MmGetSectionInformation

NTSTATUS __stdcall MmGetSectionInformation(
        VOID *SectionObject,
        _SECTION_INFORMATION_CLASS SectionInformationClass,
        VOID *SectionInformation){
  _CONTROL_AREA *v6; 
  int v7; 
  int v8; 
  __int64 v9; 
  _LARGE_INTEGER *v10; 
  int v11; 
  int v13; 
  int v14; 
  int v15; 
  int v16; 
  __int16 v17; 
  int v18; 
  __int64 v19; 
  __int64 v20; 
  __int128 *v21; 
  __int128 v22; 
  __int128 v23; 
  __int128 v24; 
  __int128 v25; 
  _DWORD *v26; 
  __int64 v27; 
  int v28; 
  int v29; 
  int v30; 
  __int128 v31[5]; 

  memset(v31, 0i64, 0x48u);
  v6 = MiSectionControlArea((_SECTION *)SectionObject);
  LOBYTE(v7) = MiAweControlArea((INT64)v6);
  if( v7 )
    return -1073741811;
  if( SectionInformationClass == SectionBasicInformation )
  {
    v13 = ((v11 & 0x1000) << 14) | 0x8000000;
    if( (v11 & 0x2000) == 0 )
      v13 = (v11 & 0x1000) << 14;
    if( (v11 & 0x20) != 0 )
      v13 = 0x1000000;
    v14 = v13 | 0x200000;
    if( (v11 & 0x40) == 0 )
      v14 = v13;
    v15 = v14 | 0x800000;
    if( (v11 & 0x80u) == 0 )
      v15 = v14;
    v16 = v15 | 0x80000;
    if( v11 >= 0 )
      v16 = v15;
    v17 = *(_WORD *)(v10->QuadPart + 12);
    v18 = v16 | 0x10000000;
    if( v17 >= 0 )
      v18 = v16;
    v8 = v18 | 0x40000000;
    if( (v17 & 0x4000) == 0 )
      v8 = v18;
    if( (v10[7].anonymous_0.LowPart & 0x20020) == 131104 )
      v8 |= 0x20000000u;
  }
  if( SectionInformationClass )
  {
    if( SectionInformationClass == SectionImageInformation || SectionInformationClass == MaxSectionInfoClass )
    {
      if( (v11 & 0x20) != 0 )
      {
        v21 = *(__int128 **)(v10->QuadPart + 56);
        v22 = *v21;
        v31[0] = *v21;
        v23 = v21[1];
        v24 = v21[2];
        v25 = v21[3];
        if( (v10[7].anonymous_0.LowPart & 0x10000000) != 0 )
        {
          *(_QWORD *)&v31[0] = *(&stru_140C4DB30 + 4) | LOWORD(v31[0]);
          v22 = v31[0];
        }
        if( SectionInformationClass == MaxSectionInfoClass )
        {
          LODWORD(v26) = MiGetControlAreaLoadConfig(v10);
          v28 = v9;
          LODWORD(v31[4]) = v9;
          v29 = v9;
          if( v26 && (*v26 & 0x10) != 0 )
          {
            v28 = 1;
            LODWORD(v31[4]) = 1;
            v29 = 1;
          }
          v30 = *(_DWORD *)(v27 + 76);
          if( (v30 & 1) != 0 )
          {
            v28 = v29 | 2;
            LODWORD(v31[4]) = v29 | 2;
            v29 |= 2u;
          }
          if( (v30 & 2) != 0 )
          {
            v28 = v29 | 8;
            LODWORD(v31[4]) = v29 | 8;
            v29 |= 8u;
          }
          if( (v30 & 4) != 0 )
          {
            v28 = v29 | 0x10;
            LODWORD(v31[4]) = v29 | 0x10;
          }
          if( (v30 & 8) != 0 )
          {
            v28 |= 0x20u;
            LODWORD(v31[4]) = v28;
          }
          if( (v30 & 0x10) != 0 )
          {
            v28 |= 0x40u;
            LODWORD(v31[4]) = v28;
          }
          if( (v30 & 0x20) != 0 )
            LODWORD(v31[4]) = v28 | 0x80;
          *(_OWORD *)SectionInformation = v22;
          *((_OWORD *)SectionInformation + 1) = v23;
          *((_OWORD *)SectionInformation + 2) = v24;
          *((_OWORD *)SectionInformation + 3) = v25;
          *((_QWORD *)SectionInformation + 8) = *(_QWORD *)&v31[4];
        }
        else
        {
          *(_OWORD *)SectionInformation = v22;
          *((_OWORD *)SectionInformation + 1) = v23;
          *((_OWORD *)SectionInformation + 2) = v24;
          *((_OWORD *)SectionInformation + 3) = v25;
        }
        return v9;
      }
    }
    else if( (v11 & 0x20) != 0 )
    {
      v19 = *(_QWORD *)(v10[12].QuadPart + 32);
      if( v19 )
        v20 = *(_QWORD *)(v19 + 40);
      else
        v20 = v9;
      if( SectionInformationClass == SectionRelocationInformation )
      {
        if( (v10[7].anonymous_0.LowPart & 0x10000000) != 0 )
          v20 += *(&stru_140C4DB30 + 4) - *(_QWORD *)(v10->QuadPart + 32);
        *(_QWORD *)SectionInformation = v20;
      }
      else
      {
        *(_QWORD *)SectionInformation = *(_QWORD *)(v10->QuadPart + 32) - v20;
      }
      return v9;
    }
    LODWORD(v9) = -1073741751;
  }
  else
  {
    *(_QWORD *)SectionInformation = *((_QWORD *)SectionObject + 3) << 12;
    *((_QWORD *)SectionInformation + 2) = *((_QWORD *)SectionObject + 6);
    *((_DWORD *)SectionInformation + 2) = v8;
  }
  return v9;
}

Referenced by:

AlpcpMapLegacyPortView
DbgkpSendErrorMessage
NtQueryInformationProcess
NtQuerySection
PspAllocateProcess
PspLocateSystemDll