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