Microsoft.Win32.RegistryKey.SetAccessControl Method

Applies Windows access control security to an existing registry key.

Syntax

public void SetAccessControl (System.Security.AccessControl.RegistrySecurity registrySecurity)

Parameters

registrySecurity
The access control security to apply to the current subkey.

Remarks

To modify permissions for a registry key, use the erload:Microsoft.Win32.RegistryKey.GetAccessControl method to obtain a System.Security.AccessControl.RegistrySecurity object representing the existing Windows access control security, modify that System.Security.AccessControl.RegistrySecurity object, and then use the RegistryKey.SetAccessControl(System.Security.AccessControl.RegistrySecurity) method to update security for the key.

Note:

The System.Security.AccessControl.RegistrySecurity object specified for registrySecurity replaces the existing security for the registry key. To add permissions for a new user, use the erload:Microsoft.Win32.RegistryKey.GetAccessControl method to obtain the existing access control security, and then modify it.

Requirements

Namespace: Microsoft.Win32
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0