请问程序中如何获得网卡的型号?

intothepain 2004-09-09 10:38:34
如题。谢谢!
...全文
58 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
danielxuao 2004-09-14
添加头文件和库文件的路径
回复
intothepain 2004-09-13
我都包含进去了,不知道为什么开发包的头文件会出错
回复
xhwu3721 2004-09-10
tool->option中将头文件所在的目录包含进去.
回复
intothepain 2004-09-09
这是编译输出的错误,请问是怎么回事?
c:\program files\microsoft sdk\include\ras.h(61) : error C2065: 'HRASCONN' : undeclared identifier
c:\program files\microsoft sdk\include\ras.h(61) : error C2501: 'DECLARE_HANDLE' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(74) : error C2146: syntax error : missing ';' before identifier 'dwSize'
c:\program files\microsoft sdk\include\ras.h(74) : error C2501: 'DWORD' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(74) : error C2501: 'dwSize' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(75) : error C2146: syntax error : missing ';' before identifier 'hrasconn'
c:\program files\microsoft sdk\include\ras.h(75) : error C2501: 'HRASCONN' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(75) : error C2501: 'hrasconn' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(76) : error C2146: syntax error : missing ';' before identifier 'szEntryName'
c:\program files\microsoft sdk\include\ras.h(76) : error C2501: 'WCHAR' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(76) : error C2501: 'szEntryName' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(98) : error C2146: syntax error : missing ';' before identifier 'dwSize'
c:\program files\microsoft sdk\include\ras.h(98) : error C2501: 'DWORD' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(98) : error C2501: 'dwSize' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(99) : error C2146: syntax error : missing ';' before identifier 'hrasconn'
c:\program files\microsoft sdk\include\ras.h(99) : error C2501: 'HRASCONN' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(99) : error C2501: 'hrasconn' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(100) : error C2146: syntax error : missing ';' before identifier 'szEntryName'
c:\program files\microsoft sdk\include\ras.h(100) : error C2501: 'CHAR' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(100) : error C2501: 'szEntryName' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(186) : error C2146: syntax error : missing ';' before identifier 'dwSize'
c:\program files\microsoft sdk\include\ras.h(186) : error C2501: 'DWORD' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(186) : error C2501: 'dwSize' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(188) : error C2146: syntax error : missing ';' before identifier 'dwError'
c:\program files\microsoft sdk\include\ras.h(188) : error C2501: 'DWORD' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(188) : error C2501: 'dwError' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(189) : error C2146: syntax error : missing ';' before identifier 'szDeviceType'
c:\program files\microsoft sdk\include\ras.h(189) : error C2501: 'WCHAR' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(189) : error C2501: 'szDeviceType' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(190) : error C2146: syntax error : missing ';' before identifier 'szDeviceName'
c:\program files\microsoft sdk\include\ras.h(190) : error C2501: 'WCHAR' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(190) : error C2501: 'szDeviceName' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(199) : error C2146: syntax error : missing ';' before identifier 'dwSize'
c:\program files\microsoft sdk\include\ras.h(199) : error C2501: 'DWORD' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(199) : error C2501: 'dwSize' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(201) : error C2146: syntax error : missing ';' before identifier 'dwError'
c:\program files\microsoft sdk\include\ras.h(201) : error C2501: 'DWORD' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(201) : error C2501: 'dwError' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(202) : error C2146: syntax error : missing ';' before identifier 'szDeviceType'
c:\program files\microsoft sdk\include\ras.h(202) : error C2501: 'CHAR' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(202) : error C2501: 'szDeviceType' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(203) : error C2146: syntax error : missing ';' before identifier 'szDeviceName'
c:\program files\microsoft sdk\include\ras.h(203) : error C2501: 'CHAR' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(203) : error C2501: 'szDeviceName' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(224) : error C2146: syntax error : missing ';' before identifier 'dwSize'
c:\program files\microsoft sdk\include\ras.h(224) : error C2501: 'DWORD' : missing storage-class or type specifiers
c:\program files\microsoft sdk\include\ras.h(224) : error C2501: 'dwSize' : missing storage-class or type specifiers
……
回复
intothepain 2004-09-09
这是msdn的代码,我安装了新的platform sdk来编译
PIP_ADAPTER_INFO pAdapterInfo;
PIP_ADAPTER_INFO pAdapter = NULL;
DWORD dwRetVal = 0;

pAdapterInfo = (IP_ADAPTER_INFO *) malloc( sizeof(IP_ADAPTER_INFO) );
ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);

// Make an initial call to GetAdaptersInfo to get
// the necessary size into the ulOutBufLen variable
if (GetAdaptersInfo( pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW) {
GlobalFree (pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc ( sizeof(ulOutBufLen) );
}

if ((dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen)) == NO_ERROR) {
pAdapter = pAdapterInfo;
while (pAdapter) {
printf("\tAdapter Name: \t%s\n", pAdapter->AdapterName);
printf("\tAdapter Desc: \t%s\n", pAdapter->Description);
printf("\tAdapter Addr: \t%ld\n", pAdapter->Address);
printf("\tIP Address: \t%s\n", pAdapter->IpAddressList.IpAddress.String);
printf("\tIP Mask: \t%s\n", pAdapter->IpAddressList.IpMask.String);

printf("\tGateway: \t%s\n", pAdapter->GatewayList.IpAddress.String);
printf("\t***\n");
if (pAdapter->DhcpEnabled) {
printf("\tDHCP Enabled: Yes\n");
printf("\t\tDHCP Server: \t%s\n", pAdapter->DhcpServer.IpAddress.String);
printf("\tLease Obtained: %ld\n", pAdapter->LeaseObtained);
}
else
printf("\tDHCP Enabled: No\n");

if (pAdapter->HaveWins) {
printf("\tHave Wins: Yes\n");
printf("\t\tPrimary Wins Server: \t%s\n", pAdapter->PrimaryWinsServer.IpAddress.String);
printf("\t\tSecondary Wins Server: \t%s\n", pAdapter->SecondaryWinsServer.IpAddress.String);
}
else
printf("\tHave Wins: No\n");
pAdapter = pAdapter->Next;
}
}
else {
printf("Call to GetAdaptersInfo failed.\n");
}
回复
相关推荐
发帖
驱动开发/核心开发
创建于2007-09-28

2.1w+

社区成员

硬件/嵌入开发 驱动开发/核心开发
申请成为版主
帖子事件
创建了帖子
2004-09-09 10:38
社区公告
暂无公告