Problems Creating a Key under HKEY_LOCAL_MACHINE in Vista

We have written a C++ application that creates a registry key to store information in.  On XP computers it works fine and on most Vista computers (Home Premium) it works fine.  However on some Vista Computers it will not create the key.  Otherwise the program works fine, but the key is never created.
The key we're creating is in HKEY_LOCAL_MACHINE\SOFTWARE.  The command we're using to create it is

The user is logged in as an administrator. Does anybody have any Ideas why, in only a few cases, the key is not created?
Who is Participating?
LordOfPortsConnect With a Mentor Commented:
The following is another article that might be useful:
jkrConnect With a Mentor Commented:
I have the feeling that you're a victim of "Registry Virtualization" - see ("Registry Virtualization")
Kent OlsenData Warehouse Architect / DBACommented:
Hi jkr,

One would think that Microsoft would embrace Registry Virtualization as a way to help slow the proliferation of worms and other viruses instead of declaring it obsolete the instant it's announced.

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Security in Vista has changed, even though the user might belong to the Administrators group the process will not run with administrator privileges unless the user explicitly permitted it. You will have to create security descriptor through an instance of SECURITY_ATTRIBUTES structure and pass a pointer to the structure to the RegCreateKeyEx function (currently you are passing NULL for this optional parameter) and ask the OS to elevate the privileges.

The following 2 articles might be useful:
joinaunionConnect With a Mentor Commented:
You can try this open registry again,click edit then permissions make sure all users are set to full control.
Then create your new key then right click  you may get a pop up (windows security)click reorder,make sure all users are set to full.
JuckManConnect With a Mentor Commented:
Even if you log in as administrator, if you want your program to work correctly run it using "run as administrator". You can do this by right clicking on this program and select "run as administrator"

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.