diff --git a/reactos/subsystems/win32/win32k/ntuser/class.c b/reactos/subsystems/win32/win32k/ntuser/class.c index 4ee8891e962..fd8a0ba73f9 100644 --- a/reactos/subsystems/win32/win32k/ntuser/class.c +++ b/reactos/subsystems/win32/win32k/ntuser/class.c @@ -16,8 +16,7 @@ * 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 * PROJECT: ReactOS kernel * PURPOSE: Window classes @@ -1855,7 +1854,7 @@ UserRegisterSystemClasses(IN ULONG Count, pi); if (Class != NULL) { - Class->ClassId = SystemClasses[i].ClassId; + Class->fnID = SystemClasses[i].ClassId; ASSERT(Class->System); Class->Next = pi->SystemClassList; @@ -1986,6 +1985,111 @@ InvalidParameter: } +RTL_ATOM +NTAPI +NtUserRegisterClassExWOW( + WNDCLASSEXW* lpwcx, + PUNICODE_STRING ClassName, + PUNICODE_STRING ClsNVersion, + PCLSMENUNAME pClassMenuName, + DWORD fnID, + DWORD Flags, + LPDWORD pWow) +{ + WNDCLASSEXW CapturedClassInfo = {0}; + UNICODE_STRING CapturedName = {0}, ClassnametoVersion = {0}; + RTL_ATOM Ret = (RTL_ATOM)0; + + UserEnterExclusive(); + + _SEH_TRY + { + /* Probe the parameters and basic parameter checks */ + if (ProbeForReadUint(&lpwcx->cbSize) != sizeof(WNDCLASSEXW)) + { + goto InvalidParameter; + } + if (!pClassMenuName) + { + goto InvalidParameter; + } + + ProbeForRead(lpwcx, + sizeof(WNDCLASSEXW), + sizeof(ULONG)); + RtlCopyMemory(&CapturedClassInfo, + lpwcx, + sizeof(WNDCLASSEXW)); + /* + Need to watch this. When UnregisterClass is called these pointers + are freed by the caller in user space. So, we just probe the data + for now and pass it on and copy it to the shared class structure. + */ + ProbeForRead(pClassMenuName, + sizeof(CLSMENUNAME), + sizeof(ULONG)); + + CapturedName = ProbeForReadUnicodeString(ClassName); + ClassnametoVersion = ProbeForReadUnicodeString(ClsNVersion); + + if (CapturedName.Length & 1 || ClassnametoVersion.Length & 1 || + CapturedClassInfo.cbClsExtra < 0 || + CapturedClassInfo.cbClsExtra + CapturedName.Length + + ClassnametoVersion.Length + sizeof(WINDOWCLASS) < CapturedClassInfo.cbClsExtra || + CapturedClassInfo.cbWndExtra < 0 || + CapturedClassInfo.hInstance == NULL) + { + goto InvalidParameter; + } + + if (CapturedName.Length != 0) + { + ProbeForRead(CapturedName.Buffer, + CapturedName.Length, + sizeof(WCHAR)); + } + else + { + if (!IS_ATOM(CapturedName.Buffer)) + { + goto InvalidParameter; + } + } + + if (ClassnametoVersion.Length != 0) + { + ProbeForRead(ClassnametoVersion.Buffer, + ClassnametoVersion.Length, + sizeof(WCHAR)); + } + else if (ClassnametoVersion.Buffer != NULL && + !IS_INTRESOURCE(ClassnametoVersion.Buffer)) + { +InvalidParameter: + SetLastWin32Error(ERROR_INVALID_PARAMETER); + _SEH_LEAVE; + } + + /* Register the class */ +// Ret = UserRegisterClass(&CapturedClassInfo, +// &CapturedName, +// &ClassnametoVersion, +// hMenu, /* FIXME - pass pointer */ +// wpExtra, +// Flags); + + } + _SEH_HANDLE + { + SetLastNtError(_SEH_GetExceptionCode()); + } + _SEH_END; + + UserLeave(); + + return Ret; +} + ULONG_PTR NTAPI NtUserGetClassLong(IN HWND hWnd, @@ -2116,7 +2220,7 @@ NtUserSetClassWord( BOOL NTAPI NtUserUnregisterClass(IN PUNICODE_STRING ClassNameOrAtom, IN HINSTANCE hInstance, - DWORD Unknown) + OUT PCLSMENUNAME pClassMenuName) { UNICODE_STRING CapturedClassName; BOOL Ret = FALSE; diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index da2a0a6fc16..1bec09fc327 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -1052,20 +1052,6 @@ CLEANUP: END_CLEANUP; } -LRESULT STDCALL -NtUserMessageCall( - HWND hWnd, - UINT Msg, - WPARAM wParam, - LPARAM lParam, - ULONG_PTR ResultInfo, - DWORD dwType, - BOOL Ansi) -{ - UNIMPLEMENTED - - return 0; -} static NTSTATUS FASTCALL CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEntry) @@ -1846,6 +1832,82 @@ IntUninitMessagePumpHook() return FALSE; } +/* + Win32k counterpart of User DefWindowProc + */ +LRESULT FASTCALL +IntDefWindowProc( + PWINDOW_OBJECT Window, + UINT Msg, + WPARAM wParam, + LPARAM lParam) +{ + PWINDOW Wnd; + + if (Msg > WM_USER) return 0; + + Wnd = Window->Wnd; + if (!Wnd) return 0; + + switch (Msg) + { + case WM_SHOWWINDOW: + { + if ((Wnd->Style & WS_VISIBLE) && wParam) break; + if (!(Wnd->Style & WS_VISIBLE) && !wParam) break; + if (!Window->hOwner) break; + if (LOWORD(lParam)) + { + if (wParam) + { + if (!(Window->Flags & WIN_NEEDS_SHOW_OWNEDPOPUP)) break; + Window->Flags &= ~WIN_NEEDS_SHOW_OWNEDPOPUP; + } + else + Window->Flags |= WIN_NEEDS_SHOW_OWNEDPOPUP; + + co_WinPosShowWindow(Window, wParam ? SW_SHOWNOACTIVATE : SW_HIDE); + } + } + break; + } + + return 0; +} + + +LRESULT STDCALL +NtUserMessageCall( + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam, + ULONG_PTR ResultInfo, + DWORD dwType, // fnID? + BOOL Ansi) +{ + LRESULT lResult = 0; + PWINDOW_OBJECT Window = NULL; + + UserEnterExclusive(); + + /* Validate input */ + if (hWnd && (hWnd != INVALID_HANDLE_VALUE) && !(Window = UserGetWindowObject(hWnd))) + { + return 0; + } + + switch(dwType) + { + case NUMC_DEFWINDOWPROC: + lResult = IntDefWindowProc(Window, Msg, wParam, lParam); + break; + } + + UserLeave(); + return lResult; +} + #define INFINITE 0xFFFFFFFF #define WAIT_FAILED ((DWORD)0xFFFFFFFF) diff --git a/reactos/subsystems/win32/win32k/ntuser/ntstubs.c b/reactos/subsystems/win32/win32k/ntuser/ntstubs.c index 58e1bf5ebb3..9622484c592 100644 --- a/reactos/subsystems/win32/win32k/ntuser/ntstubs.c +++ b/reactos/subsystems/win32/win32k/ntuser/ntstubs.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PURPOSE: Native User stubs @@ -909,22 +908,6 @@ NtUserRealWaitMessageEx( return 0; } -/* http://www.reactos.org/pipermail/ros-kernel/2003-November/000589.html */ -HWINSTA -NTAPI -NtUserRegisterClassExWOW( - CONST WNDCLASSEXW* lpwcx, - BOOL bUnicodeClass, - WNDPROC wpExtra, - DWORD dwUnknown4, - DWORD dwUnknown5, - DWORD dwUnknown6, - DWORD dwUnknown7) -{ - UNIMPLEMENTED; - return 0; -} - DWORD NTAPI NtUserRegisterUserApiHook( diff --git a/reactos/subsystems/win32/win32k/ntuser/simplecall.c b/reactos/subsystems/win32/win32k/ntuser/simplecall.c index 191f9e1c1ae..b6ee8ab9438 100644 --- a/reactos/subsystems/win32/win32k/ntuser/simplecall.c +++ b/reactos/subsystems/win32/win32k/ntuser/simplecall.c @@ -511,31 +511,6 @@ NtUserCallTwoParam( RETURN( (DWORD)IntShowOwnedPopups(Window, (BOOL) Param2)); } - case TWOPARAM_ROUTINE_ROS_SHOWWINDOW: - { -#define WIN_NEEDS_SHOW_OWNEDPOPUP (0x00000040) - DPRINT1("ROS_SHOWWINDOW\n"); - - if (!(Window = UserGetWindowObject((HWND)Param1))) - { - RETURN( 1 ); - } - - if (Param2) - { - if (!(Window->Flags & WIN_NEEDS_SHOW_OWNEDPOPUP)) - { - RETURN( -1 ); - } - Window->Flags &= ~WIN_NEEDS_SHOW_OWNEDPOPUP; - } - else - Window->Flags |= WIN_NEEDS_SHOW_OWNEDPOPUP; - - DPRINT1("ROS_SHOWWINDOW ---> 0x%x\n",Window->Flags); - RETURN( 0 ); - } - case TWOPARAM_ROUTINE_ROS_UPDATEUISTATE: { WPARAM wParam; diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 7f4f55ab834..bc1a7ac23bb 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -4701,7 +4701,6 @@ CLEANUP: END_CLEANUP; } -#define WIN_NEEDS_SHOW_OWNEDPOPUP (0x00000040) BOOL FASTCALL @@ -4711,9 +4710,9 @@ IntShowOwnedPopups(PWINDOW_OBJECT OwnerWnd, BOOL fShow ) PWINDOW_OBJECT pWnd; HWND *win_array; - ASSERT(OwnerWnd); +// ASSERT(OwnerWnd); - win_array = IntWinListChildren(OwnerWnd);//faxme: use desktop? + win_array = IntWinListChildren(UserGetWindowObject(IntGetDesktopWindow())); if (!win_array) return TRUE;