Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp	(revision 60499)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp	(revision 60500)
@@ -330,30 +330,28 @@
     mIsFullAvailable = mIsBasicAvailable = false;
 
-    AssertReturn (!callee || calleeIID, (void) 0);
+    AssertReturnVoid(!callee || calleeIID);
 
     HRESULT rc = E_FAIL;
 
-#if !defined (VBOX_WITH_XPCOM)
+#if !defined(VBOX_WITH_XPCOM)
 
     if (callee)
     {
-        CComPtr <IUnknown> iface = callee;
-        CComQIPtr <ISupportErrorInfo> serr;
-        serr = callee;
+        ComPtr<IUnknown> iface(callee);
+        ComPtr<ISupportErrorInfo> serr(iface);
         if (!serr)
             return;
-        rc = serr->InterfaceSupportsErrorInfo (*calleeIID);
-        if (!SUCCEEDED (rc))
+        rc = serr->InterfaceSupportsErrorInfo(*calleeIID);
+        if (!SUCCEEDED(rc))
             return;
     }
 
-    CComPtr <IErrorInfo> err;
-    rc = ::GetErrorInfo (0, &err);
+    ComPtr<IErrorInfo> err;
+    rc = ::GetErrorInfo(0, err.asOutParam());
     if (rc == S_OK && err)
     {
-        CComPtr <IVirtualBoxErrorInfo> info;
-        info = err;
+        ComPtr<IVirtualBoxErrorInfo> info(err);
         if (info)
-            init (CVirtualBoxErrorInfo (info));
+            init(CVirtualBoxErrorInfo(info));
 
         if (!mIsFullAvailable)
@@ -361,14 +359,14 @@
             bool gotSomething = false;
 
-            rc = err->GetGUID (COMBase::GUIDOut (mInterfaceID));
-            gotSomething |= SUCCEEDED (rc);
-            if (SUCCEEDED (rc))
-                mInterfaceName = getInterfaceNameFromIID (mInterfaceID);
-
-            rc = err->GetSource (COMBase::BSTROut (mComponent));
-            gotSomething |= SUCCEEDED (rc);
-
-            rc = err->GetDescription (COMBase::BSTROut (mText));
-            gotSomething |= SUCCEEDED (rc);
+            rc = err->GetGUID(COMBase::GUIDOut(mInterfaceID));
+            gotSomething |= SUCCEEDED(rc);
+            if (SUCCEEDED(rc))
+                mInterfaceName = getInterfaceNameFromIID(mInterfaceID);
+
+            rc = err->GetSource(COMBase::BSTROut(mComponent));
+            gotSomething |= SUCCEEDED(rc);
+
+            rc = err->GetDescription(COMBase::BSTROut(mText));
+            gotSomething |= SUCCEEDED(rc);
 
             if (gotSomething)
@@ -377,26 +375,26 @@
             mIsNull = !gotSomething;
 
-            AssertMsg (gotSomething, ("Nothing to fetch!\n"));
+            AssertMsg(gotSomething,("Nothing to fetch!\n"));
         }
     }
 
-#else /* !defined (VBOX_WITH_XPCOM) */
-
-    nsCOMPtr <nsIExceptionService> es;
-    es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
-    if (NS_SUCCEEDED (rc))
-    {
-        nsCOMPtr <nsIExceptionManager> em;
-        rc = es->GetCurrentExceptionManager (getter_AddRefs (em));
-        if (NS_SUCCEEDED (rc))
+#else /* !defined(VBOX_WITH_XPCOM) */
+
+    nsCOMPtr<nsIExceptionService> es;
+    es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
+    if (NS_SUCCEEDED(rc))
+    {
+        nsCOMPtr<nsIExceptionManager> em;
+        rc = es->GetCurrentExceptionManager(getter_AddRefs(em));
+        if (NS_SUCCEEDED(rc))
         {
-            nsCOMPtr <nsIException> ex;
-            rc = em->GetCurrentException (getter_AddRefs(ex));
-            if (NS_SUCCEEDED (rc) && ex)
+            nsCOMPtr<nsIException> ex;
+            rc = em->GetCurrentException(getter_AddRefs(ex));
+            if (NS_SUCCEEDED(rc) && ex)
             {
-                nsCOMPtr <IVirtualBoxErrorInfo> info;
-                info = do_QueryInterface (ex, &rc);
-                if (NS_SUCCEEDED (rc) && info)
-                    init (CVirtualBoxErrorInfo (info));
+                ComPtr<IVirtualBoxErrorInfo> info;
+                rc = ex.queryInterfaceTo(info.asOutParam());
+                if (NS_SUCCEEDED(rc) && info)
+                    init(CVirtualBoxErrorInfo(info));
 
                 if (!mIsFullAvailable)
@@ -404,14 +402,14 @@
                     bool gotSomething = false;
 
-                    rc = ex->GetResult (&mResultCode);
-                    gotSomething |= NS_SUCCEEDED (rc);
+                    rc = ex->GetResult(&mResultCode);
+                    gotSomething |= NS_SUCCEEDED(rc);
 
                     char *message = NULL; // utf8
-                    rc = ex->GetMessage (&message);
-                    gotSomething |= NS_SUCCEEDED (rc);
-                    if (NS_SUCCEEDED (rc) && message)
+                    rc = ex->GetMessage(&message);
+                    gotSomething |= NS_SUCCEEDED(rc);
+                    if (NS_SUCCEEDED(rc) && message)
                     {
-                        mText = QString::fromUtf8 (message);
-                        nsMemory::Free (message);
+                        mText = QString::fromUtf8(message);
+                        nsMemory::Free(message);
                     }
 
@@ -421,9 +419,9 @@
                     mIsNull = !gotSomething;
 
-                    AssertMsg (gotSomething, ("Nothing to fetch!\n"));
+                    AssertMsg(gotSomething, ("Nothing to fetch!\n"));
                 }
 
                 // set the exception to NULL (to emulate Win32 behavior)
-                em->SetCurrentException (NULL);
+                em->SetCurrentException(NULL);
 
                 rc = NS_OK;
@@ -432,12 +430,12 @@
     }
 
-    AssertComRC (rc);
-
-#endif /* !defined (VBOX_WITH_XPCOM) */
+    AssertComRC(rc);
+
+#endif /* !defined(VBOX_WITH_XPCOM) */
 
     if (callee && calleeIID && mIsBasicAvailable)
     {
-        mCalleeIID = COMBase::ToQUuid (*calleeIID);
-        mCalleeName = getInterfaceNameFromIID (mCalleeIID);
+        mCalleeIID = COMBase::ToQUuid(*calleeIID);
+        mCalleeName = getInterfaceNameFromIID(mCalleeIID);
     }
 }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h	(revision 60499)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h	(revision 60500)
@@ -657,5 +657,5 @@
 #if !defined(VBOX_WITH_XPCOM)
             B::mRC = CoCreateInstance(aClsId, NULL, CLSCTX_ALL,
-                                      _ATL_IIDOF(I), (void **)&pObj);
+                                      COM_IIDOF(I), (void **)&pObj);
 #else
             nsCOMPtr<nsIComponentManager> manager;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 60499)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 60500)
@@ -180,4 +180,9 @@
 ////////////////////////////////////////////////////////////////////////////////
 
+#ifdef VBOX_WS_WIN
+/* Make sure that ATL is usable in this linking namespace. */
+static ATL::CComModule _Module;
+#endif /* VBOX_WS_WIN */
+
 /* static */
 bool VBoxGlobal::m_sfCleanupInProgress = false;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp	(revision 60499)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp	(revision 60500)
@@ -72,5 +72,5 @@
 /** IFramebuffer implementation used to maintain VM display video memory. */
 class ATL_NO_VTABLE UIFrameBufferPrivate : public QObject,
-                                           public CComObjectRootEx<CComMultiThreadModel>,
+                                           public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>,
                                            VBOX_SCRIPTABLE_IMPL(IFramebuffer)
 {
@@ -182,5 +182,5 @@
         COM_INTERFACE_ENTRY(IFramebuffer)
         COM_INTERFACE_ENTRY2(IDispatch,IFramebuffer)
-        COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
+        COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.m_p)
     END_COM_MAP()
 
@@ -395,5 +395,5 @@
 
 #ifdef Q_OS_WIN
-     CComPtr <IUnknown> m_pUnkMarshaler;
+     ComPtr<IUnknown> m_pUnkMarshaler;
 #endif /* Q_OS_WIN */
      /** Identifier returned by AttachFramebuffer. Used in DetachFramebuffer. */
@@ -521,11 +521,8 @@
 
 
-/* COM stuff: */
-#ifdef VBOX_WS_WIN
-static CComModule _Module;
-#else /* !VBOX_WS_WIN */
+#ifdef VBOX_WITH_XPCOM
 NS_DECL_CLASSINFO(UIFrameBufferPrivate)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(UIFrameBufferPrivate, IFramebuffer)
-#endif /* !VBOX_WS_WIN */
+#endif /* VBOX_WITH_XPCOM */
 
 
@@ -583,5 +580,5 @@
 
 #ifdef Q_OS_WIN
-    CoCreateFreeThreadedMarshaler(this, &m_pUnkMarshaler.p);
+    CoCreateFreeThreadedMarshaler(this, m_pUnkMarshaler.asOutParam());
 #endif /* Q_OS_WIN */
     return S_OK;
