Einzelnen Beitrag anzeigen

shmia

Registriert seit: 2. Mär 2004
5.508 Beiträge
 
Delphi 5 Professional
 
#2

Re: Password hash in RDP files

  Alt 20. Mär 2007, 09:38
The *.RDP file is stored using UNICODE.
The file starts with the BOM (Byte Order Mark): $FF$FE to indicate that the file is using UNICODE.
You could easily view and edit the content the file with the Wordpad application; just draw & drop the file on Wordpad.

Sorry, but your code looks a bit like spaghetti.
Why don't you use a function to calculate the hash for the password ?
function CalcPasswordHash(const PlainPW:string):string; Then compare the output of this function with the content of a RDP file to make shure that your
hash function is fine.

To save your stringlist as UNICODE:
Delphi-Quellcode:
procedure SaveWideStringToFile(const filename:string; const ws:WideString);
const
   BOM_UTF16 = $FEFF; // BOM = Byte Order Mark
var
   fs : TFileStream;
   BOM : WideString;
begin
   BOM := Widechar(BOM_UTF16);
   fs := TFileStream.Create(filename, fmCreate);
   try
      fs.WriteBuffer(BOM[1], Length(BOM)*sizeof(Widechar));
      fs.WriteBuffer(ws[1], Length(ws)*sizeof(Widechar));
   finally
      fs.Free;
   end;
end;

....
    RDPFile.Add('bitmapcachepersistenable:i:1');
// RDPFile.SaveToFile(sRDPFileName); // wrong
    SaveWideStringToFile(RDPFile.Text); // correct
    RDPFile.Free;
Andreas
  Mit Zitat antworten Zitat