Skip to content
Snippets Groups Projects
Commit 56753621 authored by Richard Cohen's avatar Richard Cohen Committed by Alexandre Julliard
Browse files

Protect SetMenu from rogue menu handle.

GetMenu16 can just call GetMenu.
parent 55b92475
No related branches found
No related tags found
No related merge requests found
......@@ -3859,17 +3859,7 @@ BOOL WINAPI SetSystemMenu( HWND hwnd, HMENU hMenu )
*/
HMENU16 WINAPI GetMenu16( HWND16 hWnd )
{
HMENU16 retvalue;
WND * wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr && !(wndPtr->dwStyle & WS_CHILD))
{
retvalue = (HMENU16)wndPtr->wIDmenu;
goto END;
}
retvalue = 0;
END:
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
return (HMENU16)GetMenu(hWnd);
}
......@@ -3910,6 +3900,13 @@ BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu )
TRACE("(%04x, %04x);\n", hWnd, hMenu);
if (hMenu && !IsMenu(hMenu))
{
WARN("hMenu is not a menu handle\n");
return FALSE;
}
if (wndPtr && !(wndPtr->dwStyle & WS_CHILD))
{
if (GetCapture() == hWnd) ReleaseCapture();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment