Protect SetMenu from rogue menu handle.

GetMenu16 can just call GetMenu.
This commit is contained in:
Richard Cohen 1999-09-19 14:08:13 +00:00 committed by Alexandre Julliard
parent 55b92475f2
commit 56753621d3
1 changed files with 8 additions and 11 deletions

View File

@ -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();