Commit da5a0b76 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg/tests: Add tests for quotes and slashes in keys, values and data.

parent 061c4bce
......@@ -774,7 +774,7 @@ static void test_import(void)
char test1_reg[MAX_PATH], test2_reg[MAX_PATH];
char cmdline[MAX_PATH];
char test_string[] = "Test string";
HKEY hkey;
HKEY hkey, subkey;
LONG err;
run_reg_exe("reg import", &r);
......@@ -1082,6 +1082,39 @@ static void test_import(void)
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0);
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
"\"single'quote\"=dword:00000008\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0);
dword = 0x00000008;
todo_wine verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0);
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n"
"\"Wine\\\\31\"=\"Test value\"\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
err = RegOpenKeyExA(hkey, "Subkey\"1", 0, KEY_READ, &subkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
todo_wine verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0);
err = RegCloseKey(subkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1");
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n"
"\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
err = RegOpenKeyExA(hkey, "Subkey/2", 0, KEY_READ, &subkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
todo_wine verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0);
err = RegCloseKey(subkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2");
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
err = RegCloseKey(hkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
......@@ -1358,6 +1391,39 @@ static void test_import(void)
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
"\"single'quote\"=dword:00000008\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0);
dword = 0x00000008;
todo_wine verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n"
"\"Wine\\\\31\"=\"Test value\"\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
err = RegOpenKeyExA(hkey, "Subkey\"1", 0, KEY_READ, &subkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
todo_wine verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0);
err = RegCloseKey(subkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1");
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n"
"\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
err = RegOpenKeyExA(hkey, "Subkey/2", 0, KEY_READ, &subkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
todo_wine verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0);
err = RegCloseKey(subkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2");
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
err = RegCloseKey(hkey);
todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment