[Lazarus] Windows Registry, how do I read data from rdExpandString

Bo Berglund bo.berglund at gmail.com
Wed Feb 7 20:52:55 CET 2018

On Tue, 6 Feb 2018 13:35:28 +0100, Alexander Hofmann via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>as stated in the MSDN article you cited, the REG_EXPAND_SZ type is a
>hint to the API/API-User, that the string (stored as any other string
>either 2-byte or 1-byte depending in the Version) might contain
>environment variables, that need to be expanded before use.
>Respective M$ PowerShell, REG.exe versions etc. honor this hint and
>expand the variables before returning you the results...
>As for displaying - I would suggest displaying the "original" value
>(without expansion) alongside with a "current reading" e.g. containing
>the expanded string for the current system/user.

Thanks, then I will use ReadString for both types and let the registry
"fix" the values and expand the environment variables as needed.

While I have been looking at this I am getting more and more confused
about the 32/64 bit issues....

I had the impression before embarking on this that the 32 bit
applications would read/write into Software/Wow6432Node/<target key>
and would not be able to reach the Software/<target key>.
But that seems not to be the case for my Lazarus program because in my
viewer I can navigate the registry and I see the Wow6432Node item and
can step into it too.
I will have to stuff this into Delphi to see if it holds true there as
well. Very confusing.

I have not yet embarked on 64 bit computing (at least I believe not).

Bo Berglund
Developer in Sweden

More information about the Lazarus mailing list