In general, the first thing to write a WinPcap-based application is to get a list of connected network adapters. Both Libpcap and WinPcap provide the PCAP_FINDALLDEVS_EX () function to implement this function: This function returns a list of pcap_if structures, each of which contains the details of an adapter. It is important to note that the data field name and description represent an adapter name and a description that people can understand.
Steps to debug your code in VS2008:
Operational Environment Preparation: Wpdpack_4_1_2 installation package
1: Put Wpdpack_4_1_2 unzip in the C packing directory, open Microsoft Visual Studio 2010, copy the API code to get the device list to the work panel, the code is as follows 650) this.width=650; "Src=" http ://s5.51cto.com/wyfs02/m01/89/4a/wkiol1gpcomsk5vfaabvt-pekgy600.png "title=" CQ (q87{6judqlu~s4c3ulot.png "alt=" Wkiol1gpcomsk5vfaabvt-pekgy600.png "width=" 650 "style=" padding:0px;margin:0px;vertical-align:top;border:none; "/ >
1234567891011121314151617 |
但是可以运行编写时,可以发现是报错的这时我们要配置一些东西
项目-->**属性(alt+F7)
配置属性-->清单工具-->输入和输出-->嵌入清单-->否 项目-->**属性(alt+F7)
配置属性-->C/C++-->常规-->附加包含目录-->include(c盘下的WpdPack_4_1_2)
项目-->**属性(alt+F7)
配置属性-->链接器-->常规-->附加库目录-->lib(c盘下的WpdPack_4_1_2)
项目-->**属性(alt+F7)
配置属性-->链接器-->输入-->附加依赖项-->补充“;Packet.lib;wpcap.lib” 项目-->**属性(alt+F7)
配置属性-->C/C++-->预处理器-->预处理器定义-->补充“;HAVE_REMOTE”
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++
This compiles without an error, the compilation results can be seen
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/89/4A/wKioL1gPDB7QBvHYAABY8jJ1IPg098.png "title=" SO4FA} Bi6ezq5[i (DXP ' rsw.png "alt=" Wkiol1gpdb7qbvhyaaby8jj1ipg098.png "width=" 650 "style=" padding:0px;margin:0px "; Vertical-align:top;border:none; "/>
This is the success!!!
This article is from the "12034923" blog, please be sure to keep this source http://1406404036.blog.51cto.com/12034923/1883472
Get the list of Devices API