Changeset 22173 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Aug 11, 2009 3:38:59 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50951
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
r21806 r22173 474 474 HRESULT hrc = NewUniqueKey(machine, "VBoxInternal/DBGF/loadsyms", KeyStr); 475 475 if (SUCCEEDED(hrc)) 476 hrc = SetString(machine, "VBoxInternal/DBGF/loadsyms", KeyStr , "Filename", pszFilename);476 hrc = SetString(machine, "VBoxInternal/DBGF/loadsyms", KeyStr.c_str(), "Filename", pszFilename); 477 477 if (SUCCEEDED(hrc) && argc >= 3) 478 hrc = SetInt64(machine, "VBoxInternal/DBGF/loadsyms", KeyStr , "Delta", offDelta);478 hrc = SetInt64(machine, "VBoxInternal/DBGF/loadsyms", KeyStr.c_str(), "Delta", offDelta); 479 479 if (SUCCEEDED(hrc) && argc >= 4) 480 hrc = SetString(machine, "VBoxInternal/DBGF/loadsyms", KeyStr , "Module", pszModule);480 hrc = SetString(machine, "VBoxInternal/DBGF/loadsyms", KeyStr.c_str(), "Module", pszModule); 481 481 if (SUCCEEDED(hrc) && argc >= 5) 482 hrc = SetUInt64(machine, "VBoxInternal/DBGF/loadsyms", KeyStr , "ModuleAddress", ModuleAddress);482 hrc = SetUInt64(machine, "VBoxInternal/DBGF/loadsyms", KeyStr.c_str(), "ModuleAddress", ModuleAddress); 483 483 if (SUCCEEDED(hrc) && argc >= 6) 484 hrc = SetUInt64(machine, "VBoxInternal/DBGF/loadsyms", KeyStr , "ModuleSize", ModuleSize);484 hrc = SetUInt64(machine, "VBoxInternal/DBGF/loadsyms", KeyStr.c_str(), "ModuleSize", ModuleSize); 485 485 486 486 return FAILED(hrc); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r21769 r22173 1267 1267 if (!strcmp(a->argv[1], "enumerate")) 1268 1268 { 1269 Bstr extraDataKey;1270 1271 do 1272 {1273 Bstr nextExtraDataKey;1274 Bstr nextExtraDataValue;1275 HRESULT rcEnum = a->virtualBox->GetNextExtraDataKey(extraDataKey, nextExtraDataKey.asOutParam(),1276 nextExtraDataValue.asOutParam());1277 extraDataKey = nextExtraDataKey;1278 1279 if (SUCCEEDED(rcEnum) && !extraDataKey.isEmpty()) 1280 RTPrintf("Key: %lS, Value: %lS\n", nextExtraDataKey.raw(), nextExtraDataValue.raw());1281 } while (!extraDataKey.isEmpty());1269 SafeArray<BSTR> aKeys; 1270 CHECK_ERROR(a->virtualBox, GetExtraDataKeys(ComSafeArrayAsOutParam(aKeys))); 1271 1272 for (size_t i = 0; 1273 i < aKeys.size(); 1274 ++i) 1275 { 1276 Bstr bstrKey(aKeys[i]); 1277 Bstr bstrValue; 1278 CHECK_ERROR(a->virtualBox, GetExtraData(bstrKey, bstrValue.asOutParam())); 1279 1280 RTPrintf("Key: %lS, Value: %lS\n", bstrKey.raw(), bstrValue.raw()); 1281 } 1282 1282 } 1283 1283 else … … 1306 1306 if (!strcmp(a->argv[1], "enumerate")) 1307 1307 { 1308 Bstr extraDataKey; 1309 1310 do 1311 { 1312 Bstr nextExtraDataKey; 1313 Bstr nextExtraDataValue; 1314 HRESULT rcEnum = machine->GetNextExtraDataKey(extraDataKey, nextExtraDataKey.asOutParam(), 1315 nextExtraDataValue.asOutParam()); 1316 extraDataKey = nextExtraDataKey; 1317 1318 if (SUCCEEDED(rcEnum) && !extraDataKey.isEmpty()) 1319 { 1320 RTPrintf("Key: %lS, Value: %lS\n", nextExtraDataKey.raw(), nextExtraDataValue.raw()); 1321 } 1322 } while (!extraDataKey.isEmpty()); 1308 SafeArray<BSTR> aKeys; 1309 CHECK_ERROR(machine, GetExtraDataKeys(ComSafeArrayAsOutParam(aKeys))); 1310 1311 for (size_t i = 0; 1312 i < aKeys.size(); 1313 ++i) 1314 { 1315 Bstr bstrKey(aKeys[i]); 1316 Bstr bstrValue; 1317 CHECK_ERROR(machine, GetExtraData(bstrKey, bstrValue.asOutParam())); 1318 1319 RTPrintf("Key: %lS, Value: %lS\n", bstrKey.raw(), bstrValue.raw()); 1320 } 1323 1321 } 1324 1322 else … … 1697 1695 #endif /* !VBOX_ONLY_DOCS */ 1698 1696 1699 enum ConvertSettings1700 {1701 ConvertSettings_No = 0,1702 ConvertSettings_Yes = 1,1703 ConvertSettings_Backup = 2,1704 ConvertSettings_Ignore = 3,1705 };1706 1707 #ifndef VBOX_ONLY_DOCS1708 /**1709 * Checks if any of the settings files were auto-converted and informs the1710 * user if so.1711 *1712 * @return @false if the program should terminate and @true otherwise.1713 */1714 static bool checkForAutoConvertedSettings (ComPtr<IVirtualBox> virtualBox,1715 ComPtr<ISession> session,1716 ConvertSettings fConvertSettings)1717 {1718 /* return early if nothing to do */1719 if (fConvertSettings == ConvertSettings_Ignore)1720 return true;1721 1722 HRESULT rc;1723 1724 do1725 {1726 Bstr formatVersion;1727 CHECK_ERROR_BREAK(virtualBox, COMGETTER(SettingsFormatVersion) (formatVersion.asOutParam()));1728 1729 bool isGlobalConverted = false;1730 std::list <ComPtr <IMachine> > cvtMachines;1731 std::list <Utf8Str> fileList;1732 Bstr version;1733 Bstr filePath;1734 1735 com::SafeIfaceArray <IMachine> machines;1736 CHECK_ERROR_BREAK(virtualBox, COMGETTER(Machines)(ComSafeArrayAsOutParam (machines)));1737 1738 for (size_t i = 0; i < machines.size(); ++ i)1739 {1740 BOOL accessible;1741 CHECK_ERROR_BREAK(machines[i], COMGETTER(Accessible) (&accessible));1742 if (!accessible)1743 continue;1744 1745 CHECK_ERROR_BREAK(machines[i], COMGETTER(SettingsFileVersion) (version.asOutParam()));1746 1747 if (version != formatVersion)1748 {1749 cvtMachines.push_back (machines [i]);1750 Bstr filePath;1751 CHECK_ERROR_BREAK(machines[i], COMGETTER(SettingsFilePath) (filePath.asOutParam()));1752 fileList.push_back (Utf8StrFmt ("%ls (%ls)", filePath.raw(),1753 version.raw()));1754 }1755 }1756 1757 if (FAILED(rc))1758 break;1759 1760 CHECK_ERROR_BREAK(virtualBox, COMGETTER(SettingsFileVersion) (version.asOutParam()));1761 if (version != formatVersion)1762 {1763 isGlobalConverted = true;1764 CHECK_ERROR_BREAK(virtualBox, COMGETTER(SettingsFilePath) (filePath.asOutParam()));1765 fileList.push_back (Utf8StrFmt ("%ls (%ls)", filePath.raw(),1766 version.raw()));1767 }1768 1769 if (fileList.size() > 0)1770 {1771 switch (fConvertSettings)1772 {1773 case ConvertSettings_No:1774 {1775 RTPrintf (1776 "WARNING! The following VirtualBox settings files have been automatically\n"1777 "converted to the new settings file format version '%ls':\n"1778 "\n",1779 formatVersion.raw());1780 1781 for (std::list <Utf8Str>::const_iterator f = fileList.begin();1782 f != fileList.end(); ++ f)1783 RTPrintf (" %S\n", (*f).raw());1784 RTPrintf (1785 "\n"1786 "The current command was aborted to prevent overwriting the above settings\n"1787 "files with the results of the auto-conversion without your permission.\n"1788 "Please put one of the following command line switches to the beginning of\n"1789 "the VBoxManage command line and repeat the command:\n"1790 "\n"1791 " --convertSettings - to save all auto-converted files (it will not\n"1792 " be possible to use these settings files with an\n"1793 " older version of VirtualBox in the future);\n"1794 " --convertSettingsBackup - to create backup copies of the settings files in\n"1795 " the old format before saving them in the new format;\n"1796 " --convertSettingsIgnore - to not save the auto-converted settings files.\n"1797 "\n"1798 "Note that if you use --convertSettingsIgnore, the auto-converted settings files\n"1799 "will be implicitly saved in the new format anyway once you change a setting or\n"1800 "start a virtual machine, but NO backup copies will be created in this case.\n");1801 return false;1802 }1803 case ConvertSettings_Yes:1804 case ConvertSettings_Backup:1805 {1806 break;1807 }1808 default:1809 AssertFailedReturn (false);1810 }1811 1812 for (std::list <ComPtr <IMachine> >::const_iterator m = cvtMachines.begin();1813 m != cvtMachines.end(); ++ m)1814 {1815 Bstr id;1816 CHECK_ERROR_BREAK((*m), COMGETTER(Id) (id.asOutParam()));1817 1818 /* open a session for the VM */1819 CHECK_ERROR_BREAK (virtualBox, OpenSession (session, id));1820 1821 ComPtr <IMachine> sm;1822 CHECK_ERROR_BREAK(session, COMGETTER(Machine) (sm.asOutParam()));1823 1824 Bstr bakFileName;1825 if (fConvertSettings == ConvertSettings_Backup)1826 CHECK_ERROR (sm, SaveSettingsWithBackup (bakFileName.asOutParam()));1827 else1828 CHECK_ERROR (sm, SaveSettings());1829 1830 session->Close();1831 1832 if (FAILED(rc))1833 break;1834 }1835 1836 if (FAILED(rc))1837 break;1838 1839 if (isGlobalConverted)1840 {1841 Bstr bakFileName;1842 if (fConvertSettings == ConvertSettings_Backup)1843 CHECK_ERROR (virtualBox, SaveSettingsWithBackup (bakFileName.asOutParam()));1844 else1845 CHECK_ERROR (virtualBox, SaveSettings());1846 }1847 1848 if (FAILED(rc))1849 break;1850 }1851 }1852 while (0);1853 1854 return SUCCEEDED (rc);1855 }1856 #endif /* !VBOX_ONLY_DOCS */1857 1858 1697 // main 1859 1698 /////////////////////////////////////////////////////////////////////////////// … … 1871 1710 int iCmdArg; 1872 1711 1873 ConvertSettings fConvertSettings = ConvertSettings_No;1874 1875 1712 /* global options */ 1876 1713 for (int i = 1; i < argc || argc <= iCmd; i++) … … 1912 1749 iCmd++; 1913 1750 } 1914 else if ( !strcmp(argv[i], "--convertSettings")1915 || !strcmp(argv[i], "-convertSettings"))1916 {1917 fConvertSettings = ConvertSettings_Yes;1918 iCmd++;1919 }1920 else if ( !strcmp(argv[i], "--convertSettingsBackup")1921 || !strcmp(argv[i], "-convertSettingsBackup"))1922 {1923 fConvertSettings = ConvertSettings_Backup;1924 iCmd++;1925 }1926 else if ( !strcmp(argv[i], "--convertSettingsIgnore")1927 || !strcmp(argv[i], "-convertSettingsIgnore"))1928 {1929 fConvertSettings = ConvertSettings_Ignore;1930 iCmd++;1931 }1932 1751 else 1933 1752 { … … 2013 1832 NS_GetMainEventQ(getter_AddRefs(eventQ)); 2014 1833 #endif 2015 2016 if (!checkForAutoConvertedSettings (virtualBox, session, fConvertSettings))2017 break;2018 1834 2019 1835 #ifdef USE_XPCOM_QUEUE -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r21806 r22173 616 616 { 617 617 char szFilenameAbs[RTPATH_MAX] = ""; 618 int vrc = RTPathAbs(Utf8Str(src) , szFilenameAbs, sizeof(szFilenameAbs));618 int vrc = RTPathAbs(Utf8Str(src).c_str(), szFilenameAbs, sizeof(szFilenameAbs)); 619 619 if (RT_FAILURE(vrc)) 620 620 { … … 650 650 { 651 651 char szFilenameAbs[RTPATH_MAX] = ""; 652 int vrc = RTPathAbs(Utf8Str(dst) , szFilenameAbs, sizeof(szFilenameAbs));652 int vrc = RTPathAbs(Utf8Str(dst).c_str(), szFilenameAbs, sizeof(szFilenameAbs)); 653 653 if (RT_FAILURE(vrc)) 654 654 {
Note:
See TracChangeset
for help on using the changeset viewer.