Problem with registry

Hi,

Is there class(es) to create/remove a user to access registry

I have a problem to register .NET dll for COM interop. I got the "accessed denied" when I using regasm or Assebmly.LoadFile() on window 2003 because the user doesn't have administrator right. I found that happens in HKEY_CLASSES_ROOT\CLSID and It works If I add a user manually in HKEY_CLASSES_ROOT\CLSID.

I think I can solve this problem if there is a class to create/remove user thru the code.
Currently the dll is registered by small program created by .NET 1.1, C# and I can use .NET 2.0 if there is a class for this.

Thanks in advance,
reneesol



Answer this question

Problem with registry

  • Mr. SOAPitStop

    To be able to add/remove the permissions for a user I am quite sure you need to do it as a privileged user, that would also be able to add the key necessary.

    In .NET 2.0 RegistryKey.SetAccessControl() probably is of interest for you.



  • vikas mishra

    Hi,

    My question was not the add/remove permission for a user but add/remove a user as manually did like:
    1. locate HKEY_ACCESS_ROOT/CLSID
    2. right-click the key, and then click permission
    3. click add button on Group or user names
    4. create a new user

    When I create a user, which has not administrator right, as above then a user can register successfully. I like to do above process on codes.

    Thanks,
    reneesol


  • vasu4us

    Full control permission.


  • Thomas Olsson

    RegisterAccessRule requires Identity in first parameter, but the user doesn't exist on HKEY_ACCESS_ROOT/CLSID which has only for Administrators, RESTRICED, and SYSTEM if a user with non administrator right opens registry. That's why I try to
    create user who try to register and will remove a user after register dll.

    Am I clear Actually many users will register but HKEY_ACCESS_ROOT/CLSID doesn't have a user like Users(HOST\Users). I can change permission if there is a user like Users(HOST\Users) on HKEY_ACCESS_ROOT/CLSID

    Thanks for your reply,
    reneesol


  • hghrp

    That is what SetAccessControl() would do.

    You give it a RegistrySecurity instance as parameter.

    On that object you can use AddAccessRule()/SetAccessRule() and ModifyAccessRule()

    With those you will set the RegistryAccessRule for a RegistryKey.



  • MichaelMcD

    Just to be clear, what permission does the user have to the registry key that is trying to modify it

  • Problem with registry