ReactOS 0.4.15-dev-7931-gfd331f1
wdmaud.c File Reference
#include "wdmaud.h"
#include <debug.h>
#include <mmebuddy_debug.h>
Include dependency graph for wdmaud.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define USE_MMIXER_LIB
 
#define FUNC_NAME(x)   x##ByMMixer
 

Functions

MMRESULT QueryWdmWaveDeviceFormatSupport (IN PSOUND_DEVICE Device, IN PWAVEFORMATEX WaveFormat, IN DWORD WaveFormatSize)
 
MMRESULT PopulateWdmDeviceList (MMDEVICE_TYPE DeviceType)
 
LONG APIENTRY DriverProc (DWORD DriverId, HANDLE DriverHandle, UINT Message, LONG Parameter1, LONG Parameter2)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 

Macro Definition Documentation

◆ FUNC_NAME

#define FUNC_NAME (   x)    x##ByMMixer

Definition at line 25 of file wdmaud.c.

◆ NDEBUG

#define NDEBUG

Definition at line 17 of file wdmaud.c.

◆ USE_MMIXER_LIB

#define USE_MMIXER_LIB

Definition at line 21 of file wdmaud.c.

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 208 of file wdmaud.c.

212{
213 switch ( fdwReason )
214 {
215 case DLL_PROCESS_ATTACH :
216 SND_TRACE(L"WDMAUD.DRV - Process attached\n");
217 break;
218 case DLL_PROCESS_DETACH :
219 SND_TRACE(L"WDMAUD.DRV - Process detached\n");
220 break;
221 case DLL_THREAD_ATTACH :
222 SND_TRACE(L"WDMAUD.DRV - Thread attached\n");
223 break;
224 case DLL_THREAD_DETACH :
225 SND_TRACE(L"WDMAUD.DRV - Thread detached\n");
226 break;
227 }
228
229 return TRUE;
230}
#define TRUE
Definition: types.h:120
#define DLL_THREAD_DETACH
Definition: compat.h:133
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define DLL_THREAD_ATTACH
Definition: compat.h:132
#define SND_TRACE(...)
#define L(x)
Definition: ntvdm.h:50

◆ DriverProc()

LONG APIENTRY DriverProc ( DWORD  DriverId,
HANDLE  DriverHandle,
UINT  Message,
LONG  Parameter1,
LONG  Parameter2 
)

Definition at line 114 of file wdmaud.c.

120{
121 switch ( Message )
122 {
123 case DRV_LOAD :
124 {
127 SND_TRACE(L"DRV_LOAD\n");
128
130
131 if ( ! MMSUCCESS(Result) )
132 return 0L;
133
134 Result = FUNC_NAME(WdmAudOpenSoundDevice)(NULL, &Handle);
135
136 if ( Result != MMSYSERR_NOERROR )
137 {
138 SND_ERR(L"Failed to open \\\\.\\wdmaud\n");
139 //UnlistAllSoundDevices();
140
141 return 0L;
142 }
143
144 /* Populate the device lists */
145 SND_TRACE(L"Populating device lists\n");
152
153 SND_TRACE(L"Initialisation complete\n");
154
155 return 1L;
156 }
157
158 case DRV_FREE :
159 {
160 SND_TRACE(L"DRV_FREE\n");
161
163
164 /* TODO: Clean up the path names! */
166
168
169 SND_TRACE(L"Unfreed memory blocks: %d\n",
171
172 return 1L;
173 }
174
175 case DRV_ENABLE :
176 case DRV_DISABLE :
177 {
178 SND_TRACE(L"DRV_ENABLE / DRV_DISABLE\n");
179 return 1L;
180 }
181
182 case DRV_OPEN :
183 case DRV_CLOSE :
184 {
185 SND_TRACE(L"DRV_OPEN / DRV_CLOSE\n");
186 return 1L;
187 }
188
189 case DRV_QUERYCONFIGURE :
190 {
191 SND_TRACE(L"DRV_QUERYCONFIGURE\n");
192 return 0L;
193 }
194 case DRV_CONFIGURE :
195 return DRVCNF_OK;
196
197 default :
198 SND_TRACE(L"Unhandled message %d\n", Message);
199 return DefDriverProc(DriverId,
201 Message,
202 Parameter1,
203 Parameter2);
204 }
205}
static NDIS_HANDLE DriverHandle
#define NULL
Definition: types.h:112
LRESULT WINAPI DefDriverProc(DWORD_PTR dwDriverIdentifier, HDRVR hDrv, UINT Msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:554
static const WCHAR Message[]
Definition: register.c:74
NTSTATUS NTAPI WdmAudCleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: entry.c:286
ULONG Handle
Definition: gdb_input.c:15
#define DRV_LOAD(x)
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
#define SND_ERR(...)
#define DRV_CLOSE
Definition: mmsystem.h:122
UINT MMRESULT
Definition: mmsystem.h:962
#define DRV_QUERYCONFIGURE
Definition: mmsystem.h:126
#define DRV_ENABLE
Definition: mmsystem.h:120
#define DRV_CONFIGURE
Definition: mmsystem.h:125
#define DRV_OPEN
Definition: mmsystem.h:121
#define DRVCNF_OK
Definition: mmsystem.h:134
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define DRV_FREE
Definition: mmsystem.h:124
#define DRV_DISABLE
Definition: mmsystem.h:123
VOID CleanupEntrypointMutexes()
Definition: reentrancy.c:56
MMRESULT InitEntrypointMutexes()
Definition: reentrancy.c:21
VOID UnlistAllSoundDevices()
Definition: devicelist.c:270
UINT GetMemoryAllocationCount()
Definition: utility.c:58
@ 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
MMRESULT PopulateWdmDeviceList(MMDEVICE_TYPE DeviceType)
Definition: wdmaud.c:39
#define FUNC_NAME(x)
Definition: wdmaud.c:25
_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

◆ PopulateWdmDeviceList()

MMRESULT PopulateWdmDeviceList ( MMDEVICE_TYPE  DeviceType)

Definition at line 39 of file wdmaud.c.

41{
44 PSOUND_DEVICE SoundDevice = NULL;
45 MMFUNCTION_TABLE FuncTable;
46 DWORD i;
47
49
50 Result = FUNC_NAME(WdmAudGetNumWdmDevs)(DeviceType, &DeviceCount);
51
52 if ( ! MMSUCCESS(Result) )
53 {
54 SND_ERR(L"Error %d while obtaining number of devices\n", Result);
56 }
57
58 SND_TRACE(L"%d devices of type %d found\n", DeviceCount, DeviceType);
59
60
61 for ( i = 0; i < DeviceCount; ++ i )
62 {
63 Result = ListSoundDevice(DeviceType, UlongToPtr(i), &SoundDevice);
64
65 if ( ! MMSUCCESS(Result) )
66 {
67 SND_ERR(L"Failed to list sound device - error %d\n", Result);
69 }
70
71 /* Set up our function table */
72 ZeroMemory(&FuncTable, sizeof(MMFUNCTION_TABLE));
73 FuncTable.GetCapabilities = FUNC_NAME(WdmAudGetCapabilities);
75 FuncTable.Open = FUNC_NAME(WdmAudOpenSoundDevice);
76 FuncTable.Close = FUNC_NAME(WdmAudCloseSoundDevice);
77 FuncTable.GetDeviceInterfaceString = FUNC_NAME(WdmAudGetDeviceInterfaceString);
78
80 {
81 FuncTable.SetWaveFormat = FUNC_NAME(WdmAudSetMixerDeviceFormat);
82 FuncTable.QueryMixerInfo = FUNC_NAME(WdmAudQueryMixerInfo);
83 }
85 {
86 FuncTable.SetWaveFormat = FUNC_NAME(WdmAudSetWaveDeviceFormat);
87 FuncTable.SetState = FUNC_NAME(WdmAudSetWaveState);
89 FuncTable.GetPos = FUNC_NAME(WdmAudGetWavePosition);
90
91#ifndef USERMODE_MIXER
92 FuncTable.CommitWaveBuffer = FUNC_NAME(WdmAudCommitWaveBuffer);
93#else
95#endif
96 }
98 {
99 FuncTable.SetWaveFormat = FUNC_NAME(WdmAudSetMixerDeviceFormat);
100 FuncTable.SetState = FUNC_NAME(WdmAudSetWaveState);
101 FuncTable.GetPos = FUNC_NAME(WdmAudGetWavePosition);
102 }
103
104 SetSoundDeviceFunctionTable(SoundDevice, &FuncTable);
105 }
106
107 return MMSYSERR_NOERROR;
108}
MMRESULT WriteFileEx_Remixer(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID OffsetPtr, IN DWORD Length, IN PSOUND_OVERLAPPED Overlap, IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine)
Definition: mixer.c:423
#define UlongToPtr(u)
Definition: config.h:106
NTSTATUS NTAPI WdmAudResetStream(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo)
Definition: control.c:270
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DeviceType
Definition: mmdrv.h:42
MMRESULT ListSoundDevice(IN MMDEVICE_TYPE DeviceType, IN PVOID Identifier OPTIONAL, OUT PSOUND_DEVICE *SoundDevice OPTIONAL)
Definition: devicelist.c:131
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
MMRESULT SetSoundDeviceFunctionTable(IN PSOUND_DEVICE SoundDevice, IN PMMFUNCTION_TABLE FunctionTable)
Definition: functiontable.c:21
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
ULONG DeviceCount
Definition: mpu401.c:26
#define IS_VALID_SOUND_DEVICE_TYPE(x)
Definition: sndtypes.h:43
MMOPEN_FUNC Open
Definition: mmebuddy.h:205
MMCLOSE_FUNC Close
Definition: mmebuddy.h:206
MMGETPOS_FUNC GetPos
Definition: mmebuddy.h:215
MMRESETSTREAM_FUNC ResetStream
Definition: mmebuddy.h:218
MMGETCAPS_FUNC GetCapabilities
Definition: mmebuddy.h:198
MMWAVEQUERYFORMATSUPPORT_FUNC QueryWaveFormatSupport
Definition: mmebuddy.h:208
WAVE_COMMIT_FUNC CommitWaveBuffer
Definition: mmebuddy.h:213
MMSETSTATE_FUNC SetState
Definition: mmebuddy.h:216
MMWAVESETFORMAT_FUNC SetWaveFormat
Definition: mmebuddy.h:209
MMMIXERQUERY_FUNC QueryMixerInfo
Definition: mmebuddy.h:211
MMQUERYDEVICEINTERFACESTRING_FUNC GetDeviceInterfaceString
Definition: mmebuddy.h:217
MMRESULT QueryWdmWaveDeviceFormatSupport(IN PSOUND_DEVICE Device, IN PWAVEFORMATEX WaveFormat, IN DWORD WaveFormatSize)
Definition: wdmaud.c:29
#define ZeroMemory
Definition: winbase.h:1712

Referenced by DriverProc().

◆ QueryWdmWaveDeviceFormatSupport()

MMRESULT QueryWdmWaveDeviceFormatSupport ( IN PSOUND_DEVICE  Device,
IN PWAVEFORMATEX  WaveFormat,
IN DWORD  WaveFormatSize 
)

Definition at line 29 of file wdmaud.c.

33{
34 /* Whatever... */
35 return MMSYSERR_NOERROR;
36}

Referenced by PopulateWdmDeviceList().