[Winpcap-users] Problems with modifying pcap-win32.c to support our
Varuna De Silva
varunax at gmail.com
Thu Sep 13 06:34:27 GMT 2007
We need to add support for our device in libpcap, it is a USB device with a
- I am in the Windows platform & Working with VS2005 (C++)
- I have downloaded WinPcap and compiled the packet.dll (Though not
used) and then wpcap.dll from source successfully
- The build configuration is Debug_REMOTE
As I was previously educated I wrote my own program with including
necessary headers for the driver. Within it I gave my device the name
And next I want to call the pcap_open_live() in libpcap.
What I did In my program
I wrote my own program usb.c in VS2005 in a new project.
This had the initialization of the device name and I called
I linked the wpcap.lib (and other necessary libraries for the driver) in
winpcap\wpcap\LIB which is refreshed every time I build wpcap entire
What I did to Pcap-win32.c
- I changed the project properties to include my own preprocesser
directive HAVE_USBSS7_API in project window
- I changed the pcap_open_live() in this c file as below
pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, char
register pcap_t *p;
char host[PCAP_BUF_SIZE + 1];
char port[PCAP_BUF_SIZE + 1];
char name[PCAP_BUF_SIZE + 1];
printf("I am inside the Win32 \n");
I added my piece of code inside the HAVE_REMOTE because I am using that
I just want to know when I call pcap_open_live to which program does it get
called which has that
routine (In windows)
I know that the routine gets called since I get an error message when I call
But I doubt if it is the routine in Pcap-win32.c
The error message
Error opening adapter: The system cannot find the device specified. (20)
In seeing this message I just changed the occurrence of this statement in
if (p->adapter == NULL)
/* Adapter detected but we are not able to open it. Return failure.
snprintf(ebuf, PCAP_ERRBUF_SIZE, "Error opening adapter ss7_usb:
Just to see if it works .... Unfortunately not:-) the error message stays
The error message is alright cause I have done nothing to open the device,
But I want to know from where I get this message. Is it not the
Pcap-win32.c in winpcap\libpcap
Does Pcap-win32.c.orig has anything to do with it ? I didnt mingled with it
since that is not is the project tree.
Please Help me out with this....
I have no way out from here!
Thank you all
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Winpcap-users