- Bring FatPerformDevIoCtrl to our coding standards (tabs->spaces, comments).

- Change WaitReason to Executive ("A driver should set this value to Executive, ..." (c) WDK)

svn path=/trunk/; revision=39028
This commit is contained in:
Aleksey Bragin 2009-01-23 09:28:03 +00:00
parent 0cedc2a03c
commit d86e5e4347
2 changed files with 30 additions and 25 deletions

View file

@ -23,12 +23,12 @@ FatDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS NTSTATUS
FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject, FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject,
ULONG ControlCode, ULONG ControlCode,
PVOID InputBuffer, PVOID InputBuffer,
ULONG InputBufferSize, ULONG InputBufferSize,
PVOID OutputBuffer, PVOID OutputBuffer,
ULONG OutputBufferSize, ULONG OutputBufferSize,
BOOLEAN Override) BOOLEAN Override)
{ {
PIRP Irp; PIRP Irp;
KEVENT Event; KEVENT Event;
@ -36,32 +36,37 @@ FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject,
PIO_STACK_LOCATION Stack; PIO_STACK_LOCATION Stack;
IO_STATUS_BLOCK IoStatus; IO_STATUS_BLOCK IoStatus;
/* Initialize the event for waiting */
KeInitializeEvent(&Event, NotificationEvent, FALSE); KeInitializeEvent(&Event, NotificationEvent, FALSE);
/* Build the device I/O control request */
Irp = IoBuildDeviceIoControlRequest(ControlCode, Irp = IoBuildDeviceIoControlRequest(ControlCode,
DeviceObject, DeviceObject,
InputBuffer, InputBuffer,
InputBufferSize, InputBufferSize,
OutputBuffer, OutputBuffer,
OutputBufferSize, OutputBufferSize,
FALSE, FALSE,
&Event, &Event,
&IoStatus); &IoStatus);
if (Irp == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Fail if IRP hasn't been allocated */
if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
/* Set verify override flag if requested */
if (Override) if (Override)
{ {
Stack = IoGetNextIrpStackLocation(Irp); Stack = IoGetNextIrpStackLocation(Irp);
Stack->Flags |= SL_OVERRIDE_VERIFY_VOLUME; Stack->Flags |= SL_OVERRIDE_VERIFY_VOLUME;
} }
/* Call the driver */
Status = IoCallDriver(DeviceObject, Irp); Status = IoCallDriver(DeviceObject, Irp);
/* Wait if needed */
if (Status == STATUS_PENDING) if (Status == STATUS_PENDING)
{ {
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL); KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Status = IoStatus.Status; Status = IoStatus.Status;
} }

View file

@ -344,12 +344,12 @@ FatDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp);
NTSTATUS NTSTATUS
FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject, FatPerformDevIoCtrl(PDEVICE_OBJECT DeviceObject,
ULONG ControlCode, ULONG ControlCode,
PVOID InputBuffer, PVOID InputBuffer,
ULONG InputBufferSize, ULONG InputBufferSize,
PVOID OutputBuffer, PVOID OutputBuffer,
ULONG OutputBufferSize, ULONG OutputBufferSize,
BOOLEAN Override); BOOLEAN Override);
/* ------------------------------------------------------ direntry.c */ /* ------------------------------------------------------ direntry.c */