ReactOS  0.4.14-dev-342-gdc047f9
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 FUNC_NAME(x)   x##ByLegacy
 

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##ByLegacy

Definition at line 22 of file wdmaud.c.

◆ NDEBUG

#define NDEBUG

Definition at line 17 of file wdmaud.c.

Function Documentation

◆ DllMain()

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

Definition at line 207 of file wdmaud.c.

211 {
212  switch ( fdwReason )
213  {
214  case DLL_PROCESS_ATTACH :
215  SND_TRACE(L"WDMAUD.DRV - Process attached\n");
216  break;
217  case DLL_PROCESS_DETACH :
218  SND_TRACE(L"WDMAUD.DRV - Process detached\n");
219  break;
220  case DLL_THREAD_ATTACH :
221  SND_TRACE(L"WDMAUD.DRV - Thread attached\n");
222  break;
223  case DLL_THREAD_DETACH :
224  SND_TRACE(L"WDMAUD.DRV - Thread detached\n");
225  break;
226  }
227 
228  return TRUE;
229 }
#define TRUE
Definition: types.h:120
#define DLL_THREAD_ATTACH
Definition: compat.h:121
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define DLL_THREAD_DETACH
Definition: compat.h:122
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static const WCHAR L[]
Definition: oid.c:1250
#define SND_TRACE(...)

◆ DriverProc()

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

Definition at line 113 of file wdmaud.c.

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

◆ PopulateWdmDeviceList()

MMRESULT PopulateWdmDeviceList ( MMDEVICE_TYPE  DeviceType)

Definition at line 38 of file wdmaud.c.

40 {
42  DWORD DeviceCount = 0;
43  PSOUND_DEVICE SoundDevice = NULL;
44  MMFUNCTION_TABLE FuncTable;
45  DWORD i;
46 
48 
49  Result = FUNC_NAME(WdmAudGetNumWdmDevs)(DeviceType, &DeviceCount);
50 
51  if ( ! MMSUCCESS(Result) )
52  {
53  SND_ERR(L"Error %d while obtaining number of devices\n", Result);
55  }
56 
57  SND_TRACE(L"%d devices of type %d found\n", DeviceCount, DeviceType);
58 
59 
60  for ( i = 0; i < DeviceCount; ++ i )
61  {
62  Result = ListSoundDevice(DeviceType, UlongToPtr(i), &SoundDevice);
63 
64  if ( ! MMSUCCESS(Result) )
65  {
66  SND_ERR(L"Failed to list sound device - error %d\n", Result);
68  }
69 
70  /* Set up our function table */
71  ZeroMemory(&FuncTable, sizeof(MMFUNCTION_TABLE));
72  FuncTable.GetCapabilities = FUNC_NAME(WdmAudGetCapabilities);
74  FuncTable.Open = FUNC_NAME(WdmAudOpenSoundDevice);
75  FuncTable.Close = FUNC_NAME(WdmAudCloseSoundDevice);
76  FuncTable.GetDeviceInterfaceString = FUNC_NAME(WdmAudGetDeviceInterfaceString);
77 
79  {
80  FuncTable.SetWaveFormat = FUNC_NAME(WdmAudSetMixerDeviceFormat);
81  FuncTable.QueryMixerInfo = FUNC_NAME(WdmAudQueryMixerInfo);
82  }
84  {
85  FuncTable.SetWaveFormat = FUNC_NAME(WdmAudSetWaveDeviceFormat);
86  FuncTable.SetState = FUNC_NAME(WdmAudSetWaveState);
88  FuncTable.GetPos = FUNC_NAME(WdmAudGetWavePosition);
89 
90 #ifndef USERMODE_MIXER
91  FuncTable.CommitWaveBuffer = FUNC_NAME(WdmAudCommitWaveBuffer);
92 #else
94 #endif
95  }
97  {
98  FuncTable.SetWaveFormat = FUNC_NAME(WdmAudSetMixerDeviceFormat);
99  FuncTable.SetState = FUNC_NAME(WdmAudSetWaveState);
100  FuncTable.GetPos = FUNC_NAME(WdmAudGetWavePosition);
101  }
102 
103  SetSoundDeviceFunctionTable(SoundDevice, &FuncTable);
104  }
105 
106  return MMSYSERR_NOERROR;
107 }
MMRESULT ListSoundDevice(IN MMDEVICE_TYPE DeviceType, IN PVOID Identifier OPTIONAL, OUT PSOUND_DEVICE *SoundDevice OPTIONAL)
Definition: devicelist.c:131
MMGETPOS_FUNC GetPos
Definition: mmebuddy.h:215
MMRESULT SetSoundDeviceFunctionTable(IN PSOUND_DEVICE SoundDevice, IN PMMFUNCTION_TABLE FunctionTable)
Definition: functiontable.c:21
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
MMRESETSTREAM_FUNC ResetStream
Definition: mmebuddy.h:218
MMRESULT TranslateInternalMmResult(IN MMRESULT Result)
Definition: utility.c:132
#define ZeroMemory
Definition: winbase.h:1642
UINT MMRESULT
Definition: mmsystem.h:962
MMCLOSE_FUNC Close
Definition: mmebuddy.h:206
#define VALIDATE_MMSYS_PARAMETER(parameter_condition)
Definition: mmebuddy.h:71
WAVE_COMMIT_FUNC CommitWaveBuffer
Definition: mmebuddy.h:213
NTSTATUS NTAPI WdmAudResetStream(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PWDMAUD_DEVICE_INFO DeviceInfo)
Definition: control.c:270
MMRESULT QueryWdmWaveDeviceFormatSupport(IN PSOUND_DEVICE Device, IN PWAVEFORMATEX WaveFormat, IN DWORD WaveFormatSize)
Definition: wdmaud.c:28
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
MMWAVEQUERYFORMATSUPPORT_FUNC QueryWaveFormatSupport
Definition: mmebuddy.h:208
ULONG DeviceCount
Definition: mpu401.c:26
MMGETCAPS_FUNC GetCapabilities
Definition: mmebuddy.h:198
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
#define UlongToPtr(u)
Definition: config.h:106
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define SND_ERR(...)
unsigned long DWORD
Definition: ntddk_ex.h:95
MMSETSTATE_FUNC SetState
Definition: mmebuddy.h:216
#define FUNC_NAME(x)
Definition: wdmaud.c:22
static const WCHAR L[]
Definition: oid.c:1250
MMMIXERQUERY_FUNC QueryMixerInfo
Definition: mmebuddy.h:211
MMQUERYDEVICEINTERFACESTRING_FUNC GetDeviceInterfaceString
Definition: mmebuddy.h:217
MMOPEN_FUNC Open
Definition: mmebuddy.h:205
#define IS_VALID_SOUND_DEVICE_TYPE(x)
Definition: sndtypes.h:43
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
MMWAVESETFORMAT_FUNC SetWaveFormat
Definition: mmebuddy.h:209
#define SND_TRACE(...)

Referenced by DriverProc().

◆ QueryWdmWaveDeviceFormatSupport()

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

Definition at line 28 of file wdmaud.c.

32 {
33  /* Whatever... */
34  return MMSYSERR_NOERROR;
35 }
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96

Referenced by PopulateWdmDeviceList().