#include "stdafx.h"
#include <pcap.h>
#include<iostream>
#include<remote-ext.h>  //当需要获取远程网卡设备时候,要用到
using namespace std;
#pragma comment(lib,"wpcap.lib");
#pragma comment(lib,"ws2_32.lib");

int _tmain(int argc, _TCHAR* argv[])
{
    pcap_if_t *devs;
    pcap_if_t *d;
    int i=1;
    char source[PCAP_BUF_SIZE];
    char errbuf[PCAP_ERRBUF_SIZE];
 //获取本地网卡列表
    //if(pcap_findalldevs(&devs,errbuf)!=-1)
    //{
    //    for(d=devs;d;d=d->next)
    //    {
    //        cout<<i<<"."<<d->name<<"("<<d->description<<")"<<endl;
    //        i++;
    //    }
    //}

    //设置一个源
 if(pcap_createsrcstr(source,PCAP_SRC_IFREMOTE,"10.14.29.61","2000",NULL,errbuf)==-1) //'0' if everything is fine, '-1' if some errors occurred.
 {
    cout<<"ERROR:"<<errbuf<<endl;
    exit(-1);
 }
 cout<<"source:"<<source<<endl;

 //获取远程和本地网卡接口
    if(pcap_findalldevs_ex(source,NULL,&devs,errbuf)==-1)
    {
        cout<<"ERROR:"<<errbuf<<endl;
        exit(1);
    }
    for(d=devs;d;d=d->next)
    {
        cout<<i<<"."<<d->name<<"("<<d->description<<")"<<endl;
        i++;
    }
    system("pause");
    return 0;
}


编译没错,但是就是获取不了远程设备列表