Files
wine-staging/patches/odbc32-fixes/0025-odbc32-SQLDriverConnect-W-reuse-environment-handle-i.patch
Alistair Leslie-Hughes 3714d05e91 Updated odbc32-fixes patchset
2025-09-08 09:54:01 +10:00

62 lines
2.6 KiB
Diff

From 440409f4a44ed6b44a2e8d9b316d24c01e064197 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 7 May 2025 14:26:13 +1000
Subject: [PATCH] odbc32: SQLDriverConnect/W reuse environment handle is
possible
---
dlls/odbc32/proxyodbc.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c
index 78ec2683e63..2ae10549310 100644
--- a/dlls/odbc32/proxyodbc.c
+++ b/dlls/odbc32/proxyodbc.c
@@ -5861,6 +5861,8 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle
if (has_suffix( filename, L".dll" ))
{
+ struct environment *env;
+
if (!(con->hdr.win32_funcs = con->hdr.parent->win32_funcs = load_driver( filename )))
{
WARN( "failed to load driver %s\n", debugstr_w(filename) );
@@ -5868,7 +5870,11 @@ SQLRETURN WINAPI SQLDriverConnect(SQLHDBC ConnectionHandle, SQLHWND WindowHandle
}
TRACE( "using Windows driver %s\n", debugstr_w(filename) );
- if (!SUCCESS((ret = create_env( (struct environment *)con->hdr.parent, FALSE )))) goto done;
+ env = (struct environment *)find_object_type(SQL_HANDLE_ENV, con->hdr.parent);
+ if (!env || !env->hdr.win32_handle)
+ {
+ if (!SUCCESS((ret = create_env( (struct environment *)con->hdr.parent, FALSE )))) goto done;
+ }
if (!SUCCESS((ret = create_con( con )))) goto done;
ret = driver_connect_win32_a( con, WindowHandle, strA, Length, OutConnectionString, BufferLength, Length2,
@@ -7248,6 +7254,7 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
if (has_suffix( filename, L".dll" ))
{
+ struct environment *env;
if (!(con->hdr.win32_funcs = con->hdr.parent->win32_funcs = load_driver( filename )))
{
WARN( "failed to load driver %s\n", debugstr_w(filename) );
@@ -7255,7 +7262,12 @@ SQLRETURN WINAPI SQLDriverConnectW(SQLHDBC ConnectionHandle, SQLHWND WindowHandl
}
TRACE( "using Windows driver %s\n", debugstr_w(filename) );
- if (!SUCCESS((ret = create_env( (struct environment *)con->hdr.parent, FALSE )))) goto done;
+ env = (struct environment *)find_object_type(SQL_HANDLE_ENV, con->hdr.parent);
+ if (!env || !env->hdr.win32_handle)
+ {
+ if (!SUCCESS((ret = create_env( (struct environment *)con->hdr.parent, FALSE )))) goto done;
+ }
+
if (!SUCCESS((ret = create_con( con )))) goto done;
ret = driver_connect_win32_w( con, WindowHandle, InConnectionString, Length, OutConnectionString,
--
2.50.1