Commit 7973699a authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

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: 's avatarAlistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 410610b5
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment