[PATCH 5/5] reg: Allow /reg:32 and /reg:64 switches to be passed via the command line
Hugh McMaster
hugh.mcmaster at outlook.com
Mon Apr 5 08:24:14 CDT 2021
No further action is taken at this time.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44755
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
Please let me know if we should limit the display of this output to versions
defined as Windows 8 and 10, as the switches aren't available on older
versions of Windows.
programs/reg/add.c | 2 ++
programs/reg/delete.c | 2 ++
programs/reg/export.c | 2 ++
programs/reg/import.c | 21 +++++++++++++++++----
programs/reg/query.c | 2 ++
programs/reg/reg.c | 1 +
programs/reg/reg.rc | 4 ++++
programs/reg/resource.h | 1 +
8 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/programs/reg/add.c b/programs/reg/add.c
index 4b50a13b975..de22874b901 100644
--- a/programs/reg/add.c
+++ b/programs/reg/add.c
@@ -235,6 +235,8 @@ int reg_add(int argc, WCHAR *argvW[])
value_empty = TRUE;
continue;
}
+ else if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str, L"reg:64"))
+ continue;
else if (!str[0] || str[1])
goto invalid;
diff --git a/programs/reg/delete.c b/programs/reg/delete.c
index ac3c1108d70..d6fb81d1cc4 100644
--- a/programs/reg/delete.c
+++ b/programs/reg/delete.c
@@ -137,6 +137,8 @@ int reg_delete(int argc, WCHAR *argvW[])
value_empty = TRUE;
continue;
}
+ else if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str, L"reg:64"))
+ continue;
else if (!str[0] || str[1])
goto invalid;
diff --git a/programs/reg/export.c b/programs/reg/export.c
index 13d5871d57e..1e484c536fb 100644
--- a/programs/reg/export.c
+++ b/programs/reg/export.c
@@ -368,6 +368,8 @@ int reg_export(int argc, WCHAR *argvW[])
if (is_char(*str, 'y') && !str[1])
overwrite_file = TRUE;
+ else if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str, L"reg:64"))
+ continue;
else
goto invalid;
}
diff --git a/programs/reg/import.c b/programs/reg/import.c
index 223e7db0e48..b29deba58e5 100644
--- a/programs/reg/import.c
+++ b/programs/reg/import.c
@@ -978,11 +978,19 @@ int reg_import(int argc, WCHAR *argvW[])
BYTE s[2];
struct parser parser;
- if (argc > 3)
+ if (argc > 4) goto invalid;
+
+ if (argc == 4)
{
- output_message(STRING_INVALID_SYNTAX);
- output_message(STRING_FUNC_HELP, wcsupr(argvW[1]));
- return 1;
+ WCHAR *str;
+
+ if (argvW[3][0] != '/' && argvW[3][0] != '-')
+ goto invalid;
+
+ str = &argvW[3][1];
+
+ if (lstrcmpiW(str, L"reg:32") && lstrcmpiW(str, L"reg:64"))
+ goto invalid;
}
filename = argvW[2];
@@ -1032,4 +1040,9 @@ int reg_import(int argc, WCHAR *argvW[])
error:
fclose(fp);
return 1;
+
+invalid:
+ output_message(STRING_INVALID_SYNTAX);
+ output_message(STRING_FUNC_HELP, wcsupr(argvW[1]));
+ return 1;
}
diff --git a/programs/reg/query.c b/programs/reg/query.c
index d2a7968fa0b..9d840c8947d 100644
--- a/programs/reg/query.c
+++ b/programs/reg/query.c
@@ -347,6 +347,8 @@ int reg_query(int argc, WCHAR *argvW[])
value_empty = TRUE;
continue;
}
+ else if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str, L"reg:64"))
+ continue;
else if (!str[0] || str[1])
goto invalid;
diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index a31ce2be743..fa5c4bcd33c 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -341,6 +341,7 @@ int __cdecl wmain(int argc, WCHAR *argvW[])
if (is_help_switch(argvW[2]))
{
output_message(op_help);
+ output_message(STRING_REG_VIEW_USAGE);
return 0;
}
diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc
index abfed18b93b..85e3675464c 100644
--- a/programs/reg/reg.rc
+++ b/programs/reg/reg.rc
@@ -172,4 +172,8 @@ STRINGTABLE
STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?"
STRING_KEY_NONEXIST, "reg: Unable to find the specified registry key\n"
STRING_KEY_IMPORT_FAILED, "reg: Unable to import the registry key '%1'\n"
+ STRING_REG_VIEW_USAGE, " /reg:32\n\
+\ Access the registry using the 32-bit view.\n\n\
+\ /reg:64\n\
+\ Access the registry using the 64-bit view.\n\n"
}
diff --git a/programs/reg/resource.h b/programs/reg/resource.h
index 8b0d9de7653..b673e21883a 100644
--- a/programs/reg/resource.h
+++ b/programs/reg/resource.h
@@ -61,3 +61,4 @@
#define STRING_OVERWRITE_FILE 138
#define STRING_KEY_NONEXIST 139
#define STRING_KEY_IMPORT_FAILED 140
+#define STRING_REG_VIEW_USAGE 141
--
2.31.0
More information about the wine-devel
mailing list