Compiling a Miniport Driver for Windows CE

The source code for miniport drivers on Windows NT is largely compatible with Windows CE. As long as a miniport driver uses NDIS functions supported by Windows CE, the process of porting a miniport driver to Windows CE is straightforward.

The most significant difference between Windows CE and Windows NT is that Windows CE does not support .sys or .inf files. This reduces the complexity and size of the Windows CE loader. Therefore, a miniport driver for Windows CE is compiled as a DLL that exports the DriverEntry function. DriverEntry typically performs any general or platform-specific initializations. It also registers the miniport driver with the NDIS system by calling NdisMRegisterMiniport. DriverEntry must have the following prototype.

NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject,
IN PUNICODE_STRING
pRegistryPath);

For sample DriverEntry implementations, see the source code for the sample miniport drivers.

Because Windows CE does not support the Common Network .inf file format for installing a device driver, you must ensure that the proper registry keys are created for the miniport driver, typically through a setup application or through the driver’s Install_Driver function. For more information, see Registry Keys for Miniport Drivers.

As well as those general issues related to the structure of miniport drivers themselves, there are issues relating to pointers, as well. I/O port addresses for miniport drivers are 32-bit virtual addresses that are mapped to the miniport driver’s process address space. Do not cast I/O port addresses to non-32-bit types, such as USHORT.

A miniport driver should be installed in the \Windows directory on a target Windows CE–based platform. Miniport drivers need certain system DLLs in order to load and function correctly. Ethernet miniport drivers require the Ndis.dll, Arp.dll, and Dhcp.dll files. IrDA miniport drivers require the Ndis.dll and Irdastk.dll files. OEMs can omit some of these files if their platforms do not have the hardware used by a particular type of driver. For example, platforms without a built-in infrared port do not require Irdastk.dll.

Miniport drivers for PC Card–based NICs can be loaded and unloaded dynamically when the NICs are inserted or removed. This is because PC Cards are detected automatically by the Plug and Play support in Windows CE. However, other types of NIC hardware that cannot be detected automatically by Windows CE require that a platform be restarted after the miniport driver is installed in order for Windows CE to use the driver. After a platform is restarted, the NDIS component loads all drivers that have an HKEY_LOCAL_MACHINE\Comm\Miniport\Group value of NDIS listed in the registry.