Fore some good reason i need to write a string format of a binary value to a binary registry key, in other words I have a registry value like this :
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Sonal]
"Password"=hex:00,d6
I tried to write it to registry using following code :
procedure Tesct.Button2Click(Sender: TObject);
var
RegInfoExists : TRegistry;
EdStr : AnsiString;
begin
try
RegInfoExists := TRegistry.Create(KEY_WRITE OR KEY_WOW64_64KEY);
RegInfoExists.RootKey := HKEY_LOCAL_MACHINE;
if RegInfoExists.OpenKey('SOFTWARE\Sonal',true) then
EdStr := #$00#$d6;
RegInfoExists.WriteBinaryData('Password', EdStr,
Length(EdStr) * SizeOf(byte));
except
end;
RegInfoExists.CloseKey;
RegInfoExists.Free;
end;
And I got this :
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Sonal]
"Password"=hex:dc,d7
How i can do this ?