I've been hounding google for ways to set permissions in the registry (xp based systems and above), and I have come across many solutions, many that are similar to the article here at EE (http://www.experts-exchange.com/Programming/Languages/CPP/Q_20485542.html
However, this method does not seem to work for registry keys that have had all permissions removed, and set to a random owner (an owner other than administrators).
I have created a test key + subkey in my local registry and have tried the methods (and a combination of what I figured might work) but it really only works when my user has access explicitly granted in the permissions of that key.
Of course, my account on XP is administrator, so I dont see why there is a problem, but there is.
With my current setting (removed all users from the permissions list, made Guest the owner), GrantAccess fails, and so does TakeOwnership.
And yes, I've tried the microsoft article (which I've found so many references to, which the only one i have saved) - http://web.archive.org/web/20021021215311/http://msdn.microsoft.com/library/en-us/security/security/taking_object_ownership.asp
which also seems to fail in the manner mentioned above.
Would love to have some code snipit (no error checking if you write it yourself - lots of them have std::cout << bla bla or printf's, and if fails bail from further attempting the function)
Oh, one last part of the challenge; I'm trying to code this using good ol C and WinAPI calls (just like both of the urls displayed) and am compiling with MINGW (and will compile it with MINGWx64 after I get the 32bit code working).
My ultimate goal is to take ownership of the key, give it permissions for the current (administrative) user to access all, and to give it permissions from it's containing key.
From what I have discovered, there is no easy way to inherit permissions nor a quick dirty way to pass permissions to all child objects.