ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2022
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
236 discussions
Start a n
N
ew thread
[reactos] 58/158: [WINESYNC] reg: Add a message to better indicate when a specified registry key is not found.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e11511da86fe791ebfc83…
commit e11511da86fe791ebfc83c4cbede3ba8cbc55114 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:59:23 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:31 2022 +0200 [WINESYNC] reg: Add a message to better indicate when a specified registry key is not found. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id fa2ed01352f8f027625d464915cd953e10766d73 by Hugh McMaster <hugh.mcmaster(a)outlook.com> manual adjustment needed --- base/applications/cmdutils/reg/delete.c | 4 ++-- base/applications/cmdutils/reg/export.c | 2 +- base/applications/cmdutils/reg/lang/en-US.rc | 1 + base/applications/cmdutils/reg/query.c | 2 +- base/applications/cmdutils/reg/resource.h | 1 + sdk/tools/winesync/reg.cfg | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/base/applications/cmdutils/reg/delete.c b/base/applications/cmdutils/reg/delete.c index 1f3755b3365..c80b622bccb 100644 --- a/base/applications/cmdutils/reg/delete.c +++ b/base/applications/cmdutils/reg/delete.c @@ -46,7 +46,7 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name { if (RegDeleteTreeW(root, path) != ERROR_SUCCESS) { - output_message(STRING_CANNOT_FIND); + output_message(STRING_KEY_NONEXIST); return 1; } output_message(STRING_SUCCESS); @@ -55,7 +55,7 @@ static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name if (RegOpenKeyExW(root, path, 0, KEY_READ|KEY_SET_VALUE, &key)) { - output_message(STRING_CANNOT_FIND); + output_message(STRING_KEY_NONEXIST); return 1; } diff --git a/base/applications/cmdutils/reg/export.c b/base/applications/cmdutils/reg/export.c index 5e84369a234..0b6d9ad9cbe 100644 --- a/base/applications/cmdutils/reg/export.c +++ b/base/applications/cmdutils/reg/export.c @@ -374,7 +374,7 @@ int reg_export(int argc, WCHAR *argvW[]) if (RegOpenKeyExW(root, path, 0, KEY_READ, &hkey)) { - output_message(STRING_INVALID_KEY); + output_message(STRING_KEY_NONEXIST); return 1; } diff --git a/base/applications/cmdutils/reg/lang/en-US.rc b/base/applications/cmdutils/reg/lang/en-US.rc index 24ae3691e5b..038d7658dc0 100644 --- a/base/applications/cmdutils/reg/lang/en-US.rc +++ b/base/applications/cmdutils/reg/lang/en-US.rc @@ -146,4 +146,5 @@ STRINGTABLE STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" 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" } diff --git a/base/applications/cmdutils/reg/query.c b/base/applications/cmdutils/reg/query.c index 961d926a10b..a82101a0a29 100644 --- a/base/applications/cmdutils/reg/query.c +++ b/base/applications/cmdutils/reg/query.c @@ -302,7 +302,7 @@ static int run_query(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name, if (RegOpenKeyExW(root, path, 0, KEY_READ, &key) != ERROR_SUCCESS) { - output_message(STRING_CANNOT_FIND); + output_message(STRING_KEY_NONEXIST); return 1; } diff --git a/base/applications/cmdutils/reg/resource.h b/base/applications/cmdutils/reg/resource.h index 3658adc1556..508761d01ac 100644 --- a/base/applications/cmdutils/reg/resource.h +++ b/base/applications/cmdutils/reg/resource.h @@ -61,3 +61,4 @@ #define STRING_EXPORT_USAGE 136 #define STRING_INVALID_SYSTEM_KEY 137 #define STRING_OVERWRITE_FILE 138 +#define STRING_KEY_NONEXIST 139 diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index d0b804e2ede..e01102a7d73 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: 4df5c1641e7091f42c2313b275d999f2b9d25eff + wine: fa2ed01352f8f027625d464915cd953e10766d73
2 years, 6 months
1
0
0
0
[reactos] 57/158: [WINESYNC] reg: Improve initial syntax checks during the 'export' operation.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9b424b0080789efea28a7…
commit 9b424b0080789efea28a72285e8589c870f1b6b1 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:56:12 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:31 2022 +0200 [WINESYNC] reg: Improve initial syntax checks during the 'export' operation. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 4df5c1641e7091f42c2313b275d999f2b9d25eff by Hugh McMaster <hugh.mcmaster(a)outlook.com> manual adjustment needed --- base/applications/cmdutils/reg/export.c | 28 +++++++++++++++++----------- base/applications/cmdutils/reg/reg.c | 10 ++++++---- base/applications/cmdutils/reg/reg.h | 1 + sdk/tools/winesync/reg.cfg | 2 +- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/base/applications/cmdutils/reg/export.c b/base/applications/cmdutils/reg/export.c index 74c6ecf195d..5e84369a234 100644 --- a/base/applications/cmdutils/reg/export.c +++ b/base/applications/cmdutils/reg/export.c @@ -344,27 +344,33 @@ static HANDLE get_file_handle(WCHAR *filename, BOOL overwrite_file) return hFile; } -static BOOL is_overwrite_switch(const WCHAR *s) -{ - return is_switch(s, 'y'); -} - int reg_export(int argc, WCHAR *argvW[]) { HKEY root, hkey; WCHAR *path, *long_key; BOOL overwrite_file = FALSE; HANDLE hFile; - int ret; + int i, ret; - if (argc == 3 || argc > 5) - goto error; + if (argc < 4) goto invalid; if (!parse_registry_key(argvW[2], &root, &path, &long_key)) return 1; - if (argc == 5 && !(overwrite_file = is_overwrite_switch(argvW[4]))) - goto error; + for (i = 4; i < argc; i++) + { + WCHAR *str; + + if (argvW[i][0] != '/' && argvW[i][0] != '-') + goto invalid; + + str = &argvW[i][1]; + + if (is_char(*str, 'y') && !str[1]) + overwrite_file = TRUE; + else + goto invalid; + } if (RegOpenKeyExW(root, path, 0, KEY_READ, &hkey)) { @@ -382,7 +388,7 @@ int reg_export(int argc, WCHAR *argvW[]) return ret; -error: +invalid: output_message(STRING_INVALID_SYNTAX); output_message(STRING_FUNC_HELP, _wcsupr(argvW[1])); return 1; diff --git a/base/applications/cmdutils/reg/reg.c b/base/applications/cmdutils/reg/reg.c index 07e3a7ce97b..c275b4b8d27 100644 --- a/base/applications/cmdutils/reg/reg.c +++ b/base/applications/cmdutils/reg/reg.c @@ -250,15 +250,17 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long return TRUE; } +BOOL is_char(const WCHAR s, const WCHAR c) +{ + return (s == c || s == towupper(c)); +} + BOOL is_switch(const WCHAR *s, const WCHAR c) { if (lstrlenW(s) > 2) return FALSE; - if ((s[0] == '/' || s[0] == '-') && (s[1] == c || s[1] == towupper(c))) - return TRUE; - - return FALSE; + return ((s[0] == '/' || s[0] == '-') && is_char(s[1], c)); } static BOOL is_help_switch(const WCHAR *s) diff --git a/base/applications/cmdutils/reg/reg.h b/base/applications/cmdutils/reg/reg.h index 3525bed75b8..c7719a6e4f0 100644 --- a/base/applications/cmdutils/reg/reg.h +++ b/base/applications/cmdutils/reg/reg.h @@ -40,6 +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); BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key); +BOOL is_char(const WCHAR s, const WCHAR c); BOOL is_switch(const WCHAR *s, const WCHAR c); /* add.c */ diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 7479d9dbf89..d0b804e2ede 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: 1b746c1e1c4da4a07a1293fe9e60429867c86697 + wine: 4df5c1641e7091f42c2313b275d999f2b9d25eff
2 years, 6 months
1
0
0
0
[reactos] 56/158: [WINESYNC] reg: Use wide-char string literals in export.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ec55298764cca634231a6…
commit ec55298764cca634231a6bd6badc257230037bc1 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:51:04 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:31 2022 +0200 [WINESYNC] reg: Use wide-char string literals in export.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 1b746c1e1c4da4a07a1293fe9e60429867c86697 by Hugh McMaster <hugh.mcmaster(a)outlook.com> manual adjustment needed --- base/applications/cmdutils/reg/export.c | 32 +++++++++++--------------------- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/base/applications/cmdutils/reg/export.c b/base/applications/cmdutils/reg/export.c index e9945308212..74c6ecf195d 100644 --- a/base/applications/cmdutils/reg/export.c +++ b/base/applications/cmdutils/reg/export.c @@ -79,15 +79,14 @@ static WCHAR *escape_string(WCHAR *str, size_t str_len, size_t *line_len) static size_t export_value_name(HANDLE hFile, WCHAR *name, size_t len) { - static const WCHAR quoted_fmt[] = {'"','%','s','"','=',0}; - static const WCHAR default_name[] = {'@','=',0}; + static const WCHAR *default_name = L"@="; size_t line_len; if (name && *name) { WCHAR *str = escape_string(name, len, &line_len); WCHAR *buf = malloc((line_len + 4) * sizeof(WCHAR)); - line_len = swprintf(buf, quoted_fmt, str); + line_len = swprintf(buf, L"\"%s\"=", str); write_file(hFile, buf); free(buf); free(str); @@ -105,28 +104,24 @@ static void export_string_data(WCHAR **buf, WCHAR *data, size_t size) { size_t len = 0, line_len; WCHAR *str; - static const WCHAR fmt[] = {'"','%','s','"',0}; if (size) len = size / sizeof(WCHAR) - 1; str = escape_string(data, len, &line_len); *buf = malloc((line_len + 3) * sizeof(WCHAR)); - swprintf(*buf, fmt, str); + swprintf(*buf, L"\"%s\"", str); free(str); } static void export_dword_data(WCHAR **buf, DWORD *data) { - static const WCHAR fmt[] = {'d','w','o','r','d',':','%','0','8','x',0}; - *buf = malloc(15 * sizeof(WCHAR)); - swprintf(*buf, fmt, *data); + swprintf(*buf, L"dword:%08x", *data); } static size_t export_hex_data_type(HANDLE hFile, DWORD type) { - static const WCHAR hex[] = {'h','e','x',':',0}; - static const WCHAR hexp_fmt[] = {'h','e','x','(','%','x',')',':',0}; + static const WCHAR *hex = L"hex:"; size_t line_len; if (type == REG_BINARY) @@ -137,7 +132,7 @@ static size_t export_hex_data_type(HANDLE hFile, DWORD type) else { WCHAR *buf = malloc(15 * sizeof(WCHAR)); - line_len = swprintf(buf, hexp_fmt, type); + line_len = swprintf(buf, L"hex(%x):", type); write_file(hFile, buf); free(buf); } @@ -150,8 +145,6 @@ static size_t export_hex_data_type(HANDLE hFile, DWORD type) static void export_hex_data(HANDLE hFile, WCHAR **buf, DWORD type, DWORD line_len, void *data, DWORD size) { - static const WCHAR fmt[] = {'%','0','2','x',0}; - static const WCHAR hex_concat[] = {'\\','\r','\n',' ',' ',0}; size_t num_commas, i, pos; line_len += export_hex_data_type(hFile, type); @@ -163,7 +156,7 @@ static void export_hex_data(HANDLE hFile, WCHAR **buf, DWORD type, for (i = 0, pos = 0; i < size; i++) { - pos += swprintf(*buf + pos, fmt, ((BYTE *)data)[i]); + pos += swprintf(*buf + pos, L"%02x", ((BYTE *)data)[i]); if (i == num_commas) break; (*buf)[pos++] = ','; (*buf)[pos] = 0; @@ -172,7 +165,7 @@ static void export_hex_data(HANDLE hFile, WCHAR **buf, DWORD type, if (line_len >= MAX_HEX_CHARS) { write_file(hFile, *buf); - write_file(hFile, hex_concat); + write_file(hFile, L"\\\r\n "); line_len = 2; pos = 0; } @@ -181,7 +174,7 @@ static void export_hex_data(HANDLE hFile, WCHAR **buf, DWORD type, static void export_newline(HANDLE hFile) { - static const WCHAR newline[] = {'\r','\n',0}; + static const WCHAR *newline = L"\r\n"; write_file(hFile, newline); } @@ -224,11 +217,10 @@ static void export_data(HANDLE hFile, WCHAR *value_name, DWORD value_len, static void export_key_name(HANDLE hFile, WCHAR *name) { - static const WCHAR fmt[] = {'\r','\n','[','%','s',']','\r','\n',0}; WCHAR *buf; buf = malloc((lstrlenW(name) + 7) * sizeof(WCHAR)); - swprintf(buf, fmt, name); + swprintf(buf, L"\r\n[%s]\r\n", name); write_file(hFile, buf); free(buf); } @@ -309,9 +301,7 @@ static int export_registry_data(HANDLE hFile, HKEY key, WCHAR *path) static void export_file_header(HANDLE hFile) { - static const WCHAR header[] = { 0xfeff,'W','i','n','d','o','w','s',' ', - 'R','e','g','i','s','t','r','y',' ','E','d','i','t','o','r',' ', - 'V','e','r','s','i','o','n',' ','5','.','0','0','\r','\n',0}; + static const WCHAR *header = L"\uFEFFWindows Registry Editor Version 5.00\r\n"; write_file(hFile, header); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 7da30342ea8..7479d9dbf89 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: 1fadcf240997f77b4bf31f708893051c94e299b2 + wine: 1b746c1e1c4da4a07a1293fe9e60429867c86697
2 years, 6 months
1
0
0
0
[reactos] 55/158: [WINESYNC] reg: Use wide-char string literals in import.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aae71dcb755e72b7c5f7e…
commit aae71dcb755e72b7c5f7e26604fdf1bea97f1fda Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:51:04 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:31 2022 +0200 [WINESYNC] reg: Use wide-char string literals in import.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 1fadcf240997f77b4bf31f708893051c94e299b2 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- base/applications/cmdutils/reg/import.c | 36 +++++++++++---------------------- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/base/applications/cmdutils/reg/import.c b/base/applications/cmdutils/reg/import.c index 93d6d46aef9..3ce8fce7394 100644 --- a/base/applications/cmdutils/reg/import.c +++ b/base/applications/cmdutils/reg/import.c @@ -245,18 +245,13 @@ static BOOL parse_data_type(struct parser *parser, WCHAR **line) { struct data_type { const WCHAR *tag; int len; int type; int parse_type; }; - static const WCHAR quote[] = {'"'}; - static const WCHAR hex[] = {'h','e','x',':'}; - static const WCHAR dword[] = {'d','w','o','r','d',':'}; - static const WCHAR hexp[] = {'h','e','x','('}; - static const struct data_type data_types[] = { - /* tag len type parse type */ - { quote, 1, REG_SZ, REG_SZ }, - { hex, 4, REG_BINARY, REG_BINARY }, - { dword, 6, REG_DWORD, REG_DWORD }, - { hexp, 4, -1, REG_BINARY }, /* REG_NONE, REG_EXPAND_SZ, REG_MULTI_SZ */ - { NULL, 0, 0, 0 } + /* tag len type parse type */ + { L"\"", 1, REG_SZ, REG_SZ }, + { L"hex:", 4, REG_BINARY, REG_BINARY }, + { L"dword:", 6, REG_DWORD, REG_DWORD }, + { L"hex(", 4, -1, REG_BINARY }, /* REG_NONE, REG_EXPAND_SZ, REG_MULTI_SZ */ + { NULL, 0, 0, 0 } }; const struct data_type *ptr; @@ -443,21 +438,17 @@ enum reg_versions { static enum reg_versions parse_file_header(const WCHAR *s) { - static const WCHAR header_31[] = {'R','E','G','E','D','I','T',0}; - static const WCHAR header_40[] = {'R','E','G','E','D','I','T','4',0}; - static const WCHAR header_50[] = {'W','i','n','d','o','w','s',' ', - 'R','e','g','i','s','t','r','y',' ','E','d','i','t','o','r',' ', - 'V','e','r','s','i','o','n',' ','5','.','0','0',0}; + static const WCHAR *header_31 = L"REGEDIT"; while (*s == ' ' || *s == '\t') s++; if (!lstrcmpW(s, header_31)) return REG_VERSION_31; - if (!lstrcmpW(s, header_40)) + if (!lstrcmpW(s, L"REGEDIT4")) return REG_VERSION_40; - if (!lstrcmpW(s, header_50)) + if (!lstrcmpW(s, L"Windows Registry Editor Version 5.00")) return REG_VERSION_50; /* The Windows version accepts registry file headers beginning with "REGEDIT" and ending @@ -511,13 +502,12 @@ static WCHAR *header_state(struct parser *parser, WCHAR *pos) static WCHAR *parse_win31_line_state(struct parser *parser, WCHAR *pos) { WCHAR *line, *value; - static WCHAR hkcr[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T'}; unsigned int key_end = 0; if (!(line = get_line(parser->file))) return NULL; - if (wcsncmp(line, hkcr, ARRAY_SIZE(hkcr))) + if (wcsncmp(line, L"HKEY_CLASSES_ROOT", 17)) /* "HKEY_CLASSES_ROOT" without NUL */ return line; /* get key name */ @@ -948,8 +938,7 @@ static WCHAR *get_lineW(FILE *fp) while (next) { - static const WCHAR line_endings[] = {'\r','\n',0}; - WCHAR *p = wcspbrk(line, line_endings); + WCHAR *p = wcspbrk(line, L"\r\n"); if (!p) { size_t len, count; @@ -986,7 +975,6 @@ int reg_import(int argc, WCHAR *argvW[]) { WCHAR *filename, *pos; FILE *fp; - static const WCHAR rb_mode[] = {'r','b',0}; BYTE s[2]; struct parser parser; @@ -999,7 +987,7 @@ int reg_import(int argc, WCHAR *argvW[]) filename = argvW[2]; - fp = _wfopen(filename, rb_mode); + fp = _wfopen(filename, L"rb"); if (!fp) { output_message(STRING_FILE_NOT_FOUND, filename); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 247a1e9f0d9..7da30342ea8 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: 0c73f95b336ba2ae4b49fa7f652c622ce47038c5 + wine: 1fadcf240997f77b4bf31f708893051c94e299b2
2 years, 6 months
1
0
0
0
[reactos] 54/158: [WINESYNC] reg: Use wide-char string literals.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5eb878fe9c8864b1e672a…
commit 5eb878fe9c8864b1e672a97c6e531f4dc77c30e2 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:48:04 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:31 2022 +0200 [WINESYNC] reg: Use wide-char string literals. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 0c73f95b336ba2ae4b49fa7f652c622ce47038c5 by Hugh McMaster <hugh.mcmaster(a)outlook.com> manual adjustment needed --- base/applications/cmdutils/reg/query.c | 18 ++++----- base/applications/cmdutils/reg/reg.c | 68 ++++++++++------------------------ sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 28 insertions(+), 60 deletions(-) diff --git a/base/applications/cmdutils/reg/query.c b/base/applications/cmdutils/reg/query.c index c8277cd7114..961d926a10b 100644 --- a/base/applications/cmdutils/reg/query.c +++ b/base/applications/cmdutils/reg/query.c @@ -48,12 +48,11 @@ static WCHAR *reg_data_to_wchar(DWORD type, const BYTE *src, DWORD size_bytes) case REG_BINARY: { WCHAR *ptr; - static const WCHAR fmt[] = {'%','0','2','X',0}; buffer = malloc((size_bytes * 2 + 1) * sizeof(WCHAR)); ptr = buffer; for (i = 0; i < size_bytes; i++) - ptr += swprintf(ptr, 3, fmt, src[i]); + ptr += swprintf(ptr, 3, L"%02X", src[i]); break; } case REG_DWORD: @@ -61,10 +60,9 @@ static WCHAR *reg_data_to_wchar(DWORD type, const BYTE *src, DWORD size_bytes) case REG_DWORD_BIG_ENDIAN: { const int zero_x_dword = 10; - static const WCHAR fmt[] = {'0','x','%','x',0}; buffer = malloc((zero_x_dword + 1) * sizeof(WCHAR)); - swprintf(buffer, zero_x_dword + 1, fmt, *(DWORD *)src); + swprintf(buffer, zero_x_dword + 1, L"0x%x", *(DWORD *)src); break; } case REG_MULTI_SZ: @@ -102,11 +100,11 @@ static WCHAR *reg_data_to_wchar(DWORD type, const BYTE *src, DWORD size_bytes) return buffer; } -static const WCHAR newlineW[] = {'\n',0}; +static const WCHAR *newlineW = L"\n"; static void output_value(const WCHAR *value_name, DWORD type, BYTE *data, DWORD data_size) { - static const WCHAR fmt[] = {' ',' ',' ',' ','%','1',0}; + static const WCHAR *fmt = L" %1"; WCHAR defval[32]; WCHAR *reg_data; @@ -142,7 +140,7 @@ static int query_value(HKEY key, WCHAR *value_name, WCHAR *path, BOOL recurse) DWORD subkey_len; DWORD type, path_len, i; BYTE *data; - WCHAR fmt[] = {'%','1','\n',0}; + static const WCHAR *fmt = L"%1\n"; WCHAR *subkey_name, *subkey_path; HKEY subkey; @@ -219,13 +217,11 @@ static int query_all(HKEY key, WCHAR *path, BOOL recurse) DWORD max_data_bytes = 2048, data_size; DWORD subkey_len; DWORD i, type, path_len; - WCHAR fmt[] = {'%','1','\n',0}; - WCHAR fmt_path[] = {'%','1','\\','%','2','\n',0}; WCHAR *value_name, *subkey_name, *subkey_path; BYTE *data; HKEY subkey; - output_string(fmt, path); + output_string(L"%1\n", path); value_name = malloc(max_value_len * sizeof(WCHAR)); data = malloc(max_data_bytes); @@ -284,7 +280,7 @@ static int query_all(HKEY key, WCHAR *path, BOOL recurse) } free(subkey_path); } - else output_string(fmt_path, path, subkey_name); + else output_string(L"%1\\%2\n", path, subkey_name); i++; } else break; diff --git a/base/applications/cmdutils/reg/reg.c b/base/applications/cmdutils/reg/reg.c index fef8db6f6bf..07e3a7ce97b 100644 --- a/base/applications/cmdutils/reg/reg.c +++ b/base/applications/cmdutils/reg/reg.c @@ -21,17 +21,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(reg); -static const WCHAR short_hklm[] = {'H','K','L','M',0}; -static const WCHAR short_hkcu[] = {'H','K','C','U',0}; -static const WCHAR short_hkcr[] = {'H','K','C','R',0}; -static const WCHAR short_hku[] = {'H','K','U',0}; -static const WCHAR short_hkcc[] = {'H','K','C','C',0}; -static const WCHAR long_hklm[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}; -static const WCHAR long_hkcu[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}; -static const WCHAR long_hkcr[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}; -static const WCHAR long_hku[] = {'H','K','E','Y','_','U','S','E','R','S',0}; -static const WCHAR long_hkcc[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}; - static const struct { HKEY key; @@ -40,32 +29,23 @@ static const struct } root_rels[] = { - {HKEY_LOCAL_MACHINE, short_hklm, long_hklm}, - {HKEY_CURRENT_USER, short_hkcu, long_hkcu}, - {HKEY_CLASSES_ROOT, short_hkcr, long_hkcr}, - {HKEY_USERS, short_hku, long_hku}, - {HKEY_CURRENT_CONFIG, short_hkcc, long_hkcc}, + {HKEY_LOCAL_MACHINE, L"HKLM", L"HKEY_LOCAL_MACHINE"}, + {HKEY_CURRENT_USER, L"HKCU", L"HKEY_CURRENT_USER"}, + {HKEY_CLASSES_ROOT, L"HKCR", L"HKEY_CLASSES_ROOT"}, + {HKEY_USERS, L"HKU", L"HKEY_USERS"}, + {HKEY_CURRENT_CONFIG, L"HKCC", L"HKEY_CURRENT_CONFIG"}, }; -static const WCHAR type_none[] = {'R','E','G','_','N','O','N','E',0}; -static const WCHAR type_sz[] = {'R','E','G','_','S','Z',0}; -static const WCHAR type_expand_sz[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}; -static const WCHAR type_binary[] = {'R','E','G','_','B','I','N','A','R','Y',0}; -static const WCHAR type_dword[] = {'R','E','G','_','D','W','O','R','D',0}; -static const WCHAR type_dword_le[] = {'R','E','G','_','D','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; -static const WCHAR type_dword_be[] = {'R','E','G','_','D','W','O','R','D','_','B','I','G','_','E','N','D','I','A','N',0}; -static const WCHAR type_multi_sz[] = {'R','E','G','_','M','U','L','T','I','_','S','Z',0}; - const struct reg_type_rels type_rels[] = { - {REG_NONE, type_none}, - {REG_SZ, type_sz}, - {REG_EXPAND_SZ, type_expand_sz}, - {REG_BINARY, type_binary}, - {REG_DWORD, type_dword}, - {REG_DWORD_LITTLE_ENDIAN, type_dword_le}, - {REG_DWORD_BIG_ENDIAN, type_dword_be}, - {REG_MULTI_SZ, type_multi_sz}, + {REG_NONE, L"REG_NONE"}, + {REG_SZ, L"REG_SZ"}, + {REG_EXPAND_SZ, L"REG_EXPAND_SZ"}, + {REG_BINARY, L"REG_BINARY"}, + {REG_DWORD, L"REG_DWORD"}, + {REG_DWORD_LITTLE_ENDIAN, L"REG_DWORD_LITTLE_ENDIAN"}, + {REG_DWORD_BIG_ENDIAN, L"REG_DWORD_BIG_ENDIAN"}, + {REG_MULTI_SZ, L"REG_MULTI_SZ"}, }; void output_writeconsole(const WCHAR *str, DWORD wlen) @@ -216,10 +196,9 @@ static BOOL sane_path(const WCHAR *key) WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len) { WCHAR *subkey_path; - static const WCHAR fmt[] = {'%','s','\\','%','s',0}; subkey_path = malloc((path_len + subkey_len + 2) * sizeof(WCHAR)); - swprintf(subkey_path, fmt, path, subkey_name); + swprintf(subkey_path, L"%s\\%s", path, subkey_name); return subkey_path; } @@ -228,7 +207,6 @@ static WCHAR *get_long_key(HKEY root, WCHAR *path) { DWORD i, array_size = ARRAY_SIZE(root_rels), len; WCHAR *long_key; - WCHAR fmt[] = {'%','s','\\','%','s',0}; for (i = 0; i < array_size; i++) { @@ -247,7 +225,7 @@ static WCHAR *get_long_key(HKEY root, WCHAR *path) len += lstrlenW(path) + 1; /* add one for the backslash */ long_key = malloc((len + 1) * sizeof(WCHAR)); - swprintf(long_key, fmt, root_rels[i].long_name, path); + swprintf(long_key, L"%s\\%s", root_rels[i].long_name, path); return long_key; } @@ -301,19 +279,13 @@ static enum operations get_operation(const WCHAR *str, int *op_help) { struct op_info { const WCHAR *op; int id; int help_id; }; - static const WCHAR add[] = {'a','d','d',0}; - static const WCHAR delete[] = {'d','e','l','e','t','e',0}; - static const WCHAR export[] = {'e','x','p','o','r','t',0}; - static const WCHAR import[] = {'i','m','p','o','r','t',0}; - static const WCHAR query[] = {'q','u','e','r','y',0}; - static const struct op_info op_array[] = { - { add, REG_ADD, STRING_ADD_USAGE }, - { delete, REG_DELETE, STRING_DELETE_USAGE }, - { export, REG_EXPORT, STRING_EXPORT_USAGE }, - { import, REG_IMPORT, STRING_IMPORT_USAGE }, - { query, REG_QUERY, STRING_QUERY_USAGE }, + { L"add", REG_ADD, STRING_ADD_USAGE }, + { L"delete", REG_DELETE, STRING_DELETE_USAGE }, + { L"export", REG_EXPORT, STRING_EXPORT_USAGE }, + { L"import", REG_IMPORT, STRING_IMPORT_USAGE }, + { L"query", REG_QUERY, STRING_QUERY_USAGE }, { NULL, -1, 0 } }; diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index e4f3e317f2e..247a1e9f0d9 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: aaf503e1de3f476639113b7ab7988c8628529e03 + wine: 0c73f95b336ba2ae4b49fa7f652c622ce47038c5
2 years, 6 months
1
0
0
0
[reactos] 53/158: [WINESYNC] reg: Use RegCreateKeyExW() instead of RegCreateKeyW().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b1bb43c9912dfa082556a…
commit b1bb43c9912dfa082556af3c932689da04b46004 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:48:04 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:31 2022 +0200 [WINESYNC] reg: Use RegCreateKeyExW() instead of RegCreateKeyW(). Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id aaf503e1de3f476639113b7ab7988c8628529e03 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- base/applications/cmdutils/reg/add.c | 3 ++- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/base/applications/cmdutils/reg/add.c b/base/applications/cmdutils/reg/add.c index 29ac0e88af5..e1fd2223716 100644 --- a/base/applications/cmdutils/reg/add.c +++ b/base/applications/cmdutils/reg/add.c @@ -154,7 +154,8 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, { HKEY key; - if (RegCreateKeyW(root, path, &key) != ERROR_SUCCESS) + if (RegCreateKeyExW(root, path, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_WRITE, NULL, &key, NULL)) { output_message(STRING_INVALID_KEY); return 1; diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index be7ad220b82..e4f3e317f2e 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: 08976b3ee0db827bc5add829de1f148da89a6362 + wine: aaf503e1de3f476639113b7ab7988c8628529e03
2 years, 6 months
1
0
0
0
[reactos] 52/158: [WINESYNC] reg: Fail if duplicate command-line switches are passed to 'reg add'.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cb66fe28bae4a52fff2d1…
commit cb66fe28bae4a52fff2d1b3ca5e70a19978351ad Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:48:04 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:31 2022 +0200 [WINESYNC] reg: Fail if duplicate command-line switches are passed to 'reg add'. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 08976b3ee0db827bc5add829de1f148da89a6362 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- base/applications/cmdutils/reg/add.c | 4 +++- modules/rostests/winetests/reg/add.c | 4 ++-- sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/base/applications/cmdutils/reg/add.c b/base/applications/cmdutils/reg/add.c index 672ec19ef98..29ac0e88af5 100644 --- a/base/applications/cmdutils/reg/add.c +++ b/base/applications/cmdutils/reg/add.c @@ -227,6 +227,7 @@ int reg_add(int argc, WCHAR *argvW[]) if (!lstrcmpiW(str, L"ve")) { + if (value_empty) goto invalid; value_empty = TRUE; continue; } @@ -249,11 +250,12 @@ int reg_add(int argc, WCHAR *argvW[]) break; case 's': str = argvW[++i]; - if (!str || lstrlenW(str) != 1) + if (separator || !str || lstrlenW(str) != 1) goto invalid; separator = str[0]; break; case 'f': + if (force) goto invalid; force = TRUE; break; default: diff --git a/modules/rostests/winetests/reg/add.c b/modules/rostests/winetests/reg/add.c index f5d473e8887..e1e7a478502 100644 --- a/modules/rostests/winetests/reg/add.c +++ b/modules/rostests/winetests/reg/add.c @@ -234,7 +234,7 @@ static void test_add(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /f /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); @@ -295,7 +295,7 @@ static void test_add(void) verify_reg(hkey, NULL, REG_SZ, "", 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /f /ve", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index df540a629f6..be7ad220b82 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: 9138f5893c2eb7cafabdd8ed49b99a633eeda462 + wine: 08976b3ee0db827bc5add829de1f148da89a6362
2 years, 6 months
1
0
0
0
[reactos] 51/158: [WINESYNC] reg: Parse 'reg add' command-line arguments in add.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=65957cc65b6154e6317ca…
commit 65957cc65b6154e6317ca180b05c14b48e738d7a Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:48:04 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:31 2022 +0200 [WINESYNC] reg: Parse 'reg add' command-line arguments in add.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 9138f5893c2eb7cafabdd8ed49b99a633eeda462 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- base/applications/cmdutils/reg/add.c | 67 ++++++++++++++++++++++++++++- base/applications/cmdutils/reg/reg.c | 82 +++--------------------------------- base/applications/cmdutils/reg/reg.h | 3 +- sdk/tools/winesync/reg.cfg | 2 +- 4 files changed, 72 insertions(+), 82 deletions(-) diff --git a/base/applications/cmdutils/reg/add.c b/base/applications/cmdutils/reg/add.c index 3d0a509b4f0..672ec19ef98 100644 --- a/base/applications/cmdutils/reg/add.c +++ b/base/applications/cmdutils/reg/add.c @@ -149,8 +149,8 @@ static LPBYTE get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator, DW return out_data; } -int reg_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, - WCHAR *type, WCHAR separator, WCHAR *data, BOOL force) +static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, + WCHAR *type, WCHAR separator, WCHAR *data, BOOL force) { HKEY key; @@ -208,3 +208,66 @@ int reg_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, return 0; } + +int reg_add(int argc, WCHAR *argvW[]) +{ + HKEY root; + WCHAR *path, *key_name, *value_name = NULL, *type = NULL, *data = NULL, separator = '\0'; + BOOL value_empty = FALSE, force = FALSE; + int i; + + if (!parse_registry_key(argvW[2], &root, &path, &key_name)) + return 1; + + for (i = 3; i < argc; i++) + { + if (argvW[i][0] == '/' || argvW[i][0] == '-') + { + WCHAR *str = &argvW[i][1]; + + if (!lstrcmpiW(str, L"ve")) + { + value_empty = TRUE; + continue; + } + else if (!str[0] || str[1]) + goto invalid; + + switch (towlower(*str)) + { + case 'v': + if (value_name || !(value_name = argvW[++i])) + goto invalid; + break; + case 't': + if (type || !(type = argvW[++i])) + goto invalid; + break; + case 'd': + if (data || !(data = argvW[++i])) + goto invalid; + break; + case 's': + str = argvW[++i]; + if (!str || lstrlenW(str) != 1) + goto invalid; + separator = str[0]; + break; + case 'f': + force = TRUE; + break; + default: + goto invalid; + } + } + } + + if (value_name && value_empty) + goto invalid; + + return run_add(root, path, value_name, value_empty, type, separator, data, force); + +invalid: + output_message(STRING_INVALID_CMDLINE); + return 1; +} diff --git a/base/applications/cmdutils/reg/reg.c b/base/applications/cmdutils/reg/reg.c index 8dea9501730..fef8db6f6bf 100644 --- a/base/applications/cmdutils/reg/reg.c +++ b/base/applications/cmdutils/reg/reg.c @@ -333,11 +333,7 @@ static enum operations get_operation(const WCHAR *str, int *op_help) int __cdecl wmain(int argc, WCHAR *argvW[]) { - int i, op, op_help; - static const WCHAR switchVEW[] = {'v','e',0}; - WCHAR *key_name, *path, *value_name = NULL, *type = NULL, *data = NULL, separator = '\0'; - BOOL value_empty = FALSE, force = FALSE; - HKEY root; + int op, op_help; if (argc == 1) { @@ -373,6 +369,9 @@ int __cdecl wmain(int argc, WCHAR *argvW[]) return 0; } + if (op == REG_ADD) + return reg_add(argc, argvW); + if (op == REG_DELETE) return reg_delete(argc, argvW); @@ -382,76 +381,5 @@ int __cdecl wmain(int argc, WCHAR *argvW[]) if (op == REG_IMPORT) return reg_import(argc, argvW); - if (op == REG_QUERY) - return reg_query(argc, argvW); - - if (!parse_registry_key(argvW[2], &root, &path, &key_name)) - return 1; - - for (i = 3; i < argc; i++) - { - if (argvW[i][0] == '/' || argvW[i][0] == '-') - { - WCHAR *ptr = &argvW[i][1]; - - if (!lstrcmpiW(ptr, switchVEW)) - { - value_empty = TRUE; - continue; - } - else if (!ptr[0] || ptr[1]) - { - output_message(STRING_INVALID_CMDLINE); - return 1; - } - - switch(towlower(argvW[i][1])) - { - case 'v': - if (value_name || !(value_name = argvW[++i])) - { - output_message(STRING_INVALID_CMDLINE); - return 1; - } - break; - case 't': - if (type || !(type = argvW[++i])) - { - output_message(STRING_INVALID_CMDLINE); - return 1; - } - break; - case 'd': - if (data || !(data = argvW[++i])) - { - output_message(STRING_INVALID_CMDLINE); - return 1; - } - break; - case 's': - ptr = argvW[++i]; - if (!ptr || lstrlenW(ptr) != 1) - { - output_message(STRING_INVALID_CMDLINE); - return 1; - } - separator = ptr[0]; - break; - case 'f': - force = TRUE; - break; - default: - output_message(STRING_INVALID_CMDLINE); - return 1; - } - } - } - - if (value_name && value_empty) - { - output_message(STRING_INVALID_CMDLINE); - return 1; - } - - return reg_add(root, path, value_name, value_empty, type, separator, data, force); + return reg_query(argc, argvW); } diff --git a/base/applications/cmdutils/reg/reg.h b/base/applications/cmdutils/reg/reg.h index e4ee13eca6e..3525bed75b8 100644 --- a/base/applications/cmdutils/reg/reg.h +++ b/base/applications/cmdutils/reg/reg.h @@ -43,8 +43,7 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long BOOL is_switch(const WCHAR *s, const WCHAR c); /* add.c */ -int reg_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, - WCHAR *type, WCHAR separator, WCHAR *data, BOOL force); +int reg_add(int arc, WCHAR *argvW[]); /* delete.c */ int reg_delete(int argc, WCHAR *argvW[]); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index b9f81cb1160..df540a629f6 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: 434c345e41222ae6eebe734e655a32bfd51871ae + wine: 9138f5893c2eb7cafabdd8ed49b99a633eeda462
2 years, 6 months
1
0
0
0
[reactos] 50/158: [WINESYNC] reg: Parse 'reg delete' command-line arguments in delete.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=409d7663c10c30c699048…
commit 409d7663c10c30c699048d4719dbfe5affc50c1d Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:48:04 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:31 2022 +0200 [WINESYNC] reg: Parse 'reg delete' command-line arguments in delete.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 434c345e41222ae6eebe734e655a32bfd51871ae by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- base/applications/cmdutils/reg/delete.c | 61 +++++++++++++++++++++++++++++++-- base/applications/cmdutils/reg/reg.c | 22 ++++-------- base/applications/cmdutils/reg/reg.h | 3 +- sdk/tools/winesync/reg.cfg | 2 +- 4 files changed, 68 insertions(+), 20 deletions(-) diff --git a/base/applications/cmdutils/reg/delete.c b/base/applications/cmdutils/reg/delete.c index c102fb4ad53..1f3755b3365 100644 --- a/base/applications/cmdutils/reg/delete.c +++ b/base/applications/cmdutils/reg/delete.c @@ -18,8 +18,8 @@ #include "reg.h" -int reg_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name, - BOOL value_empty, BOOL value_all, BOOL force) +static int run_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name, + BOOL value_empty, BOOL value_all, BOOL force) { HKEY key; @@ -105,3 +105,60 @@ int reg_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name, output_message(STRING_SUCCESS); return 0; } + +int reg_delete(int argc, WCHAR *argvW[]) +{ + HKEY root; + WCHAR *path, *key_name, *value_name = NULL; + BOOL value_all = FALSE, value_empty = FALSE, force = FALSE; + int i; + + if (!parse_registry_key(argvW[2], &root, &path, &key_name)) + return 1; + + for (i = 3; i < argc; i++) + { + if (argvW[i][0] == '/' || argvW[i][0] == '-') + { + WCHAR *str = &argvW[i][1]; + + if (!lstrcmpiW(str, L"va")) + { + if (value_all) goto invalid; + value_all = TRUE; + continue; + } + else if (!lstrcmpiW(str, L"ve")) + { + if (value_empty) goto invalid; + value_empty = TRUE; + continue; + } + else if (!str[0] || str[1]) + goto invalid; + + switch (towlower(*str)) + { + case 'v': + if (value_name || !(value_name = argvW[++i])) + goto invalid; + break; + case 'f': + if (force) goto invalid; + force = TRUE; + break; + default: + goto invalid; + } + } + } + + if ((value_name && value_empty) || (value_name && value_all) || (value_empty && value_all)) + goto invalid; + + return run_delete(root, path, key_name, value_name, value_empty, value_all, force); + +invalid: + output_message(STRING_INVALID_CMDLINE); + return 1; +} diff --git a/base/applications/cmdutils/reg/reg.c b/base/applications/cmdutils/reg/reg.c index 6089d701d3c..8dea9501730 100644 --- a/base/applications/cmdutils/reg/reg.c +++ b/base/applications/cmdutils/reg/reg.c @@ -333,11 +333,10 @@ static enum operations get_operation(const WCHAR *str, int *op_help) int __cdecl wmain(int argc, WCHAR *argvW[]) { - int i, op, op_help, ret; - static const WCHAR switchVAW[] = {'v','a',0}; + int i, op, op_help; static const WCHAR switchVEW[] = {'v','e',0}; WCHAR *key_name, *path, *value_name = NULL, *type = NULL, *data = NULL, separator = '\0'; - BOOL value_empty = FALSE, value_all = FALSE, force = FALSE; + BOOL value_empty = FALSE, force = FALSE; HKEY root; if (argc == 1) @@ -374,6 +373,9 @@ int __cdecl wmain(int argc, WCHAR *argvW[]) return 0; } + if (op == REG_DELETE) + return reg_delete(argc, argvW); + if (op == REG_EXPORT) return reg_export(argc, argvW); @@ -397,11 +399,6 @@ int __cdecl wmain(int argc, WCHAR *argvW[]) value_empty = TRUE; continue; } - else if (!lstrcmpiW(ptr, switchVAW)) - { - value_all = TRUE; - continue; - } else if (!ptr[0] || ptr[1]) { output_message(STRING_INVALID_CMDLINE); @@ -450,16 +447,11 @@ int __cdecl wmain(int argc, WCHAR *argvW[]) } } - if ((value_name && value_empty) || (value_name && value_all) || (value_empty && value_all)) + if (value_name && value_empty) { output_message(STRING_INVALID_CMDLINE); return 1; } - if (op == REG_ADD) - ret = reg_add(root, path, value_name, value_empty, type, separator, data, force); - else - ret = reg_delete(root, path, key_name, value_name, value_empty, value_all, force); - - return ret; + return reg_add(root, path, value_name, value_empty, type, separator, data, force); } diff --git a/base/applications/cmdutils/reg/reg.h b/base/applications/cmdutils/reg/reg.h index e1e4804d19d..e4ee13eca6e 100644 --- a/base/applications/cmdutils/reg/reg.h +++ b/base/applications/cmdutils/reg/reg.h @@ -47,8 +47,7 @@ int reg_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, WCHAR *type, WCHAR separator, WCHAR *data, BOOL force); /* delete.c */ -int reg_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name, - BOOL value_empty, BOOL value_all, BOOL force); +int reg_delete(int argc, WCHAR *argvW[]); /* export.c */ int reg_export(int argc, WCHAR *argvW[]); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index b56101bb50b..b9f81cb1160 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: cb749592e728119bdd5a30a1080a90cf1a53546a + wine: 434c345e41222ae6eebe734e655a32bfd51871ae
2 years, 6 months
1
0
0
0
[reactos] 49/158: [WINESYNC] reg: Update a comment.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=89f0bf94a3b1fcd1f2a52…
commit 89f0bf94a3b1fcd1f2a521686d0d1d16bb35313d Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:48:04 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:31 2022 +0200 [WINESYNC] reg: Update a comment. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id cb749592e728119bdd5a30a1080a90cf1a53546a by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- base/applications/cmdutils/reg/delete.c | 2 +- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base/applications/cmdutils/reg/delete.c b/base/applications/cmdutils/reg/delete.c index 0f263e91902..c102fb4ad53 100644 --- a/base/applications/cmdutils/reg/delete.c +++ b/base/applications/cmdutils/reg/delete.c @@ -41,7 +41,7 @@ int reg_delete(HKEY root, WCHAR *path, WCHAR *key_name, WCHAR *value_name, } } - /* Delete subtree only if no /v* option is given */ + /* Delete registry key if no /v* option is given */ if (!value_name && !value_empty && !value_all) { if (RegDeleteTreeW(root, path) != ERROR_SUCCESS) diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 5b8f8048f3d..b56101bb50b 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: eee0c1f8f97d2d77118abb692e277dd440eed693 + wine: cb749592e728119bdd5a30a1080a90cf1a53546a
2 years, 6 months
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
24
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Results per page:
10
25
50
100
200