http://bugs.winehq.org/show_bug.cgi?id=19157
Summary: CoGetContextToken and CoGetObjectContext need to take existing MTA into account Product: Wine Version: 1.1.24 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ole32 AssignedTo: wine-bugs@winehq.org ReportedBy: focht@gmx.net
Hello,
since ole32.CoGetContextToken() is no longer a stub, debugging of managed code (.NET) with cordbg/mdbg doesn't work anymore.
Main thread (tid=0009) creates MTA:
--- snip --- ... 0009:Call ole32.CoInitializeEx(00000000,00000000) ret=79ebfba8 ... 0009:trace:ole:apartment_construct creating new apartment, model=0 0009:trace:ole:apartment_construct Created apartment on OXID 80000cafe ... 0009:Ret ole32.CoInitializeEx() retval=00000000 ret=79ebfba8 --- snip ---
Helper thread (tid=001f) explicitly demands MTA after CoGetContextToken() failure:
--- snip --- ... 001f:Call ole32.CoGetContextToken(02c1e5f4) ret=79ee2b0f ... 001f:trace:ole:CoGetContextToken (0x2c1e5f4) 001f:Ret ole32.CoGetContextToken() retval=800401f0 ret=79ee2b0f ... 001f:Call ole32.CoInitializeEx(00000000,00000000) ret=79ebfba8 ... 001f:trace:ole:apartment_get_or_create entering the multithreaded apartment 80000cafe ... 001f:trace:ole:apartment_addref 80000cafe: before = 1 ... --- snip ---
Another debugger helper/worker thread gets created (tid=0021) which *never* initializes COM explicitly - unlike the other threads:
--- snip --- ... 0009:Call KERNEL32.CreateThread(00000000,00000000,63ea71dc,00176a58,00000000,00176a68) ret=63ea5b42 0009:Ret KERNEL32.CreateThread() retval=0000018c ret=63ea5b42 0009:Call ole32.CoCreateInstance(63ea5bfc,00000000,00000001,63ea5c0c,001768e8) ret=63ea5bda 0009:trace:ole:CoCreateInstance (rclsid={e5cb7a31-7512-11d2-89ce-0080c792e5d8}, pUnkOuter=(nil), dwClsContext=00000001, riid={809c652e-7396-11d2-9771-00a0c9b4d50c}, ppv=0x1768e8) ... 0021:Call ole32.CoGetContextToken(0319d730) ret=79ee2b0f 0021:trace:ole:CoGetContextToken (0x319d730) 0021:Ret ole32.CoGetContextToken() retval=800401f0 ret=79ee2b0f ... 0021:Call ole32.CoGetObjectContext(79ee2a20,00173224) ret=79f82943 ... 0021:trace:ole:CoGetObjectContext ({00000000-0000-0000-c000-000000000046}, 0x173224) 0021:err:ole:CoGetObjectContext apartment not initialised 0021:Ret ole32.CoGetObjectContext() retval=800401f0 ret=79f82943 ... 0021:Call KERNEL32.RaiseException(e06d7363,00000001,00000003,0319d644) ret=78158dd3 0021:trace:seh:raise_exception code=e06d7363 flags=1 addr=0x7b842f46 ip=7b842f46 tid=0021 0021:trace:seh:raise_exception info[0]=19930520 0021:trace:seh:raise_exception info[1]=0319d6b8 0021:trace:seh:raise_exception info[2]=79f9acc4 0021:trace:seh:raise_exception eax=7b82ca8d ebx=7b8d1398 ecx=00000000 edx=0319d630 esi=0319d630 edi=0319d5b0 0021:trace:seh:raise_exception ebp=0319d598 esp=0319d534 cs=0023 ds=002b es=002b fs=0063 gs=006b flags=00000246 ... <managed debugging hangs here> --- snip ---
This is most likely same problem domain as bug 17902 (fixed by http://source.winehq.org/git/wine.git/?a=commit;h=bd4975acb0b682bbf2b4934d12... - "ole32: Use existing MTA in CoGetClassObject and CoCreateInstance")
Since the thread in question doesn't initialize COM at all, CoGetContextToken and CoGetObjectContext most likely need to look at existing MTA(s).
Regards