ReactOS  0.4.15-dev-1203-g0e5a4d5
i8042prt.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS i8042 (ps/2 keyboard-mouse controller) driver
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: drivers/input/i8042prt/i8042prt.c
5  * PURPOSE: Driver entry function
6  * PROGRAMMERS: Copyright Victor Kirhenshtein (sauros@iname.com)
7  Copyright Jason Filby (jasonfilby@yahoo.com)
8  Copyright Martijn Vernooij (o112w8r02@sneakemail.com)
9  Copyright 2006-2007 Hervé Poussineau (hpoussin@reactos.org)
10  */
11 
12 /* INCLUDES ******************************************************************/
13 
14 #include "i8042prt.h"
15 
16 #include <debug.h>
17 
18 /* FUNCTIONS *****************************************************************/
19 
20 static DRIVER_STARTIO i8042StartIo;
29 DRIVER_INITIALIZE DriverEntry;
30 
35 {
37  PFDO_DEVICE_EXTENSION DeviceExtension = NULL;
38  PDEVICE_OBJECT Fdo = NULL;
39  ULONG DeviceExtensionSize;
41 
42  TRACE_(I8042PRT, "i8042AddDevice(%p %p)\n", DriverObject, Pdo);
43 
45 
46  if (Pdo == NULL)
47  {
48  /* We're getting a NULL Pdo at the first call as
49  * we are a legacy driver. Ignore it */
50  return STATUS_SUCCESS;
51  }
52 
53  /* Create new device object. As we don't know if the device would be a keyboard
54  * or a mouse, we have to allocate the biggest device extension. */
55  DeviceExtensionSize = MAX(sizeof(I8042_KEYBOARD_EXTENSION), sizeof(I8042_MOUSE_EXTENSION));
58  DeviceExtensionSize,
59  NULL,
60  Pdo->DeviceType,
62  TRUE,
63  &Fdo);
64  if (!NT_SUCCESS(Status))
65  {
66  WARN_(I8042PRT, "IoCreateDevice() failed with status 0x%08lx\n", Status);
67  goto cleanup;
68  }
69 
70  DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
71  RtlZeroMemory(DeviceExtension, DeviceExtensionSize);
72  DeviceExtension->Type = Unknown;
73  DeviceExtension->Fdo = Fdo;
74  DeviceExtension->Pdo = Pdo;
75  DeviceExtension->PortDeviceExtension = &DriverExtension->Port;
76  Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice);
77  if (!NT_SUCCESS(Status))
78  {
79  WARN_(I8042PRT, "IoAttachDeviceToDeviceStackSafe() failed with status 0x%08lx\n", Status);
80  goto cleanup;
81  }
82 
84  &DriverExtension->DeviceListHead,
85  &DeviceExtension->ListEntry,
86  &DriverExtension->DeviceListLock);
87 
89  return STATUS_SUCCESS;
90 
91 cleanup:
92  if (DeviceExtension && DeviceExtension->LowerDevice)
93  IoDetachDevice(DeviceExtension->LowerDevice);
94  if (Fdo)
95  IoDeleteDevice(Fdo);
96  return Status;
97 }
98 
99 VOID NTAPI
102  IN PVOID Context)
103 {
104  PI8042_HOOK_WORKITEM WorkItemData;
105  PFDO_DEVICE_EXTENSION FdoDeviceExtension;
106  PPORT_DEVICE_EXTENSION PortDeviceExtension;
107  PDEVICE_OBJECT TopOfStack = NULL;
112  KEVENT Event;
113  PIRP NewIrp;
115 
116  TRACE_(I8042PRT, "i8042SendHookWorkItem(%p %p)\n", DeviceObject, Context);
117 
118  WorkItemData = (PI8042_HOOK_WORKITEM)Context;
119  FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
120  PortDeviceExtension = FdoDeviceExtension->PortDeviceExtension;
121 
122  switch (FdoDeviceExtension->Type)
123  {
124  case Keyboard:
125  {
126  PI8042_KEYBOARD_EXTENSION DeviceExtension;
127  DeviceExtension = (PI8042_KEYBOARD_EXTENSION)FdoDeviceExtension;
129  InputBuffer = &DeviceExtension->KeyboardHook;
131  break;
132  }
133  case Mouse:
134  {
135  PI8042_MOUSE_EXTENSION DeviceExtension;
136  DeviceExtension = (PI8042_MOUSE_EXTENSION)FdoDeviceExtension;
138  InputBuffer = &DeviceExtension->MouseHook;
140  break;
141  }
142  default:
143  {
144  ERR_(I8042PRT, "Unknown FDO type %u\n", FdoDeviceExtension->Type);
145  ASSERT(FALSE);
146  WorkItemData->Irp->IoStatus.Status = STATUS_INTERNAL_ERROR;
147  goto cleanup;
148  }
149  }
150 
153 
156  TopOfStack,
157  InputBuffer,
159  NULL,
160  0,
161  TRUE,
162  &Event,
163  &IoStatus);
164 
165  if (!NewIrp)
166  {
167  WARN_(I8042PRT, "IoBuildDeviceIoControlRequest() failed\n");
169  goto cleanup;
170  }
171 
172  Status = IoCallDriver(TopOfStack, NewIrp);
173  if (Status == STATUS_PENDING)
174  {
176  &Event,
177  Executive,
178  KernelMode,
179  FALSE,
180  NULL);
181  Status = IoStatus.Status;
182  }
183  if (!NT_SUCCESS(Status))
184  {
185  WARN_(I8042PRT, "IoCallDriver() failed with status 0x%08lx\n", Status);
186  goto cleanup;
187  }
188 
189  if (FdoDeviceExtension->Type == Keyboard)
190  {
191  PI8042_KEYBOARD_EXTENSION DeviceExtension;
192 
193  DeviceExtension = (PI8042_KEYBOARD_EXTENSION)FdoDeviceExtension;
194  /* Call the hooked initialization if it exists */
195  if (DeviceExtension->KeyboardHook.InitializationRoutine)
196  {
197  Status = DeviceExtension->KeyboardHook.InitializationRoutine(
198  DeviceExtension->KeyboardHook.Context,
199  PortDeviceExtension,
202  FALSE);
203  if (!NT_SUCCESS(Status))
204  {
205  WARN_(I8042PRT, "KeyboardHook.InitializationRoutine() failed with status 0x%08lx\n", Status);
206  WorkItemData->Irp->IoStatus.Status = Status;
207  goto cleanup;
208  }
209  }
210  }
211 
212  WorkItemData->Irp->IoStatus.Status = STATUS_SUCCESS;
213 
214 cleanup:
215  if (TopOfStack != NULL)
216  ObDereferenceObject(TopOfStack);
217  WorkItemData->Irp->IoStatus.Information = 0;
218  IoCompleteRequest(WorkItemData->Irp, IO_NO_INCREMENT);
219 
220  IoFreeWorkItem(WorkItemData->WorkItem);
221  ExFreePoolWithTag(WorkItemData, I8042PRT_TAG);
222 }
223 
224 static VOID NTAPI
227  IN PIRP Irp)
228 {
229  PFDO_DEVICE_EXTENSION DeviceExtension;
230 
231  DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
232  switch (DeviceExtension->Type)
233  {
234  case Keyboard:
236  break;
237  default:
238  ERR_(I8042PRT, "Unknown FDO type %u\n", DeviceExtension->Type);
239  ASSERT(FALSE);
240  break;
241  }
242 }
243 
244 /* Write the current byte of the packet. Returns FALSE in case
245  * of problems.
246  */
247 static BOOLEAN
249  IN PPORT_DEVICE_EXTENSION DeviceExtension)
250 {
251  UCHAR Port = DeviceExtension->PacketPort;
252 
253  if (Port)
254  {
255  if (!i8042Write(DeviceExtension,
256  DeviceExtension->ControlPort,
257  Port))
258  {
259  /* something is really wrong! */
260  WARN_(I8042PRT, "Failed to send packet byte!\n");
261  return FALSE;
262  }
263  }
264 
265  return i8042Write(DeviceExtension,
266  DeviceExtension->DataPort,
267  DeviceExtension->Packet.Bytes[DeviceExtension->Packet.CurrentByte]);
268 }
269 
270 BOOLEAN
272  IN PPORT_DEVICE_EXTENSION DeviceExtension,
273  IN UCHAR Output)
274 {
275  if (DeviceExtension->Packet.State == Idle)
276  return FALSE;
277 
278  switch (Output)
279  {
280  case KBD_RESEND:
281  DeviceExtension->PacketResends++;
282  if (DeviceExtension->PacketResends > DeviceExtension->Settings.ResendIterations)
283  {
284  DeviceExtension->Packet.State = Idle;
285  DeviceExtension->PacketComplete = TRUE;
286  DeviceExtension->PacketResult = STATUS_IO_TIMEOUT;
287  DeviceExtension->PacketResends = 0;
288  return TRUE;
289  }
290  DeviceExtension->Packet.CurrentByte--;
291  break;
292 
293  case KBD_NACK:
294  DeviceExtension->Packet.State = Idle;
295  DeviceExtension->PacketComplete = TRUE;
296  DeviceExtension->PacketResult = STATUS_UNEXPECTED_IO_ERROR;
297  DeviceExtension->PacketResends = 0;
298  return TRUE;
299 
300  default:
301  DeviceExtension->PacketResends = 0;
302  }
303 
304  if (DeviceExtension->Packet.CurrentByte >= DeviceExtension->Packet.ByteCount)
305  {
306  DeviceExtension->Packet.State = Idle;
307  DeviceExtension->PacketComplete = TRUE;
308  DeviceExtension->PacketResult = STATUS_SUCCESS;
309  return TRUE;
310  }
311 
312  if (!i8042PacketWrite(DeviceExtension))
313  {
314  DeviceExtension->Packet.State = Idle;
315  DeviceExtension->PacketComplete = TRUE;
316  DeviceExtension->PacketResult = STATUS_IO_TIMEOUT;
317  return TRUE;
318  }
319  DeviceExtension->Packet.CurrentByte++;
320 
321  return TRUE;
322 }
323 
324 /*
325  * This function starts a packet. It must be called with the
326  * correct DIRQL.
327  */
328 NTSTATUS
330  IN PPORT_DEVICE_EXTENSION DeviceExtension,
331  IN PFDO_DEVICE_EXTENSION FdoDeviceExtension,
332  IN PUCHAR Bytes,
334  IN PIRP Irp)
335 {
336  KIRQL Irql;
338 
339  Irql = KeAcquireInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt);
340 
341  if (DeviceExtension->Packet.State != Idle)
342  {
344  goto done;
345  }
346 
347  switch (FdoDeviceExtension->Type)
348  {
349  case Keyboard: DeviceExtension->PacketPort = 0; break;
350  case Mouse: DeviceExtension->PacketPort = CTRL_WRITE_MOUSE; break;
351  default:
352  ERR_(I8042PRT, "Unknown FDO type %u\n", FdoDeviceExtension->Type);
353  ASSERT(FALSE);
355  goto done;
356  }
357 
358  DeviceExtension->Packet.Bytes = Bytes;
359  DeviceExtension->Packet.CurrentByte = 0;
360  DeviceExtension->Packet.ByteCount = ByteCount;
361  DeviceExtension->Packet.State = SendingBytes;
362  DeviceExtension->PacketResult = Status = STATUS_PENDING;
363  DeviceExtension->CurrentIrp = Irp;
364  DeviceExtension->CurrentIrpDevice = FdoDeviceExtension->Fdo;
365 
366  if (!i8042PacketWrite(DeviceExtension))
367  {
369  DeviceExtension->Packet.State = Idle;
370  DeviceExtension->PacketResult = STATUS_ABANDONED;
371  goto done;
372  }
373 
374  DeviceExtension->Packet.CurrentByte++;
375 
376 done:
377  KeReleaseInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt, Irql);
378 
379  if (Status != STATUS_PENDING)
380  {
381  DeviceExtension->CurrentIrp = NULL;
382  DeviceExtension->CurrentIrpDevice = NULL;
383  Irp->IoStatus.Status = Status;
385  }
386  return Status;
387 }
388 
389 static NTSTATUS NTAPI
392  IN PIRP Irp)
393 {
394  PFDO_DEVICE_EXTENSION DeviceExtension;
395 
396  TRACE_(I8042PRT, "i8042DeviceControl(%p %p)\n", DeviceObject, Irp);
397  DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
398 
399  switch (DeviceExtension->Type)
400  {
401  case Keyboard:
403  default:
404  Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
407  }
408 }
409 
410 static NTSTATUS NTAPI
413  IN PIRP Irp)
414 {
415  PFDO_DEVICE_EXTENSION DeviceExtension;
418 
419  TRACE_(I8042PRT, "i8042InternalDeviceControl(%p %p)\n", DeviceObject, Irp);
420  DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
421 
422  switch (DeviceExtension->Type)
423  {
424  case Unknown:
425  {
426  ControlCode = IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.IoControlCode;
427  switch (ControlCode)
428  {
431  break;
434  break;
435  default:
436  ERR_(I8042PRT, "Unknown IO control code 0x%lx\n", ControlCode);
437  ASSERT(FALSE);
439  break;
440  }
441  break;
442  }
443  case Keyboard:
445  break;
446  case Mouse:
448  break;
449  default:
450  ERR_(I8042PRT, "Unknown FDO type %u\n", DeviceExtension->Type);
451  ASSERT(FALSE);
454  break;
455  }
456 
457  return Status;
458 }
459 
460 static NTSTATUS NTAPI
463  IN PIRP Irp)
464 {
465  PFDO_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
466  PDEVICE_OBJECT LowerDevice = DeviceExtension->LowerDevice;
467 
470  return PoCallDriver(LowerDevice, Irp);
471 }
472 
473 static NTSTATUS NTAPI
476  IN PIRP Irp)
477 {
479 }
480 
485 {
488 
490  DriverObject,
491  DriverObject,
492  sizeof(I8042_DRIVER_EXTENSION),
494  if (!NT_SUCCESS(Status))
495  {
496  WARN_(I8042PRT, "IoAllocateDriverObjectExtension() failed with status 0x%08lx\n", Status);
497  return Status;
498  }
500  KeInitializeSpinLock(&DriverExtension->Port.SpinLock);
501  InitializeListHead(&DriverExtension->DeviceListHead);
502  KeInitializeSpinLock(&DriverExtension->DeviceListLock);
503 
506  RegistryPath,
507  &DriverExtension->RegistryPath);
508  if (!NT_SUCCESS(Status))
509  {
510  WARN_(I8042PRT, "DuplicateUnicodeString() failed with status 0x%08lx\n", Status);
511  return Status;
512  }
513 
515  if (!NT_SUCCESS(Status))
516  {
517  WARN_(I8042PRT, "ReadRegistryEntries() failed with status 0x%08lx\n", Status);
518  return Status;
519  }
520 
523 
532 
534 
535  return STATUS_SUCCESS;
536 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
static NTSTATUS NTAPI i8042SystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: i8042prt.c:474
CPPORT Port[4]
Definition: headless.c:34
#define IN
Definition: typedefs.h:39
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT Pdo
Definition: classpnp.h:318
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1788
PIO_WORKITEM WorkItem
Definition: i8042prt.h:203
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2659
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
NTSTATUS NTAPI i8042Pnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pnp.c:675
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
LIST_ENTRY ListEntry
Definition: pci.h:83
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
#define ERR_(ch,...)
Definition: debug.h:156
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI i8042SendHookWorkItem(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
Definition: i8042prt.c:100
_In_ UINT Bytes
Definition: mmcopy.h:9
NTSTATUS NTAPI i8042Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: createclose.c:18
BOOLEAN i8042Write(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PUCHAR addr, IN UCHAR data)
Definition: readwrite.c:199
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
DRIVER_DISPATCH i8042KbdDeviceControl
Definition: i8042prt.h:316
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
IO_STATUS_BLOCK IoStatus
struct _INTERNAL_I8042_HOOK_KEYBOARD INTERNAL_I8042_HOOK_KEYBOARD
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
_Out_ PKIRQL Irql
Definition: csq.h:179
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
Definition: iowork.c:64
struct _I8042_KEYBOARD_EXTENSION * PI8042_KEYBOARD_EXTENSION
Definition: i8042prt.h:63
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
#define I8042PRT_TAG
Definition: i8042prt.h:12
NTSTATUS NTAPI i8042Close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: createclose.c:46
DRIVER_ADD_DEVICE i8042AddDevice
Definition: i8042prt.h:324
struct _I8042_DRIVER_EXTENSION * PI8042_DRIVER_EXTENSION
_In_ ULONG IoControlCode
Definition: cdrom.h:1437
DRIVER_STARTIO i8042KbdStartIo
Definition: i8042prt.h:314
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
UCHAR KIRQL
Definition: env_spec_w32.h:591
static BOOLEAN i8042PacketWrite(IN PPORT_DEVICE_EXTENSION DeviceExtension)
Definition: i8042prt.c:248
static NTSTATUS NTAPI i8042InternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: i8042prt.c:411
PPORT_DEVICE_EXTENSION PortDeviceExtension
Definition: i8042prt.h:134
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2262
_Dispatch_type_(IRP_MJ_DEVICE_CONTROL)
Definition: i8042prt.c:21
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:450
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
Definition: spinlock.c:165
NTSTATUS i8042StartPacket(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PFDO_DEVICE_EXTENSION FdoDeviceExtension, IN PUCHAR Bytes, IN ULONG ByteCount, IN PIRP Irp)
Definition: i8042prt.c:329
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
switch(r->id)
Definition: btrfs.c:2980
Definition: ntdd8042.h:62
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: i8042prt.c:482
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1406
BOOLEAN i8042PacketIsr(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Output)
Definition: i8042prt.c:271
#define TRACE_(x)
Definition: compat.h:76
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: isapnp.h:82
_In_z_ PWSTR RegistryPath
Definition: classp.h:1930
NTSTATUS NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: device.c:980
INTERNAL_I8042_HOOK_KEYBOARD KeyboardHook
Definition: i8042prt.h:141
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
static DRIVER_STARTIO i8042StartIo
Definition: i8042prt.c:20
NTSTATUS DuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
Definition: misc.c:72
NTSTATUS NTAPI i8042SynchWritePortKbd(IN PVOID Context, IN UCHAR Value, IN BOOLEAN WaitForAck)
Definition: keyboard.c:87
CHAR InputBuffer[80]
Definition: conmgr.c:33
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
Definition: spinlock.c:148
#define IOCTL_INTERNAL_KEYBOARD_CONNECT
Definition: kbdmou.h:56
I8042_DEVICE_TYPE Type
Definition: i8042prt.h:122
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IOCTL_INTERNAL_MOUSE_CONNECT
Definition: kbdmou.h:68
unsigned char UCHAR
Definition: xmlstorage.h:181
#define IRP_MJ_POWER
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
Status
Definition: gdiplustypes.h:24
INTERNAL_I8042_HOOK_MOUSE MouseHook
Definition: i8042prt.h:179
Definition: arc.h:85
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1866
NTSTATUS NTAPI i8042Cleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: createclose.c:32
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
DRIVER_DISPATCH(nfs41_FsdDispatch)
NTSTATUS NTAPI i8042SynchReadPort(IN PVOID Context, OUT PUCHAR Value, IN BOOLEAN WaitForAck)
Definition: readwrite.c:125
#define IRP_MJ_SYSTEM_CONTROL
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1081
T MAX(T a, T b)
Definition: polytest.cpp:85
PDEVICE_OBJECT Fdo
Definition: i8042prt.h:126
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2200
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
static NTSTATUS NTAPI i8042DeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: i8042prt.c:390
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:737
#define IOCTL_INTERNAL_I8042_HOOK_MOUSE
Definition: ntdd8042.h:45
#define KBD_RESEND
Definition: i8042prt.h:244
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
NTSTATUS ReadRegistryEntries(IN PUNICODE_STRING RegistryPath, OUT PI8042_SETTINGS Settings)
Definition: registry.c:21
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define STATUS_IO_TIMEOUT
Definition: udferr_usr.h:163
#define STATUS_UNEXPECTED_IO_ERROR
Definition: ntstatus.h:469
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
static NTSTATUS NTAPI i8042Power(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: i8042prt.c:461
struct _I8042_HOOK_WORKITEM * PI8042_HOOK_WORKITEM
#define IRP_MJ_CLEANUP
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2269
PDEVICE_OBJECT Pdo
Definition: i8042prt.h:128
#define IOCTL_INTERNAL_I8042_HOOK_KEYBOARD
Definition: ntdd8042.h:36
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:581
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)
Definition: device.c:1031
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t InputBufferLength
Definition: cdrom.h:1437
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
char * cleanup(char *str)
Definition: wpickclick.c:99
VOID NTAPI i8042InitializeHwHacks(VOID)
Definition: hwhacks.c:183
PDRIVER_STARTIO DriverStartIo
Definition: iotypes.h:2267
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130
DRIVER_DISPATCH i8042MouInternalDeviceControl
Definition: i8042prt.h:367
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
return STATUS_SUCCESS
Definition: btrfs.c:3014
struct _INTERNAL_I8042_HOOK_MOUSE INTERNAL_I8042_HOOK_MOUSE
OUT PI8042_KEYBOARD_INITIALIZATION_ROUTINE InitializationRoutine
Definition: ntdd8042.h:178
#define STATUS_ABANDONED
Definition: ntstatus.h:75
#define WARN_(ch,...)
Definition: debug.h:157
struct _I8042_MOUSE_EXTENSION * PI8042_MOUSE_EXTENSION
Definition: i8042prt.h:65
#define CTRL_WRITE_MOUSE
Definition: i8042prt.h:228
DRIVER_DISPATCH i8042KbdInternalDeviceControl
Definition: i8042prt.h:318
#define KBD_NACK
Definition: i8042prt.h:243
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52