MmAreMdlPagesLocked

NTSTATUS __stdcall MmAreMdlPagesLocked(_MDL *MemoryDescriptorList){
  UINT64 *v1; 
  unsigned __int64 v2; 
  UINT64 v3; 
  int v4; 
  _MMPFN *v5; 
  UINT8 v6; 
  int v7; 
  int v8; 

  v1 = (UINT64 *)&MemoryDescriptorList[1];
  v2 = (((LODWORD(MemoryDescriptorList->StartVa) + MemoryDescriptorList->ByteOffset) & 0xFFF)
      + (unsigned __int64)MemoryDescriptorList->ByteCount
      + 4095) >> 12;
  while( 1 )
  {
    v3 = *v1;
    MiIsPfn(*v1);
    if( v4 )
    {
      v5 = &MmGetPfnDb()[v3];
      v6 = *(&stru_140C4DB30 + 567) == 2 ? 17 : MiLockPage(v5);
      LOBYTE(v7) = MiIsPfnLocked((INT64)v5);
      v8 = v7;
      if( v6 != 17 )
        MiUnlockPage(v5, v6);
      if( !v8 )
        break;
    }
    ++v1;
    if( !--v2 )
      return 1;
  }
  return 0;
}

Referenced by:

VERIFY_BUFFER_LOCKED
VerifierMmBuildMdlForNonPagedPool