btw, that code is better:
Delphi-Quellcode:
program Test;
{$APPTYPE CONSOLE}
uses
SysUtils,
Registry,
Windows;
var
Reg : TRegistry;
buf:
array[0..3]
of byte;
begin
buf[0] := $01;
buf[1] := $00;
buf[2] := $00;
buf[3] := $00;
try // try-finally needed. If there is an exception anywhere, the object maybe does not free.
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Reg.OpenKey('
SYSTEM', False);
Reg.CreateKey('
Parameters');
Reg.OpenKey('
Parameters', False);
Reg.WriteBinaryData('
Test', buf, 4);
// hier was the error. You don't need to put a pointer here
Reg.CloseKey;
finally // now free the object
Reg.Free;
end;
end.