Microsoft.Win32.Registry.AccessControl
9.0.0-preview.2.24128.5
Prefix Reserved
See the version list below for details.
dotnet add package Microsoft.Win32.Registry.AccessControl --version 9.0.0-preview.2.24128.5
NuGet\Install-Package Microsoft.Win32.Registry.AccessControl -Version 9.0.0-preview.2.24128.5
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="9.0.0-preview.2.24128.5" />
paket add Microsoft.Win32.Registry.AccessControl --version 9.0.0-preview.2.24128.5
#r "nuget: Microsoft.Win32.Registry.AccessControl, 9.0.0-preview.2.24128.5"
// Install Microsoft.Win32.Registry.AccessControl as a Cake Addin #addin nuget:?package=Microsoft.Win32.Registry.AccessControl&version=9.0.0-preview.2.24128.5&prerelease // Install Microsoft.Win32.Registry.AccessControl as a Cake Tool #tool nuget:?package=Microsoft.Win32.Registry.AccessControl&version=9.0.0-preview.2.24128.5&prerelease
About
Provides support for managing access control lists for Microsoft.Win32.RegistryKey
.
Key Features
- Get access control lists for a registry key.
- Get a specific sections of an access control list.
- Set the access control list for a registry key.
How to Use
using Microsoft.Win32;
using System.Security.AccessControl;
// Open a registry key (or create it if it doesn't exist)
using RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("TestKey");
if (registryKey == null)
{
Console.WriteLine("Failed to create or open the registry key.");
return;
}
// Get the current access control list (ACL) for the registry key
RegistrySecurity registrySecurity = registryKey.GetAccessControl();
Console.WriteLine("Current Access Control List (ACL):");
Console.WriteLine(registrySecurity.GetSecurityDescriptorSddlForm(AccessControlSections.Access));
// Create a new access rule granting full control to the current user
string currentUser = Environment.UserName;
RegistryAccessRule accessRule = new RegistryAccessRule(currentUser, RegistryRights.FullControl, InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow);
// Add the new access rule to the ACL
registrySecurity.AddAccessRule(accessRule);
// Set the updated ACL on the registry key
registryKey.SetAccessControl(registrySecurity);
// Get and display the updated ACL for the registry key using the second GetAccessControl overload
RegistrySecurity updatedRegistrySecurity = registryKey.GetAccessControl(AccessControlSections.Access);
Console.WriteLine("Updated Access Control List (ACL):");
Console.WriteLine(updatedRegistrySecurity.GetSecurityDescriptorSddlForm(AccessControlSections.Access));
Main Types
The main type provided by this library is:
Microsoft.Win32.RegistryAclExtensions
Additional Documentation
Feedback & Contributing
Microsoft.Win32.Registry.AccessControl is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.Win32.Registry (>= 5.0.0)
- System.Security.AccessControl (>= 6.0.0)
-
.NETStandard 2.0
- Microsoft.Win32.Registry (>= 5.0.0)
- System.Security.AccessControl (>= 6.0.0)
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (10)
Showing the top 5 NuGet packages that depend on Microsoft.Win32.Registry.AccessControl:
Package | Downloads |
---|---|
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard. |
|
System.Management.Automation
Runtime for hosting PowerShell |
|
Microsoft.PowerShell.SDK
Runtime for hosting PowerShell |
|
DiscUtils.Registry
DiscUtils Registry |
|
Microsoft.CST.AttackSurfaceAnalyzer
Microsoft Attack Surface Analyzer is an open source security tool that analyzes the attack surface of a target system and reports on potential security vulnerabilities introduced during the installation of software or system misconfiguration. This package contains the AttackSurfaceAnalyzer library. For the CLI Dotnet Tool, see Microsoft.CST.AttackSurfaceAnalyzer.CLI. |
GitHub repositories (5)
Showing the top 5 popular GitHub repositories that depend on Microsoft.Win32.Registry.AccessControl:
Repository | Stars |
---|---|
PowerShell/PowerShell
PowerShell for every system!
|
|
microsoft/AttackSurfaceAnalyzer
Attack Surface Analyzer can help you analyze your operating system's security configuration for changes during software installation.
|
|
DiscUtils/DiscUtils
Utility libraries to interact with discs, filesystem formats and more
|
|
dotnet/dotnet
Home of .NET's Virtual Monolithic Repository which includes all the code needed to build the .NET SDK from source
|
|
unchase/Unchase.OpenAPI.Connectedservice
:scroll: Visual Studio extension to generate OpenAPI (Swagger) web service reference.
|