PsBoostThreadIoEx
void __fastcall PsBoostThreadIoEx(__int64 a1, char a2, char a3, void *a4){
signed __int32 v4;
unsigned __int8 v5;
char v7;
PVOID *v10;
bool v11;
unsigned __int8 CurrentIrql;
struct _KPRCB *CurrentPrcb;
PVOID *PoolWithTag;
UINT64 v15;
unsigned __int8 v16;
__int64 **v17;
__int64 *v18;
__int64 **v19;
__int64 *v20;
__int64 v21;
PVOID **v22;
__int64 v23;
PVOID **v24;
v4 = 0;
v5 = 0;
v7 = a3;
v10 = 0i64;
if( PspAlwaysTrackIoBoosting )
{
v7 = 1;
}
else if( !a3 )
{
goto LABEL_3;
}
PoolWithTag = (PVOID *)ExAllocatePoolWithTag(NonPagedPoolNx, 0x70ui64, 0x736F6F42ui64);
v10 = PoolWithTag;
if( PoolWithTag )
{
memset((INT64)PoolWithTag, 0i64);
RtlCaptureStackBackTrace(1ui64, 0xAui64, v10 + 2, 0i64);
v10[12] = KeGetCurrentThread();
v10[13] = a4;
}
KeAcquireSpinLockRaiseToDpc((UINT64 *)(a1 + 1408), v15);
v5 = v16;
LABEL_3:
if( a2 )
{
if( *(_DWORD *)(a1 + 1360) )
{
v4 = _InterlockedDecrement((volatile signed __int32 *)(a1 + 1360));
if( !v7 )
goto LABEL_6;
if( !*(_DWORD *)(a1 + 1360) )
{
if( v10 )
ExFreePoolWithTag(v10, 0x736F6F42u);
v17 = (__int64 **)(a1 + 1376);
while( 1 )
{
v18 = *v17;
if( *v17 == (__int64 *)v17 )
break;
v21 = *v18;
if( (__int64 **)v18[1] != v17 || *(__int64 **)(v21 + 8) != v18 )
goto LABEL_36;
*v17 = (__int64 *)v21;
*(_QWORD *)(v21 + 8) = v17;
ExFreePoolWithTag(v18, 0x736F6F42u);
}
v19 = (__int64 **)(a1 + 1392);
while( 1 )
{
v20 = *v19;
if( *v19 == (__int64 *)v19 )
goto LABEL_27;
v23 = *v20;
if( (__int64 **)v20[1] != v19 || *(__int64 **)(v23 + 8) != v20 )
goto LABEL_36;
*v19 = (__int64 *)v23;
*(_QWORD *)(v23 + 8) = v19;
ExFreePoolWithTag(v20, 0x736F6F42u);
}
}
if( v10 )
{
v24 = *(PVOID ***)(a1 + 1400);
if( *v24 == (PVOID *)(a1 + 1392) )
{
*v10 = (PVOID)(a1 + 1392);
v10[1] = v24;
*v24 = v10;
*(_QWORD *)(a1 + 1400) = v10;
goto LABEL_27;
}
LABEL_36:
__fastfail(3u);
}
}
}
else
{
v4 = _InterlockedIncrement((volatile signed __int32 *)(a1 + 1360));
if( !v7 )
goto LABEL_13;
if( !v10 )
goto LABEL_27;
v22 = *(PVOID ***)(a1 + 1384);
if( *v22 != (PVOID *)(a1 + 1376) )
goto LABEL_36;
*v10 = (PVOID)(a1 + 1376);
v10[1] = v22;
*v22 = v10;
*(_QWORD *)(a1 + 1384) = v10;
}
LABEL_27:
if( v7 )
{
KxReleaseSpinLock((UINT64 *)(a1 + 1408));
__writecr8(v5);
}
LABEL_6:
if( !a2 )
{
LABEL_13:
v11 = v4 == 1;
goto LABEL_8;
}
v11 = v4 == 0;
LABEL_8:
if( v11 && !a2 && *(_BYTE *)(a1 + 793) )
{
CurrentIrql = KeGetCurrentIrql();
__writecr8(2ui64);
CurrentPrcb = KeGetCurrentPrcb();
if( (unsigned int)KiAbThreadInsertList(
(_KTHREAD *)a1,
(_SINGLE_LIST_ENTRY *)CurrentPrcb + 4335,
(_SINGLE_LIST_ENTRY *)(a1 + 808)) )
KiAbQueueAutoBoostDpc(CurrentPrcb);
__writecr8(CurrentIrql);
}
}Referenced by:
CcAcquireByteRangeForWrite
CcApplyLowIoPriorityToThread
CcBoostLowPriorityWorkerThread
ExDeleteResourceLite
ExEnterPriorityRegionAndAcquireResourceExclusive
ExEnterPriorityRegionAndAcquireResourceShared
ExReinitializeResourceLite
ExReleaseResourceAndLeavePriorityRegion
ExpAcquireResourceExclusiveLite
ExpAcquireResourceSharedLite
ExpApplyPriorityBoost
ExpBoostIoAfterAcquire
ExpFreeOwnerEntry
ExpReleaseResourceExclusiveForThreadLite
ExpReleaseResourceSharedForThreadLite
ExpSetResourceOwnerPointerEx
FsRtlReleaseEofLock
FsRtlpDoBoost
FsRtlpModifyThreadPriorities
IoBoostThreadIo
KiAbThreadBoostIoPriority
KiAbThreadUnboostIoPriority
PsBoostThreadIo
PsEnterPriorityRegion
PsLeavePriorityRegion