Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/reg/reg.c | 7 +++++-- programs/reg/reg.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 3ffc5fe3d8f..a31ce2be743 100644 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -174,7 +174,7 @@ HKEY path_get_rootkey(const WCHAR *path) return NULL; }
-static BOOL sane_path(const WCHAR *key) +static BOOL sane_path(WCHAR *key) { unsigned int i = lstrlenW(key);
@@ -190,6 +190,9 @@ static BOOL sane_path(const WCHAR *key) return FALSE; }
+ if (key[i - 1] == '\') + key[i - 1] = 0; + return TRUE; }
@@ -229,7 +232,7 @@ WCHAR *get_long_key(HKEY root, WCHAR *path) return long_key; }
-BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path) +BOOL parse_registry_key(WCHAR *key, HKEY *root, WCHAR **path) { if (!sane_path(key)) return FALSE; diff --git a/programs/reg/reg.h b/programs/reg/reg.h index c71ae2445e9..20196cf4a72 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -40,7 +40,7 @@ BOOL ask_confirm(unsigned int msgid, WCHAR *reg_info); HKEY path_get_rootkey(const WCHAR *path); WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len); WCHAR *get_long_key(HKEY root, WCHAR *path); -BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path); +BOOL parse_registry_key(WCHAR *key, HKEY *root, WCHAR **path); BOOL is_char(const WCHAR s, const WCHAR c); BOOL is_switch(const WCHAR *s, const WCHAR c);