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,29 +10,47 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
DWORD STDCALL EngDeviceIoControl(
|
#define NDEBUG
|
||||||
HANDLE hDevice,
|
#include <debug.h>
|
||||||
DWORD dwIoControlCode,
|
|
||||||
LPVOID lpInBuffer,
|
DWORD STDCALL
|
||||||
DWORD nInBufferSize,
|
EngDeviceIoControl(HANDLE hDevice,
|
||||||
LPVOID lpOutBuffer,
|
DWORD dwIoControlCode,
|
||||||
DWORD nOutBufferSize,
|
LPVOID lpInBuffer,
|
||||||
DWORD *lpBytesReturned)
|
DWORD nInBufferSize,
|
||||||
|
LPVOID lpOutBuffer,
|
||||||
|
DWORD nOutBufferSize,
|
||||||
|
DWORD *lpBytesReturned)
|
||||||
{
|
{
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
IO_STATUS_BLOCK Iosb;
|
IO_STATUS_BLOCK Iosb;
|
||||||
PDRIVER_OBJECT DriverObject;
|
PFILE_OBJECT FileObject;
|
||||||
|
|
||||||
DriverObject = hDevice;
|
DPRINT("EngDeviceIoControl() called\n");
|
||||||
|
|
||||||
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
||||||
|
|
||||||
Irp = IoBuildDeviceIoControlRequest(dwIoControlCode, DriverObject->DeviceObject, lpInBuffer, nInBufferSize,
|
Status = ObReferenceObjectByHandle(hDevice,
|
||||||
lpOutBuffer, nOutBufferSize, FALSE, &Event, &Iosb);
|
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)
|
if (Status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue