Alistair Leslie-Hughes : odbccp32: Correcly lookup driver in load_config_driver.
Alexandre Julliard
julliard at winehq.org
Thu Aug 16 13:42:47 CDT 2018
Module: wine
Branch: master
Commit: 7973699a8b13893818cbc37444d562a1e6669593
URL: https://source.winehq.org/git/wine.git/?a=commit;h=7973699a8b13893818cbc37444d562a1e6669593
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Thu Aug 16 01:26:21 2018 +0000
odbccp32: Correcly lookup driver in load_config_driver.
RegGetValueW doesn't return ERROR_MORE_DATA when the buffer parameter
is NULL, unlike other Reg functions. This also passes the correct
parameter(reg_driver) on the second call to RegGetValueW.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/odbccp32/odbccp32.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c
index 08645eb..a253035 100644
--- a/dlls/odbccp32/odbccp32.c
+++ b/dlls/odbccp32/odbccp32.c
@@ -259,19 +259,25 @@ static HMODULE load_config_driver(const WCHAR *driver)
if ((ret = RegOpenKeyW(hkey, driver, &hkeydriver)) == ERROR_SUCCESS)
{
ret = RegGetValueW(hkeydriver, NULL, reg_driver, RRF_RT_REG_SZ, &type, NULL, &size);
- if(ret == ERROR_MORE_DATA)
+ if(ret != ERROR_SUCCESS || type != REG_SZ)
{
- filename = HeapAlloc(GetProcessHeap(), 0, size);
- if(!filename)
- {
- RegCloseKey(hkeydriver);
- RegCloseKey(hkey);
- push_error(ODBC_ERROR_OUT_OF_MEM, odbc_error_out_of_mem);
+ RegCloseKey(hkeydriver);
+ RegCloseKey(hkey);
+ push_error(ODBC_ERROR_INVALID_DSN, odbc_error_invalid_dsn);
- return NULL;
- }
- ret = RegGetValueW(hkeydriver, NULL, driver, RRF_RT_REG_SZ, &type, filename, &size);
+ return NULL;
+ }
+
+ filename = HeapAlloc(GetProcessHeap(), 0, size);
+ if(!filename)
+ {
+ RegCloseKey(hkeydriver);
+ RegCloseKey(hkey);
+ push_error(ODBC_ERROR_OUT_OF_MEM, odbc_error_out_of_mem);
+
+ return NULL;
}
+ ret = RegGetValueW(hkeydriver, NULL, reg_driver, RRF_RT_REG_SZ, &type, filename, &size);
RegCloseKey(hkeydriver);
}
More information about the wine-cvs
mailing list