From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> --- dlls/odbc32/proxyodbc.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index d48c60ec7a2..47af6ecc80f 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -7810,11 +7810,33 @@ static SQLRETURN native_sql_unix_w( struct connection *con, SQLWCHAR *in_stateme static SQLRETURN native_sql_win32_w( struct connection *con, SQLWCHAR *in_statement, SQLINTEGER len, SQLWCHAR *out_statement, SQLINTEGER buflen, SQLINTEGER *retlen ) { + SQLRETURN ret = SQL_ERROR; + if (con->hdr.win32_funcs->SQLNativeSqlW) return con->hdr.win32_funcs->SQLNativeSqlW( con->hdr.win32_handle, in_statement, len, out_statement, buflen, retlen ); - if (con->hdr.win32_funcs->SQLNativeSql) FIXME( "Unicode to ANSI conversion not handled\n" ); - return SQL_ERROR; + if (con->hdr.win32_funcs->SQLNativeSql) + { + SQLCHAR *statement = (SQLCHAR *)strdupWA( (WCHAR *)in_statement ); + SQLCHAR *out = NULL; + if (buflen) + out = malloc( buflen ); + + ret = con->hdr.win32_funcs->SQLNativeSql( con->hdr.win32_handle, statement, len, out, buflen, retlen ); + if(ret == SQL_SUCCESS) + { + if (out_statement) + { + MultiByteToWideChar( CP_ACP, 0, (const char *)out, len, out_statement, buflen ); + out_statement[buflen] = 0; + } + } + if (retlen) *retlen *= sizeof(WCHAR); + + free( statement ); + free( out ); + } + return ret; } /************************************************************************* -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10010