如果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 );獲得網卡信息即可