[Winpcap-users] Checking whether adapter is alive

Shmuel Lange shmuel.lange at code-red.biz
Tue Mar 7 12:48:22 GMT 2006


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?


 
-----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





More information about the Winpcap-users mailing list