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 NTSTATUS
NtfsFsdClose(PDEVICE_OBJECT DeviceObject, NtfsClose(PNTFS_IRP_CONTEXT IrpContext)
PIRP Irp)
{ {
PDEVICE_EXTENSION DeviceExtension; PDEVICE_EXTENSION DeviceExtension;
PIO_STACK_LOCATION Stack;
PFILE_OBJECT FileObject; PFILE_OBJECT FileObject;
NTSTATUS Status; NTSTATUS Status;
PDEVICE_OBJECT DeviceObject;
DPRINT("NtfsClose() called\n"); DPRINT("NtfsClose() called\n");
DeviceObject = IrpContext->DeviceObject;
if (DeviceObject == NtfsGlobalData->DeviceObject) if (DeviceObject == NtfsGlobalData->DeviceObject)
{ {
DPRINT("Closing file system\n"); DPRINT("Closing file system\n");
Status = STATUS_SUCCESS; IrpContext->Irp->IoStatus.Information = 0;
goto ByeBye; return STATUS_SUCCESS;
} }
Stack = IoGetCurrentIrpStackLocation(Irp); FileObject = IrpContext->FileObject;
FileObject = Stack->FileObject;
DeviceExtension = DeviceObject->DeviceExtension; DeviceExtension = DeviceObject->DeviceExtension;
Status = NtfsCloseFile(DeviceExtension,FileObject); Status = NtfsCloseFile(DeviceExtension, FileObject);
ByeBye: IrpContext->Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status; return Status;
} }

View file

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

View file

@ -124,7 +124,7 @@ NTAPI
NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject) NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject)
{ {
DriverObject->MajorFunction[IRP_MJ_CREATE] = NtfsFsdCreate; 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_READ] = NtfsFsdDispatch;
DriverObject->MajorFunction[IRP_MJ_WRITE] = NtfsFsdDispatch; DriverObject->MajorFunction[IRP_MJ_WRITE] = NtfsFsdDispatch;
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = NtfsFsdDispatch; DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = NtfsFsdDispatch;

View file

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