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)
...
@@ -234,9 +234,7 @@ 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
,
LPWSTR
label
,
HKEY
hKey
,
DWORD
dwChildren
)
static
HTREEITEM
AddEntryToTree
(
HWND
hwndTV
,
HTREEITEM
hParent
,
LPWSTR
label
,
HKEY
hKey
,
DWORD
dwChildren
)
{
{
TVINSERTSTRUCT
tvins
;
TVINSERTSTRUCTW
tvins
;
CHAR
*
labelA
=
GetMultiByteString
(
label
);
HTREEITEM
ret
;
if
(
hKey
)
{
if
(
hKey
)
{
if
(
RegQueryInfoKeyW
(
hKey
,
0
,
0
,
0
,
&
dwChildren
,
0
,
0
,
0
,
0
,
0
,
0
,
0
)
!=
ERROR_SUCCESS
)
{
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
...
@@ -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
.
mask
=
TVIF_TEXT
|
TVIF_IMAGE
|
TVIF_SELECTEDIMAGE
|
TVIF_CHILDREN
|
TVIF_PARAM
;
tvins
.
u
.
item
.
pszText
=
label
A
;
tvins
.
u
.
item
.
pszText
=
label
;
tvins
.
u
.
item
.
cchTextMax
=
lstrlen
(
labelA
);
tvins
.
u
.
item
.
cchTextMax
=
lstrlen
W
(
label
);
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
;
ret
=
TreeView_InsertItem
(
hwndTV
,
&
tvins
);
HeapFree
(
GetProcessHeap
(),
0
,
labelA
);
return
TreeView_InsertItemW
(
hwndTV
,
&
tvins
);
return
ret
;
}
}
static
BOOL
match_string
(
LPCTSTR
sstring1
,
LPCTSTR
sstring2
,
int
mode
)
static
BOOL
match_string
(
LPCTSTR
sstring1
,
LPCTSTR
sstring2
,
int
mode
)
...
@@ -395,7 +392,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
...
@@ -395,7 +392,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
LPWSTR
KeyPath
;
LPWSTR
KeyPath
;
DWORD
dwCount
,
dwIndex
,
dwMaxSubKeyLen
;
DWORD
dwCount
,
dwIndex
,
dwMaxSubKeyLen
;
LPWSTR
Name
;
LPWSTR
Name
;
TVITEM
tvItem
;
TVITEM
W
tvItem
;
hRoot
=
NULL
;
hRoot
=
NULL
;
KeyPath
=
GetItemPathW
(
hwndTV
,
hItem
,
&
hRoot
);
KeyPath
=
GetItemPathW
(
hwndTV
,
hItem
,
&
hRoot
);
...
@@ -421,7 +418,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
...
@@ -421,7 +418,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
tvItem
.
mask
=
TVIF_CHILDREN
;
tvItem
.
mask
=
TVIF_CHILDREN
;
tvItem
.
hItem
=
hItem
;
tvItem
.
hItem
=
hItem
;
tvItem
.
cChildren
=
dwCount
;
tvItem
.
cChildren
=
dwCount
;
if
(
!
TreeView_SetItem
(
hwndTV
,
&
tvItem
))
{
if
(
!
TreeView_SetItem
W
(
hwndTV
,
&
tvItem
))
{
return
FALSE
;
return
FALSE
;
}
}
...
@@ -436,7 +433,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
...
@@ -436,7 +433,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
return
FALSE
;
return
FALSE
;
}
}
tvItem
.
cchTextMax
=
dwMaxSubKeyLen
;
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
;
return
FALSE
;
}
}
...
@@ -444,7 +441,6 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
...
@@ -444,7 +441,6 @@ 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
(
RegEnumKeyExW
(
hKey
,
dwIndex
,
Name
,
&
cName
,
0
,
0
,
0
,
NULL
)
!=
ERROR_SUCCESS
)
{
if
(
RegEnumKeyExW
(
hKey
,
dwIndex
,
Name
,
&
cName
,
0
,
0
,
0
,
NULL
)
!=
ERROR_SUCCESS
)
{
...
@@ -460,27 +456,23 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
...
@@ -460,27 +456,23 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
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_GetItemW
(
hwndTV
,
&
tvItem
))
{
HeapFree
(
GetProcessHeap
(),
0
,
NameA
);
return
FALSE
;
return
FALSE
;
}
}
if
(
!
stricmp
(
tvItem
.
pszText
,
NameA
))
{
if
(
!
lstrcmpiW
(
tvItem
.
pszText
,
Name
))
{
found
=
TRUE
;
found
=
TRUE
;
HeapFree
(
GetProcessHeap
(),
0
,
NameA
);
break
;
break
;
}
}
}
}
if
(
found
==
FALSE
)
{
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
);
AddEntryToTree
(
hwndTV
,
hItem
,
Name
,
NULL
,
dwSubCount
);
}
}
}
}
...
@@ -493,7 +485,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
...
@@ -493,7 +485,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem)
while
(
childItem
)
{
while
(
childItem
)
{
HTREEITEM
nextItem
=
TreeView_GetNextSibling
(
hwndTV
,
childItem
);
HTREEITEM
nextItem
=
TreeView_GetNextSibling
(
hwndTV
,
childItem
);
if
(
RefreshTreeItem
(
hwndTV
,
childItem
)
==
FALSE
)
{
if
(
RefreshTreeItem
(
hwndTV
,
childItem
)
==
FALSE
)
{
SendMessage
(
hwndTV
,
TVM_DELETEITEM
,
0
,
(
LPARAM
)
childItem
);
SendMessage
W
(
hwndTV
,
TVM_DELETEITEM
,
0
,
(
LPARAM
)
childItem
);
}
}
childItem
=
nextItem
;
childItem
=
nextItem
;
}
}
...
@@ -529,9 +521,9 @@ BOOL RefreshTreeView(HWND hwndTV)
...
@@ -529,9 +521,9 @@ BOOL RefreshTreeView(HWND hwndTV)
HTREEITEM
InsertNode
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPWSTR
name
)
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
;
HTREEITEM
hNewItem
=
0
;
TVITEMEX
item
;
TVITEMEX
W
item
;
if
(
!
hItem
)
hItem
=
TreeView_GetSelection
(
hwndTV
);
if
(
!
hItem
)
hItem
=
TreeView_GetSelection
(
hwndTV
);
if
(
!
hItem
)
return
FALSE
;
if
(
!
hItem
)
return
FALSE
;
...
@@ -540,22 +532,20 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
...
@@ -540,22 +532,20 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name)
}
else
{
}
else
{
item
.
mask
=
TVIF_CHILDREN
|
TVIF_HANDLE
;
item
.
mask
=
TVIF_CHILDREN
|
TVIF_HANDLE
;
item
.
hItem
=
hItem
;
item
.
hItem
=
hItem
;
if
(
!
TreeView_GetItem
(
hwndTV
,
&
item
))
return
FALSE
;
if
(
!
TreeView_GetItem
W
(
hwndTV
,
&
item
))
return
FALSE
;
item
.
cChildren
=
1
;
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
);
SendMessageW
(
hwndTV
,
TVM_EXPAND
,
TVE_EXPAND
,
(
LPARAM
)
hItem
);
if
(
!
hNewItem
)
{
if
(
!
hNewItem
)
{
char
*
nameA
=
GetMultiByteString
(
name
);
for
(
hNewItem
=
TreeView_GetChild
(
hwndTV
,
hItem
);
hNewItem
;
hNewItem
=
TreeView_GetNextSibling
(
hwndTV
,
hNewItem
))
{
for
(
hNewItem
=
TreeView_GetChild
(
hwndTV
,
hItem
);
hNewItem
;
hNewItem
=
TreeView_GetNextSibling
(
hwndTV
,
hNewItem
))
{
item
.
mask
=
TVIF_HANDLE
|
TVIF_TEXT
;
item
.
mask
=
TVIF_HANDLE
|
TVIF_TEXT
;
item
.
hItem
=
hNewItem
;
item
.
hItem
=
hNewItem
;
item
.
pszText
=
buf
;
item
.
pszText
=
buf
;
item
.
cchTextMax
=
COUNT_OF
(
buf
);
item
.
cchTextMax
=
COUNT_OF
(
buf
);
if
(
!
TreeView_GetItem
(
hwndTV
,
&
item
))
continue
;
if
(
!
TreeView_GetItem
W
(
hwndTV
,
&
item
))
continue
;
if
(
lstrcmp
(
nameA
,
item
.
pszText
)
==
0
)
break
;
if
(
lstrcmp
W
(
name
,
item
.
pszText
)
==
0
)
break
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
}
}
if
(
hNewItem
)
if
(
hNewItem
)
SendMessageW
(
hwndTV
,
TVM_SELECTITEM
,
TVGN_CARET
,
(
LPARAM
)
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