使用winpcap接口找不到設備

window xp系統使用pcap_findalldevs或者pcap_findalldevs_ex查找設備時,找不到網卡!
主要信息以下:
winpcap.exe:4.1.3
系統重裝後使用正常,能找到name、description;可是電腦重啓以後就使用pcap_findalldevs找不到網卡了,可是此時電腦可以正常上網。

重啓後的錯誤信息:no interfaces found!make sure libpcap/winpcap is properly installed on the local machine

代碼以下:spa

nt main(int argc, char** argv)
{
pcap_if_t *alldevs;
pcap_if_t *d;
int i=0;
char errbuf[PCAP_ERRBUF_SIZE];

/* 獲取本地機器設備列表 */
if (pcap_findalldevs(&alldevs, errbuf) == -1)
{
fprintf(stderr,"Error in pcap_findalldevs_ex: %s\n", errbuf);
exit(1);
}

/* 打印列表 */
for(d = alldevs; d != NULL; d= d->next)
{
printf("%d. %s", ++i, d->name);
if (d->description)
printf(" (%s)\n", d->description);
else
printf(" (No description available)\n");
}

if (i == 0)
{
printf("\nNo interfaces found! Make sure WinPcap is installed.\n");
getchar();
return 1;
}

/* 再也不須要設備列表了,釋放它 */
pcap_freealldevs(alldevs);

getchar();
return 0;
}

解決辦法:winPcap4.1.3最後安裝完成的時候有個開機啓動bootdriver的選項這個記得要勾上哦,而後就好使了。blog

相關文章
相關標籤/搜索