DrvConfigureDriver

BOOL
   DrvConfigureDriver(
       PREG_ACCESS
RegAccess,
       LPTSTR
DriverName,
       SOUND_KERNEL_MODE_DRIVER_TYPE
DriverType,
       BOOL (*
SetParms)(PVOID),
       PVOID
Context
       );

The DrvConfigureDriver function opens a connection to the service control manager, creates a kernel-mode driver service for the specified driver, and loads the kernel-mode driver.

Parameters

RegAccess

Pointer to a globally-defined structure of type REG_ACCESS.

DriverName

Pointer to the driver name. Must match DriverName in registry path.

DriverType

Driver type, used for indicating the kernel-mode driver’s load group. The type is SOUND_KERNEL_MODE_DRIVER_TYPE. The value can be one of the following.

Value Definition
SoundDriverTypeNormal Adds kernel-mode driver to “base” load group.
SoundDriverTypeSynth Adds kernel-mode driver to “Synthesizer Drivers” load group.

The “Synthesizer Drivers” group is unknown to Windows NT and therefore is guaranteed to be loaded last.

SetParms

Pointer to a driver-supplied function that is called before the kernel-mode driver is reloaded. Can be NULL.

Context

Pointer to a driver-defined structure that is passed as input to the function pointed to by SetParms. Can be NULL.

Return Value

Returns TRUE if the operation succeeds. Otherwise returns FALSE.

Comments

The structure pointed to by RegAccess must be a single, globally-defined REG_ACCESS structure that the driver uses with all calls to drvlib.lib functions requiring a RegAccess parameter.

The function performs the following operations, in order:

1.Calls DrvCreateServicesNode, specifying TRUE for the Create parameter.

2.Calls DrvUnloadKernelDriver to unload the kernel-mode driver.

3.Calls the driver-supplied function specified by the SetParms parameter. Generally, drivers use this function to modify configuration parameters in the registry.

4.Calls DrvLoadKernelDriver to reload and restart the kernel-mode driver.

Typically, a user-mode driver calls DrvConfigureDriver from its DriverProc function when processing a DRV_CONFIGURE or DRV_INSTALL command, after obtaining user-specified configuration parameters from a dialog box.

After DrvConfigureDriver returns, call DrvCloseServiceManager.

For additional information, see Installing and Configuring your Driver, Using drvlib.lib.