VirtualBox

Ignore:
Timestamp:
Jul 22, 2008 8:12:42 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33575
Message:

Guest properties: initial commit of new interface

File:
1 edited

Legend:

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

    r10305 r10797  
    8282
    8383#include <VBox/HostServices/VBoxClipboardSvc.h>
    84 #ifdef VBOX_WITH_INFO_SVC
    85 # include <VBox/HostServices/VBoxInfoSvc.h>
     84#ifdef VBOX_WITH_GUEST_PROPS
     85# include <VBox/HostServices/GuestPropertySvc.h>
    8686#endif
    8787
     
    35383538HRESULT Console::getGuestProperty (INPTR BSTR aKey, BSTR *aValue)
    35393539{
    3540 #if !defined (VBOX_WITH_INFO_SVC)
     3540#if !defined (VBOX_WITH_GUEST_PROPS)
    35413541    return E_NOTIMPL;
    35423542#else
     
    35573557
    35583558    HRESULT rc = E_UNEXPECTED;
    3559     using namespace svcInfo;
     3559    using namespace guestProp;
    35603560
    35613561    VBOXHGCMSVCPARM parm[3];
    35623562    Utf8Str Utf8Key = aKey;
    3563     Utf8Str Utf8Value (KEY_MAX_VALUE_LEN);
     3563    Utf8Str Utf8Value (MAX_VALUE_LEN);
    35643564
    35653565    parm[0].type = VBOX_HGCM_SVC_PARM_PTR;
     
    35703570    parm[1].type = VBOX_HGCM_SVC_PARM_PTR;
    35713571    parm[1].u.pointer.addr = Utf8Value.mutableRaw();
    3572     parm[1].u.pointer.size = KEY_MAX_VALUE_LEN;
    3573     int vrc = mVMMDev->hgcmHostCall ("VBoxSharedInfoSvc", GET_CONFIG_KEY_HOST,
     3572    parm[1].u.pointer.size = MAX_VALUE_LEN;
     3573    int vrc = mVMMDev->hgcmHostCall ("VBoxGuestPropSvc", GET_CONFIG_KEY_HOST,
    35743574                                     3, &parm[0]);
    35753575    /* The returned string should never be able to be greater than our buffer */
     
    35853585    else
    35863586        rc = setError (E_UNEXPECTED,
    3587             tr ("Failed to call the VBoxSharedInfoSvc service (%Rrc)"), vrc);
     3587            tr ("Failed to call the VBoxGuestPropSvc service (%Rrc)"), vrc);
    35883588    return rc;
    3589 #endif /* else !defined (VBOX_WITH_INFO_SVC) */
     3589#endif /* else !defined (VBOX_WITH_GUEST_PROPS) */
    35903590}
    35913591
     
    35953595HRESULT Console::setGuestProperty (INPTR BSTR aKey, INPTR BSTR aValue)
    35963596{
    3597 #if !defined (VBOX_WITH_INFO_SVC)
     3597#if !defined (VBOX_WITH_GUEST_PROPS)
    35983598    return E_NOTIMPL;
    35993599#else
     
    36143614
    36153615    HRESULT rc = E_UNEXPECTED;
    3616     using namespace svcInfo;
     3616    using namespace guestProp;
    36173617
    36183618    VBOXHGCMSVCPARM parm[2];
     
    36333633        /* The + 1 is the null terminator */
    36343634        parm[1].u.pointer.size = Utf8Value.length() + 1;
    3635         vrc = mVMMDev->hgcmHostCall ("VBoxSharedInfoSvc", SET_CONFIG_KEY_HOST,
     3635        vrc = mVMMDev->hgcmHostCall ("VBoxGuestPropSvc", SET_CONFIG_KEY_HOST,
    36363636                                     2, &parm[0]);
    36373637    }
    36383638    else
    3639         vrc = mVMMDev->hgcmHostCall ("VBoxSharedInfoSvc", DEL_CONFIG_KEY_HOST,
     3639        vrc = mVMMDev->hgcmHostCall ("VBoxGuestPropSvc", DEL_CONFIG_KEY_HOST,
    36403640                                     1, &parm[0]);
    36413641    if (RT_SUCCESS (vrc))
     
    36433643    else
    36443644        rc = setError (E_UNEXPECTED,
    3645             tr ("Failed to call the VBoxSharedInfoSvc service (%Rrc)"), vrc);
     3645            tr ("Failed to call the VBoxGuestPropSvc service (%Rrc)"), vrc);
    36463646    return rc;
    3647 #endif /* else !defined (VBOX_WITH_INFO_SVC) */
     3647#endif /* else !defined (VBOX_WITH_GUEST_PROPS) */
    36483648}
    36493649
     
    41714171        alock.enter();
    41724172    }
    4173 # ifdef VBOX_WITH_INFO_SVC
     4173# ifdef VBOX_WITH_GUEST_PROPS
    41744174    /* Save all guest/host property store entries to the machine XML
    41754175     * file as extra data. */
     
    41794179    while (pValue != NULL && RT_SUCCESS(vrc))
    41804180    {
    4181         using namespace svcInfo;
    4182         char szKeyName[KEY_MAX_LEN];
    4183         char szKeyValue[KEY_MAX_VALUE_LEN];
    4184         char szExtraDataName[VBOX_SHARED_INFO_PREFIX_LEN + KEY_MAX_LEN];
    4185         vrc = CFGMR3GetValueName (pValue, szKeyName, KEY_MAX_LEN);
     4181        using namespace guestProp;
     4182        char szKeyName[MAX_NAME_LEN];
     4183        char szKeyValue[MAX_VALUE_LEN];
     4184        char szExtraDataName[VBOX_SHARED_INFO_PREFIX_LEN + MAX_NAME_LEN];
     4185        vrc = CFGMR3GetValueName (pValue, szKeyName, MAX_NAME_LEN);
    41864186        if (RT_SUCCESS(vrc))
    41874187            vrc = CFGMR3QueryString (pRegistry, szKeyName, szKeyValue, sizeof(szKeyValue));
     
    42034203    for (;;)
    42044204    {
    4205         using namespace svcInfo;
     4205        using namespace guestProp;
    42064206        Bstr strNextExtraDataKey;
    42074207        Bstr strExtraDataValue;
     
    42244224
    42254225        /* Now see if a lookup of the name in the CFGM node succeeds. */
    4226         char szKeyValue[KEY_MAX_VALUE_LEN];
     4226        char szKeyValue[MAX_VALUE_LEN];
    42274227        vrc = CFGMR3QueryString (pRegistry, pszCFGMValueName, szKeyValue, sizeof(szKeyValue));
    42284228        /* And delete it from the extra data if it failed. */
     
    42304230            mMachine->SetExtraData(strExtraDataKey, NULL);
    42314231    }
    4232 # endif /* VBOX_WITH_INFO_SVC defined */
     4232# endif /* VBOX_WITH_GUEST_PROPS defined */
    42334233#endif /* VBOX_HGCM */
    42344234
Note: See TracChangeset for help on using the changeset viewer.

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