|
-
Feb 28th, 2010, 10:09 AM
#1
Thread Starter
Addicted Member
Registry key code not working in Windows Vista...
I have the following code in my application and the code works fine in Windows 2000, XP but for some reason does not work in Windows Vista, is someone able to help me with this?
Code:
dim myReg as string = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\Software\MyCompany\MySoftware", "Path", Nothing)
Thanks
Simon
-
Feb 28th, 2010, 10:19 AM
#2
Re: Registry key code not working in Windows Vista...
When you say it does not work what do you mean?
Does it fail to run, does it run but return an error, or does it run but return something you weren't expecting.
I'd imagine if it works differently on Vista to XP or 2000 its most likely something to do with security/permissions.
-
Feb 28th, 2010, 10:25 AM
#3
Re: Registry key code not working in Windows Vista...
Hi,
Here's an example how to use Registry keys with vista.
-
Feb 28th, 2010, 10:28 AM
#4
Re: Registry key code not working in Windows Vista...
 Originally Posted by sparrow1
Hi,
Here's an example how to use Registry keys with vista.
I'm confused - I don't see anything in the question about webforms and master pages
-
Feb 28th, 2010, 10:35 AM
#5
Re: Registry key code not working in Windows Vista...
Hi,
No, but I thould it could be very interesting because it says:
This is a command-line tool that enables administrators to obtain security information about files, registry keys, and services, and transfer this information from user to user, from local or global group to group, and from domain to domain.
Enables the Registry Keys.
-
Feb 28th, 2010, 11:02 AM
#6
Thread Starter
Addicted Member
Re: Registry key code not working in Windows Vista...
The code in my first post returns Nothing
I don't understand, are you telling me that no exe in windows Vista can access registry keys.... this does not seem sensible?
I have tried running my app outside of Visual Studio and I get the same result
Thanks
Simon
-
Feb 28th, 2010, 11:07 AM
#7
Re: Registry key code not working in Windows Vista...
No what I'm saying is that in Vista some parts of the registry and file system require elevated permissions, ie running as an administrator. I'm not saying this is definitely the problem but if it worked fine for XP and Windows 2000 its one of the first things to look at.
Have you checked that the registry key exists using Regedit?
-
Feb 28th, 2010, 11:16 AM
#8
Thread Starter
Addicted Member
Re: Registry key code not working in Windows Vista...
The regestry key does exist in regedit.
I have checked the permissions of the registry key in regedit and the permissions have read access. I need the registry key to be able to read by all users as my app checks that another one of my apps exists so that it can be intergrated.
-
Feb 28th, 2010, 11:24 AM
#9
Re: Registry key code not working in Windows Vista...
Not sure why it wouldn't work then if the key definitely exists.. I've just tried it on my machine with Nokia PCSuite :
Code:
Dim myReg As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\Software\Nokia\PCSuite", "Applicationpath1", Nothing)
That works fine. Have you tried checking other keys in the same branch to see if they work?
-
Feb 28th, 2010, 12:46 PM
#10
Re: Registry key code not working in Windows Vista...
HKLM is an Administrator only branch I believe. Most registry access is limited for programs to HKLU (HKEY_LOCAL_USER). That would explain why you may not be able to access it in vista and 7, but in XP.
EDIT: KP, you using Vista or 7?
Last edited by formlesstree4; Feb 28th, 2010 at 12:48 PM.
Reason: Added vista & 7 as the issue
-
Feb 28th, 2010, 01:14 PM
#11
Re: Registry key code not working in Windows Vista...
Unless you have changed the permissions, HKLM can be read by anyone - but only written by an Administrator (or similar).
It has definitely been that way in Windows 2000/XP/Vista/7.
The only difference for Vista/7 is that if a non-Admin user writes to HKLM, it might be virutalised - it will be stored for that user only, so nobody else can read it.
-
Feb 28th, 2010, 01:26 PM
#12
Re: Registry key code not working in Windows Vista...
EDIT: KP, you using Vista or 7?
I'm using Vista.
Permissions don't seem to be a problem - as si_the_geek says that branch look to be unrestricted for reading.
If I was a gambling man I'd say the likelihood is a simple error in the path to the registry key - I'd double and triple check that the spelling is correct before going any further.
-
Feb 28th, 2010, 01:29 PM
#13
Re: Registry key code not working in Windows Vista...
I thought HKLM was restricted for admin only period...I stand corrected then.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|