Anich Gregor wrote:
Doesn't the registry expand strings of type
REG_EXPAND_SZ with environment
vars, and leaves REG_SZ untouched?
no it doesn't. It's the callers responsibility. The only case where the
registry code (advapi only) touches the data is when setting or querying
a REG_SZ or REG_EXPAND_SZ with an ansi (A) function, then it converts
the data from unicode to ansi or vice versa and makes it null-terminated
if necessary. But that's about it.
But still it tells the program which reads
the key wether it is reading REG_SZ or REG_EXPAND_SZ and some lazy coders
seem to rely on reading REG_SZ while we want the keys to be expanded so we
have to make them REG_EXPAND_SZ which is why the programs fail?
That's not necessarily due to laziness of some coders. The program or
library is fully responsible for processing the data it received from
the registry - there's nothing we can do about it except copy bad design
(as in registry values).
So if we had another type, REG_FOO, we could make
our registry code expand
environment vars for this type, but return REG_SZ as type to the program
instead of REG_FOO, or would that not work/be a bad idea?
That is a bad idea, you'd have to modify advapi to do stuff it shouldn't
do. now imagine a driver or program uses the ntoskrnl/ntdll versions
directly...
Regards,
Thomas
Oh, didn't know that... should have checked that before i wrote such stupid
suggestions ;)
Thanks for clearing this up for me.