8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00

Improve installed product detection (WIP)

This commit is contained in:
Paul Reeves 2024-06-21 11:40:46 +02:00
parent 8b6720d940
commit 4449d55c73

View File

@ -106,31 +106,55 @@ Const
FB25_x64_Install = 14;
FB30Install = 15;
FB30_x64_Install = 16;
Current32Install = FB30Install;
Current64Install = FB30_x64_Install;
FB40Install = 17;
FB40_x64_Install = 18;
FB50Install = 19;
FB50_x64_Install = 20;
FB60Install = 21;
FB60_x64_Install = 22;
FB70Install = 23;
FB70_x64_Install = 24;
FB80Install = 25;
FB80_x64_Install = 26;
FB90Install = 27;
FB90_x64_Install = 28;
Current32Install = FB{#FB_MAJOR_VER}0Install;
Current64Install = FB{#FB_MAJOR_VER}0_x64_Install;
MaxProdInstalled = FB30_x64_Install;
MaxProdInstalled = FB90_x64_Install;
//ProductsInstalled
IB4 = $00001;
IB5 = $00002;
IB6 = $00004;
IB65 = $00008;
IB70 = $00010;
FB1 = $00020;
FB15RC = $00040;
FB15 = $00080;
FB20 = $00100;
IB80 = $00200;
IB81 = $00400;
FB21 = $00800;
FB25 = $01000;
FB30 = $02000;
FB21_x64 = $04000;
FB25_x64 = $08000;
FB30_x64 = $10000;
CurFB32 = FB30;
CurFB64 = FB30_x64;
IB4 = 0;
IB5 = 1;
IB6 = 2;
IB65 = 3;
IB70 = 4;
FB1 = 5;
FB15RC = 6;
FB15 = 7;
FB20 = 8;
IB80 = 9;
IB81 = 10;
FB21 = 11;
FB21_x64 = 12;
FB25 = 13;
FB25_x64 = 14;
FB30 = 15;
FB30_x64 = 16;
FB40 = 17;
FB40_x64 = 18;
FB50 = 19;
FB50_x64 = 20;
FB60 = 21;
FB60_x64 = 22;
FB70 = 23;
FB70_x64 = 24;
FB80 = 25;
FB80_x64 = 26;
FB90 = 27;
FB90_x64 = 28;
CurFB32 = FB{#FB_MAJOR_VER}0;
CurFB64 = FB{#FB_MAJOR_VER}0_x64;
// Likely gds32 version strings for installed versions of Firebird or InterBase are:
// [6,0,n,n] InterBase 6.0
@ -373,6 +397,138 @@ begin
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB40Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM32;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB40_x64_Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM64;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB50Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM32;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB50_x64_Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM64;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB60Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM32;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB60_x64_Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM64;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB70Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM32;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB70_x64_Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM64;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB80Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM32;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB80_x64_Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM64;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB90Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM32;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
FB90_x64_Install: begin
ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
ProductsInstalledArray[product].RegKey := FB2RegKey;
ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
ProductsInstalledArray[product].MessageFile := FBMessageFile;
ProductsInstalledArray[product].RootKey := HKLM64;
ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey,
ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
end;
end; //case
ProductsInstalledArray[product].RegVersion := GetRegistryEntry(
@ -387,11 +543,9 @@ var
product: Integer;
gds32VersionString: String;
VerInt: Array of Integer;
// BoolOne, BoolTwo, BoolEval: Boolean;
// EvalOne, EvalTwo: Integer;
dbg_ProductPath, dbg_BinPath, dbg_ClientVersion, dbg_GBAKVersion, dbg_Server: String;
dbg_InstallType : Integer;
// eval_bool: boolean;
begin
@ -707,6 +861,150 @@ begin
ProductsInstalledArray[product].InstallType := NotInstalled;
end;
FB40Install: begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '4.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40;
ProductsInstalledCount := ProductsInstalledCount + 1;
end;
end;
FB40_x64_Install: begin
if iswin64 then begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '4.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40_x64;
ProductsInstalledCount := ProductsInstalledCount + 1;
end
end
else
ProductsInstalledArray[product].InstallType := NotInstalled;
end;
FB50Install: begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '5.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40;
ProductsInstalledCount := ProductsInstalledCount + 1;
end;
end;
FB50_x64_Install: begin
if iswin64 then begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '5.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40_x64;
ProductsInstalledCount := ProductsInstalledCount + 1;
end
end
else
ProductsInstalledArray[product].InstallType := NotInstalled;
end;
FB60Install: begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '6.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40;
ProductsInstalledCount := ProductsInstalledCount + 1;
end;
end;
FB60_x64_Install: begin
if iswin64 then begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '6.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40_x64;
ProductsInstalledCount := ProductsInstalledCount + 1;
end
end
else
ProductsInstalledArray[product].InstallType := NotInstalled;
end;
FB70Install: begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '7.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40;
ProductsInstalledCount := ProductsInstalledCount + 1;
end;
end;
FB70_x64_Install: begin
if iswin64 then begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '7.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40_x64;
ProductsInstalledCount := ProductsInstalledCount + 1;
end
end
else
ProductsInstalledArray[product].InstallType := NotInstalled;
end;
FB80Install: begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '8.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40;
ProductsInstalledCount := ProductsInstalledCount + 1;
end;
end;
FB80_x64_Install: begin
if iswin64 then begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '8.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40_x64;
ProductsInstalledCount := ProductsInstalledCount + 1;
end
end
else
ProductsInstalledArray[product].InstallType := NotInstalled;
end;
FB90Install: begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '9.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40;
ProductsInstalledCount := ProductsInstalledCount + 1;
end;
end;
FB90_x64_Install: begin
if iswin64 then begin
if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '9.0.0.0',2) <> 0) then
ProductsInstalledArray[product].InstallType := NotInstalled
else
if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
ProductsInstalled := ProductsInstalled + FB40_x64;
ProductsInstalledCount := ProductsInstalledCount + 1;
end
end
else
ProductsInstalledArray[product].InstallType := NotInstalled;
end;
end;//case
@ -795,7 +1093,7 @@ else
SharedFileArray[27].Filename := ExpandConstant('{app}')+'databases.conf';
SharedFileArray[28].Filename := ExpandConstant('{app}')+'firebird.conf';
SharedFileArray[29].Filename := ExpandConstant('{app}')+'firebird.log';
SharedFileArray[30].Filename := ExpandConstant('{app}')+'security6.fdb';
SharedFileArray[30].Filename := ExpandConstant('{app}')+'security{#FB_MAJOR_VER}.fdb';
SharedFileArray[31].Filename := ExpandConstant('{app}')+'fbtrace.conf';
SharedFileArray[32].Filename := ExpandConstant('{app}')+'fbsvcmgr.exe';
SharedFileArray[33].Filename := ExpandConstant('{app}')+'fbrmclib.dll';
@ -1156,9 +1454,9 @@ begin
//// **** FIX ME **** Don't use hardcoded constants here. They get overlooked.
if ( (ProductsInstalledCount = 1) AND
#if PlatformTarget == "x64"
((ProductsInstalled AND FB30_x64 ) = FB30_x64 ) ) then begin
((ProductsInstalled AND FB{#FB_MAJOR_VER}0_x64 ) = FB{#FB_MAJOR_VER}0_x64 ) ) then begin
#else
((ProductsInstalled AND FB30 ) = FB30 ) ) then begin
((ProductsInstalled AND FB{#FB_MAJOR_VER}0 ) = FB{#FB_MAJOR_VER}0 ) ) then begin
#endif
result := true;
exit;