VirtualBox

Changeset 51888 in vbox


Ignore:
Timestamp:
Jul 6, 2014 7:38:04 PM (11 years ago)
Author:
vboxsync
Message:

Main: Add possibility to add medium properties for filters in a way wihtout changing any interfaces (for 4.3) for now

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/MediumImpl.h

    r49866 r51888  
    283283    Utf8Str i_vdError(int aVRC);
    284284
     285    bool    i_isPropertyForFilter(const com::Utf8Str &aName);
     286
    285287    static DECLCALLBACK(void) i_vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL,
    286288                                            const char *pszFormat, va_list va);
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r51414 r51888  
    21972197
    21982198    settings::StringsMap::iterator it = m->mapProperties.find(aName);
    2199     if (!aName.startsWith("Special/"))
     2199    if (   !aName.startsWith("Special/")
     2200        && !i_isPropertyForFilter(aName))
    22002201    {
    22012202        if (it == m->mapProperties.end())
     
    22632264        Utf8Str strName(aNames[i]);
    22642265        if (   !strName.startsWith("Special/")
     2266            && !i_isPropertyForFilter(strName)
    22652267            && m->mapProperties.find(strName) == m->mapProperties.end())
    22662268            return setError(VBOX_E_OBJECT_NOT_FOUND,
     
    22762278        Utf8Str strValue(aValues[i]);
    22772279        settings::StringsMap::iterator it = m->mapProperties.find(strName);
    2278         if (!strName.startsWith("Special/"))
     2280        if (   !strName.startsWith("Special/")
     2281            && !i_isPropertyForFilter(strName))
    22792282        {
    22802283            AssertReturn(it != m->mapProperties.end(), E_FAIL);
     
    62446247
    62456248    return devType;
     6249}
     6250
     6251/**
     6252 * Internal method which checks whether a property name is for a filter plugin.
     6253 */
     6254bool Medium::i_isPropertyForFilter(const com::Utf8Str &aName)
     6255{
     6256    /* If the name contains "/" use the part before as a filter name and lookup the filter. */
     6257    size_t offSlash;
     6258    if ((offSlash = aName.find("/", 0)) != aName.npos)
     6259    {
     6260        com::Utf8Str strFilter;
     6261        com::Utf8Str strKey;
     6262
     6263        HRESULT rc = strFilter.assignEx(aName, 0, offSlash);
     6264        if (FAILED(rc))
     6265            return false;
     6266
     6267        rc = strKey.assignEx(aName, offSlash + 1, aName.length() - offSlash - 1); /* Skip slash */
     6268        if (FAILED(rc))
     6269            return false;
     6270
     6271        VDFILTERINFO FilterInfo;
     6272        int vrc = VDFilterInfoOne(strFilter.c_str(), &FilterInfo);
     6273        if (RT_SUCCESS(vrc))
     6274        {
     6275            /* Check that the property exists. */
     6276            PCVDCONFIGINFO paConfig = FilterInfo.paConfigInfo;
     6277            while (paConfig->pszKey)
     6278            {
     6279                if (strKey.equals(paConfig->pszKey))
     6280                    return true;
     6281                paConfig++;
     6282            }
     6283        }
     6284    }
     6285
     6286    return false;
    62466287}
    62476288
  • trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp

    r50914 r51888  
    112112
    113113    HRESULT rc = S_OK;
     114
     115# ifdef VBOX_WITH_EXTPACK
     116    /* Load all VD plugins from all extension packs first. */
     117    /** @todo: Make generic for 4.4 (requires interface changes). */
     118    static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
     119    static const char *s_pszVDPlugin = "VDPluginCrypt";
     120    if (mParent->i_getExtPackManager()->i_isExtPackUsable(strExtPackPuel.c_str()))
     121    {
     122        Utf8Str strPlugin;
     123        rc = mParent->i_getExtPackManager()->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
     124        if (SUCCEEDED(rc))
     125        {
     126            int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
     127            NOREF(vrc); /** @todo: Don't ignore errors. */
     128        }
     129        else
     130            rc = S_OK; /* ignore errors */
     131    }
     132# endif
    114133
    115134    /* Fetch info of all available hd backends. */
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r51745 r51888  
    432432        unconst(m->pAutostartDb) = new AutostartDb;
    433433
     434#ifdef VBOX_WITH_EXTPACK
     435        /*
     436         * Initialize extension pack manager before system properties because
     437         * it is required for the VD plugins.
     438         */
     439        rc = unconst(m->ptrExtPackManager).createObject();
     440        if (SUCCEEDED(rc))
     441            rc = m->ptrExtPackManager->initExtPackManager(this, VBOXEXTPACKCTX_PER_USER_DAEMON);
     442        if (FAILED(rc))
     443            throw rc;
     444#endif
     445
    434446        /* create the system properties object, someone may need it too */
    435447        unconst(m->pSystemProperties).createObject();
     
    507519            rc = m->pEventSource->init();
    508520        if (FAILED(rc)) throw rc;
    509 
    510 #ifdef VBOX_WITH_EXTPACK
    511         /* extension manager */
    512         rc = unconst(m->ptrExtPackManager).createObject();
    513         if (SUCCEEDED(rc))
    514             rc = m->ptrExtPackManager->initExtPackManager(this, VBOXEXTPACKCTX_PER_USER_DAEMON);
    515         if (FAILED(rc))
    516             throw rc;
    517 #endif
    518521    }
    519522    catch (HRESULT err)
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