HKLM and HKCU Priority

  • Thread starter David Burkinshaw
  • Start date
D

David Burkinshaw

I have a question regarding which hive has priority. We write software and
our prior version wrote keys to HKLM\Software\ODBC\..... but our new version
has to write to HKCU\Software\ODBC\....
I noticed on one PC (Server 2003) that the HKLM key value was used but on
another (XP SP2) machine the HKCU key value was used. One of our policies is
to never remove old keys from the registry (which i think is wrong) but I
can't have different PCs using the wrong key. The reason why the keys are
now in HKCU is because each user has to have their own ODBC entry to point
to their own data folder in C:\Documents and Settings\<user>\Application
Data\<company>\<product>\data
If this doesn't happen then each user could potentially see other users'
data because the data would all be stored in a common folder. They could
also step on each other's data since this is going to be run in a Citrix
style environment. Also, each user is a non-admin so they wouldn't have
Write rights to HKLM so they need to have their keys written to HKCU.
Any insight would be greatly appreciated.

Thanks in advance,

David
 
D

Dave Patrick

HKCU is for user DSN definition while HKLM is for system DSN definition.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
|I have a question regarding which hive has priority. We write software and
| our prior version wrote keys to HKLM\Software\ODBC\..... but our new
version
| has to write to HKCU\Software\ODBC\....
| I noticed on one PC (Server 2003) that the HKLM key value was used but on
| another (XP SP2) machine the HKCU key value was used. One of our policies
is
| to never remove old keys from the registry (which i think is wrong) but I
| can't have different PCs using the wrong key. The reason why the keys are
| now in HKCU is because each user has to have their own ODBC entry to point
| to their own data folder in C:\Documents and Settings\<user>\Application
| Data\<company>\<product>\data
| If this doesn't happen then each user could potentially see other users'
| data because the data would all be stored in a common folder. They could
| also step on each other's data since this is going to be run in a Citrix
| style environment. Also, each user is a non-admin so they wouldn't have
| Write rights to HKLM so they need to have their keys written to HKCU.
| Any insight would be greatly appreciated.
|
| Thanks in advance,
|
| David
|
|
 
D

David Burkinshaw

That makes sense but in this scenario which one would the system use?

A PC has two keys:

HKLM\Software\ODBC\ODBC.INI\MyApp\DefaultDir
(this if from a prior versions install)
and

HKCU\Software\ODBC\ODBC.INI\MyApp\DefaultDir
(this is from the new install)

The HKLM key points to c:\program files\MyCompany\MyApp\Data and the HKCU
points to c:\Documents and Settings\<user>\Application
Data\MyCompany\MyApp\Data. I have a few hundred Crystal reports that use the
driver which is defined by both of these keys. I can't change each report
since we don't know who's installing them thus the final location of their
data folder is unknown to us. One system appeared to use the HKLM settings
where another machine appeared to use the HKCU settings. Should the system
default to HKCU? Is there something that has to be set that forces this?

Thanks,

David
 
D

Dave Patrick

Are you saying the user and system DSN's have the same name? If so I think
HKCU should/would take precedence over HKLM

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| That makes sense but in this scenario which one would the system use?
|
| A PC has two keys:
|
| HKLM\Software\ODBC\ODBC.INI\MyApp\DefaultDir
| (this if from a prior versions install)
| and
|
| HKCU\Software\ODBC\ODBC.INI\MyApp\DefaultDir
| (this is from the new install)
|
| The HKLM key points to c:\program files\MyCompany\MyApp\Data and the HKCU
| points to c:\Documents and Settings\<user>\Application
| Data\MyCompany\MyApp\Data. I have a few hundred Crystal reports that use
the
| driver which is defined by both of these keys. I can't change each report
| since we don't know who's installing them thus the final location of their
| data folder is unknown to us. One system appeared to use the HKLM settings
| where another machine appeared to use the HKCU settings. Should the system
| default to HKCU? Is there something that has to be set that forces this?
|
| Thanks,
|
| David
|
|
|
 
D

David Burkinshaw

That is what i am saying. If HKCU takes prescedence over HKLM then I'll be
fine.

Thanks
 
Joined
Feb 19, 2015
Messages
1
Reaction score
0
I have an VSTO add-in for Excel, this add-in after installation registers in HKCU and HKLM. When i open a new excel file from startup menu, addin loads, but when i open any existing excel file, addin does not load. I wanted to know, whether new file refers HKCU only and existing file refers only HKLM ?
 

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