ReactOS 0.4.15-dev-7906-g1b85a5f
capabilities.c File Reference
#include "precomp.h"
Include dependency graph for capabilities.c:

Go to the source code of this file.

Functions

MMRESULT GetSoundDeviceCapabilities (IN PSOUND_DEVICE SoundDevice, IN DWORD DeviceId, OUT PVOID Capabilities, IN DWORD CapabilitiesSize)
 

Function Documentation

◆ GetSoundDeviceCapabilities()

MMRESULT GetSoundDeviceCapabilities ( IN PSOUND_DEVICE  SoundDevice,
IN DWORD  DeviceId,
OUT PVOID  Capabilities,
IN DWORD  CapabilitiesSize 
)

Definition at line 24 of file capabilities.c.

29{
32 BOOLEAN GoodSize = FALSE;
34
37 VALIDATE_MMSYS_PARAMETER( CapabilitiesSize > 0 );
38
39 /* Obtain the device type */
40 Result = GetSoundDeviceType(SoundDevice, &DeviceType);
42
43 if ( ! MMSUCCESS(Result) )
45
46 /* Obtain the function table */
49
50 if ( ! MMSUCCESS(Result) )
52
54
55 /* Check that the capabilities structure is of a valid size */
56 switch ( DeviceType )
57 {
59 {
60 GoodSize = CapabilitiesSize >= sizeof(WAVEOUTCAPSW);
61 break;
62 }
64 {
65 GoodSize = CapabilitiesSize >= sizeof(WAVEINCAPSW);
66 break;
67 }
69 {
70 GoodSize = CapabilitiesSize >= sizeof(MIDIOUTCAPSW);
71 break;
72 }
74 {
75 GoodSize = CapabilitiesSize >= sizeof(MIDIINCAPSW);
76 break;
77 }
78 case AUX_DEVICE_TYPE :
79 {
80 GoodSize = CapabilitiesSize >= sizeof(AUXCAPSW);
81 break;
82 }
84 {
85 GoodSize = CapabilitiesSize >= sizeof(MIXERCAPSW);
86 break;
87 }
88 };
89
90 if ( ! GoodSize )
91 {
92 SND_ERR(L"Device capabilities structure too small\n");
94 }
95
96 /* Call the "get capabilities" function within the function table */
97 SND_ASSERT( FunctionTable->GetCapabilities );
98
99 if ( ! FunctionTable->GetCapabilities )
101
102 return FunctionTable->GetCapabilities(SoundDevice,
103 DeviceId,
105 CapabilitiesSize);
106}
unsigned char BOOLEAN
#define FALSE
Definition: types.h:117
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
DeviceType
Definition: mmdrv.h:42
BOOLEAN IsValidSoundDevice(IN PSOUND_DEVICE SoundDevice)
Definition: devicelist.c:87
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
MMRESULT GetSoundDeviceFunctionTable(IN PSOUND_DEVICE SoundDevice, OUT PMMFUNCTION_TABLE *FunctionTable)
Definition: functiontable.c:47
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
#define SND_ERR(...)
#define SND_ASSERT(condition)
struct tagMIDIINCAPSW MIDIINCAPSW
struct tagAUXCAPSW AUXCAPSW
UINT MMRESULT
Definition: mmsystem.h:962
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
struct tagMIDIOUTCAPSW MIDIOUTCAPSW
struct tagWAVEINCAPSW WAVEINCAPSW
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct tagMIXERCAPSW MIXERCAPSW
struct tagWAVEOUTCAPSW WAVEOUTCAPSW
#define L(x)
Definition: ntvdm.h:50
@ MIXER_DEVICE_TYPE
Definition: sndtypes.h:33
@ MIDI_OUT_DEVICE_TYPE
Definition: sndtypes.h:31
@ WAVE_IN_DEVICE_TYPE
Definition: sndtypes.h:28
@ AUX_DEVICE_TYPE
Definition: sndtypes.h:32
@ WAVE_OUT_DEVICE_TYPE
Definition: sndtypes.h:29
@ MIDI_IN_DEVICE_TYPE
Definition: sndtypes.h:30
#define IS_VALID_SOUND_DEVICE_TYPE(x)
Definition: sndtypes.h:43
static WLX_DISPATCH_VERSION_1_4 FunctionTable
Definition: wlx.c:722
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by MmeGetSoundDeviceCapabilities().