- 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
This commit is contained in:
Thomas Bluemel 2007-11-15 19:42:41 +00:00
parent 7175aa584f
commit 23c877364c
25 changed files with 385 additions and 263 deletions

View file

@ -62,8 +62,18 @@ DesktopPtrToUser(PVOID Ptr)
PW32THREADINFO ti = GetW32ThreadInfo(); PW32THREADINFO ti = GetW32ThreadInfo();
ASSERT(Ptr != NULL); ASSERT(Ptr != NULL);
ASSERT(ti != NULL); ASSERT(ti != NULL);
ASSERT(ti->DesktopHeapDelta != 0); if ((ULONG_PTR)Ptr >= (ULONG_PTR)ti->DesktopHeapBase &&
return (PVOID)((ULONG_PTR)Ptr - ti->DesktopHeapDelta); (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 static __inline PVOID
@ -76,3 +86,4 @@ SharedPtrToKernel(PVOID Ptr)
} }
PCALLPROC FASTCALL ValidateCallProc(HANDLE hCallProc); PCALLPROC FASTCALL ValidateCallProc(HANDLE hCallProc);
PWINDOW FASTCALL ValidateHwnd(HWND hwnd);

View file

@ -120,6 +120,9 @@
#define NtUserShowCursor(bShow) \ #define NtUserShowCursor(bShow) \
NtUserCallOneParam((DWORD)bShow, ONEPARAM_ROUTINE_SHOWCURSOR) NtUserCallOneParam((DWORD)bShow, ONEPARAM_ROUTINE_SHOWCURSOR)
#define NtUserGetDesktopMapping(Ptr) \
(PVOID)NtUserCallOneParam((DWORD)Ptr, ONEPARAM_ROUTINE_GETDESKTOPMAPPING)
#define ShowCaret(hwnd) \ #define ShowCaret(hwnd) \
NtUserShowCaret(hwnd) NtUserShowCaret(hwnd)

View file

@ -339,7 +339,7 @@ GetUser32Handle(HANDLE handle)
static const BOOL g_ObjectHeapTypeShared[VALIDATE_TYPE_MONITOR + 1] = static const BOOL g_ObjectHeapTypeShared[VALIDATE_TYPE_MONITOR + 1] =
{ {
FALSE, /* VALIDATE_TYPE_FREE (not used) */ 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_MENU */
TRUE, /* VALIDATE_TYPE_CURSOR */ TRUE, /* VALIDATE_TYPE_CURSOR */
TRUE, /* VALIDATE_TYPE_MWPOS */ TRUE, /* VALIDATE_TYPE_MWPOS */
@ -362,16 +362,8 @@ ValidateHandle(HANDLE handle, UINT uType)
{ {
PVOID ret; PVOID ret;
PUSER_HANDLE_ENTRY pEntry; PUSER_HANDLE_ENTRY pEntry;
PW32CLIENTINFO ClientInfo = GetWin32ClientInfo();
ASSERT(uType <= VALIDATE_TYPE_MONITOR); 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); pEntry = GetUser32Handle(handle);
@ -413,22 +405,11 @@ ValidateHandle(HANDLE handle, UINT uType)
else else
ret = DesktopPtrToUser(pEntry->ptr); 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; return ret;
} }
// //
// Validate callproc handle and return the pointer to the object. // Validate a callproc handle and return the pointer to the object.
// //
PCALLPROC PCALLPROC
FASTCALL FASTCALL
@ -440,3 +421,41 @@ ValidateCallProc(HANDLE hCallProc)
return NULL; 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;
}

View file

@ -860,7 +860,17 @@ GetAncestor(HWND hwnd, UINT gaFlags)
BOOL STDCALL BOOL STDCALL
GetClientRect(HWND hWnd, LPRECT lpRect) 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, GetWindowRect(HWND hWnd,
LPRECT lpRect) LPRECT lpRect)
{ {
return(NtUserGetWindowRect(hWnd, lpRect)); PWINDOW Wnd = ValidateHwnd(hWnd);
if (Wnd != NULL)
{
*lpRect = Wnd->WindowRect;
return TRUE;
}
return FALSE;
} }

View file

@ -7,6 +7,7 @@ struct _W32THREADINFO;
typedef struct _DESKTOP typedef struct _DESKTOP
{ {
HANDLE hKernelHeap; HANDLE hKernelHeap;
ULONG_PTR HeapLimit;
WCHAR szDesktopName[1]; WCHAR szDesktopName[1];
HWND hTaskManWindow; HWND hTaskManWindow;
HWND hProgmanWindow; HWND hProgmanWindow;
@ -55,6 +56,18 @@ typedef struct _WINDOWCLASS
UINT MenuNameIsString : 1; UINT MenuNameIsString : 1;
} WINDOWCLASS, *PWINDOWCLASS; } 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 typedef struct _W32PROCESSINFO
{ {
PVOID UserHandleTable; PVOID UserHandleTable;
@ -71,6 +84,8 @@ typedef struct _W32THREADINFO
PW32PROCESSINFO pi; /* [USER] */ PW32PROCESSINFO pi; /* [USER] */
PW32PROCESSINFO kpi; /* [KERNEL] */ PW32PROCESSINFO kpi; /* [KERNEL] */
PDESKTOP Desktop; PDESKTOP Desktop;
PVOID DesktopHeapBase;
ULONG_PTR DesktopHeapLimit;
ULONG_PTR DesktopHeapDelta; ULONG_PTR DesktopHeapDelta;
} W32THREADINFO, *PW32THREADINFO; } W32THREADINFO, *PW32THREADINFO;
@ -496,6 +511,7 @@ NtUserCallNoParam(
#define ONEPARAM_ROUTINE_GETCURSORPOSITION 0x0b #define ONEPARAM_ROUTINE_GETCURSORPOSITION 0x0b
#define ONEPARAM_ROUTINE_ISWINDOWINDESTROY 0x0c #define ONEPARAM_ROUTINE_ISWINDOWINDESTROY 0x0c
#define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0x0d #define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0x0d
#define ONEPARAM_ROUTINE_GETDESKTOPMAPPING 0x0e
#define ONEPARAM_ROUTINE_GETWINDOWINSTANCE 0x10 #define ONEPARAM_ROUTINE_GETWINDOWINSTANCE 0x10
#define ONEPARAM_ROUTINE_MSQSETWAKEMASK 0x27 #define ONEPARAM_ROUTINE_MSQSETWAKEMASK 0x27
#define ONEPARAM_ROUTINE_GETKEYBOARDTYPE 0x28 #define ONEPARAM_ROUTINE_GETKEYBOARDTYPE 0x28

View file

@ -85,7 +85,7 @@ IntEngWndUpdateClipObj(
hVisRgn = VIS_ComputeVisibleRegion(Window, TRUE, TRUE, TRUE); hVisRgn = VIS_ComputeVisibleRegion(Window, TRUE, TRUE, TRUE);
if (hVisRgn != NULL) 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); visRgn = RGNDATA_LockRgn(hVisRgn);
if (visRgn != NULL) if (visRgn != NULL)
{ {
@ -122,8 +122,8 @@ IntEngWndUpdateClipObj(
if (ClipObj == NULL) if (ClipObj == NULL)
{ {
/* Fall back to client rect */ /* Fall back to client rect */
ClipObj = IntEngCreateClipRegion(1, (PRECTL)&Window->ClientRect, ClipObj = IntEngCreateClipRegion(1, (PRECTL)&Window->Wnd->ClientRect,
(PRECTL)&Window->ClientRect); (PRECTL)&Window->Wnd->ClientRect);
} }
if (ClipObj == NULL) if (ClipObj == NULL)
@ -133,7 +133,7 @@ IntEngWndUpdateClipObj(
} }
RtlCopyMemory(&WndObjInt->WndObj.coClient, ClipObj, sizeof (CLIPOBJ)); 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); OldClipObj = InterlockedExchangePointer(&WndObjInt->ClientClipObj, ClipObj);
if (OldClipObj != NULL) if (OldClipObj != NULL)
IntEngDeleteClipRegion(OldClipObj); IntEngDeleteClipRegion(OldClipObj);

View file

@ -205,7 +205,7 @@ DesktopHeapGetUserDelta(VOID)
Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next; Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
while (Mapping != NULL) while (Mapping != NULL)
{ {
if (Mapping->UserMapping == (PVOID)hDesktopHeap) if (Mapping->KernelMapping == (PVOID)hDesktopHeap)
{ {
Delta = (ULONG_PTR)Mapping->KernelMapping - (ULONG_PTR)Mapping->UserMapping; Delta = (ULONG_PTR)Mapping->KernelMapping - (ULONG_PTR)Mapping->UserMapping;
break; break;
@ -218,17 +218,17 @@ DesktopHeapGetUserDelta(VOID)
} }
static __inline PVOID static __inline PVOID
DesktopHeapAddressToUser(IN PDESKTOP Desktop, DesktopHeapAddressToUser(PVOID lpMem)
PVOID lpMem)
{ {
PW32HEAP_USER_MAPPING Mapping; PW32HEAP_USER_MAPPING Mapping;
Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next; Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
while (Mapping != NULL) 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); (ULONG_PTR)Mapping->UserMapping);
} }

View file

@ -25,6 +25,7 @@ typedef struct _W32HEAP_USER_MAPPING
struct _W32HEAP_USER_MAPPING *Next; struct _W32HEAP_USER_MAPPING *Next;
PVOID KernelMapping; PVOID KernelMapping;
PVOID UserMapping; PVOID UserMapping;
ULONG_PTR Limit;
ULONG Count; ULONG Count;
} W32HEAP_USER_MAPPING, *PW32HEAP_USER_MAPPING; } W32HEAP_USER_MAPPING, *PW32HEAP_USER_MAPPING;

View file

@ -26,6 +26,12 @@ typedef struct _INTERNALPOS
typedef struct _WINDOW_OBJECT 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 */ /* Pointer to the thread information */
PW32THREADINFO ti; PW32THREADINFO ti;
/* Pointer to the desktop */ /* Pointer to the desktop */
@ -59,10 +65,6 @@ typedef struct _WINDOW_OBJECT
PCHAR ExtraData; PCHAR ExtraData;
/* Size of the extra data associated with the window. */ /* Size of the extra data associated with the window. */
ULONG ExtraDataSize; ULONG ExtraDataSize;
/* Position of the window. */
RECT WindowRect;
/* Position of the window's client area. */
RECT ClientRect;
/* Handle for the window. */ /* Handle for the window. */
HWND hSelf; HWND hSelf;
/* Window flags. */ /* Window flags. */

View file

@ -6,13 +6,13 @@
#define SWP_NOCLIENTSIZE 0x1000 #define SWP_NOCLIENTSIZE 0x1000
#define IntPtInWindow(WndObject,x,y) \ #define IntPtInWindow(WndObject,x,y) \
((x) >= (WndObject)->WindowRect.left && \ ((x) >= (WndObject)->Wnd->WindowRect.left && \
(x) < (WndObject)->WindowRect.right && \ (x) < (WndObject)->Wnd->WindowRect.right && \
(y) >= (WndObject)->WindowRect.top && \ (y) >= (WndObject)->Wnd->WindowRect.top && \
(y) < (WndObject)->WindowRect.bottom && \ (y) < (WndObject)->Wnd->WindowRect.bottom && \
(!(WndObject)->WindowRegion || ((WndObject)->Style & WS_MINIMIZE) || \ (!(WndObject)->WindowRegion || ((WndObject)->Style & WS_MINIMIZE) || \
NtGdiPtInRegion((WndObject)->WindowRegion, (INT)((x) - (WndObject)->WindowRect.left), \ NtGdiPtInRegion((WndObject)->WindowRegion, (INT)((x) - (WndObject)->Wnd->WindowRect.left), \
(INT)((y) - (WndObject)->WindowRect.top)))) (INT)((y) - (WndObject)->Wnd->WindowRect.top))))
UINT UINT
FASTCALL co_WinPosArrangeIconicWindows(PWINDOW_OBJECT parent); FASTCALL co_WinPosArrangeIconicWindows(PWINDOW_OBJECT parent);

View file

@ -122,7 +122,7 @@ IntSetTebWndCallback (HWND * hWnd, PVOID * pWnd)
*pWnd = ClientInfo->pvWND; *pWnd = ClientInfo->pvWND;
ClientInfo->hWND = hWndS; ClientInfo->hWND = hWndS;
ClientInfo->pvWND = (PVOID) Window; ClientInfo->pvWND = DesktopHeapAddressToUser(Window->Wnd);
} }
static VOID static VOID

View file

@ -878,10 +878,10 @@ NtUserClipCursor(
MOUSEINPUT mi; MOUSEINPUT mi;
CurInfo->CursorClipInfo.IsClipped = TRUE; CurInfo->CursorClipInfo.IsClipped = TRUE;
CurInfo->CursorClipInfo.Left = max(Rect.left, DesktopWindow->WindowRect.left); CurInfo->CursorClipInfo.Left = max(Rect.left, DesktopWindow->Wnd->WindowRect.left);
CurInfo->CursorClipInfo.Top = max(Rect.top, DesktopWindow->WindowRect.top); CurInfo->CursorClipInfo.Top = max(Rect.top, DesktopWindow->Wnd->WindowRect.top);
CurInfo->CursorClipInfo.Right = min(Rect.right - 1, DesktopWindow->WindowRect.right - 1); CurInfo->CursorClipInfo.Right = min(Rect.right - 1, DesktopWindow->Wnd->WindowRect.right - 1);
CurInfo->CursorClipInfo.Bottom = min(Rect.bottom - 1, DesktopWindow->WindowRect.bottom - 1); CurInfo->CursorClipInfo.Bottom = min(Rect.bottom - 1, DesktopWindow->Wnd->WindowRect.bottom - 1);
mi.dx = MousePos.x; mi.dx = MousePos.x;
mi.dy = MousePos.y; mi.dy = MousePos.y;

View file

@ -870,6 +870,7 @@ NtUserCreateDesktop(
SIZE_T DesktopInfoSize; SIZE_T DesktopInfoSize;
UNICODE_STRING SafeDesktopName; UNICODE_STRING SafeDesktopName;
ULONG DummyContext; ULONG DummyContext;
ULONG_PTR HeapLimit = 4 * 1024 * 1024; /* FIXME */
DECLARE_RETURN(HDESK); DECLARE_RETURN(HDESK);
@ -955,7 +956,7 @@ NtUserCreateDesktop(
DesktopObject->DesktopHeapSection = NULL; DesktopObject->DesktopHeapSection = NULL;
DesktopObject->hDesktopHeap = UserCreateHeap(&DesktopObject->DesktopHeapSection, DesktopObject->hDesktopHeap = UserCreateHeap(&DesktopObject->DesktopHeapSection,
&DesktopHeapSystemBase, &DesktopHeapSystemBase,
4 * 1024 * 1024); /* FIXME */ HeapLimit);
if (DesktopObject->hDesktopHeap == NULL) if (DesktopObject->hDesktopHeap == NULL)
{ {
ObDereferenceObject(DesktopObject); ObDereferenceObject(DesktopObject);
@ -981,6 +982,7 @@ NtUserCreateDesktop(
DesktopInfoSize); DesktopInfoSize);
DesktopObject->DesktopInfo->hKernelHeap = DesktopObject->hDesktopHeap; DesktopObject->DesktopInfo->hKernelHeap = DesktopObject->hDesktopHeap;
DesktopObject->DesktopInfo->HeapLimit = HeapLimit;
RtlCopyMemory(DesktopObject->DesktopInfo->szDesktopName, RtlCopyMemory(DesktopObject->DesktopInfo->szDesktopName,
lpszDesktopName->Buffer, lpszDesktopName->Buffer,
lpszDesktopName->Length); lpszDesktopName->Length);
@ -1372,8 +1374,8 @@ NtUserPaintDesktop(HDC hDC)
int x, y; int x, y;
HDC hWallpaperDC; HDC hWallpaperDC;
sz.cx = DeskWin->WindowRect.right - DeskWin->WindowRect.left; sz.cx = DeskWin->Wnd->WindowRect.right - DeskWin->Wnd->WindowRect.left;
sz.cy = DeskWin->WindowRect.bottom - DeskWin->WindowRect.top; sz.cy = DeskWin->Wnd->WindowRect.bottom - DeskWin->Wnd->WindowRect.top;
if (WinSta->WallpaperMode == wmStretch || if (WinSta->WallpaperMode == wmStretch ||
WinSta->WallpaperMode == wmTile) WinSta->WallpaperMode == wmTile)
@ -1736,6 +1738,8 @@ IntUnmapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
if (ti->Desktop == DesktopObject->DesktopInfo) if (ti->Desktop == DesktopObject->DesktopInfo)
{ {
ti->Desktop = NULL; ti->Desktop = NULL;
ti->DesktopHeapBase = NULL;
ti->DesktopHeapLimit = 0;
ti->DesktopHeapDelta = 0; ti->DesktopHeapDelta = 0;
} }
} }
@ -1799,6 +1803,7 @@ IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
HeapMapping->Next = NULL; HeapMapping->Next = NULL;
HeapMapping->KernelMapping = (PVOID)DesktopObject->hDesktopHeap; HeapMapping->KernelMapping = (PVOID)DesktopObject->hDesktopHeap;
HeapMapping->UserMapping = UserBase; HeapMapping->UserMapping = UserBase;
HeapMapping->Limit = ViewSize;
HeapMapping->Count = 1; HeapMapping->Count = 1;
*PrevLink = HeapMapping; *PrevLink = HeapMapping;
@ -1811,6 +1816,8 @@ IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
if (ti->Desktop == NULL) if (ti->Desktop == NULL)
{ {
ti->Desktop = DesktopObject->DesktopInfo; ti->Desktop = DesktopObject->DesktopInfo;
ti->DesktopHeapBase = DesktopObject->hDesktopHeap;
ti->DesktopHeapLimit = ViewSize;
ti->DesktopHeapDelta = DesktopHeapGetUserDelta(); 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 && if (OldDesktop != NULL &&
!IntCheckProcessDesktopClasses(OldDesktop->DesktopInfo, !IntCheckProcessDesktopClasses(OldDesktop->DesktopInfo,
FreeOnFailure)) FreeOnFailure))
@ -1881,22 +1898,6 @@ IntSetThreadDesktop(IN PDESKTOP_OBJECT DesktopObject,
} }
ObDereferenceObject(OldDesktop); 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;
}
}
} }
} }

View file

@ -1054,10 +1054,10 @@ IntMouseInput(MOUSEINPUT *mi)
if (DesktopWindow) if (DesktopWindow)
{ {
if(MousePos.x >= DesktopWindow->ClientRect.right) if(MousePos.x >= DesktopWindow->Wnd->ClientRect.right)
MousePos.x = DesktopWindow->ClientRect.right - 1; MousePos.x = DesktopWindow->Wnd->ClientRect.right - 1;
if(MousePos.y >= DesktopWindow->ClientRect.bottom) if(MousePos.y >= DesktopWindow->Wnd->ClientRect.bottom)
MousePos.y = DesktopWindow->ClientRect.bottom - 1; MousePos.y = DesktopWindow->Wnd->ClientRect.bottom - 1;
ObmDereferenceObject(DesktopWindow); ObmDereferenceObject(DesktopWindow);
} }

View file

@ -2154,8 +2154,8 @@ NtUserMenuItemFromPoint(
RETURN( -1); RETURN( -1);
} }
X -= Window->WindowRect.left; X -= Window->Wnd->WindowRect.left;
Y -= Window->WindowRect.top; Y -= Window->Wnd->WindowRect.top;
mi = Menu->MenuItemList; mi = Menu->MenuItemList;
for (i = 0; NULL != mi; i++) for (i = 0; NULL != mi; i++)

View file

@ -633,8 +633,8 @@ co_IntTranslateMouseMessage(PUSER_MESSAGE_QUEUE ThreadQueue, LPMSG Msg, USHORT *
{ {
/* NOTE: Msg->pt should remain in screen coordinates. -- FiN */ /* NOTE: Msg->pt should remain in screen coordinates. -- FiN */
Msg->lParam = MAKELONG( Msg->lParam = MAKELONG(
Msg->pt.x - (WORD)Window->ClientRect.left, Msg->pt.x - (WORD)Window->Wnd->ClientRect.left,
Msg->pt.y - (WORD)Window->ClientRect.top); Msg->pt.y - (WORD)Window->Wnd->ClientRect.top);
} }
} }

View file

@ -242,6 +242,22 @@ NtUserCallOneParam(
switch(Routine) 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: case ONEPARAM_ROUTINE_GETMENU:
{ {
PWINDOW_OBJECT Window; PWINDOW_OBJECT Window;
@ -2542,11 +2558,15 @@ GetW32ThreadInfo(VOID)
if (W32Thread->Desktop != NULL) if (W32Thread->Desktop != NULL)
{ {
ti->Desktop = W32Thread->Desktop->DesktopInfo; ti->Desktop = W32Thread->Desktop->DesktopInfo;
ti->DesktopHeapBase = W32Thread->Desktop->DesktopInfo->hKernelHeap;
ti->DesktopHeapLimit = W32Thread->Desktop->DesktopInfo->HeapLimit;
ti->DesktopHeapDelta = DesktopHeapGetUserDelta(); ti->DesktopHeapDelta = DesktopHeapGetUserDelta();
} }
else else
{ {
ti->Desktop = NULL; ti->Desktop = NULL;
ti->DesktopHeapBase = NULL;
ti->DesktopHeapLimit = 0;
ti->DesktopHeapDelta = 0; ti->DesktopHeapDelta = 0;
} }

View file

@ -879,8 +879,8 @@ NtUserMonitorFromWindow(
RETURN(NULL); RETURN(NULL);
} }
Rect.left = Rect.right = Window->WindowRect.left; Rect.left = Rect.right = Window->Wnd->WindowRect.left;
Rect.top = Rect.bottom = Window->WindowRect.bottom; Rect.top = Rect.bottom = Window->Wnd->WindowRect.bottom;
IntGetMonitorsFromRect(&Rect, &hMonitor, NULL, 1, dwFlags); IntGetMonitorsFromRect(&Rect, &hMonitor, NULL, 1, dwFlags);

View file

@ -68,7 +68,7 @@ IntIntersectWithParents(PWINDOW_OBJECT Child, PRECT WindowRect)
return FALSE; return FALSE;
} }
if (!IntGdiIntersectRect(WindowRect, WindowRect, &ParentWindow->ClientRect)) if (!IntGdiIntersectRect(WindowRect, WindowRect, &ParentWindow->Wnd->ClientRect))
{ {
return FALSE; return FALSE;
} }
@ -119,19 +119,19 @@ IntCalcWindowRgn(PWINDOW_OBJECT Window, BOOL Client)
UINT RgnType; UINT RgnType;
if (Client) if (Client)
hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect);
else else
hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect);
if (Window->WindowRegion != NULL && !(Window->Style & WS_MINIMIZE)) if (Window->WindowRegion != NULL && !(Window->Style & WS_MINIMIZE))
{ {
NtGdiOffsetRgn(hRgnWindow, NtGdiOffsetRgn(hRgnWindow,
-Window->WindowRect.left, -Window->Wnd->WindowRect.left,
-Window->WindowRect.top); -Window->Wnd->WindowRect.top);
RgnType = NtGdiCombineRgn(hRgnWindow, hRgnWindow, Window->WindowRegion, RGN_AND); RgnType = NtGdiCombineRgn(hRgnWindow, hRgnWindow, Window->WindowRegion, RGN_AND);
NtGdiOffsetRgn(hRgnWindow, NtGdiOffsetRgn(hRgnWindow,
Window->WindowRect.left, Window->Wnd->WindowRect.left,
Window->WindowRect.top); Window->Wnd->WindowRect.top);
} }
return hRgnWindow; return hRgnWindow;
@ -340,7 +340,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
{ {
HRGN hRgnClient; HRGN hRgnClient;
hRgnClient = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); hRgnClient = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect);
RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnClient, RGN_AND); RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnClient, RGN_AND);
NtGdiDeleteObject(hRgnClient); NtGdiDeleteObject(hRgnClient);
} }
@ -353,19 +353,19 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
{ {
HRGN hRgnWindow; HRGN hRgnWindow;
hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect);
RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnWindow, RGN_AND); RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnWindow, RGN_AND);
NtGdiDeleteObject(hRgnWindow); NtGdiDeleteObject(hRgnWindow);
} }
else else
{ {
NtGdiOffsetRgn(hRgn, NtGdiOffsetRgn(hRgn,
-Window->WindowRect.left, -Window->Wnd->WindowRect.left,
-Window->WindowRect.top); -Window->Wnd->WindowRect.top);
RgnType = NtGdiCombineRgn(hRgn, hRgn, Window->WindowRegion, RGN_AND); RgnType = NtGdiCombineRgn(hRgn, hRgn, Window->WindowRegion, RGN_AND);
NtGdiOffsetRgn(hRgn, NtGdiOffsetRgn(hRgn,
Window->WindowRect.left, Window->Wnd->WindowRect.left,
Window->WindowRect.top); Window->Wnd->WindowRect.top);
} }
/* /*
@ -553,26 +553,26 @@ co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECT* UpdateRect, HRGN UpdateRg
hRgn = NULL; hRgn = NULL;
} }
else else
NtGdiOffsetRgn(hRgn, Window->ClientRect.left, Window->ClientRect.top); NtGdiOffsetRgn(hRgn, Window->Wnd->ClientRect.left, Window->Wnd->ClientRect.top);
} }
else if (UpdateRect != NULL) else if (UpdateRect != NULL)
{ {
if (!IntGdiIsEmptyRect(UpdateRect)) if (!IntGdiIsEmptyRect(UpdateRect))
{ {
hRgn = UnsafeIntCreateRectRgnIndirect((RECT *)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) || else if ((Flags & (RDW_INVALIDATE | RDW_FRAME)) == (RDW_INVALIDATE | RDW_FRAME) ||
(Flags & (RDW_VALIDATE | RDW_NOFRAME)) == (RDW_VALIDATE | RDW_NOFRAME)) (Flags & (RDW_VALIDATE | RDW_NOFRAME)) == (RDW_VALIDATE | RDW_NOFRAME))
{ {
if (!IntGdiIsEmptyRect(&Window->WindowRect)) if (!IntGdiIsEmptyRect(&Window->Wnd->WindowRect))
hRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); hRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect);
} }
else else
{ {
if (!IntGdiIsEmptyRect(&Window->ClientRect)) if (!IntGdiIsEmptyRect(&Window->Wnd->ClientRect))
hRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); hRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect);
} }
} }
@ -797,12 +797,12 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
{ {
UnsafeIntGetRgnBox(Rgn, &Ps.rcPaint); UnsafeIntGetRgnBox(Rgn, &Ps.rcPaint);
RGNDATA_UnlockRgn(Rgn); RGNDATA_UnlockRgn(Rgn);
IntGdiIntersectRect(&Ps.rcPaint, &Ps.rcPaint, &Window->ClientRect); IntGdiIntersectRect(&Ps.rcPaint, &Ps.rcPaint, &Window->Wnd->ClientRect);
if (! IntGdiIsEmptyRect(&Ps.rcPaint)) if (! IntGdiIsEmptyRect(&Ps.rcPaint))
{ {
IntGdiOffsetRect(&Ps.rcPaint, IntGdiOffsetRect(&Ps.rcPaint,
-Window->ClientRect.left, -Window->Wnd->ClientRect.left,
-Window->ClientRect.top); -Window->Wnd->ClientRect.top);
} }
} }
else else
@ -930,11 +930,11 @@ co_UserGetUpdateRgn(PWINDOW_OBJECT Window, HRGN hRgn, BOOL bErase)
} }
else else
{ {
Rect = Window->ClientRect; Rect = Window->Wnd->ClientRect;
IntIntersectWithParents(Window, &Rect); IntIntersectWithParents(Window, &Rect);
NtGdiSetRectRgn(hRgn, Rect.left, Rect.top, Rect.right, Rect.bottom); NtGdiSetRectRgn(hRgn, Rect.left, Rect.top, Rect.right, Rect.bottom);
RegionType = NtGdiCombineRgn(hRgn, hRgn, Window->UpdateRegion, RGN_AND); 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) if (bErase && RegionType != NULLREGION && RegionType != ERROR)
@ -1014,7 +1014,7 @@ NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
/* Get the update region bounding box. */ /* Get the update region bounding box. */
if (Window->UpdateRegion == (HRGN)1) if (Window->UpdateRegion == (HRGN)1)
{ {
Rect = Window->ClientRect; Rect = Window->Wnd->ClientRect;
} }
else else
{ {
@ -1024,14 +1024,14 @@ NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
RGNDATA_UnlockRgn(RgnData); RGNDATA_UnlockRgn(RgnData);
if (RegionType != ERROR && RegionType != NULLREGION) if (RegionType != ERROR && RegionType != NULLREGION)
IntGdiIntersectRect(&Rect, &Rect, &Window->ClientRect); IntGdiIntersectRect(&Rect, &Rect, &Window->Wnd->ClientRect);
} }
if (IntIntersectWithParents(Window, &Rect)) if (IntIntersectWithParents(Window, &Rect))
{ {
IntGdiOffsetRect(&Rect, IntGdiOffsetRect(&Rect,
-Window->ClientRect.left, -Window->Wnd->ClientRect.left,
-Window->ClientRect.top); -Window->Wnd->ClientRect.top);
} else } else
{ {
Rect.left = Rect.top = Rect.right = Rect.bottom = 0; 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); IntGetClientOrigin(Window, &ClientOrigin);
for (Child = Window->FirstChild; Child; Child = Child->NextSibling) for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
{ {
rcChild = Child->WindowRect; rcChild = Child->Wnd->WindowRect;
rcChild.left -= ClientOrigin.x; rcChild.left -= ClientOrigin.x;
rcChild.top -= ClientOrigin.y; rcChild.top -= ClientOrigin.y;
rcChild.right -= ClientOrigin.x; rcChild.right -= ClientOrigin.x;

View file

@ -60,8 +60,8 @@ BOOL FASTCALL
IntGetScrollBarRect (PWINDOW_OBJECT Window, INT nBar, PRECT lprect) IntGetScrollBarRect (PWINDOW_OBJECT Window, INT nBar, PRECT lprect)
{ {
BOOL vertical; BOOL vertical;
RECT ClientRect = Window->ClientRect; RECT ClientRect = Window->Wnd->ClientRect;
RECT WindowRect = Window->WindowRect; RECT WindowRect = Window->Wnd->WindowRect;
switch (nBar) switch (nBar)
{ {
@ -394,10 +394,10 @@ co_IntSetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bR
if (bRedraw) if (bRedraw)
{ {
RECT UpdateRect = psbi->rcScrollBar; RECT UpdateRect = psbi->rcScrollBar;
UpdateRect.left -= Window->ClientRect.left - Window->WindowRect.left; UpdateRect.left -= Window->Wnd->ClientRect.left - Window->Wnd->WindowRect.left;
UpdateRect.right -= Window->ClientRect.left - Window->WindowRect.left; UpdateRect.right -= Window->Wnd->ClientRect.left - Window->Wnd->WindowRect.left;
UpdateRect.top -= Window->ClientRect.top - Window->WindowRect.top; UpdateRect.top -= Window->Wnd->ClientRect.top - Window->Wnd->WindowRect.top;
UpdateRect.bottom -= Window->ClientRect.top - Window->WindowRect.top; UpdateRect.bottom -= Window->Wnd->ClientRect.top - Window->Wnd->WindowRect.top;
co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME);
} }
@ -467,8 +467,8 @@ co_IntCreateScrollBars(PWINDOW_OBJECT Window)
RtlZeroMemory(Window->Scroll, Size); RtlZeroMemory(Window->Scroll, Size);
Result = co_WinPosGetNonClientSize(Window, Result = co_WinPosGetNonClientSize(Window,
&Window->WindowRect, &Window->Wnd->WindowRect,
&Window->ClientRect); &Window->Wnd->ClientRect);
for(s = SB_HORZ; s <= SB_VERT; s++) for(s = SB_HORZ; s <= SB_VERT; s++)
{ {

View file

@ -47,11 +47,11 @@ VIS_ComputeVisibleRegion(
if (ClientArea) if (ClientArea)
{ {
VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect);
} }
else else
{ {
VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect);
} }
/* /*
@ -70,7 +70,7 @@ VIS_ComputeVisibleRegion(
return NULL; return NULL;
} }
ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->ClientRect); ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->Wnd->ClientRect);
NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_AND); NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_AND);
NtGdiDeleteObject(ClipRgn); NtGdiDeleteObject(ClipRgn);
@ -83,13 +83,13 @@ VIS_ComputeVisibleRegion(
if ((CurrentSibling->Style & WS_VISIBLE) && if ((CurrentSibling->Style & WS_VISIBLE) &&
!(CurrentSibling->ExStyle & WS_EX_TRANSPARENT)) !(CurrentSibling->ExStyle & WS_EX_TRANSPARENT))
{ {
ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentSibling->WindowRect); ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentSibling->Wnd->WindowRect);
/* Combine it with the window region if available */ /* Combine it with the window region if available */
if (CurrentSibling->WindowRegion && !(CurrentSibling->Style & WS_MINIMIZE)) 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); 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); NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
NtGdiDeleteObject(ClipRgn); NtGdiDeleteObject(ClipRgn);
@ -110,13 +110,13 @@ VIS_ComputeVisibleRegion(
if ((CurrentWindow->Style & WS_VISIBLE) && if ((CurrentWindow->Style & WS_VISIBLE) &&
!(CurrentWindow->ExStyle & WS_EX_TRANSPARENT)) !(CurrentWindow->ExStyle & WS_EX_TRANSPARENT))
{ {
ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->WindowRect); ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->Wnd->WindowRect);
/* Combine it with the window region if available */ /* Combine it with the window region if available */
if (CurrentWindow->WindowRegion && !(CurrentWindow->Style & WS_MINIMIZE)) 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); 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); NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
NtGdiDeleteObject(ClipRgn); NtGdiDeleteObject(ClipRgn);
@ -127,9 +127,9 @@ VIS_ComputeVisibleRegion(
if (Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) 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); 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; return VisRgn;
@ -153,8 +153,8 @@ co_VIS_WindowLayoutChanged(
if(Parent) if(Parent)
{ {
NtGdiOffsetRgn(Temp, NtGdiOffsetRgn(Temp,
Window->WindowRect.left - Parent->ClientRect.left, Window->Wnd->WindowRect.left - Parent->Wnd->ClientRect.left,
Window->WindowRect.top - Parent->ClientRect.top); Window->Wnd->WindowRect.top - Parent->Wnd->ClientRect.top);
UserRefObjectCo(Parent, &Ref); UserRefObjectCo(Parent, &Ref);
co_UserRedrawWindow(Parent, NULL, Temp, co_UserRedrawWindow(Parent, NULL, Temp,

View file

@ -199,13 +199,13 @@ DceSetDrawable(PWINDOW_OBJECT Window OPTIONAL, HDC hDC, ULONG Flags,
{ {
if (Flags & DCX_WINDOW) if (Flags & DCX_WINDOW)
{ {
dc->w.DCOrgX = Window->WindowRect.left; dc->w.DCOrgX = Window->Wnd->WindowRect.left;
dc->w.DCOrgY = Window->WindowRect.top; dc->w.DCOrgY = Window->Wnd->WindowRect.top;
} }
else else
{ {
dc->w.DCOrgX = Window->ClientRect.left; dc->w.DCOrgX = Window->Wnd->ClientRect.left;
dc->w.DCOrgY = Window->ClientRect.top; dc->w.DCOrgY = Window->Wnd->ClientRect.top;
} }
} }
DC_UnlockDc(dc); DC_UnlockDc(dc);
@ -311,7 +311,7 @@ DceUpdateVisRgn(DCE *Dce, PWINDOW_OBJECT Window, ULONG Flags)
DesktopWindow = UserGetWindowObject(IntGetDesktopWindow()); DesktopWindow = UserGetWindowObject(IntGetDesktopWindow());
if (NULL != DesktopWindow) if (NULL != DesktopWindow)
{ {
hRgnVisible = UnsafeIntCreateRectRgnIndirect(&DesktopWindow->WindowRect); hRgnVisible = UnsafeIntCreateRectRgnIndirect(&DesktopWindow->Wnd->WindowRect);
} }
else else
{ {
@ -530,11 +530,11 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
{ {
if (!(Flags & DCX_WINDOW)) if (!(Flags & DCX_WINDOW))
{ {
Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect); Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect);
} }
else else
{ {
Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); Dce->hClipRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect);
} }
} }
else if (ClipRegion != NULL) else if (ClipRegion != NULL)
@ -819,17 +819,17 @@ DceResetActiveDCEs(PWINDOW_OBJECT Window)
{ {
if (pDCE->DCXFlags & DCX_WINDOW) if (pDCE->DCXFlags & DCX_WINDOW)
{ {
DeltaX = CurrentWindow->WindowRect.left - dc->w.DCOrgX; DeltaX = CurrentWindow->Wnd->WindowRect.left - dc->w.DCOrgX;
DeltaY = CurrentWindow->WindowRect.top - dc->w.DCOrgY; DeltaY = CurrentWindow->Wnd->WindowRect.top - dc->w.DCOrgY;
dc->w.DCOrgX = CurrentWindow->WindowRect.left; dc->w.DCOrgX = CurrentWindow->Wnd->WindowRect.left;
dc->w.DCOrgY = CurrentWindow->WindowRect.top; dc->w.DCOrgY = CurrentWindow->Wnd->WindowRect.top;
} }
else else
{ {
DeltaX = CurrentWindow->ClientRect.left - dc->w.DCOrgX; DeltaX = CurrentWindow->Wnd->ClientRect.left - dc->w.DCOrgX;
DeltaY = CurrentWindow->ClientRect.top - dc->w.DCOrgY; DeltaY = CurrentWindow->Wnd->ClientRect.top - dc->w.DCOrgY;
dc->w.DCOrgX = CurrentWindow->ClientRect.left; dc->w.DCOrgX = CurrentWindow->Wnd->ClientRect.left;
dc->w.DCOrgY = CurrentWindow->ClientRect.top; dc->w.DCOrgY = CurrentWindow->Wnd->ClientRect.top;
} }
if (NULL != dc->w.hClipRgn) if (NULL != dc->w.hClipRgn)
{ {

View file

@ -292,6 +292,21 @@ static void IntSendDestroyMsg(HWND hWnd)
#endif #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 * IntDestroyWindow
* *
@ -447,6 +462,9 @@ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window,
RtlFreeUnicodeString(&Window->WindowName); RtlFreeUnicodeString(&Window->WindowName);
ASSERT(Window->Wnd != NULL);
UserFreeWindowInfo(Window->ti, Window);
UserDerefObject(Window); UserDerefObject(Window);
IntClipboardFreeWindow(Window); IntClipboardFreeWindow(Window);
@ -539,8 +557,8 @@ BOOL FASTCALL
IntGetWindowInfo(PWINDOW_OBJECT Window, PWINDOWINFO pwi) IntGetWindowInfo(PWINDOW_OBJECT Window, PWINDOWINFO pwi)
{ {
pwi->cbSize = sizeof(WINDOWINFO); pwi->cbSize = sizeof(WINDOWINFO);
pwi->rcWindow = Window->WindowRect; pwi->rcWindow = Window->Wnd->WindowRect;
pwi->rcClient = Window->ClientRect; pwi->rcClient = Window->Wnd->ClientRect;
pwi->dwStyle = Window->Style; pwi->dwStyle = Window->Style;
pwi->dwExStyle = Window->ExStyle; pwi->dwExStyle = Window->ExStyle;
pwi->dwWindowStatus = (UserGetForegroundWindow() == Window->hSelf); /* WS_ACTIVECAPTION */ pwi->dwWindowStatus = (UserGetForegroundWindow() == Window->hSelf); /* WS_ACTIVECAPTION */
@ -673,8 +691,8 @@ IntGetClientRect(PWINDOW_OBJECT Window, PRECT Rect)
ASSERT( Rect ); ASSERT( Rect );
Rect->left = Rect->top = 0; Rect->left = Rect->top = 0;
Rect->right = Window->ClientRect.right - Window->ClientRect.left; Rect->right = Window->Wnd->ClientRect.right - Window->Wnd->ClientRect.left;
Rect->bottom = Window->ClientRect.bottom - Window->ClientRect.top; Rect->bottom = Window->Wnd->ClientRect.bottom - Window->Wnd->ClientRect.top;
} }
@ -1301,8 +1319,8 @@ NtUserChildWindowFromPointEx(HWND hwndParent,
if(Parent->hSelf != IntGetDesktopWindow()) if(Parent->hSelf != IntGetDesktopWindow())
{ {
Pt.x += Parent->ClientRect.left; Pt.x += Parent->Wnd->ClientRect.left;
Pt.y += Parent->ClientRect.top; Pt.y += Parent->Wnd->ClientRect.top;
} }
if(!IntPtInWindow(Parent, Pt.x, Pt.y)) 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) if(Parent != NULL)
{ {
IntGdiIntersectRect(rc, rc, &Parent->ClientRect); IntGdiIntersectRect(rc, rc, &Parent->Wnd->ClientRect);
if(IncPos) if(IncPos)
{ {
@ -1528,10 +1546,21 @@ co_IntCreateWindowEx(DWORD dwExStyle,
ObmCreateObject(gHandleTable, (PHANDLE)&hWnd, ObmCreateObject(gHandleTable, (PHANDLE)&hWnd,
otWindow, sizeof(WINDOW_OBJECT) + Class->WndExtra 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); DPRINT("Created object with handle %X\n", hWnd);
if (!Window) if (!Window)
{ {
AllocErr:
ObDereferenceObject(WinSta); ObDereferenceObject(WinSta);
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
RETURN( (HWND)0); RETURN( (HWND)0);
@ -1814,16 +1843,16 @@ co_IntCreateWindowEx(DWORD dwExStyle,
} }
/* Initialize the window dimensions. */ /* Initialize the window dimensions. */
Window->WindowRect.left = Pos.x; Window->Wnd->WindowRect.left = Pos.x;
Window->WindowRect.top = Pos.y; Window->Wnd->WindowRect.top = Pos.y;
Window->WindowRect.right = Pos.x + Size.cx; Window->Wnd->WindowRect.right = Pos.x + Size.cx;
Window->WindowRect.bottom = Pos.y + Size.cy; Window->Wnd->WindowRect.bottom = Pos.y + Size.cy;
if (0 != (Window->Style & WS_CHILD) && ParentWindow) if (0 != (Window->Style & WS_CHILD) && ParentWindow)
{ {
IntGdiOffsetRect(&(Window->WindowRect), ParentWindow->ClientRect.left, IntGdiOffsetRect(&(Window->Wnd->WindowRect), ParentWindow->Wnd->ClientRect.left,
ParentWindow->ClientRect.top); ParentWindow->Wnd->ClientRect.top);
} }
Window->ClientRect = Window->WindowRect; Window->Wnd->ClientRect = Window->Wnd->WindowRect;
/* /*
* Get the size and position of the window. * Get the size and position of the window.
@ -1849,16 +1878,16 @@ co_IntCreateWindowEx(DWORD dwExStyle,
Size.cy = 0; Size.cy = 0;
} }
Window->WindowRect.left = Pos.x; Window->Wnd->WindowRect.left = Pos.x;
Window->WindowRect.top = Pos.y; Window->Wnd->WindowRect.top = Pos.y;
Window->WindowRect.right = Pos.x + Size.cx; Window->Wnd->WindowRect.right = Pos.x + Size.cx;
Window->WindowRect.bottom = Pos.y + Size.cy; Window->Wnd->WindowRect.bottom = Pos.y + Size.cy;
if (0 != (Window->Style & WS_CHILD) && ParentWindow) if (0 != (Window->Style & WS_CHILD) && ParentWindow)
{ {
IntGdiOffsetRect(&(Window->WindowRect), ParentWindow->ClientRect.left, IntGdiOffsetRect(&(Window->Wnd->WindowRect), ParentWindow->Wnd->ClientRect.left,
ParentWindow->ClientRect.top); ParentWindow->Wnd->ClientRect.top);
} }
Window->ClientRect = Window->WindowRect; Window->Wnd->ClientRect = Window->Wnd->WindowRect;
/* FIXME: Initialize the window menu. */ /* FIXME: Initialize the window menu. */
@ -1880,19 +1909,19 @@ co_IntCreateWindowEx(DWORD dwExStyle,
} }
/* Calculate the non-client size. */ /* Calculate the non-client size. */
MaxPos.x = Window->WindowRect.left; MaxPos.x = Window->Wnd->WindowRect.left;
MaxPos.y = Window->WindowRect.top; MaxPos.y = Window->Wnd->WindowRect.top;
DPRINT("IntCreateWindowEx(): About to get non-client size.\n"); DPRINT("IntCreateWindowEx(): About to get non-client size.\n");
/* WinPosGetNonClientSize SENDS THE WM_NCCALCSIZE message */ /* WinPosGetNonClientSize SENDS THE WM_NCCALCSIZE message */
Result = co_WinPosGetNonClientSize(Window, Result = co_WinPosGetNonClientSize(Window,
&Window->WindowRect, &Window->Wnd->WindowRect,
&Window->ClientRect); &Window->Wnd->ClientRect);
IntGdiOffsetRect(&Window->WindowRect, IntGdiOffsetRect(&Window->Wnd->WindowRect,
MaxPos.x - Window->WindowRect.left, MaxPos.x - Window->Wnd->WindowRect.left,
MaxPos.y - Window->WindowRect.top); MaxPos.y - Window->Wnd->WindowRect.top);
if (NULL != ParentWindow) if (NULL != ParentWindow)
@ -1951,17 +1980,17 @@ co_IntCreateWindowEx(DWORD dwExStyle,
DPRINT("IntCreateWindow(): About to send WM_SIZE\n"); DPRINT("IntCreateWindow(): About to send WM_SIZE\n");
if ((Window->ClientRect.right - Window->ClientRect.left) < 0 || if ((Window->Wnd->ClientRect.right - Window->Wnd->ClientRect.left) < 0 ||
(Window->ClientRect.bottom - Window->ClientRect.top) < 0) (Window->Wnd->ClientRect.bottom - Window->Wnd->ClientRect.top) < 0)
{ {
DPRINT("Sending bogus WM_SIZE\n"); DPRINT("Sending bogus WM_SIZE\n");
} }
lParam = MAKE_LONG(Window->ClientRect.right - lParam = MAKE_LONG(Window->Wnd->ClientRect.right -
Window->ClientRect.left, Window->Wnd->ClientRect.left,
Window->ClientRect.bottom - Window->Wnd->ClientRect.bottom -
Window->ClientRect.top); Window->Wnd->ClientRect.top);
co_IntSendMessage(Window->hSelf, WM_SIZE, SIZE_RESTORED, co_IntSendMessage(Window->hSelf, WM_SIZE, SIZE_RESTORED,
lParam); lParam);
@ -1970,13 +1999,13 @@ co_IntCreateWindowEx(DWORD dwExStyle,
if (0 != (Window->Style & WS_CHILD) && ParentWindow) if (0 != (Window->Style & WS_CHILD) && ParentWindow)
{ {
lParam = MAKE_LONG(Window->ClientRect.left - ParentWindow->ClientRect.left, lParam = MAKE_LONG(Window->Wnd->ClientRect.left - ParentWindow->Wnd->ClientRect.left,
Window->ClientRect.top - ParentWindow->ClientRect.top); Window->Wnd->ClientRect.top - ParentWindow->Wnd->ClientRect.top);
} }
else else
{ {
lParam = MAKE_LONG(Window->ClientRect.left, lParam = MAKE_LONG(Window->Wnd->ClientRect.left,
Window->ClientRect.top); Window->Wnd->ClientRect.top);
} }
@ -2050,6 +2079,8 @@ co_IntCreateWindowEx(DWORD dwExStyle,
RETURN(hWnd); RETURN(hWnd);
CLEANUP: CLEANUP:
if (!_ret_ && Window && Window->Wnd && ti)
UserFreeWindowInfo(ti, Window);
if (Window) UserDerefObjectCo(Window); if (Window) UserDerefObjectCo(Window);
if (ParentWindow) UserDerefObjectCo(ParentWindow); if (ParentWindow) UserDerefObjectCo(ParentWindow);
if (!_ret_ && ti != NULL) if (!_ret_ && ti != NULL)
@ -3844,10 +3875,10 @@ NtUserGetWindowPlacement(HWND hWnd,
Safepl.showCmd = SW_SHOWNORMAL; Safepl.showCmd = SW_SHOWNORMAL;
} }
Size.x = Window->WindowRect.left; Size.x = Window->Wnd->WindowRect.left;
Size.y = Window->WindowRect.top; Size.y = Window->Wnd->WindowRect.top;
InternalPos = WinPosInitInternalPos(Window, &Size, InternalPos = WinPosInitInternalPos(Window, &Size,
&Window->WindowRect); &Window->Wnd->WindowRect);
if (InternalPos) if (InternalPos)
{ {
Safepl.rcNormalPosition = InternalPos->NormalRect; Safepl.rcNormalPosition = InternalPos->NormalRect;
@ -3897,7 +3928,7 @@ NtUserGetWindowRect(HWND hWnd, LPRECT Rect)
{ {
RETURN(FALSE); RETURN(FALSE);
} }
Status = MmCopyToCaller(Rect, &Wnd->WindowRect, sizeof(RECT)); Status = MmCopyToCaller(Rect, &Wnd->Wnd->WindowRect, sizeof(RECT));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastNtError(Status); SetLastNtError(Status);
@ -4319,8 +4350,8 @@ IntGetWindowRgn(PWINDOW_OBJECT Window, HRGN hRgn)
} }
/* Create a new window region using the window rectangle */ /* Create a new window region using the window rectangle */
VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect);
NtGdiOffsetRgn(VisRgn, -Window->WindowRect.left, -Window->WindowRect.top); NtGdiOffsetRgn(VisRgn, -Window->Wnd->WindowRect.left, -Window->Wnd->WindowRect.top);
/* if there's a region assigned to the window, combine them both */ /* if there's a region assigned to the window, combine them both */
if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE))
NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND); 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 */ /* Create a new window region using the window rectangle */
VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect); VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect);
NtGdiOffsetRgn(VisRgn, -Window->WindowRect.left, -Window->WindowRect.top); NtGdiOffsetRgn(VisRgn, -Window->Wnd->WindowRect.left, -Window->Wnd->WindowRect.top);
/* if there's a region assigned to the window, combine them both */ /* if there's a region assigned to the window, combine them both */
if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE))
NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND); NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND);

View file

@ -64,8 +64,8 @@ IntGetClientOrigin(PWINDOW_OBJECT Window OPTIONAL, LPPOINT Point)
Point->x = Point->y = 0; Point->x = Point->y = 0;
return FALSE; return FALSE;
} }
Point->x = Window->ClientRect.left; Point->x = Window->Wnd->ClientRect.left;
Point->y = Window->ClientRect.top; Point->y = Window->Wnd->ClientRect.top;
return TRUE; return TRUE;
} }
@ -278,7 +278,7 @@ WinPosInitInternalPos(PWINDOW_OBJECT Window, POINT *pt, PRECT RestoreRect)
if(IntIsDesktopWindow(Parent)) if(IntIsDesktopWindow(Parent))
IntGetDesktopWorkArea(Desktop, &WorkArea); IntGetDesktopWorkArea(Desktop, &WorkArea);
else else
WorkArea = Parent->ClientRect; WorkArea = Parent->Wnd->ClientRect;
} }
else else
IntGetDesktopWorkArea(Desktop, &WorkArea); 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); DPRINT1("Failed to allocate INTERNALPOS structure for window 0x%x\n", Window->hSelf);
return NULL; return NULL;
} }
Window->InternalPos->NormalRect = Window->WindowRect; Window->InternalPos->NormalRect = Window->Wnd->WindowRect;
IntGetWindowBorderMeasures(Window, &XInc, &YInc); IntGetWindowBorderMeasures(Window, &XInc, &YInc);
Window->InternalPos->MaxPos.x = WorkArea.left - XInc; Window->InternalPos->MaxPos.x = WorkArea.left - XInc;
Window->InternalPos->MaxPos.y = WorkArea.top - YInc; Window->InternalPos->MaxPos.y = WorkArea.top - YInc;
@ -320,9 +320,9 @@ co_WinPosMinMaximize(PWINDOW_OBJECT Window, UINT ShowFlag, RECT* NewPos)
ASSERT_REFS_CO(Window); ASSERT_REFS_CO(Window);
Size.x = Window->WindowRect.left; Size.x = Window->Wnd->WindowRect.left;
Size.y = Window->WindowRect.top; Size.y = Window->Wnd->WindowRect.top;
InternalPos = WinPosInitInternalPos(Window, &Size, &Window->WindowRect); InternalPos = WinPosInitInternalPos(Window, &Size, &Window->Wnd->WindowRect);
if (InternalPos) if (InternalPos)
{ {
@ -533,17 +533,17 @@ co_WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos,
WINDOWPOS winposCopy; WINDOWPOS winposCopy;
params.rgrc[0] = *WindowRect; params.rgrc[0] = *WindowRect;
params.rgrc[1] = Window->WindowRect; params.rgrc[1] = Window->Wnd->WindowRect;
params.rgrc[2] = Window->ClientRect; params.rgrc[2] = Window->Wnd->ClientRect;
Parent = Window->Parent; Parent = Window->Parent;
if (0 != (Window->Style & WS_CHILD) && Parent) if (0 != (Window->Style & WS_CHILD) && Parent)
{ {
IntGdiOffsetRect(&(params.rgrc[0]), - Parent->ClientRect.left, IntGdiOffsetRect(&(params.rgrc[0]), - Parent->Wnd->ClientRect.left,
- Parent->ClientRect.top); - Parent->Wnd->ClientRect.top);
IntGdiOffsetRect(&(params.rgrc[1]), - Parent->ClientRect.left, IntGdiOffsetRect(&(params.rgrc[1]), - Parent->Wnd->ClientRect.left,
- Parent->ClientRect.top); - Parent->Wnd->ClientRect.top);
IntGdiOffsetRect(&(params.rgrc[2]), - Parent->ClientRect.left, IntGdiOffsetRect(&(params.rgrc[2]), - Parent->Wnd->ClientRect.left,
- Parent->ClientRect.top); - Parent->Wnd->ClientRect.top);
} }
params.lppos = &winposCopy; params.lppos = &winposCopy;
winposCopy = *WinPos; winposCopy = *WinPos;
@ -557,24 +557,24 @@ co_WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos,
*ClientRect = params.rgrc[0]; *ClientRect = params.rgrc[0];
if ((Window->Style & WS_CHILD) && Parent) if ((Window->Style & WS_CHILD) && Parent)
{ {
IntGdiOffsetRect(ClientRect, Parent->ClientRect.left, IntGdiOffsetRect(ClientRect, Parent->Wnd->ClientRect.left,
Parent->ClientRect.top); Parent->Wnd->ClientRect.top);
} }
FixClientRect(ClientRect, WindowRect); FixClientRect(ClientRect, WindowRect);
} }
/* FIXME: WVR_ALIGNxxx */ /* FIXME: WVR_ALIGNxxx */
if (ClientRect->left != Window->ClientRect.left || if (ClientRect->left != Window->Wnd->ClientRect.left ||
ClientRect->top != Window->ClientRect.top) ClientRect->top != Window->Wnd->ClientRect.top)
{ {
WinPos->flags &= ~SWP_NOCLIENTMOVE; WinPos->flags &= ~SWP_NOCLIENTMOVE;
} }
if ((ClientRect->right - ClientRect->left != if ((ClientRect->right - ClientRect->left !=
Window->ClientRect.right - Window->ClientRect.left) || Window->Wnd->ClientRect.right - Window->Wnd->ClientRect.left) ||
(ClientRect->bottom - ClientRect->top != (ClientRect->bottom - ClientRect->top !=
Window->ClientRect.bottom - Window->ClientRect.top)) Window->Wnd->ClientRect.bottom - Window->Wnd->ClientRect.top))
{ {
WinPos->flags &= ~SWP_NOCLIENTSIZE; WinPos->flags &= ~SWP_NOCLIENTSIZE;
} }
@ -582,8 +582,8 @@ co_WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos,
else else
{ {
if (! (WinPos->flags & SWP_NOMOVE) if (! (WinPos->flags & SWP_NOMOVE)
&& (ClientRect->left != Window->ClientRect.left || && (ClientRect->left != Window->Wnd->ClientRect.left ||
ClientRect->top != Window->ClientRect.top)) ClientRect->top != Window->Wnd->ClientRect.top))
{ {
WinPos->flags &= ~SWP_NOCLIENTMOVE; WinPos->flags &= ~SWP_NOCLIENTMOVE;
} }
@ -608,8 +608,8 @@ co_WinPosDoWinPosChanging(PWINDOW_OBJECT Window,
co_IntPostOrSendMessage(Window->hSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos); co_IntPostOrSendMessage(Window->hSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos);
} }
*WindowRect = Window->WindowRect; *WindowRect = Window->Wnd->WindowRect;
*ClientRect = Window->ClientRect; *ClientRect = Window->Wnd->ClientRect;
if (!(WinPos->flags & SWP_NOSIZE)) if (!(WinPos->flags & SWP_NOSIZE))
{ {
@ -625,17 +625,17 @@ co_WinPosDoWinPosChanging(PWINDOW_OBJECT Window,
Parent = Window->Parent; Parent = Window->Parent;
if ((0 != (Window->Style & WS_CHILD)) && Parent) if ((0 != (Window->Style & WS_CHILD)) && Parent)
{ {
X += Parent->ClientRect.left; X += Parent->Wnd->ClientRect.left;
Y += Parent->ClientRect.top; Y += Parent->Wnd->ClientRect.top;
} }
WindowRect->left = X; WindowRect->left = X;
WindowRect->top = Y; WindowRect->top = Y;
WindowRect->right += X - Window->WindowRect.left; WindowRect->right += X - Window->Wnd->WindowRect.left;
WindowRect->bottom += Y - Window->WindowRect.top; WindowRect->bottom += Y - Window->Wnd->WindowRect.top;
IntGdiOffsetRect(ClientRect, IntGdiOffsetRect(ClientRect,
X - Window->WindowRect.left, X - Window->Wnd->WindowRect.left,
Y - Window->WindowRect.top); Y - Window->Wnd->WindowRect.top);
} }
WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE; WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE;
@ -747,15 +747,15 @@ WinPosInternalMoveWindow(PWINDOW_OBJECT Window, INT MoveX, INT MoveY)
{ {
PWINDOW_OBJECT Child; PWINDOW_OBJECT Child;
Window->WindowRect.left += MoveX; Window->Wnd->WindowRect.left += MoveX;
Window->WindowRect.right += MoveX; Window->Wnd->WindowRect.right += MoveX;
Window->WindowRect.top += MoveY; Window->Wnd->WindowRect.top += MoveY;
Window->WindowRect.bottom += MoveY; Window->Wnd->WindowRect.bottom += MoveY;
Window->ClientRect.left += MoveX; Window->Wnd->ClientRect.left += MoveX;
Window->ClientRect.right += MoveX; Window->Wnd->ClientRect.right += MoveX;
Window->ClientRect.top += MoveY; Window->Wnd->ClientRect.top += MoveY;
Window->ClientRect.bottom += MoveY; Window->Wnd->ClientRect.bottom += MoveY;
for(Child = Window->FirstChild; Child; Child = Child->NextSibling) for(Child = Window->FirstChild; Child; Child = Child->NextSibling)
{ {
@ -787,15 +787,15 @@ WinPosFixupFlags(WINDOWPOS *WinPos, PWINDOW_OBJECT Window)
WinPos->cy = max(WinPos->cy, 0); WinPos->cy = max(WinPos->cy, 0);
/* Check for right size */ /* Check for right size */
if (Window->WindowRect.right - Window->WindowRect.left == WinPos->cx && if (Window->Wnd->WindowRect.right - Window->Wnd->WindowRect.left == WinPos->cx &&
Window->WindowRect.bottom - Window->WindowRect.top == WinPos->cy) Window->Wnd->WindowRect.bottom - Window->Wnd->WindowRect.top == WinPos->cy)
{ {
WinPos->flags |= SWP_NOSIZE; WinPos->flags |= SWP_NOSIZE;
} }
/* Check for right position */ /* Check for right position */
if (Window->WindowRect.left == WinPos->x && if (Window->Wnd->WindowRect.left == WinPos->x &&
Window->WindowRect.top == WinPos->y) Window->Wnd->WindowRect.top == WinPos->y)
{ {
WinPos->flags |= SWP_NOMOVE; WinPos->flags |= SWP_NOMOVE;
} }
@ -969,7 +969,7 @@ co_WinPosSetWindowPos(
else if(VisRgn) else if(VisRgn)
{ {
RGNDATA_UnlockRgn(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; OldWindowRect = Window->Wnd->WindowRect;
OldClientRect = Window->ClientRect; OldClientRect = Window->Wnd->ClientRect;
if (OldClientRect.bottom - OldClientRect.top == if (OldClientRect.bottom - OldClientRect.top ==
NewClientRect.bottom - NewClientRect.top) NewClientRect.bottom - NewClientRect.top)
@ -1069,8 +1069,8 @@ co_WinPosSetWindowPos(
NewClientRect.top - OldClientRect.top); NewClientRect.top - OldClientRect.top);
} }
Window->WindowRect = NewWindowRect; Window->Wnd->WindowRect = NewWindowRect;
Window->ClientRect = NewClientRect; Window->Wnd->ClientRect = NewClientRect;
if (!(WinPos.flags & SWP_SHOWWINDOW) && (WinPos.flags & SWP_HIDEWINDOW)) if (!(WinPos.flags & SWP_SHOWWINDOW) && (WinPos.flags & SWP_HIDEWINDOW))
{ {
@ -1119,7 +1119,7 @@ co_WinPosSetWindowPos(
else if(VisRgn) else if(VisRgn)
{ {
RGNDATA_UnlockRgn(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; PWINDOW_OBJECT Parent = Window->Parent;
NtGdiOffsetRgn(DirtyRgn, NtGdiOffsetRgn(DirtyRgn,
Window->WindowRect.left, Window->Wnd->WindowRect.left,
Window->WindowRect.top); Window->Wnd->WindowRect.top);
if ((Window->Style & WS_CHILD) && if ((Window->Style & WS_CHILD) &&
(Parent) && (Parent) &&
!(Parent->Style & WS_CLIPCHILDREN)) !(Parent->Style & WS_CLIPCHILDREN))
@ -1490,13 +1490,13 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
} }
co_IntSendMessage(Window->hSelf, WM_SIZE, wParam, co_IntSendMessage(Window->hSelf, WM_SIZE, wParam,
MAKELONG(Window->ClientRect.right - MAKELONG(Window->Wnd->ClientRect.right -
Window->ClientRect.left, Window->Wnd->ClientRect.left,
Window->ClientRect.bottom - Window->Wnd->ClientRect.bottom -
Window->ClientRect.top)); Window->Wnd->ClientRect.top));
co_IntSendMessage(Window->hSelf, WM_MOVE, 0, co_IntSendMessage(Window->hSelf, WM_MOVE, 0,
MAKELONG(Window->ClientRect.left, MAKELONG(Window->Wnd->ClientRect.left,
Window->ClientRect.top)); Window->Wnd->ClientRect.top));
IntEngWindowChanged(Window, WOC_RGN_CLIENT); IntEngWindowChanged(Window, WOC_RGN_CLIENT);
} }
@ -1612,10 +1612,10 @@ co_WinPosSearchChildren(
else else
*HitTest = HTCLIENT; *HitTest = HTCLIENT;
if (Point->x >= Current->ClientRect.left && if (Point->x >= Current->Wnd->ClientRect.left &&
Point->x < Current->ClientRect.right && Point->x < Current->Wnd->ClientRect.right &&
Point->y >= Current->ClientRect.top && Point->y >= Current->Wnd->ClientRect.top &&
Point->y < Current->ClientRect.bottom) Point->y < Current->Wnd->ClientRect.bottom)
{ {
co_WinPosSearchChildren(Current, OnlyHitTests, Point, Window, HitTest); co_WinPosSearchChildren(Current, OnlyHitTests, Point, Window, HitTest);
} }
@ -1658,8 +1658,8 @@ co_WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, PUSER_MESSAGE_QUEUE OnlyHitTes
if((DesktopWindowHandle != ScopeWin->hSelf) && if((DesktopWindowHandle != ScopeWin->hSelf) &&
(DesktopWindow = UserGetWindowObject(DesktopWindowHandle))) (DesktopWindow = UserGetWindowObject(DesktopWindowHandle)))
{ {
Point.x += ScopeWin->ClientRect.left - DesktopWindow->ClientRect.left; Point.x += ScopeWin->Wnd->ClientRect.left - DesktopWindow->Wnd->ClientRect.left;
Point.y += ScopeWin->ClientRect.top - DesktopWindow->ClientRect.top; Point.y += ScopeWin->Wnd->ClientRect.top - DesktopWindow->Wnd->ClientRect.top;
} }
HitTest = HTNOWHERE; HitTest = HTNOWHERE;
@ -1694,10 +1694,10 @@ NtUserGetMinMaxInfo(
UserRefObjectCo(Window, &Ref); UserRefObjectCo(Window, &Ref);
Size.x = Window->WindowRect.left; Size.x = Window->Wnd->WindowRect.left;
Size.y = Window->WindowRect.top; Size.y = Window->Wnd->WindowRect.top;
InternalPos = WinPosInitInternalPos(Window, &Size, InternalPos = WinPosInitInternalPos(Window, &Size,
&Window->WindowRect); &Window->Wnd->WindowRect);
if(InternalPos) if(InternalPos)
{ {
if(SendMessage) if(SendMessage)

View file

@ -47,15 +47,15 @@ IntGdiArcInternal(
Window = UserGetWindowObject(hWnd); Window = UserGetWindowObject(hWnd);
if(!Window) return FALSE; if(!Window) return FALSE;
rc.left += Window->ClientRect.left; rc.left += Window->Wnd->ClientRect.left;
rc.top += Window->ClientRect.top; rc.top += Window->Wnd->ClientRect.top;
rc.right += Window->ClientRect.left; rc.right += Window->Wnd->ClientRect.left;
rc.bottom += Window->ClientRect.top; rc.bottom += Window->Wnd->ClientRect.top;
rc1.left += Window->ClientRect.left; rc1.left += Window->Wnd->ClientRect.left;
rc1.top += Window->ClientRect.top; rc1.top += Window->Wnd->ClientRect.top;
rc1.right += Window->ClientRect.left; rc1.right += Window->Wnd->ClientRect.left;
rc1.bottom += Window->ClientRect.top; rc1.bottom += Window->Wnd->ClientRect.top;
} }
rx = (rc.right - rc.left)/2 - 1; rx = (rc.right - rc.left)/2 - 1;