mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 12:20:07 +00:00
Add delete key support.
This commit is contained in:
parent
ced6ca78b8
commit
61197df74c
@ -228,6 +228,7 @@ END
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_ERROR "Error"
|
||||
IDS_BAD_KEY "Can't query key '%s'"
|
||||
IDS_BAD_VALUE "Can't query value '%s'"
|
||||
IDS_UNSUPPORTED_TYPE "Can't edit keys of this type (%ld)"
|
||||
IDS_TOO_BIG_VALUE "Value is too big (%ld)"
|
||||
|
@ -5,7 +5,7 @@ VPATH = @srcdir@
|
||||
MODULE = regedit.exe
|
||||
APPMODE = -mwindows
|
||||
IMPORTS = msvcrt advapi32 kernel32
|
||||
DELAYIMPORTS = shell32 comdlg32 comctl32 user32 gdi32
|
||||
DELAYIMPORTS = shlwapi shell32 comdlg32 comctl32 user32 gdi32
|
||||
EXTRAINCL = -I$(TOPSRCDIR)/include/msvcrt
|
||||
EXTRADEFS = -DNO_LIBWINE_PORT
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <shellapi.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "regproc.h"
|
||||
@ -228,6 +229,30 @@ done:
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
LONG lRet;
|
||||
HKEY hKey;
|
||||
|
||||
lRet = RegOpenKeyEx(hKeyRoot, keyPath, 0, KEY_SET_VALUE, &hKey);
|
||||
if (lRet != ERROR_SUCCESS) return FALSE;
|
||||
|
||||
if (messagebox(hwnd, MB_YESNO | MB_ICONEXCLAMATION, IDS_DELETE_BOX_TITLE, IDS_DELETE_BOX_TEXT, keyPath) != IDYES)
|
||||
goto done;
|
||||
|
||||
lRet = SHDeleteKey(hKeyRoot, keyPath);
|
||||
if (lRet != ERROR_SUCCESS) {
|
||||
error(hwnd, IDS_BAD_KEY, keyPath);
|
||||
goto done;
|
||||
}
|
||||
result = TRUE;
|
||||
|
||||
done:
|
||||
RegCloseKey(hKey);
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
@ -458,8 +458,13 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
PrintRegistryHive(hWnd, _T(""));
|
||||
break;
|
||||
case ID_EDIT_DELETE:
|
||||
if (DeleteValue(hWnd, hKeyRoot, keyPath, valueName))
|
||||
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
|
||||
if (GetFocus() == g_pChildWnd->hTreeWnd) {
|
||||
if (DeleteKey(hWnd, hKeyRoot, keyPath))
|
||||
;/* FIXME: TreeView should be refreshed */
|
||||
} else if (GetFocus() == g_pChildWnd->hListWnd) {
|
||||
if (DeleteValue(hWnd, hKeyRoot, keyPath, valueName))
|
||||
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
|
||||
}
|
||||
break;
|
||||
case ID_EDIT_MODIFY:
|
||||
if (ModifyValue(hWnd, hKeyRoot, keyPath, valueName))
|
||||
@ -470,6 +475,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
case ID_EDIT_NEW_KEY:
|
||||
CreateKey(hWnd, hKeyRoot, keyPath);
|
||||
/* FIXME: TreeView should be refreshed */
|
||||
break;
|
||||
case ID_EDIT_NEW_STRINGVALUE:
|
||||
valueType = REG_SZ;
|
||||
|
@ -91,6 +91,8 @@ extern HWND CreateListView(HWND hwndParent, int id);
|
||||
extern BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath);
|
||||
extern BOOL StartValueRename(HWND hwndLV);
|
||||
extern LPCTSTR GetValueName(HWND hwndLV);
|
||||
extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
|
||||
extern BOOL IsDefaultValue(HWND hwndLV, int i);
|
||||
|
||||
/* treeview.c */
|
||||
extern HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id);
|
||||
@ -101,6 +103,7 @@ extern LPCTSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
|
||||
extern BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath);
|
||||
extern BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, DWORD valueType);
|
||||
extern BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName);
|
||||
extern BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath);
|
||||
extern BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR valueName);
|
||||
extern BOOL RenameValue(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR oldName, LPCTSTR newName);
|
||||
|
||||
|
@ -117,6 +117,7 @@
|
||||
#define IDC_DWORD_DEC 32854
|
||||
#define IDS_NEWKEY 32860
|
||||
#define IDS_NEWVALUE 32861
|
||||
#define IDS_BAD_KEY 32862
|
||||
#define ID_EDIT_MODIFY_BIN 32870
|
||||
|
||||
#define IDD_EDIT_STRING 2000
|
||||
|
Loading…
Reference in New Issue
Block a user