Call to DLL goes wrong - but not always

A

andrea

Hi guys!

We have this problem that both in the VB5 IDE (debug-mode) and in our
Access-modules the calling of a DLL behaves strange. Once a VB-App is
converted to an executable, things are fine.

Alas, that won't do in our access-stuff :-(

I included the basic DLL declarations, so you see it IS a standard DLL
and works fine otherwise:
########################
library PGP;

uses
SysUtils,
Classes,
RSADecode;

Type PBuffer = array[0..254] of char;
----------------------

function Decode(var aEncBuff:pBuffer;var len:integer;Pfad:pchar;
Filename:pchar):integer; stdcall;
begin
result:=doSomething(aEncBuff,len,Pfad,filename,false);
end;
-----------------------

function Decode_Scrambled(var aEncBuff:pBuffer;var
len:integer;Pfad:pchar;
Filename:pchar;Scrambled:boolean):integer;stdcall;
begin
result:=Dosomething(aEncBuff,len,Pfad,Filename,Scrambled);
end;

exports Decode, decode_scrambled;
begin
end.

##########################


Now this is how we declare the external function in Access:

Declare Function Decode Lib "PGP.dll" Alias "Decode" (ByVal PBuffer As
String, ByRef Laenge As Integer, ByVal Pfad As String, ByVal Filename
As String) As Integer


sub something
dim sfile as string, spfad as string, sbuffer as string * 255
dim iretc as integer, ilen as integer

sbuffer=string(255, vbnullchar)
sfile="keyfile.key"
spfad="<valid path to keyfile.key>"
sbuffer="<encrypted string>"
ilen=<length of encrypted string>
' AND HERE IT COMETH: (and fails miserably)
iretc=Decode(sbuffer, ilen, sfile, spfad)

end sub


#########################

sometimes it works, most times it won't. We have NO idea whatsoever,
so we humbly come to ask for help.

TIA

Andrea ([email protected] - remove 'nospam')
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top