Solved

Returns NULL ... RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\MyCompany");

Posted on 2008-06-12
4
3,416 Views
Last Modified: 2013-11-29
hello,

I am having a problem reading the registry. The following line returns NULL.
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\MyCompany");

Windows XP 64 bit
IIS running 32bit .NET framework and IIS enabled to run 32 bit apps.

Key was created manually using regedit.

I am administrator on this machine.

Any ideas? thanks

BTW, this works
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE");
0
Comment
Question by:Valimai
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:aphillips
ID: 21775147
This is a real mystery. It's not a privilege problem as SecurityException would be thrown.

Do other sub-keys work?

  RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft");

Have you tried?

  RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE");
  RegistryKey key2 = key.OpenSubKey(@"MyCompany");
0
 
LVL 1

Author Comment

by:Valimai
ID: 21789809
Yes, I tried the SOFTWARE key only and it returned a result. Any sub folder created cannot be read.

We have since decided that the machine has a problem and will re-install the OS.

If you do not mind, I will ask that this question be deleted.
0
 
LVL 41

Accepted Solution

by:
graye earned 500 total points
ID: 21793114
I wouldn't make that assumption!

The 64-bit version of Windows has a Virtual Registry to maintain backwards compatibility with 32-bit apps.   So, in your case, there are actually two views in the registry with same name.  The 64-bit view is available from inside a 64-bit application, and the 32-bit view is available from inside 32-bit applications.

However,  the .Net Framework does not support the ability to switch to the other "view"... so to see the "other" (32bit from 64bit app, or 64 bit from 32bit app) view, you'd have to use the low-level APIs.   There is an unfinished project out on CodePlex that is designed to be drop-in replacement for the .Net Framework's Registry class that provides this missing feature.

http://www.codeplex.com/Registry64bit
0
 
LVL 1

Author Closing Comment

by:Valimai
ID: 31466787
We have re-installed the machine to 32bit. Your explaination sounds plausable.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question