summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2017-03-14 14:03:16 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2017-03-14 14:03:16 +0000
commit721eccc893ffa2a825a5e6ba088c9cb26cec7a1e (patch)
treeee9d80194faba852571d330d3190779b1ad4e541
parentcde9c1692e1f439258dc769597e6413641f622cc (diff)
downloadVirtualBox-svn-721eccc893ffa2a825a5e6ba088c9cb26cec7a1e.tar.gz
SharedFolders: fixed regression with Windows extended-length paths.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@66091 cfe28804-0f27-0410-a406-dd0f0b0b656f
-rw-r--r--src/VBox/HostServices/SharedFolders/Makefile.kmk1
-rw-r--r--src/VBox/HostServices/SharedFolders/mappings.cpp3
-rw-r--r--src/VBox/HostServices/SharedFolders/vbsfpath.cpp4
-rw-r--r--src/VBox/HostServices/SharedFolders/vbsfpath.h14
4 files changed, 19 insertions, 3 deletions
diff --git a/src/VBox/HostServices/SharedFolders/Makefile.kmk b/src/VBox/HostServices/SharedFolders/Makefile.kmk
index 60cf1dbe38e..84ccf3cacf4 100644
--- a/src/VBox/HostServices/SharedFolders/Makefile.kmk
+++ b/src/VBox/HostServices/SharedFolders/Makefile.kmk
@@ -40,6 +40,7 @@ VBoxSharedFolders_SOURCES = \
shflhandle.cpp \
vbsf.cpp \
vbsfpath.cpp \
+ vbsfpathabs.cpp \
mappings.cpp
VBoxSharedFolders_SOURCES.win = \
VBoxSharedFolders.rc
diff --git a/src/VBox/HostServices/SharedFolders/mappings.cpp b/src/VBox/HostServices/SharedFolders/mappings.cpp
index 00ec3ab0efa..d40ecdb568a 100644
--- a/src/VBox/HostServices/SharedFolders/mappings.cpp
+++ b/src/VBox/HostServices/SharedFolders/mappings.cpp
@@ -19,6 +19,7 @@
#endif
#include "mappings.h"
+#include "vbsfpath.h"
#include <iprt/alloc.h>
#include <iprt/assert.h>
#include <iprt/path.h>
@@ -227,7 +228,7 @@ int vbsfMappingsAdd(const char *pszFolderName, PSHFLSTRING pMapName,
/* Make sure the folder name is an absolute path, otherwise we're
likely to get into trouble with buffer sizes in vbsfPathGuestToHost. */
char szAbsFolderName[RTPATH_MAX];
- int rc = RTPathAbs(pszFolderName, szAbsFolderName, sizeof(szAbsFolderName));
+ int rc = vbsfPathAbs(NULL, pszFolderName, szAbsFolderName, sizeof(szAbsFolderName));
AssertRCReturn(rc, rc);
FolderMapping[i].pszFolderName = RTStrDup(szAbsFolderName);
diff --git a/src/VBox/HostServices/SharedFolders/vbsfpath.cpp b/src/VBox/HostServices/SharedFolders/vbsfpath.cpp
index 9e58766f695..fd5f6cfd285 100644
--- a/src/VBox/HostServices/SharedFolders/vbsfpath.cpp
+++ b/src/VBox/HostServices/SharedFolders/vbsfpath.cpp
@@ -597,7 +597,7 @@ int vbsfPathGuestToHost(SHFLCLIENTDATA *pClient, SHFLROOT hRoot,
*pchDst++ = 0;
/* Construct the full host path removing '.' and '..'. */
- rc = RTPathAbsEx(pszRoot, pchVerifiedPath, pszFullPath, cbFullPathAlloc);
+ rc = vbsfPathAbs(pszRoot, pchVerifiedPath, pszFullPath, cbFullPathAlloc);
if (RT_SUCCESS(rc))
{
if (pfu32PathFlags && fLastComponentHasWildcard)
@@ -648,7 +648,7 @@ int vbsfPathGuestToHost(SHFLCLIENTDATA *pClient, SHFLROOT hRoot,
}
else
{
- LogFunc(("RTPathAbsEx %Rrc\n", rc));
+ LogFunc(("vbsfPathAbs %Rrc\n", rc));
}
}
diff --git a/src/VBox/HostServices/SharedFolders/vbsfpath.h b/src/VBox/HostServices/SharedFolders/vbsfpath.h
index f434f7b969a..a0846d0b6c1 100644
--- a/src/VBox/HostServices/SharedFolders/vbsfpath.h
+++ b/src/VBox/HostServices/SharedFolders/vbsfpath.h
@@ -50,4 +50,18 @@ int vbsfPathGuestToHost(SHFLCLIENTDATA *pClient, SHFLROOT hRoot,
*/
void vbsfFreeHostPath(char *pszHostPath);
+/**
+ * Build the absolute path by combining an absolute pszRoot and a relative pszPath.
+ * The resulting path does not contain '.' and '..' components.
+ * Similar to RTPathAbsEx but with support for Windows extended-length paths ("\\?\" prefix).
+ * Uses RTPathAbsEx for regular paths and on non-Windows hosts.
+ *
+ * @param pszRoot The absolute prefix. It is copied to the pszAbsPath without any processing.
+ * If NULL then the pszPath must be converted to the absolute path.
+ * @param pszPath The relative path to be appended to pszRoot. Already has correct delimiters (RTPATH_SLASH).
+ * @param pszAbsPath Where to store the resulting absolute path.
+ * @param cbAbsPath Size of pszAbsBuffer in bytes.
+ */
+int vbsfPathAbs(const char *pszRoot, const char *pszPath, char *pszAbsPath, size_t cbAbsPath);
+
#endif /* __VBSFPATH__H */