In Windows 7 or later, NDIS miniport driver support NdisMediumIP as its media type. This means the network data sending to or receiving from the network adapter is pure IP packet, without any media frame like an ethernet frame.
Everything is OK to write such a miniport driver, except for two points different from traditional ethernet media based driver.
- In INF, the lowerRange should be specified as “nolower” instead of “ethernet” or other types. If you specified “ethernet”, the driver still works in Windows 10. But in Windows 7 it refused to work.
- To send data to the adapter, a NET_BUFFER_LIST must be constructed and sent by a NdisMIndicateNetBufferLists() call. An extra OOB data must be set to make the driver send data successfully. It was
pNetBufferList->SourceHandle = pAdapterInfo->adapterHandle; // This is the key information that must be set, otherwise the upper level won't recognize the packet. NET_BUFFER_LIST_INFO(pNetBufferList, NetBufferListFrameType) = (PVOID)(((NDIS_ETH_TYPE_IPV4 << 8) & 0xFF00) | ((NDIS_ETH_TYPE_IPV4 >> 8) & 0x00FF)); NET_BUFFER_LIST_STATUS(pNetBufferList) = NDIS_STATUS_SUCCESS;