Commit 3b1faf59 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

regedit: Add support for REG_QWORD type.

parent aa48b656
......@@ -86,17 +86,18 @@ static void WINAPIV error_code_messagebox(HWND hwnd, unsigned int msg_id, ...)
static BOOL change_dword_base(HWND hwndDlg, BOOL toHex)
{
WCHAR buf[128];
DWORD val;
UINT64 val;
if (!GetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf, ARRAY_SIZE(buf))) return FALSE;
if (!swscanf(buf, toHex ? L"%u" : L"%x", &val)) return FALSE;
wsprintfW(buf, toHex ? L"%x" : L"%u", val);
if (!swscanf(buf, toHex ? L"%I64u" : L"%I64x", &val)) return FALSE;
wsprintfW(buf, toHex ? L"%I64x" : L"%I64u", val);
return SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf);
}
static INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND hwndValue;
WCHAR buff[64];
int len;
switch(uMsg) {
......@@ -105,6 +106,8 @@ static INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, stringValueData);
CheckRadioButton(hwndDlg, IDC_DWORD_HEX, IDC_DWORD_DEC, IDC_DWORD_HEX);
isDecimal = FALSE;
if (lParam == REG_QWORD && LoadStringW(GetModuleHandleW(0), IDS_EDIT_QWORD, buff, ARRAY_SIZE(buff)))
SetWindowTextW(hwndDlg, buff);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
......@@ -291,6 +294,19 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
}
heap_free(valueA);
}
} else if ( type == REG_QWORD ) {
UINT64 value = *((UINT64 *)stringValueData);
stringValueData = heap_xrealloc(stringValueData, 64);
swprintf(stringValueData, 64, L"%I64x", value);
if (DialogBoxParamW(0, MAKEINTRESOURCEW(IDD_EDIT_DWORD), hwnd, modify_dlgproc, type) == IDOK)
{
if (swscanf(stringValueData, isDecimal ? L"%I64u" : L"%I64x", &value))
{
lRet = RegSetValueExW(hKey, valueName, 0, type, (BYTE *)&value, sizeof(value));
if (lRet == ERROR_SUCCESS) result = TRUE;
else error_code_messagebox(hwnd, IDS_SET_VALUE_FAILED);
}
}
} else if ( type == REG_MULTI_SZ ) {
WCHAR char1 = '\r', char2 = '\n';
WCHAR *tmpValueData = NULL;
......@@ -426,7 +442,7 @@ BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPW
{
LONG lRet = ERROR_SUCCESS;
WCHAR newValue[256];
DWORD valueDword = 0;
UINT64 value = 0;
BOOL result = FALSE;
int valueNum, index;
HKEY hKey;
......@@ -451,15 +467,14 @@ BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPW
goto done;
}
lRet = RegSetValueExW(hKey, valueName, 0, valueType, (BYTE*)&valueDword, sizeof(DWORD));
lRet = RegSetValueExW(hKey, valueName, 0, valueType, (BYTE *)&value, sizeof(value));
if (lRet) {
error_code_messagebox(hwnd, IDS_CREATE_VALUE_FAILED);
goto done;
}
/* Add the new item to the listview */
index = AddEntryToList(g_pChildWnd->hListWnd, valueName, valueType,
(BYTE *)&valueDword, sizeof(DWORD), -1);
index = AddEntryToList(g_pChildWnd->hListWnd, valueName, valueType, (BYTE *)&value, sizeof(value), -1);
item.state = LVIS_FOCUSED | LVIS_SELECTED;
item.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
SendMessageW(g_pChildWnd->hListWnd, LVM_SETITEMSTATE, index, (LPARAM)&item);
......
......@@ -158,7 +158,7 @@ static void update_new_items_and_copy_keyname(HMENU hMenu, WCHAR *keyName)
{
unsigned int state = MF_ENABLED, i;
unsigned int items[] = {ID_EDIT_NEW_KEY, ID_EDIT_NEW_STRINGVALUE, ID_EDIT_NEW_BINARYVALUE,
ID_EDIT_NEW_DWORDVALUE, ID_EDIT_NEW_MULTI_STRINGVALUE,
ID_EDIT_NEW_DWORDVALUE, ID_EDIT_NEW_QWORDVALUE, ID_EDIT_NEW_MULTI_STRINGVALUE,
ID_EDIT_NEW_EXPANDVALUE, ID_EDIT_COPYKEYNAME};
if (!keyName)
......@@ -930,6 +930,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
goto create_value;
case ID_EDIT_NEW_DWORDVALUE:
valueType = REG_DWORD;
goto create_value;
case ID_EDIT_NEW_QWORDVALUE:
valueType = REG_QWORD;
/* fall through */
create_value:
{
......
......@@ -118,6 +118,14 @@ void format_value_data(HWND hwndLV, int index, DWORD type, void *data, DWORD siz
ListView_SetItemTextW(hwndLV, index, 2, buf);
break;
}
case REG_QWORD:
{
UINT64 value = *(UINT64 *)data;
WCHAR buf[64];
swprintf(buf, ARRAY_SIZE(buf), L"0x%08Ix (%Iu)", value, value);
ListView_SetItemTextW(hwndLV, index, 2, buf);
break;
}
case REG_MULTI_SZ:
MakeMULTISZDisplayable(data);
ListView_SetItemTextW(hwndLV, index, 2, data);
......@@ -245,6 +253,7 @@ void OnGetDispInfo(NMLVDISPINFOW *plvdi)
reg_binaryT[] = L"REG_BINARY",
reg_dwordT[] = L"REG_DWORD",
reg_dword_big_endianT[] = L"REG_DWORD_BIG_ENDIAN",
reg_qwordT[] = L"REG_QWORD",
reg_multi_szT[] = L"REG_MULTI_SZ",
reg_linkT[] = L"REG_LINK",
reg_resource_listT[] = L"REG_RESOURCE_LIST",
......@@ -275,6 +284,9 @@ void OnGetDispInfo(NMLVDISPINFOW *plvdi)
case REG_DWORD:
plvdi->item.pszText = reg_dwordT;
break;
case REG_QWORD:
plvdi->item.pszText = reg_qwordT;
break;
case REG_DWORD_BIG_ENDIAN:
plvdi->item.pszText = reg_dword_big_endianT;
break;
......
......@@ -48,6 +48,7 @@ BEGIN
MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE
MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE
MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE
MENUITEM "&QWORD Value", ID_EDIT_NEW_QWORDVALUE
MENUITEM "&Multi-String Value", ID_EDIT_NEW_MULTI_STRINGVALUE
MENUITEM "&Expandable String Value", ID_EDIT_NEW_EXPANDVALUE
END
......@@ -100,6 +101,7 @@ BEGIN
MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE
MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE
MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE
MENUITEM "&QWORD Value", ID_EDIT_NEW_QWORDVALUE
MENUITEM "&Multi-String Value", ID_EDIT_NEW_MULTI_STRINGVALUE
MENUITEM "&Expandable String Value", ID_EDIT_NEW_EXPANDVALUE
END
......@@ -122,6 +124,7 @@ BEGIN
MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE
MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE
MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE
MENUITEM "&QWORD Value", ID_EDIT_NEW_QWORDVALUE
MENUITEM "&Multi-String Value", ID_EDIT_NEW_MULTI_STRINGVALUE
MENUITEM "&Expandable String Value", ID_EDIT_NEW_EXPANDVALUE
END
......@@ -171,6 +174,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 32-bit value"
ID_EDIT_NEW_QWORDVALUE "Adds a new 64-bit value"
ID_EDIT_NEW_MULTI_STRINGVALUE "Adds a new multi-string value"
ID_EDIT_NEW_EXPANDVALUE "Adds a new expandable string value"
ID_REGISTRY_IMPORTREGISTRYFILE "Imports a text file into the registry"
......@@ -213,6 +217,7 @@ BEGIN
IDS_NEWKEY "New Key #%d"
IDS_NEWVALUE "New Value #%d"
IDS_NOTFOUND "Search complete. The string '%1' was not found."
IDS_EDIT_QWORD "Edit QWORD"
END
STRINGTABLE
......
......@@ -146,6 +146,8 @@
#define IDS_COLLAPSE 33107
#define IDS_EDIT_MODIFY 33108
#define IDS_EDIT_MODIFY_BIN 33109
#define ID_EDIT_NEW_QWORDVALUE 33110
#define IDS_EDIT_QWORD 33111
#define IDD_EDIT_STRING 2000
#define IDC_VALUE_NAME 2001
......
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