Hugh McMaster : reg/tests: Use string literals instead of a char buffer for REG_MULTI_SZ tests.
Alexandre Julliard
julliard at winehq.org
Fri Apr 30 16:03:28 CDT 2021
Module: wine
Branch: master
Commit: 1110421da93ebd6cc2648008fed874a49b8bbf28
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1110421da93ebd6cc2648008fed874a49b8bbf28
Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date: Fri Apr 30 22:39:44 2021 +1000
reg/tests: Use string literals instead of a char buffer for REG_MULTI_SZ tests.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/reg/tests/add.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c
index 3ac4ca800dd..d2d09e79ce6 100644
--- a/programs/reg/tests/add.c
+++ b/programs/reg/tests/add.c
@@ -723,37 +723,34 @@ static void test_reg_multi_sz(void)
{
HKEY hkey;
DWORD r;
- char buffer[22];
add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
- buffer[0] = 0;
- todo_wine verify_reg(hkey, NULL, REG_MULTI_SZ, buffer, 1, 0);
+ todo_wine verify_reg(hkey, NULL, REG_MULTI_SZ, "", 1, 0);
todo_wine delete_value(hkey, NULL);
run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_MULTI_SZ /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
- verify_reg(hkey, NULL, REG_MULTI_SZ, buffer, 1, 0);
+ verify_reg(hkey, NULL, REG_MULTI_SZ, "", 1, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
- memcpy(buffer, "three\0little\0strings\0", 22);
- verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, 0);
+ verify_reg(hkey, "multi0", REG_MULTI_SZ, "three\0little\0strings\0", 22, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi1 /s \"#\" /d \"three#little#strings\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
- verify_reg(hkey, "multi1", REG_MULTI_SZ, buffer, 22, 0);
+ verify_reg(hkey, "multi1", REG_MULTI_SZ, "three\0little\0strings\0", 22, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi2 /d \"\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
- verify_reg(hkey, "multi2", REG_MULTI_SZ, &buffer[21], 1, 0);
+ verify_reg(hkey, "multi2", REG_MULTI_SZ, "", 1, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
- verify_reg(hkey, "multi3", REG_MULTI_SZ, &buffer[21], 1, 0);
+ verify_reg(hkey, "multi3", REG_MULTI_SZ, "", 1, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
@@ -779,8 +776,7 @@ static void test_reg_multi_sz(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi11 /s \"#\" /d \"a#\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
- buffer[0]='a'; buffer[1]=0; buffer[2]=0;
- verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, 0);
+ verify_reg(hkey, "multi11", REG_MULTI_SZ, "a\0", 3, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi12 /t REG_MULTI_SZ /f /d", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
@@ -793,19 +789,18 @@ static void test_reg_multi_sz(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi15 /t REG_MULTI_SZ /d \"a\\0\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
- verify_reg(hkey, "multi15", REG_MULTI_SZ, buffer, 3, 0);
+ verify_reg(hkey, "multi15", REG_MULTI_SZ, "a\0", 3, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi16 /d \"two\\0\\0strings\" /f", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi17 /t REG_MULTI_SZ /s \"#\" /d \"#\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
- buffer[0] = 0; buffer[1] = 0;
- verify_reg(hkey, "multi17", REG_MULTI_SZ, buffer, 2, 0);
+ verify_reg(hkey, "multi17", REG_MULTI_SZ, "\0", 2, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi18 /t REG_MULTI_SZ /d \"\\0\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
- verify_reg(hkey, "multi18", REG_MULTI_SZ, buffer, 2, 0);
+ verify_reg(hkey, "multi18", REG_MULTI_SZ, "\0", 2, 0);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi19 /t REG_MULTI_SZ /s \"#\" /d \"two\\0#strings\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
More information about the wine-cvs
mailing list