Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi call Iinit() - DEC (https://www.delphipraxis.net/26930-call-iinit-dec.html)

tuxic 1. Aug 2004 09:45


call Iinit() - DEC
 
Hi ihrs,
hab mal ein kleines Problem mit Hagens DEC.
Seit dem ich die Passwortabfrage am anfang meines Programmes rausgenommen habe, bekomme ich immer die Exception, das ich doch bitte Init oder InitKey in TCipherBlowfish aufrufen soll. Das verstehe ich leider nicht so ganz. Die Exception kommt gleich nach dem FormCreate event. Offensichtlich wird dann ja Code in den DEC-Units ausgeführt.
Die Funktion für die Passwort anfrage sieht so aus:
Delphi-Quellcode:
  Randomize;
  zufall := Random(65000);
  PostMessage(Handle, WM_USER + 1024, 0, 0); // setzt das PasswordChar in der Inputbox auf '*'
  password := encode(inputbox(ACaption, 'Bitte Passwort eingeben', ''), inttostr(zufall));
  if password = '' then
    ask4pwd := false
  else
    ask4pwd := true;
die encode Funktion:
Delphi-Quellcode:
function TForm1.Encode(text, pwd:string):string;
var
  Cipher:TCipher_Blowfish;
begin
  Cipher := TCipher_Blowfish.Create(pwd, nil);
  Encode := Cipher.EncodeString(text);
  Cipher.Destroy;
end;
Wenn ich nur encode() in dem FormCreate Event aufrufe, kommt die Exception immer noch,
wenn ich hingegen die ganze "Passwort abfrage" Funktion im FormCreate Event aufrufe, kommt die Excpetion nicht mehr. Was mache ich also in dieser Funktion, dass die Exception verhindert??? :gruebel:

MfG
der verwirrte Daniel :roll:

tuxic 1. Aug 2004 10:03

Re: call Iinit() - DEC
 
OMG, ich habs gefunden... password ist doppelt belegt, das gibts in Hagens DEC und in meiner Unit. Ganz offensichtlich wird an der variable password überprüft, ob die Initialiesierung schon erfolgt ist.
Wieso funzt es dann aber trotzdem??? hmm...


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:22 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz