Board index » cppbuilder » Vista and Writing to the Registry

Vista and Writing to the Registry


2007-05-02 06:21:56 PM
cppbuilder104
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
www.dkcomputing.co.uk
 
 

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
 

Re:Vista and Writing to the Registry

"Eelke" < XXXX@XXXXX.COM >wrote in message
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 (
www.jacobsm.com/mjsoft.htm with a forum thread at
www.wilderssecurity.com/showthread.php ) and it needs
to write to any registry branch if a trojan has done something {*word*194}! Thanks
again,
--
Mark Jacobs
DK Computing
www.dkcomputing.co.uk
 

{smallsort}

Re:Vista and Writing to the Registry

"Mark Jacobs" <www.jacobsm.com/mjmsg.htm?BorlandNG>wrote in
message news: XXXX@XXXXX.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
 

Re:Vista and Writing to the Registry

"Mark Jacobs" <www.jacobsm.com/mjmsg.htm?BorlandNG>wrote in
message news:46388732$ XXXX@XXXXX.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 {*word*194}!
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
 

Re:Vista and Writing to the Registry

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
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
www.dkcomputing.co.uk
 

Re:Vista and Writing to the Registry

"Mark Jacobs" <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
 

Re:Vista and Writing to the Registry

Read these guidelines. I have been reading these guidelines since Win
2000 and it has helped me tremendously in understanding what MS expects
from us.
download.microsoft.com/download/d/e/1/de1e0c8f-a222-47bc-b78b-1656d4cf3cf7/WLP-SystemsReqs_309.doc
download.microsoft.com/download/8/e/4/8e4c929d-679a-4238-8c21-2dcc8ed1f35c/Windows%20Vista%20Software%20Logo%20Spec%201.1.doc
Mark Jacobs wrote:
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,
 

Re:Vista and Writing to the Registry

"Colin B Maharaj" < XXXX@XXXXX.COM >wrote in message
Quote
Read these guidelines. I have been reading these guidelines since Win 2000
and it has helped me tremendously in understanding what MS expects from us.
download.microsoft.com/download/d/e/1/de1e0c8f-a222-47bc-b78b-1656d4cf3cf7/WLP-SystemsReqs_309.doc

download.microsoft.com/download/8/e/4/8e4c929d-679a-4238-8c21-2dcc8ed1f35c/Windows%20Vista%20Software%20Logo%20Spec%201.1.doc
Now you can understand why I didn't bother. I hope Vista dies a {*word*193} death
some time soon!
--
Mark Jacobs
DK Computing
www.dkcomputing.co.uk