MmGetSectionStrongImageReference

NTSTATUS __fastcall MmGetSectionStrongImageReference(__int64 a1, char a2, _SECTION *a3, unsigned __int64 *a4){
  NTSTATUS result; 
  _CONTROL_AREA *v8; 
  _MI_IMAGE_SECURITY_REFERENCE *SeImageStub; 
  NTSTATUS SectionStrongImageReference; 
  _SECTION *v11; 

  if( !a1
    || (v11 = 0i64,
        result = ObReferenceObjectByHandle((VOID *)a1, 0i64, MmSectionObjectType, a2, (VOID **)&v11, 0i64),
        a3 = v11,
        result >= 0) )
  {
    v8 = MiSectionControlArea(a3);
    if( (v8->u.LongFlags & 0x20) != 0 && (v8->u2.WritableUserReferences & 0xC0000) != 0 )
    {
      SeImageStub = v8->u2.SeImageStub;
      if( SeImageStub->StrongImageReference
        || (SectionStrongImageReference = MiGetSectionStrongImageReference((INT64)v8->u2.SeImageStub),
            SectionStrongImageReference >= 0) )
      {
        SectionStrongImageReference = 0;
        *a4 = SeImageStub->StrongImageReference;
      }
    }
    else
    {
      SectionStrongImageReference = -1073741811;
    }
    if( a1 )
      HalPutDmaAdapter((PADAPTER_OBJECT)a3);
    return SectionStrongImageReference;
  }
  return result;
}

Referenced by:

PsDispatchIumService
PspAllocateProcess
PspGetSystemDllSecureHandle