Archive: [Win7] Registry data writing - no rights


[Win7] Registry data writing - no rights
Hello,
I have problems with Registry and Win7 rights...

I want to run special Windows folders by Total Commander (for example: Recycle Bin, Control Panel). To do this, I am writing proper data to registry. When user click the folder (for example: Recycle Bin) it will be open in my program - not in Windows Explorer.
The problem is, I don't have rights to write in registry key:
For example:
Recycle Bin:
Run Command:
C:\TC.exe /O /S ::{645FF040-5081-101B-9F08-00AA002F954E}
Want to add below command to this key (not exists):
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\shell\open\command

How can I set rights to this and write my data?
I tried with this command, using Accesss Plugin (no effect):
AccessControl::GrantOnRegKey "HKLM" "SOFTWARE\Classes\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}" "(S-1-5-32-545)" "FullAccess"

Is it possible to write data here? Why I cant write in this location?
(Tested on admin account with UAC enabled, with installer with admin elevation)
Thanks for any help...
-Pawel


If you check the permissions you'll find only TrustedInstaller has read/write access and is the owner. To set yourself as owner you need to enable the SeTakeOwnershipPrivilege privilege for the current process user token. You should then be able to set access control. This page has a complete macro (which enables SeRestorePrivilege):
http://nsis.sourceforge.net/EnumUsersReg

Stu


Thanks Stu,
Sounds complicated, but I hope I can make it work.
I am sure, I will ask yet about something related to this :P
-Pawel