Problem: I need to modify aliases.conf in firebird but.. as we know the user can install firebird anywhere he want. So I need to programmatically find out where the firebird was installed. I try to do that by registry but it's not good idea because withe almost every one new version of windows (2000, XP, VISTA, 7, 8 and 32 bit or 64 bit and may be 128 bit) the registry keys get change. I try also find out procedure for searching registry like simple text file but no result. I have try to find the "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\SharedDLLs\\aliases.conf" but it's not simple way. It's possible that the problem is not in registry function just in Lazarus but I do not know that. So, may be some one has any idea how to check if and where is installed firebird. Shortly say: I'm going to install my application with database file and have to have silently modify the aliases.conf.
You can find the installation location of Firebird by checking the registry key HKLM\\Software\\Firebird Project\\Firebird Server\\Instances
and reading the DefaultInstance
value.
The following code should do the trick :-
var
lReg : TRegistry;
lStr : String;
begin
lReg := TRegistry.Create;
Try
lReg.RootKey := HKEY_LOCAL_MACHINE;
If lReg.OpenKey('Software\Firebird Project\Firebird Server\Instances', False) Then
lStr := lReg.ReadString('DefaultInstance');
lReg.CloseKey;
ShowMessage(lStr);
Finally
FreeAndNil(lReg);
End;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.