remove user handle table lock, cursor locks, message queue locks, hook lock
authorGunnar Dalsnes <hardon@online.no>
Mon, 5 Sep 2005 23:11:41 +0000 (23:11 +0000)
committerGunnar Dalsnes <hardon@online.no>
Mon, 5 Sep 2005 23:11:41 +0000 (23:11 +0000)
svn path=/trunk/; revision=17685

14 files changed:
reactos/subsys/win32k/include/cursoricon.h
reactos/subsys/win32k/include/hook.h
reactos/subsys/win32k/include/msgqueue.h
reactos/subsys/win32k/include/object.h
reactos/subsys/win32k/misc/object.c
reactos/subsys/win32k/ntuser/cursoricon.c
reactos/subsys/win32k/ntuser/focus.c
reactos/subsys/win32k/ntuser/hook.c
reactos/subsys/win32k/ntuser/input.c
reactos/subsys/win32k/ntuser/message.c
reactos/subsys/win32k/ntuser/msgqueue.c
reactos/subsys/win32k/ntuser/painting.c
reactos/subsys/win32k/ntuser/window.c
reactos/subsys/win32k/ntuser/winsta.c

index 29dca57..642b559 100644 (file)
@@ -13,7 +13,6 @@ typedef struct _CURICON_OBJECT
 {
   LIST_ENTRY ListEntry;
   HANDLE Self;
-  FAST_MUTEX Lock;
   LIST_ENTRY ProcessList;
   HMODULE hModule;
   HRSRC hRsrc;
@@ -37,7 +36,6 @@ typedef struct _SYSTEM_CURSORINFO
   BOOL Enabled;
   BOOL SwapButtons;
   UINT ButtonsDown;
-  FAST_MUTEX CursorMutex;
   CURSORCLIP_INFO CursorClipInfo;
   PCURICON_OBJECT CurrentCursorObject;
   BYTE ShowingCursor;
@@ -64,12 +62,6 @@ BOOL FASTCALL IntGetCursorLocation(PWINSTATION_OBJECT WinStaObject, POINT *loc);
 #define IntReleaseCurIconObject(CurIconObj) \
   ObmDereferenceObject(CurIconObj)
 
-#define IntLockProcessCursorIcons(W32Process) \
-  ExAcquireFastMutex(&W32Process->CursorIconListLock)
-
-#define IntUnLockProcessCursorIcons(W32Process) \
-  ExReleaseFastMutex(&W32Process->CursorIconListLock)
-
 #endif /* _WIN32K_CURSORICON_H */
 
 /* EOF */
index 4e7342f..e0f6376 100644 (file)
@@ -19,7 +19,6 @@ typedef struct tagHOOK
 
 typedef struct tagHOOKTABLE
 {
-  FAST_MUTEX Lock;
   LIST_ENTRY Hooks[NB_HOOKS];  /* array of hook chains */
   UINT       Counts[NB_HOOKS]; /* use counts for each hook chain */
 } HOOKTABLE, *PHOOKTABLE;
@@ -27,12 +26,6 @@ typedef struct tagHOOKTABLE
 LRESULT FASTCALL co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam);
 VOID FASTCALL HOOK_DestroyThreadHooks(PETHREAD Thread);
 
-#define IntLockHookTable(HookTable) \
-  ExAcquireFastMutex(&HookTable->Lock)
-
-#define IntUnLockHookTable(HookTable) \
-  ExReleaseFastMutex(&HookTable->Lock)
-
 #endif /* _WIN32K_HOOK_H */
 
 /* EOF */
index 987d8e9..534d75b 100644 (file)
@@ -67,8 +67,6 @@ typedef struct _USER_MESSAGE_QUEUE
   LIST_ENTRY TimerListHead;
   /* Lock for the hardware message list. */
   KMUTEX HardwareLock;
-  /* Lock for the queue. */
-  FAST_MUTEX Lock;
   /* Pointer to the current WM_MOUSEMOVE message */
   PUSER_MESSAGE MouseMoveMsg;
   /* True if a WM_QUIT message is pending. */
@@ -216,12 +214,6 @@ LPARAM FASTCALL MsqSetMessageExtraInfo(LPARAM lParam);
 LPARAM FASTCALL MsqGetMessageExtraInfo(VOID);
 VOID STDCALL MsqRemoveWindowMessagesFromQueue(PVOID pWindow); /* F*(&$ headers, will be gone in the rewrite! */
 
-#define IntLockMessageQueue(MsgQueue) \
-  ExAcquireFastMutex(&(MsgQueue)->Lock)
-
-#define IntUnLockMessageQueue(MsgQueue) \
-  ExReleaseFastMutex(&(MsgQueue)->Lock)
-
 #define IntLockHardwareMessageQueue(MsgQueue) \
   KeWaitForMutexObject(&(MsgQueue)->HardwareLock, UserRequest, KernelMode, FALSE, NULL)
 
index 8562290..11deca8 100644 (file)
@@ -43,16 +43,9 @@ typedef struct _USER_HANDLE_BLOCK
 typedef struct _USER_HANDLE_TABLE
 {
    LIST_ENTRY ListHead;
-   FAST_MUTEX ListLock;
 } USER_HANDLE_TABLE, *PUSER_HANDLE_TABLE;
 
 
-#define ObmpLockHandleTable(HandleTable) \
-  ExAcquireFastMutex(&HandleTable->ListLock)
-
-#define ObmpUnlockHandleTable(HandleTable) \
-  ExReleaseFastMutex(&HandleTable->ListLock)
-
 ULONG FASTCALL
 ObmGetReferenceCount(
   PVOID ObjectBody);
index f4194ff..3b66810 100644 (file)
@@ -111,8 +111,6 @@ ObmpCloseAllHandles(PUSER_HANDLE_TABLE HandleTable)
   PVOID ObjectBody;
   ULONG i;
 
-  ObmpLockHandleTable(HandleTable);
-
   CurrentEntry = HandleTable->ListHead.Flink;
 
   while (CurrentEntry != &HandleTable->ListHead)
@@ -131,11 +129,8 @@ ObmpCloseAllHandles(PUSER_HANDLE_TABLE HandleTable)
              ObjectHeader->HandleCount--;
              Current->Handles[i].ObjectBody = NULL;
 
-             ObmpUnlockHandleTable(HandleTable);
-
              ObmDereferenceObject(ObjectBody);
 
-             ObmpLockHandleTable(HandleTable);
              CurrentEntry = &HandleTable->ListHead;
              break;
            }
@@ -144,7 +139,6 @@ ObmpCloseAllHandles(PUSER_HANDLE_TABLE HandleTable)
       CurrentEntry = CurrentEntry->Flink;
     }
 
-  ObmpUnlockHandleTable(HandleTable);
 }
 
 VOID FASTCALL
@@ -177,13 +171,10 @@ ObmpDeleteHandle(PUSER_HANDLE_TABLE HandleTable,
   PUSER_HANDLE Entry;
   PVOID ObjectBody;
 
-  ObmpLockHandleTable(HandleTable);
-
   Entry = ObmpGetObjectByHandle(HandleTable, Handle);
   if (Entry == NULL)
     {
       DPRINT1("Invalid handle\n");
-      ObmpUnlockHandleTable(HandleTable);
       return NULL;
     }
 
@@ -197,8 +188,6 @@ ObmpDeleteHandle(PUSER_HANDLE_TABLE HandleTable,
       Entry->ObjectBody = NULL;
     }
 
-  ObmpUnlockHandleTable(HandleTable);
-
   return ObjectBody;
 }
 
@@ -372,8 +361,6 @@ ObmCreateHandle(PUSER_HANDLE_TABLE HandleTable,
       USER_BODY_TO_HEADER(ObjectBody)->HandleCount++;
     }
 
-  ObmpLockHandleTable(HandleTable);
-
   Handle = 1;
   Current = HandleTable->ListHead.Flink;
   /*
@@ -390,7 +377,6 @@ ObmCreateHandle(PUSER_HANDLE_TABLE HandleTable,
          if (!Block->Handles[i].ObjectBody)
            {
              Block->Handles[i].ObjectBody = ObjectBody;
-             ObmpUnlockHandleTable(HandleTable);
              *HandleReturn = (HANDLE)((Handle + i) << 2);
              return STATUS_SUCCESS;
            }
@@ -415,7 +401,6 @@ ObmCreateHandle(PUSER_HANDLE_TABLE HandleTable,
   RtlZeroMemory(NewBlock, sizeof(USER_HANDLE_BLOCK));
   NewBlock->Handles[0].ObjectBody = ObjectBody;
   InsertTailList(&HandleTable->ListHead, &NewBlock->ListEntry);
-  ObmpUnlockHandleTable(HandleTable);
   *HandleReturn = (HANDLE)(Handle << 2);
 
   return STATUS_SUCCESS;
@@ -441,21 +426,16 @@ ObmReferenceObjectByHandle(PUSER_HANDLE_TABLE HandleTable,
   PUSER_HANDLE UserHandle;
   PVOID ObjectBody;
 
-  ObmpLockHandleTable(HandleTable);
-
   UserHandle = ObmpGetObjectByHandle(HandleTable, Handle);
 
   if ((UserHandle == NULL) || (UserHandle->ObjectBody == NULL))
     {
-      ObmpUnlockHandleTable(HandleTable);
       return STATUS_UNSUCCESSFUL;
     }
 
   ObjectBody = UserHandle->ObjectBody;
   ObmReferenceObjectByPointer(ObjectBody, ObjectType);
 
-  ObmpUnlockHandleTable(HandleTable);
-
   ObjectHeader = USER_BODY_TO_HEADER(ObjectBody);
 
   if ((ObjectType != otUnknown) && (ObjectHeader->Type != ObjectType))
@@ -491,7 +471,6 @@ VOID FASTCALL
 ObmInitializeHandleTable(PUSER_HANDLE_TABLE HandleTable)
 {
   InitializeListHead(&HandleTable->ListHead);
-  ExInitializeFastMutex(&HandleTable->ListLock);
 }
 
 VOID FASTCALL
index a99d816..3af19a7 100644 (file)
@@ -43,7 +43,6 @@
 
 static PAGED_LOOKASIDE_LIST ProcessLookasideList;
 static LIST_ENTRY CurIconList;
-static FAST_MUTEX CurIconListLock;
 
 /* Look up the location of the cursor in the GDIDEVICE structure
  * when all we know is the window station object
@@ -305,7 +304,6 @@ IntSetupCurIconHandles(PWINSTATION_OBJECT WinStaObject)
                                 0,
                                 128);
   InitializeListHead(&CurIconList);
-  ExInitializeFastMutex(&CurIconListLock);
 
   return TRUE;
 }
@@ -328,7 +326,6 @@ ReferenceCurIconByProcess(PCURICON_OBJECT Object)
 
   Win32Process = PsGetWin32Process();
 
-  ExAcquireFastMutex(&Object->Lock);
   Search = Object->ProcessList.Flink;
   while (Search != &Object->ProcessList)
     {
@@ -336,7 +333,6 @@ ReferenceCurIconByProcess(PCURICON_OBJECT Object)
       if (Current->Process == Win32Process)
         {
           /* Already registered for this process */
-          ExReleaseFastMutex(&Object->Lock);
           return TRUE;
         }
       Search = Search->Flink;
@@ -351,7 +347,6 @@ ReferenceCurIconByProcess(PCURICON_OBJECT Object)
   InsertHeadList(&Object->ProcessList, &Current->ListEntry);
   Current->Process = Win32Process;
 
-  ExReleaseFastMutex(&Object->Lock);
   return TRUE;
 }
 
@@ -362,8 +357,6 @@ IntFindExistingCurIconObject(PWINSTATION_OBJECT WinStaObject, HMODULE hModule,
   PLIST_ENTRY CurrentEntry;
   PCURICON_OBJECT Object;
 
-  ExAcquireFastMutex(&CurIconListLock);
-
   CurrentEntry = CurIconList.Flink;
   while (CurrentEntry != &CurIconList)
   {
@@ -380,18 +373,15 @@ IntFindExistingCurIconObject(PWINSTATION_OBJECT WinStaObject, HMODULE hModule,
         }
         if (! ReferenceCurIconByProcess(Object))
         {
-          ExReleaseFastMutex(&CurIconListLock);
           return NULL;
         }
-        ExReleaseFastMutex(&CurIconListLock);
+
         return Object;
       }
     }
     ObmDereferenceObject(Object);
   }
 
-  ExReleaseFastMutex(&CurIconListLock);
-
   return NULL;
 }
 
@@ -410,7 +400,6 @@ IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject)
   }
 
   Object->Self = Handle;
-  ExInitializeFastMutex(&Object->Lock);
   InitializeListHead(&Object->ProcessList);
 
   if (! ReferenceCurIconByProcess(Object))
@@ -421,9 +410,7 @@ IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject)
     return NULL;
   }
 
-  ExAcquireFastMutex(&CurIconListLock);
   InsertHeadList(&CurIconList, &Object->ListEntry);
-  ExReleaseFastMutex(&CurIconListLock);
 
   ObmDereferenceObject(Object);
 
@@ -440,8 +427,6 @@ IntDestroyCurIconObject(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT Object,
   PCURICON_PROCESS Current = NULL;
   PW32PROCESS W32Process = PsGetWin32Process();
 
-  ExAcquireFastMutex(&Object->Lock);
-
   /* Private objects can only be destroyed by their own process */
   if (NULL == Object->hModule)
     {
@@ -449,14 +434,12 @@ IntDestroyCurIconObject(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT Object,
     Current = CONTAINING_RECORD(Object->ProcessList.Flink, CURICON_PROCESS, ListEntry);
     if (Current->Process != W32Process)
       {
-        ExReleaseFastMutex(&Object->Lock);
         DPRINT1("Trying to destroy private icon/cursor of another process\n");
         return FALSE;
       }
     }
   else if (! ProcessCleanup)
     {
-      ExReleaseFastMutex(&Object->Lock);
       DPRINT("Trying to destroy shared icon/cursor\n");
       return FALSE;
     }
@@ -480,17 +463,13 @@ IntDestroyCurIconObject(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT Object,
   /* If there are still processes referencing this object we can't destroy it yet */
   if (! IsListEmpty(&Object->ProcessList))
     {
-    ExReleaseFastMutex(&Object->Lock);
     return TRUE;
     }
 
-  ExReleaseFastMutex(&Object->Lock);
 
   if (! ProcessCleanup)
     {
-    ExAcquireFastMutex(&CurIconListLock);
     RemoveEntryList(&Object->ListEntry);
-    ExReleaseFastMutex(&CurIconListLock);
     }
 
   CurInfo = IntGetSysCursorInfo(WinStaObject);
@@ -536,8 +515,6 @@ IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process)
     return;
   }
 
-  ExAcquireFastMutex(&CurIconListLock);
-
   CurrentEntry = CurIconList.Flink;
   while (CurrentEntry != &CurIconList)
   {
@@ -545,29 +522,23 @@ IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process)
     CurrentEntry = CurrentEntry->Flink;
     if(NT_SUCCESS(ObmReferenceObjectByPointer(Object, otCursorIcon)))
       {
-      ExAcquireFastMutex(&Object->Lock);
       ProcessEntry = Object->ProcessList.Flink;
       while (ProcessEntry != &Object->ProcessList)
       {
         ProcessData = CONTAINING_RECORD(ProcessEntry, CURICON_PROCESS, ListEntry);
         if (Win32Process == ProcessData->Process)
         {
-          ExReleaseFastMutex(&Object->Lock);
           RemoveEntryList(&Object->ListEntry);
           IntDestroyCurIconObject(WinStaObject, Object, TRUE);
           break;
         }
         ProcessEntry = ProcessEntry->Flink;
       }
-      if (ProcessEntry == &Object->ProcessList)
-      {
-        ExReleaseFastMutex(&Object->Lock);
-      }
+
       ObmDereferenceObject(Object);
     }
   }
 
-  ExReleaseFastMutex(&CurIconListLock);
   ObDereferenceObject(WinStaObject);
 }
 
index 124d39f..653f9f8 100644 (file)
@@ -190,18 +190,15 @@ co_IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWin
    co_IntSendKillFocusMessages(hWndFocusPrev, hWndFocus);
 
    IntSetFocusMessageQueue(Window->MessageQueue);
-   IntLockMessageQueue(Window->MessageQueue);
    if (Window->MessageQueue)
    {
       Window->MessageQueue->ActiveWindow = hWnd;
    }
-   IntUnLockMessageQueue(Window->MessageQueue);
-   IntLockMessageQueue(FocusWindow->MessageQueue);
+
    if (FocusWindow->MessageQueue)
    {
       FocusWindow->MessageQueue->FocusWindow = hWndFocus;
    }
-   IntUnLockMessageQueue(FocusWindow->MessageQueue);
 
    if (PrevForegroundQueue != Window->MessageQueue)
    {
@@ -299,9 +296,7 @@ co_IntSetActiveWindow(PWINDOW_OBJECT Window)
 
    /* FIXME: Call hooks. */
 
-   IntLockMessageQueue(ThreadQueue);
    ThreadQueue->ActiveWindow = hWnd;
-   IntUnLockMessageQueue(ThreadQueue);
 
    co_IntSendDeactivateMessages(hWndPrev, hWnd);
    co_IntSendActivateMessages(hWndPrev, hWnd, FALSE);
@@ -326,9 +321,7 @@ co_IntSetFocusWindow(HWND hWnd)
       return hWndPrev;
    }
 
-   IntLockMessageQueue(ThreadQueue);
    ThreadQueue->FocusWindow = hWnd;
-   IntUnLockMessageQueue(ThreadQueue);
 
    co_IntSendKillFocusMessages(hWndPrev, hWnd);
    co_IntSendSetFocusMessages(hWndPrev, hWnd);
@@ -499,9 +492,7 @@ NtUserSetCapture(HWND hWnd)
    }
 
    co_IntPostOrSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
-   IntLockMessageQueue(ThreadQueue);
    ThreadQueue->CaptureWindow = hWnd;
-   IntUnLockMessageQueue(ThreadQueue);
 
    RETURN( hWndPrev);
    
index 40e2477..0147de4 100644 (file)
@@ -48,7 +48,6 @@ IntAllocHookTable(void)
   Table = ExAllocatePoolWithTag(PagedPool, sizeof(HOOKTABLE), TAG_HOOK);
   if (NULL != Table)
     {
-      ExInitializeFastMutex(&Table->Lock);
       for (i = 0; i < NB_HOOKS; i++)
         {
           InitializeListHead(&Table->Hooks[i]);
@@ -96,9 +95,7 @@ IntAddHook(PETHREAD Thread, int HookId, BOOLEAN Global, PWINSTATION_OBJECT WinSt
   Hook->HookId = HookId;
   RtlInitUnicodeString(&Hook->ModuleName, NULL);
 
-  IntLockHookTable(Table);
   InsertHeadList(&Table->Hooks[HOOKID_TO_INDEX(HookId)], &Hook->Chain);
-  IntUnLockHookTable(Table);
 
   return Hook;
 }
@@ -132,7 +129,6 @@ IntGetFirstValidHook(PHOOKTABLE Table, int HookId)
   PHOOK Hook;
   PLIST_ENTRY Elem;
 
-  IntLockHookTable(Table);
   Hook = IntGetFirstHook(Table, HookId);
   while (NULL != Hook && NULL == Hook->Proc)
     {
@@ -140,7 +136,6 @@ IntGetFirstValidHook(PHOOKTABLE Table, int HookId)
       Hook = (Elem == &Table->Hooks[HOOKID_TO_INDEX(HookId)]
               ? NULL : CONTAINING_RECORD(Elem, HOOK, Chain));
     }
-  IntUnLockHookTable(Table);
 
   return Hook;
 }
@@ -153,18 +148,15 @@ IntGetNextHook(PHOOK Hook)
   int HookId = Hook->HookId;
   PLIST_ENTRY Elem;
 
-  IntLockHookTable(Table);
   Elem = Hook->Chain.Flink;
   while (Elem != &Table->Hooks[HOOKID_TO_INDEX(HookId)])
     {
       Hook = CONTAINING_RECORD(Elem, HOOK, Chain);
       if (NULL != Hook->Proc)
         {
-          IntUnLockHookTable(Table);
           return Hook;
         }
     }
-  IntUnLockHookTable(Table);
 
   if (NULL != GlobalHooks && Table != GlobalHooks)  /* now search through the global table */
     {
@@ -203,10 +195,6 @@ IntRemoveHook(PHOOK Hook, PWINSTATION_OBJECT WinStaObj, BOOL TableAlreadyLocked)
       return;
     }
 
-  if (! TableAlreadyLocked)
-    {
-      IntLockHookTable(Table);
-    }
   if (0 != Table->Counts[HOOKID_TO_INDEX(Hook->HookId)])
     {
       Hook->Proc = NULL; /* chain is in use, just mark it and return */
@@ -215,10 +203,6 @@ IntRemoveHook(PHOOK Hook, PWINSTATION_OBJECT WinStaObj, BOOL TableAlreadyLocked)
     {
       IntFreeHook(Table, Hook, WinStaObj);
     }
-  if (! TableAlreadyLocked)
-    {
-      IntUnLockHookTable(Table);
-    }
 }
 
 /* release a hook chain, removing deleted hooks if the use count drops to 0 */
@@ -233,12 +217,10 @@ IntReleaseHookChain(PHOOKTABLE Table, int HookId, PWINSTATION_OBJECT WinStaObj)
       return;
     }
 
-  IntLockHookTable(Table);
   /* use count shouldn't already be 0 */
   ASSERT(0 != Table->Counts[HOOKID_TO_INDEX(HookId)]);
   if (0 == Table->Counts[HOOKID_TO_INDEX(HookId)])
     {
-      IntUnLockHookTable(Table);
       return;
     }
   if (0 == --Table->Counts[HOOKID_TO_INDEX(HookId)])
@@ -254,7 +236,6 @@ IntReleaseHookChain(PHOOKTABLE Table, int HookId, PWINSTATION_OBJECT WinStaObj)
             }
         }
     }
-  IntUnLockHookTable(Table);
 }
 
 static LRESULT FASTCALL
@@ -316,14 +297,10 @@ co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
       return 0;
     }
 
-  IntLockHookTable(Table);
   Table->Counts[HOOKID_TO_INDEX(HookId)]++;
-  IntUnLockHookTable(Table);
   if (Table != GlobalHooks && GlobalHooks != NULL)
     {
-      IntLockHookTable(GlobalHooks);
       GlobalHooks->Counts[HOOKID_TO_INDEX(HookId)]++;
-      IntUnLockHookTable(GlobalHooks);
     }
 
   Result = co_IntCallHookProc(HookId, Code, wParam, lParam, Hook->Proc,
@@ -369,7 +346,7 @@ HOOK_DestroyThreadHooks(PETHREAD Thread)
           DPRINT1("Invalid window station????\n");
           return;
         }
-      IntLockHookTable(GlobalHooks);
+
       for (HookId = WH_MINHOOK; HookId <= WH_MAXHOOK; HookId++)
         {
           /* only low-level keyboard/mouse global hooks can be owned by a thread */
@@ -390,7 +367,7 @@ HOOK_DestroyThreadHooks(PETHREAD Thread)
               break;
             }
         }
-      IntUnLockHookTable(GlobalHooks);
+
       ObDereferenceObject(WinStaObj);
     }
 }
index faee188..6987121 100644 (file)
@@ -930,7 +930,6 @@ IntMouseInput(MOUSEINPUT *mi)
   SwapButtons = CurInfo->SwapButtons;
   DoMove = FALSE;
 
-  ExAcquireFastMutex(&CurInfo->CursorMutex);
   IntGetCursorLocation(WinSta, &MousePos);
   OrgPos.x = MousePos.x;
   OrgPos.y = MousePos.y;
@@ -981,8 +980,6 @@ IntMouseInput(MOUSEINPUT *mi)
     DoMove = (MousePos.x != OrgPos.x || MousePos.y != OrgPos.y);
   }
 
-  ExReleaseFastMutex(&CurInfo->CursorMutex);
-
   if (DoMove)
   {
     dc = DC_LockDc(hDC);
index 9c9c4ed..e5e97db 100644 (file)
@@ -1745,16 +1745,12 @@ NtUserGetQueueStatus(BOOL ClearChanges)
 
    Queue = PsGetWin32Thread()->MessageQueue;
 
-   IntLockMessageQueue(Queue);
-
    Result = MAKELONG(Queue->QueueBits, Queue->ChangedBits);
    if (ClearChanges)
    {
       Queue->ChangedBits = 0;
    }
 
-   IntUnLockMessageQueue(Queue);
-
    RETURN( Result);
    
 CLEANUP:
index 23c292f..6610f31 100644 (file)
@@ -77,10 +77,8 @@ IntMsqSetWakeMask(DWORD WakeMask)
     return 0;
 
   MessageQueue = Win32Thread->MessageQueue;
-  IntLockMessageQueue(MessageQueue);
   MessageQueue->WakeMask = WakeMask;
   MessageEventHandle = MessageQueue->NewMessagesHandle;
-  IntUnLockMessageQueue(MessageQueue);
 
   return MessageEventHandle;
 }
@@ -96,9 +94,7 @@ IntMsqClearWakeMask(VOID)
     return FALSE;
 
   MessageQueue = Win32Thread->MessageQueue;
-  IntLockMessageQueue(MessageQueue);
   MessageQueue->WakeMask = ~0;
-  IntUnLockMessageQueue(MessageQueue);
 
   return TRUE;
 }
@@ -106,26 +102,22 @@ IntMsqClearWakeMask(VOID)
 VOID FASTCALL
 MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue)
 {
-  IntLockMessageQueue(Queue);
   Queue->PaintCount++;
   Queue->PaintPosted = TRUE;
   Queue->QueueBits |= QS_PAINT;
   Queue->ChangedBits |= QS_PAINT;
   if (Queue->WakeMask & QS_PAINT)
     KeSetEvent(Queue->NewMessages, IO_NO_INCREMENT, FALSE);
-  IntUnLockMessageQueue(Queue);
 }
 
 VOID FASTCALL
 MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue)
 {
-  IntLockMessageQueue(Queue);
   Queue->PaintCount--;
   if (Queue->PaintCount == 0)
     {
       Queue->PaintPosted = FALSE;
     }
-  IntUnLockMessageQueue(Queue);
 }
 
 
@@ -760,12 +752,9 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
   ObmDereferenceObject(Window);
   ObDereferenceObject (Thread);
 
-//  IntLockMessageQueue(pThread->MessageQueue);
 //  InsertHeadList(&pThread->MessageQueue->PostedMessagesListHead,
 //              &Message->ListEntry);
 //  KeSetEvent(pThread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
-//  IntUnLockMessageQueue(pThread->MessageQueue);
-
 }
 
 PUSER_MESSAGE FASTCALL
@@ -797,13 +786,11 @@ co_MsqDispatchSentNotifyMessages(PUSER_MESSAGE_QUEUE MessageQueue)
   PLIST_ENTRY ListEntry;
   PUSER_SENT_MESSAGE_NOTIFY Message;
 
-  IntLockMessageQueue(MessageQueue);
   while (!IsListEmpty(&MessageQueue->SentMessagesListHead))
   {
     ListEntry = RemoveHeadList(&MessageQueue->SentMessagesListHead);
     Message = CONTAINING_RECORD(ListEntry, USER_SENT_MESSAGE_NOTIFY,
                                ListEntry);
-    IntUnLockMessageQueue(MessageQueue);
 
     co_IntCallSentMessageCallback(Message->CompletionCallback,
                                Message->hWnd,
@@ -811,9 +798,8 @@ co_MsqDispatchSentNotifyMessages(PUSER_MESSAGE_QUEUE MessageQueue)
                                Message->CompletionCallbackContext,
                                Message->Result);
 
-    IntLockMessageQueue(MessageQueue);
   }
-  IntUnLockMessageQueue(MessageQueue);
+
 }
 
 BOOLEAN FASTCALL
@@ -831,10 +817,8 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
   BOOL SenderReturned;
   PUSER_SENT_MESSAGE_NOTIFY NotifyMessage;
 
-  IntLockMessageQueue(MessageQueue);
   if (IsListEmpty(&MessageQueue->SentMessagesListHead))
     {
-      IntUnLockMessageQueue(MessageQueue);
       return(FALSE);
     }
 
@@ -847,8 +831,6 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
   InsertTailList(&MessageQueue->LocalDispatchingMessagesHead,
                 &Message->ListEntry);
 
-  IntUnLockMessageQueue(MessageQueue);
-
   if (Message->HookMessage)
     {
       Result = co_HOOK_CallHooks(Message->Msg.message,
@@ -867,13 +849,9 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
 
   /* remove the message from the local dispatching list, because it doesn't need
      to be cleaned up on thread termination anymore */
-  IntLockMessageQueue(MessageQueue);
   RemoveEntryList(&Message->ListEntry);
-  IntUnLockMessageQueue(MessageQueue);
 
   /* remove the message from the dispatching list, so lock the sender's message queue */
-  IntLockMessageQueue(Message->SenderQueue);
-
   SenderReturned = (Message->DispatchingListEntry.Flink == NULL);
   if(!SenderReturned)
   {
@@ -895,9 +873,6 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
       KeSetEvent(Message->CompletionEvent, IO_NO_INCREMENT, FALSE);
     }
 
-  /* unlock the sender's message queue, the safe operation is done */
-  IntUnLockMessageQueue(Message->SenderQueue);
-
   /* Notify the sender if they specified a callback. */
   if (!SenderReturned && Message->CompletionCallback != NULL)
     {
@@ -942,8 +917,6 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow)
   MessageQueue = Window->MessageQueue;
   ASSERT(MessageQueue);
 
-  IntLockMessageQueue(MessageQueue);
-
   /* remove the posted messages for this window */
   CurrentEntry = MessageQueue->PostedMessagesListHead.Flink;
   ListHead = &MessageQueue->PostedMessagesListHead;
@@ -973,7 +946,6 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow)
                                       ListEntry);
       if(SentMessage->Msg.hwnd == Window->Self)
       {
-        IntLockMessageQueue(SentMessage->SenderQueue);
         DPRINT("Notify the sender and remove a message from the queue that had not been dispatched\n");
 
         /* remove the message from the dispatching list */
@@ -987,7 +959,6 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow)
         {
           KeSetEvent(SentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
         }
-        IntUnLockMessageQueue(SentMessage->SenderQueue);
 
         /* dereference our and the sender's message queue */
         IntDereferenceMessageQueue(MessageQueue);
@@ -1003,21 +974,18 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow)
         CurrentEntry = CurrentEntry->Flink;
       }
     }
-  IntUnLockMessageQueue(MessageQueue);
 }
 
 VOID FASTCALL
 MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue,
                     PUSER_SENT_MESSAGE_NOTIFY NotifyMessage)
 {
-  IntLockMessageQueue(MessageQueue);
   InsertTailList(&MessageQueue->NotifyMessagesListHead,
                 &NotifyMessage->ListEntry);
   MessageQueue->QueueBits |= QS_SENDMESSAGE;
   MessageQueue->ChangedBits |= QS_SENDMESSAGE;
   if (MessageQueue->WakeMask & QS_SENDMESSAGE)
     KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
-  IntUnLockMessageQueue(MessageQueue);
 }
 
 NTSTATUS FASTCALL
@@ -1064,14 +1032,10 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
   IntReferenceMessageQueue(MessageQueue);
 
   /* add it to the list of pending messages */
-  IntLockMessageQueue(ThreadQueue);
   InsertTailList(&ThreadQueue->DispatchingMessagesHead, &Message->DispatchingListEntry);
-  IntUnLockMessageQueue(ThreadQueue);
 
   /* queue it in the destination's message queue */
-  IntLockMessageQueue(MessageQueue);
   InsertTailList(&MessageQueue->SentMessagesListHead, &Message->ListEntry);
-  IntUnLockMessageQueue(MessageQueue);
 
   MessageQueue->QueueBits |= QS_SENDMESSAGE;
   MessageQueue->ChangedBits |= QS_SENDMESSAGE;
@@ -1095,7 +1059,6 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
       {
         /* look up if the message has not yet dispatched, if so
            make sure it can't pass a result and it must not set the completion event anymore */
-       IntLockMessageQueue(MessageQueue);
         Entry = MessageQueue->SentMessagesListHead.Flink;
         while (Entry != &MessageQueue->SentMessagesListHead)
           {
@@ -1110,11 +1073,9 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
               }
             Entry = Entry->Flink;
           }
-        IntUnLockMessageQueue(MessageQueue);
 
        /* remove from the local dispatching list so the other thread knows,
           it can't pass a result and it must not set the completion event anymore */
-       IntLockMessageQueue(ThreadQueue);
         Entry = ThreadQueue->DispatchingMessagesHead.Flink;
         while (Entry != &ThreadQueue->DispatchingMessagesHead)
           {
@@ -1133,7 +1094,6 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
               }
             Entry = Entry->Flink;
           }
-       IntUnLockMessageQueue(ThreadQueue);
 
        DPRINT("MsqSendMessage (blocked) timed out\n");
       }
@@ -1159,7 +1119,6 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
           {
             /* look up if the message has not yet been dispatched, if so
                make sure it can't pass a result and it must not set the completion event anymore */
-           IntLockMessageQueue(MessageQueue);
             Entry = MessageQueue->SentMessagesListHead.Flink;
             while (Entry != &MessageQueue->SentMessagesListHead)
               {
@@ -1174,11 +1133,9 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
                   }
                 Entry = Entry->Flink;
               }
-           IntUnLockMessageQueue(MessageQueue);
 
            /* remove from the local dispatching list so the other thread knows,
               it can't pass a result and it must not set the completion event anymore */
-           IntLockMessageQueue(ThreadQueue);
             Entry = ThreadQueue->DispatchingMessagesHead.Flink;
             while (Entry != &ThreadQueue->DispatchingMessagesHead)
               {
@@ -1197,7 +1154,6 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
                   }
                 Entry = Entry->Flink;
               }
-           IntUnLockMessageQueue(ThreadQueue);
 
            DPRINT("MsqSendMessage timed out\n");
             break;
@@ -1223,27 +1179,23 @@ MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg, BOOLEAN FreeLParam,
   {
     return;
   }
-  IntLockMessageQueue(MessageQueue);
   InsertTailList(&MessageQueue->PostedMessagesListHead,
                 &Message->ListEntry);
   MessageQueue->QueueBits |= MessageBits;
   MessageQueue->ChangedBits |= MessageBits;
   if (MessageQueue->WakeMask & MessageBits)
     KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
-  IntUnLockMessageQueue(MessageQueue);
 }
 
 VOID FASTCALL
 MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode)
 {
-  IntLockMessageQueue(MessageQueue);
   MessageQueue->QuitPosted = TRUE;
   MessageQueue->QuitExitCode = ExitCode;
   MessageQueue->QueueBits |= QS_POSTMESSAGE;
   MessageQueue->ChangedBits |= QS_POSTMESSAGE;
   if (MessageQueue->WakeMask & QS_POSTMESSAGE)
     KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
-  IntUnLockMessageQueue(MessageQueue);
 }
 
 BOOLEAN STDCALL
@@ -1266,7 +1218,6 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
                                    Remove, Message));
     }
 
-  IntLockMessageQueue(MessageQueue);
   CurrentEntry = MessageQueue->PostedMessagesListHead.Flink;
   ListHead = &MessageQueue->PostedMessagesListHead;
   while (CurrentEntry != ListHead)
@@ -1282,13 +1233,13 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
            {
              RemoveEntryList(&CurrentMessage->ListEntry);
            }
-         IntUnLockMessageQueue(MessageQueue);
+
          *Message = CurrentMessage;
          return(TRUE);
        }
       CurrentEntry = CurrentEntry->Flink;
     }
-  IntUnLockMessageQueue(MessageQueue);
+
   return(FALSE);
 }
 
@@ -1350,7 +1301,6 @@ MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQu
   InitializeListHead(&MessageQueue->DispatchingMessagesHead);
   InitializeListHead(&MessageQueue->LocalDispatchingMessagesHead);
   KeInitializeMutex(&MessageQueue->HardwareLock, 0);
-  ExInitializeFastMutex(&MessageQueue->Lock);
   MessageQueue->QuitPosted = FALSE;
   MessageQueue->QuitExitCode = 0;
   KeQueryTickCount(&LargeTickCount);
@@ -1389,8 +1339,6 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
   PTIMER_ENTRY CurrentTimer;
   PUSER_SENT_MESSAGE CurrentSentMessage;
 
-  IntLockMessageQueue(MessageQueue);
-
   /* cleanup posted messages */
   while (!IsListEmpty(&MessageQueue->PostedMessagesListHead))
     {
@@ -1407,7 +1355,6 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
       CurrentSentMessage = CONTAINING_RECORD(CurrentEntry, USER_SENT_MESSAGE,
                                              ListEntry);
 
-      IntLockMessageQueue(CurrentSentMessage->SenderQueue);
       DPRINT("Notify the sender and remove a message from the queue that had not been dispatched\n");
 
       /* remove the message from the dispatching list */
@@ -1421,7 +1368,6 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
       {
         KeSetEvent(CurrentSentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
       }
-      IntUnLockMessageQueue(CurrentSentMessage->SenderQueue);
 
       /* dereference our and the sender's message queue */
       IntDereferenceMessageQueue(MessageQueue);
@@ -1447,7 +1393,6 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
       CurrentSentMessage = CONTAINING_RECORD(CurrentEntry, USER_SENT_MESSAGE,
                                              ListEntry);
 
-      IntLockMessageQueue(CurrentSentMessage->SenderQueue);
       /* remove the message from the dispatching list */
       if(CurrentSentMessage->DispatchingListEntry.Flink != NULL)
       {
@@ -1461,7 +1406,6 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
       {
         KeSetEvent(CurrentSentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
       }
-      IntUnLockMessageQueue(CurrentSentMessage->SenderQueue);
       
       /* dereference our and the sender's message queue */
       IntDereferenceMessageQueue(MessageQueue);
@@ -1484,7 +1428,6 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
          locked later */
     }
 
-  IntUnLockMessageQueue(MessageQueue);
 }
 
 PUSER_MESSAGE_QUEUE FASTCALL
@@ -1698,14 +1641,12 @@ MsqSetTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd,
   DPRINT("MsqSetTimer queue %p wnd %x id %p period %u timerproc %p msg %d\n",
          MessageQueue, Wnd, IDEvent, Period, TimerFunc, Msg);
 
-  IntLockMessageQueue(MessageQueue);
   Timer = RemoveTimer(MessageQueue, Wnd, IDEvent, Msg);
   if (NULL == Timer)
     {
       Timer = ExAllocateFromPagedLookasideList(&TimerLookasideList);
       if (NULL == Timer)
         {
-          IntUnLockMessageQueue(MessageQueue);
           DPRINT1("Failed to allocate timer entry\n");
           return FALSE;
         }
@@ -1733,8 +1674,6 @@ MsqSetTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd,
   DumpTimerList(MessageQueue);
 #endif /* ! defined(NDEBUG) */
 
-  IntUnLockMessageQueue(MessageQueue);
-
   return TRUE;
 }
 
@@ -1747,7 +1686,6 @@ MsqKillTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd,
   DPRINT("MsqKillTimer queue %p wnd %x id %p msg %d\n",
          MessageQueue, Wnd, IDEvent, Msg);
 
-  IntLockMessageQueue(MessageQueue);
   Timer = RemoveTimer(MessageQueue, Wnd, IDEvent, Msg);
 
   if (NULL == Timer)
@@ -1763,8 +1701,6 @@ MsqKillTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd,
   DumpTimerList(MessageQueue);
 #endif /* ! defined(NDEBUG) */
 
-  IntUnLockMessageQueue(MessageQueue);
-
   return NULL != Timer;
 }
 
@@ -1781,7 +1717,6 @@ MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue,
   DPRINT("MsqGetTimerMessage queue %p msg %p restart %s\n",
          MessageQueue, Msg, Restart ? "TRUE" : "FALSE");
 
-  IntLockMessageQueue(MessageQueue);
   KeQuerySystemTime(&CurrentTime);
   DPRINT("Current time %I64d\n", CurrentTime.QuadPart);
   EnumEntry = MessageQueue->TimerListHead.Flink;
@@ -1820,7 +1755,6 @@ MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue,
   if (! GotMessage)
     {
       DPRINT("No timer pending\n");
-      IntUnLockMessageQueue(MessageQueue);
       return FALSE;
     }
 
@@ -1842,8 +1776,6 @@ MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue,
 #endif /* ! defined(NDEBUG) */
     }
 
-  IntUnLockMessageQueue(MessageQueue);
-
   DPRINT("Created message wnd %x msg %d wParam %u lParam %u\n", Msg->hwnd, Msg->message,
          Msg->wParam, Msg->lParam);
 
@@ -1858,7 +1790,6 @@ MsqRemoveTimersWindow(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd)
 
   DPRINT("MsqRemoveTimersWindow queue %p wnd %x\n", MessageQueue, Wnd);
 
-  IntLockMessageQueue(MessageQueue);
   EnumEntry = MessageQueue->TimerListHead.Flink;
   while (EnumEntry != &MessageQueue->TimerListHead)
     {
@@ -1876,7 +1807,6 @@ MsqRemoveTimersWindow(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd)
   DumpTimerList(MessageQueue);
 #endif /* ! defined(NDEBUG) */
 
-  IntUnLockMessageQueue(MessageQueue);
 }
 
 BOOLEAN FASTCALL
@@ -1890,7 +1820,6 @@ MsqGetFirstTimerExpiry(PUSER_MESSAGE_QUEUE MessageQueue,
   DPRINT("MsqGetFirstTimerExpiry queue %p wndfilter %x msgfiltermin %d msgfiltermax %d expiry %p\n",
          MessageQueue, WndFilter, MsgFilterMin, MsgFilterMax, FirstTimerExpiry);
 
-  IntLockMessageQueue(MessageQueue);
   EnumEntry = MessageQueue->TimerListHead.Flink;
   while (EnumEntry != &MessageQueue->TimerListHead)
     {
@@ -1904,13 +1833,10 @@ MsqGetFirstTimerExpiry(PUSER_MESSAGE_QUEUE MessageQueue,
         {
           *FirstTimerExpiry = Timer->ExpiryTime;
           DPRINT("First timer expires %I64d\n", Timer->ExpiryTime);
-          IntUnLockMessageQueue(MessageQueue);
           return TRUE;
         }
     }
 
-  IntUnLockMessageQueue(MessageQueue);
-
   return FALSE;
 }
 
index 5f5d27d..aeef735 100644 (file)
@@ -616,10 +616,8 @@ IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax,
       if (NULL == hWnd)
       {
          DPRINT1("PAINTING BUG: Thread marked as containing dirty windows, but no dirty windows found!\n");
-         IntLockMessageQueue(MessageQueue);
          MessageQueue->PaintPosted = 0;
          MessageQueue->PaintCount = 0;
-         IntUnLockMessageQueue(MessageQueue);
       }
       return FALSE;
    }
index bec6e43..f2c1b5d 100644 (file)
@@ -2123,14 +2123,14 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
           co_WinPosActivateOtherWindow(Window);
         }
     }
-  IntLockMessageQueue(Window->MessageQueue);
+
   if (Window->MessageQueue->ActiveWindow == Window->Self)
     Window->MessageQueue->ActiveWindow = NULL;
   if (Window->MessageQueue->FocusWindow == Window->Self)
     Window->MessageQueue->FocusWindow = NULL;
   if (Window->MessageQueue->CaptureWindow == Window->Self)
     Window->MessageQueue->CaptureWindow = NULL;
-  IntUnLockMessageQueue(Window->MessageQueue);
+
   IntDereferenceMessageQueue(Window->MessageQueue);
   /* Call hooks */
 #if 0 /* FIXME */
index a62fa78..fd2020c 100644 (file)
@@ -549,7 +549,6 @@ NtUserCreateWindowStation(
 
    InitHotKeys(WindowStationObject);
 
-   ExInitializeFastMutex(&CurInfo->CursorMutex);
    CurInfo->Enabled = FALSE;
    CurInfo->ButtonsDown = 0;
    CurInfo->CursorClipInfo.IsClipped = FALSE;