Index: trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp	(revision 54643)
+++ trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp	(revision 54644)
@@ -21,14 +21,23 @@
 
 /* Qt includes: */
-# include <QObject>
+# include <QSocketNotifier>
+
+/* GUI includes: */
+# include "COMDefs.h"
 
 /* COM includes: */
-# include "COMDefs.h"
-# include "UIDefs.h"
 # include "CVirtualBoxErrorInfo.h"
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-#include <QSocketNotifier>
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
+
+/* Other VBox includes: */
+#include <iprt/log.h>
 
 #ifdef VBOX_WITH_XPCOM
Index: trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h	(revision 54643)
+++ trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h	(revision 54644)
@@ -98,12 +98,4 @@
 #endif /* !defined(VBOX_WITH_XPCOM) */
 
-
-/* VirtualBox interfaces declarations */
-#if !defined(VBOX_WITH_XPCOM)
-    #include <VirtualBox.h>
-#else /* !defined(VBOX_WITH_XPCOM) */
-    #include <VirtualBox_XPCOM.h>
-#endif /* !defined(VBOX_WITH_XPCOM) */
-
 /////////////////////////////////////////////////////////////////////////////
 
@@ -637,5 +629,5 @@
         clear();
         mIface = that.mIface;
-        this->addref(ptr());
+        this->addref((IUnknown*)ptr());
     }
 
@@ -644,5 +636,5 @@
         clear();
         setPtr(aIface);
-        this->addref(aIface);
+        this->addref((IUnknown*)aIface);
     }
 
@@ -697,11 +689,11 @@
         /* be aware of self assignment */
         I* amIface = ptr();
-        this->addref(aIface);
-        this->release(amIface);
+        this->addref((IUnknown*)aIface);
+        this->release((IUnknown*)amIface);
         if (aIface)
         {
             amIface = NULL;
             B::mRC = aIface->QueryInterface(COM_IIDOF(I), (void **)&amIface);
-            this->release(aIface);
+            this->release((IUnknown*)aIface);
             setPtr(amIface);
         }
@@ -720,6 +712,6 @@
 #endif
         /* be aware of self assignment */
-        this->addref(aIface);
-        this->release(ptr());
+        this->addref((IUnknown*)aIface);
+        this->release((IUnknown*)ptr());
         setPtr(aIface);
         B::mRC = S_OK;
@@ -732,5 +724,5 @@
        Assert(!mDead);
 #endif
-       this->release(ptr());
+       this->release((IUnknown*)ptr());
        setPtr(NULL);
     }
Index: trunk/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl	(revision 54643)
+++ trunk/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl	(revision 54644)
@@ -239,4 +239,10 @@
     <xsl:text> * Generator : src/VBox/Frontends/VirtualBox/include/COMWrappers.xsl&#x0A;</xsl:text>
     <xsl:text> */&#x0A;&#x0A;</xsl:text>
+    <xsl:text>/* VirtualBox interface declarations: */&#x0A;</xsl:text>
+    <xsl:text>#ifndef VBOX_WITH_XPCOM&#x0A;</xsl:text>
+    <xsl:text># include "VirtualBox.h"&#x0A;</xsl:text>
+    <xsl:text>#else /* !VBOX_WITH_XPCOM */&#x0A;</xsl:text>
+    <xsl:text># include "VirtualBox_XPCOM.h"&#x0A;</xsl:text>
+    <xsl:text>#endif /* VBOX_WITH_XPCOM */&#x0A;&#x0A;</xsl:text>
     <xsl:text>/* COM includes: */&#x0A;</xsl:text>
     <xsl:text>#include "COMEnums.h"&#x0A;</xsl:text>
@@ -295,6 +301,12 @@
     <xsl:text>&#x0A;</xsl:text>
 
-    <!-- Interface declaration: -->
-    <xsl:text>/* Interface declaration: */&#x0A;</xsl:text>
+    <!-- Interface forward declaration: -->
+    <xsl:text>/* Interface forward declaration: */&#x0A;</xsl:text>
+    <xsl:text>struct I</xsl:text>
+    <xsl:value-of select="substring(@name,2)"/>
+    <xsl:text>;&#x0A;&#x0A;</xsl:text>
+
+    <!-- Interface wrapper declaration: -->
+    <xsl:text>/* Interface wrapper declaration: */&#x0A;</xsl:text>
     <xsl:text>class C</xsl:text>
     <xsl:value-of select="substring(@name,2)"/>
@@ -330,5 +342,5 @@
     <xsl:text>Q_DECLARE_METATYPE(</xsl:text>
     <xsl:value-of select="concat('C',substring(@name,2))"/>
-    <xsl:text>)&#x0A;&#x0A;</xsl:text>
+    <xsl:text>);&#x0A;&#x0A;</xsl:text>
 
     <!-- Declare safe-array -->
@@ -466,5 +478,9 @@
   <xsl:text>    C</xsl:text>
   <xsl:value-of select="substring(@name,2)"/>
-  <xsl:text>() {}&#x0A;&#x0A;</xsl:text>
+  <xsl:text>();&#x0A;</xsl:text>
+  <!-- default destructor -->
+  <xsl:text>    ~C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>();&#x0A;&#x0A;</xsl:text>
   <!-- constructor taking CWhatever -->
   <xsl:text>    template&lt;class OI, class OB&gt; explicit C</xsl:text>
@@ -486,5 +502,5 @@
   <xsl:text>(const C</xsl:text>
   <xsl:value-of select="substring(@name,2)"/>
-  <xsl:text> &amp; that) : Base(that) {}&#x0A;&#x0A;</xsl:text>
+  <xsl:text> &amp; that);&#x0A;&#x0A;</xsl:text>
   <!-- constructor taking a raw iface pointer -->
   <xsl:text>    template&lt;class OI&gt; explicit C</xsl:text>
@@ -496,5 +512,5 @@
   <xsl:text>(</xsl:text>
   <xsl:value-of select="@name"/>
-  <xsl:text> * aIface) : Base(aIface) {}&#x0A;&#x0A;</xsl:text>
+  <xsl:text> * aIface);&#x0A;&#x0A;</xsl:text>
   <!-- assignment taking CWhatever -->
   <xsl:text>    template&lt;class OI, class OB&gt; C</xsl:text>
@@ -517,10 +533,5 @@
   <xsl:text> &amp; operator=(const C</xsl:text>
   <xsl:value-of select="substring(@name,2)"/>
-<xsl:text> &amp; that)
-    {
-        Base::operator=(that);
-        return *this;
-    }
-</xsl:text>
+<xsl:text> &amp; that);&#x0A;</xsl:text>
   <xsl:text>&#x0A;</xsl:text>
   <!-- assignment taking a raw iface pointer -->
@@ -539,10 +550,5 @@
   <xsl:text> &amp; operator=(</xsl:text>
   <xsl:value-of select="@name"/>
-<xsl:text> * aIface)
-    {
-        Base::operator=(aIface);
-        return *this;
-    }
-</xsl:text>
+<xsl:text> * aIface);&#x0A;</xsl:text>
   <xsl:text>&#x0A;</xsl:text>
 
@@ -655,4 +661,72 @@
 </xsl:template>
 
+<xsl:template name="defineConstructors">
+
+  <!-- default constructor -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>() {}&#x0A;&#x0A;</xsl:text>
+
+  <!-- default destructor -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::~C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>() {}&#x0A;&#x0A;</xsl:text>
+
+  <!-- copy constructor -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>(const C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text> &amp;that) : Base(that) {}&#x0A;&#x0A;</xsl:text>
+
+  <!-- copy constructor taking interface pointer -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>(</xsl:text>
+  <xsl:value-of select="@name"/>
+  <xsl:text> *pIface) : Base(pIface) {}&#x0A;&#x0A;</xsl:text>
+
+  <!-- operator= -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>&amp; </xsl:text>
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::operator=(const C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+<xsl:text> &amp;that)
+{
+    Base::operator=(that);
+    return *this;
+}
+</xsl:text>
+  <xsl:text>&#x0A;</xsl:text>
+
+  <!-- operator= taking interface pointer -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>&amp; </xsl:text>
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::operator=(</xsl:text>
+  <xsl:value-of select="@name"/>
+<xsl:text> *pIface)
+{
+    Base::operator=(pIface);
+    return *this;
+}
+</xsl:text>
+  <xsl:text>&#x0A;</xsl:text>
+
+</xsl:template>
+
 <xsl:template name="defineAttributes">
 
@@ -894,4 +968,7 @@
 
 <xsl:template name="defineMembers">
+  <xsl:call-template name="defineConstructors">
+    <xsl:with-param name="iface" select="."/>
+  </xsl:call-template>
   <xsl:call-template name="defineAttributes">
     <xsl:with-param name="iface" select="."/>
Index: trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 54643)
+++ trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp	(revision 54644)
@@ -134,4 +134,11 @@
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
 
 #include <QLibraryInfo>
Index: trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp	(revision 54643)
+++ trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp	(revision 54644)
@@ -46,4 +46,11 @@
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
+
 /* Other VBox includes: */
 #include <iprt/critsect.h>
Index: trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp	(revision 54643)
+++ trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp	(revision 54644)
@@ -41,4 +41,10 @@
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
 
 UIGMachinePreview::UIGMachinePreview(QIGraphicsWidget *pParent)
Index: trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp	(revision 54643)
+++ trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp	(revision 54644)
@@ -42,4 +42,5 @@
 # include "CUSBDeviceFilter.h"
 # include "CHostUSBDevice.h"
+# include "CHostUSBDeviceFilter.h"
 # include "CExtPackManager.h"
 # include "CExtPack.h"
@@ -47,5 +48,10 @@
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-#include "CHostUSBDeviceFilter.h"
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
 
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp	(revision 54643)
+++ trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp	(revision 54644)
@@ -39,4 +39,10 @@
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
 
 /* Namespaces: */
Index: trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp	(revision 54643)
+++ trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp	(revision 54644)
@@ -39,4 +39,10 @@
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
 
 UIWizardNewVMPage3::UIWizardNewVMPage3()
