Connecting Tech Pros Worldwide Help | Site Map

Issue with RegOpenKeyEx

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 03:59 AM
VJK
Guest
 
Posts: n/a
Default Issue with RegOpenKeyEx

This question is related to Windows registry key opening.

Please refer to the following two lines of VC++ code

printf ("queryRegistrySetting:%s - %s - %s\n", subElement,
variableName, variableType);
[color=blue]
> output: queryRegistrySetting: Software\\xx\\xx\\xx\\xx\\xx - Args -[/color]
EXPAND_STRING

long result = RegOpenKeyEx (HKEY_LOCAL_MACHINE, subElement, 0,
KEY_ALL_ACCESS, &key);
[color=blue]
> output: fails with return value of 87[/color]
[color=blue]
>From winerror.h: #define ERROR_INVALID_PARAMETER 87L // dderror[/color]

But,

long result = RegOpenKeyEx (HKEY_LOCAL_MACHINE,
"Software\\xx\\xx\\xx\\xx\\xx", 0, KEY_ALL_ACCESS, &key);

succeeds without any error. As you can see, in the second case, I have
replaced the variable subElement, with actual value.

Once it succeeds with the above change, even if I use the variable
subElement, i.e.

long result = RegOpenKeyEx (HKEY_LOCAL_MACHINE, subElement, 0,
KEY_ALL_ACCESS, &key);

succeeds without any error, till I logout and login or reboot the
system.

Alternate way of executing RegOpenKeyEx without error:
----------------------------------------------------------------------------------

Instead of replacing subElement with actual value, if I do,

a. Start->Run->regedit
b. this opens the registry editor.
c. without doing any change, I just close the registry editor.

After this,

long result = RegOpenKeyEx (HKEY_LOCAL_MACHINE, subElement, 0,
KEY_ALL_ACCESS, &key); succeeds without any error.

Could someone, explain, if they have faced similar issue and if so, how
this is solved, please ?

Thanks in advance for your help.


  #2  
Old July 23rd, 2005, 03:59 AM
BigBrian
Guest
 
Posts: n/a
Default Re: Issue with RegOpenKeyEx

>>This question is related to Windows registry key opening.

Then post it to a newsgroup which cares about such things. This
newsgroup is about the standard C++ language, which knows nothing about
the windows registry.

  #3  
Old July 23rd, 2005, 04:00 AM
Stephen Howe
Guest
 
Posts: n/a
Default Re: Issue with RegOpenKeyEx

> This question is related to Windows registry key opening.

So why not post to the Microsoft New Server where there are, no joking,
1000's of newgroups devoted to Microsoft technology? There is an army of
people that will answer your questions.
And similarly if you were using Borland technology, raise matters on the
Borland news server.

You want to subscribe to news://microsoft.news.com

Stephen Howe


  #4  
Old July 23rd, 2005, 04:00 AM
red floyd
Guest
 
Posts: n/a
Default Re: Issue with RegOpenKeyEx

Stephen Howe wrote:[color=blue][color=green]
>>This question is related to Windows registry key opening.[/color]
>
>
> So why not post to the Microsoft New Server where there are, no joking,
> 1000's of newgroups devoted to Microsoft technology? There is an army of
> people that will answer your questions.
> And similarly if you were using Borland technology, raise matters on the
> Borland news server.
>
> You want to subscribe to news://microsoft.news.com
>[/color]

You mean news://news.microsoft.com :-)

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.