3.2.7  Handling Errors During Initialization

If a miniport returns a failure status at any time during its initialization; for instance, if it cannot obtain the resources it needs, cannot claim the hardware resources its NIC needs in the registry, or if it cannot find a medium it supports, it must take care to back out actions it has taken that affect the overall system. The miniport should deallocate any memory it has allocated by calling NdisFreeMemory, it should release I/O resources it has claimed by calling NdisMDeregisterIoPortRange and if it has called NdisOpenConfiguration, it should call NdisCloseConfiguration. If the miniport has allocated map registers, or a DMA channel, it should call NdisMFreeMapRegisters or NdisMDeregisterDmaChannel.

A miniport that fails during initialization can record the problem in the error log by calling NdisWriteErrorLogEntry with an error code and error-type-specific values.