|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to detect the deleting permission for Registry key?How to detect programmatically if current user has the deleting permission
to delete a Registry key in VS 2005? thank you very much! Public Function GetAccessControl As RegistrySecurity
Dim instance As RegistryKey Dim returnValue As RegistrySecurity returnValue = instance.GetAccessControl Show quoteHide quote "YXQ" <ga***@163.com> wrote in message news:%239tsIsWJHHA.4960@TK2MSFTNGP06.phx.gbl... > How to detect programmatically if current user has the deleting permission > to delete a Registry key in VS 2005? thank you very much! > I am very grateful if you can give full code.
Show quoteHide quote "vbnetdev" <ad***@kjmsolutions.com> дÈëÏûÏ¢ news:%23jGiAPYJHHA.1064@TK2MSFTNGP04.phx.gbl... > Public Function GetAccessControl As RegistrySecurity > > Dim instance As RegistryKey > Dim returnValue As RegistrySecurity > > returnValue = instance.GetAccessControl > > > "YXQ" <ga***@163.com> wrote in message > news:%239tsIsWJHHA.4960@TK2MSFTNGP06.phx.gbl... >> How to detect programmatically if current user has the deleting >> permission to delete a Registry key in VS 2005? thank you very much! >> > > Be careful of the 163.com spam gang & comcast.net who are both using these
newsgroups Show quoteHide quote "YXQ" <ga***@163.com> wrote in message news:uB1XfhZJHHA.3668@TK2MSFTNGP02.phx.gbl... > I am very grateful if you can give full code. > > "vbnetdev" <ad***@kjmsolutions.com> дÈëÏûÏ¢ > news:%23jGiAPYJHHA.1064@TK2MSFTNGP04.phx.gbl... > > Public Function GetAccessControl As RegistrySecurity > > > > Dim instance As RegistryKey > > Dim returnValue As RegistrySecurity > > > > returnValue = instance.GetAccessControl > > > > > > "YXQ" <ga***@163.com> wrote in message > > news:%239tsIsWJHHA.4960@TK2MSFTNGP06.phx.gbl... > >> How to detect programmatically if current user has the deleting > >> permission to delete a Registry key in VS 2005? thank you very much! > >> > > > > > This will bomb as not accetpable. If you change it to currentuser if you
have admin success it shoudl proceed without problem. Sub Test3() Dim regKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine Try regKey.OpenSubKey("console", Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.Delete).ToString() Catch ex As Exception MessageBox.Show("The specified access to the key was not possible") End Try End Sub Show quoteHide quote "YXQ" <ga***@163.com> wrote in message news:uB1XfhZJHHA.3668@TK2MSFTNGP02.phx.gbl... >I am very grateful if you can give full code. > > "vbnetdev" <ad***@kjmsolutions.com> дÈëÏûÏ¢ > news:%23jGiAPYJHHA.1064@TK2MSFTNGP04.phx.gbl... >> Public Function GetAccessControl As RegistrySecurity >> >> Dim instance As RegistryKey >> Dim returnValue As RegistrySecurity >> >> returnValue = instance.GetAccessControl >> >> >> "YXQ" <ga***@163.com> wrote in message >> news:%239tsIsWJHHA.4960@TK2MSFTNGP06.phx.gbl... >>> How to detect programmatically if current user has the deleting >>> permission to delete a Registry key in VS 2005? thank you very much! >>> >> >> > Thank you.
Show quoteHide quote "vbnetdev" <ad***@kjmsolutions.com> дÈëÏûÏ¢ÐÂÎÅ:ujJ3v5cJHHA.4***@TK2MSFTNGP03.phx.gbl... > This will bomb as not accetpable. If you change it to currentuser if you > have admin success it shoudl proceed without problem. > > Sub Test3() > Dim regKey As Microsoft.Win32.RegistryKey = > Microsoft.Win32.Registry.LocalMachine > > Try > regKey.OpenSubKey("console", > Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree, > System.Security.AccessControl.RegistryRights.Delete).ToString() > Catch ex As Exception > MessageBox.Show("The specified access to the key was not > possible") > End Try > > End Sub > "YXQ" <ga***@163.com> wrote in message > news:uB1XfhZJHHA.3668@TK2MSFTNGP02.phx.gbl... >>I am very grateful if you can give full code. >> >> "vbnetdev" <ad***@kjmsolutions.com> дÈëÏûÏ¢ >> news:%23jGiAPYJHHA.1064@TK2MSFTNGP04.phx.gbl... >>> Public Function GetAccessControl As RegistrySecurity >>> >>> Dim instance As RegistryKey >>> Dim returnValue As RegistrySecurity >>> >>> returnValue = instance.GetAccessControl >>> >>> >>> "YXQ" <ga***@163.com> wrote in message >>> news:%239tsIsWJHHA.4960@TK2MSFTNGP06.phx.gbl... >>>> How to detect programmatically if current user has the deleting >>>> permission to delete a Registry key in VS 2005? thank you very much! >>>> >>> >>> >> > > > |
|||||||||||||||||||||||