From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
--- dlls/odbccp32/odbccp32.c | 48 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c index 1183cbddd35..dba24e4b673 100644 --- a/dlls/odbccp32/odbccp32.c +++ b/dlls/odbccp32/odbccp32.c @@ -114,6 +114,38 @@ static LPWSTR SQLInstall_strdup_multi(LPCSTR str) return ret; }
+static LPSTR SQLInstall_strdup_multiWtoA(LPCWSTR str) +{ + LPCWSTR p; + LPSTR ret = NULL; + DWORD len; + + if (!str) + return ret; + + for (p = str; *p; p += lstrlenW(p) + 1) + ; + + len = WideCharToMultiByte(CP_ACP, 0, str, p - str, NULL, 0, NULL, NULL ); + ret = malloc((len + 1)); + WideCharToMultiByte(CP_ACP, 0, str, p - str, ret, len, NULL, NULL ); + ret[len] = 0; + + return ret; +} + +static inline char *strdupWtoA( const WCHAR *str ) +{ + char *ret = NULL; + if (str) + { + DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL ); + if ((ret = malloc( len ))) + WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); + } + return ret; +} + static LPWSTR SQLInstall_strdup(LPCSTR str) { DWORD len; @@ -378,7 +410,21 @@ BOOL WINAPI SQLConfigDataSourceW(HWND hwnd, WORD request, LPCWSTR driver, LPCWST if(pConfigDSNW) ret = pConfigDSNW(hwnd, mapped_request, driver, attributes); else - ERR("Failed to find ConfigDSNW\n"); + { + pConfigDSN = (void*)GetProcAddress(mod, "ConfigDSN"); + if (pConfigDSN) + { + LPSTR attr = SQLInstall_strdup_multiWtoA(attributes); + char *driverA = strdupWtoA(driver); + TRACE("Calling ConfigDSN\n"); + + ret = pConfigDSN(hwnd, mapped_request, driverA, attr); + free(attr); + free(driverA); + } + else + ERR("Failed to find ConfigDSN/W\n"); + }
config_mode = config_mode_prev;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147857
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 0000000001AC00E0, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
This merge request was approved by Hans Leidekker.