Re: SystemRoot: XP vs VISTA



Tom de Neef wrote:
Thank you. ExpandEnvironmentStrings works.
Under XP, the data type is REG_SZ - 'C:\WINDOWS\System32\hhctrl.ocx'
Under Vista, it is REG_EXPAND_SZ - '%SystemRoot%\System32\hhctrl.ocx'

So, it should have been expanded. I do that now programmatically.

Yep. Delphi is ignoring the difference in types. It's up for discussion as to whether Delphi _should_ automatically expand the value.

If TRegistry.GetDataType returns rdExpandString, then call ExpandEnvironmentStrings on the string value. If you use the return value from GetDataType, then you don't need to rely on knowing the OS version or inspecting the contents of string (looking for % characters).

--
Rob
.



Relevant Pages

  • Re: A letter to Microsoft
    ... Assume all your Delphi code assets were ... we get a new data type and the existing ones ... documented to corrupt binary data. ... the existing string data typedo not go away. ...
    (borland.public.delphi.non-technical)
  • Re: [PATCH] update checkpatch.pl to version 0.05
    ... I want the string to be \{... ... +# Check for switch and associated case and default ... semantics of '' and "" are well known, to change to qrI would have to ... be expressed as qras it would expand variables but treat \ as if we ...
    (Linux-Kernel)
  • Re: How to iterate through a (semicolon;separated;list)
    ... > 'replace string' in my arsenal. ... would expand the PATH environment variable, ... string to effectively delete all occurrences of "str1" from the expanded ... everything from the begining of the expanded output to the first ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: [path-PEP] Path inherits from basestring again
    ... > Reinhold Birkenfeld wrote: ... >>>Could you please expand on what this means? ... > to compare a Path to a string, you could just wrap the string in a Path ... > Here again I would claim the "practicality over purity" argument. ...
    (comp.lang.python)
  • Re: Expanding variables in a string
    ... If I have a string containing variables, how can I expand them? ... Please tell the Brothers Lehman ... Ruby training and Rails training available at http://LearnRuby.com. ...
    (comp.lang.ruby)