mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed direct reference to a driver object.
svn path=/trunk/; revision=3080
This commit is contained in:
parent
01b92c6de5
commit
260116f684
1 changed files with 31 additions and 13 deletions
|
@ -10,8 +10,11 @@
|
|||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
DWORD STDCALL EngDeviceIoControl(
|
||||
HANDLE hDevice,
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
DWORD STDCALL
|
||||
EngDeviceIoControl(HANDLE hDevice,
|
||||
DWORD dwIoControlCode,
|
||||
LPVOID lpInBuffer,
|
||||
DWORD nInBufferSize,
|
||||
|
@ -23,16 +26,31 @@ DWORD STDCALL EngDeviceIoControl(
|
|||
NTSTATUS Status;
|
||||
KEVENT Event;
|
||||
IO_STATUS_BLOCK Iosb;
|
||||
PDRIVER_OBJECT DriverObject;
|
||||
PFILE_OBJECT FileObject;
|
||||
|
||||
DriverObject = hDevice;
|
||||
DPRINT("EngDeviceIoControl() called\n");
|
||||
|
||||
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
||||
|
||||
Irp = IoBuildDeviceIoControlRequest(dwIoControlCode, DriverObject->DeviceObject, lpInBuffer, nInBufferSize,
|
||||
lpOutBuffer, nOutBufferSize, FALSE, &Event, &Iosb);
|
||||
Status = ObReferenceObjectByHandle(hDevice,
|
||||
FILE_READ_DATA | FILE_WRITE_DATA,
|
||||
IoFileObjectType,
|
||||
KernelMode,
|
||||
(PVOID *)&FileObject,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
|
||||
Status = IoCallDriver(DriverObject->DeviceObject, Irp);
|
||||
Irp = IoBuildDeviceIoControlRequest(dwIoControlCode,
|
||||
FileObject->DeviceObject,
|
||||
lpInBuffer,
|
||||
nInBufferSize,
|
||||
lpOutBuffer,
|
||||
nOutBufferSize, FALSE, &Event, &Iosb);
|
||||
|
||||
Status = IoCallDriver(FileObject->DeviceObject, Irp);
|
||||
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue