VirtualBox

Changeset 10247 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 4, 2008 7:45:01 PM (16 years ago)
Author:
vboxsync
Message:

Main: remove guest property settings from extra data on machine shutdown if they are deleted during the machine session

File:
1 edited

Legend:

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

    r10246 r10247  
    41804180        if (RT_SUCCESS(vrc))
    41814181            pValue = CFGMR3GetNextValue (pValue);
     4182    }
     4183    /* In a second stage, we remove any extra data keys corresponding to
     4184     * properties which aren't in the CFGM node. */
     4185    Bstr strExtraDataKey;
     4186    for (;;)
     4187    {
     4188        using namespace svcInfo;
     4189        Bstr strNextExtraDataKey;
     4190        Bstr strExtraDataValue;
     4191
     4192        /* get the next key */
     4193        int hrc = mMachine->GetNextExtraDataKey(strExtraDataKey, strNextExtraDataKey.asOutParam(),
     4194                                                strExtraDataValue.asOutParam());
     4195
     4196        /* stop if for some reason there's nothing more to request */
     4197        if (FAILED(hrc) || !strNextExtraDataKey)
     4198            break;
     4199
     4200        strExtraDataKey = strNextExtraDataKey;
     4201        Utf8Str strExtraDataKeyUtf8 = Utf8Str(strExtraDataKey);
     4202
     4203        /* we only care about keys starting with VBOX_SHARED_INFO_KEY_PREFIX */
     4204        if (strncmp(strExtraDataKeyUtf8.raw(), VBOX_SHARED_INFO_KEY_PREFIX, VBOX_SHARED_INFO_PREFIX_LEN) != 0)
     4205            continue;
     4206        char *pszCFGMValueName = (char*)strExtraDataKeyUtf8.raw() + VBOX_SHARED_INFO_PREFIX_LEN;
     4207
     4208        /* Now see if a lookup of the name in the CFGM node succeeds. */
     4209        char szKeyValue[KEY_MAX_VALUE_LEN];
     4210        vrc = CFGMR3QueryString (pRegistry, pszCFGMValueName, szKeyValue, sizeof(szKeyValue));
     4211        /* And delete it from the extra data if it failed. */
     4212        if (VERR_CFGM_VALUE_NOT_FOUND == vrc)
     4213            mMachine->SetExtraData(strExtraDataKey, NULL);
    41824214    }
    41834215# endif /* VBOX_WITH_INFO_SVC defined */
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