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
db79a9f2
Commit
db79a9f2
authored
Oct 12, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Use client-side user handles for menus.
parent
4bb95f4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
menu.c
dlls/user32/menu.c
+15
-15
user_private.h
dlls/user32/user_private.h
+1
-0
No files found.
dlls/user32/menu.c
View file @
db79a9f2
...
@@ -92,8 +92,8 @@ typedef struct {
...
@@ -92,8 +92,8 @@ typedef struct {
/* Popup menu structure */
/* Popup menu structure */
typedef
struct
{
typedef
struct
{
struct
user_object
obj
;
WORD
wFlags
;
/* Menu flags (MF_POPUP, MF_SYSMENU) */
WORD
wFlags
;
/* Menu flags (MF_POPUP, MF_SYSMENU) */
WORD
wMagic
;
/* Magic number */
WORD
Width
;
/* Width of the whole menu */
WORD
Width
;
/* Width of the whole menu */
WORD
Height
;
/* Height of the whole menu */
WORD
Height
;
/* Height of the whole menu */
UINT
nItems
;
/* Number of items in the menu */
UINT
nItems
;
/* Number of items in the menu */
...
@@ -299,12 +299,15 @@ static void do_debug_print_menuitem(const char *prefix, const MENUITEM *mp,
...
@@ -299,12 +299,15 @@ static void do_debug_print_menuitem(const char *prefix, const MENUITEM *mp,
*/
*/
static
POPUPMENU
*
MENU_GetMenu
(
HMENU
hMenu
)
static
POPUPMENU
*
MENU_GetMenu
(
HMENU
hMenu
)
{
{
POPUPMENU
*
menu
=
USER_HEAP_LIN_ADDR
(
hMenu
);
POPUPMENU
*
menu
=
get_user_handle_ptr
(
hMenu
,
USER_MENU
);
if
(
!
menu
||
menu
->
wMagic
!=
MENU_MAGIC
)
if
(
menu
==
OBJ_OTHER_PROCESS
)
{
{
WARN
(
"invalid menu handle=%p, ptr=%p, magic=%x
\n
"
,
hMenu
,
menu
,
menu
?
menu
->
wMagic
:
0
);
WARN
(
"other process menu %p?
\n
"
,
hMenu
);
menu
=
NULL
;
return
NULL
;
}
}
if
(
menu
)
release_user_handle_ptr
(
menu
);
/* FIXME! */
else
WARN
(
"invalid menu handle=%p
\n
"
,
hMenu
);
return
menu
;
return
menu
;
}
}
...
@@ -4028,14 +4031,13 @@ HMENU WINAPI CreateMenu(void)
...
@@ -4028,14 +4031,13 @@ HMENU WINAPI CreateMenu(void)
{
{
HMENU
hMenu
;
HMENU
hMenu
;
LPPOPUPMENU
menu
;
LPPOPUPMENU
menu
;
if
(
!
(
hMenu
=
USER_HEAP_ALLOC
(
sizeof
(
POPUPMENU
)
)))
return
0
;
menu
=
USER_HEAP_LIN_ADDR
(
hMenu
);
ZeroMemory
(
menu
,
sizeof
(
POPUPMENU
));
if
(
!
(
menu
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
menu
)
)))
return
0
;
menu
->
wMagic
=
MENU_MAGIC
;
menu
->
FocusedItem
=
NO_SELECTED_ITEM
;
menu
->
FocusedItem
=
NO_SELECTED_ITEM
;
menu
->
bTimeToHide
=
FALSE
;
menu
->
bTimeToHide
=
FALSE
;
if
(
!
(
hMenu
=
alloc_user_handle
(
&
menu
->
obj
,
USER_MENU
)))
HeapFree
(
GetProcessHeap
(),
0
,
menu
);
TRACE
(
"return %p
\n
"
,
hMenu
);
TRACE
(
"return %p
\n
"
,
hMenu
);
return
hMenu
;
return
hMenu
;
...
@@ -4047,14 +4049,12 @@ HMENU WINAPI CreateMenu(void)
...
@@ -4047,14 +4049,12 @@ HMENU WINAPI CreateMenu(void)
*/
*/
BOOL
WINAPI
DestroyMenu
(
HMENU
hMenu
)
BOOL
WINAPI
DestroyMenu
(
HMENU
hMenu
)
{
{
LPPOPUPMENU
lppop
=
MENU_GetMenu
(
hMenu
)
;
LPPOPUPMENU
lppop
;
TRACE
(
"(%p)
\n
"
,
hMenu
);
TRACE
(
"(%p)
\n
"
,
hMenu
);
if
(
!
(
lppop
=
free_user_handle
(
hMenu
,
USER_MENU
)))
return
FALSE
;
if
(
!
lppop
)
return
FALSE
;
if
(
lppop
==
OBJ_OTHER_PROCESS
)
return
FALSE
;
lppop
->
wMagic
=
0
;
/* Mark it as destroyed */
/* DestroyMenu should not destroy system menu popup owner */
/* DestroyMenu should not destroy system menu popup owner */
if
((
lppop
->
wFlags
&
(
MF_POPUP
|
MF_SYSMENU
))
==
MF_POPUP
&&
lppop
->
hWnd
)
if
((
lppop
->
wFlags
&
(
MF_POPUP
|
MF_SYSMENU
))
==
MF_POPUP
&&
lppop
->
hWnd
)
...
@@ -4074,7 +4074,7 @@ BOOL WINAPI DestroyMenu( HMENU hMenu )
...
@@ -4074,7 +4074,7 @@ BOOL WINAPI DestroyMenu( HMENU hMenu )
}
}
HeapFree
(
GetProcessHeap
(),
0
,
lppop
->
items
);
HeapFree
(
GetProcessHeap
(),
0
,
lppop
->
items
);
}
}
USER_HEAP_FREE
(
hMenu
);
HeapFree
(
GetProcessHeap
(),
0
,
lppop
);
return
TRUE
;
return
TRUE
;
}
}
...
...
dlls/user32/user_private.h
View file @
db79a9f2
...
@@ -173,6 +173,7 @@ struct hook16_queue_info;
...
@@ -173,6 +173,7 @@ struct hook16_queue_info;
enum
user_obj_type
enum
user_obj_type
{
{
USER_WINDOW
=
1
,
/* window */
USER_WINDOW
=
1
,
/* window */
USER_MENU
,
/* menu */
USER_DWP
/* DeferWindowPos structure */
USER_DWP
/* DeferWindowPos structure */
};
};
...
...
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