From 80319e33232cb1c032dbe9c8f64b70f82c10af1f Mon Sep 17 00:00:00 2001 From: Ingo Bauersachs Date: Mon, 9 May 2016 20:42:48 +0200 Subject: [PATCH] Statically link against oleaut32 Needs at least XP SP2, but I don't care about XP anymore anyway. --- .../msofficecomm/OutOfProcessServer.cxx | 51 +++++-------------- 1 file changed, 13 insertions(+), 38 deletions(-) diff --git a/src/native/windows/msofficecomm/OutOfProcessServer.cxx b/src/native/windows/msofficecomm/OutOfProcessServer.cxx index 531147139..0be002ee4 100644 --- a/src/native/windows/msofficecomm/OutOfProcessServer.cxx +++ b/src/native/windows/msofficecomm/OutOfProcessServer.cxx @@ -261,50 +261,25 @@ HRESULT OutOfProcessServer::loadRegTypeLib() WCHAR path[MAX_PATH + 1]; DWORD pathCapacity = sizeof(path) / sizeof(WCHAR); DWORD pathLength = ::GetModuleFileNameW(module, path, pathCapacity); - if (pathLength && (pathLength < pathCapacity)) { hr = ::LoadTypeLibEx(path, REGKIND_NONE, &iTypeLib); if (SUCCEEDED(hr)) { - HMODULE oleaut32 = ::GetModuleHandle(_T("oleaut32.dll")); - - if (oleaut32) + hr = ::RegisterTypeLibForUser(iTypeLib, path, NULL); + if (SUCCEEDED(hr)) { - typedef HRESULT (WINAPI *RTLFU)(LPTYPELIB,LPOLESTR,LPOLESTR); - RTLFU registerTypeLibForUser - = (RTLFU) - ::GetProcAddress( - oleaut32, - "RegisterTypeLibForUser"); - - if (registerTypeLibForUser) - { - hr = registerTypeLibForUser(iTypeLib, path, NULL); - if (SUCCEEDED(hr)) - { - /* - * The whole point of what has been done till - * now is securing the success of future calls - * to LoadRegTypeLib. Make sure that is indeed - * the case. - */ - - iTypeLib->Release(); - - hr - = ::LoadRegTypeLib( - LIBID_CommunicatorUA, - 1, - 0, - 0, - &iTypeLib); - if (SUCCEEDED(hr)) - _iTypeLib = iTypeLib; - } - } - else - hr = E_UNEXPECTED; + /* + * The whole point of what has been done till + * now is securing the success of future calls + * to LoadRegTypeLib. Make sure that is indeed + * the case. + */ + iTypeLib->Release(); + hr = ::LoadRegTypeLib( + LIBID_CommunicatorUA, 1, 0, 0, &iTypeLib); + if (SUCCEEDED(hr)) + _iTypeLib = iTypeLib; } else hr = E_UNEXPECTED;