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