PRIVATE was: [Winpcap-users] Checking whether adapter is alive

Bryan Kadzban bryan at kadzban.is-a-geek.net
Mon Mar 27 23:31:54 GMT 2006


(Gianluca: I tried sending this directly to you, but your mail server
seems to reject anything from my IP range, claiming that all of those
addresses (the entire /24 network) are "direct spam sources".  This is
therefore the only way I can respond.  I'll remove the links and such
that were in your original mail.  This is why I don't use blacklists,
but maybe you don't have any control over that.)

Gianluca Varenni wrote:
> that should fix all the problems (i.e. blue screens) when an adapter
> is disconnected from the system or disabled (or simply you try to
> "repair" a wireless network connection).

Yep, it seems to work better here.  I haven't been able to blue-screen
it during my testing.

It looks like when an adapter is removed, the next call into packet.dll
calls SetLastError(1) and returns an error status; would it be possible
to call SetLastError with some other argument in that case?  The reason
I ask is that when I unplug the Ethernet cable or shut down the wireless
supplicant (depending on which NIC I bound my program to), I get the
same behavior (PacketRequest fails and GetLastError() returns 1); it
would be nice to be able to tell the difference between a failure that
means I need to close the file handle (because the card was unbound from
winpcap) and one that doesn't.

(Actually, it might also be nice to be able to register somehow to be
notified whenever a NIC gets bound or unbound (or both).  I suppose that
might be as simple as giving npf.sys an auto-reset event, and having it
set (not pulse!) that event when it gets a callback of the proper type.
That's probably the simplest I can come up with.  That way I don't waste
time checking whether the NIC has come back up.)

But either way, thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url : http://www.winpcap.org/pipermail/winpcap-users/attachments/20060327/f911b77f/signature.pgp


More information about the Winpcap-users mailing list