In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces an example of Array in VB.NET, which has a certain reference value, and interested friends can refer to it. I hope you will gain a lot after reading this article.
This example requires a project reference:
Imports Microsoft.Win32 'purpose: registry operation Imports System.Security.AccessControl' purpose: access control
First of all, add permissions to the keys in the registry, which can be subdivided into 11 optional permission types, with the following parameters:
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
Here are the functions that increase the permissions of the registry key
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 thank you for reading this article carefully I hope the article "examples of Array problems in VB.NET" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.