Changeset 75467 in vbox
- Timestamp:
- Nov 14, 2018 8:45:16 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
r70431 r75467 39 39 #ifdef VBOX_WITH_GUEST_PROPS 40 40 # include <VBox/HostServices/GuestPropertySvc.h> 41 #endif 42 #ifdef VBOX_WITH_SHARED_FOLDERS 43 # include <VBox/shflsvc.h> 44 # ifdef RT_OS_OS2 45 # define INCL_ERRORS 46 # define INCL_DOSFILEMGR 47 # include <os2emx.h> 48 # endif 41 49 #endif 42 50 #ifdef VBOX_WITH_DPC_LATENCY_CHECKER … … 146 154 #endif 147 155 #ifdef VBOX_WITH_SHARED_FOLDERS 148 if (eWhich == GUEST_SHAREDFOLDERS || eWhich == USAGE_ALL) 149 { 150 doUsage("list [-automount]", g_pszProgName, "sharedfolder"); 156 if (eWhich == GUEST_SHAREDFOLDERS || eWhich == USAGE_ALL) 157 { 158 doUsage("list [--automount]", g_pszProgName, "sharedfolder"); 159 # ifdef RT_OS_OS2 160 doUsage("use <drive> <folder>", g_pszProgName, "sharedfolder"); 161 doUsage("unuse <drive>", g_pszProgName, "sharedfolder"); 162 # endif 151 163 } 152 164 #endif … … 235 247 RTMsgErrorV(pszFormat, va); 236 248 va_end(va); 237 return RTEXITCODE_ FAILURE;249 return RTEXITCODE_SYNTAX; 238 250 } 239 251 … … 1591 1603 return RTEXITCODE_FAILURE; 1592 1604 } 1605 1593 1606 #endif 1594 1595 1607 #ifdef VBOX_WITH_SHARED_FOLDERS 1608 1596 1609 /** 1597 1610 * Lists the Shared Folders provided by the host. … … 1603 1616 if (argc == 1) 1604 1617 { 1605 if ( !strcmp(argv[0], "-automount") 1606 || !strcmp(argv[0], "--automount")) 1618 if (!strcmp(argv[0], "--automount")) 1607 1619 fOnlyShowAutoMount = true; 1608 1620 else … … 1614 1626 { 1615 1627 usage(GUEST_SHAREDFOLDERS); 1616 return RTEXITCODE_ FAILURE;1628 return RTEXITCODE_SYNTAX; 1617 1629 } 1618 1630 … … 1636 1648 { 1637 1649 char *pszName; 1638 rc = VbglR3SharedFolderGetName(u32ClientId, paMappings[i].u32Root, &pszName); 1650 char *pszMntPt; 1651 uint64_t fFlags; 1652 uint32_t uRootIdVer; 1653 rc = VbglR3SharedFolderQueryFolderInfo(u32ClientId, paMappings[i].u32Root, 0, 1654 &pszName, &pszMntPt, &fFlags, &uRootIdVer); 1639 1655 if (RT_SUCCESS(rc)) 1640 1656 { 1641 RTPrintf("%02u - %s\n", i + 1, pszName); 1657 RTPrintf("%02u - %s [idRoot=%u", i + 1, pszName, paMappings[i].u32Root); 1658 if (fFlags & SHFL_MIF_WRITABLE) 1659 RTPrintf(" writable"); 1660 else 1661 RTPrintf(" readonly"); 1662 if (fFlags & SHFL_MIF_AUTO_MOUNT) 1663 RTPrintf(" auto-mount"); 1664 if (fFlags & SHFL_MIF_SYMLINK_CREATION) 1665 RTPrintf(" create-symlink"); 1666 if (fFlags & SHFL_MIF_HOST_ICASE) 1667 RTPrintf(" host-icase"); 1668 if (fFlags & SHFL_MIF_GUEST_ICASE) 1669 RTPrintf(" guest-icase"); 1670 if (*pszMntPt) 1671 RTPrintf(" mnt-pt=%s", pszMntPt); 1642 1672 RTStrFree(pszName); 1673 RTStrFree(pszMntPt); 1643 1674 } 1644 1675 else … … 1657 1688 } 1658 1689 1690 # ifdef RT_OS_OS2 1691 /** 1692 * Attaches a shared folder to a drive letter. 1693 */ 1694 static RTEXITCODE sharedFolders_use(int argc, char **argv) 1695 { 1696 /* 1697 * Takes a drive letter and a share name as arguments. 1698 */ 1699 if (argc != 2) 1700 return VBoxControlSyntaxError("sharedfolders use: expected a drive letter and a shared folder name\n"); 1701 1702 const char *pszDrive = argv[0]; 1703 if (!RT_C_IS_ALPHA(pszDrive[0]) || pszDrive[1] != ':' || pszDrive[2] != '\0') 1704 return VBoxControlSyntaxError("sharedfolders use: not a drive letter: %s\n", pszDrive); 1705 1706 const char *pszName = argv[1]; 1707 size_t cchName = strlen(pszName); 1708 if (cchName < 1) 1709 return VBoxControlSyntaxError("sharedfolders use: shared folder name cannot be empty!\n"); 1710 if (cchName > 128) 1711 return VBoxControlSyntaxError("sharedfolders use: shared folder name is too long! (%s)\n", pszName); 1712 1713 /* 1714 * Do the attaching. 1715 */ 1716 static const char s_szTag[] = "VBoxControl"; 1717 char szzNameAndTag[256]; 1718 size_t cchName = strlen(pEntry->pszName); 1719 memcpy(szzNameAndTag, pEntry->pszName, cchName); 1720 szzNameAndTag[cchName] = '\0'; 1721 memcpy(&szzNameAndTag[cchName + 1], s_szTag, sizeof(s_szTag)); 1722 1723 APIRET rc = DosFSAttach(pEntry->pszActualMountPoint, "VBOXSF", szzNameAndTag, cchName + 1 + sizeof(s_szTag), FS_ATTACH); 1724 if (rc == NO_ERROR) 1725 return RTEXITCODE_SUCCESS; 1726 return VBoxControlError("DosFSAttach/FS_ATTACH failed to attach '%s' to '%s': %u\n", pszName, pszDrive, rcOs2); 1727 } 1728 1729 /** 1730 * Detaches a shared folder from a drive letter. 1731 */ 1732 static RTEXITCODE sharedFolders_unuse(int argc, char **argv) 1733 { 1734 /* 1735 * Only takes a drive letter as argument. 1736 */ 1737 if (argc != 1) 1738 return VBoxControlSyntaxError("sharedfolders unuse: expected drive letter\n"); 1739 const char *pszDrive = argv[0]; 1740 if (!RT_C_IS_ALPHA(pszDrive[0]) || pszDrive[1] != ':' || pszDrive[2] != '\0') 1741 return VBoxControlSyntaxError("sharedfolders unuse: not a drive letter: %s\n", pszDrive); 1742 1743 /* 1744 * Do the detaching. 1745 */ 1746 APIRET rcOs2 = DosFSAttach(pszDrive, "VBOXSF", NULL, 0, FS_DETACH); 1747 if (rcOs2 == NO_ERROR) 1748 return RTEXITCODE_SUCCESS; 1749 return VBoxControlError("DosFSAttach/FS_DETACH failed on '%s': %u\n", pszDrive, rcOs2); 1750 } 1751 1752 # endif /* RT_OS_OS2 */ 1753 1754 1659 1755 /** 1660 1756 * Handles Shared Folders control. … … 1673 1769 if (!strcmp(argv[0], "list")) 1674 1770 return listSharedFolders(argc - 1, argv + 1); 1675 /* else */ 1771 # ifdef RT_OS_OS2 1772 if (!strcmp(argv[0], "use")) 1773 return sharedFolders_use(argc - 1, argv + 1); 1774 if (!strcmp(argv[0], "unuse")) 1775 return sharedFolders_unuse(argc - 1, argv + 1); 1776 # endif 1777 1676 1778 usage(GUEST_SHAREDFOLDERS); 1677 1779 return RTEXITCODE_FAILURE; 1678 1780 } 1781 1679 1782 #endif 1680 1681 1783 #if !defined(VBOX_CONTROL_TEST) 1784 1682 1785 /** 1683 1786 * @callback_method_impl{FNVBOXCTRLCMDHANDLER, Command: writecoredump} … … 1698 1801 } 1699 1802 } 1803 1700 1804 #endif 1701 1702 1805 #ifdef VBOX_WITH_DPC_LATENCY_CHECKER 1806 1703 1807 /** 1704 1808 * @callback_method_impl{FNVBOXCTRLCMDHANDLER, Command: help} -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
r75457 r75467 52 52 #ifdef RT_OS_WINDOWS 53 53 #elif defined(RT_OS_OS2) 54 # define INCL_DOSFILEMGR 55 # define INCL_ERRORS 56 # include <os2emx.h> 54 57 #else 55 58 # include <errno.h> … … 1417 1420 memcpy(&szzNameAndTag[cchName + 1], g_szTag, sizeof(g_szTag)); 1418 1421 1419 APIRET rc = DosFSAttach(pEntry->pszActualMountPoint, "VBOXSF", szzNameAndTag, cchName + 1 + sizeof(g_sz zTag), FS_ATTACH);1422 APIRET rc = DosFSAttach(pEntry->pszActualMountPoint, "VBOXSF", szzNameAndTag, cchName + 1 + sizeof(g_szTag), FS_ATTACH); 1420 1423 if (rc == NO_ERROR) 1421 1424 {
Note:
See TracChangeset
for help on using the changeset viewer.