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
223c24bd
Commit
223c24bd
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: Remove unneeded character conversions.
parent
f0a507e1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
28 deletions
+18
-28
treeview.c
programs/regedit/treeview.c
+18
-28
No files found.
programs/regedit/treeview.c
View file @
223c24bd
...
...
@@ -234,9 +234,7 @@ BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem)
/* Add an entry to the tree. Only give hKey for root nodes (HKEY_ constants) */
static
HTREEITEM
AddEntryToTree
(
HWND
hwndTV
,
HTREEITEM
hParent
,
LPWSTR
label
,
HKEY
hKey
,
DWORD
dwChildren
)
{
TVINSERTSTRUCT
tvins
;
CHAR
*
labelA
=
GetMultiByteString
(
label
);
HTREEITEM
ret
;
TVINSERTSTRUCTW
tvins
;
if
(
hKey
)
{
if
(
RegQueryInfoKeyW
(
hKey
,
0
,
0
,
0
,
&
dwChildren
,
0
,
0
,
0
,
0
,
0
,
0
,
0
)
!=
ERROR_SUCCESS
)
{
...
...
@@ -245,17 +243,16 @@ static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPWSTR label, HK
}
tvins
.
u
.
item
.
mask
=
TVIF_TEXT
|
TVIF_IMAGE
|
TVIF_SELECTEDIMAGE
|
TVIF_CHILDREN
|
TVIF_PARAM
;
tvins
.
u
.
item
.
pszText
=
label
A
;
tvins
.
u
.
item
.
cchTextMax
=
lstrlen
(
labelA
);
tvins
.
u
.
item
.
pszText
=
label
;
tvins
.
u
.
item
.
cchTextMax
=
lstrlen
W
(
label
);
tvins
.
u
.
item
.
iImage
=
Image_Closed
;
tvins
.
u
.
item
.
iSelectedImage
=
Image_Open
;
tvins
.
u
.
item
.
cChildren
=
dwChildren
;
tvins
.
u
.
item
.
lParam
=
(
LPARAM
)
hKey
;
tvins
.
hInsertAfter
=
(
HTREEITEM
)(
hKey
?
TVI_LAST
:
TVI_SORT
);
tvins
.
hParent
=
hParent
;
ret
=
TreeView_InsertItem
(
hwndTV
,
&
tvins
);
HeapFree
(
GetProcessHeap
(),
0
,
labelA
);
return
ret
;
return
TreeView_InsertItemW
(
hwndTV
,
&
tvins
);
}
static
BOOL
match_string
(
LPCTSTR
sstring1
,
LPCTSTR
sstring2
,
int
mode
)
...
...
@@ -395,7 +392,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
LPWSTR
KeyPath
;
DWORD
dwCount
,
dwIndex
,
dwMaxSubKeyLen
;
LPWSTR
Name
;
TVITEM
tvItem
;
TVITEM
W
tvItem
;
hRoot
=
NULL
;
KeyPath
=
GetItemPathW
(
hwndTV
,
hItem
,
&
hRoot
);
...
...
@@ -421,7 +418,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
tvItem
.
mask
=
TVIF_CHILDREN
;
tvItem
.
hItem
=
hItem
;
tvItem
.
cChildren
=
dwCount
;
if
(
!
TreeView_SetItem
(
hwndTV
,
&
tvItem
))
{
if
(
!
TreeView_SetItem
W
(
hwndTV
,
&
tvItem
))
{
return
FALSE
;
}
...
...
@@ -436,7 +433,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
return
FALSE
;
}
tvItem
.
cchTextMax
=
dwMaxSubKeyLen
;
if
(
!
(
tvItem
.
pszText
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxSubKeyLen
*
sizeof
(
T
CHAR
))))
{
if
(
!
(
tvItem
.
pszText
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxSubKeyLen
*
sizeof
(
W
CHAR
))))
{
return
FALSE
;
}
...
...
@@ -444,7 +441,6 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
for
(
dwIndex
=
0
;
dwIndex
<
dwCount
;
dwIndex
++
)
{
DWORD
cName
=
dwMaxSubKeyLen
,
dwSubCount
;
BOOL
found
;
CHAR
*
NameA
;
found
=
FALSE
;
if
(
RegEnumKeyExW
(
hKey
,
dwIndex
,
Name
,
&
cName
,
0
,
0
,
0
,
NULL
)
!=
ERROR_SUCCESS
)
{
...
...
@@ -460,27 +456,23 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
RegCloseKey
(
hSubKey
);
}
NameA
=
GetMultiByteString
(
Name
);
/* Check if the node is already in there. */
for
(
childItem
=
TreeView_GetChild
(
hwndTV
,
hItem
);
childItem
;
childItem
=
TreeView_GetNextSibling
(
hwndTV
,
childItem
))
{
tvItem
.
mask
=
TVIF_TEXT
;
tvItem
.
hItem
=
childItem
;
if
(
!
TreeView_GetItem
(
hwndTV
,
&
tvItem
))
{
HeapFree
(
GetProcessHeap
(),
0
,
NameA
);
if
(
!
TreeView_GetItemW
(
hwndTV
,
&
tvItem
))
{
return
FALSE
;
}
if
(
!
stricmp
(
tvItem
.
pszText
,
NameA
))
{
if
(
!
lstrcmpiW
(
tvItem
.
pszText
,
Name
))
{
found
=
TRUE
;
HeapFree
(
GetProcessHeap
(),
0
,
NameA
);
break
;
}
}
if
(
found
==
FALSE
)
{
WINE_TRACE
(
"New subkey %s
\n
"
,
NameA
);
WINE_TRACE
(
"New subkey %s
\n
"
,
wine_dbgstr_w
(
Name
)
);
AddEntryToTree
(
hwndTV
,
hItem
,
Name
,
NULL
,
dwSubCount
);
}
}
...
...
@@ -493,7 +485,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
while
(
childItem
)
{
HTREEITEM
nextItem
=
TreeView_GetNextSibling
(
hwndTV
,
childItem
);
if
(
RefreshTreeItem
(
hwndTV
,
childItem
)
==
FALSE
)
{
SendMessage
(
hwndTV
,
TVM_DELETEITEM
,
0
,
(
LPARAM
)
childItem
);
SendMessage
W
(
hwndTV
,
TVM_DELETEITEM
,
0
,
(
LPARAM
)
childItem
);
}
childItem
=
nextItem
;
}
...
...
@@ -529,9 +521,9 @@ BOOL RefreshTreeView(HWND hwndTV)
HTREEITEM
InsertNode
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPWSTR
name
)
{
T
CHAR
buf
[
MAX_NEW_KEY_LEN
];
W
CHAR
buf
[
MAX_NEW_KEY_LEN
];
HTREEITEM
hNewItem
=
0
;
TVITEMEX
item
;
TVITEMEX
W
item
;
if
(
!
hItem
)
hItem
=
TreeView_GetSelection
(
hwndTV
);
if
(
!
hItem
)
return
FALSE
;
...
...
@@ -540,22 +532,20 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
}
else
{
item
.
mask
=
TVIF_CHILDREN
|
TVIF_HANDLE
;
item
.
hItem
=
hItem
;
if
(
!
TreeView_GetItem
(
hwndTV
,
&
item
))
return
FALSE
;
if
(
!
TreeView_GetItem
W
(
hwndTV
,
&
item
))
return
FALSE
;
item
.
cChildren
=
1
;
if
(
!
TreeView_SetItem
(
hwndTV
,
&
item
))
return
FALSE
;
if
(
!
TreeView_SetItem
W
(
hwndTV
,
&
item
))
return
FALSE
;
}
SendMessageW
(
hwndTV
,
TVM_EXPAND
,
TVE_EXPAND
,
(
LPARAM
)
hItem
);
if
(
!
hNewItem
)
{
char
*
nameA
=
GetMultiByteString
(
name
);
for
(
hNewItem
=
TreeView_GetChild
(
hwndTV
,
hItem
);
hNewItem
;
hNewItem
=
TreeView_GetNextSibling
(
hwndTV
,
hNewItem
))
{
item
.
mask
=
TVIF_HANDLE
|
TVIF_TEXT
;
item
.
hItem
=
hNewItem
;
item
.
pszText
=
buf
;
item
.
cchTextMax
=
COUNT_OF
(
buf
);
if
(
!
TreeView_GetItem
(
hwndTV
,
&
item
))
continue
;
if
(
lstrcmp
(
nameA
,
item
.
pszText
)
==
0
)
break
;
if
(
!
TreeView_GetItem
W
(
hwndTV
,
&
item
))
continue
;
if
(
lstrcmp
W
(
name
,
item
.
pszText
)
==
0
)
break
;
}
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
}
if
(
hNewItem
)
SendMessageW
(
hwndTV
,
TVM_SELECTITEM
,
TVGN_CARET
,
(
LPARAM
)
hNewItem
);
...
...
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