diff --git a/dlls/combase/apartment.c b/dlls/combase/apartment.c index 1181e393ada..108d6a71c5c 100644 --- a/dlls/combase/apartment.c +++ b/dlls/combase/apartment.c @@ -556,6 +556,8 @@ static struct apartment *apartment_get_or_create(DWORD model) if (!apt) { + com_get_tlsdata(&data); + if (model & COINIT_APARTMENTTHREADED) { EnterCriticalSection(&apt_cs); @@ -568,6 +570,10 @@ static struct apartment *apartment_get_or_create(DWORD model) TRACE("Created main-threaded apartment with OXID %s\n", wine_dbgstr_longlong(apt->oxid)); } + data->flags |= OLETLS_APARTMENTTHREADED; + if (model & COINIT_DISABLE_OLE1DDE) + data->flags |= OLETLS_DISABLE_OLE1DDE; + LeaveCriticalSection(&apt_cs); if (apt->main) @@ -588,11 +594,12 @@ static struct apartment *apartment_get_or_create(DWORD model) else mta = apartment_construct(model); + data->flags |= OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE; + apt = mta; LeaveCriticalSection(&apt_cs); } - com_get_tlsdata(&data); data->apt = apt; } @@ -1146,6 +1153,7 @@ void leave_apartment(struct tlsdata *data) WARN( "Uninitializing apartment while Ole is still initialized\n" ); apartment_release(data->apt); data->apt = NULL; + data->flags &= ~(OLETLS_DISABLE_OLE1DDE | OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED); } } diff --git a/dlls/combase/combase_private.h b/dlls/combase/combase_private.h index 46a7c7f655d..9247af4ebb6 100644 --- a/dlls/combase/combase_private.h +++ b/dlls/combase/combase_private.h @@ -66,6 +66,9 @@ HRESULT open_appidkey_from_clsid(REFCLSID clsid, REGSAM access, HKEY *subkey) DE enum tlsdata_flags { OLETLS_UUIDINITIALIZED = 0x2, + OLETLS_DISABLE_OLE1DDE = 0x40, + OLETLS_APARTMENTTHREADED = 0x80, + OLETLS_MULTITHREADED = 0x100, }; /* this is what is stored in TEB->ReservedForOle */ diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index c79e379f92a..5d44cd5a0ba 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -4296,7 +4296,6 @@ static void test_oletlsdata(void) hr = CoInitialize(NULL); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); flags = get_oletlsflags(); -todo_wine ok(flags & OLETLS_APARTMENTTHREADED && !(flags & OLETLS_DISABLE_OLE1DDE), "Unexpected flags %#x.\n", flags); CoUninitialize(); flags = get_oletlsflags(); @@ -4305,7 +4304,6 @@ todo_wine hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); flags = get_oletlsflags(); -todo_wine ok(flags & OLETLS_APARTMENTTHREADED && flags & OLETLS_DISABLE_OLE1DDE, "Unexpected flags %#x.\n", flags); CoUninitialize(); flags = get_oletlsflags(); @@ -4315,7 +4313,6 @@ todo_wine hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); flags = get_oletlsflags(); -todo_wine ok(flags & OLETLS_MULTITHREADED && flags & OLETLS_DISABLE_OLE1DDE, "Unexpected flags %#x.\n", flags); /* Implicit case. */