BgpFwAllocateMemory
NTSTATUS __stdcall BgpFwAllocateMemory(UINT64 Size){
int v1;
char *v2;
MDL *v3;
unsigned int v4;
__int64 v5;
unsigned __int64 v6;
char *PoolWithTag;
__int64 v8;
char *v9;
PMDL PagesForMdl;
if( !Size )
return 0;
if( (dword_140C13310 & 0x800) == 0 )
{
v1 = dword_140C13310 & 0x8000;
LODWORD(v2) = 0;
v3 = 0i64;
v4 = v1 != 0 ? 1262634818 : 1263093570;
v5 = v1 != 0 ? 48i64 : 32i64;
v6 = v5 + Size;
if( v5 + Size >= Size && v6 < 0xFFFFEFFF )
{
if( v6 < 0x1000 )
{
PoolWithTag = (char *)ExAllocatePoolWithTag(NonPagedPoolNx, v5 + Size, v4);
LABEL_7:
if( !PoolWithTag )
goto LABEL_20;
v2 = &PoolWithTag[v5];
if( v1 )
{
v8 = qword_140C133E0;
v9 = v2 - 40;
if( *(__int64 **)(qword_140C133E0 + 8) != &qword_140C133E0 )
__fastfail(3u);
*(_QWORD *)v9 = qword_140C133E0;
*((_QWORD *)v9 + 1) = &qword_140C133E0;
*(_QWORD *)(v8 + 8) = v9;
qword_140C133E0 = (__int64)(v2 - 40);
}
*((_DWORD *)v2 - 6) = v4;
*((_QWORD *)v2 - 2) = v6;
*((_QWORD *)v2 - 1) = v3;
if( !v2 )
{
LABEL_20:
if( v3 )
{
MiFreePagesFromMdl(v3, 0i64);
ExFreeHeapPool(v3);
}
}
return(int)v2;
}
v6 = (v6 + 4095) & 0xFFFFFFFFFFFFF000ui64;
PagesForMdl = MmAllocatePagesForMdlEx(0i64, MmNotMapped, 0);
v3 = PagesForMdl;
if( PagesForMdl )
{
if( (PagesForMdl->MdlFlags & 5) != 0 )
PoolWithTag = (char *)PagesForMdl->MappedSystemVa;
else
PoolWithTag = (char *)MmMapLockedPagesSpecifyCache(PagesForMdl, 0, MmCached, 0i64, 0, 0x40000010u);
goto LABEL_7;
}
}
return(int)v2;
}
return BgpFwReserveAllocate(Size);
}Referenced by:
BcpGetProgressMessages
BgpBcInitializeCriticalMode
BgpConsoleInitialize
BgpDisplayCharacterGetContext
BgpFoInitialize
BgpFwLibraryInitialize
BgpFwQueryBootGraphicsInformation
BgpGxRectangleCreate
BgpRasPrintGlyph
BgpTxtCreateRegion
BgpTxtGetRegionContext
FopInitializeFonts
FopReadCmapTable
FopReadMappingTable
FopReadNamingTable
FopValidateFontNameTable
RaspAllocateMemory
ResFwpPageInBackground
TxtpAddCacheEntry