1 |
torben |
2671 |
(* ***** BEGIN LICENSE BLOCK *****
|
2 |
|
|
* Version: MPL 1.1
|
3 |
|
|
*
|
4 |
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
5 |
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
6 |
|
|
* the License. You may obtain a copy of the License at
|
7 |
|
|
* http://www.mozilla.org/MPL/
|
8 |
|
|
*
|
9 |
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
10 |
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11 |
|
|
* for the specific language governing rights and limitations under the
|
12 |
|
|
* License.
|
13 |
|
|
*
|
14 |
|
|
* The Original Code is TurboPower SysTools
|
15 |
|
|
*
|
16 |
|
|
* The Initial Developer of the Original Code is
|
17 |
|
|
* TurboPower Software
|
18 |
|
|
*
|
19 |
|
|
* Portions created by the Initial Developer are Copyright (C) 1996-2002
|
20 |
|
|
* the Initial Developer. All Rights Reserved.
|
21 |
|
|
*
|
22 |
|
|
* Contributor(s):
|
23 |
|
|
*
|
24 |
|
|
* ***** END LICENSE BLOCK ***** *)
|
25 |
|
|
|
26 |
|
|
{*********************************************************}
|
27 |
|
|
{* _STFIN.PAS 3.00 *}
|
28 |
|
|
{*********************************************************}
|
29 |
|
|
|
30 |
|
|
{$I STDEFINE.INC}
|
31 |
|
|
{$I STCOMDEF.INC}
|
32 |
|
|
unit _StFin;
|
33 |
|
|
|
34 |
|
|
interface
|
35 |
|
|
|
36 |
|
|
uses
|
37 |
|
|
ComObj, ActiveX, SysTools_TLB, StdVcl;
|
38 |
|
|
|
39 |
|
|
type
|
40 |
|
|
TStFin = class(TAutoObject, IStFin)
|
41 |
|
|
private
|
42 |
|
|
FIsLicensed : Boolean;
|
43 |
|
|
public
|
44 |
|
|
procedure Initialize; override;
|
45 |
|
|
protected
|
46 |
|
|
function IsCardValid(const S: WideString): WordBool; safecall;
|
47 |
|
|
function License(const Key: WideString): WordBool; safecall;
|
48 |
|
|
{ Protected declarations }
|
49 |
|
|
end;
|
50 |
|
|
|
51 |
|
|
implementation
|
52 |
|
|
|
53 |
|
|
uses ComServ, StFin {$IFDEF LICENSE}, StComLic {$ENDIF};
|
54 |
|
|
|
55 |
|
|
procedure TStFin.Initialize;
|
56 |
|
|
begin
|
57 |
|
|
inherited Initialize;
|
58 |
|
|
{$IFDEF LICENSE}
|
59 |
|
|
FIsLicensed := False;
|
60 |
|
|
{$ELSE}
|
61 |
|
|
FIsLicensed := True;
|
62 |
|
|
{$ENDIF}
|
63 |
|
|
end;
|
64 |
|
|
|
65 |
|
|
function TStFin.IsCardValid(const S: WideString): WordBool;
|
66 |
|
|
begin
|
67 |
|
|
{$IFDEF LICENSE}
|
68 |
|
|
if (not FIsLicensed) or (not COMHasBeenLicensed) then
|
69 |
|
|
OleError(CLASS_E_NOTLICENSED);
|
70 |
|
|
{$ENDIF}
|
71 |
|
|
Result := StFin.IsCardValid(S);
|
72 |
|
|
end;
|
73 |
|
|
|
74 |
|
|
function TStFin.License(const Key: WideString): WordBool;
|
75 |
|
|
begin
|
76 |
|
|
{$IFDEF LICENSE}
|
77 |
|
|
Result := COMIsValidKey(Key);
|
78 |
|
|
{$ELSE}
|
79 |
|
|
Result := True;
|
80 |
|
|
{$ENDIF}
|
81 |
|
|
FIsLicensed := Result;
|
82 |
|
|
end;
|
83 |
|
|
|
84 |
|
|
initialization
|
85 |
|
|
TAutoObjectFactory.Create(ComServer, TStFin, Class_StFin,
|
86 |
|
|
ciMultiInstance, tmBoth);
|
87 |
|
|
end.
|