VeAllocatePoolWithTagPriority
VOID *__fastcall VeAllocatePoolWithTagPriority(
_POOL_TYPE PoolType,
UINT64 NumberOfBytes,
UINT64 Tag,
_EX_POOL_PRIORITY Priority,
VOID *CallingAddress){
unsigned int v6;
unsigned __int64 v7;
_POOL_TYPE v8;
_VF_TARGET_VERIFIED_DRIVER_DATA *VerifierData;
int v10;
int v11;
VOID *v12;
int v14;
UINT64 v15;
PSLIST_ENTRY v16;
unsigned __int64 PoolWithTagPriority;
__int64 v18;
unsigned int v19;
_SLIST_ENTRY *v20;
unsigned __int64 v21;
UINT64 v22;
unsigned __int64 v23;
UINT64 v24;
UINT64 Taga;
LODWORD(Taga) = Tag;
v6 = Tag;
v7 = NumberOfBytes;
v8 = PoolType;
VerifierData = 0i64;
v10 = 0;
v11 = MmKernelVerifierEnabled(*(INT64 *)&PoolType, NumberOfBytes);
v12 = CallingAddress;
if( v11 )
{
if( (v8 & 0x80u) == 0 )
{
v8 |= 0x80u;
}
else
{
v10 = 1;
VerifierData = VfTargetDriversGetVerifierData(CallingAddress);
if( !VerifierData )
return ExAllocatePoolWithTagPriority(v8, v7, v6, Priority);
}
}
ExAllocatePoolSanityChecks(v8, v7, &Taga, v12);
v14 = 0;
if( !v7 && (unsigned int)VfVerifyMode <= 1 )
{
v7 = 1i64;
v14 = 1;
}
v23 = v7;
v24 = v7;
_InterlockedIncrement(&dword_140C2A630);
if( (v8 & 2) != 0 )
{
if( (MmVerifierData & 8) != 0 && (unsigned int)VfFaultsIsSystemSufficientlyBooted() )
VerifierBugCheckIfAppropriate(0xC2ui64, 0x9Aui64, (int)v8 & 0xFFFFFFFFFFFFFF7Fui64, v7, (unsigned int)Taga, v22);
}
else if( (MmVerifierData & 4) != 0 )
{
if( !v10 )
{
v10 = 1;
VerifierData = VfTargetDriversGetVerifierData(v12);
}
if( VerifierData )
{
v15 = (unsigned int)Taga;
LODWORD(v15) = Taga & 0x7FFFFFFF;
if( (unsigned int)VfFaultsInjectPoolAllocationFailure(v15) )
{
VfAllocPoolNotification(0i64, v7);
LABEL_40:
if( (v8 & 0x10) != 0 )
RtlRaiseStatus(-1073741670);
return 0i64;
}
}
}
if( ((VfRuleClasses & 1) != 0 || (VfDifSetting & 1) != 0) && (Priority & 9) == 0 )
{
if( MmSpecialPoolCatchOverruns == 1 )
Priority |= 8u;
else
Priority |= 9u;
}
v16 = 0i64;
if( (MmVerifierData & 8) != 0 && (v8 & 0x20) == 0 )
{
if( !v10 )
VerifierData = VfTargetDriversGetVerifierData(v12);
if( VerifierData && v7 + 8 > v7 )
{
v16 = RtlpInterlockedPopEntrySList((PSLIST_HEADER)((char *)VerifierData + 80));
if( v16 || (v16 = ViGrowPoolAllocation((union SLIST_HEADER *)VerifierData)) != 0i64 )
{
v7 += 8i64;
v8 |= 0x40u;
}
}
else
{
++dword_140C2A658;
}
}
PoolWithTagPriority = (unsigned __int64)ExAllocatePoolWithTagPriority(v8, v7, (unsigned int)Taga, Priority);
if( !PoolWithTagPriority )
{
++dword_140C2A648;
if( (MmVerifierData & 0x1000) != 0 )
ViTargetIncrementCounter(v12, 0xA8ui64);
VfAllocPoolNotification(0i64, v7);
if( v16 )
RtlpInterlockedPushEntrySList((PSLIST_HEADER)((char *)VerifierData + 80), v16);
goto LABEL_40;
}
if( v14 )
{
v18 = 3i64 * (((unsigned __int8)_InterlockedExchangeAdd(&ViBugcheckWorkaroundLogIndex, 1u) + 1) & 0xF);
*((_DWORD *)ViBugcheckWorkaroundLog + 2 * v18) = 1;
*((_QWORD *)ViBugcheckWorkaroundLog + v18 + 1) = v12;
*((_QWORD *)ViBugcheckWorkaroundLog + v18 + 2) = PoolWithTagPriority;
}
v19 = 0;
_InterlockedIncrement(&dword_140C2A634);
if( (unsigned int)ExIsSpecialPoolAddress((VOID *)PoolWithTagPriority) == 1 )
{
v19 = 1;
LABEL_48:
_InterlockedIncrement(&dword_140C2A638);
goto LABEL_49;
}
if( v7 > 0xFE0 )
goto LABEL_48;
LABEL_49:
if( v16 )
{
*((_QWORD *)&v16->Next + 1) = v12;
v16->Next = (_SLIST_ENTRY *)(PoolWithTagPriority | v19);
v20 = (_SLIST_ENTRY *)v23;
if( !v19 )
v20 = (_SLIST_ENTRY *)v7;
v16[1].Next = v20;
*((_QWORD *)&v16[1].Next + 1) = (unsigned int)Taga;
LODWORD(v21) = ViPostPoolAllocation((_VI_POOL_ENTRY *)v16, v8);
PoolWithTagPriority = v21;
}
VfAllocPoolNotification((VOID *)PoolWithTagPriority, v24);
if( v16 && !v19 && (v8 & 0x400) == 0 )
VfFillAllocatedMemory((PVOID)PoolWithTagPriority, v24);
return(VOID *)PoolWithTagPriority;
}Referenced by:
ExAllocateHeapPool
IovAllocateMdl
IovAllocateWorkItem
VerifierExAllocatePool
VerifierExAllocatePool2
VerifierExAllocatePool3
VerifierExAllocatePoolWithQuota
VerifierExAllocatePoolWithQuotaTag
VerifierExAllocatePoolWithTag
VerifierExAllocatePoolWithTagPriority
VerifierIoSetCompletionRoutineEx
ViIrpAllocateLockedPacket
ViRtlReplaceStringBuffer