[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Registry

Posted on 1999-10-29
1
Medium Priority
?
205 Views
Last Modified: 2010-04-01
How can I read Key-value pairs from the registry of a remote computer? I have tried using RegConnectRegistry but the subsequent call to RegQueryValueEx gives 'file not found (error no. 2)' error. How can I solve this problem?

Here's the code that I tried:


l_Ret = RegConnectRegistry(CompName, HKEY_LOCAL_MACHINE, &phKey);         
LPCTSTR =
lpValueName  "SYSTEM\\CurrentControlSet\\Services\\EventLog\\System\\NtServicePack\\EventMessageFile";                        
l_Ret = RegQueryValueEx(phKey,lpValueName, NULL, NULL,lpData,  &dSize);

RegCloseKey(phKey);
0
Comment
Question by:arvind_cs
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 200 total points
ID: 2170638
You are confused a subkey with a value. Run the Registry Editor, the items on the left pane are keys and subkeys while the items on the right pane are values, which have such attributes as name, data and type. So, you need to call RegOpenKeyEx to open the subkey first and then use RegQueryValueEx to retrieve the value.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

607 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