2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Keyboard class driver
4 * FILE: drivers/input/kbdclass/misc.c
5 * PURPOSE: Misceallenous operations
7 * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
16 ForwardIrpAndWaitCompletion(
17 IN PDEVICE_OBJECT DeviceObject
,
21 if (Irp
->PendingReturned
)
22 KeSetEvent((PKEVENT
)Context
, IO_NO_INCREMENT
, FALSE
);
23 return STATUS_MORE_PROCESSING_REQUIRED
;
28 IN PDEVICE_OBJECT DeviceObject
,
31 PDEVICE_OBJECT LowerDevice
;
35 ASSERT(!((PCOMMON_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->IsClassDO
);
36 LowerDevice
= ((PPORT_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->LowerDevice
;
38 KeInitializeEvent(&Event
, NotificationEvent
, FALSE
);
39 IoCopyCurrentIrpStackLocationToNext(Irp
);
41 DPRINT("Calling lower device %p [%wZ]\n", LowerDevice
, &LowerDevice
->DriverObject
->DriverName
);
42 IoSetCompletionRoutine(Irp
, ForwardIrpAndWaitCompletion
, &Event
, TRUE
, TRUE
, TRUE
);
44 Status
= IoCallDriver(LowerDevice
, Irp
);
45 if (Status
== STATUS_PENDING
)
47 Status
= KeWaitForSingleObject(&Event
, Suspended
, KernelMode
, FALSE
, NULL
);
48 if (NT_SUCCESS(Status
))
49 Status
= Irp
->IoStatus
.Status
;
57 IN PDEVICE_OBJECT DeviceObject
,
60 PDEVICE_OBJECT LowerDevice
;
62 ASSERT(!((PCOMMON_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->IsClassDO
);
63 LowerDevice
= ((PPORT_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
)->LowerDevice
;
65 IoSkipCurrentIrpStackLocation(Irp
);
66 return IoCallDriver(LowerDevice
, Irp
);