MiPageNotZero

VOID __stdcall MiPageNotZero(VOID *Va, ULONG_PTR PageFrameIndex){
  __int64 v2; 
  int v4; 
  unsigned int v5; 
  int v6; 
  char *v7; 
  __int64 v8; 
  signed __int64 v9; 
  void *v10; 
  UINT32 v11; 
  _MI_PARTITION *v12; 

  v2 = *(_QWORD *)&PageFrameIndex;
  _InterlockedAdd((_DWORD *)&stru_140C4DB30 + 633, 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 *)&stru_140C4DB30 + 632, 1u);
LABEL_12:
  v10 = 0i64;
  v11 = 299;
  if( v4 != 1 )
    v10 = (void *)v8;
  if( v4 != 1 )
    v11 = 295;
  if( (MmPageValidationAction & 1) != 0 )
    KeBugCheckEx(v11, Va, *(PVOID *)&PageFrameIndex, v10, (PVOID)(-(__int64)(v4 != 1) & 0x1000));
  v12 = *(_MI_PARTITION **)(*(&stru_140C4DB30 + 267)
                          + 8 * (((unsigned __int64)MmGetPfnDb()[*(_QWORD *)&PageFrameIndex].u4._bf_0 >> 39) & 0x3FF));
  KeSetEvent(v12->Core.MemoryEvents[9], 0, 0);
  if( v12 != &Irp )
    KeSetEvent(*(&stru_140C50B28 + 27), 0, 0);
  if( (MiFlags & 0x30) == 32 && !_InterlockedCompareExchange((_DWORD *)&stru_140C4DB30 + 595, 1, 0) )
  {
    *(&stru_140C4DB30 + 300) = 0i64;
    *(&stru_140C4DB30 + 596) = v6;
    *(&stru_140C4DB30 + 299) = v5 + (v2 << 12);
    *(&stru_140C4DB30 + 302) = MiBadMemoryLogger;
    *(&stru_140C4DB30 + 303) = (char *)&stru_140C4DB30 + 2376;
    *(&stru_140C4DB30 + 594) = v11;
    ExQueueWorkItem((PWORK_QUEUE_ITEM)&stru_140C4DB30 + 75, DelayedWorkQueue);
  }
  KeZeroPages(Va, 0x1000ui64);
}

Referenced by:

MiArePageContentsZero