2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * PURPOSE: Window classes
24 * FILE: subsys/win32k/ntuser/wndproc.c
25 * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
27 * 06-06-2001 CSH Created
30 /* INCLUDES ******************************************************************/
32 #include <ddk/ntddk.h>
33 #include <win32k/win32k.h>
34 #include <win32k/userobj.h>
35 #include <include/class.h>
36 #include <include/error.h>
37 #include <include/winsta.h>
38 #include <include/window.h>
39 #include <include/msgqueue.h>
40 #include <user32/callback.h>
41 #include <include/callback.h>
46 /* FUNCTIONS *****************************************************************/
49 IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
52 ULONG_PTR CompletionCallbackContext,
55 SENDASYNCPROC_CALLBACK_ARGUMENTS Arguments;
58 Arguments.Callback = CompletionCallback;
61 Arguments.Context = CompletionCallbackContext;
62 Arguments.Result = Result;
63 Status = NtW32Call(USER32_CALLBACK_SENDASYNCPROC,
65 sizeof(SENDASYNCPROC_CALLBACK_ARGUMENTS),
68 if (!NT_SUCCESS(Status))
76 IntSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect,
77 NCCALCSIZE_PARAMS* Params)
79 SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS Arguments;
80 SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT Result;
86 Arguments.Validate = Validate;
89 Arguments.Rect = *Rect;
93 Arguments.Params = *Params;
95 ResultPointer = &Result;
96 ResultLength = sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT);
97 Status = NtW32Call(USER32_CALLBACK_SENDNCCALCSIZE,
99 sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS),
102 if (!NT_SUCCESS(Status))
112 *Params = Result.Params;
114 return(Result.Result);
118 IntSendCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct)
120 SENDCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments;
127 Arguments.CreateStruct = *CreateStruct;
128 ResultPointer = &Result;
129 ResultLength = sizeof(LRESULT);
130 Status = NtW32Call(USER32_CALLBACK_SENDCREATE,
132 sizeof(SENDCREATEMESSAGE_CALLBACK_ARGUMENTS),
135 if (!NT_SUCCESS(Status))
143 IntSendNCCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct)
145 SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments;
152 Arguments.CreateStruct = *CreateStruct;
153 ResultPointer = &Result;
154 ResultLength = sizeof(LRESULT);
155 Status = NtW32Call(USER32_CALLBACK_SENDNCCREATE,
157 sizeof(SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS),
160 if (!NT_SUCCESS(Status))
168 IntCallWindowProc(WNDPROC Proc,
174 WINDOWPROC_CALLBACK_ARGUMENTS Arguments;
179 PWINDOW_OBJECT WindowObject = IntGetWindowObject(Wnd);
181 if (IntIsDesktopWindow(WindowObject))
183 IntReleaseWindowObject(WindowObject);
184 return(IntDesktopWindowProc(Wnd, Message, wParam, lParam));
186 IntReleaseWindowObject(WindowObject);
188 Arguments.Proc = Proc;
190 Arguments.Msg = Message;
191 Arguments.wParam = wParam;
192 Arguments.lParam = lParam;
193 ResultPointer = &Result;
194 ResultLength = sizeof(LRESULT);
195 Status = NtW32Call(USER32_CALLBACK_WINDOWPROC,
197 sizeof(WINDOWPROC_CALLBACK_ARGUMENTS),
200 if (!NT_SUCCESS(Status))
208 IntSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo)
210 SENDGETMINMAXINFO_CALLBACK_ARGUMENTS Arguments;
211 SENDGETMINMAXINFO_CALLBACK_RESULT Result;
217 Arguments.MinMaxInfo = *MinMaxInfo;
218 ResultPointer = &Result;
219 ResultLength = sizeof(Result);
220 Status = NtW32Call(USER32_CALLBACK_SENDGETMINMAXINFO,
222 sizeof(SENDGETMINMAXINFO_CALLBACK_ARGUMENTS),
225 if (!NT_SUCCESS(Status))
229 return(Result.Result);
233 IntSendWINDOWPOSCHANGINGMessage(HWND Wnd, WINDOWPOS* WindowPos)
235 SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS Arguments;
242 Arguments.WindowPos = *WindowPos;
243 ResultPointer = &Result;
244 ResultLength = sizeof(LRESULT);
245 Status = NtW32Call(USER32_CALLBACK_SENDWINDOWPOSCHANGING,
247 sizeof(SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS),
250 if (!NT_SUCCESS(Status))
258 IntSendWINDOWPOSCHANGEDMessage(HWND Wnd, WINDOWPOS* WindowPos)
260 SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS Arguments;
267 Arguments.WindowPos = *WindowPos;
268 ResultPointer = &Result;
269 ResultLength = sizeof(LRESULT);
270 Status = NtW32Call(USER32_CALLBACK_SENDWINDOWPOSCHANGED,
272 sizeof(SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS),
275 if (!NT_SUCCESS(Status))
283 IntSendSTYLECHANGINGMessage(HWND Wnd, DWORD WhichStyle, STYLESTRUCT* Style)
285 SENDSTYLECHANGING_CALLBACK_ARGUMENTS Arguments;
292 Arguments.Style = *Style;
293 Arguments.WhichStyle = WhichStyle;
294 ResultPointer = &Result;
295 ResultLength = sizeof(LRESULT);
296 Status = NtW32Call(USER32_CALLBACK_SENDSTYLECHANGING,
298 sizeof(SENDSTYLECHANGING_CALLBACK_ARGUMENTS),
301 if (!NT_SUCCESS(Status))
305 *Style = Arguments.Style;
310 IntSendSTYLECHANGEDMessage(HWND Wnd, DWORD WhichStyle, STYLESTRUCT* Style)
312 SENDSTYLECHANGED_CALLBACK_ARGUMENTS Arguments;
319 Arguments.Style = *Style;
320 Arguments.WhichStyle = WhichStyle;
321 ResultPointer = &Result;
322 ResultLength = sizeof(LRESULT);
323 Status = NtW32Call(USER32_CALLBACK_SENDSTYLECHANGED,
325 sizeof(SENDSTYLECHANGED_CALLBACK_ARGUMENTS),
328 if (!NT_SUCCESS(Status))
336 IntCallTrampolineWindowProc(WNDPROC Proc,
345 return IntSendNCCREATEMessage(Wnd, (CREATESTRUCTW*)lParam);
348 return IntSendCREATEMessage(Wnd, (CREATESTRUCTW*)lParam);
350 case WM_GETMINMAXINFO:
351 return IntSendGETMINMAXINFOMessage(Wnd, (MINMAXINFO*)lParam);
357 return IntSendNCCALCSIZEMessage(Wnd, TRUE, NULL,
358 (NCCALCSIZE_PARAMS*)lParam);
362 return IntSendNCCALCSIZEMessage(Wnd, FALSE, (RECT*)lParam, NULL);
366 case WM_WINDOWPOSCHANGING:
367 return IntSendWINDOWPOSCHANGINGMessage(Wnd, (WINDOWPOS*) lParam);
369 case WM_WINDOWPOSCHANGED:
370 return IntSendWINDOWPOSCHANGEDMessage(Wnd, (WINDOWPOS*) lParam);
372 case WM_STYLECHANGING:
373 return IntSendSTYLECHANGINGMessage(Wnd, wParam, (STYLESTRUCT*) lParam);
375 case WM_STYLECHANGED:
376 return IntSendSTYLECHANGEDMessage(Wnd, wParam, (STYLESTRUCT*) lParam);
379 return(IntCallWindowProc(Proc, Wnd, Message, wParam, lParam));
384 IntLoadSysMenuTemplate()
391 ResultPointer = &Result;
392 ResultLength = sizeof(LRESULT);
393 Status = NtW32Call(USER32_CALLBACK_LOADSYSMENUTEMPLATE,
398 if (!NT_SUCCESS(Status))
402 return (HMENU)Result;
406 IntLoadDefaultCursors()
413 ResultPointer = &Result;
414 ResultLength = sizeof(LRESULT);
415 Status = NtW32Call(USER32_CALLBACK_LOADDEFAULTCURSORS,
420 if (!NT_SUCCESS(Status))