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 6137847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:46:40+00:00 2026-05-23T17:46:40+00:00

There is a REG_MULTI_SZ value that I would like to stick in an array

  • 0

There is a REG_MULTI_SZ value that I would like to stick in an array of strings so that my program can do other things with them. I’ve never used C++ to access the registry so I’m a bit lost after following some examples. I’m using VS10.

Is there a simple way to do this? Thanks.

  • 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-23T17:46:40+00:00Added an answer on May 23, 2026 at 5:46 pm

    First: run RegQueryValueEx to get type and necessary memory size:

    Single byte code:

    DWORD type, size;
    vector<string> target;
    if ( RegQueryValueExA(
        your_key, // HKEY
        TEXT("ValueName"),
        NULL,
        &type,
        NULL,
        &size ) != ERROR_SUCCESS )
      return;
    if ( type == REG_MULTI_SZ )
    {
      vector<char> temp(size);
    
      if ( RegQueryValueExA(
          your_key, // HKEY
          TEXT("ValueName"),
          NULL,
          NULL,
          reinterpret_cast<LPBYTE>(&temp[0]),
          &size ) != ERROR_SUCCESS )
      return;
    
      size_t index = 0;
      size_t len = strlen( &temp[0] );
      while ( len > 0 )
      {
        target.push_back(&temp[index]);
        index += len + 1;
        len = strlen( &temp[index] );
      }
    }
    

    Unicode:

    DWORD type, size;
    vector<wstring> target;
    if ( RegQueryValueExW(
        your_key, // HKEY
        TEXT("ValueName"),
        NULL,
        &type,
        NULL,
        &size ) != ERROR_SUCCESS )
      return;
    if ( type == REG_MULTI_SZ )
    {
      vector<wchar_t> temp(size/sizeof(wchar_t));
    
      if ( RegQueryValueExW(
          your_key, // HKEY
          TEXT("ValueName"),
          NULL,
          NULL,
          reinterpret_cast<LPBYTE>(&temp[0]),
          &size ) != ERROR_SUCCESS )
      return;
    
      size_t index = 0;
      size_t len = wcslen( &temp[0] );
      while ( len > 0 )
      {
        target.push_back(&temp[index]);
        index += len + 1;
        len = wcslen( &temp[index] );
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a conversion process that is needed when migrating Visual Studio 2005 web
There is previous little on the google on this subject other than people asking
There are a few ways to get class-like behavior in javascript, the most common
There're two well-known ways to set an integer register to zero value on x86.
Is there any way to use regex match on a stream in python? like
There is single and double quotes in the address textbox .How can I insert
Anyone know of a good reg exp that can do this, optimally in one
Hey there geniuses of SO! This is for an autocomplete plugin that needs to
I am tring to compile a program in verilog but there is a basic
I have the following batch command that fetches a registry key and assigns value

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.