Home All Groups Group Topic Archive Search About

How to detect the deleting permission for Registry key?

Author
22 Dec 2006 1:47 AM
YXQ
How to detect programmatically if current user has the deleting permission
to delete a Registry key in VS 2005? thank you very much!

Author
22 Dec 2006 4:43 AM
vbnetdev
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!
>
Author
22 Dec 2006 7:11 AM
YXQ
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!
>>
>
>
Author
22 Dec 2006 11:15 AM
Newbie Coder
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!
> >>
> >
> >
>
Author
22 Dec 2006 1:38 PM
vbnetdev
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!
>>>
>>
>>
>
Author
23 Dec 2006 10:35 AM
yxq
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!
>>>>
>>>
>>>
>>
>
>
>