Dmitry Timoshkov : ole32/tests: Add the tests to show that IEnumSTATSTG:: Next should zero out returned stats when it reaches end of enumeration.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Nov 2 09:47:15 CST 2015
Module: wine
Branch: master
Commit: 263b06ef8ddcfe64061928459083da41c9111f1d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=263b06ef8ddcfe64061928459083da41c9111f1d
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Mon Nov 2 11:34:51 2015 +0800
ole32/tests: Add the tests to show that IEnumSTATSTG::Next should zero out returned stats when it reaches end of enumeration.
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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);
}
More information about the wine-cvs
mailing list