本文整理汇总了C++中IoSetTopLevelIrp函数的典型用法代码示例。如果您正苦于以下问题:C++ IoSetTopLevelIrp函数的具体用法?C++ IoSetTopLevelIrp怎么用?C++ IoSetTopLevelIrp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IoSetTopLevelIrp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FsRtlStackOverflowRead
/*
* @implemented
*/
VOID
NTAPI
FsRtlStackOverflowRead(IN PVOID Context)
{
PSTACK_OVERFLOW_WORK_ITEM WorkItem;
WorkItem = (PSTACK_OVERFLOW_WORK_ITEM)Context;
/* Put us as top IRP for current thread */
IoSetTopLevelIrp((PIRP)FSRTL_FSP_TOP_LEVEL_IRP);
/* And call FsRtlSORoutine */
WorkItem->Routine(WorkItem->Context, WorkItem->Event);
/* If we were using fallback workitem, don't free it, just reset event */
if (WorkItem == &StackOverflowFallback)
{
KeSetEvent(&StackOverflowFallbackSerialEvent, 0, FALSE);
}
/* Otherwise, free the work item */
else
{
ExFreePoolWithTag(WorkItem, 'Fsrs');
}
/* Reset top level */
IoSetTopLevelIrp(NULL);
}
示例2: 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);
}
示例3: 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();
}
示例4: 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;
}
示例5: CdAcquireForCache
BOOLEAN
CdAcquireForCache (
_Inout_ PFCB Fcb,
_In_ BOOLEAN Wait
)
/*++
Routine Description:
The address of this routine is specified when creating a CacheMap for
a file. It is subsequently called by the Lazy Writer for synchronization.
Arguments:
Fcb - The pointer supplied as context to the cache initialization
routine.
Wait - TRUE if the caller is willing to block.
Return Value:
None
--*/
{
PAGED_CODE();
NT_ASSERT(IoGetTopLevelIrp() == NULL);
IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
return ExAcquireResourceSharedLite( Fcb->Resource, Wait );
}
示例6: CdReleaseFromCache
VOID
CdReleaseFromCache (
_Inout_ PFCB Fcb
)
/*++
Routine Description:
The address of this routine is specified when creating a CacheMap for
a virtual file. It is subsequently called by the Lazy Writer to release
a resource acquired above.
Arguments:
Fcb - The pointer supplied as context to the cache initialization
routine.
Return Value:
None
--*/
{
PAGED_CODE();
NT_ASSERT(IoGetTopLevelIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
IoSetTopLevelIrp( NULL );
ExReleaseResourceLite( Fcb->Resource );
}
示例7: DokanBuildRequest
NTSTATUS
DokanBuildRequest(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
BOOLEAN AtIrqlPassiveLevel = FALSE;
BOOLEAN IsTopLevelIrp = FALSE;
NTSTATUS Status = STATUS_UNSUCCESSFUL;
__try {
__try {
AtIrqlPassiveLevel = (KeGetCurrentIrql() == PASSIVE_LEVEL);
if (AtIrqlPassiveLevel) {
FsRtlEnterFileSystem();
}
if (!IoGetTopLevelIrp()) {
IsTopLevelIrp = TRUE;
IoSetTopLevelIrp(Irp);
}
Status = DokanDispatchRequest(DeviceObject, Irp);
}
__except (DokanExceptionFilter(Irp, GetExceptionInformation()))
{
Status = DokanExceptionHandler(DeviceObject, Irp, GetExceptionCode());
}
}
__finally {
if (IsTopLevelIrp) {
IoSetTopLevelIrp(NULL);
}
if (AtIrqlPassiveLevel) {
FsRtlExitFileSystem();
}
}
return Status;
}
示例8: DokanNoOpRelease
VOID DokanNoOpRelease(__in PVOID Fcb) {
DDbgPrint("==> DokanNoOpRelease\n");
ASSERT(IoGetTopLevelIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
IoSetTopLevelIrp(NULL);
UNREFERENCED_PARAMETER(Fcb);
DDbgPrint("<== DokanNoOpRelease\n");
}
示例9: 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);
}
示例10: NtfsReleaseScbFromLazyWrite
VOID
NtfsReleaseScbFromLazyWrite (
IN PVOID OpaqueScb
)
/*++
Routine Description:
The address of this routine is specified when creating a CacheMap for
a file. It is subsequently called by the Lazy Writer after its
performing lazy writes to the file.
Arguments:
Scb - The Scb which was specified as a context parameter for this
routine.
Return Value:
None
--*/
{
ULONG CompressedStream = (ULONG)OpaqueScb & 1;
PSCB Scb = (PSCB)((ULONG)OpaqueScb & ~1);
PFCB Fcb = Scb->Fcb;
ASSERT_SCB(Scb);
PAGED_CODE();
//
// Clear the toplevel at this point, if we set it above.
//
if (IoGetTopLevelIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP) {
IoSetTopLevelIrp( NULL );
}
Scb->LazyWriteThread[CompressedStream] = NULL;
if (NtfsSegmentNumber( &Fcb->FileReference ) <= MASTER_FILE_TABLE2_NUMBER) {
NOTHING;
} else if (Scb->Header.PagingIoResource != NULL) {
ExReleaseResource( Scb->Header.PagingIoResource );
} else {
ExReleaseResource( Scb->Header.Resource );
}
return;
}
示例11: FFSFloppyFlush
VOID
FFSFloppyFlush(
IN PVOID Parameter)
{
PFFS_FLPFLUSH_CONTEXT Context;
PFILE_OBJECT FileObject;
PFFS_FCB Fcb;
PFFS_VCB Vcb;
Context = (PFFS_FLPFLUSH_CONTEXT) Parameter;
FileObject = Context->FileObject;
Fcb = Context->Fcb;
Vcb = Context->Vcb;
FFSPrint((DBG_USER, "FFSFloppyFlushing ...\n"));
IoSetTopLevelIrp((PIRP)FSRTL_FSP_TOP_LEVEL_IRP);
if (Vcb)
{
ExAcquireSharedStarveExclusive(&Vcb->PagingIoResource, TRUE);
ExReleaseResource(&Vcb->PagingIoResource);
CcFlushCache(&(Vcb->SectionObject), NULL, 0, NULL);
}
if (FileObject)
{
ASSERT(Fcb == (PFFS_FCB)FileObject->FsContext);
ExAcquireSharedStarveExclusive(&Fcb->PagingIoResource, TRUE);
ExReleaseResource(&Fcb->PagingIoResource);
CcFlushCache(&(Fcb->SectionObject), NULL, 0, NULL);
ObDereferenceObject(FileObject);
}
IoSetTopLevelIrp(NULL);
ExFreePool(Parameter);
}
示例12: release_from_read_ahead
static void release_from_read_ahead(PVOID Context) {
PFILE_OBJECT FileObject = Context;
fcb* fcb = FileObject->FsContext;
TRACE("(%p)\n", Context);
ExReleaseResourceLite(fcb->Header.Resource);
if (IoGetTopLevelIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP)
IoSetTopLevelIrp(NULL);
}
示例13: Ext2FloppyFlush
VOID
Ext2FloppyFlush(IN PVOID Parameter)
{
PEXT2_FLPFLUSH_CONTEXT Context;
PFILE_OBJECT FileObject;
PEXT2_FCB Fcb;
PEXT2_VCB Vcb;
Context = (PEXT2_FLPFLUSH_CONTEXT) Parameter;
FileObject = Context->FileObject;
Fcb = Context->Fcb;
Vcb = Context->Vcb;
DEBUG(DL_FLP, ("Ext2FloppyFlushing ...\n"));
IoSetTopLevelIrp((PIRP)FSRTL_FSP_TOP_LEVEL_IRP);
if (FileObject) {
ASSERT(Fcb == (PEXT2_FCB)FileObject->FsContext);
ExAcquireSharedStarveExclusive(&Fcb->PagingIoResource, TRUE);
ExReleaseResourceLite(&Fcb->PagingIoResource);
CcFlushCache(&(Fcb->SectionObject), NULL, 0, NULL);
ObDereferenceObject(FileObject);
}
if (Vcb) {
ExAcquireSharedStarveExclusive(&Vcb->PagingIoResource, TRUE);
ExReleaseResourceLite(&Vcb->PagingIoResource);
ExAcquireResourceExclusiveLite(&Vcb->sbi.s_gd_lock, TRUE);
Ext2DropBH(Vcb);
CcFlushCache(&(Vcb->SectionObject), NULL, 0, NULL);
ExReleaseResourceLite(&Vcb->sbi.s_gd_lock);
}
IoSetTopLevelIrp(NULL);
Ext2FreePool(Parameter, EXT2_FLPFLUSH_MAGIC);
}
示例14: FatIsTopLevelIrp
BOOLEAN
NTAPI
FatIsTopLevelIrp(IN PIRP Irp)
{
if (!IoGetTopLevelIrp())
{
IoSetTopLevelIrp(Irp);
return TRUE;
}
return FALSE;
}
示例15: acquire_for_read_ahead
static BOOLEAN acquire_for_read_ahead(PVOID Context, BOOLEAN Wait) {
PFILE_OBJECT FileObject = Context;
fcb* fcb = FileObject->FsContext;
TRACE("(%p, %u)\n", Context, Wait);
if (!ExAcquireResourceSharedLite(fcb->Header.Resource, Wait))
return FALSE;
IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
return TRUE;
}