动态库test.dll
用C语言编写,支持各种编程语言调用。函数原型:
void fun(const char *in, char** out) in: 传入参数,为加密后的密文字符串。
out:传出参数,为解密后的返回明文字符串。
调用方法:
char** out
fun('ABCDEF',out)
以上是DLL说明;
我在程序中做如下调用
procedure discryptpassword (const instr : PChar ; var outstr : PPchar) ;stdcall;external'stkey.dll';
.
.
.
.
var
instr , outstr : string;
pin : PChar;
pout : PChar;
ppout : PPChar;
begin
instr := pwdlist[ComboBox1.ItemIndex]; //取加密的字符串
pin := Pchar(instr); pout := Pchar(outstr);
ppout := @pout ; showmessage(instr);
discryptpassword(pin , ppout); //解密
showmessage(outstr) ;
end;但是调用后的outstr 还是个空串,没有得到对应的明文.
用C语言编写,支持各种编程语言调用。函数原型:
void fun(const char *in, char** out) in: 传入参数,为加密后的密文字符串。
out:传出参数,为解密后的返回明文字符串。
调用方法:
char** out
fun('ABCDEF',out)
以上是DLL说明;
我在程序中做如下调用
procedure discryptpassword (const instr : PChar ; var outstr : PPchar) ;stdcall;external'stkey.dll';
.
.
.
.
var
instr , outstr : string;
pin : PChar;
pout : PChar;
ppout : PPChar;
begin
instr := pwdlist[ComboBox1.ItemIndex]; //取加密的字符串
pin := Pchar(instr); pout := Pchar(outstr);
ppout := @pout ; showmessage(instr);
discryptpassword(pin , ppout); //解密
showmessage(outstr) ;
end;但是调用后的outstr 还是个空串,没有得到对应的明文.
解决方案 »
- MD5验证数据库记录合法性
- ●●● 100本Delphi书籍下载...........................................
- DBGridEh中Float型字段输入-----报错,如何捕捉及处理
- 能否告知一下从pardox7.0导入到mssql的方法?用代码!
- 如何清空Sql server 2000数据库得某一个表格?
- delphi在移动控间的时候是怎么做的?
- Delphi 多摄像头同时显示问题
- 如何比较两个image 有相同的图
- Delphi实现球体上面均匀分布点
- 我用的TResourceStream的内容怎么不对?
- 这样的C++代码怎么转换为Delphi?
- ACCESS 高分急救,谁动了我的数据???
s:string;
outstr : PPchar;
begin
s:='212121';
discryptpassword (PChar(s) ,outStr );
end;
?
s:string;
outstr : PChar;
begin
try
outstr:=stralloc(1024);
s:='212121';
discryptpassword (PChar(s) ,outStr );
finally
strdispose(outstr);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
type
TAddNumber=function(Num1,Num2:Integer):Integer;stdcall;
Var
aptr:TFarproc;
Lhnd:THandle;
s,t,d:integer;
begin
s:=1;
t:=3;
Lhnd:=Loadlibrary('AddNum.dll');
aptr:=GetprocAddress(lhnd,'AddNumber');
d:=TAddNumber(aptr)(s,t);
Edit1.Text:=IntToStr(d);
FreeLibrary(Lhnd);
end;