🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
8 messages
8 total messages Started by Mark Jacobs Wed, 02 May 2007 10:21
Vista and Writing to the Registry
#2091
Author: Mark Jacobs
Date: Wed, 02 May 2007 10:21
10 lines
1565 bytes
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
Re: Vista and Writing to the Registry
#2092
Author: Eelke
Date: Wed, 02 May 2007 10:37
22 lines
2044 bytes
Mark Jacobs schreef:
> 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
#2094
Author: Mark Jacobs
Date: Wed, 02 May 2007 12:42
19 lines
2015 bytes
"Eelke" <e.klein@remove.mplussoftware.nl> wrote in message 
news:463869f2$1@newsgroups.borland.com...
> 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
Re: Vista and Writing to the Registry
#2096
Author: Remy Lebeau (TeamB)
Date: Wed, 02 May 2007 16:50
30 lines
2122 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote in
message news:4638664c@newsgroups.borland.com...

> 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.

> 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.

> 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
#1998
Author: Remy Lebeau (TeamB)
Date: Wed, 02 May 2007 16:55
15 lines
1476 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote in
message news:46388732$1@newsgroups.borland.com...

> 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
Re: Vista and Writing to the Registry
#1999
Author: Mark Jacobs
Date: Thu, 03 May 2007 08:20
16 lines
1903 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:4638c277$1@newsgroups.borland.com...
> 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
 
Re: Vista and Writing to the Registry
#2000
Author: Alan Bellingham
Date: Thu, 03 May 2007 08:55
15 lines
1706 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG> wrote:

>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
#2041
Author: Colin B Maharaj
Date: Sat, 12 May 2007 10:59
20 lines
1984 bytes
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:
> 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,
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads