VirtualBox

Changeset 30207 in vbox


Ignore:
Timestamp:
Jun 15, 2010 3:49:27 PM (14 years ago)
Author:
vboxsync
Message:

Main: console COM events, cleanup, locking

Location:
trunk/src/VBox/Main
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r30191 r30207  
    337337};
    338338
     339#ifdef RT_OS_WINDOWS
     340
     341/**
     342 * Macro used to prepare for COM event firing, note CComObjectRootEx locking.
     343 */
     344#define CONSOLE_EVENTS_START(name,count)        \
     345   {                                            \
     346      ComEventDesc evDesc;                      \
     347                                                \
     348      this->Lock();                             \
     349      int nConnections = this->m_vec.GetSize(); \
     350      if (nConnections)                         \
     351         evDesc.init(#name, count);
     352
     353/**
     354 * Actual event firing for all connection points.
     355 * Note some subtlety in the fact that connection point list access
     356 * must be synchronized with CComObjectRootEx Lock()/Unlock() methods.
     357 */
     358#define CONSOLE_EVENTS_END()                                    \
     359    for (int i=0; i<nConnections; i++)                          \
     360    {                                                           \
     361        ComPtr<IUnknown> sp = this->m_vec.GetAt(i);             \
     362        ComPtr<IDispatch> cbD;                                  \
     363        cbD = sp;                                               \
     364        if (cbD != NULL)                                        \
     365        {                                                       \
     366            CComVariant varResult;                              \
     367            this->mComEvHelper.fire(cbD, evDesc, &varResult);   \
     368        }                                                       \
     369    }                                                           \
     370    this->Unlock();                                             \
     371   }
     372
     373/**
     374 * A bit non-trivial part about those macros is that we rely heavily on C++ type
     375 * casting and assignment operator overloading in CComVariant when instantiating
     376 * member template add(), and every add() here could be, ofc, different function.
     377 */
     378#define PREP_ARGS0()
     379#define PREP_ARGS1(a1)                    evDesc.add(a1)
     380#define PREP_ARGS2(a1,a2)                 evDesc.add(a1).add(a2)
     381#define PREP_ARGS3(a1,a2,a3)              evDesc.add(a1).add(a2).add(a3)
     382#define PREP_ARGS4(a1,a2,a3,a4)           evDesc.add(a1).add(a2).add(a3).add(a4)
     383#define PREP_ARGS5(a1,a2,a3,a4,a5)        evDesc.add(a1).add(a2).add(a3).add(a4).add(a5)
     384#define PREP_ARGS6(a1,a2,a3,a4,a5,a6)     evDesc.add(a1).add(a2).add(a3).add(a4).add(a5).add(a6)
     385#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)
     386
     387#else
     388
     389/**
     390 * No events for XPCOM targets now. In the future it looks natural to implmenet generic events mechanism
     391 * for all platforms and get rid of callbacks.
     392 */
     393#define CONSOLE_EVENTS_START(name,count)
     394#define CONSOLE_EVENTS_END()
     395#define PREP_ARGS0()
     396#define PREP_ARGS1(a1)
     397#define PREP_ARGS2(a1,a2)
     398#define PREP_ARGS3(a1,a2,a3)
     399#define PREP_ARGS4(a1,a2,a3,a4)
     400#define PREP_ARGS5(a1,a2,a3,a4,a5)
     401#define PREP_ARGS6(a1,a2,a3,a4,a5,a6)
     402#define PREP_ARGS7(a1,a2,a3,a4,a5,a6,a7)
     403
     404#endif
     405
    339406/**
    340407 * Macro for iterating the callback list (Console::mCallbacks) and invoking the
    341  * given method on each entry.
     408 * given method on each entry, along with firing appropriate COM events on Windows.
    342409 *
    343410 * This handles VBOX_E_DONT_CALL_AGAIN as well as removing dead interfaces
     
    351418 *
    352419 * @param   CallbackMethod      The callback method, like OnKeyboardLedsChange.
    353  * @param   Args                The method arguments enclosed in parentheses.
     420 * @param   InvokeCb            Callbacks invocation code
     421 * @param   PreprEvent          Event preparation code
     422 * @param   Args                Number of callback arguments
    354423 */
    355 #define CONSOLE_DO_CALLBACKS(CallbackMethod, Args) \
     424#define CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, InvokeCb, PrepEvent, Args) \
    356425    do \
    357426    { \
     427        CONSOLE_EVENTS_START(CallbackMethod,Args);   \
     428        if (nConnections) { PrepEvent; } \
     429        CONSOLE_EVENTS_END();  \
    358430        CallbackList::iterator it = this->mCallbacks.begin(); \
    359431        while (it != this->mCallbacks.end()) \
     
    361433            if (it->isWanted(ConsoleCallbackRegistration::k ## CallbackMethod)) \
    362434            { \
    363                 HRESULT hrc = it->ptrICb-> CallbackMethod Args; \
     435                HRESULT hrc = InvokeCb;                  \
    364436                hrc = it->handleResult(ConsoleCallbackRegistration::k ## CallbackMethod, hrc); \
    365437                if (FAILED_DEAD_INTERFACE(hrc)) \
     
    373445    } while (0)
    374446
     447/* Actual invocation macro for different        number of parameters */
     448#define CONSOLE_DO_CALLBACKS0(CallbackMethod)                           \
     449     CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(), PREP_ARGS0(), 0)
     450#define CONSOLE_DO_CALLBACKS1(CallbackMethod,Arg1)                      \
     451    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(Arg1), PREP_ARGS1(Arg1), 1)
     452#define CONSOLE_DO_CALLBACKS2(CallbackMethod,Arg1,Arg2)                 \
     453    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(Arg1,Arg2), PREP_ARGS2(Arg1,Arg2), 2)
     454#define CONSOLE_DO_CALLBACKS3(CallbackMethod,Arg1,Arg2,Arg3)            \
     455    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(Arg1,Arg2,Arg3), PREP_ARGS3(Arg1,Arg2,Arg3), 3)
     456#define CONSOLE_DO_CALLBACKS4(CallbackMethod,Arg1,Arg2,Arg3,Arg4)       \
     457    CONSOLE_DO_CALLBACKS_GEN(CallbackMethod, it->ptrICb->##CallbackMethod##(Arg1,Arg2,Args3,Arg4), PREP_ARGS4(Arg1,Arg2,Arg3,Arg4), 4)
     458#define CONSOLE_DO_CALLBACKS7(CallbackMethod,Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7) \
     459    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)
    375460
    376461// constructor / destructor
     
    494579    unconst(mAudioSniffer) = new AudioSniffer(this);
    495580    AssertReturn(mAudioSniffer, E_FAIL);
     581
     582#ifdef RT_OS_WINDOWS
     583    if (SUCCEEDED(rc))
     584        rc = mComEvHelper.init(IID_IConsoleCallback);
     585#endif
    496586
    497587    /* Confirm a successful initialization when it's the case */
     
    27542844
    27552845    /* notify console callbacks after the folder is added to the list */
    2756     CONSOLE_DO_CALLBACKS(OnSharedFolderChange,(Scope_Session));
     2846    CONSOLE_DO_CALLBACKS1(OnSharedFolderChange, Scope_Session);
    27572847
    27582848    return rc;
     
    28112901
    28122902    /* notify console callbacks after the folder is removed to the list */
    2813     CONSOLE_DO_CALLBACKS(OnSharedFolderChange,(Scope_Session));
     2903    CONSOLE_DO_CALLBACKS1(OnSharedFolderChange, Scope_Session);
    28142904
    28152905    return rc;
     
    32293319    int vrc = VMR3ReqCall(mpVM,
    32303320                          VMCPUID_ANY,
    3231                           &pReq,
     3321&pReq,
    32323322                          0 /* no wait! */,
    32333323                          VMREQFLAGS_VBOX_STATUS,
     
    35223612    /* notify console callbacks on success */
    35233613    if (SUCCEEDED(rc))
    3524         CONSOLE_DO_CALLBACKS(OnNetworkAdapterChange,(aNetworkAdapter));
     3614        CONSOLE_DO_CALLBACKS1(OnNetworkAdapterChange, aNetworkAdapter);
    35253615
    35263616    LogFlowThisFunc(("Leaving rc=%#x\n", rc));
     
    37383828    /* notify console callbacks on success */
    37393829    if (SUCCEEDED(rc))
    3740         CONSOLE_DO_CALLBACKS(OnSerialPortChange,(aSerialPort));
     3830        CONSOLE_DO_CALLBACKS1(OnSerialPortChange, aSerialPort);
    37413831
    37423832    LogFlowThisFunc(("Leaving rc=%#x\n", rc));
     
    37723862    /* notify console callbacks on success */
    37733863    if (SUCCEEDED(rc))
    3774         CONSOLE_DO_CALLBACKS(OnParallelPortChange,(aParallelPort));
     3864        CONSOLE_DO_CALLBACKS1(OnParallelPortChange, aParallelPort);
    37753865
    37763866    LogFlowThisFunc(("Leaving rc=%#x\n", rc));
     
    38063896    /* notify console callbacks on success */
    38073897    if (SUCCEEDED(rc))
    3808         CONSOLE_DO_CALLBACKS(OnStorageControllerChange,());
     3898        CONSOLE_DO_CALLBACKS0(OnStorageControllerChange);
    38093899
    38103900    LogFlowThisFunc(("Leaving rc=%#x\n", rc));
     
    38403930    /* notify console callbacks on success */
    38413931    if (SUCCEEDED(rc))
    3842         CONSOLE_DO_CALLBACKS(OnMediumChange,(aMediumAttachment));
     3932        CONSOLE_DO_CALLBACKS1(OnMediumChange, aMediumAttachment);
    38433933
    38443934    LogFlowThisFunc(("Leaving rc=%#x\n", rc));
     
    38773967    /* notify console callbacks on success */
    38783968    if (SUCCEEDED(rc))
    3879         CONSOLE_DO_CALLBACKS(OnCPUChange,(aCPU, aRemove));
     3969        CONSOLE_DO_CALLBACKS2(OnCPUChange, aCPU, aRemove);
    38803970
    38813971    LogFlowThisFunc(("Leaving rc=%#x\n", rc));
     
    39414031    /* notify console callbacks on success */
    39424032    if (SUCCEEDED(rc))
    3943         CONSOLE_DO_CALLBACKS(OnVRDPServerChange,());
     4033        CONSOLE_DO_CALLBACKS0(OnVRDPServerChange);
    39444034
    39454035    return rc;
     
    39564046    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    39574047
    3958     CONSOLE_DO_CALLBACKS(OnRemoteDisplayInfoChange,());
     4048    CONSOLE_DO_CALLBACKS0(OnRemoteDisplayInfoChange);
    39594049}
    39604050
     
    39964086    /* notify console callbacks on success */
    39974087    if (SUCCEEDED(rc))
    3998         CONSOLE_DO_CALLBACKS(OnUSBControllerChange,());
     4088        CONSOLE_DO_CALLBACKS0(OnUSBControllerChange);
    39994089
    40004090    return rc;
     
    40214111    {
    40224112        if (aGlobal)
    4023             CONSOLE_DO_CALLBACKS(OnSharedFolderChange,(Scope_Global));
     4113            CONSOLE_DO_CALLBACKS1(OnSharedFolderChange, Scope_Global);
    40244114        else
    4025             CONSOLE_DO_CALLBACKS(OnSharedFolderChange,(Scope_Machine));
     4115            CONSOLE_DO_CALLBACKS1(OnSharedFolderChange, Scope_Machine);
    40264116    }
    40274117
     
    46804770    mCallbackData.mpsc.valid = true;
    46814771
    4682     CONSOLE_DO_CALLBACKS(OnMousePointerShapeChange,(fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayInArg(pShape)));
     4772    CONSOLE_DO_CALLBACKS7(OnMousePointerShapeChange, fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayInArg(pShape));
    46834773
    46844774#if 0
     
    47074797    mCallbackData.mcc.valid = true;
    47084798
    4709     CONSOLE_DO_CALLBACKS(OnMouseCapabilityChange,(supportsAbsolute, supportsRelative, needsHostCursor));
     4799    CONSOLE_DO_CALLBACKS3(OnMouseCapabilityChange, supportsAbsolute, supportsRelative, needsHostCursor);
    47104800}
    47114801
     
    47194809
    47204810    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    4721     CONSOLE_DO_CALLBACKS(OnStateChange,(machineState));
     4811    CONSOLE_DO_CALLBACKS1(OnStateChange, machineState);
    47224812}
    47234813
     
    47314821
    47324822    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    4733     CONSOLE_DO_CALLBACKS(OnAdditionsStateChange,());
     4823    CONSOLE_DO_CALLBACKS0(OnAdditionsStateChange);
    47344824}
    47354825
     
    47684858    mCallbackData.klc.valid = true;
    47694859
    4770     CONSOLE_DO_CALLBACKS(OnKeyboardLedsChange,(fNumLock, fCapsLock, fScrollLock));
     4860    CONSOLE_DO_CALLBACKS3(OnKeyboardLedsChange, fNumLock, fCapsLock, fScrollLock);
    47714861}
    47724862
     
    47814871
    47824872    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    4783     CONSOLE_DO_CALLBACKS(OnUSBDeviceStateChange,(aDevice, aAttached, aError));
     4873    CONSOLE_DO_CALLBACKS3(OnUSBDeviceStateChange, aDevice, aAttached, aError);
    47844874}
    47854875
     
    47934883
    47944884    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    4795     CONSOLE_DO_CALLBACKS(OnRuntimeError,(aFatal, aErrorID, aMessage));
     4885    CONSOLE_DO_CALLBACKS3(OnRuntimeError, aFatal, aErrorID, aMessage);
    47964886}
    47974887
  • trunk/src/VBox/Main/Makefile.kmk

    r30156 r30207  
    649649        win/dllmain.cpp \
    650650        win/VBoxC.def \
    651         win/VBoxC.rc
     651        win/VBoxC.rc \
     652        win/VBoxComEvents.cpp
     653
    652654
    653655ifdef VBOX_WITH_XPCOM
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r30159 r30207  
    353353
    354354#ifdef RT_OS_WINDOWS
    355     ComEventsHelper                     aComEvHelper;
     355    ComEventsHelper                     mComEvHelper;
    356356#endif
    357357};
     
    593593#ifdef RT_OS_WINDOWS
    594594    if (SUCCEEDED(rc))
    595         rc = m->aComEvHelper.init(IID_IVirtualBoxCallback);
     595        rc = m->mComEvHelper.init(IID_IVirtualBoxCallback);
    596596#endif
    597597
     
    45764576
    45774577    CallbackList callbacks;
     4578#ifdef RT_OS_WINDOWS
     4579    EventListenersList listeners;
     4580#endif
    45784581    {
    45794582        /* Make a copy to release the lock before iterating */
    45804583        AutoReadLock alock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
    45814584        callbacks = mVirtualBox->m->llCallbacks;
    4582     }
    4583 
    4584 
    45854585#ifdef RT_OS_WINDOWS
    4586 #if 1
     4586        IUnknown** pp;
     4587        for (pp = mVirtualBox->m_vec.begin(); pp < mVirtualBox->m_vec.end(); pp++)
     4588        {
     4589            listeners.Add(*pp);
     4590        }                   
     4591#endif 
     4592    }
     4593
     4594
     4595#ifdef RT_OS_WINDOWS
    45874596    // WIP
    45884597    {
    45894598     ComEventDesc evDesc;
    45904599
    4591      int nConnections = mVirtualBox->m_vec.GetSize();
    4592      /* Only prepare args if someone needs them */
     4600     int nConnections = listeners.GetSize();
     4601     /* Only prepare args if someone really needs them */
    45934602     if (nConnections)
    45944603        prepareEventDesc(evDesc);
     
    45964605     for (int i=0; i<nConnections; i++)
    45974606     {
    4598         ComPtr<IUnknown> sp = mVirtualBox->m_vec.GetAt(i);
     4607        ComPtr<IUnknown> sp = listeners.GetAt(i);
    45994608        ComPtr<IVirtualBoxCallback> cbI;
    46004609        ComPtr<IDispatch> cbD;
     
    46044613
    46054614        /**
    4606          * Would be just handleCallback(cbI) in ideal world, unfortunately our consumers want to be invoked via IDispatch,
    4607          * thus going the hard way.
     4615         * Would be just handleCallback(cbI) in an ideal world, unfortunately our
     4616         * consumers want to be invoked via IDispatch, thus going the hard way.
    46084617         */
    46094618        if (cbI != NULL && cbD != NULL)
    46104619        {
    46114620             CComVariant varResult;
    4612              mVirtualBox->m->aComEvHelper.fire(cbD, evDesc, &varResult);
     4621             mVirtualBox->m->mComEvHelper.fire(cbD, evDesc, &varResult);
    46134622             // what we gonna do with the result?
    46144623        }
    46154624     }
    46164625    }
    4617 #endif
    46184626#endif
    46194627
  • trunk/src/VBox/Main/glue/tests/Makefile.kmk

    r30159 r30207  
    1717
    1818ifeq ($(KBUILD_HOST),linux)
    19  VBOX_SDK=/home/nike/work/ws/out/linux.amd64/debug/bin/sdk
    2019 VBOX_BIN=/home/nike/work/ws/out/linux.amd64/debug/bin
     20 VBOX_SDK=$(VBOX_BIN)/sdk
    2121endif
    2222
    2323ifeq ($(KBUILD_HOST),win)
    24  VBOX_SDK=c:/out/bin/sdk
    25  VBOX_BIN=c:/out/bin
     24 VBOX_BIN=e:/ws/out/win.amd64/debug/bin
     25 VBOX_SDK=$(VBOX_BIN)/sdk
    2626 JACOB_DIR=s:/jacob-1.15-M3/
    2727 JACOB_JAR=$(JACOB_DIR)/jacob.jar
  • trunk/src/VBox/Main/glue/tests/TestVBox.java

    r30159 r30207  
    1313import org.virtualbox_3_3.*;
    1414import java.util.List;
     15import java.math.BigInteger;
    1516
    1617class VBoxCallbacks extends VBoxObjectBase implements IVirtualBoxCallback
     
    6364}
    6465
     66class ConsoleCallbacks extends VBoxObjectBase implements IConsoleCallback
     67{
     68    String mach;
     69    ConsoleCallbacks(String mach)
     70    {
     71       this.mach = mach;
     72    }
     73    public void onMousePointerShapeChange(Boolean visible, Boolean alpha, Long xHot, Long yHot, Long width, Long height, List<Short> shape)
     74    {
     75       System.out.println("onMousePointerShapeChange -- VM: " + mach);
     76    }
     77    public void onMouseCapabilityChange(Boolean supportsAbsolute, Boolean supportsRelative, Boolean needsHostCursor)
     78    {
     79       System.out.println("onMouseCapabilityChange -- VM: " + mach+" abs="+supportsAbsolute+ " rel="+supportsRelative+" need host="+needsHostCursor);
     80    }
     81    public void onKeyboardLedsChange(Boolean numLock, Boolean capsLock, Boolean scrollLock)
     82    {
     83       System.out.println("onKeyboardLedsChange -- VM: " + mach);
     84    }
     85    public void onStateChange(org.virtualbox_3_3.MachineState state)
     86    {
     87       System.out.println("onStateChange -- VM: " + mach);
     88    }
     89    public void onAdditionsStateChange()
     90    {
     91       System.out.println("onAdditionsStateChange -- VM: " + mach);
     92    }
     93    public void onNetworkAdapterChange(org.virtualbox_3_3.INetworkAdapter networkAdapter)
     94    {
     95       System.out.println("onNetworkAdapterChange -- VM: " + mach);
     96    }
     97    public void onSerialPortChange(org.virtualbox_3_3.ISerialPort serialPort)
     98    {
     99       System.out.println("onSerialPortChange -- VM: " + mach);
     100    }
     101    public void onParallelPortChange(org.virtualbox_3_3.IParallelPort parallelPort)
     102    {
     103       System.out.println("onParallelPortChange -- VM: " + mach);
     104    }
     105    public void onStorageControllerChange()
     106    {
     107       System.out.println("onStorageControllerChange -- VM: " + mach);
     108    }
     109    public void onMediumChange(org.virtualbox_3_3.IMediumAttachment mediumAttachment)
     110    {
     111       System.out.println("onMediumChange -- VM: " + mach);
     112    }
     113    public void onCPUChange(Long cpu, Boolean add)
     114    {
     115       System.out.println("onCPUChange -- VM: " + mach);
     116    }
     117    public void onVRDPServerChange()
     118    {
     119       System.out.println("onVRDPServerChange -- VM: " + mach);
     120    }
     121    public void onRemoteDisplayInfoChange()
     122    {
     123       System.out.println("onRemoteDisplayInfoChange -- VM: " + mach);
     124    }
     125    public void onUSBControllerChange()
     126    {
     127       System.out.println("onUSBControllerChange -- VM: " + mach);
     128    }
     129    public void onUSBDeviceStateChange(org.virtualbox_3_3.IUSBDevice device, Boolean attached, org.virtualbox_3_3.IVirtualBoxErrorInfo error)
     130    {
     131       System.out.println("onUSBDeviceStateChange -- VM: " + mach);
     132    }
     133    public void onSharedFolderChange(org.virtualbox_3_3.Scope scope)
     134    {
     135       System.out.println("onSharedFolderChange -- VM: " + mach);
     136    }
     137
     138    public void onRuntimeError(Boolean fatal, String id, String message)
     139    {
     140       System.out.println("onRuntimeError -- VM: " + mach);
     141    }
     142
     143    public Boolean onCanShowWindow()
     144    {
     145       System.out.println("onCanShowWindow -- VM: " + mach);
     146       return true;
     147    }
     148
     149    public BigInteger onShowWindow()
     150    {
     151       System.out.println("onShowWindow -- VM: " + mach);
     152       return BigInteger.ZERO;
     153    }
     154}
     155
    65156public class TestVBox
    66157{
     
    70161        IVirtualBoxCallback cbs = new VBoxCallbacks();
    71162        mgr.registerGlobalCallback(vbox, cbs);
    72         for (int i=0; i<100; i++)
    73         {
     163
     164        IMachine mach = vbox.getMachines().get(0);
     165        IConsoleCallback mcbs = new ConsoleCallbacks(mach.getName());
     166
     167        ISession session = null;
     168        try {
     169          session = mgr.openMachineSession(mach);
     170          mgr.registerMachineCallback(session, mcbs);
     171
     172          for (int i=0; i<100; i++)
     173          {
    74174            mgr.waitForEvents(500);
     175          }
     176
     177          System.out.println("done waiting");
     178
     179          mgr.unregisterMachineCallback(session, mcbs);
     180        } catch (Exception e) {
     181          e.printStackTrace();
     182        } finally {
     183          mgr.closeMachineSession(session);
    75184        }
    76185        mgr.unregisterGlobalCallback(vbox, cbs);
  • trunk/src/VBox/Main/glue/vboxapi.py

    r28890 r30207  
    217217            win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
    218218            win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox')
     219            win32com.client.gencache.EnsureDispatch('VirtualBox.Console')
    219220            win32com.client.gencache.EnsureDispatch('VirtualBox.CallbackWrapper')
    220221
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r29950 r30207  
    1455814558           namespace="virtualbox.org">
    1455914559      <interface name="ISession" default="yes"/>
     14560    </class>
     14561
     14562    <class name="Console" uuid="577230FF-164F-4CAC-8548-312D8275A4A7"
     14563           namespace="virtualbox.org">
     14564      <interface name="IConsole" default="yes"/>
    1456014565      <eventsink name="IConsoleCallback" default="yes"/>
    14561 
    1456214566    </class>
     14567
    1456314568    <class name="CallbackWrapper" uuid="49EE8561-5563-4715-B18C-A4B1A490DAFE"
    1456414569           namespace="virtualbox.org">
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r29965 r30207  
    4343#ifdef VBOX_WITH_GUEST_PROPS
    4444# include <VBox/HostServices/GuestPropertySvc.h>  /* For the property notification callback */
     45#endif
     46
     47#ifdef RT_OS_WINDOWS
     48# include "win/VBoxComEvents.h"
    4549#endif
    4650
     
    7983    public VirtualBoxSupportTranslation<Console>,
    8084    VBOX_SCRIPTABLE_IMPL(IConsole)
     85#ifdef RT_OS_WINDOWS
     86    , public CComCoClass<Console, &CLSID_Console>
     87    , public IConnectionPointContainerImpl<Console>
     88    , public IConnectionPointImpl<Console, &IID_IConsoleCallback, CComDynamicUnkArray>
     89#endif
    8190{
    8291    Q_OBJECT
     
    92101        COM_INTERFACE_ENTRY(IConsole)
    93102        COM_INTERFACE_ENTRY(IDispatch)
     103        COM_INTERFACE_ENTRY(IConnectionPointContainer)
    94104    END_COM_MAP()
     105
     106#ifdef RT_OS_WINDOWS
     107    BEGIN_CONNECTION_POINT_MAP(Console)
     108         CONNECTION_POINT_ENTRY(IID_IConsoleCallback)
     109    END_CONNECTION_POINT_MAP()
     110#endif
     111
    95112
    96113    Console();
     
    713730    mCallbackData;
    714731
     732#ifdef RT_OS_WINDOWS
     733    ComEventsHelper                     mComEvHelper;
     734#endif
     735   
    715736    friend struct VMTask;
    716737};
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r29925 r30207  
    9696         CONNECTION_POINT_ENTRY(IID_IVirtualBoxCallback)
    9797    END_CONNECTION_POINT_MAP()
     98   
     99    typedef CComDynamicUnkArray EventListenersList;
    98100#endif
    99101
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette