MmUpdateSlabRangeProtection

NTSTATUS __stdcall MmUpdateSlabRangeProtection(
        PVOID BugCheckParameter2,
        PVOID BugCheckParameter3,
        PVOID BugCheckParameter4){
  INT64 SlabAllocator; 
  char *v4; 
  ULONG_PTR v5; 
  UINT64 v7; 
  __int64 v8; 
  CHAR ProtectionMask; 
  DEVICE_OBJECT *v10; 
  unsigned __int64 v11; 
  PVOID v13; 
  UINT64 v14; 
  LODWORD(SlabAllocator) = dword_140C50AC4;
  v4 = (char *)BugCheckParameter3;
  v5 = (unsigned int)BugCheckParameter4;
  if( (dword_140C50AC4 & 8) != 0 && BugCheckParameter3 )
  {
    do
    {
      v14 = 0i64;
      v13 = BugCheckParameter2;
      MiEnumerateSlabAllocators(
        (__int64)&MiSystemPartition,
        (unsigned int(__fastcall *)(__int64, unsigned __int64, __int64))MiUpdateSlabRangeProtectionHelper,
        (__int64)&v13);
      v7 = v14;
      if( !v14 )
        KeBugCheckEx(0x1Au, 0x3030312ui64, (ULONG_PTR)BugCheckParameter2, (ULONG_PTR)v4, v5);
      if( *(PVOID *)(v14 + 24) != BugCheckParameter2 )
        KeBugCheckEx(0x1Au, 0x3030313ui64, (ULONG_PTR)BugCheckParameter2, *(_QWORD *)(v14 + 24), 0i64);
      v8 = *(_QWORD *)(v14 + 40);
      if( !*(_DWORD *)(v8 + 48) && *(_DWORD *)(v8 + 52) != 2 )
        KeBugCheckEx(0x1Au, 0x3030314ui64, (ULONG_PTR)BugCheckParameter2, *(_QWORD *)(v14 + 40), *(int *)(v8 + 48));
      ProtectionMask = MiMakeProtectionMask((unsigned int)v5);
      SlabAllocator = MiGetSlabAllocator((INT64)&MiSystemPartition, 0i64, ProtectionMask);
      v10 = (DEVICE_OBJECT *)SlabAllocator;
      if( SlabAllocator != v8 )
      {
        v11 = ExAcquireSpinLockExclusive((PEX_SPIN_LOCK)(v8 + 16));
        MiRemoveSlabEntry((INT64)&MiSystemPartition, (UINT64 *)v8, v7);
        ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v8 + 16));
        __writecr8(v11);
        *(_QWORD *)(v7 + 40) = v10;
        MiInsertSlabEntry((IRP *)&MiSystemPartition, v10);
      }
      BugCheckParameter2 = (char *)BugCheckParameter2 + 512;
      v4 -= 512;
    }
    while( v4 );
  }
  return SlabAllocator;
}

Referenced by:

PsDispatchIumService