Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
74cae34d
Commit
74cae34d
authored
Aug 22, 2008
by
Alexander Nicolaysen Sørnes
Committed by
Alexandre Julliard
Aug 22, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Convert AddEntryToTree to unicode.
parent
a6a4109d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
30 deletions
+37
-30
treeview.c
programs/regedit/treeview.c
+37
-30
No files found.
programs/regedit/treeview.c
View file @
74cae34d
...
@@ -232,26 +232,30 @@ BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem)
...
@@ -232,26 +232,30 @@ BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem)
}
}
/* Add an entry to the tree. Only give hKey for root nodes (HKEY_ constants) */
/* Add an entry to the tree. Only give hKey for root nodes (HKEY_ constants) */
static
HTREEITEM
AddEntryToTree
(
HWND
hwndTV
,
HTREEITEM
hParent
,
LP
T
STR
label
,
HKEY
hKey
,
DWORD
dwChildren
)
static
HTREEITEM
AddEntryToTree
(
HWND
hwndTV
,
HTREEITEM
hParent
,
LP
W
STR
label
,
HKEY
hKey
,
DWORD
dwChildren
)
{
{
TVINSERTSTRUCT
tvins
;
TVINSERTSTRUCT
tvins
;
CHAR
*
labelA
=
GetMultiByteString
(
label
);
HTREEITEM
ret
;
if
(
hKey
)
{
if
(
hKey
)
{
if
(
RegQueryInfoKey
(
hKey
,
0
,
0
,
0
,
&
dwChildren
,
0
,
0
,
0
,
0
,
0
,
0
,
0
)
!=
ERROR_SUCCESS
)
{
if
(
RegQueryInfoKey
W
(
hKey
,
0
,
0
,
0
,
&
dwChildren
,
0
,
0
,
0
,
0
,
0
,
0
,
0
)
!=
ERROR_SUCCESS
)
{
dwChildren
=
0
;
dwChildren
=
0
;
}
}
}
}
tvins
.
u
.
item
.
mask
=
TVIF_TEXT
|
TVIF_IMAGE
|
TVIF_SELECTEDIMAGE
|
TVIF_CHILDREN
|
TVIF_PARAM
;
tvins
.
u
.
item
.
mask
=
TVIF_TEXT
|
TVIF_IMAGE
|
TVIF_SELECTEDIMAGE
|
TVIF_CHILDREN
|
TVIF_PARAM
;
tvins
.
u
.
item
.
pszText
=
label
;
tvins
.
u
.
item
.
pszText
=
label
A
;
tvins
.
u
.
item
.
cchTextMax
=
lstrlen
(
label
);
tvins
.
u
.
item
.
cchTextMax
=
lstrlen
(
label
A
);
tvins
.
u
.
item
.
iImage
=
Image_Closed
;
tvins
.
u
.
item
.
iImage
=
Image_Closed
;
tvins
.
u
.
item
.
iSelectedImage
=
Image_Open
;
tvins
.
u
.
item
.
iSelectedImage
=
Image_Open
;
tvins
.
u
.
item
.
cChildren
=
dwChildren
;
tvins
.
u
.
item
.
cChildren
=
dwChildren
;
tvins
.
u
.
item
.
lParam
=
(
LPARAM
)
hKey
;
tvins
.
u
.
item
.
lParam
=
(
LPARAM
)
hKey
;
tvins
.
hInsertAfter
=
(
HTREEITEM
)(
hKey
?
TVI_LAST
:
TVI_SORT
);
tvins
.
hInsertAfter
=
(
HTREEITEM
)(
hKey
?
TVI_LAST
:
TVI_SORT
);
tvins
.
hParent
=
hParent
;
tvins
.
hParent
=
hParent
;
return
TreeView_InsertItem
(
hwndTV
,
&
tvins
);
ret
=
TreeView_InsertItem
(
hwndTV
,
&
tvins
);
HeapFree
(
GetProcessHeap
(),
0
,
labelA
);
return
ret
;
}
}
static
BOOL
match_string
(
LPCTSTR
sstring1
,
LPCTSTR
sstring2
,
int
mode
)
static
BOOL
match_string
(
LPCTSTR
sstring1
,
LPCTSTR
sstring2
,
int
mode
)
...
@@ -388,20 +392,20 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
...
@@ -388,20 +392,20 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
{
{
HKEY
hRoot
,
hKey
,
hSubKey
;
HKEY
hRoot
,
hKey
,
hSubKey
;
HTREEITEM
childItem
;
HTREEITEM
childItem
;
LP
T
STR
KeyPath
;
LP
W
STR
KeyPath
;
DWORD
dwCount
,
dwIndex
,
dwMaxSubKeyLen
;
DWORD
dwCount
,
dwIndex
,
dwMaxSubKeyLen
;
LPSTR
Name
;
LP
W
STR
Name
;
TVITEM
tvItem
;
TVITEM
tvItem
;
hRoot
=
NULL
;
hRoot
=
NULL
;
KeyPath
=
GetItemPath
(
hwndTV
,
hItem
,
&
hRoot
);
KeyPath
=
GetItemPath
W
(
hwndTV
,
hItem
,
&
hRoot
);
if
(
!
KeyPath
||
!
hRoot
)
if
(
!
KeyPath
||
!
hRoot
)
return
FALSE
;
return
FALSE
;
if
(
*
KeyPath
)
{
if
(
*
KeyPath
)
{
if
(
RegOpenKeyEx
(
hRoot
,
KeyPath
,
0
,
KEY_READ
,
&
hKey
)
!=
ERROR_SUCCESS
)
{
if
(
RegOpenKeyEx
W
(
hRoot
,
KeyPath
,
0
,
KEY_READ
,
&
hKey
)
!=
ERROR_SUCCESS
)
{
WINE_TRACE
(
"RegOpenKeyEx failed,
\"
%s
\"
was probably removed.
\n
"
,
KeyPath
);
WINE_TRACE
(
"RegOpenKeyEx failed,
%s was probably removed.
\n
"
,
wine_dbgstr_w
(
KeyPath
)
);
return
FALSE
;
return
FALSE
;
}
}
}
else
{
}
else
{
...
@@ -409,7 +413,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
...
@@ -409,7 +413,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
}
}
HeapFree
(
GetProcessHeap
(),
0
,
KeyPath
);
HeapFree
(
GetProcessHeap
(),
0
,
KeyPath
);
if
(
RegQueryInfoKey
(
hKey
,
0
,
0
,
0
,
&
dwCount
,
&
dwMaxSubKeyLen
,
0
,
0
,
0
,
0
,
0
,
0
)
!=
ERROR_SUCCESS
)
{
if
(
RegQueryInfoKey
W
(
hKey
,
0
,
0
,
0
,
&
dwCount
,
&
dwMaxSubKeyLen
,
0
,
0
,
0
,
0
,
0
,
0
)
!=
ERROR_SUCCESS
)
{
return
FALSE
;
return
FALSE
;
}
}
...
@@ -428,7 +432,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
...
@@ -428,7 +432,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
}
}
dwMaxSubKeyLen
++
;
/* account for the \0 terminator */
dwMaxSubKeyLen
++
;
/* account for the \0 terminator */
if
(
!
(
Name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxSubKeyLen
*
sizeof
(
T
CHAR
))))
{
if
(
!
(
Name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxSubKeyLen
*
sizeof
(
W
CHAR
))))
{
return
FALSE
;
return
FALSE
;
}
}
tvItem
.
cchTextMax
=
dwMaxSubKeyLen
;
tvItem
.
cchTextMax
=
dwMaxSubKeyLen
;
...
@@ -440,38 +444,43 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
...
@@ -440,38 +444,43 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
for
(
dwIndex
=
0
;
dwIndex
<
dwCount
;
dwIndex
++
)
{
for
(
dwIndex
=
0
;
dwIndex
<
dwCount
;
dwIndex
++
)
{
DWORD
cName
=
dwMaxSubKeyLen
,
dwSubCount
;
DWORD
cName
=
dwMaxSubKeyLen
,
dwSubCount
;
BOOL
found
;
BOOL
found
;
CHAR
*
NameA
;
found
=
FALSE
;
found
=
FALSE
;
if
(
RegEnumKeyEx
(
hKey
,
dwIndex
,
Name
,
&
cName
,
0
,
0
,
0
,
NULL
)
!=
ERROR_SUCCESS
)
{
if
(
RegEnumKeyEx
W
(
hKey
,
dwIndex
,
Name
,
&
cName
,
0
,
0
,
0
,
NULL
)
!=
ERROR_SUCCESS
)
{
continue
;
continue
;
}
}
/* Find the number of children of the node. */
/* Find the number of children of the node. */
dwSubCount
=
0
;
dwSubCount
=
0
;
if
(
RegOpenKeyEx
(
hKey
,
Name
,
0
,
KEY_QUERY_VALUE
,
&
hSubKey
)
==
ERROR_SUCCESS
)
{
if
(
RegOpenKeyEx
W
(
hKey
,
Name
,
0
,
KEY_QUERY_VALUE
,
&
hSubKey
)
==
ERROR_SUCCESS
)
{
if
(
RegQueryInfoKey
(
hSubKey
,
0
,
0
,
0
,
&
dwSubCount
,
0
,
0
,
0
,
0
,
0
,
0
,
0
)
!=
ERROR_SUCCESS
)
{
if
(
RegQueryInfoKey
(
hSubKey
,
0
,
0
,
0
,
&
dwSubCount
,
0
,
0
,
0
,
0
,
0
,
0
,
0
)
!=
ERROR_SUCCESS
)
{
dwSubCount
=
0
;
dwSubCount
=
0
;
}
}
RegCloseKey
(
hSubKey
);
RegCloseKey
(
hSubKey
);
}
}
NameA
=
GetMultiByteString
(
Name
);
/* Check if the node is already in there. */
/* Check if the node is already in there. */
for
(
childItem
=
TreeView_GetChild
(
hwndTV
,
hItem
);
childItem
;
for
(
childItem
=
TreeView_GetChild
(
hwndTV
,
hItem
);
childItem
;
childItem
=
TreeView_GetNextSibling
(
hwndTV
,
childItem
))
{
childItem
=
TreeView_GetNextSibling
(
hwndTV
,
childItem
))
{
tvItem
.
mask
=
TVIF_TEXT
;
tvItem
.
mask
=
TVIF_TEXT
;
tvItem
.
hItem
=
childItem
;
tvItem
.
hItem
=
childItem
;
if
(
!
TreeView_GetItem
(
hwndTV
,
&
tvItem
))
{
if
(
!
TreeView_GetItem
(
hwndTV
,
&
tvItem
))
{
HeapFree
(
GetProcessHeap
(),
0
,
NameA
);
return
FALSE
;
return
FALSE
;
}
}
if
(
!
stricmp
(
tvItem
.
pszText
,
Name
))
{
if
(
!
stricmp
(
tvItem
.
pszText
,
Name
A
))
{
found
=
TRUE
;
found
=
TRUE
;
HeapFree
(
GetProcessHeap
(),
0
,
NameA
);
break
;
break
;
}
}
}
}
if
(
found
==
FALSE
)
{
if
(
found
==
FALSE
)
{
WINE_TRACE
(
"New subkey %s
\n
"
,
Name
);
WINE_TRACE
(
"New subkey %s
\n
"
,
Name
A
);
AddEntryToTree
(
hwndTV
,
hItem
,
Name
,
NULL
,
dwSubCount
);
AddEntryToTree
(
hwndTV
,
hItem
,
Name
,
NULL
,
dwSubCount
);
}
}
}
}
...
@@ -527,9 +536,7 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
...
@@ -527,9 +536,7 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
if
(
!
hItem
)
hItem
=
TreeView_GetSelection
(
hwndTV
);
if
(
!
hItem
)
hItem
=
TreeView_GetSelection
(
hwndTV
);
if
(
!
hItem
)
return
FALSE
;
if
(
!
hItem
)
return
FALSE
;
if
(
TreeView_GetItemState
(
hwndTV
,
hItem
,
TVIS_EXPANDEDONCE
))
{
if
(
TreeView_GetItemState
(
hwndTV
,
hItem
,
TVIS_EXPANDEDONCE
))
{
char
*
nameA
=
GetMultiByteString
(
name
);
hNewItem
=
AddEntryToTree
(
hwndTV
,
hItem
,
name
,
0
,
0
);
hNewItem
=
AddEntryToTree
(
hwndTV
,
hItem
,
nameA
,
0
,
0
);
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
}
else
{
}
else
{
item
.
mask
=
TVIF_CHILDREN
|
TVIF_HANDLE
;
item
.
mask
=
TVIF_CHILDREN
|
TVIF_HANDLE
;
item
.
hItem
=
hItem
;
item
.
hItem
=
hItem
;
...
@@ -568,7 +575,7 @@ static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName)
...
@@ -568,7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@@ BOOL UpdateExpandingTree(HWND hwndTV, HTREEITEM hItem, int state)
...
@@ -646,8 +653,8 @@ BOOL UpdateExpandingTree(HWND hwndTV, HTREEITEM hItem, int state)
{
{
DWORD
dwCount
,
dwIndex
,
dwMaxSubKeyLen
;
DWORD
dwCount
,
dwIndex
,
dwMaxSubKeyLen
;
HKEY
hRoot
,
hNewKey
,
hKey
;
HKEY
hRoot
,
hNewKey
,
hKey
;
LP
T
STR
keyPath
;
LP
W
STR
keyPath
;
LP
T
STR
Name
;
LP
W
STR
Name
;
LONG
errCode
;
LONG
errCode
;
HCURSOR
hcursorOld
;
HCURSOR
hcursorOld
;
...
@@ -658,32 +665,32 @@ BOOL UpdateExpandingTree(HWND hwndTV, HTREEITEM hItem, int state)
...
@@ -658,32 +665,32 @@ BOOL UpdateExpandingTree(HWND hwndTV, HTREEITEM hItem, int state)
}
}
expanding
=
TRUE
;
expanding
=
TRUE
;
hcursorOld
=
SetCursor
(
LoadCursor
(
NULL
,
IDC_WAIT
));
hcursorOld
=
SetCursor
(
LoadCursor
(
NULL
,
IDC_WAIT
));
SendMessage
(
hwndTV
,
WM_SETREDRAW
,
FALSE
,
0
);
SendMessage
W
(
hwndTV
,
WM_SETREDRAW
,
FALSE
,
0
);
keyPath
=
GetItemPath
(
hwndTV
,
hItem
,
&
hRoot
);
keyPath
=
GetItemPath
W
(
hwndTV
,
hItem
,
&
hRoot
);
if
(
!
keyPath
)
goto
done
;
if
(
!
keyPath
)
goto
done
;
if
(
*
keyPath
)
{
if
(
*
keyPath
)
{
errCode
=
RegOpenKeyEx
(
hRoot
,
keyPath
,
0
,
KEY_READ
,
&
hNewKey
);
errCode
=
RegOpenKeyEx
W
(
hRoot
,
keyPath
,
0
,
KEY_READ
,
&
hNewKey
);
if
(
errCode
!=
ERROR_SUCCESS
)
goto
done
;
if
(
errCode
!=
ERROR_SUCCESS
)
goto
done
;
}
else
{
}
else
{
hNewKey
=
hRoot
;
hNewKey
=
hRoot
;
}
}
errCode
=
RegQueryInfoKey
(
hNewKey
,
0
,
0
,
0
,
&
dwCount
,
&
dwMaxSubKeyLen
,
0
,
0
,
0
,
0
,
0
,
0
);
errCode
=
RegQueryInfoKey
W
(
hNewKey
,
0
,
0
,
0
,
&
dwCount
,
&
dwMaxSubKeyLen
,
0
,
0
,
0
,
0
,
0
,
0
);
if
(
errCode
!=
ERROR_SUCCESS
)
goto
done
;
if
(
errCode
!=
ERROR_SUCCESS
)
goto
done
;
dwMaxSubKeyLen
++
;
/* account for the \0 terminator */
dwMaxSubKeyLen
++
;
/* account for the \0 terminator */
Name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxSubKeyLen
*
sizeof
(
T
CHAR
));
Name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxSubKeyLen
*
sizeof
(
W
CHAR
));
if
(
!
Name
)
goto
done
;
if
(
!
Name
)
goto
done
;
for
(
dwIndex
=
0
;
dwIndex
<
dwCount
;
dwIndex
++
)
{
for
(
dwIndex
=
0
;
dwIndex
<
dwCount
;
dwIndex
++
)
{
DWORD
cName
=
dwMaxSubKeyLen
,
dwSubCount
;
DWORD
cName
=
dwMaxSubKeyLen
,
dwSubCount
;
errCode
=
RegEnumKeyEx
(
hNewKey
,
dwIndex
,
Name
,
&
cName
,
0
,
0
,
0
,
0
);
errCode
=
RegEnumKeyEx
W
(
hNewKey
,
dwIndex
,
Name
,
&
cName
,
0
,
0
,
0
,
0
);
if
(
errCode
!=
ERROR_SUCCESS
)
continue
;
if
(
errCode
!=
ERROR_SUCCESS
)
continue
;
errCode
=
RegOpenKeyEx
(
hNewKey
,
Name
,
0
,
KEY_QUERY_VALUE
,
&
hKey
);
errCode
=
RegOpenKeyEx
W
(
hNewKey
,
Name
,
0
,
KEY_QUERY_VALUE
,
&
hKey
);
if
(
errCode
==
ERROR_SUCCESS
)
{
if
(
errCode
==
ERROR_SUCCESS
)
{
errCode
=
RegQueryInfoKey
(
hKey
,
0
,
0
,
0
,
&
dwSubCount
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
errCode
=
RegQueryInfoKey
W
(
hKey
,
0
,
0
,
0
,
&
dwSubCount
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
RegCloseKey
(
hKey
);
RegCloseKey
(
hKey
);
}
}
if
(
errCode
!=
ERROR_SUCCESS
)
dwSubCount
=
0
;
if
(
errCode
!=
ERROR_SUCCESS
)
dwSubCount
=
0
;
...
...
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