Examining DriverEntry in sndblst.sys

Like all kernel-mode drivers, sndblst.sys supplies an initialization function called DriverEntry to handle initialization and configuration operations. Because this code is only executed once, it is located in the driver’s INIT data segment, which is marked as discardable.

For more information about DriverEntry, see DriverEntry for Multimedia Drivers.

The DriverEntry function for sndblst.sys is located in \src\mmedia\sndblst\driver\init.c. As a first step, the function initializes the received device object’s dispatch table. Drivers using soundlib.lib must specify SoundDispatch as the dispatcher for the IRP_MJ_CLEANUP, IRP_MJ_CLOSE, IRP_MJ_CREATE, IRP_MJ_DEVICE_CONTROL, IRP_MJ_READ ,and IRP_MJ_ WRITE control codes.

The DriverEntry function calls SoundEnumSubkeys in soundlib.lib to locate the registry entry for each card. For each card found, SoundEnumSubkeys calls back into SoundCardInstanceInit, also located in init.c. If any callback to SoundCardInstanceInit returns a failure, SoundEnumSubkeys returns immediately. After SoundEnumSubkeys returns, DriverEntry calls SoundWriteRegistryDWORD to write each card’s initialization status into the registry.

Note:  The DriverEntry function for sndblst.sys searches for multiple cards. Both soundlib.lib and the registry’s multimedia device keys can handle multiple sound cards. However, the current implementation of sndblst.sys references only one card for I/O operations.