ghazark
May 5th, 2009, 06:06 PM
Hi,
I am trying to add an entry to CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run to start an application after every reboot and I see that it fails with ERROR_ACCESS_DENIED when running as a standard user.
I have searched online for similar scenarios and suggestions but I have not been able to get it to work. Here is what I have tried:
- Change the ACL of this key and assign the current user as trustee as described in http://msdn.microsoft.com/en-us/library/aa379283(vs.85).aspx. I can do the GetNamesSecurityInfo and create anew ACL and assign GRANT_ACCESS with SetEntrieInAcl but when I try to do the SetNamesSecurityInfo, it comes back with ERROR_ACCESS_DENIED failure (again!).
- I read in a post somewhere that if we get ERROR_ACCESS_DENIED in the above case, we should take ownership so I tried that as well but that one returns with ERROR_NOT_ALL_ASSIGNED.
If anyone has run into this same situation, can you please let me know how to resolve it, or what i am doing wrong?
P.S. I cannot open this key either so I cannot use RegSetKeySecurity function. The only thing I can open is HKEY_CURRENT_USER itself by calling RegOpenCurrentUser function.
Thanks much!
Karineh
I am trying to add an entry to CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run to start an application after every reboot and I see that it fails with ERROR_ACCESS_DENIED when running as a standard user.
I have searched online for similar scenarios and suggestions but I have not been able to get it to work. Here is what I have tried:
- Change the ACL of this key and assign the current user as trustee as described in http://msdn.microsoft.com/en-us/library/aa379283(vs.85).aspx. I can do the GetNamesSecurityInfo and create anew ACL and assign GRANT_ACCESS with SetEntrieInAcl but when I try to do the SetNamesSecurityInfo, it comes back with ERROR_ACCESS_DENIED failure (again!).
- I read in a post somewhere that if we get ERROR_ACCESS_DENIED in the above case, we should take ownership so I tried that as well but that one returns with ERROR_NOT_ALL_ASSIGNED.
If anyone has run into this same situation, can you please let me know how to resolve it, or what i am doing wrong?
P.S. I cannot open this key either so I cannot use RegSetKeySecurity function. The only thing I can open is HKEY_CURRENT_USER itself by calling RegOpenCurrentUser function.
Thanks much!
Karineh