- Timestamp:
- Dec 7, 2018 9:27:24 PM (6 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/VirtualBoxSDSImpl.h
r71160 r76065 72 72 73 73 // IVirtualBoxSDS methods 74 STDMETHOD IMP_(HRESULT) RegisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid, IUnknown **aExistingVirtualBox);75 STDMETHOD IMP_(HRESULT) DeregisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid);76 STDMETHOD IMP_(HRESULT) NotifyClientsFinished();74 STDMETHOD(RegisterVBoxSVC)(IVBoxSVCRegistration *aVBoxSVC, LONG aPid, IUnknown **aExistingVirtualBox); 75 STDMETHOD(DeregisterVBoxSVC)(IVBoxSVCRegistration *aVBoxSVC, LONG aPid); 76 STDMETHOD(NotifyClientsFinished)(); 77 77 78 78 -
trunk/src/VBox/Main/src-global/VirtualBoxSDSImpl.cpp
r71159 r76065 147 147 148 148 /* SDS plan B interfaces: */ 149 STDMETHODIMP _(HRESULT)VirtualBoxSDS::RegisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid, IUnknown **aExistingVirtualBox)150 { 151 LogRel(("VirtualBoxSDS::registerVBoxSVC: aVBoxSVC=%p aPid=%u \n", (IVBoxSVCRegistration *)aVBoxSVC, aPid));149 STDMETHODIMP VirtualBoxSDS::RegisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid, IUnknown **aExistingVirtualBox) 150 { 151 LogRel(("VirtualBoxSDS::registerVBoxSVC: aVBoxSVC=%p aPid=%u (%#x)\n", (IVBoxSVCRegistration *)aVBoxSVC, aPid, aPid)); 152 152 HRESULT hrc; 153 153 if ( RT_VALID_PTR(aVBoxSVC) … … 164 164 if (pUserData) 165 165 { 166 /* 167 * If there already is a chosen one, check that it is still around, 168 * replace it with the caller if no response. 169 */ 166 170 if (pUserData->m_ptrTheChosenOne.isNotNull()) 167 171 { … … 179 183 LogRel(("VirtualBoxSDS::registerVBoxSVC: Seems VBoxSVC instance died. Dropping it and letting caller take over.\n")); 180 184 pUserData->m_ptrTheChosenOne.setNull(); 185 181 186 /* Release the client list and stop client list watcher thread*/ 182 187 pUserData->m_ptrClientList.setNull(); … … 186 191 hrc = S_OK; 187 192 193 /* 194 * Is the caller the chosen one? 195 * The chosen one always have a client list object for monitoring purposes. 196 */ 188 197 if (pUserData->m_ptrTheChosenOne.isNull()) 189 198 { 190 LogRel(("VirtualBoxSDS::registerVBoxSVC: Making aPid=%u the chosen one for user %s (%s)!\n",191 aPid, pUserData->m_strUserSid.c_str(), pUserData->m_strUsername.c_str()));199 LogRel(("VirtualBoxSDS::registerVBoxSVC: Making aPid=%u (%#x) the chosen one for user %s (%s)!\n", 200 aPid, aPid, pUserData->m_strUserSid.c_str(), pUserData->m_strUsername.c_str())); 192 201 try 193 202 { 194 pUserData->m_ptrTheChosenOne = aVBoxSVC; 195 /*196 * Create instance of ClientList 197 */198 HRESULT hrc = CoCreateInstance(CLSID_VirtualBoxClientList, NULL, CLSCTX_LOCAL_SERVER,199 IID_IVirtualBoxClientList,200 (void **)pUserData->m_ptrClientList.asOutParam()); 203 #if 1 204 hrc = pUserData->m_ptrClientList.createLocalObject(CLSID_VirtualBoxClientList); 205 #else 206 hrc = CoCreateInstance(CLSID_VirtualBoxClientList, NULL, CLSCTX_LOCAL_SERVER, 207 IID_IVirtualBoxClientList, 208 (void **)pUserData->m_ptrClientList.asOutParam()); 209 #endif 201 210 if (SUCCEEDED(hrc)) 202 211 { 203 LogFunc(("Created API client list instance in VBoxSDS : hr=%Rhrf\n", hrc)); 212 LogFunc(("Created API client list instance in VBoxSDS: hrc=%Rhrc\n", hrc)); 213 pUserData->m_ptrTheChosenOne = aVBoxSVC; 204 214 } 205 215 else 206 { 207 LogFunc(("Error in creating API client list instance: hr=%Rhrf\n", hrc)); 208 } 209 210 hrc = S_OK; 216 LogRel(("VirtualBoxSDS::registerVBoxSVC: Error in creating API client list instance: hrc=%Rhrc\n", hrc)); 211 217 } 212 218 catch (...) 213 219 { 214 LogRel(("VirtualBoxSDS::registerVBoxSVC: unexpected exception setting the chosen one.\n"));215 hrc = E_ FAIL;220 LogRel(("VirtualBoxSDS::registerVBoxSVC: Unexpected exception setting the chosen one!\n")); 221 hrc = E_UNEXPECTED; 216 222 } 217 223 } … … 232 238 } 233 239 234 STDMETHODIMP _(HRESULT)VirtualBoxSDS::DeregisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid)240 STDMETHODIMP VirtualBoxSDS::DeregisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid) 235 241 { 236 242 LogRel(("VirtualBoxSDS::deregisterVBoxSVC: aVBoxSVC=%p aPid=%u\n", (IVBoxSVCRegistration *)aVBoxSVC, aPid)); … … 246 252 if (pUserData) 247 253 { 248 if ( (IVBoxSVCRegistration *)aVBoxSVC 249 == (IVBoxSVCRegistration *)pUserData->m_ptrTheChosenOne) 254 if (aVBoxSVC == (IVBoxSVCRegistration *)pUserData->m_ptrTheChosenOne) 250 255 { 251 256 LogRel(("VirtualBoxSDS::deregisterVBoxSVC: It's the chosen one for %s (%s)!\n", … … 281 286 282 287 283 STDMETHODIMP _(HRESULT)VirtualBoxSDS::NotifyClientsFinished()288 STDMETHODIMP VirtualBoxSDS::NotifyClientsFinished() 284 289 { 285 290 LogRelFlowThisFuncEnter(); … … 345 350 fRet = true; 346 351 } 347 catch (std::bad_alloc )352 catch (std::bad_alloc &) 348 353 { 349 354 LogRel(("VirtualBoxSDS::i_GetClientUserSID: std::bad_alloc setting rstrSid.\n")); … … 372 377 a_pStrUsername->append(Utf8Str(wszUsername)); 373 378 } 374 catch (std::bad_alloc )379 catch (std::bad_alloc &) 375 380 { 376 381 LogRel(("VirtualBoxSDS::i_GetClientUserSID: std::bad_alloc setting rStrUsername.\n")); … … 458 463 pUserData = new VBoxSDSPerUserData(a_rStrUserSid, a_rStrUsername); 459 464 } 460 catch (std::bad_alloc )465 catch (std::bad_alloc &) 461 466 { 462 467 pUserData = NULL; … … 482 487 pUserData->i_retain(); 483 488 } 484 catch (std::bad_alloc )489 catch (std::bad_alloc &) 485 490 { 486 491 pUserData = NULL; -
trunk/src/VBox/Main/src-global/win/VBoxSDS.cpp
r73358 r76065 19 19 /** @page pg_VBoxSDS VBoxSDS - Per user CLSID_VirtualBox coordinater 20 20 * 21 * VBoxSDS is short for VirtualBox System Directory Service (SDS). It 's purpose22 * is to make sure there only one CLSID_VirtualBox object running for each user23 * u isng VirtualBox on a Windows host system.21 * VBoxSDS is short for VirtualBox System Directory Service (SDS). Its purpose 22 * is to make sure there is only one CLSID_VirtualBox object running for each 23 * user using VirtualBox on a Windows host system. 24 24 * 25 25 * … … 34 34 * level too. 35 35 * 36 * VBoxSVC is a service affected by this issue. Using VirtualBox ac cross logins36 * VBoxSVC is a service affected by this issue. Using VirtualBox across logins 37 37 * or between user elevation levels was impossible to do simultaneously. This 38 38 * was confusing and illogical to the user. … … 103 103 #include <VBox/com/microatl.h> 104 104 105 #define _ATL_FREE_THREADED 105 #define _ATL_FREE_THREADED /** @todo r=bird: WTF? */ 106 106 107 107 /** … … 188 188 189 189 private: 190 void serviceMain( DWORD , LPTSTR*) throw()190 void serviceMain(DWORD, LPTSTR *) throw() 191 191 { 192 192 LogFunc(("Enter into serviceMain\n")); … … 940 940 * Do registration work and quit. 941 941 */ 942 // The VBoxProxyStub should do all work for COM registration942 /// @todo The VBoxProxyStub should do all work for COM registration 943 943 if (fUnregister) 944 944 hrcExit = pServiceModule->unregisterService();
Note:
See TracChangeset
for help on using the changeset viewer.