Commit 828aff30 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Add neutral English resources.

- Add a control for editing binary data. - Add a binary value editor dialog.
parent b05cceb6
...@@ -18,6 +18,76 @@ ...@@ -18,6 +18,76 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* English Neutral Resources */
LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
BEGIN
ID_FAVORITES_ADDTOFAVORITES "Adds keys to the favourites list"
ID_FAVORITES_REMOVEFAVORITE "Removes keys from the favourites list"
END
IDR_REGEDIT_MENU MENU DISCARDABLE
BEGIN
POPUP "&Registry"
BEGIN
MENUITEM "&Import Registry File...", ID_REGISTRY_IMPORTREGISTRYFILE
MENUITEM "&Export Registry File...", ID_REGISTRY_EXPORTREGISTRYFILE
MENUITEM SEPARATOR
MENUITEM "&Connect Network Registry...", ID_REGISTRY_CONNECTNETWORKREGISTRY, GRAYED
MENUITEM "&Disconnect Network Registry...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Print\tCtrl+P", ID_REGISTRY_PRINT, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_REGISTRY_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Modify", ID_EDIT_MODIFY
MENUITEM SEPARATOR
POPUP "&New"
BEGIN
MENUITEM "&Key", ID_EDIT_NEW_KEY
MENUITEM SEPARATOR
MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE
MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE
MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE
END
MENUITEM SEPARATOR
MENUITEM "&Delete\tDel", ID_EDIT_DELETE
MENUITEM "&Rename\tF2", ID_EDIT_RENAME
MENUITEM SEPARATOR
MENUITEM "&Copy Key Name", ID_EDIT_COPYKEYNAME
MENUITEM SEPARATOR
MENUITEM "&Find\tCtrl+F", ID_EDIT_FIND, GRAYED
MENUITEM "Find Ne&xt\tF3", ID_EDIT_FINDNEXT, GRAYED
END
POPUP "&View"
BEGIN
MENUITEM "Status &Bar", ID_VIEW_STATUSBAR
MENUITEM SEPARATOR
MENUITEM "Sp&lit", ID_VIEW_SPLIT
MENUITEM SEPARATOR
MENUITEM "&Refresh\tF5", ID_VIEW_REFRESH
END
POPUP "&Favourites"
BEGIN
MENUITEM "&Add to Favourites", ID_FAVORITES_ADDTOFAVORITES
, GRAYED
MENUITEM "&Remove Favourite", ID_FAVORITES_REMOVEFAVORITE
, GRAYED
END
POPUP "&Help"
BEGIN
MENUITEM "&Help Topics\tF1", ID_HELP_HELPTOPICS
MENUITEM SEPARATOR
MENUITEM "&About Registry Editor", ID_HELP_ABOUT
END
END
/* US English Resources */
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
/* /*
...@@ -130,7 +200,7 @@ END ...@@ -130,7 +200,7 @@ END
*/ */
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75 IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | DS_NOIDLEMSG | WS_CAPTION | WS_SYSMENU
CAPTION "About" CAPTION "About"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
...@@ -155,7 +225,7 @@ BEGIN ...@@ -155,7 +225,7 @@ BEGIN
END END
IDD_EDIT_DWORD DIALOG DISCARDABLE 22, 17, 210, 100 IDD_EDIT_DWORD DIALOG DISCARDABLE 22, 17, 210, 100
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | DS_NOIDLEMSG | WS_CAPTION | WS_SYSMENU
CAPTION "Edit DWORD" CAPTION "Edit DWORD"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
...@@ -170,6 +240,19 @@ BEGIN ...@@ -170,6 +240,19 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,175,80,30,11,WS_GROUP PUSHBUTTON "Cancel",IDCANCEL,175,80,30,11,WS_GROUP
END END
IDD_EDIT_BINARY DIALOG DISCARDABLE 22, 17, 210, 100
STYLE DS_MODALFRAME | DS_NOIDLEMSG | WS_CAPTION | WS_SYSMENU
CAPTION "Edit Binary"
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 | WS_DISABLED
LTEXT "Value data:",IDC_STATIC,5,30,90,8
CONTROL "",IDC_VALUE_DATA,"HexEdit",WS_TABSTOP,4,40,200,40
DEFPUSHBUTTON "OK",IDOK,140,80,30,11,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,175,80,30,11,WS_GROUP
END
/* /*
* String Table * String Table
*/ */
......
...@@ -14,6 +14,7 @@ C_SRCS = \ ...@@ -14,6 +14,7 @@ C_SRCS = \
childwnd.c \ childwnd.c \
edit.c \ edit.c \
framewnd.c \ framewnd.c \
hexedit.c \
listview.c \ listview.c \
main.c \ main.c \
regedit.c \ regedit.c \
......
...@@ -38,6 +38,14 @@ static const TCHAR* editValueName; ...@@ -38,6 +38,14 @@ static const TCHAR* editValueName;
static TCHAR* stringValueData; static TCHAR* stringValueData;
static BOOL isDecimal; static BOOL isDecimal;
struct edit_params
{
HKEY hKey;
LPCTSTR lpszValueName;
void *pData;
LONG cbData;
};
INT vmessagebox(HWND hwnd, INT buttons, INT titleId, INT resId, va_list ap) INT vmessagebox(HWND hwnd, INT buttons, INT titleId, INT resId, va_list ap)
{ {
TCHAR title[256]; TCHAR title[256];
...@@ -142,6 +150,54 @@ INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ...@@ -142,6 +150,54 @@ INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
return FALSE; return FALSE;
} }
static INT_PTR CALLBACK bin_modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
struct edit_params *params;
LPBYTE pData;
LONG cbData;
LONG lRet;
switch(uMsg) {
case WM_INITDIALOG:
params = (struct edit_params *)lParam;
SetWindowLongPtr(hwndDlg, DWLP_USER, (ULONG_PTR)params);
if (params->lpszValueName)
SetDlgItemText(hwndDlg, IDC_VALUE_NAME, params->lpszValueName);
else
SetDlgItemText(hwndDlg, IDC_VALUE_NAME, g_pszDefaultValueName);
SendDlgItemMessage(hwndDlg, IDC_VALUE_DATA, HEM_SETDATA, (WPARAM)params->cbData, (LPARAM)params->pData);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
params = (struct edit_params *)GetWindowLongPtr(hwndDlg, DWLP_USER);
cbData = SendDlgItemMessage(hwndDlg, IDC_VALUE_DATA, HEM_GETDATA, 0, 0);
pData = HeapAlloc(GetProcessHeap(), 0, cbData);
if (pData)
{
SendDlgItemMessage(hwndDlg, IDC_VALUE_DATA, HEM_GETDATA, (WPARAM)cbData, (LPARAM)pData);
lRet = RegSetValueEx(params->hKey, params->lpszValueName, 0, REG_BINARY, pData, cbData);
}
else
lRet = ERROR_OUTOFMEMORY;
if (lRet == ERROR_SUCCESS)
EndDialog(hwndDlg, 1);
else
{
error_code_messagebox(hwndDlg, lRet);
EndDialog(hwndDlg, 0);
}
return TRUE;
case IDCANCEL:
EndDialog(hwndDlg, 0);
return TRUE;
}
}
return FALSE;
}
static BOOL check_value(HWND hwnd, HKEY hKey, LPCTSTR valueName) static BOOL check_value(HWND hwnd, HKEY hKey, LPCTSTR valueName)
{ {
LONG lRet = RegQueryValueEx(hKey, valueName ? valueName : _T(""), 0, NULL, 0, NULL); LONG lRet = RegQueryValueEx(hKey, valueName ? valueName : _T(""), 0, NULL, 0, NULL);
...@@ -231,6 +287,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName) ...@@ -231,6 +287,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName)
DWORD type; DWORD type;
LONG lRet; LONG lRet;
HKEY hKey; HKEY hKey;
LONG len;
lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey); lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) { if (lRet != ERROR_SUCCESS) {
...@@ -239,7 +296,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName) ...@@ -239,7 +296,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName)
} }
editValueName = valueName ? valueName : g_pszDefaultValueName; editValueName = valueName ? valueName : g_pszDefaultValueName;
if(!(stringValueData = read_value(hwnd, hKey, valueName, &type, 0))) goto done; if(!(stringValueData = read_value(hwnd, hKey, valueName, &type, &len))) goto done;
if ( (type == REG_SZ) || (type == REG_EXPAND_SZ) ) { if ( (type == REG_SZ) || (type == REG_EXPAND_SZ) ) {
if (DialogBox(0, MAKEINTRESOURCE(IDD_EDIT_STRING), hwnd, modify_dlgproc) == IDOK) { if (DialogBox(0, MAKEINTRESOURCE(IDD_EDIT_STRING), hwnd, modify_dlgproc) == IDOK) {
...@@ -257,6 +314,14 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName) ...@@ -257,6 +314,14 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName)
else error_code_messagebox(hwnd, lRet); else error_code_messagebox(hwnd, lRet);
} }
} }
} else if ( type == REG_BINARY ) {
struct edit_params params;
params.hKey = hKey;
params.lpszValueName = valueName;
params.pData = stringValueData;
params.cbData = len;
result = DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_EDIT_BINARY), hwnd,
bin_modify_dlgproc, (LPARAM)&params);
} else { } else {
error(hwnd, IDS_UNSUPPORTED_TYPE, type); error(hwnd, IDS_UNSUPPORTED_TYPE, type);
} }
......
...@@ -110,6 +110,9 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) ...@@ -110,6 +110,9 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
/* Initialize the Windows Common Controls DLL */ /* Initialize the Windows Common Controls DLL */
InitCommonControls(); InitCommonControls();
/* register our hex editor control */
HexEdit_Register();
nClipboardFormat = RegisterClipboardFormat(strClipboardFormat); nClipboardFormat = RegisterClipboardFormat(strClipboardFormat);
/* if (nClipboardFormat == 0) { /* if (nClipboardFormat == 0) {
DWORD dwError = GetLastError(); DWORD dwError = GetLastError();
......
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
#define WM_NOTIFY_REFLECT (WM_USER+1024) #define WM_NOTIFY_REFLECT (WM_USER+1024)
/* HexEdit Class */
#define HEXEDIT_CLASS TEXT("HexEdit")
#define HEM_SETDATA (WM_USER+0)
#define HEM_GETDATA (WM_USER+1)
extern HINSTANCE hInst; extern HINSTANCE hInst;
/******************************************************************************/ /******************************************************************************/
...@@ -118,4 +123,8 @@ extern BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR value ...@@ -118,4 +123,8 @@ extern BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR value
extern BOOL RenameValue(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR oldName, LPCTSTR newName); extern BOOL RenameValue(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR oldName, LPCTSTR newName);
extern BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR newName); extern BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR newName);
/* hexedit.c */
extern void HexEdit_Register(void);
extern void HexEdit_Unregister(void);
#endif /* __MAIN_H__ */ #endif /* __MAIN_H__ */
...@@ -124,5 +124,6 @@ ...@@ -124,5 +124,6 @@
#define IDD_EDIT_STRING 2000 #define IDD_EDIT_STRING 2000
#define IDC_VALUE_NAME 2001 #define IDC_VALUE_NAME 2001
#define IDC_VALUE_DATA 2002 #define IDC_VALUE_DATA 2002
#define IDD_EDIT_BINARY 2003
#define IDC_STATIC -1 #define IDC_STATIC -1
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