Author: gadamopoulos Date: Thu Jun 3 18:12:43 2010 New Revision: 47544
URL: http://svn.reactos.org/svn/reactos?rev=47544&view=rev Log: [user32] - Remove a reactos only export (PrivateCsrssInitialized) - Don't call NtUserGetClassLong - Move implementation of AnyPopup to user mode - Fix a small bug in GetParent and in IsChild
[csrss] - Don't call PrivateCsrssInitialized
[win32k] - Call CsrInit in NtUserInitialize so we can remove PrivateCsrssInitialized - Romove a reactos only syscall (NtUserGetClassLong) - Remove UserGetClassLongPtr, UserGetWindow, UserGetWindowLong, IntGetOwner. Instead access objects directly - In WINDOW_OBJECT store pointer to the ownder window instead of a handle
Modified: trunk/reactos/dll/win32/user32/include/user32p.h trunk/reactos/dll/win32/user32/misc/misc.c trunk/reactos/dll/win32/user32/user32.pspec trunk/reactos/dll/win32/user32/windows/class.c trunk/reactos/dll/win32/user32/windows/window.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c trunk/reactos/subsystems/win32/win32k/include/class.h trunk/reactos/subsystems/win32/win32k/include/userfuncs.h trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c trunk/reactos/subsystems/win32/win32k/ntuser/class.c trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/focus.c trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c trunk/reactos/subsystems/win32/win32k/w32ksvc.db
Modified: trunk/reactos/dll/win32/user32/include/user32p.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/us... ============================================================================== --- trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -33,9 +33,6 @@ #define NtUserMsqClearWakeMask() \ NtUserCallNoParam(NOPARAM_ROUTINE_MSQCLEARWAKEMASK)
-#define NtUserAnyPopup() \ - (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_ANYPOPUP) - #define NtUserValidateRgn(hWnd, hRgn) \ (BOOL)NtUserCallTwoParam((DWORD_PTR)hWnd, (DWORD_PTR)hRgn, TWOPARAM_ROUTINE_VALIDATERGN)
Modified: trunk/reactos/dll/win32/user32/misc/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/misc.... ============================================================================== --- trunk/reactos/dll/win32/user32/misc/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/misc.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -43,13 +43,6 @@ PrivateCsrssManualGuiCheck(LONG Check) { NtUserCallOneParam(Check, ONEPARAM_ROUTINE_CSRSS_GUICHECK); -} - -VOID -WINAPI -PrivateCsrssInitialized(VOID) -{ - NtUserCallNoParam(NOPARAM_ROUTINE_CSRSS_INITIALIZED); }
Modified: trunk/reactos/dll/win32/user32/user32.pspec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/user32.psp... ============================================================================== --- trunk/reactos/dll/win32/user32/user32.pspec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/user32.pspec [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -750,7 +750,6 @@
; ROS specific exports @ stdcall PrivateCsrssManualGuiCheck(long) -@ stdcall PrivateCsrssInitialized()
; Functions exported by Win Vista @ stdcall SetProcessDPIAware()
Modified: trunk/reactos/dll/win32/user32/windows/class.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/cl... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/class.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/class.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -423,21 +423,14 @@ } else { - /* This is a race condition! Call win32k to make sure we're getting - the correct result */ - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ - WARN("Invalid class for hwnd 0x%p!\n", hWnd); } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ + Ret = 0; } _SEH2_END; - - if (Wnd == NULL) - Ret = NtUserGetClassLong(hWnd, nIndex, TRUE);
return Ret; } @@ -534,21 +527,13 @@ } else { - /* This is a race condition! Call win32k to make sure we're getting - the correct result */ - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ - WARN("Invalid class for hwnd 0x%p!\n", hWnd); } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ } _SEH2_END; - - if (Wnd == NULL) - Ret = NtUserGetClassLong(hWnd, nIndex, FALSE);
return Ret; } @@ -617,18 +602,28 @@ WORD WINAPI GetClassWord( - HWND hWnd, - int nIndex) -/* - * NOTE: Obsoleted in 32-bit windows - */ -{ - TRACE("%p %x\n", hWnd, nIndex); - - if ((nIndex < 0) && (nIndex != GCW_ATOM)) + HWND hwnd, + int offset) +{ + PWND Wnd; + PCLS class; + WORD retvalue = 0; + + if (offset < 0) return GetClassLongA( hwnd, offset ); + + Wnd = ValidateHwnd(hwnd); + if (!Wnd) return 0;
- return (WORD) NtUserGetClassLong ( hWnd, nIndex, TRUE ); + class = DesktopPtrToUser(Wnd->pcls); + if (class == NULL) return 0; + + if (offset <= class->cbclsExtra - sizeof(WORD)) + memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) ); + else + SetLastError( ERROR_INVALID_INDEX ); + + return retvalue; }
Modified: trunk/reactos/dll/win32/user32/windows/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/wi... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -1030,15 +1030,15 @@ _SEH2_TRY { WndParent = NULL; - if (Wnd->style & WS_CHILD) + if (Wnd->style & WS_POPUP) + { + if (Wnd->spwndOwner != NULL) + WndParent = DesktopPtrToUser(Wnd->spwndOwner); + } + else if (Wnd->style & WS_CHILD) { if (Wnd->spwndParent != NULL) WndParent = DesktopPtrToUser(Wnd->spwndParent); - } - else if (Wnd->style & WS_POPUP) - { - if (Wnd->spwndOwner != NULL) - WndParent = DesktopPtrToUser(Wnd->spwndOwner); }
if (WndParent != NULL) @@ -1464,7 +1464,7 @@ IsChild(HWND hWndParent, HWND hWnd) { - PWND WndParent, Wnd; + PWND WndParent, DesktopWnd, Wnd; BOOL Ret = FALSE;
WndParent = ValidateHwnd(hWndParent); @@ -1474,6 +1474,10 @@ if (!Wnd) return FALSE;
+ DesktopWnd = GetThreadDesktopWnd(); + if (!DesktopWnd) + return FALSE; + _SEH2_TRY { while (Wnd != NULL) @@ -1481,6 +1485,10 @@ if (Wnd->spwndParent != NULL) { Wnd = DesktopPtrToUser(Wnd->spwndParent); + + if(Wnd == DesktopWnd) + Wnd = NULL; + if (Wnd == WndParent) { Ret = TRUE; @@ -2062,7 +2070,18 @@ BOOL WINAPI AnyPopup(VOID) { - return NtUserAnyPopup(); + int i; + BOOL retvalue; + HWND *list = WIN_ListChildren( GetDesktopWindow() ); + + if (!list) return FALSE; + for (i = 0; list[i]; i++) + { + if (IsWindowVisible( list[i] ) && GetWindow( list[i], GW_OWNER )) break; + } + retvalue = (list[i] != 0); + HeapFree( GetProcessHeap(), 0, list ); + return retvalue; }
/*
Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntus... ============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -3135,7 +3135,6 @@
#define NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO 0xffff0005 #define NOPARAM_ROUTINE_ANYPOPUP 0xffff0006 -#define NOPARAM_ROUTINE_CSRSS_INITIALIZED 0xffff0007 #define ONEPARAM_ROUTINE_CSRSS_GUICHECK 0xffff0008 #define ONEPARAM_ROUTINE_SWITCHCARETSHOWING 0xfffe0008 #define ONEPARAM_ROUTINE_ISWINDOWINDESTROY 0xfffe000c
Modified: trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win3... ============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -13,7 +13,6 @@
/* Not defined in any header file */ extern VOID WINAPI PrivateCsrssManualGuiCheck(LONG Check); -extern VOID WINAPI PrivateCsrssInitialized(); extern VOID WINAPI InitializeAppSwitchHook();
/* GLOBALS *******************************************************************/ @@ -111,8 +110,6 @@ static BOOL WINAPI Win32CsrInitComplete(void) { - PrivateCsrssInitialized(); - return TRUE; }
Modified: trunk/reactos/subsystems/win32/win32k/include/class.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/class.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/class.h [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -65,11 +65,6 @@ IN HINSTANCE hInstance, OUT PCLSMENUNAME pClassMenuName);
-ULONG_PTR -UserGetClassLongPtr(IN PCLS Class, - IN INT Index, - IN BOOL Ansi); - RTL_ATOM IntGetClassAtom(IN PUNICODE_STRING ClassName, IN HINSTANCE hInstance OPTIONAL,
Modified: trunk/reactos/subsystems/win32/win32k/include/userfuncs.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/userfuncs.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/userfuncs.h [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -122,14 +122,10 @@
HWND FASTCALL UserGetShellWindow(VOID);
-HWND FASTCALL UserGetWindow(HWND hWnd, UINT Relationship); - HDC FASTCALL UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags);
BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Wnd); - -LONG FASTCALL UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi);
PWINDOW_OBJECT FASTCALL UserGetAncestor(PWINDOW_OBJECT Wnd, UINT Type);
Modified: trunk/reactos/subsystems/win32/win32k/include/window.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -37,11 +37,8 @@ struct _WINDOW_OBJECT* spwndChild; struct _WINDOW_OBJECT* spwndNext; struct _WINDOW_OBJECT* spwndPrev; - /* Handle to the parent window. */ struct _WINDOW_OBJECT* spwndParent; - /* Handle to the owner window. */ - HWND hOwner; // Use spwndOwner - + struct _WINDOW_OBJECT* spwndOwner;
/* Scrollbar info */ PSBINFOEX pSBInfo; // convert to PSBINFO @@ -125,10 +122,6 @@ PWINDOW_OBJECT FASTCALL IntGetParent(PWINDOW_OBJECT Wnd);
-PWINDOW_OBJECT FASTCALL -IntGetOwner(PWINDOW_OBJECT Wnd); - - INT FASTCALL IntGetWindowRgn(PWINDOW_OBJECT Window, HRGN hRgn);
@@ -140,9 +133,6 @@
VOID FASTCALL IntGetWindowBorderMeasures(PWINDOW_OBJECT WindowObject, UINT *cx, UINT *cy); - -BOOL FASTCALL -IntAnyPopup(VOID);
BOOL FASTCALL IntIsWindowInDestroy(PWINDOW_OBJECT Window);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -185,9 +185,7 @@ Example: If pWnd is created from Ansi and lpfnXxyz is assumed to be Ansi, caller will ask for Unicode Proc return Proc or CallProcData handle. - - This function should replaced NtUserGetClassLong and NtUserGetWindowLong. - */ +*/ ULONG_PTR APIENTRY NtUserGetCPD(
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -1515,96 +1515,6 @@ return Ret; }
-ULONG_PTR -UserGetClassLongPtr(IN PCLS Class, - IN INT Index, - IN BOOL Ansi) -{ - ULONG_PTR Ret = 0; - - if (Index >= 0) - { - PULONG_PTR Data; - - TRACE("GetClassLong(%d)\n", Index); - if (Index + sizeof(ULONG_PTR) < Index || - Index + sizeof(ULONG_PTR) > Class->cbclsExtra) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - - Data = (PULONG_PTR)((ULONG_PTR)(Class + 1) + Index); - - /* FIXME - Data might be a unaligned pointer! Might be a problem on - certain architectures, maybe using RtlCopyMemory is a - better choice for those architectures! */ - - TRACE("Result: %x\n", Ret); - return *Data; - } - - switch (Index) - { - case GCL_CBWNDEXTRA: - Ret = (ULONG_PTR)Class->cbwndExtra; - break; - - case GCL_CBCLSEXTRA: - Ret = (ULONG_PTR)Class->cbclsExtra; - break; - - case GCLP_HBRBACKGROUND: - Ret = (ULONG_PTR)Class->hbrBackground; - break; - - case GCLP_HCURSOR: - /* FIXME - get handle from pointer to CURSOR object */ - Ret = (ULONG_PTR)Class->hCursor; - break; - - case GCLP_HICON: - /* FIXME - get handle from pointer to ICON object */ - Ret = (ULONG_PTR)Class->hIcon; - break; - - case GCLP_HICONSM: - /* FIXME - get handle from pointer to ICON object */ - Ret = (ULONG_PTR)Class->hIconSm; - break; - - case GCLP_HMODULE: - Ret = (ULONG_PTR)Class->hModule; - break; - - case GCLP_MENUNAME: - /* NOTE: Returns pointer in kernel heap! */ - if (Ansi) - Ret = (ULONG_PTR)Class->lpszClientAnsiMenuName; - else - Ret = (ULONG_PTR)Class->lpszClientUnicodeMenuName; - break; - - case GCL_STYLE: - Ret = (ULONG_PTR)Class->style; - break; - - case GCLP_WNDPROC: - Ret = (ULONG_PTR)IntGetClassWndProc(Class, Ansi); - break; - - case GCW_ATOM: - Ret = (ULONG_PTR)Class->atomClassName; - break; - - default: - SetLastWin32Error(ERROR_INVALID_INDEX); - break; - } - - return Ret; -} - static BOOL IntSetClassMenuName(IN PCLS Class, IN PUNICODE_STRING MenuName) @@ -2191,45 +2101,6 @@ }
ULONG_PTR APIENTRY -NtUserGetClassLong(IN HWND hWnd, - IN INT Offset, - IN BOOL Ansi) -{ - PWINDOW_OBJECT Window; - ULONG_PTR Ret = 0; - - if (Offset != GCLP_WNDPROC) - { - UserEnterShared(); - } - else - { - UserEnterExclusive(); - } - - Window = UserGetWindowObject(hWnd); - if (Window != NULL) - { - Ret = UserGetClassLongPtr(Window->Wnd->pcls, - Offset, - Ansi); - - if ( Ret != 0 && - Offset == GCLP_MENUNAME && - Window->Wnd->pcls->MenuNameIsString) - { - Ret = (ULONG_PTR)UserHeapAddressToUser((PVOID)Ret); - } - } - - UserLeave(); - - return Ret; -} - - - -ULONG_PTR APIENTRY NtUserSetClassLong(HWND hWnd, INT Offset, ULONG_PTR dwNewLong,
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -129,7 +129,7 @@ { if ((Wnd->style & WS_VISIBLE) && wParam) break; if (!(Wnd->style & WS_VISIBLE) && !wParam) break; - if (!Window->hOwner) break; + if (!Window->spwndOwner) break; if (LOWORD(lParam)) { if (wParam)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -1423,7 +1423,7 @@ RETURN(FALSE); }
- DesktopBrush = (HBRUSH)UserGetClassLongPtr(WndDesktop->Wnd->pcls, GCL_HBRBACKGROUND, FALSE); + DesktopBrush = (HBRUSH)WndDesktop->Wnd->pcls->hbrBackground;
/*
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -51,12 +51,14 @@ VOID FASTCALL co_IntSendDeactivateMessages(HWND hWndPrev, HWND hWnd) { - if (hWndPrev) + PWINDOW_OBJECT WndPrev ; + + if (hWndPrev && (WndPrev = UserGetWindowObject(hWndPrev))) { co_IntSendMessageNoWait(hWndPrev, WM_NCACTIVATE, FALSE, 0); co_IntSendMessageNoWait(hWndPrev, WM_ACTIVATE, - MAKEWPARAM(WA_INACTIVE, UserGetWindowLong(hWndPrev, GWL_STYLE, FALSE) & WS_MINIMIZE), - (LPARAM)hWnd); + MAKEWPARAM(WA_INACTIVE, WndPrev->Wnd->style & WS_MINIMIZE), + (LPARAM)hWnd); } }
@@ -83,11 +85,11 @@ 0); }
- if (UserGetWindow(hWnd, GW_HWNDPREV) != NULL) + if (Window->spwndPrev != NULL) co_WinPosSetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
- if (!IntGetOwner(Window) && !IntGetParent(Window)) + if (!Window->spwndOwner && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, (LPARAM) hWnd); } @@ -153,7 +155,7 @@ /* FIXME: WA_CLICKACTIVE */ co_IntSendMessageNoWait(hWnd, WM_ACTIVATE, MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE, - UserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE), + Window->Wnd->style & WS_MINIMIZE), (LPARAM)hWndPrev); } } @@ -184,7 +186,7 @@
for(Child = Root->spwndChild; Child; Child = Child->spwndNext) { - OwnerWnd = UserGetWindowObject(Child->hOwner); + OwnerWnd = Child->spwndOwner; if(!OwnerWnd) continue;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -124,6 +124,8 @@
NtUserUpdatePerUserSystemParameters(0, TRUE);
+ CsrInit(); + return STATUS_SUCCESS; }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -108,14 +108,6 @@
case NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO: Result = (DWORD_PTR)MsqGetMessageExtraInfo(); - break; - - case NOPARAM_ROUTINE_ANYPOPUP: - Result = (DWORD_PTR)IntAnyPopup(); - break; - - case NOPARAM_ROUTINE_CSRSS_INITIALIZED: - Result = (DWORD_PTR)CsrInit(); break;
case NOPARAM_ROUTINE_MSQCLEARWAKEMASK: @@ -525,7 +517,7 @@ SWP_NOZORDER| SWP_NOACTIVATE| SWP_FRAMECHANGED ); - if (!IntGetOwner(Window) && !IntGetParent(Window)) + if (!Window->spwndOwner && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) hWnd); }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -96,6 +96,8 @@ ASSERT(Window->head.cLockObj >= 0);
Window->head.cLockObj++; + + ASSERT(Window->Wnd); } return Window; } @@ -130,6 +132,9 @@ }
ASSERT(Window->head.cLockObj >= 0); + + ASSERT(Window->Wnd); + return Window; }
@@ -163,20 +168,12 @@
-/* - Caller must NOT dereference retval! - But if caller want the returned value to persist spanning a co_ call, - it must reference the value (because the owner is not garanteed to - exist just because the owned window exist)! -*/ PWINDOW_OBJECT FASTCALL IntGetParent(PWINDOW_OBJECT Wnd) { - if (!Wnd->Wnd) return NULL; - if (Wnd->Wnd->style & WS_POPUP) { - return UserGetWindowObject(Wnd->hOwner); + return Wnd->spwndOwner; } else if (Wnd->Wnd->style & WS_CHILD) { @@ -185,20 +182,6 @@
return NULL; } - - -/* - Caller must NOT dereference retval! - But if caller want the returned value to persist spanning a co_ call, - it must reference the value (because the owner is not garanteed to - exist just because the owned window exist)! -*/ -PWINDOW_OBJECT FASTCALL -IntGetOwner(PWINDOW_OBJECT Wnd) -{ - return UserGetWindowObject(Wnd->hOwner); -} -
/* @@ -265,7 +248,7 @@ // USER_REFERENCE_ENTRY Ref; // UserRefObjectCo(Window, &Ref);
- if (!IntGetOwner(Window) && !IntGetParent(Window)) + if (!Window->spwndOwner && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM) hWnd); } @@ -1091,26 +1074,19 @@ if(!Wnd) return NULL;
- WndOldOwner = IntGetWindowObject(Wnd->hOwner); - if (WndOldOwner) - { - ret = WndOldOwner->hSelf; - UserDereferenceObject(WndOldOwner); + WndOldOwner = Wnd->spwndOwner; + + ret = WndOldOwner ? WndOldOwner->hSelf : 0; + + if((WndNewOwner = UserGetWindowObject(hWndNewOwner))) + { + Wnd->spwndOwner= WndNewOwner; + Wnd->Wnd->spwndOwner = WndNewOwner->Wnd; } else { - ret = 0; - } - - if((WndNewOwner = UserGetWindowObject(hWndNewOwner))) - { - Wnd->hOwner = hWndNewOwner; - Wnd->Wnd->spwndOwner = WndNewOwner->Wnd; - } - else - { - Wnd->hOwner = NULL; - Wnd->Wnd->spwndOwner = NULL; + Wnd->spwndOwner = NULL; + Wnd->Wnd->spwndOwner = NULL; }
UserDereferenceObject(Wnd); @@ -1277,31 +1253,6 @@ WndParent->spwndChild = Wnd->spwndNext;
Wnd->spwndPrev = Wnd->spwndNext = Wnd->spwndParent = NULL; -} - -BOOL FASTCALL -IntAnyPopup(VOID) -{ - PWINDOW_OBJECT Window, Child; - - if(!(Window = UserGetWindowObject(IntGetDesktopWindow()))) - { - return FALSE; - } - - for(Child = Window->spwndChild; Child; Child = Child->spwndNext) - { - if(Child->hOwner && Child->Wnd->style & WS_VISIBLE) - { - /* - * The desktop has a popup window if one of them has - * an owner window and is visible - */ - return TRUE; - } - } - - return FALSE; }
BOOL FASTCALL @@ -1511,7 +1462,7 @@ Window = CONTAINING_RECORD(Current, WINDOW_OBJECT, ThreadListEntry); ASSERT(Window);
- if(bChildren || Window->hOwner != NULL) + if(bChildren || Window->spwndOwner != NULL) { if(dwCount < *pBufSize && pWnd) { @@ -1737,7 +1688,7 @@ Window->pti = pti; Window->hSelf = hWnd; Window->spwndParent = ParentWindow; - Window->hOwner = OwnerWindow ? OwnerWindow->hSelf : NULL; + Window->spwndOwner = OwnerWindow;
Wnd->head.h = hWnd; Wnd->head.pti = pti; @@ -2560,7 +2511,7 @@ Child = UserGetWindowObject(*ChildHandle); if (Child == NULL) continue; - if (Child->hOwner != Window->hSelf) + if (Child->spwndOwner != Window) { continue; } @@ -2576,9 +2527,9 @@ continue; }
- if (Child->hOwner != NULL) + if (Child->spwndOwner != NULL) { - Child->hOwner = NULL; + Child->spwndOwner = NULL; Child->Wnd->spwndOwner = NULL; }
@@ -3041,9 +2992,6 @@ break; }
- //temp hack -// UserDereferenceObject(Parent); - WndAncestor = Parent; } break; @@ -3374,7 +3322,7 @@ NtUserSetShellWindowEx(HWND hwndShell, HWND hwndListView) { PWINSTATION_OBJECT WinStaObject; - PWINDOW_OBJECT WndShell; + PWINDOW_OBJECT WndShell, WndListView; DECLARE_RETURN(BOOL); USER_REFERENCE_ENTRY Ref; NTSTATUS Status; @@ -3384,6 +3332,11 @@ UserEnterExclusive();
if (!(WndShell = UserGetWindowObject(hwndShell))) + { + RETURN(FALSE); + } + + if(!(WndListView = UserGetWindowObject(hwndListView))) { RETURN(FALSE); } @@ -3421,14 +3374,14 @@ co_WinPosSetWindowPos(hwndListView, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); #endif
- if (UserGetWindowLong(hwndListView, GWL_EXSTYLE, FALSE) & WS_EX_TOPMOST) + if (WndListView->Wnd->ExStyle & WS_EX_TOPMOST) { ObDereferenceObject(WinStaObject); RETURN( FALSE); } }
- if (UserGetWindowLong(hwndShell, GWL_EXSTYLE, FALSE) & WS_EX_TOPMOST) + if (WndShell->Wnd->ExStyle & WS_EX_TOPMOST) { ObDereferenceObject(WinStaObject); RETURN( FALSE); @@ -3553,162 +3506,6 @@ END_CLEANUP; }
-HWND FASTCALL -UserGetWindow(HWND hWnd, UINT Relationship) -{ - PWINDOW_OBJECT Parent, Window; - HWND hWndResult = NULL; - - if (!(Window = UserGetWindowObject(hWnd))) - return NULL; - - switch (Relationship) - { - case GW_HWNDFIRST: - if((Parent = Window->spwndParent)) - { - if (Parent->spwndChild) - hWndResult = Parent->spwndChild->hSelf; - } - break; - - case GW_HWNDLAST: - if((Parent = Window->spwndParent)) - { - if (Parent->spwndChild) - { - Window = Parent->spwndChild; - if(Window) - { - while(Window->spwndNext) - Window = Window->spwndNext; - } - hWndResult = Window->hSelf; - } - } - break; - - case GW_HWNDNEXT: - if (Window->spwndNext) - hWndResult = Window->spwndNext->hSelf; - break; - - case GW_HWNDPREV: - if (Window->spwndPrev) - hWndResult = Window->spwndPrev->hSelf; - break; - - case GW_OWNER: - if((Parent = UserGetWindowObject(Window->hOwner))) - { - hWndResult = Parent->hSelf; - } - break; - case GW_CHILD: - if (Window->spwndChild) - hWndResult = Window->spwndChild->hSelf; - break; - } - - return hWndResult; -} - -/* - * NtUserGetWindowLong - * - * The NtUserGetWindowLong function retrieves information about the specified - * window. The function also retrieves the 32-bit (long) value at the - * specified offset into the extra window memory. - * - * Status - * @implemented - */ - -LONG FASTCALL -UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi) -{ - PWINDOW_OBJECT Window, Parent; - PWND Wnd; - LONG Result = 0; - - DPRINT("NtUserGetWindowLong(%x,%d,%d)\n", hWnd, (INT)Index, Ansi); - - if (!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd) - { - return 0; - } - - Wnd = Window->Wnd; - - /* - * WndProc is only available to the owner process - */ - if (GWL_WNDPROC == Index - && Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess()) - { - SetLastWin32Error(ERROR_ACCESS_DENIED); - return 0; - } - - if ((INT)Index >= 0) - { - if ((Index + sizeof(LONG)) > Window->Wnd->cbwndExtra) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - Result = *((LONG *)((PCHAR)(Window->Wnd + 1) + Index)); - } - else - { - switch (Index) - { - case GWL_EXSTYLE: - Result = Wnd->ExStyle; - break; - - case GWL_STYLE: - Result = Wnd->style; - break; - - case GWL_WNDPROC: - Result = (LONG)IntGetWindowProc(Wnd, Ansi); - break; - - case GWL_HINSTANCE: - Result = (LONG) Wnd->hModule; - break; - - case GWL_HWNDPARENT: - Parent = Window->spwndParent; - if(Parent) - { - if (Parent && Parent->hSelf == IntGetDesktopWindow()) - Result = (LONG) UserGetWindow(Window->hSelf, GW_OWNER); - else - Result = (LONG) Parent->hSelf; - } - break; - - case GWL_ID: - Result = (LONG) Wnd->IDMenu; - break; - - case GWL_USERDATA: - Result = Wnd->dwUserData; - break; - - default: - DPRINT1("NtUserGetWindowLong(): Unsupported index %d\n", Index); - SetLastWin32Error(ERROR_INVALID_PARAMETER); - Result = 0; - break; - } - } - - return Result; -} - LONG FASTCALL co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi) { @@ -4807,7 +4604,7 @@ // In User32, these are called after: NotifyWinEvent EVENT_OBJECT_NAMECHANGE than // RepaintButton, StaticRepaint, NtUserCallHwndLock HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK, etc. /* Send shell notifications */ - if (!IntGetOwner(Window) && !IntGetParent(Window)) + if (!Window->spwndOwner && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) hWnd); } @@ -4908,11 +4705,10 @@ count++; while (--count >= 0) { - if (UserGetWindow( win_array[count], GW_OWNER ) != OwnerWnd->hSelf) - continue; if (!(pWnd = UserGetWindowObject( win_array[count] ))) continue; - // if (pWnd == WND_OTHER_PROCESS) continue; + if (pWnd->spwndOwner != OwnerWnd) + continue;
if (fShow) {
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -151,7 +151,7 @@ }
/* If this is popup window, try to activate the owner first. */ - if ((Wnd->style & WS_POPUP) && (WndTo = IntGetOwner(Window))) + if ((Wnd->style & WS_POPUP) && (WndTo = Window->spwndOwner)) { WndTo = UserGetAncestor( WndTo, GA_ROOT ); if (can_activate_window(WndTo)) goto done; @@ -741,10 +741,14 @@ WinPosDoOwnedPopups(HWND hWnd, HWND hWndInsertAfter) { HWND *List = NULL; - HWND Owner = UserGetWindow(hWnd, GW_OWNER); - LONG Style = UserGetWindowLong(hWnd, GWL_STYLE, FALSE); - PWINDOW_OBJECT DesktopWindow, ChildObject; + HWND Owner; + LONG Style; + PWINDOW_OBJECT Window ,DesktopWindow, ChildObject; int i; + + Window = UserGetWindowObject(hWnd); + Owner = Window->spwndOwner ? Window->spwndOwner->hSelf : NULL; + Style = Window->Wnd->style;
if ((Style & WS_POPUP) && Owner) { @@ -804,8 +808,7 @@ if (!(Wnd = UserGetWindowObject(List[i]))) continue;
- if ((Wnd->Wnd->style & WS_POPUP) && - UserGetWindow(List[i], GW_OWNER) == hWnd) + if (Wnd->Wnd->style & WS_POPUP && Wnd->spwndOwner == Window) { USER_REFERENCE_ENTRY Ref; UserRefObjectCo(Wnd, &Ref); @@ -958,7 +961,7 @@ * itself. */ if ((WinPos->hwnd == WinPos->hwndInsertAfter) || - (WinPos->hwnd == UserGetWindow(WinPos->hwndInsertAfter, GW_HWNDNEXT))) + (WinPos->hwnd == InsAfterWnd->spwndNext->hSelf)) { WinPos->flags |= SWP_NOZORDER; }
Modified: trunk/reactos/subsystems/win32/win32k/w32ksvc.db URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/w32... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -684,7 +684,6 @@ # NtUserBuildMenuItemList 4 NtUserCreateCursorIconHandle 2 -NtUserGetClassLong 3 NtUserGetMenuDefaultItem 3 NtUserGetLastInputInfo 1 NtUserGetMinMaxInfo 3