RegQueryValueEx causes Error 234

Posted on 2008-11-12
Last Modified: 2012-06-21

I have this code in two programs.   In one program it works perfectly.  
On the other program (same machine) the result is 234 at the first reading.  Keeping the program turned on and quering the same function will not return an error and read the details as needed.

Any comments?


templong = RegQueryValueEx(hKey,





		  &lBytesRead) ;

Open in new window

Question by:afikim
    LVL 30

    Accepted Solution

    Hi afikim,

    the return value 234 means 'ERROR_MORE_DATA'. The size of the data to read is passed with the last parameter. In your case the size passed there is too small for the data, the size needed is returned with 'lBytesRead' - so the next call succeeds.

    If you know how many bytes to read you can simply initialize it before - if you don't know the size it's common to do it like this:

    Since you use a instance to a variable I guess it should be enough to initialize lBytesRead before like this:

    > lBytesRead = sizeof( MyVariable );

    Hope that helps,


    Author Closing Comment


    Hi Zoppo

    How did I forget that???

    Thanks for your help


    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    Video by: Grant
    The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

    745 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

    18 Experts available now in Live!

    Get 1:1 Help Now