[PATCH v2 0/1] MR8296: msi/tests: Fix wrong character count for RegSetValueExA.
-- v2: msi/tests: Fix wrong character counts passed to RegSetValueExA. https://gitlab.winehq.org/wine/wine/-/merge_requests/8296
From: Yuxuan Shui <yshui(a)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 */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8296
updated to account for more such cases. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8296#note_106366
This could use a helper that takes char* and uses strlen to set the length correctly. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8296#note_106367
Right, a helper would be better or using sizeof on these static strings. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8296#note_106470
participants (4)
-
Hans Leidekker (@hans) -
Nikolay Sivov (@nsivov) -
Yuxuan Shui -
Yuxuan Shui (@yshui)