T
thephatp
This is incredibly strange. I used regedit and went to
HKEY_LOCAL_MACHINE and create a new subkey under "Software". I added
a few more, then went into code to try to read them. I kept getting
null returned when I tried to open them, so I decided to try this:
Registry.LocalMachine.GetSubKeyNames()
The results where dumbfounding--they did NOT match what I see in the
Registry under HKEY_LOCAL_MACHINE. The list values returned from the
Registry.LocalMachine.GetSubKeyNames() method is MUCH longer than the
list of subkeys that exist in the registry.
What gives? (I'm really hoping this is an easy explanation for
someone, but I'm just not getting it.)
Also, I'm having another, just as concerning problem. In both the
Registry and in code from the list returned by GetSubKeyNames, the
subkey "Microsoft" exists. However, notice the following:
RegistryKey key1 = Registry.LocalMachine.OpenSubKey( "Software" ); //
This returns the key -- Success
RegistryKey key2 = Registry.LocalMachine.OpenSubKey( "Software\
\Microsoft" ); // This returns NULL
RegistryKey key3 = key1.OpenSubKey( "Microsoft" ) ; // This also
returns NULL
Why could this be happening?
Thanks in advance!
Chad
HKEY_LOCAL_MACHINE and create a new subkey under "Software". I added
a few more, then went into code to try to read them. I kept getting
null returned when I tried to open them, so I decided to try this:
Registry.LocalMachine.GetSubKeyNames()
The results where dumbfounding--they did NOT match what I see in the
Registry under HKEY_LOCAL_MACHINE. The list values returned from the
Registry.LocalMachine.GetSubKeyNames() method is MUCH longer than the
list of subkeys that exist in the registry.
What gives? (I'm really hoping this is an easy explanation for
someone, but I'm just not getting it.)
Also, I'm having another, just as concerning problem. In both the
Registry and in code from the list returned by GetSubKeyNames, the
subkey "Microsoft" exists. However, notice the following:
RegistryKey key1 = Registry.LocalMachine.OpenSubKey( "Software" ); //
This returns the key -- Success
RegistryKey key2 = Registry.LocalMachine.OpenSubKey( "Software\
\Microsoft" ); // This returns NULL
RegistryKey key3 = key1.OpenSubKey( "Microsoft" ) ; // This also
returns NULL
Why could this be happening?
Thanks in advance!
Chad