Jerry Dodge
Jerry Dodge

Reputation: 27296

Programatically grant "full control" to "everyone" on a registry key?

I'm trying to figure out how to programatically grant "Everyone" "Full Control" over our software's registry key so non-administrators are able to write to it. However, I cannot find this, the only solution I have found is a third-party registry component that allows you to. I don't want to install a whole third-party library just to be able to do this. Is there perhaps a Windows API call I could make to do this?

This will be done inside a custom application installer of mine. Of course it would have to be done under elevated administrative access, which is another story.

Upvotes: 3

Views: 1779

Answers (2)

RobertFrank
RobertFrank

Reputation: 7394

For many years, our installer has shelled out to cacls to set permissions during installs. It's been quite reliable.

Just figure out what command line arguments you need.

There's lots of documentation on this. For example: http://www.cyberciti.biz/tips/windows-change-access-permissions-from-the-command-line.html

Upvotes: 0

David Heffernan
David Heffernan

Reputation: 613461

The function you need is SetNamedSecurityInfo. This topic on MSDN has sample code that will meet your needs: Modifying the ACLs of an Object in C++.

Upvotes: 5

Related Questions