mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 08:49:15 +00:00
regedit: Update binary data via update_registry_value().
This commit is contained in:
parent
bbdab496ee
commit
5e2c3dd537
1 changed files with 14 additions and 22 deletions
|
@ -96,6 +96,11 @@ static BOOL update_registry_value(HWND hwndDlg, struct edit_params *params)
|
||||||
|
|
||||||
switch (params->type)
|
switch (params->type)
|
||||||
{
|
{
|
||||||
|
case REG_SZ:
|
||||||
|
case REG_EXPAND_SZ:
|
||||||
|
params->data = buf;
|
||||||
|
params->size = (len + 1) * sizeof(WCHAR);
|
||||||
|
break;
|
||||||
case REG_DWORD:
|
case REG_DWORD:
|
||||||
params->size = sizeof(DWORD);
|
params->size = sizeof(DWORD);
|
||||||
params->data = malloc(params->size);
|
params->data = malloc(params->size);
|
||||||
|
@ -129,9 +134,11 @@ static BOOL update_registry_value(HWND hwndDlg, struct edit_params *params)
|
||||||
params->size = j * sizeof(WCHAR);
|
params->size = j * sizeof(WCHAR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: /* REG_SZ, REG_EXPAND_SZ */
|
default: /* hex data types */
|
||||||
params->data = buf;
|
free(buf);
|
||||||
params->size = (len + 1) * sizeof(WCHAR);
|
params->size = SendMessageW(hwndValue, HEM_GETDATA, 0, 0);
|
||||||
|
params->data = malloc(params->size);
|
||||||
|
SendMessageW(hwndValue, HEM_GETDATA, (WPARAM)params->size, (LPARAM)params->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = RegSetValueExW(params->hkey, params->value_name, 0, params->type, (BYTE *)params->data, params->size);
|
ret = RegSetValueExW(params->hkey, params->value_name, 0, params->type, (BYTE *)params->data, params->size);
|
||||||
|
@ -224,9 +231,7 @@ static INT_PTR CALLBACK modify_dword_dlgproc(HWND hwndDlg, UINT msg, WPARAM wpar
|
||||||
static INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
struct edit_params *params;
|
struct edit_params *params;
|
||||||
BYTE *data;
|
int ret = 0;
|
||||||
LONG size;
|
|
||||||
LONG lRet;
|
|
||||||
|
|
||||||
switch(uMsg) {
|
switch(uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
@ -243,23 +248,10 @@ static INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wP
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
params = (struct edit_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER);
|
params = (struct edit_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER);
|
||||||
size = SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, HEM_GETDATA, 0, 0);
|
ret = update_registry_value(hwndDlg, params);
|
||||||
data = malloc(size);
|
/* fall through */
|
||||||
|
|
||||||
SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, HEM_GETDATA, (WPARAM)size, (LPARAM)data);
|
|
||||||
lRet = RegSetValueExW(params->hkey, params->value_name, 0, params->type, data, size);
|
|
||||||
free(data);
|
|
||||||
|
|
||||||
if (lRet == ERROR_SUCCESS)
|
|
||||||
EndDialog(hwndDlg, 1);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
error_code_messagebox(hwndDlg, IDS_SET_VALUE_FAILED);
|
|
||||||
EndDialog(hwndDlg, 0);
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hwndDlg, 0);
|
EndDialog(hwndDlg, ret);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue