[DUG] Vista and Ini files
Ross Levis
ross at stationplaylist.com
Mon Apr 30 16:30:24 NZST 2007
As I've mentioned here before, I have Inno Setup change the security rights
of the "Users" group to "Modify" privileges for a folder I called "Data",
which is underneath my installation folder in Program Files. I recently
tested this under Vista with a standard user and it is writing the data
there, not to some other virtual location. So this appears to be an option.
But I also have an issue writing to HKEY_LOCAL_MACHINE. My app has always
had the ability to set a "Load Program at Startup" checkbox which adds or
removes the an entry in HKLM\Software\Microsoft\Windows\CurrentVersion\Run
In Vista, an administrator wanting to change this option cannot. It has no
effect at all and reverts to the original setting.
The solutions are...
You can put an entry in the manifest to permanently raise the privilege
level while the app is running. This prompts a warning box to "Continue"
when the app is loaded.
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</security>
</trustInfo>
But if you want to only adjust administrator settings periodically then you
can apparently write a DLL with some COM code which prompts with the
"Continue" warning, make the change, and then go back to a "Standard" user
afterwards.
For this to work, the manifest line must be different.
http://developersoven.blogspot.com/2007/02/leveraging-vistas-uac-with-delphi
-part_3659.html
I'm not sure I can be bothered with all this hassle for just one option. It
looks like it will have to be an installation option which users can't
change afterwards without reinstalling.
What a major hassle. Ubuntu Linux is looking better every day!
Ross.
-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of David Brennan
Sent: Monday, 30 April 2007 16:24
To: 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Vista and Ini files
Hi Jeremy North,
The suggestion that a program should write to HKEY_LOCAL_MACHINE at
installation and then never again doesn't make much sense to me. If a
software program needs to store stuff in HKEY_LOCAL_MACHINE then odds are
good it needs to be able to change it.
So is there a way to write to some HKEY_LOCAL_ALL_USERS (my invention!) as
opposed to HKEY_LOCAL_USERS?
Or does this mean that software programs are meant to be using INI files now
(in All Users profile) instead of the registry for storing machine wide
parameters and settings?
I'm asking you because you seem to know what you are talking about ;-).
David.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.adventureeducation.co.nz/pipermail/delphi/attachments/20070430/41d315ab/attachment-0001.html
More information about the Delphi
mailing list