mirror of https://github.com/BOINC/boinc.git
- client: Fast User Switching does not change the session protocol
to RDP when the active session is put into the background and a new one is brought into the foreground. It appears it is safe to use the connected state in addition to the protocol to detect when the session is no longer capable of processing GPU work lib/ win_util.cpp svn path=/trunk/boinc/; revision=23068
This commit is contained in:
parent
136085ed6a
commit
e8fc714964
|
@ -894,3 +894,14 @@ David 17 Feb 2011
|
|||
gui_rpc_server_ops.cpp
|
||||
http_curl.cpp
|
||||
net_stats.cpp,h
|
||||
|
||||
Rom 18 Feb 2011
|
||||
- client: Fast User Switching does not change the session protocol
|
||||
to RDP when the active session is put into the background and
|
||||
a new one is brought into the foreground. It appears it is safe
|
||||
to use the connected state in addition to the protocol
|
||||
to detect when the session is no longer capable of processing
|
||||
GPU work
|
||||
|
||||
lib/
|
||||
win_util.cpp
|
||||
|
|
|
@ -849,7 +849,7 @@ void chdir_to_data_dir() {
|
|||
|
||||
|
||||
// return true if running under remote desktop
|
||||
// (in which case CUDA apps don't work)
|
||||
// (in which case CUDA and Stream apps don't work)
|
||||
//
|
||||
typedef BOOL (__stdcall *tWTSQSI)( IN HANDLE, IN DWORD, IN DWORD, OUT LPTSTR*, OUT DWORD* );
|
||||
typedef VOID (__stdcall *tWTSFM)( IN PVOID );
|
||||
|
@ -860,6 +860,7 @@ bool is_remote_desktop() {
|
|||
static tWTSFM pWTSFM = NULL;
|
||||
LPTSTR pBuf = NULL;
|
||||
DWORD dwLength;
|
||||
USHORT usProtocol, usConnectionState;
|
||||
|
||||
if (!wtsapi32lib) {
|
||||
wtsapi32lib = LoadLibrary(_T("wtsapi32.dll"));
|
||||
|
@ -869,14 +870,15 @@ bool is_remote_desktop() {
|
|||
}
|
||||
}
|
||||
|
||||
// WTSQuerySessionInformation(
|
||||
// WTS_CURRENT_SERVER_HANDLE,
|
||||
// WTS_CURRENT_SESSION,
|
||||
// WTSClientProtocolType,
|
||||
// &pBuf,
|
||||
// &dwLength
|
||||
// );
|
||||
if (pWTSQSI) {
|
||||
|
||||
// WTSQuerySessionInformation(
|
||||
// WTS_CURRENT_SERVER_HANDLE,
|
||||
// WTS_CURRENT_SESSION,
|
||||
// WTSClientProtocolType,
|
||||
// &pBuf,
|
||||
// &dwLength
|
||||
// );
|
||||
if (pWTSQSI(
|
||||
(HANDLE)NULL,
|
||||
(DWORD)-1,
|
||||
|
@ -884,10 +886,35 @@ bool is_remote_desktop() {
|
|||
&pBuf,
|
||||
&dwLength
|
||||
)) {
|
||||
USHORT prot = *(USHORT*)pBuf;
|
||||
usProtocol = *(USHORT*)pBuf;
|
||||
pWTSFM(pBuf);
|
||||
if (prot == 2) return true;
|
||||
}
|
||||
|
||||
// WTSQuerySessionInformation(
|
||||
// WTS_CURRENT_SERVER_HANDLE,
|
||||
// WTS_CURRENT_SESSION,
|
||||
// WTSConnectState,
|
||||
// &pBuf,
|
||||
// &dwLength
|
||||
// );
|
||||
if (pWTSQSI(
|
||||
(HANDLE)NULL,
|
||||
(DWORD)-1,
|
||||
(DWORD)8,
|
||||
&pBuf,
|
||||
&dwLength
|
||||
)) {
|
||||
usConnectionState = *(USHORT*)pBuf;
|
||||
pWTSFM(pBuf);
|
||||
}
|
||||
|
||||
// RDP Session implies Remote Desktop
|
||||
if (usProtocol == 2) return true;
|
||||
|
||||
// Fast User Switching keeps the protocol set to the console but changes
|
||||
// the connected state to disconnected.
|
||||
if ((usProtocol == 0) && (usConnectionState == 4)) return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue