MiZeroPageFile

VOID __stdcall MiZeroPageFile(VOID *Context){
  __int64 *v2; 
  bool v3; 
  unsigned int v4; 
  int v5; 
  unsigned __int8 v6; 
  __int64 v7; 
  unsigned __int8 v8; 
  unsigned int v9; 
  unsigned __int64 v10; 
  unsigned int v11; 
  _FILE_OBJECT *v12; 
  unsigned int v13; 
  _LARGE_INTEGER LargeNumberOfBytes; 
  _LARGE_INTEGER FileOffset; 
  PRKEVENT Event; 
  _BYTE MemoryDescriptorList[176]; 

  FileOffset.QuadPart = 0i64;
  LargeNumberOfBytes.QuadPart = 0i64;
  memset(MemoryDescriptorList, 0i64, sizeof(MemoryDescriptorList));
  v2 = (__int64 *)*((_QWORD *)Context + 4);
  Event = (PRKEVENT)*((_QWORD *)Context + 5);
  ExFreePoolWithTag(Context, 0);
  v3 = (*((_WORD *)v2 + 102) & 0x800) == 0;
  *(_QWORD *)&MemoryDescriptorList[32] = 0i64;
  *(_QWORD *)&MemoryDescriptorList[40] = 0i64;
  if( v3 )
  {
    *(_DWORD *)&MemoryDescriptorList[8] = 48;
  }
  else
  {
    *(_DWORD *)&MemoryDescriptorList[8] = 131120;
    memset64(&MemoryDescriptorList[48], *(&stru_140C4DB30 + 498), 0x10ui64);
  }
  v13 = 0;
  v4 = 0;
  v5 = 0;
  v6 = ExAcquireSpinLockExclusive(v2 + 29);
  v7 = *v2;
  v8 = v6;
  v9 = 1;
  if( (unsigned __int64)*v2 > 1 )
  {
    v10 = 1i64;
    do
    {
      if( _bittest64(*(const signed __int64 **)(v2[14] + 16), v10) )
      {
        if( v4 )
          v5 = 1;
      }
      else
      {
        v11 = v9;
        if( v4 )
          v11 = v13;
        ++v4;
        v13 = v11;
        if( v4 == 16 || v10 == v7 - 1 )
          v5 = 1;
      }
      if( v5 )
      {
        ExReleaseSpinLockExclusiveFromDpcLevel(v2 + 29);
        __writecr8(v8);
        if( (*((_WORD *)v2 + 102) & 0x800) != 0 )
        {
          *(_DWORD *)&MemoryDescriptorList[40] = v4 << 12;
        }
        else
        {
          v12 = (_FILE_OBJECT *)v2[7];
          FileOffset.QuadPart = (unsigned __int64)v13 << 12;
          LargeNumberOfBytes.QuadPart = (unsigned __int64)v4 << 12;
          MmZeroPageWrite(v12, &FileOffset, &LargeNumberOfBytes, 0i64);
        }
        v5 = 0;
        v8 = ExAcquireSpinLockExclusive(v2 + 29);
        v4 = 0;
      }
      v7 = *v2;
      v10 = ++v9;
    }
    while( v9 < (unsigned __int64)*v2 );
  }
  ExReleaseSpinLockExclusiveFromDpcLevel(v2 + 29);
  __writecr8(v8);
  if( (*((_WORD *)v2 + 102) & 0x800) != 0 && (MemoryDescriptorList[10] & 1) != 0 )
    MmUnmapLockedPages(*(VOID **)&MemoryDescriptorList[24], (_MDL *)MemoryDescriptorList);
  KeSetEvent(Event, 0, 0);
}

Referenced by:

MiZeroAllPageFiles