In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to solve the problem of permissions in the VB.NET registry, which is very detailed and has a certain reference value. Friends who are interested must read it!
This example requires a project reference:
Imports Microsoft.Win32 'purpose: registry operation Imports System.Security.AccessControl' purpose: access control
First, add permissions to the VB.NET registry. There are 11 optional permission types broken down, and their corresponding parameters are as follows:
Select Case ComboBox1.Text Case "full control" ObjRegRight = RegistryRights.FullControl Case "query value" ObjRegRight = RegistryRights.QueryValues Case "set value" ObjRegRight = RegistryRights.SetValue Case "create subkey" ObjRegRight = RegistryRights.CreateSubKey Case "enumerate subitem" ObjRegRight = RegistryRights.EnumerateSubKeys Case "notify" ObjRegRight = RegistryRights.Notify Case "create link" ObjRegRight = RegistryRights.CreateLink Case "delete" ObjRegRight = RegistryRights.Delete Case "write DAC" ObjRegRight = RegistryRights.WriteKey Case " Write owner "ObjRegRight = RegistryRights.TakeOwnership Case" read control "ObjRegRight = RegistryRights.ReadPermissions End Select"
Each subdivision permission is divided into two access control types: "allow" and "deny".
Select Case ComboBox2.Text Case "allow" ObjRegAccess = AccessControlType.Allow Case "deny" ObjRegAccess = AccessControlType.Deny End Select
The following are the functions that increase the permissions of the VB.NET registry
In the following two functions, Account represents the system nt account Rights and ControlType are the above-mentioned permission type and access control type, respectively.
Private Sub AddRegistrySecurity (ByVal Str_FileName As String, ByVal Account As String, ByVal Rights As RegistryRights, ByVal ControlType As AccessControlType) Dim RegKey As RegistryRegistryKey = Registry.CurrentUser.CreateSubKey ("fill in the specific key address here") Dim RegkeyAcl As RegistrySecurity = RegKey.GetAccessControl () Dim AccessRule As RegistryAccessRule = New RegistryAccessRule (Account, Rights, ControlType) RegkeyAcl.AddAccessRule (AccessRule) RegKey.SetAccessControl (RegkeyAcl) RegKey.Close () End Sub
Here are the functions that remove the permissions of the registry key
Private Sub RemoveRegistrySecurity (ByVal Str_FileName As String, ByVal Account As String, ByVal Rights As RegistryRights, ByVal ControlType As AccessControlType) Dim RegKey As RegistryRegistryKey = Registry.CurrentUser.CreateSubKey ("fill in the specific key address here") Dim RegkeyAcl As RegistrySecurity = RegKey.GetAccessControl () Dim AccessRule As RegistryAccessRule = New RegistryAccessRule (Account, Rights, ControlType) RegkeyAcl.RemoveAccessRule (AccessRule) RegKey.SetAccessControl (RegkeyAcl) RegKey.Close () End Sub above are all the contents of the article "how to solve the VB.NET registry permission problem" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.