[Winpcap-users] Winpcap-users Digest, Vol 72, Issue 8

Fish" (David B. Trout fish at infidels.org
Sat Apr 2 23:46:53 PDT 2011


Gianluca Varenni wrote:
> Fish wrote:
> > Gianluca Varenni wrote:
> > 
> > > 3. BIOCSETEVENTHANDLE should not be used directly
> > > (the other Packet APIs might stop working properly).
> > 
> > How so?!  Please explain!
> 
> 3. Suppose that you open a WinPcap handle with PacketOpenAdapter

Which does a CreateFile followed by a DeviceIoControl(BIOCSETEVENTHANDLE).


> and then call PacketSetReadEvt.

Which does a BIOCSETEVENTHANDLE to associate a [new] event handle for a
given open instance.


> This will create an event for you and send it to the driver with
> an IOCTL.

Yes: BIOCSETEVENTHANDLE.


> Then the other Packet APIs will use that same event to wait for
> data reception.

For that open instance (i.e. Win32 HANDLE returned by CreateFile), yes.


> If you set another event by sending an IOCTL directly, the other
> Packet APIs will not be aware that you changed the event directly
> with an IOCTL.

If I use the same CreateFile HANDLE (open instance), then yes.

But if I use a different CreateFile HANDLE then no. It would not impact
other Packet APIs at all.

The problem only occurs if I use the same CreateFile HANDLE that
PacketOpenAdapter created, and then call BIOCSETEVENTHANDLE myself directly
to associate a completely different event handle for that open instance.
Then and ONLY then would it cause a problem.

But as long as I do my own CreateFile to obtain my own HANDLE, then I can do
BIOCSETEVENTHANDLE all I want an it would NOT impact the other Packet APIs
at all.

-- 
"Fish" (David B. Trout) 
 fish at softdevlabs.com






More information about the Winpcap-users mailing list