regedit: Use wide character string literals in edit.c.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2022-04-14 23:01:33 +10:00 committed by Alexandre Julliard
parent 6b6d084bd4
commit 789cf28375
1 changed files with 3 additions and 7 deletions

View File

@ -85,15 +85,12 @@ static void WINAPIV error_code_messagebox(HWND hwnd, unsigned int msg_id, ...)
static BOOL change_dword_base(HWND hwndDlg, BOOL toHex)
{
static const WCHAR percent_u[] = {'%','u',0};
static const WCHAR percent_x[] = {'%','x',0};
WCHAR buf[128];
DWORD val;
if (!GetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf, ARRAY_SIZE(buf))) return FALSE;
if (!swscanf(buf, toHex ? percent_u : percent_x, &val)) return FALSE;
wsprintfW(buf, toHex ? percent_x : percent_u, val);
if (!swscanf(buf, toHex ? L"%u" : L"%x", &val)) return FALSE;
wsprintfW(buf, toHex ? L"%x" : L"%u", val);
return SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf);
}
@ -281,10 +278,9 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
else error_code_messagebox(hwnd, IDS_SET_VALUE_FAILED);
}
} else if ( type == REG_DWORD ) {
static const WCHAR x[] = {'%','x',0};
DWORD value = *((DWORD*)stringValueData);
stringValueData = heap_xrealloc(stringValueData, 64);
wsprintfW(stringValueData, x, value);
wsprintfW(stringValueData, L"%x", value);
if (DialogBoxW(0, MAKEINTRESOURCEW(IDD_EDIT_DWORD), hwnd, modify_dlgproc) == IDOK) {
DWORD val;
CHAR* valueA = GetMultiByteString(stringValueData);