Avoid accessing uninitialized data on WinME (based on an old patch by

Ferenc Wagner).
This commit is contained in:
Saulius Krasuckas 2005-06-14 19:18:18 +00:00 committed by Alexandre Julliard
parent ed12859a4a
commit d002f5ce22
1 changed files with 8 additions and 6 deletions

View File

@ -812,13 +812,14 @@ static void test_ScCopyRelocProps(void)
ok(sc == S_OK && lpResProp->ulPropTag == pvProp.ulPropTag &&
lpResProp->Value.MVszA.cValues == 1 &&
lpResProp->Value.MVszA.lppszA[0] == buffer + sizeof(SPropValue) + sizeof(char*) &&
!strcmp(lpResProp->Value.MVszA.lppszA[0], szTestA) &&
ulCount == sizeof(SPropValue) + sizeof(char*) + 5,
ulCount == sizeof(SPropValue) + sizeof(char*) + 5 &&
!strcmp(lpResProp->Value.MVszA.lppszA[0], szTestA),
"CopyProps(str): Expected 0 {1,%lx,%p,%s} %d got 0x%08lx {%ld,%lx,%p,%s} %ld\n",
pvProp.ulPropTag, buffer + sizeof(SPropValue) + sizeof(char*),
szTestA, sizeof(SPropValue) + sizeof(char*) + 5, sc,
lpResProp->Value.MVszA.cValues, lpResProp->ulPropTag,
lpResProp->Value.MVszA.lppszA[0], sc==S_OK?lpResProp->Value.MVszA.lppszA[0]:NULL, ulCount);
sc==S_OK?lpResProp->Value.MVszA.lppszA[0]:NULL,
sc==S_OK?lpResProp->Value.MVszA.lppszA[0]:NULL, ulCount);
memcpy(buffer2, buffer, sizeof(buffer));
@ -834,17 +835,18 @@ static void test_ScCopyRelocProps(void)
ok(sc == S_OK && lpResProp->ulPropTag == pvProp.ulPropTag &&
lpResProp->Value.MVszA.cValues == 1 &&
lpResProp->Value.MVszA.lppszA[0] == buffer2 + sizeof(SPropValue) + sizeof(char*) &&
!strcmp(lpResProp->Value.MVszA.lppszA[0], szTestA) &&
/* Native has a bug whereby it calculates the size correctly when copying
* but when relocating does not (presumably it uses UlPropSize() which
* ignores multivalue pointers). Wine returns the correct value.
*/
(ulCount == sizeof(SPropValue) + sizeof(char*) + 5 || ulCount == sizeof(SPropValue) + 5),
(ulCount == sizeof(SPropValue) + sizeof(char*) + 5 || ulCount == sizeof(SPropValue) + 5) &&
!strcmp(lpResProp->Value.MVszA.lppszA[0], szTestA),
"RelocProps(str): Expected 0 {1,%lx,%p,%s} %d got 0x%08lx {%ld,%lx,%p,%s} %ld\n",
pvProp.ulPropTag, buffer2 + sizeof(SPropValue) + sizeof(char*),
szTestA, sizeof(SPropValue) + sizeof(char*) + 5, sc,
lpResProp->Value.MVszA.cValues, lpResProp->ulPropTag,
lpResProp->Value.MVszA.lppszA[0], sc==S_OK?lpResProp->Value.MVszA.lppszA[0]:NULL, ulCount);
sc==S_OK?lpResProp->Value.MVszA.lppszA[0]:NULL,
sc==S_OK?lpResProp->Value.MVszA.lppszA[0]:NULL, ulCount);
/* Native crashes with lpNew or lpOld set to NULL so skip testing this */
}