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
4aabdecd
Commit
4aabdecd
authored
Aug 27, 2008
by
Alexander Nicolaysen Sørnes
Committed by
Alexandre Julliard
Aug 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Use Unicode strings when updating listview.
parent
f7ff9e76
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
34 deletions
+70
-34
childwnd.c
programs/regedit/childwnd.c
+3
-2
framewnd.c
programs/regedit/framewnd.c
+22
-10
listview.c
programs/regedit/listview.c
+43
-20
main.h
programs/regedit/main.h
+2
-2
No files found.
programs/regedit/childwnd.c
View file @
4aabdecd
...
...
@@ -233,10 +233,11 @@ static LPTSTR GetPathFullPath(HWND hwndTV, LPTSTR path) {
static
void
OnTreeSelectionChanged
(
HWND
hwndTV
,
HWND
hwndLV
,
HTREEITEM
hItem
,
BOOL
bRefreshLV
)
{
if
(
bRefreshLV
)
{
LP
CT
STR
keyPath
;
LP
W
STR
keyPath
;
HKEY
hRootKey
=
NULL
;
keyPath
=
GetItemPath
(
hwndTV
,
hItem
,
&
hRootKey
);
keyPath
=
GetItemPath
W
(
hwndTV
,
hItem
,
&
hRootKey
);
RefreshListView
(
hwndLV
,
hRootKey
,
keyPath
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPath
);
}
UpdateStatusBar
();
}
...
...
programs/regedit/framewnd.c
View file @
4aabdecd
...
...
@@ -691,10 +691,10 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
}
else
if
(
GetFocus
()
==
g_pChildWnd
->
hListWnd
)
{
WCHAR
*
keyPathW
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
curIndex
=
ListView_GetNextItem
(
g_pChildWnd
->
hListWnd
,
-
1
,
LVNI_SELECTED
);
while
(
curIndex
!=
-
1
)
{
WCHAR
*
valueNameW
;
WCHAR
*
keyPathW
;
valueName
=
GetItemText
(
g_pChildWnd
->
hListWnd
,
curIndex
);
curIndex
=
ListView_GetNextItem
(
g_pChildWnd
->
hListWnd
,
curIndex
,
LVNI_SELECTED
);
...
...
@@ -705,25 +705,29 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break
;
}
valueNameW
=
GetWideString
(
valueName
);
keyPathW
=
GetWideString
(
keyPath
);
if
(
!
DeleteValue
(
hWnd
,
hKeyRoot
,
keyPathW
,
valueNameW
,
curIndex
==-
1
&&
firstItem
))
{
HeapFree
(
GetProcessHeap
(),
0
,
valueNameW
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
break
;
}
firstItem
=
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
valueNameW
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
}
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
,
NULL
);
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPathW
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
}
break
;
case
ID_EDIT_MODIFY
:
valueName
=
GetValueName
(
g_pChildWnd
->
hListWnd
);
if
(
ModifyValue
(
hWnd
,
hKeyRoot
,
keyPath
,
valueName
))
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
,
valueName
);
{
LPCWSTR
valueNameW
=
GetValueName
(
g_pChildWnd
->
hListWnd
);
CHAR
*
valueNameA
=
GetMultiByteString
(
valueNameW
);
WCHAR
*
keyPathW
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
if
(
ModifyValue
(
hWnd
,
hKeyRoot
,
keyPath
,
valueNameA
))
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPathW
,
valueNameW
);
HeapFree
(
GetProcessHeap
(),
0
,
valueNameA
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
break
;
}
case
ID_EDIT_FIND
:
case
ID_EDIT_FINDNEXT
:
{
...
...
@@ -792,7 +796,11 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
/* fall through */
create_value:
if
(
CreateValue
(
hWnd
,
hKeyRoot
,
keyPath
,
valueType
,
newKey
))
{
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
,
newKey
);
WCHAR
*
keyPathW
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
WCHAR
*
newKeyW
=
GetWideString
(
newKey
);
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPathW
,
newKeyW
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
HeapFree
(
GetProcessHeap
(),
0
,
newKeyW
);
StartValueRename
(
g_pChildWnd
->
hListWnd
);
/* FIXME: start rename */
}
...
...
@@ -847,8 +855,12 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break
;
}
case
ID_VIEW_REFRESH
:
{
WCHAR
*
keyPathW
=
GetItemPathW
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
RefreshTreeView
(
g_pChildWnd
->
hTreeWnd
);
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
,
NULL
);
RefreshListView
(
g_pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPathW
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
}
break
;
/*case ID_OPTIONS_TOOLBAR:*/
/* toggle_child(hWnd, LOWORD(wParam), hToolBar);*/
...
...
programs/regedit/listview.c
View file @
4aabdecd
...
...
@@ -46,8 +46,8 @@ typedef struct tagLINE_INFO
static
WNDPROC
g_orgListWndProc
;
static
DWORD
g_columnToSort
=
~
0U
;
static
BOOL
g_invertSort
=
FALSE
;
static
LP
T
STR
g_valueName
;
static
LP
T
STR
g_currentPath
;
static
LP
W
STR
g_valueName
;
static
LP
W
STR
g_currentPath
;
static
HKEY
g_currentRootKey
;
static
WCHAR
g_szValueNotSetW
[
64
];
static
TCHAR
g_szValueNotSet
[
64
];
...
...
@@ -79,18 +79,41 @@ LPTSTR GetItemText(HWND hwndLV, UINT item)
return
NULL
;
}
LPCTSTR
GetValueName
(
HWND
hwndLV
)
LPWSTR
GetItemTextW
(
HWND
hwndLV
,
UINT
item
)
{
LPWSTR
newStr
,
curStr
;
unsigned
int
maxLen
=
128
;
curStr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
maxLen
*
sizeof
(
WCHAR
));
if
(
!
curStr
)
return
NULL
;
if
(
item
==
0
)
{
/* first item is ALWAYS a default */
HeapFree
(
GetProcessHeap
(),
0
,
curStr
);
return
NULL
;
}
do
{
ListView_GetItemTextW
(
hwndLV
,
item
,
0
,
curStr
,
maxLen
*
sizeof
(
WCHAR
));
if
(
lstrlenW
(
curStr
)
<
maxLen
-
1
)
return
curStr
;
newStr
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
curStr
,
maxLen
*
2
*
sizeof
(
WCHAR
));
if
(
!
newStr
)
break
;
curStr
=
newStr
;
maxLen
*=
2
;
}
while
(
TRUE
);
HeapFree
(
GetProcessHeap
(),
0
,
curStr
);
return
NULL
;
}
LPCWSTR
GetValueName
(
HWND
hwndLV
)
{
INT
item
;
if
(
g_valueName
!=
LPSTR_TEXTCALLBACK
)
if
(
g_valueName
!=
LPSTR_TEXTCALLBACK
W
)
HeapFree
(
GetProcessHeap
(),
0
,
g_valueName
);
g_valueName
=
NULL
;
item
=
ListView_GetNextItem
(
hwndLV
,
-
1
,
LVNI_FOCUSED
);
if
(
item
==
-
1
)
return
NULL
;
g_valueName
=
GetItemText
(
hwndLV
,
item
);
g_valueName
=
GetItemText
W
(
hwndLV
,
item
);
return
g_valueName
;
}
...
...
@@ -400,11 +423,18 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
case
LVN_ENDLABELEDIT
:
{
LPNMLVDISPINFO
dispInfo
=
(
LPNMLVDISPINFO
)
lParam
;
LPTSTR
valueName
=
GetItemText
(
hWnd
,
dispInfo
->
item
.
iItem
);
LPSTR
pathA
;
LONG
ret
;
if
(
!
valueName
)
return
-
1
;
/* cannot rename a default value */
ret
=
RenameValue
(
hWnd
,
g_currentRootKey
,
g_currentPath
,
valueName
,
dispInfo
->
item
.
pszText
);
pathA
=
GetMultiByteString
(
g_currentPath
);
ret
=
RenameValue
(
hWnd
,
g_currentRootKey
,
pathA
,
valueName
,
dispInfo
->
item
.
pszText
);
HeapFree
(
GetProcessHeap
(),
0
,
pathA
);
if
(
ret
)
RefreshListView
(
hWnd
,
g_currentRootKey
,
g_currentPath
,
dispInfo
->
item
.
pszText
);
{
WCHAR
*
itemTextW
=
GetWideString
(
dispInfo
->
item
.
pszText
);
RefreshListView
(
hWnd
,
g_currentRootKey
,
g_currentPath
,
itemTextW
);
HeapFree
(
GetProcessHeap
(),
0
,
itemTextW
);
}
HeapFree
(
GetProcessHeap
(),
0
,
valueName
);
return
0
;
}
...
...
@@ -490,7 +520,7 @@ fail:
return
NULL
;
}
BOOL
RefreshListView
(
HWND
hwndLV
,
HKEY
hKeyRoot
,
LPC
TSTR
keyPath
,
LPCT
STR
highlightValue
)
BOOL
RefreshListView
(
HWND
hwndLV
,
HKEY
hKeyRoot
,
LPC
WSTR
keyPath
,
LPCW
STR
highlightValue
)
{
BOOL
result
=
FALSE
;
DWORD
max_sub_key_len
;
...
...
@@ -503,17 +533,12 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR highli
LONG
errCode
;
INT
count
,
i
;
LVITEMW
item
;
WCHAR
*
keyPathW
;
WCHAR
*
highlightValueW
;
if
(
!
hwndLV
)
return
FALSE
;
SendMessageW
(
hwndLV
,
WM_SETREDRAW
,
FALSE
,
0
);
keyPathW
=
GetWideString
(
keyPath
);
highlightValueW
=
GetWideString
(
highlightValue
);
errCode
=
RegOpenKeyExW
(
hKeyRoot
,
keyPathW
,
0
,
KEY_READ
,
&
hKey
);
errCode
=
RegOpenKeyExW
(
hKeyRoot
,
keyPath
,
0
,
KEY_READ
,
&
hKey
);
if
(
errCode
!=
ERROR_SUCCESS
)
goto
done
;
count
=
ListView_GetItemCount
(
hwndLV
);
...
...
@@ -542,14 +567,14 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR highli
AddEntryToList
(
hwndLV
,
NULL
,
REG_SZ
,
NULL
,
0
,
!
highlightValue
);
}
for
(
index
=
0
;
index
<
val_count
;
index
++
)
{
BOOL
bSelected
=
(
valName
==
highlightValue
W
);
/* NOT a bug, we check for double NULL here */
BOOL
bSelected
=
(
valName
==
highlightValue
);
/* NOT a bug, we check for double NULL here */
valNameLen
=
max_val_name_len
;
valSize
=
max_val_size
;
valType
=
0
;
errCode
=
RegEnumValueW
(
hKey
,
index
,
valName
,
&
valNameLen
,
NULL
,
&
valType
,
valBuf
,
&
valSize
);
if
(
errCode
!=
ERROR_SUCCESS
)
goto
done
;
valBuf
[
valSize
]
=
0
;
if
(
valName
&&
highlightValue
W
&&
!
lstrcmpW
(
valName
,
highlightValueW
))
if
(
valName
&&
highlightValue
&&
!
lstrcmpW
(
valName
,
highlightValue
))
bSelected
=
TRUE
;
AddEntryToList
(
hwndLV
,
valName
[
0
]
?
valName
:
NULL
,
valType
,
valBuf
,
valSize
,
bSelected
);
}
...
...
@@ -558,9 +583,9 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR highli
g_currentRootKey
=
hKeyRoot
;
if
(
keyPath
!=
g_currentPath
)
{
HeapFree
(
GetProcessHeap
(),
0
,
g_currentPath
);
g_currentPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlen
(
keyPath
)
+
1
)
*
sizeof
(
T
CHAR
));
g_currentPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlen
W
(
keyPath
)
+
1
)
*
sizeof
(
W
CHAR
));
if
(
!
g_currentPath
)
goto
done
;
lstrcpy
(
g_currentPath
,
keyPath
);
lstrcpy
W
(
g_currentPath
,
keyPath
);
}
result
=
TRUE
;
...
...
@@ -568,8 +593,6 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCTSTR keyPath, LPCTSTR highli
done:
HeapFree
(
GetProcessHeap
(),
0
,
valBuf
);
HeapFree
(
GetProcessHeap
(),
0
,
valName
);
HeapFree
(
GetProcessHeap
(),
0
,
keyPathW
);
HeapFree
(
GetProcessHeap
(),
0
,
highlightValueW
);
SendMessageW
(
hwndLV
,
WM_SETREDRAW
,
TRUE
,
0
);
if
(
hKey
)
RegCloseKey
(
hKey
);
...
...
programs/regedit/main.h
View file @
4aabdecd
...
...
@@ -120,10 +120,10 @@ extern void UpdateStatusBar(void);
/* listview.c */
extern
HWND
CreateListView
(
HWND
hwndParent
,
UINT
id
);
extern
BOOL
RefreshListView
(
HWND
hwndLV
,
HKEY
hKeyRoot
,
LPC
TSTR
keyPath
,
LPCT
STR
highlightValue
);
extern
BOOL
RefreshListView
(
HWND
hwndLV
,
HKEY
hKeyRoot
,
LPC
WSTR
keyPath
,
LPCW
STR
highlightValue
);
extern
HWND
StartValueRename
(
HWND
hwndLV
);
extern
LPTSTR
GetItemText
(
HWND
hwndLV
,
UINT
item
);
extern
LPC
T
STR
GetValueName
(
HWND
hwndLV
);
extern
LPC
W
STR
GetValueName
(
HWND
hwndLV
);
extern
BOOL
ListWndNotifyProc
(
HWND
hWnd
,
WPARAM
wParam
,
LPARAM
lParam
,
BOOL
*
Result
);
extern
BOOL
IsDefaultValue
(
HWND
hwndLV
,
int
i
);
...
...
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