I don't see any use in renaming the WINDOW_OBJECT structures.
spwndXxx means shared pointer to a WND, this does not reflect it's
current usage in WINDOW_OBJECT.
We already have a WND and it has spwndXxx members and they are in use.
You should rather try to get rid of them completely inside WINDOW_OBJECT
and only use the ones from WND instead.
But that's probably the last move after all the rest is gone.
Anyway, as long as we end up with the WND structure only, do as you like
on the way to there.
Regards,
Timo
jimtabor(a)svn.reactos.org wrote:
Author: jimtabor
Date: Mon Dec 14 06:02:56 2009
New Revision: 44575
URL:
http://svn.reactos.org/svn/reactos?rev=44575&view=rev
Log:
[Win32k]
- 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.
Modified:
trunk/reactos/subsystems/win32/win32k/include/input.h
trunk/reactos/subsystems/win32/win32k/include/window.h
trunk/reactos/subsystems/win32/win32k/ntuser/class.c
trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
trunk/reactos/subsystems/win32/win32k/ntuser/message.c
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
trunk/reactos/subsystems/win32/win32k/ntuser/vis.c
trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
trunk/reactos/subsystems/win32/win32k/ntuser/window.c
trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
Modified: trunk/reactos/subsystems/win32/win32k/include/input.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] Mon Dec 14
06:02:56 2009
@@ -43,6 +43,7 @@
BOOL UserInitDefaultKeyboardLayout();
PKBL UserHklToKbl(HKL hKl);
BOOL FASTCALL UserAttachThreadInput(PTHREADINFO,PTHREADINFO,BOOL);
+BOOL FASTCALL IntConnectThreadInput(PTHREADINFO,PTHREADINFO*,PUSER_MESSAGE_QUEUE*);
#define ThreadHasInputAccess(W32Thread) \
(TRUE)
Modified: trunk/reactos/subsystems/win32/win32k/include/window.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] Mon Dec 14
06:02:56 2009
@@ -26,7 +26,7 @@
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 @@
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 @@
#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 @@
(((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)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] Mon Dec 14 06:02:56
2009
@@ -2195,7 +2195,7 @@
Window = UserGetWindowObject(hWnd);
if (Window != NULL)
{
- if (Window->ti->ppi != pi)
+ if (Window->pti->ppi != pi)
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
goto Cleanup;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Mon Dec 14 06:02:56
2009
@@ -178,7 +178,7 @@
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)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Mon Dec 14
06:02:56 2009
@@ -291,10 +291,10 @@
{
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 @@
{
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;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Mon Dec 14
06:02:56 2009
@@ -77,9 +77,9 @@
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 @@
if (DesktopWindow)
{
UserRefObjectCo(DesktopWindow, &Ref);//can DesktopWindow be NULL?
- Desk = DesktopWindow->ti->pDeskInfo;
+ Desk = DesktopWindow->pti->pDeskInfo;
}
/* Process messages in the message queue itself. */
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] Mon Dec 14
06:02:56 2009
@@ -41,7 +41,7 @@
PWINDOW_OBJECT ParentWindow;
PWND ParentWnd;
- ParentWindow = Child->Parent;
+ ParentWindow = Child->spwndParent;
while (ParentWindow != NULL)
{
ParentWnd = ParentWindow->Wnd;
@@ -58,7 +58,7 @@
/* FIXME: Layered windows. */
- ParentWindow = ParentWindow->Parent;
+ ParentWindow = ParentWindow->spwndParent;
}
return TRUE;
@@ -67,7 +67,7 @@
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 @@
RDW_VALIDATE | RDW_NOCHILDREN);
}
- ParentWindow = ParentWindow->Parent;
+ ParentWindow = ParentWindow->spwndParent;
}
return TRUE;
@@ -438,7 +438,7 @@
{
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 @@
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 @@
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 @@
/* 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 @@
return Window->hSelf;
}
- if (Window->FirstChild)
- {
- hChild = IntFindWindowToRepaint(Window->FirstChild, Thread);
+ if (Window->spwndChild)
+ {
+ hChild = IntFindWindowToRepaint(Window->spwndChild, Thread);
if (hChild != NULL)
return hChild;
}
@@ -825,7 +825,7 @@
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 @@
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;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/vis.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/vis.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/vis.c [iso-8859-1] Mon Dec 14 06:02:56
2009
@@ -65,11 +65,18 @@
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 @@
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 @@
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 @@
NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
GreDeleteObject(ClipRgn);
}
- CurrentWindow = CurrentWindow->NextSibling;
+ CurrentWindow = CurrentWindow->spwndNext;
}
}
@@ -160,7 +167,7 @@
Temp = NtGdiCreateRectRgn(0, 0, 0, 0);
NtGdiCombineRgn(Temp, NewlyExposed, NULL, RGN_COPY);
- Parent = Window->Parent;
+ Parent = Window->spwndParent;
if(Parent)
{
ParentWnd = Parent->Wnd;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] Mon Dec 14 06:02:56
2009
@@ -242,7 +242,7 @@
PWINDOW_OBJECT Parent;
PWND ParentWnd;
- Parent = Window->Parent;
+ Parent = Window->spwndParent;
if(!Parent)
{
hRgnVisible = NULL;
@@ -391,7 +391,7 @@
Flags &= ~(DCX_PARENTCLIP | DCX_CLIPCHILDREN);
}
- Parent = (Window ? Window->Parent : NULL);
+ Parent = (Window ? Window->spwndParent : NULL);
if (NULL == Window || !(Wnd->style & WS_CHILD) || NULL == Parent)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Mon Dec 14
06:02:56 2009
@@ -180,7 +180,7 @@
}
else if (Wnd->Wnd->style & WS_CHILD)
{
- return Wnd->Parent;
+ return Wnd->spwndParent;
}
return NULL;
@@ -220,7 +220,7 @@
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 @@
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 @@
/* 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 @@
}
ASSERT(Window->Wnd != NULL);
- UserFreeWindowInfo(Window->ti, Window);
+ UserFreeWindowInfo(Window->pti, Window);
UserDereferenceObject(Window);
@@ -978,7 +978,7 @@
break;
}
- Window = Window->Parent;
+ Window = Window->spwndParent;
}
return(FALSE);
@@ -1003,7 +1003,7 @@
return FALSE;
}
- Window = Window->Parent;
+ Window = Window->spwndParent;
}
if(Window && Wnd->style & WS_VISIBLE)
@@ -1054,34 +1054,34 @@
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 @@
if (Wnd->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
return NULL;
- WndOldParent = Wnd->Parent;
+ WndOldParent = Wnd->spwndParent;
if (WndOldParent) UserReferenceObject(WndOldParent); /* caller must deref */
@@ -1170,11 +1170,11 @@
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 @@
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;
-
- if (Wnd->PrevSibling)
- Wnd->PrevSibling->NextSibling = Wnd->NextSibling;
- else if (WndParent && WndParent->FirstChild == Wnd)
- WndParent->FirstChild = Wnd->NextSibling;
-
- Wnd->PrevSibling = Wnd->NextSibling = Wnd->Parent = NULL;
+ WndParent->LastChild = Wnd->spwndPrev;
+
+ if (Wnd->spwndPrev)
+ Wnd->spwndPrev->spwndNext = Wnd->spwndNext;
+ else if (WndParent && WndParent->spwndChild == Wnd)
+ WndParent->spwndChild = Wnd->spwndNext;
+
+ Wnd->spwndPrev = Wnd->spwndNext = Wnd->spwndParent = NULL;
}
BOOL FASTCALL
@@ -1297,7 +1297,7 @@
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 @@
}
if((Parent = UserGetWindowObject(hwndParent)) &&
- (Window = Parent->FirstChild))
+ (Window = Parent->spwndChild))
{
BOOL bGoDown = TRUE;
@@ -1468,20 +1468,20 @@
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 @@
/*
* Fill out the structure describing it.
*/
- Window->ti = ti;
+ Window->pti = ti;
Wnd->pcls = Class;
Class = NULL;
@@ -1867,7 +1867,7 @@
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 @@
}
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 @@
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 @@
CLEANUP:
if (!_ret_ && Window && Window->Wnd && ti)
- UserFreeWindowInfo(ti, Window);
+ co_UserDestroyWindow(Window);
+// UserFreeWindowInfo(ti, Window);
if (Window)
{
UserDerefObjectCo(Window);
@@ -2625,7 +2626,8 @@
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 @@
{
case GA_PARENT:
{
- WndAncestor = Wnd->Parent;
+ WndAncestor = Wnd->spwndParent;
break;
}
@@ -3132,7 +3134,7 @@
for(;;)
{
- if(!(Parent = WndAncestor->Parent))
+ if(!(Parent = WndAncestor->spwndParent))
{
break;
}
@@ -3686,15 +3688,15 @@
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 @@
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 @@
}
break;
case GW_CHILD:
- if (Window->FirstChild)
- hWndResult = Window->FirstChild->hSelf;
+ if (Window->spwndChild)
+ hWndResult = Window->spwndChild->hSelf;
break;
}
@@ -3793,7 +3795,7 @@
break;
case GWL_HWNDPARENT:
- Parent = Window->Parent;
+ Parent = Window->spwndParent;
if(Parent)
{
if (Parent && Parent->hSelf == IntGetDesktopWindow())
@@ -3919,7 +3921,7 @@
break;
case GWL_HWNDPARENT:
- Parent = Window->Parent;
+ Parent = Window->spwndParent;
if (Parent && (Parent->hSelf == IntGetDesktopWindow()))
OldValue = (LONG) IntSetOwner(Window->hSelf, (HWND) NewValue);
else
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Mon Dec 14
06:02:56 2009
@@ -161,7 +161,7 @@
WndTo = Window;
for (;;)
{
- if (!(WndTo = WndTo->NextSibling)) break;
+ if (!(WndTo = WndTo->spwndNext)) break;
if (can_activate_window( WndTo )) break;
}
@@ -260,7 +260,7 @@
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 @@
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 @@
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 @@
{
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 @@
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 @@
&& 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 @@
PWINDOW_OBJECT Sibling;
PWINDOW_OBJECT InsertAfterWindow;
- if ((ParentWindow = Window->Parent))
+ if ((ParentWindow = Window->spwndParent))
{
if (HWND_TOPMOST == WinPos.hwndInsertAfter)
{
@@ -989,11 +989,11 @@
|| 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 @@
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_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 @@
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 @@
GreDeleteObject(DirtyRgn);
*/
- PWINDOW_OBJECT Parent = Window->Parent;
+ PWINDOW_OBJECT Parent = Window->spwndParent;
NtGdiOffsetRgn(DirtyRgn,
Window->Wnd->rcWindow.left,
@@ -1472,7 +1472,7 @@
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 @@
/* 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 */