3.1.1 Initializing the Wrapper

DriverEntry associates the miniport NIC driver with NDIS by calling NdisMInitializeWrapper, and passing the pointer to the driver object and to the registry path. NdisMInitializeWrapper allocates a structure to represent this association, stores the miniport-specific information it needs in this structure and returns NdisWrapperHandle, which is a handle to this structure representing the miniport NIC driver. The driver must retain and pass this handle to NdisMRegisterMiniport when it registers its entry points, and to NdisTerminateWrapper if it cannot successfully complete its DriverEntry function, if it cannot successfully initialize its NIC, or when it is unloaded. NDIS will use NdisWrapperHandle to identify the miniport. While the miniport must retain this handle, it should never attempt to access or modify the contents of the structure associated with this handle.