[fpc-devel] TRegistry fixes

Bart bartjunk64 at gmail.com
Mon Feb 11 15:29:39 CET 2019


The new (W-API based) TRegistry in trunk and 3.2 fixes has some
problems on Windows, amongst which at least one regression.

The use of Utf8Decode on strings that are not guaranteed to be CP_UTF8 is wrong.
As a result Keys with unicode characters in their name cannot be read
anymore (nor written to).
(This is a regression)

The implementation of ReadStringList/WriteStringList treats a sequence
of Unicode chars (WideChar) as if they were AnsiChar (a.o.).

TRegIniFile writes data to the wrong Key.

All these issues have patches and sample programs attached.

The patch for https://bugs.freepascal.org/view.php?id=35022 also
resolves https://bugs.freepascal.org/view.php?id=35023 and

Attached to https://bugs.freepascal.org/view.php?id=35022  is also a
test, intended to be added to tests/test/packages/fcl-registry.
(Currently the only test there is a trivial one.)

I can try to write tests for the other issues as well, but verifying
in code that WriteStringList yields the correct result may be a little
tricky, because it would depend on ReadStringList.
The patch for that issue will write a StringList and read that back
again and regedit does not complain that data is wrong.

It would be very nice if some devel who actually uses Windows (and has
at least rudimentary knowledge of the use of TRegistry) can have a
look at it and give some feedback.
Especially since these bugs will be in the upcoming 3.2.0 if they are
not fixed (and merged).


More information about the fpc-devel mailing list