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
9d6b80b1
Commit
9d6b80b1
authored
Aug 28, 2008
by
Alexander Nicolaysen Sørnes
Committed by
Alexandre Julliard
Aug 29, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Convert value creation to unicode.
parent
6c4d39bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
42 deletions
+45
-42
edit.c
programs/regedit/edit.c
+7
-7
framewnd.c
programs/regedit/framewnd.c
+37
-34
main.h
programs/regedit/main.h
+1
-1
No files found.
programs/regedit/edit.c
View file @
9d6b80b1
...
...
@@ -449,27 +449,27 @@ done:
return
result
;
}
BOOL
CreateValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
TSTR
keyPath
,
DWORD
valueType
,
LPT
STR
valueName
)
BOOL
CreateValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
WSTR
keyPath
,
DWORD
valueType
,
LPW
STR
valueName
)
{
LONG
lRet
=
ERROR_SUCCESS
;
T
CHAR
newValue
[
256
];
W
CHAR
newValue
[
256
];
DWORD
valueDword
=
0
;
BOOL
result
=
FALSE
;
int
valueNum
;
HKEY
hKey
;
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
;
}
if
(
!
LoadString
(
GetModuleHandle
(
0
),
IDS_NEWVALUE
,
newValue
,
COUNT_OF
(
newValue
)))
goto
done
;
if
(
!
LoadString
W
(
GetModuleHandle
(
0
),
IDS_NEWVALUE
,
newValue
,
COUNT_OF
(
newValue
)))
goto
done
;
/* try to find out a name for the newly create key (max 100 times) */
for
(
valueNum
=
1
;
valueNum
<
100
;
valueNum
++
)
{
wsprintf
(
valueName
,
newValue
,
valueNum
);
lRet
=
RegQueryValueEx
(
hKey
,
valueName
,
0
,
0
,
0
,
0
);
wsprintf
W
(
valueName
,
newValue
,
valueNum
);
lRet
=
RegQueryValueEx
W
(
hKey
,
valueName
,
0
,
0
,
0
,
0
);
if
(
lRet
==
ERROR_FILE_NOT_FOUND
)
break
;
}
if
(
lRet
!=
ERROR_FILE_NOT_FOUND
)
{
...
...
@@ -477,7 +477,7 @@ BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCTSTR keyPath, DWORD valueType, LPT
goto
done
;
}
lRet
=
RegSetValueEx
(
hKey
,
valueName
,
0
,
valueType
,
(
BYTE
*
)
&
valueDword
,
sizeof
(
DWORD
));
lRet
=
RegSetValueEx
W
(
hKey
,
valueName
,
0
,
valueType
,
(
BYTE
*
)
&
valueDword
,
sizeof
(
DWORD
));
if
(
lRet
!=
ERROR_SUCCESS
)
{
error_code_messagebox
(
hwnd
,
lRet
);
goto
done
;
...
...
programs/regedit/framewnd.c
View file @
9d6b80b1
...
...
@@ -636,15 +636,11 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
static
BOOL
_CmdWndProc
(
HWND
hWnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
HKEY
hKeyRoot
=
0
;
LPCTSTR
keyPath
;
LPCTSTR
valueName
;
TCHAR
newKey
[
MAX_NEW_KEY_LEN
];
DWORD
valueType
;
int
curIndex
;
BOOL
firstItem
=
TRUE
;
keyPath
=
GetItemPath
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
if
(
LOWORD
(
wParam
)
>=
ID_FAVORITE_FIRST
&&
LOWORD
(
wParam
)
<=
ID_FAVORITE_LAST
)
{
HKEY
hKey
;
if
(
RegOpenKeyExW
(
HKEY_CURRENT_USER
,
favoritesKey
,
...
...
@@ -683,15 +679,15 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
case
ID_EDIT_DELETE
:
if
(
GetFocus
()
==
g_pChildWnd
->
hTreeWnd
)
{
WCHAR
*
keyPath
W
=
GetWideString
(
keyPath
);
WCHAR
*
keyPath
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
if
(
keyPath
==
0
||
*
keyPath
==
0
)
{
MessageBeep
(
MB_ICONHAND
);
}
else
if
(
DeleteKey
(
hWnd
,
hKeyRoot
,
keyPath
W
))
{
MessageBeep
(
MB_ICONHAND
);
}
else
if
(
DeleteKey
(
hWnd
,
hKeyRoot
,
keyPath
))
{
DeleteNode
(
g_pChildWnd
->
hTreeWnd
,
0
);
}
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
W
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
);
}
else
if
(
GetFocus
()
==
g_pChildWnd
->
hListWnd
)
{
WCHAR
*
keyPath
W
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
WCHAR
*
keyPath
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
curIndex
=
ListView_GetNextItem
(
g_pChildWnd
->
hListWnd
,
-
1
,
LVNI_SELECTED
);
while
(
curIndex
!=
-
1
)
{
WCHAR
*
valueNameW
;
...
...
@@ -705,7 +701,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break
;
}
valueNameW
=
GetWideString
(
valueName
);
if
(
!
DeleteValue
(
hWnd
,
hKeyRoot
,
keyPath
W
,
valueNameW
,
curIndex
==-
1
&&
firstItem
))
if
(
!
DeleteValue
(
hWnd
,
hKeyRoot
,
keyPath
,
valueNameW
,
curIndex
==-
1
&&
firstItem
))
{
HeapFree
(
GetProcessHeap
(),
0
,
valueNameW
);
break
;
...
...
@@ -713,8 +709,8 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
firstItem
=
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
valueNameW
);
}
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
W
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
W
);
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
);
}
break
;
case
ID_EDIT_MODIFY
:
...
...
@@ -722,10 +718,12 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
LPCWSTR
valueNameW
=
GetValueName
(
g_pChildWnd
->
hListWnd
);
CHAR
*
valueNameA
=
GetMultiByteString
(
valueNameW
);
WCHAR
*
keyPathW
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
if
(
ModifyValue
(
hWnd
,
hKeyRoot
,
keyPath
,
valueNameA
))
CHAR
*
keyPathA
=
GetMultiByteString
(
keyPathW
);
if
(
ModifyValue
(
hWnd
,
hKeyRoot
,
keyPathA
,
valueNameA
))
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPathW
,
valueNameW
);
HeapFree
(
GetProcessHeap
(),
0
,
valueNameA
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathA
);
break
;
}
case
ID_EDIT_FIND
:
...
...
@@ -774,12 +772,12 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case
ID_EDIT_NEW_KEY
:
{
WCHAR
newKeyW
[
MAX_NEW_KEY_LEN
];
WCHAR
*
keyPath
W
=
GetWideString
(
keyPath
);
if
(
CreateKey
(
hWnd
,
hKeyRoot
,
keyPath
W
,
newKeyW
))
{
WCHAR
*
keyPath
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
if
(
CreateKey
(
hWnd
,
hKeyRoot
,
keyPath
,
newKeyW
))
{
if
(
InsertNode
(
g_pChildWnd
->
hTreeWnd
,
0
,
newKeyW
))
StartKeyRename
(
g_pChildWnd
->
hTreeWnd
);
}
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
W
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
);
}
break
;
case
ID_EDIT_NEW_STRINGVALUE
:
...
...
@@ -795,24 +793,29 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
valueType
=
REG_DWORD
;
/* fall through */
create_value:
if
(
CreateValue
(
hWnd
,
hKeyRoot
,
keyPath
,
valueType
,
newKey
))
{
WCHAR
*
keyPathW
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
WCHAR
*
newKeyW
=
GetWideString
(
newKey
);
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPathW
,
newKeyW
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
HeapFree
(
GetProcessHeap
(),
0
,
newKeyW
);
{
WCHAR
*
keyPath
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
WCHAR
newKey
[
MAX_NEW_KEY_LEN
];
if
(
CreateValue
(
hWnd
,
hKeyRoot
,
keyPath
,
valueType
,
newKey
))
{
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
,
newKey
);
StartValueRename
(
g_pChildWnd
->
hListWnd
);
/* FIXME: start rename */
}
/* FIXME: start rename */
}
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
);
}
break
;
case
ID_EDIT_RENAME
:
if
(
keyPath
==
0
||
*
keyPath
==
0
)
{
MessageBeep
(
MB_ICONHAND
);
}
else
if
(
GetFocus
()
==
g_pChildWnd
->
hTreeWnd
)
{
StartKeyRename
(
g_pChildWnd
->
hTreeWnd
);
}
else
if
(
GetFocus
()
==
g_pChildWnd
->
hListWnd
)
{
StartValueRename
(
g_pChildWnd
->
hListWnd
);
}
{
WCHAR
*
keyPath
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
if
(
keyPath
==
0
||
*
keyPath
==
0
)
{
MessageBeep
(
MB_ICONHAND
);
}
else
if
(
GetFocus
()
==
g_pChildWnd
->
hTreeWnd
)
{
StartKeyRename
(
g_pChildWnd
->
hTreeWnd
);
}
else
if
(
GetFocus
()
==
g_pChildWnd
->
hListWnd
)
{
StartValueRename
(
g_pChildWnd
->
hListWnd
);
}
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
);
}
break
;
case
ID_REGISTRY_PRINTERSETUP
:
/*PRINTDLG pd;*/
...
...
@@ -856,10 +859,10 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
case
ID_VIEW_REFRESH
:
{
WCHAR
*
keyPath
W
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
WCHAR
*
keyPath
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
RefreshTreeView
(
g_pChildWnd
->
hTreeWnd
);
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
W
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
W
);
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
);
}
break
;
/*case ID_OPTIONS_TOOLBAR:*/
...
...
programs/regedit/main.h
View file @
9d6b80b1
...
...
@@ -141,7 +141,7 @@ extern HTREEITEM FindNext(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mod
/* edit.c */
extern
BOOL
CreateKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCWSTR
keyPath
,
LPWSTR
newKeyName
);
extern
BOOL
CreateValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
TSTR
keyPath
,
DWORD
valueType
,
LPT
STR
valueName
);
extern
BOOL
CreateValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPC
WSTR
keyPath
,
DWORD
valueType
,
LPW
STR
valueName
);
extern
BOOL
ModifyValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCTSTR
keyPath
,
LPCTSTR
valueName
);
extern
BOOL
DeleteKey
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCWSTR
keyPath
);
extern
BOOL
DeleteValue
(
HWND
hwnd
,
HKEY
hKeyRoot
,
LPCWSTR
keyPath
,
LPCWSTR
valueName
,
BOOL
showMessageBox
);
...
...
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