请问我要更改注册表的一个值为二进制的键值,怎样通过编程实现。(50分)

  • 主题发起人 主题发起人 redrain988
  • 开始时间 开始时间
R

redrain988

Unregistered / Unconfirmed
GUEST, unregistred user!
注册表的一个键值为二进制值,怎样通过编程更改。
 
TRegistry .ReadFloat
TRegistry .WriteFloat
 
var
buf:array[0..nnn] of byte;
设置buf你要写入的数据。
Reg.WriteBinaryData('名字', buf, 要写入的字节数)
 
但以下程序出错。
var buf:array [0..100] of byte;
with Tregistry.Create do
try
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('/SYSTEM/CurrentControlSet/Services/LanmanServer/shares',true);
WriteBinaryData('c', buf, hex(7):43,00,53,00,43,00,46,00,6c,00,61,00,67,00,73,00,3d,00,30,00,00,00,/
4d,00,61,00,78,00,55,00,73,00,65,00,73,00,3d,00,34,00,32,00,39,00,34,00,39,/
00,36,00,37,00,32,00,39,00,35,00,00,00,50,00,61,00,74,00,68,00,3d,00,43,00,/
3a,00,5c,00,00,00,50,00,65,00,72,00,6d,00,69,00,73,00,73,00,69,00,6f,00,6e,/
00,73,00,3d,00,30,00,00,00,52,00,65,00,6d,00,61,00,72,00,6b,00,3d,00,00,00,/
54,00,79,00,70,00,65,00,3d,00,30,00,00,00,00,00)
finally
Free;
end;
 
你那是什么语法啊
 
举个简单的例子给你:
const
buf:array [0..5] of byte=($00,$11,$22,$33,$44,$55);
with Tregistry.Create do
try
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('SYSTEM/CurrentControlSet/test',true);
WriteBinaryData('c', buf, 6)
finally
Free;
end;
 
后退
顶部