Author: Lou Adler
How to get the Password of the screensaver
Answer:
1
2 //this is a small function which give the password of the screensaver!!
3
4 function GetScrPass: string;
5 var
6 ScrnSvrPss: string;
7 reg: TRegistry;
8 buf: array[0..256] of char;
9 length: word;
10 a: byte;
11 asdec: byte;
12 password: string[128];
13 const // Decrypts the screen saver password from the registry
14 xorwert: array[1..128] of byte =
15 (72, 238, 118, 29, 103, 105, 161,
16 27, 122, 140, 71, 248, 84, 149, 151, 95, 120, 217, 218, 108, 89, 215, 107,
17 53, 197, 119, 133, 24, 42, 14, 82, 255, 0, 227, 27, 113, 141, 52, 99, 235,
18 145, 195, 36, 15, 183, 194, 248, 227, 182, 84, 76, 53, 84, 231, 201, 73, 40,
19 163, 133, 17, 11, 44, 104, 251, 238, 125, 246, 108, 227, 156, 45, 228, 114,
20 195, 187, 133, 26, 18, 60, 50, 227, 107, 79, 77, 244, 169, 36, 200, 250, 120
21 , 173, 35, 161, 228, 109, 154, 4, 206, 43, 197, 182, 197, 239, 147, 92, 168,
22 133, 43, 65, 55, 114, 250, 87, 69, 65, 161, 32, 79, 128, 179, 213, 35, 2, 100
23 , 63, 108, 241, 15);
24
25 begin
26 password := '';
27
28 reg := TRegistry.Create;
29 reg.RootKey := HKEY_CURRENT_USER;
30 Reg.OpenKey('Control PanelDesktop', FALSE);
31 Reg.ReadBinaryData('ScreenSave_Data', buf, sizeof(buf));
32
33 length := (Reg.GetDataSize('ScreenSave_Data') - 1) shr 1;
34
35 if Reg.ReadBool('ScreenSaveUsePassword') then
36 for a := 1 to length do
37 begin
38 asdec := StrToInt('$' + buf[(a shl 1) - 2] + buf[(a shl 1) - 1]);
39 password := concat(password, Chr(asdec xor xorwert[a]));
40 end
41 else
42 password := 'There was an error getting the password.';
43 reg.free;
44 ScrnSvrPss := password;
45
46 //sleep(1000);
47 result := ScrnSvrPss;
48 end;
49
50 procedure TForm1.Button1Click(Sender: TObject);
51 begin
52 edit1.text := GetScrPass;
53 end;
|