https://git.reactos.org/?p=reactos.git;a=commitdiff;h=507aae4c30510eb6a6176…
commit 507aae4c30510eb6a6176c5cfd55b0366bf1370c
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Wed Apr 19 20:27:31 2023 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Thu Apr 27 16:29:21 2023 +0200
[ATL] Take _ATL_FREE_THREADED into account
When it is not defined, COM should not be initialize multithreaded
---
sdk/lib/atl/atlbase.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sdk/lib/atl/atlbase.h b/sdk/lib/atl/atlbase.h
index 1b0b0361b6a..d6e0e9ec386 100644
--- a/sdk/lib/atl/atlbase.h
+++ b/sdk/lib/atl/atlbase.h
@@ -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()