Changeset 108046 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Feb 4, 2025 5:24:54 AM (3 months ago)
- svn:sync-xref-src-repo-rev:
- 167323
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r108003 r108046 2793 2793 RTPrintf("%-28s ", Info::tr("Shared folders:")); 2794 2794 uint32_t numSharedFolders = 0; 2795 #if 0 // not yet implemented2796 2795 /* globally shared folders first */ 2797 2796 { 2798 SafeIfaceArray <ISharedFolder> sfColl;2799 CHECK_ERROR_RET(pVirtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam( sfColl)),rc);2800 for (size_t i = 0; i < sfColl.size(); ++i)2801 { 2802 ComPtr<ISharedFolder> sf = sfColl[i];2797 com::SafeIfaceArray <ISharedFolder> folders; 2798 CHECK_ERROR_RET(pVirtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), hrc); 2799 for (size_t i = 0; i < folders.size(); ++i) 2800 { 2801 ComPtr<ISharedFolder> sf = folders[i]; 2803 2802 showSharedFolder(sf, details, Info::tr("global mapping"), "GlobalMapping", i + 1, numSharedFolders == 0); 2804 2803 ++numSharedFolders; 2805 2804 } 2806 2805 } 2807 #endif2808 2806 /* now VM mappings */ 2809 2807 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r108003 r108046 1687 1687 * Done parsing, do some work. 1688 1688 */ 1689 ComPtr<IMachine> ptrMachine;1690 CHECK_ERROR2I_RET(a->virtualBox, FindMachine(Bstr(pszMachineName).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE);1691 AssertReturn(ptrMachine.isNotNull(), RTEXITCODE_FAILURE);1692 1693 1689 HRESULT hrc; 1694 if (fTransient) 1695 { 1696 /* open an existing session for the VM */ 1697 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE); 1698 1699 /* get the session machine */ 1700 ComPtr<IMachine> ptrSessionMachine; 1701 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1702 1703 /* get the session console */ 1704 ComPtr<IConsole> ptrConsole; 1705 CHECK_ERROR2I_RET(a->session, COMGETTER(Console)(ptrConsole.asOutParam()), RTEXITCODE_FAILURE); 1706 if (ptrConsole.isNull()) 1707 return RTMsgErrorExit(RTEXITCODE_FAILURE, Misc::tr("Machine '%s' is not currently running."), pszMachineName); 1708 1709 CHECK_ERROR2(hrc, ptrConsole, CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), 1710 fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())); 1711 a->session->UnlockMachine(); 1690 if (!strcmp(pszMachineName, "global")) 1691 { 1692 if (fTransient) 1693 return errorSyntax(Misc::tr("Invalid option: global and transient both specified")); 1694 ComPtr<IVirtualBox> pVirtualBox = a->virtualBox; 1695 CHECK_ERROR2(hrc, pVirtualBox, CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), 1696 fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())); 1712 1697 } 1713 1698 else 1714 1699 { 1715 /* open a session for the VM */ 1716 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Write), RTEXITCODE_FAILURE); 1717 1718 /* get the mutable session machine */ 1719 ComPtr<IMachine> ptrSessionMachine; 1720 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1721 1722 CHECK_ERROR2(hrc, ptrSessionMachine, CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), 1723 fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())); 1724 if (SUCCEEDED(hrc)) 1725 { 1726 CHECK_ERROR2(hrc, ptrSessionMachine, SaveSettings()); 1727 } 1728 1729 a->session->UnlockMachine(); 1700 ComPtr<IMachine> ptrMachine; 1701 CHECK_ERROR2I_RET(a->virtualBox, FindMachine(Bstr(pszMachineName).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE); 1702 AssertReturn(ptrMachine.isNotNull(), RTEXITCODE_FAILURE); 1703 1704 if (fTransient) 1705 { 1706 /* open an existing session for the VM */ 1707 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE); 1708 1709 /* get the session machine */ 1710 ComPtr<IMachine> ptrSessionMachine; 1711 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1712 1713 /* get the session console */ 1714 ComPtr<IConsole> ptrConsole; 1715 CHECK_ERROR2I_RET(a->session, COMGETTER(Console)(ptrConsole.asOutParam()), RTEXITCODE_FAILURE); 1716 if (ptrConsole.isNull()) 1717 return RTMsgErrorExit(RTEXITCODE_FAILURE, Misc::tr("Machine '%s' is not currently running."), pszMachineName); 1718 1719 CHECK_ERROR2(hrc, ptrConsole, CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), 1720 fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())); 1721 a->session->UnlockMachine(); 1722 } 1723 else 1724 { 1725 /* open a session for the VM */ 1726 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Write), RTEXITCODE_FAILURE); 1727 1728 /* get the mutable session machine */ 1729 ComPtr<IMachine> ptrSessionMachine; 1730 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1731 1732 CHECK_ERROR2(hrc, ptrSessionMachine, CreateSharedFolder(Bstr(pszName).raw(), Bstr(szAbsHostPath).raw(), 1733 fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw())); 1734 if (SUCCEEDED(hrc)) 1735 { 1736 CHECK_ERROR2(hrc, ptrSessionMachine, SaveSettings()); 1737 } 1738 1739 a->session->UnlockMachine(); 1740 } 1730 1741 } 1731 1742 … … 1785 1796 * Done parsing, do some real work. 1786 1797 */ 1787 ComPtr<IMachine> ptrMachine;1788 CHECK_ERROR2I_RET(a->virtualBox, FindMachine(Bstr(pszMachineName).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE);1789 AssertReturn(ptrMachine.isNotNull(), RTEXITCODE_FAILURE);1790 1791 1798 HRESULT hrc; 1792 if (fTransient) 1793 { 1794 /* open an existing session for the VM */ 1795 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE); 1796 /* get the session machine */ 1797 ComPtr<IMachine> ptrSessionMachine; 1798 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1799 /* get the session console */ 1800 ComPtr<IConsole> ptrConsole; 1801 CHECK_ERROR2I_RET(a->session, COMGETTER(Console)(ptrConsole.asOutParam()), RTEXITCODE_FAILURE); 1802 if (ptrConsole.isNull()) 1803 return RTMsgErrorExit(RTEXITCODE_FAILURE, Misc::tr("Machine '%s' is not currently running.\n"), pszMachineName); 1804 1805 CHECK_ERROR2(hrc, ptrConsole, RemoveSharedFolder(Bstr(pszName).raw())); 1806 1807 a->session->UnlockMachine(); 1799 if (!strcmp(pszMachineName, "global")) 1800 { 1801 ComPtr<IVirtualBox> pVirtualBox = a->virtualBox; 1802 CHECK_ERROR2(hrc, pVirtualBox, RemoveSharedFolder(Bstr(pszName).raw())); 1808 1803 } 1809 1804 else 1810 1805 { 1811 /* open a session for the VM */ 1812 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Write), RTEXITCODE_FAILURE); 1813 1814 /* get the mutable session machine */ 1815 ComPtr<IMachine> ptrSessionMachine; 1816 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1817 1818 CHECK_ERROR2(hrc, ptrSessionMachine, RemoveSharedFolder(Bstr(pszName).raw())); 1819 1820 /* commit and close the session */ 1821 if (SUCCEEDED(hrc)) 1822 { 1823 CHECK_ERROR2(hrc, ptrSessionMachine, SaveSettings()); 1824 } 1825 a->session->UnlockMachine(); 1806 ComPtr<IMachine> ptrMachine; 1807 CHECK_ERROR2I_RET(a->virtualBox, FindMachine(Bstr(pszMachineName).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE); 1808 AssertReturn(ptrMachine.isNotNull(), RTEXITCODE_FAILURE); 1809 1810 if (fTransient) 1811 { 1812 /* open an existing session for the VM */ 1813 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE); 1814 /* get the session machine */ 1815 ComPtr<IMachine> ptrSessionMachine; 1816 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1817 /* get the session console */ 1818 ComPtr<IConsole> ptrConsole; 1819 CHECK_ERROR2I_RET(a->session, COMGETTER(Console)(ptrConsole.asOutParam()), RTEXITCODE_FAILURE); 1820 if (ptrConsole.isNull()) 1821 return RTMsgErrorExit(RTEXITCODE_FAILURE, Misc::tr("Machine '%s' is not currently running.\n"), pszMachineName); 1822 1823 CHECK_ERROR2(hrc, ptrConsole, RemoveSharedFolder(Bstr(pszName).raw())); 1824 1825 a->session->UnlockMachine(); 1826 } 1827 else 1828 { 1829 /* open a session for the VM */ 1830 CHECK_ERROR2I_RET(ptrMachine, LockMachine(a->session, LockType_Write), RTEXITCODE_FAILURE); 1831 1832 /* get the mutable session machine */ 1833 ComPtr<IMachine> ptrSessionMachine; 1834 CHECK_ERROR2I_RET(a->session, COMGETTER(Machine)(ptrSessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1835 1836 CHECK_ERROR2(hrc, ptrSessionMachine, RemoveSharedFolder(Bstr(pszName).raw())); 1837 1838 /* commit and close the session */ 1839 if (SUCCEEDED(hrc)) 1840 { 1841 CHECK_ERROR2(hrc, ptrSessionMachine, SaveSettings()); 1842 } 1843 a->session->UnlockMachine(); 1844 } 1826 1845 } 1827 1846
Note:
See TracChangeset
for help on using the changeset viewer.