NtMapViewOfSection

NTSTATUS __stdcall NtMapViewOfSection(
        PVOID SectionHandle,
        PVOID ProcessHandle,
        PVOID *BaseAddress,
        UINT64 ZeroBits,
        UINT64 CommitSize,
        LARGE_INTEGER *SectionOffset,
        UINT64 *ViewSize,
        SECTION_INHERIT InheritDisposition,
        UINT64 AllocationType,
        UINT64 Win32Protect){
  NTSTATUS v13; 
  INT64 v14; 
  int v15; 
  LARGE_INTEGER *v16; 
  UINT64 *v17; 
  int v18; 
  NTSTATUS v19; 
  UINT64 v20; 
  bool v21; 
  UINT64 v22; 
  INT64 v23; 
  UINT64 v24; 
  UINT64 v25; 
  INT64 v26; 
  KPROCESSOR_MODE v27; 
  INT64 v28[2]; 
  UINT64 v29[2]; 
  PADAPTER_OBJECT DmaAdapter[2]; 
  NTSTATUS v31; 
  INT64 result[9]; 
  char v33; 
  UINT64 ZeroBitsa; 
  ZeroBitsa = ZeroBits;
  memset((INT64)result, 0i64);
  *(_OWORD *)v28 = 0i64;
  *(_OWORD *)v29 = 0i64;
  *(_OWORD *)DmaAdapter = 0i64;
  v13 = MiValidateZeroBits(&ZeroBitsa);
  if( v13 >= 0 )
  {
    v27 = *((_BYTE *)KeGetCurrentThread() + 562);
    v14 = ZeroBitsa;
    v15 = Win32Protect;
    LODWORD(v25) = Win32Protect;
    v16 = SectionOffset;
    v17 = ViewSize;
    v13 = MiMapViewOfSectionCommon(
            (INT64)ProcessHandle,
            SectionHandle,
            0i64,
            (INT64 *)BaseAddress,
            (UINT64)ViewSize,
            (UINT64)SectionOffset,
            v25,
            ZeroBitsa,
            v27,
            v28);
    if( v13 < 0 )
    {
      ++dword_140C4E520;
      return v13;
    }
    LODWORD(v26) = v15;
    v18 = AllocationType;
    LODWORD(v23) = AllocationType;
    v19 = MiMapParametersInitialize(
            (INT64)result,
            (INT64)DmaAdapter[0],
            (INT64)DmaAdapter[1],
            v28[0],
            v28[1],
            v23,
            v26,
            v14);
    if( v19 < 0 )
    {
      v21 = v28[0] == 0;
    }
    else
    {
      v19 = MiMapViewOfSection(
              (__int64)DmaAdapter[0],
              (__int64)result,
              (unsigned __int64 *)v28,
              CommitSize,
              v29,
              InheritDisposition,
              0);
      v31 = v19;
      if( v19 >= 0 )
      {
        if( (v33 & 4) != 0 )
          DbgkMapViewOfSection((_EPROCESS *)DmaAdapter[1], DmaAdapter[0], (PVOID)v28[0], v20, v22);
        if( ((__int64)DmaAdapter[0][3].DmaOperations & 0x20) == 0 && (v29[1] & 2) != 0 )
        {
          LODWORD(v24) = v15;
          LODWORD(v22) = v18;
          EtwTiLogMapExecView((INT64)DmaAdapter[1], v27, v28[0], v28[1], v22, v24);
        }
        *v17 = result[3];
        *BaseAddress = (PVOID)v28[0];
        if( v16 )
          *v16 = (LARGE_INTEGER)v29[0];
        goto LABEL_12;
      }
      v21 = v28[0] == 0;
    }
    if( v21 )
      ++dword_140C4E520;
    else
      ++dword_140C4E524;
LABEL_12:
    HalPutDmaAdapter(DmaAdapter[0]);
    ObfDereferenceObjectWithTag(DmaAdapter[1], 0x77566D4Dui64);
    return v19;
  }
  return v13;
}

Referenced by:

No references.