Initializing a Miniport Driver
When a networking device becomes available, the system loads the NDIS miniport driver to manage the device (if the driver is not already loaded). Every miniport driver must provide a DriverEntry function. The system calls DriverEntry after it loads the driver. DriverEntry registers the miniport driver's characteristics with NDIS (including the supported NDIS version and the driver entry points).
The system passes two arguments to DriverEntry:
A pointer to the driver object, which was created by the I/O system.
A pointer to the registry path, which specifies where driver-specific parameters are stored.
In DriverEntry, miniport drivers pass both of these pointers in a call to the NdisMRegisterMiniportDriver function. Miniport drivers export a set of standard MiniportXxx functions by storing their entry points in an NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure and passing that structure to NdisMRegisterMiniportDriver.
A miniport driver also performs any other driver-specific initialization that it requires in DriverEntry. The driver performs adapter-specific initialization in the MiniportInitializeEx function. For more information about adapter initialization, see Initializing an Adapter.
To allow a miniport driver to configure optional services, NDIS calls the MiniportSetOptions function within the context of the miniport driver's call to NdisMRegisterMiniportDriver. For more information about optional services, see Configuring Optional Miniport Driver Services.
The miniport driver must eventually call NdisMDeregisterMiniportDriver to release resources that it allocated by calling NdisMRegisterMiniportDriver. If the driver initialization fails after the call to NdisMRegisterMiniportDriver succeeded, the driver can call NdisMDeregisterMiniportDriver from within DriverEntry. Otherwise, the miniport driver must release the driver-specific resources that it allocates in it's MiniportDriverUnload function. For more information, see Unloading a Miniport Driver.