don't crash if no thread desktop set
authorThomas Bluemel <thomas@reactsoft.com>
Thu, 29 Apr 2004 20:41:03 +0000 (20:41 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Thu, 29 Apr 2004 20:41:03 +0000 (20:41 +0000)
svn path=/trunk/; revision=9246

reactos/subsys/win32k/ntuser/input.c

index 087b722..bbf7170 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: input.c,v 1.28 2004/04/29 20:26:35 weiden Exp $
+/* $Id: input.c,v 1.29 2004/04/29 20:41:03 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -477,7 +477,7 @@ IntBlockInput(PW32THREAD W32Thread, BOOL BlockIt)
   PW32THREAD OldBlock;
   ASSERT(W32Thread);
   
-  if(W32Thread->IsExiting && BlockIt)
+  if(!W32Thread->Desktop || (W32Thread->IsExiting && BlockIt))
   {
     /*
      * fail blocking if exiting the thread
@@ -541,8 +541,17 @@ NtUserSendInput(
   LPINPUT pInput,
   INT cbSize)
 {
+  PW32THREAD W32Thread;
   UINT cnt;
   
+  W32Thread = PsGetWin32Thread();
+  ASSERT(W32Thread);
+  
+  if(!W32Thread->Desktop)
+  {
+    return 0;
+  }
+  
   if(!nInputs || !pInput || (cbSize != sizeof(INPUT)))
   {
     SetLastWin32Error(ERROR_INVALID_PARAMETER);
@@ -554,7 +563,7 @@ NtUserSendInput(
    *         e.g. services running in the service window station cannot block input
    */
   if(!ThreadHasInputAccess(W32Thread) ||
-     !IntIsActiveDesktop(PsGetWin32Thread()->Desktop))
+     !IntIsActiveDesktop(W32Thread->Desktop))
   {
     SetLastWin32Error(ERROR_ACCESS_DENIED);
     return 0;