123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- /************************************************************************/
- /* Copyright (C), 2016-2020, [IT], 保留所有权利;
- /* 模 块 名:;
- /* 描 述:;
- /*
- /* 版 本:[V];
- /* 作 者:[IT];
- /* 日 期:[12/19/2016];
- /*
- /*
- /* 注 意:CPU的Processorid并不是CPU序列号,只是能支持的指令ID,所以,不获取cpuid;
- /*
- /* 修改记录:[IT];
- /* 修改日期:;
- /* 修改版本:;
- /* 修改内容:;
- /************************************************************************/
- #ifndef __DEVICEQUERY__
- #define __DEVICEQUERY__
- #pragma once
- #include <string>
- #include <vector>
- #include <setupapi.h>
- #include <initguid.h>
- #pragma comment(lib,"setupapi.lib")
- // 网卡类型;
- enum NICKIND
- {
- // pci网卡;
- NIC_PCI,
- // usb网卡;
- NIC_USB,
- // 虚拟网卡;
- NIC_ROOT,
- // 仿真网卡;
- NIC_SWD,
- // 未知类型;
- NIC_UNK
- };
- typedef struct __MAC_ADDRESS__
- {
- INT nNICKind;
- TCHAR szNICKind[16];
- TCHAR szMacAddress[MAX_PATH];
- TCHAR szDevicePath[MAX_PATH];
- }MacAddress, *pMacAddress;
- class CDeviceQuery
- {
- public:
- CDeviceQuery(void);
- ~CDeviceQuery(void);
- private:
- BOOL GetRegistryProperty(
- IN HDEVINFO DeviceInfoSet,
- OUT PSP_DEVINFO_DATA DeviceInfoData,
- IN ULONG Property,
- OUT PVOID Buffer,
- OUT PULONG Length );
- public:
- // 枚举网卡;
- void EnumNetCards();
- // 获取网卡地址;
- INT GetMacAddress();
- // 获取硬盘信息;
- INT GetHardDiskInfo();
- // 输出所有硬件信息;
- void OutHDString();
- // Json格式的有效的硬件码;
- BYTE* GetHardWareSerialNumber(IN DWORD &dwBytelen);
- private:
- // static CDeviceQuery *m_pInstance;
- std::vector<MacAddress> m_vtMacAddress;
- std::vector<std::string> m_vtHardDiskID;
- };
- #endif
|