NetRingGetRangeCount function


Some information in this topic relates to prereleased product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

NetAdapterCx is preview only in Windows 10, version 1903.

Calculates the number of elements contained in a range of the specified net ring buffer.


UINT32 NetRingGetRangeCount(
  NET_RING const *Ring,
  UINT32         StartIndex,
  UINT32         EndIndex




The inclusive start of the range to measure.


The exclusive end of the range to measure.

Return Value

The number of elements in the given range.


For example, consider a net ring containing a total of 8 elements. Index values for the elements are 0 through 7. The number of elements in the range [1, 4) is 3. This is because the EndIndex value is not included, so the range includes elements at index values 1, 2, and 3.

Similarly, the range [4, 1) includes elements at index values 4, 5, 6, 7, and 0 (looping back to the beginning of the ring), for a total of 5 elements.

Finally, note that an empty range like [2, 2) returns zero elements.


Target Platform Universal
Minimum KMDF version 1.29
Header ring.h (include netadaptercx.h)
IRQL Any level as long as target memory is resident