Protect SetMenu from rogue menu handle.
GetMenu16 can just call GetMenu.
This commit is contained in:
parent
55b92475f2
commit
56753621d3
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue