Changeset 38310 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Aug 4, 2011 12:16:59 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxGINA
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxGINA/Helper.cpp
r38290 r38310 17 17 18 18 #include <windows.h> 19 #ifndef TARGET_NT420 # include <Wtsapi32.h>21 #endif22 19 #include "winwlx.h" 23 20 #include "Helper.h" … … 62 59 bool isRemoteSession(void) 63 60 { 64 bool fIsRemote = false; 65 66 #if 0 67 #ifndef TARGET_NT4 68 WTS_SESSION_INFO *pSessionInfo = NULL; 69 DWORD dwSessions; 70 if (WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 71 0 /* Reserved */, 72 1 /* Version */, 73 &pSessionInfo, 74 &dwSessions)) 75 { 76 DWORD dwRemoteSessions = 0; 77 for (DWORD i = 0; i < dwSessions; i++) 78 { 79 switch (pSessionInfo[i].State) 80 { 81 case WTSConnected: 82 case WTSActive: 83 { 84 LPTSTR pBuffer; 85 DWORD cbBuffer; 86 if ( WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, 87 pSessionInfo[i].SessionId, 88 WTSClientProtocolType, 89 &pBuffer, &cbBuffer) 90 && pBuffer 91 && cbBuffer) 92 { 93 USHORT uProto = (USHORT)(pBuffer); 94 /* Only count RDP sessions -- these are the ones we're 95 * interested in here. */ 96 if (uProto == WTS_PROTOCOL_TYPE_RDP) 97 dwRemoteSessions++; 98 WTSFreeMemory(pBuffer); 99 #ifndef DEBUG 100 if (dwRemoteSessions) /* Bail out as soon as possible. */ 101 break; 102 #endif 103 } 104 break; 105 } 106 107 default: 108 break; 109 } 110 } 111 112 #ifdef DEBUG 113 Log(("VBoxGINA: %s connections detected\n", 114 dwRemoteSessions ? "RDP" : "No RDP")); 115 #endif 116 if (pSessionInfo) 117 WTSFreeMemory(pSessionInfo); 118 119 if (dwSessions) 120 fIsRemote = true; 121 } 122 #endif 123 #else 124 LPTSTR pBuffer; 125 DWORD cbBuffer; 126 if ( WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, 127 WTS_CURRENT_SESSION, 128 WTSClientProtocolType, 129 &pBuffer, &cbBuffer) 130 && pBuffer 131 && cbBuffer) 132 { 133 USHORT uProto = (USHORT)(pBuffer); 134 /* Only count RDP sessions -- these are the ones we're 135 * interested in here. */ 136 fIsRemote = uProto == WTS_PROTOCOL_TYPE_RDP; 137 WTSFreeMemory(pBuffer); 138 } 139 else 140 Log(("VBoxGINA: Error %ld querying session information\n", 141 GetLastError())); 142 #endif 143 144 #ifdef DEBUG 145 Log(("VBoxGINA: Is remote session: %s\n", 146 fIsRemote ? "Yes" : "No")); 147 #endif 148 return fIsRemote; 61 return (0 != GetSystemMetrics(SM_REMOTESESSION)) ? true : false; 149 62 } 150 63 -
trunk/src/VBox/Additions/WINNT/VBoxGINA/Makefile.kmk
r38290 r38310 5 5 6 6 # 7 # Copyright (C) 2006-20 07Oracle Corporation7 # Copyright (C) 2006-2011 Oracle Corporation 8 8 # 9 9 # This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 DLLS += VBoxGINA 22 22 VBoxGINA_TEMPLATE = VBOXGUESTR3DLL 23 VBoxGINA_DEFS = UNICODE LOG_TO_BACKDOOR VBGL_VBOXGUEST VBOX_WITH_HGCM 23 VBoxGINA_DEFS = UNICODE VBGL_VBOXGUEST VBOX_WITH_HGCM 24 ifdef DEBUG_andy 25 VBoxGINA_DEFS += LOG_ENABLED 26 endif 24 27 VBoxGINA_SOURCES = \ 25 28 VBoxGINA.cpp \ … … 31 34 $(VBOX_LIB_IPRT_GUEST_R3) \ 32 35 $(VBOX_LIB_VBGL_R3) 33 ifndef TARGET_NT434 VBoxGINA_LIBS += \35 WtsApi32.lib36 endif37 36 38 37 include $(KBUILD_PATH)/subfooter.kmk -
trunk/src/VBox/Additions/WINNT/VBoxGINA/VBoxGINA.h
r30852 r38310 4 4 5 5 /* 6 * Copyright (C) 2006-201 0Oracle Corporation6 * Copyright (C) 2006-2011 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 20 20 #include <iprt/initterm.h> 21 22 #define LOG_GROUP LOG_GROUP_AUTOLOGON 21 23 #include <VBox/log.h> 22 24
Note:
See TracChangeset
for help on using the changeset viewer.