Thema: Delphi CT - Api / Chipkarten

Einzelnen Beitrag anzeigen

Colonel Chris

Registriert seit: 27. Okt 2003
7 Beiträge
 
#21

Re: CT - Api / Chipkarten

  Alt 27. Okt 2003, 22:51
Einmal die CT_data:

Delphi-Quellcode:
function CT_data( ctn: Word;
                  dad, sad: PByte;
                  lenc: Word;
                  command: PByte;
                  lenr: PWord;
                  response: PByte ): ShortInt;
begin
  Result := ERR_TRANS;
  if @Function_CTdata <> nil
  // now calling function from driver DLL
  then try
    Result := Function_CTdata(ctn,dad,sad,lenc,command,lenr,response);
  except
    Result := ERR_INCOMPATIBLE;
  end;
end;
Und der DLL-Aufruf zu Beginn der Hauptprozedur:
Delphi-Quellcode:
function CTAPI_Load(path: PChar): Integer;
begin
  Result := ERR_UNKNOWN;
  DLLHandle := LoadLibrary(path);
  if DLLHandle <> 0 then begin
    @Function_CTinit := GetProcAddress(DLLHandle, 'CT_init');
    @Function_CTdata := GetProcAddress(DLLHandle, 'CT_data');
    @Function_CTclose:= GetProcAddress(DLLHandle, 'CT_close');
    if (@Function_CTinit = nil) or (@Function_CTdata = nil)
                                or (@Function_CTclose = nil)
    then Result := ERR_INCOMPATIBLE;
  end
  else Result := ERR_LIBRARY;
end;
  Mit Zitat antworten Zitat