OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/win/wts_terminal_monitor.h" | 5 #include "remoting/host/win/wts_terminal_monitor.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <winternl.h> | 8 #include <winternl.h> |
9 #include <wtsapi32.h> | 9 #include <wtsapi32.h> |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 DWORD session_info_count; | 153 DWORD session_info_count; |
154 if (!WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &session_info, | 154 if (!WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &session_info, |
155 &session_info_count)) { | 155 &session_info_count)) { |
156 LOG_GETLASTERROR(ERROR) << "Failed to enumerate all sessions"; | 156 LOG_GETLASTERROR(ERROR) << "Failed to enumerate all sessions"; |
157 return kInvalidSessionId; | 157 return kInvalidSessionId; |
158 } | 158 } |
159 for (DWORD i = 0; i < session_info_count; ++i) { | 159 for (DWORD i = 0; i < session_info_count; ++i) { |
160 net::IPEndPoint endpoint; | 160 net::IPEndPoint endpoint; |
161 if (GetEndpointForSessionId(session_info[i].SessionId, &endpoint) && | 161 if (GetEndpointForSessionId(session_info[i].SessionId, &endpoint) && |
162 endpoint == client_endpoint) { | 162 endpoint == client_endpoint) { |
| 163 uint32 session_id = session_info[i].SessionId; |
163 WTSFreeMemory(session_info); | 164 WTSFreeMemory(session_info); |
164 return session_info[i].SessionId; | 165 return session_id; |
165 } | 166 } |
166 } | 167 } |
167 | 168 |
168 // |client_endpoint| is not associated with any session. | 169 // |client_endpoint| is not associated with any session. |
169 WTSFreeMemory(session_info); | 170 WTSFreeMemory(session_info); |
170 return kInvalidSessionId; | 171 return kInvalidSessionId; |
171 } | 172 } |
172 | 173 |
173 WtsTerminalMonitor::WtsTerminalMonitor() { | 174 WtsTerminalMonitor::WtsTerminalMonitor() { |
174 } | 175 } |
175 | 176 |
176 } // namespace remoting | 177 } // namespace remoting |
OLD | NEW |