一个DLL中,内部函数调用内部函数的错误,望高手指较! 在线......
library ConAdo;
uses
ShareMem,
SysUtils,
Registry,
Windows,
Dialogs,
Classes;
const
C1 = 52845;
C2 = 22719;
{$R *.res}
Function ConnAdo:string;stdcall;
var Provider,Password,Info,ID,Dbname,DataSource:string;
ConnString:string;
temp:TRegistry;
begin
temp:=TRegistry.Create;
try
with temp do
begin
rootkey:=HKEY_LOCAL_MACHINE;
openkey('SOFTWARE\ADO.NET\SETTINGS',false);
Provider:=ReadString('Provider');
Password:=ReadString('Password');
Password:=Decrypt(Password);
Info:=ReadString('Persist Security Info');
ID:=ReadString('User ID');
Dbname:=ReadString('Initial Catalog');
DataSource:=ReadString('Data Source');
end;
Connstring := 'Provider='+Provider+';';
Connstring := Connstring + 'Password='+Password+';';
Connstring := Connstring + 'Persist Security Info='+Info+';';
Connstring := Connstring + 'User ID=' + ID+';';
Connstring := Connstring + 'Initial Catalog=' + Dbname+';';
Connstring := Connstring + 'Data Source=' + DataSource+';';
result:=Connstring;
finally
temp.free;
end;
end;
exports ConnAdo;
function Decrypt(S: string): string;
var
i: Integer;
j: Integer;
Key: Word;
begin
result := '';
for i := 1 to (Length(s) div 2) do
begin
j := (Integer(s[2 * i - 1]) - 65) * 26;
j := j + (Integer(s[2 * i]) - 65);
result := result + Char(j);
end;
s := Result;
for i := 1 to Length(S) do
begin
Result[i] := char(byte(S[I]) xor (Key shr 8));
Key := (byte(S[I]) + Key) * C1 + C2;
end;
end;
begin
end.
Password:=Decrypt(Password);这行为什么会报错:
[Error] ConAdo.dpr(29): Undeclared identifier: 'Decrypt'