Index: /trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp	(revision 75468)
+++ /trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp	(revision 75469)
@@ -23,4 +23,6 @@
 #include <iprt/cpp/autores.h>
 #include <iprt/buildconfig.h>
+#include <iprt/ctype.h>
+#include <iprt/err.h>
 #include <iprt/getopt.h>
 #include <iprt/initterm.h>
@@ -43,4 +45,5 @@
 # include <VBox/shflsvc.h>
 # ifdef RT_OS_OS2
+#  define OS2EMX_PLAIN_CHAR
 #  define INCL_ERRORS
 #  define INCL_DOSFILEMGR
@@ -1704,9 +1707,11 @@
         return VBoxControlSyntaxError("sharedfolders use: not a drive letter: %s\n", pszDrive);
 
+    static const char s_szTag[] = "VBoxControl";
+    char        szzNameAndTag[256];
     const char *pszName   = argv[1];
     size_t cchName = strlen(pszName);
     if (cchName < 1)
         return VBoxControlSyntaxError("sharedfolders use: shared folder name cannot be empty!\n");
-    if (cchName > 128)
+    if (cchName + 1 + sizeof(s_szTag) >= sizeof(szzNameAndTag))
         return VBoxControlSyntaxError("sharedfolders use: shared folder name is too long! (%s)\n", pszName);
 
@@ -1714,13 +1719,10 @@
      * Do the attaching.
      */
-    static const char s_szTag[] = "VBoxControl";
-    char    szzNameAndTag[256];
-    size_t  cchName = strlen(pEntry->pszName);
-    memcpy(szzNameAndTag, pEntry->pszName, cchName);
+    memcpy(szzNameAndTag, pszName, cchName);
     szzNameAndTag[cchName] = '\0';
     memcpy(&szzNameAndTag[cchName + 1], s_szTag, sizeof(s_szTag));
 
-    APIRET rc = DosFSAttach(pEntry->pszActualMountPoint, "VBOXSF", szzNameAndTag, cchName + 1 + sizeof(s_szTag), FS_ATTACH);
-    if (rc == NO_ERROR)
+    APIRET rcOs2 = DosFSAttach(pszDrive, "VBOXSF", szzNameAndTag, cchName + 1 + sizeof(s_szTag), FS_ATTACH);
+    if (rcOs2 == NO_ERROR)
         return RTEXITCODE_SUCCESS;
     return VBoxControlError("DosFSAttach/FS_ATTACH failed to attach '%s' to '%s': %u\n", pszName, pszDrive, rcOs2);
Index: /trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk	(revision 75468)
+++ /trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk	(revision 75469)
@@ -137,5 +137,5 @@
 
 ifdef VBOX_WITH_SHARED_FOLDERS
- if1of ($(KBUILD_TARGET), win linux solaris)
+ if1of ($(KBUILD_TARGET), linux os2 solaris win)
 VBoxService_DEFS         += VBOX_WITH_SHARED_FOLDERS
 VBoxService_SOURCES      += \
Index: /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp	(revision 75468)
+++ /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp	(revision 75469)
@@ -54,4 +54,5 @@
 # define INCL_DOSFILEMGR
 # define INCL_ERRORS
+# define OS2EMX_PLAIN_CHAR
 # include <os2emx.h>
 #else
@@ -940,13 +941,13 @@
         RT_ZERO(uBuf);
         ULONG  cbBuf = sizeof(uBuf) - 2;
-        APIRET rcOs2 = DosQueryFSAttach(szMountPoint, 0, FSAIL_QUERYNAME, uBuf, &cbBuf);
+        APIRET rcOs2 = DosQueryFSAttach(szMountPoint, 0, FSAIL_QUERYNAME, &uBuf.FsQueryBuf, &cbBuf);
         if (rcOs2 == NO_ERROR)
         {
-            const char *pszFsdName = &uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1];
+            const char *pszFsdName = (const char *)&uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1];
             if (   uBuf.FsQueryBuf.iType == FSAT_REMOTEDRV
                 && RTStrICmpAscii(pszFsdName, "VBOXSF") == 0)
             {
-                const char *pszMountedName = &pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1];
-                const char *pszTag         = strlen(pszMountedName) + 1; /* (Safe. Always two trailing zero bytes, see above.) */
+                const char *pszMountedName = (const char *)&pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1];
+                const char *pszTag = pszMountedName + strlen(pszMountedName) + 1; /* (Safe. Always two trailing zero bytes, see above.) */
                 if (strcmp(pszTag, g_szTag) == 0)
                 {
@@ -1211,13 +1212,13 @@
 
     ULONG cbBuf = sizeof(uBuf);
-    APIRET rcOs2 = DosQueryFSAttach((PCSZ)pFsInfo->szMountpoint, 0, FSAIL_QUERYNAME, uBuf, &cbBuf);
+    APIRET rcOs2 = DosQueryFSAttach(pszMountPoint, 0, FSAIL_QUERYNAME, &uBuf.FsQueryBuf, &cbBuf);
     int rc;
     if (rcOs2 == NO_ERROR)
     {
-        const char *pszFsdName = &uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1];
+        const char *pszFsdName = (const char *)&uBuf.FsQueryBuf.szName[uBuf.FsQueryBuf.cbName + 1];
         if (   uBuf.FsQueryBuf.iType == FSAT_REMOTEDRV
             && RTStrICmpAscii(pszFsdName, "VBOXSF") == 0)
         {
-            const char *pszMountedName = &pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1];
+            const char *pszMountedName = (const char *)&pszFsdName[uBuf.FsQueryBuf.cbFSDName + 1];
             if (RTStrICmp(pszMountedName, pszName) == 0)
             {
@@ -1432,5 +1433,5 @@
     else
         VGSvcError("vbsvcAutomounterMountIt: Share name for attach to '%s' is too long: %u chars - '%s'\n",
-                   pEntry->pszActualMountPoint, cchName, pEntry->pszName;
+                   pEntry->pszActualMountPoint, cchName, pEntry->pszName);
     return VERR_OPEN_FAILED;
 
