MiCreateMdl
MDL *__stdcall MiCreateMdl(UINT64 NumberOfBytes){
unsigned int v1;
unsigned __int64 v2;
int v3;
ULONG v4;
unsigned __int64 v5;
unsigned int v6;
PMDL Mdl;
MDL *v9;
unsigned __int64 v10;
_QWORD *p_Next;
UINT64 PageForHeader;
PVOID MappedSystemVa;
void *v15;
void *v16;
_MDL *v17;
v4 = v2;
v5 = v2 >> 12;
v6 = v1;
if( v3 )
{
Mdl = IoAllocateMdl(0i64, v2, 0, 0, 0i64);
v9 = Mdl;
if( Mdl )
{
v10 = 0i64;
p_Next = &Mdl[1].Next;
if( v5 )
{
while( 1 )
{
PageForHeader = MiGetPageForHeader((_MI_PARTITION *)NumberOfBytes, v6);
if( PageForHeader == -1i64 )
break;
if( !v10 )
v9->MdlFlags |= 0x4002u;
*p_Next = PageForHeader;
++v10;
++p_Next;
if( v10 >= v5 )
goto LABEL_8;
}
v9->ByteCount = (_DWORD)v10 << 12;
goto LABEL_16;
}
LABEL_8:
if( (v9->MdlFlags & 5) != 0 )
MappedSystemVa = v9->MappedSystemVa;
else
MappedSystemVa = MmMapLockedPagesSpecifyCache(v9, 0, MmCached, 0i64, 0, 0x40000020u);
if( !MappedSystemVa )
{
LABEL_16:
MiDeleteImageCreationMdls(v9);
return 0i64;
}
return v9;
}
}
else
{
LODWORD(v15) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
v16 = v15;
if( v15 )
{
v17 = IoAllocateMdl(v15, v4, 0, 0, 0i64);
v9 = v17;
if( !v17 )
{
ExFreePoolWithTag(v16, 0);
return 0i64;
}
MmBuildMdlForNonPagedPool(v17);
v9->MdlFlags |= 0x4000u;
return v9;
}
}
return 0i64;
}Referenced by:
MiCreateImageFileMap