regedit: Do not create registry keys that end without a closing bracket.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-06-08 09:04:36 +00:00 committed by Alexandre Julliard
parent eca563e9ce
commit 5669282e1d
2 changed files with 4 additions and 3 deletions

View File

@ -568,6 +568,7 @@ static void processRegEntry(WCHAR* stdInput, BOOL isUnicode)
keyEnd = strrchrW(stdInput, ']');
if (keyEnd)
*keyEnd='\0';
else return;
/* delete the key if we encounter '-' at the start of reg key */
if (stdInput[0] == '-')

View File

@ -1155,7 +1155,7 @@ static void test_key_creation_and_deletion(void)
exec_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n");
todo_wine verify_key_nonexist(hkey, "No_Closing_Bracket");
verify_key_nonexist(hkey, "No_Closing_Bracket");
exec_import_str("REGEDIT4\n\n"
"[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n");
@ -1210,7 +1210,7 @@ static void test_key_creation_and_deletion(void)
ok(lr == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", lr);
lr = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
todo_wine ok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: got %d, expected 0\n", lr);
ok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: got %d, expected 0\n", lr);
}
static void test_value_deletion(void)
@ -1262,7 +1262,7 @@ static void test_value_deletion(void)
ok(lr == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", lr);
lr = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
todo_wine ok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: got %d, expected 0\n", lr);
ok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: got %d, expected 0\n", lr);
}
START_TEST(regedit)