Every miniport driver must provide a function called DriverEntry. By convention, DriverEntry is the transfer address for a driver. If a driver does not use the name DriverEntry, the driver developer must define the name of its entry function to the linker(s) so that the transfer address can be linked into the OS loader.
DriverEntry is called by the I/O system when a driver is loaded. This function creates an association between the miniport NIC driver and the NDIS library and registers the miniport’s characteristics with NDIS.
The declaration of a Windows NT DriverEntry is:
NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
);
Two arguments are passed 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.
DriverEntry calls NdisMInitializeWrapper and then NdisMRegisterMiniport. DriverEntry passes both pointers it received to NdisMInitializeWrapper, which returns a wrapper handle. DriverEntry passes the wrapper handle to NdisMRegisterMiniport.
The registry contains data that is persistent across system boots, as well as configuration information generated anew at each system boot. During driver installation, data describing the driver and the NIC is stored in the registry. The registry contains adapter characteristics that are read by the NIC driver to initialize itself and the NIC. See the Kernel-Mode Driver Design Guide for more about the registry and the Programmer’s Guide for more information about the .inf files that install the driver and write to the registry.