Index: /trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp
===================================================================
--- /trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp	(revision 66037)
+++ /trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp	(revision 66038)
@@ -37,4 +37,6 @@
 #include <iprt/stream.h>
 #include <iprt/test.h>
+#include <iprt/string.h>
+#include <iprt/utf16.h>
 
 #include "teststubs.h"
@@ -116,4 +118,5 @@
 *   Stub functions and data                                                                                                      *
 *********************************************************************************************************************************/
+static bool g_fFailIfNotLowercase = false;
 
 static PRTDIR g_testRTDirClosepDir;
@@ -134,4 +137,6 @@
  /* RTPrintf("%s: pszPath=%s, fMode=0x%llx\n", __PRETTY_FUNCTION__, pszPath,
              LLUIFY(fMode)); */
+    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\")))
+        return VERR_FILE_NOT_FOUND;
     ARRAY_FROM_PATH(testRTDirCreatePath, pszPath);
     return 0;
@@ -139,4 +144,10 @@
 
 static char testRTDirOpenName[256];
+static struct TESTDIRHANDLE
+{
+    int iEntry;
+    int iDir;
+} g_aTestDirHandles[4];
+static int g_iNextDirHandle = 0;
 static PRTDIR testRTDirOpenpDir;
 
@@ -144,7 +155,21 @@
 {
  /* RTPrintf("%s: pszPath=%s\n", __PRETTY_FUNCTION__, pszPath); */
+    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\")))
+        return VERR_FILE_NOT_FOUND;
     ARRAY_FROM_PATH(testRTDirOpenName, pszPath);
     *ppDir = testRTDirOpenpDir;
     testRTDirOpenpDir = 0;
+    if (!*ppDir && g_fFailIfNotLowercase)
+        *ppDir = (PRTDIR)&g_aTestDirHandles[g_iNextDirHandle++ % RT_ELEMENTS(g_aTestDirHandles)];
+    if (*ppDir)
+    {
+        struct TESTDIRHANDLE *pRealDir = (struct TESTDIRHANDLE *)*ppDir;
+        pRealDir->iEntry = 0;
+        pRealDir->iDir   = 0;
+        const char *pszSlash = pszPath - 1;
+        while ((pszSlash = strpbrk(pszSlash + 1, "\\/")) != NULL)
+            pRealDir->iDir += 1;
+        /*RTPrintf("opendir %s = %d \n", pszPath, pRealDir->iDir);*/
+    }
     return VINF_SUCCESS;
 }
@@ -154,7 +179,22 @@
 {
  /* RTPrintf("%s: pszPath=%s\n", __PRETTY_FUNCTION__, pszPath); */
+    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\")))
+        return VERR_FILE_NOT_FOUND;
     ARRAY_FROM_PATH(testRTDirOpenName, pszPath);
     *ppDir = testRTDirOpenpDir;
     testRTDirOpenpDir = 0;
+    if (!*ppDir && g_fFailIfNotLowercase)
+        *ppDir = (PRTDIR)&g_aTestDirHandles[g_iNextDirHandle++ % RT_ELEMENTS(g_aTestDirHandles)];
+    if (*ppDir)
+    {
+        struct TESTDIRHANDLE *pRealDir = (struct TESTDIRHANDLE *)*ppDir;
+        pRealDir->iEntry = 0;
+        pRealDir->iDir   = 0;
+        const char *pszSlash = pszPath - 1;
+        while ((pszSlash = strpbrk(pszSlash + 1, "\\/")) != NULL)
+            pRealDir->iDir += 1;
+        pRealDir->iDir -= 1;
+        /*RTPrintf("openfiltered %s = %d\n", pszPath, pRealDir->iDir);*/
+    }
     return VINF_SUCCESS;
 }
@@ -177,5 +217,6 @@
 extern int testRTDirRemove(const char *pszPath)
 {
-    RT_NOREF1(pszPath);
+    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\")))
+        return VERR_FILE_NOT_FOUND;
     RTPrintf("%s\n", __PRETTY_FUNCTION__);
     return 0;
@@ -192,4 +233,39 @@
              LLUIFY(enmAdditionalAttribs), LLUIFY(fFlags)); */
     g_testRTDirReadExDir = pDir;
+    if (g_fFailIfNotLowercase && pDir)
+    {
+        struct TESTDIRHANDLE *pRealDir = (struct TESTDIRHANDLE *)pDir;
+        if (pRealDir->iDir == 2) /* /test/mapping/ */
+        {
+            if (pRealDir->iEntry == 0)
+            {
+                pRealDir->iEntry++;
+                RT_ZERO(*pDirEntry);
+                pDirEntry->Info.Attr.fMode = RTFS_TYPE_DIRECTORY | RTFS_DOS_DIRECTORY | RTFS_UNIX_IROTH | RTFS_UNIX_IXOTH;
+                pDirEntry->cbName = 4;
+                pDirEntry->cwcShortName = 4;
+                strcpy(pDirEntry->szName, "test");
+                RTUtf16CopyAscii(pDirEntry->wszShortName, RT_ELEMENTS(pDirEntry->wszShortName), "test");
+                /*RTPrintf("readdir: 'test'\n");*/
+                return VINF_SUCCESS;
+            }
+        }
+        else if (pRealDir->iDir == 3) /* /test/mapping/test/ */
+        {
+            if (pRealDir->iEntry == 0)
+            {
+                pRealDir->iEntry++;
+                RT_ZERO(*pDirEntry);
+                pDirEntry->Info.Attr.fMode = RTFS_TYPE_FILE | RTFS_DOS_NT_NORMAL | RTFS_UNIX_IROTH | RTFS_UNIX_IXOTH;
+                pDirEntry->cbName = 4;
+                pDirEntry->cwcShortName = 4;
+                strcpy(pDirEntry->szName, "file");
+                RTUtf16CopyAscii(pDirEntry->wszShortName, RT_ELEMENTS(pDirEntry->wszShortName), "file");
+                /*RTPrintf("readdir: 'file'\n");*/
+                return VINF_SUCCESS;
+            }
+        }
+        /*else RTPrintf("%s: iDir=%d\n", pRealDir->iDir);*/
+    }
     return VERR_NO_MORE_FILES;
 }
@@ -226,5 +302,6 @@
 extern int  testRTFileDelete(const char *pszFilename)
 {
-    RT_NOREF1(pszFilename);
+    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszFilename, "/\\")))
+        return VERR_FILE_NOT_FOUND;
     RTPrintf("%s\n", __PRETTY_FUNCTION__);
     return 0;
@@ -267,4 +344,6 @@
     ARRAY_FROM_PATH(testRTFileOpenName, pszFilename);
     testRTFileOpenFlags = fOpen;
+    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszFilename, "/\\")))
+        return VERR_FILE_NOT_FOUND;
     *pFile = testRTFileOpenpFile;
     testRTFileOpenpFile = 0;
@@ -408,8 +487,10 @@
 extern int testRTPathQueryInfoEx(const char *pszPath, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags)
 {
-    RT_NOREF3(pszPath, enmAdditionalAttribs, fFlags);
+    RT_NOREF2(enmAdditionalAttribs, fFlags);
  /* RTPrintf("%s: pszPath=%s, enmAdditionalAttribs=0x%x, fFlags=0x%x\n",
              __PRETTY_FUNCTION__, pszPath, (unsigned) enmAdditionalAttribs,
              (unsigned) fFlags); */
+    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszPath, "/\\")))
+        return VERR_FILE_NOT_FOUND;
     RT_ZERO(*pObjInfo);
     return VINF_SUCCESS;
@@ -419,4 +500,6 @@
 {
     RT_NOREF2(pszSymlink, fDelete);
+    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszSymlink, "/\\")))
+        return VERR_FILE_NOT_FOUND;
     RTPrintf("%s\n", __PRETTY_FUNCTION__);
     return 0;
@@ -425,4 +508,6 @@
 extern int testRTSymlinkRead(const char *pszSymlink, char *pszTarget, size_t cbTarget, uint32_t fRead)
 {
+    if (g_fFailIfNotLowercase && !RTStrIsLowerCased(strpbrk(pszSymlink, "/\\")))
+        return VERR_FILE_NOT_FOUND;
     RT_NOREF4(pszSymlink, pszTarget, cbTarget, fRead);
     RTPrintf("%s\n", __PRETTY_FUNCTION__);
@@ -525,5 +610,6 @@
                                         VBOXHGCMSVCHELPERS *psvcHelpers,
                                         const char *pcszFolderName,
-                                        const char *pcszMapping)
+                                        const char *pcszMapping,
+                                        bool fCaseSensitive = true)
 {
     VBOXHGCMSVCPARM aParms[RT_MAX(SHFL_CPARMS_ADD_MAPPING,
@@ -553,5 +639,5 @@
     aParms[1].setUInt32(0);  /* root */
     aParms[2].setUInt32('/');  /* delimiter */
-    aParms[3].setUInt32(1);  /* case sensitive */
+    aParms[3].setUInt32(fCaseSensitive);
     psvcTable->pfnCall(psvcTable->pvService, &callHandle, 0,
                        psvcTable->pvService, SHFL_FN_MAP_FOLDER,
@@ -767,10 +853,46 @@
 }
 
-void testCreateDirSimple(RTTEST hTest)
+void testCreateFileSimpleCaseInsensitive(RTTEST hTest)
 {
     VBOXHGCMSVCFNTABLE  svcTable;
     VBOXHGCMSVCHELPERS  svcHelpers;
     SHFLROOT Root;
-    PRTDIR pcDir = (PRTDIR)0x10000;
+    const RTFILE hcFile = (RTFILE) 0x10000;
+    SHFLCREATERESULT Result;
+    int rc;
+
+    g_fFailIfNotLowercase = true;
+
+    RTTestSub(hTest, "Create file case insensitive");
+    Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
+                                   "/test/mapping", "testname", false /*fCaseSensitive*/);
+    testRTFileOpenpFile = hcFile;
+    rc = createFile(&svcTable, Root, "/TesT/FilE", SHFL_CF_ACCESS_READ, NULL,
+                    &Result);
+    RTTEST_CHECK_RC_OK(hTest, rc);
+
+    RTTEST_CHECK_MSG(hTest,
+                     !strcmp(&testRTFileOpenName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0],
+                             "/test/mapping/test/file"),
+                     (hTest, "pszFilename=%s\n", &testRTFileOpenName[RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS ? 2 : 0]));
+    RTTEST_CHECK_MSG(hTest, testRTFileOpenFlags == 0x181,
+                     (hTest, "fOpen=%llu\n", LLUIFY(testRTFileOpenFlags)));
+    RTTEST_CHECK_MSG(hTest, Result == SHFL_FILE_CREATED,
+                     (hTest, "Result=%d\n", (int) Result));
+    unmapAndRemoveMapping(hTest, &svcTable, Root, "testname");
+    AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
+    RTTestGuardedFree(hTest, svcTable.pvService);
+    RTTEST_CHECK_MSG(hTest, g_testRTFileCloseFile == hcFile,
+                     (hTest, "File=%u\n", (uintptr_t)g_testRTFileCloseFile));
+
+    g_fFailIfNotLowercase = false;
+}
+
+void testCreateDirSimple(RTTEST hTest)
+{
+    VBOXHGCMSVCFNTABLE  svcTable;
+    VBOXHGCMSVCHELPERS  svcHelpers;
+    SHFLROOT Root;
+    PRTDIR pDir = (PRTDIR)&g_aTestDirHandles[g_iNextDirHandle++ % RT_ELEMENTS(g_aTestDirHandles)];
     SHFLCREATERESULT Result;
     int rc;
@@ -779,5 +901,5 @@
     Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                    "/test/mapping", "testname");
-    testRTDirOpenpDir = pcDir;
+    testRTDirOpenpDir = pDir;
     rc = createFile(&svcTable, Root, "test/dir",
                     SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, NULL, &Result);
@@ -796,5 +918,5 @@
     AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
     RTTestGuardedFree(hTest, svcTable.pvService);
-    RTTEST_CHECK_MSG(hTest, g_testRTDirClosepDir == pcDir, (hTest, "pDir=%p\n", g_testRTDirClosepDir));
+    RTTEST_CHECK_MSG(hTest, g_testRTDirClosepDir == pDir, (hTest, "pDir=%p\n", g_testRTDirClosepDir));
 }
 
@@ -896,5 +1018,5 @@
     VBOXHGCMSVCHELPERS  svcHelpers;
     SHFLROOT Root;
-    PRTDIR pcDir = (PRTDIR)0x10000;
+    PRTDIR pDir = (PRTDIR)&g_aTestDirHandles[g_iNextDirHandle++ % RT_ELEMENTS(g_aTestDirHandles)];
     SHFLHANDLE Handle;
     SHFLDIRINFO DirInfo;
@@ -905,5 +1027,5 @@
     Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                    "/test/mapping", "testname");
-    testRTDirOpenpDir = pcDir;
+    testRTDirOpenpDir = pDir;
     rc = createFile(&svcTable, Root, "test/dir",
                     SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, &Handle, NULL);
@@ -912,5 +1034,5 @@
                  &DirInfo, sizeof(DirInfo), 0, &cFiles);
     RTTEST_CHECK_RC(hTest, rc, VERR_NO_MORE_FILES);
-    RTTEST_CHECK_MSG(hTest, g_testRTDirReadExDir == pcDir, (hTest, "Dir=%p\n", g_testRTDirReadExDir));
+    RTTEST_CHECK_MSG(hTest, g_testRTDirReadExDir == pDir, (hTest, "Dir=%p\n", g_testRTDirReadExDir));
     RTTEST_CHECK_MSG(hTest, cFiles == 0,
                      (hTest, "cFiles=%llu\n", LLUIFY(cFiles)));
@@ -918,5 +1040,5 @@
     AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
     RTTestGuardedFree(hTest, svcTable.pvService);
-    RTTEST_CHECK_MSG(hTest, g_testRTDirClosepDir == pcDir, (hTest, "pDir=%p\n", g_testRTDirClosepDir));
+    RTTEST_CHECK_MSG(hTest, g_testRTDirClosepDir == pDir, (hTest, "pDir=%p\n", g_testRTDirClosepDir));
 }
 
@@ -966,5 +1088,5 @@
     VBOXHGCMSVCHELPERS  svcHelpers;
     SHFLROOT Root;
-    const PRTDIR pcDir = (PRTDIR) 0x10000;
+    const PRTDIR pDir = (PRTDIR)&g_aTestDirHandles[g_iNextDirHandle++ % RT_ELEMENTS(g_aTestDirHandles)];
     const int64_t ccAtimeNano = 100000;
     SHFLFSOBJINFO Info;
@@ -975,5 +1097,5 @@
     Root = initWithWritableMapping(hTest, &svcTable, &svcHelpers,
                                    "/test/mapping", "testname");
-    testRTDirOpenpDir = pcDir;
+    testRTDirOpenpDir = pDir;
     rc = createFile(&svcTable, Root, "test/dir",
                     SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, &Handle, NULL);
@@ -984,5 +1106,5 @@
                        &Info);
     RTTEST_CHECK_RC_OK(hTest, rc);
-    RTTEST_CHECK_MSG(hTest, g_testRTDirQueryInfoDir == pcDir, (hTest, "Dir=%p\n", g_testRTDirQueryInfoDir));
+    RTTEST_CHECK_MSG(hTest, g_testRTDirQueryInfoDir == pDir, (hTest, "Dir=%p\n", g_testRTDirQueryInfoDir));
     RTTEST_CHECK_MSG(hTest, RTTimeSpecGetNano(&Info.AccessTime) == ccAtimeNano,
                      (hTest, "ATime=%llu\n",
@@ -1000,5 +1122,5 @@
     AssertReleaseRC(svcTable.pfnDisconnect(NULL, 0, svcTable.pvService));
     RTTestGuardedFree(hTest, svcTable.pvService);
-    RTTEST_CHECK_MSG(hTest, g_testRTDirClosepDir == pcDir, (hTest, "pDir=%p\n", g_testRTDirClosepDir));
+    RTTEST_CHECK_MSG(hTest, g_testRTDirClosepDir == pDir, (hTest, "pDir=%p\n", g_testRTDirClosepDir));
 }
 
Index: /trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.h
===================================================================
--- /trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.h	(revision 66037)
+++ /trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.h	(revision 66038)
@@ -54,4 +54,5 @@
 /* Sub-tests for testCreate(). */
 void testCreateFileSimple(RTTEST hTest);
+void testCreateFileSimpleCaseInsensitive(RTTEST hTest);
 void testCreateDirSimple(RTTEST hTest);
 void testCreateBadParameters(RTTEST hTest);
Index: /trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
===================================================================
--- /trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp	(revision 66037)
+++ /trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp	(revision 66038)
@@ -812,4 +812,5 @@
     /* Simple opening of an existing file. */
     testCreateFileSimple(hTest);
+    testCreateFileSimpleCaseInsensitive(hTest);
     /* Simple opening of an existing directory. */
     /** @todo How do wildcards in the path name work? */
