Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
04929756
Commit
04929756
authored
Aug 09, 2008
by
Alexander Nicolaysen Sørnes
Committed by
Alexandre Julliard
Aug 20, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Convert deletion to unicode.
parent
e0df1b9e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
21 deletions
+44
-21
edit.c
programs/regedit/edit.c
+20
-10
framewnd.c
programs/regedit/framewnd.c
+18
-9
main.c
programs/regedit/main.c
+2
-0
main.h
programs/regedit/main.h
+3
-2
regproc.h
programs/regedit/regproc.h
+1
-0
No files found.
programs/regedit/edit.c
View file @
04929756
...
...
@@ -386,22 +386,23 @@ done:
return
result
;
}
BOOL
DeleteKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
T
STR
keyPath
)
BOOL
DeleteKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
W
STR
keyPath
)
{
BOOL
result
=
FALSE
;
LONG
lRet
;
HKEY
hKey
;
lRet
=
RegOpenKeyEx
(
hKeyRoot
,
keyPath
,
0
,
KEY_READ
|
KEY_SET_VALUE
,
&
hKey
);
CHAR
*
keyPathA
=
GetMultiByteString
(
keyPath
);
lRet
=
RegOpenKeyExW
(
hKeyRoot
,
keyPath
,
0
,
KEY_READ
|
KEY_SET_VALUE
,
&
hKey
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
error_code_messagebox
(
hwnd
,
lRet
);
return
FALSE
;
}
if
(
messagebox
(
hwnd
,
MB_YESNO
|
MB_ICONEXCLAMATION
,
IDS_DELETE_BOX_TITLE
,
IDS_DELETE_BOX_TEXT
,
keyPath
)
!=
IDYES
)
if
(
messagebox
(
hwnd
,
MB_YESNO
|
MB_ICONEXCLAMATION
,
IDS_DELETE_BOX_TITLE
,
IDS_DELETE_BOX_TEXT
,
keyPath
A
)
!=
IDYES
)
goto
done
;
lRet
=
SHDeleteKey
(
hKeyRoot
,
keyPath
);
lRet
=
SHDeleteKey
W
(
hKeyRoot
,
keyPath
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
error
(
hwnd
,
IDS_BAD_KEY
,
keyPath
);
goto
done
;
...
...
@@ -410,24 +411,33 @@ BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath)
done:
RegCloseKey
(
hKey
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathA
);
return
result
;
}
BOOL
DeleteValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
TSTR
keyPath
,
LPCT
STR
valueName
,
BOOL
showMessageBox
)
BOOL
DeleteValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
WSTR
keyPath
,
LPCW
STR
valueName
,
BOOL
showMessageBox
)
{
BOOL
result
=
FALSE
;
LONG
lRet
;
HKEY
hKey
;
LPCSTR
visibleValueName
=
valueName
?
valueName
:
g_pszDefaultValueName
;
LPCWSTR
visibleValueName
=
valueName
?
valueName
:
g_pszDefaultValueNameW
;
WCHAR
empty
=
0
;
lRet
=
RegOpenKeyEx
(
hKeyRoot
,
keyPath
,
0
,
KEY_READ
|
KEY_SET_VALUE
,
&
hKey
);
lRet
=
RegOpenKeyEx
W
(
hKeyRoot
,
keyPath
,
0
,
KEY_READ
|
KEY_SET_VALUE
,
&
hKey
);
if
(
lRet
!=
ERROR_SUCCESS
)
return
FALSE
;
if
(
showMessageBox
)
if
(
messagebox
(
hwnd
,
MB_YESNO
|
MB_ICONEXCLAMATION
,
IDS_DELETE_BOX_TITLE
,
IDS_DELETE_BOX_TEXT
,
visibleValueName
)
!=
IDYES
)
{
LPSTR
visibleValueNameA
=
GetMultiByteString
(
visibleValueName
);
if
(
messagebox
(
hwnd
,
MB_YESNO
|
MB_ICONEXCLAMATION
,
IDS_DELETE_BOX_TITLE
,
IDS_DELETE_BOX_TEXT
,
visibleValueNameA
)
!=
IDYES
)
{
HeapFree
(
GetProcessHeap
(),
0
,
visibleValueNameA
);
goto
done
;
}
HeapFree
(
GetProcessHeap
(),
0
,
visibleValueNameA
);
}
lRet
=
RegDeleteValue
(
hKey
,
valueName
?
valueName
:
""
);
lRet
=
RegDeleteValue
W
(
hKey
,
valueName
?
valueName
:
&
empty
);
if
(
lRet
!=
ERROR_SUCCESS
&&
valueName
)
{
error
(
hwnd
,
IDS_BAD_VALUE
,
valueName
);
}
...
...
programs/regedit/framewnd.c
View file @
04929756
...
...
@@ -675,29 +675,38 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break
;
case
ID_EDIT_DELETE
:
if
(
GetFocus
()
==
g_pChildWnd
->
hTreeWnd
)
{
WCHAR
*
keyPathW
=
GetWideString
(
keyPath
);
if
(
keyPath
==
0
||
*
keyPath
==
0
)
{
MessageBeep
(
MB_ICONHAND
);
}
else
if
(
DeleteKey
(
hWnd
,
hKeyRoot
,
keyPath
))
{
}
else
if
(
DeleteKey
(
hWnd
,
hKeyRoot
,
keyPath
W
))
{
DeleteNode
(
g_pChildWnd
->
hTreeWnd
,
0
);
}
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
}
else
if
(
GetFocus
()
==
g_pChildWnd
->
hListWnd
)
{
curIndex
=
ListView_GetNextItem
(
g_pChildWnd
->
hListWnd
,
-
1
,
LVNI_SELECTED
);
while
(
curIndex
!=
-
1
)
{
WCHAR
*
valueNameW
;
WCHAR
*
keyPathW
;
valueName
=
GetItemText
(
g_pChildWnd
->
hListWnd
,
curIndex
);
curIndex
=
ListView_GetNextItem
(
g_pChildWnd
->
hListWnd
,
curIndex
,
LVNI_SELECTED
);
if
(
curIndex
!=
-
1
&&
firstItem
)
{
TCHAR
title
[
256
];
TCHAR
text
[
1024
];
if
(
!
LoadString
(
hInst
,
IDS_DELETE_BOX_TITLE
,
title
,
COUNT_OF
(
title
)))
lstrcpy
(
title
,
"Error"
);
if
(
!
LoadString
(
hInst
,
IDS_DELETE_BOX_TEXT_MULTIPLE
,
text
,
COUNT_OF
(
text
)))
lstrcpy
(
text
,
"Unknown error string!"
);
if
(
MessageBox
(
hWnd
,
text
,
title
,
MB_YESNO
|
MB_ICONEXCLAMATION
)
!=
IDYES
)
if
(
MessageBoxW
(
hWnd
,
MAKEINTRESOURCEW
(
IDS_DELETE_BOX_TEXT_MULTIPLE
),
MAKEINTRESOURCEW
(
IDS_DELETE_BOX_TITLE
),
MB_YESNO
|
MB_ICONEXCLAMATION
)
!=
IDYES
)
break
;
}
if
(
!
DeleteValue
(
hWnd
,
hKeyRoot
,
keyPath
,
valueName
,
curIndex
==-
1
&&
firstItem
))
valueNameW
=
GetWideString
(
valueName
);
keyPathW
=
GetWideString
(
keyPath
);
if
(
!
DeleteValue
(
hWnd
,
hKeyRoot
,
keyPathW
,
valueNameW
,
curIndex
==-
1
&&
firstItem
))
{
HeapFree
(
GetProcessHeap
(),
0
,
valueNameW
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
break
;
}
firstItem
=
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
valueNameW
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
}
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
,
NULL
);
}
...
...
programs/regedit/main.c
View file @
04929756
...
...
@@ -30,6 +30,7 @@
#include "main.h"
TCHAR
g_pszDefaultValueName
[
64
];
WCHAR
g_pszDefaultValueNameW
[
64
];
BOOL
ProcessCmdLine
(
LPSTR
lpCmdLine
);
...
...
@@ -171,6 +172,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
/* Initialize global strings */
LoadString
(
hInstance
,
IDS_APP_TITLE
,
szTitle
,
COUNT_OF
(
szTitle
));
LoadString
(
hInstance
,
IDS_REGISTRY_DEFAULT_VALUE
,
g_pszDefaultValueName
,
COUNT_OF
(
g_pszDefaultValueName
));
LoadStringW
(
hInstance
,
IDS_REGISTRY_DEFAULT_VALUE
,
g_pszDefaultValueNameW
,
COUNT_OF
(
g_pszDefaultValueNameW
));
/* Store instance handle in our global variable */
hInst
=
hInstance
;
...
...
programs/regedit/main.h
View file @
04929756
...
...
@@ -91,6 +91,7 @@ extern TCHAR szTitle[];
extern
const
TCHAR
szFrameClass
[];
extern
const
TCHAR
szChildClass
[];
extern
TCHAR
g_pszDefaultValueName
[];
extern
WCHAR
g_pszDefaultValueNameW
[];
/* about.c */
extern
void
ShowAboutBox
(
HWND
hWnd
);
...
...
@@ -129,8 +130,8 @@ extern HTREEITEM FindNext(HWND hwndTV, HTREEITEM hItem, LPCTSTR sstring, int mod
extern
BOOL
CreateKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCTSTR
keyPath
,
LPTSTR
newKeyName
);
extern
BOOL
CreateValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCTSTR
keyPath
,
DWORD
valueType
,
LPTSTR
valueName
);
extern
BOOL
ModifyValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCTSTR
keyPath
,
LPCTSTR
valueName
);
extern
BOOL
DeleteKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
T
STR
keyPath
);
extern
BOOL
DeleteValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
TSTR
keyPath
,
LPCT
STR
valueName
,
BOOL
showMessageBox
);
extern
BOOL
DeleteKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
W
STR
keyPath
);
extern
BOOL
DeleteValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
WSTR
keyPath
,
LPCW
STR
valueName
,
BOOL
showMessageBox
);
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
void
error
(
HWND
hwnd
,
INT
resId
,
...);
...
...
programs/regedit/regproc.h
View file @
04929756
...
...
@@ -25,3 +25,4 @@ BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name);
BOOL
import_registry_file
(
FILE
*
in
);
void
delete_registry_key
(
WCHAR
*
reg_key_name
);
WCHAR
*
GetWideString
(
const
char
*
strA
);
CHAR
*
GetMultiByteString
(
const
WCHAR
*
strW
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment