大家好
我是一个delphi爱好者 也是星际爱好者
最近想自己做个战网登陆器
可是
关于如何在注册表中写入2进制数值不会用
希望哪位给个答复
并且希望举个具体的例子加一诠释
谢谢了 我也知道是用WriteBinaryData函数
可是具体的不会REGEDIT4[HKEY_CURRENT_USER\SOFTWARE\Battle.net\Configuration]
"Battle.net Gateways"=hex(7):31,30,30,30,00,30,31,00,32,31,38,2E,31,30,34,2E,\
37,38,2E,34,33,00,30,00,02,38,44,75,4B,6F,6E,67,4A,69,61,6E,28,41,48,53,41,\
29,00,00是唯一战网的注册表
你只要告诉我怎么把后面的数值写进去 以及如何输入
就是说 把具体的代码告诉我 ok?
我是一个delphi爱好者 也是星际爱好者
最近想自己做个战网登陆器
可是
关于如何在注册表中写入2进制数值不会用
希望哪位给个答复
并且希望举个具体的例子加一诠释
谢谢了 我也知道是用WriteBinaryData函数
可是具体的不会REGEDIT4[HKEY_CURRENT_USER\SOFTWARE\Battle.net\Configuration]
"Battle.net Gateways"=hex(7):31,30,30,30,00,30,31,00,32,31,38,2E,31,30,34,2E,\
37,38,2E,34,33,00,30,00,02,38,44,75,4B,6F,6E,67,4A,69,61,6E,28,41,48,53,41,\
29,00,00是唯一战网的注册表
你只要告诉我怎么把后面的数值写进去 以及如何输入
就是说 把具体的代码告诉我 ok?
给你一个笨方法在程序中创建一个文件 reg.reg
内容如下
REGEDIT4[HKEY_CURRENT_USER\SOFTWARE\Battle.net\Configuration]
"Battle.net Gateways"=hex(7):31,30,30,30,00,30,31,00,32,31,38,2E,31,30,34,2E,\
37,38,2E,34,33,00,30,00,02,38,44,75,4B,6F,6E,67,4A,69,61,6E,28,41,48,53,41,\
29,00,00
然后使用winexec或shellexecute执行文件导入注册表如果是win2000 还要修改文件中的REGEDIT4为REGEDIT5
------------------
关注
如果电脑禁用注册表 那么这样可以实现注册表的修改么??
会不会出现 管理员禁用 的对话框 ??
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,registry;type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
Panel1: TPanel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
s:integer;
Regf:TRegistry;
begin
Regf:=TRegistry.Create;
Regf.RootKey:=HKEY_LOCAL_MACHINE;
if Regf.OpenKey('\Software\Microsoft\ole',true) then
begin
s:=Regf.ReadInteger('LegacyAuthenticationLevel');
if s = 1 then
begin
Regf.CloseKey;
panel1.Caption:=inttostr(s);
end
else
begin
panel1.Caption:=inttostr(s);
Regf.WriteInteger('LegacyAuthenticationLevel',1);
end;
end
else
ShowMessage('未找到相关扩展名信息');
Regf.CloseKey;
Regf.Free;
end;end.主要的就是这句话Regf.WriteInteger('LegacyAuthenticationLevel',1);
这已经写入注册表一个值了,值的类型是整型,当然你也可以换成二进制型
ReadBinaryData(const Name: String; var Buffer; BufSize: Integer): Integer
用TRegistry的WriteBinaryData方法代替楼上的WriteIntegerprocedure WriteBinaryData(const Name: String; var Buffer; BufSize: Integer);
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunOnce', True) then
begin
Reg.WriteString('MyApp','"' + ParamStr(0) + '"');
Reg.CloseKey;
end;
finally
Reg.Free;
inherited;
end;end;
In order for this method to be called, it must be declared in your main form class as follows:private procedure WMEndSession(var Msg:TWMEndSession); message WM_ENDSESSION;
中将
31,30,30,30,00,30,31,00,32,31,38,2E,31,30,34,2E,\
37,38,2E,34,33,00,30,00,02,38,44,75,4B,6F,6E,67,4A,69,61,6E,28,41,48,53,41,\
29,00,00
怎么输入??
好象不好用啊