Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2019-02

TRegistry fixes

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

Hi,

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

https://bugs.freepascal.org/view.php?id=35060
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)

https://bugs.freepascal.org/view.php?id=34876
The implementation of ReadStringList/WriteStringList treats a sequence of Unicode chars (WideChar) as if they were AnsiChar (a.o.).

https://bugs.freepascal.org/view.php?id=35022
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 https://bugs.freepascal.org/view.php?id=33980

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).

Bart

Reply by email

Pierre Muller
to Bart

Hi Bart,

Le 11/02/2019 à 15:29, Bart a écrit :

Show quoted text 40 lines
Hi, The new (W-API based) TRegistry in trunk and 3.2 fixes has some problems on Windows, amongst which at least one regression. https://bugs.freepascal.org/view.php?id=35060 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) https://bugs.freepascal.org/view.php?id=34876 The implementation of ReadStringList/WriteStringList treats a sequence of Unicode chars (WideChar) as if they were AnsiChar (a.o.). https://bugs.freepascal.org/view.php?id=35022 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 https://bugs.freepascal.org/view.php?id=33980 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).

I am one of the rare regular users of Windows OS in the core team, but I must also confess that I am neither knowledgeable in TRegistry fields, nor in all what concerns UniCode matters, which is still the main point of those modifications...

If nobody else steps up, I will try to look into it, but I hope someone else from core team will be able to check and commit those changes...

Pierre

Reply by email

Michael Van Canneyt
to Pierre Muller
Pierre Muller wrote 14 lines
Hi Bart, Le 11/02/2019 à 15:29, Bart a écrit : > Hi, I am one of the rare regular users of Windows OS in the core team, but I must also confess that I am neither knowledgeable in TRegistry fields, nor in all what concerns UniCode matters, which is still the main point of those modifications... If nobody else steps up, I will try to look into it, but I hope someone else from core team will be able to check and commit those changes...

As far as I know, Marco is working mainly on Windows these days.

But I am familiar with the TRegistry implementation. If Marco has no time, I can look at it myself during the weekend. I will need to boot a Windows VM and update FPC on that. I just need to remember on which one I have an FPC checked out :)

Michael.

Reply by email

Marco van de Voort
to Michael Van Canneyt

Op 2019-02-12 om 08:30 schreef Michael Van Canneyt:

As far as I know, Marco is working mainly on Windows these days.

Yes. And Stack is now mostly gone (a single shared Linux server remaining), so the whole BSD motivation is also gone after 25 years.

Show quoted text 6 lines
But I am familiar with the TRegistry implementation. If Marco has no time, I can look at it myself during the weekend. I will need to boot a Windows VM and update FPC on that. I just need to remember on which one I have an FPC checked out :)

I do a lot of Windows, but I don't use registry, neither in Delphi nor FPC. In both places I mostly use TXMLConfig for configuration.  I already did some of the simpler stuff, and see if I can chip stuff off in the coming days.

But I can remember that the mentioned utf8* in Windows code were a code smell back then, and I waited long to merge them. So I'm not surprised this turns up now.

But my coming weekends are a bit busy, my brother is moving.

Reply by email