diff options
-rw-r--r-- | embedserv/source/embed/servprov.cxx | 25 | ||||
-rw-r--r-- | extensions/source/ole/olethread.cxx | 25 | ||||
-rw-r--r-- | include/sal/log-areas.dox | 5 |
3 files changed, 17 insertions, 38 deletions
diff --git a/embedserv/source/embed/servprov.cxx b/embedserv/source/embed/servprov.cxx index 739a3088f025..93995d402fdd 100644 --- a/embedserv/source/embed/servprov.cxx +++ b/embedserv/source/embed/servprov.cxx @@ -79,31 +79,18 @@ void *CurThreadData::getData() return (osl_getThreadKeyData(m_hKey)); } - -// CoInitializeEx * -typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInitEx)( LPVOID, DWORD); -// CoInitialize * -typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInit)( LPVOID); - void o2u_attachCurrentThread() { static CurThreadData oleThreadData; if ( oleThreadData.getData() != 0 ) { - HINSTANCE inst= LoadLibrary( _T("ole32.dll")); - if( inst ) - { - HRESULT hr; - ptrCoInitEx initFuncEx= (ptrCoInitEx)GetProcAddress( inst, _T("CoInitializeEx")); - if( initFuncEx) - hr= initFuncEx( NULL, COINIT_MULTITHREADED); - else - { - ptrCoInit initFunc= (ptrCoInit)GetProcAddress( inst,_T("CoInitialize")); - if( initFunc) - hr= initFunc( NULL); - } + HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED); + if (!SUCCEEDED(hr)) + { // FIXME: is it a problem that this ends up in STA currently? + assert(RPC_E_CHANGED_MODE == hr); + SAL_INFO("embedserv.ole", + "CoInitializeEx fail: probably thread is in STA already?"); } oleThreadData.setData((void*)sal_True); } diff --git a/extensions/source/ole/olethread.cxx b/extensions/source/ole/olethread.cxx index 80d8c6e0393e..4fa8f582ad0f 100644 --- a/extensions/source/ole/olethread.cxx +++ b/extensions/source/ole/olethread.cxx @@ -25,10 +25,6 @@ using namespace std; namespace ole_adapter { -// CoInitializeEx * -typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInitEx)( LPVOID, DWORD); -// CoInitialize * -typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInit)( LPVOID); void o2u_attachCurrentThread() { @@ -36,21 +32,12 @@ void o2u_attachCurrentThread() if ((sal_Bool)(sal_IntPtr)oleThreadData.getData() != sal_True) { - HINSTANCE inst= LoadLibrary( _T("ole32.dll")); - if( inst ) - { - HRESULT hr; - // Try DCOM - ptrCoInitEx initFuncEx= (ptrCoInitEx)GetProcAddress( inst, _T("CoInitializeEx")); - if( initFuncEx) - hr= initFuncEx( NULL, COINIT_MULTITHREADED); - // No DCOM, try COM - else - { - ptrCoInit initFunc= (ptrCoInit)GetProcAddress( inst,_T("CoInitialize")); - if( initFunc) - hr= initFunc( NULL); - } + HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED); + if (!SUCCEEDED(hr)) + { // FIXME: is it a problem that this ends up in STA currently? + assert(RPC_E_CHANGED_MODE == hr); + SAL_INFO("extensions.olebridge", + "CoInitializeEx fail: probably thread is in STA already?"); } oleThreadData.setData((void*)sal_True); } diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index b01651dd71bc..9845f569e691 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -126,12 +126,17 @@ certain functionality. @li @c embeddedobj.general @li @c embeddedobj.ole - OLE embedded objects +@section embedserv +@li @c embedserv - embedding server +@li @c embedserv.ole - OLE server + @section extensions @li @c extensions.dbpilots @li @c extensions.plugin @li @c extensions.scanner @li @c extensions.update +@li @c extensions.olebridge - OLE automation bridge @section Filter |