Solved

Error 234 with CRegKey. Empty String values.

Posted on 1998-10-20
2
431 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
[X]
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
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to split this in C++ 4 127
max float value 3 68
C++ help/ Toy problem 19 69
visual C++ 1 37
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 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.

738 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