- 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.
This commit is contained in:
Robert Shearman 2005-02-01 14:18:10 +00:00 committed by Alexandre Julliard
parent 4590c7ddee
commit e6afc84873
4 changed files with 33 additions and 12 deletions

View File

@ -202,6 +202,19 @@ void COMPOBJ_UninitProcess( void )
UnregisterClassA(aptWinClass, OLE32_hInstance); 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. * 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 /* 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. */ 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); 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; return RPC_E_CHANGED_MODE;
} }
else else

View File

@ -363,6 +363,11 @@ static HRESULT ifproxy_release_public_refs(struct ifproxy * This)
hr = IRemUnknown_RemRelease(remunk, 1, &rif); hr = IRemUnknown_RemRelease(remunk, 1, &rif);
if (hr == S_OK) if (hr == S_OK)
This->refs = 0; 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 else
ERR("IRemUnknown_RemRelease failed with error 0x%08lx\n", hr); ERR("IRemUnknown_RemRelease failed with error 0x%08lx\n", hr);
} }
@ -490,8 +495,11 @@ static HRESULT proxy_manager_create_ifproxy(
ifproxy->proxy = NULL; ifproxy->proxy = NULL;
/* the IUnknown interface is special because it does not have a /* the IUnknown interface is special because it does not have a
* proxy associated with the ifproxy as we handle IUnknown ourselves */ * proxy associated with the ifproxy as we handle IUnknown ourselves.
if (IsEqualIID(riid, &IID_IUnknown)) * 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; ifproxy->iface = (void *)&This->lpVtbl;
hr = S_OK; hr = S_OK;

View File

@ -29,5 +29,6 @@ extern HINSTANCE OLE32_hInstance;
void COMPOBJ_InitProcess( void ); void COMPOBJ_InitProcess( void );
void COMPOBJ_UninitProcess( void ); void COMPOBJ_UninitProcess( void );
void COM_TlsDestroy( void );
#endif /* __WINE_OLE32_MAIN_H */ #endif /* __WINE_OLE32_MAIN_H */

View File

@ -188,7 +188,7 @@ static DWORD CALLBACK host_object_proc(LPVOID p)
HRESULT hr; HRESULT hr;
MSG msg; MSG msg;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if (data->filter) if (data->filter)
{ {
@ -436,7 +436,7 @@ static void test_marshal_stub_apartment_shutdown()
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL); IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy); hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData); ok_ole_success(hr, CoUnmarshalInterface);
IStream_Release(pStream); IStream_Release(pStream);
ok_more_than_one_lock(); ok_more_than_one_lock();
@ -469,7 +469,7 @@ static void test_marshal_proxy_apartment_shutdown()
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL); IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy); hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData); ok_ole_success(hr, CoUnmarshalInterface);
IStream_Release(pStream); IStream_Release(pStream);
ok_more_than_one_lock(); ok_more_than_one_lock();
@ -484,7 +484,7 @@ static void test_marshal_proxy_apartment_shutdown()
end_host_object(tid, thread); 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 */ /* 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); IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy); hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData); ok_ole_success(hr, CoUnmarshalInterface);
IStream_Release(pStream); IStream_Release(pStream);
ok_more_than_one_lock(); 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); IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy1); hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy1);
ok_ole_success(hr, CoReleaseMarshalData); ok_ole_success(hr, CoUnmarshalInterface);
ok_more_than_one_lock(); 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); IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy1); hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy1);
ok_ole_success(hr, CoReleaseMarshalData); ok_ole_success(hr, CoUnmarshalInterface);
ok_more_than_one_lock(); 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); IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy); hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData); ok_ole_success(hr, CoUnmarshalInterface);
IStream_Release(pStream); IStream_Release(pStream);
ok_more_than_one_lock(); ok_more_than_one_lock();
@ -1139,7 +1139,7 @@ static void test_proxy_interfaces()
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL); IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy); hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
ok_ole_success(hr, CoReleaseMarshalData); ok_ole_success(hr, CoUnmarshalInterface);
IStream_Release(pStream); IStream_Release(pStream);
ok_more_than_one_lock(); ok_more_than_one_lock();