summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-12-11 16:45:31 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-12-11 16:45:31 +0300
commiteebad29559ff027ff2955fe63f95478668e968de (patch)
treebc480b6507b6df334fd2f6051bbc465ff7a9d44f /src/mir_core
parenta569fea827be7c1719f3eaca1d8b33d82d4b7889 (diff)
IsTerminalDisconnected() moved to core
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
-rw-r--r--src/mir_core/src/stdafx.h1
-rw-r--r--src/mir_core/src/winver.cpp15
4 files changed, 18 insertions, 0 deletions
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 7d0d544d86..700a447198 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1054,3 +1054,4 @@ HookTemporaryEvent @1241
?Click@CCtrlButton@@QAEXXZ @1242 NONAME
??0CTimer@@QAE@$$QAV0@@Z @1243 NONAME
??4CTimer@@QAEAAV0@$$QAV0@@Z @1244 NONAME
+IsTerminalDisconnected @1245
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index c1d716b5d9..6608c359c7 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1054,3 +1054,4 @@ HookTemporaryEvent @1241
?Click@CCtrlButton@@QEAAXXZ @1242 NONAME
??0CTimer@@QEAA@$$QEAV0@@Z @1243 NONAME
??4CTimer@@QEAAAEAV0@$$QEAV0@@Z @1244 NONAME
+IsTerminalDisconnected @1245
diff --git a/src/mir_core/src/stdafx.h b/src/mir_core/src/stdafx.h
index e72153c8b7..67dea82922 100644
--- a/src/mir_core/src/stdafx.h
+++ b/src/mir_core/src/stdafx.h
@@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <vssym32.h>
#include <Uxtheme.h>
#include <Richedit.h>
+#include <Wtsapi32.h>
#include <malloc.h>
#include <stdio.h>
diff --git a/src/mir_core/src/winver.cpp b/src/mir_core/src/winver.cpp
index 07faca4d1c..a724f6e443 100644
--- a/src/mir_core/src/winver.cpp
+++ b/src/mir_core/src/winver.cpp
@@ -100,6 +100,21 @@ MIR_CORE_DLL(BOOL) IsWorkstationLocked(void)
return bLocked;
}
+MIR_CORE_DLL(BOOL) IsTerminalDisconnected(void)
+{
+ PVOID pBuffer = nullptr;
+ DWORD pBytesReturned = 0;
+ BOOL result = FALSE;
+
+ if (WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSConnectState, (LPTSTR *)&pBuffer, &pBytesReturned))
+ if (*(PDWORD)pBuffer == WTSDisconnected)
+ result = TRUE;
+
+ if (pBuffer)
+ WTSFreeMemory(pBuffer);
+ return result;
+}
+
MIR_CORE_DLL(BOOL) IsScreenSaverRunning(void)
{
BOOL rc = FALSE;