From 94b582b1a68cd07676618144537465bdf21d1847 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Fri, 30 Apr 2021 22:39:45 +1000 Subject: [PATCH] reg/tests: Split the REG_DWORD_BIG_ENDIAN tests from the REG_DWORD tests. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard --- 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 */ + close_key(hkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE); +} - 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); - - 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(); }