Module: wine Branch: master Commit: c3a46653e1e91e5922a77470eba9619df911c1d4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c3a46653e1e91e5922a77470eb...
Author: Hugh McMaster hugh.mcmaster@outlook.com Date: Fri Feb 24 11:34:02 2017 +0000
reg/tests: Test import with non-standard registry file headers.
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
programs/reg/tests/reg.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 8786b0f..7c79b31 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -875,6 +875,84 @@ static void test_import(void) err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
+ test_import_str("REGEDIT3\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test1"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test1"); + + test_import_str("regedit4\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test2"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test2"); + + test_import_str("Regedit4\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test3"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test3"); + + test_import_str("REGEDIT 4\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test4"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test4"); + + test_import_str("REGEDIT4FOO\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test5"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test5"); + + test_import_str("REGEDIT4 FOO\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test6"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test6"); + + test_import_str("REGEDIT5\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test7"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test7"); + + test_import_str("REGEDIT9\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test8"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test8"); + + test_import_str("Windows Registry Editor Version 4.00\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test9"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test9"); + + test_import_str("Windows Registry Editor Version 5\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test10"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test10"); + + test_import_str("WINDOWS REGISTRY EDITOR VERSION 5.00\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test11"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test11"); + + test_import_str("Windows Registry Editor version 5.00\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test12"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test12"); + test_import_str("REGEDIT4\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n" ""Test1"="Value1"\n", &r); @@ -1159,6 +1237,56 @@ static void test_import(void) err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
+ test_import_wstr("\xef\xbb\xbfREGEDIT3\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test1"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test1"); + + test_import_wstr("\xef\xbb\xbfregedit4\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test2"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test2"); + + test_import_wstr("\xef\xbb\xbfRegedit4\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test3"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test3"); + + test_import_wstr("\xef\xbb\xbfREGEDIT 4\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test4"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test4"); + + test_import_wstr("\xef\xbb\xbfREGEDIT4FOO\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test5"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test5"); + + test_import_wstr("\xef\xbb\xbfREGEDIT4 FOO\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test6"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test6"); + + test_import_wstr("\xef\xbb\xbfREGEDIT5\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test7"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test7"); + + test_import_wstr("\xef\xbb\xbfREGEDIT9\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test8"="Value"\n", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Test8"); + test_import_wstr("\xef\xbb\xbfREGEDIT4\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n" ""Unicode1"="Value1"\n", &r); @@ -1209,6 +1337,34 @@ static void test_import(void) ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, "got exit code %d, expected 1\n", r);
+ test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 4.00\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test9"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test9"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test10"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test10"); + + test_import_wstr("\xef\xbb\xbfWINDOWS REGISTRY EDITOR VERSION 5.00\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test11"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test11"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor version 5.00\n\n" + "[HKEY_CURRENT_USER\" KEY_BASE "]\n" + ""Test12"="Value"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + todo_wine verify_reg_nonexist(hkey, "Test12"); + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n" "[HKEY_CURRENT_USER\" KEY_BASE "]\n" ""Unicode4"="Value4"\n", &r);