ReactOS 0.4.15-dev-7931-gfd331f1
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
20static DRIVER_STARTIO i8042StartIo;
29DRIVER_INITIALIZE DriverEntry;
30
35{
37 PFDO_DEVICE_EXTENSION DeviceExtension = 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;
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
88 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
89 return STATUS_SUCCESS;
90
92 if (DeviceExtension && DeviceExtension->LowerDevice)
93 IoDetachDevice(DeviceExtension->LowerDevice);
94 if (Fdo)
96 return Status;
97}
98
103{
104 PI8042_HOOK_WORKITEM WorkItemData;
105 PFDO_DEVICE_EXTENSION FdoDeviceExtension;
106 PPORT_DEVICE_EXTENSION PortDeviceExtension;
107 PDEVICE_OBJECT TopOfStack = NULL;
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,
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,
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
214cleanup:
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
224static 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 */
247static 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
272 IN PPORT_DEVICE_EXTENSION DeviceExtension,
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 */
330 IN PPORT_DEVICE_EXTENSION DeviceExtension,
331 IN PFDO_DEVICE_EXTENSION FdoDeviceExtension,
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
376done:
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
389static 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
410static 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 {
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
460static 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
473static NTSTATUS NTAPI
476 IN PIRP Irp)
477{
479}
480
485{
488
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
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
514 Status = ReadRegistryEntries(&DriverExtension->RegistryPath, &DriverExtension->Port.Settings);
515 if (!NT_SUCCESS(Status))
516 {
517 WARN_(I8042PRT, "ReadRegistryEntries() failed with status 0x%08lx\n", Status);
518 return Status;
519 }
520
521 DriverObject->DriverExtension->AddDevice = i8042AddDevice;
522 DriverObject->DriverStartIo = i8042StartIo;
523
524 DriverObject->MajorFunction[IRP_MJ_CREATE] = i8042Create;
525 DriverObject->MajorFunction[IRP_MJ_CLEANUP] = i8042Cleanup;
526 DriverObject->MajorFunction[IRP_MJ_CLOSE] = i8042Close;
529 DriverObject->MajorFunction[IRP_MJ_POWER] = i8042Power;
531 DriverObject->MajorFunction[IRP_MJ_PNP] = i8042Pnp;
532
534
535 return STATUS_SUCCESS;
536}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define MAX(x, y)
Definition: rdesktop.h:175
#define _Dispatch_type_(a)
Definition: btrfs_drv.h:204
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
_In_ PIRP Irp
Definition: csq.h:116
_Out_ PKIRQL Irql
Definition: csq.h:179
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define TRACE_(x)
Definition: compat.h:76
static void cleanup(void)
Definition: main.c:1335
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
switch(r->id)
Definition: btrfs.c:3046
NTSTATUS NTAPI i8042Cleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: createclose.c:32
NTSTATUS NTAPI i8042Close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: createclose.c:46
NTSTATUS NTAPI i8042Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: createclose.c:18
NTSTATUS NTAPI i8042Pnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pnp.c:675
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
Status
Definition: gdiplustypes.h:25
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: green.h:15
CPPORT Port[4]
Definition: headless.c:35
VOID NTAPI i8042InitializeHwHacks(VOID)
Definition: hwhacks.c:185
static DRIVER_STARTIO i8042StartIo
Definition: i8042prt.c:20
static NTSTATUS NTAPI i8042InternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: i8042prt.c:411
static NTSTATUS NTAPI i8042SystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: i8042prt.c:474
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
static NTSTATUS NTAPI i8042Power(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: i8042prt.c:461
BOOLEAN i8042PacketIsr(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Output)
Definition: i8042prt.c:271
static BOOLEAN i8042PacketWrite(IN PPORT_DEVICE_EXTENSION DeviceExtension)
Definition: i8042prt.c:248
static NTSTATUS NTAPI i8042DeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: i8042prt.c:390
struct _I8042_HOOK_WORKITEM * PI8042_HOOK_WORKITEM
NTSTATUS NTAPI i8042SynchWritePortKbd(IN PVOID Context, IN UCHAR Value, IN BOOLEAN WaitForAck)
Definition: keyboard.c:87
DRIVER_DISPATCH i8042KbdDeviceControl
Definition: i8042prt.h:316
DRIVER_DISPATCH i8042KbdInternalDeviceControl
Definition: i8042prt.h:318
DRIVER_STARTIO i8042KbdStartIo
Definition: i8042prt.h:314
#define KBD_NACK
Definition: i8042prt.h:243
#define CTRL_WRITE_MOUSE
Definition: i8042prt.h:228
DRIVER_DISPATCH i8042MouInternalDeviceControl
Definition: i8042prt.h:365
NTSTATUS DuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
Definition: misc.c:31
struct _I8042_MOUSE_EXTENSION * PI8042_MOUSE_EXTENSION
Definition: i8042prt.h:65
NTSTATUS NTAPI i8042SynchReadPort(IN PVOID Context, OUT PUCHAR Value, IN BOOLEAN WaitForAck)
Definition: readwrite.c:125
IO_WORKITEM_ROUTINE i8042SendHookWorkItem
Definition: i8042prt.h:295
#define KBD_RESEND
Definition: i8042prt.h:244
NTSTATUS ReadRegistryEntries(IN PUNICODE_STRING RegistryPath, OUT PI8042_SETTINGS Settings)
Definition: registry.c:21
struct _I8042_KEYBOARD_EXTENSION * PI8042_KEYBOARD_EXTENSION
Definition: i8042prt.h:63
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
struct _I8042_DRIVER_EXTENSION * PI8042_DRIVER_EXTENSION
DRIVER_ADD_DEVICE i8042AddDevice
Definition: i8042prt.h:324
@ Keyboard
Definition: i8042prt.h:115
@ Mouse
Definition: i8042prt.h:116
@ Unknown
Definition: i8042prt.h:114
#define I8042PRT_TAG
Definition: i8042prt.h:12
BOOLEAN i8042Write(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PUCHAR addr, IN UCHAR data)
Definition: readwrite.c:199
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
Definition: iowork.c:64
#define IOCTL_INTERNAL_KEYBOARD_CONNECT
Definition: kbdmou.h:56
#define IOCTL_INTERNAL_MOUSE_CONNECT
Definition: kbdmou.h:68
_In_ UINT Bytes
Definition: mmcopy.h:9
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define KernelMode
Definition: asm.h:34
DRIVER_DISPATCH(nfs41_FsdDispatch)
#define IOCTL_INTERNAL_I8042_HOOK_MOUSE
Definition: ntdd8042.h:45
#define IOCTL_INTERNAL_I8042_HOOK_KEYBOARD
Definition: ntdd8042.h:36
struct _INTERNAL_I8042_HOOK_KEYBOARD INTERNAL_I8042_HOOK_KEYBOARD
struct _INTERNAL_I8042_HOOK_MOUSE INTERNAL_I8042_HOOK_MOUSE
@ SendingBytes
Definition: ntdd8042.h:63
@ Idle
Definition: ntdd8042.h:62
@ NotificationEvent
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
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
NTSTATUS NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: device.c:980
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1406
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1904
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1826
#define IoCompleteRequest
Definition: irp.c:1240
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
#define IoCallDriver
Definition: irp.c:1225
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
Definition: spinlock.c:154
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
Definition: spinlock.c:171
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_ABANDONED
Definition: ntstatus.h:75
#define STATUS_UNEXPECTED_IO_ERROR
Definition: ntstatus.h:469
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
@ Output
Definition: arc.h:85
#define ERR_(ch,...)
Definition: debug.h:156
#define WARN_(ch,...)
Definition: debug.h:157
#define STATUS_SUCCESS
Definition: shellext.h:65
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130
I8042_DEVICE_TYPE Type
Definition: i8042prt.h:122
PDEVICE_OBJECT Fdo
Definition: i8042prt.h:126
LIST_ENTRY ListEntry
Definition: pci.h:86
PDEVICE_OBJECT Pdo
Definition: i8042prt.h:128
PPORT_DEVICE_EXTENSION PortDeviceExtension
Definition: i8042prt.h:134
PIO_WORKITEM WorkItem
Definition: i8042prt.h:203
INTERNAL_I8042_HOOK_KEYBOARD KeyboardHook
Definition: i8042prt.h:141
INTERNAL_I8042_HOOK_MOUSE MouseHook
Definition: i8042prt.h:179
OUT PI8042_KEYBOARD_INITIALIZATION_ROUTINE InitializationRoutine
Definition: ntdd8042.h:178
struct _IO_STACK_LOCATION::@1564::@1565 DeviceIoControl
union _IO_STACK_LOCATION::@1564 Parameters
IO_STATUS_BLOCK IoStatus
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_IO_TIMEOUT
Definition: udferr_usr.h:163
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
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
Definition: wdfminiport.h:72
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
#define IO_NO_INCREMENT
Definition: iotypes.h:598
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1099
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
#define IRP_MJ_POWER
#define IRP_MJ_CLEANUP
@ Executive
Definition: ketypes.h:415
#define ObDereferenceObject
Definition: obfuncs.h:203
unsigned char UCHAR
Definition: xmlstorage.h:181