Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access HKEY_LOCAL_MACHINE Registry Key from non-Administrators accoun

Status
Not open for further replies.

dc2000

Programmer
Jun 7, 2005
48
US
Hi everyone:


I am creating a program that requires registration, so I am attempting to write all the user information into the Windows Registry under HKEY_LOCAL_MACHINE key for it to be accessible if my program is run from every user account on that machine. Everything works great until a user logs on that doesn't have administrative privileges (like a Guest account on Windows XP). In this case RegCreateKeyEx API returns ERROR_ACCESS_DENIED and my program returns an error. I tried searching on-line but didn't find any way to overcome this issue?

Here's a code example of how I open my registry key:
Code:
LONG nRes = RegCreateKeyEx(HKEY_LOCAL_MACHINE, pKeyName, NULL, _T(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &nDisp);

What am I doing wrong? Should I use some other way to store registration specific data?

Thank you in advance...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top