- Michael Martin found a create window and crash exit issue by testing programs from http://www.magma.ca/~wjr/ PEview. Fixed by replacing UserFreeWindowInfo with co_UserDestroyWindow at cleanup exit.
- Added more window death and thread checks.
- Started the morphing into WND structure from window object.
- Tested: wine user32 tests, AbiWord 2.6.8, Seamonkey 2.0, FF 3.5 and OOo 2.4.3.

svn path=/trunk/; revision=44575
This commit is contained in:
James Tabor 2009-12-14 05:02:56 +00:00
parent 21818f4e90
commit d51b4d5202
11 changed files with 133 additions and 123 deletions

View file

@ -43,6 +43,7 @@ BOOL FASTCALL IntKeyboardInput(KEYBDINPUT *ki);
BOOL UserInitDefaultKeyboardLayout();
PKBL UserHklToKbl(HKL hKl);
BOOL FASTCALL UserAttachThreadInput(PTHREADINFO,PTHREADINFO,BOOL);
BOOL FASTCALL IntConnectThreadInput(PTHREADINFO,PTHREADINFO*,PUSER_MESSAGE_QUEUE*);
#define ThreadHasInputAccess(W32Thread) \
(TRUE)

View file

@ -26,7 +26,7 @@ typedef struct _WINDOW_OBJECT
PWND Wnd;
/* Pointer to the thread information */
PTHREADINFO ti;
PTHREADINFO pti; // Use Wnd->head.pti
/* Pointer to the desktop */
PDESKTOPINFO Desktop;
/* system menu handle. */
@ -43,21 +43,21 @@ typedef struct _WINDOW_OBJECT
HANDLE WindowRegion;
/* Pointer to the owning thread's message queue. */
PUSER_MESSAGE_QUEUE MessageQueue;
struct _WINDOW_OBJECT* FirstChild;
struct _WINDOW_OBJECT* spwndChild;
struct _WINDOW_OBJECT* LastChild;
struct _WINDOW_OBJECT* NextSibling;
struct _WINDOW_OBJECT* PrevSibling;
struct _WINDOW_OBJECT* spwndNext;
struct _WINDOW_OBJECT* spwndPrev;
/* Entry in the list of thread windows. */
LIST_ENTRY ThreadListEntry;
/* Handle to the parent window. */
struct _WINDOW_OBJECT* Parent;
struct _WINDOW_OBJECT* spwndParent;
/* Handle to the owner window. */
HWND hOwner;
HWND hOwner; // Use spwndOwner
/* DC Entries (DCE) */
PDCE Dce;
/* Scrollbar info */
PWINDOW_SCROLLINFO Scroll;
PETHREAD OwnerThread;
PETHREAD OwnerThread; // Use Wnd->head.pti
HWND hWndLastPopup; /* handle to last active popup window (wine doesn't use pointer, for unk. reason)*/
ULONG Status;
/* counter for tiled child windows */
@ -71,7 +71,7 @@ typedef struct _WINDOW_OBJECT
#define WINDOWOBJECT_NEED_ERASEBKGND (0x00000002) // WNDS_ERASEBACKGROUND
#define WINDOWOBJECT_NEED_NCPAINT (0x00000004) // WNDS_SENDNCPAINT
#define WINDOWOBJECT_NEED_INTERNALPAINT (0x00000008) // WNDS_INTERNALPAINT
#define WINDOWOBJECT_RESTOREMAX (0x00000020)
#define WINDOWOBJECT_RESTOREMAX (0x00000020) // Set/Clr WS_MAXIMIZE && Clr/Set WS_EX2_VERTICALLYMAXIMIZEDLEFT/RIGHT
#define WINDOWSTATUS_DESTROYING (0x1) // WNDS2_INDESTROY
#define WINDOWSTATUS_DESTROYED (0x2) // WNDS_DESTROYED
@ -88,7 +88,7 @@ typedef struct _WINDOW_OBJECT
(((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))
#define IntIsDesktopWindow(WndObj) \
(WndObj->Parent == NULL)
(WndObj->spwndParent == NULL)
#define IntIsBroadcastHwnd(hWnd) \
(hWnd == HWND_BROADCAST || hWnd == HWND_TOPMOST)

View file

@ -2195,7 +2195,7 @@ NtUserSetClassLong(HWND hWnd,
Window = UserGetWindowObject(hWnd);
if (Window != NULL)
{
if (Window->ti->ppi != pi)
if (Window->pti->ppi != pi)
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
goto Cleanup;

View file

@ -178,7 +178,7 @@ IntFindChildWindowToOwner(PWINDOW_OBJECT Root, PWINDOW_OBJECT Owner)
HWND Ret;
PWINDOW_OBJECT Child, OwnerWnd;
for(Child = Root->FirstChild; Child; Child = Child->NextSibling)
for(Child = Root->spwndChild; Child; Child = Child->spwndNext)
{
OwnerWnd = UserGetWindowObject(Child->hOwner);
if(!OwnerWnd)

View file

@ -291,10 +291,10 @@ IntCallWndProc
{
BOOL SameThread = FALSE;
if (Window->ti == ((PTHREADINFO)PsGetCurrentThreadWin32Thread()))
if (Window->pti == ((PTHREADINFO)PsGetCurrentThreadWin32Thread()))
SameThread = TRUE;
if ((!SameThread && (Window->ti->fsHooks & HOOKID_TO_FLAG(WH_CALLWNDPROC))) ||
if ((!SameThread && (Window->pti->fsHooks & HOOKID_TO_FLAG(WH_CALLWNDPROC))) ||
(SameThread && ISITHOOKED(WH_CALLWNDPROC)) )
{
CWPSTRUCT CWP;
@ -314,10 +314,10 @@ IntCallWndProcRet
{
BOOL SameThread = FALSE;
if (Window->ti == ((PTHREADINFO)PsGetCurrentThreadWin32Thread()))
if (Window->pti == ((PTHREADINFO)PsGetCurrentThreadWin32Thread()))
SameThread = TRUE;
if ((!SameThread && (Window->ti->fsHooks & HOOKID_TO_FLAG(WH_CALLWNDPROCRET))) ||
if ((!SameThread && (Window->pti->fsHooks & HOOKID_TO_FLAG(WH_CALLWNDPROCRET))) ||
(SameThread && ISITHOOKED(WH_CALLWNDPROCRET)) )
{
CWPRETSTRUCT CWPR;

View file

@ -77,9 +77,9 @@ IdlePing(VOID)
Window = UserGetWindowObject(hWnd);
if (Window && Window->ti)
if (Window && Window->pti)
{
if (Window->ti->fsHooks & HOOKID_TO_FLAG(WH_FOREGROUNDIDLE))
if (Window->pti->fsHooks & HOOKID_TO_FLAG(WH_FOREGROUNDIDLE))
{
co_HOOK_CallHooks(WH_FOREGROUNDIDLE,HC_ACTION,0,0);
}
@ -582,7 +582,7 @@ co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Windo
if (DesktopWindow)
{
UserRefObjectCo(DesktopWindow, &Ref);//can DesktopWindow be NULL?
Desk = DesktopWindow->ti->pDeskInfo;
Desk = DesktopWindow->pti->pDeskInfo;
}
/* Process messages in the message queue itself. */

View file

@ -41,7 +41,7 @@ IntIntersectWithParents(PWINDOW_OBJECT Child, RECTL *WindowRect)
PWINDOW_OBJECT ParentWindow;
PWND ParentWnd;
ParentWindow = Child->Parent;
ParentWindow = Child->spwndParent;
while (ParentWindow != NULL)
{
ParentWnd = ParentWindow->Wnd;
@ -58,7 +58,7 @@ IntIntersectWithParents(PWINDOW_OBJECT Child, RECTL *WindowRect)
/* FIXME: Layered windows. */
ParentWindow = ParentWindow->Parent;
ParentWindow = ParentWindow->spwndParent;
}
return TRUE;
@ -67,7 +67,7 @@ IntIntersectWithParents(PWINDOW_OBJECT Child, RECTL *WindowRect)
BOOL FASTCALL
IntValidateParent(PWINDOW_OBJECT Child, HRGN hValidateRgn, BOOL Recurse)
{
PWINDOW_OBJECT ParentWindow = Child->Parent;
PWINDOW_OBJECT ParentWindow = Child->spwndParent;
PWND ParentWnd;
while (ParentWindow)
@ -85,7 +85,7 @@ IntValidateParent(PWINDOW_OBJECT Child, HRGN hValidateRgn, BOOL Recurse)
RDW_VALIDATE | RDW_NOCHILDREN);
}
ParentWindow = ParentWindow->Parent;
ParentWindow = ParentWindow->spwndParent;
}
return TRUE;
@ -438,7 +438,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
{
PWINDOW_OBJECT Child;
for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
for (Child = Window->spwndChild; Child; Child = Child->spwndNext)
{
if (Child->Wnd->style & WS_VISIBLE)
{
@ -494,7 +494,7 @@ IntIsWindowDrawable(PWINDOW_OBJECT Window)
PWINDOW_OBJECT WndObject;
PWND Wnd;
for (WndObject = Window; WndObject != NULL; WndObject = WndObject->Parent)
for (WndObject = Window; WndObject != NULL; WndObject = WndObject->spwndParent)
{
Wnd = WndObject->Wnd;
if (!(Wnd->style & WS_VISIBLE) ||
@ -623,7 +623,7 @@ IntFindWindowToRepaint(PWINDOW_OBJECT Window, PTHREADINFO Thread)
PWINDOW_OBJECT TempWindow;
PWND Wnd, TempWnd;
for (; Window != NULL; Window = Window->NextSibling)
for (; Window != NULL; Window = Window->spwndNext)
{
Wnd = Window->Wnd;
if (IntWndBelongsToThread(Window, Thread) &&
@ -632,8 +632,8 @@ IntFindWindowToRepaint(PWINDOW_OBJECT Window, PTHREADINFO Thread)
/* Make sure all non-transparent siblings are already drawn. */
if (Wnd->ExStyle & WS_EX_TRANSPARENT)
{
for (TempWindow = Window->NextSibling; TempWindow != NULL;
TempWindow = TempWindow->NextSibling)
for (TempWindow = Window->spwndNext; TempWindow != NULL;
TempWindow = TempWindow->spwndNext)
{
TempWnd = TempWindow->Wnd;
if (!(TempWnd->ExStyle & WS_EX_TRANSPARENT) &&
@ -648,9 +648,9 @@ IntFindWindowToRepaint(PWINDOW_OBJECT Window, PTHREADINFO Thread)
return Window->hSelf;
}
if (Window->FirstChild)
if (Window->spwndChild)
{
hChild = IntFindWindowToRepaint(Window->FirstChild, Thread);
hChild = IntFindWindowToRepaint(Window->spwndChild, Thread);
if (hChild != NULL)
return hChild;
}
@ -825,7 +825,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
if (!(Wnd->style & WS_CLIPCHILDREN))
{
PWINDOW_OBJECT Child;
for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
for (Child = Window->spwndChild; Child; Child = Child->spwndNext)
{
IntInvalidateWindows(Child, Window->UpdateRegion, RDW_FRAME | RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN);
}
@ -1406,7 +1406,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *prcUnsafeScroll,
RECTL rcDummy;
IntGetClientOrigin(Window, &ClientOrigin);
for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
for (Child = Window->spwndChild; Child; Child = Child->spwndNext)
{
rcChild = Child->Wnd->rcWindow;
rcChild.left -= ClientOrigin.x;

View file

@ -65,11 +65,18 @@ VIS_ComputeVisibleRegion(
PreviousWindow = Window;
PreviousWnd = PreviousWindow->Wnd;
CurrentWindow = Window->Parent;
CurrentWindow = Window->spwndParent;
while (CurrentWindow)
{
if ( CurrentWindow->Status & WINDOWSTATUS_DESTROYING ||
CurrentWindow->Status & WINDOWSTATUS_DESTROYED )
{
DPRINT1("ATM the Current Window or Parent is dead!\n");
return NULL;
}
CurrentWnd = CurrentWindow->Wnd;
if (!(CurrentWnd) || !(CurrentWnd->style & WS_VISIBLE))
if (!CurrentWnd || !(CurrentWnd->style & WS_VISIBLE))
{
GreDeleteObject(VisRgn);
return NULL;
@ -82,7 +89,7 @@ VIS_ComputeVisibleRegion(
if ((PreviousWnd->style & WS_CLIPSIBLINGS) ||
(PreviousWnd == Wnd && ClipSiblings))
{
CurrentSibling = CurrentWindow->FirstChild;
CurrentSibling = CurrentWindow->spwndChild;
while (CurrentSibling != NULL && CurrentSibling != PreviousWindow)
{
CurrentSiblingWnd = CurrentSibling->Wnd;
@ -100,18 +107,18 @@ VIS_ComputeVisibleRegion(
NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
GreDeleteObject(ClipRgn);
}
CurrentSibling = CurrentSibling->NextSibling;
CurrentSibling = CurrentSibling->spwndNext;
}
}
PreviousWindow = CurrentWindow;
PreviousWnd = PreviousWindow->Wnd;
CurrentWindow = CurrentWindow->Parent;
CurrentWindow = CurrentWindow->spwndParent;
}
if (ClipChildren)
{
CurrentWindow = Window->FirstChild;
CurrentWindow = Window->spwndChild;
while (CurrentWindow)
{
CurrentWnd = CurrentWindow->Wnd;
@ -129,7 +136,7 @@ VIS_ComputeVisibleRegion(
NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
GreDeleteObject(ClipRgn);
}
CurrentWindow = CurrentWindow->NextSibling;
CurrentWindow = CurrentWindow->spwndNext;
}
}
@ -160,7 +167,7 @@ co_VIS_WindowLayoutChanged(
Temp = NtGdiCreateRectRgn(0, 0, 0, 0);
NtGdiCombineRgn(Temp, NewlyExposed, NULL, RGN_COPY);
Parent = Window->Parent;
Parent = Window->spwndParent;
if(Parent)
{
ParentWnd = Parent->Wnd;

View file

@ -242,7 +242,7 @@ DceUpdateVisRgn(DCE *Dce, PWINDOW_OBJECT Window, ULONG Flags)
PWINDOW_OBJECT Parent;
PWND ParentWnd;
Parent = Window->Parent;
Parent = Window->spwndParent;
if(!Parent)
{
hRgnVisible = NULL;
@ -391,7 +391,7 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
Flags &= ~(DCX_PARENTCLIP | DCX_CLIPCHILDREN);
}
Parent = (Window ? Window->Parent : NULL);
Parent = (Window ? Window->spwndParent : NULL);
if (NULL == Window || !(Wnd->style & WS_CHILD) || NULL == Parent)
{

View file

@ -180,7 +180,7 @@ IntGetParent(PWINDOW_OBJECT Wnd)
}
else if (Wnd->Wnd->style & WS_CHILD)
{
return Wnd->Parent;
return Wnd->spwndParent;
}
return NULL;
@ -220,7 +220,7 @@ IntWinListChildren(PWINDOW_OBJECT Window)
if (!Window) return NULL;
for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
for (Child = Window->spwndChild; Child; Child = Child->spwndNext)
++NumChildren;
List = ExAllocatePoolWithTag(PagedPool, (NumChildren + 1) * sizeof(HWND), TAG_WINLIST);
@ -230,9 +230,9 @@ IntWinListChildren(PWINDOW_OBJECT Window)
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
}
for (Child = Window->FirstChild, Index = 0;
for (Child = Window->spwndChild, Index = 0;
Child != NULL;
Child = Child->NextSibling, ++Index)
Child = Child->spwndNext, ++Index)
List[Index] = Child->hSelf;
List[Index] = NULL;
@ -494,8 +494,8 @@ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window,
/* dereference the class */
IntDereferenceClass(Wnd->pcls,
Window->ti->pDeskInfo,
Window->ti->ppi);
Window->pti->pDeskInfo,
Window->pti->ppi);
Wnd->pcls = NULL;
if(Window->WindowRegion)
@ -504,7 +504,7 @@ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window,
}
ASSERT(Window->Wnd != NULL);
UserFreeWindowInfo(Window->ti, Window);
UserFreeWindowInfo(Window->pti, Window);
UserDereferenceObject(Window);
@ -978,7 +978,7 @@ IntIsChildWindow(PWINDOW_OBJECT Parent, PWINDOW_OBJECT BaseWindow)
break;
}
Window = Window->Parent;
Window = Window->spwndParent;
}
return(FALSE);
@ -1003,7 +1003,7 @@ IntIsWindowVisible(PWINDOW_OBJECT BaseWindow)
return FALSE;
}
Window = Window->Parent;
Window = Window->spwndParent;
}
if(Window && Wnd->style & WS_VISIBLE)
@ -1054,34 +1054,34 @@ IntLinkWindow(
WndParent->Wnd,
WndPrevSibling ? WndPrevSibling->Wnd : NULL);
Wnd->Parent = WndParent;
if ((Wnd->PrevSibling = WndPrevSibling))
Wnd->spwndParent = WndParent;
if ((Wnd->spwndPrev = WndPrevSibling))
{
/* link after WndPrevSibling */
if ((Wnd->NextSibling = WndPrevSibling->NextSibling))
Wnd->NextSibling->PrevSibling = Wnd;
else if ((Parent = Wnd->Parent))
if ((Wnd->spwndNext = WndPrevSibling->spwndNext))
Wnd->spwndNext->spwndPrev = Wnd;
else if ((Parent = Wnd->spwndParent))
{
if(Parent->LastChild == WndPrevSibling)
Parent->LastChild = Wnd;
}
Wnd->PrevSibling->NextSibling = Wnd;
Wnd->spwndPrev->spwndNext = Wnd;
}
else
{
/* link at top */
Parent = Wnd->Parent;
if ((Wnd->NextSibling = WndParent->FirstChild))
Wnd->NextSibling->PrevSibling = Wnd;
Parent = Wnd->spwndParent;
if ((Wnd->spwndNext = WndParent->spwndChild))
Wnd->spwndNext->spwndPrev = Wnd;
else if (Parent)
{
Parent->LastChild = Wnd;
Parent->FirstChild = Wnd;
Parent->spwndChild = Wnd;
return;
}
if(Parent)
{
Parent->FirstChild = Wnd;
Parent->spwndChild = Wnd;
}
}
@ -1159,7 +1159,7 @@ co_IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
if (Wnd->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
return NULL;
WndOldParent = Wnd->Parent;
WndOldParent = Wnd->spwndParent;
if (WndOldParent) UserReferenceObject(WndOldParent); /* caller must deref */
@ -1170,11 +1170,11 @@ co_IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
if (0 == (Wnd->Wnd->ExStyle & WS_EX_TOPMOST))
{
/* Not a TOPMOST window, put after TOPMOSTs of new parent */
Sibling = WndNewParent->FirstChild;
Sibling = WndNewParent->spwndChild;
while (NULL != Sibling && 0 != (Sibling->Wnd->ExStyle & WS_EX_TOPMOST))
{
InsertAfter = Sibling;
Sibling = Sibling->NextSibling;
Sibling = Sibling->spwndNext;
}
}
if (NULL == InsertAfter)
@ -1270,21 +1270,21 @@ IntUnlinkWnd(PWND Wnd)
VOID FASTCALL
IntUnlinkWindow(PWINDOW_OBJECT Wnd)
{
PWINDOW_OBJECT WndParent = Wnd->Parent;
PWINDOW_OBJECT WndParent = Wnd->spwndParent;
IntUnlinkWnd(Wnd->Wnd);
if (Wnd->NextSibling)
Wnd->NextSibling->PrevSibling = Wnd->PrevSibling;
if (Wnd->spwndNext)
Wnd->spwndNext->spwndPrev = Wnd->spwndPrev;
else if (WndParent && WndParent->LastChild == Wnd)
WndParent->LastChild = Wnd->PrevSibling;
WndParent->LastChild = Wnd->spwndPrev;
if (Wnd->PrevSibling)
Wnd->PrevSibling->NextSibling = Wnd->NextSibling;
else if (WndParent && WndParent->FirstChild == Wnd)
WndParent->FirstChild = Wnd->NextSibling;
if (Wnd->spwndPrev)
Wnd->spwndPrev->spwndNext = Wnd->spwndNext;
else if (WndParent && WndParent->spwndChild == Wnd)
WndParent->spwndChild = Wnd->spwndNext;
Wnd->PrevSibling = Wnd->NextSibling = Wnd->Parent = NULL;
Wnd->spwndPrev = Wnd->spwndNext = Wnd->spwndParent = NULL;
}
BOOL FASTCALL
@ -1297,7 +1297,7 @@ IntAnyPopup(VOID)
return FALSE;
}
for(Child = Window->FirstChild; Child; Child = Child->NextSibling)
for(Child = Window->spwndChild; Child; Child = Child->spwndNext)
{
if(Child->hOwner && Child->Wnd->style & WS_VISIBLE)
{
@ -1440,7 +1440,7 @@ NtUserBuildHwndList(
}
if((Parent = UserGetWindowObject(hwndParent)) &&
(Window = Parent->FirstChild))
(Window = Parent->spwndChild))
{
BOOL bGoDown = TRUE;
@ -1468,20 +1468,20 @@ NtUserBuildHwndList(
break;
}
}
if (Window->FirstChild && bChildren)
if (Window->spwndChild && bChildren)
{
Window = Window->FirstChild;
Window = Window->spwndChild;
continue;
}
bGoDown = FALSE;
}
if (Window->NextSibling)
if (Window->spwndNext)
{
Window = Window->NextSibling;
Window = Window->spwndNext;
bGoDown = TRUE;
continue;
}
Window = Window->Parent;
Window = Window->spwndParent;
if (Window == Parent)
{
break;
@ -1856,7 +1856,7 @@ AllocErr:
/*
* Fill out the structure describing it.
*/
Window->ti = ti;
Window->pti = ti;
Wnd->pcls = Class;
Class = NULL;
@ -1867,7 +1867,7 @@ AllocErr:
Window->MessageQueue = pti->MessageQueue;
IntReferenceMessageQueue(Window->MessageQueue);
Window->Parent = ParentWindow;
Window->spwndParent = ParentWindow;
Wnd->spwndParent = ParentWindow ? ParentWindow->Wnd : NULL;
if (Wnd->spwndParent != NULL && hWndParent != 0)
{
@ -1955,10 +1955,10 @@ AllocErr:
}
Window->OwnerThread = PsGetCurrentThread();
Window->FirstChild = NULL;
Window->spwndChild = NULL;
Window->LastChild = NULL;
Window->PrevSibling = NULL;
Window->NextSibling = NULL;
Window->spwndPrev = NULL;
Window->spwndNext = NULL;
Wnd->spwndNext = NULL;
Wnd->spwndPrev = NULL;
@ -2302,11 +2302,11 @@ AllocErr:
if (!(dwExStyle & WS_EX_TOPMOST))
{
InsertAfter = NULL;
Sibling = ParentWindow->FirstChild;
Sibling = ParentWindow->spwndChild;
while (Sibling && (Sibling->Wnd->ExStyle & WS_EX_TOPMOST))
{
InsertAfter = Sibling;
Sibling = Sibling->NextSibling;
Sibling = Sibling->spwndNext;
}
}
else
@ -2468,7 +2468,8 @@ AllocErr:
CLEANUP:
if (!_ret_ && Window && Window->Wnd && ti)
UserFreeWindowInfo(ti, Window);
co_UserDestroyWindow(Window);
// UserFreeWindowInfo(ti, Window);
if (Window)
{
UserDerefObjectCo(Window);
@ -2625,7 +2626,8 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
DPRINT("co_UserDestroyWindow \n");
/* Check for owner thread */
if ((Window->OwnerThread != PsGetCurrentThread()))
if ( (Window->OwnerThread != PsGetCurrentThread()) ||
Wnd->head.pti != PsGetCurrentThreadWin32Thread() )
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
return FALSE;
@ -3121,7 +3123,7 @@ PWINDOW_OBJECT FASTCALL UserGetAncestor(PWINDOW_OBJECT Wnd, UINT Type)
{
case GA_PARENT:
{
WndAncestor = Wnd->Parent;
WndAncestor = Wnd->spwndParent;
break;
}
@ -3132,7 +3134,7 @@ PWINDOW_OBJECT FASTCALL UserGetAncestor(PWINDOW_OBJECT Wnd, UINT Type)
for(;;)
{
if(!(Parent = WndAncestor->Parent))
if(!(Parent = WndAncestor->spwndParent))
{
break;
}
@ -3686,15 +3688,15 @@ UserGetWindow(HWND hWnd, UINT Relationship)
switch (Relationship)
{
case GW_HWNDFIRST:
if((Parent = Window->Parent))
if((Parent = Window->spwndParent))
{
if (Parent->FirstChild)
hWndResult = Parent->FirstChild->hSelf;
if (Parent->spwndChild)
hWndResult = Parent->spwndChild->hSelf;
}
break;
case GW_HWNDLAST:
if((Parent = Window->Parent))
if((Parent = Window->spwndParent))
{
if (Parent->LastChild)
hWndResult = Parent->LastChild->hSelf;
@ -3702,13 +3704,13 @@ UserGetWindow(HWND hWnd, UINT Relationship)
break;
case GW_HWNDNEXT:
if (Window->NextSibling)
hWndResult = Window->NextSibling->hSelf;
if (Window->spwndNext)
hWndResult = Window->spwndNext->hSelf;
break;
case GW_HWNDPREV:
if (Window->PrevSibling)
hWndResult = Window->PrevSibling->hSelf;
if (Window->spwndPrev)
hWndResult = Window->spwndPrev->hSelf;
break;
case GW_OWNER:
@ -3718,8 +3720,8 @@ UserGetWindow(HWND hWnd, UINT Relationship)
}
break;
case GW_CHILD:
if (Window->FirstChild)
hWndResult = Window->FirstChild->hSelf;
if (Window->spwndChild)
hWndResult = Window->spwndChild->hSelf;
break;
}
@ -3793,7 +3795,7 @@ UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi)
break;
case GWL_HWNDPARENT:
Parent = Window->Parent;
Parent = Window->spwndParent;
if(Parent)
{
if (Parent && Parent->hSelf == IntGetDesktopWindow())
@ -3919,7 +3921,7 @@ co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
break;
case GWL_HWNDPARENT:
Parent = Window->Parent;
Parent = Window->spwndParent;
if (Parent && (Parent->hSelf == IntGetDesktopWindow()))
OldValue = (LONG) IntSetOwner(Window->hSelf, (HWND) NewValue);
else

View file

@ -161,7 +161,7 @@ co_WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
WndTo = Window;
for (;;)
{
if (!(WndTo = WndTo->NextSibling)) break;
if (!(WndTo = WndTo->spwndNext)) break;
if (can_activate_window( WndTo )) break;
}
@ -260,7 +260,7 @@ WinPosInitInternalPos(PWINDOW_OBJECT Window, POINT *pt, RECTL *RestoreRect)
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
PDESKTOP Desktop = pti->Desktop; /* Or rather get it from the window? */
Parent = Window->Parent;
Parent = Window->spwndParent;
if(Parent)
{
if(IntIsDesktopWindow(Parent))
@ -519,7 +519,7 @@ co_WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos,
params.rgrc[0] = *WindowRect;
params.rgrc[1] = Window->Wnd->rcWindow;
params.rgrc[2] = Window->Wnd->rcClient;
Parent = Window->Parent;
Parent = Window->spwndParent;
if (0 != (Wnd->style & WS_CHILD) && Parent)
{
RECTL_vOffsetRect(&(params.rgrc[0]), - Parent->Wnd->rcClient.left,
@ -608,7 +608,7 @@ co_WinPosDoWinPosChanging(PWINDOW_OBJECT Window,
PWINDOW_OBJECT Parent;
X = WinPos->x;
Y = WinPos->y;
Parent = Window->Parent;
Parent = Window->spwndParent;
if ((0 != (Wnd->style & WS_CHILD)) && Parent)
{
X += Parent->Wnd->rcClient.left;
@ -733,7 +733,7 @@ WinPosInternalMoveWindow(PWINDOW_OBJECT Window, INT MoveX, INT MoveY)
{
PWINDOW_OBJECT Child;
ASSERT(Window != Window->FirstChild);
ASSERT(Window != Window->spwndChild);
Window->Wnd->rcWindow.left += MoveX;
Window->Wnd->rcWindow.right += MoveX;
@ -745,7 +745,7 @@ WinPosInternalMoveWindow(PWINDOW_OBJECT Window, INT MoveX, INT MoveY)
Window->Wnd->rcClient.top += MoveY;
Window->Wnd->rcClient.bottom += MoveY;
for(Child = Window->FirstChild; Child; Child = Child->NextSibling)
for(Child = Window->spwndChild; Child; Child = Child->spwndNext)
{
WinPosInternalMoveWindow(Child, MoveX, MoveY);
}
@ -839,7 +839,7 @@ WinPosFixupFlags(WINDOWPOS *WinPos, PWINDOW_OBJECT Window)
&& HWND_NOTOPMOST != WinPos->hwndInsertAfter
&& HWND_BOTTOM != WinPos->hwndInsertAfter)
{
PWINDOW_OBJECT InsAfterWnd, Parent = Window->Parent;
PWINDOW_OBJECT InsAfterWnd, Parent = Window->spwndParent;
InsAfterWnd = UserGetWindowObject(WinPos->hwndInsertAfter);
@ -979,7 +979,7 @@ co_WinPosSetWindowPos(
PWINDOW_OBJECT Sibling;
PWINDOW_OBJECT InsertAfterWindow;
if ((ParentWindow = Window->Parent))
if ((ParentWindow = Window->spwndParent))
{
if (HWND_TOPMOST == WinPos.hwndInsertAfter)
{
@ -989,11 +989,11 @@ co_WinPosSetWindowPos(
|| HWND_NOTOPMOST == WinPos.hwndInsertAfter)
{
InsertAfterWindow = NULL;
Sibling = ParentWindow->FirstChild;
Sibling = ParentWindow->spwndChild;
while (NULL != Sibling && 0 != (Sibling->Wnd->ExStyle & WS_EX_TOPMOST))
{
InsertAfterWindow = Sibling;
Sibling = Sibling->NextSibling;
Sibling = Sibling->spwndNext;
}
if (NULL != InsertAfterWindow)
{
@ -1023,10 +1023,10 @@ co_WinPosSetWindowPos(
UserDereferenceObject(InsertAfterWindow);
if ((HWND_TOPMOST == WinPos.hwndInsertAfter)
|| (0 != (Window->Wnd->ExStyle & WS_EX_TOPMOST)
&& NULL != Window->PrevSibling
&& 0 != (Window->PrevSibling->Wnd->ExStyle & WS_EX_TOPMOST))
|| (NULL != Window->NextSibling
&& 0 != (Window->NextSibling->Wnd->ExStyle & WS_EX_TOPMOST)))
&& NULL != Window->spwndPrev
&& 0 != (Window->spwndPrev->Wnd->ExStyle & WS_EX_TOPMOST))
|| (NULL != Window->spwndNext
&& 0 != (Window->spwndNext->Wnd->ExStyle & WS_EX_TOPMOST)))
{
Window->Wnd->ExStyle |= WS_EX_TOPMOST;
}
@ -1074,7 +1074,7 @@ co_WinPosSetWindowPos(
co_UserRedrawWindow(Window, NULL, 0, RDW_VALIDATE | RDW_NOFRAME |
RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_ALLCHILDREN);
if ((Window->Wnd->style & WS_VISIBLE) &&
Window->Parent == UserGetDesktopWindow())
Window->spwndParent == UserGetDesktopWindow())
{
co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->hSelf);
}
@ -1083,7 +1083,7 @@ co_WinPosSetWindowPos(
else if (WinPos.flags & SWP_SHOWWINDOW)
{
if (!(Window->Wnd->style & WS_VISIBLE) &&
Window->Parent == UserGetDesktopWindow())
Window->spwndParent == UserGetDesktopWindow())
{
co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->hSelf);
}
@ -1237,7 +1237,7 @@ co_WinPosSetWindowPos(
GreDeleteObject(DirtyRgn);
*/
PWINDOW_OBJECT Parent = Window->Parent;
PWINDOW_OBJECT Parent = Window->spwndParent;
NtGdiOffsetRgn(DirtyRgn,
Window->Wnd->rcWindow.left,
@ -1472,7 +1472,7 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
IntIsChildWindow(Window, ThreadFocusWindow)))
{
//faxme: as long as we have ref on Window, we also, indirectly, have ref on parent...
co_UserSetFocus(Window->Parent);
co_UserSetFocus(Window->spwndParent);
}
}
@ -1521,10 +1521,10 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
/* find child of 'parent' that contains the given point (in parent-relative coords) */
PWINDOW_OBJECT child_window_from_point(PWINDOW_OBJECT parent, int x, int y )
{
PWINDOW_OBJECT Wnd;// = parent->FirstChild;
PWINDOW_OBJECT Wnd;// = parent->spwndChild;
// LIST_FOR_EACH_ENTRY( Wnd, &parent->children, struct window, entry )
for (Wnd = parent->FirstChild; Wnd; Wnd = Wnd->NextSibling)
for (Wnd = parent->spwndChild; Wnd; Wnd = Wnd->spwndNext)
{
if (!IntPtInWindow( Wnd, x, y )) continue; /* skip it */