From 506d4fd052aeb2d877c74110337a4b58068d94dc Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Tue, 4 Jul 2017 12:45:51 +0000 Subject: [PATCH] regedit/tests: Test whether registry keys ending with trailing backslashes are imported and created. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard --- programs/regedit/tests/regedit.c | 41 +++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c index e85e2a7a7e2..b6f1a2eccaa 100644 --- a/programs/regedit/tests/regedit.c +++ b/programs/regedit/tests/regedit.c @@ -1488,7 +1488,7 @@ static void test_import_with_whitespace(void) static void test_key_creation_and_deletion(void) { - HKEY hkey; + HKEY hkey, subkey; LONG lr; exec_import_str("REGEDIT4\n\n" @@ -1526,6 +1526,45 @@ static void test_key_creation_and_deletion(void) lr = RegDeleteKeyA(hkey, "Subkey1d\t"); ok(lr == ERROR_SUCCESS, "got %d, expected 0\n", lr); + exec_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1e\\]\n" + "\"Wine\"=\"Test value\"\n\n"); + verify_key(hkey, "Subkey1e\\"); + verify_key(hkey, "Subkey1e"); + lr = RegOpenKeyExA(hkey, "Subkey1e", 0, KEY_READ, &subkey); + ok(lr == ERROR_SUCCESS, "RegOpenKeyExA failed: got %u, expected 0\n", lr); + verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); + RegCloseKey(subkey); + lr = RegDeleteKeyA(hkey, "Subkey1e"); + ok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: got %u, expected 0\n", lr); + + exec_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1f\\\\]\n" + "\"Wine\"=\"Test value\"\n\n"); + verify_key(hkey, "Subkey1f\\\\"); + verify_key(hkey, "Subkey1f\\"); + verify_key(hkey, "Subkey1f"); + lr = RegOpenKeyExA(hkey, "Subkey1f\\\\", 0, KEY_READ, &subkey); + ok(lr == ERROR_SUCCESS, "RegOpenKeyExA failed: got %u, expected 0\n", lr); + verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); + RegCloseKey(subkey); + lr = RegDeleteKeyA(hkey, "Subkey1f\\\\"); + ok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: got %u, expected 0\n", lr); + + exec_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1g\\\\\\\\]\n" + "\"Wine\"=\"Test value\"\n\n"); + verify_key(hkey, "Subkey1g\\\\\\\\"); + verify_key(hkey, "Subkey1g\\\\"); + verify_key(hkey, "Subkey1g\\"); + verify_key(hkey, "Subkey1g"); + lr = RegOpenKeyExA(hkey, "Subkey1g\\\\", 0, KEY_READ, &subkey); + ok(lr == ERROR_SUCCESS, "RegOpenKeyExA failed: got %u, expected 0\n", lr); + verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); + RegCloseKey(subkey); + lr = RegDeleteKeyA(hkey, "Subkey1g\\\\"); + ok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: got %u, expected 0\n", lr); + /* Test key deletion. We start by creating some registry keys. */ exec_import_str("REGEDIT4\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"