本文整理汇总了C++中FsRtlEnterFileSystem函数的典型用法代码示例。如果您正苦于以下问题:C++ FsRtlEnterFileSystem函数的具体用法?C++ FsRtlEnterFileSystem怎么用?C++ FsRtlEnterFileSystem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FsRtlEnterFileSystem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Ext2DeQueueCloseRequest
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();
}
}
示例2: FatCleanup
NTSTATUS
NTAPI
FatCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
PFAT_IRP_CONTEXT IrpContext;
NTSTATUS Status;
DPRINT("FatCleanup(DeviceObject %p, Irp %p)\n", DeviceObject, Irp);
/* FatCleanup works only with a volume device object */
if (DeviceObject == FatGlobalData.DiskDeviceObject)
{
/* Complete the request and return success */
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = FILE_OPENED;
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
return STATUS_SUCCESS;
}
/* Enter FsRtl critical region */
FsRtlEnterFileSystem();
/* Build an irp context */
IrpContext = FatBuildIrpContext(Irp, TRUE);
/* Call internal function */
Status = FatiCleanup(IrpContext, Irp);
/* Leave FsRtl critical region */
FsRtlExitFileSystem();
return Status;
}
示例3: FFSDeQueueCloseRequest
VOID NTAPI
FFSDeQueueCloseRequest(
IN PVOID Context)
{
PFFS_IRP_CONTEXT IrpContext;
PAGED_CODE();
IrpContext = (PFFS_IRP_CONTEXT) Context;
ASSERT(IrpContext);
ASSERT((IrpContext->Identifier.Type == FFSICX) &&
(IrpContext->Identifier.Size == sizeof(FFS_IRP_CONTEXT)));
_SEH2_TRY
{
_SEH2_TRY
{
FsRtlEnterFileSystem();
FFSClose(IrpContext);
}
_SEH2_EXCEPT (FFSExceptionFilter(IrpContext, _SEH2_GetExceptionInformation()))
{
FFSExceptionHandler(IrpContext);
} _SEH2_END;
}
_SEH2_FINALLY
{
FsRtlExitFileSystem();
} _SEH2_END;
}
示例4: FatDequeueRequest
VOID
NTAPI
FatDequeueRequest(IN PVOID Context)
{
PFAT_IRP_CONTEXT IrpContext;
IrpContext = (PFAT_IRP_CONTEXT) Context;
/* Enter critical region. */
FsRtlEnterFileSystem();
/* Handle top level IRP Correctly. */
if (!FlagOn(IrpContext->Flags, IRPCONTEXT_TOPLEVEL))
IoSetTopLevelIrp((PIRP) FSRTL_FSP_TOP_LEVEL_IRP);
/* Enable Synchronous IO. */
SetFlag(IrpContext->Flags, IRPCONTEXT_CANWAIT);
/* Invoke the handler routine. */
IrpContext->QueuedOperationHandler(IrpContext);
/* Restore top level IRP. */
IoSetTopLevelIrp(NULL);
/* Leave critical region. */
FsRtlExitFileSystem();
}
示例5: Ext2FileSystemControl
/*************************************************************************
*
* Function: Ext2FileSystemControl
*
* Description:
* The I/O Manager will invoke this routine to handle a
* File System Control IRP
*
* Expected Interrupt Level (for execution) :
*
* ???
*
* Arguments:
*
* DeviceObject - Supplies the volume device object where the
* file exists
*
* Irp - Supplies the Irp being processed
*
*
* Return Value:
*
* NTSTATUS - The FSD status for the IRP
*
*************************************************************************/
NTSTATUS NTAPI
Ext2FileSystemControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
NTSTATUS Status = STATUS_SUCCESS;
PIO_STACK_LOCATION IrpSp;
DebugTrace(DEBUG_TRACE_IRP_ENTRY, "File System Control IRP Received...", 0);
// Ext2BreakPoint();
FsRtlEnterFileSystem();
ASSERT(DeviceObject);
ASSERT(Irp);
//
// Get a pointer to the current Irp stack location
//
IrpSp = IoGetCurrentIrpStackLocation( Irp );
if( IrpSp->MinorFunction == IRP_MN_MOUNT_VOLUME )
{
DebugTrace(DEBUG_TRACE_MOUNT, "Mount Request Received...", 0);
Status = Ext2MountVolume ( Irp, IrpSp );
Ext2CompleteRequest( Irp, Status );
}
else if( IrpSp->MinorFunction == IRP_MN_USER_FS_REQUEST )
{
DebugTrace(DEBUG_TRACE_FSCTRL, "IRP_MN_USER_FS_REQUEST received...", 0);
Status = Ext2UserFileSystemRequest( Irp, IrpSp );
Ext2CompleteRequest( Irp, Status );
}
else
{
if( IrpSp->MinorFunction == IRP_MN_VERIFY_VOLUME )
{
DebugTrace(DEBUG_TRACE_FSCTRL, "IRP_MN_VERIFY_VOLUME received...", 0);
}
else if( IrpSp->MinorFunction == IRP_MN_LOAD_FILE_SYSTEM )
{
DebugTrace(DEBUG_TRACE_FSCTRL, "IRP_MN_LOAD_FILE_SYSTEM received...", 0);
}
else
{
DebugTrace(DEBUG_TRACE_FSCTRL, "Unknown Minor IRP code received...", 0);
}
Status = STATUS_INVALID_DEVICE_REQUEST;
Ext2CompleteRequest( Irp, Status );
}
FsRtlExitFileSystem();
return Status;
}
示例6: NpFsdQueryVolumeInformation
NTSTATUS
NTAPI
NpFsdQueryVolumeInformation(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
NTSTATUS Status;
PAGED_CODE();
TRACE("Entered\n");
FsRtlEnterFileSystem();
NpAcquireSharedVcb();
Status = NpCommonQueryVolumeInformation(DeviceObject, Irp);
NpReleaseVcb();
FsRtlExitFileSystem();
if (Status != STATUS_PENDING)
{
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
}
TRACE("Leaving, Status = %lx\n", Status);
return Status;
}
示例7: LklDequeueRequest
VOID DDKAPI LklDequeueRequest(IN PDEVICE_OBJECT device, IN PVOID context)
{
NTSTATUS status;
PIRPCONTEXT irp_context;
irp_context = (PIRPCONTEXT) context;
ASSERT(irp_context);
ASSERT(irp_context->id.type == IRP_CONTEXT && irp_context->id.size == sizeof(IRPCONTEXT));
IoFreeWorkItem(irp_context->work_item);
if (FLAG_ON(irp_context->flags, VFS_IRP_CONTEXT_NOT_TOP_LEVEL))
IoSetTopLevelIrp((PIRP)FSRTL_FSP_TOP_LEVEL_IRP);
SET_FLAG(irp_context->flags, VFS_IRP_CONTEXT_CAN_BLOCK);
FsRtlEnterFileSystem();
status = LklDispatchRequest(irp_context);
FsRtlExitFileSystem();
IoSetTopLevelIrp(NULL);
}
示例8: FatLockControl
NTSTATUS
NTAPI
FatLockControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
PFAT_IRP_CONTEXT IrpContext;
NTSTATUS Status;
BOOLEAN TopLevel;
DPRINT1("FatLockControl()\n");
/* Enter FsRtl critical region */
FsRtlEnterFileSystem();
/* Set Top Level IRP if not set */
TopLevel = FatIsTopLevelIrp(Irp);
/* Build an irp context */
IrpContext = FatBuildIrpContext(Irp, IoIsOperationSynchronous(Irp));
/* Call internal function */
Status = FatiLockControl(IrpContext, Irp);
/* Reset Top Level IRP */
if (TopLevel) IoSetTopLevelIrp(NULL);
/* Leave FsRtl critical region */
FsRtlExitFileSystem();
return Status;
}
示例9: FatFileSystemControl
NTSTATUS
NTAPI
FatFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
NTSTATUS Status = STATUS_SUCCESS;
PFAT_IRP_CONTEXT IrpContext;
BOOLEAN CanWait = TRUE;
DPRINT("FatFileSystemControl(DeviceObject %p, Irp %p)\n", DeviceObject, Irp);
/* Get CanWait flag */
if (IoGetCurrentIrpStackLocation(Irp)->FileObject)
{
CanWait = IoIsOperationSynchronous(Irp);
}
/* Enter FsRtl critical region */
FsRtlEnterFileSystem();
/* Build an irp context */
IrpContext = FatBuildIrpContext(Irp, CanWait);
/* Call internal function */
Status = FatiFileSystemControl(IrpContext, Irp);
/* Leave FsRtl critical region */
FsRtlExitFileSystem();
return Status;
}
示例10: FatCloseWorker
VOID
FatCloseWorker (
_In_ PDEVICE_OBJECT DeviceObject,
_In_opt_ PVOID Context
)
/*++
Routine Description:
This routine is a shim between the IO worker package and FatFspClose.
Arguments:
DeviceObject - Registration device object, unused
Context - Context value, unused
Return Value:
None.
--*/
{
PAGED_CODE();
UNREFERENCED_PARAMETER( DeviceObject );
FsRtlEnterFileSystem();
FatFspClose (Context);
FsRtlExitFileSystem();
}
示例11: Ext2FastIoWrite
BOOLEAN
Ext2FastIoWrite (
IN PFILE_OBJECT FileObject,
IN PLARGE_INTEGER FileOffset,
IN ULONG Length,
IN BOOLEAN Wait,
IN ULONG LockKey,
OUT PVOID Buffer,
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject)
{
PEXT2_FCB Fcb = NULL;
BOOLEAN Status = FALSE;
BOOLEAN Locked = FALSE;
Fcb = (PEXT2_FCB) FileObject->FsContext;
if (Fcb == NULL)
return FALSE;
__try {
FsRtlEnterFileSystem();
ASSERT((Fcb->Identifier.Type == EXT2FCB) &&
(Fcb->Identifier.Size == sizeof(EXT2_FCB)));
if (IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY)) {
__leave;
}
ExAcquireResourceSharedLite(&Fcb->MainResource, TRUE);
Locked = TRUE;
if (IsEndOfFile(*FileOffset) || ((LONGLONG)(Fcb->Inode->i_size) <
(FileOffset->QuadPart + Length)) ) {
} else {
ExReleaseResourceLite(&Fcb->MainResource);
Locked = FALSE;
Status = FsRtlCopyWrite(FileObject, FileOffset, Length, Wait,
LockKey, Buffer, IoStatus, DeviceObject);
}
} __finally {
if (Locked) {
ExReleaseResourceLite(&Fcb->MainResource);
}
FsRtlExitFileSystem();
}
DEBUG(DL_IO, ("Ext2FastIoWrite: %wZ Offset: %I64xh Length: %xh Key: %xh Status=%d\n",
&Fcb->Mcb->ShortName, FileOffset->QuadPart, Length, LockKey, Status));
return Status;
}
示例12: UDFClose
/*************************************************************************
*
* Function: UDFClose()
*
* 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: STATUS_SUCCESS
*
*************************************************************************/
NTSTATUS
NTAPI
UDFClose(
PDEVICE_OBJECT DeviceObject, // the logical volume device object
PIRP Irp // I/O Request Packet
)
{
NTSTATUS RC = STATUS_SUCCESS;
PtrUDFIrpContext PtrIrpContext = NULL;
BOOLEAN AreWeTopLevel = FALSE;
AdPrint(("UDFClose: \n"));
FsRtlEnterFileSystem();
ASSERT(DeviceObject);
ASSERT(Irp);
// If we were called with our file system device object instead of a
// volume device object, just complete this request with STATUS_SUCCESS
if (UDFIsFSDevObj(DeviceObject)) {
// this is a close of the FSD itself
Irp->IoStatus.Status = RC;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
FsRtlExitFileSystem();
return(RC);
}
// set the top level context
AreWeTopLevel = UDFIsIrpTopLevel(Irp);
_SEH2_TRY {
// get an IRP context structure and issue the request
PtrIrpContext = UDFAllocateIrpContext(Irp, DeviceObject);
ASSERT(PtrIrpContext);
RC = UDFCommonClose(PtrIrpContext, Irp);
} _SEH2_EXCEPT(UDFExceptionFilter(PtrIrpContext, _SEH2_GetExceptionInformation())) {
RC = UDFExceptionHandler(PtrIrpContext, Irp);
UDFLogEvent(UDF_ERROR_INTERNAL_ERROR, RC);
} _SEH2_END;
if (AreWeTopLevel) {
IoSetTopLevelIrp(NULL);
}
FsRtlExitFileSystem();
return(RC);
}
示例13: DfsFsdCleanup
NTSTATUS
DfsFsdCleanup (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
) {
NTSTATUS Status;
PIRP_CONTEXT IrpContext;
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
PFILE_OBJECT FileObject = IrpSp->FileObject;
TYPE_OF_OPEN TypeOfOpen;
PDFS_VCB Vcb;
PDFS_FCB Fcb;
DfsDbgTrace(+1, Dbg, "DfsFsdCleanup: Entered\n", 0);
ASSERT(IoIsOperationSynchronous(Irp) == TRUE);
//
// Now, pass through to the device that opened the file for us if the
// file was a redirected open of some kind.
//
if (DeviceObject->DeviceType == FILE_DEVICE_DFS) {
TypeOfOpen = DfsDecodeFileObject( FileObject, &Vcb, &Fcb);
if (TypeOfOpen == RedirectedFileOpen) {
Status = DfsVolumePassThrough(DeviceObject, Irp);
DfsDbgTrace(-1, Dbg, "DfsFsdCleanup: RedirectedOpen.Exit -> %08lx\n", Status );
return Status;
}
}
//
// TypeOfOpen != RedirectedFileOpen. We do nothing special for cleanup;
// everything is done in the close routine.
//
FsRtlEnterFileSystem();
Status = STATUS_SUCCESS;
DfsCompleteRequest( NULL, Irp, Status );
FsRtlExitFileSystem();
//
// And return to our caller
//
DfsDbgTrace(-1, Dbg, "DfsFsdCleanup: Exit -> %08lx\n", Status);
return Status;
}
示例14: DfsFsdClose
NTSTATUS
DfsFsdClose (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
) {
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
NTSTATUS Status;
PIRP_CONTEXT IrpContext;
DfsDbgTrace(+1, Dbg, "DfsFsdClose: Entered\n", 0);
ASSERT(IoIsOperationSynchronous(Irp) == TRUE);
if (DeviceObject->DeviceType == FILE_DEVICE_DFS_VOLUME) {
if (DfsLookupFcb(IrpSp->FileObject) == NULL) {
Status = DfsVolumePassThrough(DeviceObject, Irp);
DfsDbgTrace(-1, Dbg, "DfsFsdClose: Exit -> %08lx\n", Status );
return Status;
}
}
//
// Call the common close routine, with blocking allowed if synchronous
//
FsRtlEnterFileSystem();
try {
IrpContext = DfsCreateIrpContext( Irp, CanFsdWait( Irp ) );
Status = DfsCommonClose( IrpContext, Irp );
} except(DfsExceptionFilter( IrpContext, GetExceptionCode(), GetExceptionInformation() )) {
//
// We had some trouble trying to perform the requested
// operation, so we'll abort the I/O request with
// the error status that we get back from the
// execption code
//
Status = DfsProcessException( IrpContext, Irp, GetExceptionCode() );
}
FsRtlExitFileSystem();
//
// And return to our caller
//
DfsDbgTrace(-1, Dbg, "DfsFsdClose: Exit -> %08lx\n", Status);
return Status;
}
示例15: UDFShutdown
/*************************************************************************
*
* Function: UDFShutdown()
*
* Description:
* All disk-based FSDs can expect to receive this shutdown notification
* request whenever the system is about to be halted gracefully. If you
* design and implement a network redirector, you must register explicitly
* for shutdown notification by invoking the IoRegisterShutdownNotification()
* routine from your driver entry.
*
* Note that drivers that register to receive shutdown notification get
* invoked BEFORE disk-based FSDs are told about the shutdown notification.
*
* Expected Interrupt Level (for execution) :
*
* IRQL_PASSIVE_LEVEL
*
* Return Value: Irrelevant.
*
*************************************************************************/
NTSTATUS
NTAPI
UDFShutdown(
PDEVICE_OBJECT DeviceObject, // the logical volume device object
PIRP Irp // I/O Request Packet
)
{
NTSTATUS RC = STATUS_SUCCESS;
PtrUDFIrpContext PtrIrpContext = NULL;
BOOLEAN AreWeTopLevel = FALSE;
KdPrint(("UDFShutDown\n"));
// BrutePoint();
FsRtlEnterFileSystem();
ASSERT(DeviceObject);
ASSERT(Irp);
// set the top level context
AreWeTopLevel = UDFIsIrpTopLevel(Irp);
//ASSERT(!UDFIsFSDevObj(DeviceObject));
_SEH2_TRY {
// get an IRP context structure and issue the request
PtrIrpContext = UDFAllocateIrpContext(Irp, DeviceObject);
if(PtrIrpContext) {
RC = UDFCommonShutdown(PtrIrpContext, Irp);
} else {
RC = STATUS_INSUFFICIENT_RESOURCES;
Irp->IoStatus.Status = RC;
Irp->IoStatus.Information = 0;
// complete the IRP
IoCompleteRequest(Irp, IO_DISK_INCREMENT);
}
} _SEH2_EXCEPT(UDFExceptionFilter(PtrIrpContext, _SEH2_GetExceptionInformation())) {
RC = UDFExceptionHandler(PtrIrpContext, Irp);
UDFLogEvent(UDF_ERROR_INTERNAL_ERROR, RC);
} _SEH2_END;
if (AreWeTopLevel) {
IoSetTopLevelIrp(NULL);
}
FsRtlExitFileSystem();
return(RC);
} // end UDFShutdown()