Registry Problem

G

glenn

I am executing the following line:

RegistryKey reg = Registry.CurrentUser.OpenSubKey("Software\\My
Key\\License\\Settings");

DBPath = (String)reg.GetValue("DBPath");

and it works. However, it is not accessing the HKEY_Current_User key. Its
accessing HKEY_Users...

What gives?

glenn
 
D

Dmytro Lapshyn [MVP]

Hi Glenn,

How have you detected the real key accessed is HKEY_Users?
If you used something like SysInternals' RegMon, this might be the correct
result, because HKCU is actually a virtual registry hive the system maps to
HKEY_USERS\{SID}\
 
G

glenn

well, I had to do a search for a unique word I had in the key. It only
found it there. I knew it was there because I had code to determine if the
key was there before it continued and it kept continuing despite me not
seeing they key. after doing the search is when I noticed it down in the
users key.

thanks,

glenn


Dmytro Lapshyn said:
Hi Glenn,

How have you detected the real key accessed is HKEY_Users?
If you used something like SysInternals' RegMon, this might be the correct
result, because HKCU is actually a virtual registry hive the system maps
to HKEY_USERS\{SID}\

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


glenn said:
I am executing the following line:

RegistryKey reg = Registry.CurrentUser.OpenSubKey("Software\\My
Key\\License\\Settings");

DBPath = (String)reg.GetValue("DBPath");

and it works. However, it is not accessing the HKEY_Current_User key.
Its accessing HKEY_Users...

What gives?

glenn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top