25 if (InputBufferSize == 0)
30 case 0x1b: MakeCode = 0x01; NormalKey =
TRUE;
break;
32 case '1': MakeCode = 0x02; NormalKey =
TRUE;
break;
33 case '2': MakeCode = 0x03; NormalKey =
TRUE;
break;
34 case '3': MakeCode = 0x04; NormalKey =
TRUE;
break;
35 case '4': MakeCode = 0x05; NormalKey =
TRUE;
break;
36 case '5': MakeCode = 0x06; NormalKey =
TRUE;
break;
37 case '6': MakeCode = 0x07; NormalKey =
TRUE;
break;
38 case '7': MakeCode = 0x08; NormalKey =
TRUE;
break;
39 case '8': MakeCode = 0x09; NormalKey =
TRUE;
break;
40 case '9': MakeCode = 0x0a; NormalKey =
TRUE;
break;
41 case '0': MakeCode = 0x0b; NormalKey =
TRUE;
break;
42 case '-': MakeCode = 0x0c; NormalKey =
TRUE;
break;
43 case '=': MakeCode = 0x0d; NormalKey =
TRUE;
break;
44 case '\b': MakeCode = 0x0e; NormalKey =
TRUE;
break;
46 case '\t': MakeCode = 0x0f; NormalKey =
TRUE;
break;
47 case 'q': MakeCode = 0x10; NormalKey =
TRUE;
break;
48 case 'w': MakeCode = 0x11; NormalKey =
TRUE;
break;
49 case 'e': MakeCode = 0x12; NormalKey =
TRUE;
break;
50 case 'r': MakeCode = 0x13; NormalKey =
TRUE;
break;
51 case 't': MakeCode = 0x14; NormalKey =
TRUE;
break;
52 case 'y': MakeCode = 0x15; NormalKey =
TRUE;
break;
53 case 'u': MakeCode = 0x16; NormalKey =
TRUE;
break;
54 case 'i': MakeCode = 0x17; NormalKey =
TRUE;
break;
55 case 'o': MakeCode = 0x18; NormalKey =
TRUE;
break;
56 case 'p': MakeCode = 0x19; NormalKey =
TRUE;
break;
57 case '[': MakeCode = 0x1a; NormalKey =
TRUE;
break;
58 case ']': MakeCode = 0x1b; NormalKey =
TRUE;
break;
60 case '\r': MakeCode = 0x1c; NormalKey =
TRUE;
break;
62 case 'a': MakeCode = 0x1e; NormalKey =
TRUE;
break;
63 case 's': MakeCode = 0x1f; NormalKey =
TRUE;
break;
64 case 'd': MakeCode = 0x20; NormalKey =
TRUE;
break;
65 case 'f': MakeCode = 0x21; NormalKey =
TRUE;
break;
66 case 'g': MakeCode = 0x22; NormalKey =
TRUE;
break;
67 case 'h': MakeCode = 0x23; NormalKey =
TRUE;
break;
68 case 'j': MakeCode = 0x24; NormalKey =
TRUE;
break;
69 case 'k': MakeCode = 0x25; NormalKey =
TRUE;
break;
70 case 'l': MakeCode = 0x26; NormalKey =
TRUE;
break;
71 case ';': MakeCode = 0x27; NormalKey =
TRUE;
break;
72 case '\'': MakeCode = 0x28; NormalKey =
TRUE;
break;
74 case '`': MakeCode = 0x29; NormalKey =
TRUE;
break;
76 case '\\': MakeCode = 0x2b; NormalKey =
TRUE;
break;
78 case 'z': MakeCode = 0x2c; NormalKey =
TRUE;
break;
79 case 'x': MakeCode = 0x2d; NormalKey =
TRUE;
break;
80 case 'c': MakeCode = 0x2e; NormalKey =
TRUE;
break;
81 case 'v': MakeCode = 0x2f; NormalKey =
TRUE;
break;
82 case 'b': MakeCode = 0x30; NormalKey =
TRUE;
break;
83 case 'n': MakeCode = 0x31; NormalKey =
TRUE;
break;
84 case 'm': MakeCode = 0x32; NormalKey =
TRUE;
break;
85 case ',': MakeCode = 0x33; NormalKey =
TRUE;
break;
86 case '.': MakeCode = 0x34; NormalKey =
TRUE;
break;
87 case '/': MakeCode = 0x35; NormalKey =
TRUE;
break;
89 case ' ': MakeCode = 0x39; NormalKey =
TRUE;
break;
91 if (NormalKey && *OutputBufferSize >= 2)
102 DPRINT1(
"Strange byte received 0x%02x ('%c')\n",
117 DPRINT(
"KeyboardInitialize() called\n");
136 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
150 ULONG InputDataConsumed;
182 ULONG BytesConsumed = 0;
186 DPRINT(
"KeyboardDeviceWorker() called\n");
191 LowerDevice = GreenDeviceExtension->
Serial;
281 Irp->IoStatus.Information = 0;
284 switch (
Stack->Parameters.DeviceIoControl.IoControlCode)
288 DPRINT(
"IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_KEYBOARD_CONNECT\n");
311 DPRINT(
"IRP_MJ_INTERNAL_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
312 Stack->Parameters.DeviceIoControl.IoControlCode);
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define InterlockedIncrement
#define FILE_DEVICE_SECURE_OPEN
#define NT_SUCCESS(StatCode)
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
#define KeRaiseIrql(irql, oldIrql)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeLowerIrql(oldIrql)
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN IN BOOLEAN Zero
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define KEYBOARD_BUFFER_SIZE
struct _GREEN_DEVICE_EXTENSION * PGREEN_DEVICE_EXTENSION
struct _GREEN_DRIVER_EXTENSION * PGREEN_DRIVER_EXTENSION
struct _KEYBOARD_DEVICE_EXTENSION * PKEYBOARD_DEVICE_EXTENSION
struct _CONNECT_DATA * PCONNECT_DATA
#define IOCTL_INTERNAL_KEYBOARD_CONNECT
VOID(STDAPICALLTYPE * PSERVICE_CALLBACK_ROUTINE)(IN PVOID NormalContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2, IN OUT PVOID SystemArgument3)
static BOOLEAN TranslateCharToScanCodes(IN PUCHAR InputBuffer, IN ULONG InputBufferSize, OUT KEYBOARD_INPUT_DATA *OutputBuffer, OUT PULONG OutputBufferSize, OUT PULONG BytesConsumed)
static VOID NTAPI KeyboardDpcSendData(IN PKDPC Dpc, IN PVOID pDeviceExtension, IN PVOID Unused1, IN PVOID Unused2)
NTSTATUS KeyboardAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT Pdo)
static VOID NTAPI KeyboardDeviceWorker(PVOID Context)
NTSTATUS KeyboardInternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
#define KeStallExecutionProcessor(MicroSeconds)
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
#define IoCompleteRequest
NTSTATUS NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus)
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
#define FILE_DEVICE_KEYBOARD
PDEVICE_OBJECT LowerDevice
PDEVICE_OBJECT ClassDeviceObject
COMMON_FDO_DEVICE_EXTENSION Common
CONNECT_DATA ClassInformation
HANDLE WorkerThreadHandle
KEYBOARD_INPUT_DATA KeyboardInputData[2][KEYBOARD_BUFFER_SIZE]
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INVALID_PARAMETER
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_Must_inspect_result_ _In_ WDFDEVICE Fdo
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT Pdo
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql