IopWaitForSynchronousIo

NTSTATUS __stdcall IopWaitForSynchronousIo(PIRP Irp, _FILE_OBJECT *FileObject, _KPROCESSOR_MODE WaitMode){
  _BYTE *v3; 
  unsigned int v4; 
  char v5; 
  NTSTATUS v9; 

  v3 = &FileObject->gap80[24];
  v4 = FileObject->Flags & 4;
  v5 = WaitMode;
  while( (*v3 & 0x7F) != 0 || !*(_DWORD *)&FileObject->gap80[28] )
  {
    v9 = KeWaitForSingleObject((UINT64)v3, 0, v4 != 0 ? v5 : 0, 1, 0i64);
    if( v9 != 257 && v9 != 192 )
      break;
    if( v4 || (*(_DWORD *)&KeGetCurrentThread()[1].gapD8[8] & 1) != 0 || IopCheckIrpCancelled((INT64)v3, (INT64)Irp) )
    {
      IopCancelAlertedRequest(v3, Irp);
      return FileObject->FinalStatus;
    }
  }
  return FileObject->FinalStatus;
}

Referenced by:

IopQueryXxxInformation
NtQueryInformationFile
NtSetInformationFile