regedit: Use C runtime wchar functions instead of wine/unicode.h.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Alexandre Julliard 2019-04-01 11:47:50 +02:00
parent 518a6c2d07
commit 0b18409cfc
7 changed files with 34 additions and 41 deletions

View File

@ -26,7 +26,6 @@
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(regedit);
@ -243,7 +242,7 @@ static void get_last_key(HWND hwndTV)
HTREEITEM selection = NULL;
if (RegQueryValueExW(hkey, wszLastKey, NULL, NULL, (LPBYTE)wszVal, &dwSize) == ERROR_SUCCESS)
{
if (strcmpW(wszVal, g_pChildWnd->szPath))
if (lstrcmpW(wszVal, g_pChildWnd->szPath))
selection = FindPathInTree(hwndTV, wszVal);
}

View File

@ -29,7 +29,6 @@
#include <shlwapi.h>
#include "wine/heap.h"
#include "wine/unicode.h"
#include "main.h"
static const WCHAR* editValueName;
@ -531,7 +530,7 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName)
if (!keyPath || !newName) return FALSE;
if (!strrchrW(keyPath, '\\')) {
if (!wcsrchr(keyPath, '\\')) {
parentKey = hRootKey;
srcSubKey = keyPath;
} else {
@ -539,7 +538,7 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName)
parentPath = heap_xalloc((lstrlenW(keyPath) + 1) * sizeof(WCHAR));
lstrcpyW(parentPath, keyPath);
srcSubKey_copy = strrchrW(parentPath, '\\');
srcSubKey_copy = wcsrchr(parentPath, '\\');
*srcSubKey_copy = 0;
srcSubKey = srcSubKey_copy + 1;
lRet = RegOpenKeyExW(hRootKey, parentPath, 0, KEY_READ | KEY_CREATE_SUB_KEY, &parentKey);

View File

@ -30,7 +30,6 @@
#include "main.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(regedit);
@ -280,7 +279,7 @@ static void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
/* load appropriate string*/
LPWSTR lpsz = str;
/* first newline terminates actual string*/
lpsz = strchrW(lpsz, '\n');
lpsz = wcschr(lpsz, '\n');
if (lpsz != NULL)
*lpsz = '\0';
}
@ -427,7 +426,7 @@ static BOOL InitOpenFileName(HWND hWnd, OPENFILENAMEW *pofn)
LoadStringW(hInst, IDS_FILEDIALOG_FILTER_REG, filter_reg, MAX_PATH);
LoadStringW(hInst, IDS_FILEDIALOG_FILTER_REG4, filter_reg4, MAX_PATH);
LoadStringW(hInst, IDS_FILEDIALOG_FILTER_ALL, filter_all, MAX_PATH);
snprintfW( FilterBuffer, MAX_PATH, filterW, filter_reg, 0, 0, filter_reg4, 0, 0, filter_all, 0, 0 );
swprintf( FilterBuffer, filterW, filter_reg, 0, 0, filter_reg4, 0, 0, filter_all, 0, 0 );
}
pofn->lpstrFilter = FilterBuffer;
pofn->nFilterIndex = 1;

View File

@ -35,7 +35,6 @@
#include "commctrl.h"
#include "wine/heap.h"
#include "wine/unicode.h"
#include "main.h"
/* spaces dividing hex and ASCII */
@ -95,7 +94,7 @@ static LPWSTR HexEdit_GetLineText(int offset, BYTE *pData, LONG cbData, LONG pad
for (i = 0; i < cbData; i++)
{
/* (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER) */
if (isprintW(pData[offset + i]))
if (iswprint(pData[offset + i]))
lpszLine[6 + cbData * 3 + pad * 3 + DIV_SPACES + i] = pData[offset + i];
else
lpszLine[6 + cbData * 3 + pad * 3 + DIV_SPACES + i] = '.';

View File

@ -26,7 +26,6 @@
#include "main.h"
#include "wine/heap.h"
#include "wine/unicode.h"
static INT Image_String;
static INT Image_Binary;

View File

@ -22,7 +22,6 @@
#include <windows.h>
#include <commctrl.h>
#include <shellapi.h>
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "main.h"
@ -113,7 +112,7 @@ static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i)
WCHAR *realname = NULL;
FILE *reg_file;
if (!strcmpW(filename, hyphen))
if (!lstrcmpW(filename, hyphen))
reg_file = stdin;
else
{
@ -197,7 +196,7 @@ BOOL ProcessCmdLine(WCHAR *cmdline)
if (argv[i][1] && argv[i][2] && argv[i][2] != ':')
break; /* This is a file path beginning with '/'. */
switch (toupperW(argv[i][1]))
switch (towupper(argv[i][1]))
{
case '?':
error_exit(STRING_USAGE);

View File

@ -27,7 +27,6 @@
#include <io.h>
#include <windows.h>
#include <commctrl.h>
#include <wine/unicode.h>
#include <wine/debug.h>
#include <wine/heap.h>
#include "main.h"
@ -243,7 +242,7 @@ static BOOL convert_hex_to_dword(WCHAR *str, DWORD *dw)
if (!*str) goto error;
p = str;
while (isxdigitW(*p))
while (iswxdigit(*p))
{
count++;
p++;
@ -255,7 +254,7 @@ static BOOL convert_hex_to_dword(WCHAR *str, DWORD *dw)
if (*p && *p != ';') goto error;
*end = 0;
*dw = strtoulW(str, &end, 16);
*dw = wcstoul(str, &end, 16);
return TRUE;
error:
@ -288,7 +287,7 @@ static BOOL convert_hex_csv_to_hex(struct parser *parser, WCHAR **str)
WCHAR *end;
unsigned long wc;
wc = strtoulW(s, &end, 16);
wc = wcstoul(s, &end, 16);
if (wc > 0xff) return FALSE;
if (s == end && wc == 0)
@ -350,7 +349,7 @@ static BOOL parse_data_type(struct parser *parser, WCHAR **line)
for (ptr = data_types; ptr->tag; ptr++)
{
if (strncmpW(ptr->tag, *line, ptr->len))
if (wcsncmp(ptr->tag, *line, ptr->len))
continue;
parser->parse_type = ptr->parse_type;
@ -362,7 +361,7 @@ static BOOL parse_data_type(struct parser *parser, WCHAR **line)
WCHAR *end;
DWORD val;
if (!**line || tolowerW((*line)[1]) == 'x')
if (!**line || towlower((*line)[1]) == 'x')
return FALSE;
/* "hex(xx):" is special */
@ -434,13 +433,13 @@ static HKEY parse_key_name(WCHAR *key_name, WCHAR **key_path)
if (!key_name) return 0;
*key_path = strchrW(key_name, '\\');
*key_path = wcschr(key_name, '\\');
if (*key_path) (*key_path)++;
for (i = 0; i < ARRAY_SIZE(reg_class_keys); i++)
{
int len = lstrlenW(reg_class_namesW[i]);
if (!strncmpiW(key_name, reg_class_namesW[i], len) &&
if (!wcsnicmp(key_name, reg_class_namesW[i], len) &&
(key_name[len] == 0 || key_name[len] == '\\'))
{
return reg_class_keys[i];
@ -552,13 +551,13 @@ static enum reg_versions parse_file_header(const WCHAR *s)
while (*s == ' ' || *s == '\t') s++;
if (!strcmpW(s, header_31))
if (!lstrcmpW(s, header_31))
return REG_VERSION_31;
if (!strcmpW(s, header_40))
if (!lstrcmpW(s, header_40))
return REG_VERSION_40;
if (!strcmpW(s, header_50))
if (!lstrcmpW(s, header_50))
return REG_VERSION_50;
/* The Windows version accepts registry file headers beginning with "REGEDIT" and ending
@ -566,7 +565,7 @@ static enum reg_versions parse_file_header(const WCHAR *s)
* "REGEDIT 4", "REGEDIT9" and "REGEDIT4FOO" are all treated as valid file headers.
* In all such cases, however, the contents of the registry file are not imported.
*/
if (!strncmpW(s, header_31, 7)) /* "REGEDIT" without NUL */
if (!wcsncmp(s, header_31, 7)) /* "REGEDIT" without NUL */
return REG_VERSION_FUZZY;
return REG_VERSION_INVALID;
@ -618,11 +617,11 @@ static WCHAR *parse_win31_line_state(struct parser *parser, WCHAR *pos)
if (!(line = get_line(parser->file)))
return NULL;
if (strncmpW(line, hkcr, ARRAY_SIZE(hkcr)))
if (wcsncmp(line, hkcr, ARRAY_SIZE(hkcr)))
return line;
/* get key name */
while (line[key_end] && !isspaceW(line[key_end])) key_end++;
while (line[key_end] && !iswspace(line[key_end])) key_end++;
value = line + key_end;
while (*value == ' ' || *value == '\t') value++;
@ -684,7 +683,7 @@ static WCHAR *key_name_state(struct parser *parser, WCHAR *pos)
{
WCHAR *p = pos, *key_end;
if (*p == ' ' || *p == '\t' || !(key_end = strrchrW(p, ']')))
if (*p == ' ' || *p == '\t' || !(key_end = wcsrchr(p, ']')))
goto done;
*key_end = 0;
@ -761,7 +760,7 @@ static WCHAR *data_start_state(struct parser *parser, WCHAR *pos)
while (*p == ' ' || *p == '\t') p++;
/* trim trailing whitespace */
len = strlenW(p);
len = lstrlenW(p);
while (len > 0 && (p[len - 1] == ' ' || p[len - 1] == '\t')) len--;
p[len] = 0;
@ -926,7 +925,7 @@ static WCHAR *hex_multiline_state(struct parser *parser, WCHAR *pos)
while (*line == ' ' || *line == '\t') line++;
if (!*line || *line == ';') return line;
if (!isxdigitW(*line)) goto invalid;
if (!iswxdigit(*line)) goto invalid;
set_state(parser, HEX_DATA);
return line;
@ -1040,11 +1039,11 @@ static WCHAR *get_lineW(FILE *fp)
while (next)
{
static const WCHAR line_endings[] = {'\r','\n',0};
WCHAR *p = strpbrkW(line, line_endings);
WCHAR *p = wcspbrk(line, line_endings);
if (!p)
{
size_t len, count;
len = strlenW(next);
len = lstrlenW(next);
memmove(buf, next, (len + 1) * sizeof(WCHAR));
if (size - len < 3)
{
@ -1217,7 +1216,7 @@ static size_t export_value_name(FILE *fp, WCHAR *name, size_t len, BOOL unicode)
{
WCHAR *str = REGPROC_escape_string(name, len, &line_len);
WCHAR *buf = heap_xalloc((line_len + 4) * sizeof(WCHAR));
line_len = sprintfW(buf, quoted_fmt, str);
line_len = swprintf(buf, quoted_fmt, str);
REGPROC_write_line(fp, buf, unicode);
heap_free(buf);
heap_free(str);
@ -1241,7 +1240,7 @@ static void export_string_data(WCHAR **buf, WCHAR *data, size_t size)
len = size / sizeof(WCHAR) - 1;
str = REGPROC_escape_string(data, len, &line_len);
*buf = heap_xalloc((line_len + 3) * sizeof(WCHAR));
sprintfW(*buf, fmt, str);
swprintf(*buf, fmt, str);
heap_free(str);
}
@ -1250,7 +1249,7 @@ static void export_dword_data(WCHAR **buf, DWORD *data)
static const WCHAR fmt[] = {'d','w','o','r','d',':','%','0','8','x',0};
*buf = heap_xalloc(15 * sizeof(WCHAR));
sprintfW(*buf, fmt, *data);
swprintf(*buf, fmt, *data);
}
static size_t export_hex_data_type(FILE *fp, DWORD type, BOOL unicode)
@ -1267,7 +1266,7 @@ static size_t export_hex_data_type(FILE *fp, DWORD type, BOOL unicode)
else
{
WCHAR *buf = heap_xalloc(15 * sizeof(WCHAR));
line_len = sprintfW(buf, hexp_fmt, type);
line_len = swprintf(buf, hexp_fmt, type);
REGPROC_write_line(fp, buf, unicode);
heap_free(buf);
}
@ -1296,7 +1295,7 @@ static void export_hex_data(FILE *fp, WCHAR **buf, DWORD type, DWORD line_len,
for (i = 0, pos = 0; i < size; i++)
{
pos += sprintfW(*buf + pos, fmt, ((BYTE *)data)[i]);
pos += swprintf(*buf + pos, fmt, ((BYTE *)data)[i]);
if (i == num_commas) break;
(*buf)[pos++] = ',';
(*buf)[pos] = 0;
@ -1361,7 +1360,7 @@ static WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name,
static const WCHAR fmt[] = {'%','s','\\','%','s',0};
subkey_path = heap_xalloc((path_len + subkey_len + 2) * sizeof(WCHAR));
sprintfW(subkey_path, fmt, path, subkey_name);
swprintf(subkey_path, fmt, path, subkey_name);
return subkey_path;
}
@ -1372,7 +1371,7 @@ static void export_key_name(FILE *fp, WCHAR *name, BOOL unicode)
WCHAR *buf;
buf = heap_xalloc((lstrlenW(name) + 7) * sizeof(WCHAR));
sprintfW(buf, fmt, name);
swprintf(buf, fmt, name);
REGPROC_write_line(fp, buf, unicode);
heap_free(buf);
}
@ -1457,7 +1456,7 @@ static FILE *REGPROC_open_export_file(WCHAR *file_name, BOOL unicode)
FILE *file;
static const WCHAR hyphen[] = {'-',0};
if (!strcmpW(file_name, hyphen))
if (!lstrcmpW(file_name, hyphen))
{
file = stdout;
_setmode(_fileno(file), _O_BINARY);