MiMirrorBrownPhase

NTSTATUS __stdcall MiMirrorBrownPhase(INT64 a1){
  int v1; 
  int v3; 
  VOID **i; 
  _MI_PARTITION *v5; 
  int j; 
  int v7; 
  unsigned int v8; 
  NTSTATUS v9; 
  VOID **NextPartition; 
  VOID **v11; 
  unsigned __int64 v13; 

  v1 = *(_DWORD *)(a1 + 8);
  if( (v1 & 0xC0) == 0 )
  {
    v13 = 0i64;
    v3 = (v1 & 0xA) == 0;
    for( i = 0i64; ; i = v11 )
    {
      NextPartition = PsGetNextPartition(i);
      v11 = NextPartition;
      if( !NextPartition )
        break;
      v5 = (_MI_PARTITION *)*NextPartition;
      if( (*(_DWORD *)(a1 + 8) & 0x100) == 0 || v5 == &Irp )
      {
        for( j = 0; ; ++j )
        {
          MiActOnMirrorBitmap((_RTL_BITMAP_EX *)&stru_140C4DB30 + 146, MiMirrorBitmapClearAllBits);
          if( j == v3 && !*(_BYTE *)(a1 + 20) )
          {
            *(_BYTE *)(a1 + 20) = 1;
            _InterlockedIncrement((_DWORD *)&stru_140C4DB30 + 983);
          }
          v7 = *(_DWORD *)(a1 + 8);
          if( (v7 & 0x400) != 0 || (v7 & 4) != 0 )
          {
            v8 = *(_DWORD *)(a1 + 12);
          }
          else
          {
            if( (v7 & 0x10) == 0 )
              MiEmptyAllWorkingSets(v5);
            v8 = 0;
          }
          MiMirrorGatherBrownPages((UINT64 *)a1, (__int64)v5, *(_DWORD *)(a1 + 16), v8);
          v9 = MiMirrorPerformBrownWrites(*(_QWORD *)a1, *(_DWORD *)(a1 + 8), &v13);
          if( v9 < 0 )
          {
            PsQuitNextPartition(v11);
            return v9;
          }
          if( *(_BYTE *)(a1 + 20) == 1 || v13 < 0x400 )
            break;
        }
        if( (*(_DWORD *)(a1 + 8) & 0x100) == 0 )
          continue;
        PsQuitNextPartition(v11);
        return 0;
      }
    }
  }
  return 0;
}

Referenced by:

MmDuplicateMemory