Handle IRP_MJ_CLOSE with the dispatch routine

svn path=/trunk/; revision=67892
This commit is contained in:
Pierre Schweitzer 2015-05-24 21:29:34 +00:00
parent f73342d9da
commit 1dd645fcbd
4 changed files with 16 additions and 19 deletions

View file

@ -79,35 +79,30 @@ NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
}
NTSTATUS NTAPI
NtfsFsdClose(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
NTSTATUS
NtfsClose(PNTFS_IRP_CONTEXT IrpContext)
{
PDEVICE_EXTENSION DeviceExtension;
PIO_STACK_LOCATION Stack;
PFILE_OBJECT FileObject;
NTSTATUS Status;
PDEVICE_OBJECT DeviceObject;
DPRINT("NtfsClose() called\n");
DeviceObject = IrpContext->DeviceObject;
if (DeviceObject == NtfsGlobalData->DeviceObject)
{
DPRINT("Closing file system\n");
Status = STATUS_SUCCESS;
goto ByeBye;
IrpContext->Irp->IoStatus.Information = 0;
return STATUS_SUCCESS;
}
Stack = IoGetCurrentIrpStackLocation(Irp);
FileObject = Stack->FileObject;
FileObject = IrpContext->FileObject;
DeviceExtension = DeviceObject->DeviceExtension;
Status = NtfsCloseFile(DeviceExtension,FileObject);
Status = NtfsCloseFile(DeviceExtension, FileObject);
ByeBye:
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
IrpContext->Irp->IoStatus.Information = 0;
return Status;
}

View file

@ -96,6 +96,10 @@ NtfsDispatch(PNTFS_IRP_CONTEXT IrpContext)
case IRP_MJ_WRITE:
Status = NtfsWrite(IrpContext);
break;
case IRP_MJ_CLOSE:
Status = NtfsClose(IrpContext);
break;
}
ASSERT((!(IrpContext->Flags & IRPCONTEXT_COMPLETE) && !(IrpContext->Flags & IRPCONTEXT_QUEUE)) ||

View file

@ -124,7 +124,7 @@ NTAPI
NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject)
{
DriverObject->MajorFunction[IRP_MJ_CREATE] = NtfsFsdCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = NtfsFsdClose;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = NtfsFsdDispatch;
DriverObject->MajorFunction[IRP_MJ_READ] = NtfsFsdDispatch;
DriverObject->MajorFunction[IRP_MJ_WRITE] = NtfsFsdDispatch;
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = NtfsFsdDispatch;

View file

@ -521,10 +521,8 @@ NTSTATUS
NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject);
DRIVER_DISPATCH NtfsFsdClose;
NTSTATUS NTAPI
NtfsFsdClose(PDEVICE_OBJECT DeviceObject,
PIRP Irp);
NTSTATUS
NtfsClose(PNTFS_IRP_CONTEXT IrpContext);
/* create.c */