[PATCH v2 0/2] MR340: regedit: Fix broken handling of REG_DWORD and REG_QWORD values
-- v2: regedit: Use correct printf specifier for UINT64 (QWORD) values https://gitlab.winehq.org/wine/wine/-/merge_requests/340
From: Hugh McMaster <hugh.mcmaster(a)outlook.com> This bug was exposed by 3b1faf59f60c2e5d91321fd8998dd81d90a13e11 Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> --- programs/regedit/edit.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c index c19ef1506fa..47ce233039e 100644 --- a/programs/regedit/edit.c +++ b/programs/regedit/edit.c @@ -443,6 +443,7 @@ BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPW LONG lRet = ERROR_SUCCESS; WCHAR newValue[256]; UINT64 value = 0; + DWORD size_bytes; BOOL result = FALSE; int valueNum, index; HKEY hKey; @@ -466,15 +467,34 @@ BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPW error_code_messagebox(hwnd, IDS_CREATE_VALUE_FAILED); goto done; } - - lRet = RegSetValueExW(hKey, valueName, 0, valueType, (BYTE *)&value, sizeof(value)); + + switch (valueType) + { + case REG_DWORD: + case REG_DWORD_BIG_ENDIAN: + size_bytes = sizeof(DWORD); + break; + case REG_QWORD: + size_bytes = sizeof(UINT64); + break; + case REG_BINARY: + size_bytes = 0; + break; + case REG_MULTI_SZ: + size_bytes = 2 * sizeof(WCHAR); + break; + default: /* REG_NONE, REG_SZ, REG_EXPAND_SZ */ + size_bytes = sizeof(WCHAR); + } + + lRet = RegSetValueExW(hKey, valueName, 0, valueType, (BYTE *)&value, size_bytes); if (lRet) { error_code_messagebox(hwnd, IDS_CREATE_VALUE_FAILED); goto done; } /* Add the new item to the listview */ - index = AddEntryToList(g_pChildWnd->hListWnd, valueName, valueType, (BYTE *)&value, sizeof(value), -1); + index = AddEntryToList(g_pChildWnd->hListWnd, valueName, valueType, (BYTE *)&value, size_bytes, -1); item.state = LVIS_FOCUSED | LVIS_SELECTED; item.stateMask = LVIS_FOCUSED | LVIS_SELECTED; SendMessageW(g_pChildWnd->hListWnd, LVM_SETITEMSTATE, index, (LPARAM)&item); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/340
From: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> --- programs/regedit/listview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c index e314862ee6f..8e40d488b15 100644 --- a/programs/regedit/listview.c +++ b/programs/regedit/listview.c @@ -122,7 +122,7 @@ void format_value_data(HWND hwndLV, int index, DWORD type, void *data, DWORD siz { UINT64 value = *(UINT64 *)data; WCHAR buf[64]; - swprintf(buf, ARRAY_SIZE(buf), L"0x%08Ix (%Iu)", value, value); + swprintf(buf, ARRAY_SIZE(buf), L"0x%08I64x (%I64u)", value, value); ListView_SetItemTextW(hwndLV, index, 2, buf); break; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/340
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=117889 Your paranoid android. === debian11 (build log) === error: patch failed: dlls/winepulse.drv/pulse.c:2207 Task: Patch failed to apply === debian11 (build log) === error: patch failed: dlls/winepulse.drv/pulse.c:2207 Task: Patch failed to apply
participants (3)
-
Hugh McMaster -
Hugh McMaster (@hmc) -
Marvin