Hans Leidekker (@hans) commented about dlls/odbccp32/odbccp32.c:
clear_errors();
- if (RegOpenKeyW(HKEY_LOCAL_MACHINE, L"Software\\ODBC\\ODBC.INI\\ODBC Data Sources", &hkey) == ERROR_SUCCESS) + if (config_mode == ODBC_SYSTEM_DSN) + hkeyroot = HKEY_LOCAL_MACHINE; + else if (config_mode == ODBC_BOTH_DSN) + { + WCHAR *regpath = malloc( (wcslen(L"Software\\ODBC\\ODBC.INI\\ODBC Data Sources\\") + wcslen(lpszDSN) + 1) * sizeof(WCHAR) ); + /* ONLY removes one DSN, USER or SYSTEM */ + if (RegOpenKeyW(HKEY_CURRENT_USER, L"Software\\ODBC\\ODBC.INI\\ODBC Data Sources", &hkey) == ERROR_SUCCESS) + hkeyroot = HKEY_CURRENT_USER; + else + hkeyroot = HKEY_LOCAL_MACHINE; + + RegCloseKey(hkey); + free(regpath);
I guess you meant to build regpath and pass it to RegOpenKeyW(). Please add registry checks to the tests. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6333#note_79741