先用getdatasize获取该键值的大小(字节数)。
var
buf:array of char;
i:integer;
begin
i:=reg.getdatasize('xxx');
setlength(buf,i);
reg.readbinarydata('xxx',buf,i);
...
end;
Var Reg : TRegistry;
list : TStrings;
i : Integer;
begin
Reg:=TRegistry.Create;
Reg.RootKey:='HKEY_LOCAL_MACHINE';
If Reg.OpenKey('/Software/Microsoft/CurrentVersion/Run', false) then
begin
List:=TStringList.Create;
Reg.GetValueNames(List);
For i:=0 to list.Count-1do
If Reg.ValueExists(List) then
begin
Case Reg.GetDataType(List) of
rdInteger: Reg.ReadInteger(List);
rdBinary: Reg.ReadBinaryData(List);
else