mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
parent
287b983d27
commit
b77a34b8b6
@ -346,32 +346,34 @@ GrabStatus DXGI::GrabFrame(FrameInfo & frame)
|
|||||||
if (SUCCEEDED(status))
|
if (SUCCEEDED(status))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
HDESK desktop = NULL;
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
case DXGI_ERROR_ACCESS_LOST: // desktop switch, mode change or switch DWM on or off
|
// desktop switch, mode change, switch DWM on or off or Secure Desktop
|
||||||
return GRAB_STATUS_REINIT;
|
case DXGI_ERROR_ACCESS_LOST:
|
||||||
|
// see if we can open the desktop, if so request a reinit
|
||||||
|
// if not the secure desktop is active so just wait for it
|
||||||
|
// instead of aborting out
|
||||||
|
desktop = OpenInputDesktop(0, TRUE, GENERIC_READ);
|
||||||
|
if (desktop)
|
||||||
|
{
|
||||||
|
// open suceeded, not on the secure desktop, return to reinit
|
||||||
|
CloseDesktop(desktop);
|
||||||
|
return GRAB_STATUS_REINIT;
|
||||||
|
}
|
||||||
|
// fall through
|
||||||
|
|
||||||
case WAIT_ABANDONED: // this can happen also during desktop switches, not documented by MS though
|
// this can happen during desktop switches also, not documented by MS though
|
||||||
{
|
case WAIT_ABANDONED:
|
||||||
// see if we can open the desktop, if not the secure desktop
|
do
|
||||||
// is active so just wait for it instead of aborting out
|
|
||||||
HDESK desktop = NULL;
|
|
||||||
while(!desktop)
|
|
||||||
{
|
{
|
||||||
desktop = OpenInputDesktop(0, TRUE, GENERIC_READ);
|
desktop = OpenInputDesktop(0, TRUE, GENERIC_READ);
|
||||||
if (desktop)
|
if (desktop)
|
||||||
break;
|
break;
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
}
|
} while (!desktop);
|
||||||
CloseDesktop(desktop);
|
CloseDesktop(desktop);
|
||||||
|
return GRAB_STATUS_REINIT;
|
||||||
if (!ReInitialize())
|
|
||||||
{
|
|
||||||
DEBUG_ERROR("Failed to ReInitialize after lost access to desktop");
|
|
||||||
return GRAB_STATUS_ERROR;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// unknown failure
|
// unknown failure
|
||||||
|
Loading…
Reference in New Issue
Block a user