An application can use IOCTL_NDIS_QUERY_GLOBAL_STATS to obtain information from a network adapter. The application passes IOCTL_NDIS_QUERY_GLOBAL_STATS, along with an Object Identifier (OID), in the DeviceIoControl function.
IOCTL_NDIS_QUERY_GLOBAL_STATS directs NDIS to use the specified OID to obtain information from the specified network adapter.
BOOL DeviceIoControl( IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer, IN DWORD nInBufferSize, OUT LPVOID lpOutBuffer, IN DWORD nOutBufferSize, OUT LPDWORD lpBytesReturned, IN LPOVERLAPPED lpOverlapped );
If the query succeeds, DeviceIoControl returns a nonzero value.
If the query fails, DeviceIoControl returns zero. To get extended error information, call GetLastError.
Defined in ntddndis.h. Include ntddndis.h.
This IOCTL will be deprecated in future OS releases. You should use WMI interfaces to query miniport information. For more information see, NDIS Support for WMI.
An application can use IOCTL_NDIS_QUERY_GLOBAL_STATS with any query OID that is supported by the network adapter and the adapter's miniport driver.
Before an application can use IOCTL_NDIS_QUERY_GLOBAL_STATS, it must call the CreateFile function to open a handle to the network adapter. In this CreateFile call, the application passes a pointer to a null-terminated string that specifies the name of the device that NDIS registered. For NT-based operating systems, the application can retrieve the name from the ServiceName value of the "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\NetworkCards\Nnn" key in the registry, where Nnn is the string for the adapter's instance number. The string should be of the form "\\.\Xxx", where Xxx is the string for the adapter's service name. The application can use the following registry functions to access the registry:
For more information on DeviceIoControl, CreateFile, GetLastError, and the registry functions, see the Platform SDK documentation.
For Windows 2000 and later versions, use the interface name to open the device. To get the interface name, enumerate the GUID_NDIS_LAN_CLASS device interfaces by calling the SetupDiEnumDeviceInterfaces function. For information about enumerating device interfaces, see Device Information Sets.
Windows 98/Me do not support IOCTL_NDIS_QUERY_GLOBAL_STATS.