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
94ce2445
Commit
94ce2445
authored
Jan 10, 2005
by
Crestez Leonard
Committed by
Alexandre Julliard
Jan 10, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement Refresh.
Fix bug with all HKEY_ roots always showing expandable.
parent
8be26da7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
154 additions
and
24 deletions
+154
-24
childwnd.c
programs/regedit/childwnd.c
+1
-0
edit.c
programs/regedit/edit.c
+3
-0
framewnd.c
programs/regedit/framewnd.c
+2
-13
main.h
programs/regedit/main.h
+1
-0
treeview.c
programs/regedit/treeview.c
+147
-11
No files found.
programs/regedit/childwnd.c
View file @
94ce2445
...
...
@@ -100,6 +100,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
DestroyWindow
(
hWnd
);
break
;
case
ID_VIEW_REFRESH
:
WINE_TRACE
(
"Is this ever called or is it just dead code?
\n
"
);
/* TODO */
break
;
case
ID_SWITCH_PANELS
:
...
...
programs/regedit/edit.c
View file @
94ce2445
...
...
@@ -374,6 +374,9 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCTSTR keyPath, LPCTSTR newName)
if
(
lRet
!=
ERROR_SUCCESS
)
goto
done
;
}
/* The following fails if the old name is the same as the new name. */
if
(
!
strcmp
(
srcSubKey
,
newName
))
goto
done
;
lRet
=
RegCreateKey
(
parentKey
,
newName
,
&
destKey
);
if
(
lRet
!=
ERROR_SUCCESS
)
goto
done
;
...
...
programs/regedit/framewnd.c
View file @
94ce2445
...
...
@@ -414,18 +414,6 @@ BOOL CopyKeyName(HWND hWnd, LPTSTR keyName)
return
result
;
}
BOOL
RefreshView
(
HWND
hWnd
)
{
/* TODO:*/
MessageBeep
(
-
1
);
MessageBeep
(
MB_ICONASTERISK
);
MessageBeep
(
MB_ICONEXCLAMATION
);
MessageBeep
(
MB_ICONHAND
);
MessageBeep
(
MB_ICONQUESTION
);
MessageBeep
(
MB_OK
);
return
TRUE
;
}
/*******************************************************************************
*
* FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
...
...
@@ -521,7 +509,8 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
DestroyWindow
(
hWnd
);
break
;
case
ID_VIEW_REFRESH
:
RefreshView
(
hWnd
);
RefreshTreeView
(
g_pChildWnd
->
hTreeWnd
);
/*RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL); */
break
;
/*case ID_OPTIONS_TOOLBAR:*/
/* toggle_child(hWnd, LOWORD(wParam), hToolBar);*/
...
...
programs/regedit/main.h
View file @
94ce2445
...
...
@@ -101,6 +101,7 @@ extern BOOL IsDefaultValue(HWND hwndLV, int i);
/* treeview.c */
extern
HWND
CreateTreeView
(
HWND
hwndParent
,
LPTSTR
pHostName
,
int
id
);
extern
BOOL
RefreshTreeView
(
HWND
hWndTV
);
extern
BOOL
OnTreeExpanding
(
HWND
hWnd
,
NMTREEVIEW
*
pnmtv
);
extern
LPCTSTR
GetItemPath
(
HWND
hwndTV
,
HTREEITEM
hItem
,
HKEY
*
phRootKey
);
extern
BOOL
DeleteNode
(
HWND
hwndTV
,
HTREEITEM
hItem
);
...
...
programs/regedit/treeview.c
View file @
94ce2445
...
...
@@ -28,9 +28,12 @@
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#include <wine/debug.h>
#include "main.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
regedit
);
/* Global variables and constants */
/* Image_Open, Image_Closed, and Image_Root - integer variables for indexes of the images. */
/* CX_BITMAP and CY_BITMAP - width and height of an icon. */
...
...
@@ -109,11 +112,18 @@ BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem)
return
TreeView_DeleteItem
(
hwndTV
,
hItem
);
}
/* Add an entry to the tree. Only give hKey for root nodes (HKEY_ constants) */
static
HTREEITEM
AddEntryToTree
(
HWND
hwndTV
,
HTREEITEM
hParent
,
LPTSTR
label
,
HKEY
hKey
,
DWORD
dwChildren
)
{
TVITEM
tvi
;
TVINSERTSTRUCT
tvins
;
if
(
hKey
)
{
if
(
RegQueryInfoKey
(
hKey
,
0
,
0
,
0
,
&
dwChildren
,
0
,
0
,
0
,
0
,
0
,
0
,
0
)
!=
ERROR_SUCCESS
)
{
dwChildren
=
0
;
}
}
tvi
.
mask
=
TVIF_TEXT
|
TVIF_IMAGE
|
TVIF_SELECTEDIMAGE
|
TVIF_CHILDREN
|
TVIF_PARAM
;
tvi
.
pszText
=
label
;
tvi
.
cchTextMax
=
lstrlen
(
tvi
.
pszText
);
...
...
@@ -127,6 +137,133 @@ static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, HK
return
TreeView_InsertItem
(
hwndTV
,
&
tvins
);
}
BOOL
RefreshTreeItem
(
HWND
hwndTV
,
HTREEITEM
hItem
)
{
HKEY
hRoot
,
hKey
,
hSubKey
;
HTREEITEM
childItem
;
LPCTSTR
KeyPath
;
DWORD
dwCount
,
dwIndex
,
dwMaxSubKeyLen
;
LPSTR
Name
;
TVITEM
tvItem
;
KeyPath
=
GetItemPath
(
hwndTV
,
hItem
,
&
hRoot
);
if
(
*
KeyPath
)
{
if
(
RegOpenKeyEx
(
hRoot
,
KeyPath
,
0
,
KEY_READ
,
&
hKey
)
!=
ERROR_SUCCESS
)
{
WINE_TRACE
(
"RegOpenKeyEx failed,
\"
%s
\"
was probably removed.
\n
"
,
KeyPath
);
return
FALSE
;
}
}
else
{
hKey
=
hRoot
;
}
if
(
RegQueryInfoKey
(
hKey
,
0
,
0
,
0
,
&
dwCount
,
&
dwMaxSubKeyLen
,
0
,
0
,
0
,
0
,
0
,
0
)
!=
ERROR_SUCCESS
)
{
return
FALSE
;
}
/* Set the number of children again */
tvItem
.
mask
=
TVIF_CHILDREN
;
tvItem
.
hItem
=
hItem
;
tvItem
.
cChildren
=
dwCount
;
if
(
!
TreeView_SetItem
(
hwndTV
,
&
tvItem
))
{
return
FALSE
;
}
/* We don't have to bother with the rest if it's not expanded. */
if
(
TreeView_GetItemState
(
hwndTV
,
hItem
,
TVIS_EXPANDED
)
==
0
)
{
RegCloseKey
(
hKey
);
return
TRUE
;
}
dwMaxSubKeyLen
++
;
/* account for the \0 terminator */
if
(
!
(
Name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxSubKeyLen
*
sizeof
(
TCHAR
))))
{
return
FALSE
;
}
tvItem
.
cchTextMax
=
dwMaxSubKeyLen
;
if
(
!
(
tvItem
.
pszText
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxSubKeyLen
*
sizeof
(
TCHAR
))))
{
return
FALSE
;
}
/* Now go through all the children in the registry, and check if any have to be added. */
for
(
dwIndex
=
0
;
dwIndex
<
dwCount
;
dwIndex
++
)
{
DWORD
cName
=
dwMaxSubKeyLen
,
dwSubCount
;
BOOL
found
;
found
=
FALSE
;
if
(
RegEnumKeyEx
(
hKey
,
dwIndex
,
Name
,
&
cName
,
0
,
0
,
0
,
NULL
)
!=
ERROR_SUCCESS
)
{
continue
;
}
/* Find the number of children of the node. */
dwSubCount
=
0
;
if
(
RegOpenKeyEx
(
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
)
{
dwSubCount
=
0
;
}
RegCloseKey
(
hSubKey
);
}
/* 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
))
{
return
FALSE
;
}
if
(
!
strcmp
(
tvItem
.
pszText
,
Name
))
{
found
=
TRUE
;
break
;
}
}
if
(
found
==
FALSE
)
{
WINE_TRACE
(
"New subkey %s
\n
"
,
Name
);
AddEntryToTree
(
hwndTV
,
hItem
,
Name
,
NULL
,
dwSubCount
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
Name
);
HeapFree
(
GetProcessHeap
(),
0
,
tvItem
.
pszText
);
RegCloseKey
(
hKey
);
/* Now go through all the children in the tree, and check if any have to be removed. */
childItem
=
TreeView_GetChild
(
hwndTV
,
hItem
);
while
(
childItem
)
{
HTREEITEM
nextItem
=
TreeView_GetNextSibling
(
hwndTV
,
childItem
);
if
(
RefreshTreeItem
(
hwndTV
,
childItem
)
==
FALSE
)
{
TreeView_DeleteItem
(
hwndTV
,
childItem
);
}
childItem
=
nextItem
;
}
return
TRUE
;
}
BOOL
RefreshTreeView
(
HWND
hwndTV
)
{
HTREEITEM
hItem
;
HTREEITEM
hSelectedItem
;
HCURSOR
hcursorOld
;
WINE_TRACE
(
"
\n
"
);
hSelectedItem
=
TreeView_GetSelection
(
hwndTV
);
hcursorOld
=
SetCursor
(
LoadCursor
(
NULL
,
IDC_WAIT
));
SendMessage
(
hwndTV
,
WM_SETREDRAW
,
FALSE
,
0
);
hItem
=
TreeView_GetChild
(
hwndTV
,
TreeView_GetRoot
(
hwndTV
));
while
(
hItem
)
{
RefreshTreeItem
(
hwndTV
,
hItem
);
hItem
=
TreeView_GetNextSibling
(
hwndTV
,
hItem
);
}
SendMessage
(
hwndTV
,
WM_SETREDRAW
,
TRUE
,
0
);
SetCursor
(
hcursorOld
);
/* We reselect the currently selected node, this will prompt a refresh of the listview. */
TreeView_SelectItem
(
hwndTV
,
hSelectedItem
);
return
TRUE
;
}
HTREEITEM
InsertNode
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPTSTR
name
)
{
...
...
@@ -278,17 +415,16 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
if
(
!
Name
)
goto
done
;
for
(
dwIndex
=
0
;
dwIndex
<
dwCount
;
dwIndex
++
)
{
DWORD
cName
=
dwMaxSubKeyLen
,
dwSubCount
;
FILETIME
LastWriteTime
;
errCode
=
RegEnumKeyEx
(
hNewKey
,
dwIndex
,
Name
,
&
cName
,
0
,
0
,
0
,
&
LastWriteTime
);
if
(
errCode
!=
ERROR_SUCCESS
)
continue
;
errCode
=
RegOpenKeyEx
(
hNewKey
,
Name
,
0
,
KEY_QUERY_VALUE
,
&
hKey
);
if
(
errCode
==
ERROR_SUCCESS
)
{
errCode
=
RegQueryInfoKey
(
hKey
,
0
,
0
,
0
,
&
dwSubCount
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
RegCloseKey
(
hKey
);
}
if
(
errCode
!=
ERROR_SUCCESS
)
dwSubCount
=
0
;
DWORD
cName
=
dwMaxSubKeyLen
,
dwSubCount
;
errCode
=
RegEnumKeyEx
(
hNewKey
,
dwIndex
,
Name
,
&
cName
,
0
,
0
,
0
,
0
);
if
(
errCode
!=
ERROR_SUCCESS
)
continue
;
errCode
=
RegOpenKeyEx
(
hNewKey
,
Name
,
0
,
KEY_QUERY_VALUE
,
&
hKey
);
if
(
errCode
==
ERROR_SUCCESS
)
{
errCode
=
RegQueryInfoKey
(
hKey
,
0
,
0
,
0
,
&
dwSubCount
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
RegCloseKey
(
hKey
);
}
if
(
errCode
!=
ERROR_SUCCESS
)
dwSubCount
=
0
;
AddEntryToTree
(
hwndTV
,
pnmtv
->
itemNew
.
hItem
,
Name
,
NULL
,
dwSubCount
);
}
RegCloseKey
(
hNewKey
);
...
...
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