Wireshark-dev: Re: [Wireshark-dev] how to open a HANDLE with a WiFi card
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Fri, 19 Jun 2009 16:08:05 -0700

On Jun 18, 2009, at 4:43 PM, Joshua (Shiwei) Zhao wrote:

With Wireshark, I'm trying to modify it to send NDIS requests to a wifi card driver on windows OS.

Ideally, Wireshark shouldn't do that; all operations on capture devices should be done through libpcap/WinPcap.

However, as not all the functionality that Wireshark can use is yet implemented by libpcap/WinPcap APIs, sometimes Wireshark has to implement that itself. What is it you're trying to do?

To do this I need to call CreateFile() and pass a string of device name to it.

That's not necessarily the case.

See, for example, gtk/capture_if_details_dlg_win32.c, which makes calls to wpcap_packet_request_uint() to fetch various statistics and other information about a network adapter. It calls wpcap_packet_open () to get a lower-level handle on the device.

Those routines are in capture_wpcap_packet.c, which provides access to the Packet Driver API in Winpcap; the routines from that file might be sufficient to do what you want.