Changeset 38290 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Aug 3, 2011 9:22:12 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 73297
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxGINA
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxGINA/Helper.cpp
r36447 r38290 17 17 18 18 #include <windows.h> 19 #ifndef TARGET_NT4 20 # include <Wtsapi32.h> 21 #endif 19 22 #include "winwlx.h" 20 23 #include "Helper.h" … … 59 62 bool isRemoteSession(void) 60 63 { 61 return (0 != GetSystemMetrics(SM_REMOTESESSION)) ? true : false; 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; 62 149 } 63 150 -
trunk/src/VBox/Additions/WINNT/VBoxGINA/Makefile.kmk
r28800 r38290 31 31 $(VBOX_LIB_IPRT_GUEST_R3) \ 32 32 $(VBOX_LIB_VBGL_R3) 33 ifndef TARGET_NT4 34 VBoxGINA_LIBS += \ 35 WtsApi32.lib 36 endif 33 37 34 38 include $(KBUILD_PATH)/subfooter.kmk -
trunk/src/VBox/Additions/WINNT/VBoxGINA/VBoxGINA.cpp
r37638 r38290 107 107 HINSTANCE hDll; 108 108 109 #ifdef DEBUG 110 /* enable full log output*/111 RTLogGroupSettings(RTLog DefaultInstance(), "all=~0");109 #ifdef DEBUG_andy 110 /* Enable full log output. */ 111 RTLogGroupSettings(RTLogRelDefaultInstance(), "+default.e.l.f.l2.l3"); 112 112 #endif 113 113
Note:
See TracChangeset
for help on using the changeset viewer.