Index: /trunk/src/VBox/Main/include/VirtualBoxSDSImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/VirtualBoxSDSImpl.h	(revision 76064)
+++ /trunk/src/VBox/Main/include/VirtualBoxSDSImpl.h	(revision 76065)
@@ -72,7 +72,7 @@
 
     // IVirtualBoxSDS methods
-    STDMETHODIMP_(HRESULT) RegisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid, IUnknown **aExistingVirtualBox);
-    STDMETHODIMP_(HRESULT) DeregisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid);
-    STDMETHODIMP_(HRESULT) NotifyClientsFinished();
+    STDMETHOD(RegisterVBoxSVC)(IVBoxSVCRegistration *aVBoxSVC, LONG aPid, IUnknown **aExistingVirtualBox);
+    STDMETHOD(DeregisterVBoxSVC)(IVBoxSVCRegistration *aVBoxSVC, LONG aPid);
+    STDMETHOD(NotifyClientsFinished)();
 
 
Index: /trunk/src/VBox/Main/src-global/VirtualBoxSDSImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-global/VirtualBoxSDSImpl.cpp	(revision 76064)
+++ /trunk/src/VBox/Main/src-global/VirtualBoxSDSImpl.cpp	(revision 76065)
@@ -147,7 +147,7 @@
 
 /* SDS plan B interfaces: */
-STDMETHODIMP_(HRESULT) VirtualBoxSDS::RegisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid, IUnknown **aExistingVirtualBox)
-{
-    LogRel(("VirtualBoxSDS::registerVBoxSVC: aVBoxSVC=%p aPid=%u\n", (IVBoxSVCRegistration *)aVBoxSVC, aPid));
+STDMETHODIMP VirtualBoxSDS::RegisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid, IUnknown **aExistingVirtualBox)
+{
+    LogRel(("VirtualBoxSDS::registerVBoxSVC: aVBoxSVC=%p aPid=%u (%#x)\n", (IVBoxSVCRegistration *)aVBoxSVC, aPid, aPid));
     HRESULT hrc;
     if (   RT_VALID_PTR(aVBoxSVC)
@@ -164,4 +164,8 @@
             if (pUserData)
             {
+                /*
+                 * If there already is a chosen one, check that it is still around,
+                 * replace it with the caller if no response.
+                 */
                 if (pUserData->m_ptrTheChosenOne.isNotNull())
                 {
@@ -179,4 +183,5 @@
                         LogRel(("VirtualBoxSDS::registerVBoxSVC: Seems VBoxSVC instance died.  Dropping it and letting caller take over.\n"));
                         pUserData->m_ptrTheChosenOne.setNull();
+
                         /* Release the client list and stop client list watcher thread*/
                         pUserData->m_ptrClientList.setNull();
@@ -186,32 +191,33 @@
                     hrc = S_OK;
 
+                /*
+                 * Is the caller the chosen one?
+                 * The chosen one always have a client list object for monitoring purposes.
+                 */
                 if (pUserData->m_ptrTheChosenOne.isNull())
                 {
-                    LogRel(("VirtualBoxSDS::registerVBoxSVC: Making aPid=%u the chosen one for user %s (%s)!\n",
-                            aPid, pUserData->m_strUserSid.c_str(), pUserData->m_strUsername.c_str()));
+                    LogRel(("VirtualBoxSDS::registerVBoxSVC: Making aPid=%u (%#x) the chosen one for user %s (%s)!\n",
+                            aPid, aPid, pUserData->m_strUserSid.c_str(), pUserData->m_strUsername.c_str()));
                     try
                     {
-                        pUserData->m_ptrTheChosenOne = aVBoxSVC;
-                        /*
-                        * Create instance of ClientList
-                        */
-                        HRESULT hrc = CoCreateInstance(CLSID_VirtualBoxClientList, NULL, CLSCTX_LOCAL_SERVER,
-                            IID_IVirtualBoxClientList,
-                            (void **)pUserData->m_ptrClientList.asOutParam());
+#if 1
+                        hrc = pUserData->m_ptrClientList.createLocalObject(CLSID_VirtualBoxClientList);
+#else
+                        hrc = CoCreateInstance(CLSID_VirtualBoxClientList, NULL, CLSCTX_LOCAL_SERVER,
+                                               IID_IVirtualBoxClientList,
+                                               (void **)pUserData->m_ptrClientList.asOutParam());
+#endif
                         if (SUCCEEDED(hrc))
                         {
-                            LogFunc(("Created API client list instance in VBoxSDS : hr=%Rhrf\n", hrc));
+                            LogFunc(("Created API client list instance in VBoxSDS: hrc=%Rhrc\n", hrc));
+                            pUserData->m_ptrTheChosenOne = aVBoxSVC;
                         }
                         else
-                        {
-                            LogFunc(("Error in creating API client list instance: hr=%Rhrf\n", hrc));
-                        }
-
-                        hrc = S_OK;
+                            LogRel(("VirtualBoxSDS::registerVBoxSVC: Error in creating API client list instance: hrc=%Rhrc\n", hrc));
                     }
                     catch (...)
                     {
-                        LogRel(("VirtualBoxSDS::registerVBoxSVC: unexpected exception setting the chosen one.\n"));
-                        hrc = E_FAIL;
+                        LogRel(("VirtualBoxSDS::registerVBoxSVC: Unexpected exception setting the chosen one!\n"));
+                        hrc = E_UNEXPECTED;
                     }
                 }
@@ -232,5 +238,5 @@
 }
 
-STDMETHODIMP_(HRESULT) VirtualBoxSDS::DeregisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid)
+STDMETHODIMP VirtualBoxSDS::DeregisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid)
 {
     LogRel(("VirtualBoxSDS::deregisterVBoxSVC: aVBoxSVC=%p aPid=%u\n", (IVBoxSVCRegistration *)aVBoxSVC, aPid));
@@ -246,6 +252,5 @@
             if (pUserData)
             {
-                if (   (IVBoxSVCRegistration *)aVBoxSVC
-                    == (IVBoxSVCRegistration *)pUserData->m_ptrTheChosenOne)
+                if (aVBoxSVC == (IVBoxSVCRegistration *)pUserData->m_ptrTheChosenOne)
                 {
                     LogRel(("VirtualBoxSDS::deregisterVBoxSVC: It's the chosen one for %s (%s)!\n",
@@ -281,5 +286,5 @@
 
 
-STDMETHODIMP_(HRESULT) VirtualBoxSDS::NotifyClientsFinished()
+STDMETHODIMP VirtualBoxSDS::NotifyClientsFinished()
 {
     LogRelFlowThisFuncEnter();
@@ -345,5 +350,5 @@
                         fRet = true;
                     }
-                    catch (std::bad_alloc)
+                    catch (std::bad_alloc &)
                     {
                         LogRel(("VirtualBoxSDS::i_GetClientUserSID: std::bad_alloc setting rstrSid.\n"));
@@ -372,5 +377,5 @@
                                 a_pStrUsername->append(Utf8Str(wszUsername));
                             }
-                            catch (std::bad_alloc)
+                            catch (std::bad_alloc &)
                             {
                                 LogRel(("VirtualBoxSDS::i_GetClientUserSID: std::bad_alloc setting rStrUsername.\n"));
@@ -458,5 +463,5 @@
             pUserData = new VBoxSDSPerUserData(a_rStrUserSid, a_rStrUsername);
         }
-        catch (std::bad_alloc)
+        catch (std::bad_alloc &)
         {
             pUserData = NULL;
@@ -482,5 +487,5 @@
                         pUserData->i_retain();
                     }
-                    catch (std::bad_alloc)
+                    catch (std::bad_alloc &)
                     {
                         pUserData = NULL;
Index: /trunk/src/VBox/Main/src-global/win/VBoxSDS.cpp
===================================================================
--- /trunk/src/VBox/Main/src-global/win/VBoxSDS.cpp	(revision 76064)
+++ /trunk/src/VBox/Main/src-global/win/VBoxSDS.cpp	(revision 76065)
@@ -19,7 +19,7 @@
 /** @page pg_VBoxSDS    VBoxSDS - Per user CLSID_VirtualBox coordinater
  *
- * VBoxSDS is short for VirtualBox System Directory Service (SDS).  It's purpose
- * is to make sure there only one CLSID_VirtualBox object running for each user
- * uisng VirtualBox on a Windows host system.
+ * VBoxSDS is short for VirtualBox System Directory Service (SDS).  Its purpose
+ * is to make sure there is only one CLSID_VirtualBox object running for each
+ * user using VirtualBox on a Windows host system.
  *
  *
@@ -34,5 +34,5 @@
  * level too.
  *
- * VBoxSVC is a service affected by this issue.  Using VirtualBox accross logins
+ * VBoxSVC is a service affected by this issue.  Using VirtualBox across logins
  * or between user elevation levels was impossible to do simultaneously.  This
  * was confusing and illogical to the user.
@@ -103,5 +103,5 @@
 #include <VBox/com/microatl.h>
 
-#define _ATL_FREE_THREADED
+#define _ATL_FREE_THREADED /** @todo r=bird: WTF? */
 
 /**
@@ -188,5 +188,5 @@
 
 private:
-    void serviceMain( DWORD , LPTSTR* ) throw()
+    void serviceMain(DWORD, LPTSTR *) throw()
     {
         LogFunc(("Enter into serviceMain\n"));
@@ -940,5 +940,5 @@
                      * Do registration work and quit.
                      */
-                    // The VBoxProxyStub should do all work for COM registration
+                    /// @todo The VBoxProxyStub should do all work for COM registration
                     if (fUnregister)
                         hrcExit = pServiceModule->unregisterService();
