forked from madorin/fibplus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
IB_Install.pas
737 lines (651 loc) · 22.7 KB
/
IB_Install.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
{***************************************************************}
{ FIBPlus - component library for direct access to Firebird and }
{ InterBase databases }
{ }
{ FIBPlus is based in part on the product }
{ Free IB Components, written by Gregory H. Deatz for }
{ Hoagland, Longo, Moran, Dunst & Doukas Company. }
{ mailto:[email protected] }
{ }
{ Copyright (c) 1998-2013 Devrace Ltd. }
{ Written by Serge Buzadzhy ([email protected]) }
{ }
{ ------------------------------------------------------------- }
{ FIBPlus home page: http://www.fibplus.com/ }
{ FIBPlus support : http://www.devrace.com/support/ }
{ ------------------------------------------------------------- }
{ }
{ Please see the file License.txt for full license information }
{***************************************************************}
unit IB_Install;
interface
{$I FIBPlus.inc}
uses
TypInfo, SysUtils, Classes, IB_InstallHeader, IB_Intf;
type
TIscError = MSG_NO;
TIBInstallerError = (ieSuccess,
ieDelphiException,
ieNoOptionsSet,
ieNoDestinationDirectory,
ieNosourceDirectory,
ieNoUninstallFile,
ieOptionNeedsClient,
ieOptionNeedsServer,
ieInvalidOption,
ieInvalidOnErrorResult,
ieInvalidOnStatusResult);
TMainOption = (moServer,
moClient,
moConServer,
moGuiTools,
moDocumentation,
moDevelopment);
TExamplesOption = (exDB, exAPI);
TCmdOption = (cmDBMgmt, cmDBQuery, cmUsrMgmt);
TConnectivityOption = (cnODBC, cnOLEDB, cnJDBC);
TMainOptions = set of TMainOption;
TExamplesOptions = set of TExamplesOption;
TCmdOptions = set of TCmdOption;
TConnectivityOptions = set of TConnectivityOption;
TErrorResult = (erAbort, erContinue, erRetry);
TStatusResult = (srAbort, srContinue);
TWarningResult = (wrAbort, wrContinue);
TpFIBSetupOnStatus = function(Sender : TObject; StatusComment : string):
TStatusResult of object;
TpFIBSetupOnWarning = function(Sender :TObject; WarningCode: TIscError;
WarningMessage : string): TWarningResult of object;
TpFIBSetupOnError = function (Sender : TObject; IscCode : TIscError;
ErrorMessage, ErrorComment : string):
TErrorResult of object;
EIBInstall = class(Exception)
private
FIscError : MSG_NO;
FInstallerError : TIBInstallerError;
public
constructor Create(IscCode : MSG_NO; IscMessage : string); virtual;
constructor Create1(ECode : TIBInstallerError; EMessage : string);virtual;
property InstallError : MSG_NO read FIscError;
property InstallerError : TIBInstallerError read FInstallerError;
end;
EIBInstallError = class(EIBInstall);
EIBInstallerError = class(EIBInstall);
TInstallOptions = class(TPersistent)
private
FMainComponents : TMainOptions;
FExamples: TExamplesOptions;
FCmdLineTools: TCmdOptions;
FConnectivityClients: TConnectivityOptions;
published
property MainComponents : TMainOptions read FMainComponents write FMainComponents;
property CmdLineTools: TCmdOptions read FCmdLineTools write FCmdLineTools;
property ConnectivityClients: TConnectivityOptions read FConnectivityClients
write FConnectivityClients;
property Examples: TExamplesOptions read FExamples write FExamples;
end;
TpFIBSetup = class(TComponent)
private
FIBInstallLoaded: Boolean;
FRebootToComplete: Boolean;
FProgress: Integer;
FMsgFilePath: string;
FOnStatusChange: TpFIBSetupOnStatus;
FStatusContext : Pointer;
FOnError: TpFIBSetupOnError;
FErrorContext : Pointer;
FOnWarning: TpFIBSetupOnWarning;
procedure SetMsgFilePath(const Value: string);
protected
function StatusInternal(Status: Integer; const ActionDescription: TEXT):Integer;
function ErrorInternal(IscCode: MSG_NO; const ActionDescription: TEXT): Integer;
procedure Call(IscCode: MSG_NO);
procedure IBInstallError(IscCode: MSG_NO);
function GetInstallMessage(IscCode : MSG_NO) : string;
public
constructor Create(AOwner : TComponent); override;
property RebootToComplete : Boolean read FRebootToComplete;
property Progress : Integer read FProgress;
property StatusContext : Pointer read FStatusContext write FStatusContext;
property ErrorContext : Pointer read FErrorContext write FErrorContext;
property MsgFilePath: string read FMsgFilePath write SetMsgFilePath;
published
property OnWarning: TpFIBSetupOnWarning read FOnWarning write FOnWarning;
property OnError: TpFIBSetupOnError read FOnError write FOnError;
property OnStatusChange: TpFIBSetupOnStatus read FOnStatusChange write FOnStatusChange;
end;
TpFIBInstall = class(TpFIBSetup)
private
FUnInstallFile: string;
FSourceDir: string;
FDestinationDir: string;
FSuggestedDestination: string;
FInstallOptions: TInstallOptions;
procedure GetOptionProperty(InfoType : Integer; Option : TExamplesOption;
Buffer : Pointer; BufferLen : Cardinal);
procedure GetOptionProperty1(InfoType : Integer; Option : TMainOption;
Buffer : Pointer; BufferLen : Cardinal);
procedure GetOptionProperty2(InfoType : Integer; Option : TConnectivityOption;
Buffer : Pointer; BufferLen : Cardinal);
procedure GetOptionProperty3(InfoType : Integer; Option : TCmdOption;
Buffer : Pointer; BufferLen : Cardinal);
procedure InternalSetOptions(pHandle : POPTIONS_HANDLE);
procedure SetDestination(const Value: string);
procedure SetSource(const Value: string);
procedure SetInstallOptions(const Value: TInstallOptions);
procedure SuggestDestination;
public
Constructor Create(AOwner: TComponent); override;
Destructor Destroy; override;
procedure InstallCheck;
procedure InstallExecute;
function GetOptionDescription (Option : TExamplesOption): string;
function GetOptionDescription1 (Option : TMainOption) : string;
function GetOptionDescription2 (Option : TConnectivityOption) : string;
function GetOptionDescription3 (Option : TCmdOption) :string;
function GetOptionName (Option : TExamplesOption): string;
function GetOptionName1 (Option : TMainOption) :string;
function GetOptionName2 (Option : TConnectivityOption) : string;
function GetOptionName3 (Option : TCmdOption) : string;
function GetOptionSpaceRequired (Option : TExamplesOption): cardinal;
function GetOptionSpaceRequired1 (Option : TMainOption): cardinal;
function GetOptionSpaceRequired2 (Option : TConnectivityOption): cardinal;
function GetOptionSpaceRequired3 (Option : TCmdOption): cardinal;
property UnInstallFile: string read FUnInstallFile;
property SuggestedDestination: string read FSuggestedDestination;
published
property SourceDirectory: string read FSourceDir write SetSource;
property DestinationDirectory: string read FDestinationDir write SetDestination;
property InstallOptions: TInstallOptions read FInstallOptions write SetInstallOptions;
end;
TpFIBUnInstall = class(TpFIBSetup)
private
FUnInstallFile: string;
public
procedure UnInstallCheck;
procedure UnInstallExecute;
property UnInstallFile: string read FUnInstallFile write FUnInstallFile;
end;
implementation
uses FIBConsts;
const
IBInstallerMessages : array[TIBInstallerError] of string = (
SSuccess,
SDelphiException,
SNoOptionsSet,
SNoDestinationDirectory,
SNosourceDirectory,
SNoUninstallFile,
SOptionNeedsClient,
SOptionNeedsServer,
SInvalidOption,
SInvalidOnErrorResult,
SInvalidOnStatusResult
);
{$DEFINE FP_STDCALL}
procedure IBInstallerError(ECode: TIBInstallerError; const Args: array of const);
begin
raise EIBInstallerError.Create1(ECode, Format(IBInstallerMessages[ECode], Args));
end;
function ErrorCallback(IscCode: MSG_NO; UserContext: Pointer; const ActionDescription:
TEXT): Integer;{$I pFIBMacroComp.inc}
begin
Result := TpFIBSetup(UserContext).ErrorInternal(IscCode, ActionDescription);
end;
function StatusCallback(Status : Integer; UserContext: Pointer; const ActionDescription:
TEXT): Integer; {$I pFIBMacroComp.inc}
begin
Result := TpFIBSetup(UserContext).StatusInternal(Status, ActionDescription);
end;
{ TpFIBSetup }
function TpFIBSetup.ErrorInternal(IscCode: MSG_NO; const ActionDescription: TEXT):
Integer;
var
ErrorComment : string;
begin
if(ActionDescription <> nil) and (ActionDescription[0] <> #0) then
begin
SetLength(ErrorComment, StrLen(ActionDescription));
StrCopy(PChar(ErrorComment), ActionDescription);
end
else
ErrorComment := '';
if(Isccode = isc_install_fp_copy_delayed) or
(Isccode = isc_install_fp_delete_delayed) then
begin
FRebootToComplete := True;
Result := isc_install_fp_continue;
exit;
end;
if Assigned(FOnError) then
case FOnError(self, IscCode, GetInstallMessage(IscCode), ErrorComment) of
erAbort:
Result := isc_install_fp_abort;
erContinue:
Result := isc_install_fp_continue;
erRetry:
Result := isc_install_fp_retry;
else
Result := isc_install_fp_abort;
end
else
Result := isc_install_fp_abort;
end;
function TpFIBSetup.StatusInternal(Status: Integer; const ActionDescription: TEXT):
Integer;
var
StatusComment : string;
begin
FProgress := Status;
if(ActionDescription <> nil) and (ActionDescription[0] <> #0) then
begin
SetLength(StatusComment, StrLen(ActionDescription));
StrCopy(PChar(StatusComment), ActionDescription);
end
else
StatusComment := '';
if Assigned(FOnStatusChange) then
case FOnStatusChange(self, StatusComment) of
srAbort:
Result := isc_install_fp_abort;
srContinue:
Result := isc_install_fp_continue;
else
Result := isc_install_fp_continue;
end
else
Result := isc_install_fp_continue;
end;
procedure TpFIBSetup.SetMsgFilePath(const Value: string);
begin
if FMsgFilePath <> Value then
begin
Call(isc_install_load_external_text(PChar(Value)));
FMsgFilePath := Value;
end;
end;
procedure TpFIBSetup.Call(IscCode: MSG_NO);
begin
Set8087CW(Default8087CW);
if IscCode = isc_install_success then
Exit;
if IscCode < isc_install_success then
begin
if Assigned(FOnWarning) then
begin
if FOnWarning(self, IscCode, GetInstallMessage(IscCode)) = wrAbort then
IBInstallError(IscCode);
Exit;
end
else
IBInstallError(IscCode);
end;
IBInstallError(IscCode);
end;
procedure TpFIBSetup.IBInstallError(IscCode: MSG_NO);
begin
raise EIBInstallError.Create(IscCode, GetInstallMessage(IscCode));
end;
function TpFIBSetup.GetInstallMessage(IscCode : MSG_NO) : string;
var
status : MSG_NO;
IscMessage : string;
begin
SetLength(IscMessage, ISC_INSTALL_MAX_MESSAGE_LEN * 2);
status := isc_install_get_message(0, IscCode, PChar(IscMessage),
ISC_INSTALL_MAX_MESSAGE_LEN * 2);
if status <> isc_install_success then
isc_install_get_message(0, status, PChar(IscMessage),
ISC_INSTALL_MAX_MESSAGE_LEN * 2);
SetLength(IscMessage, StrLen(PChar(IscMessage)));
result := IscMessage;
end;
constructor TpFIBSetup.Create(AOwner : TComponent);
begin
inherited Create(AOwner);
FIBInstallLoaded := False;
CheckIBInstallLoaded;
FIBInstallLoaded := True;
FRebootToComplete := False;
FProgress := 0;
end;
{ TpFIBInstall }
constructor TpFIBInstall.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FIBInstallLoaded := False;
CheckIBInstallLoaded;
FIBInstallLoaded := True;
FInstallOptions := TInstallOptions.Create;
SuggestDestination;
end;
destructor TpFIBInstall.Destroy;
begin
if FIBInstallLoaded then
FInstallOptions.Free;
inherited;
end;
procedure TpFIBInstall.InstallCheck;
var
Handle : OPTIONS_HANDLE;
SrcDir, DestDir : PChar;
begin
Handle := 0;
InternalSetOptions(@Handle);
if FSourceDir = '' then
SrcDir := nil
else
SrcDir := PChar(FSourceDir);
if FDestinationDir = '' then
DestDir := nil
else
DestDir := PChar(FDestinationDir);
try
Call(isc_install_precheck(Handle, SrcDir, DestDir));
finally
isc_install_clear_options(@Handle);
end;
end;
procedure TpFIBInstall.InstallExecute;
var
Handle : OPTIONS_HANDLE;
begin
Handle := 0;
InternalSetOptions(@Handle);
if Handle = 0 then
IBInstallerError(ieNoOptionsSet, ['']);
try
SetLength(FUninstallFile, ISC_INSTALL_MAX_PATH);
Call(isc_install_execute(Handle, PChar(FSourceDir), PChar(FDestinationDir),
StatusCallback, Pointer(self), ErrorCallback,
Pointer(self), PChar(FUninstallFile)));
SetLength(FUninstallFile, StrLen(PChar(FUninstallFile)));
finally
isc_install_clear_options(@Handle);
end;
end;
procedure TpFIBInstall.InternalSetOptions(pHandle: POPTIONS_HANDLE);
begin
with FInstallOptions do
begin
if FMainComponents <> [] then
begin
if moClient in FMainComponents then
isc_install_set_option(pHandle, IB_CLIENT);
if moDevelopment in FMainComponents then
isc_install_set_option(pHandle, IB_DEV);
if moServer in FMainComponents then
isc_install_set_option(pHandle, IB_SERVER);
if moDocumentation in FMainComponents then
isc_install_set_option(pHandle, IB_DOC);
if moConServer in FMainComponents then
isc_install_set_option(pHandle, IB_CONNECTIVITY_SERVER);
if moGuiTools in FMainComponents then
isc_install_set_option(pHandle, IB_GUI_TOOLS);
end;
if FExamples <> [] then
begin
if exDB in FExamples then
isc_install_set_option(pHandle, IB_EXAMPLE_DB);
if exAPI in FExamples then
isc_install_set_option(pHandle, IB_EXAMPLE_API);
end;
if FCmdLineTools <> [] then
begin
if cmDBMgmt in FCmdLineTools then
isc_install_set_option(pHandle, IB_CMD_TOOLS_DB_MGMT);
if cmDBQuery in FCmdLineTools then
isc_install_set_option(pHandle, IB_CMD_TOOLS_DB_QUERY);
if cmUsrMgmt in FCmdLineTools then
isc_install_set_option(pHandle, IB_CMD_TOOLS_USR_MGMT);
end;
if FConnectivityClients <> [] then
begin
if cnODBC in FConnectivityClients then
isc_install_set_option(pHandle, IB_ODBC_CLIENT);
if cnOLEDB in FConnectivityClients then
isc_install_set_option(pHandle, IB_OLEDB_CLIENT);
if cnJDBC in FConnectivityClients then
isc_install_set_option(pHandle, IB_JDBC_CLIENT);
end;
end;
end;
procedure TpFIBInstall.SetDestination(const Value: string);
var
IscCode : MSG_NO;
begin
if Value <> '' then
begin
IscCode := isc_install_precheck(0, nil, PChar(Value));
if(IscCode > isc_install_success) then
IBInstallError(IscCode);
end;
FDestinationDir := Value;
end;
procedure TpFIBInstall.SetInstallOptions(const Value: TInstallOptions);
begin
if FInstallOptions <> Value then
FInstallOptions.Assign(Value);
end;
procedure TpFIBInstall.SetSource(const Value: string);
var
IscCode : MSG_NO;
begin
if Value <> '' then
begin
IscCode := isc_install_precheck(0, PChar(Value), nil);
if(IscCode > isc_install_success) then
IBInstallError(IscCode);
end;
FSourceDir := Value;
end;
procedure TpFIBInstall.SuggestDestination;
begin
SetLength(FSuggestedDestination, ISC_INSTALL_MAX_PATH);
Call(isc_install_get_info(isc_install_info_destination, 0, PChar(FSuggestedDestination),
ISC_INSTALL_MAX_PATH));
SetLength(FSuggestedDestination, StrLen(PChar(FSuggestedDestination)));
end;
function TpFIBInstall.GetOptionDescription(Option: TExamplesOption): string;
var
OptionDesc : string;
begin
SetLength(OptionDesc, ISC_INSTALL_MAX_MESSAGE_LEN);
GetOptionProperty(isc_install_info_opdescription, Option, PChar(OptionDesc),
ISC_INSTALL_MAX_MESSAGE_LEN);
SetLength(OptionDesc, StrLen(PChar(OptionDesc)));
Result := OptionDesc;
end;
function TpFIBInstall.GetOptionDescription3(Option: TCmdOption): string;
var
OptionDesc : string;
begin
SetLength(OptionDesc, ISC_INSTALL_MAX_MESSAGE_LEN);
GetOptionProperty3(isc_install_info_opdescription, Option, PChar(OptionDesc),
ISC_INSTALL_MAX_MESSAGE_LEN);
SetLength(OptionDesc, StrLen(PChar(OptionDesc)));
Result := OptionDesc;
end;
function TpFIBInstall.GetOptionDescription2(Option: TConnectivityOption): string;
var
OptionDesc : string;
begin
SetLength(OptionDesc, ISC_INSTALL_MAX_MESSAGE_LEN);
GetOptionProperty2(isc_install_info_opdescription, Option, PChar(OptionDesc),
ISC_INSTALL_MAX_MESSAGE_LEN);
SetLength(OptionDesc, StrLen(PChar(OptionDesc)));
Result := OptionDesc;
end;
function TpFIBInstall.GetOptionDescription1(Option: TMainOption): string;
var
OptionDesc : string;
begin
SetLength(OptionDesc, ISC_INSTALL_MAX_MESSAGE_LEN);
GetOptionProperty1(isc_install_info_opdescription, Option, PChar(OptionDesc),
ISC_INSTALL_MAX_MESSAGE_LEN);
SetLength(OptionDesc, StrLen(PChar(OptionDesc)));
Result := OptionDesc;
end;
function TpFIBInstall.GetOptionName(Option: TExamplesOption): string;
var
OptionName : string;
begin
SetLength(OptionName, ISC_INSTALL_MAX_MESSAGE_LEN);
GetOptionProperty(isc_install_info_opname, Option, PChar(OptionName),
ISC_INSTALL_MAX_MESSAGE_LEN);
SetLength(OptionName, StrLen(PChar(OptionName)));
Result := OptionName;
end;
function TpFIBInstall.GetOptionName3(Option: TCmdOption): string;
var
OptionName : string;
begin
SetLength(OptionName, ISC_INSTALL_MAX_MESSAGE_LEN);
GetOptionProperty3(isc_install_info_opname, Option, PChar(OptionName),
ISC_INSTALL_MAX_MESSAGE_LEN);
SetLength(OptionName, StrLen(PChar(OptionName)));
Result := OptionName;
end;
function TpFIBInstall.GetOptionName2(Option: TConnectivityOption): string;
var
OptionName : string;
begin
SetLength(OptionName, ISC_INSTALL_MAX_MESSAGE_LEN);
GetOptionProperty2(isc_install_info_opname, Option, PChar(OptionName),
ISC_INSTALL_MAX_MESSAGE_LEN);
SetLength(OptionName, StrLen(PChar(OptionName)));
Result := OptionName;
end;
function TpFIBInstall.GetOptionName1(Option: TMainOption): string;
var
OptionName : string;
begin
SetLength(OptionName, ISC_INSTALL_MAX_MESSAGE_LEN);
GetOptionProperty1(isc_install_info_opname, Option, PChar(OptionName),
ISC_INSTALL_MAX_MESSAGE_LEN);
SetLength(OptionName, StrLen(PChar(OptionName)));
Result := OptionName;
end;
function TpFIBInstall.GetOptionSpaceRequired(Option: TExamplesOption): cardinal;
var
OptionSpace : cardinal;
begin
GetOptionProperty(isc_install_info_opspace, Option, @OptionSpace,
Cardinal(SizeOf(OptionSpace)));
Result := OptionSpace;
end;
function TpFIBInstall.GetOptionSpaceRequired1(Option: TMainOption): cardinal;
var
OptionSpace : cardinal;
begin
GetOptionProperty1(isc_install_info_opspace, Option, @OptionSpace,
Cardinal(SizeOf(OptionSpace)));
Result := OptionSpace;
end;
function TpFIBInstall.GetOptionSpaceRequired2(Option: TConnectivityOption): cardinal;
var
OptionSpace : cardinal;
begin
GetOptionProperty2(isc_install_info_opspace, Option, @OptionSpace,
Cardinal(SizeOf(OptionSpace)));
Result := OptionSpace;
end;
function TpFIBInstall.GetOptionSpaceRequired3(Option: TCmdOption): cardinal;
var
OptionSpace : cardinal;
begin
GetOptionProperty3(isc_install_info_opspace, Option, @OptionSpace,
Cardinal(SizeOf(OptionSpace)));
Result := OptionSpace;
end;
procedure TpFIBInstall.GetOptionProperty1(InfoType: Integer; Option : TMainOption;
Buffer: Pointer; BufferLen : Cardinal);
var
IscOption : OPT;
begin
case Option of
moClient:
IscOption := IB_CLIENT;
moDevelopment:
IscOption := IB_DEV;
moServer:
IscOption := IB_SERVER;
moDocumentation:
IscOption := IB_DOC;
moGuiTools:
IscOption := IB_GUI_TOOLS;
else
IscOption := IB_CONNECTIVITY_SERVER;
end;
Call(isc_install_get_info(InfoType, IscOption, Buffer, BufferLen));
end;
procedure TpFIBInstall.GetOptionProperty(InfoType: Integer; Option: TExamplesOption;
Buffer: Pointer; BufferLen : Cardinal);
var
IscOption : OPT;
begin
case Option of
exDB:
IscOption := IB_EXAMPLE_DB;
else
IscOption := IB_EXAMPLE_API;
end;
Call(isc_install_get_info(InfoType, IscOption, Buffer, BufferLen));
end;
procedure TpFIBInstall.GetOptionProperty3(InfoType: Integer; Option: TCmdOption;
Buffer: Pointer; BufferLen : Cardinal);
var
IscOption : OPT;
begin
case Option of
cmDBMgmt:
IscOption := IB_CMD_TOOLS_DB_MGMT;
cmDBQuery:
IscOption := IB_CMD_TOOLS_DB_QUERY;
else
IscOption := IB_CMD_TOOLS_USR_MGMT;
end;
Call(isc_install_get_info(InfoType, IscOption, Buffer, BufferLen));
end;
procedure TpFIBInstall.GetOptionProperty2(InfoType: Integer; Option: TConnectivityOption;
Buffer: Pointer; BufferLen : Cardinal);
var
IscOption : OPT;
begin
case Option of
cnODBC:
IscOption := IB_ODBC_CLIENT;
cnOLEDB:
IscOption := IB_OLEDB_CLIENT;
else
IscOption := IB_JDBC_CLIENT;
end;
Call(isc_install_get_info(InfoType, IscOption, Buffer, BufferLen));
end;
{ TpFIBUnInstall }
procedure TpFIBUnInstall.UnInstallCheck;
begin
if FUninstallFile = '' then
IBInstallerError(ieNoUninstallFile, ['']);
Call(isc_uninstall_precheck(PChar(FUninstallFile)));
end;
procedure TpFIBUnInstall.UnInstallExecute;
begin
if FUninstallFile = '' then
IBInstallerError(ieNoUninstallFile, ['']);
Call(isc_uninstall_execute(PChar(FUninstallFile), StatusCallback, Pointer(self),
ErrorCallback, Pointer(self)));
end;
{ EIBInstall }
constructor EIBInstall.Create(IscCode: MSG_NO; IscMessage: string);
begin
inherited Create(IscMessage);
FIscError := IscCode;
FInstallerError := ieSuccess;
end;
constructor EIBInstall.Create1(ECode: TIBInstallerError; EMessage: string);
begin
inherited Create(EMessage);
FInstallerError := ECode;
FIscError := isc_install_success;
end;
end.