[host] make DXGI detect the secure desktop and wait

While we can't interact with UAC and CTL+ALT+DEL stuff, we can alteast
wait around for it to return so we can re-init and continue to stream.
This commit is contained in:
Geoffrey McRae 2017-11-04 06:11:24 +11:00
parent 00c96a7dec
commit 1975bc13bc

View File

@ -263,12 +263,24 @@ bool DXGI::GrabFrame(FrameInfo & frame)
case DXGI_ERROR_ACCESS_LOST: // desktop switch, mode change or switch DWM on or off case DXGI_ERROR_ACCESS_LOST: // desktop switch, mode change or switch DWM on or off
case WAIT_ABANDONED: // this can happen also during desktop switches, not documented by MS though case WAIT_ABANDONED: // this can happen also during desktop switches, not documented by MS though
{ {
// see if we can open the desktop, if not the secure desktop
// is active so just wait for it instead of aborting out
HDESK desktop = NULL;
while(!desktop)
{
desktop = OpenInputDesktop(0, TRUE, GENERIC_READ);
if (desktop)
break;
Sleep(100);
}
CloseDesktop(desktop);
if (!ReInitialize()) if (!ReInitialize())
{ {
DEBUG_ERROR("Failed to re-initialize after access was lost"); DEBUG_ERROR("Failed to ReInitialize after lost access to desktop");
return false; return false;
} }
continue; break;
} }
default: default: