[ATL] Take _ATL_FREE_THREADED into account

When it is not defined, COM should not be initialize multithreaded
This commit is contained in:
Mark Jansen 2023-04-19 20:27:31 +02:00
parent f4b7087a0e
commit 507aae4c30
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B

View file

@ -849,7 +849,12 @@ public:
static HRESULT InitializeCom()
{
return ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
#if defined(_ATL_FREE_THREADED)
constexpr COINIT coInit = COINIT_MULTITHREADED;
#else
constexpr COINIT coInit = COINIT_APARTMENTTHREADED;
#endif
return ::CoInitializeEx(NULL, coInit);
}
static void UninitializeCom()