Admin vs Other accounts (XP)

  • Thread starter Thread starter Micus
  • Start date Start date
M

Micus

Hi All,

I've created a software package. I can install it (for everyone) in the
administrator account and it works great. I then switch to another
non-administrator account and open the application but the program fails to
read any values in the registry. I'm storing the value in the
HKEY_LOCAL_MACHINE\SOFTWARE. Can all users access this registry key? If not,
what root key should I put these values in? This is happening on a Win XP
machine, although I will need to have it install on a 2000 machine as well.

For those who are c++ Win32 savvy, here is the function:

double CRegistry::ReadString(cString strName, double fDefault)
{
HKEY m_hRootKey = HKEY_LOCAL_MACHINE;
cString m_strCurrentPath = "Software\\MyApp\\Settings";
HKEY hKey;
DWORD dwType = REG_SZ;

if (::RegOpenKeyEx(m_hRootKey, LPCTSTR(m_strCurrentPath.c_str()), 0,
KEY_READ, &hKey) != ERROR_SUCCESS) return fDefault;

if (::RegQueryValueEx(hKey, LPCTSTR(strName.c_str()), NULL,
&dwType, (LPBYTE)&d, &dwSize) != ERROR_SUCCESS) d = fDefault;

return fDefault;
}

Thank you - Micus
 
Most users cannot access that key unless Security Permissions are set for
Everyone to READ (at least).
If you want users to be able to copntrol their own environment, READ/WRITE
from HKEY_CURRENT_USER\Software\MyApp\Settings
 
Try setting up failure auditing on the local machine hive. Run regedt32.exe
then browse to HKLM, then
Edit|Permissions|Advanced|Auditing|Add|"everyone"|OK then check the "Failed"
box on Full Control, Set Value, Create Subkey, Enumerate Subkey, Delete,
Create Link

Then try again logged on as a normal user. Then check the Event log security
for errors.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
 
Thanks for both of your responses. You've given me a starting point to
finding a solution. I've posted a similar question in the vc.language news
group and the response pointed to using HKEY_CURRENT_USER as well. I wish
there was a 'HKEY_CURRENT_USER\Everyone\Software' key...

Thanks again - Micus
 
If anyone's interested,

There were two problems and they weren't easy to find while switching
between accounts and trying to debug code. Opening a key in HKLM, as
implemented in my class using KEY_ALL_ACCESS, will fail when the app is
installed by the admin the called by a non-admin account. Solved this by
adding a GetAccessRights() method which finds the access allowed by the
user. All other registry interaction except the product key was placed in
HKCU. Everything seems to be humming along for now.

Regards,
M

Dave Patrick said:
You're welcome.

--

Regards,

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

Micus said:
Thanks for both of your responses. You've given me a starting point to
finding a solution. I've posted a similar question in the vc.language news
group and the response pointed to using HKEY_CURRENT_USER as well. I wish
there was a 'HKEY_CURRENT_USER\Everyone\Software' key...

Thanks again - Micus


fails
to
 
Back
Top