Windows Vista Forums
Vista Forums Home Join Vista Forums Tech Publications Windows 7 Forum Vista Tutorials Webcasts Tags

Welcome to Vista Forums we are your forum for Windows Vista help and discussion. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Vista Newsgroups > Vista security

Read from Registry on Vista

Update your Vista Drivers
Reply
 
Thread Tools Display Modes
Old 02-12-2007   #1 (permalink)
vovan
Guest


 

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



My System SpecsSystem Spec
Old 02-12-2007   #2 (permalink)
Newbie Coder
Guest


 

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)


My System SpecsSystem Spec
Old 02-12-2007   #3 (permalink)
vovan
Guest


 

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)
>
>



My System SpecsSystem Spec
Old 02-13-2007   #4 (permalink)
vovan
Guest


 

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
>>

>



My System SpecsSystem Spec
Old 02-13-2007   #5 (permalink)
Steve Cochran
Guest


 

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
>>>

>>

>
>


My System SpecsSystem Spec
Old 02-13-2007   #6 (permalink)
vovan
Guest


 

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
>>>>
>>>

>>
>>

>



My System SpecsSystem Spec
Old 02-21-2007   #7 (permalink)
Steve Cochran
Guest


 

Re: Read from Registry on Vista

I have similar code in VS 2005 and it works fine.

steve

"vovan" <someone@vovan.com> wrote in message
news:u7zhLl7THHA.1552@TK2MSFTNGP05.phx.gbl...
>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
>>>>>
>>>>
>>>
>>>

>>

>
>


My System SpecsSystem Spec
Reply
Update your Vista Drivers

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to read 64-bit registry from 32-bit RegRead Eric Hill VB Script 0 08-29-2008 01:26 PM
Read registry using vb/java scripts MSK .NET General 4 07-11-2008 09:48 AM
Re: Printer cannot read registry key? Alan Morris [MSFT] Vista print fax & scan 4 01-09-2008 06:19 PM
Read from Registry on Vista vovan Vista General 7 02-21-2007 04:22 PM
How to read Vista registry values containing @DllFilename.dll? Mark Findlay Vista General 1 09-18-2006 06:10 AM


Complimentary Industry Resources

Vista Forums has joined forces with TradePub.com to offer you a new, exciting, and entirely free professional resource. Visit http://vistax64.tradepub.com today to browse our selection of complimentary Industry magazines, white papers, webinars, podcasts, and more across 34 industry sectors. No credit cards, coupons, or promo codes required. Try it today!




Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51