IopLiveDumpAllocateIptBuffers

NTSTATUS __stdcall IopLiveDumpAllocateIptBuffers(_LIVEDUMP_CONTEXT *Context){
  NTSTATUS v1; 
  VOID **v2; 
  unsigned int v4; 
  VOID *v5; 
  __int64 IndependentPages; 
  _KEVENT *v7; 
  _KEVENT *v8; 
  VOID *v9; 
  unsigned __int64 v10; 
  __int64 v11; 
  _KEVENT *v12; 
  _KEVENT *v13; 
  unsigned int v14; 
  VOID *v15; 
  __int128 VirtualAddress; 

  v1 = 0;
  Context[239] = 0x10000000;
  v2 = (VOID **)(Context + 236);
  *((_QWORD *)Context + 122) = 0i64;
  VirtualAddress = 0i64;
  (*(void(__fastcall **)(__int64, _QWORD, _LIVEDUMP_CONTEXT *, __int64))(IptInterface + 40))(
    2i64,
    0i64,
    Context + 236,
    48i64);
  v4 = Context[246];
  if( v4 )
  {
    v5 = (VOID *)*((_QWORD *)Context + 122);
    if( v5 )
    {
      IopLiveDumpDiscardVirtualAddressRange(Context, v5, v4);
      v4 = Context[246];
    }
    *((_QWORD *)Context + 122) = 0i64;
    Context[246] = 0;
    Context[238] = 0;
    IndependentPages = MmAllocateIndependentPagesEx(v4, -1, 0i64, 0);
    *v2 = (VOID *)IndependentPages;
    if( IndependentPages )
    {
      v7 = (_KEVENT *)*((_QWORD *)Context + 104);
      v8 = (_KEVENT *)*((_QWORD *)Context + 103);
      Context[238] = v4;
      if( IopLiveDumpIsUnderMemoryPressure(v8, v7) )
        return -1073741248;
      IopLiveDumpDiscardVirtualAddressRange(Context, v9, (v4 + 4095i64) & 0xFFFFFFFFFFFFF000ui64);
      memset(*v2, 0i64, Context[238]);
      if( (*(int(__fastcall **)(__int128 *))(IptInterface + 24))(&VirtualAddress) >= 0 )
      {
        if( (_QWORD)VirtualAddress )
        {
          if( *((_QWORD *)&VirtualAddress + 1) )
          {
            IopLiveDumpDiscardVirtualAddressRange(Context, (VOID *)VirtualAddress, *((UINT64 *)&VirtualAddress + 1));
            v10 = *((_QWORD *)&VirtualAddress + 1);
            *((_QWORD *)Context + 116) = 0i64;
            Context[234] = 0;
            Context[226] = 0;
            v11 = MmAllocateIndependentPagesEx(v10, -1, 0i64, 0);
            *((_QWORD *)Context + 112) = v11;
            if( v11 )
            {
              v12 = (_KEVENT *)*((_QWORD *)Context + 104);
              v13 = (_KEVENT *)*((_QWORD *)Context + 103);
              Context[226] = DWORD2(VirtualAddress);
              if( !IopLiveDumpIsUnderMemoryPressure(v13, v12) )
              {
                IopLiveDumpDiscardVirtualAddressRange(Context, v15, (v14 + 4095i64) & 0xFFFFFFFFFFFFF000ui64);
                memset(*((VOID **)Context + 112), 0i64, Context[226]);
                return v1;
              }
              return -1073741248;
            }
          }
        }
      }
    }
  }
  return v1;
}

Referenced by:

IopLiveDumpAllocAndInitResources