Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 30206)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 30207)
@@ -337,7 +337,74 @@
 };
 
+#ifdef RT_OS_WINDOWS
+
+/**
+ * Macro used to prepare for COM event firing, note CComObjectRootEx locking.
+ */
+#define CONSOLE_EVENTS_START(name,count)        \
+   {                                            \
+      ComEventDesc evDesc;                      \
+                                                \
+      this->Lock();                             \
+      int nConnections = this->m_vec.GetSize(); \
+      if (nConnections)                         \
+         evDesc.init(#name, count);
+
+/**
+ * Actual event firing for all connection points.
+ * Note some subtlety in the fact that connection point list access
+ * must be synchronized with CComObjectRootEx Lock()/Unlock() methods.
+ */
+#define CONSOLE_EVENTS_END()                                    \
+    for (int i=0; i<nConnections; i++)                          \
+    {                                                           \
+        ComPtr<IUnknown> sp = this->m_vec.GetAt(i);             \
+        ComPtr<IDispatch> cbD;                                  \
+        cbD = sp;                                               \
+        if (cbD != NULL)                                        \
+        {                                                       \
+            CComVariant varResult;                              \
+            this->mComEvHelper.fire(cbD, evDesc, &varResult);   \
+        }                                                       \
+    }                                                           \
+    this->Unlock();                                             \
+   }
+
+/**
+ * A bit non-trivial part about those macros is that we rely heavily on C++ type
+ * casting and assignment operator overloading in CComVariant when instantiating
+ * member template add(), and every add() here could be, ofc, different function.
+ */
+#define PREP_ARGS0()
+#define PREP_ARGS1(a1)                    evDesc.add(a1)
+#define PREP_ARGS2(a1,a2)                 evDesc.add(a1).add(a2)
+#define PREP_ARGS3(a1,a2,a3)              evDesc.add(a1).add(a2).add(a3)
+#define PREP_ARGS4(a1,a2,a3,a4)           evDesc.add(a1).add(a2).add(a3).add(a4)
+#define PREP_ARGS5(a1,a2,a3,a4,a5)        evDesc.add(a1).add(a2).add(a3).add(a4).add(a5)
+#define PREP_ARGS6(a1,a2,a3,a4,a5,a6)     evDesc.add(a1).add(a2).add(a3).add(a4).add(a5).add(a6)
+#define PREP_ARGS7(a1,a2,a3,a4,a5,a6,a7)  evDesc.add(a1).add(a2).add(a3).add(a4).add(a5).add(a6).add(a7)
+
+#else
+
+/**
+ * No events for XPCOM targets now. In the future it looks natural to implmenet generic events mechanism
+ * for all platforms and get rid of callbacks.
+ */ 
+#define CONSOLE_EVENTS_START(name,count)
+#define CONSOLE_EVENTS_END()
+#define PREP_ARGS0()
+#define PREP_ARGS1(a1)
+#define PREP_ARGS2(a1,a2)
+#define PREP_ARGS3(a1,a2,a3)
+#define PREP_ARGS4(a1,a2,a3,a4)
+#define PREP_ARGS5(a1,a2,a3,a4,a5)
+#define PREP_ARGS6(a1,a2,a3,a4,a5,a6)
+#define PREP_ARGS7(a1,a2,a3,a4,a5,a6,a7)
+
+#endif
+
 /**
  * Macro for iterating the callback list (Console::mCallbacks) and invoking the
- * given method on each entry.
+ * given method on each entry, along with firing appropriate COM events on Windows.
  *
  * This handles VBOX_E_DONT_CALL_AGAIN as well as removing dead interfaces
@@ -351,9 +418,14 @@
  *
  * @param   CallbackMethod      The callback method, like OnKeyboardLedsChange.
- * @param   Args                The method arguments enclosed in parentheses.
+ * @param   InvokeCb            Callbacks invocation code
+ * @param   PreprEvent          Event preparation code
+ * @param   Args                Number of callback arguments
  */
-#define CONSOLE_DO_CALLBACKS(CallbackMethod, Args) \
+#define CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, InvokeCb, PrepEvent, Args) \
     do \
     { \
+        CONSOLE_EVENTS_START(CallbackMethod,Args);   \
+        if (nConnections) { PrepEvent; } \
+        CONSOLE_EVENTS_END();  \
         CallbackList::iterator it = this->mCallbacks.begin(); \
         while (it != this->mCallbacks.end()) \
@@ -361,5 +433,5 @@
             if (it->isWanted(ConsoleCallbackRegistration::k ## CallbackMethod)) \
             { \
-                HRESULT hrc = it->ptrICb-> CallbackMethod Args; \
+                HRESULT hrc = InvokeCb;                   \
                 hrc = it->handleResult(ConsoleCallbackRegistration::k ## CallbackMethod, hrc); \
                 if (FAILED_DEAD_INTERFACE(hrc)) \
@@ -373,4 +445,17 @@
     } while (0)
 
+/* Actual invocation macro for different 	number of parameters */
+#define CONSOLE_DO_CALLBACKS0(CallbackMethod)                           \
+     CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(), PREP_ARGS0(), 0)
+#define CONSOLE_DO_CALLBACKS1(CallbackMethod,Arg1)                      \
+    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(Arg1), PREP_ARGS1(Arg1), 1)
+#define CONSOLE_DO_CALLBACKS2(CallbackMethod,Arg1,Arg2)                 \
+    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(Arg1,Arg2), PREP_ARGS2(Arg1,Arg2), 2)
+#define CONSOLE_DO_CALLBACKS3(CallbackMethod,Arg1,Arg2,Arg3)            \
+    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(Arg1,Arg2,Arg3), PREP_ARGS3(Arg1,Arg2,Arg3), 3)
+#define CONSOLE_DO_CALLBACKS4(CallbackMethod,Arg1,Arg2,Arg3,Arg4)       \
+    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(Arg1,Arg2,Args3,Arg4), PREP_ARGS4(Arg1,Arg2,Arg3,Arg4), 4)
+#define CONSOLE_DO_CALLBACKS7(CallbackMethod,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7) \
+    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7), PREP_ARGS7(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7), 7)
 
 // constructor / destructor
@@ -494,4 +579,9 @@
     unconst(mAudioSniffer) = new AudioSniffer(this);
     AssertReturn(mAudioSniffer, E_FAIL);
+
+#ifdef RT_OS_WINDOWS
+    if (SUCCEEDED(rc))
+        rc = mComEvHelper.init(IID_IConsoleCallback);
+#endif
 
     /* Confirm a successful initialization when it's the case */
@@ -2754,5 +2844,5 @@
 
     /* notify console callbacks after the folder is added to the list */
-    CONSOLE_DO_CALLBACKS(OnSharedFolderChange,(Scope_Session));
+    CONSOLE_DO_CALLBACKS1(OnSharedFolderChange, Scope_Session);
 
     return rc;
@@ -2811,5 +2901,5 @@
 
     /* notify console callbacks after the folder is removed to the list */
-    CONSOLE_DO_CALLBACKS(OnSharedFolderChange,(Scope_Session));
+    CONSOLE_DO_CALLBACKS1(OnSharedFolderChange, Scope_Session);
 
     return rc;
@@ -3229,5 +3319,5 @@
     int vrc = VMR3ReqCall(mpVM,
                           VMCPUID_ANY,
-                          &pReq,
+&pReq,
                           0 /* no wait! */,
                           VMREQFLAGS_VBOX_STATUS,
@@ -3522,5 +3612,5 @@
     /* notify console callbacks on success */
     if (SUCCEEDED(rc))
-        CONSOLE_DO_CALLBACKS(OnNetworkAdapterChange,(aNetworkAdapter));
+        CONSOLE_DO_CALLBACKS1(OnNetworkAdapterChange, aNetworkAdapter);
 
     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
@@ -3738,5 +3828,5 @@
     /* notify console callbacks on success */
     if (SUCCEEDED(rc))
-        CONSOLE_DO_CALLBACKS(OnSerialPortChange,(aSerialPort));
+        CONSOLE_DO_CALLBACKS1(OnSerialPortChange, aSerialPort);
 
     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
@@ -3772,5 +3862,5 @@
     /* notify console callbacks on success */
     if (SUCCEEDED(rc))
-        CONSOLE_DO_CALLBACKS(OnParallelPortChange,(aParallelPort));
+        CONSOLE_DO_CALLBACKS1(OnParallelPortChange, aParallelPort);
 
     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
@@ -3806,5 +3896,5 @@
     /* notify console callbacks on success */
     if (SUCCEEDED(rc))
-        CONSOLE_DO_CALLBACKS(OnStorageControllerChange,());
+        CONSOLE_DO_CALLBACKS0(OnStorageControllerChange);
 
     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
@@ -3840,5 +3930,5 @@
     /* notify console callbacks on success */
     if (SUCCEEDED(rc))
-        CONSOLE_DO_CALLBACKS(OnMediumChange,(aMediumAttachment));
+        CONSOLE_DO_CALLBACKS1(OnMediumChange, aMediumAttachment);
 
     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
@@ -3877,5 +3967,5 @@
     /* notify console callbacks on success */
     if (SUCCEEDED(rc))
-        CONSOLE_DO_CALLBACKS(OnCPUChange,(aCPU, aRemove));
+        CONSOLE_DO_CALLBACKS2(OnCPUChange, aCPU, aRemove);
 
     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
@@ -3941,5 +4031,5 @@
     /* notify console callbacks on success */
     if (SUCCEEDED(rc))
-        CONSOLE_DO_CALLBACKS(OnVRDPServerChange,());
+        CONSOLE_DO_CALLBACKS0(OnVRDPServerChange);
 
     return rc;
@@ -3956,5 +4046,5 @@
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    CONSOLE_DO_CALLBACKS(OnRemoteDisplayInfoChange,());
+    CONSOLE_DO_CALLBACKS0(OnRemoteDisplayInfoChange);
 }
 
@@ -3996,5 +4086,5 @@
     /* notify console callbacks on success */
     if (SUCCEEDED(rc))
-        CONSOLE_DO_CALLBACKS(OnUSBControllerChange,());
+        CONSOLE_DO_CALLBACKS0(OnUSBControllerChange);
 
     return rc;
@@ -4021,7 +4111,7 @@
     {
         if (aGlobal)
-            CONSOLE_DO_CALLBACKS(OnSharedFolderChange,(Scope_Global));
+            CONSOLE_DO_CALLBACKS1(OnSharedFolderChange, Scope_Global);
         else
-            CONSOLE_DO_CALLBACKS(OnSharedFolderChange,(Scope_Machine));
+            CONSOLE_DO_CALLBACKS1(OnSharedFolderChange, Scope_Machine);
     }
 
@@ -4680,5 +4770,5 @@
     mCallbackData.mpsc.valid = true;
 
-    CONSOLE_DO_CALLBACKS(OnMousePointerShapeChange,(fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayInArg(pShape)));
+    CONSOLE_DO_CALLBACKS7(OnMousePointerShapeChange, fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayInArg(pShape));
 
 #if 0
@@ -4707,5 +4797,5 @@
     mCallbackData.mcc.valid = true;
 
-    CONSOLE_DO_CALLBACKS(OnMouseCapabilityChange,(supportsAbsolute, supportsRelative, needsHostCursor));
+    CONSOLE_DO_CALLBACKS3(OnMouseCapabilityChange, supportsAbsolute, supportsRelative, needsHostCursor);
 }
 
@@ -4719,5 +4809,5 @@
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    CONSOLE_DO_CALLBACKS(OnStateChange,(machineState));
+    CONSOLE_DO_CALLBACKS1(OnStateChange, machineState);
 }
 
@@ -4731,5 +4821,5 @@
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    CONSOLE_DO_CALLBACKS(OnAdditionsStateChange,());
+    CONSOLE_DO_CALLBACKS0(OnAdditionsStateChange);
 }
 
@@ -4768,5 +4858,5 @@
     mCallbackData.klc.valid = true;
 
-    CONSOLE_DO_CALLBACKS(OnKeyboardLedsChange,(fNumLock, fCapsLock, fScrollLock));
+    CONSOLE_DO_CALLBACKS3(OnKeyboardLedsChange, fNumLock, fCapsLock, fScrollLock);
 }
 
@@ -4781,5 +4871,5 @@
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    CONSOLE_DO_CALLBACKS(OnUSBDeviceStateChange,(aDevice, aAttached, aError));
+    CONSOLE_DO_CALLBACKS3(OnUSBDeviceStateChange, aDevice, aAttached, aError);
 }
 
@@ -4793,5 +4883,5 @@
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    CONSOLE_DO_CALLBACKS(OnRuntimeError,(aFatal, aErrorID, aMessage));
+    CONSOLE_DO_CALLBACKS3(OnRuntimeError, aFatal, aErrorID, aMessage);
 }
 
Index: /trunk/src/VBox/Main/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Main/Makefile.kmk	(revision 30206)
+++ /trunk/src/VBox/Main/Makefile.kmk	(revision 30207)
@@ -649,5 +649,7 @@
 	win/dllmain.cpp \
 	win/VBoxC.def \
-	win/VBoxC.rc
+	win/VBoxC.rc \
+	win/VBoxComEvents.cpp
+
 
 ifdef VBOX_WITH_XPCOM
Index: /trunk/src/VBox/Main/VirtualBoxImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/VirtualBoxImpl.cpp	(revision 30206)
+++ /trunk/src/VBox/Main/VirtualBoxImpl.cpp	(revision 30207)
@@ -353,5 +353,5 @@
 
 #ifdef RT_OS_WINDOWS
-    ComEventsHelper                     aComEvHelper;
+    ComEventsHelper                     mComEvHelper;
 #endif
 };
@@ -593,5 +593,5 @@
 #ifdef RT_OS_WINDOWS
     if (SUCCEEDED(rc))
-        rc = m->aComEvHelper.init(IID_IVirtualBoxCallback);
+        rc = m->mComEvHelper.init(IID_IVirtualBoxCallback);
 #endif
 
@@ -4576,19 +4576,28 @@
 
     CallbackList callbacks;
+#ifdef RT_OS_WINDOWS
+    EventListenersList listeners;
+#endif
     {
         /* Make a copy to release the lock before iterating */
         AutoReadLock alock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
         callbacks = mVirtualBox->m->llCallbacks;
-    }
-
-
 #ifdef RT_OS_WINDOWS
-#if 1
+	IUnknown** pp;
+	for (pp = mVirtualBox->m_vec.begin(); pp < mVirtualBox->m_vec.end(); pp++)
+	{
+            listeners.Add(*pp);
+        }                   
+#endif  
+    }
+
+
+#ifdef RT_OS_WINDOWS
     // WIP
     {
      ComEventDesc evDesc;
 
-     int nConnections = mVirtualBox->m_vec.GetSize();
-     /* Only prepare args if someone needs them */
+     int nConnections = listeners.GetSize();
+     /* Only prepare args if someone really needs them */
      if (nConnections)
         prepareEventDesc(evDesc);
@@ -4596,5 +4605,5 @@
      for (int i=0; i<nConnections; i++)
      {
-        ComPtr<IUnknown> sp = mVirtualBox->m_vec.GetAt(i);
+        ComPtr<IUnknown> sp = listeners.GetAt(i);
         ComPtr<IVirtualBoxCallback> cbI;
         ComPtr<IDispatch> cbD;
@@ -4604,16 +4613,15 @@
 
         /**
-         * Would be just handleCallback(cbI) in ideal world, unfortunately our consumers want to be invoked via IDispatch,
-         * thus going the hard way.
+         * Would be just handleCallback(cbI) in an ideal world, unfortunately our 
+	 * consumers want to be invoked via IDispatch, thus going the hard way.
          */
         if (cbI != NULL && cbD != NULL)
         {
              CComVariant varResult;
-             mVirtualBox->m->aComEvHelper.fire(cbD, evDesc, &varResult);
+             mVirtualBox->m->mComEvHelper.fire(cbD, evDesc, &varResult);
              // what we gonna do with the result?
         }
      }
     }
-#endif
 #endif
 
Index: /trunk/src/VBox/Main/glue/tests/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Main/glue/tests/Makefile.kmk	(revision 30206)
+++ /trunk/src/VBox/Main/glue/tests/Makefile.kmk	(revision 30207)
@@ -17,11 +17,11 @@
 
 ifeq ($(KBUILD_HOST),linux)
- VBOX_SDK=/home/nike/work/ws/out/linux.amd64/debug/bin/sdk
  VBOX_BIN=/home/nike/work/ws/out/linux.amd64/debug/bin
+ VBOX_SDK=$(VBOX_BIN)/sdk
 endif
 
 ifeq ($(KBUILD_HOST),win)
- VBOX_SDK=c:/out/bin/sdk
- VBOX_BIN=c:/out/bin
+ VBOX_BIN=e:/ws/out/win.amd64/debug/bin
+ VBOX_SDK=$(VBOX_BIN)/sdk
  JACOB_DIR=s:/jacob-1.15-M3/
  JACOB_JAR=$(JACOB_DIR)/jacob.jar
Index: /trunk/src/VBox/Main/glue/tests/TestVBox.java
===================================================================
--- /trunk/src/VBox/Main/glue/tests/TestVBox.java	(revision 30206)
+++ /trunk/src/VBox/Main/glue/tests/TestVBox.java	(revision 30207)
@@ -13,4 +13,5 @@
 import org.virtualbox_3_3.*;
 import java.util.List;
+import java.math.BigInteger;
 
 class VBoxCallbacks extends VBoxObjectBase implements IVirtualBoxCallback
@@ -63,4 +64,94 @@
 }
 
+class ConsoleCallbacks extends VBoxObjectBase implements IConsoleCallback
+{
+    String mach;
+    ConsoleCallbacks(String mach)
+    {
+       this.mach = mach;
+    }
+    public void onMousePointerShapeChange(Boolean visible, Boolean alpha, Long xHot, Long yHot, Long width, Long height, List<Short> shape)
+    {
+       System.out.println("onMousePointerShapeChange -- VM: " + mach);
+    }
+    public void onMouseCapabilityChange(Boolean supportsAbsolute, Boolean supportsRelative, Boolean needsHostCursor)
+    {
+       System.out.println("onMouseCapabilityChange -- VM: " + mach+" abs="+supportsAbsolute+ " rel="+supportsRelative+" need host="+needsHostCursor);
+    }
+    public void onKeyboardLedsChange(Boolean numLock, Boolean capsLock, Boolean scrollLock)
+    {
+       System.out.println("onKeyboardLedsChange -- VM: " + mach);
+    }
+    public void onStateChange(org.virtualbox_3_3.MachineState state)
+    {
+       System.out.println("onStateChange -- VM: " + mach);
+    }
+    public void onAdditionsStateChange()
+    {
+       System.out.println("onAdditionsStateChange -- VM: " + mach);
+    }
+    public void onNetworkAdapterChange(org.virtualbox_3_3.INetworkAdapter networkAdapter)
+    {
+       System.out.println("onNetworkAdapterChange -- VM: " + mach);
+    }
+    public void onSerialPortChange(org.virtualbox_3_3.ISerialPort serialPort)
+    {
+       System.out.println("onSerialPortChange -- VM: " + mach);
+    }
+    public void onParallelPortChange(org.virtualbox_3_3.IParallelPort parallelPort)
+    {
+       System.out.println("onParallelPortChange -- VM: " + mach);
+    }
+    public void onStorageControllerChange()
+    {
+       System.out.println("onStorageControllerChange -- VM: " + mach);
+    }
+    public void onMediumChange(org.virtualbox_3_3.IMediumAttachment mediumAttachment)
+    {
+       System.out.println("onMediumChange -- VM: " + mach);
+    }
+    public void onCPUChange(Long cpu, Boolean add)
+    {
+       System.out.println("onCPUChange -- VM: " + mach);
+    }
+    public void onVRDPServerChange()
+    {
+       System.out.println("onVRDPServerChange -- VM: " + mach);
+    }
+    public void onRemoteDisplayInfoChange()
+    {
+       System.out.println("onRemoteDisplayInfoChange -- VM: " + mach);
+    }
+    public void onUSBControllerChange()
+    {
+       System.out.println("onUSBControllerChange -- VM: " + mach);
+    }
+    public void onUSBDeviceStateChange(org.virtualbox_3_3.IUSBDevice device, Boolean attached, org.virtualbox_3_3.IVirtualBoxErrorInfo error)
+    {
+       System.out.println("onUSBDeviceStateChange -- VM: " + mach);
+    }
+    public void onSharedFolderChange(org.virtualbox_3_3.Scope scope)
+    {
+       System.out.println("onSharedFolderChange -- VM: " + mach);
+    }
+
+    public void onRuntimeError(Boolean fatal, String id, String message)
+    {
+       System.out.println("onRuntimeError -- VM: " + mach);
+    }
+
+    public Boolean onCanShowWindow()
+    {
+       System.out.println("onCanShowWindow -- VM: " + mach);
+       return true;
+    }
+
+    public BigInteger onShowWindow()
+    {
+       System.out.println("onShowWindow -- VM: " + mach);
+       return BigInteger.ZERO;
+    }
+}
+
 public class TestVBox
 {
@@ -70,7 +161,25 @@
         IVirtualBoxCallback cbs = new VBoxCallbacks();
         mgr.registerGlobalCallback(vbox, cbs);
-        for (int i=0; i<100; i++)
-        {
+
+        IMachine mach = vbox.getMachines().get(0);
+        IConsoleCallback mcbs = new ConsoleCallbacks(mach.getName());
+
+        ISession session = null;
+        try {
+          session = mgr.openMachineSession(mach);
+          mgr.registerMachineCallback(session, mcbs);
+
+          for (int i=0; i<100; i++)
+          {
             mgr.waitForEvents(500);
+          }
+
+          System.out.println("done waiting");
+
+          mgr.unregisterMachineCallback(session, mcbs);
+        } catch (Exception e) {
+          e.printStackTrace();
+        } finally { 
+          mgr.closeMachineSession(session);
         }
         mgr.unregisterGlobalCallback(vbox, cbs);
Index: /trunk/src/VBox/Main/glue/vboxapi.py
===================================================================
--- /trunk/src/VBox/Main/glue/vboxapi.py	(revision 30206)
+++ /trunk/src/VBox/Main/glue/vboxapi.py	(revision 30207)
@@ -217,4 +217,5 @@
             win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
             win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox')
+            win32com.client.gencache.EnsureDispatch('VirtualBox.Console')
             win32com.client.gencache.EnsureDispatch('VirtualBox.CallbackWrapper')
 
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 30206)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 30207)
@@ -14558,7 +14558,12 @@
            namespace="virtualbox.org">
       <interface name="ISession" default="yes"/>
+    </class>
+
+    <class name="Console" uuid="577230FF-164F-4CAC-8548-312D8275A4A7"
+           namespace="virtualbox.org">
+      <interface name="IConsole" default="yes"/>
       <eventsink name="IConsoleCallback" default="yes"/>
-
     </class>
+
     <class name="CallbackWrapper" uuid="49EE8561-5563-4715-B18C-A4B1A490DAFE"
            namespace="virtualbox.org">
Index: /trunk/src/VBox/Main/include/ConsoleImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 30206)
+++ /trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 30207)
@@ -43,4 +43,8 @@
 #ifdef VBOX_WITH_GUEST_PROPS
 # include <VBox/HostServices/GuestPropertySvc.h>  /* For the property notification callback */
+#endif
+
+#ifdef RT_OS_WINDOWS
+# include "win/VBoxComEvents.h"
 #endif
 
@@ -79,4 +83,9 @@
     public VirtualBoxSupportTranslation<Console>,
     VBOX_SCRIPTABLE_IMPL(IConsole)
+#ifdef RT_OS_WINDOWS
+    , public CComCoClass<Console, &CLSID_Console>
+    , public IConnectionPointContainerImpl<Console>
+    , public IConnectionPointImpl<Console, &IID_IConsoleCallback, CComDynamicUnkArray>
+#endif
 {
     Q_OBJECT
@@ -92,5 +101,13 @@
         COM_INTERFACE_ENTRY(IConsole)
         COM_INTERFACE_ENTRY(IDispatch)
+        COM_INTERFACE_ENTRY(IConnectionPointContainer)
     END_COM_MAP()
+
+#ifdef RT_OS_WINDOWS
+    BEGIN_CONNECTION_POINT_MAP(Console)
+         CONNECTION_POINT_ENTRY(IID_IConsoleCallback)
+    END_CONNECTION_POINT_MAP()
+#endif
+
 
     Console();
@@ -713,4 +730,8 @@
     mCallbackData;
 
+#ifdef RT_OS_WINDOWS
+    ComEventsHelper                     mComEvHelper;
+#endif
+    
     friend struct VMTask;
 };
Index: /trunk/src/VBox/Main/include/VirtualBoxImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 30206)
+++ /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 30207)
@@ -96,4 +96,6 @@
          CONNECTION_POINT_ENTRY(IID_IVirtualBoxCallback)
     END_CONNECTION_POINT_MAP()
+   
+    typedef CComDynamicUnkArray EventListenersList;
 #endif
 
