Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
6b7ebf08
Commit
6b7ebf08
authored
Aug 30, 2008
by
Alexander Nicolaysen Sørnes
Committed by
Alexandre Julliard
Sep 02, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Convert key renaming to unicode.
parent
4a3d8d8c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
28 deletions
+34
-28
childwnd.c
programs/regedit/childwnd.c
+17
-13
edit.c
programs/regedit/edit.c
+16
-14
main.h
programs/regedit/main.h
+1
-1
No files found.
programs/regedit/childwnd.c
View file @
6b7ebf08
...
...
@@ -25,6 +25,7 @@
#include <stdio.h>
#include "main.h"
#include "regproc.h"
#include "wine/debug.h"
#include "wine/unicode.h"
...
...
@@ -219,13 +220,13 @@ LPWSTR GetItemFullPathW(HWND hwndTV, HTREEITEM hItem, BOOL bFull) {
return
ret
;
}
static
LP
TSTR
GetPathFullPath
(
HWND
hwndTV
,
LPT
STR
path
)
{
LP
T
STR
parts
[
2
];
LP
T
STR
ret
;
static
LP
WSTR
GetPathFullPath
(
HWND
hwndTV
,
LPW
STR
path
)
{
LP
W
STR
parts
[
2
];
LP
W
STR
ret
;
parts
[
0
]
=
GetPathRoot
(
hwndTV
,
0
,
TRUE
);
parts
[
0
]
=
GetPathRoot
W
(
hwndTV
,
0
,
TRUE
);
parts
[
1
]
=
path
;
ret
=
CombinePaths
((
LPCTSTR
*
)
parts
,
2
);
ret
=
CombinePaths
W
((
LPCWSTR
*
)
parts
,
2
);
HeapFree
(
GetProcessHeap
(),
0
,
parts
[
0
]);
return
ret
;
}
...
...
@@ -424,19 +425,22 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
case
TVN_ENDLABELEDIT
:
{
HKEY
hRootKey
;
LPNMTVDISPINFO
dispInfo
=
(
LPNMTVDISPINFO
)
lParam
;
LPCTSTR
path
=
GetItemPath
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hRootKey
);
BOOL
res
=
RenameKey
(
hWnd
,
hRootKey
,
path
,
dispInfo
->
item
.
pszText
);
WCHAR
*
itemText
=
GetWideString
(
dispInfo
->
item
.
pszText
);
LPWSTR
path
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hRootKey
);
BOOL
res
=
RenameKey
(
hWnd
,
hRootKey
,
path
,
itemText
);
if
(
res
)
{
TVITEMEX
item
;
LP
T
STR
fullPath
=
GetPathFullPath
(
g_pChildWnd
->
hTreeWnd
,
dispInfo
->
item
.
psz
Text
);
TVITEMEX
W
item
;
LP
W
STR
fullPath
=
GetPathFullPath
(
g_pChildWnd
->
hTreeWnd
,
item
Text
);
item
.
mask
=
TVIF_HANDLE
|
TVIF_TEXT
;
item
.
hItem
=
TreeView_GetSelection
(
g_pChildWnd
->
hTreeWnd
);
item
.
pszText
=
dispInfo
->
item
.
psz
Text
;
SendMessage
(
g_pChildWnd
->
hTreeWnd
,
TVM_SETITEMW
,
0
,
(
LPARAM
)
&
item
);
SendMessage
(
hStatusBar
,
SB_SETTEXT
,
0
,
(
LPARAM
)
fullPath
);
item
.
pszText
=
item
Text
;
SendMessage
W
(
g_pChildWnd
->
hTreeWnd
,
TVM_SETITEMW
,
0
,
(
LPARAM
)
&
item
);
SendMessage
W
(
hStatusBar
,
SB_SETTEXTW
,
0
,
(
LPARAM
)
fullPath
);
HeapFree
(
GetProcessHeap
(),
0
,
fullPath
);
}
HeapFree
(
GetProcessHeap
(),
0
,
path
);
HeapFree
(
GetProcessHeap
(),
0
,
itemText
);
return
res
;
}
default:
...
...
programs/regedit/edit.c
View file @
6b7ebf08
...
...
@@ -30,6 +30,7 @@
#include <shellapi.h>
#include <shlwapi.h>
#include "wine/unicode.h"
#include "main.h"
#include "regproc.h"
#include "resource.h"
...
...
@@ -536,10 +537,10 @@ done:
}
BOOL
RenameKey
(
HWND
hwnd
,
HKEY
hRootKey
,
LPC
TSTR
keyPath
,
LPCT
STR
newName
)
BOOL
RenameKey
(
HWND
hwnd
,
HKEY
hRootKey
,
LPC
WSTR
keyPath
,
LPCW
STR
newName
)
{
LP
T
STR
parentPath
=
0
;
LPC
T
STR
srcSubKey
=
0
;
LP
W
STR
parentPath
=
0
;
LPC
W
STR
srcSubKey
=
0
;
HKEY
parentKey
=
0
;
HKEY
destKey
=
0
;
BOOL
result
=
FALSE
;
...
...
@@ -548,17 +549,18 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR newName)
if
(
!
keyPath
||
!
newName
)
return
FALSE
;
if
(
!
strrchr
(
keyPath
,
'\\'
))
{
if
(
!
strrchr
W
(
keyPath
,
'\\'
))
{
parentKey
=
hRootKey
;
srcSubKey
=
keyPath
;
}
else
{
LP
T
STR
srcSubKey_copy
;
LP
W
STR
srcSubKey_copy
;
parentPath
=
strdup
(
keyPath
);
srcSubKey_copy
=
strrchr
(
parentPath
,
'\\'
);
parentPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
keyPath
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
parentPath
,
keyPath
);
srcSubKey_copy
=
strrchrW
(
parentPath
,
'\\'
);
*
srcSubKey_copy
=
0
;
srcSubKey
=
srcSubKey_copy
+
1
;
lRet
=
RegOpenKeyEx
(
hRootKey
,
parentPath
,
0
,
KEY_READ
|
KEY_CREATE_SUB_KEY
,
&
parentKey
);
lRet
=
RegOpenKeyEx
W
(
hRootKey
,
parentPath
,
0
,
KEY_READ
|
KEY_CREATE_SUB_KEY
,
&
parentKey
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
error_code_messagebox
(
hwnd
,
lRet
);
goto
done
;
...
...
@@ -566,9 +568,9 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR newName)
}
/* The following fails if the old name is the same as the new name. */
if
(
!
strcmp
(
srcSubKey
,
newName
))
goto
done
;
if
(
!
lstrcmpW
(
srcSubKey
,
newName
))
goto
done
;
lRet
=
RegCreateKeyEx
(
parentKey
,
newName
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
lRet
=
RegCreateKeyEx
W
(
parentKey
,
newName
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_WRITE
,
NULL
/* FIXME */
,
&
destKey
,
&
disposition
);
if
(
disposition
==
REG_OPENED_EXISTING_KEY
)
lRet
=
ERROR_FILE_EXISTS
;
/* FIXME: we might want a better error message than this */
...
...
@@ -578,15 +580,15 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR newName)
}
/* FIXME: SHCopyKey does not copy the security attributes */
lRet
=
SHCopyKey
(
parentKey
,
srcSubKey
,
destKey
,
0
);
lRet
=
SHCopyKey
W
(
parentKey
,
srcSubKey
,
destKey
,
0
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
RegCloseKey
(
destKey
);
RegDeleteKey
(
parentKey
,
newName
);
RegDeleteKey
W
(
parentKey
,
newName
);
error_code_messagebox
(
hwnd
,
lRet
);
goto
done
;
}
lRet
=
SHDeleteKey
(
hRootKey
,
keyPath
);
lRet
=
SHDeleteKey
W
(
hRootKey
,
keyPath
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
error_code_messagebox
(
hwnd
,
lRet
);
goto
done
;
...
...
@@ -598,7 +600,7 @@ done:
RegCloseKey
(
destKey
);
if
(
parentKey
)
{
RegCloseKey
(
parentKey
);
free
(
parentPath
);
HeapFree
(
GetProcessHeap
(),
0
,
parentPath
);
}
return
result
;
}
programs/regedit/main.h
View file @
6b7ebf08
...
...
@@ -146,7 +146,7 @@ extern BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR value
extern
BOOL
DeleteKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCWSTR
keyPath
);
extern
BOOL
DeleteValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCWSTR
keyPath
,
LPCWSTR
valueName
,
BOOL
showMessageBox
);
extern
BOOL
RenameValue
(
HWND
hwnd
,
HKEY
hRootKey
,
LPCWSTR
keyPath
,
LPCWSTR
oldName
,
LPCWSTR
newName
);
extern
BOOL
RenameKey
(
HWND
hwnd
,
HKEY
hRootKey
,
LPC
TSTR
keyPath
,
LPCT
STR
newName
);
extern
BOOL
RenameKey
(
HWND
hwnd
,
HKEY
hRootKey
,
LPC
WSTR
keyPath
,
LPCW
STR
newName
);
extern
void
error
(
HWND
hwnd
,
INT
resId
,
...);
/* hexedit.c */
...
...
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