This driver demonstrates the functionality of an NDIS protocol driver on Windows® 2000. It dynamically binds to real/virtual adapters, creates a named deviceobject for each adapter, which can be opened by a Win32 application via symbolic link. At the upper edge it uses regular driver interface (handles IRPs) and at the lower edge it uses NDIS interface to communicate with the NIC driver. The accompanying test application (packapp.exe) shows how to open the adapter, send or receive packets, and send OID requests to the adpater directly.
This sample is NDIS 5.0 compliant and shows how to handle dynamic binding and unbinding to adapters whenever the adapters are pluggedin and unplugged. It also has minimal support for PnP and Power mangement queries. Refer to NDIS protocols driver design in the DDK documentation for information.
For simplicity, the Packet driver is writen so that it only binds to an Ethernet adapter. As a result it makes assumptions about frame size.
Run the build -ceZ command from this directory to build the sample—it creates packet.sys and packapp.exe.
To install this driver on Windows® 2000:
On the desktop, right-click the My Network Places icon, and then choose Properties.
Right-click the relevant Local Area Connection icon, and then choose Properties.
Click on Install, select Protocol and Click on Add button.
Click on Have Disk...; point to the PACKET.INF file present in the sample directory.
Finally, follow through the dialog and finish the installation.
To test the driver, run the Packapp.exe. This application automatically starts the driver when it loads, and stops the driver when it exits. This application is single threaded, so if you do a read and if there are no incoming packets on the adapter, it will wait until it gets one. So the application would appear as if it has hung. If you want to exit the application, you can terminate it anytime with the Task Manager. Also, this application can open only one adapter at a time. You can run multiple instances of this application to open other adapters, if the system has more than one.
If you check build this driver, be sure to uncomment the debug messages in the packet receive handlers. Otherwise if you set the filter in the user application to promiscuous or broadcast mode, the driver may get flooded with packets, and it will spend all it's time printing debug messages. As a result you system will freeze.
File DescriptionMakefile Used during compilation to create the object and sys files Packet.c Main file contains DriverEntry, Bind/Unbind Apdapter and other support routines Read.c Routines for handling user read (receive) request Write.c Routines for handling user write (send) request Openclos.c Routines for handling user open and close requests Packet.h Prototypes of all functions and data structures used by the Packet driver Packet.htm Html documentation of the Packet driver (this file) Packet.rc Resource file for the Packet driver Testapp.c Main file for the test application. ChildWin.c Routines for handling Child Windows messages. Packet32.c File for support routines used by the testapp. Sources List of source files that are compiled and linked to create the packet driver and packapp.exe
© 1999 Microsoft Corporation