Tips&Tricks I trucchi del mestiere

 

Come reperire informazioni utili utilizzando il registro di sistema


Il TIP serve a reperire informazioni utili (quali nome utente , nome bios, sheda madre ed ecc...) dal registro di Windows.Per fare tutto ci≥ bisogna creare una nuova applicazione e nel Form inserire una ListBox (che chiameremo come L), poi negli USES inserire la libreria Registry.
Tip fornito dal sig. A.Pelleriti

Doppio click sul form dellÆapplicazione e nella procedura di creazione del form inserire :

procedure TForm1.FormCreate(Sender: TObject);
var
reg : tregistry;
s :string;
i :integer;
begin
       Reg := TRegistry.Create ;
                 Reg.RootKey :=HKEY_CURRENT_USER;
                if reg.OpenKey('Software\Microsoft\Active Setup\Installed Components\{44BBA840-CC51-11CF-AAFA-00AA00B6015C}',false )then
                 begin
                s:=reg.ReadString('Username');
                l.Items.Add('Nome Utente   = '+s);
                  end;
  Reg := TRegistry.Create ;
                 Reg.RootKey :=HKEY_CURRENT_USER;
              //
                if reg.OpenKey('Software\Microsoft\Windows\ShellNoRoam',false )then
                 begin
                s:=reg.ReadString('');
                l.Items.Add('Nome Compuiter = '+s);
                  end;
        Reg := TRegistry.Create ;
                 Reg.RootKey :=HKEY_LOCAL_MACHINE;
              //
                if reg.OpenKey('HARDWARE\DESCRIPTION\System\CentralProcessor\0',false )then
                 begin
                s:=reg.ReadString('ProcessorNameString');
                l.Items.Add('Processore = '+s);
                  end;
        Reg := TRegistry.Create ;
                 Reg.RootKey :=HKEY_LOCAL_MACHINE;
              //
                if reg.OpenKey('HARDWARE\DESCRIPTION\System\CentralProcessor\0',false )then
                 begin
                s:=reg.ReadString('Identifier');
                l.Items.Add('Identificazione  = '+s);
                  end;
        Reg := TRegistry.Create ;
                 Reg.RootKey :=HKEY_LOCAL_MACHINE;
              //
                if reg.OpenKey('HARDWARE\DESCRIPTION\System\CentralProcessor\0',false )then
                 begin
                i:=reg.Readinteger('~MHz');
                l.Items.Add('Velocitα CPU  =  '+inttostr(i)+'  MHz');
                  end;
        Reg := TRegistry.Create ;
                 Reg.RootKey :=HKEY_USERS;
              //
                if reg.OpenKey('S-1-5-21-1220945662-1454471165-725345543-1003\Software\Liter\SystemInfo\BIOS',false )then
                 begin
                s:=reg.ReadString('Product');
                l.Items.Add('Nome Bios  = '+s);
                  end;
        Reg := TRegistry.Create ;
                 Reg.RootKey :=HKEY_USERS;
              //
                if reg.OpenKey('S-1-5-21-1220945662-1454471165-725345543-1003\Software\Liter\SystemInfo\BIOS',false )then
                 begin
                s:=reg.ReadString('Date');
                l.Items.Add('Data  = '+s);
                  end;
        Reg := TRegistry.Create ;
                 Reg.RootKey :=HKEY_USERS;
              //
                if reg.OpenKey('S-1-5-21-1220945662-1454471165-725345543-1003\Software\Liter\SystemInfo\Mainboard',false )then
                 begin
                s:=reg.ReadString('Current');
                l.Items.Add('Nome scheda madre   = '+s);
                  end;
//ed eccetera................
end;