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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:46:14+00:00 2026-06-11T20:46:14+00:00

The issue I’m having is that my application is inputting the incorrect data into

  • 0

The issue I’m having is that my application is inputting the incorrect data into the registry (instead of a file path, it inputs characters such as “㩃啜敳獲啜敳屲灁”) and I don’t know what the issue is, the relevant source code is below (Includes, etc have been removed).

stringstream ss;

char* file_path = getenv("APPDATA");
strcat(file_path, "\\Application.exe");
ss << file_path;
ss >> file_path_string;
CA2W unicodeFile_path(file_path);
cout << "Downloading File";
HRESULT hr = URLDownloadToFile ( NULL, _T("http://example.com/application.exe"), unicodeFile_path, 0, NULL );
cout << "Done" << endl;
cout << "Adding to registry" << endl;
HKEY hKey;
CA2W registryLocation("Software\\Microsoft\\Windows\\CurrentVersion\\Run");
CA2W registryKey("Application");
// Check registry if exists, otherwise create.
RegCreateKeyEx(HKEY_CURRENT_USER,
               registryLocation,
               0,
               NULL,
               REG_OPTION_NON_VOLATILE,
               KEY_WRITE,
               NULL,
               &hk,
               &dwDisp);
// Store reg value
RegSetValueEx(hk,
              registryKey,
              NULL,
              REG_SZ,
              (const BYTE*)file_path_string.c_str(),
              file_path_string.size() + 1);

Any help will be appreciated.

  • 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-11T20:46:15+00:00Added an answer on June 11, 2026 at 8:46 pm

    RegSetValueEx expects (for REG_SZ) that the data you’re passing in is Unicode, unless you’re not defining UNICODE in your environment. But .c_str is likely a non-Unicode stream.

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

Sidebar

Related Questions

Issue I'm having is returning some data in a sidebar depending on which category
Issue I am having difficulty debugging inside of my application's timerEvent functions. While the
Issue for text elements that are adjacent to icon elements, the glyph height is
Issue Garbage gets erroneously entered into date fields and screws up calculations. Goal Using
Issue is SOLVED: Problem is that it is a pre-compiled web page project and
Issue comes up when i try to unload plugin that is loaded and load
Issue: I am using the Microsoft.Office.Interop.Excel library in an ASP.NET application, and I have
Issue is that I have wrote a method to duplicate selected row in a
Issue: An issue exists whereby I cannot access my Self Hosted ADO.NET Data Services
Issue Weird problem. We've got two forms: the main application window and a settings

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.