From 515d2579d305a6127c6c194319a58eac62437e33 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 5 Apr 2019 13:15:42 +0300 Subject: Replace legacy dynamically-loaded functions with statically linked ones We don't need the dynamic load complexity for these now with baseline Windows version being Windows 7 SP1. Stuff used only for compatibility with older versions was dumped. Change-Id: I810f271796cfd875cfa18a3081c9ad444fe57b3e Reviewed-on: https://gerrit.libreoffice.org/70321 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- dbaccess/Executable_odbcconfig.mk | 5 +++++ dbaccess/win32/source/odbcconfig/odbcconfig.cxx | 23 ++--------------------- 2 files changed, 7 insertions(+), 21 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/Executable_odbcconfig.mk b/dbaccess/Executable_odbcconfig.mk index fdfcbf26f434..de40bdd2a6da 100644 --- a/dbaccess/Executable_odbcconfig.mk +++ b/dbaccess/Executable_odbcconfig.mk @@ -15,6 +15,11 @@ $(eval $(call gb_Executable_use_libraries,odbcconfig,\ comphelper \ )) +$(eval $(call gb_Executable_use_system_win32_libs,odbcconfig,\ + legacy_stdio_definitions \ + odbccp32 \ +)) + $(eval $(call gb_Library_use_sdk_api,odbcconfig)) $(eval $(call gb_Executable_add_exception_objects,odbcconfig,\ diff --git a/dbaccess/win32/source/odbcconfig/odbcconfig.cxx b/dbaccess/win32/source/odbcconfig/odbcconfig.cxx index 71cb8286ff86..e9c4091353a5 100644 --- a/dbaccess/win32/source/odbcconfig/odbcconfig.cxx +++ b/dbaccess/win32/source/odbcconfig/odbcconfig.cxx @@ -22,14 +22,7 @@ # define WIN32_LEAN_AND_MEAN #endif #include -#include -#include - -// the name of the library which contains the SQLManageDataSources function -#define ODBC_UI_LIB_NAME L"ODBCCP32.DLL" - -// the signature of the SQLManageDataSources function -typedef SQLRETURN (SQL_API* TSQLManageDataSource) (SQLHWND hwndParent); +#include // displays the error text for the last error (GetLastError), and returns this error value static int displayLastError() @@ -109,19 +102,7 @@ extern "C" int APIENTRY wWinMain( HINSTANCE _hAppInstance, HINSTANCE, LPWSTR, in if ( !IsWindow( hAppWindow ) ) return displayLastError(); - HMODULE hModule = LoadLibraryW( ODBC_UI_LIB_NAME ); - if ( hModule == nullptr ) - hModule = LoadLibraryExW( ODBC_UI_LIB_NAME, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH ); - if ( hModule == nullptr ) - return displayLastError(); - comphelper::ScopeGuard hModuleReleaser([hModule]() { FreeLibrary(hModule); }); - - FARPROC pManageDSProc = GetProcAddress( hModule, "SQLManageDataSources" ); - if ( pManageDSProc == nullptr ) - return displayLastError(); - - TSQLManageDataSource pManageDS = reinterpret_cast(pManageDSProc); - if ( !( (*pManageDS)( hAppWindow ) ) ) + if (!SQLManageDataSources(hAppWindow)) return displayLastError(); return 0; -- cgit