admin管理员组

文章数量:1621900

C++ 获取物理Mac地址方法:

1. 使用GetAdaptersInfo获取网卡详细信息;

2. 遍历IP_ADAPTER_INFO,取AdapterName去匹配注册表HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\下子节点的NetCfgInstanceId值,找到相对应的子节点再取Characteristics值;

3. 判断Characteristics值 & NCF_PHYSICAL(4)的结果,大于0为物理网卡;

 

//32位程序在64位系统下运行禁用重定向问题;
CWow64Detector::CWow64Detector(BOOL bDisable)
: m_bDisable(FALSE)
{
	if (bDisable && m_bWin64)
		m_bDisable = Win64DisableFsRedirection(&m_pDisData);
}

CWow64Detector::~CWow64Detector()
{
	if (m_bDisable)
	{
		Win64RevertFsRedirection(m_pDisData);
	}
}

 

BOOL IsPhysicalMac(char* pAdapterName)
{
	CWow64Detector wow64(TRUE);    //该类封装了32位程序在64位系统中的重定向问题;否则注册表查询会有问题;
	CString strAdapterName(pAdapterName);
	
	LPCTSTR lpszKey =

本文标签: 物理地址Mac