MiPageNotZero

VOID __stdcall MiPageNotZero(PVOID Va, UINT64 PageFrameIndex){
  int v4; 
  unsigned int v5; 
  int v6; 
  char *v7; 
  __int64 v8; 
  signed __int64 v9; 
  ULONG_PTR v10; 
  ULONG v11; 
  __int64 v12; 
  _InterlockedAdd(&dword_140C4E514, 1u);
  v4 = 0;
  v5 = 0;
  v6 = 0;
  v7 = (char *)Va;
  v8 = 4096i64;
  if( Va < (char *)Va + 4096 )
  {
    while( 1 )
    {
      if( *(_DWORD *)v7 )
      {
        v9 = v7 - (_BYTE *)Va;
        if( v8 != 4096 )
          v9 = v8;
        ++v4;
        v8 = v9;
        if( v4 != 1 )
          goto LABEL_12;
        v5 = (unsigned __int16)v7 & 0xFFF;
        v6 = *(_DWORD *)v7;
        if( ((*(_DWORD *)v7 - 1) & *(_DWORD *)v7) != 0 )
          break;
      }
      v7 += 4;
      if( v7 >= (char *)Va + 4096 )
        goto LABEL_10;
    }
    v4 = 2;
  }
LABEL_10:
  if( v4 == 1 )
    _InterlockedAdd(&dword_140C4E510, 1u);
LABEL_12:
  v10 = 0i64;
  v11 = 299;
  if( v4 != 1 )
    v10 = v8;
  if( v4 != 1 )
    v11 = 295;
  if( (MmPageValidationAction & 1) != 0 )
    KeBugCheckEx(v11, (ULONG_PTR)Va, PageFrameIndex, v10, -(__int64)(v4 != 1) & 0x1000);
  v12 = *(_QWORD *)(qword_140C4E388 + 8 * ((*((_QWORD *)MmGetPfnDb() + 6 * PageFrameIndex + 5) >> 39) & 0x3FFi64));
  KeSetEvent(*(PRKEVENT *)(v12 + 320), 0);
  if( (ULONG_PTR *)v12 != &MiSystemPartition )
    KeSetEvent(qword_140C50C00, 0);
  if( (MiFlags & 0x30) == 32 && !_InterlockedCompareExchange(&dword_140C4E47C, 1, 0) )
  {
    stru_140C4E490.List.Flink = 0i64;
    dword_140C4E480 = v6;
    qword_140C4E488 = v5 + (PageFrameIndex << 12);
    stru_140C4E490.WorkerRoutine = (void(__fastcall *)(void *))MiBadMemoryLogger;
    stru_140C4E490.Parameter = &dword_140C4E478;
    dword_140C4E478 = v11;
    ExQueueWorkItem(&stru_140C4E490, DelayedWorkQueue);
  }
  KeZeroPages(Va, 0x1000ui64);
}

Referenced by:

MiArePageContentsZero