Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in TDSiRegistry.WriteBinary on Delphi 2009 or higher #2

Open
GoogleCodeExporter opened this issue Apr 16, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

Compile and run this code:

{$APPTYPE CONSOLE}
uses
  Windows, SysUtils, DSiWin32;
var
  S, S1: string;
  DSiReg: TDSiRegistry;

begin
  DSiReg := TDSiRegistry.Create;
  S := '0123456789';
  DSiReg.RootKey:=HKEY_CURRENT_USER;

  if DSiReg.OpenKey('Software\_Test', True) then
    DSiReg.WriteBinary('TESTKEY', S);

  S1 := DSiReg.ReadBinary('TESTKEY', '123');
  WriteLn(S1);
  FreeAndNil(DSiReg);
end.

What is the expected output? 
  0123456789
What do you see instead?
  01234

What version of the product are you using? On what operating system?
  Windows7 x32, Delphi 2009 or higher, DSiWin32 1.59b

Please provide any additional information below.

Fix:
Change line #1972 to
WriteBinaryData(name, pointer(data)^, Length(data)*SizeOf(data[1]));

Original issue reported on code.google.com by [email protected] on 5 Dec 2010 at 10:21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant