[Winpcap-users] pcap_findalldevs doesn't find the new device andleaks memory

Gianluca Varenni gianluca.varenni at cacetech.com
Tue Jun 10 18:31:17 GMT 2008


----- Original Message ----- 
From: <tamagawa at skygroup.jp>
To: <winpcap-users at winpcap.org>
Sent: Tuesday, June 03, 2008 5:59 PM
Subject: [Winpcap-users] pcap_findalldevs doesn't find the new device 
andleaks memory


> Hi lists,
>
> I have a problem with Winpcap4.0.2 on WindowsXP SP2.
>
> My program runs a loop in which it detects new network interface.
> When I have a new NIC in a PCI slot and boot XP, Winpcap doesn't
> find the new installed card with pcap_findalldevs.

Do you mean you hot-plug a PCI card (or PCMCIA one) in your machine? WinPcap 
does not support hot-plugging i.e. when the WinPcap driver gets loaded, it 
gets the list of adapters available at that point in time. In order to 
re-enumerate the available adapters, you need to unload and reload the 
WinPcap driver.

And, in the loop,
> everytime pcap_findalldevs is called, it leaks several KB memories.

Do you have a simple application that shows such behavior? Does it happen on 
Windows XP or on other Windows versions?

>
> The problem doesn't happen after second boot. It could be that
> in case the driver for the new installed card become active after
> Winpcap is started, Winpcap can never find the card.
>
> Is there any workaround for these problems?

You need to unload before listing the adapters (pcap_findalldevs takes care 
of reloading it in case of need). Be warned that you cannot unload the 
driver if you are using it to capture packets at the same time. You can 
unload the driver from the command line using "net stop npf" or using the SC 
(Service Control) APIs, in particular ControlService with the parameter 
SERVICE_CONTROL_STOP.

Have a nice day
GV

>
> Thanks in advance for any advice.
>
> Warm regards,
> --
> tamagawa ryuji
>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users 



More information about the Winpcap-users mailing list