ODBCINST.INI = Driver Infomration. ODBC.INI = DSN information.
Drivers have to be registered with the system, so will be under LOCAL_MACHINE.
Tested with both MySQL and Postgresql ODBC drivers which supply the ODBCINST.INI parameter when requesting driver information.
From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
ODBCINST.INI = Driver Infomration. ODBC.INI = DSN information.
Drivers have to be registered with the system, so will be under LOCAL_MACHINE.
Tested with both MySQL and Postgresql ODBC drivers which supply the ODBCINST.INI parameter when requesting driver information. --- dlls/odbccp32/odbccp32.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c index 90a7517b957..b8128afac7b 100644 --- a/dlls/odbccp32/odbccp32.c +++ b/dlls/odbccp32/odbccp32.c @@ -734,7 +734,10 @@ int WINAPI SQLGetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, if (!defvalue || !buff) return 0;
- if (config_mode == ODBC_USER_DSN) + /* odbcinit.ini is only for drivers, so default to local Machine */ + if (!wcsicmp(filename, L"ODBCINST.INI")) + sectionkey = get_privateprofile_sectionkey(HKEY_LOCAL_MACHINE, section, filename); + else if (config_mode == ODBC_USER_DSN) sectionkey = get_privateprofile_sectionkey(HKEY_CURRENT_USER, section, filename); else if (config_mode == ODBC_SYSTEM_DSN) sectionkey = get_privateprofile_sectionkey(HKEY_LOCAL_MACHINE, section, filename); @@ -1812,7 +1815,10 @@ BOOL WINAPI SQLWritePrivateProfileStringW(LPCWSTR lpszSection, LPCWSTR lpszEntry return FALSE; }
- if (config_mode == ODBC_USER_DSN) + /* odbcinit.ini is only for drivers, so default to local Machine */ + if (!wcsicmp(lpszFilename, L"ODBCINST.INI")) + ret = RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\ODBC", &hkey); + else if (config_mode == ODBC_USER_DSN) ret = RegCreateKeyW(HKEY_CURRENT_USER, L"Software\ODBC", &hkey); else if (config_mode == ODBC_SYSTEM_DSN) ret = RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\ODBC", &hkey);
Hans Leidekker (@hans) commented about dlls/odbccp32/odbccp32.c:
if (!defvalue || !buff) return 0;
- if (config_mode == ODBC_USER_DSN)
- /* odbcinit.ini is only for drivers, so default to local Machine */
- if (!wcsicmp(filename, L"ODBCINST.INI"))
sectionkey = get_privateprofile_sectionkey(HKEY_LOCAL_MACHINE, section, filename);
- else if (config_mode == ODBC_USER_DSN) sectionkey = get_privateprofile_sectionkey(HKEY_CURRENT_USER, section, filename); else if (config_mode == ODBC_SYSTEM_DSN) sectionkey = get_privateprofile_sectionkey(HKEY_LOCAL_MACHINE, section, filename);
Can you add a test please? While you're at it, please merge the ODBCINST.INI and ODBC_SYSTEM_DSN cases.