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
27b2519c
Commit
27b2519c
authored
Jun 05, 2017
by
Hugh McMaster
Committed by
Alexandre Julliard
Jun 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Re-implement favourite registry key handling.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1a5561c0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
42 deletions
+55
-42
framewnd.c
programs/regedit/framewnd.c
+46
-29
regproc.c
programs/regedit/regproc.c
+0
-13
regproc.h
programs/regedit/regproc.h
+9
-0
No files found.
programs/regedit/framewnd.c
View file @
27b2519c
...
@@ -198,38 +198,55 @@ static void UpdateMenuItems(HMENU hMenu) {
...
@@ -198,38 +198,55 @@ static void UpdateMenuItems(HMENU hMenu) {
HeapFree
(
GetProcessHeap
(),
0
,
keyName
);
HeapFree
(
GetProcessHeap
(),
0
,
keyName
);
}
}
static
void
OnInitMenuPopup
(
HWND
hWnd
,
HMENU
hMenu
,
short
wItem
)
static
void
add_favourite_key_menu_items
(
HMENU
hMenu
)
{
{
if
(
wItem
==
3
)
{
HKEY
hkey
;
HKEY
hKey
;
LONG
rc
;
while
(
GetMenuItemCount
(
hMenu
)
>
2
)
DWORD
num_values
,
max_value_len
,
value_len
,
type
,
i
;
DeleteMenu
(
hMenu
,
2
,
MF_BYPOSITION
);
WCHAR
*
value_name
;
if
(
RegOpenKeyExW
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
KEY_READ
,
&
hKey
)
==
ERROR_SUCCESS
)
{
rc
=
RegOpenKeyExW
(
HKEY_CURRENT_USER
,
favoritesKey
,
0
,
KEY_READ
,
&
hkey
);
WCHAR
namebuf
[
KEY_MAX_LEN
];
if
(
rc
!=
ERROR_SUCCESS
)
return
;
BYTE
valuebuf
[
4096
];
int
i
=
0
;
rc
=
RegQueryInfoKeyW
(
hkey
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
&
num_values
,
BOOL
sep
=
FALSE
;
&
max_value_len
,
NULL
,
NULL
,
NULL
);
DWORD
ksize
,
vsize
,
type
;
if
(
rc
!=
ERROR_SUCCESS
)
LONG
error
;
{
do
{
ERR
(
"RegQueryInfoKey failed: %d
\n
"
,
rc
);
ksize
=
KEY_MAX_LEN
;
goto
exit
;
vsize
=
sizeof
(
valuebuf
);
error
=
RegEnumValueW
(
hKey
,
i
,
namebuf
,
&
ksize
,
NULL
,
&
type
,
valuebuf
,
&
vsize
);
if
(
error
!=
ERROR_SUCCESS
)
break
;
if
(
type
==
REG_SZ
)
{
if
(
!
sep
)
{
AppendMenuW
(
hMenu
,
MF_SEPARATOR
,
-
1
,
NULL
);
sep
=
TRUE
;
}
AppendMenuW
(
hMenu
,
MF_STRING
,
ID_FAVORITE_FIRST
+
i
,
namebuf
);
}
}
i
++
;
}
while
(
error
==
ERROR_SUCCESS
);
if
(
!
num_values
)
goto
exit
;
RegCloseKey
(
hKey
);
max_value_len
++
;
value_name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
max_value_len
*
sizeof
(
WCHAR
));
CHECK_ENOUGH_MEMORY
(
value_name
);
AppendMenuW
(
hMenu
,
MF_SEPARATOR
,
0
,
0
);
for
(
i
=
0
;
i
<
num_values
;
i
++
)
{
value_len
=
max_value_len
;
rc
=
RegEnumValueW
(
hkey
,
i
,
value_name
,
&
value_len
,
NULL
,
&
type
,
NULL
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
&&
type
==
REG_SZ
)
AppendMenuW
(
hMenu
,
MF_ENABLED
|
MF_STRING
,
ID_FAVORITE_FIRST
+
i
,
value_name
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
value_name
);
exit:
RegCloseKey
(
hkey
);
}
static
void
OnInitMenuPopup
(
HWND
hWnd
,
HMENU
hMenu
)
{
if
(
hMenu
==
GetSubMenu
(
hMenuFrame
,
ID_FAVORITES_MENU
))
{
while
(
GetMenuItemCount
(
hMenu
)
>
2
)
DeleteMenu
(
hMenu
,
2
,
MF_BYPOSITION
);
add_favourite_key_menu_items
(
hMenu
);
}
}
UpdateMenuItems
(
hMenu
);
UpdateMenuItems
(
hMenu
);
}
}
...
@@ -1056,7 +1073,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
...
@@ -1056,7 +1073,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
break
;
break
;
case
WM_INITMENUPOPUP
:
case
WM_INITMENUPOPUP
:
if
(
!
HIWORD
(
lParam
))
if
(
!
HIWORD
(
lParam
))
OnInitMenuPopup
(
hWnd
,
(
HMENU
)
wParam
,
LOWORD
(
lParam
)
);
OnInitMenuPopup
(
hWnd
,
(
HMENU
)
wParam
);
break
;
break
;
case
WM_MENUSELECT
:
case
WM_MENUSELECT
:
OnMenuSelect
(
hWnd
,
LOWORD
(
wParam
),
HIWORD
(
wParam
),
(
HMENU
)
lParam
);
OnMenuSelect
(
hWnd
,
LOWORD
(
wParam
),
HIWORD
(
wParam
),
(
HMENU
)
lParam
);
...
...
programs/regedit/regproc.c
View file @
27b2519c
...
@@ -50,19 +50,6 @@ static HKEY reg_class_keys[] = {
...
@@ -50,19 +50,6 @@ static HKEY reg_class_keys[] = {
#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A))
#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A))
/* return values */
#define NOT_ENOUGH_MEMORY 1
/* processing macros */
/* common check of memory allocation results */
#define CHECK_ENOUGH_MEMORY(p) \
if (!(p)) \
{ \
output_message(STRING_OUT_OF_MEMORY, __FILE__, __LINE__); \
exit(NOT_ENOUGH_MEMORY); \
}
/******************************************************************************
/******************************************************************************
* Allocates memory and converts input from multibyte to wide chars
* Allocates memory and converts input from multibyte to wide chars
* Returned string must be freed by the caller
* Returned string must be freed by the caller
...
...
programs/regedit/regproc.h
View file @
27b2519c
...
@@ -24,6 +24,15 @@
...
@@ -24,6 +24,15 @@
#define REG_FORMAT_5 1
#define REG_FORMAT_5 1
#define REG_FORMAT_4 2
#define REG_FORMAT_4 2
#define NOT_ENOUGH_MEMORY 1
#define CHECK_ENOUGH_MEMORY(p) \
if (!(p)) \
{ \
output_message(STRING_OUT_OF_MEMORY, __FILE__, __LINE__); \
exit(NOT_ENOUGH_MEMORY); \
}
void
__cdecl
output_message
(
unsigned
int
id
,
...);
void
__cdecl
output_message
(
unsigned
int
id
,
...);
BOOL
export_registry_key
(
WCHAR
*
file_name
,
WCHAR
*
reg_key_name
,
DWORD
format
);
BOOL
export_registry_key
(
WCHAR
*
file_name
,
WCHAR
*
reg_key_name
,
DWORD
format
);
...
...
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