I tried compiling and running the sendpack example of the npcap sdk for C.
While running the program with a loopback interface (specifically, Microsoft Wi-Fi Direct Virtual Adapter) as an argument to pcap_sendpacket, the program works as intended, but while running the program with my real WiFi interface (TP-Link Wireless USB Adapter) as an argument to pcap_sendpacket, the program returns an error:
send error: PacketSendPacket failed: A device attached to the system is not functioning. (31)
The code I use can be downloaded here:
https://npcap.com/dist/npcap-sdk-1.13.zip
It is the sendpack.c example in Examples-pcap.
My operating system is windows 11.
I tried disconnecting and reconnecting the tp-link adapter (my wifi interface), restarting my pc, and reinstalling npcap.
It should also be noted that wireshark (which also uses npcap) can inspect the tp-link adapter just fine (although wireshark doesn't send packets).