diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2017-03-14 19:06:16 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2017-03-14 19:06:16 +0000 |
commit | 2e9046906550f15dcd5d198686659ece977e5b59 (patch) | |
tree | fc974121273d1daabb3e506d163433a19ec907d1 /src/VBox/HostServices | |
parent | 736ec6d99e1acf457c981fd449cad894433b29dd (diff) | |
download | VirtualBox-svn-2e9046906550f15dcd5d198686659ece977e5b59.tar.gz |
SharedFolders: Some adjustments necessary for flexible array syntax in SHFLSTRING.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@66099 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/HostServices')
-rw-r--r-- | src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp | 13 | ||||
-rw-r--r-- | src/VBox/HostServices/SharedFolders/vbsf.cpp | 12 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp b/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp index 7f8a3f466be..d396f5188f0 100644 --- a/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp +++ b/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp @@ -754,7 +754,7 @@ static int flushFile(VBOXHGCMSVCFNTABLE *psvcTable, SHFLROOT root, } static int listDir(VBOXHGCMSVCFNTABLE *psvcTable, SHFLROOT root, - SHFLHANDLE handle, uint32_t fFlags, uint32_t cb, + SHFLHANDLE handle, uint32_t fFlags, const char *pcszPath, void *pvBuf, uint32_t cbBuf, uint32_t resumePoint, uint32_t *pcFiles) { @@ -765,7 +765,7 @@ static int listDir(VBOXHGCMSVCFNTABLE *psvcTable, SHFLROOT root, aParms[0].setUInt32(root); aParms[1].setUInt64(handle); aParms[2].setUInt32(fFlags); - aParms[3].setUInt32(cb); + aParms[3].setUInt32(cbBuf); if (pcszPath) { fillTestShflString(&Path, pcszPath); @@ -1019,7 +1019,11 @@ void testDirListEmpty(RTTEST hTest) SHFLROOT Root; PRTDIR pDir = (PRTDIR)&g_aTestDirHandles[g_iNextDirHandle++ % RT_ELEMENTS(g_aTestDirHandles)]; SHFLHANDLE Handle; - SHFLDIRINFO DirInfo; + union + { + SHFLDIRINFO DirInfo; + uint8_t abBuffer[sizeof(SHFLDIRINFO) + 2 * sizeof(RTUTF16)]; + } Buf; uint32_t cFiles; int rc; @@ -1030,8 +1034,7 @@ void testDirListEmpty(RTTEST hTest) rc = createFile(&svcTable, Root, "test/dir", SHFL_CF_DIRECTORY | SHFL_CF_ACCESS_READ, &Handle, NULL); RTTEST_CHECK_RC_OK(hTest, rc); - rc = listDir(&svcTable, Root, Handle, 0, sizeof (SHFLDIRINFO), NULL, - &DirInfo, sizeof(DirInfo), 0, &cFiles); + rc = listDir(&svcTable, Root, Handle, 0, NULL, &Buf.DirInfo, sizeof(Buf), 0, &cFiles); RTTEST_CHECK_RC(hTest, rc, VERR_NO_MORE_FILES); RTTEST_CHECK_MSG(hTest, g_testRTDirReadExDir == pDir, (hTest, "Dir=%p\n", g_testRTDirReadExDir)); RTTEST_CHECK_MSG(hTest, cFiles == 0, diff --git a/src/VBox/HostServices/SharedFolders/vbsf.cpp b/src/VBox/HostServices/SharedFolders/vbsf.cpp index 2e454a9c5a5..4d46ad47526 100644 --- a/src/VBox/HostServices/SharedFolders/vbsf.cpp +++ b/src/VBox/HostServices/SharedFolders/vbsf.cpp @@ -1614,7 +1614,11 @@ int vbsfQueryVolumeInfo(SHFLCLIENTDATA *pClient, SHFLROOT root, uint32_t flags, int rc = VINF_SUCCESS; SHFLVOLINFO *pSFDEntry; char *pszFullPath = NULL; - SHFLSTRING dummy; + union + { + SHFLSTRING Dummy; + uint8_t abDummy[SHFLSTRING_HEADER_SIZE + sizeof(RTUTF16)]; + } Buf; if (pcbBuffer == 0 || pBuffer == 0 || *pcbBuffer < sizeof(SHFLVOLINFO)) { @@ -1628,9 +1632,9 @@ int vbsfQueryVolumeInfo(SHFLCLIENTDATA *pClient, SHFLROOT root, uint32_t flags, *pcbBuffer = 0; pSFDEntry = (PSHFLVOLINFO)pBuffer; - ShflStringInitBuffer(&dummy, sizeof(dummy)); - dummy.String.ucs2[0] = '\0'; - rc = vbsfBuildFullPath(pClient, root, &dummy, sizeof(dummy), &pszFullPath, NULL); + ShflStringInitBuffer(&Buf.Dummy, sizeof(Buf)); + Buf.Dummy.String.ucs2[0] = '\0'; + rc = vbsfBuildFullPath(pClient, root, &Buf.Dummy, sizeof(Buf), &pszFullPath, NULL); if (RT_SUCCESS(rc)) { |