Changeset 75470 in vbox
- Timestamp:
- Nov 14, 2018 9:05:25 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
r75469 r75470 1613 1613 * Lists the Shared Folders provided by the host. 1614 1614 */ 1615 static RTEXITCODE listSharedFolders(int argc, char **argv)1615 static RTEXITCODE sharedFolder_list(int argc, char **argv) 1616 1616 { 1617 1617 bool fUsageOK = true; … … 1673 1673 if (*pszMntPt) 1674 1674 RTPrintf(" mnt-pt=%s", pszMntPt); 1675 RTPrintf("]"); 1676 # ifdef RT_OS_OS2 1677 /* Show drive letters: */ 1678 const char *pszOn = " on"; 1679 for (char chDrive = 'A'; chDrive <= 'Z'; chDrive++) 1680 { 1681 char szDrive[4] = { chDrive, ':', '\0', '\0' }; 1682 union 1683 { 1684 FSQBUFFER2 FsQueryBuf; 1685 char achPadding[512]; 1686 } uBuf; 1687 RT_ZERO(uBuf); 1688 ULONG cbBuf = sizeof(uBuf) - 2; 1689 APIRET rcOs2 = DosQueryFSAttach(szDrive, 0, FSAIL_QUERYNAME, &uBuf.FsQueryBuf, &cbBuf); 1690 if (rcOs2 == NO_ERROR) 1691 { 1692 const char *pszFsdName = (const char *)&uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1]; 1693 if ( uBuf.FsQueryBuf.iType == FSAT_REMOTEDRV 1694 && RTStrICmpAscii(pszFsdName, "VBOXSF") == 0) 1695 { 1696 const char *pszMountedName = (const char *)&pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1]; 1697 if (RTStrICmp(pszMountedName, pszName) == 0) 1698 { 1699 const char *pszTag = pszMountedName + strlen(pszMountedName) + 1; /* safe */ 1700 if (strcmp(pszTag, "VBoxAutomounter") == 0) 1701 RTPrintf("%s %s*", pszOn, szDrive); 1702 else 1703 RTPrintf("%s %s", pszOn, szDrive); 1704 pszOn = ","; 1705 } 1706 } 1707 } 1708 } 1709 # endif 1710 RTPrintf("\n"); 1711 1675 1712 RTStrFree(pszName); 1676 1713 RTStrFree(pszMntPt); … … 1695 1732 * Attaches a shared folder to a drive letter. 1696 1733 */ 1697 static RTEXITCODE sharedFolder s_use(int argc, char **argv)1734 static RTEXITCODE sharedFolder_use(int argc, char **argv) 1698 1735 { 1699 1736 /* … … 1701 1738 */ 1702 1739 if (argc != 2) 1703 return VBoxControlSyntaxError("sharedfolder suse: expected a drive letter and a shared folder name\n");1740 return VBoxControlSyntaxError("sharedfolder use: expected a drive letter and a shared folder name\n"); 1704 1741 1705 1742 const char *pszDrive = argv[0]; 1706 1743 if (!RT_C_IS_ALPHA(pszDrive[0]) || pszDrive[1] != ':' || pszDrive[2] != '\0') 1707 return VBoxControlSyntaxError("sharedfolder suse: not a drive letter: %s\n", pszDrive);1744 return VBoxControlSyntaxError("sharedfolder use: not a drive letter: %s\n", pszDrive); 1708 1745 1709 1746 static const char s_szTag[] = "VBoxControl"; … … 1712 1749 size_t cchName = strlen(pszName); 1713 1750 if (cchName < 1) 1714 return VBoxControlSyntaxError("sharedfolder suse: shared folder name cannot be empty!\n");1751 return VBoxControlSyntaxError("sharedfolder use: shared folder name cannot be empty!\n"); 1715 1752 if (cchName + 1 + sizeof(s_szTag) >= sizeof(szzNameAndTag)) 1716 return VBoxControlSyntaxError("sharedfolder suse: shared folder name is too long! (%s)\n", pszName);1753 return VBoxControlSyntaxError("sharedfolder use: shared folder name is too long! (%s)\n", pszName); 1717 1754 1718 1755 /* … … 1726 1763 if (rcOs2 == NO_ERROR) 1727 1764 return RTEXITCODE_SUCCESS; 1765 if (rcOs2 == ERROR_INVALID_FSD_NAME) 1766 return VBoxControlError("Shared folders IFS not installed?\n"); 1728 1767 return VBoxControlError("DosFSAttach/FS_ATTACH failed to attach '%s' to '%s': %u\n", pszName, pszDrive, rcOs2); 1729 1768 } … … 1732 1771 * Detaches a shared folder from a drive letter. 1733 1772 */ 1734 static RTEXITCODE sharedFolder s_unuse(int argc, char **argv)1773 static RTEXITCODE sharedFolder_unuse(int argc, char **argv) 1735 1774 { 1736 1775 /* … … 1738 1777 */ 1739 1778 if (argc != 1) 1740 return VBoxControlSyntaxError("sharedfolder sunuse: expected drive letter\n");1779 return VBoxControlSyntaxError("sharedfolder unuse: expected drive letter\n"); 1741 1780 const char *pszDrive = argv[0]; 1742 1781 if (!RT_C_IS_ALPHA(pszDrive[0]) || pszDrive[1] != ':' || pszDrive[2] != '\0') 1743 return VBoxControlSyntaxError("sharedfolder sunuse: not a drive letter: %s\n", pszDrive);1782 return VBoxControlSyntaxError("sharedfolder unuse: not a drive letter: %s\n", pszDrive); 1744 1783 1745 1784 /* … … 1770 1809 } 1771 1810 if (!strcmp(argv[0], "list")) 1772 return listSharedFolders(argc - 1, argv + 1);1811 return sharedFolder_list(argc - 1, argv + 1); 1773 1812 # ifdef RT_OS_OS2 1774 1813 if (!strcmp(argv[0], "use")) 1775 return sharedFolder s_use(argc - 1, argv + 1);1814 return sharedFolder_use(argc - 1, argv + 1); 1776 1815 if (!strcmp(argv[0], "unuse")) 1777 return sharedFolder s_unuse(argc - 1, argv + 1);1816 return sharedFolder_unuse(argc - 1, argv + 1); 1778 1817 # endif 1779 1818
Note:
See TracChangeset
for help on using the changeset viewer.