From 23c877364c599aa576afdde87809d4ad298faf2c Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Thu, 15 Nov 2007 19:42:41 +0000 Subject: [PATCH] - Fix desktop heaps handling and various bugs - Begin superseding the WINDOW_OBJECT structure by WINDOW which is located on the desktop heap - Implement GetClientRect() and GetWindowRect() to read the information from the desktop heap svn path=/trunk/; revision=30467 --- reactos/dll/win32/user32/include/user32.h | 15 +- reactos/dll/win32/user32/include/user32p.h | 3 + reactos/dll/win32/user32/misc/misc.c | 61 +++++--- reactos/dll/win32/user32/windows/window.c | 22 ++- reactos/include/reactos/win32k/ntuser.h | 16 +++ .../subsystems/win32/win32k/eng/engwindow.c | 8 +- .../subsystems/win32/win32k/include/desktop.h | 10 +- .../subsystems/win32/win32k/include/win32.h | 1 + .../subsystems/win32/win32k/include/window.h | 10 +- .../subsystems/win32/win32k/include/winpos.h | 12 +- .../subsystems/win32/win32k/ntuser/callback.c | 2 +- .../win32/win32k/ntuser/cursoricon.c | 8 +- .../subsystems/win32/win32k/ntuser/desktop.c | 39 +++--- .../subsystems/win32/win32k/ntuser/input.c | 8 +- reactos/subsystems/win32/win32k/ntuser/menu.c | 4 +- .../subsystems/win32/win32k/ntuser/message.c | 4 +- reactos/subsystems/win32/win32k/ntuser/misc.c | 20 +++ .../subsystems/win32/win32k/ntuser/monitor.c | 4 +- .../subsystems/win32/win32k/ntuser/painting.c | 58 ++++---- .../win32/win32k/ntuser/scrollbar.c | 16 +-- reactos/subsystems/win32/win32k/ntuser/vis.c | 26 ++-- .../subsystems/win32/win32k/ntuser/windc.c | 30 ++-- .../subsystems/win32/win32k/ntuser/window.c | 123 ++++++++++------ .../subsystems/win32/win32k/ntuser/winpos.c | 132 +++++++++--------- reactos/subsystems/win32/win32k/objects/arc.c | 16 +-- 25 files changed, 385 insertions(+), 263 deletions(-) diff --git a/reactos/dll/win32/user32/include/user32.h b/reactos/dll/win32/user32/include/user32.h index 858850ea589..9a9d8506a36 100644 --- a/reactos/dll/win32/user32/include/user32.h +++ b/reactos/dll/win32/user32/include/user32.h @@ -62,8 +62,18 @@ DesktopPtrToUser(PVOID Ptr) PW32THREADINFO ti = GetW32ThreadInfo(); ASSERT(Ptr != NULL); ASSERT(ti != NULL); - ASSERT(ti->DesktopHeapDelta != 0); - return (PVOID)((ULONG_PTR)Ptr - ti->DesktopHeapDelta); + if ((ULONG_PTR)Ptr >= (ULONG_PTR)ti->DesktopHeapBase && + (ULONG_PTR)Ptr < (ULONG_PTR)ti->DesktopHeapBase + ti->DesktopHeapLimit) + { + return (PVOID)((ULONG_PTR)Ptr - ti->DesktopHeapDelta); + } + else + { + /* NOTE: This is slow as it requires a call to win32k. This should only be + neccessary if a thread wants to access an object on a different + desktop */ + return NtUserGetDesktopMapping(Ptr); + } } static __inline PVOID @@ -76,3 +86,4 @@ SharedPtrToKernel(PVOID Ptr) } PCALLPROC FASTCALL ValidateCallProc(HANDLE hCallProc); +PWINDOW FASTCALL ValidateHwnd(HWND hwnd); diff --git a/reactos/dll/win32/user32/include/user32p.h b/reactos/dll/win32/user32/include/user32p.h index 5186ae4a044..29d542db6ed 100644 --- a/reactos/dll/win32/user32/include/user32p.h +++ b/reactos/dll/win32/user32/include/user32p.h @@ -120,6 +120,9 @@ #define NtUserShowCursor(bShow) \ NtUserCallOneParam((DWORD)bShow, ONEPARAM_ROUTINE_SHOWCURSOR) +#define NtUserGetDesktopMapping(Ptr) \ + (PVOID)NtUserCallOneParam((DWORD)Ptr, ONEPARAM_ROUTINE_GETDESKTOPMAPPING) + #define ShowCaret(hwnd) \ NtUserShowCaret(hwnd) diff --git a/reactos/dll/win32/user32/misc/misc.c b/reactos/dll/win32/user32/misc/misc.c index a215552257a..4625be81993 100644 --- a/reactos/dll/win32/user32/misc/misc.c +++ b/reactos/dll/win32/user32/misc/misc.c @@ -339,7 +339,7 @@ GetUser32Handle(HANDLE handle) static const BOOL g_ObjectHeapTypeShared[VALIDATE_TYPE_MONITOR + 1] = { FALSE, /* VALIDATE_TYPE_FREE (not used) */ - FALSE, /* VALIDATE_TYPE_WIN */ + TRUE, /* VALIDATE_TYPE_WIN */ /* FIXME: FALSE once WINDOW_OBJECT is deleted! */ TRUE, /* VALIDATE_TYPE_MENU */ TRUE, /* VALIDATE_TYPE_CURSOR */ TRUE, /* VALIDATE_TYPE_MWPOS */ @@ -362,16 +362,8 @@ ValidateHandle(HANDLE handle, UINT uType) { PVOID ret; PUSER_HANDLE_ENTRY pEntry; - PW32CLIENTINFO ClientInfo = GetWin32ClientInfo(); ASSERT(uType <= VALIDATE_TYPE_MONITOR); - ASSERT(ClientInfo != NULL); - - /* See if we have the handle cached still */ - if (uType == VALIDATE_TYPE_WIN) - { - if (handle == ClientInfo->hWND) return ClientInfo->pvWND; - } pEntry = GetUser32Handle(handle); @@ -413,22 +405,11 @@ ValidateHandle(HANDLE handle, UINT uType) else ret = DesktopPtrToUser(pEntry->ptr); - /* Update the cache */ -#if 0 - /* FIXME: To enable this win32k needs to check this information when destroying - the window handle and clear it out of the ClientInfo structure! */ - if (uType == VALIDATE_TYPE_WIN) - { - ClientInfo->hWND = handle; - ClientInfo->pvWND = ret; - } -#endif - return ret; } // -// Validate callproc handle and return the pointer to the object. +// Validate a callproc handle and return the pointer to the object. // PCALLPROC FASTCALL @@ -440,3 +421,41 @@ ValidateCallProc(HANDLE hCallProc) return NULL; } + +// +// Validate a window handle and return the pointer to the object. +// +PWINDOW +FASTCALL +ValidateHwnd(HWND hwnd) +{ + PW32CLIENTINFO ClientInfo = GetWin32ClientInfo(); + ASSERT(ClientInfo != NULL); + + /* See if the window is cached */ + if (hwnd == ClientInfo->hWND) + return ClientInfo->pvWND; + + PWINDOW Wnd = ValidateHandle((HANDLE)hwnd, VALIDATE_TYPE_WIN); + if (Wnd != NULL) + { + /* FIXME: Check if handle table entry is marked as deleting and + return NULL in this case! */ + +#if 0 + return Wnd; +#else + /* HACK HACK HACK! This needs to be done until WINDOW_OBJECT is completely + superseded by the WINDOW structure. We *ASSUME* a pointer to the WINDOW + structure to be at the beginning of the WINDOW_OBJECT structure!!! + + !!! REMOVE AS SOON AS WINDOW_OBJECT NO LONGER EXISTS !!! + */ + + if (*((PVOID*)Wnd) != NULL) + return DesktopPtrToUser(*((PVOID*)Wnd)); +#endif + } + + return NULL; +} diff --git a/reactos/dll/win32/user32/windows/window.c b/reactos/dll/win32/user32/windows/window.c index 8e262a494d9..15c9cde104d 100644 --- a/reactos/dll/win32/user32/windows/window.c +++ b/reactos/dll/win32/user32/windows/window.c @@ -860,7 +860,17 @@ GetAncestor(HWND hwnd, UINT gaFlags) BOOL STDCALL GetClientRect(HWND hWnd, LPRECT lpRect) { - return(NtUserGetClientRect(hWnd, lpRect)); + PWINDOW Wnd = ValidateHwnd(hWnd); + + if (Wnd != NULL) + { + lpRect->left = lpRect->top = 0; + lpRect->right = Wnd->ClientRect.right - Wnd->ClientRect.left; + lpRect->bottom = Wnd->ClientRect.bottom - Wnd->ClientRect.top; + return TRUE; + } + + return FALSE; } @@ -1007,7 +1017,15 @@ BOOL STDCALL GetWindowRect(HWND hWnd, LPRECT lpRect) { - return(NtUserGetWindowRect(hWnd, lpRect)); + PWINDOW Wnd = ValidateHwnd(hWnd); + + if (Wnd != NULL) + { + *lpRect = Wnd->WindowRect; + return TRUE; + } + + return FALSE; } diff --git a/reactos/include/reactos/win32k/ntuser.h b/reactos/include/reactos/win32k/ntuser.h index ca8885e2e69..140f3be63bf 100644 --- a/reactos/include/reactos/win32k/ntuser.h +++ b/reactos/include/reactos/win32k/ntuser.h @@ -7,6 +7,7 @@ struct _W32THREADINFO; typedef struct _DESKTOP { HANDLE hKernelHeap; + ULONG_PTR HeapLimit; WCHAR szDesktopName[1]; HWND hTaskManWindow; HWND hProgmanWindow; @@ -55,6 +56,18 @@ typedef struct _WINDOWCLASS UINT MenuNameIsString : 1; } WINDOWCLASS, *PWINDOWCLASS; +typedef struct _WINDOW +{ + /* NOTE: This structure is located in the desktop heap and will + eventually replace WINDOW_OBJECT. Right now WINDOW_OBJECT + keeps a reference to this structure until all the information + is moved to this structure */ + struct _W32PROCESSINFO *pi; /* FIXME: Move to object header some day */ + struct _W32THREADINFO *ti; + RECT WindowRect; + RECT ClientRect; +} WINDOW, *PWINDOW; + typedef struct _W32PROCESSINFO { PVOID UserHandleTable; @@ -71,6 +84,8 @@ typedef struct _W32THREADINFO PW32PROCESSINFO pi; /* [USER] */ PW32PROCESSINFO kpi; /* [KERNEL] */ PDESKTOP Desktop; + PVOID DesktopHeapBase; + ULONG_PTR DesktopHeapLimit; ULONG_PTR DesktopHeapDelta; } W32THREADINFO, *PW32THREADINFO; @@ -496,6 +511,7 @@ NtUserCallNoParam( #define ONEPARAM_ROUTINE_GETCURSORPOSITION 0x0b #define ONEPARAM_ROUTINE_ISWINDOWINDESTROY 0x0c #define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0x0d +#define ONEPARAM_ROUTINE_GETDESKTOPMAPPING 0x0e #define ONEPARAM_ROUTINE_GETWINDOWINSTANCE 0x10 #define ONEPARAM_ROUTINE_MSQSETWAKEMASK 0x27 #define ONEPARAM_ROUTINE_GETKEYBOARDTYPE 0x28 diff --git a/reactos/subsystems/win32/win32k/eng/engwindow.c b/reactos/subsystems/win32/win32k/eng/engwindow.c index c8f1aa258fb..e1c0e53be98 100644 --- a/reactos/subsystems/win32/win32k/eng/engwindow.c +++ b/reactos/subsystems/win32/win32k/eng/engwindow.c @@ -85,7 +85,7 @@ IntEngWndUpdateClipObj( hVisRgn = VIS_ComputeVisibleRegion(Window, TRUE, TRUE, TRUE); if (hVisRgn != NULL) { - NtGdiOffsetRgn(hVisRgn, Window->ClientRect.left, Window->ClientRect.top); + NtGdiOffsetRgn(hVisRgn, Window->Wnd->ClientRect.left, Window->Wnd->ClientRect.top); visRgn = RGNDATA_LockRgn(hVisRgn); if (visRgn != NULL) { @@ -122,8 +122,8 @@ IntEngWndUpdateClipObj( if (ClipObj == NULL) { /* Fall back to client rect */ - ClipObj = IntEngCreateClipRegion(1, (PRECTL)&Window->ClientRect, - (PRECTL)&Window->ClientRect); + ClipObj = IntEngCreateClipRegion(1, (PRECTL)&Window->Wnd->ClientRect, + (PRECTL)&Window->Wnd->ClientRect); } if (ClipObj == NULL) @@ -133,7 +133,7 @@ IntEngWndUpdateClipObj( } RtlCopyMemory(&WndObjInt->WndObj.coClient, ClipObj, sizeof (CLIPOBJ)); - RtlCopyMemory(&WndObjInt->WndObj.rclClient, &Window->ClientRect, sizeof (RECT)); + RtlCopyMemory(&WndObjInt->WndObj.rclClient, &Window->Wnd->ClientRect, sizeof (RECT)); OldClipObj = InterlockedExchangePointer(&WndObjInt->ClientClipObj, ClipObj); if (OldClipObj != NULL) IntEngDeleteClipRegion(OldClipObj); diff --git a/reactos/subsystems/win32/win32k/include/desktop.h b/reactos/subsystems/win32/win32k/include/desktop.h index 05a7a60de4d..d585865bf94 100644 --- a/reactos/subsystems/win32/win32k/include/desktop.h +++ b/reactos/subsystems/win32/win32k/include/desktop.h @@ -205,7 +205,7 @@ DesktopHeapGetUserDelta(VOID) Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next; while (Mapping != NULL) { - if (Mapping->UserMapping == (PVOID)hDesktopHeap) + if (Mapping->KernelMapping == (PVOID)hDesktopHeap) { Delta = (ULONG_PTR)Mapping->KernelMapping - (ULONG_PTR)Mapping->UserMapping; break; @@ -218,17 +218,17 @@ DesktopHeapGetUserDelta(VOID) } static __inline PVOID -DesktopHeapAddressToUser(IN PDESKTOP Desktop, - PVOID lpMem) +DesktopHeapAddressToUser(PVOID lpMem) { PW32HEAP_USER_MAPPING Mapping; Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next; while (Mapping != NULL) { - if (Mapping->KernelMapping == (PVOID)Desktop->hKernelHeap) + if ((ULONG_PTR)lpMem >= (ULONG_PTR)Mapping->KernelMapping && + (ULONG_PTR)lpMem < (ULONG_PTR)Mapping->KernelMapping + Mapping->Limit) { - return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)Desktop->hKernelHeap) + + return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)Mapping->KernelMapping) + (ULONG_PTR)Mapping->UserMapping); } diff --git a/reactos/subsystems/win32/win32k/include/win32.h b/reactos/subsystems/win32/win32k/include/win32.h index 61f5783b5e9..4e27781f0e1 100644 --- a/reactos/subsystems/win32/win32k/include/win32.h +++ b/reactos/subsystems/win32/win32k/include/win32.h @@ -25,6 +25,7 @@ typedef struct _W32HEAP_USER_MAPPING struct _W32HEAP_USER_MAPPING *Next; PVOID KernelMapping; PVOID UserMapping; + ULONG_PTR Limit; ULONG Count; } W32HEAP_USER_MAPPING, *PW32HEAP_USER_MAPPING; diff --git a/reactos/subsystems/win32/win32k/include/window.h b/reactos/subsystems/win32/win32k/include/window.h index ae46e6998d2..95c1642bdfb 100644 --- a/reactos/subsystems/win32/win32k/include/window.h +++ b/reactos/subsystems/win32/win32k/include/window.h @@ -26,6 +26,12 @@ typedef struct _INTERNALPOS typedef struct _WINDOW_OBJECT { + /* NOTE: Do *NOT* Move this pointer anywhere in this structure! This + is a pointer to the WINDOW structure that eventually replaces + the WINDOW_OBJECT structure! USER32 expects this pointer to + be here until WINDOW_OBJECT has completely been superseded! */ + PWINDOW Wnd; + /* Pointer to the thread information */ PW32THREADINFO ti; /* Pointer to the desktop */ @@ -59,10 +65,6 @@ typedef struct _WINDOW_OBJECT PCHAR ExtraData; /* Size of the extra data associated with the window. */ ULONG ExtraDataSize; - /* Position of the window. */ - RECT WindowRect; - /* Position of the window's client area. */ - RECT ClientRect; /* Handle for the window. */ HWND hSelf; /* Window flags. */ diff --git a/reactos/subsystems/win32/win32k/include/winpos.h b/reactos/subsystems/win32/win32k/include/winpos.h index 3b6b5c926c0..ba5080b1a34 100644 --- a/reactos/subsystems/win32/win32k/include/winpos.h +++ b/reactos/subsystems/win32/win32k/include/winpos.h @@ -6,13 +6,13 @@ #define SWP_NOCLIENTSIZE 0x1000 #define IntPtInWindow(WndObject,x,y) \ - ((x) >= (WndObject)->WindowRect.left && \ - (x) < (WndObject)->WindowRect.right && \ - (y) >= (WndObject)->WindowRect.top && \ - (y) < (WndObject)->WindowRect.bottom && \ + ((x) >= (WndObject)->Wnd->WindowRect.left && \ + (x) < (WndObject)->Wnd->WindowRect.right && \ + (y) >= (WndObject)->Wnd->WindowRect.top && \ + (y) < (WndObject)->Wnd->WindowRect.bottom && \ (!(WndObject)->WindowRegion || ((WndObject)->Style & WS_MINIMIZE) || \ - NtGdiPtInRegion((WndObject)->WindowRegion, (INT)((x) - (WndObject)->WindowRect.left), \ - (INT)((y) - (WndObject)->WindowRect.top)))) + NtGdiPtInRegion((WndObject)->WindowRegion, (INT)((x) - (WndObject)->Wnd->WindowRect.left), \ + (INT)((y) - (WndObject)->Wnd->WindowRect.top)))) UINT FASTCALL co_WinPosArrangeIconicWindows(PWINDOW_OBJECT parent); diff --git a/reactos/subsystems/win32/win32k/ntuser/callback.c b/reactos/subsystems/win32/win32k/ntuser/callback.c index 62de2f7ed0a..0ee8fd9ed26 100644 --- a/reactos/subsystems/win32/win32k/ntuser/callback.c +++ b/reactos/subsystems/win32/win32k/ntuser/callback.c @@ -122,7 +122,7 @@ IntSetTebWndCallback (HWND * hWnd, PVOID * pWnd) *pWnd = ClientInfo->pvWND; ClientInfo->hWND = hWndS; - ClientInfo->pvWND = (PVOID) Window; + ClientInfo->pvWND = DesktopHeapAddressToUser(Window->Wnd); } static VOID diff --git a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c index f44499752cc..40f64a97218 100644 --- a/reactos/subsystems/win32/win32k/ntuser/cursoricon.c +++ b/reactos/subsystems/win32/win32k/ntuser/cursoricon.c @@ -878,10 +878,10 @@ NtUserClipCursor( MOUSEINPUT mi; CurInfo->CursorClipInfo.IsClipped = TRUE; - CurInfo->CursorClipInfo.Left = max(Rect.left, DesktopWindow->WindowRect.left); - CurInfo->CursorClipInfo.Top = max(Rect.top, DesktopWindow->WindowRect.top); - CurInfo->CursorClipInfo.Right = min(Rect.right - 1, DesktopWindow->WindowRect.right - 1); - CurInfo->CursorClipInfo.Bottom = min(Rect.bottom - 1, DesktopWindow->WindowRect.bottom - 1); + CurInfo->CursorClipInfo.Left = max(Rect.left, DesktopWindow->Wnd->WindowRect.left); + CurInfo->CursorClipInfo.Top = max(Rect.top, DesktopWindow->Wnd->WindowRect.top); + CurInfo->CursorClipInfo.Right = min(Rect.right - 1, DesktopWindow->Wnd->WindowRect.right - 1); + CurInfo->CursorClipInfo.Bottom = min(Rect.bottom - 1, DesktopWindow->Wnd->WindowRect.bottom - 1); mi.dx = MousePos.x; mi.dy = MousePos.y; diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index a3c7bab7fc0..d3138d23df6 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -870,6 +870,7 @@ NtUserCreateDesktop( SIZE_T DesktopInfoSize; UNICODE_STRING SafeDesktopName; ULONG DummyContext; + ULONG_PTR HeapLimit = 4 * 1024 * 1024; /* FIXME */ DECLARE_RETURN(HDESK); @@ -955,7 +956,7 @@ NtUserCreateDesktop( DesktopObject->DesktopHeapSection = NULL; DesktopObject->hDesktopHeap = UserCreateHeap(&DesktopObject->DesktopHeapSection, &DesktopHeapSystemBase, - 4 * 1024 * 1024); /* FIXME */ + HeapLimit); if (DesktopObject->hDesktopHeap == NULL) { ObDereferenceObject(DesktopObject); @@ -981,6 +982,7 @@ NtUserCreateDesktop( DesktopInfoSize); DesktopObject->DesktopInfo->hKernelHeap = DesktopObject->hDesktopHeap; + DesktopObject->DesktopInfo->HeapLimit = HeapLimit; RtlCopyMemory(DesktopObject->DesktopInfo->szDesktopName, lpszDesktopName->Buffer, lpszDesktopName->Length); @@ -1372,8 +1374,8 @@ NtUserPaintDesktop(HDC hDC) int x, y; HDC hWallpaperDC; - sz.cx = DeskWin->WindowRect.right - DeskWin->WindowRect.left; - sz.cy = DeskWin->WindowRect.bottom - DeskWin->WindowRect.top; + sz.cx = DeskWin->Wnd->WindowRect.right - DeskWin->Wnd->WindowRect.left; + sz.cy = DeskWin->Wnd->WindowRect.bottom - DeskWin->Wnd->WindowRect.top; if (WinSta->WallpaperMode == wmStretch || WinSta->WallpaperMode == wmTile) @@ -1736,6 +1738,8 @@ IntUnmapDesktopView(IN PDESKTOP_OBJECT DesktopObject) if (ti->Desktop == DesktopObject->DesktopInfo) { ti->Desktop = NULL; + ti->DesktopHeapBase = NULL; + ti->DesktopHeapLimit = 0; ti->DesktopHeapDelta = 0; } } @@ -1799,6 +1803,7 @@ IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject) HeapMapping->Next = NULL; HeapMapping->KernelMapping = (PVOID)DesktopObject->hDesktopHeap; HeapMapping->UserMapping = UserBase; + HeapMapping->Limit = ViewSize; HeapMapping->Count = 1; *PrevLink = HeapMapping; @@ -1811,6 +1816,8 @@ IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject) if (ti->Desktop == NULL) { ti->Desktop = DesktopObject->DesktopInfo; + ti->DesktopHeapBase = DesktopObject->hDesktopHeap; + ti->DesktopHeapLimit = ViewSize; ti->DesktopHeapDelta = DesktopHeapGetUserDelta(); } } @@ -1854,6 +1861,16 @@ IntSetThreadDesktop(IN PDESKTOP_OBJECT DesktopObject, } } + if (W32Thread->Desktop == NULL) + { + PW32THREADINFO ti = GetW32ThreadInfo(); + if (ti != NULL) + { + ti->Desktop = NULL; + ti->DesktopHeapDelta = 0; + } + } + if (OldDesktop != NULL && !IntCheckProcessDesktopClasses(OldDesktop->DesktopInfo, FreeOnFailure)) @@ -1881,22 +1898,6 @@ IntSetThreadDesktop(IN PDESKTOP_OBJECT DesktopObject, } ObDereferenceObject(OldDesktop); - - /* update the thread info */ - if (W32Thread != NULL && W32Thread->ThreadInfo != NULL && - W32Thread->ThreadInfo->Desktop != (DesktopObject != NULL ? DesktopObject->DesktopInfo : NULL)) - { - if (DesktopObject != NULL) - { - W32Thread->ThreadInfo->Desktop = DesktopObject->DesktopInfo; - W32Thread->ThreadInfo->DesktopHeapDelta = DesktopHeapGetUserDelta(); - } - else - { - W32Thread->ThreadInfo->Desktop = NULL; - W32Thread->ThreadInfo->DesktopHeapDelta = 0; - } - } } } diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index fca3b91a0a9..3edf507a4bf 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -1054,10 +1054,10 @@ IntMouseInput(MOUSEINPUT *mi) if (DesktopWindow) { - if(MousePos.x >= DesktopWindow->ClientRect.right) - MousePos.x = DesktopWindow->ClientRect.right - 1; - if(MousePos.y >= DesktopWindow->ClientRect.bottom) - MousePos.y = DesktopWindow->ClientRect.bottom - 1; + if(MousePos.x >= DesktopWindow->Wnd->ClientRect.right) + MousePos.x = DesktopWindow->Wnd->ClientRect.right - 1; + if(MousePos.y >= DesktopWindow->Wnd->ClientRect.bottom) + MousePos.y = DesktopWindow->Wnd->ClientRect.bottom - 1; ObmDereferenceObject(DesktopWindow); } diff --git a/reactos/subsystems/win32/win32k/ntuser/menu.c b/reactos/subsystems/win32/win32k/ntuser/menu.c index 1f6422f8204..0544ed249d7 100644 --- a/reactos/subsystems/win32/win32k/ntuser/menu.c +++ b/reactos/subsystems/win32/win32k/ntuser/menu.c @@ -2154,8 +2154,8 @@ NtUserMenuItemFromPoint( RETURN( -1); } - X -= Window->WindowRect.left; - Y -= Window->WindowRect.top; + X -= Window->Wnd->WindowRect.left; + Y -= Window->Wnd->WindowRect.top; mi = Menu->MenuItemList; for (i = 0; NULL != mi; i++) diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 9012defca33..236cae2321f 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -633,8 +633,8 @@ co_IntTranslateMouseMessage(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg, USHORT * { /* NOTE: Msg->pt should remain in screen coordinates. -- FiN */ Msg->lParam = MAKELONG( - Msg->pt.x - (WORD)Window->ClientRect.left, - Msg->pt.y - (WORD)Window->ClientRect.top); + Msg->pt.x - (WORD)Window->Wnd->ClientRect.left, + Msg->pt.y - (WORD)Window->Wnd->ClientRect.top); } } diff --git a/reactos/subsystems/win32/win32k/ntuser/misc.c b/reactos/subsystems/win32/win32k/ntuser/misc.c index 893d7089e66..64b15ab1f92 100644 --- a/reactos/subsystems/win32/win32k/ntuser/misc.c +++ b/reactos/subsystems/win32/win32k/ntuser/misc.c @@ -242,6 +242,22 @@ NtUserCallOneParam( switch(Routine) { + case ONEPARAM_ROUTINE_GETDESKTOPMAPPING: + { + PW32THREADINFO ti; + ti = GetW32ThreadInfo(); + if (ti != NULL) + { + /* Try convert the pointer to a user mode pointer if the desktop is + mapped into the process */ + RETURN((DWORD)DesktopHeapAddressToUser((PVOID)Param)); + } + else + { + RETURN(0); + } + } + case ONEPARAM_ROUTINE_GETMENU: { PWINDOW_OBJECT Window; @@ -2542,11 +2558,15 @@ GetW32ThreadInfo(VOID) if (W32Thread->Desktop != NULL) { ti->Desktop = W32Thread->Desktop->DesktopInfo; + ti->DesktopHeapBase = W32Thread->Desktop->DesktopInfo->hKernelHeap; + ti->DesktopHeapLimit = W32Thread->Desktop->DesktopInfo->HeapLimit; ti->DesktopHeapDelta = DesktopHeapGetUserDelta(); } else { ti->Desktop = NULL; + ti->DesktopHeapBase = NULL; + ti->DesktopHeapLimit = 0; ti->DesktopHeapDelta = 0; } diff --git a/reactos/subsystems/win32/win32k/ntuser/monitor.c b/reactos/subsystems/win32/win32k/ntuser/monitor.c index ee79a9cef4c..157db905af6 100644 --- a/reactos/subsystems/win32/win32k/ntuser/monitor.c +++ b/reactos/subsystems/win32/win32k/ntuser/monitor.c @@ -879,8 +879,8 @@ NtUserMonitorFromWindow( RETURN(NULL); } - Rect.left = Rect.right = Window->WindowRect.left; - Rect.top = Rect.bottom = Window->WindowRect.bottom; + Rect.left = Rect.right = Window->Wnd->WindowRect.left; + Rect.top = Rect.bottom = Window->Wnd->WindowRect.bottom; IntGetMonitorsFromRect(&Rect, &hMonitor, NULL, 1, dwFlags); diff --git a/reactos/subsystems/win32/win32k/ntuser/painting.c b/reactos/subsystems/win32/win32k/ntuser/painting.c index cb48e73dbb9..4eabdb10050 100644 --- a/reactos/subsystems/win32/win32k/ntuser/painting.c +++ b/reactos/subsystems/win32/win32k/ntuser/painting.c @@ -68,7 +68,7 @@ IntIntersectWithParents(PWINDOW_OBJECT Child, PRECT WindowRect) return FALSE; } - if (!IntGdiIntersectRect(WindowRect, WindowRect, &ParentWindow->ClientRect)) + if (!IntGdiIntersectRect(WindowRect, WindowRect, &ParentWindow->Wnd->ClientRect)) { return FALSE; } @@ -119,19 +119,19 @@ IntCalcWindowRgn(PWINDOW_OBJECT Window, BOOL Client) UINT RgnType; if (Client) - hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); + hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect); else - hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); + hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect); if (Window->WindowRegion != NULL && !(Window->Style & WS_MINIMIZE)) { NtGdiOffsetRgn(hRgnWindow, - -Window->WindowRect.left, - -Window->WindowRect.top); + -Window->Wnd->WindowRect.left, + -Window->Wnd->WindowRect.top); RgnType = NtGdiCombineRgn(hRgnWindow, hRgnWindow, Window->WindowRegion, RGN_AND); NtGdiOffsetRgn(hRgnWindow, - Window->WindowRect.left, - Window->WindowRect.top); + Window->Wnd->WindowRect.left, + Window->Wnd->WindowRect.top); } return hRgnWindow; @@ -340,7 +340,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags) { HRGN hRgnClient; - hRgnClient = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); + hRgnClient = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect); RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnClient, RGN_AND); NtGdiDeleteObject(hRgnClient); } @@ -353,19 +353,19 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags) { HRGN hRgnWindow; - hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); + hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect); RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnWindow, RGN_AND); NtGdiDeleteObject(hRgnWindow); } else { NtGdiOffsetRgn(hRgn, - -Window->WindowRect.left, - -Window->WindowRect.top); + -Window->Wnd->WindowRect.left, + -Window->Wnd->WindowRect.top); RgnType = NtGdiCombineRgn(hRgn, hRgn, Window->WindowRegion, RGN_AND); NtGdiOffsetRgn(hRgn, - Window->WindowRect.left, - Window->WindowRect.top); + Window->Wnd->WindowRect.left, + Window->Wnd->WindowRect.top); } /* @@ -553,26 +553,26 @@ co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECT* UpdateRect, HRGN UpdateRg hRgn = NULL; } else - NtGdiOffsetRgn(hRgn, Window->ClientRect.left, Window->ClientRect.top); + NtGdiOffsetRgn(hRgn, Window->Wnd->ClientRect.left, Window->Wnd->ClientRect.top); } else if (UpdateRect != NULL) { if (!IntGdiIsEmptyRect(UpdateRect)) { hRgn = UnsafeIntCreateRectRgnIndirect((RECT *)UpdateRect); - NtGdiOffsetRgn(hRgn, Window->ClientRect.left, Window->ClientRect.top); + NtGdiOffsetRgn(hRgn, Window->Wnd->ClientRect.left, Window->Wnd->ClientRect.top); } } else if ((Flags & (RDW_INVALIDATE | RDW_FRAME)) == (RDW_INVALIDATE | RDW_FRAME) || (Flags & (RDW_VALIDATE | RDW_NOFRAME)) == (RDW_VALIDATE | RDW_NOFRAME)) { - if (!IntGdiIsEmptyRect(&Window->WindowRect)) - hRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); + if (!IntGdiIsEmptyRect(&Window->Wnd->WindowRect)) + hRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect); } else { - if (!IntGdiIsEmptyRect(&Window->ClientRect)) - hRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); + if (!IntGdiIsEmptyRect(&Window->Wnd->ClientRect)) + hRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect); } } @@ -797,12 +797,12 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs) { UnsafeIntGetRgnBox(Rgn, &Ps.rcPaint); RGNDATA_UnlockRgn(Rgn); - IntGdiIntersectRect(&Ps.rcPaint, &Ps.rcPaint, &Window->ClientRect); + IntGdiIntersectRect(&Ps.rcPaint, &Ps.rcPaint, &Window->Wnd->ClientRect); if (! IntGdiIsEmptyRect(&Ps.rcPaint)) { IntGdiOffsetRect(&Ps.rcPaint, - -Window->ClientRect.left, - -Window->ClientRect.top); + -Window->Wnd->ClientRect.left, + -Window->Wnd->ClientRect.top); } } else @@ -930,11 +930,11 @@ co_UserGetUpdateRgn(PWINDOW_OBJECT Window, HRGN hRgn, BOOL bErase) } else { - Rect = Window->ClientRect; + Rect = Window->Wnd->ClientRect; IntIntersectWithParents(Window, &Rect); NtGdiSetRectRgn(hRgn, Rect.left, Rect.top, Rect.right, Rect.bottom); RegionType = NtGdiCombineRgn(hRgn, hRgn, Window->UpdateRegion, RGN_AND); - NtGdiOffsetRgn(hRgn, -Window->ClientRect.left, -Window->ClientRect.top); + NtGdiOffsetRgn(hRgn, -Window->Wnd->ClientRect.left, -Window->Wnd->ClientRect.top); } if (bErase && RegionType != NULLREGION && RegionType != ERROR) @@ -1014,7 +1014,7 @@ NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase) /* Get the update region bounding box. */ if (Window->UpdateRegion == (HRGN)1) { - Rect = Window->ClientRect; + Rect = Window->Wnd->ClientRect; } else { @@ -1024,14 +1024,14 @@ NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase) RGNDATA_UnlockRgn(RgnData); if (RegionType != ERROR && RegionType != NULLREGION) - IntGdiIntersectRect(&Rect, &Rect, &Window->ClientRect); + IntGdiIntersectRect(&Rect, &Rect, &Window->Wnd->ClientRect); } if (IntIntersectWithParents(Window, &Rect)) { IntGdiOffsetRect(&Rect, - -Window->ClientRect.left, - -Window->ClientRect.top); + -Window->Wnd->ClientRect.left, + -Window->Wnd->ClientRect.top); } else { Rect.left = Rect.top = Rect.right = Rect.bottom = 0; @@ -1420,7 +1420,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *prcUnsafeScroll, IntGetClientOrigin(Window, &ClientOrigin); for (Child = Window->FirstChild; Child; Child = Child->NextSibling) { - rcChild = Child->WindowRect; + rcChild = Child->Wnd->WindowRect; rcChild.left -= ClientOrigin.x; rcChild.top -= ClientOrigin.y; rcChild.right -= ClientOrigin.x; diff --git a/reactos/subsystems/win32/win32k/ntuser/scrollbar.c b/reactos/subsystems/win32/win32k/ntuser/scrollbar.c index 538d55f87cc..e100f8bf792 100644 --- a/reactos/subsystems/win32/win32k/ntuser/scrollbar.c +++ b/reactos/subsystems/win32/win32k/ntuser/scrollbar.c @@ -60,8 +60,8 @@ BOOL FASTCALL IntGetScrollBarRect (PWINDOW_OBJECT Window, INT nBar, PRECT lprect) { BOOL vertical; - RECT ClientRect = Window->ClientRect; - RECT WindowRect = Window->WindowRect; + RECT ClientRect = Window->Wnd->ClientRect; + RECT WindowRect = Window->Wnd->WindowRect; switch (nBar) { @@ -394,10 +394,10 @@ co_IntSetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bR if (bRedraw) { RECT UpdateRect = psbi->rcScrollBar; - UpdateRect.left -= Window->ClientRect.left - Window->WindowRect.left; - UpdateRect.right -= Window->ClientRect.left - Window->WindowRect.left; - UpdateRect.top -= Window->ClientRect.top - Window->WindowRect.top; - UpdateRect.bottom -= Window->ClientRect.top - Window->WindowRect.top; + UpdateRect.left -= Window->Wnd->ClientRect.left - Window->Wnd->WindowRect.left; + UpdateRect.right -= Window->Wnd->ClientRect.left - Window->Wnd->WindowRect.left; + UpdateRect.top -= Window->Wnd->ClientRect.top - Window->Wnd->WindowRect.top; + UpdateRect.bottom -= Window->Wnd->ClientRect.top - Window->Wnd->WindowRect.top; co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); } @@ -467,8 +467,8 @@ co_IntCreateScrollBars(PWINDOW_OBJECT Window) RtlZeroMemory(Window->Scroll, Size); Result = co_WinPosGetNonClientSize(Window, - &Window->WindowRect, - &Window->ClientRect); + &Window->Wnd->WindowRect, + &Window->Wnd->ClientRect); for(s = SB_HORZ; s <= SB_VERT; s++) { diff --git a/reactos/subsystems/win32/win32k/ntuser/vis.c b/reactos/subsystems/win32/win32k/ntuser/vis.c index 0084e92a23f..0784e8550f9 100644 --- a/reactos/subsystems/win32/win32k/ntuser/vis.c +++ b/reactos/subsystems/win32/win32k/ntuser/vis.c @@ -47,11 +47,11 @@ VIS_ComputeVisibleRegion( if (ClientArea) { - VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); + VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect); } else { - VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); + VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect); } /* @@ -70,7 +70,7 @@ VIS_ComputeVisibleRegion( return NULL; } - ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->ClientRect); + ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->Wnd->ClientRect); NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_AND); NtGdiDeleteObject(ClipRgn); @@ -83,13 +83,13 @@ VIS_ComputeVisibleRegion( if ((CurrentSibling->Style & WS_VISIBLE) && !(CurrentSibling->ExStyle & WS_EX_TRANSPARENT)) { - ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentSibling->WindowRect); + ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentSibling->Wnd->WindowRect); /* Combine it with the window region if available */ if (CurrentSibling->WindowRegion && !(CurrentSibling->Style & WS_MINIMIZE)) { - NtGdiOffsetRgn(ClipRgn, -CurrentSibling->WindowRect.left, -CurrentSibling->WindowRect.top); + NtGdiOffsetRgn(ClipRgn, -CurrentSibling->Wnd->WindowRect.left, -CurrentSibling->Wnd->WindowRect.top); NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentSibling->WindowRegion, RGN_AND); - NtGdiOffsetRgn(ClipRgn, CurrentSibling->WindowRect.left, CurrentSibling->WindowRect.top); + NtGdiOffsetRgn(ClipRgn, CurrentSibling->Wnd->WindowRect.left, CurrentSibling->Wnd->WindowRect.top); } NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF); NtGdiDeleteObject(ClipRgn); @@ -110,13 +110,13 @@ VIS_ComputeVisibleRegion( if ((CurrentWindow->Style & WS_VISIBLE) && !(CurrentWindow->ExStyle & WS_EX_TRANSPARENT)) { - ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->WindowRect); + ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->Wnd->WindowRect); /* Combine it with the window region if available */ if (CurrentWindow->WindowRegion && !(CurrentWindow->Style & WS_MINIMIZE)) { - NtGdiOffsetRgn(ClipRgn, -CurrentWindow->WindowRect.left, -CurrentWindow->WindowRect.top); + NtGdiOffsetRgn(ClipRgn, -CurrentWindow->Wnd->WindowRect.left, -CurrentWindow->Wnd->WindowRect.top); NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentWindow->WindowRegion, RGN_AND); - NtGdiOffsetRgn(ClipRgn, CurrentWindow->WindowRect.left, CurrentWindow->WindowRect.top); + NtGdiOffsetRgn(ClipRgn, CurrentWindow->Wnd->WindowRect.left, CurrentWindow->Wnd->WindowRect.top); } NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF); NtGdiDeleteObject(ClipRgn); @@ -127,9 +127,9 @@ VIS_ComputeVisibleRegion( if (Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) { - NtGdiOffsetRgn(VisRgn, -Window->WindowRect.left, -Window->WindowRect.top); + NtGdiOffsetRgn(VisRgn, -Window->Wnd->WindowRect.left, -Window->Wnd->WindowRect.top); NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND); - NtGdiOffsetRgn(VisRgn, Window->WindowRect.left, Window->WindowRect.top); + NtGdiOffsetRgn(VisRgn, Window->Wnd->WindowRect.left, Window->Wnd->WindowRect.top); } return VisRgn; @@ -153,8 +153,8 @@ co_VIS_WindowLayoutChanged( if(Parent) { NtGdiOffsetRgn(Temp, - Window->WindowRect.left - Parent->ClientRect.left, - Window->WindowRect.top - Parent->ClientRect.top); + Window->Wnd->WindowRect.left - Parent->Wnd->ClientRect.left, + Window->Wnd->WindowRect.top - Parent->Wnd->ClientRect.top); UserRefObjectCo(Parent, &Ref); co_UserRedrawWindow(Parent, NULL, Temp, diff --git a/reactos/subsystems/win32/win32k/ntuser/windc.c b/reactos/subsystems/win32/win32k/ntuser/windc.c index 6c411458e13..b5accdea758 100644 --- a/reactos/subsystems/win32/win32k/ntuser/windc.c +++ b/reactos/subsystems/win32/win32k/ntuser/windc.c @@ -199,13 +199,13 @@ DceSetDrawable(PWINDOW_OBJECT Window OPTIONAL, HDC hDC, ULONG Flags, { if (Flags & DCX_WINDOW) { - dc->w.DCOrgX = Window->WindowRect.left; - dc->w.DCOrgY = Window->WindowRect.top; + dc->w.DCOrgX = Window->Wnd->WindowRect.left; + dc->w.DCOrgY = Window->Wnd->WindowRect.top; } else { - dc->w.DCOrgX = Window->ClientRect.left; - dc->w.DCOrgY = Window->ClientRect.top; + dc->w.DCOrgX = Window->Wnd->ClientRect.left; + dc->w.DCOrgY = Window->Wnd->ClientRect.top; } } DC_UnlockDc(dc); @@ -311,7 +311,7 @@ DceUpdateVisRgn(DCE *Dce, PWINDOW_OBJECT Window, ULONG Flags) DesktopWindow = UserGetWindowObject(IntGetDesktopWindow()); if (NULL != DesktopWindow) { - hRgnVisible = UnsafeIntCreateRectRgnIndirect(&DesktopWindow->WindowRect); + hRgnVisible = UnsafeIntCreateRectRgnIndirect(&DesktopWindow->Wnd->WindowRect); } else { @@ -530,11 +530,11 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags) { if (!(Flags & DCX_WINDOW)) { - Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); + Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect); } else { - Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); + Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect); } } else if (ClipRegion != NULL) @@ -819,17 +819,17 @@ DceResetActiveDCEs(PWINDOW_OBJECT Window) { if (pDCE->DCXFlags & DCX_WINDOW) { - DeltaX = CurrentWindow->WindowRect.left - dc->w.DCOrgX; - DeltaY = CurrentWindow->WindowRect.top - dc->w.DCOrgY; - dc->w.DCOrgX = CurrentWindow->WindowRect.left; - dc->w.DCOrgY = CurrentWindow->WindowRect.top; + DeltaX = CurrentWindow->Wnd->WindowRect.left - dc->w.DCOrgX; + DeltaY = CurrentWindow->Wnd->WindowRect.top - dc->w.DCOrgY; + dc->w.DCOrgX = CurrentWindow->Wnd->WindowRect.left; + dc->w.DCOrgY = CurrentWindow->Wnd->WindowRect.top; } else { - DeltaX = CurrentWindow->ClientRect.left - dc->w.DCOrgX; - DeltaY = CurrentWindow->ClientRect.top - dc->w.DCOrgY; - dc->w.DCOrgX = CurrentWindow->ClientRect.left; - dc->w.DCOrgY = CurrentWindow->ClientRect.top; + DeltaX = CurrentWindow->Wnd->ClientRect.left - dc->w.DCOrgX; + DeltaY = CurrentWindow->Wnd->ClientRect.top - dc->w.DCOrgY; + dc->w.DCOrgX = CurrentWindow->Wnd->ClientRect.left; + dc->w.DCOrgY = CurrentWindow->Wnd->ClientRect.top; } if (NULL != dc->w.hClipRgn) { diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 7066d6ee15f..e5bf0f78083 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -292,6 +292,21 @@ static void IntSendDestroyMsg(HWND hWnd) #endif } +static VOID +UserFreeWindowInfo(PW32THREADINFO ti, PWINDOW_OBJECT WindowObject) +{ + PW32CLIENTINFO ClientInfo = GetWin32ClientInfo(); + + if (ClientInfo->pvWND == DesktopHeapAddressToUser(WindowObject->Wnd)) + { + ClientInfo->hWND = NULL; + ClientInfo->pvWND = NULL; + } + + DesktopHeapFree(ti->Desktop, WindowObject->Wnd); + WindowObject->Wnd = NULL; +} + /*********************************************************************** * IntDestroyWindow * @@ -447,6 +462,9 @@ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window, RtlFreeUnicodeString(&Window->WindowName); + ASSERT(Window->Wnd != NULL); + UserFreeWindowInfo(Window->ti, Window); + UserDerefObject(Window); IntClipboardFreeWindow(Window); @@ -539,8 +557,8 @@ BOOL FASTCALL IntGetWindowInfo(PWINDOW_OBJECT Window, PWINDOWINFO pwi) { pwi->cbSize = sizeof(WINDOWINFO); - pwi->rcWindow = Window->WindowRect; - pwi->rcClient = Window->ClientRect; + pwi->rcWindow = Window->Wnd->WindowRect; + pwi->rcClient = Window->Wnd->ClientRect; pwi->dwStyle = Window->Style; pwi->dwExStyle = Window->ExStyle; pwi->dwWindowStatus = (UserGetForegroundWindow() == Window->hSelf); /* WS_ACTIVECAPTION */ @@ -673,8 +691,8 @@ IntGetClientRect(PWINDOW_OBJECT Window, PRECT Rect) ASSERT( Rect ); Rect->left = Rect->top = 0; - Rect->right = Window->ClientRect.right - Window->ClientRect.left; - Rect->bottom = Window->ClientRect.bottom - Window->ClientRect.top; + Rect->right = Window->Wnd->ClientRect.right - Window->Wnd->ClientRect.left; + Rect->bottom = Window->Wnd->ClientRect.bottom - Window->Wnd->ClientRect.top; } @@ -1301,8 +1319,8 @@ NtUserChildWindowFromPointEx(HWND hwndParent, if(Parent->hSelf != IntGetDesktopWindow()) { - Pt.x += Parent->ClientRect.left; - Pt.y += Parent->ClientRect.top; + Pt.x += Parent->Wnd->ClientRect.left; + Pt.y += Parent->Wnd->ClientRect.top; } if(!IntPtInWindow(Parent, Pt.x, Pt.y)) @@ -1355,7 +1373,7 @@ IntCalcDefPosSize(PWINDOW_OBJECT Parent, PWINDOW_OBJECT Window, RECT *rc, BOOL I if(Parent != NULL) { - IntGdiIntersectRect(rc, rc, &Parent->ClientRect); + IntGdiIntersectRect(rc, rc, &Parent->Wnd->ClientRect); if(IncPos) { @@ -1528,10 +1546,21 @@ co_IntCreateWindowEx(DWORD dwExStyle, ObmCreateObject(gHandleTable, (PHANDLE)&hWnd, otWindow, sizeof(WINDOW_OBJECT) + Class->WndExtra ); + if (Window) + { + Window->Wnd = DesktopHeapAlloc(ti->Desktop, + sizeof(WINDOW)); + if (!Window->Wnd) + goto AllocErr; + + Window->Wnd->ti = ti; + Window->Wnd->pi = ti->kpi; + } DPRINT("Created object with handle %X\n", hWnd); if (!Window) { +AllocErr: ObDereferenceObject(WinSta); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); RETURN( (HWND)0); @@ -1814,16 +1843,16 @@ co_IntCreateWindowEx(DWORD dwExStyle, } /* Initialize the window dimensions. */ - Window->WindowRect.left = Pos.x; - Window->WindowRect.top = Pos.y; - Window->WindowRect.right = Pos.x + Size.cx; - Window->WindowRect.bottom = Pos.y + Size.cy; + Window->Wnd->WindowRect.left = Pos.x; + Window->Wnd->WindowRect.top = Pos.y; + Window->Wnd->WindowRect.right = Pos.x + Size.cx; + Window->Wnd->WindowRect.bottom = Pos.y + Size.cy; if (0 != (Window->Style & WS_CHILD) && ParentWindow) { - IntGdiOffsetRect(&(Window->WindowRect), ParentWindow->ClientRect.left, - ParentWindow->ClientRect.top); + IntGdiOffsetRect(&(Window->Wnd->WindowRect), ParentWindow->Wnd->ClientRect.left, + ParentWindow->Wnd->ClientRect.top); } - Window->ClientRect = Window->WindowRect; + Window->Wnd->ClientRect = Window->Wnd->WindowRect; /* * Get the size and position of the window. @@ -1849,16 +1878,16 @@ co_IntCreateWindowEx(DWORD dwExStyle, Size.cy = 0; } - Window->WindowRect.left = Pos.x; - Window->WindowRect.top = Pos.y; - Window->WindowRect.right = Pos.x + Size.cx; - Window->WindowRect.bottom = Pos.y + Size.cy; + Window->Wnd->WindowRect.left = Pos.x; + Window->Wnd->WindowRect.top = Pos.y; + Window->Wnd->WindowRect.right = Pos.x + Size.cx; + Window->Wnd->WindowRect.bottom = Pos.y + Size.cy; if (0 != (Window->Style & WS_CHILD) && ParentWindow) { - IntGdiOffsetRect(&(Window->WindowRect), ParentWindow->ClientRect.left, - ParentWindow->ClientRect.top); + IntGdiOffsetRect(&(Window->Wnd->WindowRect), ParentWindow->Wnd->ClientRect.left, + ParentWindow->Wnd->ClientRect.top); } - Window->ClientRect = Window->WindowRect; + Window->Wnd->ClientRect = Window->Wnd->WindowRect; /* FIXME: Initialize the window menu. */ @@ -1880,19 +1909,19 @@ co_IntCreateWindowEx(DWORD dwExStyle, } /* Calculate the non-client size. */ - MaxPos.x = Window->WindowRect.left; - MaxPos.y = Window->WindowRect.top; + MaxPos.x = Window->Wnd->WindowRect.left; + MaxPos.y = Window->Wnd->WindowRect.top; DPRINT("IntCreateWindowEx(): About to get non-client size.\n"); /* WinPosGetNonClientSize SENDS THE WM_NCCALCSIZE message */ Result = co_WinPosGetNonClientSize(Window, - &Window->WindowRect, - &Window->ClientRect); + &Window->Wnd->WindowRect, + &Window->Wnd->ClientRect); - IntGdiOffsetRect(&Window->WindowRect, - MaxPos.x - Window->WindowRect.left, - MaxPos.y - Window->WindowRect.top); + IntGdiOffsetRect(&Window->Wnd->WindowRect, + MaxPos.x - Window->Wnd->WindowRect.left, + MaxPos.y - Window->Wnd->WindowRect.top); if (NULL != ParentWindow) @@ -1951,17 +1980,17 @@ co_IntCreateWindowEx(DWORD dwExStyle, DPRINT("IntCreateWindow(): About to send WM_SIZE\n"); - if ((Window->ClientRect.right - Window->ClientRect.left) < 0 || - (Window->ClientRect.bottom - Window->ClientRect.top) < 0) + if ((Window->Wnd->ClientRect.right - Window->Wnd->ClientRect.left) < 0 || + (Window->Wnd->ClientRect.bottom - Window->Wnd->ClientRect.top) < 0) { DPRINT("Sending bogus WM_SIZE\n"); } - lParam = MAKE_LONG(Window->ClientRect.right - - Window->ClientRect.left, - Window->ClientRect.bottom - - Window->ClientRect.top); + lParam = MAKE_LONG(Window->Wnd->ClientRect.right - + Window->Wnd->ClientRect.left, + Window->Wnd->ClientRect.bottom - + Window->Wnd->ClientRect.top); co_IntSendMessage(Window->hSelf, WM_SIZE, SIZE_RESTORED, lParam); @@ -1970,13 +1999,13 @@ co_IntCreateWindowEx(DWORD dwExStyle, if (0 != (Window->Style & WS_CHILD) && ParentWindow) { - lParam = MAKE_LONG(Window->ClientRect.left - ParentWindow->ClientRect.left, - Window->ClientRect.top - ParentWindow->ClientRect.top); + lParam = MAKE_LONG(Window->Wnd->ClientRect.left - ParentWindow->Wnd->ClientRect.left, + Window->Wnd->ClientRect.top - ParentWindow->Wnd->ClientRect.top); } else { - lParam = MAKE_LONG(Window->ClientRect.left, - Window->ClientRect.top); + lParam = MAKE_LONG(Window->Wnd->ClientRect.left, + Window->Wnd->ClientRect.top); } @@ -2050,6 +2079,8 @@ co_IntCreateWindowEx(DWORD dwExStyle, RETURN(hWnd); CLEANUP: + if (!_ret_ && Window && Window->Wnd && ti) + UserFreeWindowInfo(ti, Window); if (Window) UserDerefObjectCo(Window); if (ParentWindow) UserDerefObjectCo(ParentWindow); if (!_ret_ && ti != NULL) @@ -3844,10 +3875,10 @@ NtUserGetWindowPlacement(HWND hWnd, Safepl.showCmd = SW_SHOWNORMAL; } - Size.x = Window->WindowRect.left; - Size.y = Window->WindowRect.top; + Size.x = Window->Wnd->WindowRect.left; + Size.y = Window->Wnd->WindowRect.top; InternalPos = WinPosInitInternalPos(Window, &Size, - &Window->WindowRect); + &Window->Wnd->WindowRect); if (InternalPos) { Safepl.rcNormalPosition = InternalPos->NormalRect; @@ -3897,7 +3928,7 @@ NtUserGetWindowRect(HWND hWnd, LPRECT Rect) { RETURN(FALSE); } - Status = MmCopyToCaller(Rect, &Wnd->WindowRect, sizeof(RECT)); + Status = MmCopyToCaller(Rect, &Wnd->Wnd->WindowRect, sizeof(RECT)); if (!NT_SUCCESS(Status)) { SetLastNtError(Status); @@ -4319,8 +4350,8 @@ IntGetWindowRgn(PWINDOW_OBJECT Window, HRGN hRgn) } /* Create a new window region using the window rectangle */ - VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); - NtGdiOffsetRgn(VisRgn, -Window->WindowRect.left, -Window->WindowRect.top); + VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect); + NtGdiOffsetRgn(VisRgn, -Window->Wnd->WindowRect.left, -Window->Wnd->WindowRect.top); /* if there's a region assigned to the window, combine them both */ if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND); @@ -4357,8 +4388,8 @@ IntGetWindowRgnBox(PWINDOW_OBJECT Window, RECT *Rect) } /* Create a new window region using the window rectangle */ - VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); - NtGdiOffsetRgn(VisRgn, -Window->WindowRect.left, -Window->WindowRect.top); + VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect); + NtGdiOffsetRgn(VisRgn, -Window->Wnd->WindowRect.left, -Window->Wnd->WindowRect.top); /* if there's a region assigned to the window, combine them both */ if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND); diff --git a/reactos/subsystems/win32/win32k/ntuser/winpos.c b/reactos/subsystems/win32/win32k/ntuser/winpos.c index 76d5ec9ad07..7fefa3da2dd 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winpos.c +++ b/reactos/subsystems/win32/win32k/ntuser/winpos.c @@ -64,8 +64,8 @@ IntGetClientOrigin(PWINDOW_OBJECT Window OPTIONAL, LPPOINT Point) Point->x = Point->y = 0; return FALSE; } - Point->x = Window->ClientRect.left; - Point->y = Window->ClientRect.top; + Point->x = Window->Wnd->ClientRect.left; + Point->y = Window->Wnd->ClientRect.top; return TRUE; } @@ -278,7 +278,7 @@ WinPosInitInternalPos(PWINDOW_OBJECT Window, POINT *pt, PRECT RestoreRect) if(IntIsDesktopWindow(Parent)) IntGetDesktopWorkArea(Desktop, &WorkArea); else - WorkArea = Parent->ClientRect; + WorkArea = Parent->Wnd->ClientRect; } else IntGetDesktopWorkArea(Desktop, &WorkArea); @@ -289,7 +289,7 @@ WinPosInitInternalPos(PWINDOW_OBJECT Window, POINT *pt, PRECT RestoreRect) DPRINT1("Failed to allocate INTERNALPOS structure for window 0x%x\n", Window->hSelf); return NULL; } - Window->InternalPos->NormalRect = Window->WindowRect; + Window->InternalPos->NormalRect = Window->Wnd->WindowRect; IntGetWindowBorderMeasures(Window, &XInc, &YInc); Window->InternalPos->MaxPos.x = WorkArea.left - XInc; Window->InternalPos->MaxPos.y = WorkArea.top - YInc; @@ -320,9 +320,9 @@ co_WinPosMinMaximize(PWINDOW_OBJECT Window, UINT ShowFlag, RECT* NewPos) ASSERT_REFS_CO(Window); - Size.x = Window->WindowRect.left; - Size.y = Window->WindowRect.top; - InternalPos = WinPosInitInternalPos(Window, &Size, &Window->WindowRect); + Size.x = Window->Wnd->WindowRect.left; + Size.y = Window->Wnd->WindowRect.top; + InternalPos = WinPosInitInternalPos(Window, &Size, &Window->Wnd->WindowRect); if (InternalPos) { @@ -533,17 +533,17 @@ co_WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos, WINDOWPOS winposCopy; params.rgrc[0] = *WindowRect; - params.rgrc[1] = Window->WindowRect; - params.rgrc[2] = Window->ClientRect; + params.rgrc[1] = Window->Wnd->WindowRect; + params.rgrc[2] = Window->Wnd->ClientRect; Parent = Window->Parent; if (0 != (Window->Style & WS_CHILD) && Parent) { - IntGdiOffsetRect(&(params.rgrc[0]), - Parent->ClientRect.left, - - Parent->ClientRect.top); - IntGdiOffsetRect(&(params.rgrc[1]), - Parent->ClientRect.left, - - Parent->ClientRect.top); - IntGdiOffsetRect(&(params.rgrc[2]), - Parent->ClientRect.left, - - Parent->ClientRect.top); + IntGdiOffsetRect(&(params.rgrc[0]), - Parent->Wnd->ClientRect.left, + - Parent->Wnd->ClientRect.top); + IntGdiOffsetRect(&(params.rgrc[1]), - Parent->Wnd->ClientRect.left, + - Parent->Wnd->ClientRect.top); + IntGdiOffsetRect(&(params.rgrc[2]), - Parent->Wnd->ClientRect.left, + - Parent->Wnd->ClientRect.top); } params.lppos = &winposCopy; winposCopy = *WinPos; @@ -557,24 +557,24 @@ co_WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos, *ClientRect = params.rgrc[0]; if ((Window->Style & WS_CHILD) && Parent) { - IntGdiOffsetRect(ClientRect, Parent->ClientRect.left, - Parent->ClientRect.top); + IntGdiOffsetRect(ClientRect, Parent->Wnd->ClientRect.left, + Parent->Wnd->ClientRect.top); } FixClientRect(ClientRect, WindowRect); } /* FIXME: WVR_ALIGNxxx */ - if (ClientRect->left != Window->ClientRect.left || - ClientRect->top != Window->ClientRect.top) + if (ClientRect->left != Window->Wnd->ClientRect.left || + ClientRect->top != Window->Wnd->ClientRect.top) { WinPos->flags &= ~SWP_NOCLIENTMOVE; } if ((ClientRect->right - ClientRect->left != - Window->ClientRect.right - Window->ClientRect.left) || + Window->Wnd->ClientRect.right - Window->Wnd->ClientRect.left) || (ClientRect->bottom - ClientRect->top != - Window->ClientRect.bottom - Window->ClientRect.top)) + Window->Wnd->ClientRect.bottom - Window->Wnd->ClientRect.top)) { WinPos->flags &= ~SWP_NOCLIENTSIZE; } @@ -582,8 +582,8 @@ co_WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos, else { if (! (WinPos->flags & SWP_NOMOVE) - && (ClientRect->left != Window->ClientRect.left || - ClientRect->top != Window->ClientRect.top)) + && (ClientRect->left != Window->Wnd->ClientRect.left || + ClientRect->top != Window->Wnd->ClientRect.top)) { WinPos->flags &= ~SWP_NOCLIENTMOVE; } @@ -608,8 +608,8 @@ co_WinPosDoWinPosChanging(PWINDOW_OBJECT Window, co_IntPostOrSendMessage(Window->hSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos); } - *WindowRect = Window->WindowRect; - *ClientRect = Window->ClientRect; + *WindowRect = Window->Wnd->WindowRect; + *ClientRect = Window->Wnd->ClientRect; if (!(WinPos->flags & SWP_NOSIZE)) { @@ -625,17 +625,17 @@ co_WinPosDoWinPosChanging(PWINDOW_OBJECT Window, Parent = Window->Parent; if ((0 != (Window->Style & WS_CHILD)) && Parent) { - X += Parent->ClientRect.left; - Y += Parent->ClientRect.top; + X += Parent->Wnd->ClientRect.left; + Y += Parent->Wnd->ClientRect.top; } WindowRect->left = X; WindowRect->top = Y; - WindowRect->right += X - Window->WindowRect.left; - WindowRect->bottom += Y - Window->WindowRect.top; + WindowRect->right += X - Window->Wnd->WindowRect.left; + WindowRect->bottom += Y - Window->Wnd->WindowRect.top; IntGdiOffsetRect(ClientRect, - X - Window->WindowRect.left, - Y - Window->WindowRect.top); + X - Window->Wnd->WindowRect.left, + Y - Window->Wnd->WindowRect.top); } WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE; @@ -747,15 +747,15 @@ WinPosInternalMoveWindow(PWINDOW_OBJECT Window, INT MoveX, INT MoveY) { PWINDOW_OBJECT Child; - Window->WindowRect.left += MoveX; - Window->WindowRect.right += MoveX; - Window->WindowRect.top += MoveY; - Window->WindowRect.bottom += MoveY; + Window->Wnd->WindowRect.left += MoveX; + Window->Wnd->WindowRect.right += MoveX; + Window->Wnd->WindowRect.top += MoveY; + Window->Wnd->WindowRect.bottom += MoveY; - Window->ClientRect.left += MoveX; - Window->ClientRect.right += MoveX; - Window->ClientRect.top += MoveY; - Window->ClientRect.bottom += MoveY; + Window->Wnd->ClientRect.left += MoveX; + Window->Wnd->ClientRect.right += MoveX; + Window->Wnd->ClientRect.top += MoveY; + Window->Wnd->ClientRect.bottom += MoveY; for(Child = Window->FirstChild; Child; Child = Child->NextSibling) { @@ -787,15 +787,15 @@ WinPosFixupFlags(WINDOWPOS *WinPos, PWINDOW_OBJECT Window) WinPos->cy = max(WinPos->cy, 0); /* Check for right size */ - if (Window->WindowRect.right - Window->WindowRect.left == WinPos->cx && - Window->WindowRect.bottom - Window->WindowRect.top == WinPos->cy) + if (Window->Wnd->WindowRect.right - Window->Wnd->WindowRect.left == WinPos->cx && + Window->Wnd->WindowRect.bottom - Window->Wnd->WindowRect.top == WinPos->cy) { WinPos->flags |= SWP_NOSIZE; } /* Check for right position */ - if (Window->WindowRect.left == WinPos->x && - Window->WindowRect.top == WinPos->y) + if (Window->Wnd->WindowRect.left == WinPos->x && + Window->Wnd->WindowRect.top == WinPos->y) { WinPos->flags |= SWP_NOMOVE; } @@ -969,7 +969,7 @@ co_WinPosSetWindowPos( else if(VisRgn) { RGNDATA_UnlockRgn(VisRgn); - NtGdiOffsetRgn(VisBefore, -Window->WindowRect.left, -Window->WindowRect.top); + NtGdiOffsetRgn(VisBefore, -Window->Wnd->WindowRect.left, -Window->Wnd->WindowRect.top); } } } @@ -1044,8 +1044,8 @@ co_WinPosSetWindowPos( } } - OldWindowRect = Window->WindowRect; - OldClientRect = Window->ClientRect; + OldWindowRect = Window->Wnd->WindowRect; + OldClientRect = Window->Wnd->ClientRect; if (OldClientRect.bottom - OldClientRect.top == NewClientRect.bottom - NewClientRect.top) @@ -1069,8 +1069,8 @@ co_WinPosSetWindowPos( NewClientRect.top - OldClientRect.top); } - Window->WindowRect = NewWindowRect; - Window->ClientRect = NewClientRect; + Window->Wnd->WindowRect = NewWindowRect; + Window->Wnd->ClientRect = NewClientRect; if (!(WinPos.flags & SWP_SHOWWINDOW) && (WinPos.flags & SWP_HIDEWINDOW)) { @@ -1119,7 +1119,7 @@ co_WinPosSetWindowPos( else if(VisRgn) { RGNDATA_UnlockRgn(VisRgn); - NtGdiOffsetRgn(VisAfter, -Window->WindowRect.left, -Window->WindowRect.top); + NtGdiOffsetRgn(VisAfter, -Window->Wnd->WindowRect.left, -Window->Wnd->WindowRect.top); } /* @@ -1241,8 +1241,8 @@ co_WinPosSetWindowPos( PWINDOW_OBJECT Parent = Window->Parent; NtGdiOffsetRgn(DirtyRgn, - Window->WindowRect.left, - Window->WindowRect.top); + Window->Wnd->WindowRect.left, + Window->Wnd->WindowRect.top); if ((Window->Style & WS_CHILD) && (Parent) && !(Parent->Style & WS_CLIPCHILDREN)) @@ -1490,13 +1490,13 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd) } co_IntSendMessage(Window->hSelf, WM_SIZE, wParam, - MAKELONG(Window->ClientRect.right - - Window->ClientRect.left, - Window->ClientRect.bottom - - Window->ClientRect.top)); + MAKELONG(Window->Wnd->ClientRect.right - + Window->Wnd->ClientRect.left, + Window->Wnd->ClientRect.bottom - + Window->Wnd->ClientRect.top)); co_IntSendMessage(Window->hSelf, WM_MOVE, 0, - MAKELONG(Window->ClientRect.left, - Window->ClientRect.top)); + MAKELONG(Window->Wnd->ClientRect.left, + Window->Wnd->ClientRect.top)); IntEngWindowChanged(Window, WOC_RGN_CLIENT); } @@ -1612,10 +1612,10 @@ co_WinPosSearchChildren( else *HitTest = HTCLIENT; - if (Point->x >= Current->ClientRect.left && - Point->x < Current->ClientRect.right && - Point->y >= Current->ClientRect.top && - Point->y < Current->ClientRect.bottom) + if (Point->x >= Current->Wnd->ClientRect.left && + Point->x < Current->Wnd->ClientRect.right && + Point->y >= Current->Wnd->ClientRect.top && + Point->y < Current->Wnd->ClientRect.bottom) { co_WinPosSearchChildren(Current, OnlyHitTests, Point, Window, HitTest); } @@ -1658,8 +1658,8 @@ co_WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, PUSER_MESSAGE_QUEUE OnlyHitTes if((DesktopWindowHandle != ScopeWin->hSelf) && (DesktopWindow = UserGetWindowObject(DesktopWindowHandle))) { - Point.x += ScopeWin->ClientRect.left - DesktopWindow->ClientRect.left; - Point.y += ScopeWin->ClientRect.top - DesktopWindow->ClientRect.top; + Point.x += ScopeWin->Wnd->ClientRect.left - DesktopWindow->Wnd->ClientRect.left; + Point.y += ScopeWin->Wnd->ClientRect.top - DesktopWindow->Wnd->ClientRect.top; } HitTest = HTNOWHERE; @@ -1694,10 +1694,10 @@ NtUserGetMinMaxInfo( UserRefObjectCo(Window, &Ref); - Size.x = Window->WindowRect.left; - Size.y = Window->WindowRect.top; + Size.x = Window->Wnd->WindowRect.left; + Size.y = Window->Wnd->WindowRect.top; InternalPos = WinPosInitInternalPos(Window, &Size, - &Window->WindowRect); + &Window->Wnd->WindowRect); if(InternalPos) { if(SendMessage) diff --git a/reactos/subsystems/win32/win32k/objects/arc.c b/reactos/subsystems/win32/win32k/objects/arc.c index c8bd3eb9b3b..a0a11692590 100644 --- a/reactos/subsystems/win32/win32k/objects/arc.c +++ b/reactos/subsystems/win32/win32k/objects/arc.c @@ -47,15 +47,15 @@ IntGdiArcInternal( Window = UserGetWindowObject(hWnd); if(!Window) return FALSE; - rc.left += Window->ClientRect.left; - rc.top += Window->ClientRect.top; - rc.right += Window->ClientRect.left; - rc.bottom += Window->ClientRect.top; + rc.left += Window->Wnd->ClientRect.left; + rc.top += Window->Wnd->ClientRect.top; + rc.right += Window->Wnd->ClientRect.left; + rc.bottom += Window->Wnd->ClientRect.top; - rc1.left += Window->ClientRect.left; - rc1.top += Window->ClientRect.top; - rc1.right += Window->ClientRect.left; - rc1.bottom += Window->ClientRect.top; + rc1.left += Window->Wnd->ClientRect.left; + rc1.top += Window->Wnd->ClientRect.top; + rc1.right += Window->Wnd->ClientRect.left; + rc1.bottom += Window->Wnd->ClientRect.top; } rx = (rc.right - rc.left)/2 - 1;