remove relatives lock, window props lock, classes locks, thread window lock, menu locks

svn path=/trunk/; revision=17684
This commit is contained in:
Gunnar Dalsnes 2005-09-05 22:39:29 +00:00
parent eae95884a8
commit fd26bfbd6d
14 changed files with 21 additions and 216 deletions

View file

@ -24,7 +24,6 @@ typedef struct _WNDCLASS_OBJECT
LIST_ENTRY ListEntry; LIST_ENTRY ListEntry;
PCHAR ExtraData; PCHAR ExtraData;
/* list of windows */ /* list of windows */
FAST_MUTEX ClassWindowsListLock;
LIST_ENTRY ClassWindowsListHead; LIST_ENTRY ClassWindowsListHead;
} WNDCLASS_OBJECT, *PWNDCLASS_OBJECT; } WNDCLASS_OBJECT, *PWNDCLASS_OBJECT;
@ -34,18 +33,6 @@ InitClassImpl(VOID);
NTSTATUS FASTCALL NTSTATUS FASTCALL
CleanupClassImpl(VOID); CleanupClassImpl(VOID);
#define IntLockProcessClasses(W32Process) \
ExAcquireFastMutex(&(W32Process)->ClassListLock)
#define IntUnLockProcessClasses(W32Process) \
ExReleaseFastMutex(&(W32Process)->ClassListLock)
#define IntLockClassWindows(ClassObj) \
ExAcquireFastMutex(&(ClassObj)->ClassWindowsListLock)
#define IntUnLockClassWindows(ClassObj) \
ExReleaseFastMutex(&(ClassObj)->ClassWindowsListLock)
#define ClassDereferenceObject(ClassObj) \ #define ClassDereferenceObject(ClassObj) \
ObmDereferenceObject(ClassObj) ObmDereferenceObject(ClassObj)

View file

@ -33,7 +33,6 @@ typedef struct _MENU_OBJECT
{ {
PEPROCESS Process; PEPROCESS Process;
LIST_ENTRY ListEntry; LIST_ENTRY ListEntry;
FAST_MUTEX MenuItemsLock;
PMENU_ITEM MenuItemList; PMENU_ITEM MenuItemList;
ROSMENUINFO MenuInfo; ROSMENUINFO MenuInfo;
BOOL RtoL; BOOL RtoL;
@ -42,18 +41,6 @@ typedef struct _MENU_OBJECT
PMENU_OBJECT FASTCALL PMENU_OBJECT FASTCALL
IntGetMenuObject(HMENU hMenu); IntGetMenuObject(HMENU hMenu);
#define IntLockMenuItems(MenuObj) \
ExAcquireFastMutex(&(MenuObj)->MenuItemsLock)
#define IntUnLockMenuItems(MenuObj) \
ExReleaseFastMutex(&(MenuObj)->MenuItemsLock)
#define IntLockProcessMenus(W32Process) \
ExAcquireFastMutex(&(W32Process)->MenuListLock)
#define IntUnLockProcessMenus(W32Process) \
ExReleaseFastMutex(&(W32Process)->MenuListLock)
#define IntReleaseMenuObject(MenuObj) \ #define IntReleaseMenuObject(MenuObj) \
ObmDereferenceObject(MenuObj) ObmDereferenceObject(MenuObj)

View file

@ -14,11 +14,5 @@ IntSetProp(PWINDOW_OBJECT Wnd, ATOM Atom, HANDLE Data);
PPROPERTY FASTCALL PPROPERTY FASTCALL
IntGetProp(PWINDOW_OBJECT WindowObject, ATOM Atom); IntGetProp(PWINDOW_OBJECT WindowObject, ATOM Atom);
#define IntLockWindowProperties(Window) \
ExAcquireFastMutex(&Window->PropListLock)
#define IntUnLockWindowProperties(Window) \
ExReleaseFastMutex(&Window->PropListLock)
#endif /* _WIN32K_PROP_H */ #endif /* _WIN32K_PROP_H */

View file

@ -6,7 +6,6 @@
typedef struct _W32THREAD typedef struct _W32THREAD
{ {
struct _USER_MESSAGE_QUEUE* MessageQueue; struct _USER_MESSAGE_QUEUE* MessageQueue;
FAST_MUTEX WindowListLock;
LIST_ENTRY WindowListHead; LIST_ENTRY WindowListHead;
LIST_ENTRY W32CallbackListHead; LIST_ENTRY W32CallbackListHead;
struct _KBDTABLES* KeyboardLayout; struct _KBDTABLES* KeyboardLayout;
@ -21,9 +20,7 @@ typedef struct _W32THREAD
typedef struct _W32PROCESS typedef struct _W32PROCESS
{ {
FAST_MUTEX ClassListLock;
LIST_ENTRY ClassListHead; LIST_ENTRY ClassListHead;
FAST_MUTEX MenuListLock;
LIST_ENTRY MenuListHead; LIST_ENTRY MenuListHead;
FAST_MUTEX PrivateFontListLock; FAST_MUTEX PrivateFontListLock;
LIST_ENTRY PrivateFontListHead; LIST_ENTRY PrivateFontListHead;

View file

@ -67,8 +67,6 @@ typedef struct _WINDOW_OBJECT
FAST_MUTEX UpdateLock; FAST_MUTEX UpdateLock;
/* Pointer to the owning thread's message queue. */ /* Pointer to the owning thread's message queue. */
PUSER_MESSAGE_QUEUE MessageQueue; PUSER_MESSAGE_QUEUE MessageQueue;
/* Lock for the list of child windows. */
FAST_MUTEX RelativesLock;
struct _WINDOW_OBJECT* FirstChild; struct _WINDOW_OBJECT* FirstChild;
struct _WINDOW_OBJECT* LastChild; struct _WINDOW_OBJECT* LastChild;
struct _WINDOW_OBJECT* NextSibling; struct _WINDOW_OBJECT* NextSibling;
@ -83,7 +81,6 @@ typedef struct _WINDOW_OBJECT
PDCE Dce; PDCE Dce;
/* Property list head.*/ /* Property list head.*/
LIST_ENTRY PropListHead; LIST_ENTRY PropListHead;
FAST_MUTEX PropListLock;
ULONG PropListItems; ULONG PropListItems;
/* Scrollbar info */ /* Scrollbar info */
PWINDOW_SCROLLINFO Scroll; PWINDOW_SCROLLINFO Scroll;
@ -148,18 +145,6 @@ typedef struct _WINDOW_OBJECT
#define IntGetWndProcessId(WndObj) \ #define IntGetWndProcessId(WndObj) \
WndObj->OwnerThread->ThreadsProcess->UniqueProcessId WndObj->OwnerThread->ThreadsProcess->UniqueProcessId
#define IntLockRelatives(WndObj) \
ExAcquireFastMutex(&WndObj->RelativesLock)
#define IntUnLockRelatives(WndObj) \
ExReleaseFastMutex(&WndObj->RelativesLock)
#define IntLockThreadWindows(Thread) \
ExAcquireFastMutex(&Thread->WindowListLock)
#define IntUnLockThreadWindows(Thread) \
ExReleaseFastMutex(&Thread->WindowListLock)
PWINDOW_OBJECT FASTCALL PWINDOW_OBJECT FASTCALL
IntGetProcessWindowObject(PW32THREAD Thread, HWND hWnd); IntGetProcessWindowObject(PW32THREAD Thread, HWND hWnd);

View file

@ -71,10 +71,8 @@ Win32kProcessCallback(struct _EPROCESS *Process,
DPRINT("Creating W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql()); DPRINT("Creating W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql());
InitializeListHead(&Win32Process->ClassListHead); InitializeListHead(&Win32Process->ClassListHead);
ExInitializeFastMutex(&Win32Process->ClassListLock);
InitializeListHead(&Win32Process->MenuListHead); InitializeListHead(&Win32Process->MenuListHead);
ExInitializeFastMutex(&Win32Process->MenuListLock);
InitializeListHead(&Win32Process->PrivateFontListHead); InitializeListHead(&Win32Process->PrivateFontListHead);
ExInitializeFastMutex(&Win32Process->PrivateFontListLock); ExInitializeFastMutex(&Win32Process->PrivateFontListLock);
@ -217,7 +215,6 @@ Win32kThreadCallback(struct _ETHREAD *Thread,
Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout(); Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout();
Win32Thread->MessagePumpHookValue = 0; Win32Thread->MessagePumpHookValue = 0;
InitializeListHead(&Win32Thread->WindowListHead); InitializeListHead(&Win32Thread->WindowListHead);
ExInitializeFastMutex(&Win32Thread->WindowListLock);
InitializeListHead(&Win32Thread->W32CallbackListHead); InitializeListHead(&Win32Thread->W32CallbackListHead);
} }
else else

View file

@ -57,7 +57,6 @@ ClassReferenceClassByAtom(
PLIST_ENTRY CurrentEntry; PLIST_ENTRY CurrentEntry;
PW32PROCESS Process = PsGetWin32Process(); PW32PROCESS Process = PsGetWin32Process();
IntLockProcessClasses(Process);
CurrentEntry = Process->ClassListHead.Flink; CurrentEntry = Process->ClassListHead.Flink;
while (CurrentEntry != &Process->ClassListHead) while (CurrentEntry != &Process->ClassListHead)
{ {
@ -67,7 +66,6 @@ ClassReferenceClassByAtom(
{ {
*Class = Current; *Class = Current;
ObmReferenceObject(Current); ObmReferenceObject(Current);
IntUnLockProcessClasses(Process);
return TRUE; return TRUE;
} }
@ -76,7 +74,6 @@ ClassReferenceClassByAtom(
CurrentEntry = CurrentEntry->Flink; CurrentEntry = CurrentEntry->Flink;
} }
IntUnLockProcessClasses(Process);
if (BestMatch != NULL) if (BestMatch != NULL)
{ {
@ -369,7 +366,6 @@ IntCreateClass(
} }
InitializeListHead(&ClassObject->ClassWindowsListHead); InitializeListHead(&ClassObject->ClassWindowsListHead);
ExInitializeFastMutex(&ClassObject->ClassWindowsListLock);
return(ClassObject); return(ClassObject);
} }
@ -463,9 +459,8 @@ NtUserRegisterClassExWOW(
DPRINT("Failed creating window class object\n"); DPRINT("Failed creating window class object\n");
RETURN((RTL_ATOM)0); RETURN((RTL_ATOM)0);
} }
IntLockProcessClasses(PsGetWin32Process());
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry); InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
IntUnLockProcessClasses(PsGetWin32Process());
RETURN(Atom); RETURN(Atom);
@ -734,16 +729,13 @@ NtUserUnregisterClass(
RETURN( FALSE); RETURN( FALSE);
} }
IntLockClassWindows(Class);
if (!IsListEmpty(&Class->ClassWindowsListHead)) if (!IsListEmpty(&Class->ClassWindowsListHead))
{ {
IntUnLockClassWindows(Class);
/* Dereference the ClassReferenceClassByNameOrAtom() call */ /* Dereference the ClassReferenceClassByNameOrAtom() call */
ObmDereferenceObject(Class); ObmDereferenceObject(Class);
SetLastWin32Error(ERROR_CLASS_HAS_WINDOWS); SetLastWin32Error(ERROR_CLASS_HAS_WINDOWS);
RETURN( FALSE); RETURN( FALSE);
} }
IntUnLockClassWindows(Class);
/* Dereference the ClassReferenceClassByNameOrAtom() call */ /* Dereference the ClassReferenceClassByNameOrAtom() call */
ClassDereferenceObject(Class); ClassDereferenceObject(Class);

View file

@ -126,19 +126,15 @@ IntFindChildWindowToOwner(PWINDOW_OBJECT Root, PWINDOW_OBJECT Owner)
{ {
HWND Ret; HWND Ret;
PWINDOW_OBJECT Child, OwnerWnd; PWINDOW_OBJECT Child, OwnerWnd;
IntLockRelatives(Root);
for(Child = Root->FirstChild; Child; Child = Child->NextSibling) for(Child = Root->FirstChild; Child; Child = Child->NextSibling)
{ {
IntLockRelatives(Child);
OwnerWnd = IntGetWindowObject(Child->Owner); OwnerWnd = IntGetWindowObject(Child->Owner);
IntUnLockRelatives(Child);
if(!OwnerWnd) if(!OwnerWnd)
continue; continue;
if(OwnerWnd == Owner) if(OwnerWnd == Owner)
{ {
IntUnLockRelatives(Root);
Ret = Child->Self; Ret = Child->Self;
IntReleaseWindowObject(OwnerWnd); IntReleaseWindowObject(OwnerWnd);
return Ret; return Ret;
@ -146,7 +142,6 @@ IntFindChildWindowToOwner(PWINDOW_OBJECT Root, PWINDOW_OBJECT Owner)
IntReleaseWindowObject(OwnerWnd); IntReleaseWindowObject(OwnerWnd);
} }
IntUnLockRelatives(Root);
return NULL; return NULL;
} }

View file

@ -228,15 +228,11 @@ IntDestroyMenuObject(PMENU_OBJECT MenuObject,
NTSTATUS Status; NTSTATUS Status;
/* remove all menu items */ /* remove all menu items */
IntLockMenuItems(MenuObject);
IntDeleteMenuItems(MenuObject, bRecurse); /* do not destroy submenus */ IntDeleteMenuItems(MenuObject, bRecurse); /* do not destroy submenus */
IntUnLockMenuItems(MenuObject);
if(RemoveFromProcess) if(RemoveFromProcess)
{ {
IntLockProcessMenus((PW32PROCESS)MenuObject->Process->Win32Process);
RemoveEntryList(&MenuObject->ListEntry); RemoveEntryList(&MenuObject->ListEntry);
IntUnLockProcessMenus((PW32PROCESS)MenuObject->Process->Win32Process);
} }
Status = ObReferenceObjectByHandle(MenuObject->Process->Win32WindowStation, Status = ObReferenceObjectByHandle(MenuObject->Process->Win32WindowStation,
@ -292,12 +288,9 @@ IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar)
MenuObject->MenuInfo.MenuItemCount = 0; MenuObject->MenuInfo.MenuItemCount = 0;
MenuObject->MenuItemList = NULL; MenuObject->MenuItemList = NULL;
ExInitializeFastMutex(&MenuObject->MenuItemsLock);
/* Insert menu item into process menu handle list */ /* Insert menu item into process menu handle list */
IntLockProcessMenus(PsGetWin32Process());
InsertTailList(&PsGetWin32Process()->MenuListHead, &MenuObject->ListEntry); InsertTailList(&PsGetWin32Process()->MenuListHead, &MenuObject->ListEntry);
IntUnLockProcessMenus(PsGetWin32Process());
return MenuObject; return MenuObject;
} }
@ -311,9 +304,6 @@ IntCloneMenuItems(PMENU_OBJECT Destination, PMENU_OBJECT Source)
if(!Source->MenuInfo.MenuItemCount) if(!Source->MenuInfo.MenuItemCount)
return FALSE; return FALSE;
IntLockMenuItems(Destination);
IntLockMenuItems(Source);
MenuItem = Source->MenuItemList; MenuItem = Source->MenuItemList;
while(MenuItem) while(MenuItem)
{ {
@ -364,8 +354,6 @@ IntCloneMenuItems(PMENU_OBJECT Destination, PMENU_OBJECT Source)
MenuItem = MenuItem->Next; MenuItem = MenuItem->Next;
} }
IntUnLockMenuItems(Source);
IntUnLockMenuItems(Destination);
return TRUE; return TRUE;
} }
@ -403,12 +391,9 @@ IntCloneMenu(PMENU_OBJECT Source)
MenuObject->MenuInfo.MenuItemCount = 0; MenuObject->MenuInfo.MenuItemCount = 0;
MenuObject->MenuItemList = NULL; MenuObject->MenuItemList = NULL;
ExInitializeFastMutex(&MenuObject->MenuItemsLock);
/* Insert menu item into process menu handle list */ /* Insert menu item into process menu handle list */
IntLockProcessMenus(PsGetWin32Process());
InsertTailList(&PsGetWin32Process()->MenuListHead, &MenuObject->ListEntry); InsertTailList(&PsGetWin32Process()->MenuListHead, &MenuObject->ListEntry);
IntUnLockProcessMenus(PsGetWin32Process());
IntCloneMenuItems(MenuObject, Source); IntCloneMenuItems(MenuObject, Source);
@ -1156,15 +1141,10 @@ IntGetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT fByPos, UINT gmdiFlags,
if(!SubMenuObject || (SubMenuObject == MenuObject)) if(!SubMenuObject || (SubMenuObject == MenuObject))
break; break;
IntLockMenuItems(SubMenuObject);
IntUnLockMenuItems(MenuObject);
(*gismc)++; (*gismc)++;
sres = IntGetMenuDefaultItem(SubMenuObject, fByPos, gmdiFlags, gismc); sres = IntGetMenuDefaultItem(SubMenuObject, fByPos, gmdiFlags, gismc);
(*gismc)--; (*gismc)--;
IntUnLockMenuItems(SubMenuObject);
IntLockMenuItems(MenuObject);
IntReleaseMenuObject(SubMenuObject); IntReleaseMenuObject(SubMenuObject);
if(sres > (UINT)-1) if(sres > (UINT)-1)
@ -1253,18 +1233,14 @@ IntCleanupMenus(struct _EPROCESS *Process, PW32PROCESS Win32Process)
KeAttachProcess(&Process->Pcb); KeAttachProcess(&Process->Pcb);
} }
IntLockProcessMenus(Win32Process);
while (Win32Process->MenuListHead.Flink != &(Win32Process->MenuListHead) && while (Win32Process->MenuListHead.Flink != &(Win32Process->MenuListHead) &&
Win32Process->MenuListHead.Flink != LastHead) Win32Process->MenuListHead.Flink != LastHead)
{ {
LastHead = Win32Process->MenuListHead.Flink; LastHead = Win32Process->MenuListHead.Flink;
MenuObject = CONTAINING_RECORD(Win32Process->MenuListHead.Flink, MENU_OBJECT, ListEntry); MenuObject = CONTAINING_RECORD(Win32Process->MenuListHead.Flink, MENU_OBJECT, ListEntry);
IntUnLockProcessMenus(Win32Process);
IntDestroyMenuObject(MenuObject, FALSE, TRUE); IntDestroyMenuObject(MenuObject, FALSE, TRUE);
IntLockProcessMenus(Win32Process);
} }
IntUnLockProcessMenus(Win32Process);
if (CurrentProcess != Process) if (CurrentProcess != Process)
{ {
@ -1303,9 +1279,7 @@ NtUserBuildMenuItemList(
if(Buffer) if(Buffer)
{ {
IntLockMenuItems(MenuObject);
res = IntBuildMenuItemList(MenuObject, Buffer, nBufSize); res = IntBuildMenuItemList(MenuObject, Buffer, nBufSize);
IntUnLockMenuItems(MenuObject);
} }
else else
{ {
@ -1345,9 +1319,9 @@ NtUserCheckMenuItem(
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
RETURN( (DWORD)-1); RETURN( (DWORD)-1);
} }
IntLockMenuItems(MenuObject);
res = IntCheckMenuItem(MenuObject, uIDCheckItem, uCheck); res = IntCheckMenuItem(MenuObject, uIDCheckItem, uCheck);
IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
RETURN( res); RETURN( res);
@ -1524,9 +1498,9 @@ NtUserEnableMenuItem(
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
RETURN( res); RETURN( res);
} }
IntLockMenuItems(MenuObject);
res = IntEnableMenuItem(MenuObject, uIDEnableItem, uEnable); res = IntEnableMenuItem(MenuObject, uIDEnableItem, uEnable);
IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
RETURN( res); RETURN( res);
@ -1578,9 +1552,8 @@ NtUserInsertMenuItem(
RETURN( FALSE); RETURN( FALSE);
} }
IntLockMenuItems(MenuObject);
Res = IntInsertMenuItem(MenuObject, uItem, fByPosition, &ItemInfo); Res = IntInsertMenuItem(MenuObject, uItem, fByPosition, &ItemInfo);
IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
RETURN( Res); RETURN( Res);
@ -1627,9 +1600,9 @@ NtUserGetMenuDefaultItem(
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
RETURN( res); RETURN( res);
} }
IntLockMenuItems(MenuObject);
res = IntGetMenuDefaultItem(MenuObject, fByPos, gmdiFlags, &gismc); res = IntGetMenuDefaultItem(MenuObject, fByPos, gmdiFlags, &gismc);
IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
RETURN(res); RETURN(res);
@ -1769,9 +1742,7 @@ NtUserHiliteMenuItem(
} }
if(WindowObject->IDMenu == (UINT)hmenu) if(WindowObject->IDMenu == (UINT)hmenu)
{ {
IntLockMenuItems(MenuObject);
res = IntHiliteMenuItem(WindowObject, MenuObject, uItemHilite, uHilite); res = IntHiliteMenuItem(WindowObject, MenuObject, uItemHilite, uHilite);
IntUnLockMenuItems(MenuObject);
} }
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
@ -1914,7 +1885,6 @@ NtUserMenuItemFromPoint(
Y -= WindowObject->WindowRect.top; Y -= WindowObject->WindowRect.top;
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
IntLockMenuItems(MenuObject);
mi = MenuObject->MenuItemList; mi = MenuObject->MenuItemList;
for (i = 0; NULL != mi; i++) for (i = 0; NULL != mi; i++)
{ {
@ -1924,7 +1894,6 @@ NtUserMenuItemFromPoint(
} }
mi = mi->Next; mi = mi->Next;
} }
IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
@ -2145,9 +2114,9 @@ UserSetMenuDefaultItem(
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
return( FALSE); return( FALSE);
} }
IntLockMenuItems(MenuObject);
res = IntSetMenuDefaultItem(MenuObject, uItem, fByPos); res = IntSetMenuDefaultItem(MenuObject, uItem, fByPos);
IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
return( res); return( res);
@ -2176,9 +2145,9 @@ NtUserSetMenuDefaultItem(
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
RETURN( FALSE); RETURN( FALSE);
} }
IntLockMenuItems(MenuObject);
res = IntSetMenuDefaultItem(MenuObject, uItem, fByPos); res = IntSetMenuDefaultItem(MenuObject, uItem, fByPos);
IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
RETURN( res); RETURN( res);

View file

@ -559,7 +559,6 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread)
return hWnd; return hWnd;
} }
IntLockRelatives(Window);
for (Child = Window->FirstChild; Child; Child = Child->NextSibling) for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
{ {
if (IntIsWindowDirty(Child) && if (IntIsWindowDirty(Child) &&
@ -569,7 +568,6 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread)
break; break;
} }
} }
IntUnLockRelatives(Window);
if (hFoundWnd == NULL) if (hFoundWnd == NULL)
{ {

View file

@ -91,8 +91,6 @@ NtUserBuildPropList(HWND hWnd,
} }
/* copy list */ /* copy list */
IntLockWindowProperties(WindowObject);
li = (PROPLISTITEM *)Buffer; li = (PROPLISTITEM *)Buffer;
ListEntry = WindowObject->PropListHead.Flink; ListEntry = WindowObject->PropListHead.Flink;
while((BufferSize >= sizeof(PROPLISTITEM)) && (ListEntry != &WindowObject->PropListHead)) while((BufferSize >= sizeof(PROPLISTITEM)) && (ListEntry != &WindowObject->PropListHead))
@ -104,7 +102,6 @@ NtUserBuildPropList(HWND hWnd,
Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM)); Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM));
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
RETURN( Status); RETURN( Status);
} }
@ -115,13 +112,10 @@ NtUserBuildPropList(HWND hWnd,
ListEntry = ListEntry->Flink; ListEntry = ListEntry->Flink;
} }
IntUnLockWindowProperties(WindowObject);
} }
else else
{ {
IntLockWindowProperties(WindowObject);
Cnt = WindowObject->PropListItems * sizeof(PROPLISTITEM); Cnt = WindowObject->PropListItems * sizeof(PROPLISTITEM);
IntUnLockWindowProperties(WindowObject);
} }
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
@ -160,12 +154,10 @@ NtUserRemoveProp(HWND hWnd, ATOM Atom)
RETURN( NULL); RETURN( NULL);
} }
IntLockWindowProperties(WindowObject);
Prop = IntGetProp(WindowObject, Atom); Prop = IntGetProp(WindowObject, Atom);
if (Prop == NULL) if (Prop == NULL)
{ {
IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
RETURN(NULL); RETURN(NULL);
} }
@ -173,7 +165,6 @@ NtUserRemoveProp(HWND hWnd, ATOM Atom)
RemoveEntryList(&Prop->PropListEntry); RemoveEntryList(&Prop->PropListEntry);
ExFreePool(Prop); ExFreePool(Prop);
WindowObject->PropListItems--; WindowObject->PropListItems--;
IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
RETURN(Data); RETURN(Data);
@ -200,13 +191,11 @@ NtUserGetProp(HWND hWnd, ATOM Atom)
RETURN( FALSE); RETURN( FALSE);
} }
IntLockWindowProperties(WindowObject);
Prop = IntGetProp(WindowObject, Atom); Prop = IntGetProp(WindowObject, Atom);
if (Prop != NULL) if (Prop != NULL)
{ {
Data = Prop->Data; Data = Prop->Data;
} }
IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
RETURN(Data); RETURN(Data);
@ -256,9 +245,7 @@ NtUserSetProp(HWND hWnd, ATOM Atom, HANDLE Data)
RETURN( FALSE); RETURN( FALSE);
} }
IntLockWindowProperties(WindowObject);
ret = IntSetProp(WindowObject, Atom, Data); ret = IntSetProp(WindowObject, Atom, Data);
IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
RETURN( ret); RETURN( ret);

View file

@ -92,7 +92,6 @@ VIS_ComputeVisibleRegion(
if ((PreviousWindow->Style & WS_CLIPSIBLINGS) || if ((PreviousWindow->Style & WS_CLIPSIBLINGS) ||
(PreviousWindow == Window && ClipSiblings)) (PreviousWindow == Window && ClipSiblings))
{ {
IntLockRelatives(CurrentWindow);
CurrentSibling = CurrentWindow->FirstChild; CurrentSibling = CurrentWindow->FirstChild;
while (CurrentSibling != NULL && CurrentSibling != PreviousWindow) while (CurrentSibling != NULL && CurrentSibling != PreviousWindow)
{ {
@ -111,7 +110,6 @@ VIS_ComputeVisibleRegion(
} }
CurrentSibling = CurrentSibling->NextSibling; CurrentSibling = CurrentSibling->NextSibling;
} }
IntUnLockRelatives(CurrentWindow);
} }
PreviousWindow = CurrentWindow; PreviousWindow = CurrentWindow;
@ -121,7 +119,6 @@ VIS_ComputeVisibleRegion(
if (ClipChildren) if (ClipChildren)
{ {
IntLockRelatives(Window);
CurrentWindow = Window->FirstChild; CurrentWindow = Window->FirstChild;
while (CurrentWindow) while (CurrentWindow)
{ {
@ -140,7 +137,6 @@ VIS_ComputeVisibleRegion(
} }
CurrentWindow = CurrentWindow->NextSibling; CurrentWindow = CurrentWindow->NextSibling;
} }
IntUnLockRelatives(Window);
} }
if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE))

View file

@ -135,16 +135,12 @@ IntGetParent(PWINDOW_OBJECT Wnd)
if (Wnd->Style & WS_POPUP) if (Wnd->Style & WS_POPUP)
{ {
IntLockRelatives(Wnd);
hWnd = Wnd->Owner; hWnd = Wnd->Owner;
IntUnLockRelatives(Wnd);
return IntGetWindowObject(hWnd); return IntGetWindowObject(hWnd);
} }
else if (Wnd->Style & WS_CHILD) else if (Wnd->Style & WS_CHILD)
{ {
IntLockRelatives(Wnd);
hWnd = Wnd->Parent; hWnd = Wnd->Parent;
IntUnLockRelatives(Wnd);
return IntGetWindowObject(hWnd); return IntGetWindowObject(hWnd);
} }
@ -156,9 +152,7 @@ IntGetOwner(PWINDOW_OBJECT Wnd)
{ {
HWND hWnd; HWND hWnd;
IntLockRelatives(Wnd);
hWnd = Wnd->Owner; hWnd = Wnd->Owner;
IntUnLockRelatives(Wnd);
return IntGetWindowObject(hWnd); return IntGetWindowObject(hWnd);
} }
@ -168,9 +162,7 @@ IntGetParentObject(PWINDOW_OBJECT Wnd)
{ {
HWND hParent; HWND hParent;
IntLockRelatives(Wnd);
hParent = Wnd->Parent; hParent = Wnd->Parent;
IntUnLockRelatives(Wnd);
return IntGetWindowObject(hParent); return IntGetWindowObject(hParent);
} }
@ -191,8 +183,6 @@ IntWinListChildren(PWINDOW_OBJECT Window)
HWND *List; HWND *List;
UINT Index, NumChildren = 0; UINT Index, NumChildren = 0;
IntLockRelatives(Window);
for (Child = Window->FirstChild; Child; Child = Child->NextSibling) for (Child = Window->FirstChild; Child; Child = Child->NextSibling)
++NumChildren; ++NumChildren;
@ -200,7 +190,6 @@ IntWinListChildren(PWINDOW_OBJECT Window)
if(!List) if(!List)
{ {
DPRINT1("Failed to allocate memory for children array\n"); DPRINT1("Failed to allocate memory for children array\n");
IntUnLockRelatives(Window);
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return NULL; return NULL;
} }
@ -210,8 +199,6 @@ IntWinListChildren(PWINDOW_OBJECT Window)
List[Index] = Child->Self; List[Index] = Child->Self;
List[Index] = NULL; List[Index] = NULL;
IntUnLockRelatives(Window);
return List; return List;
} }
@ -304,10 +291,8 @@ static LRESULT co_IntDestroyWindow(PWINDOW_OBJECT Window,
ASSERT(Window); ASSERT(Window);
IntLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread);
if(Window->Status & WINDOWSTATUS_DESTROYING) if(Window->Status & WINDOWSTATUS_DESTROYING)
{ {
IntUnLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread);
DPRINT("Tried to call IntDestroyWindow() twice\n"); DPRINT("Tried to call IntDestroyWindow() twice\n");
return 0; return 0;
} }
@ -317,7 +302,6 @@ static LRESULT co_IntDestroyWindow(PWINDOW_OBJECT Window,
don't get into trouble when destroying the thread windows while we're still don't get into trouble when destroying the thread windows while we're still
in IntDestroyWindow() */ in IntDestroyWindow() */
RemoveEntryList(&Window->ThreadListEntry); RemoveEntryList(&Window->ThreadListEntry);
IntUnLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread);
BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData); BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData);
@ -368,10 +352,8 @@ static LRESULT co_IntDestroyWindow(PWINDOW_OBJECT Window,
MsqRemoveWindowMessagesFromQueue(Window); MsqRemoveWindowMessagesFromQueue(Window);
/* from now on no messages can be sent to this window anymore */ /* from now on no messages can be sent to this window anymore */
IntLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread);
Window->Status |= WINDOWSTATUS_DESTROYED; Window->Status |= WINDOWSTATUS_DESTROYED;
/* don't remove the WINDOWSTATUS_DESTROYING bit */ /* don't remove the WINDOWSTATUS_DESTROYING bit */
IntUnLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread);
/* reset shell window handles */ /* reset shell window handles */
if(ThreadData->Desktop) if(ThreadData->Desktop)
@ -429,9 +411,7 @@ static LRESULT co_IntDestroyWindow(PWINDOW_OBJECT Window,
IntDestroyScrollBars(Window); IntDestroyScrollBars(Window);
/* remove the window from the class object */ /* remove the window from the class object */
IntLockClassWindows(Window->Class);
RemoveEntryList(&Window->ClassListEntry); RemoveEntryList(&Window->ClassListEntry);
IntUnLockClassWindows(Window->Class);
/* dereference the class */ /* dereference the class */
ClassDereferenceObject(Window->Class); ClassDereferenceObject(Window->Class);
@ -577,7 +557,6 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread)
Win32Thread = Thread->Tcb.Win32Thread; Win32Thread = Thread->Tcb.Win32Thread;
Win32Process = (PW32PROCESS)Thread->ThreadsProcess->Win32Process; Win32Process = (PW32PROCESS)Thread->ThreadsProcess->Win32Process;
IntLockThreadWindows(Win32Thread);
Current = Win32Thread->WindowListHead.Flink; Current = Win32Thread->WindowListHead.Flink;
while (Current != &(Win32Thread->WindowListHead)) while (Current != &(Win32Thread->WindowListHead))
{ {
@ -591,7 +570,6 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread)
if(!List) if(!List)
{ {
DPRINT("Not enough memory to allocate window handle list\n"); DPRINT("Not enough memory to allocate window handle list\n");
IntUnLockThreadWindows(Win32Thread);
return; return;
} }
pWnd = List; pWnd = List;
@ -603,7 +581,6 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread)
pWnd++; pWnd++;
Current = Current->Flink; Current = Current->Flink;
} }
IntUnLockThreadWindows(Win32Thread);
*pWnd = NULL; *pWnd = NULL;
for(pWnd = List; *pWnd; pWnd++) for(pWnd = List; *pWnd; pWnd++)
@ -615,7 +592,6 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread)
return; return;
} }
IntUnLockThreadWindows(Win32Thread);
} }
@ -861,7 +837,6 @@ IntLinkWindow(
{ {
PWINDOW_OBJECT Parent; PWINDOW_OBJECT Parent;
IntLockRelatives(Wnd);
Wnd->Parent = WndParent->Self; Wnd->Parent = WndParent->Self;
if ((Wnd->PrevSibling = WndPrevSibling)) if ((Wnd->PrevSibling = WndPrevSibling))
{ {
@ -870,10 +845,8 @@ IntLinkWindow(
Wnd->NextSibling->PrevSibling = Wnd; Wnd->NextSibling->PrevSibling = Wnd;
else if ((Parent = IntGetWindowObject(Wnd->Parent))) else if ((Parent = IntGetWindowObject(Wnd->Parent)))
{ {
IntLockRelatives(Parent);
if(Parent->LastChild == WndPrevSibling) if(Parent->LastChild == WndPrevSibling)
Parent->LastChild = Wnd; Parent->LastChild = Wnd;
IntUnLockRelatives(Parent);
IntReleaseWindowObject(Parent); IntReleaseWindowObject(Parent);
} }
Wnd->PrevSibling->NextSibling = Wnd; Wnd->PrevSibling->NextSibling = Wnd;
@ -886,23 +859,18 @@ IntLinkWindow(
Wnd->NextSibling->PrevSibling = Wnd; Wnd->NextSibling->PrevSibling = Wnd;
else if (Parent) else if (Parent)
{ {
IntLockRelatives(Parent);
Parent->LastChild = Wnd; Parent->LastChild = Wnd;
Parent->FirstChild = Wnd; Parent->FirstChild = Wnd;
IntUnLockRelatives(Parent);
IntReleaseWindowObject(Parent); IntReleaseWindowObject(Parent);
IntUnLockRelatives(Wnd);
return; return;
} }
if(Parent) if(Parent)
{ {
IntLockRelatives(Parent);
Parent->FirstChild = Wnd; Parent->FirstChild = Wnd;
IntUnLockRelatives(Parent);
IntReleaseWindowObject(Parent); IntReleaseWindowObject(Parent);
} }
} }
IntUnLockRelatives(Wnd);
} }
HWND FASTCALL HWND FASTCALL
@ -915,7 +883,6 @@ IntSetOwner(HWND hWnd, HWND hWndNewOwner)
if(!Wnd) if(!Wnd)
return NULL; return NULL;
IntLockRelatives(Wnd);
WndOldOwner = IntGetWindowObject(Wnd->Owner); WndOldOwner = IntGetWindowObject(Wnd->Owner);
if (WndOldOwner) if (WndOldOwner)
{ {
@ -935,7 +902,6 @@ IntSetOwner(HWND hWnd, HWND hWndNewOwner)
else else
Wnd->Owner = NULL; Wnd->Owner = NULL;
IntUnLockRelatives(Wnd);
IntReleaseWindowObject(Wnd); IntReleaseWindowObject(Wnd);
return ret; return ret;
} }
@ -978,14 +944,12 @@ IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
if (0 == (Wnd->ExStyle & WS_EX_TOPMOST)) if (0 == (Wnd->ExStyle & WS_EX_TOPMOST))
{ {
/* Not a TOPMOST window, put after TOPMOSTs of new parent */ /* Not a TOPMOST window, put after TOPMOSTs of new parent */
IntLockRelatives(WndNewParent);
Sibling = WndNewParent->FirstChild; Sibling = WndNewParent->FirstChild;
while (NULL != Sibling && 0 != (Sibling->ExStyle & WS_EX_TOPMOST)) while (NULL != Sibling && 0 != (Sibling->ExStyle & WS_EX_TOPMOST))
{ {
InsertAfter = Sibling; InsertAfter = Sibling;
Sibling = Sibling->NextSibling; Sibling = Sibling->NextSibling;
} }
IntUnLockRelatives(WndNewParent);
} }
if (NULL == InsertAfter) if (NULL == InsertAfter)
{ {
@ -1074,10 +1038,9 @@ IntUnlinkWindow(PWINDOW_OBJECT Wnd)
{ {
PWINDOW_OBJECT WndParent; PWINDOW_OBJECT WndParent;
IntLockRelatives(Wnd);
if((WndParent = IntGetWindowObject(Wnd->Parent))) if((WndParent = IntGetWindowObject(Wnd->Parent)))
{ {
IntLockRelatives(WndParent);
} }
if (Wnd->NextSibling) Wnd->NextSibling->PrevSibling = Wnd->PrevSibling; if (Wnd->NextSibling) Wnd->NextSibling->PrevSibling = Wnd->PrevSibling;
@ -1088,11 +1051,9 @@ IntUnlinkWindow(PWINDOW_OBJECT Wnd)
if(WndParent) if(WndParent)
{ {
IntUnLockRelatives(WndParent);
IntReleaseWindowObject(WndParent); IntReleaseWindowObject(WndParent);
} }
Wnd->PrevSibling = Wnd->NextSibling = Wnd->Parent = NULL; Wnd->PrevSibling = Wnd->NextSibling = Wnd->Parent = NULL;
IntUnLockRelatives(Wnd);
} }
BOOL FASTCALL BOOL FASTCALL
@ -1106,7 +1067,6 @@ IntAnyPopup(VOID)
return FALSE; return FALSE;
} }
IntLockRelatives(Window);
for(Child = Window->FirstChild; Child; Child = Child->NextSibling) for(Child = Window->FirstChild; Child; Child = Child->NextSibling)
{ {
if(Child->Owner && Child->Style & WS_VISIBLE) if(Child->Owner && Child->Style & WS_VISIBLE)
@ -1115,12 +1075,11 @@ IntAnyPopup(VOID)
* The desktop has a popup window if one of them has * The desktop has a popup window if one of them has
* an owner window and is visible * an owner window and is visible
*/ */
IntUnLockRelatives(Window);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
return TRUE; return TRUE;
} }
} }
IntUnLockRelatives(Window);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
return FALSE; return FALSE;
} }
@ -1183,7 +1142,6 @@ NtUserBuildHwndList(
return 0; return 0;
} }
IntLockRelatives(Window);
for(Child = Window->FirstChild; Child != NULL; Child = Child->NextSibling) for(Child = Window->FirstChild; Child != NULL; Child = Child->NextSibling)
{ {
if(dwCount++ < nBufSize && pWnd) if(dwCount++ < nBufSize && pWnd)
@ -1196,7 +1154,6 @@ NtUserBuildHwndList(
} }
} }
} }
IntUnLockRelatives(Window);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
} }
@ -1221,7 +1178,6 @@ NtUserBuildHwndList(
return 0; return 0;
} }
IntLockThreadWindows(W32Thread);
Current = W32Thread->WindowListHead.Flink; Current = W32Thread->WindowListHead.Flink;
while(Current != &(W32Thread->WindowListHead)) while(Current != &(W32Thread->WindowListHead))
{ {
@ -1240,7 +1196,6 @@ NtUserBuildHwndList(
dwCount++; dwCount++;
Current = Current->Flink; Current = Current->Flink;
} }
IntUnLockThreadWindows(W32Thread);
ObDereferenceObject(Thread); ObDereferenceObject(Thread);
} }
@ -1275,7 +1230,6 @@ NtUserBuildHwndList(
return 0; return 0;
} }
IntLockRelatives(Window);
for(Child = Window->FirstChild; Child != NULL; Child = Child->NextSibling) for(Child = Window->FirstChild; Child != NULL; Child = Child->NextSibling)
{ {
if(dwCount++ < nBufSize && pWnd) if(dwCount++ < nBufSize && pWnd)
@ -1288,7 +1242,6 @@ NtUserBuildHwndList(
} }
} }
} }
IntUnLockRelatives(Window);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
if(hDesktop) if(hDesktop)
@ -1561,9 +1514,8 @@ co_IntCreateWindowEx(DWORD dwExStyle,
* Fill out the structure describing it. * Fill out the structure describing it.
*/ */
WindowObject->Class = ClassObject; WindowObject->Class = ClassObject;
IntLockClassWindows(ClassObject);
InsertTailList(&ClassObject->ClassWindowsListHead, &WindowObject->ClassListEntry); InsertTailList(&ClassObject->ClassWindowsListHead, &WindowObject->ClassListEntry);
IntUnLockClassWindows(ClassObject);
WindowObject->ExStyle = dwExStyle; WindowObject->ExStyle = dwExStyle;
WindowObject->Style = dwStyle & ~WS_VISIBLE; WindowObject->Style = dwStyle & ~WS_VISIBLE;
@ -1626,8 +1578,6 @@ co_IntCreateWindowEx(DWORD dwExStyle,
} }
InitializeListHead(&WindowObject->PropListHead); InitializeListHead(&WindowObject->PropListHead);
ExInitializeFastMutex(&WindowObject->PropListLock);
ExInitializeFastMutex(&WindowObject->RelativesLock);
ExInitializeFastMutex(&WindowObject->UpdateLock); ExInitializeFastMutex(&WindowObject->UpdateLock);
InitializeListHead(&WindowObject->WndObjListHead); InitializeListHead(&WindowObject->WndObjListHead);
ExInitializeFastMutex(&WindowObject->WndObjListLock); ExInitializeFastMutex(&WindowObject->WndObjListLock);
@ -1690,10 +1640,8 @@ co_IntCreateWindowEx(DWORD dwExStyle,
} }
/* Insert the window into the thread's window list. */ /* Insert the window into the thread's window list. */
IntLockThreadWindows(PsGetWin32Thread());
InsertTailList (&PsGetWin32Thread()->WindowListHead, InsertTailList (&PsGetWin32Thread()->WindowListHead,
&WindowObject->ThreadListEntry); &WindowObject->ThreadListEntry);
IntUnLockThreadWindows(PsGetWin32Thread());
/* Allocate a DCE for this window. */ /* Allocate a DCE for this window. */
if (dwStyle & CS_OWNDC) if (dwStyle & CS_OWNDC)
@ -1899,10 +1847,8 @@ co_IntCreateWindowEx(DWORD dwExStyle,
if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
{ {
PWINDOW_OBJECT PrevSibling; PWINDOW_OBJECT PrevSibling;
IntLockRelatives(ParentWindow);
if((PrevSibling = ParentWindow->LastChild)) if((PrevSibling = ParentWindow->LastChild))
IntReferenceWindowObject(PrevSibling); IntReferenceWindowObject(PrevSibling);
IntUnLockRelatives(ParentWindow);
/* link window as bottom sibling */ /* link window as bottom sibling */
IntLinkWindow(WindowObject, ParentWindow, PrevSibling /*prev sibling*/); IntLinkWindow(WindowObject, ParentWindow, PrevSibling /*prev sibling*/);
if(PrevSibling) if(PrevSibling)
@ -1914,7 +1860,6 @@ co_IntCreateWindowEx(DWORD dwExStyle,
PWINDOW_OBJECT InsertAfter, Sibling; PWINDOW_OBJECT InsertAfter, Sibling;
if (0 == (dwExStyle & WS_EX_TOPMOST)) if (0 == (dwExStyle & WS_EX_TOPMOST))
{ {
IntLockRelatives(ParentWindow);
InsertAfter = NULL; InsertAfter = NULL;
Sibling = ParentWindow->FirstChild; Sibling = ParentWindow->FirstChild;
while (NULL != Sibling && 0 != (Sibling->ExStyle & WS_EX_TOPMOST)) while (NULL != Sibling && 0 != (Sibling->ExStyle & WS_EX_TOPMOST))
@ -1922,7 +1867,6 @@ co_IntCreateWindowEx(DWORD dwExStyle,
InsertAfter = Sibling; InsertAfter = Sibling;
Sibling = Sibling->NextSibling; Sibling = Sibling->NextSibling;
} }
IntUnLockRelatives(ParentWindow);
} }
else else
{ {
@ -2239,14 +2183,12 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
Child = IntGetWindowObject(*ChildHandle); Child = IntGetWindowObject(*ChildHandle);
if (Child == NULL) if (Child == NULL)
continue; continue;
IntLockRelatives(Child);
if (Child->Owner != Window->Self) if (Child->Owner != Window->Self)
{ {
IntUnLockRelatives(Child);
IntReleaseWindowObject(Child); IntReleaseWindowObject(Child);
continue; continue;
} }
IntUnLockRelatives(Child);
if (IntWndBelongsToThread(Child, PsGetWin32Thread())) if (IntWndBelongsToThread(Child, PsGetWin32Thread()))
{ {
co_UserDestroyWindow(Child); co_UserDestroyWindow(Child);
@ -2254,12 +2196,12 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
GotOne = TRUE; GotOne = TRUE;
continue; continue;
} }
IntLockRelatives(Child);
if (Child->Owner != NULL) if (Child->Owner != NULL)
{ {
Child->Owner = NULL; Child->Owner = NULL;
} }
IntUnLockRelatives(Child);
IntReleaseWindowObject(Child); IntReleaseWindowObject(Child);
} }
ExFreePool(Children); ExFreePool(Children);
@ -3273,10 +3215,9 @@ UserGetWindow(HWND hWnd, UINT Relationship)
case GW_HWNDFIRST: case GW_HWNDFIRST:
if((Parent = IntGetParentObject(WindowObject))) if((Parent = IntGetParentObject(WindowObject)))
{ {
IntLockRelatives(Parent);
if (Parent->FirstChild) if (Parent->FirstChild)
hWndResult = Parent->FirstChild->Self; hWndResult = Parent->FirstChild->Self;
IntUnLockRelatives(Parent);
IntReleaseWindowObject(Parent); IntReleaseWindowObject(Parent);
} }
break; break;
@ -3284,42 +3225,33 @@ UserGetWindow(HWND hWnd, UINT Relationship)
case GW_HWNDLAST: case GW_HWNDLAST:
if((Parent = IntGetParentObject(WindowObject))) if((Parent = IntGetParentObject(WindowObject)))
{ {
IntLockRelatives(Parent);
if (Parent->LastChild) if (Parent->LastChild)
hWndResult = Parent->LastChild->Self; hWndResult = Parent->LastChild->Self;
IntUnLockRelatives(Parent);
IntReleaseWindowObject(Parent); IntReleaseWindowObject(Parent);
} }
break; break;
case GW_HWNDNEXT: case GW_HWNDNEXT:
IntLockRelatives(WindowObject);
if (WindowObject->NextSibling) if (WindowObject->NextSibling)
hWndResult = WindowObject->NextSibling->Self; hWndResult = WindowObject->NextSibling->Self;
IntUnLockRelatives(WindowObject);
break; break;
case GW_HWNDPREV: case GW_HWNDPREV:
IntLockRelatives(WindowObject);
if (WindowObject->PrevSibling) if (WindowObject->PrevSibling)
hWndResult = WindowObject->PrevSibling->Self; hWndResult = WindowObject->PrevSibling->Self;
IntUnLockRelatives(WindowObject);
break; break;
case GW_OWNER: case GW_OWNER:
IntLockRelatives(WindowObject);
if((Parent = IntGetWindowObject(WindowObject->Owner))) if((Parent = IntGetWindowObject(WindowObject->Owner)))
{ {
hWndResult = Parent->Self; hWndResult = Parent->Self;
IntReleaseWindowObject(Parent); IntReleaseWindowObject(Parent);
} }
IntUnLockRelatives(WindowObject);
break; break;
case GW_CHILD: case GW_CHILD:
IntLockRelatives(WindowObject);
if (WindowObject->FirstChild) if (WindowObject->FirstChild)
hWndResult = WindowObject->FirstChild->Self; hWndResult = WindowObject->FirstChild->Self;
IntUnLockRelatives(WindowObject);
break; break;
} }
@ -3428,9 +3360,7 @@ UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi)
break; break;
case GWL_HWNDPARENT: case GWL_HWNDPARENT:
IntLockRelatives(WindowObject);
Parent = IntGetWindowObject(WindowObject->Parent); Parent = IntGetWindowObject(WindowObject->Parent);
IntUnLockRelatives(WindowObject);
if(Parent) if(Parent)
{ {
if (Parent && Parent->Self == IntGetDesktopWindow()) if (Parent && Parent->Self == IntGetDesktopWindow())

View file

@ -165,17 +165,14 @@ co_WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
while (Wnd != NULL) while (Wnd != NULL)
{ {
Old = Wnd; Old = Wnd;
IntLockRelatives(Old);
if (Old->NextSibling == NULL) if (Old->NextSibling == NULL)
{ {
Wnd = NULL; Wnd = NULL;
IntUnLockRelatives(Old);
if (Old != Window) if (Old != Window)
IntReleaseWindowObject(Old); IntReleaseWindowObject(Old);
break; break;
} }
Wnd = IntGetWindowObject(Old->NextSibling->Self); Wnd = IntGetWindowObject(Old->NextSibling->Self);
IntUnLockRelatives(Old);
if (Old != Window) if (Old != Window)
IntReleaseWindowObject(Old); IntReleaseWindowObject(Old);
if ((Wnd->Style & (WS_DISABLED | WS_VISIBLE)) == WS_VISIBLE && if ((Wnd->Style & (WS_DISABLED | WS_VISIBLE)) == WS_VISIBLE &&
@ -719,12 +716,10 @@ WinPosInternalMoveWindow(PWINDOW_OBJECT Window, INT MoveX, INT MoveY)
Window->ClientRect.top += MoveY; Window->ClientRect.top += MoveY;
Window->ClientRect.bottom += MoveY; Window->ClientRect.bottom += MoveY;
IntLockRelatives(Window);
for(Child = Window->FirstChild; Child; Child = Child->NextSibling) for(Child = Window->FirstChild; Child; Child = Child->NextSibling)
{ {
WinPosInternalMoveWindow(Child, MoveX, MoveY); WinPosInternalMoveWindow(Child, MoveX, MoveY);
} }
IntUnLockRelatives(Window);
} }
/* /*
@ -958,7 +953,6 @@ co_WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
|| HWND_NOTOPMOST == WinPos.hwndInsertAfter) || HWND_NOTOPMOST == WinPos.hwndInsertAfter)
{ {
InsertAfterWindow = NULL; InsertAfterWindow = NULL;
IntLockRelatives(ParentWindow);
Sibling = ParentWindow->FirstChild; Sibling = ParentWindow->FirstChild;
while (NULL != Sibling && 0 != (Sibling->ExStyle & WS_EX_TOPMOST)) while (NULL != Sibling && 0 != (Sibling->ExStyle & WS_EX_TOPMOST))
{ {
@ -969,11 +963,9 @@ co_WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
{ {
IntReferenceWindowObject(InsertAfterWindow); IntReferenceWindowObject(InsertAfterWindow);
} }
IntUnLockRelatives(ParentWindow);
} }
else if (WinPos.hwndInsertAfter == HWND_BOTTOM) else if (WinPos.hwndInsertAfter == HWND_BOTTOM)
{ {
IntLockRelatives(ParentWindow);
if(ParentWindow->LastChild) if(ParentWindow->LastChild)
{ {
IntReferenceWindowObject(ParentWindow->LastChild); IntReferenceWindowObject(ParentWindow->LastChild);
@ -981,7 +973,6 @@ co_WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
} }
else else
InsertAfterWindow = NULL; InsertAfterWindow = NULL;
IntUnLockRelatives(ParentWindow);
} }
else else
InsertAfterWindow = IntGetWindowObject(WinPos.hwndInsertAfter); InsertAfterWindow = IntGetWindowObject(WinPos.hwndInsertAfter);