libwsk 是对 WSK (Winsock-Kernel) 接口的封装。让内核模式驱动可以使用用户模式的 Winsock2 相同的套接字概念和接口进行网络 I/O 操作。
IDE:Visual Studio 2019 or higher
如果目标系统是 Windows7,请设置这些。
libwsk 属性页 -> Driver Settings -> Target OS Version = Windows 7 libwsk 属性页 -> Driver Settings -> Target Platform = Desktop
git clone --recurse-submodules https://github.com/MiroKaku/libwsk.git
- 打开
msvc/libwsk.sln
并编译它。 - 引入
libwsk.lib
到你的项目。参考unittest
。
BSD sockets | WSA (Windows Sockets API) | WSK (Windows Sockets Kernel) | State |
---|---|---|---|
- | WSKStartup | √ | |
- | WSKCleanup | √ | |
socket | WSKSocket | √ | |
closesocket | WSKCloseSocket | √ | |
bind | - | WSKBind | √ |
listen | - | WSKListen | √ |
connect | WSKConnect | √ | |
shutdown | WSKDisconnect | √ | |
accept | WSKAccept | √ | |
send | WSKSend | √ | |
recv | WSKRecv | √ | |
sendto | WSKSendTo | √ | |
recvfrom | WSKRecvFrom | √ | |
ioctlsocket | WSKIoctl | √ | |
setsockopt | - | WSKSetSocketOpt | √ |
getsockopt | - | WSKGetSocketOpt | √ |
getaddrinfo | WSKGetAddrInfo | √ | |
freeaddrinfo | WSKFreeAddrInfo | √ | |
getnameinfo | WSKGetNameInfo | √ | |
inet_ntoa | WSKAddressToString | √ | |
inet_addr | WSKStringToAddress | √ | |
- | WSKCreateEvent | √ | |
- | WSKGetOverlappedResult | √ | |
... | ... | ... | - |