IopCallDriverReference
VOID __fastcall IopCallDriverReference(
_DEVICE_OBJECT *DeviceObject,
_IRP *Irp,
UINT8 SynchronousIo,
_FILE_OBJECT *FileObject,
_TRANSFER_TYPE TransferType){
_DWORD *FileObjectExtension;
int v10;
_IO_PRIORITY_HINT BaseIoPriorityThread;
__int64 v12;
unsigned int v13;
int v14;
unsigned int v15;
int v16;
int v17;
char *IrpExtension;
_ETHREAD *v19;
unsigned int Flags;
_ETHREAD *Thread;
_ETHREAD *CurrentThread;
_LIST_ENTRY *ActivityId;
__int128 v24;
if( !SynchronousIo )
{
if( ObpTraceFlags )
ObpPushStackInfo((_OBJECT_HEADER *)&FileObject[-1].gap80[40], 1u, 1ui64, 0x746C6644ui64);
ObpIncrPointerCount((_OBJECT_HEADER *)&FileObject[-1].gap80[40]);
}
FileObjectExtension = FileObject->FileObjectExtension;
v10 = 2;
if( FileObjectExtension && FileObjectExtension[20] )
{
v13 = Irp->Flags & 0xFFF1FFFF;
Irp->Flags = v13;
v14 = FileObjectExtension[20] << 17;
}
else
{
BaseIoPriorityThread = PsGetBaseIoPriorityThread((_ETHREAD *)KeGetCurrentThread());
if( BaseIoPriorityThread < v10 && (struct _KTHREAD *)v12 == KeGetCurrentThread() && *(_DWORD *)(v12 + 1360) )
BaseIoPriorityThread = v10;
v13 = Irp->Flags & 0xFFF1FFFF;
v14 = (BaseIoPriorityThread << 17) + 0x20000;
}
v15 = v13 | v14;
Irp->Flags = v15;
v16 = (v15 >> 17) & 7;
if( !v16 )
{
v17 = v10;
LABEL_7:
v10 = v17;
goto LABEL_8;
}
v17 = v16 - 1;
if( v17 >= v10 )
goto LABEL_7;
Thread = Irp->Tail.Thread;
if( !Thread || !Thread->IoBoostCount )
goto LABEL_7;
LABEL_8:
if( !Irp->RequestorMode )
{
if( v10 >= 2 )
goto LABEL_10;
v19 = Irp->Tail.Thread;
if( !v19 || (v19->Tcb._bf_0 & 0x400) == 0 && (v19->SameThreadPassiveFlags & 0x80u) == 0 )
{
Flags = Irp->Flags;
++*(&stru_140C452E0 + 285);
Irp->Flags = Flags & 0xFFF1FFFF | 0x60000;
goto LABEL_10;
}
}
if( v10 < 2 )
{
if( TransferType )
{
if( TransferType == WriteTransfer )
++*(&stru_140C452E0 + 284);
}
else
{
++*(&stru_140C452E0 + 283);
}
}
LABEL_10:
if( (Irp->AllocationFlags & 0x80u) == 0
&& (IrpExtension = (char *)Irp->Tail.IrpExtension) != 0i64
&& (*IrpExtension & 2) != 0 )
{
v24 = *(_OWORD *)(IrpExtension + 24);
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
ActivityId = (_LIST_ENTRY *)CurrentThread->ActivityId;
CurrentThread->ActivityId = (const _GUID *)&v24;
IofCallDriver((UINT64)DeviceObject, (UINT64)Irp);
KeGetCurrentThread()[1].WaitBlock[1].WaitListEntry.Flink = ActivityId;
}
else
{
IofCallDriver((UINT64)DeviceObject, (UINT64)Irp);
}
if( !SynchronousIo )
ObDereferenceObjectDeferDeleteWithTag((UINT64)FileObject, 1953261124i64);
}Referenced by:
NtQueryInformationFile
NtSetInformationFile