diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-05 13:15:42 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-05 23:13:15 +0200 |
commit | 515d2579d305a6127c6c194319a58eac62437e33 (patch) | |
tree | e283e99d3ed36c2f3a954df976604c7fea8d29fe /dbaccess | |
parent | edd163b5e148d1c71ff2c3f55455c971513a6f62 (diff) |
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/Executable_odbcconfig.mk | 5 | ||||
-rw-r--r-- | dbaccess/win32/source/odbcconfig/odbcconfig.cxx | 23 |
2 files changed, 7 insertions, 21 deletions
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 <windows.h> -#include <sqlext.h> -#include <comphelper/scopeguard.hxx> - -// 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 <odbcinst.h> // 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<TSQLManageDataSource>(pManageDSProc); - if ( !( (*pManageDS)( hAppWindow ) ) ) + if (!SQLManageDataSources(hAppWindow)) return displayLastError(); return 0; |