mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 23:07:18 +00:00
[host] flag paused when waiting for sec desktop
This commit is contained in:
parent
60070e6076
commit
5cabf155ab
@ -72,6 +72,16 @@ DXGI::~DXGI()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DXGI::CanInitialize()
|
||||||
|
{
|
||||||
|
HDESK desktop = OpenInputDesktop(0, TRUE, GENERIC_READ);
|
||||||
|
if (!desktop)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
CloseDesktop(desktop);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool DXGI::Initialize(CaptureOptions * options)
|
bool DXGI::Initialize(CaptureOptions * options)
|
||||||
{
|
{
|
||||||
if (m_initialized)
|
if (m_initialized)
|
||||||
@ -580,20 +590,6 @@ STDMETHODIMP Capture::DXGI::Invoke(IMFAsyncResult * pAsyncResult)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DXGI::WaitForDesktop()
|
|
||||||
{
|
|
||||||
HDESK desktop;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
desktop = OpenInputDesktop(0, TRUE, GENERIC_READ);
|
|
||||||
if (desktop)
|
|
||||||
break;
|
|
||||||
Sleep(100);
|
|
||||||
}
|
|
||||||
while (!desktop);
|
|
||||||
CloseDesktop(desktop);
|
|
||||||
}
|
|
||||||
|
|
||||||
GrabStatus Capture::DXGI::GrabFrameTexture(struct FrameInfo & frame, struct CursorInfo & cursor, ID3D11Texture2DPtr & texture, bool & timeout)
|
GrabStatus Capture::DXGI::GrabFrameTexture(struct FrameInfo & frame, struct CursorInfo & cursor, ID3D11Texture2DPtr & texture, bool & timeout)
|
||||||
{
|
{
|
||||||
if (!m_initialized)
|
if (!m_initialized)
|
||||||
@ -705,7 +701,6 @@ GrabStatus Capture::DXGI::GrabFrameTexture(struct FrameInfo & frame, struct Curs
|
|||||||
// desktop switch, mode change, switch DWM on or off or Secure Desktop
|
// desktop switch, mode change, switch DWM on or off or Secure Desktop
|
||||||
case DXGI_ERROR_ACCESS_LOST:
|
case DXGI_ERROR_ACCESS_LOST:
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
WaitForDesktop();
|
|
||||||
return GRAB_STATUS_REINIT;
|
return GRAB_STATUS_REINIT;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -752,7 +747,6 @@ GrabStatus Capture::DXGI::ReleaseFrame()
|
|||||||
|
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
case DXGI_ERROR_ACCESS_LOST:
|
case DXGI_ERROR_ACCESS_LOST:
|
||||||
WaitForDesktop();
|
|
||||||
return GRAB_STATUS_REINIT;
|
return GRAB_STATUS_REINIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ namespace Capture
|
|||||||
|
|
||||||
const char * GetName() { return "DXGI"; }
|
const char * GetName() { return "DXGI"; }
|
||||||
|
|
||||||
|
bool CanInitialize();
|
||||||
bool Initialize(CaptureOptions * options);
|
bool Initialize(CaptureOptions * options);
|
||||||
|
|
||||||
void DeInitialize();
|
void DeInitialize();
|
||||||
@ -120,9 +121,6 @@ namespace Capture
|
|||||||
GrabStatus GrabFrameRaw (struct FrameInfo & frame, struct CursorInfo & cursor);
|
GrabStatus GrabFrameRaw (struct FrameInfo & frame, struct CursorInfo & cursor);
|
||||||
GrabStatus GrabFrameH264 (struct FrameInfo & frame, struct CursorInfo & cursor);
|
GrabStatus GrabFrameH264 (struct FrameInfo & frame, struct CursorInfo & cursor);
|
||||||
|
|
||||||
void WaitForDesktop();
|
|
||||||
|
|
||||||
|
|
||||||
long m_cRef;
|
long m_cRef;
|
||||||
CaptureOptions * m_options;
|
CaptureOptions * m_options;
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ class ICapture
|
|||||||
public:
|
public:
|
||||||
virtual const char * GetName() = 0;
|
virtual const char * GetName() = 0;
|
||||||
|
|
||||||
|
virtual bool CanInitialize() = 0;
|
||||||
virtual bool Initialize(CaptureOptions * options) = 0;
|
virtual bool Initialize(CaptureOptions * options) = 0;
|
||||||
virtual void DeInitialize() = 0;
|
virtual void DeInitialize() = 0;
|
||||||
virtual bool ReInitialize() = 0;
|
virtual bool ReInitialize() = 0;
|
||||||
|
@ -238,15 +238,18 @@ bool Service::Process()
|
|||||||
|
|
||||||
case GRAB_STATUS_REINIT:
|
case GRAB_STATUS_REINIT:
|
||||||
DEBUG_INFO("ReInitialize Requested");
|
DEBUG_INFO("ReInitialize Requested");
|
||||||
|
|
||||||
|
*flags |= KVMFR_HEADER_FLAG_PAUSED;
|
||||||
if(WTSGetActiveConsoleSessionId() != m_consoleSessionID)
|
if(WTSGetActiveConsoleSessionId() != m_consoleSessionID)
|
||||||
{
|
{
|
||||||
DEBUG_INFO("User switch detected, waiting to regain control");
|
DEBUG_INFO("User switch detected, waiting to regain control");
|
||||||
*flags |= KVMFR_HEADER_FLAG_PAUSED;
|
|
||||||
while (WTSGetActiveConsoleSessionId() != m_consoleSessionID)
|
while (WTSGetActiveConsoleSessionId() != m_consoleSessionID)
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
*flags &= ~KVMFR_HEADER_FLAG_PAUSED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (!m_capture->CanInitialize())
|
||||||
|
Sleep(100);
|
||||||
|
|
||||||
if (!m_capture->ReInitialize())
|
if (!m_capture->ReInitialize())
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("ReInitialize Failed");
|
DEBUG_ERROR("ReInitialize Failed");
|
||||||
@ -259,6 +262,8 @@ bool Service::Process()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*flags &= ~KVMFR_HEADER_FLAG_PAUSED;
|
||||||
|
|
||||||
// re-init request should not count towards a failure to capture
|
// re-init request should not count towards a failure to capture
|
||||||
--i;
|
--i;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user