Bugs in the NT DDK Packet Protocol Driver Sample

Programmers wishing to write NDIS protocol drivers for Windows NT have long used the Packet sample in the NT DDK as a learning tool. Some programmers have used the Packet sample as an armature to build their drivers around, adding code but leaving the structure intact. Unfortunately, the sample has bugs. This page attempts to collect warnings about the dangers lurking in the Packet sample. This information in this page is offered in the spirit of cooperation among programmers. The author hopes that he will be contacted by those who find additional bugs in the Packet sample or wish to correct inaccuracies in this page.


The latest news: This page may be obsolete

Eliyas Yakub of Microsoft has reworked the NT 4.0 Packet sample and he believes he has addressed all the bugs reported on this page. You can download the updated sample from MS Support.

Eliyas reports on his work:

I think I took care of all the bugs. I took out the cleanup routine because it was completely wrong. In the first place, it's not a good idea to reset an adapter just because an application doesn't want to use the adapter any more. Resets are expensive operation. An adapter is not a resource of one application or protocol in the system. Secondly, there was a race condition between the protocol and miniport during freeing of packet. There is no reliable way to do this in the existing architecture. There are plans to introduce new APIs to cancel a pending Recv.

I also don't like the idea of using FsContext to save the BindApapterContext. This is not generally recommended. I modified it in the W2K version but I left it as is on NT4.0.

I would like to hear about anyone's experience with the new version of the sample.


What isn't a bug

We won't list as bugs the design choices in the Packet sample that could have been done better and probably would have been done better in a production driver unless those choices harm the robustness or throughput of the driver. Under this heading come:


The bugs themselves


Please contribute to this page!

There's no point in trying to convince you that reading this page is good for you; presumably you can decide that for yourself. But if you know something that would improve this page there are reasons for contributing to it that you may not have though of:
Copyright 1998 by Lew Perin under GNU Public License
<perin@acm.org>: home page / email
Last modified: Tue Sep 07 17:35:01 1999