reg: Allow switches to be uppercase or lowercase.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Hugh McMaster 2017-12-05 11:25:19 +00:00 committed by Alexandre Julliard
parent 1818267639
commit a0a12d9f41
2 changed files with 15 additions and 7 deletions

View File

@ -890,12 +890,20 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long
return TRUE;
}
static BOOL is_help_switch(const WCHAR *s)
static BOOL is_switch(const WCHAR *s, const WCHAR c)
{
if (strlenW(s) > 2)
return FALSE;
if ((s[0] == '/' || s[0] == '-') && (s[1] == 'h' || s[1] == '?'))
if ((s[0] == '/' || s[0] == '-') && (s[1] == c || s[1] == toupperW(c)))
return TRUE;
return FALSE;
}
static BOOL is_help_switch(const WCHAR *s)
{
if (is_switch(s, '?') || is_switch(s, 'h'))
return TRUE;
return FALSE;

View File

@ -231,7 +231,7 @@ static void test_add(void)
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
run_reg_exe("reg add -H", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
@ -618,7 +618,7 @@ static void test_delete(void)
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
run_reg_exe("reg delete -H", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
add_value(hkey, "foo", REG_DWORD, &deadbeef, sizeof(deadbeef));
@ -676,7 +676,7 @@ static void test_query(void)
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
run_reg_exe("reg query -H", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
/* Create a test key */
add_key(HKEY_CURRENT_USER, KEY_BASE, &key);
@ -870,7 +870,7 @@ static void test_import(void)
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
run_reg_exe("reg import -H", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
run_reg_exe("reg import missing.reg", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
@ -4419,7 +4419,7 @@ static void test_export(void)
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
run_reg_exe("reg export -H", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
run_reg_exe("reg export \\\\remote-pc\\HKLM\\Wine file.reg", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);