开发者

How to use NDIS protocol driver?

开发者 https://www.devze.com 2023-03-26 05:54 出处:网络
I write a NDIS protocol driver. I can register my protocol with NdisRegisterProtocol. How does the application typically access this driver?

I write a NDIS protocol driver. I can register my protocol with NdisRegisterProtocol.

How does the application typically access this driver? Is there a way to uses windows sockets or do I need to provide a StreamDriver interface?

The socket function has a third parameter 'protocol' that usually something like IPPROTO_UDP. Can I select my protocol dri开发者_开发问答ver using this parameter?


Protocol drivers aren't automatically exposed in the Windows Sockets API (and this is a good thing, since it gives you the most architectural flexibility). But you can get it to work by implementing a couple extra pieces.

  1. You need to implement some channel to communicate with your driver. I'm not too familiar with Windows CE, but StreamDriver sounds like a plausible way to do that.

  2. You need to expose that channel through Winsock. Write a "Transport Service Provider" library that takes requests from Winsock and translates them into something your protocol driver can understand.

This is how TCPIP (the protocol driver) shows up as IPPROTO_UDP (the Winsock protocol type) — the OS includes a TSP for TCP, UDP, and Raw IP.

The CE-specific documentation is here, but the NT documentation is worth reading too for the overview section.

0

精彩评论

暂无评论...
验证码 换一张
取 消