From 1975bc13bc7bd6f593a540305924006936377885 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 4 Nov 2017 06:11:24 +1100 Subject: [PATCH] [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. --- host/Capture/DXGI.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/host/Capture/DXGI.cpp b/host/Capture/DXGI.cpp index c3d110df..6416810e 100644 --- a/host/Capture/DXGI.cpp +++ b/host/Capture/DXGI.cpp @@ -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 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()) { - DEBUG_ERROR("Failed to re-initialize after access was lost"); + DEBUG_ERROR("Failed to ReInitialize after lost access to desktop"); return false; } - continue; + break; } default: