Changeset 11083 in vbox for trunk/src/VBox/Main/ConsoleImpl2.cpp
- Timestamp:
- Aug 3, 2008 9:14:53 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r11076 r11083 47 47 #ifdef VBOX_WITH_GUEST_PROPS 48 48 # include <VBox/HostServices/GuestPropertySvc.h> 49 # include <VBox/com/defs.h> 50 # include <VBox/com/array.h> 49 51 #endif /* VBOX_WITH_GUEST_PROPS */ 50 52 #include <VBox/intnet.h> … … 1721 1723 else 1722 1724 { 1723 rc = CFGMR3InsertNode(pRoot, "GuestProps", &pGuestProps); RC_CHECK(); 1724 rc = CFGMR3InsertNode(pGuestProps, "Values", &pValues); RC_CHECK(); 1725 rc = CFGMR3InsertNode(pGuestProps, "Timestamps", &pTimestamps); RC_CHECK(); 1726 rc = CFGMR3InsertNode(pGuestProps, "Flags", &pFlags); RC_CHECK(); 1727 /* Load the saved machine registry. This is stored as extra data 1728 * keys in the machine XML file, starting with the prefix 1729 * VBOX_SHARED_INFO_KEY_PREFIX. */ 1730 Bstr strExtraDataKey; 1731 for (;;) 1732 { 1733 Bstr strNextExtraDataKey; 1734 Bstr strExtraDataValue; 1735 1736 /* get the next key */ 1737 hrc = pMachine->GetNextExtraDataKey(strExtraDataKey, strNextExtraDataKey.asOutParam(), 1738 strExtraDataValue.asOutParam()); 1739 1740 /* stop if for some reason there's nothing more to request */ 1741 if (FAILED(hrc) || !strNextExtraDataKey) 1742 break; 1743 1744 strExtraDataKey = strNextExtraDataKey; 1745 Utf8Str strExtraDataKeyUtf8 = Utf8Str(strExtraDataKey); 1746 1747 /* we only care about keys starting with VBOX_SHARED_INFO_KEY_PREFIX */ 1748 if (strncmp(strExtraDataKeyUtf8.raw(), VBOX_SHARED_INFO_KEY_PREFIX, VBOX_SHARED_INFO_PREFIX_LEN) != 0) 1749 continue; 1750 char *pszCFGMValueName = (char*)strExtraDataKeyUtf8.raw() + VBOX_SHARED_INFO_PREFIX_LEN; 1751 1752 /* now let's have a look at the value */ 1753 Utf8Str strCFGMValueUtf8 = Utf8Str(strExtraDataValue); 1754 const char *pszCFGMValue = strCFGMValueUtf8.raw(); 1755 /* empty value means remove value which we've already done */ 1756 if (pszCFGMValue && *pszCFGMValue) 1757 { 1758 rc = CFGMR3InsertString(pValues, pszCFGMValueName, pszCFGMValue); 1759 AssertMsgRC(rc, ("failed to insert CFGM value '%s' to key '%s'\n", pszCFGMValue, pszCFGMValueName)); 1760 } 1725 rc = CFGMR3InsertNode(pRoot, "GuestProps", &pGuestProps); RC_CHECK(); 1726 rc = CFGMR3InsertNode(pGuestProps, "Values", &pValues); RC_CHECK(); 1727 rc = CFGMR3InsertNode(pGuestProps, "Timestamps", &pTimestamps); RC_CHECK(); 1728 rc = CFGMR3InsertNode(pGuestProps, "Flags", &pFlags); RC_CHECK(); 1729 1730 /* Pull over the properties from the server. */ 1731 SafeArray <BSTR> names; 1732 SafeArray <BSTR> values; 1733 SafeArray <ULONG64> timestamps; 1734 SafeArray <BSTR> flags; 1735 hrc = pConsole->mControl->PullGuestProperties(ComSafeArrayAsOutParam(names), 1736 ComSafeArrayAsOutParam(values), 1737 ComSafeArrayAsOutParam(timestamps), 1738 ComSafeArrayAsOutParam(flags)); H(); 1739 size_t cProps = names.size(); 1740 for (size_t i = 0; i < cProps; ++i) 1741 { 1742 rc = CFGMR3InsertString(pValues, Utf8Str(names[i]).raw(), Utf8Str(values[i]).raw()); RC_CHECK(); 1743 rc = CFGMR3InsertInteger(pTimestamps, Utf8Str(names[i]).raw(), timestamps[i]); RC_CHECK(); 1744 rc = CFGMR3InsertString(pFlags, Utf8Str(names[i]).raw(), Utf8Str(flags[i]).raw()); RC_CHECK(); 1761 1745 } 1762 1746
Note:
See TracChangeset
for help on using the changeset viewer.