-- v2: msi/tests: Fix wrong character counts passed to RegSetValueExA.
From: Yuxuan Shui yshui@codeweavers.com
--- dlls/msi/tests/msi.c | 2 +- dlls/msi/tests/source.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index c98293507e2..191f8fca292 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -1615,7 +1615,7 @@ static void test_MsiQueryFeatureState(void) ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", error);
- res = RegSetValueExA(userkey, "feature", 0, REG_SZ, (const BYTE *)"", 2); + res = RegSetValueExA(userkey, "feature", 0, REG_SZ, (const BYTE *)"", 1); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
/* feature value exists */ diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c index 0f6967cde22..dc319f4c5e6 100644 --- a/dlls/msi/tests/source.c +++ b/dlls/msi/tests/source.c @@ -2656,7 +2656,7 @@ static void test_MsiSourceListEnumMediaDisks(void) ok(!lstrcmpA(prompt, "bbb"), "Expected "bbb", got "%s"\n", prompt); ok(promptsz == 6, "Expected 6, got %lu\n", promptsz);
- res = RegSetValueExA(media, "1", 0, REG_SZ, (LPBYTE)"label", 13); + res = RegSetValueExA(media, "1", 0, REG_SZ, (LPBYTE)"label", 6); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
/* no semicolon */ @@ -2674,7 +2674,7 @@ static void test_MsiSourceListEnumMediaDisks(void) ok(!lstrcmpA(prompt, "label"), "Expected "label", got "%s"\n", prompt); ok(promptsz == 5, "Expected 5, got %lu\n", promptsz);
- res = RegSetValueExA(media, "1", 0, REG_SZ, (LPBYTE)"label;", 13); + res = RegSetValueExA(media, "1", 0, REG_SZ, (LPBYTE)"label;", 7); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
/* semicolon, no disk prompt */ @@ -2692,7 +2692,7 @@ static void test_MsiSourceListEnumMediaDisks(void) ok(!lstrcmpA(prompt, ""), "Expected "", got "%s"\n", prompt); ok(promptsz == 0, "Expected 0, got %lu\n", promptsz);
- res = RegSetValueExA(media, "1", 0, REG_SZ, (LPBYTE)";prompt", 13); + res = RegSetValueExA(media, "1", 0, REG_SZ, (LPBYTE)";prompt", 8); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
/* semicolon, label doesn't exist */ @@ -2710,7 +2710,7 @@ static void test_MsiSourceListEnumMediaDisks(void) ok(!lstrcmpA(prompt, "prompt"), "Expected "prompt", got "%s"\n", prompt); ok(promptsz == 6, "Expected 6, got %lu\n", promptsz);
- res = RegSetValueExA(media, "1", 0, REG_SZ, (LPBYTE)";", 13); + res = RegSetValueExA(media, "1", 0, REG_SZ, (LPBYTE)";", 2); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
/* semicolon, neither label nor disk prompt exist */
updated to account for more such cases.
This could use a helper that takes char* and uses strlen to set the length correctly.
Right, a helper would be better or using sizeof on these static strings.