diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index db76dbcebb5..59093ff4b28 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -2671,9 +2671,9 @@ HRESULT WINAPI CoRegisterMessageFilter( apt = COM_CurrentApt(); /* can't set a message filter in a multi-threaded apartment */ - if (apt->multi_threaded) + if (!apt || apt->multi_threaded) { - ERR("can't set message filter in MTA\n"); + WARN("can't set message filter in MTA or uninitialized apt\n"); return CO_E_NOT_SUPPORTED; } diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index b2e9bf9c6fa..81bf8310fa8 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -250,9 +250,10 @@ static void test_CoRegisterMessageFilter(void) HRESULT hr; IMessageFilter *prev_filter; -#if 0 /* crashes without an apartment! */ hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter); -#endif + ok(hr == CO_E_NOT_SUPPORTED, + "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08x\n", + hr); pCoInitializeEx(NULL, COINIT_MULTITHREADED); prev_filter = (IMessageFilter *)0xdeadbeef;