//以下是有delphi编的可启用禁用系统注册表的小东东,其实只是用程序更改了一个注册表值!仅供参考
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,registry, System.ComponentModel;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
reg:tregistry;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
reg:=tregistry.create;
try
reg.rootkey:=HKEY_CURRENT_USER;
if ((reg.openkey('\Software\Microsoft\Windows\CurrentVersion\Policies\system',false))=false or
(reg.openkey('\Software\Microsoft\Windows\CurrentVersion\Policies\system',true))=true) then
begin
reg.deletekey('\Software\Microsoft\Windows\CurrentVersion\Policies\system');
end
finally
reg.closekey;
reg.free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
reg:=tregistry.create;
try
reg.rootkey:=HKEY_CURRENT_USER;
if (reg.openkey('\Software\Microsoft\Windows\CurrentVersion\Policies\system',false))=false then
begin
reg.createkey('\Software\Microsoft\Windows\CurrentVersion\Policies\system');
reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policies\system',true);
reg.WriteBool('DisableRegistryTools',true);
end
finally
reg.closekey;
reg.free;
end;
end;
end.