VirtualBox

Changeset 44151 in vbox for trunk/src


Ignore:
Timestamp:
Dec 18, 2012 3:38:58 PM (12 years ago)
Author:
vboxsync
Message:

Main/Console: dump the VBoxInternal2 extradata settings since they influence the API behavior and are not visible elsewhere

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

Legend:

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

    r43908 r44151  
    524524    int configConstructorInner(PVM pVM, AutoWriteLock *pAlock);
    525525    int configCfgmOverlay(PVM pVM, IVirtualBox *pVirtualBox, IMachine *pMachine);
     526    int configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine);
    526527
    527528    int configMediumAttachment(PCFGMNODE pCtlInst,
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r44103 r44151  
    28202820        rc = configCfgmOverlay(pVM, virtualBox, pMachine);
    28212821
     2822    /*
     2823     * Dump all extradata API settings tweaks, both global and per VM.
     2824     */
     2825    if (RT_SUCCESS(rc))
     2826        rc = configDumpAPISettingsTweaks(virtualBox, pMachine);
     2827
    28222828#undef H
    28232829
     
    28492855
    28502856/**
    2851  * Applies the CFGM overlay as specified by /VBoxInternal/XXX extra data
     2857 * Applies the CFGM overlay as specified by VBoxInternal/XXX extra data
    28522858 * values.
    28532859 *
     
    28902896
    28912897        hrc = pMachine->GetExtraDataKeys(ComSafeArrayAsOutParam(aMachineExtraDataKeys));
    2892         AssertMsg(SUCCEEDED(hrc), ("VirtualBox::GetExtraDataKeys failed with %Rhrc\n", hrc));
     2898        AssertMsg(SUCCEEDED(hrc), ("Machine::GetExtraDataKeys failed with %Rhrc\n", hrc));
    28932899
    28942900        // build a combined list from global keys...
     
    30033009    }
    30043010    return rc;
     3011}
     3012
     3013/**
     3014 * Dumps the API settings tweaks as specified by VBoxInternal2/XXX extra data
     3015 * values.
     3016 *
     3017 * @returns VBox status code.
     3018 * @param   pVirtualBox     Pointer to the IVirtualBox interface.
     3019 * @param   pMachine        Pointer to the IMachine interface.
     3020 */
     3021/* static */
     3022int Console::configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine)
     3023{
     3024    {
     3025        SafeArray<BSTR> aGlobalExtraDataKeys;
     3026        HRESULT hrc = pVirtualBox->GetExtraDataKeys(ComSafeArrayAsOutParam(aGlobalExtraDataKeys));
     3027        AssertMsg(SUCCEEDED(hrc), ("VirtualBox::GetExtraDataKeys failed with %Rhrc\n", hrc));
     3028        bool hasKey = false;
     3029        for (size_t i = 0; i < aGlobalExtraDataKeys.size(); i++)
     3030        {
     3031            Utf8Str strKey(aGlobalExtraDataKeys[i]);
     3032            if (!strKey.startsWith("VBoxInternal2/"))
     3033                continue;
     3034
     3035            Bstr bstrValue;
     3036            hrc = pVirtualBox->GetExtraData(Bstr(strKey).raw(),
     3037                                            bstrValue.asOutParam());
     3038            if (FAILED(hrc))
     3039                continue;
     3040            if (!hasKey)
     3041                LogRel(("Global extradata API settings:\n"));
     3042            LogRel(("  %s=\"%ls\"\n", strKey.c_str(), bstrValue.raw()));
     3043            hasKey = true;
     3044        }
     3045    }
     3046
     3047    {
     3048        SafeArray<BSTR> aMachineExtraDataKeys;
     3049        HRESULT hrc = pMachine->GetExtraDataKeys(ComSafeArrayAsOutParam(aMachineExtraDataKeys));
     3050        AssertMsg(SUCCEEDED(hrc), ("Machine::GetExtraDataKeys failed with %Rhrc\n", hrc));
     3051        bool hasKey = false;
     3052        for (size_t i = 0; i < aMachineExtraDataKeys.size(); i++)
     3053        {
     3054            Utf8Str strKey(aMachineExtraDataKeys[i]);
     3055            if (!strKey.startsWith("VBoxInternal2/"))
     3056                continue;
     3057
     3058            Bstr bstrValue;
     3059            hrc = pMachine->GetExtraData(Bstr(strKey).raw(),
     3060                                         bstrValue.asOutParam());
     3061            if (FAILED(hrc))
     3062                continue;
     3063            if (!hasKey)
     3064                LogRel(("Per-VM extradata API settings:\n"));
     3065            LogRel(("  %s=\"%ls\"\n", strKey.c_str(), bstrValue.raw()));
     3066            hasKey = true;
     3067        }
     3068    }
     3069
     3070    return VINF_SUCCESS;
    30053071}
    30063072
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