none
Giving Users Full Control to a registry Key RRS feed

  • Question

  • How do I give "users", full control to a registry key in HKLM\SYSTEM\Platform using registry routines in C? (Equivalent of Edit->Permissions and giving full control to the "Users" in RegEdit) ?I'm not sure if I'm giving the right SID for Users. {ComputerName}\User)

    From the forums, I have got these routines. But it does not give full control to the Users. What am I missing here? 


    SID_IDENTIFIER_AUTHORITY sia = SECURITY_WORLD_SID_AUTHORITY; 
    AllocateAndInitializeSid(&sia,1,SECURITY_WORLD_RID,0, 0, 0, 0, 0, 0, 0,&pSid);

    I also tried, 

    1.

    SID_IDENTIFIER_AUTHORITY sia = SECURITY_NT_AUTHORITY; //Everyone- All Users
    AllocateAndInitializeSid(&sia,2,SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_USERS, 0,0,0,0,0,0,&pSid);

    2.

    CreateWellKnownSid(WinBuiltinUsersSid, NULL, pSid, &SidSize);

    followed by these routines.

    InitializeAcl(pDacl, dwAclSize, ACL_REVISION);
    AddAccessAllowedAce(pDacl, ACL_REVISION, KEY_ALL_ACCESS, pSid);
    InitializeSecurityDescriptor(pSD,SECURITY_DESCRIPTOR_REVISION);
    SetSecurityDescriptorDacl(pSD,TRUE,NULL,FALSE); status = RegSetKeySecurity(hKey,DACL_SECURITY_INFORMATION,pSD);

    Thank you in advance!





    • Edited by subram13 Thursday, June 23, 2016 7:04 PM
    Thursday, June 23, 2016 5:16 PM

Answers

  • There are parts of the registry you should not write to.  For a driver it should either be under the drivers services key, or the devices key, anything else is questionable.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    • Marked as answer by subram13 Thursday, June 23, 2016 11:22 PM
    Thursday, June 23, 2016 10:35 PM

All replies

  • As Doron asked you the last time you posted, what problem are you trying to solve.  Trying to change HKLM's security is a really bad idea, changing it so everyone can access is it is just stupid.   Tell us why you think you need this, doing what you are doing in a real product is a great way to be sued, but not much else.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Thursday, June 23, 2016 9:32 PM
  • I'm a newbie to this and when I used Registry routines to write into Registry keys, it dint let me do. Thereby, I was just exploring the way to accomplish that. Thank you! 
    Thursday, June 23, 2016 10:11 PM
  • There are parts of the registry you should not write to.  For a driver it should either be under the drivers services key, or the devices key, anything else is questionable.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    • Marked as answer by subram13 Thursday, June 23, 2016 11:22 PM
    Thursday, June 23, 2016 10:35 PM
  • Sure. Thank you for clarifying!
    Thursday, June 23, 2016 11:22 PM