mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
implemented keybd_event(), mouse_event(), BlockInput() and SendInput() - the server side however isn't implemented yet
svn path=/trunk/; revision=9245
This commit is contained in:
parent
ed9f67afe7
commit
ddcbbf2e8d
9 changed files with 209 additions and 73 deletions
|
@ -72,10 +72,10 @@ NtUserBitBltSysBmp(
|
||||||
DWORD Unknown6,
|
DWORD Unknown6,
|
||||||
DWORD Unknown7);
|
DWORD Unknown7);
|
||||||
|
|
||||||
DWORD
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserBlockInput(
|
NtUserBlockInput(
|
||||||
DWORD Unknown0);
|
BOOL BlockIt);
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
STDCALL
|
STDCALL
|
||||||
|
@ -1152,12 +1152,12 @@ DWORD STDCALL
|
||||||
NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect,
|
NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect,
|
||||||
const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags);
|
const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags);
|
||||||
|
|
||||||
DWORD
|
UINT
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserSendInput(
|
NtUserSendInput(
|
||||||
DWORD Unknown0,
|
UINT nInputs,
|
||||||
DWORD Unknown1,
|
LPINPUT pInput,
|
||||||
DWORD Unknown2);
|
INT cbSize);
|
||||||
|
|
||||||
typedef struct tagNTUSERSENDMESSAGEINFO
|
typedef struct tagNTUSERSENDMESSAGEINFO
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
|
@ -250,39 +250,6 @@ WaitForInputIdle(
|
||||||
return 0;
|
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.@]
|
* SetDebugErrorLevel [USER32.@]
|
||||||
* Sets the minimum error level for generating debugging events
|
* Sets the minimum error level for generating debugging events
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -62,13 +62,12 @@ ActivateKeyboardLayout(HKL hkl,
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
BlockInput(BOOL fBlockIt)
|
BlockInput(BOOL fBlockIt)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
return NtUserBlockInput(fBlockIt);
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -526,7 +525,7 @@ VkKeyScanW(WCHAR ch)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
UINT
|
UINT
|
||||||
STDCALL
|
STDCALL
|
||||||
|
@ -535,8 +534,7 @@ SendInput(
|
||||||
LPINPUT pInputs,
|
LPINPUT pInputs,
|
||||||
int cbSize)
|
int cbSize)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
return NtUserSendInput(nInputs, pInputs, cbSize);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -559,4 +557,55 @@ PrivateCsrssAcquireOrReleaseInputOwnership(BOOL Release)
|
||||||
NtUserAcquireOrReleaseInputOwnership(Release);
|
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 */
|
/* EOF */
|
||||||
|
|
|
@ -59,6 +59,7 @@ typedef struct _WINSTATION_OBJECT
|
||||||
UINT CaretBlinkRate;
|
UINT CaretBlinkRate;
|
||||||
HANDLE ShellWindow;
|
HANDLE ShellWindow;
|
||||||
HANDLE ShellListView;
|
HANDLE ShellListView;
|
||||||
|
BOOL DesktopLocked;
|
||||||
struct _DESKTOP_OBJECT* ActiveDesktop;
|
struct _DESKTOP_OBJECT* ActiveDesktop;
|
||||||
/* FIXME: Clipboard */
|
/* FIXME: Clipboard */
|
||||||
LIST_ENTRY HotKeyListHead;
|
LIST_ENTRY HotKeyListHead;
|
||||||
|
@ -87,6 +88,8 @@ typedef struct _DESKTOP_OBJECT
|
||||||
/* Handle of the desktop window. */
|
/* Handle of the desktop window. */
|
||||||
HANDLE DesktopWindow;
|
HANDLE DesktopWindow;
|
||||||
HANDLE PrevActiveWindow;
|
HANDLE PrevActiveWindow;
|
||||||
|
/* Thread blocking input */
|
||||||
|
PVOID BlockInputThread;
|
||||||
} DESKTOP_OBJECT, *PDESKTOP_OBJECT;
|
} DESKTOP_OBJECT, *PDESKTOP_OBJECT;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,9 @@ IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height);
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
IntHideDesktop(PDESKTOP_OBJECT Desktop);
|
IntHideDesktop(PDESKTOP_OBJECT Desktop);
|
||||||
|
|
||||||
|
#define IntIsActiveDesktop(Desktop) \
|
||||||
|
((Desktop)->WindowStation->ActiveDesktop == (Desktop))
|
||||||
|
|
||||||
#endif /* _WIN32K_DESKTOP_H */
|
#endif /* _WIN32K_DESKTOP_H */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -10,5 +10,11 @@ InitKeyboardImpl(VOID);
|
||||||
PUSER_MESSAGE_QUEUE W32kGetPrimitiveMessageQueue(VOID);
|
PUSER_MESSAGE_QUEUE W32kGetPrimitiveMessageQueue(VOID);
|
||||||
PKBDTABLES W32kGetDefaultKeyLayout(VOID);
|
PKBDTABLES W32kGetDefaultKeyLayout(VOID);
|
||||||
VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyLayout);
|
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 */
|
#endif /* _WIN32K_INPUT_H */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* Entry Point for win32k.sys
|
||||||
*/
|
*/
|
||||||
|
@ -199,6 +199,7 @@ Win32kThreadCallback (struct _ETHREAD *Thread,
|
||||||
RemoveTimersThread(Thread->Cid.UniqueThread);
|
RemoveTimersThread(Thread->Cid.UniqueThread);
|
||||||
UnregisterThreadHotKeys(Thread);
|
UnregisterThreadHotKeys(Thread);
|
||||||
DestroyThreadWindows(Thread);
|
DestroyThreadWindows(Thread);
|
||||||
|
IntBlockInput(Win32Thread, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
|
#include <internal/safe.h>
|
||||||
#include <include/class.h>
|
#include <include/class.h>
|
||||||
#include <include/error.h>
|
#include <include/error.h>
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
|
@ -470,4 +471,133 @@ NtUserDragDetect(
|
||||||
return 0;
|
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 */
|
/* EOF */
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -54,17 +54,6 @@ NtUserBitBltSysBmp(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
|
||||||
STDCALL
|
|
||||||
NtUserBlockInput(
|
|
||||||
DWORD Unknown0)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserCallHwnd(
|
NtUserCallHwnd(
|
||||||
|
@ -609,18 +598,6 @@ NtUserSBGetParms(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
|
||||||
STDCALL
|
|
||||||
NtUserSendInput(
|
|
||||||
DWORD Unknown0,
|
|
||||||
DWORD Unknown1,
|
|
||||||
DWORD Unknown2)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserSetConsoleReserveKeys(
|
NtUserSetConsoleReserveKeys(
|
||||||
|
|
Loading…
Reference in a new issue