From a5469189ad97a3da85aa7b49edcf3efb3767de8d Mon Sep 17 00:00:00 2001 From: winesync Date: Sun, 16 Jan 2022 21:17:20 +0100 Subject: [PATCH] [WINESYNC] reg: Only prompt the user to overwrite registry data if the given key already exists and [/f] is not supplied. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard wine commit id cf1e6d3f3fcb726062b957a973bb0a78b7e00eab by Hugh McMaster --- base/applications/cmdutils/reg/add.c | 6 +++--- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/base/applications/cmdutils/reg/add.c b/base/applications/cmdutils/reg/add.c index 258e3e8cb25..9aaa3fc1acc 100644 --- a/base/applications/cmdutils/reg/add.c +++ b/base/applications/cmdutils/reg/add.c @@ -154,18 +154,18 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, WCHAR *type, WCHAR separator, WCHAR *data, BOOL force) { HKEY hkey; - DWORD data_type, data_size; + DWORD dispos, data_type, data_size; BYTE *reg_data = NULL; LONG rc; if (RegCreateKeyExW(root, path, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_WRITE, NULL, &hkey, NULL)) + KEY_READ|KEY_WRITE, NULL, &hkey, &dispos)) { output_message(STRING_ACCESS_DENIED); return 1; } - if (!force) + if (!force && dispos == REG_OPENED_EXISTING_KEY) { if (RegQueryValueExW(hkey, value_name, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 6fa89b8a5d4..1c8ffb27672 100644 --- a/sdk/tools/winesync/reg.cfg +++ b/sdk/tools/winesync/reg.cfg @@ -4,4 +4,4 @@ directories: files: programs/reg/resource.h: base/applications/cmdutils/reg/resource.h tags: - wine: d433d1f122a85b7902b48bae1930eef503a239a5 + wine: cf1e6d3f3fcb726062b957a973bb0a78b7e00eab