unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Registry;
type
TForm1 =
class
(TForm)
Button1: TButton;
Memo1: TMemo;
Label1: TLabel;
procedure
Button1Click(Sender: TObject);
private
public
end
;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
WinVers =
'Software\Microsoft\Windows\CurrentVersion'
;
function
WinInfo(Root_Key: HKEY; Key_Open, Key_Read:
string
):
string
;
var
registry: TRegistry;
begin
if
((GetVersion
and
$80000000
)=
0
)
and
(Key_Open=WinVers)
then
Key_Open:=
'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
;
Registry := TRegistry
.
Create;
try
Registry
.
RootKey := Root_Key;
Registry
.
OpenKey(Key_Open,
False
);
Result := Registry
.
ReadString(Key_Read);
finally
Registry
.
Free;
end
;
if
Result<>EmptyStr
then
Result:=Key_read+
': '
+Result
else
Result:=Key_read+
': невозможно определить'
;
end
;
procedure
TForm1
.
Button1Click(Sender: TObject);
var
F: textfile;
begin
AssignFile(F,
'Информация о системе.txt'
);
ReWrite(F);
WriteLn
(F,
' О Системе:'
);
WriteLn
(F,WinInfo(HKEY_LOCAL_MACHINE,WinVers,
'RegisteredOwner'
));
WriteLn
(F,WinInfo(HKEY_LOCAL_MACHINE,WinVers,
'RegisteredOrganization'
));
WriteLn
(F,WinInfo(HKEY_LOCAL_MACHINE,WinVers,
'ProductID'
));
WriteLn
(F,WinInfo(HKEY_LOCAL_MACHINE,WinVers,
'ProductKey'
));
WriteLn
(F,WinInfo(HKEY_LOCAL_MACHINE,WinVers,
'ProductName'
));
WriteLn
(F,WinInfo(HKEY_LOCAL_MACHINE,WinVers,
'Version'
));
WriteLn
(F,WinInfo(HKEY_LOCAL_MACHINE,WinVers,
'VersionNumber'
));
CloseFile(F);
end
;
end
.