Debian Codegraph @

builds/install/arch-specific/win32/FirebirdInstallEnvironmentChecks.inc

raw
1 (* Initial Developer's Public License.
2 The contents of this file are subject to the Initial Developer's Public
3 License Version 1.0 (the "License"). You may not use this file except
4 in compliance with the License. You may obtain a copy of the License at
5 http://www.ibphoenix.com?a=ibphoenix&page=ibp_idpl
6 Software distributed under the License is distributed on an "AS IS" basis,
7 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8 for the specific language governing rights and limitations under the
9 License.
10
11 The Original Code is copyright 2001-2003 Paul Reeves for IBPhoenix.
12
13 The Initial Developer of the Original Code is Paul Reeves for IBPhoenix.
14
15 All Rights Reserved.
16
17 This file contains a whole bunch of functions that
18 check the registry and see what versions of firebird or interbase
19 are already installed.
20
21 This stuff _is_ firebird/interbase specific and some of it is entirely dependant
22 upon parts of the InnoSetup install script.
23
24 Here is a partial list of functions available in this script:
25
26 function ClassicInstallChosen: Boolean;
27
28 procedure SetupSharedFilesArray;
29 procedure GetSharedLibCountBeforeCopy;
30 procedure CheckSharedLibCountAtEnd;
31
32 function GetFirebirdDir: string;
33 function GetInterBaseDir: string;
34 function TestForWorkingInstalls: boolean;
35
36 function FirebirdOneRunning: boolean;
37
38 function InstallCPLApplet: boolean;
39 function ShowInstallCPLAppletTask: boolean;
40 function CopyGds32: boolean;
41 function ShowCopyGds32Task: boolean;
42 function CopyFbClientLib: boolean;
43 function ShowCopyFbClientLibTask: boolean;
44
45 function SummarizeInstalledProducts: String;
46 function AnalysisAssessment: boolean;
47
48 function HasWI30: boolean;
49 function HasNotWI30: boolean;
50
51 *)
52
53
54 //Registry keys for Firebird and InterBase
55 Const
56 //All InterBase and Firebird 1.0.n except IB5.n
57 IBRegKey = 'SOFTWARE\Borland\InterBase\CurrentVersion';
58 //IB5.n
59 IB5RegKey = 'SOFTWARE\InterBase Corp\InterBase\CurrentVersion';
60 //Fb15 RC
61 FB15RCKey = 'SOFTWARE\FirebirdSQL\Firebird\CurrentVersion';
62 FB15RCKeyRoot = 'SOFTWARE\FirebirdSQL';
63
64 //All IB, Fb 1.0 and Fb 1.5RC's use RootDirectory entry
65 LegacyRegPathEntry = 'RootDirectory';
66
67 //Firebird 1.5 and beyond
68 FB2RegKey = 'SOFTWARE\Firebird Project\Firebird Server\Instances';
69
70 FBRegPathEntry = 'DefaultInstance'; //Stores path to root
71
72 IB4MessageFile = 'interbas.msg';
73 IBMessageFile = 'interbase.msg'; //IB5, IB6, IB7 and Fb 1.0
74 FBMessageFile = 'firebird.msg'; //Fb2 codebase
75
76 IBDesc = 'InterBase %s ';
77 FBDesc = 'Firebird %s ';
78
79
80 Const
81 Install = 1;
82 Configure = 2;
83
84 Var
85 InstallAndConfigure: Integer;
86
87
88 // BEGIN //installed product analysis
89
90 Const
91 //Install Types
92 NotInstalled = 0;
93 ClientInstall = 1;
94 AdminInstall = 2;
95 SuperServerInstall = 4;
96 ClassicServerInstall = 8;
97 MultiServerInstall = 16;
98 BrokenInstall = 32; //version or component mismatch found, so mark broken
99
100 //Possible product installs
101 IB4Install = 0;
102 IB5Install = 1;
103 IB6Install = 2;
104 IB65Install = 3;
105 IB70Install = 4;
106 FB1Install = 5;
107 FB15RCInstall = 6;
108 FB15Install = 7;
109 FB20Install = 8;
110 IB80Install = 9;
111 IB81Install = 10;
112 FB21Install = 11;
113 FB21_x64_Install = 12;
114 FB25Install = 13;
115 FB25_x64_Install = 14;
116 FB30Install = 15;
117 FB30_x64_Install = 16;
118 FB40Install = 17;
119 FB40_x64_Install = 18;
120 FB50Install = 19;
121 FB50_x64_Install = 20;
122 FB60Install = 21;
123 FB60_x64_Install = 22;
124 FB70Install = 23;
125 FB70_x64_Install = 24;
126 FB80Install = 25;
127 FB80_x64_Install = 26;
128 FB90Install = 27;
129 FB90_x64_Install = 28;
130 MaxProdInstalled = FB90_x64_Install;
131
132 Prep32bitInstall = FB{#FB_MAJOR_VER}0Install;
133 Prep64bitInstall = FB{#FB_MAJOR_VER}0_x64_Install;
134
135
136 //ProductsInstalled
137 IB4 = $000000001; // 1
138 IB5 = $000000002; // 2
139 IB6 = $000000004; // 4
140 IB65 = $000000008; // 8
141 IB70 = $000000010; // 16
142 FB1 = $000000020; // 32
143 FB15RC = $000000040; // 64
144 FB15 = $000000080; // 128
145 FB20 = $000000100; // 258
146 IB80 = $000000200; // 512
147 IB81 = $000000400; // 1024
148 FB21 = $000000800; // 2048
149 FB21_x64 = $000001000; // 4096
150 FB25 = $000002000; // 8192
151 FB25_x64 = $000004000; // 16384
152 FB30 = $000008000; // 32768
153 FB30_x64 = $000010000; // 65536
154 FB40 = $000200000; // 131072
155 FB40_x64 = $000400000; // 262144
156 FB50 = $000800000; // 524288
157 FB50_x64 = $001000000; // 1048576
158 FB60 = $002000000; // 2097152
159 FB60_x64 = $004000000; // 4194304
160 FB70 = $008000000; // 8388608
161 FB70_x64 = $010000000; // 16777216
162 FB80 = $020000000; // 33554432
163 FB80_x64 = $040000000; // 67108864
164 FB90 = $080000000; // 134217728
165 FB90_x64 = $100000000; // 268435456
166
167 CurFB32 = FB{#FB_MAJOR_VER}0;
168 CurFB64 = FB{#FB_MAJOR_VER}0_x64;
169
170 // Likely gds32 version strings for installed versions of Firebird or InterBase are:
171 // [6,0,n,n] InterBase 6.0
172 // [6,2,0,nnn] Firebird 1.0.0
173 // [6,2,2,nnn] Firebird 1.0.2
174 // [6,2,3,nnn] Firebird 1.0.3
175 // [6,5,n,n] InterBase 6.5
176 // [6,3,0,nnnn] Any version of Firebird since 1.5.0. Not reliable for Fb detection
177 // [7,n,n,n] InterBase 7
178
179
180 Type
181 TProduct = record
182 ProductID: Integer;
183 Description: String;
184 RegKey: String;
185 RegEntry: String;
186 RegVersion: String;
187 MessageFile: String;
188 Path: String;
189 ClientVersion: String;
190 GBAKVersion: String;
191 ServerVersion: String;
192 InstallType: Integer;
193 ActualVersion: String;
194 FirebirdVersion:String;
195 RootKey: Integer;
196 BinPath: String;
197 end;
198
199
200 Var
201 ProductsInstalled: Integer;
202 ProductsInstalledCount: Integer;
203 ProductsInstalledArray: Array of TProduct;
204
205
206 procedure InitExistingInstallRecords;
207 var
208 product: Integer;
209 begin
210
211 SetArrayLength(ProductsInstalledArray,MaxProdInstalled + 1);
212 for product := 0 to MaxProdInstalled do begin
213
214 ProductsInstalledArray[product].ProductID := product;
215
216 case product of
217
218 IB4Install: begin
219 ProductsInstalledArray[product].Description := IBDesc;
220 ProductsInstalledArray[product].RegKey := IBRegKey;
221 ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry;
222 ProductsInstalledArray[product].MessageFile := IB4MessageFile;
223 ProductsInstalledArray[product].RootKey := HKLM32;
224 ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
225 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
226 end;
227
228 IB5Install: begin
229 ProductsInstalledArray[product].Description := IBDesc;
230 ProductsInstalledArray[product].RegKey := IB5RegKey;
231 ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry;
232 ProductsInstalledArray[product].MessageFile := IBMessageFile;
233 ProductsInstalledArray[product].RootKey := HKLM32;
234 ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
235 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
236 end;
237
238 IB6Install: begin
239 ProductsInstalledArray[product].Description := IBDesc;
240 ProductsInstalledArray[product].RegKey := IBRegKey;
241 ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry;
242 ProductsInstalledArray[product].MessageFile := IBMessageFile;
243 ProductsInstalledArray[product].RootKey := HKLM32;
244 ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
245 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
246 end;
247
248 IB65Install: begin
249 ProductsInstalledArray[product].Description := IBDesc;
250 ProductsInstalledArray[product].RegKey := IBRegKey;
251 ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry;
252 ProductsInstalledArray[product].MessageFile := IBMessageFile;
253 ProductsInstalledArray[product].RootKey := HKLM32;
254 ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
255 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
256 end;
257
258 IB70Install: begin
259 ProductsInstalledArray[product].Description := IBDesc;
260 ProductsInstalledArray[product].RegKey := IBRegKey;
261 ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry;
262 ProductsInstalledArray[product].MessageFile := IBMessageFile;
263 ProductsInstalledArray[product].RootKey := HKLM32;
264 ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
265 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
266 end;
267
268 IB80Install: begin
269 ProductsInstalledArray[product].Description := IBDesc;
270 ProductsInstalledArray[product].RegKey := IBRegKey;
271 ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry;
272 ProductsInstalledArray[product].MessageFile := IBMessageFile;
273 ProductsInstalledArray[product].RootKey := HKLM32;
274 ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
275 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
276 end;
277
278 IB81Install: begin
279 ProductsInstalledArray[product].Description := IBDesc;
280 ProductsInstalledArray[product].RegKey := IBRegKey;
281 ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry;
282 ProductsInstalledArray[product].MessageFile := IBMessageFile;
283 ProductsInstalledArray[product].RootKey := HKLM32;
284 ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
285 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
286 end;
287
288 FB1Install: begin
289 ProductsInstalledArray[product].Description := FBDesc;
290 ProductsInstalledArray[product].RegKey := IBRegKey;
291 ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry;
292 ProductsInstalledArray[product].MessageFile := IBMessageFile;
293 ProductsInstalledArray[product].RootKey := HKLM32;
294 ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
295 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
296 end;
297
298 FB15RCInstall: begin
299 ProductsInstalledArray[product].Description := FBDesc;
300 ProductsInstalledArray[product].RegKey := FB15RCKey;
301 ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry;
302 ProductsInstalledArray[product].MessageFile := FBMessageFile;
303 ProductsInstalledArray[product].RootKey := HKLM32;
304 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
305 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
306 end;
307
308 FB15Install: begin
309 ProductsInstalledArray[product].Description := FBDesc;
310 ProductsInstalledArray[product].RegKey := FB2RegKey;
311 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
312 ProductsInstalledArray[product].MessageFile := FBMessageFile;
313 ProductsInstalledArray[product].RootKey := HKLM32;
314 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
315 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
316 end;
317
318 FB20Install: begin
319 ProductsInstalledArray[product].Description := FBDesc;
320 ProductsInstalledArray[product].RegKey := FB2RegKey;
321 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
322 ProductsInstalledArray[product].MessageFile := FBMessageFile;
323 ProductsInstalledArray[product].RootKey := HKLM32;
324 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
325 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
326 end;
327
328 FB21Install: begin
329 ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
330 ProductsInstalledArray[product].RegKey := FB2RegKey;
331 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
332 ProductsInstalledArray[product].MessageFile := FBMessageFile;
333 ProductsInstalledArray[product].RootKey := HKLM32;
334 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
335 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
336 end;
337
338 FB21_x64_Install: begin
339 ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
340 ProductsInstalledArray[product].RegKey := FB2RegKey;
341 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
342 ProductsInstalledArray[product].MessageFile := FBMessageFile;
343 ProductsInstalledArray[product].RootKey := HKLM64;
344 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
345 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
346 end;
347
348 FB25Install: begin
349 ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
350 ProductsInstalledArray[product].RegKey := FB2RegKey;
351 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
352 ProductsInstalledArray[product].MessageFile := FBMessageFile;
353 ProductsInstalledArray[product].RootKey := HKLM32;
354 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
355 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
356 end;
357
358 FB25_x64_Install: begin
359 ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
360 ProductsInstalledArray[product].RegKey := FB2RegKey;
361 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
362 ProductsInstalledArray[product].MessageFile := FBMessageFile;
363 ProductsInstalledArray[product].RootKey := HKLM64;
364 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
365 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path + 'bin\' ;
366 end;
367
368 FB30Install: begin
369 ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
370 ProductsInstalledArray[product].RegKey := FB2RegKey;
371 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
372 ProductsInstalledArray[product].MessageFile := FBMessageFile;
373 ProductsInstalledArray[product].RootKey := HKLM32;
374 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
375 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
376 end;
377
378 FB30_x64_Install: begin
379 ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
380 ProductsInstalledArray[product].RegKey := FB2RegKey;
381 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
382 ProductsInstalledArray[product].MessageFile := FBMessageFile;
383 ProductsInstalledArray[product].RootKey := HKLM64;
384 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
385 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
386 end;
387
388 FB40Install: begin
389 ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
390 ProductsInstalledArray[product].RegKey := FB2RegKey;
391 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
392 ProductsInstalledArray[product].MessageFile := FBMessageFile;
393 ProductsInstalledArray[product].RootKey := HKLM32;
394 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
395 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
396 end;
397
398 FB40_x64_Install: begin
399 ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
400 ProductsInstalledArray[product].RegKey := FB2RegKey;
401 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
402 ProductsInstalledArray[product].MessageFile := FBMessageFile;
403 ProductsInstalledArray[product].RootKey := HKLM64;
404 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
405 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
406 end;
407
408 FB50Install: begin
409 ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
410 ProductsInstalledArray[product].RegKey := FB2RegKey;
411 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
412 ProductsInstalledArray[product].MessageFile := FBMessageFile;
413 ProductsInstalledArray[product].RootKey := HKLM32;
414 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
415 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
416 end;
417
418 FB50_x64_Install: begin
419 ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
420 ProductsInstalledArray[product].RegKey := FB2RegKey;
421 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
422 ProductsInstalledArray[product].MessageFile := FBMessageFile;
423 ProductsInstalledArray[product].RootKey := HKLM64;
424 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
425 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
426 end;
427
428 FB60Install: begin
429 ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
430 ProductsInstalledArray[product].RegKey := FB2RegKey;
431 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
432 ProductsInstalledArray[product].MessageFile := FBMessageFile;
433 ProductsInstalledArray[product].RootKey := HKLM32;
434 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
435 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
436 end;
437
438 FB60_x64_Install: begin
439 ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
440 ProductsInstalledArray[product].RegKey := FB2RegKey;
441 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
442 ProductsInstalledArray[product].MessageFile := FBMessageFile;
443 ProductsInstalledArray[product].RootKey := HKLM64;
444 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
445 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
446 end;
447
448 FB70Install: begin
449 ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
450 ProductsInstalledArray[product].RegKey := FB2RegKey;
451 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
452 ProductsInstalledArray[product].MessageFile := FBMessageFile;
453 ProductsInstalledArray[product].RootKey := HKLM32;
454 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
455 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
456 end;
457
458 FB70_x64_Install: begin
459 ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
460 ProductsInstalledArray[product].RegKey := FB2RegKey;
461 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
462 ProductsInstalledArray[product].MessageFile := FBMessageFile;
463 ProductsInstalledArray[product].RootKey := HKLM64;
464 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
465 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
466 end;
467
468 FB80Install: begin
469 ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
470 ProductsInstalledArray[product].RegKey := FB2RegKey;
471 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
472 ProductsInstalledArray[product].MessageFile := FBMessageFile;
473 ProductsInstalledArray[product].RootKey := HKLM32;
474 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
475 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
476 end;
477
478 FB80_x64_Install: begin
479 ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
480 ProductsInstalledArray[product].RegKey := FB2RegKey;
481 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
482 ProductsInstalledArray[product].MessageFile := FBMessageFile;
483 ProductsInstalledArray[product].RootKey := HKLM64;
484 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
485 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
486 end;
487
488 FB90Install: begin
489 ProductsInstalledArray[product].Description := FBDesc + ' (Win32) ';
490 ProductsInstalledArray[product].RegKey := FB2RegKey;
491 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
492 ProductsInstalledArray[product].MessageFile := FBMessageFile;
493 ProductsInstalledArray[product].RootKey := HKLM32;
494 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
495 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
496 end;
497
498 FB90_x64_Install: begin
499 ProductsInstalledArray[product].Description := FBDesc + ' (x64) ';
500 ProductsInstalledArray[product].RegKey := FB2RegKey;
501 ProductsInstalledArray[product].RegEntry := FBRegPathEntry;
502 ProductsInstalledArray[product].MessageFile := FBMessageFile;
503 ProductsInstalledArray[product].RootKey := HKLM64;
504 ProductsInstalledArray[product].Path := GuessFirebirdPath( product, ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry);
505 ProductsInstalledArray[product].BinPath := ProductsInstalledArray[product].Path;
506 end;
507
508 end; //case
509
510 ProductsInstalledArray[product].RegVersion := GetRegistryEntry( ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, 'Version');
511
512 end; //for
513 end; //function
514
515
516 Procedure AnalyzeEnvironment;
517 var
518 product: Integer;
519 gds32SysVersionString: String;
520 fbclientSysVersionString: String;
521 VerInt: Array of Integer;
522
523 dbg_ProductPath, dbg_BinPath, dbg_ClientVersion, dbg_GBAKVersion, dbg_Server, dbg_MessageFile: String;
524 dbg_InstallType : Integer;
525
526
527 begin
528
529 ProductsInstalled := 0;
530 ProductsInstalledCount := 0;
531
532 //Test for fbclient version in <sys>
533 if FileExists(GetSysPath+'\fbclient.dll') then begin
534 fbclientSysVersionString := GetInstalledVersion(GetSysPath+'\fbclient.dll',VerInt);
535 end;
536
537 //Test for gds32 version in <sys>
538 if FileExists(GetSysPath+'\gds32.dll') then begin
539 gds32SysVersionString := GetInstalledVersion(GetSysPath+'\gds32.dll',VerInt);
540 end;
541
542 for product := 0 to MaxProdInstalled do begin
543
544 // Check if working client already installed.
545 ///////////////////////
546 dbg_ProductPath := ProductsInstalledArray[product].Path;
547 dbg_BinPath := ProductsInstalledArray[product].BinPath;
548 dbg_GBAKVersion := ProductsInstalledArray[product].GBAKVersion;
549 dbg_Server := ProductsInstalledArray[product].ServerVersion;
550 dbg_InstallType := ProductsInstalledArray[product].InstallType;
551 dbg_MessageFile := ProductsInstalledArray[product].MessageFile
552
553 if FileExists(ProductsInstalledArray[product].BinPath + '\fbclient.dll') then
554 ProductsInstalledArray[product].ClientVersion := GetInstalledVersion( ProductsInstalledArray[product].BinPath + '\fbclient.dll',VerInt)
555 else
556 if FileExists(ProductsInstalledArray[product].BinPath + '\gds32.dll') then
557 ProductsInstalledArray[product].ClientVersion := GetInstalledVersion( ProductsInstalledArray[product].BinPath + '\gds32.dll',VerInt);
558
559 if ProductsInstalledArray[product].ClientVersion <> '' then
560 dbg_ClientVersion := ProductsInstalledArray[product].ClientVersion;
561
562 if ( dbg_ProductPath <> '' ) AND ( dbg_ClientVersion <> '' ) AND
563 (FileExists( dbg_ProductPath + '\' + dbg_MessageFile )) then
564 ProductsInstalledArray[product].InstallType := ProductsInstalledArray[product].InstallType + ClientInstall
565 else
566 //The minimum requirements for a working client don't exist, so ignore this product.
567 Continue;
568
569 // Client version found, so see what else is there
570 ///////////
571 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
572
573 GetVersionNumbersString( ProductsInstalledArray[product].BinPath+'\gbak.exe',
574 ProductsInstalledArray[product].GBAKVersion);
575 If ProductsInstalledArray[product].GBAKVersion <> '' then begin
576 ProductsInstalledArray[product].ActualVersion := ProductsInstalledArray[product].GBAKVersion;
577 ProductsInstalledArray[product].InstallType := ProductsInstalledArray[product].InstallType + AdminInstall;
578 end;
579
580 if FileExists(ProductsInstalledArray[product].BinPath+'\fb_inet_server.exe') then begin
581 GetVersionNumbersString( ProductsInstalledArray[product].BinPath+'\fb_inet_server.exe',
582 ProductsInstalledArray[product].ServerVersion);
583 If ProductsInstalledArray[product].ServerVersion <> '' then begin
584 ProductsInstalledArray[product].ActualVersion := ProductsInstalledArray[product].ServerVersion;
585 ProductsInstalledArray[product].InstallType := ProductsInstalledArray[product].InstallType + ClassicServerInstall;
586 end;
587 end;
588
589 if FileExists(ProductsInstalledArray[product].BinPath+'\fbserver.exe') then begin
590 GetVersionNumbersString( ProductsInstalledArray[product].BinPath+'\fbserver.exe',
591 ProductsInstalledArray[product].ServerVersion);
592 If ProductsInstalledArray[product].ServerVersion <> '' then begin
593 ProductsInstalledArray[product].ActualVersion := ProductsInstalledArray[product].ServerVersion;
594 ProductsInstalledArray[product].InstallType := ProductsInstalledArray[product].InstallType + SuperServerInstall;
595 end;
596 end;
597
598 if FileExists(ProductsInstalledArray[product].BinPath+'\ibserver.exe') then begin
599 GetVersionNumbersString( ProductsInstalledArray[product].BinPath+'\ibserver.exe',
600 ProductsInstalledArray[product].ServerVersion);
601 If ProductsInstalledArray[product].ServerVersion <> '' then begin
602 ProductsInstalledArray[product].ActualVersion := ProductsInstalledArray[product].ServerVersion;
603 ProductsInstalledArray[product].InstallType := ProductsInstalledArray[product].InstallType + SuperServerInstall;
604 end;
605 end;
606
607 if FileExists(ProductsInstalledArray[product].BinPath+'\firebird.exe') then begin
608 GetVersionNumbersString( ProductsInstalledArray[product].BinPath+'\firebird.exe',
609 ProductsInstalledArray[product].ServerVersion);
610 If ProductsInstalledArray[product].ServerVersion <> '' then begin
611 ProductsInstalledArray[product].ActualVersion := ProductsInstalledArray[product].ServerVersion;
612 ProductsInstalledArray[product].InstallType := ProductsInstalledArray[product].InstallType + MultiServerInstall;
613 end;
614 end;
615
616 if (ProductsInstalledArray[product].InstallType <> NotInstalled) then begin
617 //Check that we haven't already flagged the install as broken.
618 // AND ((ProductsInstalledArray[product].InstallType AND BrokenInstall)<>BrokenInstall))
619 //Now test that the version strings match!
620 if (CompareStr(ProductsInstalledArray[product].ClientVersion, ProductsInstalledArray[product].GBAKVersion)<> 0) then
621 ProductsInstalledArray[product].InstallType := ProductsInstalledArray[product].InstallType + BrokenInstall
622 else
623 if (CompareStr(ProductsInstalledArray[product].ClientVersion, ProductsInstalledArray[product].ServerVersion )<> 0) then
624 ProductsInstalledArray[product].InstallType := ProductsInstalledArray[product].InstallType + BrokenInstall;
625 end;
626
627
628 //Now, resolve version numbers.
629 ///////////////////////////////
630
631 case product of
632 IB4Install: begin
633 //check to see if the client library matches the server version installed.
634 if CompareVersion(ProductsInstalledArray[product].ActualVersion, '4.0.0.0',1) <> 0 then
635 ProductsInstalledArray[product].InstallType := NotInstalled
636 else
637 if ((ProductsInstalledArray[product].InstallType AND ClientInstall)= ClientInstall) then begin
638 //Although, if we get here, we must have an install, because the message file is unique to 4.n
639 ProductsInstalled := ProductsInstalled + IB4;
640 ProductsInstalledCount := ProductsInstalledCount + 1;
641 end;
642 end;
643
644 IB5Install: begin
645 //check to see if the client library matches the server version installed.
646 if CompareVersion(ProductsInstalledArray[product].ActualVersion, '5.0.0.0',1) <> 0 then
647 ProductsInstalledArray[product].InstallType := NotInstalled
648 else
649 //Again, if we get here we must have an install, because the registry key is unique to 5.n
650 if ((ProductsInstalledArray[product].InstallType AND ClientInstall)= ClientInstall) then begin
651 ProductsInstalled := ProductsInstalled + IB5;
652 ProductsInstalledCount := ProductsInstalledCount + 1;
653 end
654 end;
655
656 IB6Install: begin
657 //If we get here we have ambiguity with other versions of InterBase and Firebird
658 if ( pos('InterBase',ProductsInstalledArray[product].RegVersion) > 0 ) then begin
659 if CompareVersion(ProductsInstalledArray[product].ClientVersion, '6.0.0.0',2) <> 0 then
660 ProductsInstalledArray[product].InstallType := NotInstalled
661 else
662 if ((ProductsInstalledArray[product].InstallType AND ClientInstall)= ClientInstall) then begin
663 ProductsInstalled := ProductsInstalled + IB6;
664 ProductsInstalledCount := ProductsInstalledCount + 1;
665 end;
666 end
667 else
668 ProductsInstalledArray[product].InstallType := NotInstalled;
669 end;
670
671 IB65Install: begin
672 //If we get here we have ambiguity with other versions of InterBase and Firebird
673 if ( pos('InterBase',ProductsInstalledArray[product].RegVersion) > 0 ) then begin
674 if CompareVersion(ProductsInstalledArray[product].ClientVersion, '6.5.0.0',2) <> 0 then
675 ProductsInstalledArray[product].InstallType := NotInstalled
676 else
677 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
678 ProductsInstalled := ProductsInstalled + IB65;
679 ProductsInstalledCount := ProductsInstalledCount + 1;
680 end
681 end
682 else
683 ProductsInstalledArray[product].InstallType := NotInstalled;
684 end;
685
686 IB70Install: begin
687 //If we get here we have ambiguity with other versions of InterBase and Firebird
688 if ( pos('InterBase',ProductsInstalledArray[product].RegVersion) > 0 ) then begin
689 if CompareVersion(ProductsInstalledArray[product].ClientVersion, '7.0.0.0',1) <> 0 then
690 ProductsInstalledArray[product].InstallType := NotInstalled
691 else
692 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
693 ProductsInstalled := ProductsInstalled + IB70;
694 ProductsInstalledCount := ProductsInstalledCount + 1;
695 end;
696 end
697 else
698 ProductsInstalledArray[product].InstallType := NotInstalled;
699 end;
700
701 FB1Install: begin
702 if ( pos('Firebird',ProductsInstalledArray[product].RegVersion) > 0 ) then begin
703 if CompareVersion(ProductsInstalledArray[product].ClientVersion, '6.2.0.0',2) <> 0 then
704 ProductsInstalledArray[product].InstallType := NotInstalled
705 else
706 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
707 ProductsInstalled := ProductsInstalled + FB1;
708 ProductsInstalledCount := ProductsInstalledCount + 1;
709 ProductsInstalledArray[product].ActualVersion := ConvertIBVerStrToFbVerStr(ProductsInstalledArray[product].ActualVersion);
710 end;
711 end
712 else
713 ProductsInstalledArray[product].InstallType := NotInstalled;
714 end;
715
716 FB15RCInstall: begin
717 if CompareVersion(ProductsInstalledArray[product].ClientVersion, '1.5.0.0',2) <> 0 then
718 ProductsInstalledArray[product].InstallType := NotInstalled
719 else
720 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
721 ProductsInstalled := ProductsInstalled + FB15RC;
722 ProductsInstalledCount := ProductsInstalledCount + 1;
723 end;
724 end;
725
726 FB15Install: begin
727 if CompareVersion(ProductsInstalledArray[product].ClientVersion, '1.5.0.0',2) <> 0 then
728 ProductsInstalledArray[product].InstallType := NotInstalled
729 else
730 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
731 ProductsInstalled := ProductsInstalled + FB15;
732 ProductsInstalledCount := ProductsInstalledCount + 1;
733 end;
734 end;
735
736 FB20Install: begin
737 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '2.0.0.0',2) <> 0) then
738 ProductsInstalledArray[product].InstallType := NotInstalled
739 else
740 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
741 ProductsInstalled := ProductsInstalled + FB20;
742 ProductsInstalledCount := ProductsInstalledCount + 1;
743 end;
744 end;
745
746 IB80Install: begin
747 //If we get here we have ambiguity with other versions of InterBase and Firebird
748 if ( pos('InterBase',ProductsInstalledArray[product].RegVersion) > 0 ) then begin
749 if CompareVersion(ProductsInstalledArray[product].ClientVersion, '8.0.0.0',2) <> 0 then
750 ProductsInstalledArray[product].InstallType := NotInstalled
751 else
752 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
753 ProductsInstalled := ProductsInstalled + IB80;
754 ProductsInstalledCount := ProductsInstalledCount + 1;
755 end;
756 end
757 else
758 ProductsInstalledArray[product].InstallType := NotInstalled;
759 end;
760
761 IB81Install: begin
762 //If we get here we have ambiguity with other versions of InterBase and Firebird
763 if ( pos('InterBase',ProductsInstalledArray[product].RegVersion) > 0 ) then begin
764 if CompareVersion(ProductsInstalledArray[product].ClientVersion, '8.1.0.0',2) <> 0 then
765 ProductsInstalledArray[product].InstallType := NotInstalled
766 else
767 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
768 ProductsInstalled := ProductsInstalled + IB81;
769 ProductsInstalledCount := ProductsInstalledCount + 1;
770 end;
771 end
772 else
773 ProductsInstalledArray[product].InstallType := NotInstalled;
774 end;
775
776 FB21Install: begin
777 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '2.1.0.0',2) <> 0) then
778 ProductsInstalledArray[product].InstallType := NotInstalled
779 else
780 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
781 ProductsInstalled := ProductsInstalled + FB21;
782 ProductsInstalledCount := ProductsInstalledCount + 1;
783 end;
784 end;
785
786 FB21_x64_Install: begin
787 if iswin64 then begin
788 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '2.1.0.0',2) <> 0) then
789 ProductsInstalledArray[product].InstallType := NotInstalled
790 else
791 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
792 ProductsInstalled := ProductsInstalled + FB21_x64;
793 ProductsInstalledCount := ProductsInstalledCount + 1;
794 end
795 end
796 else
797 ProductsInstalledArray[product].InstallType := NotInstalled;
798 end;
799
800 FB25Install: begin
801 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '2.5.0.0',2) <> 0) then
802 ProductsInstalledArray[product].InstallType := NotInstalled
803 else
804 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
805 ProductsInstalled := ProductsInstalled + FB25;
806 ProductsInstalledCount := ProductsInstalledCount + 1;
807 end;
808 end;
809
810 FB25_x64_Install: begin
811 if iswin64 then begin
812 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '2.5.0.0',2) <> 0) then
813 ProductsInstalledArray[product].InstallType := NotInstalled
814 else
815 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
816 ProductsInstalled := ProductsInstalled + FB25_x64;
817 ProductsInstalledCount := ProductsInstalledCount + 1;
818 end
819 end
820 else
821 ProductsInstalledArray[product].InstallType := NotInstalled;
822 end;
823
824 FB30Install: begin
825 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '3.0.0.0',2) <> 0) then
826 ProductsInstalledArray[product].InstallType := NotInstalled
827 else
828 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
829 ProductsInstalled := ProductsInstalled + FB30;
830 ProductsInstalledCount := ProductsInstalledCount + 1;
831 end;
832 end;
833
834 FB30_x64_Install: begin
835 if iswin64 then begin
836 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '3.0.0.0',2) <> 0) then
837 ProductsInstalledArray[product].InstallType := NotInstalled
838 else
839 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
840 ProductsInstalled := ProductsInstalled + FB30_x64;
841 ProductsInstalledCount := ProductsInstalledCount + 1;
842 end
843 end
844 else
845 ProductsInstalledArray[product].InstallType := NotInstalled;
846 end;
847
848 FB40Install: begin
849 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '4.0.0.0',2) <> 0) then
850 ProductsInstalledArray[product].InstallType := NotInstalled
851 else
852 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
853 ProductsInstalled := ProductsInstalled + FB40;
854 ProductsInstalledCount := ProductsInstalledCount + 1;
855 end;
856 end;
857
858 FB40_x64_Install: begin
859 if iswin64 then begin
860 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '4.0.0.0',2) <> 0) then
861 ProductsInstalledArray[product].InstallType := NotInstalled
862 else
863 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
864 ProductsInstalled := ProductsInstalled + FB40_x64;
865 ProductsInstalledCount := ProductsInstalledCount + 1;
866 end
867 end
868 else
869 ProductsInstalledArray[product].InstallType := NotInstalled;
870 end;
871
872 FB50Install: begin
873 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '5.0.0.0',2) <> 0) then
874 ProductsInstalledArray[product].InstallType := NotInstalled
875 else
876 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
877 ProductsInstalled := ProductsInstalled + FB50;
878 ProductsInstalledCount := ProductsInstalledCount + 1;
879 end;
880 end;
881
882 FB50_x64_Install: begin
883 if iswin64 then begin
884 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '5.0.0.0',2) <> 0) then
885 ProductsInstalledArray[product].InstallType := NotInstalled
886 else
887 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
888 ProductsInstalled := ProductsInstalled + FB50_x64;
889 ProductsInstalledCount := ProductsInstalledCount + 1;
890 end
891 end
892 else
893 ProductsInstalledArray[product].InstallType := NotInstalled;
894 end;
895
896 FB60Install: begin
897 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '6.0.0.0',2) <> 0) then
898 ProductsInstalledArray[product].InstallType := NotInstalled
899 else
900 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
901 ProductsInstalled := ProductsInstalled + FB60;
902 ProductsInstalledCount := ProductsInstalledCount + 1;
903 end;
904 end;
905
906 FB60_x64_Install: begin
907 if iswin64 then begin
908 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '6.0.0.0',2) <> 0) then
909 ProductsInstalledArray[product].InstallType := NotInstalled
910 else
911 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
912 ProductsInstalled := ProductsInstalled + FB60_x64;
913 ProductsInstalledCount := ProductsInstalledCount + 1;
914 end
915 end
916 else
917 ProductsInstalledArray[product].InstallType := NotInstalled;
918 end;
919
920 FB70Install: begin
921 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '7.0.0.0',2) <> 0) then
922 ProductsInstalledArray[product].InstallType := NotInstalled
923 else
924 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
925 ProductsInstalled := ProductsInstalled + FB70;
926 ProductsInstalledCount := ProductsInstalledCount + 1;
927 end;
928 end;
929
930 FB70_x64_Install: begin
931 if iswin64 then begin
932 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '7.0.0.0',2) <> 0) then
933 ProductsInstalledArray[product].InstallType := NotInstalled
934 else
935 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
936 ProductsInstalled := ProductsInstalled + FB70_x64;
937 ProductsInstalledCount := ProductsInstalledCount + 1;
938 end
939 end
940 else
941 ProductsInstalledArray[product].InstallType := NotInstalled;
942 end;
943
944 FB80Install: begin
945 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '8.0.0.0',2) <> 0) then
946 ProductsInstalledArray[product].InstallType := NotInstalled
947 else
948 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
949 ProductsInstalled := ProductsInstalled + FB80;
950 ProductsInstalledCount := ProductsInstalledCount + 1;
951 end;
952 end;
953
954 FB80_x64_Install: begin
955 if iswin64 then begin
956 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '8.0.0.0',2) <> 0) then
957 ProductsInstalledArray[product].InstallType := NotInstalled
958 else
959 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
960 ProductsInstalled := ProductsInstalled + FB80_x64;
961 ProductsInstalledCount := ProductsInstalledCount + 1;
962 end
963 end
964 else
965 ProductsInstalledArray[product].InstallType := NotInstalled;
966 end;
967
968 FB90Install: begin
969 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '9.0.0.0',2) <> 0) then
970 ProductsInstalledArray[product].InstallType := NotInstalled
971 else
972 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
973 ProductsInstalled := ProductsInstalled + FB90;
974 ProductsInstalledCount := ProductsInstalledCount + 1;
975 end;
976 end;
977
978 FB90_x64_Install: begin
979 if iswin64 then begin
980 if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '9.0.0.0',2) <> 0) then
981 ProductsInstalledArray[product].InstallType := NotInstalled
982 else
983 if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin
984 ProductsInstalled := ProductsInstalled + FB90_x64;
985 ProductsInstalledCount := ProductsInstalledCount + 1;
986 end
987 end
988 else
989 ProductsInstalledArray[product].InstallType := NotInstalled;
990 end;
991
992 end;//case
993
994
995 end; //if ((ProductsInstalledArray[product].InstallType AND ClientInstall)= ClientInstall) then begin
996 end; //for
997 end;
998
999
1000
1001 function SummarizeInstalledProducts: String;
1002 var
1003 InstallSummaryArray: TArrayofString;
1004 product: Integer;
1005 i: Integer;
1006 StatusDescription: String;
1007 InstallSummary: String;
1008 begin
1009
1010 //do nothing gracefully if we are called by accident.
1011 if ProductsInstalledCount = 0 then
1012 exit;
1013
1014 SetArrayLength(InstallSummaryArray,ProductsInstalledCount);
1015 for product := 0 to MaxProdInstalled -1 do begin
1016 if (ProductsInstalledArray[product].InstallType <> NotInstalled) then begin
1017 InstallSummaryArray[i] := Format(ProductsInstalledArray[product].Description, [ProductsInstalledArray[product].ActualVersion]);
1018 if (ProductsInstalledArray[product].ServerVersion <> '') then begin
1019 if ((ProductsInstalledArray[product].InstallType AND ClassicServerInstall) = ClassicServerInstall) then
1020 InstallSummaryArray[i] := InstallSummaryArray[i] + ' '+ExpandConstant('{cm:ClassicServerInstall}')
1021 else
1022 InstallSummaryArray[i] := InstallSummaryArray[i] + ' '+ExpandConstant('{cm:SuperServerInstall}')
1023 end
1024 else begin
1025 if (ProductsInstalledArray[product].GBAKVersion <> '') then
1026 InstallSummaryArray[i] := InstallSummaryArray[i] + ' '+ExpandConstant('{cm:DeveloperInstall}')
1027 else
1028 InstallSummaryArray[i] := InstallSummaryArray[i] + ' '+ExpandConstant('{cm:ClientInstall}')
1029 end;
1030
1031 if ((ProductsInstalledArray[product].InstallType AND BrokenInstall) = BrokenInstall) then
1032 InstallSummaryArray[i] := InstallSummaryArray[i]
1033 + #13 + ExpandConstant('{cm:PreviousInstallBroken}')
1034 else
1035 InstallSummaryArray[i] := InstallSummaryArray[i]
1036 + #13 + ExpandConstant('{cm:PreviousInstallGood}')
1037 ;
1038
1039 i:= i+1;
1040 end;
1041 end;
1042
1043 for i:=0 to ProductsInstalledCount-1 do
1044 InstallSummary := InstallSummary + InstallSummaryArray[i] + #13;
1045
1046 // If older firebird is installed and installed platform does not match product we are installing
1047 // then notify user.
1048 #if PlatformTarget == "x64"
1049 if ((ProductsInstalled AND CurFB64 ) = CurFB64 ) then
1050 #else
1051 if ((ProductsInstalled AND CurFB32 ) = CurFB32 ) then
1052 #endif
1053 InstallSummary := InstallSummary
1054 +#13 + ExpandConstant('{cm:InstallSummarySuffix1}')
1055 +#13 + ExpandConstant('{cm:InstallSummarySuffix2}')
1056 +#13 + ExpandConstant('{cm:InstallSummarySuffix3}')
1057 +#13 + ExpandConstant('{cm:InstallSummarySuffix4}')
1058 +#13
1059 ;
1060
1061 if ProductsInstalledCount = 1 then
1062 StatusDescription := Format(ExpandConstant('{cm:InstalledProducts}'), [IntToStr(ProductsInstalledCount), ExpandConstant('{cm:InstalledProdCountSingular}')])
1063 else
1064 StatusDescription := Format(ExpandConstant('{cm:InstalledProducts}'), [IntToStr(ProductsInstalledCount), ExpandConstant('{cm:InstalledProdCountPlural}')]);
1065
1066 Result := StatusDescription
1067 +#13
1068 +#13 + InstallSummary
1069 +#13 + ExpandConstant('{cm:InstallSummaryCancel1}')
1070 +#13 + ExpandConstant('{cm:InstallSummaryCancel2}')
1071 +#13
1072 +#13 + ExpandConstant('{cm:InstallSummaryCancel3}')
1073 +#13
1074 end;
1075
1076
1077 function AnalysisAssessment: boolean;
1078 var
1079 MsgText: String;
1080 MsgResult: Integer;
1081 begin
1082 result := false;
1083
1084 //We've got all this information. What do we do with it?
1085
1086 if ProductsInstalledCount = 0 then begin
1087 result := true;
1088 exit;
1089 end;
1090
1091
1092 //If existing install of the same majorver.minorver is
1093 //found then we can upgrade it.
1094 Log( 'CurFB64 is ' + IntToStr(CurFB64) + ' Expect ' + IntToStr( FB{#FB_MAJOR_VER}0_x64 ));
1095 Log( 'FB_MAJOR_VER is ' + '{#FB_MAJOR_VER}' );
1096 if ( (ProductsInstalledCount = 1) AND
1097 #if PlatformTarget == "x64"
1098 ( (ProductsInstalled AND CurFB64 ) = CurFB64 ) ) then begin
1099 #else
1100 ( (ProductsInstalled AND CurFB32 ) = CurFB32 ) ) then begin
1101 #endif
1102 result := true;
1103 exit;
1104 end
1105 ;
1106
1107 if ForceInstall then begin
1108 result := true;
1109 exit;
1110 end;
1111
1112 //Otherwise, show user the analysis report.
1113 MsgText := SummarizeInstalledProducts;
1114 MsgResult := MsgBox(MsgText,mbConfirmation,MB_YESNO);
1115 if (MsgResult = IDNO ) then
1116 result := true;
1117 //but we don't configure
1118 if ((InstallAndConfigure AND Configure) = Configure) then
1119 InstallAndConfigure := InstallAndConfigure - Configure;
1120 end;
1121
1122 //END //Installed product analysis
1123
1124
1125 function ClassicInstallChosen: Boolean;
1126 begin
1127 result := WizardIsTaskSelected('UseClassicServerTask');
1128 end;
1129
1130
1131
1132 /////=======================================
1133
1134
1135
1136 Type
1137 TSharedFileArrayRecord = record
1138 Filename: String;
1139 Count: Integer;
1140 end;
1141
1142 var
1143 SharedFileArray: Array of TSharedFileArrayRecord;
1144
1145
1146
1147 procedure SetupSharedFilesArray;
1148 //All shared files go in this list. Use
1149 // find /n "sharedfile" FirebirdInstall_20.iss
1150 //to list them in the order they appear in the setup script
1151 // Shared Files are defined as either:
1152 // - Files which are absolutely necessary for a functioning installation.
1153 // Hence gbak and gfix are shared files, isql and qli are not
1154 // - Libraries
1155 // - License files
1156 begin
1157 SetArrayLength(SharedFileArray,37);
1158
1159 SharedFileArray[0].Filename := ExpandConstant('{app}')+'IPLicense.txt';
1160 SharedFileArray[1].Filename := ExpandConstant('{app}')+'IDPLicense.txt';
1161 SharedFileArray[2].Filename := ExpandConstant('{app}')+'firebird.msg';
1162 SharedFileArray[3].Filename := ExpandConstant('{app}')+'gbak.exe';
1163 SharedFileArray[4].Filename := ExpandConstant('{app}')+'gfix.exe';
1164 SharedFileArray[5].Filename := ExpandConstant('{app}')+'gsec.exe';
1165 SharedFileArray[6].Filename := ExpandConstant('{app}')+'gsplit.exe';
1166 SharedFileArray[7].Filename := ExpandConstant('{app}')+'gstat.exe';
1167 SharedFileArray[8].Filename := ExpandConstant('{app}')+'fbguard.exe';
1168 SharedFileArray[9].Filename := ExpandConstant('{app}')+'fb_lock_print.exe';
1169 SharedFileArray[10].Filename := ExpandConstant('{app}')+'firebird.exe';
1170 SharedFileArray[11].Filename := ExpandConstant('{app}')+'ib_util.dll';
1171 SharedFileArray[12].Filename := ExpandConstant('{app}')+'instclient.exe';
1172 SharedFileArray[13].Filename := ExpandConstant('{app}')+'instreg.exe';
1173 SharedFileArray[14].Filename := ExpandConstant('{app}')+'instsvc.exe';
1174
1175 SharedFileArray[15].Filename := ExpandConstant('{sys}')+'gds32.dll';
1176 SharedFileArray[16].Filename := ExpandConstant('{sys}')+'fbclient.dll';
1177
1178 SharedFileArray[17].Filename := ExpandConstant('{app}')+'fbclient.dll';
1179
1180 SharedFileArray[18].Filename := ExpandConstant('{app}')+'icuuc30.dll';
1181 SharedFileArray[19].Filename := ExpandConstant('{app}')+'icuin30.dll';
1182 SharedFileArray[20].Filename := ExpandConstant('{app}')+'icudt30.dll';
1183
1184 SharedFileArray[21].Filename := ExpandConstant('{app}')+'msvcrt.dll';
1185 SharedFileArray[22].Filename := ExpandConstant('{app}')+'msvcr{#msvc_version}0.dll';
1186
1187 SharedFileArray[23].Filename := ExpandConstant('{app}')+'fbintl.dll';
1188 SharedFileArray[24].Filename := ExpandConstant('{app}')+'UDF\ib_udf.dll';
1189 SharedFileArray[25].Filename := ExpandConstant('{app}')+'UDF\fbudf.dll';
1190
1191
1192 if UsingWinNT then
1193 SharedFileArray[26].Filename := ExpandConstant('{sys}')+'Firebird2Control.cpl'
1194 else
1195 SharedFileArray[26].Filename := ExpandConstant('{sys}')+'FIREBI~1.CPL';
1196
1197 SharedFileArray[27].Filename := ExpandConstant('{app}')+'databases.conf';
1198 SharedFileArray[28].Filename := ExpandConstant('{app}')+'firebird.conf';
1199 SharedFileArray[29].Filename := ExpandConstant('{app}')+'firebird.log';
1200 SharedFileArray[30].Filename := ExpandConstant('{app}')+'security{#FB_MAJOR_VER}.fdb';
1201 SharedFileArray[31].Filename := ExpandConstant('{app}')+'fbtrace.conf';
1202 SharedFileArray[32].Filename := ExpandConstant('{app}')+'fbsvcmgr.exe';
1203 SharedFileArray[33].Filename := ExpandConstant('{app}')+'fbrmclib.dll';
1204 SharedFileArray[34].Filename := ExpandConstant('{app}')+'fbtracemgr.exe';
1205 SharedFileArray[35].Filename := ExpandConstant('{app}')+'zlib1.dll';
1206 SharedFileArray[36].Filename := ExpandConstant('{app}')+'replication.conf';
1207
1208 // FIXME
1209 // Add in WOW64 here.
1210
1211 end;
1212
1213
1214
1215 procedure GetSharedLibCountBeforeCopy;
1216 var
1217 dw: Cardinal;
1218 i: Integer;
1219 begin
1220 for i:= 0 to GetArrayLength(SharedFileArray)-1 do begin
1221 if RegQueryDWordValue(HKEY_LOCAL_MACHINE,
1222 'SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs',SharedFileArray[i].filename, dw) then
1223 SharedFileArray[i].Count := dw
1224 else
1225 SharedFileArray[i].Count := 0;
1226 end;
1227 end;
1228
1229
1230 procedure CheckSharedLibCountAtEnd;
1231 // If a shared file exists on disk (from a manual install perhaps?) then
1232 // the Installer will set the SharedFile count to 2 even if no registry
1233 // entry exists. Is it a bug, an anomaly or a WAD?
1234 // Is it InnoSetup or the O/S?
1235 // Anyway, let's work around it, otherwise the files will appear 'sticky'
1236 // after an uninstall.
1237
1238 var
1239 dw: cardinal;
1240 i: Integer;
1241
1242 begin
1243 for i:= 0 to GetArrayLength(SharedFileArray)-1 do begin
1244 if RegQueryDWordValue(HKEY_LOCAL_MACHINE,
1245 'SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs',SharedFileArray[i].Filename, dw) then begin
1246 if (( dw - SharedFileArray[i].Count ) > 1 ) then begin
1247 dw := SharedFileArray[i].Count + 1 ;
1248 RegWriteDWordValue(HKEY_LOCAL_MACHINE,
1249 'SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs',SharedFileArray[i].Filename, dw);
1250 end;
1251 end;
1252 end;
1253 end;
1254
1255
1256 ///===================================================
1257 var
1258 InterBaseVer: Array of Integer;
1259 FirebirdVer: Array of Integer;
1260
1261
1262 function GetFirebirdDir: string;
1263 //Check if Firebird installed, get version info to global var and return root dir
1264 var
1265 FirebirdDir: String;
1266 begin
1267 FirebirdDir := '';
1268 FirebirdVer := [0,0,0,0];
1269 RegQueryStringValue(HKEY_LOCAL_MACHINE,
1270 'SOFTWARE\Firebird Project\Firebird Server\Instances','DefaultInstance', FirebirdDir);
1271 //If nothing returned then check for the registry entry used during beta/RC phase
1272 if (FirebirdDir='') then
1273 RegQueryStringValue(HKEY_LOCAL_MACHINE,
1274 'SOFTWARE\FirebirdSQL\Firebird\CurrentVersion','RootDirectory', FirebirdDir);
1275 if (FirebirdDir<>'') then
1276 GetInstalledVersion(FirebirdDir+'\gbak.exe', FirebirdVer);
1277
1278 Result := FirebirdDir;
1279 end;
1280
1281
1282
1283 function GetInterBaseDir: string;
1284 //Check if InterBase installed, get version info to global var and return root dir
1285 var
1286 InterBaseDir: String;
1287 begin
1288 InterBaseDir := '';
1289 InterBaseVer := [0,0,0,0];
1290 RegQueryStringValue(HKEY_LOCAL_MACHINE,
1291 'SOFTWARE\Borland\InterBase\CurrentVersion','RootDirectory', InterBaseDir);
1292 if ( InterBaseDir <> '' ) then
1293 GetInstalledVersion(InterBaseDir+'\gbak.exe',InterBaseVer);
1294
1295 Result := InterBaseDir;
1296 end;
1297
1298
1299 function IsServerInstall: Boolean;
1300 begin
1301 if WizardIsComponentSelected('ServerComponent') then
1302 Result := true
1303 else
1304 Result := False;
1305 end;
1306
1307
1308 function IsNotServerInstall: Boolean;
1309 begin
1310 if IsServerInstall then
1311 Result := False
1312 else
1313 Result := True;
1314 end;
1315
1316
1317 function ConfigureFirebird: boolean;
1318 begin
1319 Result := (InstallAndConfigure AND Configure) = Configure;
1320 end;
1321
1322
1323 function FirebirdOneRunning: boolean;
1324 var
1325 i: Integer;
1326 begin
1327 result := false;
1328
1329 //Look for a running copy of InterBase or Firebird 1.0.
1330 i:=0;
1331 i:=FindWindowByClassName('IB_Server') ;
1332 if ( i<>0 ) then
1333 result := true;
1334 end;
1335
1336
1337 //Detect server running with default ClassName or mutex
1338 var
1339 RunningServerVerString: String;
1340
1341 function FirebirdDefaultServerRunning: Boolean;
1342 var
1343 Handle: Integer;
1344 mutex_found: boolean;
1345 mutexes: String;
1346 begin
1347 RunningServerVerString := '';
1348 Result := false;
1349
1350 if FirebirdOneRunning then
1351 RunningServerVerString := 'Firebird v1.0 / InterBase';
1352
1353 //Look for a valid window handle
1354 if RunningServerVerString = '' then begin
1355 //This is effectivley a test for Firebird running as an application.
1356 //This is useful if Firebird is running without the guardian
1357 //because prior to v2.0.4 there is no server mutex.
1358 Handle := FindWindowByClassName('FB_Disabled');
1359 if ( Handle = 0 ) then
1360 Handle := FindWindowByClassName('FB_Server');
1361 if ( Handle = 0 ) then
1362 Handle := FindWindowByClassName('FB_Guard');
1363
1364 if (Handle > 0) then
1365 RunningServerVerString := 'Firebird';
1366 end;
1367
1368 //Look for a firebird mutex
1369 if RunningServerVerString = '' then begin
1370 //General Notes on testing for mutexes:
1371 // - Mutexes are case-sensitive.
1372 // - Don't escape the slash in Global\, Local\ etc. (We don't currently use Local\)
1373 //
1374 // v2.0 notes
1375 // - v2.0 prior to 2.0.4 does not create a FirebirdServerMutex mutex,
1376 // so server running without guardian is not detected.
1377 // - v2.0.4 creates mutexes without the global prefix.
1378 // - Later versions (if any) will use the prefix, so we will test for them anyway.
1379 mutexes := 'Global\FirebirdGuardianMutex' + ',' +
1380 'Global\FirebirdServerMutex' + ',' +
1381 'FirebirdGuardianMutex' + ',' +
1382 'FirebirdServerMutex';
1383 mutex_found := CheckForMutexes(mutexes);
1384
1385 if mutex_found then
1386 RunningServerVerString := 'Firebird';
1387 end;
1388
1389 if RunningServerVerString = '' then begin
1390 //v2.1.1 notes
1391 // - v2.1.0 creates mutexes without the global prefix.
1392 // - v2.1.1 and later should use the correct prefix.
1393 mutexes := 'Global\FirebirdGuardianMutexDefaultInstance' + ',' +
1394 'Global\FirebirdServerMutexDefaultInstance' + ',' +
1395 'FirebirdGuardianMutexDefaultInstance' + ',' +
1396 'FirebirdServerMutexDefaultInstance';
1397 mutex_found := CheckForMutexes(mutexes);
1398
1399 if mutex_found then
1400 RunningServerVerString := 'Firebird v2.1 or later'
1401 end;
1402
1403 if RunningServerVerString <> '' then
1404 Result := True;
1405
1406 end;
1407
1408
1409 function InstallCPLApplet: boolean;
1410 begin
1411 result := False;
1412 //For now, cpl applet is broken - it cannot install a service correctly
1413 // and it cannot run fb as a multi-client app.
1414 #ifdef cplapplet_fixed
1415 if ( (ConfigureFirebird) AND (not NoCPL) ) then
1416 result := IsTaskSelected('UseSuperServerTask\InstallCPLAppletTask') ;
1417 #endif
1418 end;
1419
1420
1421 function ShowInstallCPLAppletTask: boolean;
1422 begin
1423 // result := ((not NoCPL) and ConfigureFirebird);
1424 result := false;
1425 end;
1426
1427
1428 function InstallGuardian: boolean;
1429 begin
1430 result := False;
1431 if (ConfigureFirebird) then
1432 result := WizardIsTaskSelected('UseSuperServerTask\UseGuardianTask')
1433 or WizardIsTaskSelected('UseSuperClassicTask\UseGuardianTask');
1434 end;
1435
1436
1437 function CopyGds32: boolean;
1438 begin
1439 result := False;
1440 if ConfigureFirebird then begin
1441 result := ( WizardIsTaskSelected( 'CopyFbClientAsGds32Task' ) );
1442 end;
1443 end;
1444
1445
1446 function ShowCopyGds32Task: boolean;
1447 begin
1448 result := ( ConfigureFirebird );
1449 end;
1450
1451
1452 function CopyFbClientLib: boolean;
1453 begin
1454 result := ( WizardIsTaskSelected( 'CopyFbClientToSysTask' ) );
1455 end;
1456
1457
1458 function ShowCopyFbClientLibTask: boolean;
1459 //See note for ShowCopyGds32Task.
1460 begin
1461 result := False;
1462 if ConfigureFirebird then
1463 result := ( ConfigureFirebird );
1464 end;
1465
1466
1467 function ConfigureAuthentication: boolean;
1468 // This function should only be called once - when the innosetup installer tries to
1469 // install the secdb. If it is called a second time it will always find the secdb
1470 // exists, even if it hasn't been configured. The only real way to test whether we
1471 // should configure authentication is to actually _open_ a database and read the
1472 // sec$users table. Except we cannot do that as we need this information before we
1473 // install the files needed to read the database.
1474 begin
1475 // if it is the first time we are called test for existence of the security db
1476 if init_secdb = UNDEFINED then begin
1477 if FileExists(WizardDirValue + '\security{#FB_MAJOR_VER}.fdb') then
1478 Result := false
1479 else
1480 Result := true
1481 end
1482 else
1483 // else the result is the current setting of init_secdb
1484 Result := Boolean(init_secdb);
1485
1486 // Whatever the result, cast it to an integer and update init_secdb
1487 init_secdb := Integer(Result);
1488
1489 end;
1490
1491
1492 function HasWI30: boolean;
1493 //We need at least Windows Installer 3.0 available if we
1494 //are installing the msi bundles for the VC10 CRT libraries.
1495 var
1496 VersionStr: String;
1497 VerInt: array of Integer;
1498 begin
1499 Result := False;
1500 VersionStr := WIVersion;
1501 DecodeVersion(VersionStr, VerInt);
1502 if (VerInt[0] >= 3) then
1503 Result := True;
1504 end;
1505
1506
1507 function HasNotWI30: boolean;
1508 //Used to check if O/S does NOT have minimum version of Windows Installer
1509 begin
1510 result := NOT HasWI30;
1511 end;
1512
1513 // kate: replace-tabs on; indent-width 2; tab-width 2; replace-tabs-save on; syntax Pascal;
1514