quartz/vmr9: Validate the window in IVMRWindowlessControl9::SetVideoClippingWindow().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-05-01 22:52:00 -05:00 committed by Alexandre Julliard
parent 218d2a5119
commit f1de733a03
2 changed files with 8 additions and 4 deletions

View File

@ -3226,9 +3226,9 @@ static void test_clipping_window(void)
ok(!!window, "Failed to create a window.\n");
hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, (HWND)0xdeadbeef);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &mt);
ok(hr == S_OK, "Got hr %#x.\n", hr);

View File

@ -1852,12 +1852,16 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoClippingWindow(IVMRWindowles
TRACE("(%p/%p)->(%p)\n", iface, This, hwnd);
if (!IsWindow(hwnd))
{
WARN("Invalid window %p, returning E_INVALIDARG.\n", hwnd);
return E_INVALIDARG;
}
EnterCriticalSection(&This->renderer.filter.csFilter);
This->hWndClippingWindow = hwnd;
if (This->renderer.sink.pin.peer)
VMR9_maybe_init(This, FALSE, &This->renderer.sink.pin.mt);
if (!hwnd)
IVMRSurfaceAllocatorEx9_TerminateDevice(This->allocator, This->cookie);
LeaveCriticalSection(&This->renderer.filter.csFilter);
return S_OK;
}