mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +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,29 +10,47 @@
|
|||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
DWORD STDCALL EngDeviceIoControl(
|
||||
HANDLE hDevice,
|
||||
DWORD dwIoControlCode,
|
||||
LPVOID lpInBuffer,
|
||||
DWORD nInBufferSize,
|
||||
LPVOID lpOutBuffer,
|
||||
DWORD nOutBufferSize,
|
||||
DWORD *lpBytesReturned)
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
DWORD STDCALL
|
||||
EngDeviceIoControl(HANDLE hDevice,
|
||||
DWORD dwIoControlCode,
|
||||
LPVOID lpInBuffer,
|
||||
DWORD nInBufferSize,
|
||||
LPVOID lpOutBuffer,
|
||||
DWORD nOutBufferSize,
|
||||
DWORD *lpBytesReturned)
|
||||
{
|
||||
PIRP Irp;
|
||||
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