Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 71 ++++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 21 deletions(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index fdd09c885bc..3ac4ca800dd 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -404,6 +404,16 @@ static void test_reg_none(void)
add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
+ run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_NONE /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg(hkey, NULL, REG_NONE, "\0", 2, 0); + + todo_wine delete_value(hkey, NULL); + + run_reg_exe("reg add HKCU\" KEY_BASE " /ve /t REG_NONE /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); + verify_reg(hkey, NULL, REG_NONE, "\0", 2, 0); + run_reg_exe("reg add HKCU\" KEY_BASE " /v none0 /d deadbeef /t REG_NONE /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg(hkey, "none0", REG_NONE, "d\0e\0a\0d\0b\0e\0e\0f\0\0", 18, 0); @@ -412,10 +422,6 @@ static void test_reg_none(void) ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, "none1", REG_NONE, "\0", 2, 0);
- run_reg_exe("reg add HKCU\" KEY_BASE " /ve /t REG_NONE /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, NULL, REG_NONE, "\0", 2, 0); - close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -427,6 +433,10 @@ static void test_reg_sz(void)
add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
+ run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_SZ /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); + todo_wine verify_reg(hkey, NULL, REG_SZ, "", 1, 0); + run_reg_exe("reg add HKCU\" KEY_BASE " /d WineTest /f", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), "got exit code %d, expected 0\n", r); @@ -501,6 +511,16 @@ static void test_reg_expand_sz(void)
add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
+ run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_EXPAND_SZ /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); + todo_wine verify_reg(hkey, NULL, REG_EXPAND_SZ, "", 1, 0); + + todo_wine delete_value(hkey, NULL); + + run_reg_exe("reg add HKCU\" KEY_BASE " /ve /t REG_EXPAND_SZ /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); + verify_reg(hkey, NULL, REG_EXPAND_SZ, "", 1, 0); + run_reg_exe("reg add HKCU\" KEY_BASE " /v expand0 /t REG_EXpand_sz /d "dead%PATH%beef" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, 0); @@ -521,10 +541,6 @@ static void test_reg_expand_sz(void) ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, 0);
- run_reg_exe("reg add HKCU\" KEY_BASE " /ve /t REG_EXPAND_SZ /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, NULL, REG_EXPAND_SZ, "", 1, 0); - close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -538,15 +554,25 @@ static void test_reg_binary(void)
add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
- run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_BINARY /v bin0 /f", &r); + run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_BINARY /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "bin0", REG_BINARY, buffer, 0, 0); + todo_wine verify_reg(hkey, NULL, REG_BINARY, buffer, 0, 0); + + todo_wine delete_value(hkey, NULL); + + run_reg_exe("reg add HKCU\" KEY_BASE " /ve /t REG_BINARY /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); + verify_reg(hkey, NULL, REG_BINARY, buffer, 0, 0);
run_reg_exe("reg add HKEY_CURRENT_USER\" KEY_BASE " /ve /t REG_BINARY /d deadbeef /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); dword = 0xefbeadde; verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), 0);
+ run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_BINARY /v bin0 /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); + verify_reg(hkey, "bin0", REG_BINARY, buffer, 0, 0); + run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_BINARY /v bin1 /f /d 0xDeAdBeEf", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
@@ -579,10 +605,6 @@ static void test_reg_binary(void) run_reg_exe("reg add HKCU\" KEY_BASE " /v bin6 /t REG_BINARY /f /d", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
- run_reg_exe("reg add HKCU\" KEY_BASE " /ve /t REG_BINARY /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, NULL, REG_BINARY, buffer, 0, 0); - close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -604,6 +626,9 @@ static void test_reg_dword(void) else win_skip("broken reg.exe detected\n");
+ run_reg_exe("reg add HKCU\" KEY_BASE " /ve /t REG_DWORD /f", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r); + run_reg_exe("reg add HKCU\" KEY_BASE " /v dword0 /t REG_DWORD /f /d", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
@@ -667,9 +692,6 @@ static void test_reg_dword(void) run_reg_exe("reg add HKCU\" KEY_BASE " /v dword15 /t REG_DWORD /d 4294967296 /f", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r);
- run_reg_exe("reg add HKCU\" KEY_BASE " /ve /t REG_DWORD /f", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r); - /* REG_DWORD_LITTLE_ENDIAN */ run_reg_exe("reg add HKCU\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -705,6 +727,17 @@ static void test_reg_multi_sz(void)
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 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); + 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); @@ -786,10 +819,6 @@ static void test_reg_multi_sz(void) ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, "multi21", REG_MULTI_SZ, "two\0\0strings\0", 16, 0);
- 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); - close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); }
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- 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);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 43 ++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index d2d09e79ce6..f6a4a7fe576 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -698,22 +698,38 @@ static void test_reg_dword(void) dword = 456; verify_reg(hkey, "DWORD_LE", REG_DWORD_LITTLE_ENDIAN, &dword, sizeof(dword), 0);
- /* REG_DWORD_BIG_ENDIAN */ - run_reg_exe("reg add HKCU\" KEY_BASE " /v DWORD_BE /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - dword = 456; - verify_reg(hkey, "DWORD_BE", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0); - /* REG_DWORD_BIG_ENDIAN is broken in every version of windows. It behaves like - * an ordinary REG_DWORD - that is little endian. GG */ - - run_reg_exe("reg add HKCU\" KEY_BASE " /v DWORD_BE2 /t REG_DWORD_BIG_ENDIAN /f /d", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); + close_key(hkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE); +}
- run_reg_exe("reg add HKCU\" KEY_BASE " /v DWORD_BE3 /t REG_DWORD_BIG_ENDIAN /f", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r); +/* REG_DWORD_BIG_ENDIAN is broken in every version of Windows. It behaves + * like an ordinary REG_DWORD, which is little endian. + */ +static void test_reg_dword_big_endian(void) +{ + HKEY hkey; + DWORD r, dword;
run_reg_exe("reg add HKCU\" KEY_BASE " /ve /t REG_DWORD_BIG_ENDIAN /f", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 1\n", r); + + run_reg_exe("reg add HKCU\" KEY_BASE " /v Test1 /t REG_DWORD_BIG_ENDIAN /f /d", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg add HKCU\" KEY_BASE " /v Test2 /t REG_DWORD_BIG_ENDIAN /f", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 1\n", r); + + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + + run_reg_exe("reg add HKCU\" KEY_BASE " /v Test3 /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 456; + verify_reg(hkey, "Test3", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0); + + run_reg_exe("reg add HKCU\" KEY_BASE " /v Test4 /t REG_DWORD_BIG_ENDIAN /d 0x456 /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x456; + verify_reg(hkey, "Test4", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0);
close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); @@ -835,5 +851,6 @@ START_TEST(add) test_reg_expand_sz(); test_reg_binary(); test_reg_dword(); + test_reg_dword_big_endian(); test_reg_multi_sz(); }
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index f6a4a7fe576..6090b587f92 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -673,7 +673,7 @@ static void test_reg_dword(void) run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_DWORD /v dword10 /f /d -0x1", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r);
- run_reg_exe("reg add HKCU\" KEY_BASE " /v dword8 /t REG_dword /d 0x01ffffffff /f", &r); + run_reg_exe("reg add HKCU\" KEY_BASE " /v dword11 /t REG_dword /d 0x01ffffffff /f", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 1\n", r);
run_reg_exe("reg add HKCU\" KEY_BASE " /v dword12 /t REG_DWORD /d 0xffffffff /f", &r);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index 6090b587f92..78519565b22 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -692,6 +692,16 @@ static void test_reg_dword(void) run_reg_exe("reg add HKCU\" KEY_BASE " /v dword15 /t REG_DWORD /d 4294967296 /f", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r);
+ run_reg_exe("reg add HKCU\" KEY_BASE " /v dword16 /t REG_DWORD /d 456 /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 456; + verify_reg(hkey, "dword16", REG_DWORD, &dword, sizeof(dword), 0); + + run_reg_exe("reg add HKCU\" KEY_BASE " /v dword17 /t REG_DWORD /d 0x456 /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x456; + verify_reg(hkey, "dword17", REG_DWORD, &dword, sizeof(dword), 0); + /* REG_DWORD_LITTLE_ENDIAN */ run_reg_exe("reg add HKCU\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/tests/add.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/programs/reg/tests/add.c b/programs/reg/tests/add.c index 78519565b22..23d0115fd64 100644 --- a/programs/reg/tests/add.c +++ b/programs/reg/tests/add.c @@ -57,18 +57,18 @@ void verify_reg_(const char *file, unsigned line, HKEY hkey, const char *value, size = sizeof(data); memset(data, 0xdd, size); err = RegQueryValueExA(hkey, value, NULL, &type, data, &size); - lok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err); + lok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got error %d\n", err); if (err != ERROR_SUCCESS) return;
todo_wine_if (todo & TODO_REG_TYPE) - lok(type == exp_type, "got wrong type %d, expected %d\n", type, exp_type); + lok(type == exp_type, "got registry type %d, expected %d\n", type, exp_type); todo_wine_if (todo & TODO_REG_SIZE) - lok(size == exp_size, "got wrong size %d, expected %d\n", size, exp_size); + lok(size == exp_size, "got data size %d, expected %d\n", size, exp_size); if (exp_data) { todo_wine_if (todo & TODO_REG_DATA) - lok(memcmp(data, exp_data, size) == 0, "got wrong data\n"); + lok(memcmp(data, exp_data, size) == 0, "registry data does not match\n"); } }
@@ -87,7 +87,7 @@ void open_key_(const char *file, unsigned line, const HKEY base, const char *pat LONG err;
err = RegOpenKeyExA(base, path, 0, KEY_READ|sam, hkey); - lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: %d\n", err); + lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: got error %d\n", err); }
void close_key_(const char *file, unsigned line, HKEY hkey) @@ -95,7 +95,7 @@ void close_key_(const char *file, unsigned line, HKEY hkey) LONG err;
err = RegCloseKey(hkey); - lok(err == ERROR_SUCCESS, "RegCloseKey failed: %d\n", err); + lok(err == ERROR_SUCCESS, "RegCloseKey failed: got error %d\n", err); }
void verify_key_(const char *file, unsigned line, HKEY key_base, const char *subkey) @@ -104,7 +104,7 @@ void verify_key_(const char *file, unsigned line, HKEY key_base, const char *sub LONG err;
err = RegOpenKeyExA(key_base, subkey, 0, KEY_READ, &hkey); - lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: got %d\n", err); + lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: got error %d\n", err);
if (hkey) RegCloseKey(hkey); @@ -130,7 +130,7 @@ void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path
err = RegCreateKeyExA(hkey, path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ|KEY_WRITE, NULL, &new_key, NULL); - lok(err == ERROR_SUCCESS, "RegCreateKeyExA failed: %d\n", err); + lok(err == ERROR_SUCCESS, "RegCreateKeyExA failed: got error %d\n", err);
if (subkey) *subkey = new_key; @@ -145,7 +145,7 @@ void delete_key_(const char *file, unsigned line, const HKEY hkey, const char *p LONG err;
err = RegDeleteKeyA(hkey, path); - lok(err == ERROR_SUCCESS, "RegDeleteKeyA failed: %d\n", err); + lok(err == ERROR_SUCCESS, "RegDeleteKeyA failed: got error %d\n", err); } }
@@ -197,7 +197,7 @@ void add_value_(const char *file, unsigned line, HKEY hkey, const char *name, LONG err;
err = RegSetValueExA(hkey, name, 0, type, (const BYTE *)data, size); - lok(err == ERROR_SUCCESS, "RegSetValueExA failed: %d\n", err); + lok(err == ERROR_SUCCESS, "RegSetValueExA failed: got error %d\n", err); }
void delete_value_(const char *file, unsigned line, const HKEY hkey, const char *name) @@ -205,7 +205,7 @@ void delete_value_(const char *file, unsigned line, const HKEY hkey, const char LONG err;
err = RegDeleteValueA(hkey, name); - lok(err == ERROR_SUCCESS, "RegDeleteValueA failed: %d\n", err); + lok(err == ERROR_SUCCESS, "RegDeleteValueA failed: got error %d\n", err); }
/* Unit tests */
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/add.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/programs/reg/add.c b/programs/reg/add.c index db909167f30..c3dec2d5b7f 100644 --- a/programs/reg/add.c +++ b/programs/reg/add.c @@ -48,11 +48,12 @@ static inline BYTE hexchar_to_byte(WCHAR ch) return -1; }
-static LPBYTE get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator, DWORD *reg_count) +static BYTE *get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator, DWORD *size_bytes) { static const WCHAR empty; LPBYTE out_data = NULL; - *reg_count = 0; + + *size_bytes = 0;
if (!data) data = ∅
@@ -62,8 +63,8 @@ static LPBYTE get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator, DW case REG_SZ: case REG_EXPAND_SZ: { - *reg_count = (lstrlenW(data) + 1) * sizeof(WCHAR); - out_data = malloc(*reg_count); + *size_bytes = (lstrlenW(data) + 1) * sizeof(WCHAR); + out_data = malloc(*size_bytes); lstrcpyW((LPWSTR)out_data,data); break; } @@ -78,8 +79,8 @@ static LPBYTE get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator, DW output_message(STRING_MISSING_INTEGER); break; } - *reg_count = sizeof(DWORD); - out_data = malloc(*reg_count); + *size_bytes = sizeof(DWORD); + out_data = malloc(*size_bytes); ((LPDWORD)out_data)[0] = val; break; } @@ -87,8 +88,8 @@ static LPBYTE get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator, DW { BYTE hex0, hex1; int i = 0, destByteIndex = 0, datalen = lstrlenW(data); - *reg_count = ((datalen + datalen % 2) / 2) * sizeof(BYTE); - out_data = malloc(*reg_count); + *size_bytes = ((datalen + datalen % 2) / 2) * sizeof(BYTE); + out_data = malloc(*size_bytes); if(datalen % 2) { hex1 = hexchar_to_byte(data[i++]); @@ -139,7 +140,7 @@ static LPBYTE get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator, DW buffer[destindex] = 0; if (destindex && buffer[destindex - 1]) buffer[++destindex] = 0; - *reg_count = (destindex + 1) * sizeof(WCHAR); + *size_bytes = (destindex + 1) * sizeof(WCHAR); return (BYTE *)buffer; } default: @@ -164,7 +165,7 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, if (value_name || value_empty || data) { DWORD reg_type; - DWORD reg_count = 0; + DWORD data_size = 0; BYTE* reg_data = NULL;
if (!force) @@ -194,13 +195,13 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, return 1; }
- if (!(reg_data = get_regdata(data, reg_type, separator, ®_count))) + if (!(reg_data = get_regdata(data, reg_type, separator, &data_size))) { RegCloseKey(hkey); return 1; }
- RegSetValueExW(hkey, value_name, 0, reg_type, reg_data, reg_count); + RegSetValueExW(hkey, value_name, 0, reg_type, reg_data, data_size); free(reg_data); }