Added patch to zero out returned stats when IEnumSTATSTG::Next reaches end of enumeration.

This commit is contained in:
Sebastian Lackner 2015-10-31 17:33:07 +01:00
parent 85d50ecc2a
commit a2714839b3
7 changed files with 163 additions and 1 deletions

View File

@ -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

2
debian/changelog vendored
View File

@ -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).

View File

@ -0,0 +1,30 @@
From 3c33f1f4e9c9e829226bb6bba9a42154f00a48ef Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
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 <dmitry@baikal.ru>
---
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,
&currentEntry);
+ if (FAILED(hr)) break;
/*
* Copy the information to the return buffer.
--
2.6.1

View File

@ -0,0 +1,29 @@
From 9b77ae10308afc29ee408f42b4ae854b6ce0be92 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
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 <dmitry@baikal.ru>
---
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, &currentSearchNode);
if (FAILED(hr) || currentSearchNode == DIRENTRY_NULL)
+ {
+ memset(currentReturnStruct, 0, sizeof(*currentReturnStruct));
break;
+ }
/*
* Read the entry from the storage.
--
2.6.1

View File

@ -0,0 +1,79 @@
From 2c518d5f6fef54adbffac7be1d70da8236a9441b Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
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 <dmitry@baikal.ru>
---
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

View File

@ -0,0 +1 @@
Fixes: IEnumSTATSTG::Next should zero out returned stats when enumeration ends

View File

@ -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: