 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mark Jacobs Guest
|
Posted: Wed May 02, 2007 3:21 pm Post subject: Vista and Writing to the Registry |
|
|
I have an application that cannot write to the registry unless I set its
properties, compatibility to run as admin. After doing this, each time the PC
is restarted, and the app is set launch at boot up, but I get a UAC message
asking me if I'm sure I want to allow my app to run with admin privileges. Is
there any way programmatically to avoid this prompt each time? Is there a
better way of ensuring an app can write to the registry under Vista? TIA,
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk |
|
| Back to top |
|
 |
Eelke Guest
|
Posted: Wed May 02, 2007 3:37 pm Post subject: Re: Vista and Writing to the Registry |
|
|
Mark Jacobs schreef:
| Quote: | I have an application that cannot write to the registry unless I set its
properties, compatibility to run as admin. After doing this, each time
the PC is restarted, and the app is set launch at boot up, but I get a
UAC message asking me if I'm sure I want to allow my app to run with
admin privileges. Is there any way programmatically to avoid this prompt
each time? Is there a better way of ensuring an app can write to the
registry under Vista? TIA,
|
You would probably have this problem to on windows 2000 with standard users.
Yes use registry keys to which you do have write access as a normal
user. The keys under HKEY_LOCAL_MACHINE are generally readonly for users
so store as much as possible under HKEY_CURRENT_USER instead.
If you must have write access to keys under HKEY_LOCAL_MACHINE it is
possible to create keys with different security settings. But I never
tried it myself as using HKEY_CURRENT_USER has aalways been sufficient
for me. Ofcourse these keys should be created when running as
administrator so it might be a good idea to create them during installation.
Eelke |
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Wed May 02, 2007 5:42 pm Post subject: Re: Vista and Writing to the Registry |
|
|
"Eelke" <e.klein (AT) remove (DOT) mplussoftware.nl> wrote in message
news:463869f2$1 (AT) newsgroups (DOT) borland.com...
| Quote: | If you must have write access to keys under HKEY_LOCAL_MACHINE it is
possible to create keys with different security settings. But I never tried
it myself as using HKEY_CURRENT_USER has aalways been sufficient for me.
Ofcourse these keys should be created when running as administrator so it
might be a good idea to create them during installation.
|
Thanks for the reply. So, there is probably no solution, and the user will
have to approve at every reboot under Vista (not too bad, I suppose). That's
because the application is MJ Registry Watcher (
http://www.jacobsm.com/mjsoft.htm#rgwtchr with a forum thread at
http://www.wilderssecurity.com/showthread.php?t=54666&page=21 ) and it needs
to write to any registry branch if a trojan has done something naughty! Thanks
again,
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed May 02, 2007 9:50 pm Post subject: Re: Vista and Writing to the Registry |
|
|
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote in
message news:4638664c (AT) newsgroups (DOT) borland.com...
| Quote: | I have an application that cannot write to the registry
unless I set its properties, compatibility to run as admin.
|
Then you are probably writing to a section of the registry that you
shouldn't be, unless you really are trying to perform tasks that are
deemed to be administrative in nature. What exactly are you trying to
do? Also, make sure that you are opening the key(s) with the proper
access rights as well. For instance, TRegistry defaults to requiring
admin rights by default, so you would have to set the TRegistry.Access
property accordingly before opening a key.
| Quote: | After doing this, each time the PC is restarted, and the app is set
launch at boot up, but I get a UAC message asking me if I'm sure
I want to allow my app to run with admin privileges. Is there any
way programmatically to avoid this prompt each time?
|
No. That would circumvent what UAC is all about.
| Quote: | Is there a better way of ensuring an app can write to the registry
under Vista?
|
Don't write to restrictive areas to begin with, unless you absolutely
have to (in which case, you need admin rights to access them).
Gambit |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed May 02, 2007 9:55 pm Post subject: Re: Vista and Writing to the Registry |
|
|
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote in
message news:46388732$1 (AT) newsgroups (DOT) borland.com...
| Quote: | That's because the application is MJ Registry Watcher... and
it needs to write to any registry branch if a trojan has done
something naughty!
|
Have you considered changing your watcher to be a system service
instead of a standalone application? A service runs in the SYSTEM
account by default and thus has full access to the Registry, and can
also run when no user is logged in.
Gambit |
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Thu May 03, 2007 1:20 pm Post subject: Re: Vista and Writing to the Registry |
|
|
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:4638c277$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Have you considered changing your watcher to be a system service
instead of a standalone application? A service runs in the SYSTEM
account by default and thus has full access to the Registry, and can
also run when no user is logged in.
|
Yowch! There's a lot of UI and splitting the engine into a service whilst
cooperating with the UI part is a massive change and a lot of work for a hobby
project I offer to the public for free. Thanks anyway. They'll just have to OK
it at every reboot under Vista - not a biggy.
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk |
|
| Back to top |
|
 |
Alan Bellingham Guest
|
Posted: Thu May 03, 2007 1:55 pm Post subject: Re: Vista and Writing to the Registry |
|
|
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote:
| Quote: | Yowch! There's a lot of UI and splitting the engine into a service whilst
cooperating with the UI part is a massive change and a lot of work for a hobby
project I offer to the public for free. Thanks anyway. They'll just have to OK
it at every reboot under Vista - not a biggy.
|
Ouch. Indeed, not worth doing then.
It does show the value of splitting UI from logic code, though. I've at
least one piece of code that needs similarly reshaping.
Alan Bellingham
--
ACCU Conference 2008: 2-5 April 2008 - Oxford (probably), UK |
|
| Back to top |
|
 |
Colin B Maharaj Guest
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|