VirtualBox

Changeset 75469 in vbox


Ignore:
Timestamp:
Nov 14, 2018 8:53:20 PM (6 years ago)
Author:
vboxsync
Message:

VBoxService,VBoxControl: OS/2 build fixes.

Location:
trunk/src/VBox/Additions/common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp

    r75467 r75469  
    2323#include <iprt/cpp/autores.h>
    2424#include <iprt/buildconfig.h>
     25#include <iprt/ctype.h>
     26#include <iprt/err.h>
    2527#include <iprt/getopt.h>
    2628#include <iprt/initterm.h>
     
    4345# include <VBox/shflsvc.h>
    4446# ifdef RT_OS_OS2
     47#  define OS2EMX_PLAIN_CHAR
    4548#  define INCL_ERRORS
    4649#  define INCL_DOSFILEMGR
     
    17041707        return VBoxControlSyntaxError("sharedfolders use: not a drive letter: %s\n", pszDrive);
    17051708
     1709    static const char s_szTag[] = "VBoxControl";
     1710    char        szzNameAndTag[256];
    17061711    const char *pszName   = argv[1];
    17071712    size_t cchName = strlen(pszName);
    17081713    if (cchName < 1)
    17091714        return VBoxControlSyntaxError("sharedfolders use: shared folder name cannot be empty!\n");
    1710     if (cchName > 128)
     1715    if (cchName + 1 + sizeof(s_szTag) >= sizeof(szzNameAndTag))
    17111716        return VBoxControlSyntaxError("sharedfolders use: shared folder name is too long! (%s)\n", pszName);
    17121717
     
    17141719     * Do the attaching.
    17151720     */
    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);
    17201722    szzNameAndTag[cchName] = '\0';
    17211723    memcpy(&szzNameAndTag[cchName + 1], s_szTag, sizeof(s_szTag));
    17221724
    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)
    17251727        return RTEXITCODE_SUCCESS;
    17261728    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  
    137137
    138138ifdef VBOX_WITH_SHARED_FOLDERS
    139  if1of ($(KBUILD_TARGET), win linux solaris)
     139 if1of ($(KBUILD_TARGET), linux os2 solaris win)
    140140VBoxService_DEFS         += VBOX_WITH_SHARED_FOLDERS
    141141VBoxService_SOURCES      += \
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp

    r75467 r75469  
    5454# define INCL_DOSFILEMGR
    5555# define INCL_ERRORS
     56# define OS2EMX_PLAIN_CHAR
    5657# include <os2emx.h>
    5758#else
     
    940941        RT_ZERO(uBuf);
    941942        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);
    943944        if (rcOs2 == NO_ERROR)
    944945        {
    945             const char *pszFsdName = &uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1];
     946            const char *pszFsdName = (const char *)&uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1];
    946947            if (   uBuf.FsQueryBuf.iType == FSAT_REMOTEDRV
    947948                && RTStrICmpAscii(pszFsdName, "VBOXSF") == 0)
    948949            {
    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.) */
    951952                if (strcmp(pszTag, g_szTag) == 0)
    952953                {
     
    12111212
    12121213    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);
    12141215    int rc;
    12151216    if (rcOs2 == NO_ERROR)
    12161217    {
    1217         const char *pszFsdName = &uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1];
     1218        const char *pszFsdName = (const char *)&uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1];
    12181219        if (   uBuf.FsQueryBuf.iType == FSAT_REMOTEDRV
    12191220            && RTStrICmpAscii(pszFsdName, "VBOXSF") == 0)
    12201221        {
    1221             const char *pszMountedName = &pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1];
     1222            const char *pszMountedName = (const char *)&pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1];
    12221223            if (RTStrICmp(pszMountedName, pszName) == 0)
    12231224            {
     
    14321433    else
    14331434        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);
    14351436    return VERR_OPEN_FAILED;
    14361437
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette