Commit d433d1f1 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg: Fail if access is denied when adding registry data.

parent a0dc4d7c
...@@ -156,6 +156,7 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, ...@@ -156,6 +156,7 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,
HKEY hkey; HKEY hkey;
DWORD data_type, data_size; DWORD data_type, data_size;
BYTE *reg_data = NULL; BYTE *reg_data = NULL;
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, NULL))
...@@ -199,10 +200,17 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, ...@@ -199,10 +200,17 @@ static int run_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,
return 1; return 1;
} }
RegSetValueExW(hkey, value_name, 0, data_type, reg_data, data_size); rc = RegSetValueExW(hkey, value_name, 0, data_type, reg_data, data_size);
free(reg_data);
free(reg_data);
RegCloseKey(hkey); RegCloseKey(hkey);
if (rc)
{
output_message(STRING_ACCESS_DENIED);
return 1;
}
output_message(STRING_SUCCESS); output_message(STRING_SUCCESS);
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment