Commit e6afc848 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Add code for destroying the thread-local storage data, but don't use

it yet. - Don't release apartment on changing modes because we didn't add a reference anywhere. - Quieten the RPC_E_DISCONNECTED error message as it is an expected return code. - Treat IID_NULL the same as IID_IUnknown. - Make tests compile on Win95 again. - Fix copy+paste error where the test failure should be from the CoUnmarshalInterface function.
parent 4590c7dd
......@@ -202,6 +202,19 @@ void COMPOBJ_UninitProcess( void )
UnregisterClassA(aptWinClass, OLE32_hInstance);
}
void COM_TlsDestroy()
{
struct oletls *info = NtCurrentTeb()->ReservedForOle;
if (info)
{
if (info->apt) COM_ApartmentRelease(info->apt);
if (info->errorinfo) IErrorInfo_Release(info->errorinfo);
if (info->state) IUnknown_Release(info->state);
HeapFree(GetProcessHeap(), 0, info);
NtCurrentTeb()->ReservedForOle = NULL;
}
}
/******************************************************************************
* Manage apartments.
*/
......@@ -585,7 +598,6 @@ HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
/* Changing the threading model after it's been set is illegal. If this warning is triggered by Wine
code then we are probably using the wrong threading model to implement that API. */
ERR("Attempt to change threading model of this apartment from 0x%lx to 0x%lx\n", apt->model, dwCoInit);
COM_ApartmentRelease(apt);
return RPC_E_CHANGED_MODE;
}
else
......
......@@ -363,6 +363,11 @@ static HRESULT ifproxy_release_public_refs(struct ifproxy * This)
hr = IRemUnknown_RemRelease(remunk, 1, &rif);
if (hr == S_OK)
This->refs = 0;
else if (hr == RPC_E_DISCONNECTED)
WARN("couldn't release references because object was "
"disconnected: oxid = %s, oid = %s\n",
wine_dbgstr_longlong(This->parent->oxid),
wine_dbgstr_longlong(This->parent->oid));
else
ERR("IRemUnknown_RemRelease failed with error 0x%08lx\n", hr);
}
......@@ -490,8 +495,11 @@ static HRESULT proxy_manager_create_ifproxy(
ifproxy->proxy = NULL;
/* the IUnknown interface is special because it does not have a
* proxy associated with the ifproxy as we handle IUnknown ourselves */
if (IsEqualIID(riid, &IID_IUnknown))
* proxy associated with the ifproxy as we handle IUnknown ourselves.
* IID_NULL is a placeholder for IID_IUnknown used by the DCOM part of
* the rpc runtime. */
if (IsEqualIID(riid, &IID_NULL) ||
IsEqualIID(riid, &IID_IUnknown))
{
ifproxy->iface = (void *)&This->lpVtbl;
hr = S_OK;
......
......@@ -29,5 +29,6 @@ extern HINSTANCE OLE32_hInstance;
void COMPOBJ_InitProcess( void );
void COMPOBJ_UninitProcess( void );
void COM_TlsDestroy( void );
#endif /* __WINE_OLE32_MAIN_H */
......@@ -188,7 +188,7 @@ static DWORD CALLBACK host_object_proc(LPVOID p)
HRESULT hr;
MSG msg;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if (data->filter)
{
......@@ -436,7 +436,7 @@ static void test_marshal_stub_apartment_shutdown()
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData);
ok_ole_success(hr, CoUnmarshalInterface);
IStream_Release(pStream);
ok_more_than_one_lock();
......@@ -469,7 +469,7 @@ static void test_marshal_proxy_apartment_shutdown()
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData);
ok_ole_success(hr, CoUnmarshalInterface);
IStream_Release(pStream);
ok_more_than_one_lock();
......@@ -484,7 +484,7 @@ static void test_marshal_proxy_apartment_shutdown()
end_host_object(tid, thread);
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
}
/* tests that proxies are released when the containing mta apartment is destroyed */
......@@ -509,7 +509,7 @@ static void test_marshal_proxy_mta_apartment_shutdown()
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData);
ok_ole_success(hr, CoUnmarshalInterface);
IStream_Release(pStream);
ok_more_than_one_lock();
......@@ -619,7 +619,7 @@ static void test_tableweak_marshal_and_unmarshal_twice()
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy1);
ok_ole_success(hr, CoReleaseMarshalData);
ok_ole_success(hr, CoUnmarshalInterface);
ok_more_than_one_lock();
......@@ -750,7 +750,7 @@ static void test_tablestrong_marshal_and_unmarshal_twice()
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy1);
ok_ole_success(hr, CoReleaseMarshalData);
ok_ole_success(hr, CoUnmarshalInterface);
ok_more_than_one_lock();
......@@ -947,7 +947,7 @@ static void test_proxy_used_in_wrong_thread()
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData);
ok_ole_success(hr, CoUnmarshalInterface);
IStream_Release(pStream);
ok_more_than_one_lock();
......@@ -1139,7 +1139,7 @@ static void test_proxy_interfaces()
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData);
ok_ole_success(hr, CoUnmarshalInterface);
IStream_Release(pStream);
ok_more_than_one_lock();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment