NTSTATUS
SoundCreateDevice(
IN PCSOUND_DEVICE_INIT DeviceInit,
IN UCHAR CreationFlags,
IN PDRIVER_OBJECT pDriverObject,
IN PVOID pGDI,
IN PVOID DeviceSpecificData,
IN PVOID pHw,
IN int i,
OUT PDEVICE_OBJECT *ppDevObj
);
The SoundCreateDevice function creates a device object and an associated LOCAL_DEVICE_INFO structure.
Parameters
DeviceInit
Pointer to an initialized SOUND_DEVICE_INIT structure.
CreationFlags
The following flag values are supported:
Flag | Definition |
SOUND_CREATION_NO_NAME_RANGE | Don't append number to name prototype when creating device name. |
SOUND_CREATION_NO_VOLUME | Volume setting not supported. |
pDriverObject
Pointer to the driver object received as input to the DriverEntry function.
pGDI
Pointer to driver-specified information. Pointer is stored in the pGlobalInfo member of the device's LOCAL_DEVICE_INFO structure.
DeviceSpecificData
Pointer to one of the following device-type structures.
Structure | Usage |
WAVE_INFO | For waveform devices |
MIDI_INFO | For MIDI devices |
MIXER_INFO | For mixer devices |
NULL | For other devices |
pHw
Pointer to driver-specified hardware context information. The pointer is stored in the HwContext member of the device's LOCAL_DEVICE_INFO structure.
i
Driver-specified index value. Stored in DeviceIndex member of the device's LOCAL_DEVICE_INFO structure.
ppDevObj
Address of a location to receive a pointer to a DEVICE_OBJECT structure, if the call succeeds.
Return Value
Returns STATUS_SUCCESS if device creation succeeds. Returns STATUS_INSUFFICIENT_RESOURCES if device creation fails.
Comments
The SOUND_DEVICE_INIT structure must be nonpaged.
The SoundCreateDevice function creates a device object by calling IoCreateDevice. If the object creation succeeds, the function returns the address of a DEVICE_OBJECT structure. The function also allocates a LOCAL_DEVICE_INFO structure and assigns its address to the DeviceExtension member of the DEVICE_OBJECT structure.
The function calls IoCreateSymbolicLink to map the NT generic name for the device object to the corresponding Win32 logical name.
For more information about device objects, see the Kernel-Mode Drivers Design Guide.