-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit1.pas
116 lines (84 loc) · 2.77 KB
/
Unit1.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
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
labelStatus: TLabel;
lbMessage: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
function SecureEngineInitialize(): Boolean; stdcall;
function SecureEngineFinalize(): Boolean; stdcall;
function SecureEngineShowCustomMessageA(MsgId: Integer; pMsg:PAnsiChar):Boolean; stdcall;
function SecureEngineGetEncryptionKey(ZoneId: Integer; pOutputEncryptionKey:PAnsiChar):Boolean; stdcall;
procedure SecureEngineGetProtectedFileNameW(pName: PWideChar); stdcall;
function SecureEngineGetFingerPrintW(pName: PWideChar):Boolean; stdcall;
exports
SecureEngineInitialize,
SecureEngineShowCustomMessageA,
SecureEngineGetEncryptionKey,
SecureEngineGetProtectedFileNameW,
SecureEngineGetFingerPrintW,
SecureEngineFinalize;
implementation
{$R *.dfm}
function SecureEngineInitialize(): Boolean;
begin
Form1 := TForm1.Create(application);
Form1.LabelStatus.Caption := 'SecureEngineInitialize';
Form1.labelStatus.Width := Form1.Width;
Form1.ShowModal;
Result := True;
end;
function SecureEngineFinalize(): Boolean;
begin
Form1 := TForm1.Create(application);
Form1.LabelStatus.Caption := 'SecureEngineFinalize';
Form1.labelStatus.Width := Form1.Width;
Form1.ShowModal;
Result := True;
end;
procedure SecureEngineGetProtectedFileNameW(pName: PWideChar);
begin
Form1 := TForm1.Create(application);
Form1.LabelStatus.Caption := 'SecureEngineGetProtectedFileNameW: ' + WideString(pName);
Form1.labelStatus.Width := Form1.Width;
Form1.ShowModal;
end;
function SecureEngineGetFingerPrintW(pName: PWideChar):Boolean;
begin
Form1 := TForm1.Create(application);
Form1.LabelStatus.Caption := 'SecureEngineGetFingerPrintW: ' + WideString(pName);
Form1.labelStatus.Width := Form1.Width;
Form1.ShowModal;
Result := True;
end;
function SecureEngineShowCustomMessageA(MsgId: Integer; pMsg:PAnsiChar):Boolean;
begin
Form1 := TForm1.Create(application);
Form1.LabelStatus.Caption := 'Calling Message (A): ' + IntToStr(MsgId);
if pMsg <> nil then
Form1.lbMessage.Caption := 'Original Message: ' + AnsiString(pMsg);
Form1.labelStatus.Width := Form1.Width;
Form1.ShowModal;
Result := True;
end;
function SecureEngineGetEncryptionKey(ZoneId: Integer; pOutputEncryptionKey:PAnsiChar):Boolean;
begin
StrCopy(pOutputEncryptionKey, 'My Encryption Key');
Result := True;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Close;
end;
end.