sys: fsctl

This commit is contained in:
Bill Zissimopoulos 2015-12-21 16:04:10 -08:00
parent e71ecd5fa1
commit 68eefd9e24

View File

@ -394,24 +394,17 @@ static NTSTATUS FspFsctlTransact(
PIRP ProcessIrp, PendingIrp;
LARGE_INTEGER Timeout;
Result = STATUS_SUCCESS;
FsContext2 = IrpSp->FileObject->FsContext2;
ExAcquireFastMutex(&FsContext2->FastMutex);
try
{
/* check to see if we already have a volume */
FsvolDeviceObject = FsContext2->FsvolDeviceObject;
if (0 != FsvolDeviceObject)
{
BOOLEAN Success; (VOID)Success;
/* this must succeed because our volume device exists until IRP_MJ_CLEANUP */
Success = FspDeviceRetain(FsvolDeviceObject);
ASSERT(Success);
Result = STATUS_SUCCESS;
}
else
if (0 == FsvolDeviceObject)
Result = STATUS_ACCESS_DENIED;
/* no need to FspDeviceRetain our volume device, because it exists until IRP_MJ_CLEANUP */
}
finally
{
@ -420,8 +413,6 @@ static NTSTATUS FspFsctlTransact(
if (!NT_SUCCESS(Result))
return Result;
try
{
FsvolDeviceExtension = FspFsvolDeviceExtension(FsvolDeviceObject);
/* process any user-mode file system responses */
@ -447,8 +438,7 @@ static NTSTATUS FspFsctlTransact(
if (0 == Irp->MdlAddress)
{
Irp->IoStatus.Information = 0;
Result = STATUS_SUCCESS;
goto exit;
return STATUS_SUCCESS;
}
MdlBuffer = MmGetMdlVirtualAddress(Irp->MdlAddress);
ASSERT(0 != MdlBuffer);
@ -460,16 +450,12 @@ static NTSTATUS FspFsctlTransact(
while (0 == (PendingIrp = FspIoqNextPendingIrp(&FsvolDeviceExtension->Ioq, &Timeout)))
{
if (FspIoqStopped(&FsvolDeviceExtension->Ioq))
{
Result = STATUS_CANCELLED;
goto exit;
}
return STATUS_CANCELLED;
}
if (FspIoqTimeout == PendingIrp)
{
Irp->IoStatus.Information = 0;
Result = STATUS_SUCCESS;
goto exit;
return STATUS_SUCCESS;
}
/* send any pending IRP's to the user-mode file system */
@ -498,8 +484,7 @@ static NTSTATUS FspFsctlTransact(
*/
ASSERT(FspIoqStopped(&FsvolDeviceExtension->Ioq));
FspIopCompleteIrp(PendingIrp, STATUS_CANCELLED);
Result = STATUS_CANCELLED;
goto exit;
return STATUS_CANCELLED;
}
/* check that we have enough space before pulling the next pending IRP off the queue */
@ -516,13 +501,6 @@ static NTSTATUS FspFsctlTransact(
Irp->IoStatus.Information = (PUINT8)Request - (PUINT8)MdlBuffer;
Result = STATUS_SUCCESS;
exit:;
}
finally
{
FspDeviceRelease(FsvolDeviceObject);
}
return Result;
}