Hi!
I develop the app, that must be binded to hardware-specific information.
This is a part of license protection scenario.
The serial number of motherboard must be obtained.
How to do it under Windows ?
Hi!
I develop the app, that must be binded to hardware-specific information.
This is a part of license protection scenario.
The serial number of motherboard must be obtained.
How to do it under Windows ?
If you need something harder to spoof than a MAC, read SMBIOS data rather than the network stack. MACs are trivial to override in Windows using the adapter’s Advanced property (NetworkAddress). When that is set, the OS and APIs will typically report the overridden value, so ipconfig /all is not a reliable hardware anchor. (learn.microsoft.com)
WMI exposes the baseboard (motherboard) serial directly via Win32_BaseBoard.SerialNumber, which is backed by SMBIOS. Contrary to ’s note, WMI is a core Windows service (Winmgmt) that starts automatically; you don’t need to install anything. Here is a minimal C++ example that queries it:
// link: wbemuuid.lib
#include <windows.h>
#include <comdef.h>
#include <wbemidl.h>
std::string GetBoardSN() {
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
CoInitializeSecurity(nullptr, -1, nullptr, nullptr,
RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_NONE, nullptr);
CComPtr<IWbemLocator> loc; loc.CoCreateInstance(CLSID_WbemLocator);
CComPtr<IWbemServices> svc;
loc->ConnectServer(_bstr_t(L"ROOT\\CIMV2"), nullptr, nullptr, nullptr, 0, nullptr, nullptr, &svc);
CoSetProxyBlanket(svc, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, nullptr,
RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_NONE);
CComPtr<IEnumWbemClassObject> en;
svc->ExecQuery(bstr_t("WQL"), bstr_t("SELECT SerialNumber FROM Win32_BaseBoard"),
WBEM_FLAG_FORWARD_ONLY|WBEM_FLAG_RETURN_IMMEDIATELY, nullptr, &en);
CComPtr<IWbemClassObject> obj; ULONG ret = 0; VARIANT v; VariantInit(&v);
if (en->Next(5000, 1, &obj, &ret) == S_OK && obj->Get(L"SerialNumber", 0, &v, 0, 0) == S_OK)
return std::string(_bstr_t(v.bstrVal)); // may be empty on some systems
return {};
} References for the class and service behavior are on Microsoft Learn. (learn.microsoft.com)
If you want to avoid WMI entirely (or need maximum speed), read raw SMBIOS with GetSystemFirmwareTable('RSMB', ...) and parse Type 2 (Baseboard) for the Serial Number. (learn.microsoft.com)
Pragmatic licensing tip: some firmware leaves these fields blank or inconsistent, so combine multiple IDs (e.g., Baseboard SerialNumber plus Win32_ComputerSystemProduct.UUID) and hash them, with a grace policy for repairs/RMA. (ibm.com)
Jump to Post— donaldw 33Do you have a network card?
Jump to Post— Narue 5,707>The serial number of motherboard must be obtained.
>How to do it under Windows ?
WMI FAQ.
Do you have a network card?
From another CG thread:
Try calling IWbemServices->GetObject(...) using "Win32_BaseBoard.Tag=\"Base Board\"" as the class name.
Avoid WMI (slow and not installed by default)
Use Kernel and Shell apis
Do you have a network card?
Unfortunately, these methods are getting not true MAC address. I can change it via Control Panel > Network and Internet > Network and Sharing Center > Change Adapter settings - Right click on adapter > Properties > "Configure" button > tab "Advanced" > choose "Network Address" and change it.
After changing the MAC by hands, the apps in the tutorial and even Win API functions will return that address.
But, it must be some function, that returns true, hardware MAC address ...
Unfortunately, these methods are getting not true MAC address
try this:
go to the command prompt n type
ipconfig<space>/all
this should tell u ur true hardware mac address.. it worked for me, the mac address will be given under something like "physical address"..
cheers :)
somjit{}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.