Index: /trunk/include/VBox/settings.h
===================================================================
--- /trunk/include/VBox/settings.h	(revision 75379)
+++ /trunk/include/VBox/settings.h	(revision 75380)
@@ -751,4 +751,5 @@
     bool            fWritable;
     bool            fAutoMount;
+    com::Utf8Str    strAutoMountPoint;
 };
 
Index: /trunk/include/VBox/shflsvc.h
===================================================================
--- /trunk/include/VBox/shflsvc.h	(revision 75379)
+++ /trunk/include/VBox/shflsvc.h	(revision 75380)
@@ -40,4 +40,7 @@
 #include <iprt/fs.h>
 #include <iprt/assert.h>
+#ifdef IN_RING3
+# include <iprt/mem.h>
+#endif
 
 
@@ -231,4 +234,126 @@
 
 /**
+ * Helper for copying one string into another.
+ *
+ * @returns pDst
+ * @param   pDst        The destination string. Assumed to be the same size as
+ *                      the source.
+ * @param   pSrc        The source string.
+ */
+DECLINLINE(PSHFLSTRING) ShflStringCopy(PSHFLSTRING pDst, PCSHFLSTRING pSrc)
+{
+    pDst->u16Length = pSrc->u16Length;
+    pDst->u16Size   = pSrc->u16Size;
+    memcpy(&pDst->String, &pSrc->String, pSrc->u16Size);
+    return pDst;
+}
+
+#ifdef IN_RING3
+
+/**
+ * Duplicates a string using RTMemAlloc as allocator.
+ *
+ * @returns Copy, NULL if out of memory.
+ * @param   pSrc        The source string.
+ */
+DECLINLINE(PSHFLSTRING) ShflStringDup(PCSHFLSTRING pSrc)
+{
+    PSHFLSTRING pDst = (PSHFLSTRING)RTMemAlloc(SHFLSTRING_HEADER_SIZE + pSrc->u16Size);
+    if (pDst)
+        return ShflStringCopy(pDst, pSrc);
+    return pDst;
+}
+
+/**
+ * Duplicates a UTF-16 string using RTMemAlloc as allocator.
+ *
+ * The returned string will be using UTF-16 encoding too.
+ *
+ * @returns Pointer to copy on success - pass to RTMemFree to free.
+ *          NULL if out of memory.
+ * @param   pwszSrc     The source string.  Encoding is not checked.
+ */
+DECLINLINE(PSHFLSTRING) ShflStringDupUtf16(PCRTUTF16 pwszSrc)
+{
+    size_t cwcSrc = RTUtf16Len(pwszSrc);
+    if (cwcSrc < UINT16_MAX / sizeof(RTUTF16))
+    {
+        PSHFLSTRING pDst = (PSHFLSTRING)RTMemAlloc(SHFLSTRING_HEADER_SIZE + (cwcSrc + 1) * sizeof(RTUTF16));
+        if (pDst)
+        {
+            pDst->u16Length = (uint16_t)(cwcSrc * sizeof(RTUTF16));
+            pDst->u16Size   = (uint16_t)((cwcSrc + 1) * sizeof(RTUTF16));
+            memcpy(&pDst->String, pwszSrc, (cwcSrc + 1) * sizeof(RTUTF16));
+            return pDst;
+        }
+    }
+    AssertFailed();
+    return NULL;
+}
+
+/**
+ * Duplicates a UTF-8 string using RTMemAlloc as allocator.
+ *
+ * The returned string will be using UTF-8 encoding too.
+ *
+ * @returns Pointer to copy on success - pass to RTMemFree to free.
+ *          NULL if out of memory.
+ * @param   pszSrc      The source string.  Encoding is not checked.
+ */
+DECLINLINE(PSHFLSTRING) ShflStringDupUtf8(const char *pszSrc)
+{
+    size_t cchSrc = strlen(pszSrc);
+    if (cchSrc < UINT16_MAX)
+    {
+        PSHFLSTRING pDst = (PSHFLSTRING)RTMemAlloc(SHFLSTRING_HEADER_SIZE + cchSrc + 1);
+        if (pDst)
+        {
+            pDst->u16Length = (uint16_t)cchSrc;
+            pDst->u16Size   = (uint16_t)(cchSrc + 1);
+            memcpy(&pDst->String, pszSrc, cchSrc + 1);
+            return pDst;
+        }
+    }
+    AssertFailed();
+    return NULL;
+}
+
+/**
+ * Creates a UTF-16 duplicate of the UTF-8 string @a pszSrc using RTMemAlloc as
+ * allocator.
+ *
+ * @returns Pointer to copy on success - pass to RTMemFree to free.
+ *          NULL if out of memory or invalid UTF-8 encoding.
+ * @param   pszSrc      The source string.
+ */
+DECLINLINE(PSHFLSTRING) ShflStringDupUtf8AsUtf16(const char *pszSrc)
+{
+    size_t cwcConversion = 0;
+    int rc = RTStrCalcUtf16LenEx(pszSrc, RTSTR_MAX, &cwcConversion);
+    if (   RT_SUCCESS(rc)
+        && cwcConversion < UINT16_MAX / sizeof(RTUTF16))
+    {
+        PSHFLSTRING pDst = (PSHFLSTRING)RTMemAlloc(SHFLSTRING_HEADER_SIZE + (cwcConversion + 1) * sizeof(RTUTF16));
+        if (pDst)
+        {
+            PRTUTF16 pwszDst = pDst->String.ucs2;
+            pDst->u16Size = (uint16_t)((cwcConversion + 1) * sizeof(RTUTF16));
+            rc = RTStrToUtf16Ex(pszSrc, RTSTR_MAX, &pwszDst, cwcConversion + 1, &cwcConversion);
+            AssertRC(rc);
+            if (RT_SUCCESS(rc))
+            {
+                pDst->u16Length = (uint16_t)(cwcConversion * sizeof(RTUTF16));
+                return pDst;
+            }
+            RTMemFree(pDst);
+        }
+    }
+    AssertMsgFailed(("rc=%Rrc cwcConversion=%#x\n", rc, cwcConversion));
+    return NULL;
+}
+
+#endif /* IN_RING3 */
+
+/**
  * Validates a HGCM string output parameter.
  *
@@ -312,4 +437,12 @@
 }
 
+/** Macro for passing as string as a HGCM parmeter (pointer)  */
+#define SHFLSTRING_TO_HGMC_PARAM(a_pParam, a_pString) \
+    do { \
+        (a_pParam)->type = VBOX_HGCM_SVC_PARM_PTR; \
+        (a_pParam)->u.pointer.addr = (a_pString); \
+        (a_pParam)->u.pointer.size = ShflStringSizeOfBuffer(a_pString); \
+    } while (0)
+
 /** @} */
 
@@ -1426,5 +1559,5 @@
 #define SHFL_ADD_MAPPING_F_MISSING          (RT_BIT_32(3))
 
-#define SHFL_CPARMS_ADD_MAPPING  (3)
+#define SHFL_CPARMS_ADD_MAPPING  (4)
 
 /**
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp	(revision 75379)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp	(revision 75380)
@@ -49,4 +49,16 @@
 // funcs
 ///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Helper for formatting an indexed name or some such thing.
+ */
+static const char *FmtNm(char psz[80], const char *pszFormat, ...)
+{
+    va_list va;
+    va_start(va, pszFormat);
+    RTStrPrintfV(psz, 80, pszFormat, va);
+    va_end(va);
+    return psz;
+}
 
 HRESULT showSnapshots(ComPtr<ISnapshot> &rootSnapshot,
@@ -368,4 +380,37 @@
 }
 
+/** Shows a shared folder.   */
+static HRESULT showSharedFolder(ComPtr<ISharedFolder> &sf, VMINFO_DETAILS details, const char *pszDesc,
+                                const char *pszMrInfix, size_t idxMr, bool fFirst)
+{
+    Bstr name, hostPath, bstrAutoMountPoint;
+    BOOL writable = FALSE, fAutoMount = FALSE;
+    CHECK_ERROR2I_RET(sf, COMGETTER(Name)(name.asOutParam()), hrcCheck);
+    CHECK_ERROR2I_RET(sf, COMGETTER(HostPath)(hostPath.asOutParam()), hrcCheck);
+    CHECK_ERROR2I_RET(sf, COMGETTER(Writable)(&writable), hrcCheck);
+    CHECK_ERROR2I_RET(sf, COMGETTER(AutoMount)(&fAutoMount), hrcCheck);
+    CHECK_ERROR2I_RET(sf, COMGETTER(AutoMountPoint)(bstrAutoMountPoint.asOutParam()), hrcCheck);
+
+    if (fFirst && details != VMINFO_MACHINEREADABLE)
+        RTPrintf("\n\n");
+    if (details == VMINFO_MACHINEREADABLE)
+    {
+        char szNm[80];
+        outputMachineReadableString(FmtNm(szNm, "SharedFolderName%s%zu", pszMrInfix, idxMr), &name);
+        outputMachineReadableString(FmtNm(szNm, "SharedFolderPath%s%zu", pszMrInfix, idxMr), &hostPath);
+    }
+    else
+    {
+        RTPrintf("Name: '%ls', Host path: '%ls' (%s), %s%s%",
+                 name.raw(), hostPath.raw(), pszDesc, writable ? "writable" : "readonly", fAutoMount ? ", auto-mount" : "");
+        if (bstrAutoMountPoint.isNotEmpty())
+            RTPrintf(", mount-point: '%ls'\n", bstrAutoMountPoint.raw());
+        else
+            RTPrintf("\n");
+    }
+    return S_OK;
+}
+
+
 static const char *paravirtProviderToString(ParavirtProvider_T provider, VMINFO_DETAILS details)
 {
@@ -407,16 +452,4 @@
             return "Unknown";
     }
-}
-
-/**
- * Helper for formatting an indexed name or some such thing.
- */
-static const char *FmtNm(char psz[80], const char *pszFormat, ...)
-{
-    va_list va;
-    va_start(va, pszFormat);
-    RTStrPrintfV(psz, 80, pszFormat, va);
-    va_end(va);
-    return psz;
 }
 
@@ -2218,8 +2251,5 @@
         {
             ComPtr<ISharedFolder> sf = sfColl[i];
-            Bstr name, hostPath;
-            sf->COMGETTER(Name)(name.asOutParam());
-            sf->COMGETTER(HostPath)(hostPath.asOutParam());
-            RTPrintf("Name: '%ls', Host path: '%ls' (global mapping)\n", name.raw(), hostPath.raw());
+            showSharedFolder(sf, details, "global mapping", "GlobalMapping", i + 1, numSharedFolders == 0);
             ++numSharedFolders;
         }
@@ -2229,26 +2259,9 @@
     {
         com::SafeIfaceArray <ISharedFolder> folders;
-
         CHECK_ERROR_RET(machine, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), rc);
-
         for (size_t i = 0; i < folders.size(); ++i)
         {
             ComPtr<ISharedFolder> sf = folders[i];
-
-            Bstr name, hostPath;
-            BOOL writable;
-            sf->COMGETTER(Name)(name.asOutParam());
-            sf->COMGETTER(HostPath)(hostPath.asOutParam());
-            sf->COMGETTER(Writable)(&writable);
-            if (!numSharedFolders && details != VMINFO_MACHINEREADABLE)
-                RTPrintf("\n\n");
-            if (details == VMINFO_MACHINEREADABLE)
-            {
-                outputMachineReadableString(FmtNm(szNm, "SharedFolderNameMachineMapping%zu", i + 1), &name);
-                outputMachineReadableString(FmtNm(szNm, "SharedFolderPathMachineMapping%zu", i + 1), &hostPath);
-            }
-            else
-                RTPrintf("Name: '%ls', Host path: '%ls' (machine mapping), %s\n",
-                         name.raw(), hostPath.raw(), writable ? "writable" : "readonly");
+            showSharedFolder(sf, details, "machine mapping", "MachineMapping", i + 1, numSharedFolders == 0);
             ++numSharedFolders;
         }
@@ -2258,23 +2271,9 @@
     {
         com::SafeIfaceArray <ISharedFolder> folders;
-
         CHECK_ERROR_RET(pConsole, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), rc);
-
         for (size_t i = 0; i < folders.size(); ++i)
         {
             ComPtr<ISharedFolder> sf = folders[i];
-
-            Bstr name, hostPath;
-            sf->COMGETTER(Name)(name.asOutParam());
-            sf->COMGETTER(HostPath)(hostPath.asOutParam());
-            if (!numSharedFolders && details != VMINFO_MACHINEREADABLE)
-                RTPrintf("\n\n");
-            if (details == VMINFO_MACHINEREADABLE)
-            {
-                outputMachineReadableString(FmtNm(szNm, "SharedFolderNameTransientMapping%zu", i + 1), &name);
-                outputMachineReadableString(FmtNm(szNm, "SharedFolderPathTransientMapping%zu", i + 1), &hostPath);
-            }
-            else
-                RTPrintf("Name: '%ls', Host path: '%ls' (transient mapping)\n", name.raw(), hostPath.raw());
+            showSharedFolder(sf, details, "transient mapping", "TransientMapping", i + 1, numSharedFolders == 0);
             ++numSharedFolders;
         }
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp	(revision 75379)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp	(revision 75380)
@@ -1096,4 +1096,5 @@
         bool fWritable = true;
         bool fAutoMount = false;
+        char *pszAutoMountPoint = "";
 
         for (int i = 2; i < a->argc; i++)
@@ -1130,4 +1131,11 @@
                 fAutoMount = true;
             }
+            else if (!strcmp(a->argv[i], "--auto-mount-point"))
+            {
+                if (a->argc <= i + 1 || !*a->argv[i+1])
+                    return errorArgument("Missing argument to '%s'", a->argv[i]);
+                i++;
+                pszAutoMountPoint = a->argv[i];
+            }
             else
                 return errorSyntax(USAGE_SHAREDFOLDER_ADD, "Invalid parameter '%s'", Utf8Str(a->argv[i]).c_str());
@@ -1160,7 +1168,6 @@
                                       "Machine '%s' is not currently running.\n", pszMachineName);
 
-            CHECK_ERROR(console, CreateSharedFolder(Bstr(name).raw(),
-                                                    Bstr(hostpath).raw(),
-                                                    fWritable, fAutoMount));
+            CHECK_ERROR(console, CreateSharedFolder(Bstr(name).raw(), Bstr(hostpath).raw(),
+                                                    fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw()));
             a->session->UnlockMachine();
         }
@@ -1174,7 +1181,6 @@
             a->session->COMGETTER(Machine)(sessionMachine.asOutParam());
 
-            CHECK_ERROR(sessionMachine, CreateSharedFolder(Bstr(name).raw(),
-                                                           Bstr(hostpath).raw(),
-                                                           fWritable, fAutoMount));
+            CHECK_ERROR(sessionMachine, CreateSharedFolder(Bstr(name).raw(), Bstr(hostpath).raw(),
+                                                           fWritable, fAutoMount, Bstr(pszAutoMountPoint).raw()));
             if (SUCCEEDED(rc))
                 CHECK_ERROR(sessionMachine, SaveSettings());
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp	(revision 75379)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp	(revision 75380)
@@ -42,8 +42,9 @@
     UIDataSettingsSharedFolder()
         : m_enmType(MachineType)
-        , m_strName(QString())
-        , m_strPath(QString())
+        , m_strName()
+        , m_strPath()
+        , m_fWritable(false)
         , m_fAutoMount(false)
-        , m_fWritable(false)
+        , m_strAutoMountPoint()
     {}
 
@@ -52,9 +53,10 @@
     {
         return true
-               && (m_enmType == other.m_enmType)
-               && (m_strName == other.m_strName)
-               && (m_strPath == other.m_strPath)
-               && (m_fAutoMount == other.m_fAutoMount)
-               && (m_fWritable == other.m_fWritable)
+               && m_enmType == other.m_enmType
+               && m_strName == other.m_strName
+               && m_strPath == other.m_strPath
+               && m_fWritable == other.m_fWritable
+               && m_fAutoMount == other.m_fAutoMount
+               && m_strAutoMountPoint == other.m_strAutoMountPoint
                ;
     }
@@ -71,8 +73,11 @@
     /** Holds the shared folder path. */
     QString             m_strPath;
+    /** Holds whether the shared folder should be writeable. */
+    bool                m_fWritable;
     /** Holds whether the shared folder should be auto-mounted at startup. */
     bool                m_fAutoMount;
-    /** Holds whether the shared folder should be writeable. */
-    bool                m_fWritable;
+    /** Where in the guest to try auto mount the shared folder (drive for
+     * Windows & OS/2, path for unixy guests). */
+    QString             m_strAutoMountPoint;
 };
 
@@ -161,6 +166,7 @@
             m_fields << m_strName
                      << m_strPath
+                     << (m_fWritable ? UIMachineSettingsSF::tr("Full") : UIMachineSettingsSF::tr("Read-only"))
                      << (m_fAutoMount ? UIMachineSettingsSF::tr("Yes") : "")
-                     << (m_fWritable ? UIMachineSettingsSF::tr("Full") : UIMachineSettingsSF::tr("Read-only"));
+                     << m_strAutoMountPoint;
 
         /* Adjust item layout: */
@@ -180,12 +186,13 @@
     virtual QString defaultText() const /* override */
     {
-        return parentItem() ?
-               tr("%1, %2: %3, %4: %5, %6: %7",
-                  "col.1 text, col.2 name: col.2 text, col.3 name: col.3 text, col.4 name: col.4 text")
+        return parentItem()
+             ? tr("%1, %2: %3, %4: %5, %6: %7, %8: %9",
+                  "col.1 text, col.2 name: col.2 text, col.3 name: col.3 text, col.4 name: col.4 text, col.5 name: col.5 text")
                   .arg(text(0))
                   .arg(parentTree()->headerItem()->text(1)).arg(text(1))
                   .arg(parentTree()->headerItem()->text(2)).arg(text(2))
-                  .arg(parentTree()->headerItem()->text(3)).arg(text(3)) :
-               text(0);
+                  .arg(parentTree()->headerItem()->text(3)).arg(text(3))
+                  .arg(parentTree()->headerItem()->text(4)).arg(text(4))
+             : text(0);
     }
 
@@ -215,5 +222,5 @@
             iTextWidth = fm.width(strOneString);
             if (   iTextWidth
-                && (iTextWidth + iIndentSize > cWidth))
+                && iTextWidth + iIndentSize > cWidth)
             {
                 iStart = 0;
@@ -331,6 +338,7 @@
                 oldFolderData.m_strName = comFolder.GetName();
                 oldFolderData.m_strPath = comFolder.GetHostPath();
+                oldFolderData.m_fWritable = comFolder.GetWritable();
                 oldFolderData.m_fAutoMount = comFolder.GetAutoMount();
-                oldFolderData.m_fWritable = comFolder.GetWritable();
+                oldFolderData.m_strAutoMountPoint = comFolder.GetAutoMountPoint();
                 /* Override folder cache key: */
                 strFolderKey = oldFolderData.m_strName;
@@ -474,6 +482,7 @@
         newFolderData.m_strName = strName;
         newFolderData.m_strPath = strPath;
+        newFolderData.m_fWritable = dlgFolderDetails.isWriteable();
         newFolderData.m_fAutoMount = dlgFolderDetails.isAutoMounted();
-        newFolderData.m_fWritable = dlgFolderDetails.isWriteable();
+        newFolderData.m_strAutoMountPoint = dlgFolderDetails.autoMountPoint();
 
         /* Add new folder item: */
@@ -502,6 +511,7 @@
     dlgFolderDetails.setName(pItem->m_strName);
     dlgFolderDetails.setPermanent(pItem->m_enmType == MachineType);
+    dlgFolderDetails.setWriteable(pItem->m_fWritable);
     dlgFolderDetails.setAutoMount(pItem->m_fAutoMount);
-    dlgFolderDetails.setWriteable(pItem->m_fWritable);
+    dlgFolderDetails.setAutoMountPoint(pItem->m_strAutoMountPoint);
 
     /* Run folder details dialog: */
@@ -518,6 +528,7 @@
         pItem->m_strName = strName;
         pItem->m_strPath = strPath;
+        pItem->m_fWritable = dlgFolderDetails.isWriteable();
         pItem->m_fAutoMount = dlgFolderDetails.isAutoMounted();
-        pItem->m_fWritable = dlgFolderDetails.isWriteable();
+        pItem->m_strAutoMountPoint = dlgFolderDetails.autoMountPoint();
         pItem->updateFields();
 
@@ -598,8 +609,9 @@
      *
      * Columns
-     * 0 = Tree view
-     * 1 = Shared Folder name
-     * 2 = Auto-mount flag
-     * 3 = Writable flag
+     * 0 = Tree view / name
+     * 1 = Path
+     * 2 = Writable flag
+     * 3 = Auto-mount flag
+     * 4 = Auto mount point
      */
     QAbstractItemView *pItemView = mTwFolders;
@@ -610,14 +622,42 @@
     const int mw2 = qMax(pItemView->sizeHintForColumn(2), pItemHeader->sectionSizeHint(2));
     const int mw3 = qMax(pItemView->sizeHintForColumn(3), pItemHeader->sectionSizeHint(3));
-
-    const int w0 = mw0 < iTotal / 4 ? mw0 : iTotal / 4;
-    const int w2 = mw2 < iTotal / 4 ? mw2 : iTotal / 4;
-    const int w3 = mw3 < iTotal / 4 ? mw3 : iTotal / 4;
+    const int mw4 = qMax(pItemView->sizeHintForColumn(4), pItemHeader->sectionSizeHint(4));
+#if 0 /** @todo Neither approach is perfect.  Short folder names, short paths, plenty of white space, but there is often '...' in column 0. */
+
+    const int w0 = mw0 < iTotal / 5 ? mw0 : iTotal / 5;
+    const int w2 = mw2 < iTotal / 5 ? mw2 : iTotal / 5;
+    const int w3 = mw3 < iTotal / 5 ? mw3 : iTotal / 5;
+    const int w4 = mw4 < iTotal / 5 ? mw4 : iTotal / 5;
 
     /* Giving 1st column all the available space. */
+    const int w1 = iTotal - w0 - w2 - w3 - w4;
+#else
+    const int mw1 = qMax(pItemView->sizeHintForColumn(1), pItemHeader->sectionSizeHint(1));
+    const int iHintTotal = mw0 + mw1 + mw2 + mw3 + mw4;
+    int w0, w1, w2, w3, w4;
+    int cExcess = iTotal - iHintTotal;
+    if (cExcess >= 0)
+    {
+        /* give excess width to column 1 (path) */
+        w0 = mw0;
+        w1 = mw1 + cExcess;
+        w2 = mw2;
+        w3 = mw3;
+        w4 = mw4;
+    }
+    else
+    {
+        w0 = mw0 < iTotal / 5 ? mw0 : iTotal / 5;
+        w2 = mw2 < iTotal / 5 ? mw2 : iTotal / 5;
+        w3 = mw3 < iTotal / 5 ? mw3 : iTotal / 5;
+        w4 = mw4 < iTotal / 5 ? mw4 : iTotal / 5;
+        w1 = iTotal - w0 - w2 - w3 - w4;
+    }
+#endif
     mTwFolders->setColumnWidth(0, w0);
-    mTwFolders->setColumnWidth(1, iTotal - w0 - w2 - w3);
+    mTwFolders->setColumnWidth(1, w1);
     mTwFolders->setColumnWidth(2, w2);
     mTwFolders->setColumnWidth(3, w3);
+    mTwFolders->setColumnWidth(4, w4);
 }
 
@@ -829,6 +869,7 @@
         pItem->m_strName = sharedFolderData.m_strName;
         pItem->m_strPath = sharedFolderData.m_strPath;
+        pItem->m_fWritable = sharedFolderData.m_fWritable;
         pItem->m_fAutoMount = sharedFolderData.m_fAutoMount;
-        pItem->m_fWritable = sharedFolderData.m_fWritable;
+        pItem->m_strAutoMountPoint = sharedFolderData.m_strAutoMountPoint;
         pItem->updateFields();
 
@@ -1019,64 +1060,53 @@
 bool UIMachineSettingsSF::createSharedFolder(const UISettingsCacheSharedFolder &folderCache)
 {
-    /* Prepare result: */
-    bool fSuccess = true;
-    /* Create folder: */
+    /* Get folder data: */
+    const UIDataSettingsSharedFolder &newFolderData = folderCache.data();
+    const UISharedFolderType enmFoldersType = newFolderData.m_enmType;
+    const QString strFolderName = newFolderData.m_strName;
+    const QString strFolderPath = newFolderData.m_strPath;
+    const bool fIsWritable = newFolderData.m_fWritable;
+    const bool fIsAutoMount = newFolderData.m_fAutoMount;
+    const QString strAutoMountPoint = newFolderData.m_strAutoMountPoint;
+
+    /* Get current folders: */
+    CSharedFolderVector folders;
+    bool fSuccess = getSharedFolders(enmFoldersType, folders);
+
+    /* Search for a folder with the same name: */
+    CSharedFolder comFolder;
     if (fSuccess)
-    {
-        /* Get folder data: */
-        const UIDataSettingsSharedFolder &newFolderData = folderCache.data();
-        const UISharedFolderType enmFoldersType = newFolderData.m_enmType;
-        const QString strFolderName = newFolderData.m_strName;
-        const QString strFolderPath = newFolderData.m_strPath;
-        const bool fIsAutoMount = newFolderData.m_fAutoMount;
-        const bool fIsWritable = newFolderData.m_fWritable;
-
-        /* Get current folders: */
-        CSharedFolderVector folders;
-        if (fSuccess)
-            fSuccess = getSharedFolders(enmFoldersType, folders);
-
-        /* Search for a folder with the same name: */
-        CSharedFolder comFolder;
-        if (fSuccess)
-            fSuccess = getSharedFolder(strFolderName, folders, comFolder);
-
-        /* Make sure such folder doesn't exist: */
-        if (fSuccess && comFolder.isNull())
-        {
-            /* Create new folder: */
-            switch (enmFoldersType)
+        fSuccess = getSharedFolder(strFolderName, folders, comFolder);
+
+    /* Make sure such folder doesn't exist: */
+    if (fSuccess && comFolder.isNull())
+    {
+        /* Create new folder: */
+        switch (enmFoldersType)
+        {
+            case MachineType:
             {
-                case MachineType:
-                {
-                    /* Create new folder: */
-                    m_machine.CreateSharedFolder(strFolderName, strFolderPath, fIsWritable, fIsAutoMount);
-                    /* Check that machine is OK: */
-                    fSuccess = m_machine.isOk();
-                    if (!fSuccess)
-                    {
-                        /* Show error message: */
-                        notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
-                    }
-                    break;
-                }
-                case ConsoleType:
-                {
-                    /* Create new folder: */
-                    m_console.CreateSharedFolder(strFolderName, strFolderPath, fIsWritable, fIsAutoMount);
-                    /* Check that console is OK: */
-                    fSuccess = m_console.isOk();
-                    if (!fSuccess)
-                    {
-                        /* Show error message: */
-                        notifyOperationProgressError(UIErrorString::formatErrorInfo(m_console));
-                    }
-                    break;
-                }
-                default:
-                    break;
+                /* Create new folder: */
+                m_machine.CreateSharedFolder(strFolderName, strFolderPath, fIsWritable, fIsAutoMount, strAutoMountPoint);
+                /* Show error if the operation failed: */
+                fSuccess = m_machine.isOk();
+                if (!fSuccess)
+                    notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
+                break;
             }
-        }
-    }
+            case ConsoleType:
+            {
+                /* Create new folder: */
+                m_console.CreateSharedFolder(strFolderName, strFolderPath, fIsWritable, fIsAutoMount, strAutoMountPoint);
+                /* Show error if the operation failed: */
+                fSuccess = m_console.isOk();
+                if (!fSuccess)
+                    notifyOperationProgressError(UIErrorString::formatErrorInfo(m_console));
+                break;
+            }
+            default:
+                break;
+        }
+    }
+
     /* Return result: */
     return fSuccess;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.ui
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.ui	(revision 75379)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.ui	(revision 75380)
@@ -87,10 +87,15 @@
         <column>
          <property name="text">
-          <string>Auto-mount</string>
+          <string>Access</string>
          </property>
         </column>
         <column>
          <property name="text">
-          <string>Access</string>
+          <string>Auto Mount</string>
+         </property>
+        </column>
+        <column>
+         <property name="text">
+          <string>At</string>
          </property>
         </column>
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.cpp	(revision 75379)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.cpp	(revision 75380)
@@ -110,4 +110,14 @@
 }
 
+void UIMachineSettingsSFDetails::setAutoMountPoint(const QString &strAutoMountPoint)
+{
+    mLeAutoMountPoint->setText(strAutoMountPoint);
+}
+
+QString UIMachineSettingsSFDetails::autoMountPoint() const
+{
+    return mLeAutoMountPoint->text();
+}
+
 void UIMachineSettingsSFDetails::setPermanent(bool fPermanent)
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.h	(revision 75379)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.h	(revision 75380)
@@ -16,6 +16,6 @@
  */
 
-#ifndef __UIMachineSettingsSFDetails_h__
-#define __UIMachineSettingsSFDetails_h__
+#ifndef ___UIMachineSettingsSFDetails_h___
+#define ___UIMachineSettingsSFDetails_h___
 
 /* Includes */
@@ -56,4 +56,7 @@
     bool isAutoMounted() const;
 
+    void setAutoMountPoint(const QString &strAutoMountPoint);
+    QString autoMountPoint() const;
+
     void setPermanent(bool fPermanent);
     bool isPermanent() const;
@@ -75,3 +78,3 @@
 };
 
-#endif // __UIMachineSettingsSFDetails_h__
+#endif // !___UIMachineSettingsSFDetails_h___
Index: /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.ui
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.ui	(revision 75379)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.ui	(revision 75380)
@@ -74,5 +74,22 @@
     </widget>
    </item>
+   <item row="4" column="0" >
+    <widget class="QLabel" name="mLbAutoMountPoint" >
+     <property name="text" >
+      <string>Mount point:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+    </widget>
+   </item>
    <item row="4" column="1" >
+    <widget class="QLineEdit" name="mLeAutoMountPoint" >
+     <property name="toolTip" >
+      <string>Where to automatically mount the folder in the guest.  A drive letter (e.g. 'G:') for Windows and OS/2 guests, path for the others.  If left empty the guest will pick something fitting.</string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="1" >
     <widget class="QCheckBox" name="mCbPermanent" >
      <property name="toolTip" >
@@ -84,5 +101,5 @@
     </widget>
    </item>
-   <item row="5" column="1" >
+   <item row="6" column="1" >
     <spacer>
      <property name="orientation" >
@@ -97,5 +114,5 @@
     </spacer>
    </item>
-   <item row="6" column="0" colspan="2" >
+   <item row="7" column="0" colspan="2" >
     <widget class="QIDialogButtonBox" name="mButtonBox" >
      <property name="standardButtons" >
Index: /trunk/src/VBox/HostServices/SharedFolders/mappings.cpp
===================================================================
--- /trunk/src/VBox/HostServices/SharedFolders/mappings.cpp	(revision 75379)
+++ /trunk/src/VBox/HostServices/SharedFolders/mappings.cpp	(revision 75380)
@@ -87,5 +87,5 @@
               pLoadedMapping->pMapName->String.ucs2, pLoadedMapping->pszFolderName));
     return vbsfMappingsAdd(pLoadedMapping->pszFolderName, pLoadedMapping->pMapName,
-                           pLoadedMapping->fWritable, pLoadedMapping->fAutoMount,
+                           pLoadedMapping->fWritable, pLoadedMapping->fAutoMount, pLoadedMapping->pAutoMountPoint,
                            pLoadedMapping->fSymlinksCreate, /* fMissing = */ true, /* fPlaceholder = */ true);
 }
@@ -200,6 +200,6 @@
  * We are always executed from one specific HGCM thread. So thread safe.
  */
-int vbsfMappingsAdd(const char *pszFolderName, PSHFLSTRING pMapName,
-                    bool fWritable, bool fAutoMount, bool fSymlinksCreate, bool fMissing, bool fPlaceholder)
+int vbsfMappingsAdd(const char *pszFolderName, PSHFLSTRING pMapName, bool fWritable,
+                    bool fAutoMount, PSHFLSTRING pAutoMountPoint, bool fSymlinksCreate, bool fMissing, bool fPlaceholder)
 {
     unsigned i;
@@ -232,21 +232,16 @@
             AssertRCReturn(rc, rc);
 
-            FolderMapping[i].pszFolderName = RTStrDup(szAbsFolderName);
-            if (!FolderMapping[i].pszFolderName)
+            FolderMapping[i].pszFolderName   = RTStrDup(szAbsFolderName);
+            FolderMapping[i].pMapName        = ShflStringDup(pMapName);
+            FolderMapping[i].pAutoMountPoint = ShflStringDup(pAutoMountPoint);
+            if (   !FolderMapping[i].pszFolderName
+                || !FolderMapping[i].pMapName
+                || !FolderMapping[i].pAutoMountPoint)
             {
+                RTStrFree(FolderMapping[i].pszFolderName);
+                RTMemFree(FolderMapping[i].pMapName);
+                RTMemFree(FolderMapping[i].pAutoMountPoint);
                 return VERR_NO_MEMORY;
             }
-
-            FolderMapping[i].pMapName = (PSHFLSTRING)RTMemAlloc(ShflStringSizeOfBuffer(pMapName));
-            if (!FolderMapping[i].pMapName)
-            {
-                RTStrFree(FolderMapping[i].pszFolderName);
-                AssertFailed();
-                return VERR_NO_MEMORY;
-            }
-
-            FolderMapping[i].pMapName->u16Length = pMapName->u16Length;
-            FolderMapping[i].pMapName->u16Size   = pMapName->u16Size;
-            memcpy(FolderMapping[i].pMapName->String.ucs2, pMapName->String.ucs2, pMapName->u16Size);
 
             FolderMapping[i].fValid          = true;
Index: /trunk/src/VBox/HostServices/SharedFolders/mappings.h
===================================================================
--- /trunk/src/VBox/HostServices/SharedFolders/mappings.h	(revision 75379)
+++ /trunk/src/VBox/HostServices/SharedFolders/mappings.h	(revision 75380)
@@ -1,4 +1,5 @@
+/* $Id$ */
 /** @file
- * Shared folders: Mappings header.
+ * Shared folders service - Mappings header.
  */
 
@@ -23,17 +24,18 @@
 typedef struct
 {
-    char        *pszFolderName;       /**< directory at the host to share with the guest */
-    PSHFLSTRING pMapName;             /**< share name for the guest */
-    uint32_t    cMappings;            /**< number of mappings */
-    bool        fValid;               /**< mapping entry is used/valid */
-    bool        fHostCaseSensitive;   /**< host file name space is case-sensitive */
-    bool        fGuestCaseSensitive;  /**< guest file name space is case-sensitive */
-    bool        fWritable;            /**< folder is writable for the guest */
-    bool        fAutoMount;           /**< folder will be auto-mounted by the guest */
-    bool        fSymlinksCreate;      /**< guest is able to create symlinks */
-    bool        fMissing;             /**< mapping not invalid but host path does not exist.
-                                           Any guest operation on such a folder fails! */
-    bool        fPlaceholder;         /**< mapping does not exist in the VM settings but the guest
-                                           still has. fMissing is always true for this mapping. */
+    char       *pszFolderName;          /**< Directory at the host to share with the guest. */
+    PSHFLSTRING pMapName;               /**< Share name for the guest. */
+    uint32_t    cMappings;              /**< Number of mappings. */
+    bool        fValid;                 /**< Mapping entry is used/valid. */
+    bool        fHostCaseSensitive;     /**< Host file name space is case-sensitive. */
+    bool        fGuestCaseSensitive;    /**< Guest file name space is case-sensitive. */
+    bool        fWritable;              /**< Folder is writable for the guest. */
+    PSHFLSTRING pAutoMountPoint;        /**< Where the guest should try auto-mount the folder. */
+    bool        fAutoMount;             /**< Folder will be auto-mounted by the guest. */
+    bool        fSymlinksCreate;        /**< Guest is able to create symlinks. */
+    bool        fMissing;               /**< Mapping not invalid but host path does not exist.
+                                             Any guest operation on such a folder fails! */
+    bool        fPlaceholder;           /**< Mapping does not exist in the VM settings but the guest
+                                             still has. fMissing is always true for this mapping. */
 } MAPPING;
 /** Pointer to a MAPPING structure. */
@@ -44,6 +46,6 @@
 bool vbsfMappingQuery(uint32_t iMapping, PMAPPING *pMapping);
 
-int vbsfMappingsAdd(const char *pszFolderName, PSHFLSTRING pMapName,
-                    bool fWritable, bool fAutoMount, bool fCreateSymlinks, bool fMissing, bool fPlaceholder);
+int vbsfMappingsAdd(const char *pszFolderName, PSHFLSTRING pMapName, bool fWritable,
+                    bool fAutoMount, PSHFLSTRING pAutoMountPoint, bool fCreateSymlinks, bool fMissing, bool fPlaceholder);
 int vbsfMappingsRemove(PSHFLSTRING pMapName);
 
Index: /trunk/src/VBox/HostServices/SharedFolders/service.cpp
===================================================================
--- /trunk/src/VBox/HostServices/SharedFolders/service.cpp	(revision 75379)
+++ /trunk/src/VBox/HostServices/SharedFolders/service.cpp	(revision 75380)
@@ -29,6 +29,7 @@
 #include <VBox/vmm/pdmifs.h>
 
-#define SHFL_SSM_VERSION_FOLDERNAME_UTF16   2
-#define SHFL_SSM_VERSION                    3
+#define SHFL_SAVED_STATE_VERSION_FOLDERNAME_UTF16       2
+#define SHFL_SAVED_STATE_VERSION_PRE_AUTO_MOUNT_POINT   3
+#define SHFL_SAVED_STATE_VERSION                        4
 
 
@@ -120,5 +121,5 @@
     Log(("SharedFolders host service: saving state, u32ClientID = %u\n", u32ClientID));
 
-    int rc = SSMR3PutU32(pSSM, SHFL_SSM_VERSION);
+    int rc = SSMR3PutU32(pSSM, SHFL_SAVED_STATE_VERSION);
     AssertRCReturn(rc, rc);
 
@@ -147,24 +148,19 @@
         if (pFolderMapping && pFolderMapping->fValid)
         {
-            uint32_t len;
-
-            len = (uint32_t)strlen(pFolderMapping->pszFolderName);
-            rc = SSMR3PutU32(pSSM, len);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutStrZ(pSSM, pFolderMapping->pszFolderName);
-            AssertRCReturn(rc, rc);
+            uint32_t len = (uint32_t)strlen(pFolderMapping->pszFolderName);
+            SSMR3PutU32(pSSM, len);
+            SSMR3PutStrZ(pSSM, pFolderMapping->pszFolderName);
 
             len = ShflStringSizeOfBuffer(pFolderMapping->pMapName);
-            rc = SSMR3PutU32(pSSM, len);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutMem(pSSM, pFolderMapping->pMapName, len);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutBool(pSSM, pFolderMapping->fHostCaseSensitive);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutBool(pSSM, pFolderMapping->fGuestCaseSensitive);
+            SSMR3PutU32(pSSM, len);
+            SSMR3PutMem(pSSM, pFolderMapping->pMapName, len);
+
+            SSMR3PutBool(pSSM, pFolderMapping->fHostCaseSensitive);
+
+            SSMR3PutBool(pSSM, pFolderMapping->fGuestCaseSensitive);
+
+            len = ShflStringSizeOfBuffer(pFolderMapping->pAutoMountPoint);
+            SSMR3PutU32(pSSM, len);
+            rc = SSMR3PutMem(pSSM, pFolderMapping->pAutoMountPoint, len);
             AssertRCReturn(rc, rc);
         }
@@ -190,6 +186,6 @@
     AssertRCReturn(rc, rc);
 
-    if (   version > SHFL_SSM_VERSION
-        || version < SHFL_SSM_VERSION_FOLDERNAME_UTF16)
+    if (   version > SHFL_SAVED_STATE_VERSION
+        || version < SHFL_SAVED_STATE_VERSION_FOLDERNAME_UTF16)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
 
@@ -214,5 +210,5 @@
         /* Load the saved mapping description and try to find it in the mappings. */
         MAPPING mapping;
-        memset (&mapping, 0, sizeof (mapping));
+        RT_ZERO(mapping);
 
         /* restore the folder mapping counter. */
@@ -225,21 +221,24 @@
         if (mapping.fValid)
         {
-            uint32_t cbFolderName;
+            uint32_t cb;
+
+            /* Load the host path name. */
+            rc = SSMR3GetU32(pSSM, &cb);
+            AssertRCReturn(rc, rc);
+
             char *pszFolderName;
-
-            uint32_t cbMapName;
-            PSHFLSTRING pMapName;
-
-            /* Load the host path name. */
-            rc = SSMR3GetU32(pSSM, &cbFolderName);
-            AssertRCReturn(rc, rc);
-
-            if (version == SHFL_SSM_VERSION_FOLDERNAME_UTF16)
-            {
-                PSHFLSTRING pFolderName = (PSHFLSTRING)RTMemAlloc(cbFolderName);
+            if (version == SHFL_SAVED_STATE_VERSION_FOLDERNAME_UTF16)
+            {
+                AssertReturn(cb > SHFLSTRING_HEADER_SIZE && cb <= UINT16_MAX + SHFLSTRING_HEADER_SIZE && !(cb & 1),
+                             SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, "Bad folder name size: %#x\n", cb));
+                PSHFLSTRING pFolderName = (PSHFLSTRING)RTMemAlloc(cb);
                 AssertReturn(pFolderName != NULL, VERR_NO_MEMORY);
 
-                rc = SSMR3GetMem(pSSM, pFolderName, cbFolderName);
+                rc = SSMR3GetMem(pSSM, pFolderName, cb);
                 AssertRCReturn(rc, rc);
+                AssertReturn(pFolderName->u16Length < cb && pFolderName->u16Size < pFolderName->u16Length,
+                             SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,
+                                               "Bad folder name string: %#x/%#x cb=%#x\n",
+                                               pFolderName->u16Size, pFolderName->u16Length, cb));
 
                 rc = RTUtf16ToUtf8(pFolderName->String.ucs2, &pszFolderName);
@@ -249,8 +248,8 @@
             else
             {
-                pszFolderName = (char*)RTStrAlloc(cbFolderName + 1);
+                pszFolderName = (char *)RTStrAlloc(cb + 1);
                 AssertReturn(pszFolderName, VERR_NO_MEMORY);
 
-                rc = SSMR3GetStrZ(pSSM, pszFolderName, cbFolderName + 1);
+                rc = SSMR3GetStrZ(pSSM, pszFolderName, cb + 1);
                 AssertRCReturn(rc, rc);
                 mapping.pszFolderName = pszFolderName;
@@ -258,13 +257,20 @@
 
             /* Load the map name. */
-            rc = SSMR3GetU32(pSSM, &cbMapName);
+            rc = SSMR3GetU32(pSSM, &cb);
             AssertRCReturn(rc, rc);
-
-            pMapName = (PSHFLSTRING)RTMemAlloc(cbMapName);
+            AssertReturn(cb > SHFLSTRING_HEADER_SIZE && cb <= UINT16_MAX + SHFLSTRING_HEADER_SIZE && !(cb & 1),
+                         SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, "Bad map name size: %#x\n", cb));
+
+            PSHFLSTRING pMapName = (PSHFLSTRING)RTMemAlloc(cb);
             AssertReturn(pMapName != NULL, VERR_NO_MEMORY);
 
-            rc = SSMR3GetMem(pSSM, pMapName, cbMapName);
+            rc = SSMR3GetMem(pSSM, pMapName, cb);
             AssertRCReturn(rc, rc);
-
+            AssertReturn(pMapName->u16Length < cb && pMapName->u16Size < pMapName->u16Length,
+                         SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,
+                                           "Bad map name string: %#x/%#x cb=%#x\n",
+                                           pMapName->u16Size, pMapName->u16Length, cb));
+
+            /* Load case sensitivity config. */
             rc = SSMR3GetBool(pSSM, &mapping.fHostCaseSensitive);
             AssertRCReturn(rc, rc);
@@ -273,6 +279,33 @@
             AssertRCReturn(rc, rc);
 
+            /* Load the auto mount point. */
+            PSHFLSTRING pAutoMountPoint;
+            if (version > SHFL_SAVED_STATE_VERSION_PRE_AUTO_MOUNT_POINT)
+            {
+                rc = SSMR3GetU32(pSSM, &cb);
+                AssertRCReturn(rc, rc);
+                AssertReturn(cb > SHFLSTRING_HEADER_SIZE && cb <= UINT16_MAX + SHFLSTRING_HEADER_SIZE && !(cb & 1),
+                             SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, "Bad auto mount point size: %#x\n", cb));
+
+                pAutoMountPoint = (PSHFLSTRING)RTMemAlloc(cb);
+                AssertReturn(pAutoMountPoint != NULL, VERR_NO_MEMORY);
+
+                rc = SSMR3GetMem(pSSM, pAutoMountPoint, cb);
+                AssertRCReturn(rc, rc);
+                AssertReturn(pAutoMountPoint->u16Length < cb && pAutoMountPoint->u16Size < pAutoMountPoint->u16Length,
+                             SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,
+                                               "Bad auto mount point string: %#x/%#x cb=%#x\n",
+                                               pAutoMountPoint->u16Size, pAutoMountPoint->u16Length, cb));
+
+            }
+            else
+            {
+                pAutoMountPoint = ShflStringDupUtf8("");
+                AssertReturn(pAutoMountPoint, VERR_NO_MEMORY);
+            }
+
             mapping.pszFolderName = pszFolderName;
             mapping.pMapName = pMapName;
+            mapping.pAutoMountPoint = pAutoMountPoint;
 
             /* 'i' is the root handle of the saved mapping. */
@@ -284,4 +317,5 @@
             }
 
+            RTMemFree(pAutoMountPoint);
             RTMemFree(pMapName);
             RTStrFree(pszFolderName);
@@ -1315,7 +1349,8 @@
             rc = VERR_INVALID_PARAMETER;
         }
-        else if (   paParms[0].type != VBOX_HGCM_SVC_PARM_PTR     /* host folder name */
-                 || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR     /* guest map name */
+        else if (   paParms[0].type != VBOX_HGCM_SVC_PARM_PTR     /* host folder path */
+                 || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR     /* map name */
                  || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT   /* fFlags */
+                 || paParms[3].type != VBOX_HGCM_SVC_PARM_PTR     /* auto mount point */
                 )
         {
@@ -1325,11 +1360,13 @@
         {
             /* Fetch parameters. */
-            SHFLSTRING *pFolderName = (SHFLSTRING *)paParms[0].u.pointer.addr;
-            SHFLSTRING *pMapName    = (SHFLSTRING *)paParms[1].u.pointer.addr;
-            uint32_t fFlags         = paParms[2].u.uint32;
+            SHFLSTRING *pHostPath       = (SHFLSTRING *)paParms[0].u.pointer.addr;
+            SHFLSTRING *pMapName        = (SHFLSTRING *)paParms[1].u.pointer.addr;
+            uint32_t fFlags             = paParms[2].u.uint32;
+            SHFLSTRING *pAutoMountPoint = (SHFLSTRING *)paParms[3].u.pointer.addr;
 
             /* Verify parameters values. */
-            if (    !ShflStringIsValidIn(pFolderName, paParms[0].u.pointer.size, false /*fUtf8Not16*/)
+            if (    !ShflStringIsValidIn(pHostPath, paParms[0].u.pointer.size, false /*fUtf8Not16*/)
                 ||  !ShflStringIsValidIn(pMapName, paParms[1].u.pointer.size, false /*fUtf8Not16*/)
+                ||  !ShflStringIsValidIn(pAutoMountPoint, paParms[3].u.pointer.size, false /*fUtf8Not16*/)
                )
             {
@@ -1338,21 +1375,21 @@
             else
             {
-                LogRel(("    Host path '%ls', map name '%ls', %s, automount=%s, create_symlinks=%s, missing=%s\n",
-                        ((SHFLSTRING *)paParms[0].u.pointer.addr)->String.ucs2,
-                        ((SHFLSTRING *)paParms[1].u.pointer.addr)->String.ucs2,
+                LogRel(("    Host path '%ls', map name '%ls', %s, automount=%s, automntpnt=%s, create_symlinks=%s, missing=%s\n",
+                        pHostPath->String.utf16, pMapName->String.utf16,
                         RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_WRITABLE) ? "writable" : "read-only",
                         RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_AUTOMOUNT) ? "true" : "false",
+                        pAutoMountPoint->String.utf16,
                         RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_CREATE_SYMLINKS) ? "true" : "false",
                         RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_MISSING) ? "true" : "false"));
 
-                char *pszFolderName;
-                rc = RTUtf16ToUtf8(pFolderName->String.ucs2, &pszFolderName);
-
+                char *pszHostPath;
+                rc = RTUtf16ToUtf8(pHostPath->String.ucs2, &pszHostPath);
                 if (RT_SUCCESS(rc))
                 {
                     /* Execute the function. */
-                    rc = vbsfMappingsAdd(pszFolderName, pMapName,
+                    rc = vbsfMappingsAdd(pszHostPath, pMapName,
                                          RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_WRITABLE),
                                          RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_AUTOMOUNT),
+                                         pAutoMountPoint,
                                          RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_CREATE_SYMLINKS),
                                          RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_MISSING),
@@ -1363,5 +1400,5 @@
                         ; /* none */
                     }
-                    RTStrFree(pszFolderName);
+                    RTStrFree(pszHostPath);
                 }
             }
Index: /trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp
===================================================================
--- /trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp	(revision 75379)
+++ /trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp	(revision 75380)
@@ -617,4 +617,5 @@
     union TESTSHFLSTRING FolderName;
     union TESTSHFLSTRING Mapping;
+    union TESTSHFLSTRING AutoMountPoint;
     VBOXHGCMCALLHANDLE_TYPEDEF callHandle = { VINF_SUCCESS };
     int rc;
@@ -627,4 +628,5 @@
     fillTestShflString(&FolderName, pcszFolderName);
     fillTestShflString(&Mapping, pcszMapping);
+    fillTestShflString(&AutoMountPoint, "");
     aParms[0].setPointer(&FolderName,   RT_UOFFSETOF(SHFLSTRING, String)
                                       + FolderName.string.u16Size);
@@ -632,4 +634,5 @@
                                    + Mapping.string.u16Size);
     aParms[2].setUInt32(1);
+    aParms[3].setPointer(&AutoMountPoint, SHFLSTRING_HEADER_SIZE + AutoMountPoint.string.u16Size);
     rc = psvcTable->pfnHostCall(psvcTable->pvService, SHFL_FN_ADD_MAPPING,
                                 SHFL_CPARMS_ADD_MAPPING, aParms);
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 75379)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 75380)
@@ -1960,5 +1960,5 @@
   <interface
     name="IVirtualBox" extends="$unknown"
-    uuid="176b85cd-4bc2-453e-9228-f408c5282267"
+    uuid="606da9e2-032b-4c82-3bf0-3675789df7b9"
     wsmap="managed"
     reservedMethods="7" reservedAttributes="12"
@@ -2692,4 +2692,10 @@
         <desc>Whether the share gets automatically mounted by the guest
           or not.</desc>
+      </param>
+      <param name="autoMountPoint" type="wstring" dir="in">
+        <desc>Where the guest should automatically mount the folder, if possible.
+          For Windows and OS/2 guests this should be a drive letter, while other
+          guests it should be a absolute directory.
+        </desc>
       </param>
     </method>
@@ -5221,5 +5227,5 @@
   <interface
     name="IMachine" extends="$unknown"
-    uuid="BD65ADC6-7F47-4F69-B881-96EA06CF9924"
+    uuid="cfc5671a-2309-4893-8744-ba4c07d65d86"
     wsmap="managed"
     wrap-hint-server-addinterfaces="IInternalMachineControl"
@@ -7805,4 +7811,10 @@
           or not.</desc>
       </param>
+      <param name="autoMountPoint" type="wstring" dir="in">
+        <desc>Where the guest should automatically mount the folder, if possible.
+          For Windows and OS/2 guests this should be a drive letter, while other
+          guests it should be a absolute directory.
+        </desc>
+      </param>
     </method>
 
@@ -9317,4 +9329,10 @@
         <desc>Whether the share gets automatically mounted by the guest
           or not.</desc>
+      </param>
+      <param name="autoMountPoint" type="wstring" dir="in">
+        <desc>Where the guest should automatically mount the folder, if possible.
+          For Windows and OS/2 guests this should be a drive letter, while other
+          guests it should be a absolute directory.
+        </desc>
       </param>
     </method>
@@ -20520,5 +20538,5 @@
   <interface
     name="ISharedFolder" extends="$unknown"
-    uuid="15aabe95-e594-4e18-9222-b5e83a23f1da"
+    uuid="e02c0f1e-15f4-440e-3814-bbf613f8448b"
     wsmap="struct"
     reservedAttributes="4"
@@ -20602,4 +20620,16 @@
       <desc>
         Whether the folder gets automatically mounted by the guest or not.
+      </desc>
+    </attribute>
+
+    <attribute name="autoMountPoint" type="wstring" readonly="yes">
+      <desc>
+        Desired mount point in the guest for automatically mounting the folder
+        when <link to="ISharedFolder::autoMount"/> is set.  For Windows and
+        OS/2 guests this should be a drive letter, while other guests it should
+        be a absolute directory.
+
+        When empty the guest will choose a mount point.  The guest may do so
+        too should the specified mount point be in use or otherwise unusable.
       </desc>
     </attribute>
Index: /trunk/src/VBox/Main/include/ConsoleImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 75379)
+++ /trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 75380)
@@ -342,5 +342,6 @@
                                const com::Utf8Str &aHostPath,
                                BOOL aWritable,
-                               BOOL aAutomount);
+                               BOOL aAutomount,
+                               const com::Utf8Str &aAutoMountPoint);
     HRESULT removeSharedFolder(const com::Utf8Str &aName);
     HRESULT teleport(const com::Utf8Str &aHostname,
@@ -549,15 +550,18 @@
         SharedFolderData(const Utf8Str &aHostPath,
                          bool aWritable,
-                         bool aAutoMount)
-           : m_strHostPath(aHostPath),
-             m_fWritable(aWritable),
-             m_fAutoMount(aAutoMount)
+                         bool aAutoMount,
+                         const Utf8Str &aAutoMountPoint)
+            : m_strHostPath(aHostPath)
+            , m_fWritable(aWritable)
+            , m_fAutoMount(aAutoMount)
+            , m_strAutoMountPoint(aAutoMountPoint)
         { }
 
         // copy constructor
         SharedFolderData(const SharedFolderData& aThat)
-           : m_strHostPath(aThat.m_strHostPath),
-             m_fWritable(aThat.m_fWritable),
-             m_fAutoMount(aThat.m_fAutoMount)
+            : m_strHostPath(aThat.m_strHostPath)
+            , m_fWritable(aThat.m_fWritable)
+            , m_fAutoMount(aThat.m_fAutoMount)
+            , m_strAutoMountPoint(aThat.m_strAutoMountPoint)
         { }
 
@@ -565,4 +569,5 @@
         bool m_fWritable;
         bool m_fAutoMount;
+        Utf8Str m_strAutoMountPoint;
     };
 
@@ -820,5 +825,4 @@
 
     static const char *sSSMConsoleUnit;
-    static uint32_t sSSMConsoleVer;
 
     HRESULT i_loadDataFromSavedState();
Index: /trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MachineImpl.h	(revision 75379)
+++ /trunk/src/VBox/Main/include/MachineImpl.h	(revision 75380)
@@ -1115,5 +1115,6 @@
                                const com::Utf8Str &aHostPath,
                                BOOL aWritable,
-                               BOOL aAutomount);
+                               BOOL aAutomount,
+                               const com::Utf8Str &aAutoMountPoint);
     HRESULT removeSharedFolder(const com::Utf8Str &aName);
     HRESULT canShowConsoleWindow(BOOL *aCanShow);
Index: /trunk/src/VBox/Main/include/SharedFolderImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/SharedFolderImpl.h	(revision 75379)
+++ /trunk/src/VBox/Main/include/SharedFolderImpl.h	(revision 75380)
@@ -1,5 +1,4 @@
 /* $Id$ */
 /** @file
- *
  * VirtualBox COM class implementation
  */
@@ -36,8 +35,11 @@
 
     // public initializer/uninitializer for internal purposes only
-    HRESULT init(Machine *aMachine, const com::Utf8Str &aName, const com::Utf8Str &aHostPath, bool aWritable, bool aAutoMount, bool fFailOnError);
+    HRESULT init(Machine *aMachine, const com::Utf8Str &aName, const com::Utf8Str &aHostPath,
+                 bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError);
     HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
-    HRESULT init(Console *aConsole, const com::Utf8Str &aName, const com::Utf8Str &aHostPath, bool aWritable, bool aAutoMount, bool fFailOnError);
-//     HRESULT init(VirtualBox *aVirtualBox, const Utf8Str &aName, const Utf8Str &aHostPath, bool aWritable, bool aAutoMount, bool fFailOnError);
+    HRESULT init(Console *aConsole, const com::Utf8Str &aName, const com::Utf8Str &aHostPath,
+                 bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError);
+//     HRESULT init(VirtualBox *aVirtualBox, const Utf8Str &aName, const Utf8Str &aHostPath,
+//                  bool aWritable, const com::Utf8Str &aAutoMountPoint, bool aAutoMount, bool fFailOnError);
     void uninit();
 
@@ -49,5 +51,5 @@
      * @return
      */
-    const Utf8Str& i_getName() const;
+    const Utf8Str &i_getName() const;
 
     /**
@@ -55,5 +57,5 @@
      * @return
      */
-    const Utf8Str& i_getHostPath() const;
+    const Utf8Str &i_getHostPath() const;
 
     /**
@@ -69,4 +71,9 @@
     bool i_isAutoMounted() const;
 
+    /**
+     * Public internal method for getting the auto mount point.
+     */
+    const Utf8Str &i_getAutoMountPoint() const;
+
 protected:
 
@@ -76,4 +83,5 @@
                             bool aWritable,
                             bool aAutoMount,
+                            const com::Utf8Str &aAutoMountPoint,
                             bool fFailOnError);
 private:
@@ -85,4 +93,5 @@
     HRESULT getWritable(BOOL *aWritable);
     HRESULT getAutoMount(BOOL *aAutoMount);
+    HRESULT getAutoMountPoint(com::Utf8Str &aAutoMountPoint);
     HRESULT getLastAccessError(com::Utf8Str &aLastAccessError);
 
@@ -101,4 +110,4 @@
 };
 
-#endif // ____H_SHAREDFOLDERIMPL
+#endif // !____H_SHAREDFOLDERIMPL
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
Index: /trunk/src/VBox/Main/include/VirtualBoxImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 75379)
+++ /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 75380)
@@ -329,5 +329,6 @@
                                const com::Utf8Str &aHostPath,
                                BOOL aWritable,
-                               BOOL aAutomount);
+                               BOOL aAutomount,
+                               const com::Utf8Str &aAutoMountPoint);
     HRESULT removeSharedFolder(const com::Utf8Str &aName);
     HRESULT getExtraDataKeys(std::vector<com::Utf8Str> &aKeys);
Index: /trunk/src/VBox/Main/src-all/SharedFolderImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-all/SharedFolderImpl.cpp	(revision 75379)
+++ /trunk/src/VBox/Main/src-all/SharedFolderImpl.cpp	(revision 75380)
@@ -46,4 +46,5 @@
     bool            fWritable;
     bool            fAutoMount;
+    const Utf8Str   strAutoMountPoint;
     Utf8Str         strLastAccessError;
 };
@@ -95,4 +96,5 @@
  *  @param aWritable    writable if true, readonly otherwise
  *  @param aAutoMount   if auto mounted by guest true, false otherwise
+ *  @param aAutoMountPoint Where the guest should try auto mount it.
  *  @param fFailOnError Whether to fail with an error if the shared folder path is bad.
  *
@@ -104,4 +106,5 @@
                            bool aWritable,
                            bool aAutoMount,
+                           const Utf8Str &aAutoMountPoint,
                            bool fFailOnError)
 {
@@ -112,5 +115,5 @@
     unconst(mMachine) = aMachine;
 
-    HRESULT rc = i_protectedInit(aMachine, aName, aHostPath, aWritable, aAutoMount, fFailOnError);
+    HRESULT rc = i_protectedInit(aMachine, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError);
 
     /* Confirm a successful initialization when it's the case */
@@ -146,4 +149,5 @@
                                  aThat->m->fWritable,
                                  aThat->m->fAutoMount,
+                                 aThat->m->strAutoMountPoint,
                                  false /* fFailOnError */ );
 
@@ -166,4 +170,5 @@
  *  @param aHostPath    full path to the shared folder on the host
  *  @param aWritable    writable if true, readonly otherwise
+ *  @param aAutoMountPoint Where the guest should try auto mount it.
  *  @param fFailOnError Whether to fail with an error if the shared folder path is bad.
  *
@@ -175,4 +180,5 @@
                            bool aWritable,
                            bool aAutoMount,
+                           const Utf8Str &aAutoMountPoint
                            bool fFailOnError)
 {
@@ -183,5 +189,5 @@
     unconst(mVirtualBox) = aVirtualBox;
 
-    HRESULT rc = protectedInit(aVirtualBox, aName, aHostPath, aWritable, aAutoMount);
+    HRESULT rc = protectedInit(aVirtualBox, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError);
 
     /* Confirm a successful initialization when it's the case */
@@ -205,4 +211,5 @@
  *  @param aHostPath    full path to the shared folder on the host
  *  @param aWritable    writable if true, readonly otherwise
+ *  @param aAutoMountPoint Where the guest should try auto mount it.
  *  @param fFailOnError Whether to fail with an error if the shared folder path is bad.
  *
@@ -214,4 +221,5 @@
                            bool aWritable,
                            bool aAutoMount,
+                           const Utf8Str &aAutoMountPoint,
                            bool fFailOnError)
 {
@@ -222,5 +230,5 @@
     unconst(mConsole) = aConsole;
 
-    HRESULT rc = i_protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, fFailOnError);
+    HRESULT rc = i_protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError);
 
     /* Confirm a successful initialization when it's the case */
@@ -243,4 +251,5 @@
                                       bool aWritable,
                                       bool aAutoMount,
+                                      const Utf8Str &aAutoMountPoint,
                                       bool fFailOnError)
 {
@@ -260,7 +269,7 @@
      * accept both the slashified paths and not. */
 #if defined (RT_OS_OS2) || defined (RT_OS_WINDOWS)
-    if (hostPathLen > 2 &&
-        RTPATH_IS_SEP (hostPath.c_str()[hostPathLen - 1]) &&
-        RTPATH_IS_VOLSEP (hostPath.c_str()[hostPathLen - 2]))
+    if (   hostPathLen > 2
+        && RTPATH_IS_SEP(hostPath.c_str()[hostPathLen - 1])
+        && RTPATH_IS_VOLSEP(hostPath.c_str()[hostPathLen - 2]))
         ;
 #else
@@ -292,4 +301,5 @@
     m->fWritable = aWritable;
     m->fAutoMount = aAutoMount;
+    unconst(m->strAutoMountPoint) = aAutoMountPoint;
 
     return S_OK;
@@ -385,4 +395,12 @@
 }
 
+HRESULT SharedFolder::getAutoMountPoint(com::Utf8Str &aAutoMountPoint)
+{
+    /* strAutoMountPoint is constant during life time, no need to lock. */
+    aAutoMountPoint = m->strAutoMountPoint;
+    return S_OK;
+}
+
+
 HRESULT SharedFolder::getLastAccessError(com::Utf8Str &aLastAccessError)
 {
@@ -415,3 +433,8 @@
 }
 
+const Utf8Str &SharedFolder::i_getAutoMountPoint() const
+{
+    return m->strAutoMountPoint;
+}
+
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
Index: /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 75379)
+++ /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 75380)
@@ -1516,6 +1516,8 @@
 //static
 const char *Console::sSSMConsoleUnit = "ConsoleData";
-//static
-uint32_t Console::sSSMConsoleVer = 0x00010001;
+/** The saved state version.  */
+#define CONSOLE_SAVED_STATE_VERSION                         UINT32_C(0x00010002)
+/** The saved state version, pre shared folder autoMountPoint.  */
+#define CONSOLE_SAVED_STATE_VERSION_PRE_AUTO_MOUNT_POINT    UINT32_C(0x00010001)
 
 inline static const char *networkAdapterTypeToName(NetworkAdapterType_T adapterType)
@@ -1569,5 +1571,5 @@
         uint32_t version = 0;
         vrc = SSMR3Seek(ssm, sSSMConsoleUnit, 0 /* iInstance */, &version);
-        if (SSM_VERSION_MAJOR(version) == SSM_VERSION_MAJOR(sSSMConsoleVer))
+        if (SSM_VERSION_MAJOR(version) == SSM_VERSION_MAJOR(CONSOLE_SAVED_STATE_VERSION))
         {
             if (RT_SUCCESS(vrc))
@@ -1614,6 +1616,5 @@
     AutoReadLock alock(that COMMA_LOCKVAL_SRC_POS);
 
-    int vrc = SSMR3PutU32(pSSM, (uint32_t)that->m_mapSharedFolders.size());
-    AssertRC(vrc);
+    SSMR3PutU32(pSSM, (uint32_t)that->m_mapSharedFolders.size());
 
     for (SharedFolderMap::const_iterator it = that->m_mapSharedFolders.begin();
@@ -1625,24 +1626,19 @@
         AutoReadLock sfLock(pSF COMMA_LOCKVAL_SRC_POS);
 
-        Utf8Str name = pSF->i_getName();
-        vrc = SSMR3PutU32(pSSM, (uint32_t)name.length() + 1 /* term. 0 */);
-        AssertRC(vrc);
-        vrc = SSMR3PutStrZ(pSSM, name.c_str());
-        AssertRC(vrc);
-
-        Utf8Str hostPath = pSF->i_getHostPath();
-        vrc = SSMR3PutU32(pSSM, (uint32_t)hostPath.length() + 1 /* term. 0 */);
-        AssertRC(vrc);
-        vrc = SSMR3PutStrZ(pSSM, hostPath.c_str());
-        AssertRC(vrc);
-
-        vrc = SSMR3PutBool(pSSM, !!pSF->i_isWritable());
-        AssertRC(vrc);
-
-        vrc = SSMR3PutBool(pSSM, !!pSF->i_isAutoMounted());
-        AssertRC(vrc);
-    }
-
-    return;
+        const Utf8Str &name = pSF->i_getName();
+        SSMR3PutU32(pSSM, (uint32_t)name.length() + 1 /* term. 0 */);
+        SSMR3PutStrZ(pSSM, name.c_str());
+
+        const Utf8Str &hostPath = pSF->i_getHostPath();
+        SSMR3PutU32(pSSM, (uint32_t)hostPath.length() + 1 /* term. 0 */);
+        SSMR3PutStrZ(pSSM, hostPath.c_str());
+
+        SSMR3PutBool(pSSM, !!pSF->i_isWritable());
+        SSMR3PutBool(pSSM, !!pSF->i_isAutoMounted());
+
+        const Utf8Str &rStrAutoMountPoint = pSF->i_getAutoMountPoint();
+        SSMR3PutU32(pSSM, (uint32_t)rStrAutoMountPoint.length() + 1 /* term. 0 */);
+        SSMR3PutStrZ(pSSM, rStrAutoMountPoint.c_str());
+    }
 }
 
@@ -1665,5 +1661,5 @@
     LogFlowFunc(("\n"));
 
-    if (SSM_VERSION_MAJOR_CHANGED(uVersion, sSSMConsoleVer))
+    if (SSM_VERSION_MAJOR_CHANGED(uVersion, CONSOLE_SAVED_STATE_VERSION))
         return VERR_VERSION_MISMATCH;
     Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
@@ -1706,28 +1702,44 @@
         bool autoMount = false;
 
-        uint32_t szBuf = 0;
+        uint32_t cbStr = 0;
         char *buf = NULL;
 
-        vrc = SSMR3GetU32(pSSM, &szBuf);
+        vrc = SSMR3GetU32(pSSM, &cbStr);
         AssertRCReturn(vrc, vrc);
-        buf = new char[szBuf];
-        vrc = SSMR3GetStrZ(pSSM, buf, szBuf);
+        buf = new char[cbStr];
+        vrc = SSMR3GetStrZ(pSSM, buf, cbStr);
         AssertRC(vrc);
         strName = buf;
         delete[] buf;
 
-        vrc = SSMR3GetU32(pSSM, &szBuf);
+        vrc = SSMR3GetU32(pSSM, &cbStr);
         AssertRCReturn(vrc, vrc);
-        buf = new char[szBuf];
-        vrc = SSMR3GetStrZ(pSSM, buf, szBuf);
+        buf = new char[cbStr];
+        vrc = SSMR3GetStrZ(pSSM, buf, cbStr);
         AssertRC(vrc);
         strHostPath = buf;
         delete[] buf;
 
-        if (u32Version > 0x00010000)
+        if (u32Version >= CONSOLE_SAVED_STATE_VERSION_PRE_AUTO_MOUNT_POINT)
             SSMR3GetBool(pSSM, &writable);
 
-        if (u32Version > 0x00010000) // ???
+        if (   u32Version >= CONSOLE_SAVED_STATE_VERSION_PRE_AUTO_MOUNT_POINT
+#ifndef VBOX_OSE /* This broke saved state when introduced in r63916 (4.0). */
+            && SSMR3HandleRevision(pSSM) >= 63916
+#endif
+           )
             SSMR3GetBool(pSSM, &autoMount);
+
+        Utf8Str strAutoMountPoint;
+        if (u32Version >= CONSOLE_SAVED_STATE_VERSION)
+        {
+            vrc = SSMR3GetU32(pSSM, &cbStr);
+            AssertRCReturn(vrc, vrc);
+            vrc = strAutoMountPoint.reserveNoThrow(cbStr);
+            AssertRCReturn(vrc, vrc);
+            vrc = SSMR3GetStrZ(pSSM, strAutoMountPoint.mutableRaw(), cbStr);
+            AssertRCReturn(vrc, vrc);
+            strAutoMountPoint.jolt();
+        }
 
         ComObjPtr<SharedFolder> pSharedFolder;
@@ -1738,4 +1750,5 @@
                                          writable,
                                          autoMount,
+                                         strAutoMountPoint,
                                          false /* fFailOnError */);
         AssertComRCReturn(rc, VERR_INTERNAL_ERROR);
@@ -2941,5 +2954,6 @@
 }
 
-HRESULT Console::createSharedFolder(const com::Utf8Str &aName, const com::Utf8Str &aHostPath, BOOL aWritable, BOOL aAutomount)
+HRESULT Console::createSharedFolder(const com::Utf8Str &aName, const com::Utf8Str &aHostPath, BOOL aWritable,
+                                    BOOL aAutomount, const com::Utf8Str &aAutoMountPoint)
 {
     LogFlowThisFunc(("Entering for '%s' -> '%s'\n", aName.c_str(), aHostPath.c_str()));
@@ -2974,4 +2988,5 @@
                              !!aWritable,
                              !!aAutomount,
+                             aAutoMountPoint,
                              true /* fFailOnError */);
     if (FAILED(rc)) return rc;
@@ -2995,5 +3010,5 @@
 
         /* second, create the given folder */
-        rc = i_createSharedFolder(aName, SharedFolderData(aHostPath, !!aWritable, !!aAutomount));
+        rc = i_createSharedFolder(aName, SharedFolderData(aHostPath, !!aWritable, !!aAutomount, aAutoMountPoint));
         if (FAILED(rc))
             return rc;
@@ -7683,5 +7698,6 @@
                 sharedFolders[it->first] = SharedFolderData(pSF->i_getHostPath(),
                                                             pSF->i_isWritable(),
-                                                            pSF->i_isAutoMounted());
+                                                            pSF->i_isAutoMounted(),
+                                                            pSF->i_getAutoMountPoint());
             }
         }
@@ -8441,25 +8457,28 @@
                 ComPtr<ISharedFolder> pSharedFolder = folders[i];
 
-                Bstr bstrName;
-                Bstr bstrHostPath;
+                Bstr bstr;
+                rc = pSharedFolder->COMGETTER(Name)(bstr.asOutParam());
+                if (FAILED(rc)) throw rc;
+                Utf8Str strName(bstr);
+
+                rc = pSharedFolder->COMGETTER(HostPath)(bstr.asOutParam());
+                if (FAILED(rc)) throw rc;
+                Utf8Str strHostPath(bstr);
+
                 BOOL writable;
-                BOOL autoMount;
-
-                rc = pSharedFolder->COMGETTER(Name)(bstrName.asOutParam());
-                if (FAILED(rc)) throw rc;
-                Utf8Str strName(bstrName);
-
-                rc = pSharedFolder->COMGETTER(HostPath)(bstrHostPath.asOutParam());
-                if (FAILED(rc)) throw rc;
-                Utf8Str strHostPath(bstrHostPath);
-
                 rc = pSharedFolder->COMGETTER(Writable)(&writable);
                 if (FAILED(rc)) throw rc;
 
+                BOOL autoMount;
                 rc = pSharedFolder->COMGETTER(AutoMount)(&autoMount);
                 if (FAILED(rc)) throw rc;
 
+                rc = pSharedFolder->COMGETTER(AutoMountPoint)(bstr.asOutParam());
+                if (FAILED(rc)) throw rc;
+                Utf8Str strAutoMountPoint(bstr);
+
                 m_mapMachineSharedFolders.insert(std::make_pair(strName,
-                                                                SharedFolderData(strHostPath, !!writable, !!autoMount)));
+                                                                SharedFolderData(strHostPath, !!writable,
+                                                                                 !!autoMount, strAutoMountPoint)));
 
                 /* send changes to HGCM if the VM is running */
@@ -8488,5 +8507,5 @@
                             /* create the new machine folder */
                             rc = i_createSharedFolder(strName,
-                                                      SharedFolderData(strHostPath, !!writable, !!autoMount));
+                                                      SharedFolderData(strHostPath, !!writable, !!autoMount, strAutoMountPoint));
                             if (FAILED(rc)) throw rc;
                         }
@@ -8577,101 +8596,84 @@
 HRESULT Console::i_createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData)
 {
+    Log(("Adding shared folder '%s' -> '%s'\n", strName.c_str(), aData.m_strHostPath.c_str()));
+
+    /*
+     * Sanity checks
+     */
     ComAssertRet(strName.isNotEmpty(), E_FAIL);
     ComAssertRet(aData.m_strHostPath.isNotEmpty(), E_FAIL);
 
-    /* sanity checks */
     AssertReturn(mpUVM, E_FAIL);
     AssertReturn(m_pVMMDev && m_pVMMDev->isShFlActive(), E_FAIL);
 
-    VBOXHGCMSVCPARM parms[SHFL_CPARMS_ADD_MAPPING];
-    SHFLSTRING *pFolderName, *pMapName;
-    size_t cbString;
-
-    Bstr value;
-    HRESULT hrc = mMachine->GetExtraData(BstrFmt("VBoxInternal2/SharedFoldersEnableSymlinksCreate/%s",
-                                                 strName.c_str()).raw(),
-                                         value.asOutParam());
-    bool fSymlinksCreate = hrc == S_OK && value == "1";
-
-    Log(("Adding shared folder '%s' -> '%s'\n", strName.c_str(), aData.m_strHostPath.c_str()));
-
-    // check whether the path is valid and exists
-    char hostPathFull[RTPATH_MAX];
-    int vrc = RTPathAbsEx(NULL,
-                          aData.m_strHostPath.c_str(),
-                          hostPathFull,
-                          sizeof(hostPathFull));
-
-    bool fMissing = false;
+    /*
+     * Find out whether we should allow symbolic link creation.
+     */
+    Bstr bstrValue;
+    HRESULT hrc = mMachine->GetExtraData(BstrFmt("VBoxInternal2/SharedFoldersEnableSymlinksCreate/%s", strName.c_str()).raw(),
+                                         bstrValue.asOutParam());
+    bool fSymlinksCreate = hrc == S_OK && bstrValue == "1";
+
+    /*
+     * Check whether the path is valid and exists.
+     */
+    char szAbsHostPath[RTPATH_MAX];
+    int vrc = RTPathAbsEx(NULL, aData.m_strHostPath.c_str(), szAbsHostPath, sizeof(szAbsHostPath));
     if (RT_FAILURE(vrc))
         return setErrorBoth(E_INVALIDARG, vrc, tr("Invalid shared folder path: '%s' (%Rrc)"), aData.m_strHostPath.c_str(), vrc);
-    if (!RTPathExists(hostPathFull))
-        fMissing = true;
-
-    /* Check whether the path is full (absolute) */
-    if (RTPathCompare(aData.m_strHostPath.c_str(), hostPathFull) != 0)
+
+    /* Check whether the path is full (absolute).  ASSUMING a RTPATH_MAX of ~4K
+       this also checks that the length is within bounds of a SHFLSTRING.  */
+    if (RTPathCompare(aData.m_strHostPath.c_str(), szAbsHostPath) != 0)
         return setError(E_INVALIDARG,
                         tr("Shared folder path '%s' is not absolute"),
                         aData.m_strHostPath.c_str());
 
-    // now that we know the path is good, give it to HGCM
-
-    Bstr bstrName(strName);
-    Bstr bstrHostPath(aData.m_strHostPath);
-
-    cbString = (bstrHostPath.length() + 1) * sizeof(RTUTF16);
-    if (cbString >= UINT16_MAX)
-        return setError(E_INVALIDARG, tr("The name is too long"));
-    pFolderName = (SHFLSTRING*)RTMemAllocZ(SHFLSTRING_HEADER_SIZE + cbString);
-    Assert(pFolderName);
-    memcpy(pFolderName->String.ucs2, bstrHostPath.raw(), cbString);
-
-    pFolderName->u16Size   = (uint16_t)cbString;
-    pFolderName->u16Length = (uint16_t)(cbString - sizeof(RTUTF16));
-
-    parms[0].type = VBOX_HGCM_SVC_PARM_PTR;
-    parms[0].u.pointer.addr = pFolderName;
-    parms[0].u.pointer.size = ShflStringSizeOfBuffer(pFolderName);
-
-    cbString = (bstrName.length() + 1) * sizeof(RTUTF16);
-    if (cbString >= UINT16_MAX)
-    {
-        RTMemFree(pFolderName);
-        return setError(E_INVALIDARG, tr("The host path is too long"));
-    }
-    pMapName = (SHFLSTRING*)RTMemAllocZ(SHFLSTRING_HEADER_SIZE + cbString);
-    Assert(pMapName);
-    memcpy(pMapName->String.ucs2, bstrName.raw(), cbString);
-
-    pMapName->u16Size   = (uint16_t)cbString;
-    pMapName->u16Length = (uint16_t)(cbString - sizeof(RTUTF16));
-
-    parms[1].type = VBOX_HGCM_SVC_PARM_PTR;
-    parms[1].u.pointer.addr = pMapName;
-    parms[1].u.pointer.size = ShflStringSizeOfBuffer(pMapName);
-
-    parms[2].type = VBOX_HGCM_SVC_PARM_32BIT;
-    parms[2].u.uint32 = (aData.m_fWritable ? SHFL_ADD_MAPPING_F_WRITABLE : 0)
-                      | (aData.m_fAutoMount ? SHFL_ADD_MAPPING_F_AUTOMOUNT : 0)
-                      | (fSymlinksCreate ? SHFL_ADD_MAPPING_F_CREATE_SYMLINKS : 0)
-                      | (fMissing ? SHFL_ADD_MAPPING_F_MISSING : 0)
-                      ;
-
-    vrc = m_pVMMDev->hgcmHostCall("VBoxSharedFolders",
-                                  SHFL_FN_ADD_MAPPING,
-                                  SHFL_CPARMS_ADD_MAPPING, &parms[0]);
-    RTMemFree(pFolderName);
-    RTMemFree(pMapName);
-
-    if (RT_FAILURE(vrc))
-        return setErrorBoth(E_FAIL, vrc, tr("Could not create a shared folder '%s' mapped to '%s' (%Rrc)"),
-                            strName.c_str(), aData.m_strHostPath.c_str(), vrc);
-
-    if (fMissing)
-        return setError(E_INVALIDARG,
-                        tr("Shared folder path '%s' does not exist on the host"),
-                        aData.m_strHostPath.c_str());
-
-    return S_OK;
+    bool const fMissing = !RTPathExists(szAbsHostPath);
+
+    /*
+     * Check the other two string lengths before converting them all to SHFLSTRINGS.
+     */
+    if (strName.length() >= _2K)
+        return setError(E_INVALIDARG, tr("Shared folder name is too long: %zu bytes"), strName.length());
+    if (aData.m_strAutoMountPoint.length() >= RTPATH_MAX)
+        return setError(E_INVALIDARG, tr("Shared folder mountp point too long: %zu bytes"), aData.m_strAutoMountPoint.length());
+
+    PSHFLSTRING pHostPath       = ShflStringDupUtf8AsUtf16(aData.m_strHostPath.c_str());
+    PSHFLSTRING pName           = ShflStringDupUtf8AsUtf16(strName.c_str());
+    PSHFLSTRING pAutoMountPoint = ShflStringDupUtf8AsUtf16(aData.m_strAutoMountPoint.c_str());
+    if (pHostPath && pName && pAutoMountPoint)
+    {
+        /*
+         * Make a SHFL_FN_ADD_MAPPING call to tell the service about folder.
+         */
+        VBOXHGCMSVCPARM aParams[SHFL_CPARMS_ADD_MAPPING];
+        SHFLSTRING_TO_HGMC_PARAM(&aParams[0], pHostPath);
+        SHFLSTRING_TO_HGMC_PARAM(&aParams[1], pName);
+        aParams[2].setUInt32(  (aData.m_fWritable  ? SHFL_ADD_MAPPING_F_WRITABLE : 0)
+                             | (aData.m_fAutoMount ? SHFL_ADD_MAPPING_F_AUTOMOUNT : 0)
+                             | (fSymlinksCreate    ? SHFL_ADD_MAPPING_F_CREATE_SYMLINKS : 0)
+                             | (fMissing           ? SHFL_ADD_MAPPING_F_MISSING : 0));
+        SHFLSTRING_TO_HGMC_PARAM(&aParams[3], pAutoMountPoint);
+        AssertCompile(SHFL_CPARMS_ADD_MAPPING == 4);
+
+        vrc = m_pVMMDev->hgcmHostCall("VBoxSharedFolders", SHFL_FN_ADD_MAPPING, SHFL_CPARMS_ADD_MAPPING, aParams);
+        if (RT_FAILURE(vrc))
+            hrc = setErrorBoth(E_FAIL, vrc, tr("Could not create a shared folder '%s' mapped to '%s' (%Rrc)"),
+                               strName.c_str(), aData.m_strHostPath.c_str(), vrc);
+
+        else if (fMissing)
+            hrc = setError(E_INVALIDARG,
+                           tr("Shared folder path '%s' does not exist on the host"),
+                           aData.m_strHostPath.c_str());
+        else
+            hrc = S_OK;
+    }
+    else
+        hrc = E_OUTOFMEMORY;
+    RTMemFree(pAutoMountPoint);
+    RTMemFree(pName);
+    RTMemFree(pHostPath);
+    return hrc;
 }
 
@@ -10176,5 +10178,6 @@
                  * Register our load/save state file handlers
                  */
-                vrc = SSMR3RegisterExternal(pConsole->mpUVM, sSSMConsoleUnit, 0 /*iInstance*/, sSSMConsoleVer, 0 /* cbGuess */,
+                vrc = SSMR3RegisterExternal(pConsole->mpUVM, sSSMConsoleUnit, 0 /*iInstance*/,
+                                            CONSOLE_SAVED_STATE_VERSION, 0 /* cbGuess */,
                                             NULL, NULL, NULL,
                                             NULL, i_saveStateFileExec, NULL,
Index: /trunk/src/VBox/Main/src-server/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 75379)
+++ /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 75380)
@@ -5422,5 +5422,6 @@
 }
 
-HRESULT Machine::createSharedFolder(const com::Utf8Str &aName, const com::Utf8Str &aHostPath, BOOL  aWritable, BOOL  aAutomount)
+HRESULT Machine::createSharedFolder(const com::Utf8Str &aName, const com::Utf8Str &aHostPath, BOOL aWritable,
+                                    BOOL aAutomount, const com::Utf8Str &aAutoMountPoint)
 {
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -5442,4 +5443,5 @@
                             !!aWritable,
                             !!aAutomount,
+                            aAutoMountPoint,
                             true /* fFailOnError */);
     if (FAILED(rc)) return rc;
@@ -9021,4 +9023,5 @@
                                     RT_BOOL(sf.fWritable),
                                     RT_BOOL(sf.fAutoMount),
+                                    sf.strAutoMountPoint,
                                     false /* fFailOnError */);
             if (FAILED(rc)) return rc;
@@ -10316,4 +10319,5 @@
             sf.fWritable = !!pSF->i_isWritable();
             sf.fAutoMount = !!pSF->i_isAutoMounted();
+            sf.strAutoMountPoint = pSF->i_getAutoMountPoint();
 
             data.llSharedFolders.push_back(sf);
Index: /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp	(revision 75379)
+++ /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp	(revision 75380)
@@ -2013,5 +2013,6 @@
                                        const com::Utf8Str &aHostPath,
                                        BOOL aWritable,
-                                       BOOL aAutomount)
+                                       BOOL aAutomount,
+                                       const com::Utf8Str &aAutoMountPoint)
 {
     NOREF(aName);
@@ -2019,4 +2020,5 @@
     NOREF(aWritable);
     NOREF(aAutomount);
+    NOREF(aAutoMountPoint);
 
     return setError(E_NOTIMPL, "Not yet implemented");
Index: /trunk/src/VBox/Main/xml/Settings.cpp
===================================================================
--- /trunk/src/VBox/Main/xml/Settings.cpp	(revision 75379)
+++ /trunk/src/VBox/Main/xml/Settings.cpp	(revision 75380)
@@ -2876,8 +2876,9 @@
 {
     return (this == &g)
-        || (   strName       == g.strName
-            && strHostPath   == g.strHostPath
-            && fWritable     == g.fWritable
-            && fAutoMount    == g.fAutoMount);
+        || (   strName           == g.strName
+            && strHostPath       == g.strHostPath
+            && fWritable         == g.fWritable
+            && fAutoMount        == g.fAutoMount
+            && strAutoMountPoint == g.strAutoMountPoint);
 }
 
@@ -4699,4 +4700,5 @@
                 pelmFolder->getAttributeValue("writable", sf.fWritable);
                 pelmFolder->getAttributeValue("autoMount", sf.fAutoMount);
+                pelmFolder->getAttributeValue("autoMountPoint", sf.strAutoMountPoint);
                 hw.llSharedFolders.push_back(sf);
             }
@@ -6459,4 +6461,6 @@
             pelmThis->setAttribute("writable", sf.fWritable);
             pelmThis->setAttribute("autoMount", sf.fAutoMount);
+            if (sf.strAutoMountPoint.isNotEmpty())
+                pelmThis->setAttribute("autoMountPoint", sf.strAutoMountPoint);
         }
     }
@@ -7292,4 +7296,13 @@
             return;
         }
+        if (hardwareMachine.llSharedFolders.size())
+            for (SharedFoldersList::const_iterator it = hardwareMachine.llSharedFolders.begin();
+                 it != hardwareMachine.llSharedFolders.end();
+                 ++it)
+                if (it->strAutoMountPoint.isNotEmpty())
+                {
+                    m->sv = SettingsVersion_v1_17;
+                    return;
+                }
 
         /*
