[Winpcap-users] Checking whether adapter is alive

Gianluca Varenni gianluca.varenni at cacetech.com
Sun Mar 12 17:19:31 GMT 2006


----- Original Message ----- 
From: "Shmuel Lange" <shmuel.lange at code-red.biz>
To: <winpcap-users at winpcap.org>
Sent: Tuesday, March 07, 2006 4:48 AM
Subject: RE: [Winpcap-users] Checking whether adapter is alive


> Loris,
>
> I try to solve the problem by using dummy WriteFile function before 
> calling
> PacketRequest function of WinPcap:
>
> if(WriteFile(AdapterObject ->hFile, NULL, 0, &dummy, NULL))
> PacketRequest(...);
>
> If the user removes the adapter (remove the card) the WriteFile would fail
> and PacketRequest would be skipped.
>
> It is work with Winpcap version 3.0 but it isn't work with the new Winpcap
> version (3.1).
>
> The problem with the new version is that the WriteFile always fail.
>
> Why can't I use WriteFile with WinPcap 3.1?

Well, first of all accessing the internal fields of the LPADAPTER is really 
dangerous, there's no guarantee that this structure will not change in the 
future (it was an error on our side to expose this structure in the public 
includes).

Regarding the fact that WriteFile fails with WinPcap 3.1, this is due to a 
patch in the driver that was done in one of the betas of WinPcap 3.1. This 
sanity check prevents the user from trying to transmit an empty buffer to 
the network.

Have a nice day
GV

>
>
>
> -----Original Message-----
> From: winpcap-users-bounces at winpcap.org
> [mailto:winpcap-users-bounces at winpcap.org] On Behalf Of Loris Degioanni
> Sent: Sunday, March 05, 2006 7:44 PM
> To: winpcap-users at winpcap.org
> Subject: Re: [Winpcap-users] Checking whether adapter is alive
>
> Bryan, Shmuel,
> do you have a small snippet of code that we can use to replicate the
> problem? That would allow us to debug it more easily.
>
> A simple workaround, if the frequency of the calls to PacketRequest() is
> not high, is closing and reopening the adapter every time. The adapter
> should just not open if the card is removed.
>
> Loris
>
>
> Shmuel Lange wrote:
>> Yes. If I don't do that I would see blue-screen.
>>
>> -----Original Message-----
>> From: winpcap-users-bounces at winpcap.org
>> [mailto:winpcap-users-bounces at winpcap.org] On Behalf Of Bryan Kadzban
>> Sent: Sunday, March 05, 2006 3:36 PM
>> To: winpcap-users at winpcap.org
>> Subject: Re: [Winpcap-users] Checking whether adapter is alive
>>
>> Shmuel Lange wrote:
>>> I use PacketOpenAdapter (of WinPcap 3.1) function to open wireless
>>> adapter and then I use PacketRequest function to do somthing.
>>>
>>> Is there is way to check whether the user remove the wireless card
>>> before I call PacketRequest function?
>>>
>>
>> Because if you don't, it blue-screens, right?  Or aren't you seeing that?
>>
>> (Last October, I reported a case where disabling or enabling any NIC
>> (though not any connection), or changing driver options, would BSOD on
>> the next PacketRequest call -- in my case, to either set or get an NDIS
>> OID.  I think it has something to do with how npf.sys doesn't handle
>> device PnP events correctly (it leaves a "stale" pointer somewhere),
>> though I have no idea how to make it do so.  In the meantime, I've just
>> been shutting down the npf driver before doing any kind of disable,
>> enable, or driver-option-change.  I still have a memory dump of when the
>> BSOD happens, if anyone wants it, but it's 512 megs.)
>>
>>
>>
>> _______________________________________________
>> Winpcap-users mailing list
>> Winpcap-users at winpcap.org
>> https://www.winpcap.org/mailman/listinfo/winpcap-users
>>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users
>
>
>
> _______________________________________________
> 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