PoBlockConsoleSwitch

UINT64 __stdcall PoBlockConsoleSwitch(_WIN32_POWERSTATE_PARAMETERS *Parms){
  UINT64 SessionId; 
  _LARGE_INTEGER Interval; 

  Interval.QuadPart = -100000i64;
  while( 1 )
  {
    LODWORD(SessionId) = RtlGetActiveConsoleId();
    if( (_DWORD)SessionId != -1 )
    {
      Parms->PowerStateTask = PowerState_BlockSessionSwitch;
      if( PopDispatchStateCallout(Parms, &SessionId) >= 0 )
        break;
    }
    KeDelayExecutionThread(0, 0, &Interval);
  }
  return RtlGetActiveConsoleId();
}

Referenced by:

PnprQuiesceDevices
PoPowerOffMonitor
PopAcquireAdaptiveLock
PopBlockSessionSwitch
PopDirectedDripsNotifyAppsAndServices
PopIssueActionRequest