Method 1
Connect to the netapi32.lib library, define an NCB struct, and then call netbois (NCB) to obtain the serial number.
If NetBIOS is disabled, the serial number cannot be obtained.
Method 2
It is of little practical value to call the ipconfig command to obtain the result.
Method 3: Use the SNMP protocol
Read loadlibrary ("inetmib1.dll ");
Obtain the function addresses of snmpextensioninit, snmpextensioninitex, snmpextensionquery, and snmpextensiontrap In the DLL, and then fill asnobjectidentifier with snmp_oidcpy to obtain the parameters of the NIC.
Another method is:
Include "iphlpapi. H"
# Pragma comment (Lib, "iphlpapi. lib ")
Bool getmacaddress (cstring & straddress)
{
Ip_adapter_info adapterinfo [16]; // defines the NIC information storage area.
DWORD dwbuflen = sizeof (adapterinfo );
DWORD dwstatus = getadaptersinfo (
Adapterinfo, // [Output] pointing to the received data buffer pointer
& Dwbuflen); // [input] buffer size
If (dwstatus! = Error_success)
Return false;
Straddress. Format ("% 02x: % 02x: % 02x: % 02x: % 02x: % 02x ",
Adapterinfo-> Address [0],
Adapterinfo-> Address [1],
Adapterinfo-> Address [2],
Adapterinfo-> Address [3],
Adapterinfo-> Address [4],
Adapterinfo-> Address [5]);
Return true;
}
However, the premise is that a new SDK has not been tested.