#include <windows.h>
#include <stdio.h>
#include <setupapi.h>
#pragma comment (lib,"Setupapi.lib")
#define MACADDRESS_BYTELEN 6 // MAC地址字节长度
#define OID_802_3_PERMANENT_ADDRESS 0x01010101 //The address of the NIC encoded in the hardware.
//#define OID_802_3_CURRENT_ADDRESS 0x01010102 //The address the NIC is currently using.
/* An application can use IOCTL_NDIS_QUERY_GLOBAL_STATS to obtain information from a network adapter.
* The application passes IOCTL_NDIS_QUERY_GLOBAL_STATS, along with an Object Identifier(OID),
* in the DeviceIoControl() function.*/
#define IOCTL_NDIS_QUERY_GLOBAL_STATS 0x00170002
// 初始化网卡原始MAC地址的GUID结构
GUID GUID_DEVCLASS_QUERY={0xAD498944, 0x762F, 0x11D0, 0x8D, 0xCB, 0x00,