summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/Executable_odbcconfig.mk5
-rw-r--r--dbaccess/win32/source/odbcconfig/odbcconfig.cxx12
-rw-r--r--include/systools/win32/odbccp32.hxx6
3 files changed, 12 insertions, 11 deletions
diff --git a/dbaccess/Executable_odbcconfig.mk b/dbaccess/Executable_odbcconfig.mk
index 862c77b3b5af..2156128469e3 100644
--- a/dbaccess/Executable_odbcconfig.mk
+++ b/dbaccess/Executable_odbcconfig.mk
@@ -15,11 +15,6 @@ $(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 0cc48725c5e1..127d840c839e 100644
--- a/dbaccess/win32/source/odbcconfig/odbcconfig.cxx
+++ b/dbaccess/win32/source/odbcconfig/odbcconfig.cxx
@@ -18,11 +18,9 @@
*/
-#if !defined WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#include <odbcinst.h>
+#include <sal/config.h>
+
+#include <systools/win32/odbccp32.hxx>
// displays the error text for the last error (GetLastError), and returns this error value
static int displayLastError()
@@ -102,7 +100,9 @@ extern "C" int APIENTRY wWinMain( HINSTANCE _hAppInstance, HINSTANCE, LPWSTR, in
if ( !IsWindow( hAppWindow ) )
return displayLastError();
- if (!SQLManageDataSources(hAppWindow))
+ // Have a odbccp32 variable, to not call FreeLibrary before displayLastError
+ sal::systools::odbccp32 odbccp32;
+ if (!odbccp32.SQLManageDataSources(hAppWindow))
return displayLastError();
return 0;
diff --git a/include/systools/win32/odbccp32.hxx b/include/systools/win32/odbccp32.hxx
index 51b1a10c9576..bbfaf9eecbd9 100644
--- a/include/systools/win32/odbccp32.hxx
+++ b/include/systools/win32/odbccp32.hxx
@@ -33,6 +33,12 @@ public:
return Invoke<proc_t>("SQLGetInstalledDriversW", sBuf, nBufSize, nullptr);
}
+ bool SQLManageDataSources(HWND hwndParent)
+ {
+ using proc_t = BOOL __stdcall(HWND);
+ return Invoke<proc_t>("SQLManageDataSources", hwndParent);
+ }
+
private:
template <typename proc_t, typename... Args> bool Invoke(const char* func, Args... args) const
{