Commit in reactos on MAIN
include/win32k/ntuser.h+6-61.127 -> 1.128
lib/user32/misc/stubs.c+1-341.58 -> 1.59
lib/user32/windows/input.c+56-71.23 -> 1.24
ntoskrnl/include/internal/ex.h+31.34 -> 1.35
subsys/win32k/include/desktop.h+31.4 -> 1.5
                     /input.h+61.6 -> 1.7
subsys/win32k/main/dllmain.c+2-11.68 -> 1.69
subsys/win32k/ntuser/input.c+131-11.27 -> 1.28
                    /stubs.c+1-241.44 -> 1.45
+209-73
9 modified files
implemented keybd_event(), mouse_event(), BlockInput() and SendInput() - the server side however isn't implemented yet

reactos/include/win32k
ntuser.h 1.127 -> 1.128
diff -u -r1.127 -r1.128
--- ntuser.h	25 Apr 2004 20:05:29 -0000	1.127
+++ ntuser.h	29 Apr 2004 20:26:34 -0000	1.128
@@ -72,10 +72,10 @@
   DWORD Unknown6,
   DWORD Unknown7);
 
-DWORD
+BOOL
 STDCALL
 NtUserBlockInput(
-  DWORD Unknown0);
+  BOOL BlockIt);
 
 ULONG
 STDCALL
@@ -1152,12 +1152,12 @@
 NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect,
    const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags);
 
-DWORD
+UINT
 STDCALL
 NtUserSendInput(
-  DWORD Unknown0,
-  DWORD Unknown1,
-  DWORD Unknown2);
+  UINT nInputs,
+  LPINPUT pInput,
+  INT cbSize);
 
 typedef struct tagNTUSERSENDMESSAGEINFO
 {

reactos/lib/user32/misc
stubs.c 1.58 -> 1.59
diff -u -r1.58 -r1.59
--- stubs.c	9 Apr 2004 20:03:14 -0000	1.58
+++ stubs.c	29 Apr 2004 20:26:35 -0000	1.59
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.58 2004/04/09 20:03:14 navaraf Exp $
+/* $Id: stubs.c,v 1.59 2004/04/29 20:26:35 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -250,39 +250,6 @@
   return 0;
 }
 
-
-/*
- * @unimplemented
- */
-VOID
-STDCALL
-keybd_event(
-	    BYTE bVk,
-	    BYTE bScan,
-	    DWORD dwFlags,
-	    DWORD dwExtraInfo)
-
-
-{
-  UNIMPLEMENTED
-}
-
-
-/*
- * @unimplemented
- */
-VOID
-STDCALL
-mouse_event(
-	    DWORD dwFlags,
-	    DWORD dx,
-	    DWORD dy,
-	    DWORD cButtons,
-	    DWORD dwExtraInfo)
-{
-  UNIMPLEMENTED
-}
-
 /******************************************************************************
  * SetDebugErrorLevel [USER32.@]
  * Sets the minimum error level for generating debugging events

reactos/lib/user32/windows
input.c 1.23 -> 1.24
diff -u -r1.23 -r1.24
--- input.c	26 Jan 2004 08:44:51 -0000	1.23
+++ input.c	29 Apr 2004 20:26:35 -0000	1.24
@@ -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.23 2004/01/26 08:44:51 weiden Exp $
+/* $Id: input.c,v 1.24 2004/04/29 20:26:35 weiden Exp $
  *
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/input.c
@@ -62,13 +62,12 @@
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 BOOL STDCALL
 BlockInput(BOOL fBlockIt)
 {
-  UNIMPLEMENTED;
-  return FALSE;
+  return NtUserBlockInput(fBlockIt);
 }
 
 
@@ -526,7 +525,7 @@
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 UINT
 STDCALL
@@ -535,8 +534,7 @@
   LPINPUT pInputs,
   int cbSize)
 {
-  UNIMPLEMENTED;
-  return 0;
+  return NtUserSendInput(nInputs, pInputs, cbSize);
 }
 
 /*
@@ -559,4 +557,55 @@
   NtUserAcquireOrReleaseInputOwnership(Release);
 }
 
+/*
+ * @implemented
+ */
+VOID
+STDCALL
+keybd_event(
+	    BYTE bVk,
+	    BYTE bScan,
+	    DWORD dwFlags,
+	    ULONG_PTR dwExtraInfo)
+
+
+{
+  INPUT Input;
+  
+  Input.type = INPUT_KEYBOARD;
+  Input.ki.wVk = bVk;
+  Input.ki.wScan = bScan;
+  Input.ki.dwFlags = dwFlags;
+  Input.ki.time = 0;
+  Input.ki.dwExtraInfo = dwExtraInfo;
+  
+  NtUserSendInput(1, &Input, sizeof(INPUT));
+}
+
+
+/*
+ * @implemented
+ */
+VOID
+STDCALL
+mouse_event(
+	    DWORD dwFlags,
+	    DWORD dx,
+	    DWORD dy,
+	    DWORD dwData,
+	    ULONG_PTR dwExtraInfo)
+{
+  INPUT Input;
+  
+  Input.type = INPUT_MOUSE;
+  Input.mi.dx = dx;
+  Input.mi.dy = dy;
+  Input.mi.mouseData = dwData;
+  Input.mi.dwFlags = dwFlags;
+  Input.mi.time = 0;
+  Input.mi.dwExtraInfo = dwExtraInfo;
+  
+  NtUserSendInput(1, &Input, sizeof(INPUT));
+}
+
 /* EOF */

reactos/ntoskrnl/include/internal
ex.h 1.34 -> 1.35
diff -u -r1.34 -r1.35
--- ex.h	14 Apr 2004 07:11:20 -0000	1.34
+++ ex.h	29 Apr 2004 20:26:35 -0000	1.35
@@ -59,6 +59,7 @@
   UINT CaretBlinkRate;
   HANDLE ShellWindow;
   HANDLE ShellListView;
+  BOOL DesktopLocked;
   struct _DESKTOP_OBJECT* ActiveDesktop;
   /* FIXME: Clipboard */
   LIST_ENTRY HotKeyListHead;
@@ -87,6 +88,8 @@
   /* Handle of the desktop window. */
   HANDLE DesktopWindow;
   HANDLE PrevActiveWindow;
+  /* Thread blocking input */
+  PVOID BlockInputThread;
 } DESKTOP_OBJECT, *PDESKTOP_OBJECT;
 
 

reactos/subsys/win32k/include
desktop.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- desktop.h	26 Dec 2003 00:58:33 -0000	1.4
+++ desktop.h	29 Apr 2004 20:26:35 -0000	1.5
@@ -46,6 +46,9 @@
 NTSTATUS FASTCALL
 IntHideDesktop(PDESKTOP_OBJECT Desktop);
 
+#define IntIsActiveDesktop(Desktop) \
+  ((Desktop)->WindowStation->ActiveDesktop == (Desktop))
+
 #endif /* _WIN32K_DESKTOP_H */
 
 /* EOF */

reactos/subsys/win32k/include
input.h 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- input.h	24 Nov 2003 00:22:53 -0000	1.6
+++ input.h	29 Apr 2004 20:26:35 -0000	1.7
@@ -10,5 +10,11 @@
 PUSER_MESSAGE_QUEUE W32kGetPrimitiveMessageQueue(VOID);
 PKBDTABLES W32kGetDefaultKeyLayout(VOID);
 VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyLayout);
+BOOL FASTCALL IntBlockInput(PW32THREAD W32Thread, BOOL BlockIt);
+BOOL FASTCALL IntMouseInput(MOUSEINPUT *mi);
+BOOL FASTCALL IntKeyboardInput(KEYBDINPUT *ki);
+
+#define ThreadHasInputAccess(W32Thread) \
+  (TRUE)
 
 #endif /* _WIN32K_INPUT_H */

reactos/subsys/win32k/main
dllmain.c 1.68 -> 1.69
diff -u -r1.68 -r1.69
--- dllmain.c	9 Apr 2004 20:03:18 -0000	1.68
+++ dllmain.c	29 Apr 2004 20:26:35 -0000	1.69
@@ -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: dllmain.c,v 1.68 2004/04/09 20:03:18 navaraf Exp $
+/* $Id: dllmain.c,v 1.69 2004/04/29 20:26:35 weiden Exp $
  *
  *  Entry Point for win32k.sys
  */
@@ -199,6 +199,7 @@
       RemoveTimersThread(Thread->Cid.UniqueThread);
       UnregisterThreadHotKeys(Thread);
       DestroyThreadWindows(Thread);
+      IntBlockInput(Win32Thread, FALSE);
     }
 
   return STATUS_SUCCESS;

reactos/subsys/win32k/ntuser
input.c 1.27 -> 1.28
diff -u -r1.27 -r1.28
--- input.c	10 Feb 2004 18:11:12 -0000	1.27
+++ input.c	29 Apr 2004 20:26:35 -0000	1.28
@@ -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.27 2004/02/10 18:11:12 navaraf Exp $
+/* $Id: input.c,v 1.28 2004/04/29 20:26:35 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -31,6 +31,7 @@
 
 #include <ddk/ntddk.h>
 #include <win32k/win32k.h>
+#include <internal/safe.h>
 #include <include/class.h>
 #include <include/error.h>
 #include <include/winsta.h>
@@ -470,4 +471,133 @@
   return 0;
 }
 
+BOOL FASTCALL
+IntBlockInput(PW32THREAD W32Thread, BOOL BlockIt)
+{
+  PW32THREAD OldBlock;
+  ASSERT(W32Thread);
+  
+  if(W32Thread->IsExiting && BlockIt)
+  {
+    /*
+     * fail blocking if exiting the thread
+     */
+    
+    return FALSE;
+  }
+  
+  /*
+   * FIXME - check access rights of the window station
+   *         e.g. services running in the service window station cannot block input
+   */
+  if(!ThreadHasInputAccess(W32Thread) ||
+     !IntIsActiveDesktop(W32Thread->Desktop))
+  {
+    SetLastWin32Error(ERROR_ACCESS_DENIED);
+    return FALSE;
+  }
+  
+  ASSERT(W32Thread->Desktop);
+  OldBlock = W32Thread->Desktop->BlockInputThread;
+  if(OldBlock)
+  {
+    if(OldBlock != W32Thread)
+    {
+      SetLastWin32Error(ERROR_ACCESS_DENIED);
+      return FALSE;
+    }
+    W32Thread->Desktop->BlockInputThread = (BlockIt ? W32Thread : NULL);
+    return OldBlock == NULL;
+  }
+  
+  W32Thread->Desktop->BlockInputThread = (BlockIt ? W32Thread : NULL);
+  return OldBlock == NULL;
+}
+
+BOOL
+STDCALL
+NtUserBlockInput(
+  BOOL BlockIt)
+{
+  return IntBlockInput(PsGetWin32Thread(), BlockIt);
+}
+
+BOOL FASTCALL
+IntMouseInput(MOUSEINPUT *mi)
+{
+  return FALSE;
+}
+
+BOOL FASTCALL
+IntKeyboardInput(KEYBDINPUT *ki)
+{
+  return FALSE;
+}
+
+UINT
+STDCALL
+NtUserSendInput(
+  UINT nInputs,
+  LPINPUT pInput,
+  INT cbSize)
+{
+  UINT cnt;
+  
+  if(!nInputs || !pInput || (cbSize != sizeof(INPUT)))
+  {
+    SetLastWin32Error(ERROR_INVALID_PARAMETER);
+    return 0;
+  }
+  
+  /*
+   * FIXME - check access rights of the window station
+   *         e.g. services running in the service window station cannot block input
+   */
+  if(!ThreadHasInputAccess(W32Thread) ||
+     !IntIsActiveDesktop(PsGetWin32Thread()->Desktop))
+  {
+    SetLastWin32Error(ERROR_ACCESS_DENIED);
+    return 0;
+  }
+  
+  cnt = 0;
+  while(nInputs--)
+  {
+    INPUT SafeInput;
+    NTSTATUS Status;
+    
+    Status = MmCopyFromCaller(&SafeInput, pInput++, sizeof(INPUT));
+    if(!NT_SUCCESS(Status))
+    {
+      SetLastNtError(Status);
+      return cnt;
+    }
+    
+    switch(SafeInput.type)
+    {
+      case INPUT_MOUSE:
+        if(IntMouseInput(&SafeInput.mi))
+        {
+          cnt++;
+        }
+        break;
+      case INPUT_KEYBOARD:
+        if(IntKeyboardInput(&SafeInput.ki))
+        {
+          cnt++;
+        }
+        break;
+      case INPUT_HARDWARE:
+        break;
+#ifndef NDEBUG
+      default:
+        DPRINT1("SendInput(): Invalid input type: 0x%x\n", SafeInput.type);
+        break;
+#endif
+    }
+  }
+  
+  return cnt;
+}
+
 /* EOF */

reactos/subsys/win32k/ntuser
stubs.c 1.44 -> 1.45
diff -u -r1.44 -r1.45
--- stubs.c	24 Jan 2004 08:26:25 -0000	1.44
+++ stubs.c	29 Apr 2004 20:26:35 -0000	1.45
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.44 2004/01/24 08:26:25 ekohl Exp $
+/* $Id: stubs.c,v 1.45 2004/04/29 20:26:35 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -56,17 +56,6 @@
 
 DWORD
 STDCALL
-NtUserBlockInput(
-  DWORD Unknown0)
-{
-  UNIMPLEMENTED
-
-  return 0;
-}
-
-
-DWORD
-STDCALL
 NtUserCallHwnd(
   DWORD Unknown0,
   DWORD Unknown1)
@@ -611,18 +600,6 @@
 
 DWORD
 STDCALL
-NtUserSendInput(
-  DWORD Unknown0,
-  DWORD Unknown1,
-  DWORD Unknown2)
-{
-  UNIMPLEMENTED
-
-  return 0;
-}
-
-DWORD
-STDCALL
 NtUserSetConsoleReserveKeys(
   DWORD Unknown0,
   DWORD Unknown1)
CVSspam 0.2.8