How to use c++ code to become basic CMOS information

Mirko 0 Reputation points
2026-01-27T18:13:35.3633333+00:00

Dear All,

I just started in C++ programming and my main goal is to get basic BIOS information e.g. installed CPU, installed HDD and other information. I do not want to use WMI or other DLL files for my goal. Is there anyone who could give me a hint or code examples or needed header infos?

Thank's for your time.

Greetings Mirko

Windows development | Windows API - Win32
{count} votes

3 answers

Sort by: Most helpful
  1. Jack Dang (WICLOUD CORPORATION) 11,900 Reputation points Microsoft External Staff Moderator
    2026-01-28T08:54:19.1633333+00:00

    Hi @Mirko ,

    Thanks for reaching out.

    CMOS doesn’t actually contain detailed hardware information. It’s mainly used by the BIOS to store basic setup data like the system clock and boot order, not a full list of installed hardware.

    On top of that, regular C++ applications running in user mode can’t directly access BIOS, CMOS, or hardware ports. Windows intentionally blocks this to keep the system stable and secure. Only kernel-mode code (device drivers) is allowed to interact with hardware at that level.

    https://learn.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/user-mode-and-kernel-mode

    Because of these limits, there isn’t a supported or safe way for a normal C++ app to read CMOS or BIOS data directly on Windows.

    The supported approach for user-mode applications is to use Windows APIs or WMI, which are designed to provide this information reliably across different machines.

    https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-start-page

    Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.

    1 person found this answer helpful.
    0 comments No comments

  2. Castorix31 91,726 Reputation points
    2026-01-27T20:49:50.5833333+00:00
    0 comments No comments

  3. Q&A Assist
    2026-01-27T18:13:46.1133333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To access basic BIOS information such as installed CPU and HDD without using WMI or DLL files in C++, you typically interact with the system's hardware through lower-level APIs or directly access system information structures. However, this can be quite complex and often requires administrative privileges.

    Here are some general approaches you can consider:

    1. Using the sysinfoapi.h Header: This header provides functions to retrieve system information. For example, you can use GetLogicalProcessorInformation to get information about logical processors. Example code snippet:
         #include <windows.h>
         #include <iostream>
         
         int main() {
             SYSTEM_INFO sysInfo;
             GetSystemInfo(&sysInfo);
             std::cout << "Number of processors: " << sysInfo.dwNumberOfProcessors << std::endl;
             return 0;
         }
      
    2. Using GetPhysicallyInstalledSystemMemory: This function retrieves the amount of RAM that is physically installed on the computer. Example code snippet:
         #include <windows.h>
         #include <iostream>
         
         int main() {
             ULONG_PTR memory;
             GetPhysicallyInstalledSystemMemory(&memory);
             std::cout << "Installed Memory: " << memory / 1024 << " MB" << std::endl;
             return 0;
         }
      
    3. Accessing BIOS Information: For more detailed BIOS information, you may need to use specific APIs or read from the BIOS directly, which can be more complicated and may require specific permissions. This typically involves using the SetupDiGetDeviceRegistryProperty function from the setupapi.h header.
    4. Using Third-party Libraries: If you are open to using libraries, there are third-party libraries available that can simplify the process of retrieving hardware information.

    Keep in mind that accessing hardware information directly can be limited by system permissions and may not be portable across different versions of Windows.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.