Broken TRegistryIniFile
Original Reporter info from Mantis: Wallaby
-
Reporter name:
Original Reporter info from Mantis: Wallaby
- Reporter name:
Description:
The following code works incorrectly in trunk and fixes_3.2:
{$MODE DELPHI}
program test;
uses
Registry;
const
RegPath = 'Software\Company Name\Product Name';
begin
{Write}
with TRegistryIniFile.Create(RegPath) do
try
WriteString('Test', 'Key', 'Value');
finally
Free;
end;
{Read}
with TRegistryIniFile.Create(RegPath) do
try
WriteLn(ReadString('Test', 'Key', 'Duh!'));
finally
Free;
end;
end.
Instead of creating: HKEY_CURRENT_USER\Software\Company Name\Product Name
It creates HKEY_CURRENT_USER\Software\Company Name\Product Name\Software\Company Name\Product Name\Test
On top of that no value is written. The above code will print "Duh!" rather than "Value".
As far as I can tell it's related to converting TRegistry to Unicode. It would be great to have this fixed before 3.2 release as this will break many programs.
Steps to reproduce:
Compile and execute the attached program. Open regedit.exe, navigate to HKEY_CURRENT_USER\Software\Company Name and expand it all the way down.
Note that the path is wrong and no value was written.
Mantis conversion info:
- Mantis ID: 36663
- OS: Windows
- OS Build: 10.0
- Build: 3.3.1-r44120 [2020/02/06] x86_64
- Platform: Win32
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 44127 (#5b2738d2)
- Monitored by: » Wallaby (Wallaby)
- Target version: 3.2.0