PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Read from Registry on Vista

Reply

Read from Registry on Vista

 
Thread Tools Rate Thread
Old 13-02-2007, 12:07 AM   #1
vovan
Guest
 
Posts: n/a
Default Read from Registry on Vista


I'm using this approach to read from registry.
Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess, _
"HKEY_LOCAL_MACHINE\SOFTWARE\SRS
Enterprises\Coordinator\Settings")
'Vlad 02/12/2007
Dim f2 As New
RegistryPermission(RegistryPermissionAccess.AllAccess, _
"HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\SRS
Enterprises\Coordinator\Settings")

Dim pRegKey As RegistryKey = Registry.LocalMachine
pRegKey.OpenSubKey("SOFTWARE\\SRS
Enterprises\\Coordinator\\Settings")
Dim val As Object = pRegKey.GetValue("CSSLQN")

It works on Windows XP, on Windows Server 2003. It doesn't work on Vista
Business. pRegKey.GetValue("CSSLQN") returns null. The key with value
exists.

What should I add to my code to get the value from a registry?
Thank you

Vovan


  Reply With Quote
Old 13-02-2007, 12:37 AM   #2
Newbie Coder
Guest
 
Posts: n/a
Default Re: Read from Registry on Vista

After the registry permission declaration you don't use demand or assert.
So, you declare it but never use it

Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess,
"HKEY_LOCAL_MACHINE\SOFTWARE\SRS Enterprises\Coordinator\Settings")

f.Demand() ' Personally I use ASSERT because at the end you can use
f.RevertAssert(), but you cannot do that with Demand()

Please try & post back

--
Newbie Coder
(It's just a name)


  Reply With Quote
Old 13-02-2007, 01:57 AM   #3
vovan
Guest
 
Posts: n/a
Default Re: Read from Registry on Vista

Thank you
I tried both one by one. I still get null from the key.

Vovan

"Newbie Coder" <newbiecoder@spammeplease.com> wrote in message
news:ujRw6cwTHHA.2256@TK2MSFTNGP02.phx.gbl...
> After the registry permission declaration you don't use demand or assert.
> So, you declare it but never use it
>
> Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess,
> "HKEY_LOCAL_MACHINE\SOFTWARE\SRS Enterprises\Coordinator\Settings")
>
> f.Demand() ' Personally I use ASSERT because at the end you can use
> f.RevertAssert(), but you cannot do that with Demand()
>
> Please try & post back
>
> --
> Newbie Coder
> (It's just a name)
>
>



  Reply With Quote
Old 13-02-2007, 03:53 AM   #4
Steve Cochran
Guest
 
Posts: n/a
Default Re: Read from Registry on Vista

First of all, why do you set the permissions to all access when you are just
reading? Second, why are you using \\ instead of \ ?

maybe you need to proofread your doce

steve

"vovan" <someone@vovan.com> wrote in message
news:%231VL5LwTHHA.2124@TK2MSFTNGP06.phx.gbl...
> I'm using this approach to read from registry.
> Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess, _
> "HKEY_LOCAL_MACHINE\SOFTWARE\SRS
> Enterprises\Coordinator\Settings")
> 'Vlad 02/12/2007
> Dim f2 As New
> RegistryPermission(RegistryPermissionAccess.AllAccess, _
>
> "HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\SRS
> Enterprises\Coordinator\Settings")
>
> Dim pRegKey As RegistryKey = Registry.LocalMachine
> pRegKey.OpenSubKey("SOFTWARE\\SRS
> Enterprises\\Coordinator\\Settings")
> Dim val As Object = pRegKey.GetValue("CSSLQN")
>
> It works on Windows XP, on Windows Server 2003. It doesn't work on Vista
> Business. pRegKey.GetValue("CSSLQN") returns null. The key with value
> exists.
>
> What should I add to my code to get the value from a registry?
> Thank you
>
> Vovan
>


  Reply With Quote
Old 13-02-2007, 10:12 AM   #5
Larry Linson
Guest
 
Posts: n/a
Default Re: Read from Registry on Vista

vb dotnet does not run on Vista; you better rewrite your **** in VB6

-Larry

  Reply With Quote
Old 13-02-2007, 01:41 PM   #6
vovan
Guest
 
Posts: n/a
Default Re: Read from Registry on Vista

I found the sample of the code a couple of years ago. I replaced its values
with my values and it worked right away.
Since that I never had any problem with that code before Vista.
I use it in Windows Service project.
I tested it in Windows Form project. It works on Vista.
So the same code does work in Windows Form project on Vista, in any project
before Vista and doesn't work in Windows Service project on Vista.
What's the difference?

Vovan

"Steve Cochran" <scochran@oehelp.com> wrote in message
news:03F8EB62-2A72-4A12-92A0-035FE513738A@microsoft.com...
> First of all, why do you set the permissions to all access when you are
> just reading? Second, why are you using \\ instead of \ ?
>
> maybe you need to proofread your doce
>
> steve
>
> "vovan" <someone@vovan.com> wrote in message
> news:%231VL5LwTHHA.2124@TK2MSFTNGP06.phx.gbl...
>> I'm using this approach to read from registry.
>> Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess, _
>> "HKEY_LOCAL_MACHINE\SOFTWARE\SRS
>> Enterprises\Coordinator\Settings")
>> 'Vlad 02/12/2007
>> Dim f2 As New
>> RegistryPermission(RegistryPermissionAccess.AllAccess, _
>>
>> "HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\SRS
>> Enterprises\Coordinator\Settings")
>>
>> Dim pRegKey As RegistryKey = Registry.LocalMachine
>> pRegKey.OpenSubKey("SOFTWARE\\SRS
>> Enterprises\\Coordinator\\Settings")
>> Dim val As Object = pRegKey.GetValue("CSSLQN")
>>
>> It works on Windows XP, on Windows Server 2003. It doesn't work on Vista
>> Business. pRegKey.GetValue("CSSLQN") returns null. The key with value
>> exists.
>>
>> What should I add to my code to get the value from a registry?
>> Thank you
>>
>> Vovan
>>

>



  Reply With Quote
Old 13-02-2007, 05:01 PM   #7
RobinS
Guest
 
Posts: n/a
Default Re: Read from Registry on Vista

Yes it does.

Robin S.
---------------------------------
"Larry Linson" <larrylinsonjr@hotmail.com> wrote in message
news:1171361541.189193.67980@s48g2000cws.googlegroups.com...
> vb dotnet does not run on Vista; you better rewrite your **** in VB6
>
> -Larry
>



  Reply With Quote
Old 13-02-2007, 09:19 PM   #8
Steve Cochran
Guest
 
Posts: n/a
Default Re: Read from Registry on Vista

I guess they got more specific in what they would allow and not allow or
what was conventional or not. I don't know, but the error is probably due
to the double slashes.

steve

"vovan" <someone@vovan.com> wrote in message
news:uP7DiS3THHA.1212@TK2MSFTNGP03.phx.gbl...
>I found the sample of the code a couple of years ago. I replaced its values
>with my values and it worked right away.
> Since that I never had any problem with that code before Vista.
> I use it in Windows Service project.
> I tested it in Windows Form project. It works on Vista.
> So the same code does work in Windows Form project on Vista, in any
> project before Vista and doesn't work in Windows Service project on Vista.
> What's the difference?
>
> Vovan
>
> "Steve Cochran" <scochran@oehelp.com> wrote in message
> news:03F8EB62-2A72-4A12-92A0-035FE513738A@microsoft.com...
>> First of all, why do you set the permissions to all access when you are
>> just reading? Second, why are you using \\ instead of \ ?
>>
>> maybe you need to proofread your doce
>>
>> steve
>>
>> "vovan" <someone@vovan.com> wrote in message
>> news:%231VL5LwTHHA.2124@TK2MSFTNGP06.phx.gbl...
>>> I'm using this approach to read from registry.
>>> Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess, _
>>> "HKEY_LOCAL_MACHINE\SOFTWARE\SRS
>>> Enterprises\Coordinator\Settings")
>>> 'Vlad 02/12/2007
>>> Dim f2 As New
>>> RegistryPermission(RegistryPermissionAccess.AllAccess, _
>>>
>>> "HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\SRS
>>> Enterprises\Coordinator\Settings")
>>>
>>> Dim pRegKey As RegistryKey = Registry.LocalMachine
>>> pRegKey.OpenSubKey("SOFTWARE\\SRS
>>> Enterprises\\Coordinator\\Settings")
>>> Dim val As Object = pRegKey.GetValue("CSSLQN")
>>>
>>> It works on Windows XP, on Windows Server 2003. It doesn't work on Vista
>>> Business. pRegKey.GetValue("CSSLQN") returns null. The key with value
>>> exists.
>>>
>>> What should I add to my code to get the value from a registry?
>>> Thank you
>>>
>>> Vovan
>>>

>>

>
>


  Reply With Quote
Old 13-02-2007, 09:52 PM   #9
vovan
Guest
 
Posts: n/a
Default Re: Read from Registry on Vista

I tried single slashes before my original post. The same problem.

Vovan

"Steve Cochran" <scochran@oehelp.com> wrote in message
news:upkfgS7THHA.4632@TK2MSFTNGP04.phx.gbl...
>I guess they got more specific in what they would allow and not allow or
>what was conventional or not. I don't know, but the error is probably due
>to the double slashes.
>
> steve
>
> "vovan" <someone@vovan.com> wrote in message
> news:uP7DiS3THHA.1212@TK2MSFTNGP03.phx.gbl...
>>I found the sample of the code a couple of years ago. I replaced its
>>values with my values and it worked right away.
>> Since that I never had any problem with that code before Vista.
>> I use it in Windows Service project.
>> I tested it in Windows Form project. It works on Vista.
>> So the same code does work in Windows Form project on Vista, in any
>> project before Vista and doesn't work in Windows Service project on
>> Vista.
>> What's the difference?
>>
>> Vovan
>>
>> "Steve Cochran" <scochran@oehelp.com> wrote in message
>> news:03F8EB62-2A72-4A12-92A0-035FE513738A@microsoft.com...
>>> First of all, why do you set the permissions to all access when you are
>>> just reading? Second, why are you using \\ instead of \ ?
>>>
>>> maybe you need to proofread your doce
>>>
>>> steve
>>>
>>> "vovan" <someone@vovan.com> wrote in message
>>> news:%231VL5LwTHHA.2124@TK2MSFTNGP06.phx.gbl...
>>>> I'm using this approach to read from registry.
>>>> Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess, _
>>>> "HKEY_LOCAL_MACHINE\SOFTWARE\SRS
>>>> Enterprises\Coordinator\Settings")
>>>> 'Vlad 02/12/2007
>>>> Dim f2 As New
>>>> RegistryPermission(RegistryPermissionAccess.AllAccess, _
>>>>
>>>> "HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\SRS
>>>> Enterprises\Coordinator\Settings")
>>>>
>>>> Dim pRegKey As RegistryKey = Registry.LocalMachine
>>>> pRegKey.OpenSubKey("SOFTWARE\\SRS
>>>> Enterprises\\Coordinator\\Settings")
>>>> Dim val As Object = pRegKey.GetValue("CSSLQN")
>>>>
>>>> It works on Windows XP, on Windows Server 2003. It doesn't work on
>>>> Vista Business. pRegKey.GetValue("CSSLQN") returns null. The key with
>>>> value exists.
>>>>
>>>> What should I add to my code to get the value from a registry?
>>>> Thank you
>>>>
>>>> Vovan
>>>>
>>>

>>
>>

>



  Reply With Quote
Old 14-02-2007, 02:35 AM   #10
dbahooker@hotmail.com
Guest
 
Posts: n/a
Default Re: Read from Registry on Vista

sorry dude

vb 2002, 2003 and 2005 don't work on vista

welcome to visual fred, bitch you should have known better than to
trust MS




On Feb 12, 4:07 pm, "vovan" <some...@vovan.com> wrote:
> I'm using this approach to read from registry.
> Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess, _
> "HKEY_LOCAL_MACHINE\SOFTWARE\SRS
> Enterprises\Coordinator\Settings")
> 'Vlad 02/12/2007
> Dim f2 As New
> RegistryPermission(RegistryPermissionAccess.AllAccess, _
> "HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\SRS
> Enterprises\Coordinator\Settings")
>
> Dim pRegKey As RegistryKey = Registry.LocalMachine
> pRegKey.OpenSubKey("SOFTWARE\\SRS
> Enterprises\\Coordinator\\Settings")
> Dim val As Object = pRegKey.GetValue("CSSLQN")
>
> It works on Windows XP, on Windows Server 2003. It doesn't work on Vista
> Business. pRegKey.GetValue("CSSLQN") returns null. The key with value
> exists.
>
> What should I add to my code to get the value from a registry?
> Thank you
>
> Vovan



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off