Changeset 75469 in vbox
- Timestamp:
- Nov 14, 2018 8:53:20 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions/common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
r75467 r75469 23 23 #include <iprt/cpp/autores.h> 24 24 #include <iprt/buildconfig.h> 25 #include <iprt/ctype.h> 26 #include <iprt/err.h> 25 27 #include <iprt/getopt.h> 26 28 #include <iprt/initterm.h> … … 43 45 # include <VBox/shflsvc.h> 44 46 # ifdef RT_OS_OS2 47 # define OS2EMX_PLAIN_CHAR 45 48 # define INCL_ERRORS 46 49 # define INCL_DOSFILEMGR … … 1704 1707 return VBoxControlSyntaxError("sharedfolders use: not a drive letter: %s\n", pszDrive); 1705 1708 1709 static const char s_szTag[] = "VBoxControl"; 1710 char szzNameAndTag[256]; 1706 1711 const char *pszName = argv[1]; 1707 1712 size_t cchName = strlen(pszName); 1708 1713 if (cchName < 1) 1709 1714 return VBoxControlSyntaxError("sharedfolders use: shared folder name cannot be empty!\n"); 1710 if (cchName > 128)1715 if (cchName + 1 + sizeof(s_szTag) >= sizeof(szzNameAndTag)) 1711 1716 return VBoxControlSyntaxError("sharedfolders use: shared folder name is too long! (%s)\n", pszName); 1712 1717 … … 1714 1719 * Do the attaching. 1715 1720 */ 1716 static const char s_szTag[] = "VBoxControl"; 1717 char szzNameAndTag[256]; 1718 size_t cchName = strlen(pEntry->pszName); 1719 memcpy(szzNameAndTag, pEntry->pszName, cchName); 1721 memcpy(szzNameAndTag, pszName, cchName); 1720 1722 szzNameAndTag[cchName] = '\0'; 1721 1723 memcpy(&szzNameAndTag[cchName + 1], s_szTag, sizeof(s_szTag)); 1722 1724 1723 APIRET rc = DosFSAttach(pEntry->pszActualMountPoint, "VBOXSF", szzNameAndTag, cchName + 1 + sizeof(s_szTag), FS_ATTACH);1724 if (rc == NO_ERROR)1725 APIRET rcOs2 = DosFSAttach(pszDrive, "VBOXSF", szzNameAndTag, cchName + 1 + sizeof(s_szTag), FS_ATTACH); 1726 if (rcOs2 == NO_ERROR) 1725 1727 return RTEXITCODE_SUCCESS; 1726 1728 return VBoxControlError("DosFSAttach/FS_ATTACH failed to attach '%s' to '%s': %u\n", pszName, pszDrive, rcOs2); -
trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk
r75407 r75469 137 137 138 138 ifdef VBOX_WITH_SHARED_FOLDERS 139 if1of ($(KBUILD_TARGET), win linux solaris)139 if1of ($(KBUILD_TARGET), linux os2 solaris win) 140 140 VBoxService_DEFS += VBOX_WITH_SHARED_FOLDERS 141 141 VBoxService_SOURCES += \ -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
r75467 r75469 54 54 # define INCL_DOSFILEMGR 55 55 # define INCL_ERRORS 56 # define OS2EMX_PLAIN_CHAR 56 57 # include <os2emx.h> 57 58 #else … … 940 941 RT_ZERO(uBuf); 941 942 ULONG cbBuf = sizeof(uBuf) - 2; 942 APIRET rcOs2 = DosQueryFSAttach(szMountPoint, 0, FSAIL_QUERYNAME, uBuf, &cbBuf);943 APIRET rcOs2 = DosQueryFSAttach(szMountPoint, 0, FSAIL_QUERYNAME, &uBuf.FsQueryBuf, &cbBuf); 943 944 if (rcOs2 == NO_ERROR) 944 945 { 945 const char *pszFsdName = &uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1];946 const char *pszFsdName = (const char *)&uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1]; 946 947 if ( uBuf.FsQueryBuf.iType == FSAT_REMOTEDRV 947 948 && RTStrICmpAscii(pszFsdName, "VBOXSF") == 0) 948 949 { 949 const char *pszMountedName = &pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1];950 const char *pszTag =strlen(pszMountedName) + 1; /* (Safe. Always two trailing zero bytes, see above.) */950 const char *pszMountedName = (const char *)&pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1]; 951 const char *pszTag = pszMountedName + strlen(pszMountedName) + 1; /* (Safe. Always two trailing zero bytes, see above.) */ 951 952 if (strcmp(pszTag, g_szTag) == 0) 952 953 { … … 1211 1212 1212 1213 ULONG cbBuf = sizeof(uBuf); 1213 APIRET rcOs2 = DosQueryFSAttach( (PCSZ)pFsInfo->szMountpoint, 0, FSAIL_QUERYNAME, uBuf, &cbBuf);1214 APIRET rcOs2 = DosQueryFSAttach(pszMountPoint, 0, FSAIL_QUERYNAME, &uBuf.FsQueryBuf, &cbBuf); 1214 1215 int rc; 1215 1216 if (rcOs2 == NO_ERROR) 1216 1217 { 1217 const char *pszFsdName = &uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1];1218 const char *pszFsdName = (const char *)&uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1]; 1218 1219 if ( uBuf.FsQueryBuf.iType == FSAT_REMOTEDRV 1219 1220 && RTStrICmpAscii(pszFsdName, "VBOXSF") == 0) 1220 1221 { 1221 const char *pszMountedName = &pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1];1222 const char *pszMountedName = (const char *)&pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1]; 1222 1223 if (RTStrICmp(pszMountedName, pszName) == 0) 1223 1224 { … … 1432 1433 else 1433 1434 VGSvcError("vbsvcAutomounterMountIt: Share name for attach to '%s' is too long: %u chars - '%s'\n", 1434 pEntry->pszActualMountPoint, cchName, pEntry->pszName ;1435 pEntry->pszActualMountPoint, cchName, pEntry->pszName); 1435 1436 return VERR_OPEN_FAILED; 1436 1437
Note:
See TracChangeset
for help on using the changeset viewer.