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
4a3d8d8c
Commit
4a3d8d8c
authored
Aug 29, 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 value renaming to unicode.
parent
7aa56d24
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
58 deletions
+19
-58
edit.c
programs/regedit/edit.c
+11
-47
listview.c
programs/regedit/listview.c
+7
-10
main.h
programs/regedit/main.h
+1
-1
No files found.
programs/regedit/edit.c
View file @
4a3d8d8c
...
...
@@ -198,51 +198,15 @@ static INT_PTR CALLBACK bin_modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPara
return
FALSE
;
}
static
BOOL
check_value
(
HWND
hwnd
,
HKEY
hKey
,
LPC
T
STR
valueName
)
static
BOOL
check_value
(
HWND
hwnd
,
HKEY
hKey
,
LPC
W
STR
valueName
)
{
LONG
lRet
=
RegQueryValueEx
(
hKey
,
valueName
?
valueName
:
_T
(
""
),
0
,
NULL
,
0
,
NULL
);
WCHAR
empty
=
0
;
LONG
lRet
=
RegQueryValueExW
(
hKey
,
valueName
?
valueName
:
&
empty
,
0
,
NULL
,
0
,
NULL
);
if
(
lRet
!=
ERROR_SUCCESS
)
return
FALSE
;
return
TRUE
;
}
static
LPTSTR
read_value
(
HWND
hwnd
,
HKEY
hKey
,
LPCTSTR
valueName
,
DWORD
*
lpType
,
LONG
*
len
)
{
DWORD
valueDataLen
;
LPTSTR
buffer
=
NULL
;
LONG
lRet
;
lRet
=
RegQueryValueEx
(
hKey
,
valueName
?
valueName
:
_T
(
""
),
0
,
lpType
,
0
,
&
valueDataLen
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
if
(
lRet
==
ERROR_FILE_NOT_FOUND
&&
!
valueName
)
{
/* no default value here, make it up */
if
(
len
)
*
len
=
1
;
if
(
lpType
)
*
lpType
=
REG_SZ
;
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
1
);
*
buffer
=
'\0'
;
return
buffer
;
}
error
(
hwnd
,
IDS_BAD_VALUE
,
valueName
);
goto
done
;
}
if
(
*
lpType
==
REG_DWORD
)
valueDataLen
=
sizeof
(
DWORD
);
if
(
!
(
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
valueDataLen
+
1
)))
{
error
(
hwnd
,
IDS_TOO_BIG_VALUE
,
valueDataLen
);
goto
done
;
}
lRet
=
RegQueryValueEx
(
hKey
,
valueName
,
0
,
0
,
(
LPBYTE
)
buffer
,
&
valueDataLen
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
error
(
hwnd
,
IDS_BAD_VALUE
,
valueName
);
goto
done
;
}
buffer
[
valueDataLen
]
=
0
;
if
(
len
)
*
len
=
valueDataLen
;
return
buffer
;
done:
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
NULL
;
}
static
LPWSTR
read_valueW
(
HWND
hwnd
,
HKEY
hKey
,
LPCWSTR
valueName
,
DWORD
*
lpType
,
LONG
*
len
)
static
LPWSTR
read_value
(
HWND
hwnd
,
HKEY
hKey
,
LPCWSTR
valueName
,
DWORD
*
lpType
,
LONG
*
len
)
{
DWORD
valueDataLen
;
LPWSTR
buffer
=
NULL
;
...
...
@@ -335,7 +299,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
}
editValueName
=
valueName
?
valueName
:
g_pszDefaultValueNameW
;
if
(
!
(
stringValueData
=
read_value
W
(
hwnd
,
hKey
,
valueName
,
&
type
,
&
len
)))
goto
done
;
if
(
!
(
stringValueData
=
read_value
(
hwnd
,
hKey
,
valueName
,
&
type
,
&
len
)))
goto
done
;
if
(
(
type
==
REG_SZ
)
||
(
type
==
REG_EXPAND_SZ
)
)
{
if
(
DialogBoxW
(
0
,
MAKEINTRESOURCEW
(
IDD_EDIT_STRING
),
hwnd
,
modify_dlgproc
)
==
IDOK
)
{
...
...
@@ -532,9 +496,9 @@ done:
return
result
;
}
BOOL
RenameValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
TSTR
keyPath
,
LPCTSTR
oldName
,
LPCT
STR
newName
)
BOOL
RenameValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
WSTR
keyPath
,
LPCWSTR
oldName
,
LPCW
STR
newName
)
{
LP
T
STR
value
=
NULL
;
LP
W
STR
value
=
NULL
;
DWORD
type
;
LONG
len
,
lRet
;
BOOL
result
=
FALSE
;
...
...
@@ -543,7 +507,7 @@ BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR oldName, LPC
if
(
!
oldName
)
return
FALSE
;
if
(
!
newName
)
return
FALSE
;
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
)
{
error_code_messagebox
(
hwnd
,
lRet
);
return
FALSE
;
...
...
@@ -552,14 +516,14 @@ BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR oldName, LPC
if
(
check_value
(
hwnd
,
hKey
,
newName
))
goto
done
;
value
=
read_value
(
hwnd
,
hKey
,
oldName
,
&
type
,
&
len
);
if
(
!
value
)
goto
done
;
lRet
=
RegSetValueEx
(
hKey
,
newName
,
0
,
type
,
(
BYTE
*
)
value
,
len
);
lRet
=
RegSetValueEx
W
(
hKey
,
newName
,
0
,
type
,
(
BYTE
*
)
value
,
len
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
error_code_messagebox
(
hwnd
,
lRet
);
goto
done
;
}
lRet
=
RegDeleteValue
(
hKey
,
oldName
);
lRet
=
RegDeleteValue
W
(
hKey
,
oldName
);
if
(
lRet
!=
ERROR_SUCCESS
)
{
RegDeleteValue
(
hKey
,
newName
);
RegDeleteValue
W
(
hKey
,
newName
);
error_code_messagebox
(
hwnd
,
lRet
);
goto
done
;
}
...
...
programs/regedit/listview.c
View file @
4a3d8d8c
...
...
@@ -422,20 +422,17 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
break
;
case
LVN_ENDLABELEDIT
:
{
LPNMLVDISPINFO
dispInfo
=
(
LPNMLVDISPINFO
)
lParam
;
LP
TSTR
valueName
=
GetItemText
(
hWnd
,
dispInfo
->
item
.
iItem
);
LPSTR
pathA
;
LP
WSTR
oldName
=
GetItemTextW
(
hWnd
,
dispInfo
->
item
.
iItem
);
WCHAR
*
newName
=
GetWideString
(
dispInfo
->
item
.
pszText
)
;
LONG
ret
;
if
(
!
valueName
)
return
-
1
;
/* cannot rename a default value */
pathA
=
GetMultiByteString
(
g_currentPath
);
ret
=
RenameValue
(
hWnd
,
g_currentRootKey
,
pathA
,
valueName
,
dispInfo
->
item
.
pszText
);
HeapFree
(
GetProcessHeap
(),
0
,
pathA
);
if
(
!
oldName
)
return
-
1
;
/* cannot rename a default value */
ret
=
RenameValue
(
hWnd
,
g_currentRootKey
,
g_currentPath
,
oldName
,
newName
);
if
(
ret
)
{
WCHAR
*
itemTextW
=
GetWideString
(
dispInfo
->
item
.
pszText
);
RefreshListView
(
hWnd
,
g_currentRootKey
,
g_currentPath
,
itemTextW
);
HeapFree
(
GetProcessHeap
(),
0
,
itemTextW
);
RefreshListView
(
hWnd
,
g_currentRootKey
,
g_currentPath
,
newName
);
}
HeapFree
(
GetProcessHeap
(),
0
,
valueName
);
HeapFree
(
GetProcessHeap
(),
0
,
newName
);
HeapFree
(
GetProcessHeap
(),
0
,
oldName
);
return
0
;
}
case
NM_RETURN
:
{
...
...
programs/regedit/main.h
View file @
4a3d8d8c
...
...
@@ -145,7 +145,7 @@ extern BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueTy
extern
BOOL
ModifyValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCWSTR
keyPath
,
LPCWSTR
valueName
);
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
,
LPC
TSTR
keyPath
,
LPCTSTR
oldName
,
LPCT
STR
newName
);
extern
BOOL
RenameValue
(
HWND
hwnd
,
HKEY
hRootKey
,
LPC
WSTR
keyPath
,
LPCWSTR
oldName
,
LPCW
STR
newName
);
extern
BOOL
RenameKey
(
HWND
hwnd
,
HKEY
hRootKey
,
LPCTSTR
keyPath
,
LPCTSTR
newName
);
extern
void
error
(
HWND
hwnd
,
INT
resId
,
...);
...
...
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