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
16614538
Commit
16614538
authored
Dec 12, 2003
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Dec 12, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove most string size limitations.
Better error handling. Less listview flicker. A bunch of style fixes and improvements.
parent
bd13ab8d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
211 additions
and
203 deletions
+211
-203
about.c
programs/regedit/about.c
+2
-6
childwnd.c
programs/regedit/childwnd.c
+30
-34
edit.c
programs/regedit/edit.c
+2
-2
framewnd.c
programs/regedit/framewnd.c
+14
-34
listview.c
programs/regedit/listview.c
+60
-42
main.c
programs/regedit/main.c
+1
-0
main.h
programs/regedit/main.h
+7
-6
treeview.c
programs/regedit/treeview.c
+95
-79
No files found.
programs/regedit/about.c
View file @
16614538
...
...
@@ -28,18 +28,14 @@
#include "main.h"
extern
HINSTANCE
hInst
;
static
INT_PTR
CALLBACK
AboutDialogWndProc
(
HWND
hDlg
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
HWND
hLicenseEditWnd
;
TCHAR
strLicense
[
0x1000
];
switch
(
message
)
{
case
WM_INITDIALOG
:
hLicenseEditWnd
=
GetDlgItem
(
hDlg
,
IDC_LICENSE_EDIT
);
LoadString
(
hInst
,
IDS_LICENSE
,
strLicense
,
0x1000
);
SetWindowText
(
hLicenseEditWnd
,
strLicense
);
LoadString
(
hInst
,
IDS_LICENSE
,
strLicense
,
COUNT_OF
(
strLicense
));
SetDlgItemText
(
hDlg
,
IDC_LICENSE_EDIT
,
strLicense
);
return
TRUE
;
case
WM_COMMAND
:
if
((
LOWORD
(
wParam
)
==
IDOK
)
||
(
LOWORD
(
wParam
)
==
IDCANCEL
))
{
...
...
programs/regedit/childwnd.c
View file @
16614538
...
...
@@ -20,38 +20,26 @@
#define WIN32_LEAN_AND_MEAN
/* Exclude rarely-used stuff from Windows headers */
#include <windows.h>
#include <tchar.h>
#include <commctrl.h>
#include <tchar.h>
#include <stdio.h>
#include "main.h"
ChildWnd
*
pChildWnd
;
ChildWnd
*
g_
pChildWnd
;
/*******************************************************************************
* Local module support methods
*/
/*FIXME: why do we need this, we should remove it, we have already FindRegRoot */
static
void
MakeFullRegPath
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPTSTR
keyPath
,
int
*
pPathLen
,
int
max
)
static
LPCTSTR
get_root_key_name
(
HKEY
hRootKey
)
{
TVITEM
item
;
item
.
mask
=
TVIF_PARAM
;
item
.
hItem
=
hItem
;
if
(
TreeView_GetItem
(
hwndTV
,
&
item
))
{
if
(
item
.
hItem
!=
TreeView_GetRoot
(
hwndTV
))
{
/* recurse */
MakeFullRegPath
(
hwndTV
,
TreeView_GetParent
(
hwndTV
,
hItem
),
keyPath
,
pPathLen
,
max
);
keyPath
[
*
pPathLen
]
=
_T
(
'\\'
);
++
(
*
pPathLen
);
}
item
.
mask
=
TVIF_TEXT
;
item
.
hItem
=
hItem
;
item
.
pszText
=
&
keyPath
[
*
pPathLen
];
item
.
cchTextMax
=
max
-
*
pPathLen
;
if
(
TreeView_GetItem
(
hwndTV
,
&
item
))
{
*
pPathLen
+=
_tcslen
(
item
.
pszText
);
}
}
if
(
hRootKey
==
HKEY_CLASSES_ROOT
)
return
_T
(
"HKEY_CLASSES_ROOT"
);
if
(
hRootKey
==
HKEY_CURRENT_USER
)
return
_T
(
"HKEY_CURRENT_USER"
);
if
(
hRootKey
==
HKEY_LOCAL_MACHINE
)
return
_T
(
"HKEY_LOCAL_MACHINE"
);
if
(
hRootKey
==
HKEY_USERS
)
return
_T
(
"HKEY_USERS"
);
if
(
hRootKey
==
HKEY_CURRENT_CONFIG
)
return
_T
(
"HKEY_CURRENT_CONFIG"
);
return
_T
(
"UKNOWN HKEY, PLEASE REPORT"
);
}
static
void
draw_splitbar
(
HWND
hWnd
,
int
x
)
...
...
@@ -127,13 +115,15 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT
CALLBACK
ChildWndProc
(
HWND
hWnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
static
int
last_split
;
/* ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA); */
ChildWnd
*
pChildWnd
=
g_pChildWnd
;
switch
(
message
)
{
case
WM_CREATE
:
pChildWnd
=
(
ChildWnd
*
)((
LPCREATESTRUCT
)
lParam
)
->
lpCreateParams
;
g_pChildWnd
=
pChildWnd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ChildWnd
))
;
if
(
!
pChildWnd
)
return
0
;
_tcsncpy
(
pChildWnd
->
szPath
,
_T
(
"My Computer"
),
MAX_PATH
);
pChildWnd
->
nSplitPos
=
250
;
pChildWnd
->
hWnd
=
hWnd
;
pChildWnd
->
hTreeWnd
=
CreateTreeView
(
hWnd
,
pChildWnd
->
szPath
,
TREE_WINDOW
);
pChildWnd
->
hListWnd
=
CreateListView
(
hWnd
,
LIST_WINDOW
/*, pChildWnd->szPath*/
);
break
;
...
...
@@ -157,6 +147,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
}
goto
def
;
case
WM_DESTROY
:
HeapFree
(
GetProcessHeap
(),
0
,
pChildWnd
);
pChildWnd
=
NULL
;
PostQuitMessage
(
0
);
break
;
case
WM_LBUTTONDOWN
:
{
...
...
@@ -234,17 +226,21 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
case
TVN_ITEMEXPANDING
:
return
!
OnTreeExpanding
(
pChildWnd
->
hTreeWnd
,
(
NMTREEVIEW
*
)
lParam
);
case
TVN_SELCHANGED
:
{
HKEY
hKey
;
TCHAR
keyPath
[
1000
];
int
keyPathLen
=
0
;
keyPath
[
0
]
=
_T
(
'\0'
);
hKey
=
FindRegRoot
(
pChildWnd
->
hTreeWnd
,
((
NMTREEVIEW
*
)
lParam
)
->
itemNew
.
hItem
,
keyPath
,
&
keyPathLen
,
sizeof
(
keyPath
)
/
sizeof
(
TCHAR
));
RefreshListView
(
pChildWnd
->
hListWnd
,
hKey
,
keyPath
);
LPCTSTR
keyPath
,
rootName
;
LPTSTR
fullPath
;
HKEY
hRootKey
;
keyPathLen
=
0
;
keyPath
[
0
]
=
_T
(
'\0'
);
MakeFullRegPath
(
pChildWnd
->
hTreeWnd
,
((
NMTREEVIEW
*
)
lParam
)
->
itemNew
.
hItem
,
keyPath
,
&
keyPathLen
,
sizeof
(
keyPath
)
/
sizeof
(
TCHAR
));
SendMessage
(
hStatusBar
,
SB_SETTEXT
,
0
,
(
LPARAM
)
keyPath
);
keyPath
=
GetItemPath
(
pChildWnd
->
hTreeWnd
,
((
NMTREEVIEW
*
)
lParam
)
->
itemNew
.
hItem
,
&
hRootKey
);
if
(
keyPath
)
{
RefreshListView
(
pChildWnd
->
hListWnd
,
hRootKey
,
keyPath
);
rootName
=
get_root_key_name
(
hRootKey
);
fullPath
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlen
(
rootName
)
+
1
+
lstrlen
(
keyPath
)
+
1
)
*
sizeof
(
TCHAR
));
if
(
fullPath
)
{
_stprintf
(
fullPath
,
"%s
\\
%s"
,
rootName
,
keyPath
);
SendMessage
(
hStatusBar
,
SB_SETTEXT
,
0
,
(
LPARAM
)
fullPath
);
HeapFree
(
GetProcessHeap
(),
0
,
fullPath
);
}
}
}
break
;
default:
...
...
programs/regedit/edit.c
View file @
16614538
...
...
@@ -33,7 +33,7 @@
#include "regproc.h"
#include "resource.h"
static
TCHAR
*
editValueName
;
static
const
TCHAR
*
editValueName
;
static
TCHAR
*
stringValueData
;
void
error
(
HWND
hwnd
,
INT
resId
,
...)
...
...
@@ -91,7 +91,7 @@ INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
return
FALSE
;
}
BOOL
ModifyValue
(
HWND
hwnd
,
HKEY
hKey
,
LPTSTR
valueName
)
BOOL
ModifyValue
(
HWND
hwnd
,
HKEY
hKey
,
LP
C
TSTR
valueName
)
{
DWORD
valueDataLen
;
DWORD
type
;
...
...
programs/regedit/framewnd.c
View file @
16614538
...
...
@@ -38,8 +38,6 @@
static
BOOL
bInMenuLoop
=
FALSE
;
/* Tells us if we are in the menu loop */
static
HWND
hChildWnd
;
/*******************************************************************************
* Local module support methods
*/
...
...
@@ -60,7 +58,7 @@ static void resize_frame_rect(HWND hWnd, PRECT prect)
GetClientRect
(
hStatusBar
,
&
rt
);
prect
->
bottom
-=
rt
.
bottom
;
}
MoveWindow
(
hChild
Wnd
,
prect
->
left
,
prect
->
top
,
prect
->
right
,
prect
->
bottom
,
TRUE
);
MoveWindow
(
g_pChildWnd
->
h
Wnd
,
prect
->
left
,
prect
->
top
,
prect
->
right
,
prect
->
bottom
,
TRUE
);
}
void
resize_frame_client
(
HWND
hWnd
)
...
...
@@ -437,21 +435,20 @@ BOOL RefreshView(HWND hWnd)
*/
static
BOOL
_CmdWndProc
(
HWND
hWnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
HKEY
hKeyRoot
,
hKey
;
TCHAR
keyPath
[
1000
]
=
{
0
};
TCHAR
valueName
[
255
]
=
{
0
};
int
keyPathLen
=
0
,
item
;
HKEY
hKeyRoot
=
0
,
hKey
=
0
;
LPCTSTR
keyPath
;
LPCTSTR
valueName
;
BOOL
result
=
TRUE
;
LONG
lRet
;
hKeyRoot
=
FindRegRoot
(
pChildWnd
->
hTreeWnd
,
0
,
keyPath
,
&
keyPathLen
,
sizeof
(
keyPath
)
/
sizeof
(
TCHAR
));
keyPath
=
GetItemPath
(
g_pChildWnd
->
hTreeWnd
,
0
,
&
hKeyRoot
);
valueName
=
GetValueName
(
g_pChildWnd
->
hListWnd
);
if
(
keyPath
)
{
lRet
=
RegOpenKeyEx
(
hKeyRoot
,
keyPath
,
0
,
KEY_READ
,
&
hKey
);
if
(
lRet
!=
ERROR_SUCCESS
)
hKey
=
0
;
item
=
ListView_GetNextItem
(
pChildWnd
->
hListWnd
,
-
1
,
LVNI_FOCUSED
);
if
(
item
!=
-
1
)
ListView_GetItemText
(
pChildWnd
->
hListWnd
,
item
,
0
,
valueName
,
sizeof
(
valueName
)
/
sizeof
(
TCHAR
));
}
switch
(
LOWORD
(
wParam
))
{
/* Parse the menu selections:*/
case
ID_REGISTRY_IMPORTREGISTRYFILE
:
ImportRegistryFile
(
hWnd
);
break
;
...
...
@@ -467,7 +464,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break
;
case
ID_EDIT_MODIFY
:
if
(
ModifyValue
(
hWnd
,
hKey
,
valueName
))
RefreshListView
(
pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
);
RefreshListView
(
g_
pChildWnd
->
hListWnd
,
hKeyRoot
,
keyPath
);
break
;
case
ID_EDIT_COPYKEYNAME
:
CopyKeyName
(
hWnd
,
_T
(
""
));
...
...
@@ -486,22 +483,17 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case
ID_VIEW_REFRESH
:
RefreshView
(
hWnd
);
break
;
/*
case ID_OPTIONS_TOOLBAR:*/
/*
case ID_OPTIONS_TOOLBAR:*/
/* toggle_child(hWnd, LOWORD(wParam), hToolBar);*/
/* break;*/
case
ID_VIEW_STATUSBAR
:
toggle_child
(
hWnd
,
LOWORD
(
wParam
),
hStatusBar
);
break
;
case
ID_HELP_HELPTOPICS
:
/* WinHelp(hWnd, _T("regedit"), HELP_CONTENTS, 0);*/
WinHelp
(
hWnd
,
_T
(
"regedit"
),
HELP_FINDER
,
0
);
break
;
case
ID_HELP_ABOUT
:
#ifdef WINSHELLAPI
/* ShellAbout(hWnd, szTitle, _T(""), LoadIcon(hInst, (LPCTSTR)IDI_REGEDIT));*/
#else
ShowAboutBox
(
hWnd
);
#endif
break
;
default:
result
=
FALSE
;
...
...
@@ -524,23 +516,15 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT
CALLBACK
FrameWndProc
(
HWND
hWnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
static
ChildWnd
*
pChildWnd
=
NULL
;
switch
(
message
)
{
case
WM_CREATE
:
{
pChildWnd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ChildWnd
));
_tcsncpy
(
pChildWnd
->
szPath
,
_T
(
"My Computer"
),
MAX_PATH
);
hChildWnd
=
CreateWindowEx
(
0
,
szChildClass
,
_T
(
"regedit child window"
),
/* WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE|WS_BORDER,*/
WS_CHILD
|
WS_VISIBLE
,
case
WM_CREATE
:
CreateWindowEx
(
0
,
szChildClass
,
_T
(
"regedit child window"
),
WS_CHILD
|
WS_VISIBLE
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
hWnd
,
(
HMENU
)
0
,
hInst
,
pChildWnd
);
}
hWnd
,
(
HMENU
)
0
,
hInst
,
0
);
break
;
case
WM_COMMAND
:
if
(
!
_CmdWndProc
(
hWnd
,
message
,
wParam
,
lParam
))
{
if
(
!
_CmdWndProc
(
hWnd
,
message
,
wParam
,
lParam
))
return
DefWindowProc
(
hWnd
,
message
,
wParam
,
lParam
);
}
break
;
case
WM_SIZE
:
resize_frame_client
(
hWnd
);
...
...
@@ -557,10 +541,6 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
OnMenuSelect
(
hWnd
,
LOWORD
(
wParam
),
HIWORD
(
wParam
),
(
HMENU
)
lParam
);
break
;
case
WM_DESTROY
:
if
(
pChildWnd
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pChildWnd
);
pChildWnd
=
NULL
;
}
WinHelp
(
hWnd
,
_T
(
"regedit"
),
HELP_QUIT
,
0
);
PostQuitMessage
(
0
);
default:
...
...
programs/regedit/listview.c
View file @
16614538
...
...
@@ -19,15 +19,13 @@
*/
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <stdlib.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#include "commctrl.h"
#include <windowsx.h>
#include "main.h"
typedef
struct
tagLINE_INFO
...
...
@@ -45,11 +43,37 @@ typedef struct tagLINE_INFO
static
WNDPROC
g_orgListWndProc
;
static
DWORD
g_columnToSort
=
~
0UL
;
static
BOOL
g_invertSort
=
FALSE
;
static
LPTSTR
g_valueName
;
#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
static
int
default_column_widths
[
MAX_LIST_COLUMNS
]
=
{
200
,
175
,
400
};
static
int
column_alignment
[
MAX_LIST_COLUMNS
]
=
{
LVCFMT_LEFT
,
LVCFMT_LEFT
,
LVCFMT_LEFT
};
LPCTSTR
GetValueName
(
HWND
hwndLV
)
{
int
item
,
len
,
maxLen
;
LPTSTR
newStr
;
if
(
!
g_valueName
)
g_valueName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
1024
);
if
(
!
g_valueName
)
return
NULL
;
*
g_valueName
=
0
;
maxLen
=
HeapSize
(
GetProcessHeap
(),
0
,
g_valueName
);
if
(
maxLen
==
(
SIZE_T
)
-
1
)
return
NULL
;
item
=
ListView_GetNextItem
(
hwndLV
,
-
1
,
LVNI_FOCUSED
);
if
(
item
==
-
1
)
return
NULL
;
do
{
ListView_GetItemText
(
hwndLV
,
item
,
0
,
g_valueName
,
maxLen
);
len
=
_tcslen
(
g_valueName
);
if
(
len
<
maxLen
-
1
)
break
;
newStr
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
g_valueName
,
maxLen
*
2
);
if
(
!
newStr
)
return
NULL
;
g_valueName
=
newStr
;
maxLen
*=
2
;
}
while
(
TRUE
);
return
g_valueName
;
}
/*******************************************************************************
* Local module support methods
...
...
@@ -118,7 +142,7 @@ static void AddEntryToList(HWND hwndLV, LPTSTR Name, DWORD dwValType, void* ValB
}
}
static
void
CreateListColumns
(
HWND
hWndListView
)
static
BOOL
CreateListColumns
(
HWND
hWndListView
)
{
TCHAR
szText
[
50
];
int
index
;
...
...
@@ -134,11 +158,9 @@ static void CreateListColumns(HWND hWndListView)
lvC
.
cx
=
default_column_widths
[
index
];
lvC
.
fmt
=
column_alignment
[
index
];
LoadString
(
hInst
,
IDS_LIST_COLUMN_FIRST
+
index
,
szText
,
sizeof
(
szText
)
/
sizeof
(
TCHAR
));
if
(
ListView_InsertColumn
(
hWndListView
,
index
,
&
lvC
)
==
-
1
)
{
/* TODO: handle failure condition... */
break
;
}
if
(
ListView_InsertColumn
(
hWndListView
,
index
,
&
lvC
)
==
-
1
)
return
FALSE
;
}
return
TRUE
;
}
/* OnGetDispInfo - processes the LVN_GETDISPINFO notification message. */
...
...
@@ -168,9 +190,6 @@ static void OnGetDispInfo(NMLVDISPINFO* plvdi)
case
REG_DWORD
:
plvdi
->
item
.
pszText
=
_T
(
"REG_DWORD"
);
break
;
/* case REG_DWORD_LITTLE_ENDIAN: */
/* plvdi->item.pszText = _T("REG_DWORD_LITTLE_ENDIAN"); */
/* break; */
case
REG_DWORD_BIG_ENDIAN
:
plvdi
->
item
.
pszText
=
_T
(
"REG_DWORD_BIG_ENDIAN"
);
break
;
...
...
@@ -212,8 +231,7 @@ static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSor
if
(
g_columnToSort
==
1
&&
l
->
dwValType
!=
r
->
dwValType
)
return
g_invertSort
?
(
int
)
r
->
dwValType
-
(
int
)
l
->
dwValType
:
(
int
)
l
->
dwValType
-
(
int
)
r
->
dwValType
;
if
(
g_columnToSort
==
2
)
{
if
(
g_columnToSort
==
2
)
{
/* FIXME: Sort on value */
}
return
g_invertSort
?
_tcscmp
(
r
->
name
,
l
->
name
)
:
_tcscmp
(
l
->
name
,
r
->
name
);
...
...
@@ -249,8 +267,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
case
LVN_COLUMNCLICK
:
if
(
g_columnToSort
==
((
LPNMLISTVIEW
)
lParam
)
->
iSubItem
)
g_invertSort
=
!
g_invertSort
;
else
{
else
{
g_columnToSort
=
((
LPNMLISTVIEW
)
lParam
)
->
iSubItem
;
g_invertSort
=
FALSE
;
}
...
...
@@ -332,29 +349,38 @@ HWND CreateListView(HWND hwndParent, int id)
WS_VISIBLE
|
WS_CHILD
|
LVS_REPORT
,
0
,
0
,
rcClient
.
right
,
rcClient
.
bottom
,
hwndParent
,
(
HMENU
)
id
,
hInst
,
NULL
);
if
(
!
hwndLV
)
return
NULL
;
ListView_SetExtendedListViewStyle
(
hwndLV
,
LVS_EX_FULLROWSELECT
);
/* Initialize the image list, and add items to the control. */
/*
if (!InitListViewImageLists(hwndLV) ||
!InitListViewItems(hwndLV, szName)) {
DestroyWindow(hwndLV);
return FALSE;
}
if (!InitListViewImageLists(hwndLV)) goto fail;
if (!InitListViewItems(hwndLV, szName)) goto fail;
*/
CreateListColumns
(
hwndLV
)
;
if
(
!
CreateListColumns
(
hwndLV
))
goto
fail
;
g_orgListWndProc
=
SubclassWindow
(
hwndLV
,
ListWndProc
);
return
hwndLV
;
fail:
DestroyWindow
(
hwndLV
);
return
NULL
;
}
BOOL
RefreshListView
(
HWND
hwndLV
,
HKEY
hKey
,
LPTSTR
keyPath
)
BOOL
RefreshListView
(
HWND
hwndLV
,
HKEY
hKey
,
LP
C
TSTR
keyPath
)
{
if
(
hwndLV
!=
NULL
)
{
DWORD
max_sub_key_len
;
DWORD
max_val_name_len
;
DWORD
max_val_size
;
DWORD
val_count
;
HKEY
hNewKey
;
LONG
errCode
;
INT
count
,
i
;
count
=
ListView_GetItemCount
(
hwndLV
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
LVITEM
item
;
if
(
!
hwndLV
)
return
FALSE
;
SendMessage
(
hwndLV
,
WM_SETREDRAW
,
FALSE
,
0
);
count
=
ListView_GetItemCount
(
hwndLV
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
item
.
mask
=
LVIF_PARAM
;
item
.
iItem
=
i
;
ListView_GetItem
(
hwndLV
,
&
item
);
...
...
@@ -363,22 +389,15 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
}
g_columnToSort
=
~
0UL
;
ListView_DeleteAllItems
(
hwndLV
);
}
if
(
hKey
!=
NULL
)
{
HKEY
hNewKey
;
LONG
errCode
=
RegOpenKeyEx
(
hKey
,
keyPath
,
0
,
KEY_READ
,
&
hNewKey
);
if
(
errCode
==
ERROR_SUCCESS
)
{
DWORD
max_sub_key_len
;
DWORD
max_val_name_len
;
DWORD
max_val_size
;
DWORD
val_count
;
ShowWindow
(
hwndLV
,
SW_HIDE
);
errCode
=
RegOpenKeyEx
(
hKey
,
keyPath
,
0
,
KEY_READ
,
&
hNewKey
);
if
(
errCode
!=
ERROR_SUCCESS
)
return
FALSE
;
/* get size information and resize the buffers if necessary */
errCode
=
RegQueryInfoKey
(
hNewKey
,
NULL
,
NULL
,
NULL
,
NULL
,
&
max_sub_key_len
,
NULL
,
&
val_count
,
&
max_val_name_len
,
&
max_val_size
,
NULL
,
NULL
);
errCode
=
RegQueryInfoKey
(
hNewKey
,
NULL
,
NULL
,
NULL
,
NULL
,
&
max_sub_key_len
,
NULL
,
&
val_count
,
&
max_val_name_len
,
&
max_val_size
,
NULL
,
NULL
);
#define BUF_HEAD_SPACE 2
/* TODO
: check why this is required with ROS ??? */
#define BUF_HEAD_SPACE 2
/* FIXME
: check why this is required with ROS ??? */
if
(
errCode
==
ERROR_SUCCESS
)
{
TCHAR
*
ValName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
++
max_val_name_len
*
sizeof
(
TCHAR
)
+
BUF_HEAD_SPACE
);
...
...
@@ -403,9 +422,8 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPTSTR keyPath)
HeapFree
(
GetProcessHeap
(),
0
,
ValName
);
}
ListView_SortItems
(
hwndLV
,
CompareFunc
,
hwndLV
);
ShowWindow
(
hwndLV
,
SW_SHOW
);
RegCloseKey
(
hNewKey
);
}
}
SendMessage
(
hwndLV
,
WM_SETREDRAW
,
TRUE
,
0
);
return
TRUE
;
}
programs/regedit/main.c
View file @
16614538
...
...
@@ -46,6 +46,7 @@ UINT nClipboardFormat;
LPCTSTR
strClipboardFormat
=
_T
(
"TODO: SET CORRECT FORMAT"
);
#define MAX_LOADSTRING 100
TCHAR
szTitle
[
MAX_LOADSTRING
];
TCHAR
szFrameClass
[
MAX_LOADSTRING
];
TCHAR
szChildClass
[
MAX_LOADSTRING
];
...
...
programs/regedit/main.h
View file @
16614538
...
...
@@ -28,12 +28,12 @@
#define TREE_WINDOW 2002
#define LIST_WINDOW 2003
#define MAX_LOADSTRING 100
#define SPLIT_WIDTH 5
#define MAX_NAME_LEN 500
#define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
extern
HINSTANCE
hInst
;
/******************************************************************************/
enum
OPTION_FLAGS
{
...
...
@@ -55,7 +55,7 @@ typedef struct {
WINDOWPLACEMENT
pos
;
TCHAR
szPath
[
MAX_PATH
];
}
ChildWnd
;
extern
ChildWnd
*
pChildWnd
;
extern
ChildWnd
*
g_
pChildWnd
;
/*******************************************************************************
* Global Variables:
...
...
@@ -84,14 +84,15 @@ extern void UpdateStatusBar(void);
/* listview.c */
extern
HWND
CreateListView
(
HWND
hwndParent
,
int
id
);
extern
BOOL
RefreshListView
(
HWND
hwndTV
,
HKEY
hKey
,
LPTSTR
keyPath
);
extern
BOOL
RefreshListView
(
HWND
hwndLV
,
HKEY
hKey
,
LPCTSTR
keyPath
);
extern
LPCTSTR
GetValueName
(
HWND
hwndLV
);
/* treeview.c */
extern
HWND
CreateTreeView
(
HWND
hwndParent
,
LPTSTR
pHostName
,
int
id
);
extern
BOOL
OnTreeExpanding
(
HWND
hWnd
,
NMTREEVIEW
*
pnmtv
);
extern
HKEY
FindRegRoot
(
HWND
hwndTV
,
HTREEITEM
hItem
,
LPTSTR
keyPath
,
int
*
pPathLen
,
int
max
);
extern
LPCTSTR
GetItemPath
(
HWND
hwndTV
,
HTREEITEM
hItem
,
HKEY
*
phRootKey
);
/* edit.c */
BOOL
ModifyValue
(
HWND
hwnd
,
HKEY
hKey
,
LPTSTR
valueName
);
BOOL
ModifyValue
(
HWND
hwnd
,
HKEY
hKey
,
LP
C
TSTR
valueName
);
#endif
/* __MAIN_H__ */
programs/regedit/treeview.c
View file @
16614538
This diff is collapsed.
Click to expand it.
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