windows: Fix RoInitialize() failure after a CoInitializeEx() call using apartment threading
This mirrors the same codepath in WIN_CoInitialize() which handles STA and MTA.main
parent
923cb4463e
commit
8982d9f403
|
@ -148,7 +148,19 @@ WIN_RoInitialize(void)
|
|||
typedef HRESULT (WINAPI *RoInitialize_t)(RO_INIT_TYPE initType);
|
||||
RoInitialize_t RoInitializeFunc = (RoInitialize_t)WIN_LoadComBaseFunction("RoInitialize");
|
||||
if (RoInitializeFunc) {
|
||||
return RoInitializeFunc(RO_INIT_MULTITHREADED);
|
||||
/* RO_INIT_SINGLETHREADED is equivalent to COINIT_APARTMENTTHREADED */
|
||||
HRESULT hr = RoInitializeFunc(RO_INIT_SINGLETHREADED);
|
||||
if (hr == RPC_E_CHANGED_MODE) {
|
||||
hr = RoInitializeFunc(RO_INIT_MULTITHREADED);
|
||||
}
|
||||
|
||||
/* S_FALSE means success, but someone else already initialized. */
|
||||
/* You still need to call RoUninitialize in this case! */
|
||||
if (hr == S_FALSE) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return hr;
|
||||
} else {
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue