Index: trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxCalls.c
===================================================================
--- trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxCalls.c	(revision 3943)
+++ trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxCalls.c	(revision 3944)
@@ -200,4 +200,11 @@
     data.delimiter.u.value32          = RTPATH_DELIMITER;
 
+    data.fCaseSensitive.type          = VMMDevHGCMParmType_32bit;
+#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
+    data.fCaseSensitive.u.value32     = 0;
+#else
+    data.fCaseSensitive.u.value32     = 1;
+#endif
+
     rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
 
Index: trunk/src/VBox/HostServices/SharedFolders/mappings.cpp
===================================================================
--- trunk/src/VBox/HostServices/SharedFolders/mappings.cpp	(revision 3943)
+++ trunk/src/VBox/HostServices/SharedFolders/mappings.cpp	(revision 3944)
@@ -75,4 +75,24 @@
             FolderMapping[i].fValid    = true;
             FolderMapping[i].cMappings = 0;
+
+            /* Check if the host file system is case sensitive */
+            RTFSPROPERTIES prop;
+            char *utf8Root, *asciiroot;
+
+            int rc = RTUtf16ToUtf8(FolderMapping[i].pFolderName->String.ucs2, &utf8Root);
+            AssertRC(rc);
+
+            if (VBOX_SUCCESS(rc))
+            {
+                rc = RTStrUtf8ToCurrentCP(&asciiroot, utf8Root);
+                if (VBOX_SUCCESS(rc))
+                {
+                    rc = RTFsQueryProperties(asciiroot, &prop);
+                    AssertRC(rc);
+                    RTStrFree(asciiroot);
+                }
+                RTStrFree(utf8Root);
+            }
+            FolderMapping[i].fHostCaseSensitive = VBOX_SUCCESS(rc) ? prop.fCaseSensitive : false;
             break;
         }
@@ -131,4 +151,26 @@
 }
 
+bool vbsfIsGuestMappingCaseSensitive (SHFLROOT root)
+{
+    if (root > SHFL_MAX_MAPPINGS)
+    {
+        AssertFailed();
+        return false;
+    }
+
+    return FolderMapping[root].fGuestCaseSensitive;
+}
+
+bool vbsfIsHostMappingCaseSensitive (SHFLROOT root)
+{
+    if (root > SHFL_MAX_MAPPINGS)
+    {
+        AssertFailed();
+        return false;
+    }
+
+    return FolderMapping[root].fHostCaseSensitive;
+}
+
 int vbsfMappingsQuery (SHFLCLIENTDATA *pClient, SHFLMAPPING *pMappings, uint32_t *pcMappings)
 {
@@ -203,5 +245,5 @@
 }
 
-int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUCS2 delimiter, SHFLROOT *pRoot)
+int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUCS2 delimiter, bool fCaseSensitive, SHFLROOT *pRoot)
 {
     size_t index;
@@ -255,4 +297,6 @@
 
     FolderMapping[index].cMappings++;
+    Assert(FolderMapping[index].cMappings == 1 || FolderMapping[index].fGuestCaseSensitive == fCaseSensitive);
+    FolderMapping[index].fGuestCaseSensitive = fCaseSensitive;
     *pRoot = index;
     return VINF_SUCCESS;
Index: trunk/src/VBox/HostServices/SharedFolders/mappings.h
===================================================================
--- trunk/src/VBox/HostServices/SharedFolders/mappings.h	(revision 3943)
+++ trunk/src/VBox/HostServices/SharedFolders/mappings.h	(revision 3944)
@@ -33,4 +33,6 @@
     uint32_t    cMappings;
     bool        fValid;
+    bool        fHostCaseSensitive;
+    bool        fGuestCaseSensitive;
 } MAPPING, *PMAPPING;
 
@@ -45,9 +47,10 @@
 int vbsfMappingsQueryName (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pString);
 
-int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUCS2 delimiter, SHFLROOT *pRoot);
+int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUCS2 delimiter, bool fCaseSensitive, SHFLROOT *pRoot);
 int vbsfUnmapFolder (SHFLCLIENTDATA *pClient, SHFLROOT root);
 
 const RTUCS2 *vbsfMappingsQueryHostRoot (SHFLROOT root, uint32_t *pcbRoot);
-
+bool          vbsfIsGuestMappingCaseSensitive (SHFLROOT root);
+bool          vbsfIsHostMappingCaseSensitive (SHFLROOT root);
 
 #endif /* __MAPPINGS__H */
Index: trunk/src/VBox/HostServices/SharedFolders/service.cpp
===================================================================
--- trunk/src/VBox/HostServices/SharedFolders/service.cpp	(revision 3943)
+++ trunk/src/VBox/HostServices/SharedFolders/service.cpp	(revision 3944)
@@ -30,4 +30,6 @@
 #include <iprt/assert.h>
 #include <VBox/ssm.h>
+
+#define SHFL_SSM_VERSION        2
 
 
@@ -117,5 +119,8 @@
     Log(("svcSaveState: u32ClientID = %d\n", u32ClientID));
 
-    int rc = SSMR3PutU32(pSSM, SHFL_MAX_MAPPINGS);
+    int rc = SSMR3PutU32(pSSM, SHFL_SSM_VERSION);
+    AssertRCReturn(rc, rc);
+
+    rc = SSMR3PutU32(pSSM, SHFL_MAX_MAPPINGS);
     AssertRCReturn(rc, rc);
 
@@ -153,4 +158,10 @@
             rc = SSMR3PutMem(pSSM, FolderMapping[i].pMapName, len);
             AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutBool(pSSM, FolderMapping[i].fHostCaseSensitive);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutBool(pSSM, FolderMapping[i].fGuestCaseSensitive);
+            AssertRCReturn(rc, rc);
         }
     }
@@ -163,9 +174,15 @@
     uint32_t        nrMappings;
     SHFLCLIENTDATA *pClient = (SHFLCLIENTDATA *)pvClient;
-    uint32_t        len;
+    uint32_t        len, version;
 
     Log(("svcLoadState: u32ClientID = %d\n", u32ClientID));
 
-    int rc = SSMR3GetU32(pSSM, &nrMappings);
+    int rc = SSMR3GetU32(pSSM, &version);
+    AssertRCReturn(rc, rc);
+
+    if (version != SHFL_SSM_VERSION)
+        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+
+    rc = SSMR3GetU32(pSSM, &nrMappings);
     AssertRCReturn(rc, rc);
     if (nrMappings != SHFL_MAX_MAPPINGS)
@@ -245,4 +262,13 @@
             RTMemFree(pName);
 
+            bool fCaseSensitive;
+
+            rc = SSMR3GetBool(pSSM, &fCaseSensitive);
+            AssertRCReturn(rc, rc);
+            if (FolderMapping[i].fHostCaseSensitive != fCaseSensitive)
+                return VERR_SSM_UNEXPECTED_DATA;
+
+            rc = SSMR3GetBool(pSSM, &FolderMapping[i].fGuestCaseSensitive);
+            AssertRCReturn(rc, rc);
         }
     }
@@ -703,10 +729,11 @@
         }
 
-        case SHFL_FN_MAP_FOLDER:
-        {
-            Log(("svcCall: SHFL_FN_MAP_FOLDER\n"));
-
-            /* Verify parameter count and types. */
-            if (cParms != SHFL_CPARMS_MAP_FOLDER)
+        /* Legacy interface */
+        case SHFL_FN_MAP_FOLDER_OLD:
+        {
+            Log(("svcCall: SHFL_FN_MAP_FOLDER_OLD\n"));
+
+            /* Verify parameter count and types. */
+            if (cParms != SHFL_CPARMS_MAP_FOLDER_OLD)
             {
                 rc = VERR_INVALID_PARAMETER;
@@ -714,4 +741,5 @@
             else if (   paParms[0].type != VBOX_HGCM_SVC_PARM_PTR     /* path */
                      || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT   /* root */
+                     || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT   /* delimiter */
                     )
             {
@@ -726,5 +754,42 @@
 
                 /* Execute the function. */
-                rc = vbsfMapFolder (pClient, pszMapName, delimiter, &root);
+                rc = vbsfMapFolder (pClient, pszMapName, delimiter, false,  &root);
+
+                if (VBOX_SUCCESS(rc))
+                {
+                    /* Update parameters.*/
+                    paParms[1].u.uint32 = root;
+                }
+            }
+            break;
+        }
+
+        case SHFL_FN_MAP_FOLDER:
+        {
+            Log(("svcCall: SHFL_FN_MAP_FOLDER\n"));
+
+            /* Verify parameter count and types. */
+            if (cParms != SHFL_CPARMS_MAP_FOLDER)
+            {
+                rc = VERR_INVALID_PARAMETER;
+            }
+            else if (   paParms[0].type != VBOX_HGCM_SVC_PARM_PTR     /* path */
+                     || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT   /* root */
+                     || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT   /* delimiter */
+                     || paParms[3].type != VBOX_HGCM_SVC_PARM_32BIT   /* fCaseSensitive */
+                    )
+            {
+                rc = VERR_INVALID_PARAMETER;
+            }
+            else
+            {
+                /* Fetch parameters. */
+                PSHFLSTRING pszMapName = (PSHFLSTRING)paParms[0].u.pointer.addr;
+                SHFLROOT    root       = (SHFLROOT)paParms[1].u.uint32;
+                RTUCS2      delimiter  = (RTUCS2)paParms[2].u.uint32;
+                bool        fCaseSensitive = !!paParms[3].u.uint32;
+
+                /* Execute the function. */
+                rc = vbsfMapFolder (pClient, pszMapName, delimiter, fCaseSensitive, &root);
 
                 if (VBOX_SUCCESS(rc))
Index: trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
===================================================================
--- trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp	(revision 3943)
+++ trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp	(revision 3944)
@@ -240,4 +240,57 @@
     if (VBOX_SUCCESS (rc))
     {
+#if 0
+        /* When the host file system is case sensitive and the guest expects a case insensitive fs, then problems can occur */
+        if (    vbsfIsHostMappingCaseSensitive (root)
+            &&  !vbsfIsGuestMappingCaseSensitive(root))
+        {
+            RTFSOBJINFO info;
+            rc = RTPathQueryInfo (pszFullPath, &info, RTFSOBJATTRADD_NOTHING);
+            if (rc != VINF_SUCCESS)
+            {
+                char *src = pszFullPath;
+                
+                Assert(rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND);
+                Log(("Handle case insenstive guest fs on top of host case sensitive fs for %ws\n", pszFullPath));
+                while(*src)
+                {
+                    if (*src == RTPATH_DELIMITER)
+                        break;
+                    src++;
+                }
+                Assert(*src);
+                if (*src)
+                {
+                    src++;
+                    for(;;)
+                    {
+                        char *end = src;
+
+                        while(*end)
+                        {
+                            if (*end == RTPATH_DELIMITER)
+                                break;
+                            end++;
+                        }
+                        if (!*end)
+                            break;
+
+                        *end = 0;
+                    
+                        rc = RTPathQueryInfo(src, &info, RTFSOBJATTRADD_NOTHING);
+                        if (rc != VINF_SUCCESS)
+                        {
+                            Assert(rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND);
+                        }
+
+                        *end = RTPATH_DELIMITER;
+                        src = end + 1;
+                    }
+                }
+
+            }
+            rc = VINF_SUCCESS;
+        }
+#endif
         *ppszFullPath = pszFullPath;
 
