- 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();
ASSERT(Ptr != NULL);
ASSERT(ti != NULL);
ASSERT(ti->DesktopHeapDelta != 0);
return (PVOID)((ULONG_PTR)Ptr - ti->DesktopHeapDelta);
if ((ULONG_PTR)Ptr >= (ULONG_PTR)ti->DesktopHeapBase &&
(ULONG_PTR)Ptr < (ULONG_PTR)ti->DesktopHeapBase + ti->DesktopHeapLimit)
{
return (PVOID)((ULONG_PTR)Ptr - ti->DesktopHeapDelta);
}
else
{
/* NOTE: This is slow as it requires a call to win32k. This should only be
neccessary if a thread wants to access an object on a different
desktop */
return NtUserGetDesktopMapping(Ptr);
}
}
static __inline PVOID
@ -76,3 +86,4 @@ SharedPtrToKernel(PVOID Ptr)
}
PCALLPROC FASTCALL ValidateCallProc(HANDLE hCallProc);
PWINDOW FASTCALL ValidateHwnd(HWND hwnd);

View file

@ -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)

View file

@ -339,7 +339,7 @@ GetUser32Handle(HANDLE handle)
static const BOOL g_ObjectHeapTypeShared[VALIDATE_TYPE_MONITOR + 1] =
{
FALSE, /* VALIDATE_TYPE_FREE (not used) */
FALSE, /* VALIDATE_TYPE_WIN */
TRUE, /* VALIDATE_TYPE_WIN */ /* FIXME: FALSE once WINDOW_OBJECT is deleted! */
TRUE, /* VALIDATE_TYPE_MENU */
TRUE, /* VALIDATE_TYPE_CURSOR */
TRUE, /* VALIDATE_TYPE_MWPOS */
@ -362,16 +362,8 @@ ValidateHandle(HANDLE handle, UINT uType)
{
PVOID ret;
PUSER_HANDLE_ENTRY pEntry;
PW32CLIENTINFO ClientInfo = GetWin32ClientInfo();
ASSERT(uType <= VALIDATE_TYPE_MONITOR);
ASSERT(ClientInfo != NULL);
/* See if we have the handle cached still */
if (uType == VALIDATE_TYPE_WIN)
{
if (handle == ClientInfo->hWND) return ClientInfo->pvWND;
}
pEntry = GetUser32Handle(handle);
@ -413,22 +405,11 @@ ValidateHandle(HANDLE handle, UINT uType)
else
ret = DesktopPtrToUser(pEntry->ptr);
/* Update the cache */
#if 0
/* FIXME: To enable this win32k needs to check this information when destroying
the window handle and clear it out of the ClientInfo structure! */
if (uType == VALIDATE_TYPE_WIN)
{
ClientInfo->hWND = handle;
ClientInfo->pvWND = ret;
}
#endif
return ret;
}
//
// Validate callproc handle and return the pointer to the object.
// Validate a callproc handle and return the pointer to the object.
//
PCALLPROC
FASTCALL
@ -440,3 +421,41 @@ ValidateCallProc(HANDLE hCallProc)
return NULL;
}
//
// Validate a window handle and return the pointer to the object.
//
PWINDOW
FASTCALL
ValidateHwnd(HWND hwnd)
{
PW32CLIENTINFO ClientInfo = GetWin32ClientInfo();
ASSERT(ClientInfo != NULL);
/* See if the window is cached */
if (hwnd == ClientInfo->hWND)
return ClientInfo->pvWND;
PWINDOW Wnd = ValidateHandle((HANDLE)hwnd, VALIDATE_TYPE_WIN);
if (Wnd != NULL)
{
/* FIXME: Check if handle table entry is marked as deleting and
return NULL in this case! */
#if 0
return Wnd;
#else
/* HACK HACK HACK! This needs to be done until WINDOW_OBJECT is completely
superseded by the WINDOW structure. We *ASSUME* a pointer to the WINDOW
structure to be at the beginning of the WINDOW_OBJECT structure!!!
!!! REMOVE AS SOON AS WINDOW_OBJECT NO LONGER EXISTS !!!
*/
if (*((PVOID*)Wnd) != NULL)
return DesktopPtrToUser(*((PVOID*)Wnd));
#endif
}
return NULL;
}

View file

@ -860,7 +860,17 @@ GetAncestor(HWND hwnd, UINT gaFlags)
BOOL STDCALL
GetClientRect(HWND hWnd, LPRECT lpRect)
{
return(NtUserGetClientRect(hWnd, lpRect));
PWINDOW Wnd = ValidateHwnd(hWnd);
if (Wnd != NULL)
{
lpRect->left = lpRect->top = 0;
lpRect->right = Wnd->ClientRect.right - Wnd->ClientRect.left;
lpRect->bottom = Wnd->ClientRect.bottom - Wnd->ClientRect.top;
return TRUE;
}
return FALSE;
}
@ -1007,7 +1017,15 @@ BOOL STDCALL
GetWindowRect(HWND hWnd,
LPRECT lpRect)
{
return(NtUserGetWindowRect(hWnd, lpRect));
PWINDOW Wnd = ValidateHwnd(hWnd);
if (Wnd != NULL)
{
*lpRect = Wnd->WindowRect;
return TRUE;
}
return FALSE;
}

View file

@ -7,6 +7,7 @@ struct _W32THREADINFO;
typedef struct _DESKTOP
{
HANDLE hKernelHeap;
ULONG_PTR HeapLimit;
WCHAR szDesktopName[1];
HWND hTaskManWindow;
HWND hProgmanWindow;
@ -55,6 +56,18 @@ typedef struct _WINDOWCLASS
UINT MenuNameIsString : 1;
} WINDOWCLASS, *PWINDOWCLASS;
typedef struct _WINDOW
{
/* NOTE: This structure is located in the desktop heap and will
eventually replace WINDOW_OBJECT. Right now WINDOW_OBJECT
keeps a reference to this structure until all the information
is moved to this structure */
struct _W32PROCESSINFO *pi; /* FIXME: Move to object header some day */
struct _W32THREADINFO *ti;
RECT WindowRect;
RECT ClientRect;
} WINDOW, *PWINDOW;
typedef struct _W32PROCESSINFO
{
PVOID UserHandleTable;
@ -71,6 +84,8 @@ typedef struct _W32THREADINFO
PW32PROCESSINFO pi; /* [USER] */
PW32PROCESSINFO kpi; /* [KERNEL] */
PDESKTOP Desktop;
PVOID DesktopHeapBase;
ULONG_PTR DesktopHeapLimit;
ULONG_PTR DesktopHeapDelta;
} W32THREADINFO, *PW32THREADINFO;
@ -496,6 +511,7 @@ NtUserCallNoParam(
#define ONEPARAM_ROUTINE_GETCURSORPOSITION 0x0b
#define ONEPARAM_ROUTINE_ISWINDOWINDESTROY 0x0c
#define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0x0d
#define ONEPARAM_ROUTINE_GETDESKTOPMAPPING 0x0e
#define ONEPARAM_ROUTINE_GETWINDOWINSTANCE 0x10
#define ONEPARAM_ROUTINE_MSQSETWAKEMASK 0x27
#define ONEPARAM_ROUTINE_GETKEYBOARDTYPE 0x28

View file

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

View file

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

View file

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

View file

@ -26,6 +26,12 @@ typedef struct _INTERNALPOS
typedef struct _WINDOW_OBJECT
{
/* NOTE: Do *NOT* Move this pointer anywhere in this structure! This
is a pointer to the WINDOW structure that eventually replaces
the WINDOW_OBJECT structure! USER32 expects this pointer to
be here until WINDOW_OBJECT has completely been superseded! */
PWINDOW Wnd;
/* Pointer to the thread information */
PW32THREADINFO ti;
/* Pointer to the desktop */
@ -59,10 +65,6 @@ typedef struct _WINDOW_OBJECT
PCHAR ExtraData;
/* Size of the extra data associated with the window. */
ULONG ExtraDataSize;
/* Position of the window. */
RECT WindowRect;
/* Position of the window's client area. */
RECT ClientRect;
/* Handle for the window. */
HWND hSelf;
/* Window flags. */

View file

@ -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);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -242,6 +242,22 @@ NtUserCallOneParam(
switch(Routine)
{
case ONEPARAM_ROUTINE_GETDESKTOPMAPPING:
{
PW32THREADINFO ti;
ti = GetW32ThreadInfo();
if (ti != NULL)
{
/* Try convert the pointer to a user mode pointer if the desktop is
mapped into the process */
RETURN((DWORD)DesktopHeapAddressToUser((PVOID)Param));
}
else
{
RETURN(0);
}
}
case ONEPARAM_ROUTINE_GETMENU:
{
PWINDOW_OBJECT Window;
@ -2542,11 +2558,15 @@ GetW32ThreadInfo(VOID)
if (W32Thread->Desktop != NULL)
{
ti->Desktop = W32Thread->Desktop->DesktopInfo;
ti->DesktopHeapBase = W32Thread->Desktop->DesktopInfo->hKernelHeap;
ti->DesktopHeapLimit = W32Thread->Desktop->DesktopInfo->HeapLimit;
ti->DesktopHeapDelta = DesktopHeapGetUserDelta();
}
else
{
ti->Desktop = NULL;
ti->DesktopHeapBase = NULL;
ti->DesktopHeapLimit = 0;
ti->DesktopHeapDelta = 0;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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