Possible Duplicate:
Get the list of ODBC data source names programatically using Delphi
I am looking for a way to get the local system's ODBC connections. The method I currently use is reading the registry values from the HKCU in the following function, which works!
function GetSystemDSN : TStringlist;
var
ini : TRegistry;
strings : TStringlist;
begin
ini := TRegistry.Create(KEY_READ);
strings := TStringlist.create;
with ini do
try
RootKey := HKEY_CURRENT_USER;
if KeyExists('SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources') then
begin
OpenKeyReadOnly('SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources');
GetValueNames(strings);
end;
result := strings;
finally
ini.Free;
end;
end;
However I should be able to change to HKEY_LOCAL_MACHINE and read the global system's ODBC connections, but here I get nothing. I heard there is some difference between 32 and 64 bit systems where you use the Wow6432Node
hidden key. But still I get nothing.
I am also concerned about this because I will need to separate 32 and 64 bit compiled version?
Are there any other ways to get the system and user ODBC connections?