VOID Ext2DeQueueCloseRequest (IN PVOID Context) { PEXT2_IRP_CONTEXT IrpContext; IrpContext = (PEXT2_IRP_CONTEXT) Context; ASSERT(IrpContext); ASSERT((IrpContext->Identifier.Type == EXT2ICX) && (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT))); __try { __try { FsRtlEnterFileSystem(); Ext2Close(IrpContext); } __except (Ext2ExceptionFilter(IrpContext, GetExceptionInformation())) { Ext2ExceptionHandler(IrpContext); } } __finally { FsRtlExitFileSystem(); } }
/************************************************************************* * * Function: Ext2Close() * * Description: * The I/O Manager will invoke this routine to handle a close * request * * Expected Interrupt Level (for execution) : * * IRQL_PASSIVE_LEVEL (invocation at higher IRQL will cause execution * to be deferred to a worker thread context) * * Return Value: Does not matter! * *************************************************************************/ NTSTATUS NTAPI Ext2Close( PDEVICE_OBJECT DeviceObject, // the logical volume device object PIRP Irp) // I/O Request Packet { NTSTATUS RC = STATUS_SUCCESS; PtrExt2IrpContext PtrIrpContext = NULL; BOOLEAN AreWeTopLevel = FALSE; DebugTrace(DEBUG_TRACE_IRP_ENTRY, "Close IRP Received...", 0); FsRtlEnterFileSystem(); ASSERT(DeviceObject); ASSERT(Irp); // set the top level context AreWeTopLevel = Ext2IsIrpTopLevel(Irp); try { // get an IRP context structure and issue the request PtrIrpContext = Ext2AllocateIrpContext(Irp, DeviceObject); ASSERT(PtrIrpContext); RC = Ext2CommonClose(PtrIrpContext, Irp, TRUE); } except (Ext2ExceptionFilter(PtrIrpContext, GetExceptionInformation())) { RC = Ext2ExceptionHandler(PtrIrpContext, Irp); Ext2LogEvent(EXT2_ERROR_INTERNAL_ERROR, RC); } if (AreWeTopLevel) { IoSetTopLevelIrp(NULL); } FsRtlExitFileSystem(); return(RC); }
VOID Ext2DeQueueRequest (IN PVOID Context) { PEXT2_IRP_CONTEXT IrpContext; IrpContext = (PEXT2_IRP_CONTEXT) Context; ASSERT(IrpContext); ASSERT((IrpContext->Identifier.Type == EXT2ICX) && (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT))); __try { __try { FsRtlEnterFileSystem(); if (!IrpContext->IsTopLevel) { IoSetTopLevelIrp((PIRP) FSRTL_FSP_TOP_LEVEL_IRP); } Ext2DispatchRequest(IrpContext); } __except (Ext2ExceptionFilter(IrpContext, GetExceptionInformation())) { Ext2ExceptionHandler(IrpContext); } } __finally { IoSetTopLevelIrp(NULL); FsRtlExitFileSystem(); } }
NTSTATUS Ext2BuildRequest (PDEVICE_OBJECT DeviceObject, PIRP Irp) { BOOLEAN AtIrqlPassiveLevel = FALSE; BOOLEAN IsTopLevelIrp = FALSE; PEXT2_IRP_CONTEXT IrpContext = NULL; NTSTATUS Status = STATUS_UNSUCCESSFUL; __try { __try { #if EXT2_DEBUG Ext2DbgPrintCall(DeviceObject, Irp); #endif AtIrqlPassiveLevel = (KeGetCurrentIrql() == PASSIVE_LEVEL); if (AtIrqlPassiveLevel) { FsRtlEnterFileSystem(); } if (!IoGetTopLevelIrp()) { IsTopLevelIrp = TRUE; IoSetTopLevelIrp(Irp); } IrpContext = Ext2AllocateIrpContext(DeviceObject, Irp); if (!IrpContext) { Status = STATUS_INSUFFICIENT_RESOURCES; Irp->IoStatus.Status = Status; Ext2CompleteRequest(Irp, TRUE, IO_NO_INCREMENT); } else { if ((IrpContext->MajorFunction == IRP_MJ_CREATE) && !AtIrqlPassiveLevel) { DbgBreak(); } Status = Ext2DispatchRequest(IrpContext); } } __except (Ext2ExceptionFilter(IrpContext, GetExceptionInformation())) { Status = Ext2ExceptionHandler(IrpContext); } } __finally { if (IsTopLevelIrp) { IoSetTopLevelIrp(NULL); } if (AtIrqlPassiveLevel) { FsRtlExitFileSystem(); } } return Status; }