如果pc有很多适配器或者网卡,则一般应先得到大小即用
DWORD GetAdaptersInfo(
PIP_ADAPTER_INFO pAdapterInfo, // buffer to receive data
PULONG pOutBufLen // size of data returned
);
其中pOutBufLen是DWORD或者无符号整型
然后根据
HGLOBAL GlobalAlloc(
UINT uFlags, // allocation attributes
SIZE_T dwBytes // number of bytes to allocate
);
动态分配内存,之后
DWORD GetAdaptersInfo(
PIP_ADAPTER_INFO pAdapterInfo, // buffer to receive data
PULONG pOutBufLen // size of data returned
);
获得网卡信息即可