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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:12:53+00:00 2026-06-06T03:12:53+00:00

I have written to code to read and write to registry which is working

  • 0

I have written to code to read and write to registry which is working fine in all the OS except the win2003. Basically after setting value in registry(RegSetValueExW) I am able to read it correctly (RegQueryValueExW). But when i open regedit, i see some junk characters in it.

open using

RegOpenKeyExW(HKEY_LOCAL_MACHINE, subKey , 0, KEY_WRITE | KEY_WOW64_64KEY, &_regKey);

to set: (value is wstring)

::RegSetValueExW(_regKey, key, NULL, REG_MULTI_SZ, reinterpret_cast<const BYTE*>(value.c_str()), static_cast<DWORD>(value.length()*2 + 1));

for query:

::RegQueryValueExW(regKey, key, NULL, &type, reinterpret_cast<LPBYTE>(&value[0]), &valueLength);
  • 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-06-06T03:12:55+00:00Added an answer on June 6, 2026 at 3:12 am

    From the MSDN manual page on RegSetValueExW:

    With the REG_MULTI_SZ data type, the string must be terminated with two null characters.

    You need to construct a BYTE array containing two terminator characters and pass it to the function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully written a vhdl code to read and write a file. Basically
I have written a c# code to read string values within brackets () string
I have written code that opens 16 figures at once. Currently, they all open
I'm working on a project and have written code that determines how much money
Hi all i have written a small code to open a particular text file.
I have written the following code snippet to read data from the database :
Can I Read Windows Registry From Windows Service in VC++ ? I have written
I have written two scripts Write.py and Read.py . Write.py opens friends.txt in append
I have written code in Java to access web cam,and to save image... I
I have written code to perform a function that could take a while to

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.