Index: /trunk/include/VBox/com/ptr.h
===================================================================
--- /trunk/include/VBox/com/ptr.h	(revision 60503)
+++ /trunk/include/VBox/com/ptr.h	(revision 60504)
@@ -4,5 +4,5 @@
 
 /*
- * Copyright (C) 2006-2015 Oracle Corporation
+ * Copyright (C) 2006-2016 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -35,13 +35,7 @@
 #endif
 
-#if !defined (VBOX_WITH_XPCOM)
- #include <atlbase.h>
- #ifndef _ATL_IIDOF
- # define _ATL_IIDOF(c) __uuidof(c)
- #endif
-#else
- #include <nsISupportsUtils.h>
-
-#endif /* !defined (VBOX_WITH_XPCOM) */
+#ifdef VBOX_WITH_XPCOM
+# include <nsISupportsUtils.h>
+#endif /* VBOX_WITH_XPCOM */
 
 #include <VBox/com/defs.h>
@@ -62,8 +56,8 @@
                                  const char *serverName,
                                  const nsIID &id,
-                                 void** ppobj);
+                                 void **ppobj);
 HRESULT GlueCreateInstance(const CLSID &clsid,
                            const nsIID &id,
-                           void** ppobj);
+                           void **ppobj);
 }
 
@@ -130,5 +124,5 @@
         m_p = NULL;
         if (!that.isNull())
-            that->QueryInterface(COM_IIDOF(T), (void**)&m_p);
+            that->QueryInterface(COM_IIDOF(T), (void **)&m_p);
     }
 
@@ -155,9 +149,9 @@
         m_p = NULL;
         if (p)
-            p->QueryInterface(COM_IIDOF(T), (void**)&m_p);
-    }
-
-    /**
-     * Specialization: copy constructor from a plain T* pointer. Calls AddRef().
+            p->QueryInterface(COM_IIDOF(T), (void **)&m_p);
+    }
+
+    /**
+     * Specialization: copy constructor from a plain T * pointer. Calls AddRef().
      */
     ComPtr(T *that_p)
@@ -178,5 +172,5 @@
     ComPtr& operator=(const ComPtr<T2> &that)
     {
-        return operator=((T2*)that);
+        return operator=((T2 *)that);
     }
 
@@ -187,5 +181,5 @@
     ComPtr& operator=(const ComPtr &that)
     {
-        return operator=((T*)that);
+        return operator=((T *)that);
     }
 
@@ -204,10 +198,10 @@
         cleanup();
         if (p)
-            p->QueryInterface(COM_IIDOF(T), (void**)&m_p);
+            p->QueryInterface(COM_IIDOF(T), (void **)&m_p);
         return *this;
     }
 
     /**
-     * Specialization of the previous: assignment from a plain T* pointer.
+     * Specialization of the previous: assignment from a plain T * pointer.
      * Calls Release() on the previous member pointer, if any, and AddRef() on the new one.
      */
@@ -243,6 +237,5 @@
     }
 
-
-    bool operator<(T* p) const
+    bool operator<(T *p) const
     {
         return m_p < p;
@@ -253,5 +246,5 @@
      * parameters to COM method calls.
      */
-    operator T*() const
+    operator T *() const
     {
         return m_p;
@@ -262,5 +255,5 @@
      *  pointer).
      */
-    T* operator->() const
+    T *operator->() const
     {
         return m_p;
@@ -276,5 +269,5 @@
      * can get cleaned up properly.
      */
-    T** asOutParam()
+    T **asOutParam()
     {
         cleanup();
@@ -294,5 +287,5 @@
         {
             if (m_p)
-                return m_p->QueryInterface(COM_IIDOF(T2), (void**)pp);
+                return m_p->QueryInterface(COM_IIDOF(T2), (void **)pp);
             else
             {
@@ -310,15 +303,15 @@
      */
     template <class T2>
-    bool operator==(T2* p)
+    bool operator==(T2 *p)
     {
         IUnknown *p1 = NULL;
         bool fNeedsRelease1 = false;
         if (m_p)
-            fNeedsRelease1 = (SUCCEEDED(m_p->QueryInterface(COM_IIDOF(IUnknown), (void**)&p1)));
+            fNeedsRelease1 = (SUCCEEDED(m_p->QueryInterface(COM_IIDOF(IUnknown), (void **)&p1)));
 
         IUnknown *p2 = NULL;
         bool fNeedsRelease2 = false;
         if (p)
-            fNeedsRelease2 = (SUCCEEDED(p->QueryInterface(COM_IIDOF(IUnknown), (void**)&p2)));
+            fNeedsRelease2 = (SUCCEEDED(p->QueryInterface(COM_IIDOF(IUnknown), (void **)&p2)));
 
         bool f = p1 == p2;
@@ -338,11 +331,11 @@
         HRESULT rc;
         T *obj = NULL;
-#if !defined (VBOX_WITH_XPCOM)
-        rc = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, _ATL_IIDOF(T),
-                              (void**)&obj);
-#else /* !defined (VBOX_WITH_XPCOM) */
+#ifndef VBOX_WITH_XPCOM
+        rc = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, COM_IIDOF(T),
+                              (void **)&obj);
+#else /* VBOX_WITH_XPCOM */
         using namespace com;
-        rc = GlueCreateInstance(clsid, NS_GET_IID(T), (void**)&obj);
-#endif /* !defined (VBOX_WITH_XPCOM) */
+        rc = GlueCreateInstance(clsid, NS_GET_IID(T), (void **)&obj);
+#endif /* VBOX_WITH_XPCOM */
         *this = obj;
         if (SUCCEEDED(rc))
@@ -362,16 +355,16 @@
     HRESULT createLocalObject(const CLSID &clsid)
     {
-#if !defined (VBOX_WITH_XPCOM)
+#ifndef VBOX_WITH_XPCOM
         HRESULT rc;
         T *obj = NULL;
-        rc = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, _ATL_IIDOF(T),
-                              (void**)&obj);
+        rc = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, COM_IIDOF(T),
+                              (void **)&obj);
         *this = obj;
         if (SUCCEEDED(rc))
             obj->Release();
         return rc;
-#else /* !defined (VBOX_WITH_XPCOM) */
+#else /* VBOX_WITH_XPCOM */
         return createInprocObject(clsid);
-#endif /* !defined (VBOX_WITH_XPCOM) */
+#endif /* VBOX_WITH_XPCOM */
     }
 
@@ -386,5 +379,5 @@
     {
         T *obj = NULL;
-        HRESULT rc = GlueCreateObjectOnServer(clsid, serverName, NS_GET_IID(T), (void**)&obj);
+        HRESULT rc = GlueCreateObjectOnServer(clsid, serverName, NS_GET_IID(T), (void **)&obj);
         *this = obj;
         if (SUCCEEDED(rc))
@@ -395,5 +388,5 @@
 
 protected:
-    void copyFrom(T* p)
+    void copyFrom(T *p)
     {
         m_p = p;
@@ -411,4 +404,6 @@
     }
 
+public:
+    // Do NOT access this member unless you really know what you're doing!
     T *m_p;
 };
@@ -479,7 +474,7 @@
     {
         HRESULT rc;
-#if !defined (VBOX_WITH_XPCOM)
-#   ifdef VBOX_COM_OUTOFPROC_MODULE
-        CComObjectNoLock<T> *obj = new CComObjectNoLock<T>();
+#ifndef VBOX_WITH_XPCOM
+# ifdef VBOX_COM_OUTOFPROC_MODULE
+        ATL::CComObjectNoLock<T> *obj = new ATL::CComObjectNoLock<T>();
         if (obj)
         {
@@ -490,9 +485,9 @@
         else
             rc = E_OUTOFMEMORY;
-#   else
-        CComObject<T> *obj = NULL;
-        rc = CComObject<T>::CreateInstance(&obj);
-#   endif
-#else /* !defined (VBOX_WITH_XPCOM) */
+# else
+        ATL::CComObject<T> *obj = NULL;
+        rc = ATL::CComObject<T>::CreateInstance(&obj);
+# endif
+#else /* VBOX_WITH_XPCOM */
         CComObject<T> *obj = new CComObject<T>();
         if (obj)
@@ -500,5 +495,5 @@
         else
             rc = E_OUTOFMEMORY;
-#endif /* !defined (VBOX_WITH_XPCOM) */
+#endif /* VBOX_WITH_XPCOM */
         *this = obj;
         return rc;
