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
313f75a0
Commit
313f75a0
authored
Jun 21, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Use NtUserThunkedMenuItemInfo for GetSubMenu implementation.
parent
d7dba1ed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
120 deletions
+26
-120
menu.c
dlls/user32/menu.c
+3
-101
menu.c
dlls/win32u/menu.c
+22
-19
ntuser.h
include/ntuser.h
+1
-0
No files found.
dlls/user32/menu.c
View file @
313f75a0
...
...
@@ -115,32 +115,6 @@ static POPUPMENU *MENU_GetMenu(HMENU hMenu)
return
menu
;
}
static
POPUPMENU
*
grab_menu_ptr
(
HMENU
hMenu
)
{
POPUPMENU
*
menu
=
get_user_handle_ptr
(
hMenu
,
NTUSER_OBJ_MENU
);
if
(
menu
==
OBJ_OTHER_PROCESS
)
{
WARN
(
"other process menu %p?
\n
"
,
hMenu
);
return
NULL
;
}
if
(
menu
)
menu
->
refcount
++
;
else
WARN
(
"invalid menu handle=%p
\n
"
,
hMenu
);
return
menu
;
}
static
void
release_menu_ptr
(
POPUPMENU
*
menu
)
{
if
(
menu
)
{
menu
->
refcount
--
;
release_user_handle_ptr
(
menu
);
}
}
/***********************************************************************
* MENU_CopySysPopup
*
...
...
@@ -232,66 +206,6 @@ HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu )
}
static
POPUPMENU
*
find_menu_item
(
HMENU
hmenu
,
UINT
id
,
UINT
flags
,
UINT
*
pos
)
{
UINT
fallback_pos
=
~
0u
,
i
;
POPUPMENU
*
menu
;
menu
=
grab_menu_ptr
(
hmenu
);
if
(
!
menu
)
return
NULL
;
if
(
flags
&
MF_BYPOSITION
)
{
if
(
id
>=
menu
->
nItems
)
{
release_menu_ptr
(
menu
);
return
NULL
;
}
if
(
pos
)
*
pos
=
id
;
return
menu
;
}
else
{
MENUITEM
*
item
=
menu
->
items
;
for
(
i
=
0
;
i
<
menu
->
nItems
;
i
++
,
item
++
)
{
if
(
item
->
fType
&
MF_POPUP
)
{
POPUPMENU
*
submenu
=
find_menu_item
(
item
->
hSubMenu
,
id
,
flags
,
pos
);
if
(
submenu
)
{
release_menu_ptr
(
menu
);
return
submenu
;
}
else
if
(
item
->
wID
==
id
)
{
/* fallback to this item if nothing else found */
fallback_pos
=
i
;
}
}
else
if
(
item
->
wID
==
id
)
{
if
(
pos
)
*
pos
=
i
;
return
menu
;
}
}
}
if
(
fallback_pos
!=
~
0u
)
*
pos
=
fallback_pos
;
else
{
release_menu_ptr
(
menu
);
menu
=
NULL
;
}
return
menu
;
}
/**********************************************************************
* MENU_ParseResource
*
...
...
@@ -755,22 +669,10 @@ HMENU WINAPI GetMenu( HWND hWnd )
/**********************************************************************
* GetSubMenu (USER32.@)
*/
HMENU
WINAPI
GetSubMenu
(
HMENU
hMenu
,
INT
nP
os
)
HMENU
WINAPI
GetSubMenu
(
HMENU
menu
,
INT
p
os
)
{
POPUPMENU
*
menu
;
HMENU
submenu
;
UINT
pos
;
if
(
!
(
menu
=
find_menu_item
(
hMenu
,
nPos
,
MF_BYPOSITION
,
&
pos
)))
return
0
;
if
(
menu
->
items
[
pos
].
fType
&
MF_POPUP
)
submenu
=
menu
->
items
[
pos
].
hSubMenu
;
else
submenu
=
0
;
release_menu_ptr
(
menu
);
return
submenu
;
UINT
ret
=
NtUserThunkedMenuItemInfo
(
menu
,
pos
,
MF_BYPOSITION
,
NtUserGetSubMenu
,
NULL
,
NULL
);
return
UlongToHandle
(
ret
);
}
...
...
dlls/win32u/menu.c
View file @
313f75a0
...
...
@@ -1151,6 +1151,25 @@ static BOOL check_menu_radio_item( HMENU handle, UINT first, UINT last, UINT che
return
done
;
}
/* see GetSubMenu */
static
HMENU
get_sub_menu
(
HMENU
handle
,
INT
pos
)
{
POPUPMENU
*
menu
;
HMENU
submenu
;
UINT
i
;
if
(
!
(
menu
=
find_menu_item
(
handle
,
pos
,
MF_BYPOSITION
,
&
i
)))
return
0
;
if
(
menu
->
items
[
i
].
fType
&
MF_POPUP
)
submenu
=
menu
->
items
[
i
].
hSubMenu
;
else
submenu
=
0
;
release_menu_ptr
(
menu
);
return
submenu
;
}
/**********************************************************************
* NtUserThunkedMenuItemInfo (win32u.@)
*/
...
...
@@ -1178,6 +1197,9 @@ UINT WINAPI NtUserThunkedMenuItemInfo( HMENU handle, UINT pos, UINT flags, UINT
case
NtUserGetMenuItemInfoW
:
return
get_menu_item_info
(
handle
,
pos
,
flags
,
info
,
FALSE
);
case
NtUserGetSubMenu
:
return
HandleToUlong
(
get_sub_menu
(
handle
,
pos
));
case
NtUserInsertMenuItem
:
if
(
!
info
||
info
->
cbSize
!=
sizeof
(
*
info
))
{
...
...
@@ -1314,25 +1336,6 @@ BOOL WINAPI NtUserSetMenuContextHelpId( HMENU handle, DWORD id )
return
TRUE
;
}
/* see GetSubMenu */
static
HMENU
get_sub_menu
(
HMENU
handle
,
INT
pos
)
{
POPUPMENU
*
menu
;
HMENU
submenu
;
UINT
i
;
if
(
!
(
menu
=
find_menu_item
(
handle
,
pos
,
MF_BYPOSITION
,
&
i
)))
return
0
;
if
(
menu
->
items
[
i
].
fType
&
MF_POPUP
)
submenu
=
menu
->
items
[
i
].
hSubMenu
;
else
submenu
=
0
;
release_menu_ptr
(
menu
);
return
submenu
;
}
/**********************************************************************
* NtUserMenuItemFromPoint (win32u.@)
*/
...
...
include/ntuser.h
View file @
313f75a0
...
...
@@ -229,6 +229,7 @@ enum
NtUserGetMenuItemInfoA
,
NtUserGetMenuItemInfoW
,
NtUserGetMenuState
,
NtUserGetSubMenu
,
};
struct
send_message_timeout_params
...
...
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