Solved

Error 234 with CRegKey. Empty String values.

Posted on 1998-10-20
2
419 Views
Last Modified: 2008-03-10
When I use CRegKey.QueryValue I get the correct number of letters in the string, but my LPTSTR is always empty. The error that is returned is 234 which is ERROR_MORE_DATA. What does this mean? And why does it only do half of what it's supposed to do?

//Here is the line (note, opening the key is ERROR_SUCCESS):
error_num = key.QueryValue(lpStringVal, "LocalService", &dwStringSize);

//dwStringSize is 39 (the correct number)
//but lpStringVal is empty.
0
Comment
Question by:xxchange
2 Comments
 

Accepted Solution

by:
dirty_dog earned 50 total points
ID: 1175653
You need to initialize dwStringSize to the maximum number of letters that lpStringVal can hold.  Then QueryValue will replace it with the letters actually read.

This allows you to query the value once with 0 bytes, allocate enough memory to hold the value, and then query again for the actual value.
0
 

Author Comment

by:xxchange
ID: 1175654
Thanks alot. Worked like a charm. You rock.


0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now