Commit f225297a authored by Byeong-Sik Jeon's avatar Byeong-Sik Jeon Committed by Alexandre Julliard

regedit: Support REG_MULTI_SZ creation and editing.

parent 932c6f5b
......@@ -53,6 +53,7 @@ BEGIN
MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE
MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE
MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE
MENUITEM "&Multi String Value", ID_EDIT_NEW_MULTI_STRINGVALUE
END
MENUITEM SEPARATOR
MENUITEM "&Delete\tDel", ID_EDIT_DELETE
......@@ -129,6 +130,7 @@ BEGIN
MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE
MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE
MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE
MENUITEM "&Multi String Value", ID_EDIT_NEW_MULTI_STRINGVALUE
END
MENUITEM SEPARATOR
MENUITEM "&Delete\tDel", ID_EDIT_DELETE
......@@ -179,6 +181,7 @@ BEGIN
MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE
MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE
MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE
MENUITEM "&Multi String Value", ID_EDIT_NEW_MULTI_STRINGVALUE
END
MENUITEM SEPARATOR
MENUITEM "&Delete\tDel", ID_EDIT_DELETE
......@@ -286,6 +289,19 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,175,80,30,11,WS_GROUP
END
IDD_EDIT_MULTI_STRING DIALOG DISCARDABLE 22, 17, 210, 175
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "Edit Multi String"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Value name:",IDC_STATIC,5,5,119,8
EDITTEXT IDC_VALUE_NAME,5,15,200,12, WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL| WS_DISABLED
LTEXT "Value data:",IDC_STATIC,5,30,119,8
EDITTEXT IDC_VALUE_DATA,5,40,200,112, WS_BORDER | WS_TABSTOP | WS_HSCROLL | WS_VSCROLL | ES_MULTILINE | ES_WANTRETURN
DEFPUSHBUTTON "OK",IDOK,140,160,30,11,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,175,160,30,11,WS_GROUP
END
/*
* String Table
*/
......@@ -321,6 +337,7 @@ BEGIN
ID_EDIT_NEW_STRINGVALUE "Adds a new string value"
ID_EDIT_NEW_BINARYVALUE "Adds a new binary value"
ID_EDIT_NEW_DWORDVALUE "Adds a new double word value"
ID_EDIT_NEW_MULTI_STRINGVALUE "Adds a new multi string value"
ID_REGISTRY_IMPORTREGISTRYFILE "Imports a text file into the registry"
ID_REGISTRY_EXPORTREGISTRYFILE
"Exports all or part of the registry to a text file"
......
......@@ -322,6 +322,59 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName)
params.cbData = len;
result = DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_EDIT_BINARY), hwnd,
bin_modify_dlgproc, (LPARAM)&params);
} else if ( type == REG_MULTI_SZ ) {
TCHAR char1 = (TCHAR)'\r', char2 = (TCHAR)'\n';
TCHAR *tmpValueData = NULL;
INT i, j, count;
for ( i = 0, count = 0; i < len - 1; i++)
if ( !stringValueData[i] && stringValueData[i + 1] )
count++;
tmpValueData = HeapAlloc( GetProcessHeap(), 0, ( len + count ) * sizeof(TCHAR));
if ( !tmpValueData ) goto done;
for ( i = 0, j = 0; i < len - 1; i++)
{
if ( !stringValueData[i] && stringValueData[i + 1])
{
tmpValueData[j++] = char1;
tmpValueData[j++] = char2;
}
else
tmpValueData[j++] = stringValueData[i];
}
tmpValueData[j] = stringValueData[i];
HeapFree( GetProcessHeap(), 0, stringValueData);
stringValueData = tmpValueData;
tmpValueData = NULL;
if (DialogBox(0, MAKEINTRESOURCE(IDD_EDIT_MULTI_STRING), hwnd, modify_dlgproc) == IDOK)
{
len = lstrlen( stringValueData );
tmpValueData = HeapAlloc( GetProcessHeap(), 0, (len + 2) * sizeof(TCHAR));
if ( !tmpValueData ) goto done;
for ( i = 0, j = 0; i < len - 1; i++)
{
if ( stringValueData[i] == char1 && stringValueData[i + 1] == char2)
{
if ( tmpValueData[j - 1] != 0)
tmpValueData[j++] = 0;
i++;
}
else
tmpValueData[j++] = stringValueData[i];
}
tmpValueData[j++] = stringValueData[i];
tmpValueData[j++] = 0;
tmpValueData[j++] = 0;
HeapFree( GetProcessHeap(), 0, stringValueData);
stringValueData = tmpValueData;
lRet = RegSetValueEx(hKey, valueName, 0, type, (LPBYTE)stringValueData, j * sizeof(TCHAR));
if (lRet == ERROR_SUCCESS) result = TRUE;
else error_code_messagebox(hwnd, lRet);
}
} else {
error(hwnd, IDS_UNSUPPORTED_TYPE, type);
}
......
......@@ -710,6 +710,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case ID_EDIT_NEW_STRINGVALUE:
valueType = REG_SZ;
goto create_value;
case ID_EDIT_NEW_MULTI_STRINGVALUE:
valueType = REG_MULTI_SZ;
goto create_value;
case ID_EDIT_NEW_BINARYVALUE:
valueType = REG_BINARY;
goto create_value;
......
......@@ -132,6 +132,7 @@
#define ID_SWITCH_PANELS 32871
#define ID_FAVORITE_FIRST 33000
#define ID_FAVORITE_LAST 33099
#define ID_EDIT_NEW_MULTI_STRINGVALUE 33100
#define IDD_EDIT_STRING 2000
#define IDC_VALUE_NAME 2001
......@@ -142,6 +143,7 @@
#define IDC_FIND_VALUES 2006
#define IDC_FIND_CONTENT 2007
#define IDC_FIND_WHOLE 2008
#define IDD_EDIT_MULTI_STRING 2009
#define IDC_EXPORT_BASE 100
#define IDC_EXPORT_ALL 101
......
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