views:

773

answers:

4

Hello,

I am trying to write to the registry from my application, but when I do I get access denied. Of course, it works if i run the app as Administrator. However, with my applcation, it is not initiated by the user. It start automatically.

So, the question is, how do i read/write to my own registry key from the C++ app?

Thanks for any help.

A: 

If your application starts automatically, could it be rewritten as a service? It would have system-level access to registry.

Nemanja Trifunovic
This depends upon the user account used to run the service. However, it is almost always the case.
Splash
Even if it doesn't run as SYSTEM, this might be a good idea. For instance, you can create a special non-interactive user account for the service with precisely the rights needed.
MSalters
A: 

If it's really your key, you control its security. The reason you need Admin rights is probably because you created the key with a DACL that refuses access to "normal" users. The most common way this happens is by inheriting a DACL from a parent key.

MSalters
A: 

is there a way to get my .exe file to execute with admin rights instead of me killing the LUA? When i altar the reg is promots the user which i dont want, i am only adding the file to kill the LUA to give the user full rights to execute my .exe file.

if i can just get it to exeute as admin is would save me editing the reg, i cant find my source for the .exe coded in delphi thats the problem to add anything and the .reg file needs to be ran with the .exe files on vista

any ideas

It looks like this is intended to be a separate question.
JosephStyons