Changeset 25573 in vbox for trunk/src/VBox/Frontends/VBoxHeadless
- Timestamp:
- Dec 22, 2009 4:30:25 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56251
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r25448 r25573 116 116 refcnt = 0; 117 117 #endif 118 mfNoLoggedInUsers = true; 118 119 } 119 120 … … 197 198 STDMETHOD(OnGuestPropertyChange)(IN_BSTR machineId, IN_BSTR key, IN_BSTR value, IN_BSTR flags) 198 199 { 200 #ifdef VBOX_WITH_GUEST_PROPS 201 Utf8Str utf8Key = key; 202 if (utf8Key == "/VirtualBox/GuestInfo/OS/NoLoggedInUsers") 203 { 204 /* Check if the "disconnect on logout feature" is enabled. */ 205 BOOL fDisconnectOnGuestLogout = FALSE; 206 ComPtr <IMachine> machine; 207 HRESULT hrc = S_OK; 208 209 if (gConsole) 210 { 211 hrc = gConsole->COMGETTER(Machine)(machine.asOutParam()); 212 if (SUCCEEDED(hrc) && machine) 213 { 214 Bstr value; 215 hrc = machine->GetExtraData(Bstr("VRDP/DisconnectOnGuestLogout"), value.asOutParam()); 216 if (SUCCEEDED(hrc) && value == "1") 217 { 218 fDisconnectOnGuestLogout = TRUE; 219 } 220 } 221 } 222 223 if (fDisconnectOnGuestLogout) 224 { 225 Utf8Str utf8Value = value; 226 if (utf8Value == "true") 227 { 228 if (!mfNoLoggedInUsers) /* Only if the property really changes. */ 229 { 230 mfNoLoggedInUsers = true; 231 232 /* If there is a VRDP connection, drop it. */ 233 ComPtr<IRemoteDisplayInfo> info; 234 hrc = gConsole->COMGETTER(RemoteDisplayInfo)(info.asOutParam()); 235 if (SUCCEEDED(hrc) && info) 236 { 237 ULONG cClients = 0; 238 hrc = info->COMGETTER(NumberOfClients)(&cClients); 239 if (SUCCEEDED(hrc) && cClients > 0) 240 { 241 ComPtr <IVRDPServer> vrdpServer; 242 hrc = machine->COMGETTER(VRDPServer)(vrdpServer.asOutParam()); 243 if (SUCCEEDED(hrc) && vrdpServer) 244 { 245 vrdpServer->COMSETTER(Enabled)(FALSE); 246 vrdpServer->COMSETTER(Enabled)(TRUE); 247 } 248 } 249 } 250 } 251 } 252 else 253 { 254 mfNoLoggedInUsers = false; 255 } 256 } 257 } 258 #endif /* VBOX_WITH_GUEST_PROPS */ 199 259 return S_OK; 200 260 } … … 205 265 #endif 206 266 267 bool mfNoLoggedInUsers; 207 268 }; 208 269 … … 1077 1138 while (0); 1078 1139 1140 /* No more access to the 'console' object, which will be uninitialized by the next session->Close call. */ 1141 gConsole = NULL; 1142 1079 1143 if (fSessionOpened) 1080 1144 {
Note:
See TracChangeset
for help on using the changeset viewer.