Re: SystemRoot: XP vs VISTA
- From: "Tom de Neef" <tdeneef@xxxxxxxx>
- Date: Fri, 9 Feb 2007 09:01:33 +0100
"Rob Kennedy" <me3@xxxxxxxxxxx> schreef in bericht
news:532atbF1ptm14U1@xxxxxxxxxxxxxxxxxxxxx
result := Reg.ReadString('');That registry key is stored with reference to an environment variable. Use
Under XP this result in 'C:\WINDOWS\System32\hhctrl.ocx'
under Vista the same code results in
'%SystemRoot%\System32\hhctrl.ocx'
the ExpandEnvironmentStrings API function to replace the environment
variable with its actual value. Don't dig around in the registry any more
than you absolutely have to.
The registry has a data type for storing environment-variable-based
values. When you read from those keys, the OS is supposed to fill in the
actual value for you. Check (in regedit.exe) the type of the key you're
reading. Is it Reg_Expand_Sz, or just Reg_Sz? This is to determine whether
it's the OS that is using the wrong type, or Delphi that is ignoring that
type. You can't fix the former, but you can address the latter.
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.
Tom
.
- Follow-Ups:
- Re: SystemRoot: XP vs VISTA
- From: Rob Kennedy
- Re: SystemRoot: XP vs VISTA
- References:
- SystemRoot: XP vs VISTA
- From: Tom de Neef
- Re: SystemRoot: XP vs VISTA
- From: Rob Kennedy
- SystemRoot: XP vs VISTA
- Prev by Date: Re: SystemRoot: XP vs VISTA
- Next by Date: Re: Problem using With statement
- Previous by thread: Re: SystemRoot: XP vs VISTA
- Next by thread: Re: SystemRoot: XP vs VISTA
- Index(es):
Relevant Pages
|
|