[PATCH 04/13] reg: Print a more informative error message if the system key is invalid
Hugh McMaster
hugh.mcmaster at outlook.com
Sun Dec 3 00:50:12 CST 2017
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
programs/reg/reg.c | 9 +++---
programs/reg/reg.rc | 1 +
programs/reg/resource.h | 73 +++++++++++++++++++++++++------------------------
3 files changed, 43 insertions(+), 40 deletions(-)
diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index a65bfc8d05..e26928470e 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -878,16 +878,17 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long
if (!sane_path(key))
return FALSE;
+ *path = strchrW(key, '\\');
+ if (*path) (*path)++;
+
*root = path_get_rootkey(key);
if (!*root)
{
- output_message(STRING_INVALID_KEY);
+ if (*path) *(*path - 1) = 0;
+ output_message(STRING_INVALID_SYSTEM_KEY, key);
return FALSE;
}
- *path = strchrW(key, '\\');
- if (*path) (*path)++;
-
*long_key = get_long_key(*root, *path);
return TRUE;
diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc
index 1647e222fa..2ac0b22809 100644
--- a/programs/reg/reg.rc
+++ b/programs/reg/reg.rc
@@ -67,4 +67,5 @@ STRINGTABLE
STRING_OPEN_KEY_FAILED, "reg: Unable to open the registry key '%1'.\n"
STRING_ESCAPE_SEQUENCE, "reg: Unrecognized escape sequence [\\%1!c!]\n"
STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n"
+ STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n"
}
diff --git a/programs/reg/resource.h b/programs/reg/resource.h
index 8441638657..aef2ca9738 100644
--- a/programs/reg/resource.h
+++ b/programs/reg/resource.h
@@ -21,39 +21,40 @@
#include <windef.h>
/* Translation IDs. */
-#define STRING_USAGE 101
-#define STRING_ADD_USAGE 102
-#define STRING_DELETE_USAGE 103
-#define STRING_QUERY_USAGE 104
-#define STRING_SUCCESS 105
-#define STRING_INVALID_KEY 106
-#define STRING_INVALID_CMDLINE 107
-#define STRING_NO_REMOTE 108
-#define STRING_CANNOT_FIND 109
-#define STRING_UNSUPPORTED_TYPE 110
-#define STRING_MISSING_INTEGER 111
-#define STRING_MISSING_HEXDATA 112
-#define STRING_UNHANDLED_TYPE 113
-#define STRING_OVERWRITE_VALUE 114
-#define STRING_YESNO 115
-#define STRING_YES 116
-#define STRING_NO 117
-#define STRING_CANCELLED 118
-#define STRING_DEFAULT_VALUE 119
-#define STRING_DELETE_VALUE 120
-#define STRING_DELETE_VALUEALL 121
-#define STRING_DELETE_SUBKEY 122
-#define STRING_INVALID_STRING 123
-#define STRING_VALUEALL_FAILED 124
-#define STRING_GENERAL_FAILURE 125
-#define STRING_MATCHES_FOUND 126
-#define STRING_INVALID_SYNTAX 127
-#define STRING_INVALID_OPTION 128
-#define STRING_REG_HELP 129
-#define STRING_FUNC_HELP 130
-#define STRING_VALUE_NOT_SET 131
-#define STRING_IMPORT_USAGE 132
-#define STRING_FILE_NOT_FOUND 133
-#define STRING_OPEN_KEY_FAILED 134
-#define STRING_ESCAPE_SEQUENCE 135
-#define STRING_EXPORT_USAGE 136
+#define STRING_USAGE 101
+#define STRING_ADD_USAGE 102
+#define STRING_DELETE_USAGE 103
+#define STRING_QUERY_USAGE 104
+#define STRING_SUCCESS 105
+#define STRING_INVALID_KEY 106
+#define STRING_INVALID_CMDLINE 107
+#define STRING_NO_REMOTE 108
+#define STRING_CANNOT_FIND 109
+#define STRING_UNSUPPORTED_TYPE 110
+#define STRING_MISSING_INTEGER 111
+#define STRING_MISSING_HEXDATA 112
+#define STRING_UNHANDLED_TYPE 113
+#define STRING_OVERWRITE_VALUE 114
+#define STRING_YESNO 115
+#define STRING_YES 116
+#define STRING_NO 117
+#define STRING_CANCELLED 118
+#define STRING_DEFAULT_VALUE 119
+#define STRING_DELETE_VALUE 120
+#define STRING_DELETE_VALUEALL 121
+#define STRING_DELETE_SUBKEY 122
+#define STRING_INVALID_STRING 123
+#define STRING_VALUEALL_FAILED 124
+#define STRING_GENERAL_FAILURE 125
+#define STRING_MATCHES_FOUND 126
+#define STRING_INVALID_SYNTAX 127
+#define STRING_INVALID_OPTION 128
+#define STRING_REG_HELP 129
+#define STRING_FUNC_HELP 130
+#define STRING_VALUE_NOT_SET 131
+#define STRING_IMPORT_USAGE 132
+#define STRING_FILE_NOT_FOUND 133
+#define STRING_OPEN_KEY_FAILED 134
+#define STRING_ESCAPE_SEQUENCE 135
+#define STRING_EXPORT_USAGE 136
+#define STRING_INVALID_SYSTEM_KEY 137
--
2.15.0
More information about the wine-devel
mailing list