[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 <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id cf1e6d3f3fcb726062b957a973bb0a78b7e00eab by Hugh McMaster <hugh.mcmaster@outlook.com>
This commit is contained in:
winesync 2022-01-16 21:17:20 +01:00 committed by Thomas Csovcsity
parent 61d4db3fde
commit a5469189ad
2 changed files with 4 additions and 4 deletions

View file

@ -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) WCHAR *type, WCHAR separator, WCHAR *data, BOOL force)
{ {
HKEY hkey; HKEY hkey;
DWORD data_type, data_size; DWORD dispos, data_type, data_size;
BYTE *reg_data = NULL; BYTE *reg_data = NULL;
LONG rc; LONG rc;
if (RegCreateKeyExW(root, path, 0, NULL, REG_OPTION_NON_VOLATILE, 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); output_message(STRING_ACCESS_DENIED);
return 1; return 1;
} }
if (!force) if (!force && dispos == REG_OPENED_EXISTING_KEY)
{ {
if (RegQueryValueExW(hkey, value_name, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) if (RegQueryValueExW(hkey, value_name, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{ {

View file

@ -4,4 +4,4 @@ directories:
files: files:
programs/reg/resource.h: base/applications/cmdutils/reg/resource.h programs/reg/resource.h: base/applications/cmdutils/reg/resource.h
tags: tags:
wine: d433d1f122a85b7902b48bae1930eef503a239a5 wine: cf1e6d3f3fcb726062b957a973bb0a78b7e00eab