Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 939973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:52:42+00:00 2026-05-15T21:52:42+00:00

I am querying the registry on Windows CE. I want to pull back the

  • 0

I am querying the registry on Windows CE. I want to pull back the DhcpDNS value from the TcpIp area of the registry, which works.

What happens though, however, is if there is two values – displayed as "x.x.x.x" "x.x.x.x" in my CE registry editor – then it only brings back one of them. I am sure this is a silly mistake but I am unsure why it is happening.

Here is the code I am using

std::string ISAPIConfig::GetTcpIpRegSetting(const std::wstring &regEntryName)
{
    HKEY hKey = 0;
    HKEY root = HKEY_LOCAL_MACHINE;
    LONG retVal = 0;

    wchar_t buffer[3000];
    DWORD bufferSize = 0;
    DWORD dataType = 0;

    std::string dataString = "";

    //Open IP regkey
    retVal = RegOpenKeyExW(root, L"Comm\\PCI\\FETCE6B1\\Parms\\TcpIp", 0, 0, &hKey);

    //Pull out info we need
    memset(buffer, 0, sizeof(buffer));
    bufferSize = sizeof(buffer);
    retVal = RegQueryValueExW(hKey, regEntryName.c_str(), 0, &dataType, reinterpret_cast<LPBYTE>(buffer), &bufferSize);
    Unicode::UnicodeToAnsi(buffer, dataString);

    return dataString;
}

void UnicodeToAnsi(const std::wstring &wideString, std::string &ansiString){
    std::wostringstream converter;
    std::ostringstream converted;
    std::wstring::const_iterator loop;

    for(loop = wideString.begin(); loop != wideString.end(); ++loop){
        converted << converter.narrow((*loop));
    }

    ansiString = converted.str();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:52:44+00:00Added an answer on May 15, 2026 at 9:52 pm

    The value is a multi_sz, which is in the format:

    {data}\0{data}\0\0

    I don’t know what the Unicode::UnicodeToAnsi does, but it’s likely just looking for that first null terminator and stopping there. You have to parse past single nulls until you hit the double-null.

    EDIT

    You have to update your code – very likely your interfaces. Right now you’re trying to returns a string for a multi_sz which, by definition, means multiple strings. you probably want to returns a string[] (though I’d probably opt to use a couple output parameters – one that’s an array pointer and the other that is a element count).

    You then need to loop through the data that came back from the RegQuery call, something maybe like this (off the top of my head, not tested or compiled):

    TCHAR *p = buffer;
    
    if(bufferSize > 0)
    {
      do
      {
          Unicode::UnicodeToAnsi(p, dataString); 
          // do something with dataString - store it in an array or whatever
          p+= _tcslen(p);
        }   while((p-buffer) < bufferSize)
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm querying a SQL db from excel using vba, that all works fine but
Possible Duplicate: Querying if a Windows Service is disabled (without using the Registry)? I
Simply querying running jobs using something like select * from dba_jobs_running; works fine when
I am querying information from Active Directory . I have code that works, but
I'm querying Sharepoint server-side and getting back results as Xml. I want to slim
I am querying my mysql-db using PDO, with a plain SELECT * FROM Invoices
i'm querying a database like this: SELECT * from Log WHERE cookieId IN (select
I've got a problem querying the message count from the remote msmq queue. This
When querying a database from Node, how does one pass the HTTP response object
When querying SolR with a date SolR will actually highlight stuff from the text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.