ReactOS  0.4.15-dev-506-ga3ec01c
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  }
63  case WAVE_IN_DEVICE_TYPE :
64  {
65  GoodSize = CapabilitiesSize >= sizeof(WAVEINCAPSW);
66  break;
67  }
69  {
70  GoodSize = CapabilitiesSize >= sizeof(MIDIOUTCAPSW);
71  break;
72  }
73  case MIDI_IN_DEVICE_TYPE :
74  {
75  GoodSize = CapabilitiesSize >= sizeof(MIDIINCAPSW);
76  break;
77  }
78  case AUX_DEVICE_TYPE :
79  {
80  GoodSize = CapabilitiesSize >= sizeof(AUXCAPSW);
81  break;
82  }
83  case MIXER_DEVICE_TYPE :
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");
93  return MMSYSERR_INVALPARAM;
94  }
95 
96  /* Call the "get capabilities" function within the function table */
97  SND_ASSERT( FunctionTable->GetCapabilities );
98 
99  if ( ! FunctionTable->GetCapabilities )
100  return MMSYSERR_NOTSUPPORTED;
101 
102  return FunctionTable->GetCapabilities(SoundDevice,
103  DeviceId,
104  Capabilities,
105  CapabilitiesSize);
106 }
struct tagMIXERCAPSW MIXERCAPSW
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
struct tagMIDIINCAPSW MIDIINCAPSW
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
UINT MMRESULT
Definition: mmsystem.h:962
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
MMRESULT GetSoundDeviceFunctionTable(IN PSOUND_DEVICE SoundDevice, OUT PMMFUNCTION_TABLE *FunctionTable)
Definition: functiontable.c:47
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
struct tagWAVEINCAPSW WAVEINCAPSW
unsigned char BOOLEAN
#define SND_ASSERT(condition)
_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:426
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct tagAUXCAPSW AUXCAPSW
#define SND_ERR(...)
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
struct tagMIDIOUTCAPSW MIDIOUTCAPSW
static const WCHAR L[]
Definition: oid.c:1250
BOOLEAN IsValidSoundDevice(IN PSOUND_DEVICE SoundDevice)
Definition: devicelist.c:87
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define IS_VALID_SOUND_DEVICE_TYPE(x)
Definition: sndtypes.h:43
static WLX_DISPATCH_VERSION_1_4 FunctionTable
Definition: wlx.c:736
struct tagWAVEOUTCAPSW WAVEOUTCAPSW

Referenced by MmeGetSoundDeviceCapabilities().