MiMapViewOfSectionExCommon

NTSTATUS __stdcall MiMapViewOfSectionExCommon(
        VOID *a1,
        INT64 rdx0,
        UINT64 er8,
        INT64 *a4,
        INT64 a5,
        INT64 a6,
        INT64 a7,
        INT64 a8,
        INT64 Address,
        INT64 ullMultiplicand,
        INT64 a11,
        INT64 a12,
        CHAR a13){
  unsigned int v13; 
  NTSTATUS result; 
  VOID *v17; 
  NTSTATUS MapExtendedParameters; 
  UINT64 v19; 
  UINT64 CommitSize; 
  _LARGE_INTEGER *v21; 
  UINT64 v22; 
  UINT64 v23; 
  UINT64 *v24; 
  _KPROCESSOR_MODE AllocationType; 
  UINT64 AllocationTypea; 
  UINT64 Win32Protect; 
  INT64 v28[2]; 
  UINT64 ViewSize[2]; 
  INT64 v30[2]; 
  NTSTATUS v31; 
  __int64 v32[16]; 
  __int64 v33[15]; 
  int v35; 

  v13 = er8;
  memset(v32, 0i64, sizeof(v32));
  *(_OWORD *)v28 = 0i64;
  *(_OWORD *)ViewSize = 0i64;
  *(_OWORD *)v30 = 0i64;
  memset(v33, 0i64, 0x48u);
  LOBYTE(AllocationType) = a13;
  LODWORD(v23) = a8;
  result = MiMapViewOfSectionCommon(rdx0, a1, v13, a4, a6, a5, v23, 0, AllocationType, v28);
  if( result < 0 )
  {
    if( v28[0] )
      ++*(&stru_140C4DB30 + 637);
    else
      ++*(&stru_140C4DB30 + 636);
    return result;
  }
  LOBYTE(v17) = a13;
  MapExtendedParameters = MiCaptureAllocateMapExtendedParameters((VOID *)Address, (unsigned int)ullMultiplicand, v17);
  if( MapExtendedParameters < 0 )
  {
LABEL_12:
    if( MapExtendedParameters >= 0 )
      goto LABEL_13;
    goto LABEL_22;
  }
  if( (v33[7] & 0xFFFFFFFFFFFFFFDFui64) == 0 )
  {
    MapExtendedParameters = MiMapParametersInitialize(v32, v30[0], v30[1], v28[0], v28[1]);
    if( MapExtendedParameters >= 0 )
    {
      MapExtendedParameters = MiMapExParametersInitialize((__int64)v32, (__int64)v28, (__int64)v33);
      if( MapExtendedParameters >= 0 )
      {
        HIDWORD(v32[9]) = a11;
        v32[10] = a12;
        HIDWORD(v32[7]) |= v35;
        LODWORD(v24) = 0;
        LODWORD(v21) = 1;
        MapExtendedParameters = MiMapViewOfSection(
                                  (VOID *)v30[0],
                                  (_EPROCESS *)v32,
                                  (VOID **)v28,
                                  0i64,
                                  (UINT64)ViewSize,
                                  v21,
                                  v24,
                                  (_SECTION_INHERIT)0,
                                  AllocationTypea,
                                  Win32Protect,
                                  v28[0],
                                  (VOID **)v28[1]);
        v31 = MapExtendedParameters;
        if( MapExtendedParameters >= 0 )
        {
          if( (v32[9] & 4) != 0 )
            DbgkMapViewOfSection((_EPROCESS *)v30[1], (VOID *)v30[0], (VOID *)v28[0], v19, CommitSize);
          if( (*(_DWORD *)(v30[0] + 56) & 0x20) == 0 && (ViewSize[1] & 2) != 0 )
          {
            LODWORD(v22) = a8;
            LODWORD(CommitSize) = a7;
            EtwTiLogMapExecView(v30[1], a13, v28[0], v28[1], CommitSize, v22);
          }
          *a4 = v28[0];
          *(_QWORD *)a6 = v32[3];
          if( a5 )
            *(_QWORD *)a5 = ViewSize[0];
        }
      }
    }
    goto LABEL_12;
  }
  MapExtendedParameters = -1073741811;
LABEL_22:
  if( v28[0] )
    ++*(&stru_140C4DB30 + 637);
  else
    ++*(&stru_140C4DB30 + 636);
LABEL_13:
  if( !v13 )
  {
    HalPutDmaAdapter((PADAPTER_OBJECT)v30[0]);
    ObfDereferenceObjectWithTag((VOID *)v30[1], 0x77566D4Dui64);
  }
  return MapExtendedParameters;
}

Referenced by:

MiPerformImageHotPatch
MmMapViewOfSectionEx
NtMapViewOfSectionEx