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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:48:15+00:00 2026-06-04T21:48:15+00:00

I tried to access the Windows Registry with this Code: CRegKey key; LPTSTR szBuffer

  • 0

I tried to access the Windows Registry with this Code:

CRegKey key;
LPTSTR szBuffer = new TCHAR[50];
ULONG cchBuffer = 257;
key.Open(HKEY_CURRENT_USER, L"HARDWARE", KEY_READ);
ULONG chars;
CString str;

if (key.QueryStringValue(L"Test", 0, &chars) == ERROR_SUCCESS)
{
    key.QueryStringValue(L"Test", str.GetBuffer(chars), &chars);
    str.ReleaseBuffer();
}
key.Close();

It returned an Error of the Microsoft Visual C++ Runtime Library:

Debug Assertation Failed!

Program: …

File: C:\Program Files\Microsoft Visual Studio
11.0\VC\ATLMFC\INCLUDE\altbase.h Line: 6146

Expression: m_hkey != 0

For information Blah blah

After pressing Ignore it crashes.

I’m not sure what compiler is used because I (think I have) configured Qt Creator to use Visual C++ but the output Directory os called …_._MinGW_Qt_SDK_DEBUG

What to do now?

  • 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-04T21:48:16+00:00Added an answer on June 4, 2026 at 9:48 pm

    I don’t have a Windows machine nearby, but I think that there is no subkey named HARDWARE into HKEY_CURRENT_USER: it is into HKEY_LOCAL_MACHINE.

    That, added to the fact that you are not checking the Open call for errors suggests that what you really want to do is:

    key.Open(HKEY_LOCAL_MACHINE, L"HARDWARE", KEY_READ);
    

    Anyway, it is always a good idea to handle the error, just in case.

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

Sidebar

Related Questions

I tried to read a REG_BINARY value of the Windows registry, but I don't
This code used to work on Vista (and Windows XP) but after an upgrade
I'm writing this program that will need to access the registry to pull some
I am storing some short user data strings in the Windows registry. This worked
System: Windows 7 32bit Language: C++ I have tried to access register HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port
Is there any way to access a Windows hidden share from Cygwin? I've tried:
I am experimenting with Windows Live SDK for Windows Phone and tried to access
I tried to access my Gmail mailbox with InterImap Library. It shows my messages
I tried to install django on my shared hosting environment, which has SSH access.
I tried some add to favorties JavaScript scripts.. With IE8, I get an access

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.