BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Vista and Writing to the Registry

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Mark Jacobs
Guest





PostPosted: Wed May 02, 2007 3:21 pm    Post subject: Vista and Writing to the Registry Reply with 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,
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
Back to top
Eelke
Guest





PostPosted: Wed May 02, 2007 3:37 pm    Post subject: Re: Vista and Writing to the Registry Reply with quote



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





PostPosted: Wed May 02, 2007 5:42 pm    Post subject: Re: Vista and Writing to the Registry Reply with quote



"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





PostPosted: Wed May 02, 2007 9:50 pm    Post subject: Re: Vista and Writing to the Registry Reply with quote

"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





PostPosted: Wed May 02, 2007 9:55 pm    Post subject: Re: Vista and Writing to the Registry Reply with quote

"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





PostPosted: Thu May 03, 2007 1:20 pm    Post subject: Re: Vista and Writing to the Registry Reply with quote

"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





PostPosted: Thu May 03, 2007 1:55 pm    Post subject: Re: Vista and Writing to the Registry Reply with quote

"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





PostPosted: Sat May 12, 2007 3:59 pm    Post subject: Re: Vista and Writing to the Registry Reply with 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.


http://download.microsoft.com/download/d/e/1/de1e0c8f-a222-47bc-b78b-1656d4cf3cf7/WLP-SystemsReqs_309.doc

http://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,
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.