IopAddLiveDumpPagesToPartialKernelDump

NTSTATUS __stdcall IopAddLiveDumpPagesToPartialKernelDump(
        UINT64 BugCheckCode,
        INT64 rdx0,
        UINT64 a3,
        INT64 a4,
        UINT64 a2){
  unsigned int v7; 
  __int64 v8; 
  __int64 v9; 
  NTSTATUS result; 
  __int64 v11; 
  int v12; 
  __int64 *i; 
  _QWORD **v14; 
  _QWORD *v15; 
  __int64 v16[2]; 
  _KAFFINITY_ENUMERATION_CONTEXT v17; 
  _MM_KERNEL_DUMP_CONTEXT Context[2]; 
  __int64 v19; 
  __int64 *v20; 
  __int64 v21; 
  __int64 *v22; 
  __int64 v23; 
  UINT64 ProcIndex; 

  HIDWORD(ProcIndex) = HIDWORD(a4);
  v23 = 0i64;
  LODWORD(ProcIndex) = 0;
  v7 = BugCheckCode;
  memset(&v17, 0, sizeof(v17));
  v8 = *(_QWORD *)(qword_140C50960 + 8i64);
  v9 = *(_QWORD *)(v8 + 48);
  v19 = 0i64;
  v23 = 3i64;
  v16[0] = v9;
  v16[1] = v8 + 56;
  v20 = v16;
  v22 = &AvailablePagesForPartialDump;
  *(_QWORD *)Context = IoSetDumpRangeForPartialKernelDump;
  v21 = v8;
  result = MmAddRangeToCrashDump(Context, &KdDebuggerDataBlock, 0x380ui64);
  if( result >= 0 )
  {
    result = MmAddRangeToCrashDump(Context, &KiProcessorBlock, 8i64 * (unsigned int)KeNumberProcessors_0);
    if( result >= 0 )
    {
      v11 = 0i64;
      if( (_DWORD)KeNumberProcessors_0 )
      {
        while( 1 )
        {
          result = MmAddRangeToCrashDump(Context, *(&KiProcessorBlock + v11), 0xAF00ui64);
          if( result < 0 )
            break;
          v11 = (unsigned int)(v11 + 1);
          if( (unsigned int)v11 >= (unsigned int)KeNumberProcessors_0 )
            goto LABEL_6;
        }
      }
      else
      {
LABEL_6:
        v17.CurrentMask = KeActiveProcessors.Bitmap[0];
        v17.Affinity = &KeActiveProcessors;
        while( 1 )
        {
          KeEnumerateNextProcessor(&ProcIndex, &v17);
          if( v12 )
            break;
          result = IopMarkPagesForProcessorData(Context, (unsigned int)ProcIndex);
          if( result < 0 )
            return result;
        }
        result = MmAddPrivateDataToCrashDump(Context, 2ui64);
        if( result >= 0 )
        {
          result = MmAddRangeToCrashDump(Context, &KUSER_SHARED_DATA, 0x720ui64);
          if( result >= 0 )
          {
            result = MmAddPrivateDataToCrashDump(Context, 4ui64);
            if( result >= 0 )
            {
              result = MmAddPrivateDataToCrashDump(Context, 8ui64);
              if( result >= 0 )
              {
                if( !MmPhysicalMemoryBlock
                  || (result = MmAddRangeToCrashDump(
                                 Context,
                                 MmPhysicalMemoryBlock,
                                 16 * (MmPhysicalMemoryBlock->NumberOfRuns - 1 + 2i64)),
                      result >= 0) )
                {
                  result = MmAddPrivateDataToCrashDump(Context, 0x20ui64);
                  if( result >= 0 )
                  {
                    if( v7 != 351 || rdx0 != 2 )
                      goto LABEL_24;
                    result = MmAddRangeToCrashDump(Context, (VOID *)a3, 0x38ui64);
                    if( result < 0 )
                      return result;
                    if( IopMarkPagesForDeviceNode(Context, *(_QWORD *)(a3 + 48)) == -1073741789 )
                      return -1073741789;
                    if( !a2 || (result = IopMarkPagesForDeviceNode(Context, a2), result >= 0) )
                    {
LABEL_24:
                      result = ExAddPrivateDataToCrashDump(Context);
                      if( result >= 0 )
                      {
                        for( i = (__int64 *)PsActiveProcessHead; i != &PsActiveProcessHead; i = (__int64 *)*i )
                        {
                          v14 = (_QWORD **)(i + 51);
                          v15 = *v14;
                          result = MmAddRangeToCrashDump(Context, i - 137, 0xA40ui64);
                          if( result < 0 )
                            return result;
                          while( v15 != v14 )
                          {
                            result = MmAddRangeToCrashDump(Context, v15 - 157, 0x898ui64);
                            if( result < 0 )
                              return result;
                            result = MmAddRangeToCrashDump(Context, (VOID *)*(v15 - 151), *(v15 - 150) - *(v15 - 151));
                            if( result < 0 )
                              return result;
                            v15 = (_QWORD *)*v15;
                          }
                        }
                        result = MmAddPrivateDataToCrashDump(Context, 0x10ui64);
                        if( result >= 0 )
                        {
                          IopDumpCallAddPagesCallbacks(v7);
                          IoSaveBugCheckProgress(0x21ui64);
                          return MmAddPrivateDataToCrashDump(Context, 1ui64);
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return result;
}

Referenced by:

IoAddPagesForPartialKernelDump