ReactOS  0.4.15-dev-499-g1f31905
mment4.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef BOOLEAN(* SOUND_DEVICE_DETECTED_PROC) (UCHAR DeviceType, PWSTR DevicePath)
 

Functions

MMRESULT EnumerateNt4ServiceSoundDevices (IN LPWSTR ServiceName, IN MMDEVICE_TYPE DeviceType, IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc)
 
MMRESULT DetectNt4SoundDevices (IN MMDEVICE_TYPE DeviceType, IN PWSTR BaseDeviceName, IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc)
 
MMRESULT OpenSoundDriverParametersRegKey (IN LPWSTR ServiceName, OUT PHKEY KeyHandle)
 
MMRESULT OpenSoundDeviceRegKey (IN LPWSTR ServiceName, IN DWORD DeviceIndex, OUT PHKEY KeyHandle)
 
MMRESULT GetNt4SoundDeviceCapabilities (IN PSOUND_DEVICE SoundDevice, OUT PVOID Capabilities, IN DWORD CapabilitiesSize)
 
MMRESULT QueryNt4WaveDeviceFormatSupport (IN PSOUND_DEVICE SoundDevice, IN LPWAVEFORMATEX Format, IN DWORD FormatSize)
 
MMRESULT SetNt4WaveDeviceFormat (IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN DWORD DeviceId, IN LPWAVEFORMATEX Format, IN DWORD FormatSize)
 
MMRESULT OpenNt4SoundDevice (IN PSOUND_DEVICE SoundDevice, OUT PVOID *Handle)
 
MMRESULT CloseNt4SoundDevice (IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID Handle)
 

Typedef Documentation

◆ SOUND_DEVICE_DETECTED_PROC

typedef BOOLEAN(* SOUND_DEVICE_DETECTED_PROC) (UCHAR DeviceType, PWSTR DevicePath)

Definition at line 24 of file mment4.h.

Function Documentation

◆ CloseNt4SoundDevice()

MMRESULT CloseNt4SoundDevice ( IN PSOUND_DEVICE_INSTANCE  SoundDeviceInstance,
IN PVOID  Handle 
)

Definition at line 65 of file control.c.

68 {
69  SND_TRACE(L"Closing NT4 style sound device\n");
70 
73 }
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
BOOLEAN IsValidSoundDeviceInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
_In_ HANDLE Handle
Definition: extypes.h:390
static const WCHAR L[]
Definition: oid.c:1250
MMRESULT CloseKernelSoundDevice(IN HANDLE Handle)
Definition: kernel.c:58
#define SND_TRACE(...)

Referenced by FoundDevice().

◆ DetectNt4SoundDevices()

MMRESULT DetectNt4SoundDevices ( IN MMDEVICE_TYPE  DeviceType,
IN PWSTR  BaseDeviceName,
IN SOUND_DEVICE_DETECTED_PROC  SoundDeviceDetectedProc 
)

Definition at line 151 of file detect.c.

155 {
156  SIZE_T DeviceNameLength = 0;
158  ULONG Index = 0;
160  BOOLEAN DoSearch = TRUE;
161 
163 
164  DeviceNameLength = wcslen(BaseDeviceName);
165  /* Consider the length of the number */
166  DeviceNameLength += GetDigitCount(Index);
167 
168  DeviceName = AllocateWideString(DeviceNameLength);
169 
170  if ( ! DeviceName )
171  {
172  return MMSYSERR_NOMEM;
173  }
174 
175  while ( DoSearch )
176  {
177  /* Nothing like a nice clean device name */
179  wsprintf(DeviceName, L"%ls%d", BaseDeviceName, Index);
180 
182  TRUE,
184  {
185  /* Notify the callback function */
186  SND_TRACE(L"Found device: %wS\n", DeviceName);
187  SoundDeviceDetectedProc(DeviceType, DeviceName);
188 
190 
191  ++ Index;
192  }
193  else
194  {
195  DoSearch = FALSE;
196  }
197  }
198 
200 
201  return MMSYSERR_NOERROR;
202 }
static VOID FreeMemory(PCREATE_DATA Data)
Definition: create.c:134
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:407
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
UINT GetDigitCount(IN UINT Number)
Definition: utility.c:68
uint16_t * PWSTR
Definition: typedefs.h:55
DeviceType
Definition: mmdrv.h:41
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
#define ZeroWideString(string)
Definition: mmebuddy.h:36
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
MMRESULT OpenKernelSoundDeviceByName(IN PWSTR DevicePath, IN BOOLEAN ReadOnly, OUT PHANDLE Handle)
Definition: kernel.c:23
#define IsValidSoundDeviceType
Definition: mmebuddy.h:69
#define AllocateWideString(string_length)
Definition: mmebuddy.h:33
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
static const UCHAR Index[8]
Definition: usbohci.c:18
static const WCHAR L[]
Definition: oid.c:1250
ULONG_PTR SIZE_T
Definition: typedefs.h:79
unsigned int ULONG
Definition: retypes.h:1
#define wsprintf
Definition: winuser.h:5840
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SND_TRACE(...)

◆ EnumerateNt4ServiceSoundDevices()

MMRESULT EnumerateNt4ServiceSoundDevices ( IN LPWSTR  ServiceName,
IN MMDEVICE_TYPE  DeviceType,
IN SOUND_DEVICE_DETECTED_PROC  SoundDeviceDetectedProc 
)

Definition at line 26 of file detect.c.

30 {
31  HKEY Key;
32  DWORD KeyIndex = 0;
33 
35 
36  /* Device type zero means "all" */
38  DeviceType == 0 );
39 
40  while ( OpenSoundDeviceRegKey(ServiceName, KeyIndex, &Key) == MMSYSERR_NOERROR )
41  {
42  HKEY DevicesKey;
43  DWORD ValueType = REG_NONE, ValueIndex = 0;
44  DWORD MaxNameLength = 0, ValueNameLength = 0;
45  PWSTR DevicePath = NULL, ValueName = NULL;
46  DWORD ValueDataLength = sizeof(DWORD);
48 
49  if ( RegOpenKeyEx(Key,
51  0,
52  KEY_READ,
53  &DevicesKey) == ERROR_SUCCESS )
54  {
55  /* Find out how much memory is needed for the key name */
56  if ( RegQueryInfoKey(DevicesKey,
57  NULL, NULL, NULL, NULL, NULL, NULL, NULL,
58  &MaxNameLength,
59  NULL, NULL, NULL) != ERROR_SUCCESS )
60  {
61  SND_ERR(L"Failed to query registry key information\n");
62  RegCloseKey(DevicesKey);
64 
65  return MMSYSERR_ERROR;
66  }
67 
68  DevicePath = AllocateWideString(MaxNameLength +
69  strlen("\\\\.\\"));
70 
71  /* Check that the memory allocation was successful */
72  if ( ! DevicePath )
73  {
74  /* There's no point in going further */
75  RegCloseKey(DevicesKey);
77 
78  return MMSYSERR_NOMEM;
79  }
80 
81  /* Insert the device path prefix */
82  wsprintf(DevicePath, L"\\\\.\\");
83 
84  /* The offset of the string following this prefix */
85  ValueName = DevicePath + strlen("\\\\.\\");
86 
87  /* Copy this so that it may be overwritten - include NULL */
88  ValueNameLength = MaxNameLength + sizeof(WCHAR);
89 
90  SND_TRACE(L"Interested in devices beginning with %wS\n", DevicePath);
91 
92  while ( RegEnumValue(DevicesKey,
93  ValueIndex,
94  ValueName,
95  &ValueNameLength,
96  NULL,
97  &ValueType,
98  (LPBYTE) &ValueData,
99  &ValueDataLength) == ERROR_SUCCESS )
100  {
101  /* Device types are stored as DWORDs */
102  if ( ( ValueType == REG_DWORD ) &&
103  ( ValueDataLength == sizeof(DWORD) ) )
104  {
105  if ( ( DeviceType == 0 ) ||
106  ( DeviceType == ValueData ) )
107  {
108  SND_TRACE(L"Found device: %wS\n", DevicePath);
109  SoundDeviceDetectedProc(ValueData, DevicePath);
110  }
111  }
112 
113  /* Reset variables for the next iteration */
114  ValueNameLength = MaxNameLength + sizeof(WCHAR);
115  ZeroMemory(ValueName, (MaxNameLength+1)*sizeof(WCHAR));
116  /*ZeroWideString(ValueName);*/
117  ValueDataLength = sizeof(DWORD);
118  ValueData = 0;
120 
121  ++ ValueIndex;
122  }
123 
124  FreeMemory(DevicePath);
125 
126  RegCloseKey(DevicesKey);
127  }
128  else
129  {
130  SND_WARN(L"Unable to open the Devices key!\n");
131  }
132 
133  ++ KeyIndex;
134 
135  RegCloseKey(Key);
136  }
137 
138  return MMSYSERR_NOERROR;
139 }
static VOID FreeMemory(PCREATE_DATA Data)
Definition: create.c:134
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG Key
Definition: fatprocs.h:2706
#define RegQueryInfoKey
Definition: winreg.h:521
#define ERROR_SUCCESS
Definition: deptool.c:10
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWSTR
Definition: typedefs.h:55
DeviceType
Definition: mmdrv.h:41
_In_ PCWSTR _In_z_ PCWSTR _In_ ULONG ValueType
Definition: rtlfuncs.h:4062
#define ZeroMemory
Definition: winbase.h:1648
#define DWORD
Definition: nt_native.h:44
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define IsValidSoundDeviceType
Definition: mmebuddy.h:69
#define AllocateWideString(string_length)
Definition: mmebuddy.h:33
smooth NULL
Definition: ftsmooth.c:416
MMRESULT OpenSoundDeviceRegKey(IN LPWSTR ServiceName, IN DWORD DeviceIndex, OUT PHKEY KeyHandle)
Definition: registry.c:73
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
LPTSTR ServiceName
Definition: ServiceMain.c:15
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SND_ERR(...)
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:311
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define SND_WARN(...)
#define REG_DEVICES_KEY_NAME_U
Definition: sndnames.h:78
#define RegOpenKeyEx
Definition: winreg.h:520
#define REG_NONE
Definition: nt_native.h:1492
#define wsprintf
Definition: winuser.h:5840
#define REG_DWORD
Definition: sdbapi.c:596
#define RegEnumValue
Definition: winreg.h:511
#define SND_TRACE(...)

Referenced by DriverProc().

◆ GetNt4SoundDeviceCapabilities()

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

Definition at line 80 of file control.c.

84 {
87  DWORD IoCtl;
89 
90  /* If these are bad there's an internal error with MME-Buddy! */
91  SND_ASSERT( SoundDevice );
93  SND_ASSERT( CapabilitiesSize > 0 );
94 
95  SND_TRACE(L"NT4 get-capabilities routine called\n");
96 
97  /* Get the device type */
98  Result = GetSoundDeviceType(SoundDevice, &DeviceType);
100 
101  if ( ! MMSUCCESS(Result) )
103 
104  /* Choose the appropriate IOCTL */
106  {
108  }
109  else if ( IS_MIDI_DEVICE_TYPE(DeviceType) )
110  {
112  }
113  else
114  {
115  /* FIXME - need to support AUX and mixer devices */
116  SND_ASSERT( FALSE );
117  IoCtl = 0;
118  }
119 
120  /* Get the capabilities information from the driver */
122 
123  if ( ! MMSUCCESS(Result) )
124  {
125  SND_ERR(L"Failed to open device");
127  }
128 
130  IoCtl,
131  Capabilities,
132  CapabilitiesSize,
133  NULL,
134  0,
135  NULL);
136 
138 
139  if ( ! MMSUCCESS(Result) )
140  {
141  SND_ERR(L"Retrieval of capabilities information failed\n");
143  }
144 
145  return Result;
146 }
#define TRUE
Definition: types.h:120
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
UINT MMRESULT
Definition: mmsystem.h:962
#define IS_MIDI_DEVICE_TYPE(x)
Definition: sndtypes.h:49
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
MMRESULT OpenNt4KernelSoundDevice(IN PSOUND_DEVICE SoundDevice, IN BOOLEAN ReadOnly, OUT PHANDLE Handle)
Definition: control.c:22
#define IOCTL_MIDI_GET_CAPABILITIES
Definition: mmdef.h:69
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
smooth NULL
Definition: ftsmooth.c:416
#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 IS_WAVE_DEVICE_TYPE(x)
Definition: sndtypes.h:46
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define SND_ERR(...)
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
DWORD SyncOverlappedDeviceIoControl(IN HANDLE Handle, IN DWORD IoControlCode, IN LPVOID InBuffer, IN DWORD InBufferSize, OUT LPVOID OutBuffer, IN DWORD OutBufferSize, OUT LPDWORD BytesTransferred OPTIONAL)
Definition: misc.c:298
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
MMRESULT CloseKernelSoundDevice(IN HANDLE Handle)
Definition: kernel.c:58
#define IOCTL_WAVE_GET_CAPABILITIES
Definition: mmdef.h:52
#define SND_TRACE(...)

Referenced by GetSoundBlasterDeviceCapabilities().

◆ OpenNt4SoundDevice()

MMRESULT OpenNt4SoundDevice ( IN PSOUND_DEVICE  SoundDevice,
OUT PVOID Handle 
)

Definition at line 52 of file control.c.

55 {
56  SND_TRACE(L"Opening NT4 style sound device\n");
57 
60 
61  return OpenNt4KernelSoundDevice(SoundDevice, FALSE, Handle);
62 }
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
MMRESULT OpenNt4KernelSoundDevice(IN PSOUND_DEVICE SoundDevice, IN BOOLEAN ReadOnly, OUT PHANDLE Handle)
Definition: control.c:22
_In_ HANDLE Handle
Definition: extypes.h:390
static const WCHAR L[]
Definition: oid.c:1250
BOOLEAN IsValidSoundDevice(IN PSOUND_DEVICE SoundDevice)
Definition: devicelist.c:87
#define SND_TRACE(...)

Referenced by FoundDevice().

◆ OpenSoundDeviceRegKey()

MMRESULT OpenSoundDeviceRegKey ( IN LPWSTR  ServiceName,
IN DWORD  DeviceIndex,
OUT PHKEY  KeyHandle 
)

Definition at line 73 of file registry.c.

77 {
79  PWCHAR RegPath;
80 
83 
84  /*
85  Work out the space required to hold the path:
86 
87  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
88  sndblst\
89  Parameters\
90  Device123\
91  */
93  + wcslen(ServiceName) + 1
96  + GetDigitCount(DeviceIndex);
97 
98  /* Allocate storage for the string */
99  RegPath = AllocateWideString(PathLength);
100 
101  if ( ! RegPath )
102  {
103  return MMSYSERR_NOMEM;
104  }
105 
106  /* Write the path */
107  wsprintf(RegPath,
108  L"%ls\\%ls\\%ls\\%ls%d",
110  ServiceName,
113  DeviceIndex);
114 
115  SND_TRACE(L"Opening reg key: %wS\n", RegPath);
116 
117  /* Perform the open */
119  RegPath,
120  0,
121  KEY_READ,
123  {
124  /* Couldn't open the key */
125  SND_ERR(L"Failed to open reg key: %wS\n", RegPath);
126  FreeMemory(RegPath);
127  return MMSYSERR_ERROR;
128  }
129 
130  FreeMemory(RegPath);
131 
132  return MMSYSERR_NOERROR;
133 }
static VOID FreeMemory(PCREATE_DATA Data)
Definition: create.c:134
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_PARAMETERS_KEY_NAME_U
Definition: sndnames.h:76
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
UINT GetDigitCount(IN UINT Number)
Definition: utility.c:68
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWCHAR
Definition: typedefs.h:55
static USHORT PathLength
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
#define AllocateWideString(string_length)
Definition: mmebuddy.h:33
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
LPTSTR ServiceName
Definition: ServiceMain.c:15
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
#define SND_ERR(...)
static const WCHAR L[]
Definition: oid.c:1250
#define REG_SERVICES_KEY_NAME_U
Definition: sndnames.h:75
ULONG_PTR SIZE_T
Definition: typedefs.h:79
#define RegOpenKeyEx
Definition: winreg.h:520
#define wsprintf
Definition: winuser.h:5840
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_DEVICE_KEY_NAME_U
Definition: sndnames.h:77
#define SND_TRACE(...)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by EnumerateNt4ServiceSoundDevices().

◆ OpenSoundDriverParametersRegKey()

MMRESULT OpenSoundDriverParametersRegKey ( IN LPWSTR  ServiceName,
OUT PHKEY  KeyHandle 
)

Definition at line 20 of file registry.c.

23 {
24  SIZE_T KeyLength;
25  PWCHAR ParametersKeyName;
26 
29 
30  /* Work out how long the string will be */
31  KeyLength = wcslen(REG_SERVICES_KEY_NAME_U) + 1
32  + wcslen(ServiceName) + 1
34 
35  /* Allocate memory for the string */
36  ParametersKeyName = AllocateWideString(KeyLength);
37 
38  if ( ! ParametersKeyName )
39  return MMSYSERR_NOMEM;
40 
41  /* Construct the registry path */
42  wsprintf(ParametersKeyName,
43  L"%s\\%s\\%s",
47 
48  SND_TRACE(L"Opening reg key: %wS\n", ParametersKeyName);
49 
50  /* Perform the open */
52  ParametersKeyName,
53  0,
54  KEY_READ,
56  {
57  /* Couldn't open the key */
58  SND_ERR(L"Failed to open reg key: %wS\n", ParametersKeyName);
59  FreeMemory(ParametersKeyName);
60  return MMSYSERR_ERROR;
61  }
62 
63  FreeMemory(ParametersKeyName);
64 
65  return MMSYSERR_NOERROR;
66 }
static VOID FreeMemory(PCREATE_DATA Data)
Definition: create.c:134
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_PARAMETERS_KEY_NAME_U
Definition: sndnames.h:76
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWCHAR
Definition: typedefs.h:55
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
#define AllocateWideString(string_length)
Definition: mmebuddy.h:33
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
LPTSTR ServiceName
Definition: ServiceMain.c:15
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
#define SND_ERR(...)
static const WCHAR L[]
Definition: oid.c:1250
#define REG_SERVICES_KEY_NAME_U
Definition: sndnames.h:75
ULONG_PTR SIZE_T
Definition: typedefs.h:79
#define RegOpenKeyEx
Definition: winreg.h:520
#define wsprintf
Definition: winuser.h:5840
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SND_TRACE(...)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

◆ QueryNt4WaveDeviceFormatSupport()

MMRESULT QueryNt4WaveDeviceFormatSupport ( IN PSOUND_DEVICE  SoundDevice,
IN LPWAVEFORMATEX  Format,
IN DWORD  FormatSize 
)

Definition at line 154 of file control.c.

158 {
160  HANDLE Handle;
161 
162  SND_TRACE(L"NT4 wave format support querying routine called\n");
163 
166  VALIDATE_MMSYS_PARAMETER( FormatSize >= sizeof(WAVEFORMATEX) );
167 
168  /* Get the device path */
169  Result = OpenNt4KernelSoundDevice(SoundDevice,
170  FALSE,
171  &Handle);
172 
173  if ( ! MMSUCCESS(Result) )
174  {
175  SND_ERR(L"Unable to open kernel sound device\n");
177  }
178 
181  (LPVOID) Format,
182  FormatSize,
183  NULL,
184  0,
185  NULL);
186 
187  if ( ! MMSUCCESS(Result) )
188  {
189  SND_ERR(L"Sync overlapped I/O failed - MMSYS_ERROR %d\n", Result);
191  }
192 
194 
195  return MMSYSERR_NOERROR;
196 }
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
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
MMRESULT OpenNt4KernelSoundDevice(IN PSOUND_DEVICE SoundDevice, IN BOOLEAN ReadOnly, OUT PHANDLE Handle)
Definition: control.c:22
smooth NULL
Definition: ftsmooth.c:416
_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
_In_ HANDLE Handle
Definition: extypes.h:390
#define IOCTL_WAVE_QUERY_FORMAT
Definition: mmdef.h:50
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define SND_ERR(...)
static const WCHAR L[]
Definition: oid.c:1250
DWORD SyncOverlappedDeviceIoControl(IN HANDLE Handle, IN DWORD IoControlCode, IN LPVOID InBuffer, IN DWORD InBufferSize, OUT LPVOID OutBuffer, IN DWORD OutBufferSize, OUT LPDWORD BytesTransferred OPTIONAL)
Definition: misc.c:298
BOOLEAN IsValidSoundDevice(IN PSOUND_DEVICE SoundDevice)
Definition: devicelist.c:87
MMRESULT CloseKernelSoundDevice(IN HANDLE Handle)
Definition: kernel.c:58
#define SND_TRACE(...)

Referenced by FoundDevice().

◆ SetNt4WaveDeviceFormat()

MMRESULT SetNt4WaveDeviceFormat ( IN PSOUND_DEVICE_INSTANCE  SoundDeviceInstance,
IN DWORD  DeviceId,
IN LPWAVEFORMATEX  Format,
IN DWORD  FormatSize 
)

Definition at line 199 of file control.c.

204 {
206  HANDLE Handle;
207 
210  VALIDATE_MMSYS_PARAMETER( FormatSize >= sizeof(WAVEFORMATEX) );
211 
212  Result = GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle);
213 
214  if ( ! MMSUCCESS(Result) )
216 
217  SND_TRACE(L"Setting wave device format on handle %x\n", Handle);
218 
221  (LPVOID) Format,
222  FormatSize,
223  NULL,
224  0,
225  NULL);
226 
227  if ( ! MMSUCCESS(Result) )
229 
230  return MMSYSERR_NOERROR;
231 }
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
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
smooth NULL
Definition: ftsmooth.c:416
_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
BOOLEAN IsValidSoundDeviceInstance(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
_In_ HANDLE Handle
Definition: extypes.h:390
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define IOCTL_WAVE_SET_FORMAT
Definition: mmdef.h:51
static const WCHAR L[]
Definition: oid.c:1250
DWORD SyncOverlappedDeviceIoControl(IN HANDLE Handle, IN DWORD IoControlCode, IN LPVOID InBuffer, IN DWORD InBufferSize, OUT LPVOID OutBuffer, IN DWORD OutBufferSize, OUT LPDWORD BytesTransferred OPTIONAL)
Definition: misc.c:298
MMRESULT GetSoundDeviceInstanceHandle(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, OUT PVOID *Handle)
#define SND_TRACE(...)

Referenced by FoundDevice().