Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Problems Creating a Key under HKEY_LOCAL_MACHINE in Vista

Posted on 2008-06-18
6
649 Views
Last Modified: 2012-06-27
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
LONG lRes = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "Software\\OurKey\0", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &RegKey, NULL);

The user is logged in as an administrator. Does anybody have any Ideas why, in only a few cases, the key is not created?
0
Comment
Question by:jimrichmond
6 Comments
 
LVL 86

Assisted Solution

by:jkr
jkr earned 50 total points
ID: 21815317
I have the feeling that you're a victim of "Registry Virtualization" - see  http://msdn.microsoft.com/en-us/library/aa965884(VS.85).aspx ("Registry Virtualization")
0
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 21815868
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.


Kent
0
 
LVL 19

Expert Comment

by:LordOfPorts
ID: 21816020
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:

http://msdn.microsoft.com/en-us/library/aa379560(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa446595(VS.85).aspx
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 19

Accepted Solution

by:
LordOfPorts earned 75 total points
ID: 21816133
The following is another article that might be useful:

http://www.developer.com/net/cplus/article.php/3677161
0
 
LVL 16

Assisted Solution

by:joinaunion
joinaunion earned 75 total points
ID: 21816951
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.
0
 
LVL 5

Assisted Solution

by:JuckMan
JuckMan earned 50 total points
ID: 21839684
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"

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So who is this article for? If you are like most of the computer users out there, you probably only realize the meaning of 'System maintenance' after something goes wrong. This article is for you if you care about keeping your system working opti…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question