NTSTATUS Status;
KEVENT Event;
IO_STATUS_BLOCK Iosb;
- PDEVICE_OBJECT theDevice;
+ PDRIVER_OBJECT DriverObject;
- ObReferenceObjectByHandle(hDevice, GENERIC_ALL, NULL, UserMode,
- (PVOID *)&theDevice, NULL);
+ DriverObject = hDevice;
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(dwIoControlCode,
- theDevice,
+ DriverObject->DeviceObject,
lpInBuffer,
nInBufferSize,
lpOutBuffer,
&Event,
&Iosb);
- Status = IoCallDriver(theDevice, Irp);
+ Status = IoCallDriver(DriverObject->DeviceObject, Irp);
if (Status == STATUS_PENDING)
{