From 2f18b0cd6da4a7318f77c65ff0f4a85a4b7d18e4 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 3 May 2024 13:53:18 +1000 Subject: [PATCH] Updated odbc-remove-unixodbc patchset Functions SQLDataSources*/SQLDrivers* are local to this DLL and not forwards onto the driver DLL. Hense the Environment handle being passed as the first parameter. Said functions need to return SQL_NO_DATA to state we have no data instead of an SQL_ERROR. Fixes: https://bugs.winehq.org/show_bug.cgi?id=56616 Allows it to run now, more work will be required to make it fully functional. --- .../0001-odbc32-Remove-unixODBC-support.patch | 24 +++++++------- ...8-odbc32-Implement-SQLDriverConnectW.patch | 32 +++++++------------ ...SQLSetDescFieldW-request-onto-driver.patch | 20 ++++++------ 3 files changed, 34 insertions(+), 42 deletions(-) diff --git a/patches/odbc-remove-unixodbc/0001-odbc32-Remove-unixODBC-support.patch b/patches/odbc-remove-unixodbc/0001-odbc32-Remove-unixODBC-support.patch index 3443e4d1..244a3866 100644 --- a/patches/odbc-remove-unixodbc/0001-odbc32-Remove-unixODBC-support.patch +++ b/patches/odbc-remove-unixodbc/0001-odbc32-Remove-unixODBC-support.patch @@ -1,4 +1,4 @@ -From 7d53aa3bef76743b3cef0362d1b8206bdbbca087 Mon Sep 17 00:00:00 2001 +From ee5b1fc178c80194f3a104800e9f8a361cacb2ff Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 2 Feb 2023 14:20:44 +1100 Subject: [PATCH] odbc32: Remove unixODBC support @@ -15,10 +15,10 @@ Subject: [PATCH] odbc32: Remove unixODBC support delete mode 100644 dlls/odbc32/unixlib.h diff --git a/configure.ac b/configure.ac -index 3a9ea346a55..077bf9ad390 100644 +index bcbb3d19c6e..b928eda2b92 100644 --- a/configure.ac +++ b/configure.ac -@@ -1797,9 +1797,6 @@ then +@@ -1813,9 +1813,6 @@ then AC_SUBST(PROCSTAT_LIBS,"-lprocstat")]) fi @@ -40,7 +40,7 @@ index 44962ca4896..65d481facd9 100644 - unixlib.c + rsrc.rc diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 679f3d7380e..e8574430e74 100644 +index 679f3d7380e..3927d00673e 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -40,315 +40,19 @@ @@ -584,7 +584,7 @@ index 679f3d7380e..e8574430e74 100644 - struct SQLDataSources_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1, - NameLength1, Description, BufferLength2, NameLength2 }; - SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; ++ SQLRETURN ret = SQL_NO_DATA; - TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," + FIXME("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," @@ -612,7 +612,7 @@ index 679f3d7380e..e8574430e74 100644 - struct SQLDataSourcesA_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1, - NameLength1, Description, BufferLength2, NameLength2 }; - SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; ++ SQLRETURN ret = SQL_NO_DATA; - TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," + FIXME("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," @@ -1723,7 +1723,7 @@ index 679f3d7380e..e8574430e74 100644 - struct SQLDrivers_params params = { EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax, - pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr }; - SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; ++ SQLRETURN ret = SQL_NO_DATA; - TRACE("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p," + FIXME("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p," @@ -2371,7 +2371,7 @@ index 679f3d7380e..e8574430e74 100644 - struct SQLDataSourcesW_params params = { EnvironmentHandle, Direction, ServerName, BufferLength1, - NameLength1, Description, BufferLength2, NameLength2 }; - SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; ++ SQLRETURN ret = SQL_NO_DATA; - TRACE("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," + FIXME("(EnvironmentHandle %p, Direction %d, ServerName %p, BufferLength1 %d, NameLength1 %p, Description %p," @@ -2524,7 +2524,7 @@ index 679f3d7380e..e8574430e74 100644 - struct SQLDriversW_params params = { EnvironmentHandle, fDirection, szDriverDesc, cbDriverDescMax, - pcbDriverDesc, szDriverAttributes, cbDriverAttrMax, pcbDriverAttr }; - SQLRETURN ret; -+ SQLRETURN ret = SQL_ERROR; ++ SQLRETURN ret = SQL_NO_DATA; - TRACE("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p," + FIXME("(EnvironmentHandle %p, Direction %d, szDriverDesc %p, cbDriverDescMax %d, pcbDriverDesc %p," @@ -4416,10 +4416,10 @@ index 13ce8d0883b..00000000000 -struct SQLTablesW_params { SQLHSTMT StatementHandle; SQLWCHAR *CatalogName; SQLSMALLINT NameLength1; SQLWCHAR *SchemaName; SQLSMALLINT NameLength2; SQLWCHAR *TableName; SQLSMALLINT NameLength3; SQLWCHAR *TableType; SQLSMALLINT NameLength4; }; -struct SQLTransact_params { SQLHENV EnvironmentHandle; SQLHDBC ConnectionHandle; SQLUSMALLINT CompletionType; }; diff --git a/include/config.h.in b/include/config.h.in -index 4461fb060cb..1a8d0385fd5 100644 +index dc44f2ec4e3..6456c142308 100644 --- a/include/config.h.in +++ b/include/config.h.in -@@ -762,9 +762,6 @@ +@@ -768,9 +768,6 @@ /* Define to the soname of the libnetapi library. */ #undef SONAME_LIBNETAPI @@ -4430,5 +4430,5 @@ index 4461fb060cb..1a8d0385fd5 100644 #undef SONAME_LIBOSMESA -- -2.42.0 +2.43.0 diff --git a/patches/odbc-remove-unixodbc/0008-odbc32-Implement-SQLDriverConnectW.patch b/patches/odbc-remove-unixodbc/0008-odbc32-Implement-SQLDriverConnectW.patch index e3dd2eb1..60d92374 100644 --- a/patches/odbc-remove-unixodbc/0008-odbc32-Implement-SQLDriverConnectW.patch +++ b/patches/odbc-remove-unixodbc/0008-odbc32-Implement-SQLDriverConnectW.patch @@ -1,17 +1,17 @@ -From 258bc40f574604e6d27cf3fb75e682f463dcde99 Mon Sep 17 00:00:00 2001 +From ed0548c0f726d46beb1684845572e6b27c2de46b Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sat, 4 Feb 2023 09:16:29 +1100 -Subject: [PATCH 08/42] odbc32: Implement SQLDriverConnectW +Subject: [PATCH] odbc32: Implement SQLDriverConnectW --- - dlls/odbc32/proxyodbc.c | 344 +++++++++++++++++++++++++++++++++++++++- - 1 file changed, 343 insertions(+), 1 deletion(-) + dlls/odbc32/proxyodbc.c | 334 +++++++++++++++++++++++++++++++++++++++- + 1 file changed, 333 insertions(+), 1 deletion(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index b4ec548b09c..ebb6b53d62d 100644 +index 8306dc89878..b44aa7fcc2b 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -53,10 +53,257 @@ struct SQLHDBC_data +@@ -53,10 +53,247 @@ struct SQLHDBC_data { int type; struct SQLHENV_data *environment; @@ -43,17 +43,12 @@ index b4ec548b09c..ebb6b53d62d 100644 + SQLRETURN (WINAPI *pSQLConnect)(SQLHDBC,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT); + SQLRETURN (WINAPI *pSQLConnectW)(SQLHDBC,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); + SQLRETURN (WINAPI *pSQLCopyDesc)(SQLHDESC,SQLHDESC); -+ SQLRETURN (WINAPI *pSQLDataSources)(SQLHENV,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLDataSourcesA)(SQLHENV,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLDataSourcesW)(SQLHENV,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*); + SQLRETURN (WINAPI *pSQLDescribeCol)(SQLHSTMT,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*); + SQLRETURN (WINAPI *pSQLDescribeColW)(SQLHSTMT,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*); + SQLRETURN (WINAPI *pSQLDescribeParam)(SQLHSTMT,SQLUSMALLINT,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*); + SQLRETURN (WINAPI *pSQLDisconnect)(SQLHDBC); + SQLRETURN (WINAPI *pSQLDriverConnect)(SQLHDBC,SQLHWND,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLUSMALLINT); + SQLRETURN (WINAPI *pSQLDriverConnectW)(SQLHDBC,SQLHWND,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLUSMALLINT); -+ SQLRETURN (WINAPI *pSQLDrivers)(SQLHENV,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); -+ SQLRETURN (WINAPI *pSQLDriversW)(SQLHENV,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*); + SQLRETURN (WINAPI *pSQLEndTran)(SQLSMALLINT,SQLHANDLE,SQLSMALLINT); + SQLRETURN (WINAPI *pSQLError)(SQLHENV,SQLHDBC,SQLHSTMT,SQLCHAR*,SQLINTEGER*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); + SQLRETURN (WINAPI *pSQLErrorW)(SQLHENV,SQLHDBC,SQLHSTMT,SQLWCHAR*,SQLINTEGER*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*); @@ -171,17 +166,12 @@ index b4ec548b09c..ebb6b53d62d 100644 + LOAD_FUNCPTR(SQLConnect); + LOAD_FUNCPTR(SQLConnectW); + LOAD_FUNCPTR(SQLCopyDesc); -+ LOAD_FUNCPTR(SQLDataSources); -+ LOAD_FUNCPTR(SQLDataSourcesA); -+ LOAD_FUNCPTR(SQLDataSourcesW); + LOAD_FUNCPTR(SQLDescribeCol); + LOAD_FUNCPTR(SQLDescribeColW); + LOAD_FUNCPTR(SQLDescribeParam); + LOAD_FUNCPTR(SQLDisconnect); + LOAD_FUNCPTR(SQLDriverConnect); + LOAD_FUNCPTR(SQLDriverConnectW); -+ LOAD_FUNCPTR(SQLDrivers); -+ LOAD_FUNCPTR(SQLDriversW); + LOAD_FUNCPTR(SQLEndTran); + LOAD_FUNCPTR(SQLError); + LOAD_FUNCPTR(SQLErrorW); @@ -269,7 +259,7 @@ index b4ec548b09c..ebb6b53d62d 100644 /************************************************************************* * SQLAllocConnect [ODBC32.001] */ -@@ -77,6 +324,7 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH +@@ -77,6 +314,7 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH hdbc->type = SQL_HANDLE_DBC; hdbc->environment = EnvironmentHandle; hdbc->login_timeout = 0; @@ -277,7 +267,7 @@ index b4ec548b09c..ebb6b53d62d 100644 *ConnectionHandle = hdbc; -@@ -438,6 +686,8 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) +@@ -438,6 +676,8 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) return SQL_ERROR; } @@ -286,7 +276,7 @@ index b4ec548b09c..ebb6b53d62d 100644 free(hdbc); return SQL_SUCCESS; -@@ -1596,6 +1846,62 @@ SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSM +@@ -1596,6 +1836,62 @@ SQLRETURN WINAPI SQLColumnsW(SQLHSTMT StatementHandle, WCHAR *CatalogName, SQLSM return ret; } @@ -349,7 +339,7 @@ index b4ec548b09c..ebb6b53d62d 100644 /************************************************************************* * SQLDriverConnectW [ODBC32.141] */ -@@ -1603,13 +1909,49 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl +@@ -1603,13 +1899,49 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl SQLSMALLINT Length, WCHAR *OutConnectionString, SQLSMALLINT BufferLength, SQLSMALLINT *Length2, SQLUSMALLINT DriverCompletion) { @@ -401,5 +391,5 @@ index b4ec548b09c..ebb6b53d62d 100644 } -- -2.39.1 +2.43.0 diff --git a/patches/odbc-remove-unixodbc/0032-odbc32-Forward-SQLSetDescFieldW-request-onto-driver.patch b/patches/odbc-remove-unixodbc/0032-odbc32-Forward-SQLSetDescFieldW-request-onto-driver.patch index 82a3fda4..759d473b 100644 --- a/patches/odbc-remove-unixodbc/0032-odbc32-Forward-SQLSetDescFieldW-request-onto-driver.patch +++ b/patches/odbc-remove-unixodbc/0032-odbc32-Forward-SQLSetDescFieldW-request-onto-driver.patch @@ -1,17 +1,17 @@ -From d2d566575b786ccaa223e582260a0b33038a8153 Mon Sep 17 00:00:00 2001 +From ce7011a2e2ef487f3c11b8c5d2328a7618b70ae7 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Mon, 6 Feb 2023 14:11:44 +1100 -Subject: [PATCH 32/42] odbc32: Forward SQLSetDescFieldW request onto driver +Subject: [PATCH] odbc32: Forward SQLSetDescFieldW request onto driver --- - dlls/odbc32/proxyodbc.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) + dlls/odbc32/proxyodbc.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c -index 27e4f1a4baa..7589ba7d9d4 100644 +index 39d509c28e1..921729d7c22 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c -@@ -2218,6 +2218,7 @@ SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLS +@@ -2212,6 +2212,7 @@ SQLRETURN WINAPI SQLGetDiagFieldW(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLS ret = statement->connection->pSQLGetDiagFieldW(HandleType, statement->driver_stmt, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength); } @@ -19,7 +19,7 @@ index 27e4f1a4baa..7589ba7d9d4 100644 return ret; } -@@ -2790,11 +2791,17 @@ SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, +@@ -2784,12 +2785,18 @@ SQLRETURN WINAPI SQLDriversW(SQLHENV EnvironmentHandle, SQLUSMALLINT fDirection, SQLRETURN WINAPI SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, SQLPOINTER Value, SQLINTEGER BufferLength) { @@ -30,14 +30,16 @@ index 27e4f1a4baa..7589ba7d9d4 100644 + TRACE("(DescriptorHandle %p, RecNumber %d, FieldIdentifier %d, Value %p, BufferLength %d)\n", DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength); +- return ret; + if (hdesc->parent->connection->pSQLSetDescFieldW) + ret = hdesc->parent->connection->pSQLSetDescFieldW(hdesc->driver_hdesc, RecNumber, FieldIdentifier, + Value, BufferLength); + TRACE("ret %d\n", ret); + - return ret; ++ return ret; } + /************************************************************************* -- -2.39.1 +2.43.0