[PATCH 2/2] regedit: Remove unnecessary string conversion when modifying REG_DWORD value.
Nikolay Sivov
wine at gitlab.winehq.org
Thu Jun 23 17:55:29 CDT 2022
From: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
programs/regedit/edit.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c
index e18b6ca5846..c19ef1506fa 100644
--- a/programs/regedit/edit.c
+++ b/programs/regedit/edit.c
@@ -284,16 +284,16 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
DWORD value = *((DWORD*)stringValueData);
stringValueData = heap_xrealloc(stringValueData, 64);
wsprintfW(stringValueData, L"%x", value);
- if (DialogBoxW(0, MAKEINTRESOURCEW(IDD_EDIT_DWORD), hwnd, modify_dlgproc) == IDOK) {
- DWORD val;
- CHAR* valueA = GetMultiByteString(stringValueData);
- if (sscanf(valueA, isDecimal ? "%lu" : "%lx", &val)) {
- lRet = RegSetValueExW(hKey, valueName, 0, type, (BYTE*)&val, sizeof(val));
- if (lRet == ERROR_SUCCESS) result = TRUE;
+ if (DialogBoxW(0, MAKEINTRESOURCEW(IDD_EDIT_DWORD), hwnd, modify_dlgproc) == IDOK)
+ {
+ DWORD val;
+ if (swscanf(stringValueData, isDecimal ? L"%lu" : L"%lx", &val))
+ {
+ lRet = RegSetValueExW(hKey, valueName, 0, type, (BYTE*)&val, sizeof(val));
+ if (lRet == ERROR_SUCCESS) result = TRUE;
else error_code_messagebox(hwnd, IDS_SET_VALUE_FAILED);
- }
- heap_free(valueA);
- }
+ }
+ }
} else if ( type == REG_QWORD ) {
UINT64 value = *((UINT64 *)stringValueData);
stringValueData = heap_xrealloc(stringValueData, 64);
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/305
More information about the wine-devel
mailing list