mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 10:13:56 +00:00
regedit: Use zero as a default for REG_DWORD and REG_QWORD values.
This commit is contained in:
parent
89bbd1327e
commit
93199da8c3
1 changed files with 19 additions and 8 deletions
|
@ -184,15 +184,26 @@ static INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT msg, WPARAM wpa
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL change_dword_base(HWND hwndDlg, BOOL toHex)
|
||||
static void change_dword_base(HWND hwndDlg, BOOL toHex)
|
||||
{
|
||||
WCHAR buf[128];
|
||||
WCHAR buf[64];
|
||||
unsigned int len;
|
||||
UINT64 val;
|
||||
|
||||
if (!GetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf, ARRAY_SIZE(buf))) return FALSE;
|
||||
if (!swscanf(buf, toHex ? L"%I64u" : L"%I64x", &val)) return FALSE;
|
||||
wsprintfW(buf, toHex ? L"%I64x" : L"%I64u", val);
|
||||
return SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf);
|
||||
len = GetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf, ARRAY_SIZE(buf));
|
||||
if (!len) SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, L"0");
|
||||
|
||||
if ((isDecimal && !toHex) || (!isDecimal && toHex))
|
||||
return;
|
||||
|
||||
if (len)
|
||||
{
|
||||
swscanf(buf, toHex ? L"%I64u" : L"%I64x", &val);
|
||||
swprintf(buf, ARRAY_SIZE(buf), toHex ? L"%I64x" : L"%I64u", val);
|
||||
SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf);
|
||||
}
|
||||
|
||||
isDecimal = !toHex;
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
|
@ -217,10 +228,10 @@ static INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT msg, WPARAM wpar
|
|||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDC_DWORD_HEX:
|
||||
if (isDecimal && change_dword_base(hwndDlg, TRUE)) isDecimal = FALSE;
|
||||
change_dword_base(hwndDlg, TRUE);
|
||||
break;
|
||||
case IDC_DWORD_DEC:
|
||||
if (!isDecimal && change_dword_base(hwndDlg, FALSE)) isDecimal = TRUE;
|
||||
change_dword_base(hwndDlg, FALSE);
|
||||
break;
|
||||
case IDOK:
|
||||
params = (struct edit_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER);
|
||||
|
|
Loading…
Reference in a new issue