Setting Regisrty Permission

A

Austin Myers

I need to be able to programmincally set (USER) permissions on a registry
key. I've read the Knowledge Base articles and they all point to a couple
of articles that seem to have been pulled form the knowledge base. (What's
up with that?) I've so tried numerous samples from various forums, none of
them work.

To be specific, my code will be installed by the admin (assuming the admin
has the machine locked down) and at this time I want to set permission for a
registry key so that when users log on they (my code) has access to that
key.

Help....
 
C

Cor Ligthert [MVP]

Austin,

http://msdn.microsoft.com/library/d...tml/frlrfmicrosoftwin32registryclasstopic.asp

I got it, you want to set the registry keys not for the Admin as the current
local user and not all users but for another user which can logon on this
computer. But therefore his/here User registry information is not at the
moment in the registry.

Not that I know it, however maybe others had the same problems reading your
message as I had and understand it now better.

I write this because reading your message this knowledge came very late, I
had already made another answer, I have left that link from that message.

Cor
 
A

Austin Myers

Cor Ligthert said:
I got it, you want to set the registry keys not for the Admin as the
current local user and not all users but for another user which can logon
on this computer.

Almost, I want to simply have the admin (during the install of my code) to
make a key read and write accessible with my add in regardless of the users
permissions or rights. I do NOT want the admin to be required to make
manual changes to the registry. Hence my need to do it in code.

An example: Several people use a machine as limited users. The Admin
installs my add in, which writes keys to the registry. Once completed ANY
user that logs on the machine should be able to use the add in and access
the needed registry keys. As an FYI: I am storing my products registration
key in the registry along with some add in settings, etc.
 
M

Michel Posseth [MCP]

1. Do you want to set registry acces by code ? or 2 do you want that your
code can access the registry keys while the user ( with non admin
priviliges ) can access the registry through your app ?

both are 2 total differnt things

if you want to write information for a user in the registry , you do this in
the current user section you do not need to set specific rights for the user
in this section as it is there own private data

regards

Michel Posseth
 
A

Austin Myers

Michel Posseth said:
1. Do you want to set registry acces by code ? or 2 do you want that
your code can access the registry keys while the user ( with non admin
priviliges ) can access the registry through your app ?


Yes to both. When the Admin installs my code, I want it to make the needed
permission changes at that time so the Admin does not have to do it
manually. (With say regedit) After that change has been made, I want my
code to be able to access those keys regardless of the users rights.
 
M

Michel Posseth [MCP]

Austin ,,

if i understand you corectly , you want to set a license key during
installation / registration by the admin
and want to read this key when the user starts the program vor validation ?
( am i correct )

in this case write the key under HKEY_LOCAL_MACHINE\SOFTWARE\

the local ACL wil take care of this as the administrator has full
priviliges and the users have read priviliges under this key

hth

Michel
 
A

Austin Myers

Michel Posseth said:
Austin ,,

if i understand you corectly , you want to set a license key during
installation / registration by the admin
and want to read this key when the user starts the program vor validation
? ( am i correct )

Correct, mostly. (I also need to store some settings from my code.)

in this case write the key under HKEY_LOCAL_MACHINE\SOFTWARE\


Did, and when I log in as a limited user and my code tries to read it I get
an error saying I don't have permission to use that part of the registry.


the local ACL wil take care of this as the administrator has full
priviliges and the users have read priviliges under this key

Not that I can see.

I fully admit that I am floundering here with .NET, it was soooo much
simpler in VB.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top