From a408bba2268e07e87589c34c634e6d23aba248d3 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 14 Feb 2022 14:49:13 +0300 Subject: [PATCH] mfplay: Fix IsProtected() return value. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mfplay/player.c | 5 ++++- dlls/mfplay/tests/mfplay.c | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/mfplay/player.c b/dlls/mfplay/player.c index d8c13cc22a8..f0df707c6d8 100644 --- a/dlls/mfplay/player.c +++ b/dlls/mfplay/player.c @@ -627,10 +627,13 @@ static HRESULT WINAPI media_item_IsProtected(IMFPMediaItem *iface, BOOL *protect TRACE("%p, %p.\n", iface, protected); + if (!protected) + return E_POINTER; + EnterCriticalSection(&item->player->cs); if (SUCCEEDED(hr = media_item_get_pd(item, &pd))) { - *protected = MFRequireProtectedEnvironment(pd) == S_OK; + *protected = (hr = MFRequireProtectedEnvironment(pd)) == S_OK; IMFPresentationDescriptor_Release(pd); } LeaveCriticalSection(&item->player->cs); diff --git a/dlls/mfplay/tests/mfplay.c b/dlls/mfplay/tests/mfplay.c index c58f34e8b31..12825ba29da 100644 --- a/dlls/mfplay/tests/mfplay.c +++ b/dlls/mfplay/tests/mfplay.c @@ -328,8 +328,10 @@ static void test_media_item(void) hr = IMFPMediaItem_HasAudio(item, &ret, &selected); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFPMediaItem_IsProtected(item, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + hr = IMFPMediaItem_IsProtected(item, &ret); - todo_wine ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr); hr = IMFPMediaItem_GetDuration(item, &MFP_POSITIONTYPE_100NS, &propvar); @@ -380,6 +382,9 @@ static void test_media_item(void) hr = IMFPMediaItem_HasAudio(item, &ret, &selected); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr); + hr = IMFPMediaItem_IsProtected(item, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + hr = IMFPMediaItem_IsProtected(item, &ret); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr);