MmUpdateSlabRangeProtection

NTSTATUS __stdcall MmUpdateSlabRangeProtection(
        PVOID BugCheckParameter2,
        PVOID BugCheckParameter3,
        PVOID BugCheckParameter4){
  _DEVICE_OBJECT *v3; 
  char *v4; 
  unsigned __int64 v5; 
  UINT64 v7; 
  __int64 v8; 
  INT8 ProtectionMask; 
  _DEVICE_OBJECT *v10; 
  unsigned __int64 v11; 
  PVOID v13; 
  UINT64 v14; 

  LODWORD(v3) = dword_140C50AC4[0];
  v4 = (char *)BugCheckParameter3;
  v5 = (unsigned int)BugCheckParameter4;
  if( (dword_140C50AC4[0] & 8) != 0 && BugCheckParameter3 )
  {
    do
    {
      v14 = 0i64;
      v13 = BugCheckParameter2;
      MiEnumerateSlabAllocators(
        (__int64)&Irp,
        (unsigned int(__fastcall *)(__int64, unsigned __int64, __int64))MiUpdateSlabRangeProtectionHelper,
        (__int64)&v13);
      v7 = v14;
      if( !v14 )
        KeBugCheckEx(0x1Au, (PVOID)0x3030312, BugCheckParameter2, v4, (PVOID)v5);
      if( *(PVOID *)(v14 + 24) != BugCheckParameter2 )
        KeBugCheckEx(0x1Au, (PVOID)0x3030313, BugCheckParameter2, *(PVOID *)(v14 + 24), 0i64);
      v8 = *(_QWORD *)(v14 + 40);
      if( !*(_DWORD *)(v8 + 48) && *(_DWORD *)(v8 + 52) != 2 )
        KeBugCheckEx(0x1Au, (PVOID)0x3030314, BugCheckParameter2, *(PVOID *)(v14 + 40), (PVOID)*(int *)(v8 + 48));
      ProtectionMask = MiMakeProtectionMask((unsigned int)v5);
      LODWORD(v3) = MiGetSlabAllocator((INT64)&Irp, 0i64, ProtectionMask);
      v10 = v3;
      if( v3 != (_DEVICE_OBJECT *)v8 )
      {
        v11 = (unsigned __int8)ExAcquireSpinLockExclusive((INT64 *)(v8 + 16));
        MiRemoveSlabEntry((INT64)&Irp, (UINT64 *)v8, v7);
        ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)(v8 + 16));
        __writecr8(v11);
        *(_QWORD *)(v7 + 40) = v10;
        MiInsertSlabEntry((_IRP *)&Irp, v10);
      }
      BugCheckParameter2 = (char *)BugCheckParameter2 + 512;
      v4 -= 512;
    }
    while( v4 );
  }
  return(int)v3;
}

Referenced by:

PsDispatchIumService