Author: weiden Date: Thu Nov 15 22:42:41 2007 New Revision: 30467
URL: http://svn.reactos.org/svn/reactos?rev=30467&view=rev Log: - 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
Modified: trunk/reactos/dll/win32/user32/include/user32.h trunk/reactos/dll/win32/user32/include/user32p.h trunk/reactos/dll/win32/user32/misc/misc.c trunk/reactos/dll/win32/user32/windows/window.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/eng/engwindow.c trunk/reactos/subsystems/win32/win32k/include/desktop.h trunk/reactos/subsystems/win32/win32k/include/win32.h trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/include/winpos.h trunk/reactos/subsystems/win32/win32k/ntuser/callback.c trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/input.c trunk/reactos/subsystems/win32/win32k/ntuser/menu.c trunk/reactos/subsystems/win32/win32k/ntuser/message.c trunk/reactos/subsystems/win32/win32k/ntuser/misc.c trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c trunk/reactos/subsystems/win32/win32k/ntuser/painting.c trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c trunk/reactos/subsystems/win32/win32k/ntuser/vis.c trunk/reactos/subsystems/win32/win32k/ntuser/windc.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c trunk/reactos/subsystems/win32/win32k/objects/arc.c
Modified: trunk/reactos/dll/win32/user32/include/user32.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/us... ============================================================================== --- trunk/reactos/dll/win32/user32/include/user32.h (original) +++ trunk/reactos/dll/win32/user32/include/user32.h Thu Nov 15 22:42:41 2007 @@ -62,8 +62,18 @@ 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 @@ }
PCALLPROC FASTCALL ValidateCallProc(HANDLE hCallProc); +PWINDOW FASTCALL ValidateHwnd(HWND hwnd);
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 (original) +++ trunk/reactos/dll/win32/user32/include/user32p.h Thu Nov 15 22:42:41 2007 @@ -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)
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 (original) +++ trunk/reactos/dll/win32/user32/misc/misc.c Thu Nov 15 22:42:41 2007 @@ -339,7 +339,7 @@ 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 @@ { 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 @@ 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 @@
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; +}
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 (original) +++ trunk/reactos/dll/win32/user32/windows/window.c Thu Nov 15 22:42:41 2007 @@ -860,7 +860,17 @@ 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 @@ GetWindowRect(HWND hWnd, LPRECT lpRect) { - return(NtUserGetWindowRect(hWnd, lpRect)); + PWINDOW Wnd = ValidateHwnd(hWnd); + + if (Wnd != NULL) + { + *lpRect = Wnd->WindowRect; + return TRUE; + } + + return FALSE; }
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 (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h Thu Nov 15 22:42:41 2007 @@ -7,6 +7,7 @@ typedef struct _DESKTOP { HANDLE hKernelHeap; + ULONG_PTR HeapLimit; WCHAR szDesktopName[1]; HWND hTaskManWindow; HWND hProgmanWindow; @@ -55,6 +56,18 @@ 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 @@ PW32PROCESSINFO pi; /* [USER] */ PW32PROCESSINFO kpi; /* [KERNEL] */ PDESKTOP Desktop; + PVOID DesktopHeapBase; + ULONG_PTR DesktopHeapLimit; ULONG_PTR DesktopHeapDelta; } W32THREADINFO, *PW32THREADINFO;
@@ -496,6 +511,7 @@ #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
Modified: trunk/reactos/subsystems/win32/win32k/eng/engwindow.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/engwindow.c (original) +++ trunk/reactos/subsystems/win32/win32k/eng/engwindow.c Thu Nov 15 22:42:41 2007 @@ -85,7 +85,7 @@ 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 @@ 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 @@ }
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);
Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/desktop.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/desktop.h Thu Nov 15 22:42:41 2007 @@ -205,7 +205,7 @@ 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 @@ }
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); }
Modified: trunk/reactos/subsystems/win32/win32k/include/win32.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/win32.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/win32.h Thu Nov 15 22:42:41 2007 @@ -25,6 +25,7 @@ struct _W32HEAP_USER_MAPPING *Next; PVOID KernelMapping; PVOID UserMapping; + ULONG_PTR Limit; ULONG Count; } W32HEAP_USER_MAPPING, *PW32HEAP_USER_MAPPING;
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 (original) +++ trunk/reactos/subsystems/win32/win32k/include/window.h Thu Nov 15 22:42:41 2007 @@ -26,6 +26,12 @@
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 @@ 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. */
Modified: trunk/reactos/subsystems/win32/win32k/include/winpos.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/winpos.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/winpos.h Thu Nov 15 22:42:41 2007 @@ -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);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callback.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/callback.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/callback.c Thu Nov 15 22:42:41 2007 @@ -122,7 +122,7 @@ *pWnd = ClientInfo->pvWND;
ClientInfo->hWND = hWndS; - ClientInfo->pvWND = (PVOID) Window; + ClientInfo->pvWND = DesktopHeapAddressToUser(Window->Wnd); }
static VOID
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c Thu Nov 15 22:42:41 2007 @@ -878,10 +878,10 @@ 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;
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 (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c Thu Nov 15 22:42:41 2007 @@ -870,6 +870,7 @@ SIZE_T DesktopInfoSize; UNICODE_STRING SafeDesktopName; ULONG DummyContext; + ULONG_PTR HeapLimit = 4 * 1024 * 1024; /* FIXME */ DECLARE_RETURN(HDESK);
@@ -955,7 +956,7 @@ DesktopObject->DesktopHeapSection = NULL; DesktopObject->hDesktopHeap = UserCreateHeap(&DesktopObject->DesktopHeapSection, &DesktopHeapSystemBase, - 4 * 1024 * 1024); /* FIXME */ + HeapLimit); if (DesktopObject->hDesktopHeap == NULL) { ObDereferenceObject(DesktopObject); @@ -981,6 +982,7 @@ DesktopInfoSize);
DesktopObject->DesktopInfo->hKernelHeap = DesktopObject->hDesktopHeap; + DesktopObject->DesktopInfo->HeapLimit = HeapLimit; RtlCopyMemory(DesktopObject->DesktopInfo->szDesktopName, lpszDesktopName->Buffer, lpszDesktopName->Length); @@ -1372,8 +1374,8 @@ 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 @@ if (ti->Desktop == DesktopObject->DesktopInfo) { ti->Desktop = NULL; + ti->DesktopHeapBase = NULL; + ti->DesktopHeapLimit = 0; ti->DesktopHeapDelta = 0; } } @@ -1799,6 +1803,7 @@ HeapMapping->Next = NULL; HeapMapping->KernelMapping = (PVOID)DesktopObject->hDesktopHeap; HeapMapping->UserMapping = UserBase; + HeapMapping->Limit = ViewSize; HeapMapping->Count = 1; *PrevLink = HeapMapping;
@@ -1811,6 +1816,8 @@ if (ti->Desktop == NULL) { ti->Desktop = DesktopObject->DesktopInfo; + ti->DesktopHeapBase = DesktopObject->hDesktopHeap; + ti->DesktopHeapLimit = ViewSize; ti->DesktopHeapDelta = DesktopHeapGetUserDelta(); } } @@ -1854,6 +1861,16 @@ } }
+ 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 @@ }
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; - } - } } }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/input.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c Thu Nov 15 22:42:41 2007 @@ -1054,10 +1054,10 @@
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); }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/menu.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/menu.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/menu.c Thu Nov 15 22:42:41 2007 @@ -2154,8 +2154,8 @@ 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++)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/message.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c Thu Nov 15 22:42:41 2007 @@ -633,8 +633,8 @@ { /* 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); } }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c Thu Nov 15 22:42:41 2007 @@ -242,6 +242,22 @@
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 @@ 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; }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c Thu Nov 15 22:42:41 2007 @@ -879,8 +879,8 @@ 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);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c Thu Nov 15 22:42:41 2007 @@ -68,7 +68,7 @@ return FALSE; }
- if (!IntGdiIntersectRect(WindowRect, WindowRect, &ParentWindow->ClientRect)) + if (!IntGdiIntersectRect(WindowRect, WindowRect, &ParentWindow->Wnd->ClientRect)) { return FALSE; } @@ -119,19 +119,19 @@ 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 @@ { HRGN hRgnClient;
- hRgnClient = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); + hRgnClient = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect); RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnClient, RGN_AND); NtGdiDeleteObject(hRgnClient); } @@ -353,19 +353,19 @@ { 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 @@ 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 @@ { 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 @@ } 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 @@ /* Get the update region bounding box. */ if (Window->UpdateRegion == (HRGN)1) { - Rect = Window->ClientRect; + Rect = Window->Wnd->ClientRect; } else { @@ -1024,14 +1024,14 @@ 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 @@ 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;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c Thu Nov 15 22:42:41 2007 @@ -60,8 +60,8 @@ 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 @@ 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 @@ 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++) {
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/vis.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/vis.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/vis.c Thu Nov 15 22:42:41 2007 @@ -47,11 +47,11 @@
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 @@ return NULL; }
- ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->ClientRect); + ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->Wnd->ClientRect); NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_AND); NtGdiDeleteObject(ClipRgn);
@@ -83,13 +83,13 @@ 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 @@ 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 @@
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 @@ 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,
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c Thu Nov 15 22:42:41 2007 @@ -199,13 +199,13 @@ { 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 @@ DesktopWindow = UserGetWindowObject(IntGetDesktopWindow()); if (NULL != DesktopWindow) { - hRgnVisible = UnsafeIntCreateRectRgnIndirect(&DesktopWindow->WindowRect); + hRgnVisible = UnsafeIntCreateRectRgnIndirect(&DesktopWindow->Wnd->WindowRect); } else { @@ -530,11 +530,11 @@ { 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 @@ { 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) {
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 (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c Thu Nov 15 22:42:41 2007 @@ -290,6 +290,21 @@ DPRINT("destroyed itself while in WM_DESTROY!\n"); } #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; }
/*********************************************************************** @@ -446,6 +461,9 @@ }
RtlFreeUnicodeString(&Window->WindowName); + + ASSERT(Window->Wnd != NULL); + UserFreeWindowInfo(Window->ti, Window);
UserDerefObject(Window);
@@ -539,8 +557,8 @@ 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 @@ 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 @@
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 @@
if(Parent != NULL) { - IntGdiIntersectRect(rc, rc, &Parent->ClientRect); + IntGdiIntersectRect(rc, rc, &Parent->Wnd->ClientRect);
if(IncPos) { @@ -1528,10 +1546,21 @@ 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 @@ }
/* 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); - } - Window->ClientRect = Window->WindowRect; + IntGdiOffsetRect(&(Window->Wnd->WindowRect), ParentWindow->Wnd->ClientRect.left, + ParentWindow->Wnd->ClientRect.top); + } + Window->Wnd->ClientRect = Window->Wnd->WindowRect;
/* * Get the size and position of the window. @@ -1849,16 +1878,16 @@ 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); - } - Window->ClientRect = Window->WindowRect; + IntGdiOffsetRect(&(Window->Wnd->WindowRect), ParentWindow->Wnd->ClientRect.left, + ParentWindow->Wnd->ClientRect.top); + } + Window->Wnd->ClientRect = Window->Wnd->WindowRect;
/* FIXME: Initialize the window menu. */
@@ -1880,19 +1909,19 @@ }
/* 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); - - IntGdiOffsetRect(&Window->WindowRect, - MaxPos.x - Window->WindowRect.left, - MaxPos.y - Window->WindowRect.top); + &Window->Wnd->WindowRect, + &Window->Wnd->ClientRect); + + IntGdiOffsetRect(&Window->Wnd->WindowRect, + MaxPos.x - Window->Wnd->WindowRect.left, + MaxPos.y - Window->Wnd->WindowRect.top);
if (NULL != ParentWindow) @@ -1951,17 +1980,17 @@
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 @@
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 @@ 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 @@ 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 @@ { 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 @@ }
/* 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 @@ }
/* 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);
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 (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c Thu Nov 15 22:42:41 2007 @@ -64,8 +64,8 @@ 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 @@ if(IntIsDesktopWindow(Parent)) IntGetDesktopWorkArea(Desktop, &WorkArea); else - WorkArea = Parent->ClientRect; + WorkArea = Parent->Wnd->ClientRect; } else IntGetDesktopWorkArea(Desktop, &WorkArea); @@ -289,7 +289,7 @@ 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 @@
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 @@ 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 @@ *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 @@ 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_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 @@ 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 @@ { PWINDOW_OBJECT Child;
- Window->WindowRect.left += MoveX; - Window->WindowRect.right += MoveX; - Window->WindowRect.top += MoveY; - Window->WindowRect.bottom += MoveY; - - Window->ClientRect.left += MoveX; - Window->ClientRect.right += MoveX; - Window->ClientRect.top += MoveY; - Window->ClientRect.bottom += MoveY; + Window->Wnd->WindowRect.left += MoveX; + Window->Wnd->WindowRect.right += MoveX; + Window->Wnd->WindowRect.top += MoveY; + Window->Wnd->WindowRect.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 @@ 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 @@ 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 @@ } }
- 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 @@ 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 @@ 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 @@ 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_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 @@ 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 @@ 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 @@
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)
Modified: trunk/reactos/subsystems/win32/win32k/objects/arc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/arc.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/arc.c Thu Nov 15 22:42:41 2007 @@ -47,15 +47,15 @@ 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;