MiLockdownSections
VOID __stdcall MiLockdownSections(_KLDR_DATA_TABLE_ENTRY *DataTableEntry){
void *DllBase;
_KLDR_DATA_TABLE_ENTRY *v2;
int v3;
int v4;
__int64 v5;
__int64 v6;
__int64 v7;
int v8;
_RTL_BITMAP *SectionPointer;
_DWORD *v10;
int v11;
int v12;
unsigned int v13;
DllBase = DataTableEntry->DllBase;
v2 = DataTableEntry + 1;
v3 = 0;
if( (MiFlags & 0x10000) != 0 && (!DataTableEntry->SectionPointer || (HIDWORD(DataTableEntry[1].GpValue) & 2) != 0) )
v3 = 2;
v4 = v3 | 1;
if( MiGetSystemRegionType((UINT64)DataTableEntry->DllBase) == 1 )
v4 = v3;
if( v4 )
{
LODWORD(v5) = RtlImageNtHeader((UINT64)DllBase);
v6 = v5;
v7 = *(unsigned __int16 *)(v5 + 20) + 60i64;
MiLockLoaderEntry((INT64)v2, 0i64);
v8 = *(unsigned __int16 *)(v6 + 6);
SectionPointer = (_RTL_BITMAP *)v2->SectionPointer;
if( *(_WORD *)(v6 + 6) )
{
v10 = (_DWORD *)(v7 + v6);
do
{
v11 = 0;
if( *(v10 - 9) == 1987011374 && *((_WORD *)v10 - 16) == 29285 )
v11 = 1;
v12 = v11 | 2;
if( (*v10 & 0x20000000) == 0 )
v12 = v11;
if( (v12 & v4) != 0 )
{
v13 = *(v10 - 5);
if( v13 < *(v10 - 7) )
v13 = *(v10 - 7);
RtlSetBits(
SectionPointer,
*(v10 - 6) >> 12,
((((unsigned __int64)DllBase + *(v10 - 6) + v13 + 4095) & 0xFFFFFFFFFFFFF000ui64)
- ((unsigned __int64)DllBase
+ (unsigned int)*(v10 - 6))) >> 12);
}
--v8;
v10 += 10;
}
while( v8 > 0 );
}
MiUnlockLoaderEntry((INT64)v2, 0i64);
}
}Referenced by:
MiConstructLoaderEntry
MiInitializeLoadedModuleList