MiControlAreaRequiresCharge

NTSTATUS __stdcall MiControlAreaRequiresCharge(INT64 a1){
  int v1; 
  unsigned int v2; 
  int v3; 
  __int64 v4; 
  _MI_PARTITION *v5; 

  LOBYTE(v1) = MiControlAreaExemptFromCrossPartitionCharges(a1);
  if( v1 == 1 )
    return 1;
  if( v2 > 1 )
    v5 = v3 == 2 ? *(_MI_PARTITION **)(*(&stru_140C4DB30 + 267)
                                     + 8i64
                                     * *((unsigned __int16 *)KeGetCurrentThread()->ApcState.Process->Session + 215)) : &Irp;
  else
    v5 = *(_MI_PARTITION **)(*(&stru_140C4DB30 + 267)
                           + 8i64 * KeGetCurrentThread()->ApcState.Process->Vm.Instance.PartitionId);
  if( v5 == *(_MI_PARTITION **)(*(&stru_140C4DB30 + 267) + 8i64 * (*(_WORD *)(v4 + 60) & 0x3FF)) )
    return 1;
  if( (*(_BYTE *)(v4 + 62) & 1) == 0 || v3 == 1 || v3 == 4 )
    return 2;
  ++*(&stru_140C4DB30 + 538);
  return 0;
}

Referenced by:

MiApplyHotPatchToLoadedDriver
MiCreatePrototypePtes
MiDeleteVad
MiInsertInSystemSpace
MiMapImageInSystemSpace
MiMapViewOfImageSection
MiReferenceControlArea
MiSessionInsertImage
MiUpControlAreaRefs
MmLoadSystemImageEx