请教下为何MSDN里查不到GetAdaptersInfo这个API,

来源:百度知道 编辑:UC知道 时间:2024/05/22 02:44:53
介绍函数的地方说Window SDK里提供了GetAdaptersInfo这样一个函数可以获取到网卡MIC地址.
因为一直也没下WindowsSDK,一直都还以为MSDN里能查到所有MS给的API函数,结果今天发现原来不是这样.

那如果我下载Windows SDk并使用里面的函数,是不是还要引用其他非系统自带的模块?

可是windows自带的模块里连一个获取MIC地址的函数都没有吗?

如果是这样,那W SDK里是不是还有很多这种有用的函数而我用不了呢,比如呢?

还有一问 比如在MSDN里查GetWindowText时,除了MFC里定义的还有一条是出自"Windows User Interface : Platform SDK",
那这个"Platform SDK"和"Windows SDK"又有什么区别了?我以为是一个东西来着. .

MIC地址?还是MAC地址?
MAC地址可以用下面的方法获得:

1,用注册表
HKLM\Software\Micrososft\Windows NT\CurrentVersion\NetworkCards

2 使用WMI
Windows Management Instrumentation

用下面的语句查询WMI即可。
SELECT IPAddress, IPSubnet,MACAddress
from Win32_NetworkAdapterConfiguration

具体代码自己查吧,印象会深刻一点。

GetAdaptersInfo
The GetAdaptersInfo function retrieves adapter information for the local computer.

DWORD GetAdaptersInfo(
PIP_ADAPTER_INFO pAdapterInfo, // buffer to receive data
PULONG pOutBufLen // size of data returned
);
Parameters
pAdapterInfo
[out] Pointer to a buffer that, , receives a linked list of IP_ADAPTER_INFO structures.
pOutBufLen
[in] Pointer to a ULONG variable that specifies the size of the buffer pointed to by the pAdapterInfo parameter. If this size is insufficient to hold the adapter information, GetAdaptersInfo fills in this variable