return Status;
}
}
- else
- {
- /* Use local event */
- Event = ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_IO);
- if (!Event)
- {
- ObDereferenceObject(FileObject);
- return STATUS_INSUFFICIENT_RESOURCES;
- }
- KeInitializeEvent(Event, SynchronizationEvent, FALSE);
- LocalEvent = TRUE;
- }
/*
* Quick path for FileFsDeviceInformation - the kernel has enough
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- /* Cleanup */
- IopCleanupAfterException(FileObject, NULL, NULL, Event);
+ /* Check if we had a file lock */
+ if (BooleanFlagOn(FileObject->Flags, FO_SYNCHRONOUS_IO))
+ {
+ /* Release it */
+ IopUnlockFileObject(FileObject);
+ }
+
+ /* Dereference the FO */
+ ObDereferenceObject(FileObject);
+
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
- /*
- * We didn't have an exception, but we didn't issue an IRP
- * to complete either, so avoid duplicating code and
- * call appropriate helper
- */
- IopCleanupAfterException(FileObject, NULL, NULL, Event);
+ /* Check if we had a file lock */
+ if (BooleanFlagOn(FileObject->Flags, FO_SYNCHRONOUS_IO))
+ {
+ /* Release it */
+ IopUnlockFileObject(FileObject);
+ }
+
+ /* Dereference the FO */
+ ObDereferenceObject(FileObject);
return STATUS_SUCCESS;
}
ExFreePoolWithTag(DriverPathInfo, TAG_IO);
}
- /*
- * We didn't have an exception, but we didn't issue an IRP
- * to complete either, so avoid duplicating code and
- * call appropriate helper
- */
- IopCleanupAfterException(FileObject, NULL, NULL, Event);
+ /* Check if we had a file lock */
+ if (BooleanFlagOn(FileObject->Flags, FO_SYNCHRONOUS_IO))
+ {
+ /* Release it */
+ IopUnlockFileObject(FileObject);
+ }
+
+ /* Dereference the FO */
+ ObDereferenceObject(FileObject);
return Status;
}
+ if (!BooleanFlagOn(FileObject->Flags, FO_SYNCHRONOUS_IO))
+ {
+ /* Use local event */
+ Event = ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_IO);
+ if (!Event)
+ {
+ ObDereferenceObject(FileObject);
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+ KeInitializeEvent(Event, SynchronizationEvent, FALSE);
+ LocalEvent = TRUE;
+ }
+
/* Get the device object */
DeviceObject = IoGetRelatedDeviceObject(FileObject);