RegistryKey.GetAccessControl Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the access control security for the current registry key.
GetAccessControl() |
Returns the access control security for the current registry key. |
GetAccessControl(AccessControlSections) |
Returns the specified sections of the access control security for the current registry key. |
- Source:
- RegistryKey.cs
Returns the access control security for the current registry key.
public:
System::Security::AccessControl::RegistrySecurity ^ GetAccessControl();
public System.Security.AccessControl.RegistrySecurity GetAccessControl ();
member this.GetAccessControl : unit -> System.Security.AccessControl.RegistrySecurity
Public Function GetAccessControl () As RegistrySecurity
Returns
An object that describes the access control permissions on the registry key represented by the current RegistryKey.
Exceptions
The user does not have the necessary permissions.
The RegistryKey being manipulated is closed (closed keys cannot be accessed).
The current key has been deleted.
Remarks
This method overload is equivalent to calling the GetAccessControl(AccessControlSections) method overload with the bitwise combination of the following flags: AccessControlSections.Access, AccessControlSections.Owner, and AccessControlSections.Group. You can use that overload to search for other permissions.
The user must have RegistryRights.ReadPermissions rights to call this method.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5 |
- Source:
- RegistryKey.cs
Returns the specified sections of the access control security for the current registry key.
public:
System::Security::AccessControl::RegistrySecurity ^ GetAccessControl(System::Security::AccessControl::AccessControlSections includeSections);
public System.Security.AccessControl.RegistrySecurity GetAccessControl (System.Security.AccessControl.AccessControlSections includeSections);
member this.GetAccessControl : System.Security.AccessControl.AccessControlSections -> System.Security.AccessControl.RegistrySecurity
Public Function GetAccessControl (includeSections As AccessControlSections) As RegistrySecurity
Parameters
- includeSections
- AccessControlSections
A bitwise combination of enumeration values that specifies the type of security information to get.
Returns
An object that describes the access control permissions on the registry key represented by the current RegistryKey.
Exceptions
The user does not have the necessary permissions.
The RegistryKey being manipulated is closed (closed keys cannot be accessed).
The current key has been deleted.
Remarks
To request the access permissions currently granted to users, specify the bitwise combination of the following flags: AccessControlSections.Access, AccessControlSections.Owner, and AccessControlSections.Group. Alternatively, you can use the GetAccessControl() method overload, which specifies exactly that combination of values.
The user must have RegistryRights.ReadPermissions rights to call this method.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: