mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
[host] detect switch user event and wait instead of terminating
Fixes #22
This commit is contained in:
parent
bf85358715
commit
9d8f3a79b0
@ -46,6 +46,7 @@ Service::Service() :
|
||||
m_cursorData(NULL),
|
||||
m_shapePending(false)
|
||||
{
|
||||
m_consoleSessionID = WTSGetActiveConsoleSessionId();
|
||||
m_ivshmem = IVSHMEM::Get();
|
||||
}
|
||||
|
||||
@ -233,6 +234,13 @@ bool Service::Process()
|
||||
|
||||
case GRAB_STATUS_REINIT:
|
||||
DEBUG_INFO("ReInitialize Requested");
|
||||
if(WTSGetActiveConsoleSessionId() != m_consoleSessionID)
|
||||
{
|
||||
DEBUG_INFO("User switch detected, waiting to regain control");
|
||||
while (WTSGetActiveConsoleSessionId() != m_consoleSessionID)
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
if (!m_capture->ReInitialize() || !InitPointers())
|
||||
{
|
||||
DEBUG_ERROR("ReInitialize Failed");
|
||||
|
@ -49,6 +49,7 @@ private:
|
||||
~Service();
|
||||
|
||||
bool m_initialized;
|
||||
DWORD m_consoleSessionID;
|
||||
uint8_t * m_memory;
|
||||
IVSHMEM * m_ivshmem;
|
||||
HANDLE m_timer;
|
||||
|
Loading…
Reference in New Issue
Block a user