diff --git a/reactos/subsys/win32k/include/class.h b/reactos/subsys/win32k/include/class.h index 1a7a34c20e3..d1dbde12889 100644 --- a/reactos/subsys/win32k/include/class.h +++ b/reactos/subsys/win32k/include/class.h @@ -24,7 +24,6 @@ typedef struct _WNDCLASS_OBJECT LIST_ENTRY ListEntry; PCHAR ExtraData; /* list of windows */ - FAST_MUTEX ClassWindowsListLock; LIST_ENTRY ClassWindowsListHead; } WNDCLASS_OBJECT, *PWNDCLASS_OBJECT; @@ -34,18 +33,6 @@ InitClassImpl(VOID); NTSTATUS FASTCALL 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) \ ObmDereferenceObject(ClassObj) diff --git a/reactos/subsys/win32k/include/menu.h b/reactos/subsys/win32k/include/menu.h index cbe0cdba0d3..95d2a934aab 100644 --- a/reactos/subsys/win32k/include/menu.h +++ b/reactos/subsys/win32k/include/menu.h @@ -33,7 +33,6 @@ typedef struct _MENU_OBJECT { PEPROCESS Process; LIST_ENTRY ListEntry; - FAST_MUTEX MenuItemsLock; PMENU_ITEM MenuItemList; ROSMENUINFO MenuInfo; BOOL RtoL; @@ -42,18 +41,6 @@ typedef struct _MENU_OBJECT PMENU_OBJECT FASTCALL 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) \ ObmDereferenceObject(MenuObj) diff --git a/reactos/subsys/win32k/include/prop.h b/reactos/subsys/win32k/include/prop.h index 14806633f9f..35ec010a34b 100644 --- a/reactos/subsys/win32k/include/prop.h +++ b/reactos/subsys/win32k/include/prop.h @@ -14,11 +14,5 @@ IntSetProp(PWINDOW_OBJECT Wnd, ATOM Atom, HANDLE Data); PPROPERTY FASTCALL IntGetProp(PWINDOW_OBJECT WindowObject, ATOM Atom); -#define IntLockWindowProperties(Window) \ - ExAcquireFastMutex(&Window->PropListLock) - -#define IntUnLockWindowProperties(Window) \ - ExReleaseFastMutex(&Window->PropListLock) - #endif /* _WIN32K_PROP_H */ diff --git a/reactos/subsys/win32k/include/win32.h b/reactos/subsys/win32k/include/win32.h index ed900669f31..acb1868eb5c 100644 --- a/reactos/subsys/win32k/include/win32.h +++ b/reactos/subsys/win32k/include/win32.h @@ -6,7 +6,6 @@ typedef struct _W32THREAD { struct _USER_MESSAGE_QUEUE* MessageQueue; - FAST_MUTEX WindowListLock; LIST_ENTRY WindowListHead; LIST_ENTRY W32CallbackListHead; struct _KBDTABLES* KeyboardLayout; @@ -21,9 +20,7 @@ typedef struct _W32THREAD typedef struct _W32PROCESS { - FAST_MUTEX ClassListLock; LIST_ENTRY ClassListHead; - FAST_MUTEX MenuListLock; LIST_ENTRY MenuListHead; FAST_MUTEX PrivateFontListLock; LIST_ENTRY PrivateFontListHead; diff --git a/reactos/subsys/win32k/include/window.h b/reactos/subsys/win32k/include/window.h index 92220612b1a..dc0c1c9b4b4 100644 --- a/reactos/subsys/win32k/include/window.h +++ b/reactos/subsys/win32k/include/window.h @@ -67,8 +67,6 @@ typedef struct _WINDOW_OBJECT FAST_MUTEX UpdateLock; /* Pointer to the owning thread's message queue. */ PUSER_MESSAGE_QUEUE MessageQueue; - /* Lock for the list of child windows. */ - FAST_MUTEX RelativesLock; struct _WINDOW_OBJECT* FirstChild; struct _WINDOW_OBJECT* LastChild; struct _WINDOW_OBJECT* NextSibling; @@ -83,7 +81,6 @@ typedef struct _WINDOW_OBJECT PDCE Dce; /* Property list head.*/ LIST_ENTRY PropListHead; - FAST_MUTEX PropListLock; ULONG PropListItems; /* Scrollbar info */ PWINDOW_SCROLLINFO Scroll; @@ -148,18 +145,6 @@ typedef struct _WINDOW_OBJECT #define IntGetWndProcessId(WndObj) \ 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 IntGetProcessWindowObject(PW32THREAD Thread, HWND hWnd); diff --git a/reactos/subsys/win32k/main/dllmain.c b/reactos/subsys/win32k/main/dllmain.c index 3b77b979eb1..9e85e2a0a20 100644 --- a/reactos/subsys/win32k/main/dllmain.c +++ b/reactos/subsys/win32k/main/dllmain.c @@ -71,10 +71,8 @@ Win32kProcessCallback(struct _EPROCESS *Process, DPRINT("Creating W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql()); InitializeListHead(&Win32Process->ClassListHead); - ExInitializeFastMutex(&Win32Process->ClassListLock); InitializeListHead(&Win32Process->MenuListHead); - ExInitializeFastMutex(&Win32Process->MenuListLock); InitializeListHead(&Win32Process->PrivateFontListHead); ExInitializeFastMutex(&Win32Process->PrivateFontListLock); @@ -217,7 +215,6 @@ Win32kThreadCallback(struct _ETHREAD *Thread, Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout(); Win32Thread->MessagePumpHookValue = 0; InitializeListHead(&Win32Thread->WindowListHead); - ExInitializeFastMutex(&Win32Thread->WindowListLock); InitializeListHead(&Win32Thread->W32CallbackListHead); } else diff --git a/reactos/subsys/win32k/ntuser/class.c b/reactos/subsys/win32k/ntuser/class.c index 6a2ce6027f5..71bcdbac474 100644 --- a/reactos/subsys/win32k/ntuser/class.c +++ b/reactos/subsys/win32k/ntuser/class.c @@ -57,7 +57,6 @@ ClassReferenceClassByAtom( PLIST_ENTRY CurrentEntry; PW32PROCESS Process = PsGetWin32Process(); - IntLockProcessClasses(Process); CurrentEntry = Process->ClassListHead.Flink; while (CurrentEntry != &Process->ClassListHead) { @@ -67,7 +66,6 @@ ClassReferenceClassByAtom( { *Class = Current; ObmReferenceObject(Current); - IntUnLockProcessClasses(Process); return TRUE; } @@ -76,7 +74,6 @@ ClassReferenceClassByAtom( CurrentEntry = CurrentEntry->Flink; } - IntUnLockProcessClasses(Process); if (BestMatch != NULL) { @@ -369,7 +366,6 @@ IntCreateClass( } InitializeListHead(&ClassObject->ClassWindowsListHead); - ExInitializeFastMutex(&ClassObject->ClassWindowsListLock); return(ClassObject); } @@ -463,9 +459,8 @@ NtUserRegisterClassExWOW( DPRINT("Failed creating window class object\n"); RETURN((RTL_ATOM)0); } - IntLockProcessClasses(PsGetWin32Process()); + InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry); - IntUnLockProcessClasses(PsGetWin32Process()); RETURN(Atom); @@ -734,16 +729,13 @@ NtUserUnregisterClass( RETURN( FALSE); } - IntLockClassWindows(Class); if (!IsListEmpty(&Class->ClassWindowsListHead)) { - IntUnLockClassWindows(Class); /* Dereference the ClassReferenceClassByNameOrAtom() call */ ObmDereferenceObject(Class); SetLastWin32Error(ERROR_CLASS_HAS_WINDOWS); RETURN( FALSE); } - IntUnLockClassWindows(Class); /* Dereference the ClassReferenceClassByNameOrAtom() call */ ClassDereferenceObject(Class); diff --git a/reactos/subsys/win32k/ntuser/focus.c b/reactos/subsys/win32k/ntuser/focus.c index c4b134b6968..124d39fcbc2 100644 --- a/reactos/subsys/win32k/ntuser/focus.c +++ b/reactos/subsys/win32k/ntuser/focus.c @@ -126,19 +126,15 @@ IntFindChildWindowToOwner(PWINDOW_OBJECT Root, PWINDOW_OBJECT Owner) { HWND Ret; PWINDOW_OBJECT Child, OwnerWnd; - IntLockRelatives(Root); for(Child = Root->FirstChild; Child; Child = Child->NextSibling) { - IntLockRelatives(Child); OwnerWnd = IntGetWindowObject(Child->Owner); - IntUnLockRelatives(Child); if(!OwnerWnd) continue; if(OwnerWnd == Owner) { - IntUnLockRelatives(Root); Ret = Child->Self; IntReleaseWindowObject(OwnerWnd); return Ret; @@ -146,7 +142,6 @@ IntFindChildWindowToOwner(PWINDOW_OBJECT Root, PWINDOW_OBJECT Owner) IntReleaseWindowObject(OwnerWnd); } - IntUnLockRelatives(Root); return NULL; } diff --git a/reactos/subsys/win32k/ntuser/menu.c b/reactos/subsys/win32k/ntuser/menu.c index 25c7854a85b..f26fec030f7 100644 --- a/reactos/subsys/win32k/ntuser/menu.c +++ b/reactos/subsys/win32k/ntuser/menu.c @@ -228,15 +228,11 @@ IntDestroyMenuObject(PMENU_OBJECT MenuObject, NTSTATUS Status; /* remove all menu items */ - IntLockMenuItems(MenuObject); IntDeleteMenuItems(MenuObject, bRecurse); /* do not destroy submenus */ - IntUnLockMenuItems(MenuObject); if(RemoveFromProcess) { - IntLockProcessMenus((PW32PROCESS)MenuObject->Process->Win32Process); RemoveEntryList(&MenuObject->ListEntry); - IntUnLockProcessMenus((PW32PROCESS)MenuObject->Process->Win32Process); } Status = ObReferenceObjectByHandle(MenuObject->Process->Win32WindowStation, @@ -292,12 +288,9 @@ IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar) MenuObject->MenuInfo.MenuItemCount = 0; MenuObject->MenuItemList = NULL; - ExInitializeFastMutex(&MenuObject->MenuItemsLock); /* Insert menu item into process menu handle list */ - IntLockProcessMenus(PsGetWin32Process()); InsertTailList(&PsGetWin32Process()->MenuListHead, &MenuObject->ListEntry); - IntUnLockProcessMenus(PsGetWin32Process()); return MenuObject; } @@ -311,9 +304,6 @@ IntCloneMenuItems(PMENU_OBJECT Destination, PMENU_OBJECT Source) if(!Source->MenuInfo.MenuItemCount) return FALSE; - IntLockMenuItems(Destination); - IntLockMenuItems(Source); - MenuItem = Source->MenuItemList; while(MenuItem) { @@ -364,8 +354,6 @@ IntCloneMenuItems(PMENU_OBJECT Destination, PMENU_OBJECT Source) MenuItem = MenuItem->Next; } - IntUnLockMenuItems(Source); - IntUnLockMenuItems(Destination); return TRUE; } @@ -403,12 +391,9 @@ IntCloneMenu(PMENU_OBJECT Source) MenuObject->MenuInfo.MenuItemCount = 0; MenuObject->MenuItemList = NULL; - ExInitializeFastMutex(&MenuObject->MenuItemsLock); /* Insert menu item into process menu handle list */ - IntLockProcessMenus(PsGetWin32Process()); InsertTailList(&PsGetWin32Process()->MenuListHead, &MenuObject->ListEntry); - IntUnLockProcessMenus(PsGetWin32Process()); IntCloneMenuItems(MenuObject, Source); @@ -1156,15 +1141,10 @@ IntGetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT fByPos, UINT gmdiFlags, if(!SubMenuObject || (SubMenuObject == MenuObject)) break; - IntLockMenuItems(SubMenuObject); - IntUnLockMenuItems(MenuObject); - (*gismc)++; sres = IntGetMenuDefaultItem(SubMenuObject, fByPos, gmdiFlags, gismc); (*gismc)--; - IntUnLockMenuItems(SubMenuObject); - IntLockMenuItems(MenuObject); IntReleaseMenuObject(SubMenuObject); if(sres > (UINT)-1) @@ -1253,18 +1233,14 @@ IntCleanupMenus(struct _EPROCESS *Process, PW32PROCESS Win32Process) KeAttachProcess(&Process->Pcb); } - IntLockProcessMenus(Win32Process); while (Win32Process->MenuListHead.Flink != &(Win32Process->MenuListHead) && Win32Process->MenuListHead.Flink != LastHead) { LastHead = Win32Process->MenuListHead.Flink; MenuObject = CONTAINING_RECORD(Win32Process->MenuListHead.Flink, MENU_OBJECT, ListEntry); - IntUnLockProcessMenus(Win32Process); IntDestroyMenuObject(MenuObject, FALSE, TRUE); - IntLockProcessMenus(Win32Process); } - IntUnLockProcessMenus(Win32Process); if (CurrentProcess != Process) { @@ -1303,9 +1279,7 @@ NtUserBuildMenuItemList( if(Buffer) { - IntLockMenuItems(MenuObject); res = IntBuildMenuItemList(MenuObject, Buffer, nBufSize); - IntUnLockMenuItems(MenuObject); } else { @@ -1345,9 +1319,9 @@ NtUserCheckMenuItem( SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); RETURN( (DWORD)-1); } - IntLockMenuItems(MenuObject); + res = IntCheckMenuItem(MenuObject, uIDCheckItem, uCheck); - IntUnLockMenuItems(MenuObject); + IntReleaseMenuObject(MenuObject); RETURN( res); @@ -1524,9 +1498,9 @@ NtUserEnableMenuItem( SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); RETURN( res); } - IntLockMenuItems(MenuObject); + res = IntEnableMenuItem(MenuObject, uIDEnableItem, uEnable); - IntUnLockMenuItems(MenuObject); + IntReleaseMenuObject(MenuObject); RETURN( res); @@ -1578,9 +1552,8 @@ NtUserInsertMenuItem( RETURN( FALSE); } - IntLockMenuItems(MenuObject); Res = IntInsertMenuItem(MenuObject, uItem, fByPosition, &ItemInfo); - IntUnLockMenuItems(MenuObject); + IntReleaseMenuObject(MenuObject); RETURN( Res); @@ -1627,9 +1600,9 @@ NtUserGetMenuDefaultItem( SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); RETURN( res); } - IntLockMenuItems(MenuObject); + res = IntGetMenuDefaultItem(MenuObject, fByPos, gmdiFlags, &gismc); - IntUnLockMenuItems(MenuObject); + IntReleaseMenuObject(MenuObject); RETURN(res); @@ -1769,9 +1742,7 @@ NtUserHiliteMenuItem( } if(WindowObject->IDMenu == (UINT)hmenu) { - IntLockMenuItems(MenuObject); res = IntHiliteMenuItem(WindowObject, MenuObject, uItemHilite, uHilite); - IntUnLockMenuItems(MenuObject); } IntReleaseMenuObject(MenuObject); IntReleaseWindowObject(WindowObject); @@ -1914,7 +1885,6 @@ NtUserMenuItemFromPoint( Y -= WindowObject->WindowRect.top; IntReleaseWindowObject(WindowObject); - IntLockMenuItems(MenuObject); mi = MenuObject->MenuItemList; for (i = 0; NULL != mi; i++) { @@ -1924,7 +1894,6 @@ NtUserMenuItemFromPoint( } mi = mi->Next; } - IntUnLockMenuItems(MenuObject); IntReleaseMenuObject(MenuObject); @@ -2145,9 +2114,9 @@ UserSetMenuDefaultItem( SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); return( FALSE); } - IntLockMenuItems(MenuObject); + res = IntSetMenuDefaultItem(MenuObject, uItem, fByPos); - IntUnLockMenuItems(MenuObject); + IntReleaseMenuObject(MenuObject); return( res); @@ -2176,9 +2145,9 @@ NtUserSetMenuDefaultItem( SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); RETURN( FALSE); } - IntLockMenuItems(MenuObject); + res = IntSetMenuDefaultItem(MenuObject, uItem, fByPos); - IntUnLockMenuItems(MenuObject); + IntReleaseMenuObject(MenuObject); RETURN( res); diff --git a/reactos/subsys/win32k/ntuser/painting.c b/reactos/subsys/win32k/ntuser/painting.c index c792a0744bb..5f5d27dd4d3 100644 --- a/reactos/subsys/win32k/ntuser/painting.c +++ b/reactos/subsys/win32k/ntuser/painting.c @@ -559,7 +559,6 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread) return hWnd; } - IntLockRelatives(Window); for (Child = Window->FirstChild; Child; Child = Child->NextSibling) { if (IntIsWindowDirty(Child) && @@ -569,7 +568,6 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread) break; } } - IntUnLockRelatives(Window); if (hFoundWnd == NULL) { diff --git a/reactos/subsys/win32k/ntuser/prop.c b/reactos/subsys/win32k/ntuser/prop.c index 740d1fb2864..98f1c31d131 100644 --- a/reactos/subsys/win32k/ntuser/prop.c +++ b/reactos/subsys/win32k/ntuser/prop.c @@ -91,8 +91,6 @@ NtUserBuildPropList(HWND hWnd, } /* copy list */ - IntLockWindowProperties(WindowObject); - li = (PROPLISTITEM *)Buffer; ListEntry = WindowObject->PropListHead.Flink; while((BufferSize >= sizeof(PROPLISTITEM)) && (ListEntry != &WindowObject->PropListHead)) @@ -104,7 +102,6 @@ NtUserBuildPropList(HWND hWnd, Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM)); if(!NT_SUCCESS(Status)) { - IntUnLockWindowProperties(WindowObject); IntReleaseWindowObject(WindowObject); RETURN( Status); } @@ -115,13 +112,10 @@ NtUserBuildPropList(HWND hWnd, ListEntry = ListEntry->Flink; } - IntUnLockWindowProperties(WindowObject); } else { - IntLockWindowProperties(WindowObject); Cnt = WindowObject->PropListItems * sizeof(PROPLISTITEM); - IntUnLockWindowProperties(WindowObject); } IntReleaseWindowObject(WindowObject); @@ -160,12 +154,10 @@ NtUserRemoveProp(HWND hWnd, ATOM Atom) RETURN( NULL); } - IntLockWindowProperties(WindowObject); Prop = IntGetProp(WindowObject, Atom); if (Prop == NULL) { - IntUnLockWindowProperties(WindowObject); IntReleaseWindowObject(WindowObject); RETURN(NULL); } @@ -173,7 +165,6 @@ NtUserRemoveProp(HWND hWnd, ATOM Atom) RemoveEntryList(&Prop->PropListEntry); ExFreePool(Prop); WindowObject->PropListItems--; - IntUnLockWindowProperties(WindowObject); IntReleaseWindowObject(WindowObject); RETURN(Data); @@ -200,13 +191,11 @@ NtUserGetProp(HWND hWnd, ATOM Atom) RETURN( FALSE); } - IntLockWindowProperties(WindowObject); Prop = IntGetProp(WindowObject, Atom); if (Prop != NULL) { Data = Prop->Data; } - IntUnLockWindowProperties(WindowObject); IntReleaseWindowObject(WindowObject); RETURN(Data); @@ -256,9 +245,7 @@ NtUserSetProp(HWND hWnd, ATOM Atom, HANDLE Data) RETURN( FALSE); } - IntLockWindowProperties(WindowObject); ret = IntSetProp(WindowObject, Atom, Data); - IntUnLockWindowProperties(WindowObject); IntReleaseWindowObject(WindowObject); RETURN( ret); diff --git a/reactos/subsys/win32k/ntuser/vis.c b/reactos/subsys/win32k/ntuser/vis.c index c6187c9aa36..ae7a4905f43 100644 --- a/reactos/subsys/win32k/ntuser/vis.c +++ b/reactos/subsys/win32k/ntuser/vis.c @@ -92,7 +92,6 @@ VIS_ComputeVisibleRegion( if ((PreviousWindow->Style & WS_CLIPSIBLINGS) || (PreviousWindow == Window && ClipSiblings)) { - IntLockRelatives(CurrentWindow); CurrentSibling = CurrentWindow->FirstChild; while (CurrentSibling != NULL && CurrentSibling != PreviousWindow) { @@ -111,7 +110,6 @@ VIS_ComputeVisibleRegion( } CurrentSibling = CurrentSibling->NextSibling; } - IntUnLockRelatives(CurrentWindow); } PreviousWindow = CurrentWindow; @@ -121,7 +119,6 @@ VIS_ComputeVisibleRegion( if (ClipChildren) { - IntLockRelatives(Window); CurrentWindow = Window->FirstChild; while (CurrentWindow) { @@ -140,7 +137,6 @@ VIS_ComputeVisibleRegion( } CurrentWindow = CurrentWindow->NextSibling; } - IntUnLockRelatives(Window); } if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 16018dd5f5d..bec6e43fb8e 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -135,16 +135,12 @@ IntGetParent(PWINDOW_OBJECT Wnd) if (Wnd->Style & WS_POPUP) { - IntLockRelatives(Wnd); hWnd = Wnd->Owner; - IntUnLockRelatives(Wnd); return IntGetWindowObject(hWnd); } else if (Wnd->Style & WS_CHILD) { - IntLockRelatives(Wnd); hWnd = Wnd->Parent; - IntUnLockRelatives(Wnd); return IntGetWindowObject(hWnd); } @@ -156,9 +152,7 @@ IntGetOwner(PWINDOW_OBJECT Wnd) { HWND hWnd; - IntLockRelatives(Wnd); hWnd = Wnd->Owner; - IntUnLockRelatives(Wnd); return IntGetWindowObject(hWnd); } @@ -168,9 +162,7 @@ IntGetParentObject(PWINDOW_OBJECT Wnd) { HWND hParent; - IntLockRelatives(Wnd); hParent = Wnd->Parent; - IntUnLockRelatives(Wnd); return IntGetWindowObject(hParent); } @@ -191,8 +183,6 @@ IntWinListChildren(PWINDOW_OBJECT Window) HWND *List; UINT Index, NumChildren = 0; - IntLockRelatives(Window); - for (Child = Window->FirstChild; Child; Child = Child->NextSibling) ++NumChildren; @@ -200,7 +190,6 @@ IntWinListChildren(PWINDOW_OBJECT Window) if(!List) { DPRINT1("Failed to allocate memory for children array\n"); - IntUnLockRelatives(Window); SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); return NULL; } @@ -210,8 +199,6 @@ IntWinListChildren(PWINDOW_OBJECT Window) List[Index] = Child->Self; List[Index] = NULL; - IntUnLockRelatives(Window); - return List; } @@ -304,10 +291,8 @@ static LRESULT co_IntDestroyWindow(PWINDOW_OBJECT Window, ASSERT(Window); - IntLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread); if(Window->Status & WINDOWSTATUS_DESTROYING) { - IntUnLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread); DPRINT("Tried to call IntDestroyWindow() twice\n"); 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 in IntDestroyWindow() */ RemoveEntryList(&Window->ThreadListEntry); - IntUnLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread); BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData); @@ -368,10 +352,8 @@ static LRESULT co_IntDestroyWindow(PWINDOW_OBJECT Window, MsqRemoveWindowMessagesFromQueue(Window); /* from now on no messages can be sent to this window anymore */ - IntLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread); Window->Status |= WINDOWSTATUS_DESTROYED; /* don't remove the WINDOWSTATUS_DESTROYING bit */ - IntUnLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread); /* reset shell window handles */ if(ThreadData->Desktop) @@ -429,9 +411,7 @@ static LRESULT co_IntDestroyWindow(PWINDOW_OBJECT Window, IntDestroyScrollBars(Window); /* remove the window from the class object */ - IntLockClassWindows(Window->Class); RemoveEntryList(&Window->ClassListEntry); - IntUnLockClassWindows(Window->Class); /* dereference the class */ ClassDereferenceObject(Window->Class); @@ -577,7 +557,6 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread) Win32Thread = Thread->Tcb.Win32Thread; Win32Process = (PW32PROCESS)Thread->ThreadsProcess->Win32Process; - IntLockThreadWindows(Win32Thread); Current = Win32Thread->WindowListHead.Flink; while (Current != &(Win32Thread->WindowListHead)) { @@ -591,7 +570,6 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread) if(!List) { DPRINT("Not enough memory to allocate window handle list\n"); - IntUnLockThreadWindows(Win32Thread); return; } pWnd = List; @@ -603,7 +581,6 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread) pWnd++; Current = Current->Flink; } - IntUnLockThreadWindows(Win32Thread); *pWnd = NULL; for(pWnd = List; *pWnd; pWnd++) @@ -615,7 +592,6 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread) return; } - IntUnLockThreadWindows(Win32Thread); } @@ -861,7 +837,6 @@ IntLinkWindow( { PWINDOW_OBJECT Parent; - IntLockRelatives(Wnd); Wnd->Parent = WndParent->Self; if ((Wnd->PrevSibling = WndPrevSibling)) { @@ -870,10 +845,8 @@ IntLinkWindow( Wnd->NextSibling->PrevSibling = Wnd; else if ((Parent = IntGetWindowObject(Wnd->Parent))) { - IntLockRelatives(Parent); if(Parent->LastChild == WndPrevSibling) Parent->LastChild = Wnd; - IntUnLockRelatives(Parent); IntReleaseWindowObject(Parent); } Wnd->PrevSibling->NextSibling = Wnd; @@ -886,23 +859,18 @@ IntLinkWindow( Wnd->NextSibling->PrevSibling = Wnd; else if (Parent) { - IntLockRelatives(Parent); Parent->LastChild = Wnd; Parent->FirstChild = Wnd; - IntUnLockRelatives(Parent); IntReleaseWindowObject(Parent); - IntUnLockRelatives(Wnd); return; } if(Parent) { - IntLockRelatives(Parent); Parent->FirstChild = Wnd; - IntUnLockRelatives(Parent); IntReleaseWindowObject(Parent); } } - IntUnLockRelatives(Wnd); + } HWND FASTCALL @@ -915,7 +883,6 @@ IntSetOwner(HWND hWnd, HWND hWndNewOwner) if(!Wnd) return NULL; - IntLockRelatives(Wnd); WndOldOwner = IntGetWindowObject(Wnd->Owner); if (WndOldOwner) { @@ -935,7 +902,6 @@ IntSetOwner(HWND hWnd, HWND hWndNewOwner) else Wnd->Owner = NULL; - IntUnLockRelatives(Wnd); IntReleaseWindowObject(Wnd); return ret; } @@ -978,14 +944,12 @@ IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent) if (0 == (Wnd->ExStyle & WS_EX_TOPMOST)) { /* Not a TOPMOST window, put after TOPMOSTs of new parent */ - IntLockRelatives(WndNewParent); Sibling = WndNewParent->FirstChild; while (NULL != Sibling && 0 != (Sibling->ExStyle & WS_EX_TOPMOST)) { InsertAfter = Sibling; Sibling = Sibling->NextSibling; } - IntUnLockRelatives(WndNewParent); } if (NULL == InsertAfter) { @@ -1074,10 +1038,9 @@ IntUnlinkWindow(PWINDOW_OBJECT Wnd) { PWINDOW_OBJECT WndParent; - IntLockRelatives(Wnd); if((WndParent = IntGetWindowObject(Wnd->Parent))) { - IntLockRelatives(WndParent); + } if (Wnd->NextSibling) Wnd->NextSibling->PrevSibling = Wnd->PrevSibling; @@ -1088,11 +1051,9 @@ IntUnlinkWindow(PWINDOW_OBJECT Wnd) if(WndParent) { - IntUnLockRelatives(WndParent); IntReleaseWindowObject(WndParent); } Wnd->PrevSibling = Wnd->NextSibling = Wnd->Parent = NULL; - IntUnLockRelatives(Wnd); } BOOL FASTCALL @@ -1106,7 +1067,6 @@ IntAnyPopup(VOID) return FALSE; } - IntLockRelatives(Window); for(Child = Window->FirstChild; Child; Child = Child->NextSibling) { if(Child->Owner && Child->Style & WS_VISIBLE) @@ -1115,12 +1075,11 @@ IntAnyPopup(VOID) * The desktop has a popup window if one of them has * an owner window and is visible */ - IntUnLockRelatives(Window); IntReleaseWindowObject(Window); return TRUE; } } - IntUnLockRelatives(Window); + IntReleaseWindowObject(Window); return FALSE; } @@ -1183,7 +1142,6 @@ NtUserBuildHwndList( return 0; } - IntLockRelatives(Window); for(Child = Window->FirstChild; Child != NULL; Child = Child->NextSibling) { if(dwCount++ < nBufSize && pWnd) @@ -1196,7 +1154,6 @@ NtUserBuildHwndList( } } } - IntUnLockRelatives(Window); IntReleaseWindowObject(Window); } @@ -1221,7 +1178,6 @@ NtUserBuildHwndList( return 0; } - IntLockThreadWindows(W32Thread); Current = W32Thread->WindowListHead.Flink; while(Current != &(W32Thread->WindowListHead)) { @@ -1240,7 +1196,6 @@ NtUserBuildHwndList( dwCount++; Current = Current->Flink; } - IntUnLockThreadWindows(W32Thread); ObDereferenceObject(Thread); } @@ -1275,7 +1230,6 @@ NtUserBuildHwndList( return 0; } - IntLockRelatives(Window); for(Child = Window->FirstChild; Child != NULL; Child = Child->NextSibling) { if(dwCount++ < nBufSize && pWnd) @@ -1288,7 +1242,6 @@ NtUserBuildHwndList( } } } - IntUnLockRelatives(Window); IntReleaseWindowObject(Window); if(hDesktop) @@ -1561,9 +1514,8 @@ co_IntCreateWindowEx(DWORD dwExStyle, * Fill out the structure describing it. */ WindowObject->Class = ClassObject; - IntLockClassWindows(ClassObject); + InsertTailList(&ClassObject->ClassWindowsListHead, &WindowObject->ClassListEntry); - IntUnLockClassWindows(ClassObject); WindowObject->ExStyle = dwExStyle; WindowObject->Style = dwStyle & ~WS_VISIBLE; @@ -1626,8 +1578,6 @@ co_IntCreateWindowEx(DWORD dwExStyle, } InitializeListHead(&WindowObject->PropListHead); - ExInitializeFastMutex(&WindowObject->PropListLock); - ExInitializeFastMutex(&WindowObject->RelativesLock); ExInitializeFastMutex(&WindowObject->UpdateLock); InitializeListHead(&WindowObject->WndObjListHead); ExInitializeFastMutex(&WindowObject->WndObjListLock); @@ -1690,10 +1640,8 @@ co_IntCreateWindowEx(DWORD dwExStyle, } /* Insert the window into the thread's window list. */ - IntLockThreadWindows(PsGetWin32Thread()); InsertTailList (&PsGetWin32Thread()->WindowListHead, &WindowObject->ThreadListEntry); - IntUnLockThreadWindows(PsGetWin32Thread()); /* Allocate a DCE for this window. */ if (dwStyle & CS_OWNDC) @@ -1899,10 +1847,8 @@ co_IntCreateWindowEx(DWORD dwExStyle, if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) { PWINDOW_OBJECT PrevSibling; - IntLockRelatives(ParentWindow); if((PrevSibling = ParentWindow->LastChild)) IntReferenceWindowObject(PrevSibling); - IntUnLockRelatives(ParentWindow); /* link window as bottom sibling */ IntLinkWindow(WindowObject, ParentWindow, PrevSibling /*prev sibling*/); if(PrevSibling) @@ -1914,7 +1860,6 @@ co_IntCreateWindowEx(DWORD dwExStyle, PWINDOW_OBJECT InsertAfter, Sibling; if (0 == (dwExStyle & WS_EX_TOPMOST)) { - IntLockRelatives(ParentWindow); InsertAfter = NULL; Sibling = ParentWindow->FirstChild; while (NULL != Sibling && 0 != (Sibling->ExStyle & WS_EX_TOPMOST)) @@ -1922,7 +1867,6 @@ co_IntCreateWindowEx(DWORD dwExStyle, InsertAfter = Sibling; Sibling = Sibling->NextSibling; } - IntUnLockRelatives(ParentWindow); } else { @@ -2239,14 +2183,12 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window) Child = IntGetWindowObject(*ChildHandle); if (Child == NULL) continue; - IntLockRelatives(Child); if (Child->Owner != Window->Self) { - IntUnLockRelatives(Child); IntReleaseWindowObject(Child); continue; } - IntUnLockRelatives(Child); + if (IntWndBelongsToThread(Child, PsGetWin32Thread())) { co_UserDestroyWindow(Child); @@ -2254,12 +2196,12 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window) GotOne = TRUE; continue; } - IntLockRelatives(Child); + if (Child->Owner != NULL) { Child->Owner = NULL; } - IntUnLockRelatives(Child); + IntReleaseWindowObject(Child); } ExFreePool(Children); @@ -3273,10 +3215,9 @@ UserGetWindow(HWND hWnd, UINT Relationship) case GW_HWNDFIRST: if((Parent = IntGetParentObject(WindowObject))) { - IntLockRelatives(Parent); if (Parent->FirstChild) hWndResult = Parent->FirstChild->Self; - IntUnLockRelatives(Parent); + IntReleaseWindowObject(Parent); } break; @@ -3284,42 +3225,33 @@ UserGetWindow(HWND hWnd, UINT Relationship) case GW_HWNDLAST: if((Parent = IntGetParentObject(WindowObject))) { - IntLockRelatives(Parent); if (Parent->LastChild) hWndResult = Parent->LastChild->Self; - IntUnLockRelatives(Parent); + IntReleaseWindowObject(Parent); } break; case GW_HWNDNEXT: - IntLockRelatives(WindowObject); if (WindowObject->NextSibling) hWndResult = WindowObject->NextSibling->Self; - IntUnLockRelatives(WindowObject); break; case GW_HWNDPREV: - IntLockRelatives(WindowObject); if (WindowObject->PrevSibling) hWndResult = WindowObject->PrevSibling->Self; - IntUnLockRelatives(WindowObject); break; case GW_OWNER: - IntLockRelatives(WindowObject); if((Parent = IntGetWindowObject(WindowObject->Owner))) { hWndResult = Parent->Self; IntReleaseWindowObject(Parent); } - IntUnLockRelatives(WindowObject); break; case GW_CHILD: - IntLockRelatives(WindowObject); if (WindowObject->FirstChild) hWndResult = WindowObject->FirstChild->Self; - IntUnLockRelatives(WindowObject); break; } @@ -3428,9 +3360,7 @@ UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi) break; case GWL_HWNDPARENT: - IntLockRelatives(WindowObject); Parent = IntGetWindowObject(WindowObject->Parent); - IntUnLockRelatives(WindowObject); if(Parent) { if (Parent && Parent->Self == IntGetDesktopWindow()) diff --git a/reactos/subsys/win32k/ntuser/winpos.c b/reactos/subsys/win32k/ntuser/winpos.c index 0bb42d29b21..34e942b25da 100644 --- a/reactos/subsys/win32k/ntuser/winpos.c +++ b/reactos/subsys/win32k/ntuser/winpos.c @@ -165,17 +165,14 @@ co_WinPosActivateOtherWindow(PWINDOW_OBJECT Window) while (Wnd != NULL) { Old = Wnd; - IntLockRelatives(Old); if (Old->NextSibling == NULL) { Wnd = NULL; - IntUnLockRelatives(Old); if (Old != Window) IntReleaseWindowObject(Old); break; } Wnd = IntGetWindowObject(Old->NextSibling->Self); - IntUnLockRelatives(Old); if (Old != Window) IntReleaseWindowObject(Old); 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.bottom += MoveY; - IntLockRelatives(Window); for(Child = Window->FirstChild; Child; Child = Child->NextSibling) { 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) { InsertAfterWindow = NULL; - IntLockRelatives(ParentWindow); Sibling = ParentWindow->FirstChild; 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); } - IntUnLockRelatives(ParentWindow); } else if (WinPos.hwndInsertAfter == HWND_BOTTOM) { - IntLockRelatives(ParentWindow); if(ParentWindow->LastChild) { IntReferenceWindowObject(ParentWindow->LastChild); @@ -981,7 +973,6 @@ co_WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx, } else InsertAfterWindow = NULL; - IntUnLockRelatives(ParentWindow); } else InsertAfterWindow = IntGetWindowObject(WinPos.hwndInsertAfter);