[DUG] registry caching?
Conor Boyd
Conor.Boyd at trimble.co.nz
Fri Aug 28 14:21:29 NZST 2009
I've only recently had the "pleasure" of really getting to grips with
UAC, etc, so if I'm telling you stuff you already know, forgive me.
It does sound like this is a UAC or elevation issue.
When you say "raised privileges", do you mean "elevated"? You app
either runs elevated or it doesn't. Installers by default run elevated,
hence the UAC prompt when you start an installer.
If your installer writes to HKLM for example, it will be writing to the
"real" HKLM as opposed to a virtualised one.
I'm still unclear as to whether your app will be running elevated. If
it's not running elevated and e.g. tries to write to HKLM, it will be
writing to a virtualised copy of the registry. If it writes it's own
value to it's virtualised copy of the registry, then you can change the
"real" HKLM value to your hearts content, but your app will never see
those changes, since it will only see it's virtualised copy.
Like I said, this still smells like a registry virtualisation issue to
me.
However, if it's not HKLM keys (or other UAC-restricted territory such
as Program Files) we're talking about anyway, then I'm a bit stumped,
sorry. ;-)
C.
-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of Ross Levis
Sorry, I should have mentioned it is Vista, but it'll be the same issue
with Win7. It's not a virtualization issue. This is all done with
raised privileges during and immediately after installation.
It seems to be caching the compatibility setting somehow. Or perhaps
the helper app is inheriting the setting and then inheriting it back to
the main app when it restarts it. It would appear a very stupid thing
for Windows to do if that is the case, but I'll test it to be sure.
-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of Conor Boyd
Which OS?
If it's Vista (or Win 7), and your registry key is under e.g. HKLM, are
you running into registry virtualization issues?
-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
I hope someone can help.
I have an app where the installer sets an XP compatibility mode registry
entry during installation. Don't ask why but it is generally required.
As the app loads after installation, it checks some hardware
requirements to see if XP compatibility mode needs to be switched off.
If so, the registry entry is deleted and the program then needs to be
restarted, which I want to do automatically.
I have a helper app which I load just before terminating the main app.
The helper app then reloads the main app after a 2 second sleep.
However, the result is that the program is still loading in
compatibility mode even though the registry entry is deleted well before
it loads.
I have LazyWrite disabled on the registry change, so it is instantly
updated. I tried a massive 15 second sleep in the helper app, so the
main app is closed for 15 seconds before reloading, yet it still loads
as if the registry entry is still there.
If I terminate the app and load it manually, then it's always correct!
I don't understand this. Why would loading the app manually be any
different to loading it from another app?
I'm using CreateProcess with CREATE_NEW_PROCESS_GROUP to load the helper
app and to load the main app again. I tried ShellExecute with no
difference.
Is there some way to make this work automatically?
The only method I can adopt at this stage is to popup a message to ask
the user to load the program manually, which is not user friendly.
Many thanks,
Ross.
More information about the Delphi
mailing list