ViKeWaitForSingleObjectCommon

NTSTATUS __stdcall ViKeWaitForSingleObjectCommon(
        VOID *Object,
        _KWAIT_REASON WaitReason,
        INT64 WaitMode,
        INT64 Alertable,
        _LARGE_INTEGER *Timeout,
        UINT64 DisableChecks,
        UINT64 a7){
  _ETHREAD *CurrentThread; 
  UINT8 v8; 
  char v9; 
  UINT8 WaitIrql; 
  _LARGE_INTEGER *v12; 
  __int64 v13; 
  __int64 v14; 
  UINT64 EnableStackSwap; 
  UINT64 v17; 
  VOID *Objecta; 

  Objecta = Object;
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  v8 = Alertable;
  v9 = WaitMode;
  if( (CurrentThread->Tcb._bf_0 & 4) != 0 )
    WaitIrql = CurrentThread->Tcb.WaitIrql;
  else
    WaitIrql = KeGetCurrentIrql();
  v12 = Timeout;
  LODWORD(EnableStackSwap) = ((unsigned int)*(&CurrentThread->Tcb.MiscFlags + 1) >> 6) & 1;
  ViKeWaitSanityChecks(1ui64, &Objecta, WaitMode, Timeout, EnableStackSwap, WaitIrql, v17);
  if( (unsigned int)ViKeInjectStatusAlerted(v8) )
    return 257;
  LOBYTE(v14) = v8;
  LOBYTE(v13) = v9;
  return((__int64(__fastcall *)(VOID *, _QWORD, __int64, __int64, _LARGE_INTEGER *))pXdvKeWaitForSingleObject)(
           Objecta,
           (unsigned int)WaitReason,
           v13,
           v14,
           v12);
}

Referenced by:

VerifierKeWaitForSingleObject
VerifierKeWaitForSingleObjectNoReboot