From a2714839b3da80c4f62429ba3c9d0a65fc7e4ac3 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 31 Oct 2015 17:33:07 +0100 Subject: [PATCH] Added patch to zero out returned stats when IEnumSTATSTG::Next reaches end of enumeration. --- README.md | 3 +- debian/changelog | 2 + ...e-failure-of-reading-directory-entry.patch | 30 +++++++ ...out-returned-stats-when-IEnumSTATSTG.patch | 29 +++++++ ...the-tests-to-show-that-IEnumSTATSTG-.patch | 79 +++++++++++++++++++ patches/ole32-IEnumSTATSTG/definition | 1 + patches/patchinstall.sh | 20 +++++ 7 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 patches/ole32-IEnumSTATSTG/0001-dlls-ole32-Handle-failure-of-reading-directory-entry.patch create mode 100644 patches/ole32-IEnumSTATSTG/0002-dlls-ole32-Zero-out-returned-stats-when-IEnumSTATSTG.patch create mode 100644 patches/ole32-IEnumSTATSTG/0003-ole32-tests-Add-the-tests-to-show-that-IEnumSTATSTG-.patch create mode 100644 patches/ole32-IEnumSTATSTG/definition diff --git a/README.md b/README.md index 04dd8965..100945d4 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,12 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features included in the next upcoming release [7]:** +**Bug fixes and features included in the next upcoming release [8]:** * Add stub for SetCoalescableTimer ([Wine Bug #39509](https://bugs.winehq.org/show_bug.cgi?id=39509)) * Add stub for SfcGetNextProtectedFile ([Wine Bug #38097](https://bugs.winehq.org/show_bug.cgi?id=38097)) * Do not allow interruption of system APC in server_select ([Wine Bug #14697](https://bugs.winehq.org/show_bug.cgi?id=14697)) +* IEnumSTATSTG::Next should zero out returned stats when enumeration ends * Implement FileNamesInformation class support for NtQueryDirectoryFile * Implement hal.KeQueryPerformanceCounter ([Wine Bug #39500](https://bugs.winehq.org/show_bug.cgi?id=39500)) * Implement stub for ProcessQuotaLimits info class diff --git a/debian/changelog b/debian/changelog index 6ef0954c..d7f53d75 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,8 @@ wine-staging (1.7.54) UNRELEASED; urgency=low stub. * Added patch for SetCoalescableTimer stub function. * Added patch for SfcGetNextProtectedFile stub function. + * Added patch to zero out returned stats when IEnumSTATSTG::Next reaches end + of enumeration. * Removed patch to implement kernel32.GetPhysicallyInstalledSystemMemory (accepted upstream). * Partially removed patches for ws2_32 TransmitFile (accepted upstream). diff --git a/patches/ole32-IEnumSTATSTG/0001-dlls-ole32-Handle-failure-of-reading-directory-entry.patch b/patches/ole32-IEnumSTATSTG/0001-dlls-ole32-Handle-failure-of-reading-directory-entry.patch new file mode 100644 index 00000000..66bde26c --- /dev/null +++ b/patches/ole32-IEnumSTATSTG/0001-dlls-ole32-Handle-failure-of-reading-directory-entry.patch @@ -0,0 +1,30 @@ +From 3c33f1f4e9c9e829226bb6bba9a42154f00a48ef Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Thu, 29 Oct 2015 15:41:02 +0800 +Subject: dlls/ole32: Handle failure of reading directory entry in + IEnumSTATSTG::Next. + +Signed-off-by: Dmitry Timoshkov +--- + dlls/ole32/storage32.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c +index bfef4a2..4d775b4 100644 +--- a/dlls/ole32/storage32.c ++++ b/dlls/ole32/storage32.c +@@ -1036,9 +1036,10 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Next( + /* + * Read the entry from the storage. + */ +- StorageBaseImpl_ReadDirEntry(This->parentStorage, ++ hr = StorageBaseImpl_ReadDirEntry(This->parentStorage, + currentSearchNode, + ¤tEntry); ++ if (FAILED(hr)) break; + + /* + * Copy the information to the return buffer. +-- +2.6.1 + diff --git a/patches/ole32-IEnumSTATSTG/0002-dlls-ole32-Zero-out-returned-stats-when-IEnumSTATSTG.patch b/patches/ole32-IEnumSTATSTG/0002-dlls-ole32-Zero-out-returned-stats-when-IEnumSTATSTG.patch new file mode 100644 index 00000000..2b20d728 --- /dev/null +++ b/patches/ole32-IEnumSTATSTG/0002-dlls-ole32-Zero-out-returned-stats-when-IEnumSTATSTG.patch @@ -0,0 +1,29 @@ +From 9b77ae10308afc29ee408f42b4ae854b6ce0be92 Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Thu, 29 Oct 2015 15:41:15 +0800 +Subject: dlls/ole32: Zero out returned stats when IEnumSTATSTG::Next reaches + end of enumeration. + +Signed-off-by: Dmitry Timoshkov +--- + dlls/ole32/storage32.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c +index 4d775b4..f75e097 100644 +--- a/dlls/ole32/storage32.c ++++ b/dlls/ole32/storage32.c +@@ -1031,7 +1031,10 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Next( + hr = IEnumSTATSTGImpl_GetNextRef(This, ¤tSearchNode); + + if (FAILED(hr) || currentSearchNode == DIRENTRY_NULL) ++ { ++ memset(currentReturnStruct, 0, sizeof(*currentReturnStruct)); + break; ++ } + + /* + * Read the entry from the storage. +-- +2.6.1 + diff --git a/patches/ole32-IEnumSTATSTG/0003-ole32-tests-Add-the-tests-to-show-that-IEnumSTATSTG-.patch b/patches/ole32-IEnumSTATSTG/0003-ole32-tests-Add-the-tests-to-show-that-IEnumSTATSTG-.patch new file mode 100644 index 00000000..9ed912a0 --- /dev/null +++ b/patches/ole32-IEnumSTATSTG/0003-ole32-tests-Add-the-tests-to-show-that-IEnumSTATSTG-.patch @@ -0,0 +1,79 @@ +From 2c518d5f6fef54adbffac7be1d70da8236a9441b Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Thu, 29 Oct 2015 15:41:21 +0800 +Subject: ole32/tests: Add the tests to show that IEnumSTATSTG::Next should + zero out returned stats when it reaches end of enumeration. + +Signed-off-by: Dmitry Timoshkov +--- + dlls/ole32/tests/storage32.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c +index edd0b3f..afe9332 100644 +--- a/dlls/ole32/tests/storage32.c ++++ b/dlls/ole32/tests/storage32.c +@@ -1224,6 +1224,7 @@ static void test_streamenum(void) + static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; + static const WCHAR stmname2[] = { 'A','B','C','D','E','F','G','H','I',0 }; + static const WCHAR stmname3[] = { 'A','B','C','D','E','F','G','H','I','J',0 }; ++ static const STATSTG stat_null; + STATSTG stat; + IEnumSTATSTG *ee = NULL; + ULONG count; +@@ -1269,10 +1270,12 @@ static void test_streamenum(void) + r = IStorage_DestroyElement(stg, stmname); + ok(r==S_OK, "IStorage->DestroyElement failed\n"); + ++ memset(&stat, 0xad, sizeof(stat)); + count = 0xf00; + r = IEnumSTATSTG_Next(ee, 1, &stat, &count); + ok(r==S_FALSE, "IEnumSTATSTG->Next failed\n"); + ok(count == 0, "count wrong\n"); ++ ok(memcmp(&stat, &stat_null, sizeof(stat)) == 0, "stat is not zeroed\n"); + + /* reset and try again */ + r = IEnumSTATSTG_Reset(ee); +@@ -2418,6 +2421,7 @@ static void test_fmtusertypestg(void) + static const WCHAR fileW[] = {'f','m','t','t','e','s','t',0}; + static WCHAR userTypeW[] = {'S','t','g','U','s','r','T','y','p','e',0}; + static const WCHAR strmNameW[] = {1,'C','o','m','p','O','b','j',0}; ++ static const STATSTG statstg_null; + + hr = StgCreateDocfile( fileW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg); + ok(hr == S_OK, "should succeed, res=%x\n", hr); +@@ -2436,6 +2440,7 @@ static void test_fmtusertypestg(void) + BOOL found = FALSE; + STATSTG statstg; + DWORD got; ++ memset(&statstg, 0xad, sizeof(statstg)); + while ((hr = IEnumSTATSTG_Next(stat, 1, &statstg, &got)) == S_OK && got == 1) + { + if (strcmp_ww(statstg.pwcsName, strmNameW) == 0) +@@ -2444,6 +2449,7 @@ static void test_fmtusertypestg(void) + ok(0, "found unexpected stream or storage\n"); + CoTaskMemFree(statstg.pwcsName); + } ++ ok(memcmp(&statstg, &statstg_null, sizeof(statstg)) == 0, "statstg is not zeroed\n"); + ok(found == TRUE, "expected storage to contain stream \\0001CompObj\n"); + IEnumSTATSTG_Release(stat); + } +@@ -2460,6 +2466,7 @@ static void test_fmtusertypestg(void) + BOOL found = FALSE; + STATSTG statstg; + DWORD got; ++ memset(&statstg, 0xad, sizeof(statstg)); + while ((hr = IEnumSTATSTG_Next(stat, 1, &statstg, &got)) == S_OK && got == 1) + { + if (strcmp_ww(statstg.pwcsName, strmNameW) == 0) +@@ -2468,6 +2475,7 @@ static void test_fmtusertypestg(void) + ok(0, "found unexpected stream or storage\n"); + CoTaskMemFree(statstg.pwcsName); + } ++ ok(memcmp(&statstg, &statstg_null, sizeof(statstg)) == 0, "statstg is not zeroed\n"); + ok(found == TRUE, "expected storage to contain stream \\0001CompObj\n"); + IEnumSTATSTG_Release(stat); + } +-- +2.6.1 + diff --git a/patches/ole32-IEnumSTATSTG/definition b/patches/ole32-IEnumSTATSTG/definition new file mode 100644 index 00000000..1f7b3b2a --- /dev/null +++ b/patches/ole32-IEnumSTATSTG/definition @@ -0,0 +1 @@ +Fixes: IEnumSTATSTG::Next should zero out returned stats when enumeration ends diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 43122567..82c25013 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -221,6 +221,7 @@ patch_enable_all () enable_nvcuda_CUDA_Support="$1" enable_nvcuvid_CUDA_Video_Support="$1" enable_nvencodeapi_Video_Encoder="$1" + enable_ole32_IEnumSTATSTG="$1" enable_openal32_EFX_Extension="$1" enable_opengl32_Revert_Disable_Ext="$1" enable_quartz_MediaSeeking_Positions="$1" @@ -761,6 +762,9 @@ patch_enable () nvencodeapi-Video_Encoder) enable_nvencodeapi_Video_Encoder="$2" ;; + ole32-IEnumSTATSTG) + enable_ole32_IEnumSTATSTG="$2" + ;; openal32-EFX_Extension) enable_openal32_EFX_Extension="$2" ;; @@ -4569,6 +4573,22 @@ if test "$enable_nvencodeapi_Video_Encoder" -eq 1; then ) >> "$patchlist" fi +# Patchset ole32-IEnumSTATSTG +# | +# | Modified files: +# | * dlls/ole32/storage32.c, dlls/ole32/tests/storage32.c +# | +if test "$enable_ole32_IEnumSTATSTG" -eq 1; then + patch_apply ole32-IEnumSTATSTG/0001-dlls-ole32-Handle-failure-of-reading-directory-entry.patch + patch_apply ole32-IEnumSTATSTG/0002-dlls-ole32-Zero-out-returned-stats-when-IEnumSTATSTG.patch + patch_apply ole32-IEnumSTATSTG/0003-ole32-tests-Add-the-tests-to-show-that-IEnumSTATSTG-.patch + ( + echo '+ { "Dmitry Timoshkov", "dlls/ole32: Handle failure of reading directory entry in IEnumSTATSTG::Next.", 1 },'; + echo '+ { "Dmitry Timoshkov", "dlls/ole32: Zero out returned stats when IEnumSTATSTG::Next reaches end of enumeration.", 1 },'; + echo '+ { "Dmitry Timoshkov", "ole32/tests: Add the tests to show that IEnumSTATSTG::Next should zero out returned stats when it reaches end of enumeration.", 1 },'; + ) >> "$patchlist" +fi + # Patchset openal32-EFX_Extension # | # | This patchset fixes the following Wine bugs: