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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:55:24+00:00 2026-06-10T06:55:24+00:00

which datatype should the variable that recives the data from the Registery have? HKEY

  • 0

which datatype should the variable that recives the data from the Registery have?

HKEY hKey;
HKEY hKey2;

DWORD dwMHz = MAX_PATH;
string pName;


long lError = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
        "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
        0,
        KEY_READ,
        &hKey);
long lError2 = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
        "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
        0,
        KEY_READ,
        &hKey2);

// Working
RegQueryValueEx(hKey, "~MHz", NULL, NULL, (LPBYTE) &dwMHz, &BufSize);

//Not working                                            <-- THIS -->
RegQueryValueEx(hKey2, "ProcessorNameInfo", NULL, NULL, (LPBYTE) &pName, &BufSize2);


cout << "   Processor frequency: " << dwMHz / 1024 << " GHz" << endl;
cout << "   Processor Name: " << pName << endl;

RegCloseKey(hKey);
RegCloseKey(hKey2);

When I try to print the ‘pName’ I get nothing.

  • 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-10T06:55:26+00:00Added an answer on June 10, 2026 at 6:55 am

    aYou’ll want to read this data into an array of type TCHAR, which depending on how your application is built (UNICODE/MBCS) will be properly typed as char or wchar_t.

    When reading REG_SZ strings using this API, you need to make sure of 2 things.

    1) Your output buffer needs to have space for any trailing NULL terminator
    2) On success, your output buffer MIGHT NOT BE NULL TERMINATED.

    That last bit is important – if the string was not stored with a NULL terminator, then your output buffer won’t be either. You need to watch for this and handle this properly, lest you end up with a security vulnerability in your application.

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

Sidebar

Related Questions

I have this field from the database which is: DataType: Numeric (7, 3) So
Hey guys I have an ajax jquery function that receives data from a php
I have this function which returns a datatype InetAddress[] public InetAddress [] lookupAllHostAddr(String host)
I've a table which has a field (datatype text) that contains a xml-file. After
I have address table in which city field have nvarchar datatype, but I want
I have this query which returns a result set with Date(column) as nvarchar datatype.
I'm writing a Fibonacci series generator and I'm not sure which datatype should I
I have a class Shape which should have area defined on all instances. area
Basically I have defined a Tree data type which is defined as follows: data
I have an application that I am writing that modifies data on a cached

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.