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
455ce06d
Commit
455ce06d
authored
Aug 23, 2008
by
Alexander Nicolaysen Sørnes
Committed by
Alexandre Julliard
Aug 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Convert favourites handling to unicode.
parent
039df36b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
47 deletions
+47
-47
framewnd.c
programs/regedit/framewnd.c
+31
-31
main.h
programs/regedit/main.h
+1
-1
treeview.c
programs/regedit/treeview.c
+15
-15
No files found.
programs/regedit/framewnd.c
View file @
455ce06d
...
...
@@ -36,9 +36,9 @@
* Global and Local Variables:
*/
static
TCHAR
favoritesKey
[]
=
_T
(
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Applets
\\
RegEdit
\\
Favorites"
)
;
static
WCHAR
favoritesKey
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'A'
,
'p'
,
'p'
,
'l'
,
'e'
,
't'
,
's'
,
'\\'
,
'R'
,
'e'
,
'g'
,
'E'
,
'd'
,
'i'
,
't'
,
'\\'
,
'F'
,
'a'
,
'v'
,
'o'
,
'r'
,
'i'
,
't'
,
'e'
,
's'
,
0
}
;
static
BOOL
bInMenuLoop
=
FALSE
;
/* Tells us if we are in the menu loop */
static
T
CHAR
favoriteName
[
128
];
static
W
CHAR
favoriteName
[
128
];
static
TCHAR
searchString
[
128
];
static
int
searchMask
=
SEARCH_KEYS
|
SEARCH_VALUES
|
SEARCH_CONTENT
;
...
...
@@ -123,9 +123,9 @@ static void OnInitMenuPopup(HWND hWnd, HMENU hMenu, short wItem)
HKEY
hKey
;
while
(
GetMenuItemCount
(
hMenu
)
>
2
)
DeleteMenu
(
hMenu
,
2
,
MF_BYPOSITION
);
if
(
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
favoritesKey
,
if
(
RegOpenKeyEx
W
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
KEY_READ
,
&
hKey
)
==
ERROR_SUCCESS
)
{
T
CHAR
namebuf
[
KEY_MAX_LEN
];
W
CHAR
namebuf
[
KEY_MAX_LEN
];
BYTE
valuebuf
[
4096
];
int
i
=
0
;
BOOL
sep
=
FALSE
;
...
...
@@ -134,15 +134,15 @@ static void OnInitMenuPopup(HWND hWnd, HMENU hMenu, short wItem)
do
{
ksize
=
KEY_MAX_LEN
;
vsize
=
sizeof
(
valuebuf
);
error
=
RegEnumValue
(
hKey
,
i
,
namebuf
,
&
ksize
,
NULL
,
&
type
,
valuebuf
,
&
vsize
);
error
=
RegEnumValue
W
(
hKey
,
i
,
namebuf
,
&
ksize
,
NULL
,
&
type
,
valuebuf
,
&
vsize
);
if
(
error
!=
ERROR_SUCCESS
)
break
;
if
(
type
==
REG_SZ
)
{
if
(
!
sep
)
{
AppendMenu
(
hMenu
,
MF_SEPARATOR
,
-
1
,
NULL
);
AppendMenu
W
(
hMenu
,
MF_SEPARATOR
,
-
1
,
NULL
);
sep
=
TRUE
;
}
AppendMenu
(
hMenu
,
MF_STRING
,
ID_FAVORITE_FIRST
+
i
,
namebuf
);
AppendMenu
W
(
hMenu
,
MF_STRING
,
ID_FAVORITE_FIRST
+
i
,
namebuf
);
}
i
++
;
}
while
(
error
==
ERROR_SUCCESS
);
...
...
@@ -524,13 +524,13 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
case
WM_INITDIALOG
:
{
HKEY
hKeyRoot
=
NULL
;
LP
STR
ItemPath
=
GetItemPath
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
&
hKeyRoot
);
LP
WSTR
ItemPath
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
&
hKeyRoot
);
if
(
!
ItemPath
||
!*
ItemPath
)
ItemPath
=
GetItemFullPath
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
FALSE
);
ItemPath
=
GetItemFullPath
W
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
FALSE
);
EnableWindow
(
GetDlgItem
(
hwndDlg
,
IDOK
),
FALSE
);
SetWindowText
(
hwndValue
,
ItemPath
);
SendMessage
(
hwndValue
,
EM_SETLIMITTEXT
,
127
,
0
);
SetWindowText
W
(
hwndValue
,
ItemPath
);
SendMessage
W
(
hwndValue
,
EM_SETLIMITTEXT
,
127
,
0
);
return
TRUE
;
}
case
WM_COMMAND
:
...
...
@@ -542,8 +542,8 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
}
break
;
case
IDOK
:
if
(
GetWindowTextLength
(
hwndValue
)
>
0
)
{
GetWindowText
(
hwndValue
,
favoriteName
,
128
);
if
(
GetWindowTextLength
W
(
hwndValue
)
>
0
)
{
GetWindowText
W
(
hwndValue
,
favoriteName
,
128
);
EndDialog
(
hwndDlg
,
IDOK
);
}
return
TRUE
;
...
...
@@ -565,20 +565,20 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
HKEY
hKey
;
int
i
=
0
;
EnableWindow
(
GetDlgItem
(
hwndDlg
,
IDOK
),
FALSE
);
if
(
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
favoritesKey
,
if
(
RegOpenKeyEx
W
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
KEY_READ
,
&
hKey
)
==
ERROR_SUCCESS
)
{
T
CHAR
namebuf
[
KEY_MAX_LEN
];
W
CHAR
namebuf
[
KEY_MAX_LEN
];
BYTE
valuebuf
[
4096
];
DWORD
ksize
,
vsize
,
type
;
LONG
error
;
do
{
ksize
=
KEY_MAX_LEN
;
vsize
=
sizeof
(
valuebuf
);
error
=
RegEnumValue
(
hKey
,
i
,
namebuf
,
&
ksize
,
NULL
,
&
type
,
valuebuf
,
&
vsize
);
error
=
RegEnumValue
W
(
hKey
,
i
,
namebuf
,
&
ksize
,
NULL
,
&
type
,
valuebuf
,
&
vsize
);
if
(
error
!=
ERROR_SUCCESS
)
break
;
if
(
type
==
REG_SZ
)
{
SendMessage
(
hwndList
,
LB_ADDSTRING
,
0
,
(
LPARAM
)
namebuf
);
SendMessage
W
(
hwndList
,
LB_ADDSTRING
,
0
,
(
LPARAM
)
namebuf
);
}
i
++
;
}
while
(
error
==
ERROR_SUCCESS
);
...
...
@@ -587,7 +587,7 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
else
return
FALSE
;
EnableWindow
(
GetDlgItem
(
hwndDlg
,
IDOK
),
i
!=
0
);
SendMessage
(
hwndList
,
LB_SETCURSEL
,
0
,
0
);
SendMessage
W
(
hwndList
,
LB_SETCURSEL
,
0
,
0
);
return
TRUE
;
}
case
WM_COMMAND
:
...
...
@@ -602,11 +602,11 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
int
pos
=
SendMessage
(
hwndList
,
LB_GETCURSEL
,
0
,
0
);
int
len
=
SendMessage
(
hwndList
,
LB_GETTEXTLEN
,
pos
,
0
);
if
(
len
>
0
)
{
LP
TSTR
lpName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
T
CHAR
)
*
(
len
+
1
));
SendMessage
(
hwndList
,
LB_GETTEXT
,
pos
,
(
LPARAM
)
lpName
);
LP
WSTR
lpName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
W
CHAR
)
*
(
len
+
1
));
SendMessage
W
(
hwndList
,
LB_GETTEXT
,
pos
,
(
LPARAM
)
lpName
);
if
(
len
>
127
)
lpName
[
127
]
=
'\0'
;
_tcscpy
(
favoriteName
,
lpName
);
lstrcpyW
(
favoriteName
,
lpName
);
EndDialog
(
hwndDlg
,
IDOK
);
HeapFree
(
GetProcessHeap
(),
0
,
lpName
);
}
...
...
@@ -642,15 +642,15 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if
(
LOWORD
(
wParam
)
>=
ID_FAVORITE_FIRST
&&
LOWORD
(
wParam
)
<=
ID_FAVORITE_LAST
)
{
HKEY
hKey
;
if
(
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
favoritesKey
,
if
(
RegOpenKeyEx
W
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
KEY_READ
,
&
hKey
)
==
ERROR_SUCCESS
)
{
T
CHAR
namebuf
[
KEY_MAX_LEN
];
W
CHAR
namebuf
[
KEY_MAX_LEN
];
BYTE
valuebuf
[
4096
];
DWORD
ksize
=
KEY_MAX_LEN
,
vsize
=
sizeof
(
valuebuf
),
type
=
0
;
if
(
RegEnumValue
(
hKey
,
LOWORD
(
wParam
)
-
ID_FAVORITE_FIRST
,
namebuf
,
&
ksize
,
NULL
,
if
(
RegEnumValue
W
(
hKey
,
LOWORD
(
wParam
)
-
ID_FAVORITE_FIRST
,
namebuf
,
&
ksize
,
NULL
,
&
type
,
valuebuf
,
&
vsize
)
==
ERROR_SUCCESS
)
{
SendMessage
(
g_pChildWnd
->
hTreeWnd
,
TVM_SELECTITEM
,
TVGN_CARET
,
(
LPARAM
)
FindPathInTree
(
g_pChildWnd
->
hTreeWnd
,
(
T
CHAR
*
)
valuebuf
)
);
SendMessage
W
(
g_pChildWnd
->
hTreeWnd
,
TVM_SELECTITEM
,
TVGN_CARET
,
(
LPARAM
)
FindPathInTree
(
g_pChildWnd
->
hTreeWnd
,
(
W
CHAR
*
)
valuebuf
)
);
}
RegCloseKey
(
hKey
);
}
...
...
@@ -813,13 +813,13 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case
ID_FAVORITES_ADDTOFAVORITES
:
{
HKEY
hKey
;
LPTSTR
lpKeyPath
=
GetItemFullPath
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
FALSE
);
LPWSTR
lpKeyPath
=
GetItemFullPathW
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
FALSE
);
if
(
lpKeyPath
)
{
if
(
DialogBox
(
0
,
MAKEINTRESOURCE
(
IDD_ADDFAVORITE
),
hWnd
,
addtofavorites_dlgproc
)
==
IDOK
)
{
if
(
RegCreateKeyEx
(
HKEY_CURRENT_USER
,
favoritesKey
,
if
(
RegCreateKeyEx
W
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
hKey
,
NULL
)
==
ERROR_SUCCESS
)
{
RegSetValueEx
(
hKey
,
favoriteName
,
0
,
REG_SZ
,
(
BYTE
*
)
lpKeyPath
,
(
_tcslen
(
lpKeyPath
)
+
1
)
*
sizeof
(
T
CHAR
));
RegSetValueEx
W
(
hKey
,
favoriteName
,
0
,
REG_SZ
,
(
BYTE
*
)
lpKeyPath
,
(
lstrlenW
(
lpKeyPath
)
+
1
)
*
sizeof
(
W
CHAR
));
RegCloseKey
(
hKey
);
}
}
...
...
@@ -831,9 +831,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if
(
DialogBox
(
0
,
MAKEINTRESOURCE
(
IDD_DELFAVORITE
),
hWnd
,
removefavorite_dlgproc
)
==
IDOK
)
{
HKEY
hKey
;
if
(
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
favoritesKey
,
if
(
RegOpenKeyEx
W
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
KEY_READ
|
KEY_WRITE
,
&
hKey
)
==
ERROR_SUCCESS
)
{
RegDeleteValue
(
hKey
,
favoriteName
);
RegDeleteValue
W
(
hKey
,
favoriteName
);
RegCloseKey
(
hKey
);
}
}
...
...
programs/regedit/main.h
View file @
455ce06d
...
...
@@ -136,7 +136,7 @@ extern LPWSTR GetItemPathW(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
extern
BOOL
DeleteNode
(
HWND
hwndTV
,
HTREEITEM
hItem
);
extern
HTREEITEM
InsertNode
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPWSTR
name
);
extern
HWND
StartKeyRename
(
HWND
hwndTV
);
extern
HTREEITEM
FindPathInTree
(
HWND
hwndTV
,
LPC
T
STR
lpKeyName
);
extern
HTREEITEM
FindPathInTree
(
HWND
hwndTV
,
LPC
W
STR
lpKeyName
);
extern
HTREEITEM
FindNext
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPCTSTR
sstring
,
int
mode
,
int
*
row
);
/* edit.c */
...
...
programs/regedit/treeview.c
View file @
455ce06d
...
...
@@ -166,9 +166,9 @@ LPWSTR GetItemPathW(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey)
return
pathBuffer
;
}
static
LP
TSTR
get_path_component
(
LPCT
STR
*
lplpKeyName
)
{
LPC
T
STR
lpPos
=
*
lplpKeyName
;
LP
T
STR
lpResult
=
NULL
;
static
LP
WSTR
get_path_component
(
LPCW
STR
*
lplpKeyName
)
{
LPC
W
STR
lpPos
=
*
lplpKeyName
;
LP
W
STR
lpResult
=
NULL
;
int
len
;
if
(
!
lpPos
)
return
NULL
;
...
...
@@ -176,37 +176,37 @@ static LPTSTR get_path_component(LPCTSTR *lplpKeyName) {
lpPos
++
;
if
(
*
lpPos
&&
lpPos
==
*
lplpKeyName
)
return
NULL
;
len
=
(
lpPos
+
1
-
(
*
lplpKeyName
))
*
sizeof
(
TCHAR
);
lpResult
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
len
=
lpPos
+
1
-
(
*
lplpKeyName
);
lpResult
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
lpResult
)
/* that would be very odd */
return
NULL
;
memcpy
(
lpResult
,
*
lplpKeyName
,
len
-
1
);
lpResult
[
len
-
1
]
=
'\0'
;
lstrcpynW
(
lpResult
,
*
lplpKeyName
,
len
);
*
lplpKeyName
=
*
lpPos
?
lpPos
+
1
:
NULL
;
return
lpResult
;
}
HTREEITEM
FindPathInTree
(
HWND
hwndTV
,
LPC
T
STR
lpKeyName
)
{
TVITEMEX
tvi
;
T
CHAR
buf
[
261
];
/* tree view has 260 character limitation on item name */
HTREEITEM
FindPathInTree
(
HWND
hwndTV
,
LPC
W
STR
lpKeyName
)
{
TVITEMEX
W
tvi
;
W
CHAR
buf
[
261
];
/* tree view has 260 character limitation on item name */
HTREEITEM
hItem
,
hOldItem
;
buf
[
260
]
=
'\0'
;
hItem
=
TreeView_GetRoot
(
hwndTV
);
SendMessage
(
hwndTV
,
TVM_EXPAND
,
TVE_EXPAND
,
(
LPARAM
)
hItem
);
SendMessage
W
(
hwndTV
,
TVM_EXPAND
,
TVE_EXPAND
,
(
LPARAM
)
hItem
);
hItem
=
TreeView_GetChild
(
hwndTV
,
hItem
);
hOldItem
=
hItem
;
while
(
1
)
{
LPTSTR
lpItemName
=
get_path_component
(
&
lpKeyName
);
LPWSTR
lpItemName
=
get_path_component
(
&
lpKeyName
);
if
(
lpItemName
)
{
while
(
hItem
)
{
tvi
.
mask
=
TVIF_TEXT
|
TVIF_HANDLE
;
tvi
.
hItem
=
hItem
;
tvi
.
pszText
=
buf
;
tvi
.
cchTextMax
=
260
;
SendMessage
(
hwndTV
,
TVM_GETITEM
,
0
,
(
LPARAM
)
&
tvi
);
if
(
!
_tcsicmp
(
tvi
.
pszText
,
lpItemName
))
{
SendMessage
(
hwndTV
,
TVM_EXPAND
,
TVE_EXPAND
,
(
LPARAM
)
hItem
);
SendMessage
W
(
hwndTV
,
TVM_GETITEMW
,
0
,
(
LPARAM
)
&
tvi
);
if
(
!
lstrcmpiW
(
tvi
.
pszText
,
lpItemName
))
{
SendMessage
W
(
hwndTV
,
TVM_EXPAND
,
TVE_EXPAND
,
(
LPARAM
)
hItem
);
if
(
!
lpKeyName
)
return
hItem
;
hOldItem
=
hItem
;
...
...
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