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 @@
...
@@ -36,9 +36,9 @@
* Global and Local Variables:
* 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
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
TCHAR
searchString
[
128
];
static
int
searchMask
=
SEARCH_KEYS
|
SEARCH_VALUES
|
SEARCH_CONTENT
;
static
int
searchMask
=
SEARCH_KEYS
|
SEARCH_VALUES
|
SEARCH_CONTENT
;
...
@@ -123,9 +123,9 @@ static void OnInitMenuPopup(HWND hWnd, HMENU hMenu, short wItem)
...
@@ -123,9 +123,9 @@ static void OnInitMenuPopup(HWND hWnd, HMENU hMenu, short wItem)
HKEY
hKey
;
HKEY
hKey
;
while
(
GetMenuItemCount
(
hMenu
)
>
2
)
while
(
GetMenuItemCount
(
hMenu
)
>
2
)
DeleteMenu
(
hMenu
,
2
,
MF_BYPOSITION
);
DeleteMenu
(
hMenu
,
2
,
MF_BYPOSITION
);
if
(
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
favoritesKey
,
if
(
RegOpenKeyEx
W
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
KEY_READ
,
&
hKey
)
==
ERROR_SUCCESS
)
{
0
,
KEY_READ
,
&
hKey
)
==
ERROR_SUCCESS
)
{
T
CHAR
namebuf
[
KEY_MAX_LEN
];
W
CHAR
namebuf
[
KEY_MAX_LEN
];
BYTE
valuebuf
[
4096
];
BYTE
valuebuf
[
4096
];
int
i
=
0
;
int
i
=
0
;
BOOL
sep
=
FALSE
;
BOOL
sep
=
FALSE
;
...
@@ -134,15 +134,15 @@ static void OnInitMenuPopup(HWND hWnd, HMENU hMenu, short wItem)
...
@@ -134,15 +134,15 @@ static void OnInitMenuPopup(HWND hWnd, HMENU hMenu, short wItem)
do
{
do
{
ksize
=
KEY_MAX_LEN
;
ksize
=
KEY_MAX_LEN
;
vsize
=
sizeof
(
valuebuf
);
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
)
if
(
error
!=
ERROR_SUCCESS
)
break
;
break
;
if
(
type
==
REG_SZ
)
{
if
(
type
==
REG_SZ
)
{
if
(
!
sep
)
{
if
(
!
sep
)
{
AppendMenu
(
hMenu
,
MF_SEPARATOR
,
-
1
,
NULL
);
AppendMenu
W
(
hMenu
,
MF_SEPARATOR
,
-
1
,
NULL
);
sep
=
TRUE
;
sep
=
TRUE
;
}
}
AppendMenu
(
hMenu
,
MF_STRING
,
ID_FAVORITE_FIRST
+
i
,
namebuf
);
AppendMenu
W
(
hMenu
,
MF_STRING
,
ID_FAVORITE_FIRST
+
i
,
namebuf
);
}
}
i
++
;
i
++
;
}
while
(
error
==
ERROR_SUCCESS
);
}
while
(
error
==
ERROR_SUCCESS
);
...
@@ -524,13 +524,13 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
...
@@ -524,13 +524,13 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
case
WM_INITDIALOG
:
case
WM_INITDIALOG
:
{
{
HKEY
hKeyRoot
=
NULL
;
HKEY
hKeyRoot
=
NULL
;
LP
STR
ItemPath
=
GetItemPath
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
&
hKeyRoot
);
LP
WSTR
ItemPath
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
&
hKeyRoot
);
if
(
!
ItemPath
||
!*
ItemPath
)
if
(
!
ItemPath
||
!*
ItemPath
)
ItemPath
=
GetItemFullPath
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
FALSE
);
ItemPath
=
GetItemFullPath
W
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
FALSE
);
EnableWindow
(
GetDlgItem
(
hwndDlg
,
IDOK
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hwndDlg
,
IDOK
),
FALSE
);
SetWindowText
(
hwndValue
,
ItemPath
);
SetWindowText
W
(
hwndValue
,
ItemPath
);
SendMessage
(
hwndValue
,
EM_SETLIMITTEXT
,
127
,
0
);
SendMessage
W
(
hwndValue
,
EM_SETLIMITTEXT
,
127
,
0
);
return
TRUE
;
return
TRUE
;
}
}
case
WM_COMMAND
:
case
WM_COMMAND
:
...
@@ -542,8 +542,8 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
...
@@ -542,8 +542,8 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
}
}
break
;
break
;
case
IDOK
:
case
IDOK
:
if
(
GetWindowTextLength
(
hwndValue
)
>
0
)
{
if
(
GetWindowTextLength
W
(
hwndValue
)
>
0
)
{
GetWindowText
(
hwndValue
,
favoriteName
,
128
);
GetWindowText
W
(
hwndValue
,
favoriteName
,
128
);
EndDialog
(
hwndDlg
,
IDOK
);
EndDialog
(
hwndDlg
,
IDOK
);
}
}
return
TRUE
;
return
TRUE
;
...
@@ -565,20 +565,20 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
...
@@ -565,20 +565,20 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
HKEY
hKey
;
HKEY
hKey
;
int
i
=
0
;
int
i
=
0
;
EnableWindow
(
GetDlgItem
(
hwndDlg
,
IDOK
),
FALSE
);
EnableWindow
(
GetDlgItem
(
hwndDlg
,
IDOK
),
FALSE
);
if
(
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
favoritesKey
,
if
(
RegOpenKeyEx
W
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
KEY_READ
,
&
hKey
)
==
ERROR_SUCCESS
)
{
0
,
KEY_READ
,
&
hKey
)
==
ERROR_SUCCESS
)
{
T
CHAR
namebuf
[
KEY_MAX_LEN
];
W
CHAR
namebuf
[
KEY_MAX_LEN
];
BYTE
valuebuf
[
4096
];
BYTE
valuebuf
[
4096
];
DWORD
ksize
,
vsize
,
type
;
DWORD
ksize
,
vsize
,
type
;
LONG
error
;
LONG
error
;
do
{
do
{
ksize
=
KEY_MAX_LEN
;
ksize
=
KEY_MAX_LEN
;
vsize
=
sizeof
(
valuebuf
);
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
)
if
(
error
!=
ERROR_SUCCESS
)
break
;
break
;
if
(
type
==
REG_SZ
)
{
if
(
type
==
REG_SZ
)
{
SendMessage
(
hwndList
,
LB_ADDSTRING
,
0
,
(
LPARAM
)
namebuf
);
SendMessage
W
(
hwndList
,
LB_ADDSTRING
,
0
,
(
LPARAM
)
namebuf
);
}
}
i
++
;
i
++
;
}
while
(
error
==
ERROR_SUCCESS
);
}
while
(
error
==
ERROR_SUCCESS
);
...
@@ -587,7 +587,7 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
...
@@ -587,7 +587,7 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
else
else
return
FALSE
;
return
FALSE
;
EnableWindow
(
GetDlgItem
(
hwndDlg
,
IDOK
),
i
!=
0
);
EnableWindow
(
GetDlgItem
(
hwndDlg
,
IDOK
),
i
!=
0
);
SendMessage
(
hwndList
,
LB_SETCURSEL
,
0
,
0
);
SendMessage
W
(
hwndList
,
LB_SETCURSEL
,
0
,
0
);
return
TRUE
;
return
TRUE
;
}
}
case
WM_COMMAND
:
case
WM_COMMAND
:
...
@@ -602,11 +602,11 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
...
@@ -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
pos
=
SendMessage
(
hwndList
,
LB_GETCURSEL
,
0
,
0
);
int
len
=
SendMessage
(
hwndList
,
LB_GETTEXTLEN
,
pos
,
0
);
int
len
=
SendMessage
(
hwndList
,
LB_GETTEXTLEN
,
pos
,
0
);
if
(
len
>
0
)
{
if
(
len
>
0
)
{
LP
TSTR
lpName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
T
CHAR
)
*
(
len
+
1
));
LP
WSTR
lpName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
W
CHAR
)
*
(
len
+
1
));
SendMessage
(
hwndList
,
LB_GETTEXT
,
pos
,
(
LPARAM
)
lpName
);
SendMessage
W
(
hwndList
,
LB_GETTEXT
,
pos
,
(
LPARAM
)
lpName
);
if
(
len
>
127
)
if
(
len
>
127
)
lpName
[
127
]
=
'\0'
;
lpName
[
127
]
=
'\0'
;
_tcscpy
(
favoriteName
,
lpName
);
lstrcpyW
(
favoriteName
,
lpName
);
EndDialog
(
hwndDlg
,
IDOK
);
EndDialog
(
hwndDlg
,
IDOK
);
HeapFree
(
GetProcessHeap
(),
0
,
lpName
);
HeapFree
(
GetProcessHeap
(),
0
,
lpName
);
}
}
...
@@ -642,15 +642,15 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...
@@ -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
)
{
if
(
LOWORD
(
wParam
)
>=
ID_FAVORITE_FIRST
&&
LOWORD
(
wParam
)
<=
ID_FAVORITE_LAST
)
{
HKEY
hKey
;
HKEY
hKey
;
if
(
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
favoritesKey
,
if
(
RegOpenKeyEx
W
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
KEY_READ
,
&
hKey
)
==
ERROR_SUCCESS
)
{
0
,
KEY_READ
,
&
hKey
)
==
ERROR_SUCCESS
)
{
T
CHAR
namebuf
[
KEY_MAX_LEN
];
W
CHAR
namebuf
[
KEY_MAX_LEN
];
BYTE
valuebuf
[
4096
];
BYTE
valuebuf
[
4096
];
DWORD
ksize
=
KEY_MAX_LEN
,
vsize
=
sizeof
(
valuebuf
),
type
=
0
;
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
)
{
&
type
,
valuebuf
,
&
vsize
)
==
ERROR_SUCCESS
)
{
SendMessage
(
g_pChildWnd
->
hTreeWnd
,
TVM_SELECTITEM
,
TVGN_CARET
,
SendMessage
W
(
g_pChildWnd
->
hTreeWnd
,
TVM_SELECTITEM
,
TVGN_CARET
,
(
LPARAM
)
FindPathInTree
(
g_pChildWnd
->
hTreeWnd
,
(
T
CHAR
*
)
valuebuf
)
);
(
LPARAM
)
FindPathInTree
(
g_pChildWnd
->
hTreeWnd
,
(
W
CHAR
*
)
valuebuf
)
);
}
}
RegCloseKey
(
hKey
);
RegCloseKey
(
hKey
);
}
}
...
@@ -813,13 +813,13 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...
@@ -813,13 +813,13 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case
ID_FAVORITES_ADDTOFAVORITES
:
case
ID_FAVORITES_ADDTOFAVORITES
:
{
{
HKEY
hKey
;
HKEY
hKey
;
LPTSTR
lpKeyPath
=
GetItemFullPath
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
FALSE
);
LPWSTR
lpKeyPath
=
GetItemFullPathW
(
g_pChildWnd
->
hTreeWnd
,
NULL
,
FALSE
);
if
(
lpKeyPath
)
{
if
(
lpKeyPath
)
{
if
(
DialogBox
(
0
,
MAKEINTRESOURCE
(
IDD_ADDFAVORITE
),
hWnd
,
addtofavorites_dlgproc
)
==
IDOK
)
{
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
,
0
,
NULL
,
0
,
KEY_READ
|
KEY_WRITE
,
NULL
,
&
hKey
,
NULL
)
==
ERROR_SUCCESS
)
{
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
);
RegCloseKey
(
hKey
);
}
}
}
}
...
@@ -831,9 +831,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...
@@ -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
)
{
if
(
DialogBox
(
0
,
MAKEINTRESOURCE
(
IDD_DELFAVORITE
),
hWnd
,
removefavorite_dlgproc
)
==
IDOK
)
{
HKEY
hKey
;
HKEY
hKey
;
if
(
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
favoritesKey
,
if
(
RegOpenKeyEx
W
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
KEY_READ
|
KEY_WRITE
,
&
hKey
)
==
ERROR_SUCCESS
)
{
0
,
KEY_READ
|
KEY_WRITE
,
&
hKey
)
==
ERROR_SUCCESS
)
{
RegDeleteValue
(
hKey
,
favoriteName
);
RegDeleteValue
W
(
hKey
,
favoriteName
);
RegCloseKey
(
hKey
);
RegCloseKey
(
hKey
);
}
}
}
}
...
...
programs/regedit/main.h
View file @
455ce06d
...
@@ -136,7 +136,7 @@ extern LPWSTR GetItemPathW(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
...
@@ -136,7 +136,7 @@ extern LPWSTR GetItemPathW(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
extern
BOOL
DeleteNode
(
HWND
hwndTV
,
HTREEITEM
hItem
);
extern
BOOL
DeleteNode
(
HWND
hwndTV
,
HTREEITEM
hItem
);
extern
HTREEITEM
InsertNode
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPWSTR
name
);
extern
HTREEITEM
InsertNode
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPWSTR
name
);
extern
HWND
StartKeyRename
(
HWND
hwndTV
);
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
);
extern
HTREEITEM
FindNext
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPCTSTR
sstring
,
int
mode
,
int
*
row
);
/* edit.c */
/* edit.c */
...
...
programs/regedit/treeview.c
View file @
455ce06d
...
@@ -166,9 +166,9 @@ LPWSTR GetItemPathW(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey)
...
@@ -166,9 +166,9 @@ LPWSTR GetItemPathW(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey)
return
pathBuffer
;
return
pathBuffer
;
}
}
static
LP
TSTR
get_path_component
(
LPCT
STR
*
lplpKeyName
)
{
static
LP
WSTR
get_path_component
(
LPCW
STR
*
lplpKeyName
)
{
LPC
T
STR
lpPos
=
*
lplpKeyName
;
LPC
W
STR
lpPos
=
*
lplpKeyName
;
LP
T
STR
lpResult
=
NULL
;
LP
W
STR
lpResult
=
NULL
;
int
len
;
int
len
;
if
(
!
lpPos
)
if
(
!
lpPos
)
return
NULL
;
return
NULL
;
...
@@ -176,37 +176,37 @@ static LPTSTR get_path_component(LPCTSTR *lplpKeyName) {
...
@@ -176,37 +176,37 @@ static LPTSTR get_path_component(LPCTSTR *lplpKeyName) {
lpPos
++
;
lpPos
++
;
if
(
*
lpPos
&&
lpPos
==
*
lplpKeyName
)
if
(
*
lpPos
&&
lpPos
==
*
lplpKeyName
)
return
NULL
;
return
NULL
;
len
=
(
lpPos
+
1
-
(
*
lplpKeyName
))
*
sizeof
(
TCHAR
);
len
=
lpPos
+
1
-
(
*
lplpKeyName
);
lpResult
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
lpResult
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
lpResult
)
/* that would be very odd */
if
(
!
lpResult
)
/* that would be very odd */
return
NULL
;
return
NULL
;
memcpy
(
lpResult
,
*
lplpKeyName
,
len
-
1
);
lstrcpynW
(
lpResult
,
*
lplpKeyName
,
len
);
lpResult
[
len
-
1
]
=
'\0'
;
*
lplpKeyName
=
*
lpPos
?
lpPos
+
1
:
NULL
;
*
lplpKeyName
=
*
lpPos
?
lpPos
+
1
:
NULL
;
return
lpResult
;
return
lpResult
;
}
}
HTREEITEM
FindPathInTree
(
HWND
hwndTV
,
LPC
T
STR
lpKeyName
)
{
HTREEITEM
FindPathInTree
(
HWND
hwndTV
,
LPC
W
STR
lpKeyName
)
{
TVITEMEX
tvi
;
TVITEMEX
W
tvi
;
T
CHAR
buf
[
261
];
/* tree view has 260 character limitation on item name */
W
CHAR
buf
[
261
];
/* tree view has 260 character limitation on item name */
HTREEITEM
hItem
,
hOldItem
;
HTREEITEM
hItem
,
hOldItem
;
buf
[
260
]
=
'\0'
;
buf
[
260
]
=
'\0'
;
hItem
=
TreeView_GetRoot
(
hwndTV
);
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
);
hItem
=
TreeView_GetChild
(
hwndTV
,
hItem
);
hOldItem
=
hItem
;
hOldItem
=
hItem
;
while
(
1
)
{
while
(
1
)
{
LPTSTR
lpItemName
=
get_path_component
(
&
lpKeyName
);
LPWSTR
lpItemName
=
get_path_component
(
&
lpKeyName
);
if
(
lpItemName
)
{
if
(
lpItemName
)
{
while
(
hItem
)
{
while
(
hItem
)
{
tvi
.
mask
=
TVIF_TEXT
|
TVIF_HANDLE
;
tvi
.
mask
=
TVIF_TEXT
|
TVIF_HANDLE
;
tvi
.
hItem
=
hItem
;
tvi
.
hItem
=
hItem
;
tvi
.
pszText
=
buf
;
tvi
.
pszText
=
buf
;
tvi
.
cchTextMax
=
260
;
tvi
.
cchTextMax
=
260
;
SendMessage
(
hwndTV
,
TVM_GETITEM
,
0
,
(
LPARAM
)
&
tvi
);
SendMessage
W
(
hwndTV
,
TVM_GETITEMW
,
0
,
(
LPARAM
)
&
tvi
);
if
(
!
_tcsicmp
(
tvi
.
pszText
,
lpItemName
))
{
if
(
!
lstrcmpiW
(
tvi
.
pszText
,
lpItemName
))
{
SendMessage
(
hwndTV
,
TVM_EXPAND
,
TVE_EXPAND
,
(
LPARAM
)
hItem
);
SendMessage
W
(
hwndTV
,
TVM_EXPAND
,
TVE_EXPAND
,
(
LPARAM
)
hItem
);
if
(
!
lpKeyName
)
if
(
!
lpKeyName
)
return
hItem
;
return
hItem
;
hOldItem
=
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