[libvirt] [PATCH 2/2] VirtualBox support to libvirt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I have attached a patch which when applied on the HEAD as of today would
allow virtualbox support in libvirt.

The patch works very well with the VirtualBox OSE version and the 2.2 Beta 
release.

[PATCH 1/2] contains diff of files already in libvirt.
[PATCH 2/2] contains new files needed for VirtualBox support.

Regards,
-pritesh
diff --git a/src/vbox/VBoxCAPI_v2_2.h b/src/vbox/VBoxCAPI_v2_2.h
new file mode 100644
index 0000000..0d7ca38
--- /dev/null
+++ b/src/vbox/VBoxCAPI_v2_2.h
@@ -0,0 +1,4784 @@
+
+/*
+ *  DO NOT EDIT! This is a generated file.
+ *
+ *  XPCOM IDL (XPIDL) definition for VirtualBox Main API (COM interfaces)
+ *  generated from XIDL (XML interface definition).
+ *
+ *  Source    : src/VBox/Main/idl/VirtualBox.xidl
+ *  Generator : src/VBox/Main/idl/xpcidl.xsl
+ *
+ *  This file contains portions from the following Mozilla XPCOM files:
+ *      xpcom/include/xpcom/nsID.h
+ *      xpcom/include/nsIException.h
+ *      xpcom/include/nsprpub/prtypes.h
+ *      xpcom/include/xpcom/nsISupportsBase.h
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Netscape Portable Runtime (NSPR).
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998-2000
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK *****
+ */
+
+#ifndef ___VirtualBox_CXPCOM_h
+#define ___VirtualBox_CXPCOM_h
+
+#ifdef __cplusplus
+# include "VirtualBox_XPCOM.h"
+#else /* !__cplusplus */
+
+#include <stddef.h>
+#include "wchar.h"
+
+#if defined(WIN32)
+
+#define PR_EXPORT(__type) extern __declspec(dllexport) __type
+#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPORT(__type) __declspec(dllimport) __type
+#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
+
+#define PR_EXTERN(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
+#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
+
+#define PR_CALLBACK
+#define PR_CALLBACK_DECL
+#define PR_STATIC_CALLBACK(__x) static __x
+
+#elif defined(XP_BEOS)
+
+#define PR_EXPORT(__type) extern __declspec(dllexport) __type
+#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPORT(__type) extern __declspec(dllexport) __type
+#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
+
+#define PR_EXTERN(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
+#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
+
+#define PR_CALLBACK
+#define PR_CALLBACK_DECL
+#define PR_STATIC_CALLBACK(__x) static __x
+
+#elif defined(WIN16)
+
+#define PR_CALLBACK_DECL        __cdecl
+
+#if defined(_WINDLL)
+#define PR_EXPORT(__type) extern __type _cdecl _export _loadds
+#define PR_IMPORT(__type) extern __type _cdecl _export _loadds
+#define PR_EXPORT_DATA(__type) extern __type _export
+#define PR_IMPORT_DATA(__type) extern __type _export
+
+#define PR_EXTERN(__type) extern __type _cdecl _export _loadds
+#define PR_IMPLEMENT(__type) __type _cdecl _export _loadds
+#define PR_EXTERN_DATA(__type) extern __type _export
+#define PR_IMPLEMENT_DATA(__type) __type _export
+
+#define PR_CALLBACK             __cdecl __loadds
+#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
+
+#else /* this must be .EXE */
+#define PR_EXPORT(__type) extern __type _cdecl _export
+#define PR_IMPORT(__type) extern __type _cdecl _export
+#define PR_EXPORT_DATA(__type) extern __type _export
+#define PR_IMPORT_DATA(__type) extern __type _export
+
+#define PR_EXTERN(__type) extern __type _cdecl _export
+#define PR_IMPLEMENT(__type) __type _cdecl _export
+#define PR_EXTERN_DATA(__type) extern __type _export
+#define PR_IMPLEMENT_DATA(__type) __type _export
+
+#define PR_CALLBACK             __cdecl __loadds
+#define PR_STATIC_CALLBACK(__x) __x PR_CALLBACK
+#endif /* _WINDLL */
+
+#elif defined(XP_MAC)
+
+#define PR_EXPORT(__type) extern __declspec(export) __type
+#define PR_EXPORT_DATA(__type) extern __declspec(export) __type
+#define PR_IMPORT(__type) extern __declspec(export) __type
+#define PR_IMPORT_DATA(__type) extern __declspec(export) __type
+
+#define PR_EXTERN(__type) extern __declspec(export) __type
+#define PR_IMPLEMENT(__type) __declspec(export) __type
+#define PR_EXTERN_DATA(__type) extern __declspec(export) __type
+#define PR_IMPLEMENT_DATA(__type) __declspec(export) __type
+
+#define PR_CALLBACK
+#define PR_CALLBACK_DECL
+#define PR_STATIC_CALLBACK(__x) static __x
+
+#elif defined(XP_OS2) && defined(__declspec)
+
+#define PR_EXPORT(__type) extern __declspec(dllexport) __type
+#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPORT(__type) __declspec(dllimport) __type
+#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
+
+#define PR_EXTERN(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
+#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
+
+#define PR_CALLBACK
+#define PR_CALLBACK_DECL
+#define PR_STATIC_CALLBACK(__x) static __x
+
+#elif defined(XP_OS2_VACPP)
+
+#define PR_EXPORT(__type) extern __type
+#define PR_EXPORT_DATA(__type) extern __type
+#define PR_IMPORT(__type) extern __type
+#define PR_IMPORT_DATA(__type) extern __type
+
+#define PR_EXTERN(__type) extern __type
+#define PR_IMPLEMENT(__type) __type
+#define PR_EXTERN_DATA(__type) extern __type
+#define PR_IMPLEMENT_DATA(__type) __type
+#define PR_CALLBACK _Optlink
+#define PR_CALLBACK_DECL
+#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
+
+#else /* Unix */
+
+# ifdef VBOX_HAVE_VISIBILITY_HIDDEN
+#  define PR_EXPORT(__type) __attribute__((visibility("default"))) extern __type
+#  define PR_EXPORT_DATA(__type) __attribute__((visibility("default"))) extern __type
+#  define PR_IMPORT(__type) extern __type
+#  define PR_IMPORT_DATA(__type) extern __type
+#  define PR_EXTERN(__type) __attribute__((visibility("default"))) extern __type
+#  define PR_IMPLEMENT(__type) __attribute__((visibility("default"))) __type
+#  define PR_EXTERN_DATA(__type) __attribute__((visibility("default"))) extern __type
+#  define PR_IMPLEMENT_DATA(__type) __attribute__((visibility("default"))) __type
+#  define PR_CALLBACK
+#  define PR_CALLBACK_DECL
+#  define PR_STATIC_CALLBACK(__x) static __x
+# else
+#  define PR_EXPORT(__type) extern __type
+#  define PR_EXPORT_DATA(__type) extern __type
+#  define PR_IMPORT(__type) extern __type
+#  define PR_IMPORT_DATA(__type) extern __type
+#  define PR_EXTERN(__type) extern __type
+#  define PR_IMPLEMENT(__type) __type
+#  define PR_EXTERN_DATA(__type) extern __type
+#  define PR_IMPLEMENT_DATA(__type) __type
+#  define PR_CALLBACK
+#  define PR_CALLBACK_DECL
+#  define PR_STATIC_CALLBACK(__x) static __x
+# endif
+#endif
+
+#if defined(_NSPR_BUILD_)
+#define NSPR_API(__type) PR_EXPORT(__type)
+#define NSPR_DATA_API(__type) PR_EXPORT_DATA(__type)
+#else
+#define NSPR_API(__type) PR_IMPORT(__type)
+#define NSPR_DATA_API(__type) PR_IMPORT_DATA(__type)
+#endif
+
+typedef unsigned char PRUint8;
+#if (defined(HPUX) && defined(__cplusplus) \
+        && !defined(__GNUC__) && __cplusplus < 199707L) \
+    || (defined(SCO) && defined(__cplusplus) \
+        && !defined(__GNUC__) && __cplusplus == 1L)
+typedef char PRInt8;
+#else
+typedef signed char PRInt8;
+#endif
+
+#define PR_INT8_MAX 127
+#define PR_INT8_MIN (-128)
+#define PR_UINT8_MAX 255U
+
+typedef unsigned short PRUint16;
+typedef short PRInt16;
+
+#define PR_INT16_MAX 32767
+#define PR_INT16_MIN (-32768)
+#define PR_UINT16_MAX 65535U
+
+typedef unsigned int PRUint32;
+typedef int PRInt32;
+#define PR_INT32(x)  x
+#define PR_UINT32(x) x ## U
+
+#define PR_INT32_MAX PR_INT32(2147483647)
+#define PR_INT32_MIN (-PR_INT32_MAX - 1)
+#define PR_UINT32_MAX PR_UINT32(4294967295)
+
+typedef long PRInt64;
+typedef unsigned long PRUint64;
+typedef int PRIntn;
+typedef unsigned int PRUintn;
+
+typedef double          PRFloat64;
+typedef size_t PRSize;
+
+typedef ptrdiff_t PRPtrdiff;
+
+typedef unsigned long PRUptrdiff;
+
+typedef PRIntn PRBool;
+
+#define PR_TRUE 1
+#define PR_FALSE 0
+
+typedef PRUint8 PRPackedBool;
+
+/*
+** Status code used by some routines that have a single point of failure or
+** special status return.
+*/
+typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
+
+#ifndef __PRUNICHAR__
+#define __PRUNICHAR__
+#if defined(WIN32) || defined(XP_MAC)
+typedef wchar_t PRUnichar;
+#else
+typedef PRUint16 PRUnichar;
+#endif
+#endif
+
+typedef long PRWord;
+typedef unsigned long PRUword;
+
+#define nsnull 0
+typedef PRUint32 nsresult;
+
+#if defined(__GNUC__) && (__GNUC__ > 2)
+#define NS_LIKELY(x)    (__builtin_expect((x), 1))
+#define NS_UNLIKELY(x)  (__builtin_expect((x), 0))
+#else
+#define NS_LIKELY(x)    (x)
+#define NS_UNLIKELY(x)  (x)
+#endif
+
+#define NS_FAILED(_nsresult) (NS_UNLIKELY((_nsresult) & 0x80000000))
+#define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) & 0x80000000)))
+
+/**
+ * An "interface id" which can be used to uniquely identify a given
+ * interface.
+ * A "unique identifier". This is modeled after OSF DCE UUIDs.
+ */
+
+struct nsID {
+  PRUint32 m0;
+  PRUint16 m1;
+  PRUint16 m2;
+  PRUint8 m3[8];
+};
+
+typedef struct nsID nsID;
+typedef nsID nsIID;
+
+struct nsISupports;   /* forward declaration */
+struct nsIStackFrame; /* forward declaration */
+struct nsIException;  /* forward declaration */
+typedef struct nsISupports nsISupports;     /* forward declaration */
+typedef struct nsIStackFrame nsIStackFrame; /* forward declaration */
+typedef struct nsIException nsIException;   /* forward declaration */
+
+/**
+ * IID for the nsISupports interface
+ * {00000000-0000-0000-c000-000000000046}
+ *
+ * To maintain binary compatibility with COM's IUnknown, we define the IID
+ * of nsISupports to be the same as that of COM's IUnknown.
+ */
+#define NS_ISUPPORTS_IID                                                      \
+  { 0x00000000, 0x0000, 0x0000,                                               \
+    {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
+
+/**
+ * Reference count values
+ *
+ * This is the return type for AddRef() and Release() in nsISupports.
+ * IUnknown of COM returns an unsigned long from equivalent functions.
+ * The following ifdef exists to maintain binary compatibility with
+ * IUnknown.
+ */
+
+/**
+ * Basic component object model interface. Objects which implement
+ * this interface support runtime interface discovery (QueryInterface)
+ * and a reference counted memory model (AddRef/Release). This is
+ * modelled after the win32 IUnknown API.
+ */
+struct nsISupports_vtbl {
+
+  /**
+   * @name Methods
+   */
+
+  /**
+   * A run time mechanism for interface discovery.
+   * @param aIID         [in]  A requested interface IID
+   * @param aInstancePtr [out] A pointer to an interface pointer to
+   *                           receive the result.
+   * @return            NS_OK if the interface is supported by the associated
+   *                          instance, NS_NOINTERFACE if it is not.
+   * NS_ERROR_INVALID_POINTER if aInstancePtr is NULL.
+   */
+  nsresult (*QueryInterface)(nsISupports *this_, const nsID *iid, void **resultp);
+  /**
+   * Increases the reference count for this interface.
+   * The associated instance will not be deleted unless
+   * the reference count is returned to zero.
+   *
+   * @return The resulting reference count.
+   */
+  nsresult (*AddRef)(nsISupports *this_);
+
+  /**
+   * Decreases the reference count for this interface.
+   * Generally, if the reference count returns to zero,
+   * the associated instance is deleted.
+   *
+   * @return The resulting reference count.
+   */
+  nsresult (*Release)(nsISupports *this_);
+
+};
+
+struct nsISupports {
+    struct nsISupports_vtbl *vtbl;
+};
+
+/* starting interface:    nsIException */
+#define NS_IEXCEPTION_IID_STR "f3a8d3b4-c424-4edc-8bf6-8974c983ba78"
+
+#define NS_IEXCEPTION_IID \
+  {0xf3a8d3b4, 0xc424, 0x4edc, \
+    { 0x8b, 0xf6, 0x89, 0x74, 0xc9, 0x83, 0xba, 0x78 }}
+
+struct nsIException_vtbl {
+
+  /* Methods from the Class nsISupports */
+  struct nsISupports_vtbl nsisupports;
+
+  /* readonly attribute string message; */
+  nsresult (*GetMessage)(nsIException *this_, PRUnichar * *aMessage);
+
+  /* readonly attribute nsresult (*result; */
+  nsresult (*GetResult)(nsIException *this_, nsresult *aResult);
+
+  /* readonly attribute string name; */
+  nsresult (*GetName)(nsIException *this_, PRUnichar * *aName);
+
+  /* readonly attribute string filename; */
+  nsresult (*GetFilename)(nsIException *this_, PRUnichar * *aFilename);
+
+  /* readonly attribute PRUint32 lineNumber; */
+  nsresult (*GetLineNumber)(nsIException *this_, PRUint32 *aLineNumber);
+
+  /* readonly attribute PRUint32 columnNumber; */
+  nsresult (*GetColumnNumber)(nsIException *this_, PRUint32 *aColumnNumber);
+
+  /* readonly attribute nsIStackFrame location; */
+  nsresult (*GetLocation)(nsIException *this_, nsIStackFrame * *aLocation);
+
+  /* readonly attribute nsIException inner; */
+  nsresult (*GetInner)(nsIException *this_, nsIException * *aInner);
+
+  /* readonly attribute nsISupports data; */
+  nsresult (*GetData)(nsIException *this_, nsISupports * *aData);
+
+  /* string toString (); */
+  nsresult (*ToString)(nsIException *this_, PRUnichar **_retval);
+};
+
+struct nsIException {
+    struct nsIException_vtbl *vtbl;
+};
+
+/* starting interface:    nsIStackFrame */
+#define NS_ISTACKFRAME_IID_STR "91d82105-7c62-4f8b-9779-154277c0ee90"
+
+#define NS_ISTACKFRAME_IID \
+  {0x91d82105, 0x7c62, 0x4f8b, \
+    { 0x97, 0x79, 0x15, 0x42, 0x77, 0xc0, 0xee, 0x90 }}
+
+struct nsIStackFrame_vtbl {
+
+  /* Methods from the Class nsISupports */
+  struct nsISupports_vtbl nsisupports;
+
+  /* readonly attribute PRUint32 language; */
+  nsresult (*GetLanguage)(nsIStackFrame *this_, PRUint32 *aLanguage);
+
+  /* readonly attribute string languageName; */
+  nsresult (*GetLanguageName)(nsIStackFrame *this_, PRUnichar * *aLanguageName);
+
+  /* readonly attribute string filename; */
+  nsresult (*GetFilename)(nsIStackFrame *this_, PRUnichar * *aFilename);
+
+  /* readonly attribute string name; */
+  nsresult (*GetName)(nsIStackFrame *this_, PRUnichar * *aName);
+
+  /* readonly attribute PRInt32 lineNumber; */
+  nsresult (*GetLineNumber)(nsIStackFrame *this_, PRInt32 *aLineNumber);
+
+  /* readonly attribute string sourceLine; */
+  nsresult (*GetSourceLine)(nsIStackFrame *this_, PRUnichar * *aSourceLine);
+
+  /* readonly attribute nsIStackFrame caller; */
+  nsresult (*GetCaller)(nsIStackFrame *this_, nsIStackFrame * *aCaller);
+
+  /* string toString (); */
+  nsresult (*ToString)(nsIStackFrame *this_, PRUnichar **_retval);
+};
+
+struct nsIStackFrame {
+    struct nsIStackFrame_vtbl *vtbl;
+};
+
+
+#define VBOX_E_OBJECT_NOT_FOUND 0x80BB0001
+#define VBOX_E_INVALID_VM_STATE 0x80BB0002
+#define VBOX_E_VM_ERROR 0x80BB0003
+#define VBOX_E_FILE_ERROR 0x80BB0004
+#define VBOX_E_IPRT_ERROR 0x80BB0005
+#define VBOX_E_PDM_ERROR 0x80BB0006
+#define VBOX_E_INVALID_OBJECT_STATE 0x80BB0007
+#define VBOX_E_HOST_ERROR 0x80BB0008
+#define VBOX_E_NOT_SUPPORTED 0x80BB0009
+#define VBOX_E_XML_ERROR 0x80BB000A
+#define VBOX_E_INVALID_SESSION_STATE 0x80BB000B
+#define VBOX_E_OBJECT_IN_USE 0x80BB000C
+
+
+struct IVirtualBoxErrorInfo;
+struct IVirtualBoxCallback;
+struct IDHCPServer;
+struct IVirtualBox;
+struct IAppliance;
+struct IVirtualSystemDescription;
+struct IInternalMachineControl;
+struct IBIOSSettings;
+struct IMachine;
+struct IConsoleCallback;
+struct IRemoteDisplayInfo;
+struct IConsole;
+struct IHostDVDDrive;
+struct IHostFloppyDrive;
+struct IHostNetworkInterface;
+struct IHost;
+struct ISystemProperties;
+struct IGuestOSType;
+struct IGuest;
+struct IProgress;
+struct ISnapshot;
+struct IMedium;
+struct IHardDiskAttachment;
+struct IHardDisk;
+struct IHardDiskFormat;
+struct IFloppyImage;
+struct IDVDImage;
+struct IDVDDrive;
+struct IFloppyDrive;
+struct IKeyboard;
+struct IMouse;
+struct IFramebuffer;
+struct IFramebufferOverlay;
+struct IDisplay;
+struct INetworkAdapter;
+struct ISerialPort;
+struct IParallelPort;
+struct IMachineDebugger;
+struct IUSBController;
+struct IUSBDevice;
+struct IUSBDeviceFilter;
+struct IHostUSBDevice;
+struct IHostUSBDeviceFilter;
+struct IAudioAdapter;
+struct IVRDPServer;
+struct ISharedFolder;
+struct IInternalSessionControl;
+struct ISession;
+struct IStorageController;
+struct IManagedObjectRef;
+struct IWebsessionManager;
+struct IPerformanceMetric;
+struct IPerformanceCollector;
+
+typedef struct IVirtualBoxErrorInfo IVirtualBoxErrorInfo;
+typedef struct IVirtualBoxCallback IVirtualBoxCallback;
+typedef struct IDHCPServer IDHCPServer;
+typedef struct IVirtualBox IVirtualBox;
+typedef struct IAppliance IAppliance;
+typedef struct IVirtualSystemDescription IVirtualSystemDescription;
+typedef struct IInternalMachineControl IInternalMachineControl;
+typedef struct IBIOSSettings IBIOSSettings;
+typedef struct IMachine IMachine;
+typedef struct IConsoleCallback IConsoleCallback;
+typedef struct IRemoteDisplayInfo IRemoteDisplayInfo;
+typedef struct IConsole IConsole;
+typedef struct IHostDVDDrive IHostDVDDrive;
+typedef struct IHostFloppyDrive IHostFloppyDrive;
+typedef struct IHostNetworkInterface IHostNetworkInterface;
+typedef struct IHost IHost;
+typedef struct ISystemProperties ISystemProperties;
+typedef struct IGuestOSType IGuestOSType;
+typedef struct IGuest IGuest;
+typedef struct IProgress IProgress;
+typedef struct ISnapshot ISnapshot;
+typedef struct IMedium IMedium;
+typedef struct IHardDiskAttachment IHardDiskAttachment;
+typedef struct IHardDisk IHardDisk;
+typedef struct IHardDiskFormat IHardDiskFormat;
+typedef struct IFloppyImage IFloppyImage;
+typedef struct IDVDImage IDVDImage;
+typedef struct IDVDDrive IDVDDrive;
+typedef struct IFloppyDrive IFloppyDrive;
+typedef struct IKeyboard IKeyboard;
+typedef struct IMouse IMouse;
+typedef struct IFramebuffer IFramebuffer;
+typedef struct IFramebufferOverlay IFramebufferOverlay;
+typedef struct IDisplay IDisplay;
+typedef struct INetworkAdapter INetworkAdapter;
+typedef struct ISerialPort ISerialPort;
+typedef struct IParallelPort IParallelPort;
+typedef struct IMachineDebugger IMachineDebugger;
+typedef struct IUSBController IUSBController;
+typedef struct IUSBDevice IUSBDevice;
+typedef struct IUSBDeviceFilter IUSBDeviceFilter;
+typedef struct IHostUSBDevice IHostUSBDevice;
+typedef struct IHostUSBDeviceFilter IHostUSBDeviceFilter;
+typedef struct IAudioAdapter IAudioAdapter;
+typedef struct IVRDPServer IVRDPServer;
+typedef struct ISharedFolder ISharedFolder;
+typedef struct IInternalSessionControl IInternalSessionControl;
+typedef struct ISession ISession;
+typedef struct IStorageController IStorageController;
+typedef struct IManagedObjectRef IManagedObjectRef;
+typedef struct IWebsessionManager IWebsessionManager;
+typedef struct IPerformanceMetric IPerformanceMetric;
+typedef struct IPerformanceCollector IPerformanceCollector;
+
+/* Start of enum TSBool Declaration */
+#define TSBOOL_IID_STR "523ff64d-842a-4b1a-80e7-c311b028cb3a"
+#define TSBOOL_IID { \
+    0x523ff64d, 0x842a, 0x4b1a, \
+    { 0x80, 0xe7, 0xc3, 0x11, 0xb0, 0x28, 0xcb, 0x3a } \
+}
+enum TSBool
+{
+    TSBool_False = 0,
+    TSBool_True = 1,
+    TSBool_Default = 2
+};
+/* End of enum TSBool Declaration */
+
+
+/* Start of enum MachineState Declaration */
+#define MACHINESTATE_IID_STR "73bf04d0-7c4f-4684-9abf-d65a9ad74343"
+#define MACHINESTATE_IID { \
+    0x73bf04d0, 0x7c4f, 0x4684, \
+    { 0x9a, 0xbf, 0xd6, 0x5a, 0x9a, 0xd7, 0x43, 0x43 } \
+}
+enum MachineState
+{
+    MachineState_Null = 0,
+    MachineState_PoweredOff = 1,
+    MachineState_Saved = 2,
+    MachineState_Aborted = 3,
+    MachineState_Running = 4,
+    MachineState_Paused = 5,
+    MachineState_Stuck = 6,
+    MachineState_Starting = 7,
+    MachineState_Stopping = 8,
+    MachineState_Saving = 9,
+    MachineState_Restoring = 10,
+    MachineState_Discarding = 11,
+    MachineState_SettingUp = 12,
+    MachineState_FirstOnline = 4,
+    MachineState_LastOnline = 10,
+    MachineState_FirstTransient = 7,
+    MachineState_LastTransient = 12
+};
+/* End of enum MachineState Declaration */
+
+
+/* Start of enum SessionState Declaration */
+#define SESSIONSTATE_IID_STR "CF2700C0-EA4B-47ae-9725-7810114B94D8"
+#define SESSIONSTATE_IID { \
+    0xCF2700C0, 0xEA4B, 0x47ae, \
+    { 0x97, 0x25, 0x78, 0x10, 0x11, 0x4B, 0x94, 0xD8 } \
+}
+enum SessionState
+{
+    SessionState_Null = 0,
+    SessionState_Closed = 1,
+    SessionState_Open = 2,
+    SessionState_Spawning = 3,
+    SessionState_Closing = 4
+};
+/* End of enum SessionState Declaration */
+
+
+/* Start of enum SessionType Declaration */
+#define SESSIONTYPE_IID_STR "A13C02CB-0C2C-421E-8317-AC0E8AAA153A"
+#define SESSIONTYPE_IID { \
+    0xA13C02CB, 0x0C2C, 0x421E, \
+    { 0x83, 0x17, 0xAC, 0x0E, 0x8A, 0xAA, 0x15, 0x3A } \
+}
+enum SessionType
+{
+    SessionType_Null = 0,
+    SessionType_Direct = 1,
+    SessionType_Remote = 2,
+    SessionType_Existing = 3
+};
+/* End of enum SessionType Declaration */
+
+
+/* Start of enum DeviceType Declaration */
+#define DEVICETYPE_IID_STR "6d9420f7-0b56-4636-99f9-7346f1b01e57"
+#define DEVICETYPE_IID { \
+    0x6d9420f7, 0x0b56, 0x4636, \
+    { 0x99, 0xf9, 0x73, 0x46, 0xf1, 0xb0, 0x1e, 0x57 } \
+}
+enum DeviceType
+{
+    DeviceType_Null = 0,
+    DeviceType_Floppy = 1,
+    DeviceType_DVD = 2,
+    DeviceType_HardDisk = 3,
+    DeviceType_Network = 4,
+    DeviceType_USB = 5,
+    DeviceType_SharedFolder = 6
+};
+/* End of enum DeviceType Declaration */
+
+
+/* Start of enum DeviceActivity Declaration */
+#define DEVICEACTIVITY_IID_STR "6FC8AEAA-130A-4eb5-8954-3F921422D707"
+#define DEVICEACTIVITY_IID { \
+    0x6FC8AEAA, 0x130A, 0x4eb5, \
+    { 0x89, 0x54, 0x3F, 0x92, 0x14, 0x22, 0xD7, 0x07 } \
+}
+enum DeviceActivity
+{
+    DeviceActivity_Null = 0,
+    DeviceActivity_Idle = 1,
+    DeviceActivity_Reading = 2,
+    DeviceActivity_Writing = 3
+};
+/* End of enum DeviceActivity Declaration */
+
+
+/* Start of enum ClipboardMode Declaration */
+#define CLIPBOARDMODE_IID_STR "33364716-4008-4701-8f14-be0fa3d62950"
+#define CLIPBOARDMODE_IID { \
+    0x33364716, 0x4008, 0x4701, \
+    { 0x8f, 0x14, 0xbe, 0x0f, 0xa3, 0xd6, 0x29, 0x50 } \
+}
+enum ClipboardMode
+{
+    ClipboardMode_Disabled = 0,
+    ClipboardMode_HostToGuest = 1,
+    ClipboardMode_GuestToHost = 2,
+    ClipboardMode_Bidirectional = 3
+};
+/* End of enum ClipboardMode Declaration */
+
+
+/* Start of enum Scope Declaration */
+#define SCOPE_IID_STR "7c91096e-499e-4eca-9f9b-9001438d7855"
+#define SCOPE_IID { \
+    0x7c91096e, 0x499e, 0x4eca, \
+    { 0x9f, 0x9b, 0x90, 0x01, 0x43, 0x8d, 0x78, 0x55 } \
+}
+enum Scope
+{
+    Scope_Global = 0,
+    Scope_Machine = 1,
+    Scope_Session = 2
+};
+/* End of enum Scope Declaration */
+
+
+/* Start of enum GuestStatisticType Declaration */
+#define GUESTSTATISTICTYPE_IID_STR "aa7c1d71-aafe-47a8-9608-27d2d337cf55"
+#define GUESTSTATISTICTYPE_IID { \
+    0xaa7c1d71, 0xaafe, 0x47a8, \
+    { 0x96, 0x08, 0x27, 0xd2, 0xd3, 0x37, 0xcf, 0x55 } \
+}
+enum GuestStatisticType
+{
+    GuestStatisticType_CPULoad_Idle = 0,
+    GuestStatisticType_CPULoad_Kernel = 1,
+    GuestStatisticType_CPULoad_User = 2,
+    GuestStatisticType_Threads = 3,
+    GuestStatisticType_Processes = 4,
+    GuestStatisticType_Handles = 5,
+    GuestStatisticType_MemoryLoad = 6,
+    GuestStatisticType_PhysMemTotal = 7,
+    GuestStatisticType_PhysMemAvailable = 8,
+    GuestStatisticType_PhysMemBalloon = 9,
+    GuestStatisticType_MemCommitTotal = 10,
+    GuestStatisticType_MemKernelTotal = 11,
+    GuestStatisticType_MemKernelPaged = 12,
+    GuestStatisticType_MemKernelNonpaged = 13,
+    GuestStatisticType_MemSystemCache = 14,
+    GuestStatisticType_PageFileSize = 15,
+    GuestStatisticType_SampleNumber = 16,
+    GuestStatisticType_MaxVal = 17
+};
+/* End of enum GuestStatisticType Declaration */
+
+
+/* Start of enum BIOSBootMenuMode Declaration */
+#define BIOSBOOTMENUMODE_IID_STR "ae4fb9f7-29d2-45b4-b2c7-d579603135d5"
+#define BIOSBOOTMENUMODE_IID { \
+    0xae4fb9f7, 0x29d2, 0x45b4, \
+    { 0xb2, 0xc7, 0xd5, 0x79, 0x60, 0x31, 0x35, 0xd5 } \
+}
+enum BIOSBootMenuMode
+{
+    BIOSBootMenuMode_Disabled = 0,
+    BIOSBootMenuMode_MenuOnly = 1,
+    BIOSBootMenuMode_MessageAndMenu = 2
+};
+/* End of enum BIOSBootMenuMode Declaration */
+
+
+/* Start of enum DriveState Declaration */
+#define DRIVESTATE_IID_STR "cb7233b7-c519-42a5-8310-1830953cacbc"
+#define DRIVESTATE_IID { \
+    0xcb7233b7, 0xc519, 0x42a5, \
+    { 0x83, 0x10, 0x18, 0x30, 0x95, 0x3c, 0xac, 0xbc } \
+}
+enum DriveState
+{
+    DriveState_Null = 0,
+    DriveState_NotMounted = 1,
+    DriveState_ImageMounted = 2,
+    DriveState_HostDriveCaptured = 3
+};
+/* End of enum DriveState Declaration */
+
+
+/* Start of enum ProcessorFeature Declaration */
+#define PROCESSORFEATURE_IID_STR "b8353b35-705d-4796-9967-ebfb7ba54af4"
+#define PROCESSORFEATURE_IID { \
+    0xb8353b35, 0x705d, 0x4796, \
+    { 0x99, 0x67, 0xeb, 0xfb, 0x7b, 0xa5, 0x4a, 0xf4 } \
+}
+enum ProcessorFeature
+{
+    ProcessorFeature_HWVirtEx = 0,
+    ProcessorFeature_PAE = 1,
+    ProcessorFeature_LongMode = 2
+};
+/* End of enum ProcessorFeature Declaration */
+
+
+/* Start of enum CIMOSType Declaration */
+#define CIMOSTYPE_IID_STR "86ef5f8c-18b2-4db8-a314-33721b59f89b"
+#define CIMOSTYPE_IID { \
+    0x86ef5f8c, 0x18b2, 0x4db8, \
+    { 0xa3, 0x14, 0x33, 0x72, 0x1b, 0x59, 0xf8, 0x9b } \
+}
+enum CIMOSType
+{
+    CIMOSType_CIMOS_Unknown = 0,
+    CIMOSType_CIMOS_Other = 1,
+    CIMOSType_CIMOS_MACOS = 2,
+    CIMOSType_CIMOS_ATTUNIX = 3,
+    CIMOSType_CIMOS_DGUX = 4,
+    CIMOSType_CIMOS_DECNT = 5,
+    CIMOSType_CIMOS_Tru64UNIX = 6,
+    CIMOSType_CIMOS_OpenVMS = 7,
+    CIMOSType_CIMOS_HPUX = 8,
+    CIMOSType_CIMOS_AIX = 9,
+    CIMOSType_CIMOS_MVS = 10,
+    CIMOSType_CIMOS_OS400 = 11,
+    CIMOSType_CIMOS_OS2 = 12,
+    CIMOSType_CIMOS_JavaVM = 13,
+    CIMOSType_CIMOS_MSDOS = 14,
+    CIMOSType_CIMOS_WIN3x = 15,
+    CIMOSType_CIMOS_WIN95 = 16,
+    CIMOSType_CIMOS_WIN98 = 17,
+    CIMOSType_CIMOS_WINNT = 18,
+    CIMOSType_CIMOS_WINCE = 19,
+    CIMOSType_CIMOS_NCR3000 = 20,
+    CIMOSType_CIMOS_NetWare = 21,
+    CIMOSType_CIMOS_OSF = 22,
+    CIMOSType_CIMOS_DCOS = 23,
+    CIMOSType_CIMOS_ReliantUNIX = 24,
+    CIMOSType_CIMOS_SCOUnixWare = 25,
+    CIMOSType_CIMOS_SCOOpenServer = 26,
+    CIMOSType_CIMOS_Sequent = 27,
+    CIMOSType_CIMOS_IRIX = 28,
+    CIMOSType_CIMOS_Solaris = 29,
+    CIMOSType_CIMOS_SunOS = 30,
+    CIMOSType_CIMOS_U6000 = 31,
+    CIMOSType_CIMOS_ASERIES = 32,
+    CIMOSType_CIMOS_HPNonStopOS = 33,
+    CIMOSType_CIMOS_HPNonStopOSS = 34,
+    CIMOSType_CIMOS_BS2000 = 35,
+    CIMOSType_CIMOS_LINUX = 36,
+    CIMOSType_CIMOS_Lynx = 37,
+    CIMOSType_CIMOS_XENIX = 38,
+    CIMOSType_CIMOS_VM = 39,
+    CIMOSType_CIMOS_InteractiveUNIX = 40,
+    CIMOSType_CIMOS_BSDUNIX = 41,
+    CIMOSType_CIMOS_FreeBSD = 42,
+    CIMOSType_CIMOS_NetBSD = 43,
+    CIMOSType_CIMOS_GNUHurd = 44,
+    CIMOSType_CIMOS_OS9 = 45,
+    CIMOSType_CIMOS_MACHKernel = 46,
+    CIMOSType_CIMOS_Inferno = 47,
+    CIMOSType_CIMOS_QNX = 48,
+    CIMOSType_CIMOS_EPOC = 49,
+    CIMOSType_CIMOS_IxWorks = 50,
+    CIMOSType_CIMOS_VxWorks = 51,
+    CIMOSType_CIMOS_MiNT = 52,
+    CIMOSType_CIMOS_BeOS = 53,
+    CIMOSType_CIMOS_HPMPE = 54,
+    CIMOSType_CIMOS_NextStep = 55,
+    CIMOSType_CIMOS_PalmPilot = 56,
+    CIMOSType_CIMOS_Rhapsody = 57,
+    CIMOSType_CIMOS_Windows2000 = 58,
+    CIMOSType_CIMOS_Dedicated = 59,
+    CIMOSType_CIMOS_OS390 = 60,
+    CIMOSType_CIMOS_VSE = 61,
+    CIMOSType_CIMOS_TPF = 62,
+    CIMOSType_CIMOS_WindowsMe = 63,
+    CIMOSType_CIMOS_CalderaOpenUNIX = 64,
+    CIMOSType_CIMOS_OpenBSD = 65,
+    CIMOSType_CIMOS_NotApplicable = 66,
+    CIMOSType_CIMOS_WindowsXP = 67,
+    CIMOSType_CIMOS_zOS = 68,
+    CIMOSType_CIMOS_MicrosoftWindowsServer2003 = 69,
+    CIMOSType_CIMOS_MicrosoftWindowsServer2003_64 = 70,
+    CIMOSType_CIMOS_WindowsXP_64 = 71,
+    CIMOSType_CIMOS_WindowsXPEmbedded = 72,
+    CIMOSType_CIMOS_WindowsVista = 73,
+    CIMOSType_CIMOS_WindowsVista_64 = 74,
+    CIMOSType_CIMOS_WindowsEmbeddedforPointofService = 75,
+    CIMOSType_CIMOS_MicrosoftWindowsServer2008 = 76,
+    CIMOSType_CIMOS_MicrosoftWindowsServer2008_64 = 77,
+    CIMOSType_CIMOS_FreeBSD_64 = 78,
+    CIMOSType_CIMOS_RedHatEnterpriseLinux = 79,
+    CIMOSType_CIMOS_RedHatEnterpriseLinux_64 = 80,
+    CIMOSType_CIMOS_Solaris_64 = 81,
+    CIMOSType_CIMOS_SUSE = 82,
+    CIMOSType_CIMOS_SUSE_64 = 83,
+    CIMOSType_CIMOS_SLES = 84,
+    CIMOSType_CIMOS_SLES_64 = 85,
+    CIMOSType_CIMOS_NovellOES = 86,
+    CIMOSType_CIMOS_NovellLinuxDesktop = 87,
+    CIMOSType_CIMOS_SunJavaDesktopSystem = 88,
+    CIMOSType_CIMOS_Mandriva = 89,
+    CIMOSType_CIMOS_Mandriva_64 = 90,
+    CIMOSType_CIMOS_TurboLinux = 91,
+    CIMOSType_CIMOS_TurboLinux_64 = 92,
+    CIMOSType_CIMOS_Ubuntu = 93,
+    CIMOSType_CIMOS_Ubuntu_64 = 94,
+    CIMOSType_CIMOS_Debian = 95,
+    CIMOSType_CIMOS_Debian_64 = 96,
+    CIMOSType_CIMOS_Linux_2_4_x = 97,
+    CIMOSType_CIMOS_Linux_2_4_x_64 = 98,
+    CIMOSType_CIMOS_Linux_2_6_x = 99,
+    CIMOSType_CIMOS_Linux_2_6_x_64 = 100,
+    CIMOSType_CIMOS_Linux_64 = 101,
+    CIMOSType_CIMOS_Other_64 = 102
+};
+/* End of enum CIMOSType Declaration */
+
+
+/* Start of enum OVFResourceType Declaration */
+#define OVFRESOURCETYPE_IID_STR "646a78d7-6f04-49f4-82c4-75c28a75a4cd"
+#define OVFRESOURCETYPE_IID { \
+    0x646a78d7, 0x6f04, 0x49f4, \
+    { 0x82, 0xc4, 0x75, 0xc2, 0x8a, 0x75, 0xa4, 0xcd } \
+}
+enum OVFResourceType
+{
+    OVFResourceType_Other = 1,
+    OVFResourceType_ComputerSystem = 2,
+    OVFResourceType_Processor = 3,
+    OVFResourceType_Memory = 4,
+    OVFResourceType_IDEController = 5,
+    OVFResourceType_ParallelSCSIHBA = 6,
+    OVFResourceType_FCHBA = 7,
+    OVFResourceType_iSCSIHBA = 8,
+    OVFResourceType_IBHCA = 9,
+    OVFResourceType_EthernetAdapter = 10,
+    OVFResourceType_OtherNetworkAdapter = 11,
+    OVFResourceType_IOSlot = 12,
+    OVFResourceType_IODevice = 13,
+    OVFResourceType_FloppyDrive = 14,
+    OVFResourceType_CDDrive = 15,
+    OVFResourceType_DVDDrive = 16,
+    OVFResourceType_HardDisk = 17,
+    OVFResourceType_OtherStorageDevice = 20,
+    OVFResourceType_USBController = 23,
+    OVFResourceType_SoundCard = 35
+};
+/* End of enum OVFResourceType Declaration */
+
+
+/* Start of enum VirtualSystemDescriptionType Declaration */
+#define VIRTUALSYSTEMDESCRIPTIONTYPE_IID_STR "8ac36d00-bb7c-4a35-a835-3f004b27427b"
+#define VIRTUALSYSTEMDESCRIPTIONTYPE_IID { \
+    0x8ac36d00, 0xbb7c, 0x4a35, \
+    { 0xa8, 0x35, 0x3f, 0x00, 0x4b, 0x27, 0x42, 0x7b } \
+}
+enum VirtualSystemDescriptionType
+{
+    VirtualSystemDescriptionType_Ignore = 1,
+    VirtualSystemDescriptionType_OS = 2,
+    VirtualSystemDescriptionType_Name = 3,
+    VirtualSystemDescriptionType_Description = 4,
+    VirtualSystemDescriptionType_CPU = 5,
+    VirtualSystemDescriptionType_Memory = 6,
+    VirtualSystemDescriptionType_HardDiskControllerIDE = 7,
+    VirtualSystemDescriptionType_HardDiskControllerSATA = 8,
+    VirtualSystemDescriptionType_HardDiskControllerSCSI = 9,
+    VirtualSystemDescriptionType_HardDiskImage = 10,
+    VirtualSystemDescriptionType_Floppy = 11,
+    VirtualSystemDescriptionType_CDROM = 12,
+    VirtualSystemDescriptionType_NetworkAdapter = 13,
+    VirtualSystemDescriptionType_USBController = 14,
+    VirtualSystemDescriptionType_SoundCard = 15
+};
+/* End of enum VirtualSystemDescriptionType Declaration */
+
+
+/* Start of enum HostNetworkInterfaceMediumType Declaration */
+#define HOSTNETWORKINTERFACEMEDIUMTYPE_IID_STR "1aa54aaf-2497-45a2-bfb1-8eb225e93d5b"
+#define HOSTNETWORKINTERFACEMEDIUMTYPE_IID { \
+    0x1aa54aaf, 0x2497, 0x45a2, \
+    { 0xbf, 0xb1, 0x8e, 0xb2, 0x25, 0xe9, 0x3d, 0x5b } \
+}
+enum HostNetworkInterfaceMediumType
+{
+    HostNetworkInterfaceMediumType_Unknown = 0,
+    HostNetworkInterfaceMediumType_Ethernet = 1,
+    HostNetworkInterfaceMediumType_PPP = 2,
+    HostNetworkInterfaceMediumType_SLIP = 3
+};
+/* End of enum HostNetworkInterfaceMediumType Declaration */
+
+
+/* Start of enum HostNetworkInterfaceStatus Declaration */
+#define HOSTNETWORKINTERFACESTATUS_IID_STR "CC474A69-2710-434B-8D99-C38E5D5A6F41"
+#define HOSTNETWORKINTERFACESTATUS_IID { \
+    0xCC474A69, 0x2710, 0x434B, \
+    { 0x8D, 0x99, 0xC3, 0x8E, 0x5D, 0x5A, 0x6F, 0x41 } \
+}
+enum HostNetworkInterfaceStatus
+{
+    HostNetworkInterfaceStatus_Unknown = 0,
+    HostNetworkInterfaceStatus_Up = 1,
+    HostNetworkInterfaceStatus_Down = 2
+};
+/* End of enum HostNetworkInterfaceStatus Declaration */
+
+
+/* Start of enum HostNetworkInterfaceType Declaration */
+#define HOSTNETWORKINTERFACETYPE_IID_STR "67431b00-9946-48a2-bc02-b25c5919f4f3"
+#define HOSTNETWORKINTERFACETYPE_IID { \
+    0x67431b00, 0x9946, 0x48a2, \
+    { 0xbc, 0x02, 0xb2, 0x5c, 0x59, 0x19, 0xf4, 0xf3 } \
+}
+enum HostNetworkInterfaceType
+{
+    HostNetworkInterfaceType_Bridged = 1,
+    HostNetworkInterfaceType_HostOnly = 2
+};
+/* End of enum HostNetworkInterfaceType Declaration */
+
+
+/* Start of enum MediaState Declaration */
+#define MEDIASTATE_IID_STR "8b86e03c-2f1c-412a-8fbd-326f62701200"
+#define MEDIASTATE_IID { \
+    0x8b86e03c, 0x2f1c, 0x412a, \
+    { 0x8f, 0xbd, 0x32, 0x6f, 0x62, 0x70, 0x12, 0x00 } \
+}
+enum MediaState
+{
+    MediaState_NotCreated = 0,
+    MediaState_Created = 1,
+    MediaState_LockedRead = 2,
+    MediaState_LockedWrite = 3,
+    MediaState_Inaccessible = 4,
+    MediaState_Creating = 5,
+    MediaState_Deleting = 6
+};
+/* End of enum MediaState Declaration */
+
+
+/* Start of enum HardDiskType Declaration */
+#define HARDDISKTYPE_IID_STR "a348fafd-a64e-4643-ba65-eb3896bd7e0a"
+#define HARDDISKTYPE_IID { \
+    0xa348fafd, 0xa64e, 0x4643, \
+    { 0xba, 0x65, 0xeb, 0x38, 0x96, 0xbd, 0x7e, 0x0a } \
+}
+enum HardDiskType
+{
+    HardDiskType_Normal = 0,
+    HardDiskType_Immutable = 1,
+    HardDiskType_Writethrough = 2
+};
+/* End of enum HardDiskType Declaration */
+
+
+/* Start of enum HardDiskVariant Declaration */
+#define HARDDISKVARIANT_IID_STR "99334b63-7ed0-4f61-8a7e-7ec3e20dd912"
+#define HARDDISKVARIANT_IID { \
+    0x99334b63, 0x7ed0, 0x4f61, \
+    { 0x8a, 0x7e, 0x7e, 0xc3, 0xe2, 0x0d, 0xd9, 0x12 } \
+}
+enum HardDiskVariant
+{
+    HardDiskVariant_Standard = 0,
+    HardDiskVariant_VmdkSplit2G = 0x01,
+    HardDiskVariant_VmdkStreamOptimized = 0x04,
+    HardDiskVariant_Fixed = 0x1000,
+    HardDiskVariant_Diff = 0x2000
+};
+/* End of enum HardDiskVariant Declaration */
+
+
+/* Start of enum DataType Declaration */
+#define DATATYPE_IID_STR "d90ea51e-a3f1-4a01-beb1-c1723c0d3ba7"
+#define DATATYPE_IID { \
+    0xd90ea51e, 0xa3f1, 0x4a01, \
+    { 0xbe, 0xb1, 0xc1, 0x72, 0x3c, 0x0d, 0x3b, 0xa7 } \
+}
+enum DataType
+{
+    DataType_Int32 = 0,
+    DataType_Int8 = 1,
+    DataType_String = 2
+};
+/* End of enum DataType Declaration */
+
+
+/* Start of enum DataFlags Declaration */
+#define DATAFLAGS_IID_STR "86884dcf-1d6b-4f1b-b4bf-f5aa44959d60"
+#define DATAFLAGS_IID { \
+    0x86884dcf, 0x1d6b, 0x4f1b, \
+    { 0xb4, 0xbf, 0xf5, 0xaa, 0x44, 0x95, 0x9d, 0x60 } \
+}
+enum DataFlags
+{
+    DataFlags_None = 0x00,
+    DataFlags_Mandatory = 0x01,
+    DataFlags_Expert = 0x02,
+    DataFlags_Array = 0x04,
+    DataFlags_FlagMask = 0x07
+};
+/* End of enum DataFlags Declaration */
+
+
+/* Start of enum HardDiskFormatCapabilities Declaration */
+#define HARDDISKFORMATCAPABILITIES_IID_STR "1df1e4aa-d25a-4ba6-b2a2-02f60eb5903b"
+#define HARDDISKFORMATCAPABILITIES_IID { \
+    0x1df1e4aa, 0xd25a, 0x4ba6, \
+    { 0xb2, 0xa2, 0x02, 0xf6, 0x0e, 0xb5, 0x90, 0x3b } \
+}
+enum HardDiskFormatCapabilities
+{
+    HardDiskFormatCapabilities_Uuid = 0x01,
+    HardDiskFormatCapabilities_CreateFixed = 0x02,
+    HardDiskFormatCapabilities_CreateDynamic = 0x04,
+    HardDiskFormatCapabilities_CreateSplit2G = 0x08,
+    HardDiskFormatCapabilities_Differencing = 0x10,
+    HardDiskFormatCapabilities_Asynchronous = 0x20,
+    HardDiskFormatCapabilities_File = 0x40,
+    HardDiskFormatCapabilities_Properties = 0x80,
+    HardDiskFormatCapabilities_CapabilityMask = 0xFF
+};
+/* End of enum HardDiskFormatCapabilities Declaration */
+
+
+/* Start of enum MouseButtonState Declaration */
+#define MOUSEBUTTONSTATE_IID_STR "03131722-2EC5-4173-9794-0DACA46673EF"
+#define MOUSEBUTTONSTATE_IID { \
+    0x03131722, 0x2EC5, 0x4173, \
+    { 0x97, 0x94, 0x0D, 0xAC, 0xA4, 0x66, 0x73, 0xEF } \
+}
+enum MouseButtonState
+{
+    MouseButtonState_LeftButton = 0x01,
+    MouseButtonState_RightButton = 0x02,
+    MouseButtonState_MiddleButton = 0x04,
+    MouseButtonState_WheelUp = 0x08,
+    MouseButtonState_WheelDown = 0x10,
+    MouseButtonState_MouseStateMask = 0x1F
+};
+/* End of enum MouseButtonState Declaration */
+
+
+/* Start of enum FramebufferAccelerationOperation Declaration */
+#define FRAMEBUFFERACCELERATIONOPERATION_IID_STR "f0e5ebbe-dc8e-4e2d-916e-53baa3844df8"
+#define FRAMEBUFFERACCELERATIONOPERATION_IID { \
+    0xf0e5ebbe, 0xdc8e, 0x4e2d, \
+    { 0x91, 0x6e, 0x53, 0xba, 0xa3, 0x84, 0x4d, 0xf8 } \
+}
+enum FramebufferAccelerationOperation
+{
+    FramebufferAccelerationOperation_SolidFillAcceleration = 1,
+    FramebufferAccelerationOperation_ScreenCopyAcceleration = 2
+};
+/* End of enum FramebufferAccelerationOperation Declaration */
+
+
+/* Start of enum FramebufferPixelFormat Declaration */
+#define FRAMEBUFFERPIXELFORMAT_IID_STR "7acfd5ed-29e3-45e3-8136-73c9224f3d2d"
+#define FRAMEBUFFERPIXELFORMAT_IID { \
+    0x7acfd5ed, 0x29e3, 0x45e3, \
+    { 0x81, 0x36, 0x73, 0xc9, 0x22, 0x4f, 0x3d, 0x2d } \
+}
+enum FramebufferPixelFormat
+{
+    FramebufferPixelFormat_Opaque = 0,
+    FramebufferPixelFormat_FOURCC_RGB = 0x32424752
+};
+/* End of enum FramebufferPixelFormat Declaration */
+
+
+/* Start of enum NetworkAttachmentType Declaration */
+#define NETWORKATTACHMENTTYPE_IID_STR "44bce1ee-99f7-4e8e-89fc-80597fd9eeaf"
+#define NETWORKATTACHMENTTYPE_IID { \
+    0x44bce1ee, 0x99f7, 0x4e8e, \
+    { 0x89, 0xfc, 0x80, 0x59, 0x7f, 0xd9, 0xee, 0xaf } \
+}
+enum NetworkAttachmentType
+{
+    NetworkAttachmentType_Null = 0,
+    NetworkAttachmentType_NAT = 1,
+    NetworkAttachmentType_Bridged = 2,
+    NetworkAttachmentType_Internal = 3,
+    NetworkAttachmentType_HostOnly = 4
+};
+/* End of enum NetworkAttachmentType Declaration */
+
+
+/* Start of enum NetworkAdapterType Declaration */
+#define NETWORKADAPTERTYPE_IID_STR "156b17b9-5d61-4d54-be90-62e37dda848d"
+#define NETWORKADAPTERTYPE_IID { \
+    0x156b17b9, 0x5d61, 0x4d54, \
+    { 0xbe, 0x90, 0x62, 0xe3, 0x7d, 0xda, 0x84, 0x8d } \
+}
+enum NetworkAdapterType
+{
+    NetworkAdapterType_Null = 0,
+    NetworkAdapterType_Am79C970A = 1,
+    NetworkAdapterType_Am79C973 = 2,
+    NetworkAdapterType_I82540EM = 3,
+    NetworkAdapterType_I82543GC = 4
+};
+/* End of enum NetworkAdapterType Declaration */
+
+
+/* Start of enum PortMode Declaration */
+#define PORTMODE_IID_STR "b266f43c-2e93-46b3-812b-c20e600e867b"
+#define PORTMODE_IID { \
+    0xb266f43c, 0x2e93, 0x46b3, \
+    { 0x81, 0x2b, 0xc2, 0x0e, 0x60, 0x0e, 0x86, 0x7b } \
+}
+enum PortMode
+{
+    PortMode_Disconnected = 0,
+    PortMode_HostPipe = 1,
+    PortMode_HostDevice = 2
+};
+/* End of enum PortMode Declaration */
+
+
+/* Start of enum USBDeviceState Declaration */
+#define USBDEVICESTATE_IID_STR "b99a2e65-67fb-4882-82fd-f3e5e8193ab4"
+#define USBDEVICESTATE_IID { \
+    0xb99a2e65, 0x67fb, 0x4882, \
+    { 0x82, 0xfd, 0xf3, 0xe5, 0xe8, 0x19, 0x3a, 0xb4 } \
+}
+enum USBDeviceState
+{
+    USBDeviceState_NotSupported = 0,
+    USBDeviceState_Unavailable = 1,
+    USBDeviceState_Busy = 2,
+    USBDeviceState_Available = 3,
+    USBDeviceState_Held = 4,
+    USBDeviceState_Captured = 5
+};
+/* End of enum USBDeviceState Declaration */
+
+
+/* Start of enum USBDeviceFilterAction Declaration */
+#define USBDEVICEFILTERACTION_IID_STR "cbc30a49-2f4e-43b5-9da6-121320475933"
+#define USBDEVICEFILTERACTION_IID { \
+    0xcbc30a49, 0x2f4e, 0x43b5, \
+    { 0x9d, 0xa6, 0x12, 0x13, 0x20, 0x47, 0x59, 0x33 } \
+}
+enum USBDeviceFilterAction
+{
+    USBDeviceFilterAction_Null = 0,
+    USBDeviceFilterAction_Ignore = 1,
+    USBDeviceFilterAction_Hold = 2
+};
+/* End of enum USBDeviceFilterAction Declaration */
+
+
+/* Start of enum AudioDriverType Declaration */
+#define AUDIODRIVERTYPE_IID_STR "4bcc3d73-c2fe-40db-b72f-0c2ca9d68496"
+#define AUDIODRIVERTYPE_IID { \
+    0x4bcc3d73, 0xc2fe, 0x40db, \
+    { 0xb7, 0x2f, 0x0c, 0x2c, 0xa9, 0xd6, 0x84, 0x96 } \
+}
+enum AudioDriverType
+{
+    AudioDriverType_Null = 0,
+    AudioDriverType_WinMM = 1,
+    AudioDriverType_OSS = 2,
+    AudioDriverType_ALSA = 3,
+    AudioDriverType_DirectSound = 4,
+    AudioDriverType_CoreAudio = 5,
+    AudioDriverType_MMPM = 6,
+    AudioDriverType_Pulse = 7,
+    AudioDriverType_SolAudio = 8
+};
+/* End of enum AudioDriverType Declaration */
+
+
+/* Start of enum AudioControllerType Declaration */
+#define AUDIOCONTROLLERTYPE_IID_STR "7afd395c-42c3-444e-8788-3ce80292f36c"
+#define AUDIOCONTROLLERTYPE_IID { \
+    0x7afd395c, 0x42c3, 0x444e, \
+    { 0x87, 0x88, 0x3c, 0xe8, 0x02, 0x92, 0xf3, 0x6c } \
+}
+enum AudioControllerType
+{
+    AudioControllerType_AC97 = 0,
+    AudioControllerType_SB16 = 1
+};
+/* End of enum AudioControllerType Declaration */
+
+
+/* Start of enum VRDPAuthType Declaration */
+#define VRDPAUTHTYPE_IID_STR "3d91887a-b67f-4b33-85bf-2da7ab1ea83a"
+#define VRDPAUTHTYPE_IID { \
+    0x3d91887a, 0xb67f, 0x4b33, \
+    { 0x85, 0xbf, 0x2d, 0xa7, 0xab, 0x1e, 0xa8, 0x3a } \
+}
+enum VRDPAuthType
+{
+    VRDPAuthType_Null = 0,
+    VRDPAuthType_External = 1,
+    VRDPAuthType_Guest = 2
+};
+/* End of enum VRDPAuthType Declaration */
+
+
+/* Start of enum StorageBus Declaration */
+#define STORAGEBUS_IID_STR "f381fdca-5953-41d0-b2bd-0542b012698d"
+#define STORAGEBUS_IID { \
+    0xf381fdca, 0x5953, 0x41d0, \
+    { 0xb2, 0xbd, 0x05, 0x42, 0xb0, 0x12, 0x69, 0x8d } \
+}
+enum StorageBus
+{
+    StorageBus_Null = 0,
+    StorageBus_IDE = 1,
+    StorageBus_SATA = 2,
+    StorageBus_SCSI = 3
+};
+/* End of enum StorageBus Declaration */
+
+
+/* Start of enum StorageControllerType Declaration */
+#define STORAGECONTROLLERTYPE_IID_STR "685387db-a837-4320-a258-08f46a22f62a"
+#define STORAGECONTROLLERTYPE_IID { \
+    0x685387db, 0xa837, 0x4320, \
+    { 0xa2, 0x58, 0x08, 0xf4, 0x6a, 0x22, 0xf6, 0x2a } \
+}
+enum StorageControllerType
+{
+    StorageControllerType_Null = 0,
+    StorageControllerType_LsiLogic = 1,
+    StorageControllerType_BusLogic = 2,
+    StorageControllerType_IntelAhci = 3,
+    StorageControllerType_PIIX3 = 4,
+    StorageControllerType_PIIX4 = 5,
+    StorageControllerType_ICH6 = 6
+};
+/* End of enum StorageControllerType Declaration */
+
+
+/* Start of struct IVirtualBoxErrorInfo Declaration */
+#define IVIRTUALBOXERRORINFO_IID_STR "e98b5376-8eb4-4eea-812a-3964bf3bb26f"
+#define IVIRTUALBOXERRORINFO_IID { \
+    0xe98b5376, 0x8eb4, 0x4eea, \
+    { 0x81, 0x2a, 0x39, 0x64, 0xbf, 0x3b, 0xb2, 0x6f } \
+}
+struct IVirtualBoxErrorInfo_vtbl
+{
+    struct nsIException_vtbl nsiexception;
+
+    nsresult (*GetResultCode)(IVirtualBoxErrorInfo *this_, nsresult *resultCode);
+
+    nsresult (*GetInterfaceID)(IVirtualBoxErrorInfo *this_, nsID * *interfaceID);
+
+    nsresult (*GetComponent)(IVirtualBoxErrorInfo *this_, PRUnichar * *component);
+
+    nsresult (*GetText)(IVirtualBoxErrorInfo *this_, PRUnichar * *text);
+
+    nsresult (*GetNext)(IVirtualBoxErrorInfo *this_, IVirtualBoxErrorInfo * *next);
+
+};
+
+struct IVirtualBoxErrorInfo
+{
+    struct IVirtualBoxErrorInfo_vtbl *vtbl;
+};
+/* End of struct IVirtualBoxErrorInfo Declaration */
+
+
+/* Start of struct IVirtualBoxCallback Declaration */
+#define IVIRTUALBOXCALLBACK_IID_STR "5516cc08-fb81-47a6-b184-031e7bbd2997"
+#define IVIRTUALBOXCALLBACK_IID { \
+    0x5516cc08, 0xfb81, 0x47a6, \
+    { 0xb1, 0x84, 0x03, 0x1e, 0x7b, 0xbd, 0x29, 0x97 } \
+}
+struct IVirtualBoxCallback_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*OnMachineStateChange)(
+        IVirtualBoxCallback *this_,
+        const nsID * machineId,
+        PRUint32 state
+    );
+
+    nsresult (*OnMachineDataChange)(
+        IVirtualBoxCallback *this_,
+        const nsID * machineId
+    );
+
+    nsresult (*OnExtraDataCanChange)(
+        IVirtualBoxCallback *this_,
+        const nsID * machineId,
+        PRUnichar * key,
+        PRUnichar * value,
+        PRUnichar * * error,
+        PRBool * allowChange
+    );
+
+    nsresult (*OnExtraDataChange)(
+        IVirtualBoxCallback *this_,
+        const nsID * machineId,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*OnMediaRegistered)(
+        IVirtualBoxCallback *this_,
+        const nsID * mediaId,
+        PRUint32 mediaType,
+        PRBool registered
+    );
+
+    nsresult (*OnMachineRegistered)(
+        IVirtualBoxCallback *this_,
+        const nsID * machineId,
+        PRBool registered
+    );
+
+    nsresult (*OnSessionStateChange)(
+        IVirtualBoxCallback *this_,
+        const nsID * machineId,
+        PRUint32 state
+    );
+
+    nsresult (*OnSnapshotTaken)(
+        IVirtualBoxCallback *this_,
+        const nsID * machineId,
+        const nsID * snapshotId
+    );
+
+    nsresult (*OnSnapshotDiscarded)(
+        IVirtualBoxCallback *this_,
+        const nsID * machineId,
+        const nsID * snapshotId
+    );
+
+    nsresult (*OnSnapshotChange)(
+        IVirtualBoxCallback *this_,
+        const nsID * machineId,
+        const nsID * snapshotId
+    );
+
+    nsresult (*OnGuestPropertyChange)(
+        IVirtualBoxCallback *this_,
+        const nsID * machineId,
+        PRUnichar * name,
+        PRUnichar * value,
+        PRUnichar * flags
+    );
+
+};
+
+struct IVirtualBoxCallback
+{
+    struct IVirtualBoxCallback_vtbl *vtbl;
+};
+/* End of struct IVirtualBoxCallback Declaration */
+
+
+/* Start of struct IDHCPServer Declaration */
+#define IDHCPSERVER_IID_STR "fab58256-c76e-4ddd-8029-18343e5b0069"
+#define IDHCPSERVER_IID { \
+    0xfab58256, 0xc76e, 0x4ddd, \
+    { 0x80, 0x29, 0x18, 0x34, 0x3e, 0x5b, 0x00, 0x69 } \
+}
+struct IDHCPServer_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetEnabled)(IDHCPServer *this_, PRBool *enabled);
+    nsresult (*SetEnabled)(IDHCPServer *this_, PRBool enabled);
+
+    nsresult (*GetIPAddress)(IDHCPServer *this_, PRUnichar * *IPAddress);
+
+    nsresult (*GetNetworkMask)(IDHCPServer *this_, PRUnichar * *networkMask);
+
+    nsresult (*GetNetworkName)(IDHCPServer *this_, PRUnichar * *networkName);
+
+    nsresult (*GetLowerIP)(IDHCPServer *this_, PRUnichar * *lowerIP);
+
+    nsresult (*GetUpperIP)(IDHCPServer *this_, PRUnichar * *upperIP);
+
+    nsresult (*SetConfiguration)(
+        IDHCPServer *this_,
+        PRUnichar * IPAddress,
+        PRUnichar * networkMask,
+        PRUnichar * FromIPAddress,
+        PRUnichar * ToIPAddress
+    );
+
+};
+
+struct IDHCPServer
+{
+    struct IDHCPServer_vtbl *vtbl;
+};
+/* End of struct IDHCPServer Declaration */
+
+
+/* Start of struct IVirtualBox Declaration */
+#define IVIRTUALBOX_IID_STR "779264f4-65ed-48ed-be39-518ca549e296"
+#define IVIRTUALBOX_IID { \
+    0x779264f4, 0x65ed, 0x48ed, \
+    { 0xbe, 0x39, 0x51, 0x8c, 0xa5, 0x49, 0xe2, 0x96 } \
+}
+struct IVirtualBox_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetVersion)(IVirtualBox *this_, PRUnichar * *version);
+
+    nsresult (*GetRevision)(IVirtualBox *this_, PRUint32 *revision);
+
+    nsresult (*GetPackageType)(IVirtualBox *this_, PRUnichar * *packageType);
+
+    nsresult (*GetHomeFolder)(IVirtualBox *this_, PRUnichar * *homeFolder);
+
+    nsresult (*GetSettingsFilePath)(IVirtualBox *this_, PRUnichar * *settingsFilePath);
+
+    nsresult (*GetSettingsFileVersion)(IVirtualBox *this_, PRUnichar * *settingsFileVersion);
+
+    nsresult (*GetSettingsFormatVersion)(IVirtualBox *this_, PRUnichar * *settingsFormatVersion);
+
+    nsresult (*GetHost)(IVirtualBox *this_, IHost * *host);
+
+    nsresult (*GetSystemProperties)(IVirtualBox *this_, ISystemProperties * *systemProperties);
+
+    nsresult (*GetMachines)(IVirtualBox *this_, PRUint32 *machinesSize, IMachine * **machines);
+
+    nsresult (*GetHardDisks)(IVirtualBox *this_, PRUint32 *hardDisksSize, IHardDisk * **hardDisks);
+
+    nsresult (*GetDVDImages)(IVirtualBox *this_, PRUint32 *DVDImagesSize, IDVDImage * **DVDImages);
+
+    nsresult (*GetFloppyImages)(IVirtualBox *this_, PRUint32 *floppyImagesSize, IFloppyImage * **floppyImages);
+
+    nsresult (*GetProgressOperations)(IVirtualBox *this_, PRUint32 *progressOperationsSize, IProgress * **progressOperations);
+
+    nsresult (*GetGuestOSTypes)(IVirtualBox *this_, PRUint32 *guestOSTypesSize, IGuestOSType * **guestOSTypes);
+
+    nsresult (*GetSharedFolders)(IVirtualBox *this_, PRUint32 *sharedFoldersSize, ISharedFolder * **sharedFolders);
+
+    nsresult (*GetPerformanceCollector)(IVirtualBox *this_, IPerformanceCollector * *performanceCollector);
+
+    nsresult (*GetDHCPServers)(IVirtualBox *this_, PRUint32 *DHCPServersSize, IDHCPServer * **DHCPServers);
+
+    nsresult (*CreateMachine)(
+        IVirtualBox *this_,
+        PRUnichar * name,
+        PRUnichar * osTypeId,
+        PRUnichar * baseFolder,
+        const nsID * id,
+        IMachine * * machine
+    );
+
+    nsresult (*CreateLegacyMachine)(
+        IVirtualBox *this_,
+        PRUnichar * name,
+        PRUnichar * osTypeId,
+        PRUnichar * settingsFile,
+        const nsID * id,
+        IMachine * * machine
+    );
+
+    nsresult (*OpenMachine)(
+        IVirtualBox *this_,
+        PRUnichar * settingsFile,
+        IMachine * * machine
+    );
+
+    nsresult (*RegisterMachine)(
+        IVirtualBox *this_,
+        IMachine * machine
+    );
+
+    nsresult (*GetMachine)(
+        IVirtualBox *this_,
+        const nsID * id,
+        IMachine * * machine
+    );
+
+    nsresult (*FindMachine)(
+        IVirtualBox *this_,
+        PRUnichar * name,
+        IMachine * * machine
+    );
+
+    nsresult (*UnregisterMachine)(
+        IVirtualBox *this_,
+        const nsID * id,
+        IMachine * * machine
+    );
+
+    nsresult (*CreateAppliance)(
+        IVirtualBox *this_,
+        IAppliance * * appliance
+    );
+
+    nsresult (*CreateHardDisk)(
+        IVirtualBox *this_,
+        PRUnichar * format,
+        PRUnichar * location,
+        IHardDisk * * hardDisk
+    );
+
+    nsresult (*OpenHardDisk)(
+        IVirtualBox *this_,
+        PRUnichar * location,
+        IHardDisk * * hardDisk
+    );
+
+    nsresult (*GetHardDisk)(
+        IVirtualBox *this_,
+        const nsID * id,
+        IHardDisk * * hardDisk
+    );
+
+    nsresult (*FindHardDisk)(
+        IVirtualBox *this_,
+        PRUnichar * location,
+        IHardDisk * * hardDisk
+    );
+
+    nsresult (*OpenDVDImage)(
+        IVirtualBox *this_,
+        PRUnichar * location,
+        const nsID * id,
+        IDVDImage * * image
+    );
+
+    nsresult (*GetDVDImage)(
+        IVirtualBox *this_,
+        const nsID * id,
+        IDVDImage * * image
+    );
+
+    nsresult (*FindDVDImage)(
+        IVirtualBox *this_,
+        PRUnichar * location,
+        IDVDImage * * image
+    );
+
+    nsresult (*OpenFloppyImage)(
+        IVirtualBox *this_,
+        PRUnichar * location,
+        const nsID * id,
+        IFloppyImage * * image
+    );
+
+    nsresult (*GetFloppyImage)(
+        IVirtualBox *this_,
+        const nsID * id,
+        IFloppyImage * * image
+    );
+
+    nsresult (*FindFloppyImage)(
+        IVirtualBox *this_,
+        PRUnichar * location,
+        IFloppyImage * * image
+    );
+
+    nsresult (*GetGuestOSType)(
+        IVirtualBox *this_,
+        PRUnichar * id,
+        IGuestOSType * * type
+    );
+
+    nsresult (*CreateSharedFolder)(
+        IVirtualBox *this_,
+        PRUnichar * name,
+        PRUnichar * hostPath,
+        PRBool writable
+    );
+
+    nsresult (*RemoveSharedFolder)(
+        IVirtualBox *this_,
+        PRUnichar * name
+    );
+
+    nsresult (*GetNextExtraDataKey)(
+        IVirtualBox *this_,
+        PRUnichar * key,
+        PRUnichar * * nextKey,
+        PRUnichar * * nextValue
+    );
+
+    nsresult (*GetExtraData)(
+        IVirtualBox *this_,
+        PRUnichar * key,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetExtraData)(
+        IVirtualBox *this_,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*OpenSession)(
+        IVirtualBox *this_,
+        ISession * session,
+        const nsID * machineId
+    );
+
+    nsresult (*OpenRemoteSession)(
+        IVirtualBox *this_,
+        ISession * session,
+        const nsID * machineId,
+        PRUnichar * type,
+        PRUnichar * environment,
+        IProgress * * progress
+    );
+
+    nsresult (*OpenExistingSession)(
+        IVirtualBox *this_,
+        ISession * session,
+        const nsID * machineId
+    );
+
+    nsresult (*RegisterCallback)(
+        IVirtualBox *this_,
+        IVirtualBoxCallback * callback
+    );
+
+    nsresult (*UnregisterCallback)(
+        IVirtualBox *this_,
+        IVirtualBoxCallback * callback
+    );
+
+    nsresult (*WaitForPropertyChange)(
+        IVirtualBox *this_,
+        PRUnichar * what,
+        PRUint32 timeout,
+        PRUnichar * * changed,
+        PRUnichar * * values
+    );
+
+    nsresult (*SaveSettings)(IVirtualBox *this_ );
+
+    nsresult (*SaveSettingsWithBackup)(
+        IVirtualBox *this_,
+        PRUnichar * * bakFileName
+    );
+
+    nsresult (*CreateDHCPServer)(
+        IVirtualBox *this_,
+        PRUnichar * name,
+        IDHCPServer * * server
+    );
+
+    nsresult (*FindDHCPServerByNetworkName)(
+        IVirtualBox *this_,
+        PRUnichar * name,
+        IDHCPServer * * server
+    );
+
+    nsresult (*RemoveDHCPServer)(
+        IVirtualBox *this_,
+        IDHCPServer * server
+    );
+
+};
+
+struct IVirtualBox
+{
+    struct IVirtualBox_vtbl *vtbl;
+};
+/* End of struct IVirtualBox Declaration */
+
+
+/* Start of struct IAppliance Declaration */
+#define IAPPLIANCE_IID_STR "a7a71c1f-20d3-4483-95c0-7357dda77f50"
+#define IAPPLIANCE_IID { \
+    0xa7a71c1f, 0x20d3, 0x4483, \
+    { 0x95, 0xc0, 0x73, 0x57, 0xdd, 0xa7, 0x7f, 0x50 } \
+}
+struct IAppliance_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetPath)(IAppliance *this_, PRUnichar * *path);
+
+    nsresult (*GetDisks)(IAppliance *this_, PRUint32 *disksSize, PRUnichar * **disks);
+
+    nsresult (*GetVirtualSystemDescriptions)(IAppliance *this_, PRUint32 *virtualSystemDescriptionsSize, IVirtualSystemDescription * **virtualSystemDescriptions);
+
+    nsresult (*Read)(
+        IAppliance *this_,
+        PRUnichar * file
+    );
+
+    nsresult (*Interpret)(IAppliance *this_ );
+
+    nsresult (*ImportMachines)(
+        IAppliance *this_,
+        IProgress * * aProgress
+    );
+
+    nsresult (*Write)(
+        IAppliance *this_,
+        PRUnichar * path,
+        IProgress * * aProgress
+    );
+
+    nsresult (*GetWarnings)(
+        IAppliance *this_,
+        PRUint32 *aWarningsSize,
+        PRUnichar *** aWarnings
+    );
+
+};
+
+struct IAppliance
+{
+    struct IAppliance_vtbl *vtbl;
+};
+/* End of struct IAppliance Declaration */
+
+
+/* Start of struct IVirtualSystemDescription Declaration */
+#define IVIRTUALSYSTEMDESCRIPTION_IID_STR "c2e9f5b5-522c-47e5-be55-0d20b46a95d9"
+#define IVIRTUALSYSTEMDESCRIPTION_IID { \
+    0xc2e9f5b5, 0x522c, 0x47e5, \
+    { 0xbe, 0x55, 0x0d, 0x20, 0xb4, 0x6a, 0x95, 0xd9 } \
+}
+struct IVirtualSystemDescription_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetCount)(IVirtualSystemDescription *this_, PRUint32 *count);
+
+    nsresult (*GetDescription)(
+        IVirtualSystemDescription *this_,
+        PRUint32 *aTypesSize,
+        PRUint32* aTypes,
+        PRUint32 *aRefsSize,
+        PRUnichar *** aRefs,
+        PRUint32 *aOvfValuesSize,
+        PRUnichar *** aOvfValues,
+        PRUint32 *aVboxValuesSize,
+        PRUnichar *** aVboxValues,
+        PRUint32 *aExtraConfigValuesSize,
+        PRUnichar *** aExtraConfigValues
+    );
+
+    nsresult (*GetDescriptionByType)(
+        IVirtualSystemDescription *this_,
+        PRUint32 aType,
+        PRUint32 *aTypesSize,
+        PRUint32* aTypes,
+        PRUint32 *aRefsSize,
+        PRUnichar *** aRefs,
+        PRUint32 *aOvfValuesSize,
+        PRUnichar *** aOvfValues,
+        PRUint32 *aVboxValuesSize,
+        PRUnichar *** aVboxValues,
+        PRUint32 *aExtraConfigValuesSize,
+        PRUnichar *** aExtraConfigValues
+    );
+
+    nsresult (*SetFinalValues)(
+        IVirtualSystemDescription *this_,
+        PRUint32 aEnabledSize,
+        PRBool* aEnabled,
+        PRUint32 aVboxValuesSize,
+        PRUnichar ** aVboxValues,
+        PRUint32 aExtraConfigValuesSize,
+        PRUnichar ** aExtraConfigValues
+    );
+
+};
+
+struct IVirtualSystemDescription
+{
+    struct IVirtualSystemDescription_vtbl *vtbl;
+};
+/* End of struct IVirtualSystemDescription Declaration */
+
+
+/* Start of struct IInternalMachineControl Declaration */
+#define IINTERNALMACHINECONTROL_IID_STR "2c88b969-7a74-4ef3-b95f-8a209a1535f3"
+#define IINTERNALMACHINECONTROL_IID { \
+    0x2c88b969, 0x7a74, 0x4ef3, \
+    { 0xb9, 0x5f, 0x8a, 0x20, 0x9a, 0x15, 0x35, 0xf3 } \
+}
+struct IInternalMachineControl_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*UpdateState)(
+        IInternalMachineControl *this_,
+        PRUint32 state
+    );
+
+    nsresult (*GetIPCId)(
+        IInternalMachineControl *this_,
+        PRUnichar * * id
+    );
+
+    nsresult (*RunUSBDeviceFilters)(
+        IInternalMachineControl *this_,
+        IUSBDevice * device,
+        PRBool * matched,
+        PRUint32 * maskedInterfaces
+    );
+
+    nsresult (*CaptureUSBDevice)(
+        IInternalMachineControl *this_,
+        const nsID * id
+    );
+
+    nsresult (*DetachUSBDevice)(
+        IInternalMachineControl *this_,
+        const nsID * id,
+        PRBool done
+    );
+
+    nsresult (*AutoCaptureUSBDevices)(IInternalMachineControl *this_ );
+
+    nsresult (*DetachAllUSBDevices)(
+        IInternalMachineControl *this_,
+        PRBool done
+    );
+
+    nsresult (*OnSessionEnd)(
+        IInternalMachineControl *this_,
+        ISession * session,
+        IProgress * * progress
+    );
+
+    nsresult (*BeginSavingState)(
+        IInternalMachineControl *this_,
+        IProgress * progress,
+        PRUnichar * * stateFilePath
+    );
+
+    nsresult (*EndSavingState)(
+        IInternalMachineControl *this_,
+        PRBool success
+    );
+
+    nsresult (*AdoptSavedState)(
+        IInternalMachineControl *this_,
+        PRUnichar * savedStateFile
+    );
+
+    nsresult (*BeginTakingSnapshot)(
+        IInternalMachineControl *this_,
+        IConsole * initiator,
+        PRUnichar * name,
+        PRUnichar * description,
+        IProgress * progress,
+        PRUnichar * * stateFilePath,
+        IProgress * * serverProgress
+    );
+
+    nsresult (*EndTakingSnapshot)(
+        IInternalMachineControl *this_,
+        PRBool success
+    );
+
+    nsresult (*DiscardSnapshot)(
+        IInternalMachineControl *this_,
+        IConsole * initiator,
+        const nsID * id,
+        PRUint32 * machineState,
+        IProgress * * progress
+    );
+
+    nsresult (*DiscardCurrentState)(
+        IInternalMachineControl *this_,
+        IConsole * initiator,
+        PRUint32 * machineState,
+        IProgress * * progress
+    );
+
+    nsresult (*DiscardCurrentSnapshotAndState)(
+        IInternalMachineControl *this_,
+        IConsole * initiator,
+        PRUint32 * machineState,
+        IProgress * * progress
+    );
+
+    nsresult (*PullGuestProperties)(
+        IInternalMachineControl *this_,
+        PRUint32 *nameSize,
+        PRUnichar *** name,
+        PRUint32 *valueSize,
+        PRUnichar *** value,
+        PRUint32 *timestampSize,
+        PRUint64* timestamp,
+        PRUint32 *flagsSize,
+        PRUnichar *** flags
+    );
+
+    nsresult (*PushGuestProperties)(
+        IInternalMachineControl *this_,
+        PRUint32 nameSize,
+        PRUnichar ** name,
+        PRUint32 valueSize,
+        PRUnichar ** value,
+        PRUint32 timestampSize,
+        PRUint64* timestamp,
+        PRUint32 flagsSize,
+        PRUnichar ** flags
+    );
+
+    nsresult (*PushGuestProperty)(
+        IInternalMachineControl *this_,
+        PRUnichar * name,
+        PRUnichar * value,
+        PRUint64 timestamp,
+        PRUnichar * flags
+    );
+
+    nsresult (*LockMedia)(IInternalMachineControl *this_ );
+
+};
+
+struct IInternalMachineControl
+{
+    struct IInternalMachineControl_vtbl *vtbl;
+};
+/* End of struct IInternalMachineControl Declaration */
+
+
+/* Start of struct IBIOSSettings Declaration */
+#define IBIOSSETTINGS_IID_STR "38b54279-dc35-4f5e-a431-835b867c6b5e"
+#define IBIOSSETTINGS_IID { \
+    0x38b54279, 0xdc35, 0x4f5e, \
+    { 0xa4, 0x31, 0x83, 0x5b, 0x86, 0x7c, 0x6b, 0x5e } \
+}
+struct IBIOSSettings_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetLogoFadeIn)(IBIOSSettings *this_, PRBool *logoFadeIn);
+    nsresult (*SetLogoFadeIn)(IBIOSSettings *this_, PRBool logoFadeIn);
+
+    nsresult (*GetLogoFadeOut)(IBIOSSettings *this_, PRBool *logoFadeOut);
+    nsresult (*SetLogoFadeOut)(IBIOSSettings *this_, PRBool logoFadeOut);
+
+    nsresult (*GetLogoDisplayTime)(IBIOSSettings *this_, PRUint32 *logoDisplayTime);
+    nsresult (*SetLogoDisplayTime)(IBIOSSettings *this_, PRUint32 logoDisplayTime);
+
+    nsresult (*GetLogoImagePath)(IBIOSSettings *this_, PRUnichar * *logoImagePath);
+    nsresult (*SetLogoImagePath)(IBIOSSettings *this_, PRUnichar * logoImagePath);
+
+    nsresult (*GetBootMenuMode)(IBIOSSettings *this_, PRUint32 *bootMenuMode);
+    nsresult (*SetBootMenuMode)(IBIOSSettings *this_, PRUint32 bootMenuMode);
+
+    nsresult (*GetACPIEnabled)(IBIOSSettings *this_, PRBool *ACPIEnabled);
+    nsresult (*SetACPIEnabled)(IBIOSSettings *this_, PRBool ACPIEnabled);
+
+    nsresult (*GetIOAPICEnabled)(IBIOSSettings *this_, PRBool *IOAPICEnabled);
+    nsresult (*SetIOAPICEnabled)(IBIOSSettings *this_, PRBool IOAPICEnabled);
+
+    nsresult (*GetTimeOffset)(IBIOSSettings *this_, PRInt64 *timeOffset);
+    nsresult (*SetTimeOffset)(IBIOSSettings *this_, PRInt64 timeOffset);
+
+    nsresult (*GetPXEDebugEnabled)(IBIOSSettings *this_, PRBool *PXEDebugEnabled);
+    nsresult (*SetPXEDebugEnabled)(IBIOSSettings *this_, PRBool PXEDebugEnabled);
+
+};
+
+struct IBIOSSettings
+{
+    struct IBIOSSettings_vtbl *vtbl;
+};
+/* End of struct IBIOSSettings Declaration */
+
+
+/* Start of struct IMachine Declaration */
+#define IMACHINE_IID_STR "dcf6a64c-1466-4b5a-b822-9db04133dc74"
+#define IMACHINE_IID { \
+    0xdcf6a64c, 0x1466, 0x4b5a, \
+    { 0xb8, 0x22, 0x9d, 0xb0, 0x41, 0x33, 0xdc, 0x74 } \
+}
+struct IMachine_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetParent)(IMachine *this_, IVirtualBox * *parent);
+
+    nsresult (*GetAccessible)(IMachine *this_, PRBool *accessible);
+
+    nsresult (*GetAccessError)(IMachine *this_, IVirtualBoxErrorInfo * *accessError);
+
+    nsresult (*GetName)(IMachine *this_, PRUnichar * *name);
+    nsresult (*SetName)(IMachine *this_, PRUnichar * name);
+
+    nsresult (*GetDescription)(IMachine *this_, PRUnichar * *description);
+    nsresult (*SetDescription)(IMachine *this_, PRUnichar * description);
+
+    nsresult (*GetId)(IMachine *this_, nsID * *id);
+
+    nsresult (*GetOSTypeId)(IMachine *this_, PRUnichar * *OSTypeId);
+    nsresult (*SetOSTypeId)(IMachine *this_, PRUnichar * OSTypeId);
+
+    nsresult (*GetHardwareVersion)(IMachine *this_, PRUnichar * *HardwareVersion);
+    nsresult (*SetHardwareVersion)(IMachine *this_, PRUnichar * HardwareVersion);
+
+    nsresult (*GetCPUCount)(IMachine *this_, PRUint32 *CPUCount);
+    nsresult (*SetCPUCount)(IMachine *this_, PRUint32 CPUCount);
+
+    nsresult (*GetMemorySize)(IMachine *this_, PRUint32 *memorySize);
+    nsresult (*SetMemorySize)(IMachine *this_, PRUint32 memorySize);
+
+    nsresult (*GetMemoryBalloonSize)(IMachine *this_, PRUint32 *memoryBalloonSize);
+    nsresult (*SetMemoryBalloonSize)(IMachine *this_, PRUint32 memoryBalloonSize);
+
+    nsresult (*GetStatisticsUpdateInterval)(IMachine *this_, PRUint32 *statisticsUpdateInterval);
+    nsresult (*SetStatisticsUpdateInterval)(IMachine *this_, PRUint32 statisticsUpdateInterval);
+
+    nsresult (*GetVRAMSize)(IMachine *this_, PRUint32 *VRAMSize);
+    nsresult (*SetVRAMSize)(IMachine *this_, PRUint32 VRAMSize);
+
+    nsresult (*GetAccelerate3DEnabled)(IMachine *this_, PRBool *accelerate3DEnabled);
+    nsresult (*SetAccelerate3DEnabled)(IMachine *this_, PRBool accelerate3DEnabled);
+
+    nsresult (*GetMonitorCount)(IMachine *this_, PRUint32 *monitorCount);
+    nsresult (*SetMonitorCount)(IMachine *this_, PRUint32 monitorCount);
+
+    nsresult (*GetBIOSSettings)(IMachine *this_, IBIOSSettings * *BIOSSettings);
+
+    nsresult (*GetHWVirtExEnabled)(IMachine *this_, PRUint32 *HWVirtExEnabled);
+    nsresult (*SetHWVirtExEnabled)(IMachine *this_, PRUint32 HWVirtExEnabled);
+
+    nsresult (*GetHWVirtExNestedPagingEnabled)(IMachine *this_, PRBool *HWVirtExNestedPagingEnabled);
+    nsresult (*SetHWVirtExNestedPagingEnabled)(IMachine *this_, PRBool HWVirtExNestedPagingEnabled);
+
+    nsresult (*GetHWVirtExVPIDEnabled)(IMachine *this_, PRBool *HWVirtExVPIDEnabled);
+    nsresult (*SetHWVirtExVPIDEnabled)(IMachine *this_, PRBool HWVirtExVPIDEnabled);
+
+    nsresult (*GetPAEEnabled)(IMachine *this_, PRBool *PAEEnabled);
+    nsresult (*SetPAEEnabled)(IMachine *this_, PRBool PAEEnabled);
+
+    nsresult (*GetSnapshotFolder)(IMachine *this_, PRUnichar * *snapshotFolder);
+    nsresult (*SetSnapshotFolder)(IMachine *this_, PRUnichar * snapshotFolder);
+
+    nsresult (*GetVRDPServer)(IMachine *this_, IVRDPServer * *VRDPServer);
+
+    nsresult (*GetHardDiskAttachments)(IMachine *this_, PRUint32 *hardDiskAttachmentsSize, IHardDiskAttachment * **hardDiskAttachments);
+
+    nsresult (*GetDVDDrive)(IMachine *this_, IDVDDrive * *DVDDrive);
+
+    nsresult (*GetFloppyDrive)(IMachine *this_, IFloppyDrive * *floppyDrive);
+
+    nsresult (*GetUSBController)(IMachine *this_, IUSBController * *USBController);
+
+    nsresult (*GetAudioAdapter)(IMachine *this_, IAudioAdapter * *audioAdapter);
+
+    nsresult (*GetStorageControllers)(IMachine *this_, PRUint32 *storageControllersSize, IStorageController * **storageControllers);
+
+    nsresult (*GetSettingsFilePath)(IMachine *this_, PRUnichar * *settingsFilePath);
+
+    nsresult (*GetSettingsFileVersion)(IMachine *this_, PRUnichar * *settingsFileVersion);
+
+    nsresult (*GetSettingsModified)(IMachine *this_, PRBool *settingsModified);
+
+    nsresult (*GetSessionState)(IMachine *this_, PRUint32 *sessionState);
+
+    nsresult (*GetSessionType)(IMachine *this_, PRUnichar * *sessionType);
+
+    nsresult (*GetSessionPid)(IMachine *this_, PRUint32 *sessionPid);
+
+    nsresult (*GetState)(IMachine *this_, PRUint32 *state);
+
+    nsresult (*GetLastStateChange)(IMachine *this_, PRInt64 *lastStateChange);
+
+    nsresult (*GetStateFilePath)(IMachine *this_, PRUnichar * *stateFilePath);
+
+    nsresult (*GetLogFolder)(IMachine *this_, PRUnichar * *logFolder);
+
+    nsresult (*GetCurrentSnapshot)(IMachine *this_, ISnapshot * *currentSnapshot);
+
+    nsresult (*GetSnapshotCount)(IMachine *this_, PRUint32 *snapshotCount);
+
+    nsresult (*GetCurrentStateModified)(IMachine *this_, PRBool *currentStateModified);
+
+    nsresult (*GetSharedFolders)(IMachine *this_, PRUint32 *sharedFoldersSize, ISharedFolder * **sharedFolders);
+
+    nsresult (*GetClipboardMode)(IMachine *this_, PRUint32 *clipboardMode);
+    nsresult (*SetClipboardMode)(IMachine *this_, PRUint32 clipboardMode);
+
+    nsresult (*GetGuestPropertyNotificationPatterns)(IMachine *this_, PRUnichar * *guestPropertyNotificationPatterns);
+    nsresult (*SetGuestPropertyNotificationPatterns)(IMachine *this_, PRUnichar * guestPropertyNotificationPatterns);
+
+    nsresult (*SetBootOrder)(
+        IMachine *this_,
+        PRUint32 position,
+        PRUint32 device
+    );
+
+    nsresult (*GetBootOrder)(
+        IMachine *this_,
+        PRUint32 position,
+        PRUint32 * device
+    );
+
+    nsresult (*AttachHardDisk)(
+        IMachine *this_,
+        const nsID * id,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device
+    );
+
+    nsresult (*GetHardDisk)(
+        IMachine *this_,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        IHardDisk * * hardDisk
+    );
+
+    nsresult (*DetachHardDisk)(
+        IMachine *this_,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device
+    );
+
+    nsresult (*GetHardDiskAttachmentsOfController)(
+        IMachine *this_,
+        PRUnichar * name,
+        PRUint32 *hardDiskAttachmentsSize,
+        IHardDiskAttachment *** hardDiskAttachments
+    );
+
+    nsresult (*GetNetworkAdapter)(
+        IMachine *this_,
+        PRUint32 slot,
+        INetworkAdapter * * adapter
+    );
+
+    nsresult (*AddStorageController)(
+        IMachine *this_,
+        PRUnichar * name,
+        PRUint32 connectionType,
+        IStorageController * * controller
+    );
+
+    nsresult (*GetStorageControllerByName)(
+        IMachine *this_,
+        PRUnichar * name,
+        IStorageController * * storageController
+    );
+
+    nsresult (*RemoveStorageController)(
+        IMachine *this_,
+        PRUnichar * name
+    );
+
+    nsresult (*GetSerialPort)(
+        IMachine *this_,
+        PRUint32 slot,
+        ISerialPort * * port
+    );
+
+    nsresult (*GetParallelPort)(
+        IMachine *this_,
+        PRUint32 slot,
+        IParallelPort * * port
+    );
+
+    nsresult (*GetNextExtraDataKey)(
+        IMachine *this_,
+        PRUnichar * key,
+        PRUnichar * * nextKey,
+        PRUnichar * * nextValue
+    );
+
+    nsresult (*GetExtraData)(
+        IMachine *this_,
+        PRUnichar * key,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetExtraData)(
+        IMachine *this_,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*SaveSettings)(IMachine *this_ );
+
+    nsresult (*SaveSettingsWithBackup)(
+        IMachine *this_,
+        PRUnichar * * bakFileName
+    );
+
+    nsresult (*DiscardSettings)(IMachine *this_ );
+
+    nsresult (*DeleteSettings)(IMachine *this_ );
+
+    nsresult (*Export)(
+        IMachine *this_,
+        IAppliance * appliance
+    );
+
+    nsresult (*GetSnapshot)(
+        IMachine *this_,
+        const nsID * id,
+        ISnapshot * * snapshot
+    );
+
+    nsresult (*FindSnapshot)(
+        IMachine *this_,
+        PRUnichar * name,
+        ISnapshot * * snapshot
+    );
+
+    nsresult (*SetCurrentSnapshot)(
+        IMachine *this_,
+        const nsID * id
+    );
+
+    nsresult (*CreateSharedFolder)(
+        IMachine *this_,
+        PRUnichar * name,
+        PRUnichar * hostPath,
+        PRBool writable
+    );
+
+    nsresult (*RemoveSharedFolder)(
+        IMachine *this_,
+        PRUnichar * name
+    );
+
+    nsresult (*CanShowConsoleWindow)(
+        IMachine *this_,
+        PRBool * canShow
+    );
+
+    nsresult (*ShowConsoleWindow)(
+        IMachine *this_,
+        PRUint64 * winId
+    );
+
+    nsresult (*GetGuestProperty)(
+        IMachine *this_,
+        PRUnichar * name,
+        PRUnichar * * value,
+        PRUint64 * timestamp,
+        PRUnichar * * flags
+    );
+
+    nsresult (*GetGuestPropertyValue)(
+        IMachine *this_,
+        PRUnichar * property,
+        PRUnichar * * value
+    );
+
+    nsresult (*GetGuestPropertyTimestamp)(
+        IMachine *this_,
+        PRUnichar * property,
+        PRUint64 * value
+    );
+
+    nsresult (*SetGuestProperty)(
+        IMachine *this_,
+        PRUnichar * property,
+        PRUnichar * value,
+        PRUnichar * flags
+    );
+
+    nsresult (*SetGuestPropertyValue)(
+        IMachine *this_,
+        PRUnichar * property,
+        PRUnichar * value
+    );
+
+    nsresult (*EnumerateGuestProperties)(
+        IMachine *this_,
+        PRUnichar * patterns,
+        PRUint32 *nameSize,
+        PRUnichar *** name,
+        PRUint32 *valueSize,
+        PRUnichar *** value,
+        PRUint32 *timestampSize,
+        PRUint64* timestamp,
+        PRUint32 *flagsSize,
+        PRUnichar *** flags
+    );
+
+};
+
+struct IMachine
+{
+    struct IMachine_vtbl *vtbl;
+};
+/* End of struct IMachine Declaration */
+
+
+/* Start of struct IConsoleCallback Declaration */
+#define ICONSOLECALLBACK_IID_STR "13dfbef3-b74d-487d-bada-2304529aefa6"
+#define ICONSOLECALLBACK_IID { \
+    0x13dfbef3, 0xb74d, 0x487d, \
+    { 0xba, 0xda, 0x23, 0x04, 0x52, 0x9a, 0xef, 0xa6 } \
+}
+struct IConsoleCallback_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*OnMousePointerShapeChange)(
+        IConsoleCallback *this_,
+        PRBool visible,
+        PRBool alpha,
+        PRUint32 xHot,
+        PRUint32 yHot,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint8 * shape
+    );
+
+    nsresult (*OnMouseCapabilityChange)(
+        IConsoleCallback *this_,
+        PRBool supportsAbsolute,
+        PRBool needsHostCursor
+    );
+
+    nsresult (*OnKeyboardLedsChange)(
+        IConsoleCallback *this_,
+        PRBool numLock,
+        PRBool capsLock,
+        PRBool scrollLock
+    );
+
+    nsresult (*OnStateChange)(
+        IConsoleCallback *this_,
+        PRUint32 state
+    );
+
+    nsresult (*OnAdditionsStateChange)(IConsoleCallback *this_ );
+
+    nsresult (*OnDVDDriveChange)(IConsoleCallback *this_ );
+
+    nsresult (*OnFloppyDriveChange)(IConsoleCallback *this_ );
+
+    nsresult (*OnNetworkAdapterChange)(
+        IConsoleCallback *this_,
+        INetworkAdapter * networkAdapter
+    );
+
+    nsresult (*OnSerialPortChange)(
+        IConsoleCallback *this_,
+        ISerialPort * serialPort
+    );
+
+    nsresult (*OnParallelPortChange)(
+        IConsoleCallback *this_,
+        IParallelPort * parallelPort
+    );
+
+    nsresult (*OnStorageControllerChange)(IConsoleCallback *this_ );
+
+    nsresult (*OnVRDPServerChange)(IConsoleCallback *this_ );
+
+    nsresult (*OnUSBControllerChange)(IConsoleCallback *this_ );
+
+    nsresult (*OnUSBDeviceStateChange)(
+        IConsoleCallback *this_,
+        IUSBDevice * device,
+        PRBool attached,
+        IVirtualBoxErrorInfo * error
+    );
+
+    nsresult (*OnSharedFolderChange)(
+        IConsoleCallback *this_,
+        PRUint32 scope
+    );
+
+    nsresult (*OnRuntimeError)(
+        IConsoleCallback *this_,
+        PRBool fatal,
+        PRUnichar * id,
+        PRUnichar * message
+    );
+
+    nsresult (*OnCanShowWindow)(
+        IConsoleCallback *this_,
+        PRBool * canShow
+    );
+
+    nsresult (*OnShowWindow)(
+        IConsoleCallback *this_,
+        PRUint64 * winId
+    );
+
+};
+
+struct IConsoleCallback
+{
+    struct IConsoleCallback_vtbl *vtbl;
+};
+/* End of struct IConsoleCallback Declaration */
+
+
+/* Start of struct IRemoteDisplayInfo Declaration */
+#define IREMOTEDISPLAYINFO_IID_STR "550104cd-2dfd-4a6c-857d-f6f8e088e62c"
+#define IREMOTEDISPLAYINFO_IID { \
+    0x550104cd, 0x2dfd, 0x4a6c, \
+    { 0x85, 0x7d, 0xf6, 0xf8, 0xe0, 0x88, 0xe6, 0x2c } \
+}
+struct IRemoteDisplayInfo_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetActive)(IRemoteDisplayInfo *this_, PRBool *active);
+
+    nsresult (*GetNumberOfClients)(IRemoteDisplayInfo *this_, PRUint32 *numberOfClients);
+
+    nsresult (*GetBeginTime)(IRemoteDisplayInfo *this_, PRInt64 *beginTime);
+
+    nsresult (*GetEndTime)(IRemoteDisplayInfo *this_, PRInt64 *endTime);
+
+    nsresult (*GetBytesSent)(IRemoteDisplayInfo *this_, PRUint64 *bytesSent);
+
+    nsresult (*GetBytesSentTotal)(IRemoteDisplayInfo *this_, PRUint64 *bytesSentTotal);
+
+    nsresult (*GetBytesReceived)(IRemoteDisplayInfo *this_, PRUint64 *bytesReceived);
+
+    nsresult (*GetBytesReceivedTotal)(IRemoteDisplayInfo *this_, PRUint64 *bytesReceivedTotal);
+
+    nsresult (*GetUser)(IRemoteDisplayInfo *this_, PRUnichar * *user);
+
+    nsresult (*GetDomain)(IRemoteDisplayInfo *this_, PRUnichar * *domain);
+
+    nsresult (*GetClientName)(IRemoteDisplayInfo *this_, PRUnichar * *clientName);
+
+    nsresult (*GetClientIP)(IRemoteDisplayInfo *this_, PRUnichar * *clientIP);
+
+    nsresult (*GetClientVersion)(IRemoteDisplayInfo *this_, PRUint32 *clientVersion);
+
+    nsresult (*GetEncryptionStyle)(IRemoteDisplayInfo *this_, PRUint32 *encryptionStyle);
+
+};
+
+struct IRemoteDisplayInfo
+{
+    struct IRemoteDisplayInfo_vtbl *vtbl;
+};
+/* End of struct IRemoteDisplayInfo Declaration */
+
+
+/* Start of struct IConsole Declaration */
+#define ICONSOLE_IID_STR "9511bc54-15ee-4ddf-808e-472aba03809c"
+#define ICONSOLE_IID { \
+    0x9511bc54, 0x15ee, 0x4ddf, \
+    { 0x80, 0x8e, 0x47, 0x2a, 0xba, 0x03, 0x80, 0x9c } \
+}
+struct IConsole_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetMachine)(IConsole *this_, IMachine * *machine);
+
+    nsresult (*GetState)(IConsole *this_, PRUint32 *state);
+
+    nsresult (*GetGuest)(IConsole *this_, IGuest * *guest);
+
+    nsresult (*GetKeyboard)(IConsole *this_, IKeyboard * *keyboard);
+
+    nsresult (*GetMouse)(IConsole *this_, IMouse * *mouse);
+
+    nsresult (*GetDisplay)(IConsole *this_, IDisplay * *display);
+
+    nsresult (*GetDebugger)(IConsole *this_, IMachineDebugger * *debugger);
+
+    nsresult (*GetUSBDevices)(IConsole *this_, PRUint32 *USBDevicesSize, IUSBDevice * **USBDevices);
+
+    nsresult (*GetRemoteUSBDevices)(IConsole *this_, PRUint32 *remoteUSBDevicesSize, IHostUSBDevice * **remoteUSBDevices);
+
+    nsresult (*GetSharedFolders)(IConsole *this_, PRUint32 *sharedFoldersSize, ISharedFolder * **sharedFolders);
+
+    nsresult (*GetRemoteDisplayInfo)(IConsole *this_, IRemoteDisplayInfo * *remoteDisplayInfo);
+
+    nsresult (*PowerUp)(
+        IConsole *this_,
+        IProgress * * progress
+    );
+
+    nsresult (*PowerUpPaused)(
+        IConsole *this_,
+        IProgress * * progress
+    );
+
+    nsresult (*PowerDown)(IConsole *this_ );
+
+    nsresult (*PowerDownAsync)(
+        IConsole *this_,
+        IProgress * * progress
+    );
+
+    nsresult (*Reset)(IConsole *this_ );
+
+    nsresult (*Pause)(IConsole *this_ );
+
+    nsresult (*Resume)(IConsole *this_ );
+
+    nsresult (*PowerButton)(IConsole *this_ );
+
+    nsresult (*SleepButton)(IConsole *this_ );
+
+    nsresult (*GetPowerButtonHandled)(
+        IConsole *this_,
+        PRBool * handled
+    );
+
+    nsresult (*GetGuestEnteredACPIMode)(
+        IConsole *this_,
+        PRBool * entered
+    );
+
+    nsresult (*SaveState)(
+        IConsole *this_,
+        IProgress * * progress
+    );
+
+    nsresult (*AdoptSavedState)(
+        IConsole *this_,
+        PRUnichar * savedStateFile
+    );
+
+    nsresult (*DiscardSavedState)(IConsole *this_ );
+
+    nsresult (*GetDeviceActivity)(
+        IConsole *this_,
+        PRUint32 type,
+        PRUint32 * activity
+    );
+
+    nsresult (*AttachUSBDevice)(
+        IConsole *this_,
+        const nsID * id
+    );
+
+    nsresult (*DetachUSBDevice)(
+        IConsole *this_,
+        const nsID * id,
+        IUSBDevice * * device
+    );
+
+    nsresult (*FindUSBDeviceByAddress)(
+        IConsole *this_,
+        PRUnichar * name,
+        IUSBDevice * * device
+    );
+
+    nsresult (*FindUSBDeviceById)(
+        IConsole *this_,
+        const nsID * id,
+        IUSBDevice * * device
+    );
+
+    nsresult (*CreateSharedFolder)(
+        IConsole *this_,
+        PRUnichar * name,
+        PRUnichar * hostPath,
+        PRBool writable
+    );
+
+    nsresult (*RemoveSharedFolder)(
+        IConsole *this_,
+        PRUnichar * name
+    );
+
+    nsresult (*TakeSnapshot)(
+        IConsole *this_,
+        PRUnichar * name,
+        PRUnichar * description,
+        IProgress * * progress
+    );
+
+    nsresult (*DiscardSnapshot)(
+        IConsole *this_,
+        const nsID * id,
+        IProgress * * progress
+    );
+
+    nsresult (*DiscardCurrentState)(
+        IConsole *this_,
+        IProgress * * progress
+    );
+
+    nsresult (*DiscardCurrentSnapshotAndState)(
+        IConsole *this_,
+        IProgress * * progress
+    );
+
+    nsresult (*RegisterCallback)(
+        IConsole *this_,
+        IConsoleCallback * callback
+    );
+
+    nsresult (*UnregisterCallback)(
+        IConsole *this_,
+        IConsoleCallback * callback
+    );
+
+};
+
+struct IConsole
+{
+    struct IConsole_vtbl *vtbl;
+};
+/* End of struct IConsole Declaration */
+
+
+/* Start of struct IHostDVDDrive Declaration */
+#define IHOSTDVDDRIVE_IID_STR "21f86694-202d-4ce4-8b05-a63ff82dbf4c"
+#define IHOSTDVDDRIVE_IID { \
+    0x21f86694, 0x202d, 0x4ce4, \
+    { 0x8b, 0x05, 0xa6, 0x3f, 0xf8, 0x2d, 0xbf, 0x4c } \
+}
+struct IHostDVDDrive_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IHostDVDDrive *this_, PRUnichar * *name);
+
+    nsresult (*GetDescription)(IHostDVDDrive *this_, PRUnichar * *description);
+
+    nsresult (*GetUdi)(IHostDVDDrive *this_, PRUnichar * *udi);
+
+};
+
+struct IHostDVDDrive
+{
+    struct IHostDVDDrive_vtbl *vtbl;
+};
+/* End of struct IHostDVDDrive Declaration */
+
+
+/* Start of struct IHostFloppyDrive Declaration */
+#define IHOSTFLOPPYDRIVE_IID_STR "3f02d604-e908-4919-9fd1-8a4afd68fc63"
+#define IHOSTFLOPPYDRIVE_IID { \
+    0x3f02d604, 0xe908, 0x4919, \
+    { 0x9f, 0xd1, 0x8a, 0x4a, 0xfd, 0x68, 0xfc, 0x63 } \
+}
+struct IHostFloppyDrive_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IHostFloppyDrive *this_, PRUnichar * *name);
+
+    nsresult (*GetDescription)(IHostFloppyDrive *this_, PRUnichar * *description);
+
+    nsresult (*GetUdi)(IHostFloppyDrive *this_, PRUnichar * *udi);
+
+};
+
+struct IHostFloppyDrive
+{
+    struct IHostFloppyDrive_vtbl *vtbl;
+};
+/* End of struct IHostFloppyDrive Declaration */
+
+
+/* Start of struct IHostNetworkInterface Declaration */
+#define IHOSTNETWORKINTERFACE_IID_STR "88adaf3f-166b-4542-9457-0f1323507fae"
+#define IHOSTNETWORKINTERFACE_IID { \
+    0x88adaf3f, 0x166b, 0x4542, \
+    { 0x94, 0x57, 0x0f, 0x13, 0x23, 0x50, 0x7f, 0xae } \
+}
+struct IHostNetworkInterface_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IHostNetworkInterface *this_, PRUnichar * *name);
+
+    nsresult (*GetId)(IHostNetworkInterface *this_, nsID * *id);
+
+    nsresult (*GetNetworkName)(IHostNetworkInterface *this_, PRUnichar * *networkName);
+
+    nsresult (*GetDhcpEnabled)(IHostNetworkInterface *this_, PRBool *dhcpEnabled);
+
+    nsresult (*GetIPAddress)(IHostNetworkInterface *this_, PRUnichar * *IPAddress);
+
+    nsresult (*GetNetworkMask)(IHostNetworkInterface *this_, PRUnichar * *networkMask);
+
+    nsresult (*GetIPV6Supported)(IHostNetworkInterface *this_, PRBool *IPV6Supported);
+
+    nsresult (*GetIPV6Address)(IHostNetworkInterface *this_, PRUnichar * *IPV6Address);
+
+    nsresult (*GetIPV6NetworkMaskPrefixLength)(IHostNetworkInterface *this_, PRUint32 *IPV6NetworkMaskPrefixLength);
+
+    nsresult (*GetHardwareAddress)(IHostNetworkInterface *this_, PRUnichar * *hardwareAddress);
+
+    nsresult (*GetMediumType)(IHostNetworkInterface *this_, PRUint32 *mediumType);
+
+    nsresult (*GetStatus)(IHostNetworkInterface *this_, PRUint32 *status);
+
+    nsresult (*GetInterfaceType)(IHostNetworkInterface *this_, PRUint32 *interfaceType);
+
+    nsresult (*EnableStaticIpConfig)(
+        IHostNetworkInterface *this_,
+        PRUnichar * IPAddress,
+        PRUnichar * networkMask
+    );
+
+    nsresult (*EnableStaticIpConfigV6)(
+        IHostNetworkInterface *this_,
+        PRUnichar * IPV6Address,
+        PRUint32 IPV6NetworkMaskPrefixLength
+    );
+
+    nsresult (*EnableDynamicIpConfig)(IHostNetworkInterface *this_ );
+
+    nsresult (*DhcpRediscover)(IHostNetworkInterface *this_ );
+
+};
+
+struct IHostNetworkInterface
+{
+    struct IHostNetworkInterface_vtbl *vtbl;
+};
+/* End of struct IHostNetworkInterface Declaration */
+
+
+/* Start of struct IHost Declaration */
+#define IHOST_IID_STR "926469ca-9091-42ef-928e-582d78b66c70"
+#define IHOST_IID { \
+    0x926469ca, 0x9091, 0x42ef, \
+    { 0x92, 0x8e, 0x58, 0x2d, 0x78, 0xb6, 0x6c, 0x70 } \
+}
+struct IHost_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetDVDDrives)(IHost *this_, PRUint32 *DVDDrivesSize, IHostDVDDrive * **DVDDrives);
+
+    nsresult (*GetFloppyDrives)(IHost *this_, PRUint32 *floppyDrivesSize, IHostFloppyDrive * **floppyDrives);
+
+    nsresult (*GetUSBDevices)(IHost *this_, PRUint32 *USBDevicesSize, IHostUSBDevice * **USBDevices);
+
+    nsresult (*GetUSBDeviceFilters)(IHost *this_, PRUint32 *USBDeviceFiltersSize, IHostUSBDeviceFilter * **USBDeviceFilters);
+
+    nsresult (*GetNetworkInterfaces)(IHost *this_, PRUint32 *networkInterfacesSize, IHostNetworkInterface * **networkInterfaces);
+
+    nsresult (*GetProcessorCount)(IHost *this_, PRUint32 *processorCount);
+
+    nsresult (*GetProcessorOnlineCount)(IHost *this_, PRUint32 *processorOnlineCount);
+
+    nsresult (*GetMemorySize)(IHost *this_, PRUint32 *memorySize);
+
+    nsresult (*GetMemoryAvailable)(IHost *this_, PRUint32 *memoryAvailable);
+
+    nsresult (*GetOperatingSystem)(IHost *this_, PRUnichar * *operatingSystem);
+
+    nsresult (*GetOSVersion)(IHost *this_, PRUnichar * *OSVersion);
+
+    nsresult (*GetUTCTime)(IHost *this_, PRInt64 *UTCTime);
+
+    nsresult (*GetProcessorSpeed)(
+        IHost *this_,
+        PRUint32 cpuId,
+        PRUint32 * speed
+    );
+
+    nsresult (*GetProcessorFeature)(
+        IHost *this_,
+        PRUint32 feature,
+        PRBool * supported
+    );
+
+    nsresult (*GetProcessorDescription)(
+        IHost *this_,
+        PRUint32 cpuId,
+        PRUnichar * * description
+    );
+
+    nsresult (*CreateUSBDeviceFilter)(
+        IHost *this_,
+        PRUnichar * name,
+        IHostUSBDeviceFilter * * filter
+    );
+
+    nsresult (*InsertUSBDeviceFilter)(
+        IHost *this_,
+        PRUint32 position,
+        IHostUSBDeviceFilter * filter
+    );
+
+    nsresult (*RemoveUSBDeviceFilter)(
+        IHost *this_,
+        PRUint32 position,
+        IHostUSBDeviceFilter * * filter
+    );
+
+    nsresult (*FindHostDVDDrive)(
+        IHost *this_,
+        PRUnichar * name,
+        IHostDVDDrive * * drive
+    );
+
+    nsresult (*FindHostFloppyDrive)(
+        IHost *this_,
+        PRUnichar * name,
+        IHostFloppyDrive * * drive
+    );
+
+    nsresult (*FindHostNetworkInterfaceByName)(
+        IHost *this_,
+        PRUnichar * name,
+        IHostNetworkInterface * * networkInterface
+    );
+
+    nsresult (*FindHostNetworkInterfaceById)(
+        IHost *this_,
+        const nsID * id,
+        IHostNetworkInterface * * networkInterface
+    );
+
+    nsresult (*FindHostNetworkInterfacesOfType)(
+        IHost *this_,
+        PRUint32 type,
+        PRUint32 *networkInterfacesSize,
+        IHostNetworkInterface *** networkInterfaces
+    );
+
+    nsresult (*FindUSBDeviceById)(
+        IHost *this_,
+        const nsID * id,
+        IHostUSBDevice * * device
+    );
+
+    nsresult (*FindUSBDeviceByAddress)(
+        IHost *this_,
+        PRUnichar * name,
+        IHostUSBDevice * * device
+    );
+
+};
+
+struct IHost
+{
+    struct IHost_vtbl *vtbl;
+};
+/* End of struct IHost Declaration */
+
+
+/* Start of struct ISystemProperties Declaration */
+#define ISYSTEMPROPERTIES_IID_STR "0760e03f-06d0-481e-9f81-be43fef092ba"
+#define ISYSTEMPROPERTIES_IID { \
+    0x0760e03f, 0x06d0, 0x481e, \
+    { 0x9f, 0x81, 0xbe, 0x43, 0xfe, 0xf0, 0x92, 0xba } \
+}
+struct ISystemProperties_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetMinGuestRAM)(ISystemProperties *this_, PRUint32 *minGuestRAM);
+
+    nsresult (*GetMaxGuestRAM)(ISystemProperties *this_, PRUint32 *maxGuestRAM);
+
+    nsresult (*GetMinGuestVRAM)(ISystemProperties *this_, PRUint32 *minGuestVRAM);
+
+    nsresult (*GetMaxGuestVRAM)(ISystemProperties *this_, PRUint32 *maxGuestVRAM);
+
+    nsresult (*GetMinGuestCPUCount)(ISystemProperties *this_, PRUint32 *minGuestCPUCount);
+
+    nsresult (*GetMaxGuestCPUCount)(ISystemProperties *this_, PRUint32 *maxGuestCPUCount);
+
+    nsresult (*GetMaxVDISize)(ISystemProperties *this_, PRUint64 *maxVDISize);
+
+    nsresult (*GetNetworkAdapterCount)(ISystemProperties *this_, PRUint32 *networkAdapterCount);
+
+    nsresult (*GetSerialPortCount)(ISystemProperties *this_, PRUint32 *serialPortCount);
+
+    nsresult (*GetParallelPortCount)(ISystemProperties *this_, PRUint32 *parallelPortCount);
+
+    nsresult (*GetMaxBootPosition)(ISystemProperties *this_, PRUint32 *maxBootPosition);
+
+    nsresult (*GetDefaultMachineFolder)(ISystemProperties *this_, PRUnichar * *defaultMachineFolder);
+    nsresult (*SetDefaultMachineFolder)(ISystemProperties *this_, PRUnichar * defaultMachineFolder);
+
+    nsresult (*GetDefaultHardDiskFolder)(ISystemProperties *this_, PRUnichar * *defaultHardDiskFolder);
+    nsresult (*SetDefaultHardDiskFolder)(ISystemProperties *this_, PRUnichar * defaultHardDiskFolder);
+
+    nsresult (*GetHardDiskFormats)(ISystemProperties *this_, PRUint32 *hardDiskFormatsSize, IHardDiskFormat * **hardDiskFormats);
+
+    nsresult (*GetDefaultHardDiskFormat)(ISystemProperties *this_, PRUnichar * *defaultHardDiskFormat);
+    nsresult (*SetDefaultHardDiskFormat)(ISystemProperties *this_, PRUnichar * defaultHardDiskFormat);
+
+    nsresult (*GetRemoteDisplayAuthLibrary)(ISystemProperties *this_, PRUnichar * *remoteDisplayAuthLibrary);
+    nsresult (*SetRemoteDisplayAuthLibrary)(ISystemProperties *this_, PRUnichar * remoteDisplayAuthLibrary);
+
+    nsresult (*GetWebServiceAuthLibrary)(ISystemProperties *this_, PRUnichar * *webServiceAuthLibrary);
+    nsresult (*SetWebServiceAuthLibrary)(ISystemProperties *this_, PRUnichar * webServiceAuthLibrary);
+
+    nsresult (*GetHWVirtExEnabled)(ISystemProperties *this_, PRBool *HWVirtExEnabled);
+    nsresult (*SetHWVirtExEnabled)(ISystemProperties *this_, PRBool HWVirtExEnabled);
+
+    nsresult (*GetLogHistoryCount)(ISystemProperties *this_, PRUint32 *LogHistoryCount);
+    nsresult (*SetLogHistoryCount)(ISystemProperties *this_, PRUint32 LogHistoryCount);
+
+};
+
+struct ISystemProperties
+{
+    struct ISystemProperties_vtbl *vtbl;
+};
+/* End of struct ISystemProperties Declaration */
+
+
+/* Start of struct IGuestOSType Declaration */
+#define IGUESTOSTYPE_IID_STR "cfe9e64c-4430-435b-9e7c-e3d8e417bd58"
+#define IGUESTOSTYPE_IID { \
+    0xcfe9e64c, 0x4430, 0x435b, \
+    { 0x9e, 0x7c, 0xe3, 0xd8, 0xe4, 0x17, 0xbd, 0x58 } \
+}
+struct IGuestOSType_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetFamilyId)(IGuestOSType *this_, PRUnichar * *familyId);
+
+    nsresult (*GetFamilyDescription)(IGuestOSType *this_, PRUnichar * *familyDescription);
+
+    nsresult (*GetId)(IGuestOSType *this_, PRUnichar * *id);
+
+    nsresult (*GetDescription)(IGuestOSType *this_, PRUnichar * *description);
+
+    nsresult (*GetIs64Bit)(IGuestOSType *this_, PRBool *is64Bit);
+
+    nsresult (*GetRecommendedIOAPIC)(IGuestOSType *this_, PRBool *recommendedIOAPIC);
+
+    nsresult (*GetRecommendedVirtEx)(IGuestOSType *this_, PRBool *recommendedVirtEx);
+
+    nsresult (*GetRecommendedRAM)(IGuestOSType *this_, PRUint32 *recommendedRAM);
+
+    nsresult (*GetRecommendedVRAM)(IGuestOSType *this_, PRUint32 *recommendedVRAM);
+
+    nsresult (*GetRecommendedHDD)(IGuestOSType *this_, PRUint32 *recommendedHDD);
+
+    nsresult (*GetAdapterType)(IGuestOSType *this_, PRUint32 *adapterType);
+
+};
+
+struct IGuestOSType
+{
+    struct IGuestOSType_vtbl *vtbl;
+};
+/* End of struct IGuestOSType Declaration */
+
+
+/* Start of struct IGuest Declaration */
+#define IGUEST_IID_STR "d8556fca-81bc-12af-fca3-365528fa38ca"
+#define IGUEST_IID { \
+    0xd8556fca, 0x81bc, 0x12af, \
+    { 0xfc, 0xa3, 0x36, 0x55, 0x28, 0xfa, 0x38, 0xca } \
+}
+struct IGuest_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetOSTypeId)(IGuest *this_, PRUnichar * *OSTypeId);
+
+    nsresult (*GetAdditionsActive)(IGuest *this_, PRBool *additionsActive);
+
+    nsresult (*GetAdditionsVersion)(IGuest *this_, PRUnichar * *additionsVersion);
+
+    nsresult (*GetSupportsSeamless)(IGuest *this_, PRBool *supportsSeamless);
+
+    nsresult (*GetSupportsGraphics)(IGuest *this_, PRBool *supportsGraphics);
+
+    nsresult (*GetMemoryBalloonSize)(IGuest *this_, PRUint32 *memoryBalloonSize);
+    nsresult (*SetMemoryBalloonSize)(IGuest *this_, PRUint32 memoryBalloonSize);
+
+    nsresult (*GetStatisticsUpdateInterval)(IGuest *this_, PRUint32 *statisticsUpdateInterval);
+    nsresult (*SetStatisticsUpdateInterval)(IGuest *this_, PRUint32 statisticsUpdateInterval);
+
+    nsresult (*SetCredentials)(
+        IGuest *this_,
+        PRUnichar * userName,
+        PRUnichar * password,
+        PRUnichar * domain,
+        PRBool allowInteractiveLogon
+    );
+
+    nsresult (*GetStatistic)(
+        IGuest *this_,
+        PRUint32 cpuId,
+        PRUint32 statistic,
+        PRUint32 * statVal
+    );
+
+};
+
+struct IGuest
+{
+    struct IGuest_vtbl *vtbl;
+};
+/* End of struct IGuest Declaration */
+
+
+/* Start of struct IProgress Declaration */
+#define IPROGRESS_IID_STR "d3aa5417-6103-41fc-9e54-01ee1d08f42f"
+#define IPROGRESS_IID { \
+    0xd3aa5417, 0x6103, 0x41fc, \
+    { 0x9e, 0x54, 0x01, 0xee, 0x1d, 0x08, 0xf4, 0x2f } \
+}
+struct IProgress_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetId)(IProgress *this_, nsID * *id);
+
+    nsresult (*GetDescription)(IProgress *this_, PRUnichar * *description);
+
+    nsresult (*GetInitiator)(IProgress *this_, nsISupports * *initiator);
+
+    nsresult (*GetCancelable)(IProgress *this_, PRBool *cancelable);
+
+    nsresult (*GetPercent)(IProgress *this_, PRInt32 *percent);
+
+    nsresult (*GetCompleted)(IProgress *this_, PRBool *completed);
+
+    nsresult (*GetCanceled)(IProgress *this_, PRBool *canceled);
+
+    nsresult (*GetResultCode)(IProgress *this_, nsresult *resultCode);
+
+    nsresult (*GetErrorInfo)(IProgress *this_, IVirtualBoxErrorInfo * *errorInfo);
+
+    nsresult (*GetOperationCount)(IProgress *this_, PRUint32 *operationCount);
+
+    nsresult (*GetOperation)(IProgress *this_, PRUint32 *operation);
+
+    nsresult (*GetOperationDescription)(IProgress *this_, PRUnichar * *operationDescription);
+
+    nsresult (*GetOperationPercent)(IProgress *this_, PRInt32 *operationPercent);
+
+    nsresult (*WaitForCompletion)(
+        IProgress *this_,
+        PRInt32 timeout
+    );
+
+    nsresult (*WaitForOperationCompletion)(
+        IProgress *this_,
+        PRUint32 operation,
+        PRInt32 timeout
+    );
+
+    nsresult (*Cancel)(IProgress *this_ );
+
+};
+
+struct IProgress
+{
+    struct IProgress_vtbl *vtbl;
+};
+/* End of struct IProgress Declaration */
+
+
+/* Start of struct ISnapshot Declaration */
+#define ISNAPSHOT_IID_STR "5db6b1d9-c76b-4424-a6f4-8257f642d6ea"
+#define ISNAPSHOT_IID { \
+    0x5db6b1d9, 0xc76b, 0x4424, \
+    { 0xa6, 0xf4, 0x82, 0x57, 0xf6, 0x42, 0xd6, 0xea } \
+}
+struct ISnapshot_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetId)(ISnapshot *this_, nsID * *id);
+
+    nsresult (*GetName)(ISnapshot *this_, PRUnichar * *name);
+    nsresult (*SetName)(ISnapshot *this_, PRUnichar * name);
+
+    nsresult (*GetDescription)(ISnapshot *this_, PRUnichar * *description);
+    nsresult (*SetDescription)(ISnapshot *this_, PRUnichar * description);
+
+    nsresult (*GetTimeStamp)(ISnapshot *this_, PRInt64 *timeStamp);
+
+    nsresult (*GetOnline)(ISnapshot *this_, PRBool *online);
+
+    nsresult (*GetMachine)(ISnapshot *this_, IMachine * *machine);
+
+    nsresult (*GetParent)(ISnapshot *this_, ISnapshot * *parent);
+
+    nsresult (*GetChildren)(ISnapshot *this_, PRUint32 *childrenSize, ISnapshot * **children);
+
+};
+
+struct ISnapshot
+{
+    struct ISnapshot_vtbl *vtbl;
+};
+/* End of struct ISnapshot Declaration */
+
+
+/* Start of struct IMedium Declaration */
+#define IMEDIUM_IID_STR "a7fb3bfb-c180-4274-bae4-7fbc89046e13"
+#define IMEDIUM_IID { \
+    0xa7fb3bfb, 0xc180, 0x4274, \
+    { 0xba, 0xe4, 0x7f, 0xbc, 0x89, 0x04, 0x6e, 0x13 } \
+}
+struct IMedium_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetId)(IMedium *this_, nsID * *id);
+
+    nsresult (*GetDescription)(IMedium *this_, PRUnichar * *description);
+    nsresult (*SetDescription)(IMedium *this_, PRUnichar * description);
+
+    nsresult (*GetState)(IMedium *this_, PRUint32 *state);
+
+    nsresult (*GetLocation)(IMedium *this_, PRUnichar * *location);
+    nsresult (*SetLocation)(IMedium *this_, PRUnichar * location);
+
+    nsresult (*GetName)(IMedium *this_, PRUnichar * *name);
+
+    nsresult (*GetSize)(IMedium *this_, PRUint64 *size);
+
+    nsresult (*GetLastAccessError)(IMedium *this_, PRUnichar * *lastAccessError);
+
+    nsresult (*GetMachineIds)(IMedium *this_, PRUint32 *machineIdsSize, nsID * **machineIds);
+
+    nsresult (*GetSnapshotIds)(
+        IMedium *this_,
+        const nsID * machineId,
+        PRUint32 *snapshotIdsSize,
+        nsID *** snapshotIds
+    );
+
+    nsresult (*LockRead)(
+        IMedium *this_,
+        PRUint32 * state
+    );
+
+    nsresult (*UnlockRead)(
+        IMedium *this_,
+        PRUint32 * state
+    );
+
+    nsresult (*LockWrite)(
+        IMedium *this_,
+        PRUint32 * state
+    );
+
+    nsresult (*UnlockWrite)(
+        IMedium *this_,
+        PRUint32 * state
+    );
+
+    nsresult (*Close)(IMedium *this_ );
+
+};
+
+struct IMedium
+{
+    struct IMedium_vtbl *vtbl;
+};
+/* End of struct IMedium Declaration */
+
+
+/* Start of struct IHardDiskAttachment Declaration */
+#define IHARDDISKATTACHMENT_IID_STR "b1dd04bb-93c0-4ad3-a9cf-82316e595836"
+#define IHARDDISKATTACHMENT_IID { \
+    0xb1dd04bb, 0x93c0, 0x4ad3, \
+    { 0xa9, 0xcf, 0x82, 0x31, 0x6e, 0x59, 0x58, 0x36 } \
+}
+struct IHardDiskAttachment_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetHardDisk)(IHardDiskAttachment *this_, IHardDisk * *hardDisk);
+
+    nsresult (*GetController)(IHardDiskAttachment *this_, PRUnichar * *controller);
+
+    nsresult (*GetPort)(IHardDiskAttachment *this_, PRInt32 *port);
+
+    nsresult (*GetDevice)(IHardDiskAttachment *this_, PRInt32 *device);
+
+};
+
+struct IHardDiskAttachment
+{
+    struct IHardDiskAttachment_vtbl *vtbl;
+};
+/* End of struct IHardDiskAttachment Declaration */
+
+
+/* Start of struct IHardDisk Declaration */
+#define IHARDDISK_IID_STR "3498d065-dee6-48bf-bcc5-47018fee4f42"
+#define IHARDDISK_IID { \
+    0x3498d065, 0xdee6, 0x48bf, \
+    { 0xbc, 0xc5, 0x47, 0x01, 0x8f, 0xee, 0x4f, 0x42 } \
+}
+struct IHardDisk_vtbl
+{
+    struct IMedium_vtbl imedium;
+
+    nsresult (*GetFormat)(IHardDisk *this_, PRUnichar * *format);
+
+    nsresult (*GetType)(IHardDisk *this_, PRUint32 *type);
+    nsresult (*SetType)(IHardDisk *this_, PRUint32 type);
+
+    nsresult (*GetParent)(IHardDisk *this_, IHardDisk * *parent);
+
+    nsresult (*GetChildren)(IHardDisk *this_, PRUint32 *childrenSize, IHardDisk * **children);
+
+    nsresult (*GetRoot)(IHardDisk *this_, IHardDisk * *root);
+
+    nsresult (*GetReadOnly)(IHardDisk *this_, PRBool *readOnly);
+
+    nsresult (*GetLogicalSize)(IHardDisk *this_, PRUint64 *logicalSize);
+
+    nsresult (*GetAutoReset)(IHardDisk *this_, PRBool *autoReset);
+    nsresult (*SetAutoReset)(IHardDisk *this_, PRBool autoReset);
+
+    nsresult (*GetProperty)(
+        IHardDisk *this_,
+        PRUnichar * name,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetProperty)(
+        IHardDisk *this_,
+        PRUnichar * name,
+        PRUnichar * value
+    );
+
+    nsresult (*GetProperties)(
+        IHardDisk *this_,
+        PRUnichar * names,
+        PRUint32 *returnNamesSize,
+        PRUnichar *** returnNames,
+        PRUint32 *returnValuesSize,
+        PRUnichar *** returnValues
+    );
+
+    nsresult (*SetProperties)(
+        IHardDisk *this_,
+        PRUint32 namesSize,
+        PRUnichar ** names,
+        PRUint32 valuesSize,
+        PRUnichar ** values
+    );
+
+    nsresult (*CreateBaseStorage)(
+        IHardDisk *this_,
+        PRUint64 logicalSize,
+        PRUint32 variant,
+        IProgress * * progress
+    );
+
+    nsresult (*DeleteStorage)(
+        IHardDisk *this_,
+        IProgress * * progress
+    );
+
+    nsresult (*CreateDiffStorage)(
+        IHardDisk *this_,
+        IHardDisk * target,
+        PRUint32 variant,
+        IProgress * * progress
+    );
+
+    nsresult (*MergeTo)(
+        IHardDisk *this_,
+        const nsID * targetId,
+        IProgress * * progress
+    );
+
+    nsresult (*CloneTo)(
+        IHardDisk *this_,
+        IHardDisk * target,
+        PRUint32 variant,
+        IProgress * * progress
+    );
+
+    nsresult (*FlattenTo)(
+        IHardDisk *this_,
+        IHardDisk * target,
+        PRUint32 variant,
+        IProgress * * progress
+    );
+
+    nsresult (*Compact)(
+        IHardDisk *this_,
+        IProgress * * progress
+    );
+
+    nsresult (*Reset)(
+        IHardDisk *this_,
+        IProgress * * progress
+    );
+
+};
+
+struct IHardDisk
+{
+    struct IHardDisk_vtbl *vtbl;
+};
+/* End of struct IHardDisk Declaration */
+
+
+/* Start of struct IHardDiskFormat Declaration */
+#define IHARDDISKFORMAT_IID_STR "7f3ba790-3a0b-4a8a-bac2-bb50150123c5"
+#define IHARDDISKFORMAT_IID { \
+    0x7f3ba790, 0x3a0b, 0x4a8a, \
+    { 0xba, 0xc2, 0xbb, 0x50, 0x15, 0x01, 0x23, 0xc5 } \
+}
+struct IHardDiskFormat_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetId)(IHardDiskFormat *this_, PRUnichar * *id);
+
+    nsresult (*GetName)(IHardDiskFormat *this_, PRUnichar * *name);
+
+    nsresult (*GetFileExtensions)(IHardDiskFormat *this_, PRUint32 *fileExtensionsSize, PRUnichar * **fileExtensions);
+
+    nsresult (*GetCapabilities)(IHardDiskFormat *this_, PRUint32 *capabilities);
+
+    nsresult (*DescribeProperties)(
+        IHardDiskFormat *this_,
+        PRUint32 *namesSize,
+        PRUnichar *** names,
+        PRUint32 *descriptionSize,
+        PRUnichar *** description,
+        PRUint32 *typesSize,
+        PRUint32* types,
+        PRUint32 *flagsSize,
+        PRUint32* flags,
+        PRUint32 *defaultsSize,
+        PRUnichar *** defaults
+    );
+
+};
+
+struct IHardDiskFormat
+{
+    struct IHardDiskFormat_vtbl *vtbl;
+};
+/* End of struct IHardDiskFormat Declaration */
+
+
+/* Start of struct IFloppyImage Declaration */
+#define IFLOPPYIMAGE_IID_STR "faa6101f-078c-4b3a-ab75-75670c8170b3"
+#define IFLOPPYIMAGE_IID { \
+    0xfaa6101f, 0x078c, 0x4b3a, \
+    { 0xab, 0x75, 0x75, 0x67, 0x0c, 0x81, 0x70, 0xb3 } \
+}
+struct IFloppyImage_vtbl
+{
+    struct IMedium_vtbl imedium;
+
+};
+
+struct IFloppyImage
+{
+    struct IFloppyImage_vtbl *vtbl;
+};
+/* End of struct IFloppyImage Declaration */
+
+
+/* Start of struct IDVDImage Declaration */
+#define IDVDIMAGE_IID_STR "b1f90bbb-e8a9-4484-9af1-3638e943f763"
+#define IDVDIMAGE_IID { \
+    0xb1f90bbb, 0xe8a9, 0x4484, \
+    { 0x9a, 0xf1, 0x36, 0x38, 0xe9, 0x43, 0xf7, 0x63 } \
+}
+struct IDVDImage_vtbl
+{
+    struct IMedium_vtbl imedium;
+
+};
+
+struct IDVDImage
+{
+    struct IDVDImage_vtbl *vtbl;
+};
+/* End of struct IDVDImage Declaration */
+
+
+/* Start of struct IDVDDrive Declaration */
+#define IDVDDRIVE_IID_STR "d650ef30-be9b-4dae-b463-11d5824681a5"
+#define IDVDDRIVE_IID { \
+    0xd650ef30, 0xbe9b, 0x4dae, \
+    { 0xb4, 0x63, 0x11, 0xd5, 0x82, 0x46, 0x81, 0xa5 } \
+}
+struct IDVDDrive_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetState)(IDVDDrive *this_, PRUint32 *state);
+
+    nsresult (*GetPassthrough)(IDVDDrive *this_, PRBool *passthrough);
+    nsresult (*SetPassthrough)(IDVDDrive *this_, PRBool passthrough);
+
+    nsresult (*MountImage)(
+        IDVDDrive *this_,
+        const nsID * imageId
+    );
+
+    nsresult (*CaptureHostDrive)(
+        IDVDDrive *this_,
+        IHostDVDDrive * drive
+    );
+
+    nsresult (*Unmount)(IDVDDrive *this_ );
+
+    nsresult (*GetImage)(
+        IDVDDrive *this_,
+        IDVDImage * * image
+    );
+
+    nsresult (*GetHostDrive)(
+        IDVDDrive *this_,
+        IHostDVDDrive * * drive
+    );
+
+};
+
+struct IDVDDrive
+{
+    struct IDVDDrive_vtbl *vtbl;
+};
+/* End of struct IDVDDrive Declaration */
+
+
+/* Start of struct IFloppyDrive Declaration */
+#define IFLOPPYDRIVE_IID_STR "159412cd-bab8-452e-8097-218a020825a6"
+#define IFLOPPYDRIVE_IID { \
+    0x159412cd, 0xbab8, 0x452e, \
+    { 0x80, 0x97, 0x21, 0x8a, 0x02, 0x08, 0x25, 0xa6 } \
+}
+struct IFloppyDrive_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetEnabled)(IFloppyDrive *this_, PRBool *enabled);
+    nsresult (*SetEnabled)(IFloppyDrive *this_, PRBool enabled);
+
+    nsresult (*GetState)(IFloppyDrive *this_, PRUint32 *state);
+
+    nsresult (*MountImage)(
+        IFloppyDrive *this_,
+        const nsID * imageId
+    );
+
+    nsresult (*CaptureHostDrive)(
+        IFloppyDrive *this_,
+        IHostFloppyDrive * drive
+    );
+
+    nsresult (*Unmount)(IFloppyDrive *this_ );
+
+    nsresult (*GetImage)(
+        IFloppyDrive *this_,
+        IFloppyImage * * image
+    );
+
+    nsresult (*GetHostDrive)(
+        IFloppyDrive *this_,
+        IHostFloppyDrive * * drive
+    );
+
+};
+
+struct IFloppyDrive
+{
+    struct IFloppyDrive_vtbl *vtbl;
+};
+/* End of struct IFloppyDrive Declaration */
+
+
+/* Start of struct IKeyboard Declaration */
+#define IKEYBOARD_IID_STR "2d1a531b-4c6e-49cc-8af6-5c857b78b5d7"
+#define IKEYBOARD_IID { \
+    0x2d1a531b, 0x4c6e, 0x49cc, \
+    { 0x8a, 0xf6, 0x5c, 0x85, 0x7b, 0x78, 0xb5, 0xd7 } \
+}
+struct IKeyboard_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*PutScancode)(
+        IKeyboard *this_,
+        PRInt32 scancode
+    );
+
+    nsresult (*PutScancodes)(
+        IKeyboard *this_,
+        PRUint32 scancodesSize,
+        PRInt32* scancodes,
+        PRUint32 * codesStored
+    );
+
+    nsresult (*PutCAD)(IKeyboard *this_ );
+
+};
+
+struct IKeyboard
+{
+    struct IKeyboard_vtbl *vtbl;
+};
+/* End of struct IKeyboard Declaration */
+
+
+/* Start of struct IMouse Declaration */
+#define IMOUSE_IID_STR "FD443EC1-0006-4F5B-9282-D72760A66916"
+#define IMOUSE_IID { \
+    0xFD443EC1, 0x0006, 0x4F5B, \
+    { 0x92, 0x82, 0xD7, 0x27, 0x60, 0xA6, 0x69, 0x16 } \
+}
+struct IMouse_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetAbsoluteSupported)(IMouse *this_, PRBool *absoluteSupported);
+
+    nsresult (*PutMouseEvent)(
+        IMouse *this_,
+        PRInt32 dx,
+        PRInt32 dy,
+        PRInt32 dz,
+        PRInt32 buttonState
+    );
+
+    nsresult (*PutMouseEventAbsolute)(
+        IMouse *this_,
+        PRInt32 x,
+        PRInt32 y,
+        PRInt32 dz,
+        PRInt32 buttonState
+    );
+
+};
+
+struct IMouse
+{
+    struct IMouse_vtbl *vtbl;
+};
+/* End of struct IMouse Declaration */
+
+
+/* Start of struct IFramebuffer Declaration */
+#define IFRAMEBUFFER_IID_STR "af431304-5b09-40e2-94da-3c3cb03822c1"
+#define IFRAMEBUFFER_IID { \
+    0xaf431304, 0x5b09, 0x40e2, \
+    { 0x94, 0xda, 0x3c, 0x3c, 0xb0, 0x38, 0x22, 0xc1 } \
+}
+struct IFramebuffer_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetAddress)(IFramebuffer *this_, PRUint8 * *address);
+
+    nsresult (*GetWidth)(IFramebuffer *this_, PRUint32 *width);
+
+    nsresult (*GetHeight)(IFramebuffer *this_, PRUint32 *height);
+
+    nsresult (*GetBitsPerPixel)(IFramebuffer *this_, PRUint32 *bitsPerPixel);
+
+    nsresult (*GetBytesPerLine)(IFramebuffer *this_, PRUint32 *bytesPerLine);
+
+    nsresult (*GetPixelFormat)(IFramebuffer *this_, PRUint32 *pixelFormat);
+
+    nsresult (*GetUsesGuestVRAM)(IFramebuffer *this_, PRBool *usesGuestVRAM);
+
+    nsresult (*GetHeightReduction)(IFramebuffer *this_, PRUint32 *heightReduction);
+
+    nsresult (*GetOverlay)(IFramebuffer *this_, IFramebufferOverlay * *overlay);
+
+    nsresult (*GetWinId)(IFramebuffer *this_, PRUint64 *winId);
+
+    nsresult (*Lock)(IFramebuffer *this_ );
+
+    nsresult (*Unlock)(IFramebuffer *this_ );
+
+    nsresult (*NotifyUpdate)(
+        IFramebuffer *this_,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 width,
+        PRUint32 height,
+        PRBool * finished
+    );
+
+    nsresult (*RequestResize)(
+        IFramebuffer *this_,
+        PRUint32 screenId,
+        PRUint32 pixelFormat,
+        PRUint8 * VRAM,
+        PRUint32 bitsPerPixel,
+        PRUint32 bytesPerLine,
+        PRUint32 width,
+        PRUint32 height,
+        PRBool * finished
+    );
+
+    nsresult (*OperationSupported)(
+        IFramebuffer *this_,
+        PRUint32 operation,
+        PRBool * supported
+    );
+
+    nsresult (*VideoModeSupported)(
+        IFramebuffer *this_,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 bpp,
+        PRBool * supported
+    );
+
+    nsresult (*SolidFill)(
+        IFramebuffer *this_,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 color,
+        PRBool * handled
+    );
+
+    nsresult (*CopyScreenBits)(
+        IFramebuffer *this_,
+        PRUint32 xDst,
+        PRUint32 yDst,
+        PRUint32 xSrc,
+        PRUint32 ySrc,
+        PRUint32 width,
+        PRUint32 height,
+        PRBool * handled
+    );
+
+    nsresult (*GetVisibleRegion)(
+        IFramebuffer *this_,
+        PRUint8 * rectangles,
+        PRUint32 count,
+        PRUint32 * countCopied
+    );
+
+    nsresult (*SetVisibleRegion)(
+        IFramebuffer *this_,
+        PRUint8 * rectangles,
+        PRUint32 count
+    );
+
+};
+
+struct IFramebuffer
+{
+    struct IFramebuffer_vtbl *vtbl;
+};
+/* End of struct IFramebuffer Declaration */
+
+
+/* Start of struct IFramebufferOverlay Declaration */
+#define IFRAMEBUFFEROVERLAY_IID_STR "0bcc1c7e-e415-47d2-bfdb-e4c705fb0f47"
+#define IFRAMEBUFFEROVERLAY_IID { \
+    0x0bcc1c7e, 0xe415, 0x47d2, \
+    { 0xbf, 0xdb, 0xe4, 0xc7, 0x05, 0xfb, 0x0f, 0x47 } \
+}
+struct IFramebufferOverlay_vtbl
+{
+    struct IFramebuffer_vtbl iframebuffer;
+
+    nsresult (*GetX)(IFramebufferOverlay *this_, PRUint32 *x);
+
+    nsresult (*GetY)(IFramebufferOverlay *this_, PRUint32 *y);
+
+    nsresult (*GetVisible)(IFramebufferOverlay *this_, PRBool *visible);
+    nsresult (*SetVisible)(IFramebufferOverlay *this_, PRBool visible);
+
+    nsresult (*GetAlpha)(IFramebufferOverlay *this_, PRUint32 *alpha);
+    nsresult (*SetAlpha)(IFramebufferOverlay *this_, PRUint32 alpha);
+
+    nsresult (*Move)(
+        IFramebufferOverlay *this_,
+        PRUint32 x,
+        PRUint32 y
+    );
+
+};
+
+struct IFramebufferOverlay
+{
+    struct IFramebufferOverlay_vtbl *vtbl;
+};
+/* End of struct IFramebufferOverlay Declaration */
+
+
+/* Start of struct IDisplay Declaration */
+#define IDISPLAY_IID_STR "09789f63-4525-48e5-a5e4-1080453b0eab"
+#define IDISPLAY_IID { \
+    0x09789f63, 0x4525, 0x48e5, \
+    { 0xa5, 0xe4, 0x10, 0x80, 0x45, 0x3b, 0x0e, 0xab } \
+}
+struct IDisplay_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetWidth)(IDisplay *this_, PRUint32 *width);
+
+    nsresult (*GetHeight)(IDisplay *this_, PRUint32 *height);
+
+    nsresult (*GetBitsPerPixel)(IDisplay *this_, PRUint32 *bitsPerPixel);
+
+    nsresult (*SetupInternalFramebuffer)(
+        IDisplay *this_,
+        PRUint32 depth
+    );
+
+    nsresult (*LockFramebuffer)(
+        IDisplay *this_,
+        PRUint8 * * address
+    );
+
+    nsresult (*UnlockFramebuffer)(IDisplay *this_ );
+
+    nsresult (*RegisterExternalFramebuffer)(
+        IDisplay *this_,
+        IFramebuffer * framebuffer
+    );
+
+    nsresult (*SetFramebuffer)(
+        IDisplay *this_,
+        PRUint32 screenId,
+        IFramebuffer * framebuffer
+    );
+
+    nsresult (*GetFramebuffer)(
+        IDisplay *this_,
+        PRUint32 screenId,
+        IFramebuffer * * framebuffer,
+        PRInt32 * xOrigin,
+        PRInt32 * yOrigin
+    );
+
+    nsresult (*SetVideoModeHint)(
+        IDisplay *this_,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 bitsPerPixel,
+        PRUint32 display
+    );
+
+    nsresult (*SetSeamlessMode)(
+        IDisplay *this_,
+        PRBool enabled
+    );
+
+    nsresult (*TakeScreenShot)(
+        IDisplay *this_,
+        PRUint8 * address,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+    nsresult (*DrawToScreen)(
+        IDisplay *this_,
+        PRUint8 * address,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+    nsresult (*InvalidateAndUpdate)(IDisplay *this_ );
+
+    nsresult (*ResizeCompleted)(
+        IDisplay *this_,
+        PRUint32 screenId
+    );
+
+    nsresult (*UpdateCompleted)(IDisplay *this_ );
+
+};
+
+struct IDisplay
+{
+    struct IDisplay_vtbl *vtbl;
+};
+/* End of struct IDisplay Declaration */
+
+
+/* Start of struct INetworkAdapter Declaration */
+#define INETWORKADAPTER_IID_STR "65607a27-2b73-4d43-b4cc-0ba2c817fbde"
+#define INETWORKADAPTER_IID { \
+    0x65607a27, 0x2b73, 0x4d43, \
+    { 0xb4, 0xcc, 0x0b, 0xa2, 0xc8, 0x17, 0xfb, 0xde } \
+}
+struct INetworkAdapter_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetAdapterType)(INetworkAdapter *this_, PRUint32 *adapterType);
+    nsresult (*SetAdapterType)(INetworkAdapter *this_, PRUint32 adapterType);
+
+    nsresult (*GetSlot)(INetworkAdapter *this_, PRUint32 *slot);
+
+    nsresult (*GetEnabled)(INetworkAdapter *this_, PRBool *enabled);
+    nsresult (*SetEnabled)(INetworkAdapter *this_, PRBool enabled);
+
+    nsresult (*GetMACAddress)(INetworkAdapter *this_, PRUnichar * *MACAddress);
+    nsresult (*SetMACAddress)(INetworkAdapter *this_, PRUnichar * MACAddress);
+
+    nsresult (*GetAttachmentType)(INetworkAdapter *this_, PRUint32 *attachmentType);
+
+    nsresult (*GetHostInterface)(INetworkAdapter *this_, PRUnichar * *hostInterface);
+    nsresult (*SetHostInterface)(INetworkAdapter *this_, PRUnichar * hostInterface);
+
+    nsresult (*GetInternalNetwork)(INetworkAdapter *this_, PRUnichar * *internalNetwork);
+    nsresult (*SetInternalNetwork)(INetworkAdapter *this_, PRUnichar * internalNetwork);
+
+    nsresult (*GetNATNetwork)(INetworkAdapter *this_, PRUnichar * *NATNetwork);
+    nsresult (*SetNATNetwork)(INetworkAdapter *this_, PRUnichar * NATNetwork);
+
+    nsresult (*GetCableConnected)(INetworkAdapter *this_, PRBool *cableConnected);
+    nsresult (*SetCableConnected)(INetworkAdapter *this_, PRBool cableConnected);
+
+    nsresult (*GetLineSpeed)(INetworkAdapter *this_, PRUint32 *lineSpeed);
+    nsresult (*SetLineSpeed)(INetworkAdapter *this_, PRUint32 lineSpeed);
+
+    nsresult (*GetTraceEnabled)(INetworkAdapter *this_, PRBool *traceEnabled);
+    nsresult (*SetTraceEnabled)(INetworkAdapter *this_, PRBool traceEnabled);
+
+    nsresult (*GetTraceFile)(INetworkAdapter *this_, PRUnichar * *traceFile);
+    nsresult (*SetTraceFile)(INetworkAdapter *this_, PRUnichar * traceFile);
+
+    nsresult (*AttachToNAT)(INetworkAdapter *this_ );
+
+    nsresult (*AttachToBridgedInterface)(INetworkAdapter *this_ );
+
+    nsresult (*AttachToInternalNetwork)(INetworkAdapter *this_ );
+
+    nsresult (*AttachToHostOnlyInterface)(INetworkAdapter *this_ );
+
+    nsresult (*Detach)(INetworkAdapter *this_ );
+
+};
+
+struct INetworkAdapter
+{
+    struct INetworkAdapter_vtbl *vtbl;
+};
+/* End of struct INetworkAdapter Declaration */
+
+
+/* Start of struct ISerialPort Declaration */
+#define ISERIALPORT_IID_STR "937f6970-5103-4745-b78e-d28dcf1479a8"
+#define ISERIALPORT_IID { \
+    0x937f6970, 0x5103, 0x4745, \
+    { 0xb7, 0x8e, 0xd2, 0x8d, 0xcf, 0x14, 0x79, 0xa8 } \
+}
+struct ISerialPort_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetSlot)(ISerialPort *this_, PRUint32 *slot);
+
+    nsresult (*GetEnabled)(ISerialPort *this_, PRBool *enabled);
+    nsresult (*SetEnabled)(ISerialPort *this_, PRBool enabled);
+
+    nsresult (*GetIOBase)(ISerialPort *this_, PRUint32 *IOBase);
+    nsresult (*SetIOBase)(ISerialPort *this_, PRUint32 IOBase);
+
+    nsresult (*GetIRQ)(ISerialPort *this_, PRUint32 *IRQ);
+    nsresult (*SetIRQ)(ISerialPort *this_, PRUint32 IRQ);
+
+    nsresult (*GetHostMode)(ISerialPort *this_, PRUint32 *hostMode);
+    nsresult (*SetHostMode)(ISerialPort *this_, PRUint32 hostMode);
+
+    nsresult (*GetServer)(ISerialPort *this_, PRBool *server);
+    nsresult (*SetServer)(ISerialPort *this_, PRBool server);
+
+    nsresult (*GetPath)(ISerialPort *this_, PRUnichar * *path);
+    nsresult (*SetPath)(ISerialPort *this_, PRUnichar * path);
+
+};
+
+struct ISerialPort
+{
+    struct ISerialPort_vtbl *vtbl;
+};
+/* End of struct ISerialPort Declaration */
+
+
+/* Start of struct IParallelPort Declaration */
+#define IPARALLELPORT_IID_STR "0c925f06-dd10-4b77-8de8-294d738c3214"
+#define IPARALLELPORT_IID { \
+    0x0c925f06, 0xdd10, 0x4b77, \
+    { 0x8d, 0xe8, 0x29, 0x4d, 0x73, 0x8c, 0x32, 0x14 } \
+}
+struct IParallelPort_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetSlot)(IParallelPort *this_, PRUint32 *slot);
+
+    nsresult (*GetEnabled)(IParallelPort *this_, PRBool *enabled);
+    nsresult (*SetEnabled)(IParallelPort *this_, PRBool enabled);
+
+    nsresult (*GetIOBase)(IParallelPort *this_, PRUint32 *IOBase);
+    nsresult (*SetIOBase)(IParallelPort *this_, PRUint32 IOBase);
+
+    nsresult (*GetIRQ)(IParallelPort *this_, PRUint32 *IRQ);
+    nsresult (*SetIRQ)(IParallelPort *this_, PRUint32 IRQ);
+
+    nsresult (*GetPath)(IParallelPort *this_, PRUnichar * *path);
+    nsresult (*SetPath)(IParallelPort *this_, PRUnichar * path);
+
+};
+
+struct IParallelPort
+{
+    struct IParallelPort_vtbl *vtbl;
+};
+/* End of struct IParallelPort Declaration */
+
+
+/* Start of struct IMachineDebugger Declaration */
+#define IMACHINEDEBUGGER_IID_STR "b0b2a2dd-0627-4502-91c2-ddc5e77609e0"
+#define IMACHINEDEBUGGER_IID { \
+    0xb0b2a2dd, 0x0627, 0x4502, \
+    { 0x91, 0xc2, 0xdd, 0xc5, 0xe7, 0x76, 0x09, 0xe0 } \
+}
+struct IMachineDebugger_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetSinglestep)(IMachineDebugger *this_, PRBool *singlestep);
+    nsresult (*SetSinglestep)(IMachineDebugger *this_, PRBool singlestep);
+
+    nsresult (*GetRecompileUser)(IMachineDebugger *this_, PRBool *recompileUser);
+    nsresult (*SetRecompileUser)(IMachineDebugger *this_, PRBool recompileUser);
+
+    nsresult (*GetRecompileSupervisor)(IMachineDebugger *this_, PRBool *recompileSupervisor);
+    nsresult (*SetRecompileSupervisor)(IMachineDebugger *this_, PRBool recompileSupervisor);
+
+    nsresult (*GetPATMEnabled)(IMachineDebugger *this_, PRBool *PATMEnabled);
+    nsresult (*SetPATMEnabled)(IMachineDebugger *this_, PRBool PATMEnabled);
+
+    nsresult (*GetCSAMEnabled)(IMachineDebugger *this_, PRBool *CSAMEnabled);
+    nsresult (*SetCSAMEnabled)(IMachineDebugger *this_, PRBool CSAMEnabled);
+
+    nsresult (*GetLogEnabled)(IMachineDebugger *this_, PRBool *logEnabled);
+    nsresult (*SetLogEnabled)(IMachineDebugger *this_, PRBool logEnabled);
+
+    nsresult (*GetHWVirtExEnabled)(IMachineDebugger *this_, PRBool *HWVirtExEnabled);
+
+    nsresult (*GetHWVirtExNestedPagingEnabled)(IMachineDebugger *this_, PRBool *HWVirtExNestedPagingEnabled);
+
+    nsresult (*GetHWVirtExVPIDEnabled)(IMachineDebugger *this_, PRBool *HWVirtExVPIDEnabled);
+
+    nsresult (*GetPAEEnabled)(IMachineDebugger *this_, PRBool *PAEEnabled);
+
+    nsresult (*GetVirtualTimeRate)(IMachineDebugger *this_, PRUint32 *virtualTimeRate);
+    nsresult (*SetVirtualTimeRate)(IMachineDebugger *this_, PRUint32 virtualTimeRate);
+
+    nsresult (*GetVM)(IMachineDebugger *this_, PRUint64 *VM);
+
+    nsresult (*ResetStats)(
+        IMachineDebugger *this_,
+        PRUnichar * pattern
+    );
+
+    nsresult (*DumpStats)(
+        IMachineDebugger *this_,
+        PRUnichar * pattern
+    );
+
+    nsresult (*GetStats)(
+        IMachineDebugger *this_,
+        PRUnichar * pattern,
+        PRBool withDescriptions,
+        PRUnichar * * stats
+    );
+
+    nsresult (*InjectNMI)(IMachineDebugger *this_ );
+
+};
+
+struct IMachineDebugger
+{
+    struct IMachineDebugger_vtbl *vtbl;
+};
+/* End of struct IMachineDebugger Declaration */
+
+
+/* Start of struct IUSBController Declaration */
+#define IUSBCONTROLLER_IID_STR "238540fa-4b73-435a-a38e-4e1d9eab5c17"
+#define IUSBCONTROLLER_IID { \
+    0x238540fa, 0x4b73, 0x435a, \
+    { 0xa3, 0x8e, 0x4e, 0x1d, 0x9e, 0xab, 0x5c, 0x17 } \
+}
+struct IUSBController_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetEnabled)(IUSBController *this_, PRBool *enabled);
+    nsresult (*SetEnabled)(IUSBController *this_, PRBool enabled);
+
+    nsresult (*GetEnabledEhci)(IUSBController *this_, PRBool *enabledEhci);
+    nsresult (*SetEnabledEhci)(IUSBController *this_, PRBool enabledEhci);
+
+    nsresult (*GetUSBStandard)(IUSBController *this_, PRUint16 *USBStandard);
+
+    nsresult (*GetDeviceFilters)(IUSBController *this_, PRUint32 *deviceFiltersSize, IUSBDeviceFilter * **deviceFilters);
+
+    nsresult (*CreateDeviceFilter)(
+        IUSBController *this_,
+        PRUnichar * name,
+        IUSBDeviceFilter * * filter
+    );
+
+    nsresult (*InsertDeviceFilter)(
+        IUSBController *this_,
+        PRUint32 position,
+        IUSBDeviceFilter * filter
+    );
+
+    nsresult (*RemoveDeviceFilter)(
+        IUSBController *this_,
+        PRUint32 position,
+        IUSBDeviceFilter * * filter
+    );
+
+};
+
+struct IUSBController
+{
+    struct IUSBController_vtbl *vtbl;
+};
+/* End of struct IUSBController Declaration */
+
+
+/* Start of struct IUSBDevice Declaration */
+#define IUSBDEVICE_IID_STR "850af07b-9ee8-48c2-b6b0-f6d0acbf63c3"
+#define IUSBDEVICE_IID { \
+    0x850af07b, 0x9ee8, 0x48c2, \
+    { 0xb6, 0xb0, 0xf6, 0xd0, 0xac, 0xbf, 0x63, 0xc3 } \
+}
+struct IUSBDevice_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetId)(IUSBDevice *this_, nsID * *id);
+
+    nsresult (*GetVendorId)(IUSBDevice *this_, PRUint16 *vendorId);
+
+    nsresult (*GetProductId)(IUSBDevice *this_, PRUint16 *productId);
+
+    nsresult (*GetRevision)(IUSBDevice *this_, PRUint16 *revision);
+
+    nsresult (*GetManufacturer)(IUSBDevice *this_, PRUnichar * *manufacturer);
+
+    nsresult (*GetProduct)(IUSBDevice *this_, PRUnichar * *product);
+
+    nsresult (*GetSerialNumber)(IUSBDevice *this_, PRUnichar * *serialNumber);
+
+    nsresult (*GetAddress)(IUSBDevice *this_, PRUnichar * *address);
+
+    nsresult (*GetPort)(IUSBDevice *this_, PRUint16 *port);
+
+    nsresult (*GetVersion)(IUSBDevice *this_, PRUint16 *version);
+
+    nsresult (*GetPortVersion)(IUSBDevice *this_, PRUint16 *portVersion);
+
+    nsresult (*GetRemote)(IUSBDevice *this_, PRBool *remote);
+
+};
+
+struct IUSBDevice
+{
+    struct IUSBDevice_vtbl *vtbl;
+};
+/* End of struct IUSBDevice Declaration */
+
+
+/* Start of struct IUSBDeviceFilter Declaration */
+#define IUSBDEVICEFILTER_IID_STR "d6831fb4-1a94-4c2c-96ef-8d0d6192066d"
+#define IUSBDEVICEFILTER_IID { \
+    0xd6831fb4, 0x1a94, 0x4c2c, \
+    { 0x96, 0xef, 0x8d, 0x0d, 0x61, 0x92, 0x06, 0x6d } \
+}
+struct IUSBDeviceFilter_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IUSBDeviceFilter *this_, PRUnichar * *name);
+    nsresult (*SetName)(IUSBDeviceFilter *this_, PRUnichar * name);
+
+    nsresult (*GetActive)(IUSBDeviceFilter *this_, PRBool *active);
+    nsresult (*SetActive)(IUSBDeviceFilter *this_, PRBool active);
+
+    nsresult (*GetVendorId)(IUSBDeviceFilter *this_, PRUnichar * *vendorId);
+    nsresult (*SetVendorId)(IUSBDeviceFilter *this_, PRUnichar * vendorId);
+
+    nsresult (*GetProductId)(IUSBDeviceFilter *this_, PRUnichar * *productId);
+    nsresult (*SetProductId)(IUSBDeviceFilter *this_, PRUnichar * productId);
+
+    nsresult (*GetRevision)(IUSBDeviceFilter *this_, PRUnichar * *revision);
+    nsresult (*SetRevision)(IUSBDeviceFilter *this_, PRUnichar * revision);
+
+    nsresult (*GetManufacturer)(IUSBDeviceFilter *this_, PRUnichar * *manufacturer);
+    nsresult (*SetManufacturer)(IUSBDeviceFilter *this_, PRUnichar * manufacturer);
+
+    nsresult (*GetProduct)(IUSBDeviceFilter *this_, PRUnichar * *product);
+    nsresult (*SetProduct)(IUSBDeviceFilter *this_, PRUnichar * product);
+
+    nsresult (*GetSerialNumber)(IUSBDeviceFilter *this_, PRUnichar * *serialNumber);
+    nsresult (*SetSerialNumber)(IUSBDeviceFilter *this_, PRUnichar * serialNumber);
+
+    nsresult (*GetPort)(IUSBDeviceFilter *this_, PRUnichar * *port);
+    nsresult (*SetPort)(IUSBDeviceFilter *this_, PRUnichar * port);
+
+    nsresult (*GetRemote)(IUSBDeviceFilter *this_, PRUnichar * *remote);
+    nsresult (*SetRemote)(IUSBDeviceFilter *this_, PRUnichar * remote);
+
+    nsresult (*GetMaskedInterfaces)(IUSBDeviceFilter *this_, PRUint32 *maskedInterfaces);
+    nsresult (*SetMaskedInterfaces)(IUSBDeviceFilter *this_, PRUint32 maskedInterfaces);
+
+};
+
+struct IUSBDeviceFilter
+{
+    struct IUSBDeviceFilter_vtbl *vtbl;
+};
+/* End of struct IUSBDeviceFilter Declaration */
+
+
+/* Start of struct IHostUSBDevice Declaration */
+#define IHOSTUSBDEVICE_IID_STR "173b4b44-d268-4334-a00d-b6521c9a740a"
+#define IHOSTUSBDEVICE_IID { \
+    0x173b4b44, 0xd268, 0x4334, \
+    { 0xa0, 0x0d, 0xb6, 0x52, 0x1c, 0x9a, 0x74, 0x0a } \
+}
+struct IHostUSBDevice_vtbl
+{
+    struct IUSBDevice_vtbl iusbdevice;
+
+    nsresult (*GetState)(IHostUSBDevice *this_, PRUint32 *state);
+
+};
+
+struct IHostUSBDevice
+{
+    struct IHostUSBDevice_vtbl *vtbl;
+};
+/* End of struct IHostUSBDevice Declaration */
+
+
+/* Start of struct IHostUSBDeviceFilter Declaration */
+#define IHOSTUSBDEVICEFILTER_IID_STR "4cc70246-d74a-400f-8222-3900489c0374"
+#define IHOSTUSBDEVICEFILTER_IID { \
+    0x4cc70246, 0xd74a, 0x400f, \
+    { 0x82, 0x22, 0x39, 0x00, 0x48, 0x9c, 0x03, 0x74 } \
+}
+struct IHostUSBDeviceFilter_vtbl
+{
+    struct IUSBDeviceFilter_vtbl iusbdevicefilter;
+
+    nsresult (*GetAction)(IHostUSBDeviceFilter *this_, PRUint32 *action);
+    nsresult (*SetAction)(IHostUSBDeviceFilter *this_, PRUint32 action);
+
+};
+
+struct IHostUSBDeviceFilter
+{
+    struct IHostUSBDeviceFilter_vtbl *vtbl;
+};
+/* End of struct IHostUSBDeviceFilter Declaration */
+
+
+/* Start of struct IAudioAdapter Declaration */
+#define IAUDIOADAPTER_IID_STR "921873db-5f3f-4b69-91f9-7be9e535a2cb"
+#define IAUDIOADAPTER_IID { \
+    0x921873db, 0x5f3f, 0x4b69, \
+    { 0x91, 0xf9, 0x7b, 0xe9, 0xe5, 0x35, 0xa2, 0xcb } \
+}
+struct IAudioAdapter_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetEnabled)(IAudioAdapter *this_, PRBool *enabled);
+    nsresult (*SetEnabled)(IAudioAdapter *this_, PRBool enabled);
+
+    nsresult (*GetAudioController)(IAudioAdapter *this_, PRUint32 *audioController);
+    nsresult (*SetAudioController)(IAudioAdapter *this_, PRUint32 audioController);
+
+    nsresult (*GetAudioDriver)(IAudioAdapter *this_, PRUint32 *audioDriver);
+    nsresult (*SetAudioDriver)(IAudioAdapter *this_, PRUint32 audioDriver);
+
+};
+
+struct IAudioAdapter
+{
+    struct IAudioAdapter_vtbl *vtbl;
+};
+/* End of struct IAudioAdapter Declaration */
+
+
+/* Start of struct IVRDPServer Declaration */
+#define IVRDPSERVER_IID_STR "f4584ae7-6bce-474b-83d6-17d235e6aa89"
+#define IVRDPSERVER_IID { \
+    0xf4584ae7, 0x6bce, 0x474b, \
+    { 0x83, 0xd6, 0x17, 0xd2, 0x35, 0xe6, 0xaa, 0x89 } \
+}
+struct IVRDPServer_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetEnabled)(IVRDPServer *this_, PRBool *enabled);
+    nsresult (*SetEnabled)(IVRDPServer *this_, PRBool enabled);
+
+    nsresult (*GetPort)(IVRDPServer *this_, PRUint32 *port);
+    nsresult (*SetPort)(IVRDPServer *this_, PRUint32 port);
+
+    nsresult (*GetNetAddress)(IVRDPServer *this_, PRUnichar * *netAddress);
+    nsresult (*SetNetAddress)(IVRDPServer *this_, PRUnichar * netAddress);
+
+    nsresult (*GetAuthType)(IVRDPServer *this_, PRUint32 *authType);
+    nsresult (*SetAuthType)(IVRDPServer *this_, PRUint32 authType);
+
+    nsresult (*GetAuthTimeout)(IVRDPServer *this_, PRUint32 *authTimeout);
+    nsresult (*SetAuthTimeout)(IVRDPServer *this_, PRUint32 authTimeout);
+
+    nsresult (*GetAllowMultiConnection)(IVRDPServer *this_, PRBool *allowMultiConnection);
+    nsresult (*SetAllowMultiConnection)(IVRDPServer *this_, PRBool allowMultiConnection);
+
+    nsresult (*GetReuseSingleConnection)(IVRDPServer *this_, PRBool *reuseSingleConnection);
+    nsresult (*SetReuseSingleConnection)(IVRDPServer *this_, PRBool reuseSingleConnection);
+
+};
+
+struct IVRDPServer
+{
+    struct IVRDPServer_vtbl *vtbl;
+};
+/* End of struct IVRDPServer Declaration */
+
+
+/* Start of struct ISharedFolder Declaration */
+#define ISHAREDFOLDER_IID_STR "64637bb2-9e17-471c-b8f3-f8968dd9884e"
+#define ISHAREDFOLDER_IID { \
+    0x64637bb2, 0x9e17, 0x471c, \
+    { 0xb8, 0xf3, 0xf8, 0x96, 0x8d, 0xd9, 0x88, 0x4e } \
+}
+struct ISharedFolder_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(ISharedFolder *this_, PRUnichar * *name);
+
+    nsresult (*GetHostPath)(ISharedFolder *this_, PRUnichar * *hostPath);
+
+    nsresult (*GetAccessible)(ISharedFolder *this_, PRBool *accessible);
+
+    nsresult (*GetWritable)(ISharedFolder *this_, PRBool *writable);
+
+    nsresult (*GetLastAccessError)(ISharedFolder *this_, PRUnichar * *lastAccessError);
+
+};
+
+struct ISharedFolder
+{
+    struct ISharedFolder_vtbl *vtbl;
+};
+/* End of struct ISharedFolder Declaration */
+
+
+/* Start of struct IInternalSessionControl Declaration */
+#define IINTERNALSESSIONCONTROL_IID_STR "2581845a-5a9d-45fb-bc3b-2476552dd970"
+#define IINTERNALSESSIONCONTROL_IID { \
+    0x2581845a, 0x5a9d, 0x45fb, \
+    { 0xbc, 0x3b, 0x24, 0x76, 0x55, 0x2d, 0xd9, 0x70 } \
+}
+struct IInternalSessionControl_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetPID)(
+        IInternalSessionControl *this_,
+        PRUint32 * pid
+    );
+
+    nsresult (*GetRemoteConsole)(
+        IInternalSessionControl *this_,
+        IConsole * * console
+    );
+
+    nsresult (*AssignMachine)(
+        IInternalSessionControl *this_,
+        IMachine * machine
+    );
+
+    nsresult (*AssignRemoteMachine)(
+        IInternalSessionControl *this_,
+        IMachine * machine,
+        IConsole * console
+    );
+
+    nsresult (*UpdateMachineState)(
+        IInternalSessionControl *this_,
+        PRUint32 aMachineState
+    );
+
+    nsresult (*Uninitialize)(IInternalSessionControl *this_ );
+
+    nsresult (*OnDVDDriveChange)(IInternalSessionControl *this_ );
+
+    nsresult (*OnFloppyDriveChange)(IInternalSessionControl *this_ );
+
+    nsresult (*OnNetworkAdapterChange)(
+        IInternalSessionControl *this_,
+        INetworkAdapter * networkAdapter
+    );
+
+    nsresult (*OnSerialPortChange)(
+        IInternalSessionControl *this_,
+        ISerialPort * serialPort
+    );
+
+    nsresult (*OnParallelPortChange)(
+        IInternalSessionControl *this_,
+        IParallelPort * parallelPort
+    );
+
+    nsresult (*OnStorageControllerChange)(IInternalSessionControl *this_ );
+
+    nsresult (*OnVRDPServerChange)(IInternalSessionControl *this_ );
+
+    nsresult (*OnUSBControllerChange)(IInternalSessionControl *this_ );
+
+    nsresult (*OnSharedFolderChange)(
+        IInternalSessionControl *this_,
+        PRBool global
+    );
+
+    nsresult (*OnUSBDeviceAttach)(
+        IInternalSessionControl *this_,
+        IUSBDevice * device,
+        IVirtualBoxErrorInfo * error,
+        PRUint32 maskedInterfaces
+    );
+
+    nsresult (*OnUSBDeviceDetach)(
+        IInternalSessionControl *this_,
+        const nsID * id,
+        IVirtualBoxErrorInfo * error
+    );
+
+    nsresult (*OnShowWindow)(
+        IInternalSessionControl *this_,
+        PRBool check,
+        PRBool * canShow,
+        PRUint64 * winId
+    );
+
+    nsresult (*AccessGuestProperty)(
+        IInternalSessionControl *this_,
+        PRUnichar * name,
+        PRUnichar * value,
+        PRUnichar * flags,
+        PRBool isSetter,
+        PRUnichar * * retValue,
+        PRUint64 * retTimestamp,
+        PRUnichar * * retFlags
+    );
+
+    nsresult (*EnumerateGuestProperties)(
+        IInternalSessionControl *this_,
+        PRUnichar * patterns,
+        PRUint32 *keySize,
+        PRUnichar *** key,
+        PRUint32 *valueSize,
+        PRUnichar *** value,
+        PRUint32 *timestampSize,
+        PRUint64* timestamp,
+        PRUint32 *flagsSize,
+        PRUnichar *** flags
+    );
+
+};
+
+struct IInternalSessionControl
+{
+    struct IInternalSessionControl_vtbl *vtbl;
+};
+/* End of struct IInternalSessionControl Declaration */
+
+
+/* Start of struct ISession Declaration */
+#define ISESSION_IID_STR "12F4DCDB-12B2-4ec1-B7CD-DDD9F6C5BF4D"
+#define ISESSION_IID { \
+    0x12F4DCDB, 0x12B2, 0x4ec1, \
+    { 0xB7, 0xCD, 0xDD, 0xD9, 0xF6, 0xC5, 0xBF, 0x4D } \
+}
+struct ISession_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetState)(ISession *this_, PRUint32 *state);
+
+    nsresult (*GetType)(ISession *this_, PRUint32 *type);
+
+    nsresult (*GetMachine)(ISession *this_, IMachine * *machine);
+
+    nsresult (*GetConsole)(ISession *this_, IConsole * *console);
+
+    nsresult (*Close)(ISession *this_ );
+
+};
+
+struct ISession
+{
+    struct ISession_vtbl *vtbl;
+};
+/* End of struct ISession Declaration */
+
+
+/* Start of struct IStorageController Declaration */
+#define ISTORAGECONTROLLER_IID_STR "6bf8335b-d14a-44a5-9b45-ddc49ce7d5b2"
+#define ISTORAGECONTROLLER_IID { \
+    0x6bf8335b, 0xd14a, 0x44a5, \
+    { 0x9b, 0x45, 0xdd, 0xc4, 0x9c, 0xe7, 0xd5, 0xb2 } \
+}
+struct IStorageController_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IStorageController *this_, PRUnichar * *name);
+
+    nsresult (*GetMaxDevicesPerPortCount)(IStorageController *this_, PRUint32 *maxDevicesPerPortCount);
+
+    nsresult (*GetMinPortCount)(IStorageController *this_, PRUint32 *minPortCount);
+
+    nsresult (*GetMaxPortCount)(IStorageController *this_, PRUint32 *maxPortCount);
+
+    nsresult (*GetInstance)(IStorageController *this_, PRUint32 *instance);
+    nsresult (*SetInstance)(IStorageController *this_, PRUint32 instance);
+
+    nsresult (*GetPortCount)(IStorageController *this_, PRUint32 *portCount);
+    nsresult (*SetPortCount)(IStorageController *this_, PRUint32 portCount);
+
+    nsresult (*GetBus)(IStorageController *this_, PRUint32 *bus);
+
+    nsresult (*GetControllerType)(IStorageController *this_, PRUint32 *controllerType);
+    nsresult (*SetControllerType)(IStorageController *this_, PRUint32 controllerType);
+
+    nsresult (*GetIDEEmulationPort)(
+        IStorageController *this_,
+        PRInt32 devicePosition,
+        PRInt32 * portNumber
+    );
+
+    nsresult (*SetIDEEmulationPort)(
+        IStorageController *this_,
+        PRInt32 devicePosition,
+        PRInt32 portNumber
+    );
+
+};
+
+struct IStorageController
+{
+    struct IStorageController_vtbl *vtbl;
+};
+/* End of struct IStorageController Declaration */
+
+
+/* Start of struct IPerformanceMetric Declaration */
+#define IPERFORMANCEMETRIC_IID_STR "2a1a60ae-9345-4019-ad53-d34ba41cbfe9"
+#define IPERFORMANCEMETRIC_IID { \
+    0x2a1a60ae, 0x9345, 0x4019, \
+    { 0xad, 0x53, 0xd3, 0x4b, 0xa4, 0x1c, 0xbf, 0xe9 } \
+}
+struct IPerformanceMetric_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetMetricName)(IPerformanceMetric *this_, PRUnichar * *metricName);
+
+    nsresult (*GetObject)(IPerformanceMetric *this_, nsISupports * *object);
+
+    nsresult (*GetDescription)(IPerformanceMetric *this_, PRUnichar * *description);
+
+    nsresult (*GetPeriod)(IPerformanceMetric *this_, PRUint32 *period);
+
+    nsresult (*GetCount)(IPerformanceMetric *this_, PRUint32 *count);
+
+    nsresult (*GetUnit)(IPerformanceMetric *this_, PRUnichar * *unit);
+
+    nsresult (*GetMinimumValue)(IPerformanceMetric *this_, PRInt32 *minimumValue);
+
+    nsresult (*GetMaximumValue)(IPerformanceMetric *this_, PRInt32 *maximumValue);
+
+};
+
+struct IPerformanceMetric
+{
+    struct IPerformanceMetric_vtbl *vtbl;
+};
+/* End of struct IPerformanceMetric Declaration */
+
+
+/* Start of struct IPerformanceCollector Declaration */
+#define IPERFORMANCECOLLECTOR_IID_STR "e22e1acb-ac4a-43bb-a31c-17321659b0c6"
+#define IPERFORMANCECOLLECTOR_IID { \
+    0xe22e1acb, 0xac4a, 0x43bb, \
+    { 0xa3, 0x1c, 0x17, 0x32, 0x16, 0x59, 0xb0, 0xc6 } \
+}
+struct IPerformanceCollector_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetMetricNames)(IPerformanceCollector *this_, PRUint32 *metricNamesSize, PRUnichar * **metricNames);
+
+    nsresult (*GetMetrics)(
+        IPerformanceCollector *this_,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *metricsSize,
+        IPerformanceMetric *** metrics
+    );
+
+    nsresult (*SetupMetrics)(
+        IPerformanceCollector *this_,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 period,
+        PRUint32 count,
+        PRUint32 *affectedMetricsSize,
+        IPerformanceMetric *** affectedMetrics
+    );
+
+    nsresult (*EnableMetrics)(
+        IPerformanceCollector *this_,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *affectedMetricsSize,
+        IPerformanceMetric *** affectedMetrics
+    );
+
+    nsresult (*DisableMetrics)(
+        IPerformanceCollector *this_,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *affectedMetricsSize,
+        IPerformanceMetric *** affectedMetrics
+    );
+
+    nsresult (*QueryMetricsData)(
+        IPerformanceCollector *this_,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *returnMetricNamesSize,
+        PRUnichar *** returnMetricNames,
+        PRUint32 *returnObjectsSize,
+        nsISupports ** returnObjects,
+        PRUint32 *returnUnitsSize,
+        PRUnichar *** returnUnits,
+        PRUint32 *returnScalesSize,
+        PRUint32* returnScales,
+        PRUint32 *returnSequenceNumbersSize,
+        PRUint32* returnSequenceNumbers,
+        PRUint32 *returnDataIndicesSize,
+        PRUint32* returnDataIndices,
+        PRUint32 *returnDataLengthsSize,
+        PRUint32* returnDataLengths,
+        PRUint32 *returnDataSize,
+        PRInt32** returnData
+    );
+
+};
+
+struct IPerformanceCollector
+{
+    struct IPerformanceCollector_vtbl *vtbl;
+};
+/* End of struct IPerformanceCollector Declaration */
+
+
+
+#define NS_VIRTUALBOX_CID { \
+    0xB1A7A4F2, 0x47B9, 0x4A1E, \
+    { 0x82, 0xB2, 0x07, 0xCC, 0xD5, 0x32, 0x3C, 0x3F } \
+}
+#define NS_VIRTUALBOX_CONTRACTID "@virtualbox.org/VirtualBox;1"
+/* for compatibility with Win32 */
+#define CLSID_VirtualBox (nsCID) NS_VIRTUALBOX_CID
+
+
+
+#define NS_SESSION_CID { \
+    0x3C02F46D, 0xC9D2, 0x4f11, \
+    { 0xA3, 0x84, 0x53, 0xF0, 0xCF, 0x91, 0x72, 0x14 } \
+}
+#define NS_SESSION_CONTRACTID "@virtualbox.org/Session;1"
+/* for compatibility with Win32 */
+#define CLSID_Session (nsCID) NS_SESSION_CID
+
+
+
+#endif /* !__cplusplus */
+
+#ifdef IN_VBOXXPCOMC
+# define VBOXXPCOMC_DECL(type)  PR_EXPORT(type)
+#else
+# define VBOXXPCOMC_DECL(type)  PR_IMPORT(type)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * Function table for dynamic linking.
+ * Use VBoxGetFunctions() to obtain the pointer to it.
+ */
+typedef struct VBOXXPCOMC
+{
+    /** The size of the structure. */
+    unsigned cb;
+    /** The structure version. */
+    unsigned uVersion;
+
+    unsigned int (*pfnGetVersion)(void);
+
+    void  (*pfnComInitialize)(IVirtualBox **virtualBox, ISession **session);
+    void  (*pfnComUninitialize)(void);
+
+    void  (*pfnComUnallocMem)(void *pv);
+    void  (*pfnUtf16Free)(PRUnichar *pwszString);
+    void  (*pfnUtf8Free)(char *pszString);
+
+    int   (*pfnUtf16ToUtf8)(const PRUnichar *pwszString, char **ppszString);
+    int   (*pfnUtf8ToUtf16)(const char *pszString, PRUnichar **ppwszString);
+
+    /** Tail version, same as uVersion. */
+    unsigned uEndVersion;
+} VBOXXPCOMC;
+/** Pointer to a const VBoxXPCOMC function table. */
+typedef VBOXXPCOMC const *PCVBOXXPCOM;
+
+/** The current interface version.
+ * For use with VBoxGetXPCOMCFunctions and to be found in
+ * VBOXXPCOMC::uVersion. */
+#define VBOX_XPCOMC_VERSION     0x00010000U
+
+VBOXXPCOMC_DECL(PCVBOXXPCOM) VBoxGetXPCOMCFunctions(unsigned uVersion);
+/** Typedef for VBoxGetXPCOMCFunctions. */
+typedef PCVBOXXPCOM (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
+
+/** The symbol name of VBoxGetXPCOMCFunctions. */
+#if defined(__OS2__)
+# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME   "_VBoxGetXPCOMCFunctions"
+#else
+# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME   "VBoxGetXPCOMCFunctions"
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !___VirtualBox_CXPCOM_h */
diff --git a/src/vbox/VBoxXPCOMCGlue.c b/src/vbox/VBoxXPCOMCGlue.c
new file mode 100644
index 0000000..4763dbb
--- /dev/null
+++ b/src/vbox/VBoxXPCOMCGlue.c
@@ -0,0 +1,212 @@
+/* $Revision: 44380 $ */
+/** @file
+ * Glue code for dynamically linking to VBoxXPCOMC.
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+
+#ifdef VBOX_WITH_XPCOM
+# define VIR_ALLOC_N(a, b) ((a) = (char *)malloc(b))
+# define VIR_FREE(name) (free(name))
+#else /* !VBOX_WITH_XPCOM */
+# include <config.h>
+# include "memory.h"
+#endif /* !VBOX_WITH_XPCOM */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+
+#include "VBoxXPCOMCGlue.h"
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#if defined(__linux__) || defined(__linux_gnu__) || defined(__sun__)
+# define DYNLIB_NAME    "VBoxXPCOMC.so"
+#elif defined(__APPLE__)
+# define DYNLIB_NAME    "VBoxXPCOMC.dylib"
+#elif defined(_MSC_VER) || defined(__OS2__)
+# define DYNLIB_NAME    "VBoxXPCOMC.dll"
+#else
+# error "Port me"
+#endif
+
+/** The dlopen handle for VBoxXPCOMC. */
+void *g_hVBoxXPCOMC = NULL;
+/** The last load error. */
+char g_szVBoxErrMsg[256];
+/** Pointer to the VBoxXPCOMC function table.  */
+PCVBOXXPCOM g_pVBoxFuncs = NULL;
+/** Pointer to VBoxGetXPCOMCFunctions for the loaded VBoxXPCOMC so/dylib/dll. */
+PFNVBOXGETXPCOMCFUNCTIONS g_pfnGetFunctions = NULL;
+
+
+/**
+ * Try load VBoxXPCOMC.so/dylib/dll from the specified location and resolve all
+ * the symbols we need.
+ *
+ * @returns 0 on success, -1 on failure.
+ * @param   pszHome         The director where to try load VBoxXPCOMC from. Can be NULL.
+ */
+static int tryLoadOne(const char *pszHome)
+{
+    size_t      cchHome = pszHome ? strlen(pszHome) : 0;
+    size_t      cbBuf;
+    char *      pszBuf;
+    int         rc = -1;
+
+    /*
+     * Construct the full name.
+     */
+    cbBuf = cchHome + sizeof("/" DYNLIB_NAME);
+    if(VIR_ALLOC_N(pszBuf, cbBuf)) {;}
+    if (!pszBuf)
+    {
+        sprintf(g_szVBoxErrMsg, "malloc(%u) failed", (unsigned)cbBuf);
+        return -1;
+    }
+    if (pszHome)
+    {
+        memcpy(pszBuf, pszHome, cchHome);
+        pszBuf[cchHome] = '/';
+        cchHome++;
+    }
+    memcpy(&pszBuf[cchHome], DYNLIB_NAME, sizeof(DYNLIB_NAME));
+
+    /*
+     * Try load it by that name, setting the VBOX_APP_HOME first (for now).
+     * Then resolve and call the function table getter.
+     */
+    setenv("VBOX_APP_HOME", pszHome, 0 /* no need to overwrite */);
+    g_hVBoxXPCOMC = dlopen(pszBuf, RTLD_NOW | RTLD_LOCAL);
+    if (g_hVBoxXPCOMC)
+    {
+        PFNVBOXGETXPCOMCFUNCTIONS pfnGetFunctions;
+        pfnGetFunctions = (PFNVBOXGETXPCOMCFUNCTIONS)
+            dlsym(g_hVBoxXPCOMC, VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME);
+        if (pfnGetFunctions)
+        {
+            g_pVBoxFuncs = pfnGetFunctions(VBOX_XPCOMC_VERSION);
+            if (g_pVBoxFuncs)
+            {
+                g_pfnGetFunctions = pfnGetFunctions;
+                rc = 0;
+            }
+            else
+                sprintf(g_szVBoxErrMsg, "%.80s: pfnGetFunctions(%#x) failed",
+                        pszBuf, VBOX_XPCOMC_VERSION);
+        }
+        else
+            sprintf(g_szVBoxErrMsg, "dlsym(%.80s/%.32s): %128s",
+                    pszBuf, VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME, dlerror());
+        if (rc != 0)
+        {
+            dlclose(g_hVBoxXPCOMC);
+            g_hVBoxXPCOMC = NULL;
+        }
+    }
+    else
+        sprintf(g_szVBoxErrMsg, "dlopen(%.80s): %128s", pszBuf, dlerror());
+    VIR_FREE(pszBuf);
+    return rc;
+}
+
+
+/**
+ * Tries to locate and load VBoxXPCOMC.so/dylib/dll, resolving all the related
+ * function pointers.
+ *
+ * @returns 0 on success, -1 on failure.
+ *
+ * @remark  This should be considered moved into a separate glue library since
+ *          its its going to be pretty much the same for any user of VBoxXPCOMC
+ *          and it will just cause trouble to have duplicate versions of this
+ *          source code all around the place.
+ */
+int VBoxCGlueInit(void)
+{
+    /*
+     * If the user specifies the location, try only that.
+     */
+    const char *pszHome = getenv("VBOX_APP_HOME");
+    if (pszHome)
+        return tryLoadOne(pszHome);
+
+    /*
+     * Try the known standard locations.
+     */
+#if defined(__gnu__linux__) || defined(__linux__)
+    if (tryLoadOne("/opt/VirtualBox") == 0)
+        return 0;
+    if (tryLoadOne("/usr/lib/virtualbox") == 0)
+        return 0;
+#elif defined(__sun__)
+    if (tryLoadOne("/opt/VirtualBox/amd64") == 0)
+        return 0;
+    if (tryLoadOne("/opt/VirtualBox/i386") == 0)
+        return 0;
+#elif defined(__APPLE__)
+    if (tryLoadOne("/Application/VirtualBox.app/Contents/MacOS") == 0)
+        return 0;
+#else
+# error "port me"
+#endif
+
+    /*
+     * Finally try the dynamic linker search path.
+     */
+    if (tryLoadOne(NULL) == 0)
+        return 0;
+
+    /* No luck, return failure. */
+    return -1;
+}
+
+/**
+ * Terminate the C glue library.
+ */
+void VBoxCGlueTerm(void)
+{
+    if (g_hVBoxXPCOMC)
+    {
+        /* VBoxRT.so doesn't like being reloaded and it asserts at:
+         * Expression: g_szrtProcExePath[0] != '\0'
+         * Location  : src/VBox/Runtime/r3/process.cpp(100) char* RTProcGetExecutableName(char*, size_t)
+         * so for time being not comment the following line
+         */
+        /* dlclose(g_hVBoxXPCOMC); */
+        g_hVBoxXPCOMC = NULL;
+    }
+    g_pVBoxFuncs = NULL;
+    g_pfnGetFunctions = NULL;
+    memset(g_szVBoxErrMsg, 0, sizeof(g_szVBoxErrMsg));
+}
diff --git a/src/vbox/VBoxXPCOMCGlue.h b/src/vbox/VBoxXPCOMCGlue.h
new file mode 100644
index 0000000..a97ddf3
--- /dev/null
+++ b/src/vbox/VBoxXPCOMCGlue.h
@@ -0,0 +1,59 @@
+/* $Revision: 44350 $ */
+/** @file VBoxXPCOMCGlue.h
+ * Glue for dynamically linking with VBoxXPCOMC.
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef ___VBoxXPCOMC_cglue_h
+#define ___VBoxXPCOMC_cglue_h
+
+#include "VBoxCAPI_v2_2.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** The dlopen handle for VBoxXPCOMC. */
+extern void *g_hVBoxXPCOMC;
+/** The last load error. */
+extern char g_szVBoxErrMsg[256];
+/** Pointer to the VBoxXPCOMC function table.  */
+extern PCVBOXXPCOM g_pVBoxFuncs;
+/** Pointer to VBoxGetXPCOMCFunctions for the loaded VBoxXPCOMC so/dylib/dll. */
+extern PFNVBOXGETXPCOMCFUNCTIONS g_pfnGetFunctions;
+
+
+int VBoxCGlueInit(void);
+void VBoxCGlueTerm(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/vbox/vbox_V2_2.c b/src/vbox/vbox_V2_2.c
new file mode 100644
index 0000000..72ec885
--- /dev/null
+++ b/src/vbox/vbox_V2_2.c
@@ -0,0 +1,13 @@
+/** @file vbox_V2_2.c
+ * C file to include support for multiple versions of VirtualBox
+ * at runtime.
+ */
+
+#include <config.h>
+
+/** The API Version */
+#define VBOX_API_VERSION    2002
+/** Version specific prefix. */
+#define NAME(name)  vbox22##name
+
+#include "vbox_tmpl.c"
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
new file mode 100644
index 0000000..b484abc
--- /dev/null
+++ b/src/vbox/vbox_driver.c
@@ -0,0 +1,53 @@
+/** @file vbox_driver.c
+ * Core driver methods for managing VirtualBox VM's
+ */
+
+#include <config.h>
+
+#include "internal.h"
+
+#include "datatypes.h"
+#include "logging.h"
+#include "vbox_driver.h"
+#include "VBoxXPCOMCGlue.h"
+
+#define VIR_FROM_THIS VIR_FROM_VBOX
+
+
+extern virDriver vbox22Driver;
+extern virDriver vbox25Driver;
+
+
+int vboxRegister(void) {
+    virDriver *driver;
+    uint32_t uVersion = 0;
+    uint32_t major    = 0;
+    uint32_t minor    = 0;
+    uint32_t intVer   = 0;
+    uint32_t micro    = 0;
+
+    if (VBoxCGlueInit() != 0)
+        return -1;
+
+    if (g_pVBoxFuncs == NULL)
+        return -1;
+
+    uVersion = g_pVBoxFuncs->pfnGetVersion();
+    major  = uVersion / 1000000;
+    intVer = uVersion % 1000000;
+    minor  = intVer / 1000;
+    micro  = intVer % 1000;
+
+    DEBUG("VBoxCGlueInit worked for version: %d.%d.%d", major, minor, micro);
+
+    /* select driver implementation based on version. */
+    if ((major == 2) && ((minor == 1)||(minor == 2)) )
+        driver = &vbox22Driver;
+    else
+        return -1;
+
+    if (virRegisterDriver(driver) < 0)
+        return -1;
+
+    return 0;
+}
diff --git a/src/vbox/vbox_driver.h b/src/vbox/vbox_driver.h
new file mode 100644
index 0000000..9430f66
--- /dev/null
+++ b/src/vbox/vbox_driver.h
@@ -0,0 +1,12 @@
+/** @file vbox_driver.h
+ * Core driver methods for managing VirtualBox VM's
+ */
+
+#ifndef VBOX_DRIVER_H
+#define VBOX_DRIVER_H
+
+#include "internal.h"
+
+int vboxRegister(void);
+
+#endif
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
new file mode 100644
index 0000000..bb5a812
--- /dev/null
+++ b/src/vbox/vbox_tmpl.c
@@ -0,0 +1,2337 @@
+/** @file vbox_tmpl.c
+ * Template File to support multiple versions of VirtualBox
+ * at runtime :).
+ *
+ * IMPORTANT:
+ * Please dont include this file in the src/Makefile.am, it
+ * is automatically include by other files.
+ */
+
+#include <config.h>
+
+#include <dlfcn.h>
+#include <sys/utsname.h>
+
+#include "internal.h"
+
+#include "datatypes.h"
+#include "domain_conf.h"
+#include "virterror_internal.h"
+#include "uuid.h"
+#include "memory.h"
+#include "nodeinfo.h"
+#include "logging.h"
+#include "vbox_driver.h"
+#include "VBoxXPCOMCGlue.h"
+
+/* This one changes from version to version. */
+#if VBOX_API_VERSION == 2002
+# include "VBoxCAPI_v2_2.h"
+/* Commented for now, v2.5 is far far away */
+/*
+#elif VBOX_API_VERSION == 2005
+# include "VBoxCAPI_v2_5.h"
+*/
+#endif
+
+#define VIR_FROM_THIS VIR_FROM_VBOX
+
+#define vboxError(conn, code, fmt...) \
+        virReportErrorHelper(conn, VIR_FROM_VBOX, code, __FILE__, \
+                            __FUNCTION__, __LINE__, fmt)
+
+struct vbox_driver {
+    virMutex lock;
+    int version;
+    virDomainObjList domains;
+    virCapsPtr caps;
+};
+
+
+/*******************************************************************************
+* Global VirtualBox and ISession Objects                                       *
+*******************************************************************************/
+static IVirtualBox *g_vboxObj   = NULL;
+static ISession *g_vboxSession  = NULL;
+
+/* To Check if VBoxXPCOMC is already loaded */
+static int g_bVBoxXPCOMCInit = -1;
+
+/* Dont know where to put these functions yet, so they
+ * sit here for now abd thus making them static
+ */
+static void nsIDtoChar(unsigned char *uuid, nsID *iid) {
+    char uuidstrsrc[VIR_UUID_STRING_BUFLEN];
+    char uuidstrdst[VIR_UUID_STRING_BUFLEN];
+    unsigned char uuidinterim[VIR_UUID_BUFLEN];
+    int i;
+
+    memcpy(uuidinterim, iid, VIR_UUID_BUFLEN);
+    virUUIDFormat(uuidinterim, uuidstrsrc);
+
+    uuidstrdst[0]  = uuidstrsrc[6];
+    uuidstrdst[1]  = uuidstrsrc[7];
+    uuidstrdst[2]  = uuidstrsrc[4];
+    uuidstrdst[3]  = uuidstrsrc[5];
+    uuidstrdst[4]  = uuidstrsrc[2];
+    uuidstrdst[5]  = uuidstrsrc[3];
+    uuidstrdst[6]  = uuidstrsrc[0];
+    uuidstrdst[7]  = uuidstrsrc[1];
+
+    uuidstrdst[8]  = uuidstrsrc[8];
+
+    uuidstrdst[9]  = uuidstrsrc[11];
+    uuidstrdst[10] = uuidstrsrc[12];
+    uuidstrdst[11] = uuidstrsrc[9];
+    uuidstrdst[12] = uuidstrsrc[10];
+
+    uuidstrdst[13] = uuidstrsrc[13];
+
+    uuidstrdst[14] = uuidstrsrc[16];
+    uuidstrdst[15] = uuidstrsrc[17];
+    uuidstrdst[16] = uuidstrsrc[14];
+    uuidstrdst[17] = uuidstrsrc[15];
+
+    for(i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
+        uuidstrdst[i] = uuidstrsrc[i];
+    }
+
+    uuidstrdst[VIR_UUID_STRING_BUFLEN-1] = '\0';
+    virUUIDParse(uuidstrdst, uuid);
+}
+
+static void nsIDFromChar(nsID *iid, unsigned char *uuid) {
+    char uuidstrsrc[VIR_UUID_STRING_BUFLEN];
+    char uuidstrdst[VIR_UUID_STRING_BUFLEN];
+    unsigned char uuidinterim[VIR_UUID_BUFLEN];
+    int i;
+
+    virUUIDFormat(uuid, uuidstrsrc);
+
+    uuidstrdst[0]  = uuidstrsrc[6];
+    uuidstrdst[1]  = uuidstrsrc[7];
+    uuidstrdst[2]  = uuidstrsrc[4];
+    uuidstrdst[3]  = uuidstrsrc[5];
+    uuidstrdst[4]  = uuidstrsrc[2];
+    uuidstrdst[5]  = uuidstrsrc[3];
+    uuidstrdst[6]  = uuidstrsrc[0];
+    uuidstrdst[7]  = uuidstrsrc[1];
+
+    uuidstrdst[8]  = uuidstrsrc[8];
+
+    uuidstrdst[9]  = uuidstrsrc[11];
+    uuidstrdst[10] = uuidstrsrc[12];
+    uuidstrdst[11] = uuidstrsrc[9];
+    uuidstrdst[12] = uuidstrsrc[10];
+
+    uuidstrdst[13] = uuidstrsrc[13];
+
+    uuidstrdst[14] = uuidstrsrc[16];
+    uuidstrdst[15] = uuidstrsrc[17];
+    uuidstrdst[16] = uuidstrsrc[14];
+    uuidstrdst[17] = uuidstrsrc[15];
+
+    for(i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
+        uuidstrdst[i] = uuidstrsrc[i];
+    }
+
+    uuidstrdst[VIR_UUID_STRING_BUFLEN-1] = '\0';
+    virUUIDParse(uuidstrdst, uuidinterim);
+    memcpy(iid, uuidinterim, VIR_UUID_BUFLEN);
+}
+
+
+static int vboxInitialize(virConnectPtr conn) {
+    if (g_bVBoxXPCOMCInit >= 0)
+        return 0;
+
+    if (VBoxCGlueInit() != 0) {
+        vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s\n", g_szVBoxErrMsg);
+        return -1;
+    }
+
+    if (g_pVBoxFuncs == NULL) {
+        vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s\n", g_szVBoxErrMsg);
+        return -1;
+    }
+
+    g_pVBoxFuncs->pfnComInitialize(&g_vboxObj, &g_vboxSession);
+    if (g_vboxObj == NULL)
+        return -1;
+    if (g_vboxSession == NULL)
+        return -1;
+
+    g_bVBoxXPCOMCInit = 0;
+    return 0;
+}
+
+static void vboxUninitialize(void) {
+    g_pVBoxFuncs->pfnComUninitialize();
+    VBoxCGlueTerm();
+    g_bVBoxXPCOMCInit = -1;
+}
+
+static int vboxExtractVersionInfo(int *retversion) {
+    int ret = -1;
+    unsigned int major = 0, minor = 0, micro = 0;
+    unsigned int version;
+    nsresult rc;
+    PRUnichar *versionUtf16 = NULL;
+
+    rc = g_vboxObj->vtbl->GetVersion(g_vboxObj, &versionUtf16);
+    if (NS_SUCCEEDED(rc)) {
+        char *vboxVersion = NULL;
+        g_pVBoxFuncs->pfnUtf16ToUtf8(versionUtf16, &vboxVersion);
+        if (sscanf(vboxVersion, "%u.%u.%u",
+               &major, &minor, &micro) != 3)
+               return ret;
+        g_pVBoxFuncs->pfnUtf8Free(vboxVersion);
+        g_pVBoxFuncs->pfnComUnallocMem(versionUtf16);
+    } else {
+        return ret;
+    }
+
+    version = (major * 1000 * 1000) + (minor * 1000) + micro;
+
+    if (retversion)
+        *retversion = version;
+    ret = 0;
+
+    return ret;
+}
+
+static int vboxExtractVersion(virConnectPtr conn, struct vbox_driver *driver) {
+    if (driver->version > 0)
+        return 0;
+
+    if (vboxExtractVersionInfo(&driver->version) < 0) {
+        vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s",
+                  "Cound not extract VirtualBox version");
+        return -1;
+    }
+
+    return 0;
+}
+
+static int vboxGetNumOfDomains(virConnectPtr conn) {
+    nsresult rc;
+    IMachine **machines = NULL;
+    PRUint32 machineCnt = 0;
+    PRUint32 state;
+    int ret = -1;
+    int i;
+
+    if(g_vboxObj) {
+        rc = g_vboxObj->vtbl->GetMachines(g_vboxObj, &machineCnt, &machines);
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "Could not get number of Domains",(unsigned)rc);
+            goto cleanup;
+        }
+
+        if (machineCnt == 0) {
+            ret = 0;
+            goto cleanup;
+        }
+
+        /* Do the cleanup as required by GetMachines() */
+        for (i = 0; i < machineCnt; ++i) {
+            IMachine *machine = machines[i];
+
+            if (machine) {
+                PRBool isAccessible = PR_FALSE;
+                machine->vtbl->GetAccessible(machine, &isAccessible);
+                if (isAccessible) {
+                    machine->vtbl->GetState(machine, &state);
+                    if ((state == MachineState_Running) ||
+                        (state == MachineState_Paused) ) {
+                        ret++;
+                    }
+                }
+            }
+        }
+        ret++;
+    }
+
+cleanup:
+    for (i = 0; i < machineCnt; ++i)
+        if (machines[i])
+            machines[i]->vtbl->nsisupports.Release((void *)machines[i]);
+    return ret;
+}
+
+static int vboxGetNumOfDefinedDomains(virConnectPtr conn) {
+    nsresult rc;
+    IMachine **machines = NULL;
+    PRUint32 machineCnt = 0;
+    PRUint32 state;
+    int ret = -1;
+    int i;
+
+    if(g_vboxObj) {
+        rc = g_vboxObj->vtbl->GetMachines(g_vboxObj, &machineCnt, &machines);
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "Could not get number of Defined Domains",(unsigned)rc);
+            goto cleanup;
+        }
+
+        if (machineCnt == 0) {
+            ret = 0;
+            goto cleanup;
+        }
+
+        /* Do the cleanup as required by GetMachines() */
+        for (i = 0; i < machineCnt; ++i) {
+            IMachine *machine = machines[i];
+
+            if (machine) {
+                PRBool isAccessible = PR_FALSE;
+                machine->vtbl->GetAccessible(machine, &isAccessible);
+                if (isAccessible) {
+                    machine->vtbl->GetState(machine, &state);
+                    if ((state != MachineState_Running) &&
+                        (state != MachineState_Paused) ) {
+                        ret++;
+                    }
+                }
+            }
+        }
+        ret++;
+    }
+
+cleanup:
+    for (i = 0; i < machineCnt; ++i)
+        if (machines[i])
+            machines[i]->vtbl->nsisupports.Release((void *)machines[i]);
+    return ret;
+}
+
+static int vboxGetListDomains(virConnectPtr conn, int *ids, int nids) {
+    nsresult rc;
+    IMachine **machines = NULL;
+    PRUint32 machineCnt = 0;
+    PRUint32 state;
+    int ret = -1;
+    int i, j;
+
+    if(g_vboxObj) {
+        rc = g_vboxObj->vtbl->GetMachines(g_vboxObj, &machineCnt, &machines);
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "Could not get list of Domains",(unsigned)rc);
+            goto cleanup;
+        }
+
+        if (machineCnt == 0) {
+            ret = 0;
+            goto cleanup;
+        }
+
+        for (i = 0,j = 0; (i < machineCnt) && (j < nids); ++i) {
+            IMachine *machine = machines[i];
+
+            if (machine) {
+                PRBool isAccessible = PR_FALSE;
+                machine->vtbl->GetAccessible(machine, &isAccessible);
+                if (isAccessible) {
+                    machine->vtbl->GetState(machine, &state);
+                    if ((state == MachineState_Running) ||
+                        (state == MachineState_Paused) ) {
+                        ret++;
+                        ids[j++] = i;
+                    }
+                }
+            }
+        }
+        ret++;
+    }
+
+cleanup:
+    for (i = 0; i < machineCnt; ++i)
+        if (machines[i])
+            machines[i]->vtbl->nsisupports.Release((void *)machines[i]);
+    return ret;
+}
+
+static int vboxGetListDefinedDomains(virConnectPtr conn,
+                                     char ** const names, int maxnames) {
+    nsresult rc;
+    IMachine **machines = NULL;
+    PRUint32 machineCnt = 0;
+    char *machineName   = NULL;
+    PRUnichar *machineNameUtf16 = NULL;
+    PRUint32 state;
+    int ret = -1;
+    int i, j;
+
+    if(g_vboxObj) {
+        rc = g_vboxObj->vtbl->GetMachines(g_vboxObj, &machineCnt, &machines);
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "Could not get list of Defined Domains",(unsigned)rc);
+            goto cleanup;
+        }
+
+        if (machineCnt == 0) {
+            ret = 0;
+            goto cleanup;
+        }
+
+        for (i = 0,j = 0; (i < machineCnt) && (j < maxnames); i++) {
+            IMachine *machine = machines[i];
+
+            if (machine) {
+                PRBool isAccessible = PR_FALSE;
+                machine->vtbl->GetAccessible(machine, &isAccessible);
+                if (isAccessible) {
+                    machine->vtbl->GetState(machine, &state);
+                    if ((state != MachineState_Running) &&
+                        (state != MachineState_Paused) ) {
+                        machine->vtbl->GetName(machine, &machineNameUtf16);
+                        g_pVBoxFuncs->pfnUtf16ToUtf8(machineNameUtf16, &machineName);
+                        if (!(names[j++] = strdup(machineName))) {
+                            virReportOOMError(conn);
+                            for ( ; j >= 0 ; j--)
+                                VIR_FREE(names[j]);
+                            ret = -1;
+                            goto cleanup;
+                        }
+                        ret++;
+                    }
+                }
+            }
+        }
+        ret++;
+    }
+
+cleanup:
+    g_pVBoxFuncs->pfnUtf8Free(machineName);
+    g_pVBoxFuncs->pfnUtf16Free(machineNameUtf16);
+    for (i = 0; i < machineCnt; ++i)
+        if (machines[i])
+            machines[i]->vtbl->nsisupports.Release((void *)machines[i]);
+    return ret;
+}
+
+static virDomainPtr vboxGetDomainLookupByID(virConnectPtr conn, int id) {
+    nsresult rc;
+    IMachine **machines = NULL;
+    PRUint32 machineCnt = 0;
+    virDomainPtr dom    = NULL;
+    nsID  *iid          = NULL;
+    unsigned char iidl[VIR_UUID_BUFLEN];
+    PRUint32 state;
+    int i;
+
+    if(g_vboxObj) {
+        rc = g_vboxObj->vtbl->GetMachines(g_vboxObj, &machineCnt, &machines);
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "Could not get list of machines",(unsigned)rc);
+            return NULL;
+        }
+
+        if (id < machineCnt) {
+            if (machines[id]) {
+                PRBool isAccessible = PR_FALSE;
+                machines[id]->vtbl->GetAccessible(machines[id], &isAccessible);
+                if (isAccessible) {
+                    machines[id]->vtbl->GetState(machines[id], &state);
+                    if ((state == MachineState_Running) ||
+                        (state == MachineState_Paused) ) {
+                        PRUnichar *machineNameUtf16 = NULL;
+                        char *machineName;
+
+                        machines[id]->vtbl->GetName(machines[id], &machineNameUtf16);
+                        g_pVBoxFuncs->pfnUtf16ToUtf8(machineNameUtf16, &machineName);
+
+                        machines[id]->vtbl->GetId(machines[id], &iid);
+                        nsIDtoChar(iidl, iid);
+
+                        /* get a new domain pointer from virGetDomain, if it fails
+                         * then no need to assign the id, else assign the id, cause
+                         * it is -1 by default. rest is taken care by virGetDomain
+                         * itself, so need not worry.
+                         */
+
+                        dom = virGetDomain(conn, machineName, iidl);
+                        if (dom)
+                            dom->id = id;
+
+                        /* Cleanup all the XPCOM allocated stuff here */
+                        g_pVBoxFuncs->pfnComUnallocMem(iid);
+                        g_pVBoxFuncs->pfnUtf8Free(machineName);
+                        g_pVBoxFuncs->pfnComUnallocMem(machineNameUtf16);
+                    }
+                }
+            }
+        }
+
+        /* Do the cleanup as required by GetMachines() */
+        for (i = 0; i < machineCnt; ++i) {
+            if (machines[i])
+                machines[i]->vtbl->nsisupports.Release((void *)machines[i]);
+        }
+    }
+
+    return dom;
+}
+
+static int vboxGetDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) {
+    nsresult rc;
+    IMachine **machines = NULL;
+    PRUint32 machineCnt = 0;
+    char *machineName   = NULL;
+    PRUnichar *machineNameUtf16 = NULL;
+    int i, ret = -1;
+
+    if(g_vboxObj) {
+        rc = g_vboxObj->vtbl->GetMachines(g_vboxObj, &machineCnt, &machines);
+        if (NS_FAILED(rc)) {
+            vboxError(NULL, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "Could not get list of machines",(unsigned)rc);
+            goto cleanup;
+        }
+
+        info->nrVirtCpu = 0;
+        for (i = 0; i < machineCnt; ++i) {
+            IMachine *machine = machines[i];
+            PRBool isAccessible = PR_FALSE;
+
+            if (!machine)
+                continue;
+
+            machine->vtbl->GetAccessible(machine, &isAccessible);
+            if (isAccessible) {
+
+                machine->vtbl->GetName(machine, &machineNameUtf16);
+                g_pVBoxFuncs->pfnUtf16ToUtf8(machineNameUtf16, &machineName);
+
+                if (STREQ(dom->name, machineName)) {
+                    /* Get the Machine State (also match it with
+                    * virDomainState). Get the Machine memory and
+                    * for time being set maxmem and memory to same
+                    * Also since there is no direct way of checking
+                    * the cputime required (one condition being the
+                    * VM is remote), return zero for cputime. Get the
+                    * number of CPU (This is 1 for current
+                    * VirtualBox builds).
+                    */
+                    PRUint32 CPUCount;
+                    PRUint32 memorySize;
+                    PRUint32 state;
+
+                    machine->vtbl->GetCPUCount(machine, &CPUCount);
+                    machine->vtbl->GetMemorySize(machine, &memorySize);
+                    machine->vtbl->GetState(machine, &state);
+
+                    info->cpuTime = 0;
+                    info->nrVirtCpu = CPUCount;
+                    info->memory = memorySize * 1024;
+                    info->maxMem = memorySize * 1024;
+                    switch(state) {
+                        case MachineState_Running:
+                            info->state = VIR_DOMAIN_RUNNING;
+                            break;
+                        case MachineState_Stuck:
+                            info->state = VIR_DOMAIN_BLOCKED;
+                            break;
+                        case MachineState_Paused:
+                            info->state = VIR_DOMAIN_PAUSED;
+                            break;
+                        case MachineState_Stopping:
+                            info->state = VIR_DOMAIN_SHUTDOWN;
+                            break;
+                        case MachineState_PoweredOff:
+                            info->state = VIR_DOMAIN_SHUTOFF;
+                            break;
+                        case MachineState_Aborted:
+                            info->state = VIR_DOMAIN_CRASHED;
+                            break;
+                        case MachineState_Null:
+                        default:
+                            info->state = VIR_DOMAIN_NOSTATE;
+                            break;
+                    }
+                }
+
+                if (machineName)
+                    g_pVBoxFuncs->pfnUtf8Free(machineName);
+                if (machineNameUtf16)
+                    g_pVBoxFuncs->pfnComUnallocMem(machineNameUtf16);
+                if (info->nrVirtCpu)
+                    break;
+            }
+
+        }
+
+        /* Do the cleanup and take care you dont leak any memory */
+        for (i = 0; i < machineCnt; ++i) {
+            if (machines[i])
+                machines[i]->vtbl->nsisupports.Release((void *)machines[i]);
+        }
+    }
+
+    ret = 0;
+
+cleanup:
+    return ret;
+}
+
+static virDomainPtr vboxGetDomainLookupByName(virConnectPtr conn, const char *name) {
+    nsresult rc;
+    IMachine **machines = NULL;
+    PRUint32 machineCnt = 0;
+    virDomainPtr dom    = NULL;
+    nsID  *iid          = NULL;
+    char *machineName   = NULL;
+    PRUnichar *machineNameUtf16 = NULL;
+    unsigned char iidl[VIR_UUID_BUFLEN];
+    int i, matched = 0;
+
+    if(g_vboxObj) {
+        rc = g_vboxObj->vtbl->GetMachines(g_vboxObj, &machineCnt, &machines);
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "Could not get list of machines",(unsigned)rc);
+            return NULL;
+        }
+
+        for (i = 0; i < machineCnt; ++i) {
+            IMachine *machine = machines[i];
+            PRBool isAccessible = PR_FALSE;
+
+            if (!machine)
+                continue;
+
+            machine->vtbl->GetAccessible(machine, &isAccessible);
+            if (isAccessible) {
+
+                machine->vtbl->GetName(machine, &machineNameUtf16);
+                g_pVBoxFuncs->pfnUtf16ToUtf8(machineNameUtf16, &machineName);
+
+                if (machineName && (STREQ(name, machineName))) {
+
+                    PRUint32 state;
+
+                    matched = 1;
+
+                    machine->vtbl->GetId(machine, &iid);
+                    nsIDtoChar(iidl, iid);
+
+                    machine->vtbl->GetState(machine, &state);
+
+                    /* get a new domain pointer from virGetDomain, if it fails
+                     * then no need to assign the id, else assign the id, cause
+                     * it is -1 by default. rest is taken care by virGetDomain
+                     * itself, so need not worry.
+                     */
+
+                    dom = virGetDomain(conn, machineName, iidl);
+                    if (dom)
+                        if ((state == MachineState_Running) ||
+                            (state == MachineState_Paused) )
+                            dom->id = i;
+                }
+
+                if (machineName) {
+                    g_pVBoxFuncs->pfnUtf8Free(machineName);
+                    machineName = NULL;
+                }
+                if (machineNameUtf16) {
+                    g_pVBoxFuncs->pfnComUnallocMem(machineNameUtf16);
+                    machineNameUtf16 = NULL;
+                }
+                if (matched == 1)
+                    break;
+            }
+        }
+
+        /* Do the cleanup and take care you dont leak any memory */
+        if (iid)
+            g_pVBoxFuncs->pfnComUnallocMem(iid);
+        for (i = 0; i < machineCnt; ++i) {
+            if (machines[i])
+                machines[i]->vtbl->nsisupports.Release((void *)machines[i]);
+        }
+    }
+
+    return dom;
+}
+
+static virDomainPtr vboxGetDomainLookupByUUID(virConnectPtr conn,
+                                              const unsigned char *uuid) {
+    nsresult rc;
+    IMachine **machines = NULL;
+    PRUint32 machineCnt = 0;
+    virDomainPtr dom    = NULL;
+    nsID  *iid          = NULL;
+    char *machineName   = NULL;
+    PRUnichar *machineNameUtf16 = NULL;
+    unsigned char iidl[VIR_UUID_BUFLEN];
+    int i, matched = 0;
+
+    if(g_vboxObj) {
+        rc = g_vboxObj->vtbl->GetMachines(g_vboxObj, &machineCnt, &machines);
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "Could not get list of machines",(unsigned)rc);
+            return NULL;
+        }
+
+        for (i = 0; i < machineCnt; ++i) {
+            IMachine *machine = machines[i];
+            PRBool isAccessible = PR_FALSE;
+
+            if (!machine)
+                continue;
+
+            machine->vtbl->GetAccessible(machine, &isAccessible);
+            if (isAccessible) {
+
+                machine->vtbl->GetId(machine, &iid);
+                if (!iid)
+                    continue;
+                nsIDtoChar(iidl, iid);
+
+                if (memcmp(uuid, iidl, VIR_UUID_BUFLEN) == 0) {
+
+                    PRUint32 state;
+
+                    matched = 1;
+
+                    machine->vtbl->GetName(machine, &machineNameUtf16);
+                    g_pVBoxFuncs->pfnUtf16ToUtf8(machineNameUtf16, &machineName);
+
+                    machine->vtbl->GetState(machine, &state);
+
+                    /* get a new domain pointer from virGetDomain, if it fails
+                     * then no need to assign the id, else assign the id, cause
+                     * it is -1 by default. rest is taken care by virGetDomain
+                     * itself, so need not worry.
+                     */
+
+                    dom = virGetDomain(conn, machineName, iidl);
+                    if (dom)
+                        if ((state == MachineState_Running) ||
+                            (state == MachineState_Paused) )
+                            dom->id = i;
+                }
+
+                if (iid) {
+                    g_pVBoxFuncs->pfnComUnallocMem(iid);
+                    iid = NULL;
+                }
+                if (matched == 1)
+                    break;
+            }
+        }
+
+        /* Do the cleanup and take care you dont leak any memory */
+        if (machineName)
+            g_pVBoxFuncs->pfnUtf8Free(machineName);
+        if (machineNameUtf16)
+            g_pVBoxFuncs->pfnComUnallocMem(machineNameUtf16);
+        for (i = 0; i < machineCnt; ++i) {
+            if (machines[i])
+                machines[i]->vtbl->nsisupports.Release((void *)machines[i]);
+        }
+    }
+
+    return dom;
+}
+
+static int vboxGetDomainSuspend(virDomainPtr dom) {
+    nsresult rc;
+    IMachine *machine = NULL;
+    nsID  *iid        = NULL;
+    IConsole *console = NULL;
+    PRUint32 state;
+    int ret = -1;
+
+    if (VIR_ALLOC(iid) < 0) {
+        virReportOOMError(dom->conn);
+        goto cleanup;
+    }
+
+    if(g_vboxObj) {
+        PRBool isAccessible = PR_FALSE;
+
+        nsIDFromChar(iid, dom->uuid);
+        rc = g_vboxObj->vtbl->GetMachine(g_vboxObj, iid, &machine);
+        if (NS_FAILED(rc)) {
+            vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+                            "no domain with matching id %d", dom->id);
+            goto cleanup;
+        }
+
+        if (!machine)
+            goto cleanup;
+
+        machine->vtbl->GetAccessible(machine, &isAccessible);
+        if (isAccessible) {
+            machine->vtbl->GetState(machine, &state);
+
+            if (state == MachineState_Running) {
+                 /* set state pause */
+                g_vboxObj->vtbl->OpenExistingSession(g_vboxObj, g_vboxSession, iid);
+                g_vboxSession->vtbl->GetConsole(g_vboxSession, &console);
+                if (console) {
+                    console->vtbl->Pause(console);
+                    console->vtbl->nsisupports.Release((void *)console);
+                    ret = 0;
+                } else {
+                    vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+                              "%s", "error while suspend the domain");
+                    goto cleanup;
+                }
+                g_vboxSession->vtbl->Close(g_vboxSession);
+            } else {
+                vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+                          "%s", "machine not in running state to suspend it");
+                goto cleanup;
+            }
+        }
+    }
+
+cleanup:
+    if (machine)
+        machine->vtbl->nsisupports.Release((void *)machine);
+
+    VIR_FREE(iid);
+    return ret;
+}
+
+static int vboxGetDomainResume(virDomainPtr dom) {
+    nsresult rc;
+    IMachine *machine = NULL;
+    nsID  *iid        = NULL;
+    IConsole *console = NULL;
+    PRUint32 state;
+    int ret = -1;
+
+    if (VIR_ALLOC(iid) < 0) {
+        virReportOOMError(dom->conn);
+        goto cleanup;
+    }
+
+    if(g_vboxObj) {
+        PRBool isAccessible = PR_FALSE;
+
+        nsIDFromChar(iid, dom->uuid);
+        rc = g_vboxObj->vtbl->GetMachine(g_vboxObj, iid, &machine);
+        if (NS_FAILED(rc)) {
+            vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+                            "no domain with matching id %d", dom->id);
+            goto cleanup;
+        }
+
+        if (!machine)
+            goto cleanup;
+
+        machine->vtbl->GetAccessible(machine, &isAccessible);
+        if (isAccessible) {
+            machine->vtbl->GetState(machine, &state);
+
+            if (state == MachineState_Paused) {
+                 /* resume the machine here */
+                g_vboxObj->vtbl->OpenExistingSession(g_vboxObj, g_vboxSession, iid);
+                g_vboxSession->vtbl->GetConsole(g_vboxSession, &console);
+                if (console) {
+                    console->vtbl->Resume(console);
+                    console->vtbl->nsisupports.Release((void *)console);
+                    ret = 0;
+                } else {
+                    vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+                              "%s", "error while resuming the domain");
+                    goto cleanup;
+                }
+                g_vboxSession->vtbl->Close(g_vboxSession);
+            } else {
+                vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+                          "%s", "machine not paused, so can't resume it");
+                goto cleanup;
+            }
+        }
+    }
+
+cleanup:
+    if (machine)
+        machine->vtbl->nsisupports.Release((void *)machine);
+
+    VIR_FREE(iid);
+    return ret;
+}
+
+static int vboxGetDomainReboot(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED) {
+    nsresult rc;
+    IMachine *machine = NULL;
+    nsID  *iid        = NULL;
+    IConsole *console = NULL;
+    PRUint32 state;
+    int ret = -1;
+
+    if (VIR_ALLOC(iid) < 0) {
+        virReportOOMError(dom->conn);
+        goto cleanup;
+    }
+
+    if(g_vboxObj) {
+        PRBool isAccessible = PR_FALSE;
+
+        nsIDFromChar(iid, dom->uuid);
+        rc = g_vboxObj->vtbl->GetMachine(g_vboxObj, iid, &machine);
+        if (NS_FAILED(rc)) {
+            vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+                            "no domain with matching id %d", dom->id);
+            goto cleanup;
+        }
+
+        if (!machine)
+            goto cleanup;
+
+        machine->vtbl->GetAccessible(machine, &isAccessible);
+        if (isAccessible) {
+            machine->vtbl->GetState(machine, &state);
+
+            if (state == MachineState_Running) {
+                g_vboxObj->vtbl->OpenExistingSession(g_vboxObj, g_vboxSession, iid);
+                g_vboxSession->vtbl->GetConsole(g_vboxSession, &console);
+                if (console) {
+                    console->vtbl->Reset(console);
+                    console->vtbl->nsisupports.Release((void *)console);
+                    ret = 0;
+                }
+                g_vboxSession->vtbl->Close(g_vboxSession);
+            } else {
+                vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+                          "%s", "machine not running, so can't reboot it");
+                goto cleanup;
+            }
+        }
+    }
+
+cleanup:
+    if (machine)
+        machine->vtbl->nsisupports.Release((void *)machine);
+
+    VIR_FREE(iid);
+    return ret;
+}
+
+static int vboxGetDomainShutdown(virDomainPtr dom) {
+    nsresult rc;
+    IMachine *machine = NULL;
+    nsID  *iid        = NULL;
+    IConsole *console = NULL;
+    PRUint32 state;
+    int ret = -1;
+
+    if (VIR_ALLOC(iid) < 0) {
+        virReportOOMError(dom->conn);
+        goto cleanup;
+    }
+
+    if(g_vboxObj) {
+        PRBool isAccessible = PR_FALSE;
+
+        nsIDFromChar(iid, dom->uuid);
+        rc = g_vboxObj->vtbl->GetMachine(g_vboxObj, iid, &machine);
+        if (NS_FAILED(rc)) {
+            vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+                            "no domain with matching id %d", dom->id);
+            goto cleanup;
+        }
+
+        if (!machine)
+            goto cleanup;
+
+        machine->vtbl->GetAccessible(machine, &isAccessible);
+        if (isAccessible) {
+            machine->vtbl->GetState(machine, &state);
+
+            if (state == MachineState_Paused) {
+                vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+                          "%s", "machine paused, so can't power it down");
+                goto cleanup;
+            } else if (state == MachineState_PoweredOff) {
+                vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+                          "%s", "machine already powered down");
+                goto cleanup;
+            }
+
+            g_vboxObj->vtbl->OpenExistingSession(g_vboxObj, g_vboxSession, iid);
+            g_vboxSession->vtbl->GetConsole(g_vboxSession, &console);
+            if (console) {
+                console->vtbl->PowerButton(console);
+                console->vtbl->nsisupports.Release((void *)console);
+                ret = 0;
+            }
+            g_vboxSession->vtbl->Close(g_vboxSession);
+        }
+    }
+
+cleanup:
+    if (machine)
+        machine->vtbl->nsisupports.Release((void *)machine);
+
+    VIR_FREE(iid);
+    return ret;
+}
+
+static int vboxGetDomainDestroy(virDomainPtr dom) {
+    nsresult rc;
+    IMachine *machine = NULL;
+    nsID  *iid        = NULL;
+    IConsole *console = NULL;
+    PRUint32 state;
+    int ret = -1;
+
+    if (VIR_ALLOC(iid) < 0) {
+        virReportOOMError(dom->conn);
+        goto cleanup;
+    }
+
+    if(g_vboxObj) {
+        PRBool isAccessible = PR_FALSE;
+
+        nsIDFromChar(iid, dom->uuid);
+        rc = g_vboxObj->vtbl->GetMachine(g_vboxObj, iid, &machine);
+        if (NS_FAILED(rc)) {
+            vboxError(dom->conn, VIR_ERR_INVALID_DOMAIN,
+                            "no domain with matching id %d", dom->id);
+            goto cleanup;
+        }
+
+        if (!machine)
+            goto cleanup;
+
+        machine->vtbl->GetAccessible(machine, &isAccessible);
+        if (isAccessible) {
+            machine->vtbl->GetState(machine, &state);
+
+            if (state == MachineState_PoweredOff) {
+                vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+                          "%s", "machine already powered down");
+                goto cleanup;
+            }
+
+            g_vboxObj->vtbl->OpenExistingSession(g_vboxObj, g_vboxSession, iid);
+            g_vboxSession->vtbl->GetConsole(g_vboxSession, &console);
+            if (console) {
+                console->vtbl->PowerDown(console);
+                console->vtbl->nsisupports.Release((void *)console);
+                ret = 0;
+            }
+            g_vboxSession->vtbl->Close(g_vboxSession);
+        }
+    }
+
+cleanup:
+    if (machine)
+        machine->vtbl->nsisupports.Release((void *)machine);
+
+    VIR_FREE(iid);
+    return ret;
+}
+
+static virCapsPtr vboxCapsInit(void) {
+    struct utsname utsname;
+    virCapsPtr caps;
+    virCapsGuestPtr guest;
+
+    uname(&utsname);
+
+    if ((caps = virCapabilitiesNew(utsname.machine,
+                                   0, 0)) == NULL)
+        goto no_memory;
+
+    if (virCapsInitNUMA(caps) < 0)
+        goto no_memory;
+
+    virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x08, 0x00, 0x27 });
+
+    if ((guest = virCapabilitiesAddGuest(caps,
+                                         "hvm",
+                                         utsname.machine,
+                                         sizeof(int) == 4 ? 32 : 64,
+                                         NULL,
+                                         NULL,
+                                         0,
+                                         NULL)) == NULL)
+        goto no_memory;
+
+    if (virCapabilitiesAddGuestDomain(guest,
+                                      "vbox",
+                                      NULL,
+                                      NULL,
+                                      0,
+                                      NULL) == NULL)
+        goto no_memory;
+    return caps;
+
+no_memory:
+    virCapabilitiesFree(caps);
+    return NULL;
+}
+
+static void vboxFreeDriver(struct vbox_driver *driver) {
+    if (!driver)
+        return;
+
+    virDomainObjListFree(&driver->domains);
+    virCapabilitiesFree(driver->caps);
+    VIR_FREE(driver);
+}
+
+static int vboxGetDomainCreate(virDomainPtr dom) {
+    nsresult rc;
+    IMachine **machines = NULL;
+    IProgress *progress = NULL;
+    PRUint32 machineCnt = 0;
+    PRUnichar *env      = NULL;
+    const char *display = getenv("DISPLAY");
+    PRUnichar *sessionType;
+    char displayutf8[32];
+    unsigned char iidl[VIR_UUID_BUFLEN];
+    int i, ret = -1;
+
+
+    if (display) {
+        sprintf(displayutf8, "DISPLAY=%s", display);
+        g_pVBoxFuncs->pfnUtf8ToUtf16(displayutf8, &env);
+    }
+
+    g_pVBoxFuncs->pfnUtf8ToUtf16("gui", &sessionType);
+
+    if (!dom->name) {
+        vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s",
+                  "Error while reading the domain name");
+        goto cleanup;
+    }
+
+    if(g_vboxObj) {
+        rc = g_vboxObj->vtbl->GetMachines(g_vboxObj, &machineCnt, &machines);
+        if (NS_FAILED(rc)) {
+            vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "Could not get list of machines",(unsigned)rc);
+            goto cleanup;
+        }
+
+        for (i = 0; i < machineCnt; ++i) {
+            IMachine *machine = machines[i];
+            PRBool isAccessible = PR_FALSE;
+
+            if (!machine)
+                continue;
+
+            machine->vtbl->GetAccessible(machine, &isAccessible);
+            if (isAccessible) {
+                nsID *iid = NULL;
+
+                machine->vtbl->GetId(machine, &iid);
+                if (!iid)
+                    continue;
+                nsIDtoChar(iidl, iid);
+
+                if (memcmp(dom->uuid, iidl, VIR_UUID_BUFLEN) == 0) {
+                    PRUint32 state;
+                    machine->vtbl->GetState(machine, &state);
+
+                    if ( (state == MachineState_PoweredOff) ||
+                         (state == MachineState_Saved) ||
+                         (state == MachineState_Aborted) ) {
+
+                        g_vboxObj->vtbl->OpenRemoteSession( g_vboxObj,
+                                                            g_vboxSession,
+                                                            iid,
+                                                            sessionType,
+                                                            env,
+                                                            &progress );
+                        if (NS_FAILED(rc)) {
+                            vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+                                      "%s", "openremotesession failed, domain can't be started");
+                            ret = -1;
+                        } else {
+                            PRBool completed;
+                            nsresult resultCode;
+                            progress->vtbl->WaitForCompletion(progress, -1);
+                            rc = progress->vtbl->GetCompleted(progress, &completed);
+                            if (NS_FAILED(rc)) {
+                                /* error */
+                                ret = -1;
+                            }
+                            progress->vtbl->GetResultCode(progress, &resultCode);
+                            if (NS_FAILED(resultCode)) {
+                                /* error */
+                                ret = -1;
+                            } else {
+                                /* all ok set the domid */
+                                dom->id = i;
+                                ret = 0;
+                            }
+                        }
+
+                        if (progress)
+                            progress->vtbl->nsisupports.Release((void *)progress);
+
+                        g_vboxSession->vtbl->Close(g_vboxSession);
+
+                    } else {
+                        vboxError(dom->conn, VIR_ERR_OPERATION_FAILED,
+                                  "%s", "machine is not in poweroff|saved|"
+                                        "aborted state, so couldn't start it");
+                        ret = -1;
+                    }
+                }
+
+                if (iid)
+                    g_pVBoxFuncs->pfnComUnallocMem(iid);
+                if (ret != -1)
+                    break;
+            }
+        }
+
+        /* Do the cleanup and take care you dont leak any memory */
+        for (i = 0; i < machineCnt; ++i) {
+            if (machines[i])
+                machines[i]->vtbl->nsisupports.Release((void *)machines[i]);
+        }
+    }
+
+    g_pVBoxFuncs->pfnUtf16Free(env);
+    g_pVBoxFuncs->pfnUtf16Free(sessionType);
+
+cleanup:
+    return ret;
+}
+
+static virDomainPtr vboxGetDomainDefineXML(virConnectPtr conn, virDomainDefPtr def) {
+    nsresult rc;
+    IMachine *machine   = NULL;
+    IBIOSSettings *bios = NULL;
+    virDomainPtr dom    = NULL;
+    nsID  *iid          = NULL;
+    nsID *mchiid        = NULL;
+    PRUnichar *machineNameUtf16 = NULL;
+
+    if (VIR_ALLOC(iid) < 0) {
+        virReportOOMError(conn);
+        goto cleanup;
+    }
+
+    if (g_vboxObj) {
+        g_pVBoxFuncs->pfnUtf8ToUtf16(def->name, &machineNameUtf16);
+        nsIDFromChar(iid, def->uuid);
+        rc = g_vboxObj->vtbl->CreateMachine(g_vboxObj,
+                                            machineNameUtf16,
+                                            NULL,
+                                            NULL,
+                                            iid,
+                                            &machine);
+        g_pVBoxFuncs->pfnUtf16Free(machineNameUtf16);
+
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "could not define a domain",(unsigned)rc);
+            goto cleanup;
+        }
+
+        rc = machine->vtbl->SetMemorySize(machine, def->memory / 1024);
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%lu Kb, rc=%08x",
+                      "could not set the memory size of the domain to",
+                      def->memory, (unsigned)rc);
+        }
+
+        rc = machine->vtbl->SetCPUCount(machine, def->vcpus);
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%lu, rc=%08x",
+                      "could not set the number of virtual CPUs to",
+                      def->vcpus, (unsigned)rc);
+        }
+
+        rc = machine->vtbl->SetPAEEnabled(machine, (def->features) &
+                                          (1 << VIR_DOMAIN_FEATURE_PAE));
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+                      "could not change PAE status to",
+                      ((def->features) & (1 << VIR_DOMAIN_FEATURE_PAE))
+                      ? "Enabled" : "Disabled", (unsigned)rc);
+        }
+
+        machine->vtbl->GetBIOSSettings(machine, &bios);
+        if (bios) {
+            rc = bios->vtbl->SetACPIEnabled(bios, (def->features) &
+                                            (1 << VIR_DOMAIN_FEATURE_ACPI));
+            if (NS_FAILED(rc)) {
+                vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+                          "could not change ACPI status to",
+                          ((def->features) & (1 << VIR_DOMAIN_FEATURE_ACPI))
+                          ? "Enabled" : "Disabled", (unsigned)rc);
+            }
+            rc = bios->vtbl->SetIOAPICEnabled(bios, (def->features) &
+                                              (1 << VIR_DOMAIN_FEATURE_APIC));
+            if (NS_FAILED(rc)) {
+                vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+                          "could not change APIC status to",
+                          ((def->features) & (1 << VIR_DOMAIN_FEATURE_APIC))
+                          ? "Enabled" : "Disabled", (unsigned)rc);
+            }
+            bios->vtbl->nsisupports.Release((void *)bios);
+        }
+
+        /* Register the machine before attaching other devices to it */
+        rc = g_vboxObj->vtbl->RegisterMachine(g_vboxObj, machine);
+        if (NS_FAILED(rc)) {
+            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
+                      "could not define a domain",(unsigned)rc);
+            goto cleanup;
+        }
+
+        /* Get the uuid of the machine, currently it is immutable
+         * object so open a session to it and get it back, so that
+         * you can make changes to the machine setting
+         */
+        machine->vtbl->GetId(machine, &mchiid);
+        g_vboxObj->vtbl->OpenSession(g_vboxObj, g_vboxSession, mchiid);
+        g_vboxSession->vtbl->GetMachine(g_vboxSession, &machine);
+
+        {   /* Started:Block to set the boot device order */
+            ISystemProperties *systemProperties = NULL;
+            PRUint32 maxBootPosition            = 0;
+            int i = 0;
+
+            DEBUG("def->os.type             %s", def->os.type);
+            DEBUG("def->os.arch             %s", def->os.arch);
+            DEBUG("def->os.machine          %s", def->os.machine);
+            DEBUG("def->os.nBootDevs        %d", def->os.nBootDevs);
+            DEBUG("def->os.bootDevs[0]      %d", def->os.bootDevs[0]);
+            DEBUG("def->os.bootDevs[1]      %d", def->os.bootDevs[1]);
+            DEBUG("def->os.bootDevs[2]      %d", def->os.bootDevs[2]);
+            DEBUG("def->os.bootDevs[3]      %d", def->os.bootDevs[3]);
+            DEBUG("def->os.init             %s", def->os.init);
+            DEBUG("def->os.kernel           %s", def->os.kernel);
+            DEBUG("def->os.initrd           %s", def->os.initrd);
+            DEBUG("def->os.cmdline          %s", def->os.cmdline);
+            DEBUG("def->os.root             %s", def->os.root);
+            DEBUG("def->os.loader           %s", def->os.loader);
+            DEBUG("def->os.bootloader       %s", def->os.bootloader);
+            DEBUG("def->os.bootloaderArgs   %s", def->os.bootloaderArgs);
+
+            g_vboxObj->vtbl->GetSystemProperties(g_vboxObj, &systemProperties);
+            if (systemProperties) {
+                systemProperties->vtbl->GetMaxBootPosition(systemProperties, &maxBootPosition);
+                systemProperties->vtbl->nsisupports.Release((void *)systemProperties);
+            }
+
+            for (i = 0; (i < def->os.nBootDevs) && (i < maxBootPosition); i++) {
+                PRUint32 device = DeviceType_Null;
+
+                if (def->os.bootDevs[i] == VIR_DOMAIN_BOOT_FLOPPY) {
+                    device = DeviceType_Floppy;
+                } else if (def->os.bootDevs[i] == VIR_DOMAIN_BOOT_CDROM) {
+                    device = DeviceType_DVD;
+                } else if (def->os.bootDevs[i] == VIR_DOMAIN_BOOT_DISK) {
+                    device = DeviceType_HardDisk;
+                } else if (def->os.bootDevs[i] == VIR_DOMAIN_BOOT_NET) {
+                    device = DeviceType_Network;
+                }
+                machine->vtbl->SetBootOrder(machine, i+1, device);
+            }
+        }   /* Finished:Block to set the boot device order */
+
+        {   /* Started:Block to attach the CDROM/DVD Drive and HardDisks to the VM */
+
+            if (def->ndisks > 0) {
+                int i;
+
+                for (i = 0; i < def->ndisks; i++) {
+                    DEBUG("disk(%d) type:       %d", i, def->disks[i]->type);
+                    DEBUG("disk(%d) device:     %d", i, def->disks[i]->device);
+                    DEBUG("disk(%d) bus:        %d", i, def->disks[i]->bus);
+                    DEBUG("disk(%d) src:        %s", i, def->disks[i]->src);
+                    DEBUG("disk(%d) dst:        %s", i, def->disks[i]->dst);
+                    DEBUG("disk(%d) driverName: %s", i, def->disks[i]->driverName);
+                    DEBUG("disk(%d) driverType: %s", i, def->disks[i]->driverType);
+                    DEBUG("disk(%d) cachemode:  %d", i, def->disks[i]->cachemode);
+                    DEBUG("disk(%d) readonly:   %s", i, def->disks[i]->readonly ? "True" : "False");
+                    DEBUG("disk(%d) shared:     %s", i, def->disks[i]->shared ? "True" : "False");
+                    DEBUG("disk(%d) slotnum:    %d", i, def->disks[i]->slotnum);
+
+                    if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
+                        if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_FILE) {
+                            IDVDDrive *dvdDrive = NULL;
+                            /* Currently CDROM/DVD Drive is always IDE
+                             * Secondary Master so neglecting the following
+                             * parameters:
+                             *      def->disks[i]->bus
+                             *      def->disks[i]->dst
+                             */
+
+                            machine->vtbl->GetDVDDrive(machine, &dvdDrive);
+                            if (dvdDrive) {
+                                IDVDImage *dvdImage     = NULL;
+                                PRUnichar *dvdfileUtf16 = NULL;
+                                nsID *dvduuid           = NULL;
+                                nsID dvdemptyuuid;
+
+                                memset(&dvdemptyuuid, 0, sizeof(dvdemptyuuid));
+
+                                g_pVBoxFuncs->pfnUtf8ToUtf16(def->disks[i]->src, &dvdfileUtf16);
+
+                                g_vboxObj->vtbl->FindDVDImage(g_vboxObj, dvdfileUtf16, &dvdImage);
+                                if (!dvdImage) {
+                                    g_vboxObj->vtbl->OpenDVDImage(g_vboxObj, dvdfileUtf16, &dvdemptyuuid, &dvdImage);
+                                }
+                                if (dvdImage) {
+                                    rc = dvdImage->vtbl->imedium.GetId((void *)dvdImage, &dvduuid);
+                                    if (NS_FAILED(rc)) {
+                                        vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+                                                  "can't get the uuid of the file to be attached to cdrom",
+                                                  def->disks[i]->src, (unsigned)rc);
+                                    } else {
+                                        rc = dvdDrive->vtbl->MountImage(dvdDrive, dvduuid);
+                                        if (NS_FAILED(rc)) {
+                                            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+                                                      "could not attach the file to cdrom",
+                                                      def->disks[i]->src, (unsigned)rc);
+                                        } else {
+                                            DEBUG("CD/DVDImage UUID:{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+                                            (unsigned)dvduuid->m0,    (unsigned)dvduuid->m1, (unsigned)dvduuid->m2,
+                                            (unsigned)dvduuid->m3[0], (unsigned)dvduuid->m3[1],
+                                            (unsigned)dvduuid->m3[2], (unsigned)dvduuid->m3[3],
+                                            (unsigned)dvduuid->m3[4], (unsigned)dvduuid->m3[5],
+                                            (unsigned)dvduuid->m3[6], (unsigned)dvduuid->m3[7]);
+                                        }
+                                        g_pVBoxFuncs->pfnComUnallocMem(dvduuid);
+                                    }
+
+                                    dvdImage->vtbl->imedium.nsisupports.Release((void *)dvdImage);
+                                }
+                                g_pVBoxFuncs->pfnUtf16Free(dvdfileUtf16);
+                                dvdDrive->vtbl->nsisupports.Release((void *)dvdDrive);
+                            }
+                        } else if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
+                        }
+                    } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
+                        if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_FILE) {
+                            IHardDisk *hardDisk     = NULL;
+                            PRUnichar *hddfileUtf16 = NULL;
+                            nsID *hdduuid           = NULL;
+                            /* Current Limitation: Harddisk can't be connected to
+                             * Secondary Master as Secondary Master is always used
+                             * for CD/DVD Drive, so not connect the harddisk if it
+                             * is requested to be connected to Secondary master
+                             */
+
+                            g_pVBoxFuncs->pfnUtf8ToUtf16(def->disks[i]->src, &hddfileUtf16);
+
+                            g_vboxObj->vtbl->FindHardDisk(g_vboxObj, hddfileUtf16, &hardDisk);
+
+                            if (!hardDisk) {
+                                g_vboxObj->vtbl->OpenHardDisk(g_vboxObj, hddfileUtf16, &hardDisk);
+                            }
+
+                            if (hardDisk) {
+                                rc = hardDisk->vtbl->imedium.GetId((void *)hardDisk, &hdduuid);
+                                if (NS_FAILED(rc)) {
+                                    vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+                                              "can't get the uuid of the file to be attached as harddisk",
+                                              def->disks[i]->src, (unsigned)rc);
+                                } else {
+                                    if (def->disks[i]->readonly) {
+                                        hardDisk->vtbl->SetType(hardDisk, HardDiskType_Immutable);
+                                        DEBUG0("setting harddisk to readonly");
+                                    } else if (!def->disks[i]->readonly) {
+                                        hardDisk->vtbl->SetType(hardDisk, HardDiskType_Normal);
+                                        DEBUG0("setting harddisk type to normal");
+                                    }
+                                    if (def->disks[i]->bus == VIR_DOMAIN_DISK_BUS_IDE) {
+                                        if (STREQ(def->disks[i]->dst, "hdc")) {
+                                            DEBUG0("Not connecting harddisk to hdc as hdc"
+                                                   " is taken by CD/DVD Drive");
+                                        } else {
+                                            PRInt32 channel          = 0;
+                                            PRInt32 device           = 0;
+                                            PRUnichar *hddcnameUtf16 = NULL;
+
+                                            char *hddcname = strdup("IDE");
+                                            g_pVBoxFuncs->pfnUtf8ToUtf16(hddcname, &hddcnameUtf16);
+                                            VIR_FREE(hddcname);
+
+                                            if (STREQ(def->disks[i]->dst, "hda")) {
+                                                channel = 0;
+                                                device  = 0;
+                                            } else if (STREQ(def->disks[i]->dst, "hdb")) {
+                                                channel = 0;
+                                                device  = 1;
+                                            } else if (STREQ(def->disks[i]->dst, "hdd")) {
+                                                channel = 1;
+                                                device  = 1;
+                                            }
+
+                                            rc = machine->vtbl->AttachHardDisk(machine, hdduuid,
+                                                                               hddcnameUtf16,
+                                                                               channel, device);
+                                            g_pVBoxFuncs->pfnUtf16Free(hddcnameUtf16);
+
+                                            if (NS_FAILED(rc)) {
+                                                vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+                                                          "could not attach the file as harddisk",
+                                                          def->disks[i]->src, (unsigned)rc);
+                                            } else {
+                                                DEBUG("Attached HDD with UUID:"
+                                                      "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+                                                (unsigned)hdduuid->m0,    (unsigned)hdduuid->m1,
+                                                (unsigned)hdduuid->m2,
+                                                (unsigned)hdduuid->m3[0], (unsigned)hdduuid->m3[1],
+                                                (unsigned)hdduuid->m3[2], (unsigned)hdduuid->m3[3],
+                                                (unsigned)hdduuid->m3[4], (unsigned)hdduuid->m3[5],
+                                                (unsigned)hdduuid->m3[6], (unsigned)hdduuid->m3[7]);
+                                            }
+                                        }
+                                    }
+                                    g_pVBoxFuncs->pfnComUnallocMem(hdduuid);
+                                }
+                                hardDisk->vtbl->imedium.nsisupports.Release((void *)hardDisk);
+                            }
+                            g_pVBoxFuncs->pfnUtf16Free(hddfileUtf16);
+                        } else if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
+                        }
+                    } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
+                        if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_FILE) {
+                            IFloppyDrive *floppyDrive;
+                            machine->vtbl->GetFloppyDrive(machine, &floppyDrive);
+                            if (floppyDrive) {
+                                rc = floppyDrive->vtbl->SetEnabled(floppyDrive, 1);
+                                if (NS_SUCCEEDED(rc)) {
+                                    IFloppyImage *floppyImage = NULL;
+                                    PRUnichar *fdfileUtf16    = NULL;
+                                    nsID *fduuid              = NULL;
+                                    nsID fdemptyuuid;
+
+                                    memset(&fdemptyuuid, 0, sizeof(fdemptyuuid));
+
+                                    g_pVBoxFuncs->pfnUtf8ToUtf16(def->disks[i]->src, &fdfileUtf16);
+                                    rc = g_vboxObj->vtbl->FindFloppyImage(g_vboxObj, fdfileUtf16,
+                                                                          &floppyImage);
+
+                                    if (!floppyImage) {
+                                        g_vboxObj->vtbl->OpenFloppyImage(g_vboxObj, fdfileUtf16,
+                                                                         &fdemptyuuid, &floppyImage);
+                                    }
+
+                                    if (floppyImage) {
+                                        rc = floppyImage->vtbl->imedium.GetId((void *)floppyImage, &fduuid);
+                                        if (NS_FAILED(rc)) {
+                                            vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+                                                      "can't get the uuid of the file to be attached to floppy drive",
+                                                      def->disks[i]->src, (unsigned)rc);
+                                        } else {
+                                            rc = floppyDrive->vtbl->MountImage(floppyDrive, fduuid);
+                                            if (NS_FAILED(rc)) {
+                                                vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s:%s, rc=%08x",
+                                                          "could not attach the file to floppy drive",
+                                                          def->disks[i]->src, (unsigned)rc);
+                                            } else {
+                                                DEBUG("floppyImage UUID:"
+                                                      "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+                                                (unsigned)fduuid->m0,    (unsigned)fduuid->m1,
+                                                (unsigned)fduuid->m2,
+                                                (unsigned)fduuid->m3[0], (unsigned)fduuid->m3[1],
+                                                (unsigned)fduuid->m3[2], (unsigned)fduuid->m3[3],
+                                                (unsigned)fduuid->m3[4], (unsigned)fduuid->m3[5],
+                                                (unsigned)fduuid->m3[6], (unsigned)fduuid->m3[7]);
+                                            }
+                                            g_pVBoxFuncs->pfnComUnallocMem(fduuid);
+                                        }
+                                        floppyImage->vtbl->imedium.nsisupports.Release((void *)floppyImage);
+                                    }
+                                    g_pVBoxFuncs->pfnUtf16Free(fdfileUtf16);
+                                }
+                                floppyDrive->vtbl->nsisupports.Release((void *)floppyDrive);
+                            }
+                        } else if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
+                        }
+                    }
+                }
+            }
+
+        }   /* Finished:Block to attach the CDROM/DVD Drive and HardDisks to the VM */
+
+        {   /* Started:Block to attach the Sound Controller to the VM */
+            if (def->nsounds == 1) {
+                IAudioAdapter *audioAdapter = NULL;
+
+                machine->vtbl->GetAudioAdapter(machine, &audioAdapter);
+                if (audioAdapter) {
+                    rc = audioAdapter->vtbl->SetEnabled(audioAdapter, 1);
+                    if (NS_SUCCEEDED(rc)) {
+                        if (def->sounds[0]->model == VIR_DOMAIN_SOUND_MODEL_SB16) {
+                            audioAdapter->vtbl->SetAudioController(audioAdapter, AudioControllerType_SB16);
+                        } else if (def->sounds[0]->model == VIR_DOMAIN_SOUND_MODEL_ES97) {
+                            audioAdapter->vtbl->SetAudioController(audioAdapter, AudioControllerType_AC97);
+                        }
+                    }
+                    audioAdapter->vtbl->nsisupports.Release((void *)audioAdapter);
+                }
+            }
+        }   /* Finished:Block to attach the Sound Controller to the VM */
+
+        {   /* Started:Block to attach the Network Card to the VM */
+            ISystemProperties *systemProperties = NULL;
+            PRUint32 networkAdapterCount        = 0;
+            int i = 0;
+
+            g_vboxObj->vtbl->GetSystemProperties(g_vboxObj, &systemProperties);
+            if (systemProperties) {
+                systemProperties->vtbl->GetNetworkAdapterCount(systemProperties, &networkAdapterCount);
+                systemProperties->vtbl->nsisupports.Release((void *)systemProperties);
+            }
+
+            DEBUG("Number of Network Cards to be connected: %d", def->nnets);
+            DEBUG("Number of Network Cards available: %d", networkAdapterCount);
+
+            for (i = 0; (i < def->nnets) && (i < networkAdapterCount); i++) {
+                INetworkAdapter *adapter = NULL;
+                PRUint32 adapterType     = NetworkAdapterType_Null;
+                char macaddr[VIR_MAC_STRING_BUFLEN] = {0};
+                char macaddrvbox[VIR_MAC_STRING_BUFLEN - 5] = {0};
+
+                virFormatMacAddr(def->nets[i]->mac, macaddr);
+                snprintf(macaddrvbox, VIR_MAC_STRING_BUFLEN - 5,
+                         "%02X%02X%02X%02X%02X%02X",
+                         def->nets[i]->mac[0],
+                         def->nets[i]->mac[1],
+                         def->nets[i]->mac[2],
+                         def->nets[i]->mac[3],
+                         def->nets[i]->mac[4],
+                         def->nets[i]->mac[5]);
+                macaddrvbox[VIR_MAC_STRING_BUFLEN - 6] = '\0';
+
+                DEBUG("NIC(%d): Type:   %d", i, def->nets[i]->type);
+                DEBUG("NIC(%d): Model:  %s", i, def->nets[i]->model);
+                DEBUG("NIC(%d): Mac:    %s", i, macaddr);
+                DEBUG("NIC(%d): ifname: %s", i, def->nets[i]->ifname);
+                if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_ETHERNET) {
+                    DEBUG("NIC(%d): dev:    %s", i, def->nets[i]->data.ethernet.dev);
+                    DEBUG("NIC(%d): script: %s", i, def->nets[i]->data.ethernet.script);
+                    DEBUG("NIC(%d): ipaddr: %s", i, def->nets[i]->data.ethernet.ipaddr);
+                } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
+                    DEBUG("NIC(%d): name:   %s", i, def->nets[i]->data.network.name);
+                } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
+                    DEBUG("NIC(%d): brname: %s", i, def->nets[i]->data.bridge.brname);
+                    DEBUG("NIC(%d): script: %s", i, def->nets[i]->data.bridge.script);
+                    DEBUG("NIC(%d): ipaddr: %s", i, def->nets[i]->data.bridge.ipaddr);
+                }
+
+                machine->vtbl->GetNetworkAdapter(machine, i, &adapter);
+                if (adapter) {
+                    PRUnichar *MACAddress      = NULL;
+                    PRUnichar *hostInterface   = NULL;
+                    PRUnichar *internalNetwork = NULL;
+
+                    adapter->vtbl->SetEnabled(adapter, 1);
+
+                    if (STRCASEEQ(def->nets[i]->model , "Am79C970A")) {
+                        adapterType = NetworkAdapterType_Am79C970A;
+                    } else if (STRCASEEQ(def->nets[i]->model , "Am79C973")) {
+                        adapterType = NetworkAdapterType_Am79C973;
+                    } else if (STRCASEEQ(def->nets[i]->model , "82540EM")) {
+                        adapterType = NetworkAdapterType_I82540EM;
+                    } else if (STRCASEEQ(def->nets[i]->model , "82543GC")) {
+                        adapterType = NetworkAdapterType_I82543GC;
+                    }
+
+                    adapter->vtbl->SetAdapterType(adapter, adapterType);
+
+                    if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
+                        /* Bridged Network */
+
+                        adapter->vtbl->AttachToBridgedInterface(adapter);
+
+                        if (def->nets[i]->data.bridge.brname) {
+                            g_pVBoxFuncs->pfnUtf8ToUtf16(def->nets[i]->data.bridge.brname, &hostInterface);
+                            adapter->vtbl->SetHostInterface(adapter, hostInterface);
+                            g_pVBoxFuncs->pfnUtf16Free(hostInterface);
+                        }
+                    } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
+                        /* Internal Network */
+
+                        adapter->vtbl->AttachToInternalNetwork(adapter);
+
+                        if (def->nets[i]->data.network.name) {
+                            g_pVBoxFuncs->pfnUtf8ToUtf16(def->nets[i]->data.network.name, &internalNetwork);
+                            adapter->vtbl->SetInternalNetwork(adapter, internalNetwork);
+                            g_pVBoxFuncs->pfnUtf16Free(internalNetwork);
+                        }
+                    } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_USER) {
+                        /* NAT */
+                        adapter->vtbl->AttachToNAT(adapter);
+                    } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_ETHERNET) {
+                        /* Host Only Networking (currently only vboxnet0 available
+                         * on *nix and mac, on windows you can create and configure
+                         * as many as you want)
+                         */
+                        adapter->vtbl->AttachToHostOnlyInterface(adapter);
+
+                        if (def->nets[i]->data.ethernet.dev) {
+                            g_pVBoxFuncs->pfnUtf8ToUtf16(def->nets[i]->data.ethernet.dev, &hostInterface);
+                            adapter->vtbl->SetHostInterface(adapter, hostInterface);
+                            g_pVBoxFuncs->pfnUtf16Free(hostInterface);
+                        }
+                    }
+
+                    g_pVBoxFuncs->pfnUtf8ToUtf16(macaddrvbox, &MACAddress);
+                    if (def->nets[i]->mac) {
+                        adapter->vtbl->SetMACAddress(adapter, MACAddress);
+                    }
+                    g_pVBoxFuncs->pfnUtf16Free(MACAddress);
+                }
+            }
+        }   /* Finished:Block to attach the Network Card to the VM */
+
+        {   /* Started:Block to attach the Serial Port to the VM */
+            ISystemProperties *systemProperties = NULL;
+            PRUint32 serialPortCount            = 0;
+            int i = 0;
+
+            g_vboxObj->vtbl->GetSystemProperties(g_vboxObj, &systemProperties);
+            if (systemProperties) {
+                systemProperties->vtbl->GetSerialPortCount(systemProperties, &serialPortCount);
+                systemProperties->vtbl->nsisupports.Release((void *)systemProperties);
+            }
+
+            DEBUG("Number of Serial Ports to be connected: %d", def->nserials);
+            DEBUG("Number of Serial Ports available: %d", serialPortCount);
+            for (i = 0; (i < def->nserials) && (i < serialPortCount); i++) {
+                ISerialPort *serialPort = NULL;
+
+                DEBUG("SerialPort(%d): Type: %d", i, def->serials[i]->type);
+                DEBUG("SerialPort(%d): dstPort: %d", i, def->serials[i]->dstPort);
+
+                machine->vtbl->GetSerialPort(machine, i, &serialPort);
+                if (serialPort) {
+                    PRUnichar *pathUtf16 = NULL;
+
+                    serialPort->vtbl->SetEnabled(serialPort, 1);
+                    g_pVBoxFuncs->pfnUtf8ToUtf16(def->serials[i]->data.file.path, &pathUtf16);
+
+                    /* For now hard code the serial ports to COM1 and COM2,
+                     * COM1 (Base Addr: 0x3F8 (decimal: 1016), IRQ: 4)
+                     * COM2 (Base Addr: 0x2F8 (decimal:  760), IRQ: 3)
+                     * TODO: make this more flexible
+                     */
+                    if (def->serials[i]->type == VIR_DOMAIN_CHR_TYPE_DEV) {
+                        serialPort->vtbl->SetPath(serialPort, pathUtf16);
+                        if (i == 0) {
+                            serialPort->vtbl->SetIRQ(serialPort, 4);
+                            serialPort->vtbl->SetIOBase(serialPort, 1016);
+                        } else if (i == 1) {
+                            serialPort->vtbl->SetIRQ(serialPort, 3);
+                            serialPort->vtbl->SetIOBase(serialPort, 760);
+                        }
+                        serialPort->vtbl->SetHostMode(serialPort, PortMode_HostDevice);
+                    } else if (def->serials[i]->type == VIR_DOMAIN_CHR_TYPE_PIPE) {
+                        serialPort->vtbl->SetPath(serialPort, pathUtf16);
+                        if (i == 0) {
+                            serialPort->vtbl->SetIRQ(serialPort, 4);
+                            serialPort->vtbl->SetIOBase(serialPort, 1016);
+                        } else if (i == 1) {
+                            serialPort->vtbl->SetIRQ(serialPort, 3);
+                            serialPort->vtbl->SetIOBase(serialPort, 760);
+                        }
+                        if (!virFileExists(def->serials[i]->data.file.path)) {
+                            serialPort->vtbl->SetServer(serialPort, 1);
+                        }
+                        serialPort->vtbl->SetHostMode(serialPort, PortMode_HostPipe);
+                    } else if (def->serials[i]->type == VIR_DOMAIN_CHR_TYPE_NULL) {
+                        serialPort->vtbl->SetHostMode(serialPort, PortMode_Disconnected);
+                    }
+
+                    serialPort->vtbl->nsisupports.Release((void *)serialPort);
+                    if (pathUtf16) {
+                        g_pVBoxFuncs->pfnUtf16Free(pathUtf16);
+                        pathUtf16 = NULL;
+                    }
+                }
+            }
+        }   /* Finished:Block to attach the Serial Port to the VM */
+
+        {   /* Started:Block to attach the Parallel Port to the VM */
+            ISystemProperties *systemProperties = NULL;
+            PRUint32 parallelPortCount          = 0;
+            int i = 0;
+
+            g_vboxObj->vtbl->GetSystemProperties(g_vboxObj, &systemProperties);
+            if (systemProperties) {
+                systemProperties->vtbl->GetParallelPortCount(systemProperties, &parallelPortCount);
+                systemProperties->vtbl->nsisupports.Release((void *)systemProperties);
+            }
+
+            DEBUG("Number of Parallel Ports to be connected: %d", def->nparallels);
+            DEBUG("Number of Parallel Ports available: %d", parallelPortCount);
+            for (i = 0; (i < def->nparallels) && (i < parallelPortCount); i++) {
+                IParallelPort *parallelPort = NULL;
+
+                DEBUG("ParallelPort(%d): Type: %d", i, def->parallels[i]->type);
+                DEBUG("ParallelPort(%d): dstPort: %d", i, def->parallels[i]->dstPort);
+
+                machine->vtbl->GetParallelPort(machine, i, &parallelPort);
+                if (parallelPort) {
+                    PRUnichar *pathUtf16 = NULL;
+
+                    parallelPort->vtbl->SetEnabled(parallelPort, 1);
+                    g_pVBoxFuncs->pfnUtf8ToUtf16(def->parallels[i]->data.file.path, &pathUtf16);
+
+                    /* For now hard code the parallel ports to
+                     * LPT1 (Base Addr: 0x378 (decimal: 888), IRQ: 7)
+                     * LPT2 (Base Addr: 0x278 (decimal: 632), IRQ: 5)
+                     * TODO: make this more flexible
+                     */
+                    if (def->parallels[i]->type == VIR_DOMAIN_CHR_TYPE_DEV) {
+                        parallelPort->vtbl->SetPath(parallelPort, pathUtf16);
+                        if (i == 0) {
+                            parallelPort->vtbl->SetIRQ(parallelPort, 7);
+                            parallelPort->vtbl->SetIOBase(parallelPort, 888);
+                        } else if (i == 1) {
+                            parallelPort->vtbl->SetIRQ(parallelPort, 5);
+                            parallelPort->vtbl->SetIOBase(parallelPort, 632);
+                        }
+                    }
+
+                    parallelPort->vtbl->nsisupports.Release((void *)parallelPort);
+                    if (pathUtf16) {
+                        g_pVBoxFuncs->pfnUtf16Free(pathUtf16);
+                        pathUtf16 = NULL;
+                    }
+                }
+            }
+        }   /* Finished:Block to attach the Parallel Port to the VM */
+
+        /* Save the machine settings made till now and close the
+         * session. also free up the mchiid variable used.
+         */
+        rc = machine->vtbl->SaveSettings(machine);
+        g_vboxSession->vtbl->Close(g_vboxSession);
+        g_pVBoxFuncs->pfnComUnallocMem(mchiid);
+
+        /* get a new domain pointer from virGetDomain, if it fails
+         * then no need to assign the id, else assign the id, cause
+         * it is -1 by default. rest is taken care by virGetDomain
+         * itself, so need not worry.
+         */
+
+        dom = virGetDomain(conn, def->name, def->uuid);
+        if(machine) {
+            machine->vtbl->nsisupports.Release((void *)machine);
+            machine = NULL;
+        }
+    }
+
+    VIR_FREE(iid);
+
+    return dom;
+
+cleanup:
+    if(machine)
+        machine->vtbl->nsisupports.Release((void *)machine);
+    VIR_FREE(iid);
+    return NULL;
+}
+
+static int vboxGetDomainUndefine(virDomainPtr dom) {
+    nsresult rc;
+    IMachine *machine = NULL;
+    nsID *iid         = NULL;
+    int ret = -1;
+
+    if (VIR_ALLOC(iid) < 0) {
+        virReportOOMError(dom->conn);
+        goto cleanup;
+    }
+
+    if(g_vboxObj) {
+        nsIDFromChar(iid, dom->uuid);
+
+        /* Block for checking if HDD's are attched to VM.
+         * considering just IDE bus for now. Also skipped
+         * chanel=1 and device=0 (Secondary Master) as currenlty
+         * it is allocated to CD/DVD Drive bt default
+         */
+        {
+            PRUnichar *hddcnameUtf16 = NULL;
+
+            char *hddcname = strdup("IDE");
+            g_pVBoxFuncs->pfnUtf8ToUtf16(hddcname, &hddcnameUtf16);
+            VIR_FREE(hddcname);
+
+            /* Open a Session for the machine */
+            rc = g_vboxObj->vtbl->OpenSession(g_vboxObj, g_vboxSession, iid);
+            if (NS_SUCCEEDED(rc)) {
+                rc = g_vboxSession->vtbl->GetMachine(g_vboxSession, &machine);
+                if (NS_SUCCEEDED(rc) && machine) {
+
+                    /* Disconnect all the drives if present */
+                    machine->vtbl->DetachHardDisk(machine, hddcnameUtf16, 0, 0);
+                    machine->vtbl->DetachHardDisk(machine, hddcnameUtf16, 0, 1);
+                    machine->vtbl->DetachHardDisk(machine, hddcnameUtf16, 1, 1);
+
+                    machine->vtbl->SaveSettings(machine);
+                }
+                g_vboxSession->vtbl->Close(g_vboxSession);
+            }
+            g_pVBoxFuncs->pfnUtf16Free(hddcnameUtf16);
+        }
+
+        rc = g_vboxObj->vtbl->UnregisterMachine(g_vboxObj, iid, &machine);
+        DEBUG("UUID of machine being undefine:{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+        (unsigned)iid->m0,    (unsigned)iid->m1, (unsigned)iid->m2,
+        (unsigned)iid->m3[0], (unsigned)iid->m3[1],
+        (unsigned)iid->m3[2], (unsigned)iid->m3[3],
+        (unsigned)iid->m3[4], (unsigned)iid->m3[5],
+        (unsigned)iid->m3[6], (unsigned)iid->m3[7]);
+
+        if (NS_SUCCEEDED(rc) && machine){
+            machine->vtbl->DeleteSettings((void *)machine);
+            ret = 0;
+        }
+    }
+
+cleanup:
+    if (machine)
+        machine->vtbl->nsisupports.Release((void *)machine);
+
+    VIR_FREE(iid);
+    return ret;
+}
+
+/* All the code below this point onwards is directly
+ * taken from the previous version of the file vbox_driver.c
+ * Need to properly integrate it with the code above so
+ * that things are in sync.
+ */
+
+static void vboxDriverLock(struct vbox_driver *driver) {
+    virMutexLock(&driver->lock);
+}
+
+static void vboxDriverUnlock(struct vbox_driver *driver) {
+    virMutexUnlock(&driver->lock);
+}
+
+static int vboxGetVersion(virConnectPtr conn, unsigned long *version) {
+    struct  vbox_driver *driver = conn->privateData;
+    DEBUG("%s: in vboxGetVersion",conn->driver->name);
+
+    vboxDriverLock(driver);
+    *version = driver->version;
+    vboxDriverUnlock(driver);
+
+    return 0;
+}
+
+static virDrvOpenStatus vboxOpen(virConnectPtr conn,
+                                   virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+                                   int flags ATTRIBUTE_UNUSED) {
+    struct vbox_driver *driver;
+    uid_t uid = getuid();
+
+    if (vboxInitialize(conn) < 0)
+        return VIR_DRV_OPEN_DECLINED;
+
+    if (conn->uri == NULL) {
+        conn->uri = xmlParseURI(uid ? "vbox:///session" : "vbox:///system");
+        if (conn->uri == NULL) {
+            vboxError(conn, VIR_ERR_NO_DOMAIN, NULL);
+            return VIR_DRV_OPEN_ERROR;
+        }
+    } else if (conn->uri->scheme == NULL ||
+               conn->uri->path == NULL ) {
+        return VIR_DRV_OPEN_DECLINED;
+    }
+
+    if (STRNEQ (conn->uri->scheme, "vbox"))
+        return VIR_DRV_OPEN_DECLINED;
+
+    if (uid != 0) {
+        if (STRNEQ (conn->uri->path, "/session"))
+            return VIR_DRV_OPEN_DECLINED;
+    } else { /* root */
+        if (STRNEQ (conn->uri->path, "/system") &&
+            STRNEQ (conn->uri->path, "/session"))
+            return VIR_DRV_OPEN_DECLINED;
+    }
+
+    if (VIR_ALLOC(driver) < 0) {
+        virReportOOMError(conn);
+        return VIR_DRV_OPEN_ERROR;
+    }
+
+    if (!(driver->caps = vboxCapsInit()))
+        goto cleanup;
+
+    if (vboxExtractVersion(conn, driver) < 0)
+        return VIR_DRV_OPEN_ERROR;
+
+    conn->privateData = driver;
+    DEBUG0("VBOX: in vboxOpen");
+
+    return VIR_DRV_OPEN_SUCCESS;
+cleanup:
+    vboxFreeDriver(driver);
+    return VIR_DRV_OPEN_ERROR;
+};
+
+static int vboxClose(virConnectPtr conn) {
+    struct vbox_driver *driver = conn->privateData;
+    DEBUG("%s: in vboxClose",conn->driver->name);
+
+    vboxFreeDriver(driver);
+    vboxUninitialize();
+    conn->privateData = NULL;
+
+    return 0;
+}
+
+static const char *vboxGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
+    DEBUG("%s: in vboxGetType",conn->driver->name);
+    return strdup("VBox");
+}
+
+#ifdef VBOX_TURNED_OFF_FOR_NOW
+static virDrvOpenStatus vboxOpenNetwork(virConnectPtr conn,
+                                        virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+                                        int flags ATTRIBUTE_UNUSED) {
+    DEBUG("%s: in vboxOpenNetwork",conn->driver->name);
+    if (STRNEQ(conn->driver->name, "VBOX"))
+        return VIR_DRV_OPEN_DECLINED;
+
+    conn->networkPrivateData = conn->privateData;
+    return VIR_DRV_OPEN_SUCCESS;
+}
+
+static int vboxCloseNetwork(virConnectPtr conn) {
+    DEBUG("%s: in vboxCloseNetwork",conn->driver->name);
+    conn->networkPrivateData = NULL;
+    return 0;
+}
+
+static virDrvOpenStatus vboxStorageOpen(virConnectPtr conn,
+                                        virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+                                        int flags ATTRIBUTE_UNUSED) {
+    DEBUG("%s: in vboxStorageOpen",conn->driver->name);
+    if (STRNEQ(conn->driver->name, "VBOX"))
+        return VIR_DRV_OPEN_DECLINED;
+
+    conn->storagePrivateData = conn->privateData;
+    return VIR_DRV_OPEN_SUCCESS;
+}
+
+static int vboxStorageClose(virConnectPtr conn) {
+    DEBUG("%s: in vboxStorageClose",conn->driver->name);
+    conn->storagePrivateData = NULL;
+    return 0;
+}
+
+static virDrvOpenStatus vboxDevMonOpen(virConnectPtr conn,
+                                       virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+                                       int flags ATTRIBUTE_UNUSED) {
+    DEBUG("%s: in vboxDevMonOpen",conn->driver->name);
+    if (STRNEQ(conn->driver->name, "VBOX"))
+        return VIR_DRV_OPEN_DECLINED;
+
+    conn->devMonPrivateData = conn->privateData;
+    return VIR_DRV_OPEN_SUCCESS;
+}
+
+static int vboxDevMonClose(virConnectPtr conn) {
+    DEBUG("%s: in vboxDevMonClose",conn->driver->name);
+    conn->devMonPrivateData = NULL;
+    return 0;
+}
+#endif /* VBOX_TURNED_OFF_FOR_NOW */
+
+static int vboxNumOfDomains(virConnectPtr conn) {
+    int active = 0;
+
+    active = vboxGetNumOfDomains(conn);
+
+    DEBUG("%s:NumOfDomains: %d", conn->driver->name, active);
+
+    return active;
+}
+
+static int vboxNumOfDefinedDomains(virConnectPtr conn) {
+    int inactive = 0;
+
+    inactive = vboxGetNumOfDefinedDomains(conn);
+
+    DEBUG("%s:NumOfDefinedDomains: %d", conn->driver->name, inactive);
+
+    return inactive;
+}
+
+static int vboxListDomains(virConnectPtr conn, int *ids, int nids) {
+    int active = 0;
+
+    active = vboxGetListDomains(conn, ids, nids);
+
+    DEBUG("%s:ListDomains: %d", conn->driver->name, active);
+
+    return active;
+}
+
+static int vboxListDefinedDomains(virConnectPtr conn,
+                                  char ** const names, int maxnames) {
+    int inactive = 0;
+
+    inactive = vboxGetListDefinedDomains(conn, names, maxnames);
+
+    DEBUG("%s:ListDefinedDomains: %d", conn->driver->name, inactive);
+
+    return inactive;
+}
+
+static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) {
+    struct  vbox_driver *driver = conn->privateData;
+    virDomainPtr cdomain = NULL;
+
+    vboxDriverLock(driver);
+    cdomain = vboxGetDomainLookupByID(conn, id);
+    vboxDriverUnlock(driver);
+
+    DEBUG("%s:DomainLookupByID", conn->driver->name);
+
+    return cdomain;
+}
+
+static virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn,
+                                           const unsigned char *uuid) {
+    struct  vbox_driver *driver = conn->privateData;
+    virDomainPtr cdomain = NULL;
+
+    vboxDriverLock(driver);
+    cdomain = vboxGetDomainLookupByUUID(conn, uuid);
+    vboxDriverUnlock(driver);
+
+    DEBUG("%s:DomainLookupByUUID", conn->driver->name);
+
+    return cdomain;
+}
+
+static char *vboxDomainGetOSType(virDomainPtr dom ATTRIBUTE_UNUSED) {
+    /* Returning "hvm" always as suggested on list, cause
+     * this functions seems to be badly named and it
+     * is supposed to pass the ABI name and not the domain
+     * operating system driver as I had imagined ;)
+     */
+    return strdup("hvm");
+}
+
+static int vboxDomainGetInfo(virDomainPtr dom,
+                             virDomainInfoPtr info) {
+    int ret = -1;
+
+    ret = vboxGetDomainGetInfo(dom, info);
+
+    DEBUG("vboxDomainGetInfo: name = %s", dom->name);
+
+    return ret;
+}
+
+static virDomainPtr vboxDomainLookupByName(virConnectPtr conn,
+                                           const char *name) {
+    struct  vbox_driver *driver = conn->privateData;
+    virDomainPtr cdomain = NULL;
+
+    vboxDriverLock(driver);
+    cdomain = vboxGetDomainLookupByName(conn, name);
+    vboxDriverUnlock(driver);
+
+    DEBUG("%s:DomainLookupByName", conn->driver->name);
+
+    return cdomain;
+}
+
+static int vboxDomainSuspend(virDomainPtr dom) {
+    int ret = -1;
+
+    ret = vboxGetDomainSuspend(dom);
+
+    DEBUG0("vboxDomainSuspend");
+
+    return ret;
+}
+
+static int vboxDomainResume(virDomainPtr dom) {
+    int ret = -1;
+
+    ret = vboxGetDomainResume(dom);
+
+    DEBUG0("vboxDomainResume");
+
+    return ret;
+}
+
+static int vboxDomainReboot(virDomainPtr dom, unsigned int flags) {
+    int ret = -1;
+
+    ret = vboxGetDomainReboot(dom, flags);
+
+    DEBUG0("vboxDomainReboot");
+
+    return ret;
+}
+
+static int vboxDomainShutdown(virDomainPtr dom) {
+    int ret = -1;
+
+    ret = vboxGetDomainShutdown(dom);
+
+    DEBUG0("vboxDomainShutdown");
+
+    return ret;
+}
+
+static int vboxDomainDestroy(virDomainPtr dom) {
+    int ret = -1;
+
+    ret = vboxGetDomainDestroy(dom);
+
+    DEBUG0("vboxDomainDestroy");
+
+    return ret;
+}
+
+static char *vboxGetCapabilities(virConnectPtr conn) {
+    struct vbox_driver *driver = conn->privateData;
+    char *ret;
+
+    vboxDriverLock(driver);
+    ret = virCapabilitiesFormatXML(driver->caps);
+    vboxDriverUnlock(driver);
+
+    return ret;
+}
+
+static int vboxDomainCreate(virDomainPtr dom) {
+    int ret = -1;
+
+    ret = vboxGetDomainCreate(dom);
+
+    DEBUG0("vboxDomainCreate");
+
+    return ret;
+}
+
+static char *vboxGetHostname(virConnectPtr conn) {
+    char *hostname;
+
+    /* the return string should be freed by caller */
+    hostname = virGetHostname();
+    if (hostname == NULL) {
+        vboxError(conn, VIR_ERR_INTERNAL_ERROR,"%s",
+                  "failed to determine host name");
+        return NULL;
+    }
+
+    return hostname;
+}
+
+static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
+    struct vbox_driver *driver = conn->privateData;
+    virDomainDefPtr def;
+    virDomainPtr dom = NULL;
+
+    vboxDriverLock(driver);
+    if (!(def = virDomainDefParseString(conn, driver->caps, xml,
+                                        VIR_DOMAIN_XML_INACTIVE)))
+        goto cleanup;
+
+    dom = vboxGetDomainDefineXML(conn, def);
+
+cleanup:
+    virDomainDefFree(def);
+    vboxDriverUnlock(driver);
+    return dom;
+}
+
+static int vboxDomainUndefine(virDomainPtr dom) {
+    struct vbox_driver *driver = dom->conn->privateData;
+    int ret = -1;
+
+    vboxDriverLock(driver);
+
+    ret = vboxGetDomainUndefine(dom);
+
+    vboxDriverUnlock(driver);
+    return ret;
+}
+
+
+virDriver NAME(Driver) = {
+    VIR_DRV_VBOX,
+    "VBOX",
+    .open                          = vboxOpen,
+    .close                         = vboxClose,
+    .supports_feature              = NULL,
+    .type                          = vboxGetType,
+    .version                       = vboxGetVersion,
+    .getHostname                   = vboxGetHostname,
+    .getURI                        = NULL,
+    .getMaxVcpus                   = NULL,
+    .nodeGetInfo                   = NULL,
+    .getCapabilities               = vboxGetCapabilities,
+    .listDomains                   = vboxListDomains,
+    .numOfDomains                  = vboxNumOfDomains,
+    .domainCreateXML               = NULL,
+    .domainLookupByID              = vboxDomainLookupByID,
+    .domainLookupByUUID            = vboxDomainLookupByUUID,
+    .domainLookupByName            = vboxDomainLookupByName,
+    .domainSuspend                 = vboxDomainSuspend,
+    .domainResume                  = vboxDomainResume,
+    .domainShutdown                = vboxDomainShutdown,
+    .domainReboot                  = vboxDomainReboot,
+    .domainDestroy                 = vboxDomainDestroy,
+    .domainGetOSType               = vboxDomainGetOSType,
+    .domainGetMaxMemory            = NULL,
+    .domainSetMaxMemory            = NULL,
+    .domainSetMemory               = NULL,
+    .domainGetInfo                 = vboxDomainGetInfo,
+    .domainSave                    = NULL,
+    .domainRestore                 = NULL,
+    .domainCoreDump                = NULL,
+    .domainSetVcpus                = NULL,
+    .domainPinVcpu                 = NULL,
+    .domainGetVcpus                = NULL,
+    .domainGetMaxVcpus             = NULL,
+    .domainDumpXML                 = NULL,
+    .listDefinedDomains            = vboxListDefinedDomains,
+    .numOfDefinedDomains           = vboxNumOfDefinedDomains,
+    .domainCreate                  = vboxDomainCreate,
+    .domainDefineXML               = vboxDomainDefineXML,
+    .domainUndefine                = vboxDomainUndefine,
+    .domainAttachDevice            = NULL,
+    .domainDetachDevice            = NULL,
+    .domainGetAutostart            = NULL,
+    .domainSetAutostart            = NULL,
+    .domainGetSchedulerType        = NULL,
+    .domainGetSchedulerParameters  = NULL,
+    .domainSetSchedulerParameters  = NULL,
+    .domainMigratePrepare          = NULL,
+    .domainMigratePerform          = NULL,
+    .domainMigrateFinish           = NULL,
+    .domainBlockStats              = NULL,
+    .domainInterfaceStats          = NULL,
+    .domainBlockPeek               = NULL,
+    .domainMemoryPeek              = NULL,
+    .nodeGetCellsFreeMemory        = NULL,
+    .getFreeMemory                 = NULL,
+    .domainEventRegister           = NULL,
+    .domainEventDeregister         = NULL,
+    .domainMigratePrepare2         = NULL,
+    .domainMigrateFinish2          = NULL,
+};
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]