2

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 driver using this parameter?

harper
  • 13,345
  • 8
  • 56
  • 105

1 Answers1

3

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.

Jeffrey Tippet
  • 3,146
  • 1
  • 14
  • 15