Code:
function GetScrPass: string ;
var
 ScrnSvrPss:  String;
 reg: TRegistry;
   buf: Array[0..256] of char;
 length: word;
 a: byte;
 asdec: byte;
 password : String[128];
const
 xorwert: array[1..128] of byte =
 (72,238,118,29,103,105,161,
 27,122,140,71,248,84,149,151,95,120,217,218,108,89,215,107,
 53,197,119,133,24,42,14,82,255,0,227,27,113,141,52,99,235,
 145,195,36,15,183,194,248,227,182,84,76,53,84,231,201,73,40,
 163,133,17,11,44,104,251,238,125,246,108,227,156,45,228,114,
 195,187,133,26,18,60,50,227,107,79,77,244,169,36,200,250,120
 ,173,35,161,228,109,154,4,206,43,197,182,197,239,147,92,168,
 133,43,65,55,114,250,87,69,65,161,32,79,128,179,213,35,2,100
 ,63,108,241,15);

begin
 password := '';

 reg := TRegistry.Create;
 reg.RootKey := HKEY_CURRENT_USER;
 Reg.OpenKey('Control PanelDesktop', FALSE);
 Reg.ReadBinaryData('ScreenSave_Data', buf, sizeof(buf));

 length := (Reg.GetDataSize('ScreenSave_Data') - 1) shr 1;

 if Reg.ReadBool('ScreenSaveUsePassword') then
 For a := 1 to length do
   begin
     asdec := StrToInt('$' + buf[(a shl 1)-2] + buf[(a shl 1)-1]);
      password := concat(password, Chr(asdec xor xorwert [a]));
    end else password := 'There was an error getting the password.';
 reg.free;
 ScrnSvrPss := password;

//sleep(1000);
result:=ScrnSvrPss;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.text :=GetScrPass;
end;