[Winpcap-users] Checking whether adapter is alive
Loris Degioanni
loris.degioanni at gmail.com
Mon Mar 6 16:58:15 GMT 2006
Thanks Bryan,
I'll give a look at it probably next weekend.
Loris
Bryan Kadzban wrote:
> Loris Degioanni wrote:
>> 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.
>
> Well, my program (not sure about Shmuel's) runs this type of code. I
> have a .Net OO wrapper around the whole thing, but these are the API
> calls it makes:
>
> // start of setup
> PacketGetAdapterNames(...); // get size of buffer
> // allocate a buffer
> PacketGetAdapterNames(...); // get adapter list into the buffer
>
> for each "name" in the list returned {
> handle = PacketOpenAdapter(name);
>
> // Get OID_GEN_PHYSICAL_MEDIUM using PacketRequest on "handle", and
> // filter out non-wireless cards.
> // If not filtered, add handle to the list of handles.
> }
> // end of setup
>
> every second, for each item in the list of handles, do {
> PACKET_OID_DATA *req = malloc(whatever);
> req->Oid = OID_802_11_BSSID_LIST;
> req->Length = // what I passed to malloc
> PacketRequest(handle, 0, req);
> // (Actually, I do this, with increasing buffer sizes, until
> // PacketRequest doesn't fail with the "buffer too short" status.)
>
> // Display all APs in range, indicating the signal strength of
> // each, based on the list returned by this OID
> }
>
> This "every second" loop runs (with only one device) fine, until the
> device in question gets disabled. Then it BSODs. (It may also BSOD if
> other devices on the same machine get disabled, I don't remember. I do
> know it blue-screens if any device options get changed, though.) You
> can reproduce it by either removing a USB NIC while the loop is running
> (if you have a USB NIC), or disabling the device in device manager (but
> this may not be possible).
>
> The *easy* way to trigger the BSOD is to go into device manager, open up
> the properties of the NIC device that you have open in the loop (again,
> or perhaps any other one, I don't remember for sure anymore), go to the
> Advanced tab, change the value of any of the options there, and hit OK.
> The machine will BSOD on the first call into PacketRequest after you hit
> OK.
>
> I also have a memory dump file from one of the blue screens, but I'm
> guessing it's probably too large to send via email (it's 512MB).
>
> Thanks!
>
>> 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.
>
> Hmm. One open and close per second might get to be a bit much, I don't
> know...
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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