xref: /reactos/win32ss/include/callback.h (revision de5c4720)
1 /*
2  * PROJECT:     ReactOS Kernel
3  * LICENSE:     LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4  * PURPOSE:     Defining kernel-to-user32 callbacks
5  * COPYRIGHT:   Copyright 2018 James Tabor <james.tabor@reactos.org>
6  *              Copyright 2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
7  */
8 
9 #pragma once
10 
11 #define DEFINE_USER32_CALLBACK(id, value, fn) id,
12 
13 typedef enum _USER32_CALLBACK
14 {
15 #include "u32cb.h"
16     USER32_CALLBACK_COUNT
17 } USER32_CALLBACK;
18 
19 #undef DEFINE_USER32_CALLBACK
20 
21 typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
22 {
23   WNDPROC Proc;
24   BOOL IsAnsiProc;
25   HWND Wnd;
26   UINT Msg;
27   WPARAM wParam;
28   LPARAM lParam;
29   INT lParamBufferSize;
30   LRESULT Result;
31   /* char Buffer[]; */
32 } WINDOWPROC_CALLBACK_ARGUMENTS, *PWINDOWPROC_CALLBACK_ARGUMENTS;
33 
34 typedef struct _SENDASYNCPROC_CALLBACK_ARGUMENTS
35 {
36   SENDASYNCPROC Callback;
37   HWND Wnd;
38   UINT Msg;
39   ULONG_PTR Context;
40   LRESULT Result;
41 } SENDASYNCPROC_CALLBACK_ARGUMENTS, *PSENDASYNCPROC_CALLBACK_ARGUMENTS;
42 
43 typedef struct _CALL_BACK_INFO
44 {
45    SENDASYNCPROC CallBack;
46    ULONG_PTR Context;
47 } CALL_BACK_INFO, * PCALL_BACK_INFO;
48 
49 
50 typedef struct _HOOKPROC_CALLBACK_ARGUMENTS
51 {
52   INT HookId;
53   INT Code;
54   WPARAM wParam;
55   LPARAM lParam;
56   HOOKPROC Proc;
57   INT Mod;
58   ULONG_PTR offPfn;
59   BOOLEAN Ansi;
60   LRESULT Result;
61   UINT lParamSize;
62   WCHAR ModuleName[512];
63 } HOOKPROC_CALLBACK_ARGUMENTS, *PHOOKPROC_CALLBACK_ARGUMENTS;
64 
65 typedef struct _HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS
66 {
67   CREATESTRUCTW Cs; /* lpszName and lpszClass replaced by offsets */
68   HWND WndInsertAfter;
69   /* WCHAR szName[] */
70   /* WCHAR szClass[] */
71 } HOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS, *PHOOKPROC_CBT_CREATEWND_EXTRA_ARGUMENTS;
72 
73 typedef struct tagCWP_Struct
74 {
75    HOOKPROC_CALLBACK_ARGUMENTS hpca;
76    CWPSTRUCT cwps;
77    PBYTE Extra[4];
78 } CWP_Struct, *PCWP_Struct;
79 
80 typedef struct tagCWPR_Struct
81 {
82    HOOKPROC_CALLBACK_ARGUMENTS hpca;
83    CWPRETSTRUCT cwprs;
84    PBYTE Extra[4];
85 } CWPR_Struct, *PCWPR_Struct;
86 
87 typedef struct _EVENTPROC_CALLBACK_ARGUMENTS
88 {
89   HWINEVENTHOOK hook;
90   DWORD event;
91   HWND hwnd;
92   LONG idObject;
93   LONG idChild;
94   DWORD dwEventThread;
95   DWORD dwmsEventTime;
96   WINEVENTPROC Proc;
97   INT_PTR Mod;
98   ULONG_PTR offPfn;
99 } EVENTPROC_CALLBACK_ARGUMENTS, *PEVENTPROC_CALLBACK_ARGUMENTS;
100 
101 typedef struct _LOADMENU_CALLBACK_ARGUMENTS
102 {
103   HINSTANCE hModule;
104   LPCWSTR InterSource;
105   WCHAR MenuName[1];
106 } LOADMENU_CALLBACK_ARGUMENTS, *PLOADMENU_CALLBACK_ARGUMENTS;
107 
108 typedef struct _COPYIMAGE_CALLBACK_ARGUMENTS
109 {
110   HANDLE hImage;
111   UINT uType;
112   int cxDesired;
113   int cyDesired;
114   UINT fuFlags;
115 } COPYIMAGE_CALLBACK_ARGUMENTS, *PCOPYIMAGE_CALLBACK_ARGUMENTS;
116 
117 typedef struct _CLIENT_LOAD_LIBRARY_ARGUMENTS
118 {
119     UNICODE_STRING strLibraryName;
120     UNICODE_STRING strInitFuncName;
121     BOOL Unload;
122     BOOL ApiHook;
123 } CLIENT_LOAD_LIBRARY_ARGUMENTS, *PCLIENT_LOAD_LIBRARY_ARGUMENTS;
124 
125 typedef struct _GET_CHARSET_INFO
126 {
127     LCID Locale;
128     CHARSETINFO Cs;
129 } GET_CHARSET_INFO, *PGET_CHARSET_INFO;
130 
131 typedef struct _SETWNDICONS_CALLBACK_ARGUMENTS
132 {
133     HICON hIconSample;
134     HICON hIconHand;
135     HICON hIconQuestion;
136     HICON hIconBang;
137     HICON hIconNote;
138     HICON hIconWindows;
139     HICON hIconSmWindows;
140 } SETWNDICONS_CALLBACK_ARGUMENTS, *PSETWNDICONS_CALLBACK_ARGUMENTS;
141 
142 typedef struct _DDEPOSTGET_CALLBACK_ARGUMENTS
143 {
144     INT Type;
145     MSG;
146     int size;
147     PVOID pvData;
148     BYTE buffer[1];
149 } DDEPOSTGET_CALLBACK_ARGUMENTS, *PDDEPOSTGET_CALLBACK_ARGUMENTS;
150 
151 typedef struct _SETOBM_CALLBACK_ARGUMENTS
152 {
153     struct tagOEMBITMAPINFO oembmi[93];
154 } SETOBM_CALLBACK_ARGUMENTS, *PSETOBM_CALLBACK_ARGUMENTS;
155 
156 typedef struct _LPK_CALLBACK_ARGUMENTS
157 {
158     LPWSTR lpString;
159     HDC hdc;
160     INT x;
161     INT y;
162     UINT flags;
163     RECT rect;
164     UINT count;
165     BOOL bRect;
166 } LPK_CALLBACK_ARGUMENTS, *PLPK_CALLBACK_ARGUMENTS;
167 
168 typedef struct _IMMPROCESSKEY_CALLBACK_ARGUMENTS
169 {
170     HWND    hWnd;
171     HKL     hKL;
172     UINT    vKey;
173     LPARAM  lParam;
174     DWORD   dwHotKeyID;
175 } IMMPROCESSKEY_CALLBACK_ARGUMENTS, *PIMMPROCESSKEY_CALLBACK_ARGUMENTS;
176 
177 typedef struct _IMMLOADLAYOUT_CALLBACK_ARGUMENTS
178 {
179     HKL hKL;
180 } IMMLOADLAYOUT_CALLBACK_ARGUMENTS, *PIMMLOADLAYOUT_CALLBACK_ARGUMENTS;
181 
182 typedef struct _IMMLOADLAYOUT_CALLBACK_OUTPUT
183 {
184     BOOL ret;
185     IMEINFOEX iiex;
186 } IMMLOADLAYOUT_CALLBACK_OUTPUT, *PIMMLOADLAYOUT_CALLBACK_OUTPUT;
187 
188 NTSTATUS WINAPI
189 User32CallCopyImageFromKernel(PVOID Arguments, ULONG ArgumentLength);
190 NTSTATUS WINAPI
191 User32CallSetWndIconsFromKernel(PVOID Arguments, ULONG ArgumentLength);
192 NTSTATUS WINAPI
193 User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
194 NTSTATUS WINAPI
195 User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength);
196 NTSTATUS WINAPI
197 User32LoadSysMenuTemplateForKernel(PVOID Arguments, ULONG ArgumentLength);
198 NTSTATUS WINAPI
199 User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength);
200 NTSTATUS WINAPI
201 User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
202 NTSTATUS WINAPI
203 User32CallEventProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
204 NTSTATUS WINAPI
205 User32CallLoadMenuFromKernel(PVOID Arguments, ULONG ArgumentLength);
206 NTSTATUS WINAPI
207 User32CallClientThreadSetupFromKernel(PVOID Arguments, ULONG ArgumentLength);
208 NTSTATUS WINAPI
209 User32CallClientLoadLibraryFromKernel(PVOID Arguments, ULONG ArgumentLength);
210 NTSTATUS WINAPI
211 User32CallGetCharsetInfo(PVOID Arguments, ULONG ArgumentLength);
212 NTSTATUS WINAPI
213 User32DeliverUserAPC(PVOID Arguments, ULONG ArgumentLength);
214 NTSTATUS WINAPI
215 User32CallDDEPostFromKernel(PVOID Arguments, ULONG ArgumentLength);
216 NTSTATUS WINAPI
217 User32CallDDEGetFromKernel(PVOID Arguments, ULONG ArgumentLength);
218 NTSTATUS WINAPI
219 User32CallOBMFromKernel(PVOID Arguments, ULONG ArgumentLength);
220 NTSTATUS WINAPI
221 User32CallLPKFromKernel(PVOID Arguments, ULONG ArgumentLength);
222 NTSTATUS WINAPI
223 User32CallUMPDFromKernel(PVOID Arguments, ULONG ArgumentLength);
224 NTSTATUS WINAPI
225 User32CallImmProcessKeyFromKernel(PVOID Arguments, ULONG ArgumentLength);
226 NTSTATUS WINAPI
227 User32CallImmLoadLayoutFromKernel(PVOID Arguments, ULONG ArgumentLength);
228