evr/presenter: Validate passed handle on SetVideoWindow().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-10-06 14:48:59 +03:00 committed by Alexandre Julliard
parent c01a9bae61
commit adc4dd674a
2 changed files with 9 additions and 0 deletions

View file

@ -603,6 +603,9 @@ static HRESULT WINAPI video_presenter_control_SetVideoWindow(IMFVideoDisplayCont
TRACE("%p, %p.\n", iface, window);
if (!IsWindow(window))
return E_INVALIDARG;
EnterCriticalSection(&presenter->cs);
presenter->video_window = window;
LeaveCriticalSection(&presenter->cs);

View file

@ -1073,6 +1073,12 @@ static void test_default_presenter(void)
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(hwnd2 == NULL, "Unexpected window %p.\n", hwnd2);
hr = IMFVideoDisplayControl_SetVideoWindow(display_control, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMFVideoDisplayControl_SetVideoWindow(display_control, (HWND)0x1);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMFVideoDisplayControl_SetVideoWindow(display_control, hwnd);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);