VirtualBox

Changeset 2463 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 3, 2007 1:53:29 PM (18 years ago)
Author:
vboxsync
Message:

Main & All Frontends: Prototyped a bunch of Main API changes (IVirtualBoxErrorInfo extension for cascading errors; IMachine/IConsoleCallback extension to properly activate the console window; IVirtualBoxCallback::onExtraDataCanChange() support for error messages; minor IHost::createUSBDeviceFilter/removeUSBDeviceFilter corrections).

Location:
trunk/src/VBox
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r2271 r2463  
    264264
    265265    STDMETHOD(OnExtraDataCanChange)(INPTR GUIDPARAM machineId, INPTR BSTR key, INPTR BSTR value,
    266                                     BOOL *changeAllowed)
     266                                    BSTR *error, BOOL *changeAllowed)
    267267    {
    268268        /* we never disagree */
    269269        if (!changeAllowed)
    270270            return E_INVALIDARG;
    271         *changeAllowed = true;
     271        *changeAllowed = TRUE;
    272272        return S_OK;
    273273    }
     
    500500                     fPaused ? "The VM was paused. Continue with HostKey + P after you solved the problem.\n" : "");
    501501        return S_OK;
     502    }
     503
     504    STDMETHOD(OnCanShowWindow)(BOOL *canShow)
     505    {
     506        if (!canShow)
     507            return E_POINTER;
     508        /* @todo return TRUE if gConsole is not NULL */
     509        *canShow = FALSE;
     510        return S_OK;
     511    }
     512
     513    STDMETHOD(OnShowWindow)()
     514    {
     515        /* @todo implement */
     516        return E_NOTIMPL;
    502517    }
    503518
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r2378 r2463  
    367367                                         QString::fromUcs2 (message)));
    368368        return S_OK;
     369    }
     370
     371    STDMETHOD(OnCanShowWindow)(BOOL *canShow)
     372    {
     373        if (!canShow)
     374            return E_POINTER;
     375        /* @todo return TRUE... */
     376        *canShow = FALSE;
     377        return S_OK;
     378    }
     379
     380    STDMETHOD(OnShowWindow)()
     381    {
     382        /* @todo implement */
     383        return E_NOTIMPL;
    369384    }
    370385
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r2392 r2463  
    174174    STDMETHOD(OnExtraDataCanChange)(IN_GUIDPARAM id,
    175175                                    IN_BSTRPARAM key, IN_BSTRPARAM value,
    176                                     BOOL *allowChange)
    177     {
    178         if (!allowChange)
     176                                    BSTR *error, BOOL *allowChange)
     177    {
     178        if (!error || !allowChange)
    179179            return E_INVALIDARG;
    180180
    181181        if (COMBase::toQUuid (id).isNull())
    182182        {
    183             // it's a global extra data key someone wants to change
     183            /* it's a global extra data key someone wants to change */
    184184            QString sKey = QString::fromUcs2 (key);
    185185            QString sVal = QString::fromUcs2 (value);
    186186            if (sKey.startsWith ("GUI/"))
    187187            {
    188                 // try to set the global setting to check its syntax
     188                /* try to set the global setting to check its syntax */
    189189                VBoxGlobalSettings gs (false /* non-null */);
    190190                if (gs.setPublicProperty (sKey, sVal))
    191191                {
    192                     /// @todo (dmik)
    193                     //  report the error message to the server using
    194                     //  IVurtualBoxError
    195                     *allowChange = !!gs; // allow only when no error
     192                    /* this is a known GUI property key */
     193                    if (!gs)
     194                    {
     195                        /* disallow the change when there is an error*/
     196                        *error = SysAllocString ((const OLECHAR *)
     197                                                 gs.lastError().ucs2());
     198                        *allowChange = FALSE;
     199                    }
     200                    else
     201                        *allowChange = TRUE;
    196202                    return S_OK;
    197203                }
     
    199205        }
    200206
    201         // not interested in this key -- never disagree
     207        /* not interested in this key -- never disagree */
    202208        *allowChange = TRUE;
    203209        return S_OK;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.cpp

    r2354 r2463  
    197197
    198198/**
    199  *  Sets a value of the property with the given public name.
    200  *  Returns false if such property is not found, and true otherwise.
     199 *  Sets a value of a property with the given public name.
     200 *  Returns false if the specified property is not found, and true otherwise.
    201201 *
    202202 *  This method (as opposed to #setProperty (const char *name, const QVariant& value))
     
    204204 *
    205205 *  If an error occures while setting the value of the property, #operator !()
    206  *  will return false after this method returns, and #lastError() will contain
     206 *  will return false after this method returns true, and #lastError() will contain
    207207 *  the error message.
    208208 *
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui.h

    r2420 r2463  
    656656     */
    657657    CHost host = vboxGlobal().virtualBox().GetHost();
    658     CHostUSBDeviceFilter removedFilter;
    659658    if (mUSBFilterListModified)
    660         for (ulong count = host.GetUSBDeviceFilters().GetCount(); count; -- count)
    661             host.RemoveUSBDeviceFilter (0, removedFilter);
     659        for (ulong cnt = host.GetUSBDeviceFilters().GetCount(); cnt; -- cnt)
     660            host.RemoveUSBDeviceFilter (0);
    662661
    663662    /* then add all new filters */
     
    877876    }
    878877
    879     /* creating new usb filter */
    880     CHostUSBDeviceFilter hostFilter;
    881     vboxGlobal().virtualBox().GetHost().CreateUSBDeviceFilter (
    882         usbFilterName.arg (maxFilterIndex + 1), hostFilter);
     878    /* create a new usb filter */
     879    CHost host = vboxGlobal().virtualBox().GetHost();
     880    CHostUSBDeviceFilter hostFilter = host
     881        .CreateUSBDeviceFilter (usbFilterName.arg (maxFilterIndex + 1));
    883882    hostFilter.SetAction (CEnums::USBDeviceFilterHold);
    884883
     
    904903
    905904    CHost host = vboxGlobal().virtualBox().GetHost();
    906     CHostUSBDeviceFilter hostFilter;
    907     host.CreateUSBDeviceFilter (vboxGlobal().details (usb), hostFilter);
     905    CHostUSBDeviceFilter hostFilter = host
     906        .CreateUSBDeviceFilter (vboxGlobal().details (usb));
    908907    hostFilter.SetAction (CEnums::USBDeviceFilterHold);
    909908
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r2453 r2463  
    35023502    while (it != mCallbacks.end())
    35033503        (*it++)->OnRuntimeError (aFatal, aErrorID, aMessage);
     3504}
     3505
     3506/**
     3507 *  @note Locks this object for reading.
     3508 */
     3509HRESULT Console::onShowWindow (BOOL aCheck, BOOL *aCanShow)
     3510{
     3511    AssertReturn (aCanShow, E_POINTER);
     3512
     3513    *aCanShow = FALSE;
     3514
     3515    AutoCaller autoCaller (this);
     3516    AssertComRCReturnRC (autoCaller.rc());
     3517
     3518    AutoReaderLock alock (this);
     3519
     3520    HRESULT rc = S_OK;
     3521    CallbackList::iterator it = mCallbacks.begin();
     3522
     3523    if (aCheck)
     3524    {
     3525        while (it != mCallbacks.end())
     3526        {
     3527            BOOL canShow = FALSE;
     3528            rc = (*it++)->OnCanShowWindow (&canShow);
     3529            AssertComRC (rc);
     3530            if (FAILED (rc) || !canShow)
     3531                return rc;
     3532        }
     3533        *aCanShow = TRUE;
     3534    }
     3535    else
     3536    {
     3537        while (it != mCallbacks.end())
     3538        {
     3539            rc = (*it++)->OnShowWindow();
     3540            if (FAILED (rc))
     3541                return rc;
     3542        }
     3543    }
     3544
     3545    return S_OK;
    35043546}
    35053547
  • trunk/src/VBox/Main/MachineImpl.cpp

    r2408 r2463  
    17911791}
    17921792
    1793 /**
    1794  * Returns the extra data key name following the given key. If the key
    1795  * is not found, an error is returned. If NULL is supplied, the first
    1796  * key will be returned. If key is the last item, NULL will be returned.
    1797  *
    1798  * @returns COM status code
    1799  * @param key       extra data key name
    1800  * @param nextKey   name of the key following "key". NULL if "key" is the last.
    1801  * @param nextValue value of the key following "key". Optional parameter.
    1802  */
    1803 STDMETHODIMP Machine::GetNextExtraDataKey(INPTR BSTR key, BSTR *nextKey, BSTR *nextValue)
    1804 {
    1805     if (!nextKey)
     1793STDMETHODIMP Machine::GetNextExtraDataKey (INPTR BSTR aKey, BSTR *aNextKey, BSTR *aNextValue)
     1794{
     1795    if (!aNextKey)
    18061796        return E_POINTER;
    18071797
     
    18121802
    18131803    /* start with nothing found */
    1814     *nextKey = NULL;
     1804    *aNextKey = NULL;
    18151805
    18161806    /*
     
    18481838
    18491839            /* if we're supposed to return the first one */
    1850             if (key == NULL)
     1840            if (aKey == NULL)
    18511841            {
    1852                 name.cloneTo(nextKey);
    1853                 if (nextValue)
    1854                     CFGLDRQueryBSTR(extraDataItemNode, "value", nextValue);
     1842                name.cloneTo(aNextKey);
     1843                if (aNextValue)
     1844                    CFGLDRQueryBSTR(extraDataItemNode, "value", aNextValue);
    18551845                found = true;
    18561846            }
    18571847            /* did we find the key we're looking for? */
    1858             else if (name == key)
     1848            else if (name == aKey)
    18591849            {
    18601850                found = true;
     
    18641854                    CFGLDRGetChildNode(extraDataNode, "ExtraDataItem", i + 1, &extraDataItemNode);
    18651855                    CFGLDRQueryBSTR(extraDataItemNode, "name", name.asOutParam());
    1866                     name.cloneTo(nextKey);
    1867                     if (nextValue)
    1868                         CFGLDRQueryBSTR(extraDataItemNode, "value", nextValue);
     1856                    name.cloneTo(aNextKey);
     1857                    if (aNextValue)
     1858                        CFGLDRQueryBSTR(extraDataItemNode, "value", aNextValue);
    18691859                    found = true;
    18701860                }
     
    18721862                {
    18731863                    /* it's the last one */
    1874                     *nextKey = NULL;
     1864                    *aNextKey = NULL;
    18751865                }
    18761866            }
     
    18911881}
    18921882
    1893 /**
    1894  * Returns associated extra data from the configuration. If the key does
    1895  * not exist, NULL will be stored in the output pointer.
    1896  *
    1897  * @returns COM status code
    1898  * @param key    extra data key
    1899  * @param value  address of result pointer
    1900  */
    1901 STDMETHODIMP Machine::GetExtraData(INPTR BSTR key, BSTR *value)
    1902 {
    1903     if (!key)
     1883STDMETHODIMP Machine::GetExtraData (INPTR BSTR aKey, BSTR *aValue)
     1884{
     1885    if (!aKey)
    19041886        return E_INVALIDARG;
    1905     if (!value)
     1887    if (!aValue)
    19061888        return E_POINTER;
    19071889
     
    19121894
    19131895    /* start with nothing found */
    1914     *value = NULL;
     1896    *aValue = NULL;
    19151897
    19161898    /*
     
    19461928            CFGLDRGetChildNode(extraDataNode, "ExtraDataItem", i, &extraDataItemNode);
    19471929            CFGLDRQueryBSTR(extraDataItemNode, "name", name.asOutParam());
    1948             if (name == key)
     1930            if (name == aKey)
    19491931            {
    19501932                found = true;
    1951                 CFGLDRQueryBSTR(extraDataItemNode, "value", value);
     1933                CFGLDRQueryBSTR(extraDataItemNode, "value", aValue);
    19521934            }
    19531935            CFGLDRReleaseNode(extraDataItemNode);
     
    19641946
    19651947/**
    1966  *  Stores associated extra data in the configuration. If the data value is NULL
    1967  *  then the corresponding extra data item is deleted. This method can be called
    1968  *  outside a session and therefore belongs to the non protected machine data.
    1969  *
    1970  *  @param key    extra data key
    1971  *  @param value  extra data value
    1972  *
    19731948 *  @note Locks mParent for reading + this object for writing.
    19741949 */
    1975 STDMETHODIMP Machine::SetExtraData (INPTR BSTR key, INPTR BSTR value)
    1976 {
    1977     if (!key)
     1950STDMETHODIMP Machine::SetExtraData (INPTR BSTR aKey, INPTR BSTR aValue)
     1951{
     1952    if (!aKey)
    19781953        return E_INVALIDARG;
    19791954
     
    20151990
    20161991    vrc = CFGLDRGetChildNode (machineNode, "ExtraData", 0, &extraDataNode);
    2017     if (VBOX_FAILURE (vrc) && value)
     1992    if (VBOX_FAILURE (vrc) && aValue)
    20181993        vrc = CFGLDRCreateChildNode (machineNode, "ExtraData", &extraDataNode);
    20191994
     
    20312006            Bstr name;
    20322007            CFGLDRQueryBSTR (extraDataItemNode, "name", name.asOutParam());
    2033             if (name == key)
     2008            if (name == aKey)
    20342009            {
    20352010                CFGLDRQueryBSTR (extraDataItemNode, "value", oldVal.asOutParam());
     
    20442019         *  Note:
    20452020         *  1. when oldVal is null, |oldVal == (BSTR) NULL| is true
    2046          *  2. we cannot do |oldVal != value| because it will compare
     2021         *  2. we cannot do |oldVal != aValue| because it will compare
    20472022         *  BSTR pointers instead of strings (due to type conversion ops)
    20482023         */
    2049         changed = !(oldVal == value);
     2024        changed = !(oldVal == aValue);
    20502025
    20512026        if (changed)
    20522027        {
    20532028            /* ask for permission from all listeners */
    2054             if (!mParent->onExtraDataCanChange (mData->mUuid, key, value))
     2029            Bstr error;
     2030            if (!mParent->onExtraDataCanChange (mData->mUuid, aKey, aValue, error))
    20552031            {
    2056                 LogWarningFunc (("Someone vetoed! Change refused!\n"));
     2032                const char *sep = error.isEmpty() ? "" : ": ";
     2033                const BSTR err = error.isNull() ? (const BSTR) L"" : error.raw();
     2034                LogWarningFunc (("Someone vetoed! Change refused%s%ls\n",
     2035                                 sep, err));
    20572036                rc = setError (E_ACCESSDENIED,
    20582037                    tr ("Could not set extra data because someone refused "
    2059                         "the requested change of '%ls' to '%ls'"), key, value);
     2038                        "the requested change of '%ls' to '%ls'%s%ls"),
     2039                    aKey, aValue, sep, err);
    20602040            }
    20612041            else
    20622042            {
    2063                 if (value)
     2043                if (aValue)
    20642044                {
    20652045                    if (!extraDataItemNode)
     
    20682048                        CFGLDRAppendChildNode (extraDataNode, "ExtraDataItem",
    20692049                                               &extraDataItemNode);
    2070                         CFGLDRSetBSTR (extraDataItemNode, "name", key);
     2050                        CFGLDRSetBSTR (extraDataItemNode, "name", aKey);
    20712051                    }
    2072                     CFGLDRSetBSTR (extraDataItemNode, "value", value);
     2052                    CFGLDRSetBSTR (extraDataItemNode, "value", aValue);
    20732053                }
    20742054                else
     
    20972077    if (SUCCEEDED (rc) && changed)
    20982078    {
    2099         mParent->onExtraDataChange (mData->mUuid, key, value);
     2079        mParent->onExtraDataChange (mData->mUuid, aKey, aValue);
    21002080    }
    21012081
     
    23132293
    23142294    return S_OK;
     2295}
     2296
     2297STDMETHODIMP Machine::CanShowConsoleWindow (BOOL *aCanShow)
     2298{
     2299    if (!aCanShow)
     2300        return E_POINTER;
     2301
     2302    /* start with No */
     2303    aCanShow = FALSE;
     2304
     2305    AutoCaller autoCaller (this);
     2306    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     2307
     2308    ComPtr <IInternalSessionControl> directControl;
     2309    {
     2310        AutoReaderLock alock (this);
     2311
     2312        if (mData->mSession.mState != SessionState_SessionOpen)
     2313            return setError (E_FAIL,
     2314                tr ("Machine session is not open (session state: %d)"),
     2315                mData->mSession.mState);
     2316
     2317        directControl = mData->mSession.mDirectControl;
     2318    }
     2319
     2320    /* ignore calls made after #OnSessionEnd() is called */
     2321    if (!directControl)
     2322        return S_OK;
     2323
     2324    return directControl->OnShowWindow (TRUE /* aCheck */, aCanShow);
     2325}
     2326
     2327STDMETHODIMP Machine::ShowConsoleWindow()
     2328{
     2329    AutoCaller autoCaller (this);
     2330    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     2331
     2332    ComPtr <IInternalSessionControl> directControl;
     2333    {
     2334        AutoReaderLock alock (this);
     2335
     2336        if (mData->mSession.mState != SessionState_SessionOpen)
     2337            return setError (E_FAIL,
     2338                tr ("Machine session is not open (session state: %d)"),
     2339                mData->mSession.mState);
     2340
     2341        directControl = mData->mSession.mDirectControl;
     2342    }
     2343
     2344    /* ignore calls made after #OnSessionEnd() is called */
     2345    if (!directControl)
     2346        return S_OK;
     2347
     2348    BOOL dummy;
     2349    return directControl->OnShowWindow (FALSE /* aCheck */, &dummy);
    23152350}
    23162351
  • trunk/src/VBox/Main/SessionImpl.cpp

    r678 r2463  
    588588
    589589    return mConsole->onUSBDeviceDetach (aId);
     590}
     591
     592STDMETHODIMP Session::OnShowWindow (BOOL aCheck, BOOL *aCanShow)
     593{
     594    AutoCaller autoCaller (this);
     595    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     596
     597    AutoReaderLock alock (this);
     598    AssertReturn (mState == SessionState_SessionOpen &&
     599                  mType == SessionType_DirectSession, E_FAIL);
     600
     601    return mConsole->onShowWindow (aCheck, aCanShow);
    590602}
    591603
  • trunk/src/VBox/Main/VirtualBoxErrorInfoImpl.cpp

    r1 r2463  
    2626////////////////////////////////////////////////////////////////////////////////
    2727
    28 void VirtualBoxErrorInfo::init (HRESULT resultCode, const GUID &iid,
    29                                 const BSTR component, const BSTR text)
     28void VirtualBoxErrorInfo::init (HRESULT aResultCode, const GUID &aIID,
     29                                const BSTR aComponent, const BSTR aText,
     30                                IVirtualBoxErrorInfo *aNext)
    3031{
    31     mResultCode = resultCode;
    32     mIID = iid;
    33     mComponent = component;
    34     mText = text;
     32    mResultCode = aResultCode;
     33    mIID = aIID;
     34    mComponent = aComponent;
     35    mText = aText;
     36    mNext = aNext;
    3537}
    3638
     
    3840////////////////////////////////////////////////////////////////////////////////
    3941
    40 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(ResultCode) (HRESULT *resultCode)
     42STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(ResultCode) (HRESULT *aResultCode)
    4143{
    42     if (!resultCode)
     44    if (!aResultCode)
    4345        return E_POINTER;
    4446
    45     *resultCode = mResultCode;
     47    *aResultCode = mResultCode;
    4648    return S_OK;
    4749}
    4850
    49 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(InterfaceID) (GUIDPARAMOUT iid)
     51STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(InterfaceID) (GUIDPARAMOUT aIID)
    5052{
    51     if (!iid)
     53    if (!aIID)
    5254        return E_POINTER;
    5355
    54     mIID.cloneTo (iid);
     56    mIID.cloneTo (aIID);
    5557    return S_OK;
    5658}
    5759
    58 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Component) (BSTR *component)
     60STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Component) (BSTR *aComponent)
    5961{
    60     if (!component)
     62    if (!aComponent)
    6163        return E_POINTER;
    6264
    63     mComponent.cloneTo (component);
     65    mComponent.cloneTo (aComponent);
    6466    return S_OK;
    6567}
    6668
    67 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Text) (BSTR *text)
     69STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Text) (BSTR *aText)
    6870{
    69     if (!text)
     71    if (!aText)
    7072        return E_POINTER;
    7173
    72     mText.cloneTo (text);
     74    mText.cloneTo (aText);
    7375    return S_OK;
     76}
     77
     78STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Next) (IVirtualBoxErrorInfo **aNext)
     79{
     80    if (!aNext)
     81        return E_POINTER;
     82
     83    /* this will set aNext to NULL if mNext is null */
     84    return mNext.queryInterfaceTo (aNext);
    7485}
    7586
     
    158169NS_IMETHODIMP VirtualBoxErrorInfo::GetInner (nsIException **aInner)
    159170{
    160     return NS_ERROR_NOT_IMPLEMENTED;
     171    ComPtr <IVirtualBoxErrorInfo> info;
     172    nsresult rv = COMGETTER(Next) (info.asOutParam());
     173    CheckComRCReturnRC (rv);
     174    return info.queryInterfaceTo (aInner);
    161175}
    162176
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r2358 r2463  
    18121812        {
    18131813            /* ask for permission from all listeners */
    1814             if (!onExtraDataCanChange (emptyGuid, aKey, aValue))
     1814            Bstr error;
     1815            if (!onExtraDataCanChange (emptyGuid, aKey, aValue, error))
    18151816            {
    1816                 Log (("VirtualBox::SetExtraData(): Someone vetoed! Change refused\n"));
     1817                const char *sep = error.isEmpty() ? "" : ": ";
     1818                const BSTR err = error.isNull() ? (const BSTR) L"" : error.raw();
     1819                LogWarningFunc (("Someone vetoed! Change refused%s%ls\n",
     1820                                 sep, err));
    18171821                rc = setError (E_ACCESSDENIED,
    18181822                    tr ("Could not set extra data because someone refused "
    1819                         "the requested change of '%ls' to '%ls'"), aKey, aValue);
     1823                        "the requested change of '%ls' to '%ls'%s%ls"),
     1824                    aKey, aValue, sep, err);
    18201825            }
    18211826            else
     
    24902495 *  @note Doesn't lock any object.
    24912496 */
    2492 void VirtualBox::onMachineStateChange (const Guid &id, MachineState_T state)
    2493 {
    2494     postEvent (new MachineEvent (this, id, state));
     2497void VirtualBox::onMachineStateChange (const Guid &aId, MachineState_T aState)
     2498{
     2499    postEvent (new MachineEvent (this, aId, aState));
    24952500}
    24962501
     
    24982503 *  @note Doesn't lock any object.
    24992504 */
    2500 void VirtualBox::onMachineDataChange (const Guid &id)
    2501 {
    2502     postEvent (new MachineEvent (this, id));
     2505void VirtualBox::onMachineDataChange (const Guid &aId)
     2506{
     2507    postEvent (new MachineEvent (this, aId));
    25032508}
    25042509
     
    25062511 *  @note Locks this object for reading.
    25072512 */
    2508 BOOL VirtualBox::onExtraDataCanChange(const Guid &id, INPTR BSTR key, INPTR BSTR value)
    2509 {
    2510     LogFlowThisFunc(("machine={%s} key={%ls} val={%ls}\n",
    2511                      id.toString().raw(), key, value));
     2513BOOL VirtualBox::onExtraDataCanChange (const Guid &aId, INPTR BSTR aKey, INPTR BSTR aValue,
     2514                                       Bstr &aError)
     2515{
     2516    LogFlowThisFunc (("machine={%s} aKey={%ls} aValue={%ls}\n",
     2517                      aId.toString().raw(), aKey, aValue));
     2518
     2519    AutoCaller autoCaller (this);
     2520    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    25122521
    25132522    CallbackList list;
     
    25172526    }
    25182527
    2519     BOOL allowChange = true;
     2528    BOOL allowChange = TRUE;
    25202529    CallbackList::iterator it = list.begin();
    25212530    while ((it != list.end()) && allowChange)
    25222531    {
    2523         HRESULT rc = (*it++)->OnExtraDataCanChange(id, key, value, &allowChange);
     2532        HRESULT rc = (*it++)->OnExtraDataCanChange (aId, aKey, aValue,
     2533                                                    aError.asOutParam(), &allowChange);
    25242534        if (FAILED (rc))
    25252535        {
    2526             /*
    2527              *  if a call to this method fails for some reason (for ex., because
    2528              *  the other side is dead), we ensure allowChange stays true
    2529              *  (MS COM RPC implementation seems to zero all output vars before
    2530              *  issuing an IPC call or after a failure, so it's essential there)
    2531              */
    2532             allowChange = true;
    2533         }
    2534     }
    2535 
    2536     LogFlowThisFunc (("allowChange=%d\n", allowChange));
     2536            /* if a call to this method fails for some reason (for ex., because
     2537             * the other side is dead), we ensure allowChange stays true
     2538             * (MS COM RPC implementation seems to zero all output vars before
     2539             * issuing an IPC call or after a failure, so it's essential
     2540             * there) */
     2541            allowChange = TRUE;
     2542        }
     2543    }
     2544
     2545    LogFlowThisFunc (("allowChange=%RTbool\n", allowChange));
    25372546    return allowChange;
    25382547}
     
    25612570 *  @note Doesn't lock any object.
    25622571 */
    2563 void VirtualBox::onExtraDataChange (const Guid &id, INPTR BSTR key, INPTR BSTR value)
    2564 {
    2565     postEvent (new ExtraDataEvent (this, id, key, value));
     2572void VirtualBox::onExtraDataChange (const Guid &aId, INPTR BSTR aKey, INPTR BSTR aValue)
     2573{
     2574    postEvent (new ExtraDataEvent (this, aId, aKey, aValue));
    25662575}
    25672576
     
    25952604 *  @note Doesn't lock any object.
    25962605 */
    2597 void VirtualBox::onSessionStateChange (const Guid &id, SessionState_T state)
    2598 {
    2599     postEvent (new SessionEvent (this, id, state));
     2606void VirtualBox::onSessionStateChange (const Guid &aId, SessionState_T aState)
     2607{
     2608    postEvent (new SessionEvent (this, aId, aState));
    26002609}
    26012610
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r2365 r2463  
    349349    <interface
    350350        name="IVirtualBoxErrorInfo" extends="$errorinfo"
    351         uuid="37EDE76D-6E16-4CE4-9D48-2C5A87AFFEA2"
     351        uuid="e98b5376-8eb4-4eea-812a-3964bf3bb26f"
    352352        supportsErrorInfo="no"
    353353        wsmap="struct"
     
    360360            In MS COM, this interface extends the IErrorInfo interface,
    361361            in XPCOM, it extends the nsIException interface. In both cases,
    362             it provides a set of common attributes to retrieve error information.
     362            it provides a set of common attributes to retrieve error
     363            information.
     364
     365            Sometimes invocation of some component's method may involve
     366            methods of other components that may also fail (independently of
     367            this method's failure), or a series of non-fatal errors may precede
     368            a fatal error that causes method failure. In cases like that, it
     369            may be desirable to preserve information about all errors happened
     370            during method invocation and deliver it to the caller. The <link
     371            to="#next"/> attribute is intended specifically for this purpose
     372            and allows to represent a chain of errors through a single
     373            IVirtualBoxErrorInfo instance set after method invocation.
    363374        </desc>
    364375
     
    374385                <note>
    375386                    In MS COM, there is no equivalent.
    376                     In XPCOM, it is the same as to nsIException::result.
     387                    In XPCOM, it is the same as nsIException::result.
    377388                </note>
    378389            </desc>
     
    383394                UUID of the interface that defined the error.
    384395                <note>
    385                     In MS COM, it is the same as  to IErrorInfo::GetGUID.
     396                    In MS COM, it is the same as IErrorInfo::GetGUID.
    386397                    In XPCOM, there is no equivalent.
    387398                </note>
     
    393404                Name of the component that generated the error.
    394405                <note>
    395                     In MS COM, it is the same as to IErrorInfo::GetSource.
     406                    In MS COM, it is the same as IErrorInfo::GetSource.
    396407                    In XPCOM, there is no eqiuvalent.
    397408                </note>
     
    404415                <note>
    405416                    In MS COM, it is the same as IErrorInfo::GetDescription.
    406                     In XPCOM, it is the same as to nsIException::message.
     417                    In XPCOM, it is the same as nsIException::message.
     418                </note>
     419            </desc>
     420        </attribute>
     421
     422        <attribute name="next" type="IVirtualBoxErrorInfo" readonly="yes">
     423            <desc>
     424                Next error object if there is any, or @c null otherwise.
     425                <note>
     426                    In MS COM, there is no equivalent.
     427                    In XPCOM, it is the same as nsIException::inner.
    407428                </note>
    408429            </desc>
     
    419440    <interface
    420441        name="IVirtualBoxCallback" extends="$unknown"
    421         uuid="1293842f-0380-47cf-80b5-e4f821861b26"
     442        uuid="ee95ffc2-b6c6-4ce8-9e9e-ceadbb5019fe"
    422443        wsmap="suppress"
    423444    >
     
    452473            <param name="machineId" type="uuid" dir="in">
    453474                <desc>
    454                     ID of the machine this event relates to.
    455                     Nul for global extra data change requests.
     475                    ID of the machine this event relates to
     476                    (null ID for global extra data change requests).
    456477                </desc>
    457478            </param>
     
    466487                </desc>
    467488            </param>
     489            <param name="error" type="wstring" dir="out">
     490                <desc>
     491                    Optional error message describing the reason of the
     492                    veto (ignored if this notification returns @c true).
     493                </desc>
     494            </param>
    468495            <param name="allowChange" type="boolean" dir="return">
    469496                <desc>
    470                     Flag to indicate whether the callee agrees (true)
    471                     or vetoes against the change (false).
     497                    Flag to indicate whether the callee agrees (@ true)
     498                    or vetoes against the change (@ false).
    472499                </desc>
    473500            </param>
     
    972999                until <link to="#registerHardDisk()"/> is called.
    9731000
    974                 @deprecated Use <link to="#openHardDisk()"/> instead.
     1001                @deprecated Use <link to="IVirtualBox::openHardDisk()"/> instead.
    9751002
    9761003                <note>Opening differencing images is not supported.</note>
     
    10561083                Returns a registered hard disk that uses the given image file.
    10571084
    1058                 @deprecated Use <link to="#findHardDisk()"/> instead.
     1085                @deprecated Use <link to="IVirtualBox::findHardDisk()"/> instead.
    10591086
    10601087                <note>The specified file path can be absolute (full path) or
     
    13621389                Returns the extra data key name following the supplied key.
    13631390                An error is returned if the supplied key does not exist.
    1364                 NULL is returned if the supplied key is the last key.
    1365                 When supplying NULL for the key, the first item is returned.
    1366                 NextValue is an optional parameter and if supplied, the next
    1367                 key's value is returned as well.
    1368             </desc>
    1369             <param name="key" type="wstring" dir="in"/>
    1370             <param name="nextKey" type="wstring" dir="out"/>
    1371             <param name="nextValue" type="wstring" dir="out"/>
     1391                @c NULL is returned if the supplied key is the last key.
     1392                When supplying @c NULL for the key, the first item is returned.
     1393                @a nextValue is an optional parameter and if supplied, the next
     1394                key's value is returned in it.
     1395            </desc>
     1396            <param name="key" type="wstring" dir="in">
     1397                <desc>Name of the data key to follow.</desc>
     1398            </param>
     1399            <param name="nextKey" type="wstring" dir="out">
     1400                <desc>Name of the next data key.</desc>
     1401            </param>
     1402            <param name="nextValue" type="wstring" dir="out">
     1403                <desc>Value of the next data key.</desc>
     1404            </param>
    13721405        </method>
    13731406
    13741407        <method name="getExtraData">
    1375             <desc>Returns associated extra data.</desc>
    1376             <param name="key" type="wstring" dir="in"/>
    1377             <param name="value" type="wstring" dir="return"/>
     1408            <desc>
     1409                Returns associated extra data.
     1410                If the reuqested key does not exist, this function will
     1411                succeed and return @c null in the @a value argument.
     1412            </desc>
     1413            <param name="key" type="wstring" dir="in">
     1414                <desc>Name of the data key to get.</desc>
     1415            </param>
     1416            <param name="value" type="wstring" dir="return">
     1417                <desc>Value of the requested data key.</desc>
     1418            </param>
    13781419        </method>
    13791420
    13801421        <method name="setExtraData">
    1381             <desc>Sets associated extra data.</desc>
    1382             <param name="key" type="wstring" dir="in"/>
    1383             <param name="value" type="wstring" dir="in"/>
     1422            <desc>
     1423                Sets associated extra data.
     1424                If you pass @c NULL as a key @a vaule, the given key will be
     1425                deleted.
     1426                <note>
     1427                    This method can be called outside a machine session and
     1428                    therefore it's a caller's responsibility to handle race
     1429                    condition when several clients change the same key at the
     1430                    same time.
     1431                </note>
     1432            </desc>
     1433            <param name="key" type="wstring" dir="in">
     1434                <desc>Name of the data key to set.</desc>
     1435            </param>
     1436            <param name="value" type="wstring" dir="in">
     1437                <desc>Value to assign to the key.</desc>
     1438            </param>
    13841439        </method>
    13851440
     
    18251880    <interface
    18261881        name="IMachine" extends="$unknown"
    1827         uuid="50fa9181-d2d4-45ca-bf0e-742677b9c707"
     1882        uuid="f0ad6688-2216-4654-a375-10afc5b88dcd"
    18281883        wsmap="uuid"
    18291884    >
     
    25102565        </method>
    25112566
     2567        <method name="canShowConsoleWindow">
     2568            <desc>
     2569                Returns @c true if the VM console process can activate the
     2570                console window and bring it to foreground on the desktop of
     2571                the host PC.
     2572                <note>
     2573                    This method will fail if a session for this machine is not
     2574                    currently open.
     2575                </note>
     2576            </desc>
     2577            <param name="canShow" type="boolean" dir="return">
     2578                <desc>
     2579                    @c true if the console window can be shown and @c
     2580                    false otherwise.
     2581                </desc>
     2582            </param>
     2583        </method>
     2584
     2585        <method name="showConsoleWindow">
     2586            <desc>
     2587                Returns @c true if the VM console process can activate the
     2588                console window and bring it to foreground on the desktop of
     2589                the host PC.
     2590                <note>
     2591                    This method will fail if a session for this machine is not
     2592                    currently open.
     2593                </note>
     2594            </desc>
     2595        </method>
     2596
    25122597    </interface>
    25132598
     
    25192604    <interface
    25202605        name="IConsoleCallback" extends="$unknown"
    2521         uuid="05D3DD3F-0550-4953-BB3C-4ECB3EBF7C2E"
     2606        uuid="a56eff10-6db9-4985-a12a-039b604b491b"
    25222607        wsmap="suppress"
    25232608    >
     
    26732758
    26742759                <note>
    2675                     This notification is not designed to be implemented by more
    2676                     than one callback at a time. If you have multiple
     2760                    This notification is not designed to be implemented by
     2761                    more than one callback at a time. If you have multiple
    26772762                    IConsoleCallback instances registered on the given
    2678                     IConsole object, make sure you just return S_OK from all but
    2679                     one of them that does actual user notification and performs
    2680                     necessary actions.
     2763                    IConsole object, make sure you simply do nothing but
     2764                    return @c S_OK from all but one of them that does actual
     2765                    user notification and performs necessary actions.
    26812766                </note>
    26822767
     
    26912776                <desc>Optional error message</desc>
    26922777            </param>
     2778        </method>
     2779
     2780        <method name="onCanShowWindow">
     2781            <desc>
     2782                Notification when a call to
     2783                <link to="IMachine::canShowConsoleWindow()"/> is made by a
     2784                front-end to check if a subsequent call to
     2785                <link to="IMachine::showConsoleWindow()"/> can succeed.
     2786
     2787                The callee should give an answer appropriate to the current
     2788                machine state in the @a canShow argument. This answer must
     2789                remain valid at least until the next
     2790                <link to="IConsole::state">machine state</link> change.
     2791
     2792                <note>
     2793                    This notification is not designed to be implemented by
     2794                    more than one callback at a time. If you have multiple
     2795                    IConsoleCallback instances registered on the given
     2796                    IConsole object, make sure you simply do nothing but
     2797                    return @c true and @c S_OK from all but one of them that
     2798                    actually manages console window activation.
     2799                </note>
     2800            </desc>
     2801            <param name="canShow" type="boolean" dir="return">
     2802                <desc>
     2803                    @c true if the console window can be shown and @c
     2804                    false otherwise.
     2805                </desc>
     2806            </param>
     2807        </method>
     2808
     2809        <method name="onShowWindow">
     2810            <desc>
     2811                Notification when a call to
     2812                <link to="IMachine::showConsoleWindow()"/>
     2813                requests the console window to be activated and brought to
     2814                foreground on the desktop of the host PC.
     2815
     2816                This notification should cause the VM console process to
     2817                perform the requested action as described above. If it is
     2818                impossible to do it at a time of this notification, this
     2819                method should return a failure.
     2820
     2821                <note>
     2822                    This notification is not designed to be implemented by
     2823                    more than one callback at a time. If you have multiple
     2824                    IConsoleCallback instances registered on the given
     2825                    IConsole object, make sure you simply do nothing but
     2826                    return@c S_OK from all but one of them that actually
     2827                    manages console window activation.
     2828                </note>
     2829            </desc>
    26932830        </method>
    26942831
     
    34273564    <interface
    34283565        name="IHost" extends="$unknown"
    3429         uuid="FD443EC1-000B-4F5B-9282-D72760A66916"
     3566        uuid="81729c26-1aec-46f5-b7c0-cc7364738fdb"
    34303567        wsmap="global"
    34313568    >
     
    35613698                </desc>
    35623699            </param>
    3563             <param name="filter" type="IHostUSBDeviceFilter" dir="out">
     3700            <param name="filter" type="IHostUSBDeviceFilter" dir="return">
    35643701                <desc>Created filter object.</desc>
    35653702            </param>
     
    36053742                <desc>Position to remove the filter from.</desc>
    36063743            </param>
    3607             <param name="filter" type="IHostUSBDeviceFilter" dir="out">
     3744            <param name="filter" type="IHostUSBDeviceFilter" dir="return">
    36083745                <desc>Removed USB device filter.</desc>
    36093746            </param>
     
    58786015                the @a vram parameter of this method.
    58796016
    5880                 For non linear modes (such as text and standard VGA), the
    5881                 @vram parameter is NULL and must not be used. When it's not
     6017                For non linear modes (such as text and standard VGA), the @a
     6018                vram parameter is @c NULL and must not be used. When it's not
    58826019                NULL, it is recommended to use it to access the guest video
    58836020                memory instead of creating a separate buffer as it will at
     
    58986035                <desc>Pointer to the guest VRAM (NULL for non linear modes)</desc>
    58996036            </param>
    5900             <param name="lineSize" type="unsigned long" dir="in"/>
    5901             <param name="width" type="unsigned long" dir="in"/>
    5902             <param name="height" type="unsigned long" dir="in"/>
    5903             <param name="finished" type="boolean" dir="return"/>
     6037            <param name="lineSize" type="unsigned long" dir="in">
     6038                <desc>Size of one scan line, in bytes.</desc>
     6039            </param>
     6040            <param name="width" type="unsigned long" dir="in">
     6041                <desc>Width of the guest display, in pixels.</desc>
     6042            </param>
     6043            <param name="height" type="unsigned long" dir="in">
     6044                <desc>Height of the guest display, in pixels.</desc>
     6045            </param>
     6046            <param name="finished" type="boolean" dir="return">
     6047                <desc>
     6048                    Can the VM start using the new framebuffer immediately
     6049                    after this method returns or it should wait for
     6050                    <link to="IDisplay::resizeCompleted()"/>.
     6051                </desc>
     6052            </param>
    59046053        </method>
    59056054
     
    71467295    <interface
    71477296        name="IInternalSessionControl" extends="$unknown"
    7148         uuid="A99D5EB3-02DE-48e4-B059-91A8A41B4DA1"
     7297        uuid="9c6bec01-4135-40a0-b9d3-ab119a9c5412"
    71497298        internal="yes"
    71507299        wsmap="suppress"
     
    72497398        </method>
    72507399
     7400        <method name="onShowWindow">
     7401            <desc>
     7402                Called by <link to="IMachine::canShowConsoleWindow()"/> and by
     7403                <link to="IMachine::showConsoleWindow()"/> in order to notify
     7404                console callbacks
     7405                <link to="IConsoleCallback::onCanShowWindow()"/>
     7406                and <link to="IConsoleCallback::onShowWindow()"/>.
     7407            </desc>
     7408            <param name="check" type="boolean" dir="in"/>
     7409            <param name="canShow" type="boolean" dir="out"/>
     7410        </method>
     7411
    72517412    </interface>
    72527413
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r2453 r2463  
    199199    void onKeyboardLedsChange (bool fNumLock, bool fCapsLock, bool fScrollLock);
    200200    void onRuntimeError (BOOL aFatal, INPTR BSTR aErrorID, INPTR BSTR aMessage);
     201    HRESULT onShowWindow (BOOL aCheck, BOOL *aCanShow);
    201202
    202203    static const PDMDRVREG DrvStatusReg;
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r2219 r2463  
    108108    }
    109109
     110    STDMETHOD(OnCanShowWindow)(BOOL *canShow)
     111    {
     112        if (canShow)
     113            *canShow = TRUE;
     114        return S_OK;
     115    }
     116
     117    STDMETHOD(OnShowWindow)()
     118    {
     119        return S_OK;
     120    }
     121
    110122    // IDisplay properties
    111123    STDMETHOD(COMGETTER(Width)) (ULONG *width);
  • trunk/src/VBox/Main/include/MachineImpl.h

    r1721 r2463  
    355355    STDMETHOD(DetachHardDisk) (DiskControllerType_T aCtl, LONG aDev);
    356356    STDMETHOD(GetNetworkAdapter) (ULONG slot, INetworkAdapter **adapter);
    357     STDMETHOD(GetNextExtraDataKey)(INPTR BSTR key, BSTR *nextKey, BSTR *nextValue);
    358     STDMETHOD(GetExtraData)(INPTR BSTR key, BSTR *value);
    359     STDMETHOD(SetExtraData)(INPTR BSTR key, INPTR BSTR value);
     357    STDMETHOD(GetNextExtraDataKey)(INPTR BSTR aKey, BSTR *aNextKey, BSTR *aNextValue);
     358    STDMETHOD(GetExtraData)(INPTR BSTR aKey, BSTR *aValue);
     359    STDMETHOD(SetExtraData)(INPTR BSTR aKey, INPTR BSTR aValue);
    360360    STDMETHOD(SaveSettings)();
    361361    STDMETHOD(DiscardSettings)();
     
    364364    STDMETHOD(FindSnapshot) (INPTR BSTR aName, ISnapshot **aSnapshot);
    365365    STDMETHOD(SetCurrentSnapshot) (INPTR GUIDPARAM aId);
    366     STDMETHOD(CreateSharedFolder)(INPTR BSTR aName, INPTR BSTR aHostPath);
    367     STDMETHOD(RemoveSharedFolder)(INPTR BSTR aName);
     366    STDMETHOD(CreateSharedFolder) (INPTR BSTR aName, INPTR BSTR aHostPath);
     367    STDMETHOD(RemoveSharedFolder) (INPTR BSTR aName);
     368    STDMETHOD(CanShowConsoleWindow) (BOOL *aCanShow);
     369    STDMETHOD(ShowConsoleWindow)();
    368370
    369371    // public methods only for internal purposes
  • trunk/src/VBox/Main/include/SessionImpl.h

    r606 r2463  
    102102    STDMETHOD(OnUSBDeviceAttach) (IUSBDevice *aDevice);
    103103    STDMETHOD(OnUSBDeviceDetach) (INPTR GUIDPARAM aId);
     104    STDMETHOD(OnShowWindow) (BOOL aCheck, BOOL *aCanShow);
    104105
    105106    // for VirtualBoxSupportErrorInfoImpl
  • trunk/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h

    r1 r2463  
    6161
    6262    // public initializer/uninitializer for internal purposes only
    63     void init (HRESULT resultCode, const GUID &iid,
    64                const BSTR component, const BSTR text);
     63    void init (HRESULT aResultCode, const GUID &aIID,
     64               const BSTR aComponent, const BSTR aText,
     65               IVirtualBoxErrorInfo *aNext = NULL);
    6566
    6667    // IVirtualBoxErrorInfo properties
    67     STDMETHOD(COMGETTER(ResultCode)) (HRESULT *resultCode);
    68     STDMETHOD(COMGETTER(InterfaceID)) (GUIDPARAMOUT iid);
    69     STDMETHOD(COMGETTER(Component)) (BSTR *component);
    70     STDMETHOD(COMGETTER(Text)) (BSTR *text);
     68    STDMETHOD(COMGETTER(ResultCode)) (HRESULT *aResultCode);
     69    STDMETHOD(COMGETTER(InterfaceID)) (GUIDPARAMOUT aIID);
     70    STDMETHOD(COMGETTER(Component)) (BSTR *aComponent);
     71    STDMETHOD(COMGETTER(Text)) (BSTR *aText);
     72    STDMETHOD(COMGETTER(Next)) (IVirtualBoxErrorInfo **aNext);
    7173
    7274private:
     
    7678    Guid mIID;
    7779    Bstr mComponent;
     80    ComPtr <IVirtualBoxErrorInfo> mNext;
    7881};
    7982
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r2029 r2463  
    197197    void updateClientWatcher();
    198198
    199     void onMachineStateChange (const Guid &id, MachineState_T state);
    200     void onMachineDataChange (const Guid &id);
    201     BOOL onExtraDataCanChange(const Guid &id, INPTR BSTR key, INPTR BSTR value);
    202     void onExtraDataChange(const Guid &id, INPTR BSTR key, INPTR BSTR value);
     199    void onMachineStateChange (const Guid &aId, MachineState_T aState);
     200    void onMachineDataChange (const Guid &aId);
     201    BOOL onExtraDataCanChange(const Guid &aId, INPTR BSTR aKey, INPTR BSTR aValue,
     202                              Bstr &aError);
     203    void onExtraDataChange(const Guid &aId, INPTR BSTR aKey, INPTR BSTR aValue);
    203204    void onMachineRegistered (const Guid &aId, BOOL aRegistered);
    204     void onSessionStateChange (const Guid &id, SessionState_T state);
     205    void onSessionStateChange (const Guid &aId, SessionState_T aState);
    205206
    206207    void onSnapshotTaken (const Guid &aMachineId, const Guid &aSnapshotId);
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