[PATCH] odbccp32: Only pass supported values to ConfigDSN functions
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Thu Nov 12 03:48:54 CST 2020
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=50116
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/odbccp32/odbccp32.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c
index c842872fa6e..57e2b3ec55f 100644
--- a/dlls/odbccp32/odbccp32.c
+++ b/dlls/odbccp32/odbccp32.c
@@ -338,6 +338,23 @@ fail:
return FALSE;
}
+static WORD fixup_config_request(WORD request)
+{
+ switch(request)
+ {
+ case ODBC_ADD_SYS_DSN:
+ return ODBC_ADD_DSN;
+ case ODBC_CONFIG_SYS_DSN:
+ return ODBC_CONFIG_DSN;
+ case ODBC_REMOVE_SYS_DSN:
+ return ODBC_REMOVE_DSN;
+ case ODBC_REMOVE_DEFAULT_DSN:
+ FIXME("ODBC_REMOVE_DEFAULT_DSN currently not handled\n");
+ }
+
+ return request;
+}
+
BOOL WINAPI SQLConfigDataSourceW(HWND hwnd, WORD request, LPCWSTR driver, LPCWSTR attributes)
{
HMODULE mod;
@@ -357,6 +374,8 @@ BOOL WINAPI SQLConfigDataSourceW(HWND hwnd, WORD request, LPCWSTR driver, LPCWST
if (!mod)
return FALSE;
+ request = fixup_config_request(request);
+
pConfigDSNW = (void*)GetProcAddress(mod, "ConfigDSNW");
if(pConfigDSNW)
ret = pConfigDSNW(hwnd, request, driver, attributes);
@@ -402,6 +421,8 @@ BOOL WINAPI SQLConfigDataSource(HWND hwnd, WORD request, LPCSTR driver, LPCSTR a
return FALSE;
}
+ request = fixup_config_request(request);
+
pConfigDSN = (void*)GetProcAddress(mod, "ConfigDSN");
if (pConfigDSN)
{
--
2.28.0
More information about the wine-devel
mailing list