X-Git-Url: http://git.jankratochvil.net/?a=blobdiff_plain;f=subsys%2Fwin32k%2Fntuser%2Fcallback.c;h=d33ea7efb94fbec0a3c038aba2cc496e6256ce7b;hb=a3df8bf1429570e0bd6c6428f6ed80073578cf4b;hp=67340b4a4b299a99f6583e0ba3552ed74197e054;hpb=7c0db166f81fbe8c8b913d7f26048e337d383605;p=reactos.git diff --git a/subsys/win32k/ntuser/callback.c b/subsys/win32k/ntuser/callback.c index 67340b4..d33ea7e 100644 --- a/subsys/win32k/ntuser/callback.c +++ b/subsys/win32k/ntuser/callback.c @@ -1,3 +1,21 @@ +/* + * ReactOS W32 Subsystem + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ /* $Id$ * * COPYRIGHT: See COPYING in the top level directory @@ -17,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -27,7 +46,7 @@ /* FUNCTIONS *****************************************************************/ VOID STDCALL -W32kCallSentMessageCallback(SENDASYNCPROC CompletionCallback, +IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback, HWND hWnd, UINT Msg, ULONG_PTR CompletionCallbackContext, @@ -54,7 +73,7 @@ W32kCallSentMessageCallback(SENDASYNCPROC CompletionCallback, } LRESULT STDCALL -W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect, +IntSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect, NCCALCSIZE_PARAMS* Params) { SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS Arguments; @@ -96,7 +115,7 @@ W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect, } LRESULT STDCALL -W32kSendCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct) +IntSendCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct) { SENDCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments; LRESULT Result; @@ -121,7 +140,7 @@ W32kSendCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct) } LRESULT STDCALL -W32kSendNCCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct) +IntSendNCCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct) { SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS Arguments; LRESULT Result; @@ -146,7 +165,7 @@ W32kSendNCCREATEMessage(HWND Wnd, CREATESTRUCTW* CreateStruct) } LRESULT STDCALL -W32kCallWindowProc(WNDPROC Proc, +IntCallWindowProc(WNDPROC Proc, HWND Wnd, UINT Message, WPARAM wParam, @@ -157,11 +176,14 @@ W32kCallWindowProc(WNDPROC Proc, NTSTATUS Status; PVOID ResultPointer; ULONG ResultLength; + PWINDOW_OBJECT WindowObject = IntGetWindowObject(Wnd); - if (W32kIsDesktopWindow(Wnd)) + if (IntIsDesktopWindow(WindowObject)) { - return(W32kDesktopWindowProc(Wnd, Message, wParam, lParam)); + IntReleaseWindowObject(WindowObject); + return(IntDesktopWindowProc(Wnd, Message, wParam, lParam)); } + IntReleaseWindowObject(WindowObject); Arguments.Proc = Proc; Arguments.Wnd = Wnd; @@ -183,7 +205,7 @@ W32kCallWindowProc(WNDPROC Proc, } LRESULT STDCALL -W32kSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo) +IntSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo) { SENDGETMINMAXINFO_CALLBACK_ARGUMENTS Arguments; SENDGETMINMAXINFO_CALLBACK_RESULT Result; @@ -208,7 +230,110 @@ W32kSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo) } LRESULT STDCALL -W32kCallTrampolineWindowProc(WNDPROC Proc, +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, @@ -217,30 +342,86 @@ W32kCallTrampolineWindowProc(WNDPROC Proc, switch (Message) { case WM_NCCREATE: - return(W32kSendNCCREATEMessage(Wnd, (CREATESTRUCTW*)lParam)); + return IntSendNCCREATEMessage(Wnd, (CREATESTRUCTW*)lParam); case WM_CREATE: - return(W32kSendCREATEMessage(Wnd, (CREATESTRUCTW*)lParam)); + return IntSendCREATEMessage(Wnd, (CREATESTRUCTW*)lParam); case WM_GETMINMAXINFO: - return(W32kSendGETMINMAXINFOMessage(Wnd, (MINMAXINFO*)lParam)); + return IntSendGETMINMAXINFOMessage(Wnd, (MINMAXINFO*)lParam); case WM_NCCALCSIZE: { if (wParam) { - return(W32kSendNCCALCSIZEMessage(Wnd, TRUE, NULL, - (NCCALCSIZE_PARAMS*)lParam)); + return IntSendNCCALCSIZEMessage(Wnd, TRUE, NULL, + (NCCALCSIZE_PARAMS*)lParam); } else { - return(W32kSendNCCALCSIZEMessage(Wnd, FALSE, (RECT*)lParam, NULL)); + 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(W32kCallWindowProc(Proc, Wnd, Message, wParam, lParam)); + return(IntCallWindowProc(Proc, Wnd, Message, wParam, lParam)); + } +} + +HMENU STDCALL +IntLoadSysMenuTemplate() +{ + LRESULT Result; + NTSTATUS Status; + PVOID ResultPointer; + ULONG ResultLength; + + ResultPointer = &Result; + ResultLength = sizeof(LRESULT); + Status = NtW32Call(USER32_CALLBACK_LOADSYSMENUTEMPLATE, + NULL, + 0, + &ResultPointer, + &ResultLength); + if (!NT_SUCCESS(Status)) + { + return(0); + } + return (HMENU)Result; +} + +BOOL STDCALL +IntLoadDefaultCursors() +{ + LRESULT Result; + NTSTATUS Status; + PVOID ResultPointer; + ULONG ResultLength; + + ResultPointer = &Result; + ResultLength = sizeof(LRESULT); + Status = NtW32Call(USER32_CALLBACK_LOADDEFAULTCURSORS, + NULL, + 0, + &ResultPointer, + &ResultLength); + if (!NT_SUCCESS(Status)) + { + return(0); } + return (BOOL)Result; } /* EOF */