
Hinweise zur Nutzung des
API (Application Program Interface)
für den ZRANDOM
USB - Generator
(DLL-Funktionsaufruf)
Allgemeines
Beispiel für einen DLL-Funktionsaufruf in Delphi
unit Unit1_CallZranUSB; // Windows API (Application Program Interface)Der eigentliche Funktionsaufruf ist rot gekennzeichnet.
// This file calls the function StartZrandomUSB in ZranUSB.dll
// in order to generate 20000 true random bits on demand.
// This file is a DELPHI Unit used by the DELPHI Project CallZranUSB.dpr
// ZranUSB.dll can also be used by C++ or Visual Basic!interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ComCtrls;implementation
var
returnvalue,i : longint;
randombits : array[0..19999] of longint;
s,allbits : string;function StartZrandomUSB(mode:longint; filename_bin,filename_log:PChar;
writefiles:longint; var randombits : array of longint) : longint;
stdcall; external 'ZranUSB.dll';begin
{
The function parameters have following meanings:
1. Generation mode (0: physical, 1: XOR)
2. Binary file name
3. Protocol file name
4. Write files (0: No, 1: Yes)
5. Array [0..19999] of generated True Random Bits (longint)
Possible function results:
return value = 0 -> No Error
return value > 0 -> Error described in the protocol file
}// ---------------- Start ZRANDOM generator -------------------------
returnvalue:=StartZrandomUSB(1,'ZBITS.BIN','ZBITS.LOG',1,randombits);
// ------------------------------------------------------------------s:=Format('%d',[returnvalue]);
ShowMessage('Return value = '+s);// Show first 1000 True Random Bits:
allbits:='';
for i:=0 to 999 do
begin
s:=Format('%d',[randombits[i]]);
allbits:=allbits+s;
if ((i+1) mod 80)=0 then allbits:=allbits+#13
end;
ShowMessage(allbits);end.
Hier kann die Demo-Datei
heruntergeladen werden.
(Die DLL wurde nicht mit C++ oder VB getestet. Es kann kein Support zu C++ oder VB geliefert werden.)
Copyright WESTPHAL ELECTRONIC
Webmaster: info@westphal-electronic.com
Letzte Änderung: 09.04.2005