uses Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
fReg: TRegistry;
fBuffer:array[0..1024] of char;
aBuffer:array[0..1024] of char;
begin
fReg := TRegistry.Create;
StrLCopy(fBuffer,pchar('大富翁的小伙计!'),Sizeof(fBuffer));
try
fReg.RootKey := HKEY_CURRENT_USER;
if fReg.OpenKey('/Software/BinaryData', True) then
begin
fReg.WriteBinaryData('MyApp',fBuffer,Sizeof(fBuffer));
fReg.ReadBinaryData('MyApp',aBuffer,Sizeof(aBuffer));
ShowMessage(String(aBuffer));
end;
finally
fReg.CloseKey;
fReg.Free;
end;
end;