2003-12-03 20:25:24 +00:00
|
|
|
/*
|
|
|
|
* Registry editing UI functions.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Dimitrie O. Paun
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-12-03 20:25:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
#include <commdlg.h>
|
|
|
|
#include <cderr.h>
|
|
|
|
#include <shellapi.h>
|
2004-03-12 19:44:47 +00:00
|
|
|
#include <shlwapi.h>
|
2003-12-03 20:25:24 +00:00
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
2004-01-05 21:14:19 +00:00
|
|
|
static BOOL isDecimal;
|
2003-12-03 20:25:24 +00:00
|
|
|
|
2005-04-14 11:30:31 +00:00
|
|
|
struct edit_params
|
|
|
|
{
|
2018-07-16 12:20:49 +00:00
|
|
|
HKEY hkey;
|
|
|
|
const WCHAR *value_name;
|
2018-07-16 12:20:50 +00:00
|
|
|
DWORD type;
|
2018-07-16 12:20:49 +00:00
|
|
|
void *data;
|
|
|
|
DWORD size;
|
2005-04-14 11:30:31 +00:00
|
|
|
};
|
|
|
|
|
2021-10-25 09:01:38 +00:00
|
|
|
static int vmessagebox(HWND hwnd, int buttons, int titleId, int resId, va_list va_args)
|
2003-12-03 20:25:24 +00:00
|
|
|
{
|
2009-01-06 20:09:43 +00:00
|
|
|
WCHAR title[256];
|
2017-02-01 12:56:27 +00:00
|
|
|
WCHAR fmt[1024];
|
|
|
|
WCHAR *str;
|
|
|
|
int ret;
|
2003-12-03 20:25:24 +00:00
|
|
|
|
2018-05-21 13:34:49 +00:00
|
|
|
LoadStringW(hInst, titleId, title, ARRAY_SIZE(title));
|
|
|
|
LoadStringW(hInst, resId, fmt, ARRAY_SIZE(fmt));
|
2003-12-03 20:25:24 +00:00
|
|
|
|
2017-02-01 12:56:27 +00:00
|
|
|
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
|
|
|
fmt, 0, 0, (WCHAR *)&str, 0, &va_args);
|
|
|
|
ret = MessageBoxW(hwnd, str, title, buttons);
|
|
|
|
LocalFree(str);
|
2004-01-05 21:14:19 +00:00
|
|
|
|
2017-02-01 12:56:27 +00:00
|
|
|
return ret;
|
2004-01-05 21:14:19 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 09:21:53 +00:00
|
|
|
int WINAPIV messagebox(HWND hwnd, int buttons, int titleId, int resId, ...)
|
2004-01-05 21:14:19 +00:00
|
|
|
{
|
2021-10-25 09:01:38 +00:00
|
|
|
va_list ap;
|
2004-01-05 21:14:19 +00:00
|
|
|
INT result;
|
|
|
|
|
2021-10-25 09:01:38 +00:00
|
|
|
va_start(ap, resId);
|
2004-01-05 21:14:19 +00:00
|
|
|
result = vmessagebox(hwnd, buttons, titleId, resId, ap);
|
2021-10-25 09:01:38 +00:00
|
|
|
va_end(ap);
|
2003-12-03 20:25:24 +00:00
|
|
|
|
2004-01-05 21:14:19 +00:00
|
|
|
return result;
|
2003-12-03 20:25:24 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 09:21:53 +00:00
|
|
|
static void WINAPIV error_code_messagebox(HWND hwnd, unsigned int msg_id, ...)
|
2004-01-05 21:14:19 +00:00
|
|
|
{
|
2021-10-25 09:01:38 +00:00
|
|
|
va_list ap;
|
2004-01-05 21:14:19 +00:00
|
|
|
|
2021-10-25 09:01:38 +00:00
|
|
|
va_start(ap, msg_id);
|
2017-02-01 12:56:51 +00:00
|
|
|
vmessagebox(hwnd, MB_OK|MB_ICONERROR, IDS_ERROR, msg_id, ap);
|
2021-10-25 09:01:38 +00:00
|
|
|
va_end(ap);
|
2004-01-05 21:14:19 +00:00
|
|
|
}
|
|
|
|
|
2022-07-11 11:39:32 +00:00
|
|
|
static BOOL update_registry_value(HWND hwndDlg, struct edit_params *params)
|
2022-07-08 00:44:21 +00:00
|
|
|
{
|
|
|
|
HWND hwndValue;
|
|
|
|
unsigned int len;
|
2022-07-11 11:39:32 +00:00
|
|
|
WCHAR *buf;
|
|
|
|
LONG ret;
|
|
|
|
|
|
|
|
hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA);
|
|
|
|
len = GetWindowTextLengthW(hwndValue);
|
|
|
|
buf = malloc((len + 1) * sizeof(WCHAR));
|
|
|
|
len = GetWindowTextW(hwndValue, buf, len + 1);
|
|
|
|
|
|
|
|
free(params->data);
|
2022-07-18 12:27:01 +00:00
|
|
|
|
|
|
|
switch (params->type)
|
|
|
|
{
|
2022-07-24 12:41:05 +00:00
|
|
|
case REG_SZ:
|
|
|
|
case REG_EXPAND_SZ:
|
|
|
|
params->data = buf;
|
|
|
|
params->size = (len + 1) * sizeof(WCHAR);
|
|
|
|
break;
|
2022-07-18 12:27:01 +00:00
|
|
|
case REG_DWORD:
|
|
|
|
params->size = sizeof(DWORD);
|
|
|
|
params->data = malloc(params->size);
|
|
|
|
swscanf(buf, isDecimal ? L"%lu" : L"%lx", params->data);
|
2022-07-26 02:19:43 +00:00
|
|
|
free(buf);
|
2022-07-18 12:27:01 +00:00
|
|
|
break;
|
|
|
|
case REG_QWORD:
|
|
|
|
params->size = sizeof(UINT64);
|
|
|
|
params->data = malloc(params->size);
|
|
|
|
swscanf(buf, isDecimal ? L"%I64u" : L"%I64x", params->data);
|
2022-07-26 02:19:43 +00:00
|
|
|
free(buf);
|
2022-07-18 12:27:01 +00:00
|
|
|
break;
|
|
|
|
case REG_MULTI_SZ:
|
|
|
|
{
|
|
|
|
WCHAR *tmp = malloc((len + 2) * sizeof(WCHAR));
|
|
|
|
unsigned int i, j;
|
|
|
|
|
|
|
|
for (i = 0, j = 0; i < len; i++)
|
|
|
|
{
|
|
|
|
if (buf[i] == '\r' && buf[i + 1] == '\n')
|
|
|
|
{
|
|
|
|
if (tmp[j - 1]) tmp[j++] = 0;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
else tmp[j++] = buf[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp[j++] = 0;
|
|
|
|
tmp[j++] = 0;
|
|
|
|
|
|
|
|
free(buf);
|
|
|
|
params->data = tmp;
|
|
|
|
params->size = j * sizeof(WCHAR);
|
|
|
|
break;
|
|
|
|
}
|
2022-07-24 12:41:05 +00:00
|
|
|
default: /* hex data types */
|
|
|
|
free(buf);
|
|
|
|
params->size = SendMessageW(hwndValue, HEM_GETDATA, 0, 0);
|
|
|
|
params->data = malloc(params->size);
|
|
|
|
SendMessageW(hwndValue, HEM_GETDATA, (WPARAM)params->size, (LPARAM)params->data);
|
2022-07-18 12:27:01 +00:00
|
|
|
}
|
2022-07-11 11:39:32 +00:00
|
|
|
|
|
|
|
ret = RegSetValueExW(params->hkey, params->value_name, 0, params->type, (BYTE *)params->data, params->size);
|
|
|
|
if (ret) error_code_messagebox(hwndDlg, IDS_SET_VALUE_FAILED);
|
|
|
|
|
|
|
|
return !ret;
|
|
|
|
}
|
|
|
|
|
2022-07-25 10:40:27 +00:00
|
|
|
static void set_dlgproc_value_name(HWND hwndDlg, struct edit_params *params)
|
|
|
|
{
|
|
|
|
if (params->value_name)
|
|
|
|
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, params->value_name);
|
|
|
|
else
|
|
|
|
SetDlgItemTextW(hwndDlg, IDC_VALUE_NAME, g_pszDefaultValueName);
|
|
|
|
}
|
|
|
|
|
2022-07-11 11:39:32 +00:00
|
|
|
static INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT msg, WPARAM wparam, LPARAM lparam)
|
|
|
|
{
|
|
|
|
struct edit_params *params;
|
|
|
|
int ret = 0;
|
2022-07-08 00:44:21 +00:00
|
|
|
|
|
|
|
switch (msg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2022-07-11 11:39:32 +00:00
|
|
|
params = (struct edit_params *)lparam;
|
|
|
|
SetWindowLongPtrW(hwndDlg, DWLP_USER, (ULONG_PTR)params);
|
2022-07-25 10:40:27 +00:00
|
|
|
set_dlgproc_value_name(hwndDlg, params);
|
2022-07-11 11:39:32 +00:00
|
|
|
SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, params->data);
|
2022-07-08 00:44:21 +00:00
|
|
|
return TRUE;
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wparam))
|
|
|
|
{
|
|
|
|
case IDOK:
|
2022-07-11 11:39:32 +00:00
|
|
|
params = (struct edit_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER);
|
|
|
|
ret = update_registry_value(hwndDlg, params);
|
2022-07-08 00:44:21 +00:00
|
|
|
/* fall through */
|
|
|
|
case IDCANCEL:
|
2022-07-11 11:39:32 +00:00
|
|
|
EndDialog(hwndDlg, ret);
|
2022-07-08 00:44:21 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2022-07-28 12:19:14 +00:00
|
|
|
static void set_dword_edit_limit(HWND hwndDlg, DWORD type)
|
|
|
|
{
|
|
|
|
if (isDecimal)
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, EM_SETLIMITTEXT, type == REG_DWORD ? 10 : 20, 0);
|
|
|
|
else
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, EM_SETLIMITTEXT, type == REG_DWORD ? 8 : 16, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void change_dword_base(HWND hwndDlg, BOOL toHex, DWORD type)
|
2004-01-05 21:14:19 +00:00
|
|
|
{
|
2022-07-27 07:12:38 +00:00
|
|
|
WCHAR buf[64];
|
|
|
|
unsigned int len;
|
2022-06-23 15:51:22 +00:00
|
|
|
UINT64 val;
|
2004-01-05 21:14:19 +00:00
|
|
|
|
2022-07-27 07:12:38 +00:00
|
|
|
len = GetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf, ARRAY_SIZE(buf));
|
|
|
|
if (!len) SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, L"0");
|
|
|
|
|
|
|
|
if ((isDecimal && !toHex) || (!isDecimal && toHex))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (len)
|
|
|
|
{
|
|
|
|
swscanf(buf, toHex ? L"%I64u" : L"%I64x", &val);
|
|
|
|
swprintf(buf, ARRAY_SIZE(buf), toHex ? L"%I64x" : L"%I64u", val);
|
|
|
|
SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
isDecimal = !toHex;
|
2022-07-28 12:19:14 +00:00
|
|
|
|
|
|
|
set_dword_edit_limit(hwndDlg, type);
|
2004-01-05 21:14:19 +00:00
|
|
|
}
|
|
|
|
|
2022-07-18 12:27:01 +00:00
|
|
|
static INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT msg, WPARAM wparam, LPARAM lparam)
|
2003-12-03 20:25:24 +00:00
|
|
|
{
|
2022-07-28 12:19:14 +00:00
|
|
|
static struct edit_params *params;
|
2022-07-18 12:27:01 +00:00
|
|
|
WCHAR buf[64];
|
|
|
|
int ret = 0;
|
2003-12-03 20:25:24 +00:00
|
|
|
|
2022-07-18 12:27:01 +00:00
|
|
|
switch (msg)
|
|
|
|
{
|
2003-12-08 22:48:07 +00:00
|
|
|
case WM_INITDIALOG:
|
2022-07-18 12:27:01 +00:00
|
|
|
params = (struct edit_params *)lparam;
|
|
|
|
SetWindowLongPtrW(hwndDlg, DWLP_USER, (ULONG_PTR)params);
|
2022-07-25 10:40:27 +00:00
|
|
|
set_dlgproc_value_name(hwndDlg, params);
|
2022-07-18 12:27:01 +00:00
|
|
|
SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, params->data);
|
2018-07-16 12:20:48 +00:00
|
|
|
CheckRadioButton(hwndDlg, IDC_DWORD_HEX, IDC_DWORD_DEC, IDC_DWORD_HEX);
|
|
|
|
isDecimal = FALSE;
|
2022-07-18 12:27:01 +00:00
|
|
|
if (params->type == REG_QWORD && LoadStringW(GetModuleHandleW(0), IDS_EDIT_QWORD, buf, ARRAY_SIZE(buf)))
|
|
|
|
SetWindowTextW(hwndDlg, buf);
|
2022-07-28 12:19:14 +00:00
|
|
|
set_dword_edit_limit(hwndDlg, params->type);
|
2003-12-08 22:48:07 +00:00
|
|
|
return TRUE;
|
|
|
|
case WM_COMMAND:
|
2022-07-18 12:27:01 +00:00
|
|
|
switch (LOWORD(wparam))
|
|
|
|
{
|
2004-01-05 21:14:19 +00:00
|
|
|
case IDC_DWORD_HEX:
|
2022-07-28 12:19:14 +00:00
|
|
|
change_dword_base(hwndDlg, TRUE, params->type);
|
2022-07-18 12:27:01 +00:00
|
|
|
break;
|
2004-01-05 21:14:19 +00:00
|
|
|
case IDC_DWORD_DEC:
|
2022-07-28 12:19:14 +00:00
|
|
|
change_dword_base(hwndDlg, FALSE, params->type);
|
2022-07-18 12:27:01 +00:00
|
|
|
break;
|
2003-12-08 22:48:07 +00:00
|
|
|
case IDOK:
|
2022-07-18 12:27:01 +00:00
|
|
|
params = (struct edit_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER);
|
2022-07-28 04:53:49 +00:00
|
|
|
if (!SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, EM_LINELENGTH, 0, 0))
|
|
|
|
SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, L"0");
|
2022-07-18 12:27:01 +00:00
|
|
|
ret = update_registry_value(hwndDlg, params);
|
|
|
|
/* fall through */
|
2003-12-08 22:48:07 +00:00
|
|
|
case IDCANCEL:
|
2022-07-18 12:27:01 +00:00
|
|
|
EndDialog(hwndDlg, ret);
|
2003-12-08 22:48:07 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2003-12-03 20:25:24 +00:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2022-07-18 12:27:01 +00:00
|
|
|
static INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2005-04-14 11:30:31 +00:00
|
|
|
{
|
|
|
|
struct edit_params *params;
|
2022-07-24 12:41:05 +00:00
|
|
|
int ret = 0;
|
2005-04-14 11:30:31 +00:00
|
|
|
|
|
|
|
switch(uMsg) {
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
params = (struct edit_params *)lParam;
|
2011-04-16 08:07:13 +00:00
|
|
|
SetWindowLongPtrW(hwndDlg, DWLP_USER, (ULONG_PTR)params);
|
2022-07-25 10:40:27 +00:00
|
|
|
set_dlgproc_value_name(hwndDlg, params);
|
2018-07-16 12:20:49 +00:00
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, HEM_SETDATA, (WPARAM)params->size, (LPARAM)params->data);
|
2018-03-11 17:28:31 +00:00
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, WM_SETFONT, (WPARAM) GetStockObject(ANSI_FIXED_FONT), TRUE);
|
2005-04-14 11:30:31 +00:00
|
|
|
return TRUE;
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam)) {
|
|
|
|
case IDOK:
|
2011-04-16 08:07:13 +00:00
|
|
|
params = (struct edit_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER);
|
2022-07-24 12:41:05 +00:00
|
|
|
ret = update_registry_value(hwndDlg, params);
|
|
|
|
/* fall through */
|
2005-04-14 11:30:31 +00:00
|
|
|
case IDCANCEL:
|
2022-07-24 12:41:05 +00:00
|
|
|
EndDialog(hwndDlg, ret);
|
2005-04-14 11:30:31 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2022-07-21 08:50:36 +00:00
|
|
|
static BOOL read_value(HWND hwnd, struct edit_params *params)
|
2008-08-29 19:37:43 +00:00
|
|
|
{
|
2022-07-21 08:50:36 +00:00
|
|
|
LONG ret;
|
|
|
|
WCHAR *buf = NULL;
|
2008-08-29 19:37:43 +00:00
|
|
|
|
2022-07-21 08:50:36 +00:00
|
|
|
if ((ret = RegQueryValueExW(params->hkey, params->value_name, NULL, ¶ms->type, NULL, ¶ms->size)))
|
|
|
|
{
|
|
|
|
if (ret == ERROR_FILE_NOT_FOUND && !params->value_name)
|
|
|
|
{
|
|
|
|
params->type = REG_SZ;
|
|
|
|
params->size = sizeof(WCHAR);
|
|
|
|
params->data = malloc(params->size);
|
|
|
|
*(WCHAR *)params->data = 0;
|
|
|
|
return TRUE;
|
2008-08-29 19:37:43 +00:00
|
|
|
}
|
2022-07-03 12:29:22 +00:00
|
|
|
|
2022-07-21 08:50:36 +00:00
|
|
|
goto error;
|
2008-08-29 19:37:43 +00:00
|
|
|
}
|
|
|
|
|
2022-07-21 08:50:36 +00:00
|
|
|
buf = malloc(params->size + sizeof(WCHAR));
|
|
|
|
|
|
|
|
if (RegQueryValueExW(params->hkey, params->value_name, NULL, ¶ms->type, (BYTE *)buf, ¶ms->size))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
if (params->size % sizeof(WCHAR) == 0)
|
|
|
|
buf[params->size / sizeof(WCHAR)] = 0;
|
|
|
|
|
|
|
|
params->data = buf;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
error:
|
|
|
|
error_code_messagebox(hwnd, IDS_BAD_VALUE, params->value_name);
|
|
|
|
free(buf);
|
|
|
|
params->data = NULL;
|
|
|
|
return FALSE;
|
2008-08-29 19:37:43 +00:00
|
|
|
}
|
|
|
|
|
2008-08-21 21:49:34 +00:00
|
|
|
BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPWSTR keyName)
|
2004-01-03 00:33:56 +00:00
|
|
|
{
|
2004-01-16 02:21:23 +00:00
|
|
|
BOOL result = FALSE;
|
2004-01-06 20:38:56 +00:00
|
|
|
LONG lRet = ERROR_SUCCESS;
|
2006-10-23 19:30:58 +00:00
|
|
|
HKEY retKey = NULL;
|
2008-08-21 21:49:34 +00:00
|
|
|
WCHAR newKey[MAX_NEW_KEY_LEN - 4];
|
2004-01-06 20:38:56 +00:00
|
|
|
int keyNum;
|
2004-01-16 02:21:23 +00:00
|
|
|
HKEY hKey;
|
2004-01-03 00:33:56 +00:00
|
|
|
|
2008-08-21 21:49:34 +00:00
|
|
|
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_CREATE_SUB_KEY, &hKey);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) {
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_CREATE_KEY_FAILED);
|
2005-03-21 10:29:09 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2004-01-03 00:33:56 +00:00
|
|
|
|
2018-05-21 13:34:49 +00:00
|
|
|
if (!LoadStringW(GetModuleHandleW(0), IDS_NEWKEY, newKey, ARRAY_SIZE(newKey))) goto done;
|
2004-01-03 00:33:56 +00:00
|
|
|
|
2017-02-01 12:57:32 +00:00
|
|
|
/* try to find a name for the key being created (maximum = 100 attempts) */
|
2004-01-06 20:38:56 +00:00
|
|
|
for (keyNum = 1; keyNum < 100; keyNum++) {
|
2008-08-21 21:49:34 +00:00
|
|
|
wsprintfW(keyName, newKey, keyNum);
|
|
|
|
lRet = RegOpenKeyW(hKey, keyName, &retKey);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) break;
|
2004-01-06 20:38:56 +00:00
|
|
|
RegCloseKey(retKey);
|
2004-01-03 00:33:56 +00:00
|
|
|
}
|
2004-01-16 02:21:23 +00:00
|
|
|
if (lRet == ERROR_SUCCESS) goto done;
|
2004-01-03 00:33:56 +00:00
|
|
|
|
2008-08-21 21:49:34 +00:00
|
|
|
lRet = RegCreateKeyW(hKey, keyName, &retKey);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) {
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_CREATE_KEY_FAILED);
|
2005-03-21 10:29:09 +00:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2004-01-16 02:21:23 +00:00
|
|
|
result = TRUE;
|
2004-01-06 20:38:56 +00:00
|
|
|
|
2004-01-16 02:21:23 +00:00
|
|
|
done:
|
2004-01-06 20:38:56 +00:00
|
|
|
RegCloseKey(retKey);
|
2004-01-16 02:21:23 +00:00
|
|
|
return result;
|
2004-01-03 00:33:56 +00:00
|
|
|
}
|
|
|
|
|
2022-07-18 12:27:01 +00:00
|
|
|
static void format_dlgproc_string(struct edit_params *params)
|
|
|
|
{
|
|
|
|
int i, j, count, len;
|
|
|
|
WCHAR *str, *buf;
|
|
|
|
|
|
|
|
if (params->type == REG_DWORD || params->type == REG_QWORD)
|
|
|
|
{
|
|
|
|
UINT64 value = *((UINT64 *)params->data);
|
|
|
|
|
|
|
|
params->data = realloc(params->data, 32 * sizeof(WCHAR));
|
|
|
|
swprintf(params->data, 32, params->type == REG_DWORD ? L"%lx" : L"%I64x", value);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* REG_MULTI_SZ */
|
|
|
|
len = params->size / sizeof(WCHAR);
|
|
|
|
str = params->data;
|
|
|
|
|
|
|
|
for (i = 0, count = 0; i < len; i++)
|
|
|
|
{
|
|
|
|
if (!str[i] && str[i + 1]) count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf = malloc(params->size + (count * sizeof(WCHAR)));
|
|
|
|
|
|
|
|
for (i = 0, j = 0; i < len; i++)
|
|
|
|
{
|
|
|
|
if (!str[i] && str[i + 1])
|
|
|
|
{
|
|
|
|
buf[j++] = '\r';
|
|
|
|
buf[j++] = '\n';
|
|
|
|
}
|
|
|
|
else buf[j++] = str[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
free(params->data);
|
|
|
|
str = NULL;
|
|
|
|
params->data = buf;
|
|
|
|
}
|
|
|
|
|
2008-08-29 19:37:43 +00:00
|
|
|
BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
|
2003-12-03 20:25:24 +00:00
|
|
|
{
|
2022-07-11 11:39:32 +00:00
|
|
|
struct edit_params params;
|
|
|
|
BOOL result = FALSE;
|
2003-12-03 20:25:24 +00:00
|
|
|
|
2022-07-21 08:50:36 +00:00
|
|
|
if (RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, ¶ms.hkey))
|
|
|
|
{
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_SET_VALUE_FAILED);
|
2022-07-21 08:50:36 +00:00
|
|
|
return FALSE;
|
2005-03-21 10:29:09 +00:00
|
|
|
}
|
2003-12-03 20:25:24 +00:00
|
|
|
|
2022-07-11 11:39:32 +00:00
|
|
|
params.value_name = valueName;
|
2022-07-21 08:50:36 +00:00
|
|
|
|
|
|
|
if (!read_value(hwnd, ¶ms))
|
|
|
|
{
|
|
|
|
RegCloseKey(params.hkey);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2022-07-11 11:39:32 +00:00
|
|
|
|
2022-07-18 12:27:01 +00:00
|
|
|
switch (params.type)
|
2017-08-07 12:29:01 +00:00
|
|
|
{
|
2022-07-18 12:27:01 +00:00
|
|
|
case REG_SZ:
|
|
|
|
case REG_EXPAND_SZ:
|
|
|
|
result = DialogBoxParamW(NULL, MAKEINTRESOURCEW(IDD_EDIT_STRING), hwnd,
|
|
|
|
modify_string_dlgproc, (LPARAM)¶ms);
|
|
|
|
break;
|
|
|
|
case REG_DWORD:
|
|
|
|
case REG_QWORD:
|
|
|
|
format_dlgproc_string(¶ms);
|
|
|
|
result = DialogBoxParamW(NULL, MAKEINTRESOURCEW(IDD_EDIT_DWORD), hwnd,
|
|
|
|
modify_dword_dlgproc, (LPARAM)¶ms);
|
|
|
|
break;
|
|
|
|
case REG_MULTI_SZ:
|
|
|
|
format_dlgproc_string(¶ms);
|
|
|
|
result = DialogBoxParamW(NULL, MAKEINTRESOURCEW(IDD_EDIT_MULTI_STRING), hwnd,
|
|
|
|
modify_string_dlgproc, (LPARAM)¶ms);
|
|
|
|
break;
|
|
|
|
default: /* hex data types */
|
2017-08-07 12:29:01 +00:00
|
|
|
result = DialogBoxParamW(NULL, MAKEINTRESOURCEW(IDD_EDIT_BINARY), hwnd,
|
2022-07-18 12:27:01 +00:00
|
|
|
modify_binary_dlgproc, (LPARAM)¶ms);
|
2003-12-03 20:25:24 +00:00
|
|
|
}
|
|
|
|
|
2017-05-29 08:20:44 +00:00
|
|
|
/* Update the listview item with the new data string */
|
|
|
|
if (result)
|
|
|
|
{
|
|
|
|
int index = SendMessageW(g_pChildWnd->hListWnd, LVM_GETNEXTITEM, -1,
|
|
|
|
MAKELPARAM(LVNI_FOCUSED | LVNI_SELECTED, 0));
|
2022-07-21 08:50:36 +00:00
|
|
|
|
|
|
|
format_value_data(g_pChildWnd->hListWnd, index, params.type, params.data, params.size);
|
2017-05-29 08:20:44 +00:00
|
|
|
}
|
|
|
|
|
2022-07-21 08:50:36 +00:00
|
|
|
free(params.data);
|
|
|
|
RegCloseKey(params.hkey);
|
2003-12-03 20:25:24 +00:00
|
|
|
return result;
|
|
|
|
}
|
2004-01-05 21:14:19 +00:00
|
|
|
|
2008-08-09 00:25:34 +00:00
|
|
|
BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath)
|
2004-03-12 19:44:47 +00:00
|
|
|
{
|
|
|
|
BOOL result = FALSE;
|
|
|
|
LONG lRet;
|
|
|
|
HKEY hKey;
|
2008-08-09 00:25:34 +00:00
|
|
|
|
|
|
|
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ|KEY_SET_VALUE, &hKey);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) {
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_DELETE_KEY_FAILED);
|
2005-03-21 10:29:09 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2004-03-12 19:44:47 +00:00
|
|
|
|
2017-07-12 11:09:23 +00:00
|
|
|
if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_KEY_TITLE,
|
|
|
|
IDS_DELETE_KEY_TEXT) != IDYES)
|
2004-03-12 19:44:47 +00:00
|
|
|
goto done;
|
|
|
|
|
2008-08-09 00:25:34 +00:00
|
|
|
lRet = SHDeleteKeyW(hKeyRoot, keyPath);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) {
|
2017-02-01 12:56:51 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_BAD_KEY, keyPath);
|
2004-03-12 19:44:47 +00:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
result = TRUE;
|
|
|
|
|
|
|
|
done:
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2018-05-28 13:48:06 +00:00
|
|
|
BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
|
2004-01-05 21:14:19 +00:00
|
|
|
{
|
2004-01-16 02:21:23 +00:00
|
|
|
BOOL result = FALSE;
|
2004-01-05 21:14:19 +00:00
|
|
|
LONG lRet;
|
2004-01-16 02:21:23 +00:00
|
|
|
HKEY hKey;
|
2004-01-05 21:14:19 +00:00
|
|
|
|
2008-08-09 00:25:34 +00:00
|
|
|
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) return FALSE;
|
2004-01-05 21:14:19 +00:00
|
|
|
|
2018-05-28 13:48:07 +00:00
|
|
|
lRet = RegDeleteValueW(hKey, valueName);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet && valueName) {
|
2017-02-01 12:56:51 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_BAD_VALUE, valueName);
|
2004-01-05 21:14:19 +00:00
|
|
|
}
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) goto done;
|
2004-01-16 02:21:23 +00:00
|
|
|
result = TRUE;
|
|
|
|
|
|
|
|
done:
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
return result;
|
2004-01-05 21:14:19 +00:00
|
|
|
}
|
2004-01-06 20:38:56 +00:00
|
|
|
|
2008-08-28 14:18:44 +00:00
|
|
|
BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPWSTR valueName)
|
2004-01-06 20:38:56 +00:00
|
|
|
{
|
|
|
|
LONG lRet = ERROR_SUCCESS;
|
2008-08-28 14:18:44 +00:00
|
|
|
WCHAR newValue[256];
|
2022-06-23 15:51:22 +00:00
|
|
|
UINT64 value = 0;
|
2022-06-29 05:49:24 +00:00
|
|
|
DWORD size_bytes;
|
2004-01-16 02:21:23 +00:00
|
|
|
BOOL result = FALSE;
|
2017-05-29 08:20:34 +00:00
|
|
|
int valueNum, index;
|
2004-01-16 02:21:23 +00:00
|
|
|
HKEY hKey;
|
2017-05-29 08:20:34 +00:00
|
|
|
LVITEMW item;
|
2004-01-06 20:38:56 +00:00
|
|
|
|
2008-08-28 14:18:44 +00:00
|
|
|
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) {
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_CREATE_VALUE_FAILED);
|
2005-03-21 10:29:09 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2004-01-06 20:38:56 +00:00
|
|
|
|
2018-05-21 13:34:49 +00:00
|
|
|
if (!LoadStringW(GetModuleHandleW(0), IDS_NEWVALUE, newValue, ARRAY_SIZE(newValue))) goto done;
|
2004-01-06 20:38:56 +00:00
|
|
|
|
2017-02-01 12:57:32 +00:00
|
|
|
/* try to find a name for the value being created (maximum = 100 attempts) */
|
2004-01-06 20:38:56 +00:00
|
|
|
for (valueNum = 1; valueNum < 100; valueNum++) {
|
2008-08-28 14:18:44 +00:00
|
|
|
wsprintfW(valueName, newValue, valueNum);
|
|
|
|
lRet = RegQueryValueExW(hKey, valueName, 0, 0, 0, 0);
|
2005-03-21 10:29:09 +00:00
|
|
|
if (lRet == ERROR_FILE_NOT_FOUND) break;
|
|
|
|
}
|
|
|
|
if (lRet != ERROR_FILE_NOT_FOUND) {
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_CREATE_VALUE_FAILED);
|
2005-03-21 10:29:09 +00:00
|
|
|
goto done;
|
2004-01-06 20:38:56 +00:00
|
|
|
}
|
2022-06-29 05:49:24 +00:00
|
|
|
|
|
|
|
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);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) {
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_CREATE_VALUE_FAILED);
|
2005-03-21 10:29:09 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2017-05-29 08:20:34 +00:00
|
|
|
|
|
|
|
/* Add the new item to the listview */
|
2022-06-29 05:49:24 +00:00
|
|
|
index = AddEntryToList(g_pChildWnd->hListWnd, valueName, valueType, (BYTE *)&value, size_bytes, -1);
|
2017-05-29 08:20:34 +00:00
|
|
|
item.state = LVIS_FOCUSED | LVIS_SELECTED;
|
|
|
|
item.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
|
|
|
|
SendMessageW(g_pChildWnd->hListWnd, LVM_SETITEMSTATE, index, (LPARAM)&item);
|
|
|
|
|
2004-01-16 02:21:23 +00:00
|
|
|
result = TRUE;
|
2004-01-06 20:38:56 +00:00
|
|
|
|
2004-01-16 02:21:23 +00:00
|
|
|
done:
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
return result;
|
2004-01-06 20:38:56 +00:00
|
|
|
}
|
2004-01-13 23:18:12 +00:00
|
|
|
|
2008-08-29 20:20:26 +00:00
|
|
|
BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR oldName, LPCWSTR newName)
|
2004-01-13 23:18:12 +00:00
|
|
|
{
|
2022-07-21 08:50:36 +00:00
|
|
|
struct edit_params params;
|
2004-01-13 23:18:12 +00:00
|
|
|
BOOL result = FALSE;
|
|
|
|
|
2004-05-04 02:55:28 +00:00
|
|
|
if (!oldName) return FALSE;
|
2004-01-16 23:02:44 +00:00
|
|
|
if (!newName) return FALSE;
|
|
|
|
|
2022-07-21 08:50:36 +00:00
|
|
|
if (RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, ¶ms.hkey))
|
|
|
|
{
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_RENAME_VALUE_FAILED);
|
2022-07-21 08:50:36 +00:00
|
|
|
return FALSE;
|
2005-03-21 10:29:09 +00:00
|
|
|
}
|
2018-05-21 13:34:57 +00:00
|
|
|
|
2022-07-21 08:50:36 +00:00
|
|
|
if (!RegQueryValueExW(params.hkey, newName, NULL, NULL, NULL, NULL))
|
|
|
|
{
|
2017-02-01 12:57:20 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_VALUE_EXISTS, oldName);
|
|
|
|
goto done;
|
|
|
|
}
|
2022-07-21 08:50:36 +00:00
|
|
|
|
|
|
|
params.value_name = oldName;
|
|
|
|
if (!read_value(hwnd, ¶ms)) goto done;
|
|
|
|
|
|
|
|
if (RegSetValueExW(params.hkey, newName, 0, params.type, (BYTE *)params.data, params.size))
|
|
|
|
{
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_RENAME_VALUE_FAILED);
|
2022-07-21 08:50:36 +00:00
|
|
|
goto done;
|
2005-03-21 10:29:09 +00:00
|
|
|
}
|
2022-07-21 08:50:36 +00:00
|
|
|
|
|
|
|
if (RegDeleteValueW(params.hkey, oldName))
|
|
|
|
{
|
|
|
|
RegDeleteValueW(params.hkey, newName);
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_RENAME_VALUE_FAILED);
|
2022-07-21 08:50:36 +00:00
|
|
|
goto done;
|
2004-01-13 23:18:12 +00:00
|
|
|
}
|
2022-07-21 08:50:36 +00:00
|
|
|
|
2004-01-13 23:18:12 +00:00
|
|
|
result = TRUE;
|
|
|
|
|
|
|
|
done:
|
2022-07-21 08:50:36 +00:00
|
|
|
free(params.data);
|
|
|
|
RegCloseKey(params.hkey);
|
2004-01-13 23:18:12 +00:00
|
|
|
return result;
|
|
|
|
}
|
2004-03-15 20:19:38 +00:00
|
|
|
|
2008-08-30 21:50:24 +00:00
|
|
|
BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName)
|
2004-03-15 20:19:38 +00:00
|
|
|
{
|
2008-08-30 21:50:24 +00:00
|
|
|
LPWSTR parentPath = 0;
|
|
|
|
LPCWSTR srcSubKey = 0;
|
2004-03-15 20:19:38 +00:00
|
|
|
HKEY parentKey = 0;
|
|
|
|
HKEY destKey = 0;
|
|
|
|
BOOL result = FALSE;
|
|
|
|
LONG lRet;
|
2005-03-21 10:29:09 +00:00
|
|
|
DWORD disposition;
|
2004-03-15 20:19:38 +00:00
|
|
|
|
|
|
|
if (!keyPath || !newName) return FALSE;
|
|
|
|
|
2019-04-01 09:47:50 +00:00
|
|
|
if (!wcsrchr(keyPath, '\\')) {
|
2004-03-15 20:19:38 +00:00
|
|
|
parentKey = hRootKey;
|
|
|
|
srcSubKey = keyPath;
|
|
|
|
} else {
|
2008-08-30 21:50:24 +00:00
|
|
|
LPWSTR srcSubKey_copy;
|
2006-10-05 21:01:55 +00:00
|
|
|
|
2023-09-24 18:24:10 +00:00
|
|
|
parentPath = wcsdup(keyPath);
|
2019-04-01 09:47:50 +00:00
|
|
|
srcSubKey_copy = wcsrchr(parentPath, '\\');
|
2006-10-05 21:01:55 +00:00
|
|
|
*srcSubKey_copy = 0;
|
|
|
|
srcSubKey = srcSubKey_copy + 1;
|
2008-08-30 21:50:24 +00:00
|
|
|
lRet = RegOpenKeyExW(hRootKey, parentPath, 0, KEY_READ | KEY_CREATE_SUB_KEY, &parentKey);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) {
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_RENAME_KEY_FAILED);
|
2005-03-21 10:29:09 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2004-03-15 20:19:38 +00:00
|
|
|
}
|
|
|
|
|
2005-01-10 16:03:22 +00:00
|
|
|
/* The following fails if the old name is the same as the new name. */
|
2008-08-30 21:50:24 +00:00
|
|
|
if (!lstrcmpW(srcSubKey, newName)) goto done;
|
2005-01-10 16:03:22 +00:00
|
|
|
|
2008-08-30 21:50:24 +00:00
|
|
|
lRet = RegCreateKeyExW(parentKey, newName, 0, NULL, REG_OPTION_NON_VOLATILE,
|
2005-03-21 10:29:09 +00:00
|
|
|
KEY_WRITE, NULL /* FIXME */, &destKey, &disposition);
|
|
|
|
if (disposition == REG_OPENED_EXISTING_KEY)
|
2017-02-01 12:56:40 +00:00
|
|
|
lRet = ERROR_FILE_EXISTS;
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) {
|
2017-02-01 12:57:20 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_KEY_EXISTS, srcSubKey);
|
2005-03-21 10:29:09 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2004-03-15 20:19:38 +00:00
|
|
|
|
|
|
|
/* FIXME: SHCopyKey does not copy the security attributes */
|
2008-08-30 21:50:24 +00:00
|
|
|
lRet = SHCopyKeyW(parentKey, srcSubKey, destKey, 0);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) {
|
2005-03-21 10:29:09 +00:00
|
|
|
RegCloseKey(destKey);
|
2008-08-30 21:50:24 +00:00
|
|
|
RegDeleteKeyW(parentKey, newName);
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_RENAME_KEY_FAILED);
|
2005-03-21 10:29:09 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2004-03-15 20:19:38 +00:00
|
|
|
|
2008-08-30 21:50:24 +00:00
|
|
|
lRet = SHDeleteKeyW(hRootKey, keyPath);
|
2018-05-21 13:34:58 +00:00
|
|
|
if (lRet) {
|
2017-02-01 12:56:40 +00:00
|
|
|
error_code_messagebox(hwnd, IDS_RENAME_KEY_FAILED);
|
2005-03-21 10:29:09 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2004-03-15 20:19:38 +00:00
|
|
|
|
|
|
|
result = TRUE;
|
|
|
|
|
|
|
|
done:
|
|
|
|
RegCloseKey(destKey);
|
2023-06-19 04:32:00 +00:00
|
|
|
RegCloseKey(parentKey);
|
|
|
|
free(parentPath);
|
2004-03-15 20:19:38 +00:00
|
|
|
return result;
|
|
|
|
}
|