RFC mfplat:mfplat crash on Windows 7

Francois Gouget fgouget at codeweavers.com
Mon Nov 30 08:59:22 CST 2020


So mfplat:mfplat crashes on Windows 7 (all available VMs):
https://test.winehq.org/data/tests/mfplat:mfplat.html

The culprit is this line:

 615     get_event((IMFMediaEventGenerator *)mediasource, MENewStream, &var);
which calls
 429     hr = IMFMediaEventGenerator_GetEvent(mediasource, 0, &event);
which crashes.

I applied the patch below to confirm the location of the crash and also 
to confirm that the mediasource object does support the 
IID_IMFMediaEventGenerator interface which it does.
https://testbot.winehq.org/JobDetails.pl?Key=82748

So that crash is pretty strange. The only theory I have is that this API 
was new in Windows 7 and that it was still somewhat buggy. This theory 
is based on the test.winehq.org website which says 'n/a' for 
mfplat:mfplat which should mean the dll is 'missing'. That's confirmed 
for Windows 2008 and also mostly for Vista since it is missing 
MFCreateVideoMediaType() which prevents mfplat_test.exe from running. In 
Windows 8 and 10 the test works... mostly (Windows 10 has timeouts).


Is the test doing something wron to cause this crah? Should we skip this 
test on Windows 7? Should that be based on the Windows version or some 
other characteristic?


diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 474d6281f5f..6899f41b230 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -426,8 +426,10 @@ static BOOL get_event(IMFMediaEventGenerator *generator, MediaEventType expected
     HRESULT hr, event_status;
     IMFMediaEvent *event;
 
+    trace("generator=%p\n", generator);
     hr = IMFMediaEventGenerator_GetEvent(generator, 0, &event);
     ok(hr == S_OK, "Failed to get event, hr %#x.\n", hr);
+    trace("event=%p\n", event); /* (not reached on win7) */
 
     hr = IMFMediaEvent_GetStatus(event, &event_status);
     ok(hr == S_OK, "Failed to get status code, hr %#x.\n", hr);
@@ -477,6 +479,7 @@ static void test_source_resolver(void)
     PROPVARIANT var;
     HRESULT hr;
     GUID guid;
+    IUnknown *unk;
 
     if (!pMFCreateSourceResolver)
     {
@@ -612,15 +615,25 @@ todo_wine
     hr = IMFMediaSource_Start(mediasource, descriptor, &GUID_NULL, &var);
     ok(hr == S_OK, "Failed to start media source, hr %#x.\n", hr);
 
+    hr = IUnknown_QueryInterface(mediasource, &IID_IMFMediaEventGenerator, (void **)&unk);
+    trace("QueryInterface(IID_IMFMediaEventGenerator): hr = %#x\n", hr);
+    ok(hr == S_OK, "Got hr %#x\n", hr);
+
+    trace("\n");
     get_event((IMFMediaEventGenerator *)mediasource, MENewStream, &var);
+    trace("\n"); /* not reached on win7 */
     ok(var.vt == VT_UNKNOWN, "Unexpected value type %u from MENewStream event.\n", var.vt);
     video_stream = (IMFMediaStream *)var.punkVal;
 
-    get_event((IMFMediaEventGenerator *)mediasource, MESourceStarted, NULL);
+    get_event((IMFMediaEventGenerator *)unk, MESourceStarted, NULL);
 
     /* Request samples, our file is 10 frames at 25fps */
     get_event((IMFMediaEventGenerator *)video_stream, MEStreamStarted, NULL);
     sample_count = 10;
+    trace("\n");
+
+    if (SUCCEEDED(hr))
+        IUnknown_Release(unk);
 
     for (i = 0; i < sample_count; ++i)
     {
-- 
2.20.1



More information about the wine-devel mailing list