diff --git a/reactos/include/user32/callback.h b/reactos/include/user32/callback.h index 9bc1eca7784..a3d63400409 100644 --- a/reactos/include/user32/callback.h +++ b/reactos/include/user32/callback.h @@ -3,26 +3,22 @@ #define USER32_CALLBACK_WINDOWPROC (0) #define USER32_CALLBACK_SENDASYNCPROC (1) -#define USER32_CALLBACK_SENDNCCREATE (2) -#define USER32_CALLBACK_SENDNCCALCSIZE (3) -#define USER32_CALLBACK_SENDCREATE (4) -#define USER32_CALLBACK_SENDGETMINMAXINFO (5) -#define USER32_CALLBACK_SENDWINDOWPOSCHANGING (6) -#define USER32_CALLBACK_SENDWINDOWPOSCHANGED (7) -#define USER32_CALLBACK_SENDSTYLECHANGING (8) -#define USER32_CALLBACK_SENDSTYLECHANGED (9) -#define USER32_CALLBACK_LOADSYSMENUTEMPLATE (10) -#define USER32_CALLBACK_LOADDEFAULTCURSORS (11) -#define USER32_CALLBACK_HOOKPROC (12) -#define USER32_CALLBACK_MAXIMUM (12) +#define USER32_CALLBACK_LOADSYSMENUTEMPLATE (2) +#define USER32_CALLBACK_LOADDEFAULTCURSORS (3) +#define USER32_CALLBACK_HOOKPROC (4) +#define USER32_CALLBACK_MAXIMUM (4) typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS { WNDPROC Proc; + BOOL IsAnsiProc; HWND Wnd; UINT Msg; WPARAM wParam; LPARAM lParam; + INT lParamBufferSize; + LRESULT Result; + /* char Buffer[]; */ } WINDOWPROC_CALLBACK_ARGUMENTS, *PWINDOWPROC_CALLBACK_ARGUMENTS; typedef struct _SENDASYNCPROC_CALLBACK_ARGUMENTS @@ -34,74 +30,6 @@ typedef struct _SENDASYNCPROC_CALLBACK_ARGUMENTS LRESULT Result; } SENDASYNCPROC_CALLBACK_ARGUMENTS, *PSENDASYNCPROC_CALLBACK_ARGUMENTS; -typedef struct _SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS -{ - HWND Wnd; - CREATESTRUCTW CreateStruct; -} SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS, - *PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS; - -typedef struct _SENDCREATEMESSAGE_CALLBACK_ARGUMENTS -{ - HWND Wnd; - CREATESTRUCTW CreateStruct; -} SENDCREATEMESSAGE_CALLBACK_ARGUMENTS, *PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS; - -typedef struct _SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS -{ - HWND Wnd; - BOOL Validate; - RECT Rect; - NCCALCSIZE_PARAMS Params; -} SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS, - *PSENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS; - -typedef struct _SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT -{ - LRESULT Result; - RECT Rect; - NCCALCSIZE_PARAMS Params; -} SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT, - *PSENDNCCALCSIZEMESSAGE_CALLBACK_RESULT; - -typedef struct _SENDGETMINMAXINFO_CALLBACK_ARGUMENTS -{ - HWND Wnd; - MINMAXINFO MinMaxInfo; -} SENDGETMINMAXINFO_CALLBACK_ARGUMENTS, *PSENDGETMINMAXINFO_CALLBACK_ARGUMENTS; - -typedef struct _SENDGETMINMAXINFO_CALLBACK_RESULT -{ - LRESULT Result; - MINMAXINFO MinMaxInfo; -} SENDGETMINMAXINFO_CALLBACK_RESULT, *PSENDGETMINMAXINFO_CALLBACK_RESULT; - -typedef struct _SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS -{ - HWND Wnd; - WINDOWPOS WindowPos; -} SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS, *PSENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS; - -typedef struct _SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS -{ - HWND Wnd; - WINDOWPOS WindowPos; -} SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS, *PSENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS; - -typedef struct _SENDSTYLECHANGING_CALLBACK_ARGUMENTS -{ - HWND Wnd; - STYLESTRUCT Style; - DWORD WhichStyle; -} SENDSTYLECHANGING_CALLBACK_ARGUMENTS, *PSENDSTYLECHANGING_CALLBACK_ARGUMENTS; - -typedef struct _SENDSTYLECHANGED_CALLBACK_ARGUMENTS -{ - HWND Wnd; - STYLESTRUCT Style; - DWORD WhichStyle; -} SENDSTYLECHANGED_CALLBACK_ARGUMENTS, *PSENDSTYLECHANGED_CALLBACK_ARGUMENTS; - typedef struct _HOOKPROC_CALLBACK_ARGUMENTS { INT HookId; @@ -127,22 +55,6 @@ User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength); NTSTATUS STDCALL User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength); NTSTATUS STDCALL -User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength); -NTSTATUS STDCALL -User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength); -NTSTATUS STDCALL -User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength); -NTSTATUS STDCALL -User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength); -NTSTATUS STDCALL -User32SendWINDOWPOSCHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength); -NTSTATUS STDCALL -User32SendWINDOWPOSCHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength); -NTSTATUS STDCALL -User32SendSTYLECHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength); -NTSTATUS STDCALL -User32SendSTYLECHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength); -NTSTATUS STDCALL User32LoadSysMenuTemplateForKernel(PVOID Arguments, ULONG ArgumentLength); NTSTATUS STDCALL User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength); diff --git a/reactos/lib/user32/include/window.h b/reactos/lib/user32/include/window.h index b10bbe8fc8b..bed44dfcd44 100644 --- a/reactos/lib/user32/include/window.h +++ b/reactos/lib/user32/include/window.h @@ -21,3 +21,6 @@ UserGetFrameSize(ULONG Style, ULONG ExStyle, SIZE *Size); DWORD SCROLL_HitTest( HWND hwnd, INT nBar, POINT pt, BOOL bDragging ); +LRESULT FASTCALL IntCallWindowProcW(BOOL IsAnsiProc, WNDPROC WndProc, + HWND hWnd, UINT Msg, WPARAM wParam, + LPARAM lParam); diff --git a/reactos/lib/user32/misc/dllmain.c b/reactos/lib/user32/misc/dllmain.c index e3f2dabb17a..522abcdc69d 100644 --- a/reactos/lib/user32/misc/dllmain.c +++ b/reactos/lib/user32/misc/dllmain.c @@ -58,22 +58,6 @@ Init(VOID) (PVOID)User32CallWindowProcFromKernel; NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDASYNCPROC] = (PVOID)User32CallSendAsyncProcForKernel; - NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDNCCREATE] = - (PVOID)User32SendNCCREATEMessageForKernel; - NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDCREATE] = - (PVOID)User32SendCREATEMessageForKernel; - NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDGETMINMAXINFO] = - (PVOID)User32SendGETMINMAXINFOMessageForKernel; - NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDNCCALCSIZE] = - (PVOID)User32SendNCCALCSIZEMessageForKernel; - NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDWINDOWPOSCHANGING] = - (PVOID)User32SendWINDOWPOSCHANGINGMessageForKernel; - NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDWINDOWPOSCHANGED] = - (PVOID)User32SendWINDOWPOSCHANGEDMessageForKernel; - NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDSTYLECHANGING] = - (PVOID)User32SendSTYLECHANGINGMessageForKernel; - NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDSTYLECHANGED] = - (PVOID)User32SendSTYLECHANGEDMessageForKernel; NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_LOADSYSMENUTEMPLATE] = (PVOID)User32LoadSysMenuTemplateForKernel; NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_LOADDEFAULTCURSORS] = diff --git a/reactos/lib/user32/windows/message.c b/reactos/lib/user32/windows/message.c index e52b0185bf2..8e5dcea4e3c 100644 --- a/reactos/lib/user32/windows/message.c +++ b/reactos/lib/user32/windows/message.c @@ -1,4 +1,4 @@ -/* $Id: message.c,v 1.31 2003/12/19 19:30:05 weiden Exp $ +/* $Id: message.c,v 1.32 2003/12/26 22:52:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -399,7 +399,7 @@ User32FreeAsciiConvertedMessage(UINT Msg, WPARAM wParam, LPARAM lParam) } } -STATIC LRESULT FASTCALL +LRESULT FASTCALL IntCallWindowProcW(BOOL IsAnsiProc, WNDPROC WndProc, HWND hWnd, diff --git a/reactos/lib/user32/windows/window.c b/reactos/lib/user32/windows/window.c index 95f97334486..6f164ea1648 100644 --- a/reactos/lib/user32/windows/window.c +++ b/reactos/lib/user32/windows/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.92 2003/12/22 11:37:32 navaraf Exp $ +/* $Id: window.c,v 1.93 2003/12/26 22:52:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -26,210 +26,6 @@ static BOOL ControlsInitialized = FALSE; /* FUNCTIONS *****************************************************************/ -NTSTATUS STDCALL -User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength) -{ - PSENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs; - SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT Result; - WNDPROC Proc; - - DPRINT("User32SendNCCALCSIZEMessageForKernel.\n"); - CallbackArgs = (PSENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS)Arguments; - if (ArgumentLength != sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS)) - { - DPRINT("Wrong length.\n"); - return(STATUS_INFO_LENGTH_MISMATCH); - } - Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE); - DPRINT("Proc %X\n", Proc); - /* Call the window procedure; notice kernel messages are always unicode. */ - if (CallbackArgs->Validate) - { - Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCALCSIZE, - TRUE, - (LPARAM)&CallbackArgs->Params); - Result.Params = CallbackArgs->Params; - } - else - { - Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCALCSIZE, - FALSE, (LPARAM)&CallbackArgs->Rect); - Result.Rect = CallbackArgs->Rect; - } - DPRINT("Returning result %d.\n", Result); - return(ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS)); -} - - -NTSTATUS STDCALL -User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength) -{ - PSENDGETMINMAXINFO_CALLBACK_ARGUMENTS CallbackArgs; - SENDGETMINMAXINFO_CALLBACK_RESULT Result; - WNDPROC Proc; - - DPRINT("User32SendGETMINAXINFOMessageForKernel.\n"); - CallbackArgs = (PSENDGETMINMAXINFO_CALLBACK_ARGUMENTS)Arguments; - if (ArgumentLength != sizeof(SENDGETMINMAXINFO_CALLBACK_ARGUMENTS)) - { - DPRINT("Wrong length.\n"); - return(STATUS_INFO_LENGTH_MISMATCH); - } - Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE); - DPRINT("Proc %X\n", Proc); - /* Call the window procedure; notice kernel messages are always unicode. */ - Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_GETMINMAXINFO, - 0, (LPARAM)&CallbackArgs->MinMaxInfo); - Result.MinMaxInfo = CallbackArgs->MinMaxInfo; - DPRINT("Returning result %d.\n", Result); - return(ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS)); -} - - -NTSTATUS STDCALL -User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength) -{ - PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs; - WNDPROC Proc; - LRESULT Result; - - DPRINT("User32SendCREATEMessageForKernel.\n"); - CallbackArgs = (PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS)Arguments; - if (ArgumentLength != sizeof(SENDCREATEMESSAGE_CALLBACK_ARGUMENTS)) - { - DPRINT("Wrong length.\n"); - return(STATUS_INFO_LENGTH_MISMATCH); - } - Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE); - DPRINT("Proc %X\n", Proc); - /* Call the window procedure; notice kernel messages are always unicode. */ - Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0, - (LPARAM)&CallbackArgs->CreateStruct); - DPRINT("Returning result %d.\n", Result); - return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS)); -} - - -NTSTATUS STDCALL -User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength) -{ - PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs; - WNDPROC Proc; - LRESULT Result; - - DPRINT("User32SendNCCREATEMessageForKernel.\n"); - CallbackArgs = (PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS)Arguments; - if (ArgumentLength != sizeof(SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS)) - { - DPRINT("Wrong length.\n"); - return(STATUS_INFO_LENGTH_MISMATCH); - } - Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE); - DPRINT("Proc %X\n", Proc); - /* Call the window procedure; notice kernel messages are always unicode. */ - Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0, - (LPARAM)&CallbackArgs->CreateStruct); - DPRINT("Returning result %d.\n", Result); - return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS)); -} - - -NTSTATUS STDCALL -User32SendWINDOWPOSCHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength) -{ - PSENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS CallbackArgs; - WNDPROC Proc; - LRESULT Result; - - DPRINT("User32SendWINDOWPOSCHANGINGMessageForKernel.\n"); - CallbackArgs = (PSENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS)Arguments; - if (ArgumentLength != sizeof(SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS)) - { - DPRINT("Wrong length.\n"); - return(STATUS_INFO_LENGTH_MISMATCH); - } - Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE); - DPRINT("Proc %X\n", Proc); - /* Call the window procedure; notice kernel messages are always unicode. */ - Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_WINDOWPOSCHANGING, 0, - (LPARAM)&CallbackArgs->WindowPos); - DPRINT("Returning result %d.\n", Result); - return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS)); -} - - -NTSTATUS STDCALL -User32SendWINDOWPOSCHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength) -{ - PSENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS CallbackArgs; - WNDPROC Proc; - LRESULT Result; - - DPRINT("User32SendWINDOWPOSCHANGEDMessageForKernel.\n"); - CallbackArgs = (PSENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS)Arguments; - if (ArgumentLength != sizeof(SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS)) - { - DPRINT("Wrong length.\n"); - return(STATUS_INFO_LENGTH_MISMATCH); - } - Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE); - DPRINT("Proc %X\n", Proc); - /* Call the window procedure; notice kernel messages are always unicode. */ - Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_WINDOWPOSCHANGED, 0, - (LPARAM)&CallbackArgs->WindowPos); - DPRINT("Returning result %d.\n", Result); - return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS)); -} - - -NTSTATUS STDCALL -User32SendSTYLECHANGINGMessageForKernel(PVOID Arguments, ULONG ArgumentLength) -{ - PSENDSTYLECHANGING_CALLBACK_ARGUMENTS CallbackArgs; - WNDPROC Proc; - LRESULT Result; - - DPRINT("User32SendSTYLECHANGINGMessageForKernel.\n"); - CallbackArgs = (PSENDSTYLECHANGING_CALLBACK_ARGUMENTS)Arguments; - if (ArgumentLength != sizeof(SENDSTYLECHANGING_CALLBACK_ARGUMENTS)) - { - DPRINT("Wrong length.\n"); - return(STATUS_INFO_LENGTH_MISMATCH); - } - Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE); - DPRINT("Proc %X\n", Proc); - /* Call the window procedure; notice kernel messages are always unicode. */ - Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGING, CallbackArgs->WhichStyle, - (LPARAM)&CallbackArgs->Style); - DPRINT("Returning result %d.\n", Result); - return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS)); -} - - -NTSTATUS STDCALL -User32SendSTYLECHANGEDMessageForKernel(PVOID Arguments, ULONG ArgumentLength) -{ - PSENDSTYLECHANGED_CALLBACK_ARGUMENTS CallbackArgs; - WNDPROC Proc; - LRESULT Result; - - DPRINT("User32SendSTYLECHANGEDGMessageForKernel.\n"); - CallbackArgs = (PSENDSTYLECHANGED_CALLBACK_ARGUMENTS)Arguments; - if (ArgumentLength != sizeof(SENDSTYLECHANGED_CALLBACK_ARGUMENTS)) - { - DPRINT("Wrong length.\n"); - return(STATUS_INFO_LENGTH_MISMATCH); - } - Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE); - DPRINT("Proc %X\n", Proc); - /* Call the window procedure; notice kernel messages are always unicode. */ - Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_STYLECHANGED, CallbackArgs->WhichStyle, - (LPARAM)&CallbackArgs->Style); - DPRINT("Returning result %d.\n", Result); - return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS)); -} - - NTSTATUS STDCALL User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength) { @@ -251,21 +47,46 @@ NTSTATUS STDCALL User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength) { PWINDOWPROC_CALLBACK_ARGUMENTS CallbackArgs; - LRESULT Result; + LPARAM lParam; - CallbackArgs = (PWINDOWPROC_CALLBACK_ARGUMENTS)Arguments; - if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)) + /* Make sure we don't try to access mem beyond what we were given */ + if (ArgumentLength < sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)) { - return(STATUS_INFO_LENGTH_MISMATCH); + return STATUS_INFO_LENGTH_MISMATCH; } - if (CallbackArgs->Proc == NULL) + + CallbackArgs = (PWINDOWPROC_CALLBACK_ARGUMENTS) Arguments; + /* Check if lParam is really a pointer and adjust it if it is */ + if (0 <= CallbackArgs->lParamBufferSize) { - CallbackArgs->Proc = (WNDPROC)NtUserGetWindowLong(CallbackArgs->Wnd, GWL_WNDPROC, FALSE); + if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS) + + CallbackArgs->lParamBufferSize) + { + return STATUS_INFO_LENGTH_MISMATCH; + } + lParam = (LPARAM) ((char *) CallbackArgs + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)); } - Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd, - CallbackArgs->Msg, CallbackArgs->wParam, - CallbackArgs->lParam); - return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS)); + else + { + if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)) + { + return STATUS_INFO_LENGTH_MISMATCH; + } + lParam = CallbackArgs->lParam; + } + + if (WM_NCCALCSIZE == CallbackArgs->Msg && CallbackArgs->wParam) + { + NCCALCSIZE_PARAMS *Params = (NCCALCSIZE_PARAMS *) lParam; + Params->lppos = (PWINDOWPOS) (Params + 1); + } + + + CallbackArgs->Result = IntCallWindowProcW(CallbackArgs->IsAnsiProc, CallbackArgs->Proc, + CallbackArgs->Wnd, CallbackArgs->Msg, + CallbackArgs->wParam, lParam); + + return ZwCallbackReturn(CallbackArgs, ArgumentLength, STATUS_SUCCESS); } diff --git a/reactos/subsys/win32k/include/callback.h b/reactos/subsys/win32k/include/callback.h index f0da1e46199..b0ab227baf1 100644 --- a/reactos/subsys/win32k/include/callback.h +++ b/reactos/subsys/win32k/include/callback.h @@ -3,20 +3,13 @@ LRESULT STDCALL IntCallWindowProc(WNDPROC Proc, - HWND Wnd, - UINT Message, - WPARAM wParam, - LPARAM lParam); -LRESULT STDCALL -IntCallTrampolineWindowProc(WNDPROC Proc, - HWND Wnd, - UINT Message, - WPARAM wParam, - LPARAM lParam); -LRESULT STDCALL -IntSendNCCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct); -LRESULT STDCALL -IntSendCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct); + BOOLEAN IsAnsiProc, + HWND Wnd, + UINT Message, + WPARAM wParam, + LPARAM lParam, + INT lParamBufferSize); + VOID STDCALL IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback, HWND hWnd, @@ -24,24 +17,6 @@ IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback, ULONG_PTR CompletionCallbackContext, LRESULT Result); -LRESULT STDCALL -IntSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect, - NCCALCSIZE_PARAMS* Params); - -LRESULT STDCALL -IntSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo); - -LRESULT STDCALL -IntSendWINDOWPOSCHANGINGMessage(HWND Wnd, WINDOWPOS* WindowPos); - -LRESULT STDCALL -IntSendWINDOWPOSCHANGEDMessage(HWND Wnd, WINDOWPOS* WindowPos); - -LRESULT STDCALL -IntSendSTYLECHANGINGMessage(HWND Wnd, DWORD WhichStyle, STYLESTRUCT* Style); - -LRESULT STDCALL -IntSendSTYLECHANGEDMessage(HWND Wnd, DWORD WhichStyle, STYLESTRUCT* Style); HMENU STDCALL IntLoadSysMenuTemplate(); diff --git a/reactos/subsys/win32k/include/msgqueue.h b/reactos/subsys/win32k/include/msgqueue.h index c36825a4267..d099b43f8fb 100644 --- a/reactos/subsys/win32k/include/msgqueue.h +++ b/reactos/subsys/win32k/include/msgqueue.h @@ -144,8 +144,7 @@ LRESULT STDCALL IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, - LPARAM lParam, - BOOL KernelMessage); + LPARAM lParam); VOID STDCALL MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); VOID STDCALL diff --git a/reactos/subsys/win32k/ntuser/accelerator.c b/reactos/subsys/win32k/ntuser/accelerator.c index 35c16f676bb..b55af5f3ce8 100644 --- a/reactos/subsys/win32k/ntuser/accelerator.c +++ b/reactos/subsys/win32k/ntuser/accelerator.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: accelerator.c,v 1.5 2003/12/14 11:36:42 gvg Exp $ +/* $Id: accelerator.c,v 1.6 2003/12/26 22:52:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -351,12 +351,12 @@ IntTranslateAccelerator(HWND hWnd, nPos = cmd; if(MENU_FindItem(&hSubMenu, &nPos, MF_BYCOMMAND)) { - IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hSysMenu, 0L, TRUE); + IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hSysMenu, 0L); if(hSubMenu != hSysMenu) { nPos = MENU_FindSubMenu(&hSysMenu, hSubMenu); TRACE_(accel)("hSysMenu = %p, hSubMenu = %p, nPos = %d\n", hSysMenu, hSubMenu, nPos); - IntSendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, TRUE), TRUE); + IntSendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, TRUE)); } uSysStat = GetMenuState(GetSubMenu(hSysMenu, 0), cmd, MF_BYCOMMAND); } @@ -366,12 +366,12 @@ IntTranslateAccelerator(HWND hWnd, nPos = cmd; if(MENU_FindItem(&hSubMenu, &nPos, MF_BYCOMMAND)) { - IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L, TRUE); + IntSendMessage(hWnd, WM_INITMENU, (WPARAM)hMenu, 0L); if(hSubMenu != hMenu) { nPos = MENU_FindSubMenu(&hMenu, hSubMenu); TRACE_(accel)("hMenu = %p, hSubMenu = %p, nPos = %d\n", hMenu, hSubMenu, nPos); - IntSendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, FALSE), TRUE); + IntSendMessage(hWnd, WM_INITMENUPOPUP, (WPARAM)hSubMenu, MAKELPARAM(nPos, FALSE)); } uStat = GetMenuState(hMenu, cmd, MF_BYCOMMAND); } @@ -412,12 +412,12 @@ IntTranslateAccelerator(HWND hWnd, if (mesg == WM_COMMAND) { DPRINT(", sending WM_COMMAND, wParam=%0x\n", 0x10000 | cmd); - IntSendMessage(hWnd, mesg, 0x10000 | cmd, 0L, TRUE); + IntSendMessage(hWnd, mesg, 0x10000 | cmd, 0L); } else if (mesg == WM_SYSCOMMAND) { DPRINT(", sending WM_SYSCOMMAND, wParam=%0x\n", cmd); - IntSendMessage(hWnd, mesg, cmd, 0x00010000L, TRUE); + IntSendMessage(hWnd, mesg, cmd, 0x00010000L); } else { diff --git a/reactos/subsys/win32k/ntuser/callback.c b/reactos/subsys/win32k/ntuser/callback.c index 3c41c703f6e..bfea10e9657 100644 --- a/reactos/subsys/win32k/ntuser/callback.c +++ b/reactos/subsys/win32k/ntuser/callback.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: callback.c,v 1.20 2003/12/15 19:32:32 gvg Exp $ +/* $Id: callback.c,v 1.21 2003/12/26 22:52:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -74,307 +74,75 @@ IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback, return; } -LRESULT STDCALL -IntSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect, - NCCALCSIZE_PARAMS* Params) -{ - SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS Arguments; - SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT Result; - NTSTATUS Status; - PVOID ResultPointer; - ULONG ResultLength; - - Arguments.Wnd = Wnd; - Arguments.Validate = Validate; - if (!Validate) - { - Arguments.Rect = *Rect; - } - else - { - Arguments.Params = *Params; - } - ResultPointer = &Result; - ResultLength = sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT); - Status = NtW32Call(USER32_CALLBACK_SENDNCCALCSIZE, - &Arguments, - sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS), - &ResultPointer, - &ResultLength); - if (!NT_SUCCESS(Status)) - { - return(0); - } - if (!Validate) - { - *Rect = Result.Rect; - } - else - { - *Params = Result.Params; - } - return(Result.Result); -} - -LRESULT STDCALL -IntSendCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct) -{ - SENDCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments; - LRESULT Result; - NTSTATUS Status; - PVOID ResultPointer; - ULONG ResultLength; - - Arguments.Wnd = Wnd; - Arguments.CreateStruct = *CreateStruct; - ResultPointer = &Result; - ResultLength = sizeof(LRESULT); - Status = NtW32Call(USER32_CALLBACK_SENDCREATE, - &Arguments, - sizeof(SENDCREATEMESSAGE_CALLBACK_ARGUMENTS), - &ResultPointer, - &ResultLength); - if (!NT_SUCCESS(Status)) - { - return(0); - } - return(Result); -} - -LRESULT STDCALL -IntSendNCCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct) -{ - SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments; - LRESULT Result; - NTSTATUS Status; - PVOID ResultPointer; - ULONG ResultLength; - - Arguments.Wnd = Wnd; - Arguments.CreateStruct = *CreateStruct; - ResultPointer = &Result; - ResultLength = sizeof(LRESULT); - Status = NtW32Call(USER32_CALLBACK_SENDNCCREATE, - &Arguments, - sizeof(SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS), - &ResultPointer, - &ResultLength); - if (!NT_SUCCESS(Status)) - { - return(0); - } - return(Result); -} - LRESULT STDCALL IntCallWindowProc(WNDPROC Proc, + BOOLEAN IsAnsiProc, HWND Wnd, UINT Message, WPARAM wParam, - LPARAM lParam) + LPARAM lParam, + INT lParamBufferSize) { - WINDOWPROC_CALLBACK_ARGUMENTS Arguments; - LRESULT Result; + WINDOWPROC_CALLBACK_ARGUMENTS StackArguments; + PWINDOWPROC_CALLBACK_ARGUMENTS Arguments; NTSTATUS Status; PVOID ResultPointer; ULONG ResultLength; + ULONG ArgumentLength; + LRESULT Result; - Arguments.Proc = Proc; - Arguments.Wnd = Wnd; - Arguments.Msg = Message; - Arguments.wParam = wParam; - Arguments.lParam = lParam; - ResultPointer = &Result; - ResultLength = sizeof(LRESULT); + if (0 < lParamBufferSize) + { + ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS) + lParamBufferSize; + Arguments = ExAllocatePoolWithTag(PagedPool,ArgumentLength, TAG_CALLBACK); + if (NULL == Arguments) + { + DPRINT1("Unable to allocate buffer for window proc callback\n"); + return -1; + } + RtlMoveMemory((PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)), + (PVOID) lParam, lParamBufferSize); + } + else + { + Arguments = &StackArguments; + ArgumentLength = sizeof(WINDOWPROC_CALLBACK_ARGUMENTS); + } + Arguments->Proc = Proc; + Arguments->IsAnsiProc = IsAnsiProc; + Arguments->Wnd = Wnd; + Arguments->Msg = Message; + Arguments->wParam = wParam; + Arguments->lParam = lParam; + Arguments->lParamBufferSize = lParamBufferSize; + ResultPointer = Arguments; + ResultLength = ArgumentLength; Status = NtW32Call(USER32_CALLBACK_WINDOWPROC, - &Arguments, - sizeof(WINDOWPROC_CALLBACK_ARGUMENTS), + Arguments, + ArgumentLength, &ResultPointer, &ResultLength); if (!NT_SUCCESS(Status)) { + if (0 < lParamBufferSize) + { + ExFreePool(Arguments); + } return -1; } + Result = Arguments->Result; + + if (0 < lParamBufferSize) + { + RtlMoveMemory((PVOID) lParam, + (PVOID) ((char *) Arguments + sizeof(WINDOWPROC_CALLBACK_ARGUMENTS)), + lParamBufferSize); + ExFreePool(Arguments); + } return Result; } -LRESULT STDCALL -IntSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo) -{ - SENDGETMINMAXINFO_CALLBACK_ARGUMENTS Arguments; - SENDGETMINMAXINFO_CALLBACK_RESULT Result; - NTSTATUS Status; - PVOID ResultPointer; - ULONG ResultLength; - - Arguments.Wnd = Wnd; - Arguments.MinMaxInfo = *MinMaxInfo; - ResultPointer = &Result; - ResultLength = sizeof(Result); - Status = NtW32Call(USER32_CALLBACK_SENDGETMINMAXINFO, - &Arguments, - sizeof(SENDGETMINMAXINFO_CALLBACK_ARGUMENTS), - &ResultPointer, - &ResultLength); - if (!NT_SUCCESS(Status)) - { - return(0); - } - return(Result.Result); -} - -LRESULT STDCALL -IntSendWINDOWPOSCHANGINGMessage(HWND Wnd, WINDOWPOS* WindowPos) -{ - SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS Arguments; - LRESULT Result; - NTSTATUS Status; - PVOID ResultPointer; - ULONG ResultLength; - - Arguments.Wnd = Wnd; - Arguments.WindowPos = *WindowPos; - ResultPointer = &Result; - ResultLength = sizeof(LRESULT); - Status = NtW32Call(USER32_CALLBACK_SENDWINDOWPOSCHANGING, - &Arguments, - sizeof(SENDWINDOWPOSCHANGING_CALLBACK_ARGUMENTS), - &ResultPointer, - &ResultLength); - if (!NT_SUCCESS(Status)) - { - return(0); - } - return(Result); -} - -LRESULT STDCALL -IntSendWINDOWPOSCHANGEDMessage(HWND Wnd, WINDOWPOS* WindowPos) -{ - SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS Arguments; - LRESULT Result; - NTSTATUS Status; - PVOID ResultPointer; - ULONG ResultLength; - - Arguments.Wnd = Wnd; - Arguments.WindowPos = *WindowPos; - ResultPointer = &Result; - ResultLength = sizeof(LRESULT); - Status = NtW32Call(USER32_CALLBACK_SENDWINDOWPOSCHANGED, - &Arguments, - sizeof(SENDWINDOWPOSCHANGED_CALLBACK_ARGUMENTS), - &ResultPointer, - &ResultLength); - if (!NT_SUCCESS(Status)) - { - return(0); - } - return(Result); -} - -LRESULT STDCALL -IntSendSTYLECHANGINGMessage(HWND Wnd, DWORD WhichStyle, STYLESTRUCT* Style) -{ - SENDSTYLECHANGING_CALLBACK_ARGUMENTS Arguments; - LRESULT Result; - NTSTATUS Status; - PVOID ResultPointer; - ULONG ResultLength; - - Arguments.Wnd = Wnd; - Arguments.Style = *Style; - Arguments.WhichStyle = WhichStyle; - ResultPointer = &Result; - ResultLength = sizeof(LRESULT); - Status = NtW32Call(USER32_CALLBACK_SENDSTYLECHANGING, - &Arguments, - sizeof(SENDSTYLECHANGING_CALLBACK_ARGUMENTS), - &ResultPointer, - &ResultLength); - if (!NT_SUCCESS(Status)) - { - return(0); - } - *Style = Arguments.Style; - return(Result); -} - -LRESULT STDCALL -IntSendSTYLECHANGEDMessage(HWND Wnd, DWORD WhichStyle, STYLESTRUCT* Style) -{ - SENDSTYLECHANGED_CALLBACK_ARGUMENTS Arguments; - LRESULT Result; - NTSTATUS Status; - PVOID ResultPointer; - ULONG ResultLength; - - Arguments.Wnd = Wnd; - Arguments.Style = *Style; - Arguments.WhichStyle = WhichStyle; - ResultPointer = &Result; - ResultLength = sizeof(LRESULT); - Status = NtW32Call(USER32_CALLBACK_SENDSTYLECHANGED, - &Arguments, - sizeof(SENDSTYLECHANGED_CALLBACK_ARGUMENTS), - &ResultPointer, - &ResultLength); - if (!NT_SUCCESS(Status)) - { - return(0); - } - return(Result); -} - -LRESULT STDCALL -IntCallTrampolineWindowProc(WNDPROC Proc, - HWND Wnd, - UINT Message, - WPARAM wParam, - LPARAM lParam) -{ - switch (Message) - { - case WM_NCCREATE: - return IntSendNCCREATEMessage(Wnd, (CREATESTRUCTW*)lParam); - - case WM_CREATE: - return IntSendCREATEMessage(Wnd, (CREATESTRUCTW*)lParam); - - case WM_GETMINMAXINFO: - return IntSendGETMINMAXINFOMessage(Wnd, (MINMAXINFO*)lParam); - - case WM_NCCALCSIZE: - { - if (wParam) - { - return IntSendNCCALCSIZEMessage(Wnd, TRUE, NULL, - (NCCALCSIZE_PARAMS*)lParam); - } - else - { - return IntSendNCCALCSIZEMessage(Wnd, FALSE, (RECT*)lParam, NULL); - } - } - - case WM_WINDOWPOSCHANGING: - return IntSendWINDOWPOSCHANGINGMessage(Wnd, (WINDOWPOS*) lParam); - - case WM_WINDOWPOSCHANGED: - return IntSendWINDOWPOSCHANGEDMessage(Wnd, (WINDOWPOS*) lParam); - - case WM_STYLECHANGING: - return IntSendSTYLECHANGINGMessage(Wnd, wParam, (STYLESTRUCT*) lParam); - - case WM_STYLECHANGED: - return IntSendSTYLECHANGEDMessage(Wnd, wParam, (STYLESTRUCT*) lParam); - - default: - return(IntCallWindowProc(Proc, Wnd, Message, wParam, lParam)); - } -} - HMENU STDCALL IntLoadSysMenuTemplate() { diff --git a/reactos/subsys/win32k/ntuser/caret.c b/reactos/subsys/win32k/ntuser/caret.c index 353798950fc..5993c7c95f5 100644 --- a/reactos/subsys/win32k/ntuser/caret.c +++ b/reactos/subsys/win32k/ntuser/caret.c @@ -1,4 +1,4 @@ -/* $Id: caret.c,v 1.9 2003/12/20 15:42:47 weiden Exp $ +/* $Id: caret.c,v 1.10 2003/12/26 22:52:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -33,7 +33,7 @@ IntHideCaret(PTHRDCARETINFO CaretInfo) { if(CaretInfo->hWnd && CaretInfo->Visible && CaretInfo->Showing) { - IntCallWindowProc(NULL, CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); + IntSendMessage(CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); CaretInfo->Showing = 0; return TRUE; } @@ -204,7 +204,7 @@ IntSetCaretPos(int X, int Y) ThreadQueue->CaretInfo->Showing = 0; ThreadQueue->CaretInfo->Pos.x = X; ThreadQueue->CaretInfo->Pos.y = Y; - IntCallWindowProc(NULL, ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); + IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); IntSetTimer(ThreadQueue->CaretInfo->hWnd, IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TRUE); } return TRUE; @@ -238,7 +238,7 @@ IntDrawCaret(HWND hWnd) if(ThreadQueue->CaretInfo->hWnd && ThreadQueue->CaretInfo->Visible && ThreadQueue->CaretInfo->Showing) { - IntCallWindowProc(NULL, ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); + IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); ThreadQueue->CaretInfo->Showing = 1; } } @@ -402,7 +402,7 @@ NtUserShowCaret( ThreadQueue->CaretInfo->Visible = 1; if(!ThreadQueue->CaretInfo->Showing) { - IntCallWindowProc(NULL, ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); + IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); } IntSetTimer(hWnd, IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TRUE); } diff --git a/reactos/subsys/win32k/ntuser/focus.c b/reactos/subsys/win32k/ntuser/focus.c index 6003649f7ab..dfeb7b7cdaa 100644 --- a/reactos/subsys/win32k/ntuser/focus.c +++ b/reactos/subsys/win32k/ntuser/focus.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: focus.c,v 1.5 2003/12/14 11:36:42 gvg Exp $ + * $Id: focus.c,v 1.6 2003/12/26 22:52:11 gvg Exp $ */ #include <win32k/win32k.h> @@ -56,10 +56,10 @@ IntSendDeactivateMessages(HWND hWndPrev, HWND hWnd) { if (hWndPrev) { - IntSendMessage(hWndPrev, WM_NCACTIVATE, FALSE, 0, TRUE); + IntSendMessage(hWndPrev, WM_NCACTIVATE, FALSE, 0); IntSendMessage(hWndPrev, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, NtUserGetWindowLong(hWndPrev, GWL_STYLE, FALSE) & WS_MINIMIZE), - (LPARAM)NULL, TRUE); + (LPARAM)NULL); } } @@ -69,10 +69,10 @@ IntSendActivateMessages(HWND hWndPrev, HWND hWnd) if (hWnd) { /* Send palette messages */ - if (IntSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0, TRUE)) + if (IntSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0)) { IntSendMessage(HWND_BROADCAST, WM_PALETTEISCHANGING, - (WPARAM)hWnd, 0, TRUE); + (WPARAM)hWnd, 0); } WinPosSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, @@ -80,11 +80,11 @@ IntSendActivateMessages(HWND hWndPrev, HWND hWnd) /* FIXME: IntIsWindow */ - IntSendMessage(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == NtUserGetForegroundWindow()), 0, TRUE); + IntSendMessage(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == NtUserGetForegroundWindow()), 0); /* FIXME: WA_CLICKACTIVE */ IntSendMessage(hWnd, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE), - (LPARAM)hWndPrev, TRUE); + (LPARAM)hWndPrev); } } @@ -93,7 +93,7 @@ IntSendKillFocusMessages(HWND hWndPrev, HWND hWnd) { if (hWndPrev) { - IntSendMessage(hWndPrev, WM_KILLFOCUS, (WPARAM)hWnd, 0, TRUE); + IntSendMessage(hWndPrev, WM_KILLFOCUS, (WPARAM)hWnd, 0); } } @@ -102,7 +102,7 @@ IntSendSetFocusMessages(HWND hWndPrev, HWND hWnd) { if (hWnd) { - IntSendMessage(hWnd, WM_SETFOCUS, (WPARAM)hWndPrev, 0, TRUE); + IntSendMessage(hWnd, WM_SETFOCUS, (WPARAM)hWndPrev, 0); } } @@ -326,7 +326,7 @@ NtUserSetCapture(HWND hWnd) } } hWndPrev = ThreadQueue->CaptureWindow; - IntSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd, TRUE); + IntSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd); /* ExAcquireFastMutex(&ThreadQueue->Lock);*/ ThreadQueue->CaptureWindow = hWnd; /* ExReleaseFastMutex(&ThreadQueue->Lock);*/ diff --git a/reactos/subsys/win32k/ntuser/message.c b/reactos/subsys/win32k/ntuser/message.c index 8e6268cf2cf..918bfdf7e0a 100644 --- a/reactos/subsys/win32k/ntuser/message.c +++ b/reactos/subsys/win32k/ntuser/message.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: message.c,v 1.41 2003/12/25 14:06:15 chorns Exp $ +/* $Id: message.c,v 1.42 2003/12/26 22:52:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -46,6 +46,8 @@ #define NDEBUG #include <debug.h> +#define TAG_MSG TAG('M', 'E', 'S', 'G') + /* FUNCTIONS *****************************************************************/ NTSTATUS FASTCALL @@ -86,10 +88,12 @@ NtUserDispatchMessage(CONST MSG* UnsafeMsg) /* FIXME: Check for continuing validity of timer. */ return IntCallWindowProc((WNDPROC)Msg.lParam, - Msg.hwnd, - Msg.message, - Msg.wParam, - 0 /* GetTickCount() */); + FALSE, + Msg.hwnd, + Msg.message, + Msg.wParam, + 0 /* GetTickCount() */, + -1); } } @@ -111,11 +115,26 @@ NtUserDispatchMessage(CONST MSG* UnsafeMsg) /* FIXME: Call hook procedures. */ /* Call the window procedure. */ - Result = IntCallWindowProc(WindowObject->WndProcW, - Msg.hwnd, - Msg.message, - Msg.wParam, - Msg.lParam); + if (0xFFFF0000 != ((DWORD) WindowObject->WndProcW & 0xFFFF0000)) + { + Result = IntCallWindowProc(WindowObject->WndProcW, + FALSE, + Msg.hwnd, + Msg.message, + Msg.wParam, + Msg.lParam, + -1); + } + else + { + Result = IntCallWindowProc(WindowObject->WndProcA, + TRUE, + Msg.hwnd, + Msg.message, + Msg.wParam, + Msg.lParam, + -1); + } IntReleaseWindowObject(WindowObject); @@ -134,12 +153,12 @@ IntSendSpecialMessages(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg) { case WM_MOUSEMOVE: { - IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(HTCLIENT, Msg->message), TRUE); + IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(HTCLIENT, Msg->message)); break; } case WM_NCMOUSEMOVE: { - IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(Msg->wParam, Msg->message), TRUE); + IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(Msg->wParam, Msg->message)); break; } case WM_LBUTTONDOWN: @@ -160,8 +179,8 @@ IntSendSpecialMessages(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg) wParam = (WPARAM)InputWindowStation->SystemCursor.ButtonsDown; ObDereferenceObject(InputWindowStation); - IntSendMessage(Msg->hwnd, WM_MOUSEMOVE, wParam, Msg->lParam, TRUE); - IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(HTCLIENT, Msg->message), TRUE); + IntSendMessage(Msg->hwnd, WM_MOUSEMOVE, wParam, Msg->lParam); + IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(HTCLIENT, Msg->message)); break; } case WM_NCLBUTTONDOWN: @@ -173,8 +192,8 @@ IntSendSpecialMessages(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg) case WM_NCRBUTTONDBLCLK: case WM_NCXBUTTONDBLCLK: { - IntSendMessage(Msg->hwnd, WM_NCMOUSEMOVE, (WPARAM)Msg->wParam, Msg->lParam, TRUE); - IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(Msg->wParam, Msg->message), TRUE); + IntSendMessage(Msg->hwnd, WM_NCMOUSEMOVE, (WPARAM)Msg->wParam, Msg->lParam); + IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(Msg->wParam, Msg->message)); break; } } @@ -518,16 +537,154 @@ NtUserQuerySendMessage(DWORD Unknown0) return 0; } +#define MMS_SIZE_WPARAM -1 +#define MMS_SIZE_WPARAMWCHAR -2 +#define MMS_SIZE_SPECIAL -3 +#define MMS_FLAG_READ 0x01 +#define MMS_FLAG_WRITE 0x02 +#define MMS_FLAG_READWRITE (MMS_FLAG_READ | MMS_FLAG_WRITE) +typedef struct tagMSGMEMORY + { + UINT Message; + UINT Size; + INT Flags; + } MSGMEMORY, *PMSGMEMORY; + +static MSGMEMORY MsgMemory[] = + { + { WM_CREATE, sizeof(CREATESTRUCTW), MMS_FLAG_READWRITE }, + { WM_GETMINMAXINFO, sizeof(MINMAXINFO), MMS_FLAG_READWRITE }, + { WM_GETTEXT, MMS_SIZE_WPARAMWCHAR, MMS_FLAG_WRITE }, + { WM_NCCALCSIZE, MMS_SIZE_SPECIAL, MMS_FLAG_READWRITE }, + { WM_NCCREATE, sizeof(CREATESTRUCTW), MMS_FLAG_READWRITE }, + { WM_SETTEXT, MMS_SIZE_WPARAMWCHAR, MMS_FLAG_READ }, + { WM_STYLECHANGED, sizeof(STYLESTRUCT), MMS_FLAG_READ }, + { WM_STYLECHANGING, sizeof(STYLESTRUCT), MMS_FLAG_READWRITE }, + { WM_WINDOWPOSCHANGED, sizeof(WINDOWPOS), MMS_FLAG_READ }, + { WM_WINDOWPOSCHANGING, sizeof(WINDOWPOS), MMS_FLAG_READWRITE }, + }; + +static PMSGMEMORY FASTCALL +FindMsgMemory(UINT Msg) + { + PMSGMEMORY MsgMemoryEntry; + + /* See if this message type is present in the table */ + for (MsgMemoryEntry = MsgMemory; + MsgMemoryEntry < MsgMemory + sizeof(MsgMemory) / sizeof(MSGMEMORY); + MsgMemoryEntry++) + { + if (Msg == MsgMemoryEntry->Message) + { + return MsgMemoryEntry; + } + } + + return NULL; +} + +static UINT FASTCALL +MsgMemorySize(PMSGMEMORY MsgMemoryEntry, WPARAM wParam) +{ + if (MMS_SIZE_WPARAM == MsgMemoryEntry->Size) + { + return (UINT) wParam; + } + else if (MMS_SIZE_WPARAMWCHAR == MsgMemoryEntry->Size) + { + return (UINT) (wParam * sizeof(WCHAR)); + } + else if (MMS_SIZE_SPECIAL == MsgMemoryEntry->Size) + { + switch(MsgMemoryEntry->Message) + { + case WM_NCCALCSIZE: + return wParam ? sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS) : sizeof(RECT); + break; + default: + assert(FALSE); + return 0; + break; + } + } + else + { + return MsgMemoryEntry->Size; + } +} + +static FASTCALL NTSTATUS +PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + NCCALCSIZE_PARAMS *UnpackedParams; + NCCALCSIZE_PARAMS *PackedParams; + + *lParamPacked = lParam; + if (WM_NCCALCSIZE == Msg && wParam) + { + UnpackedParams = (NCCALCSIZE_PARAMS *) lParam; + if (UnpackedParams->lppos != (PWINDOWPOS) (UnpackedParams + 1)) + { + PackedParams = ExAllocatePoolWithTag(PagedPool, + sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS), + TAG_MSG); + if (NULL == PackedParams) + { + DPRINT1("Not enough memory to pack lParam\n"); + return STATUS_NO_MEMORY; + } + RtlCopyMemory(PackedParams, UnpackedParams, sizeof(NCCALCSIZE_PARAMS)); + PackedParams->lppos = (PWINDOWPOS) (PackedParams + 1); + RtlCopyMemory(PackedParams->lppos, UnpackedParams->lppos, sizeof(WINDOWPOS)); + *lParamPacked = (LPARAM) PackedParams; + } + } + + return STATUS_SUCCESS; +} + +static FASTCALL NTSTATUS +UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + NCCALCSIZE_PARAMS *UnpackedParams; + NCCALCSIZE_PARAMS *PackedParams; + PWINDOWPOS UnpackedWindowPos; + + if (lParamPacked == lParam) + { + return STATUS_SUCCESS; + } + + if (WM_NCCALCSIZE == Msg && wParam) + { + PackedParams = (NCCALCSIZE_PARAMS *) lParamPacked; + UnpackedParams = (NCCALCSIZE_PARAMS *) lParam; + UnpackedWindowPos = UnpackedParams->lppos; + RtlCopyMemory(UnpackedParams, PackedParams, sizeof(NCCALCSIZE_PARAMS)); + UnpackedParams->lppos = UnpackedWindowPos; + RtlCopyMemory(UnpackedWindowPos, PackedParams + 1, sizeof(WINDOWPOS)); + ExFreePool((PVOID) lParamPacked); + + return STATUS_SUCCESS; + } + + assert(FALSE); + + return STATUS_INVALID_PARAMETER; +} + LRESULT STDCALL IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, - LPARAM lParam, - BOOL KernelMessage) + LPARAM lParam) { LRESULT Result; NTSTATUS Status; PWINDOW_OBJECT Window; + PMSGMEMORY MsgMemoryEntry; + INT lParamBufferSize; + LPARAM lParamPacked; /* FIXME: Check for a broadcast or topmost destination. */ @@ -544,29 +701,52 @@ IntSendMessage(HWND hWnd, if (NULL != PsGetWin32Thread() && Window->MessageQueue == PsGetWin32Thread()->MessageQueue) { - if (KernelMessage) - { - Result = IntCallTrampolineWindowProc(NULL, hWnd, Msg, wParam, - lParam); - IntReleaseWindowObject(Window); - return Result; - } + /* See if this message type is present in the table */ + MsgMemoryEntry = FindMsgMemory(Msg); + if (NULL == MsgMemoryEntry) + { + lParamBufferSize = -1; + } else - { - Result = IntCallWindowProc(Window->WndProcW, hWnd, Msg, wParam, lParam); - IntReleaseWindowObject(Window); + { + lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam); + } + + if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam))) + { + IntReleaseWindowObject(Window); + DPRINT1("Failed to pack message parameters\n"); + return -1; + } + if (0xFFFF0000 != ((DWORD) Window->WndProcW & 0xFFFF0000)) + { + Result = IntCallWindowProc(Window->WndProcW, FALSE, hWnd, Msg, wParam, + lParamPacked,lParamBufferSize); + } + else + { + Result = IntCallWindowProc(Window->WndProcA, TRUE, hWnd, Msg, wParam, + lParamPacked,lParamBufferSize); + } + if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam))) + { + IntReleaseWindowObject(Window); + DPRINT1("Failed to unpack message parameters\n"); + return Result; + } + + IntReleaseWindowObject(Window); return Result; - } } else { PUSER_SENT_MESSAGE Message; PKEVENT CompletionEvent; - CompletionEvent = ExAllocatePool(NonPagedPool, sizeof(KEVENT)); + CompletionEvent = ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_MSG); KeInitializeEvent(CompletionEvent, NotificationEvent, FALSE); - Message = ExAllocatePool(NonPagedPool, sizeof(USER_SENT_MESSAGE)); + Message = ExAllocatePoolWithTag(NonPagedPool, sizeof(USER_SENT_MESSAGE), TAG_MSG); Message->Msg.hwnd = hWnd; Message->Msg.message = Msg; Message->Msg.wParam = wParam; @@ -579,21 +759,106 @@ IntSendMessage(HWND hWnd, IntReleaseWindowObject(Window); Status = KeWaitForSingleObject(CompletionEvent, - UserRequest, - UserMode, - FALSE, - NULL); + UserRequest, + UserMode, + FALSE, + NULL); if (Status == STATUS_WAIT_0) - { - return Result; - } + { + return Result; + } else - { - return FALSE; - } + { + return FALSE; + } } } +static NTSTATUS FASTCALL +CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg) +{ + NTSTATUS Status; + PMSGMEMORY MsgMemoryEntry; + PVOID KernelMem; + UINT Size; + + *KernelModeMsg = *UserModeMsg; + + /* See if this message type is present in the table */ + MsgMemoryEntry = FindMsgMemory(UserModeMsg->message); + if (NULL == MsgMemoryEntry) + { + /* Not present, no copying needed */ + return STATUS_SUCCESS; + } + + /* Determine required size */ + Size = MsgMemorySize(MsgMemoryEntry, UserModeMsg->wParam); + + /* Allocate kernel mem */ + KernelMem = ExAllocatePoolWithTag(PagedPool, Size, TAG_MSG); + if (NULL == KernelMem) + { + DPRINT1("Not enough memory to copy message to kernel mem\n"); + return STATUS_NO_MEMORY; + } + KernelModeMsg->lParam = (LPARAM) KernelMem; + + /* Copy data if required */ + if (0 != (MsgMemoryEntry->Flags & MMS_FLAG_READ)) + { + Status = MmCopyFromCaller(KernelMem, (PVOID) UserModeMsg->lParam, Size); + if (! NT_SUCCESS(Status)) + { + DPRINT1("Failed to copy message to kernel: invalid usermode buffer\n"); + ExFreePool(KernelMem); + return Status; + } + } + else + { + /* Make sure we don't pass any secrets to usermode */ + RtlZeroMemory(KernelMem, Size); + } + + return STATUS_SUCCESS; +} + +static NTSTATUS FASTCALL +CopyMsgToUserMem(MSG *UserModeMsg, MSG *KernelModeMsg) +{ + NTSTATUS Status; + PMSGMEMORY MsgMemoryEntry; + UINT Size; + + /* See if this message type is present in the table */ + MsgMemoryEntry = FindMsgMemory(UserModeMsg->message); + if (NULL == MsgMemoryEntry) + { + /* Not present, no copying needed */ + return STATUS_SUCCESS; + } + + /* Determine required size */ + Size = MsgMemorySize(MsgMemoryEntry, UserModeMsg->wParam); + + /* Copy data if required */ + if (0 != (MsgMemoryEntry->Flags & MMS_FLAG_WRITE)) + { + Status = MmCopyToCaller((PVOID) UserModeMsg->lParam, (PVOID) KernelModeMsg->lParam, Size); + if (! NT_SUCCESS(Status)) + { + DPRINT1("Failed to copy message to kernel: invalid usermode buffer\n"); + ExFreePool((PVOID) KernelModeMsg->lParam); + return Status; + } + } + + ExFreePool((PVOID) KernelModeMsg->lParam); + + return STATUS_SUCCESS; +} + LRESULT STDCALL NtUserSendMessage(HWND Wnd, UINT Msg, @@ -605,6 +870,8 @@ NtUserSendMessage(HWND Wnd, NTSTATUS Status; PWINDOW_OBJECT Window; NTUSERSENDMESSAGEINFO Info; + MSG UserModeMsg; + MSG KernelModeMsg; /* FIXME: Check for a broadcast or topmost destination. */ @@ -652,7 +919,26 @@ NtUserSendMessage(HWND Wnd, /* Must be handled by other thread */ IntReleaseWindowObject(Window); Info.HandledByKernel = TRUE; - Result = IntSendMessage(Wnd, Msg, wParam, lParam, FALSE); + UserModeMsg.hwnd = Wnd; + UserModeMsg.message = Msg; + UserModeMsg.wParam = wParam; + UserModeMsg.lParam = lParam; + Status = CopyMsgToKernelMem(&KernelModeMsg, &UserModeMsg); + if (! NT_SUCCESS(Status)) + { + MmCopyToCaller(UnsafeInfo, &Info, sizeof(NTUSERSENDMESSAGEINFO)); + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return -1; + } + Result = IntSendMessage(KernelModeMsg.hwnd, KernelModeMsg.message, + KernelModeMsg.wParam, KernelModeMsg.lParam); + Status = CopyMsgToUserMem(&UserModeMsg, &KernelModeMsg); + if (! NT_SUCCESS(Status)) + { + MmCopyToCaller(UnsafeInfo, &Info, sizeof(NTUSERSENDMESSAGEINFO)); + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return -1; + } } Status = MmCopyToCaller(UnsafeInfo, &Info, sizeof(NTUSERSENDMESSAGEINFO)); diff --git a/reactos/subsys/win32k/ntuser/msgqueue.c b/reactos/subsys/win32k/ntuser/msgqueue.c index 9c900cdf8a6..cdb0f7417cf 100644 --- a/reactos/subsys/win32k/ntuser/msgqueue.c +++ b/reactos/subsys/win32k/ntuser/msgqueue.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: msgqueue.c,v 1.57 2003/12/25 12:26:35 navaraf Exp $ +/* $Id: msgqueue.c,v 1.58 2003/12/26 22:52:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -266,7 +266,7 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh, if(Window) { - Result = IntSendMessage(Wnd, WM_MOUSEACTIVATE, (WPARAM)NtUserGetParent(Window->Self), (LPARAM)SpareLParam, TRUE); + Result = IntSendMessage(Wnd, WM_MOUSEACTIVATE, (WPARAM)NtUserGetParent(Window->Self), (LPARAM)SpareLParam); IntReleaseWindowObject(Window); switch (Result) @@ -735,8 +735,7 @@ MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue) Result = IntSendMessage(Message->Msg.hwnd, Message->Msg.message, Message->Msg.wParam, - Message->Msg.lParam, - TRUE); + Message->Msg.lParam); /* Let the sender know the result. */ if (Message->Result != NULL) diff --git a/reactos/subsys/win32k/ntuser/painting.c b/reactos/subsys/win32k/ntuser/painting.c index 151172f8405..b9aa5455b14 100644 --- a/reactos/subsys/win32k/ntuser/painting.c +++ b/reactos/subsys/win32k/ntuser/painting.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: painting.c,v 1.52 2003/12/23 21:33:25 weiden Exp $ + * $Id: painting.c,v 1.53 2003/12/26 22:52:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -159,7 +159,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags) { if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT) { - IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)IntGetNCUpdateRegion(Window, TRUE), 0, TRUE); + IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)IntGetNCUpdateRegion(Window, TRUE), 0); } if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND) @@ -170,7 +170,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags) DCX_INTERSECTUPDATE); if (hDC != NULL) { - if (IntSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0, TRUE)) + if (IntSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0)) { Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND; } @@ -184,7 +184,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags) if (Window->UpdateRegion != NULL || Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) { - IntSendMessage(hWnd, WM_PAINT, 0, 0, TRUE); + IntSendMessage(hWnd, WM_PAINT, 0, 0); if (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) { Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT; @@ -774,7 +774,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs) if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND) { Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND; - lPs->fErase = !IntSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)lPs->hdc, 0, TRUE); + lPs->fErase = !IntSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)lPs->hdc, 0); } else { diff --git a/reactos/subsys/win32k/ntuser/scrollbar.c b/reactos/subsys/win32k/ntuser/scrollbar.c index 8fdd4efd360..4a8e6661c0a 100644 --- a/reactos/subsys/win32k/ntuser/scrollbar.c +++ b/reactos/subsys/win32k/ntuser/scrollbar.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: scrollbar.c,v 1.22 2003/12/23 08:48:59 navaraf Exp $ +/* $Id: scrollbar.c,v 1.23 2003/12/26 22:52:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -582,7 +582,7 @@ IntSetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedr } if (bRedraw) - IntSendMessage(Window->Self, WM_NCPAINT, 1, 0, TRUE); + IntSendMessage(Window->Self, WM_NCPAINT, 1, 0); /* Return current position */ return Info->nPos; diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 8e81b62fb0c..9498743510c 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: window.c,v 1.173 2003/12/23 18:12:38 weiden Exp $ +/* $Id: window.c,v 1.174 2003/12/26 22:52:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -265,7 +265,7 @@ static void IntSendDestroyMsg(HWND Wnd) /* * Send the WM_DESTROY to the window. */ - IntSendMessage(Wnd, WM_DESTROY, 0, 0, TRUE); + IntSendMessage(Wnd, WM_DESTROY, 0, 0); /* * This WM_DESTROY message can trigger re-entrant calls to DestroyWindow @@ -358,7 +358,7 @@ static LRESULT IntDestroyWindow(PWINDOW_OBJECT Window, /* * Send the WM_NCDESTROY to the window being destroyed. */ - IntSendMessage(Window->Self, WM_NCDESTROY, 0, 0, TRUE); + IntSendMessage(Window->Self, WM_NCDESTROY, 0, 0); } /* reset shell window handles */ @@ -1329,7 +1329,7 @@ NtUserCreateWindowEx(DWORD dwExStyle, DPRINT("[win32k.window] NtUserCreateWindowEx style %d, exstyle %d, parent %d\n", Cs.style, Cs.dwExStyle, Cs.hwndParent); DPRINT("NtUserCreateWindowEx(): (%d,%d-%d,%d)\n", x, y, nWidth, nHeight); DPRINT("NtUserCreateWindowEx(): About to send NCCREATE message.\n"); - Result = IntSendNCCREATEMessage(WindowObject->Self, &Cs); + Result = IntSendMessage(WindowObject->Self, WM_NCCREATE, 0, (LPARAM) &Cs); if (!Result) { /* FIXME: Cleanup. */ @@ -1373,7 +1373,7 @@ NtUserCreateWindowEx(DWORD dwExStyle, /* Send the WM_CREATE message. */ DPRINT("NtUserCreateWindowEx(): about to send CREATE message.\n"); - Result = IntSendCREATEMessage(WindowObject->Self, &Cs); + Result = IntSendMessage(WindowObject->Self, WM_CREATE, 0, (LPARAM) &Cs); if (Result == (LRESULT)-1) { /* FIXME: Cleanup. */ @@ -1400,7 +1400,7 @@ NtUserCreateWindowEx(DWORD dwExStyle, WindowObject->ClientRect.left, WindowObject->ClientRect.bottom - WindowObject->ClientRect.top); - IntCallWindowProc(NULL, WindowObject->Self, WM_SIZE, SIZE_RESTORED, + IntSendMessage(WindowObject->Self, WM_SIZE, SIZE_RESTORED, lParam); DPRINT("NtUserCreateWindow(): About to send WM_MOVE\n"); @@ -1415,7 +1415,7 @@ NtUserCreateWindowEx(DWORD dwExStyle, lParam = MAKE_LONG(WindowObject->ClientRect.left, WindowObject->ClientRect.top); } - IntCallWindowProc(NULL, WindowObject->Self, WM_MOVE, 0, lParam); + IntSendMessage(WindowObject->Self, WM_MOVE, 0, lParam); } /* Show or maybe minimize or maximize the window. */ @@ -1441,10 +1441,10 @@ NtUserCreateWindowEx(DWORD dwExStyle, (!(WindowObject->ExStyle & WS_EX_NOPARENTNOTIFY))) { DPRINT("NtUserCreateWindow(): About to notify parent\n"); - IntCallWindowProc(NULL, WindowObject->Parent->Self, - WM_PARENTNOTIFY, - MAKEWPARAM(WM_CREATE, WindowObject->IDMenu), - (LPARAM)WindowObject->Self); + IntSendMessage(WindowObject->Parent->Self, + WM_PARENTNOTIFY, + MAKEWPARAM(WM_CREATE, WindowObject->IDMenu), + (LPARAM)WindowObject->Self); } if (dwStyle & WS_VISIBLE) @@ -2518,18 +2518,18 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi) Style.styleNew &= ~WS_EX_TOPMOST; } - IntSendSTYLECHANGINGMessage(hWnd, GWL_EXSTYLE, &Style); + IntSendMessage(hWnd, WM_STYLECHANGING, GWL_EXSTYLE, (LPARAM) &Style); WindowObject->ExStyle = (DWORD)Style.styleNew; - IntSendSTYLECHANGEDMessage(hWnd, GWL_EXSTYLE, &Style); + IntSendMessage(hWnd, WM_STYLECHANGED, GWL_EXSTYLE, (LPARAM) &Style); break; case GWL_STYLE: OldValue = (LONG) WindowObject->Style; Style.styleOld = OldValue; Style.styleNew = NewValue; - IntSendSTYLECHANGINGMessage(hWnd, GWL_STYLE, &Style); + IntSendMessage(hWnd, WM_STYLECHANGING, GWL_STYLE, (LPARAM) &Style); WindowObject->Style = (DWORD)Style.styleNew; - IntSendSTYLECHANGEDMessage(hWnd, GWL_STYLE, &Style); + IntSendMessage(hWnd, WM_STYLECHANGED, GWL_STYLE, (LPARAM) &Style); break; case GWL_WNDPROC: diff --git a/reactos/subsys/win32k/ntuser/winpos.c b/reactos/subsys/win32k/ntuser/winpos.c index 794511279cd..b15e61097d3 100644 --- a/reactos/subsys/win32k/ntuser/winpos.c +++ b/reactos/subsys/win32k/ntuser/winpos.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: winpos.c,v 1.73 2003/12/26 16:19:15 weiden Exp $ +/* $Id: winpos.c,v 1.74 2003/12/26 22:52:12 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -219,7 +219,7 @@ WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT* NewPos) { if (WindowObject->Style & WS_MINIMIZE) { - if (!IntSendMessage(WindowObject->Self, WM_QUERYOPEN, 0, 0, TRUE)) + if (!IntSendMessage(WindowObject->Self, WM_QUERYOPEN, 0, 0)) { return(SWP_NOSIZE | SWP_NOMOVE); } @@ -366,7 +366,7 @@ WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT* MaxPos, WinPosFillMinMaxInfoStruct(Window, &MinMax); - IntSendMessage(Window->Self, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax, TRUE); + IntSendMessage(Window->Self, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax); MinMax.ptMaxTrackSize.x = max(MinMax.ptMaxTrackSize.x, MinMax.ptMinTrackSize.x); @@ -398,8 +398,7 @@ WinPosChangeActiveWindow(HWND hWnd, BOOL MouseMsg) WM_ACTIVATE, MAKELONG(MouseMsg ? WA_CLICKACTIVE : WA_CLICKACTIVE, (WindowObject->Style & WS_MINIMIZE) ? 1 : 0), - (LPARAM)IntGetDesktopWindow(), /* FIXME: Previous active window */ - TRUE); + (LPARAM)IntGetDesktopWindow()); /* FIXME: Previous active window */ #endif IntSetForegroundWindow(WindowObject); @@ -436,7 +435,7 @@ WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos, params.lppos = &winposCopy; winposCopy = *WinPos; - wvrFlags = IntSendNCCALCSIZEMessage(Window->Self, TRUE, NULL, ¶ms); + wvrFlags = IntSendMessage(Window->Self, WM_NCCALCSIZE, TRUE, (LPARAM) ¶ms); /* If the application send back garbage, ignore it */ if (params.rgrc[0].left <= params.rgrc[0].right && @@ -489,7 +488,7 @@ WinPosDoWinPosChanging(PWINDOW_OBJECT WindowObject, if (!(WinPos->flags & SWP_NOSENDCHANGING)) { - IntSendWINDOWPOSCHANGINGMessage(WindowObject->Self, WinPos); + IntSendMessage(WindowObject->Self, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos); } *WindowRect = WindowObject->WindowRect; @@ -1046,7 +1045,7 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx, { if ((Window->Style & (WS_CHILD | WS_POPUP)) == WS_CHILD) { - IntSendMessage(WinPos.hwnd, WM_CHILDACTIVATE, 0, 0, TRUE); + IntSendMessage(WinPos.hwnd, WM_CHILDACTIVATE, 0, 0); } else { @@ -1055,7 +1054,7 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx, } if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) - IntSendWINDOWPOSCHANGEDMessage(WinPos.hwnd, &WinPos); + IntSendMessage(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM) &WinPos); IntReleaseWindowObject(Window); @@ -1066,7 +1065,7 @@ LRESULT FASTCALL WinPosGetNonClientSize(HWND Wnd, RECT* WindowRect, RECT* ClientRect) { *ClientRect = *WindowRect; - return(IntSendNCCALCSIZEMessage(Wnd, FALSE, ClientRect, NULL)); + return(IntSendMessage(Wnd, WM_NCCALCSIZE, FALSE, (LPARAM) ClientRect)); } BOOLEAN FASTCALL @@ -1169,7 +1168,7 @@ WinPosShowWindow(HWND Wnd, INT Cmd) ShowFlag = (Cmd != SW_HIDE); if (ShowFlag != WasVisible) { - IntSendMessage(Wnd, WM_SHOWWINDOW, ShowFlag, 0, TRUE); + IntSendMessage(Wnd, WM_SHOWWINDOW, ShowFlag, 0); /* * FIXME: Need to check the window wasn't destroyed during the * window procedure. @@ -1226,10 +1225,10 @@ WinPosShowWindow(HWND Wnd, INT Cmd) MAKELONG(Window->ClientRect.right - Window->ClientRect.left, Window->ClientRect.bottom - - Window->ClientRect.top), TRUE); + Window->ClientRect.top)); IntSendMessage(Wnd, WM_MOVE, 0, MAKELONG(Window->ClientRect.left, - Window->ClientRect.top), TRUE); + Window->ClientRect.top)); } /* Activate the window if activation is not requested and the window is not minimized */ @@ -1341,7 +1340,7 @@ WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, POINT WinPoint, if ((*Window)->MessageQueue == PsGetWin32Thread()->MessageQueue) { HitTest = IntSendMessage((*Window)->Self, WM_NCHITTEST, 0, - MAKELONG(Point.x, Point.y), FALSE); + MAKELONG(Point.x, Point.y)); /* FIXME: Check for HTTRANSPARENT here. */ } else