PC Review


Reply
Thread Tools Rate Thread

Issue with RegOpenKeyEx

 
 
VJK
Guest
Posts: n/a
 
      5th May 2005
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);

> output: queryRegistrySetting: Software\\xx\\xx\\xx\\xx\\xx - Args -

EXPAND_STRING

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

> output: fails with return value of 87


>From winerror.h: #define ERROR_INVALID_PARAMETER 87L // dderror


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 scrool to the subelement,
Software\\xx\\xx\\xx\\xx\\xx and 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.

 
Reply With Quote
 
 
 
 
Crouchie1998
Guest
Posts: n/a
 
      5th May 2005
Try posting your question in the microsoft Visual C newsgroup & not a
Windows 2000 registry one

I know the answer to your question & I will gladly answer it if posted in
the correct newsgroup.

By the way: 'prinf' is a C command that can be used in C++

Crouchie1998
BA (HONS) MCP MCSE


 
Reply With Quote
 
 
 
 
VJK
Guest
Posts: n/a
 
      9th May 2005
Ok Crouchie. As you said, I have posted the same question in "Visual
C++ Lovers" If you can answer my question, in that group, that will
help me a lot.

Thanks again.
VJK

 
Reply With Quote
 
VJK
Guest
Posts: n/a
 
      23rd May 2005
I have also posted my question in Visual C developers forum. Awaiting
for your reply :-)

VJK


Crouchie1998 wrote:
> Try posting your question in the microsoft Visual C newsgroup & not a
> Windows 2000 registry one
>
> I know the answer to your question & I will gladly answer it if

posted in
> the correct newsgroup.
>
> By the way: 'prinf' is a C command that can be used in C++
>
> Crouchie1998
> BA (HONS) MCP MCSE


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RegOpenKeyEx returns access denied (error 5) Strigger Windows XP Security 4 12th Mar 2012 05:54 AM
RegOpenKeyEx: The handle is Invalid armando Windows XP General 2 20th Jul 2006 06:59 AM
Issue with RegOpenKeyEx VJK Microsoft Windows 2000 Registry 1 27th Jul 2005 08:14 PM
Issue with RegOpenKeyEx VJK Microsoft Windows 2000 Registry 3 23rd May 2005 04:10 PM
Receiving error when clicking on properties: RegOpenKeyEx:Handle is invalid Assassin Windows XP Accessibility 3 27th Sep 2003 07:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:24 AM.