Skip to content
Snippets Groups Projects
Commit 4a22ba5b authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard
Browse files

reg: Parse the registry key using a helper function.

parent 16a64e99
No related branches found
No related tags found
No related merge requests found
......@@ -818,6 +818,24 @@ static int reg_query(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name,
return ret;
}
static BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
{
if (!sane_path(key))
return FALSE;
*root = path_get_rootkey(key);
if (!*root)
{
output_message(STRING_INVALID_KEY);
return FALSE;
}
*path = strchrW(key, '\\');
if (*path) (*path)++;
return TRUE;
}
static BOOL is_help_switch(const WCHAR *s)
{
if (strlenW(s) > 2)
......@@ -906,20 +924,10 @@ int wmain(int argc, WCHAR *argvW[])
return 0;
}
key_name = argvW[2];
if (!sane_path(key_name))
return 1;
root = path_get_rootkey(key_name);
if (!root)
{
output_message(STRING_INVALID_KEY);
if (!parse_registry_key(argvW[2], &root, &path))
return 1;
}
path = strchrW(key_name, '\\');
if (path) path++;
key_name = argvW[2];
for (i = 3; i < argc; i++)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment