ReactOS  0.4.14-dev-49-gfb4591c
dsound.c File Reference
#include "precomp.h"
Include dependency graph for dsound.c:

Go to the source code of this file.

Functions

HRESULT WINAPI DllCanUnloadNow ()
 
HRESULT WINAPI GetDeviceID (LPCGUID pGuidSrc, LPGUID pGuidDest)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
BOOL WINAPI DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
 

Variables

HINSTANCE dsound_hInstance
 
LPFILTERINFO RootInfo = NULL
 
static INTERFACE_TABLE InterfaceTable []
 

Function Documentation

◆ DllCanUnloadNow()

HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 46 of file dsound.c.

47 {
48  return S_FALSE;
49 }
#define S_FALSE
Definition: winerror.h:2357

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 124 of file dsound.c.

128 {
129  LPOLESTR pStr, pStr2;
130  UINT i;
132  IClassFactory * pcf = NULL;
133 
134  if (!ppv)
135  return E_INVALIDARG;
136 
137  *ppv = NULL;
138 
139  for (i = 0; InterfaceTable[i].riid; i++)
140  {
141  if (IsEqualIID(InterfaceTable[i].riid, rclsid))
142  {
144  break;
145  }
146  }
147 
148  if (!pcf)
149  {
150  StringFromIID(rclsid, &pStr);
151  StringFromIID(riid, &pStr2);
152  DPRINT("No Class Available for %ws IID %ws\n", pStr, pStr2);
153  CoTaskMemFree(pStr);
154  CoTaskMemFree(pStr2);
155  //ASSERT(0);
157  }
158 
159  hres = IClassFactory_QueryInterface(pcf, riid, ppv);
160  IClassFactory_Release(pcf);
161 
162  return hres;
163 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
static LPOLESTR
Definition: stg_prop.c:27
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
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
const GUID * riid
Definition: precomp.h:26
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
IClassFactory * IClassFactory_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, REFIID riidInst)
Definition: classfactory.c:125
static INTERFACE_TABLE InterfaceTable[]
Definition: dsound.c:15
unsigned int UINT
Definition: ndis.h:50
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ DllMain()

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

Definition at line 169 of file dsound.c.

173 {
174  switch (fdwReason)
175  {
176  case DLL_PROCESS_ATTACH:
177  dsound_hInstance = hInstDLL;
178 #if 1
179  DPRINT("NumDevs %u\n", waveOutGetNumDevs());
181  {
182  DPRINT("EnumAudioDeviceInterfaces failed\n");
183  RootInfo = NULL;
184  }
185 DPRINT1("EnumAudioDeviceInterfaces %p %u\n", RootInfo, waveOutGetNumDevs());
186 #endif
188  break;
189  default:
190  break;
191  }
192 
193  return TRUE;
194 }
HRESULT EnumAudioDeviceInterfaces(LPFILTERINFO *OutRootInfo)
Definition: devicelist.c:384
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2140
LPFILTERINFO RootInfo
Definition: dsound.c:13
#define S_OK
Definition: intsafe.h:59
HINSTANCE dsound_hInstance
Definition: dsound.c:12
#define DPRINT1
Definition: precomp.h:8

◆ GetDeviceID()

HRESULT WINAPI GetDeviceID ( LPCGUID  pGuidSrc,
LPGUID  pGuidDest 
)

Definition at line 53 of file dsound.c.

54 {
58 
59  if (!pGuidSrc || !pGuidDest)
60  {
61  /* invalid param */
62  return DSERR_INVALIDPARAM;
63  }
64 
65  /* sanity check */
66  ASSERT(!IsEqualGUID(pGuidSrc, &GUID_NULL));
67 
68  if (IsEqualGUID(&DSDEVID_DefaultPlayback, pGuidSrc) ||
69  IsEqualGUID(&DSDEVID_DefaultVoicePlayback, pGuidSrc))
70  {
73  {
74  /* hack */
75  DPRINT1("Failed to get DRVM_MAPPER_PREFERRED_GET, using device 0\n");
76  DeviceID = 0;
77  }
78 
80  {
81  /* device not found */
82  return DSERR_INVALIDPARAM;
83  }
84 
85  /* copy device guid */
86  RtlMoveMemory(pGuidDest, &Filter->DeviceGuid[1], sizeof(GUID));
87  return DS_OK;
88  }
89  else if (IsEqualGUID(&DSDEVID_DefaultCapture, pGuidSrc) ||
90  IsEqualGUID(&DSDEVID_DefaultVoiceCapture, pGuidSrc))
91  {
94  {
95  /* hack */
96  DPRINT1("Failed to get DRVM_MAPPER_PREFERRED_GET, for record using device 0\n");
97  DeviceID = 0;
98  }
99 
101  {
102  /* device not found */
103  return DSERR_INVALIDPARAM;
104  }
105 
106  /* copy device guid */
107  RtlMoveMemory(pGuidDest, &Filter->DeviceGuid[0], sizeof(GUID));
108  return DS_OK;
109  }
110 
111  if (!FindDeviceByGuid(pGuidSrc, &Filter))
112  {
113  /* unknown guid */
114  return DSERR_INVALIDPARAM;
115  }
116 
117  /* done */
118  return DS_OK;
119 }
#define TRUE
Definition: types.h:120
BOOL FindDeviceByGuid(LPCGUID pGuidSrc, LPFILTERINFO *Filter)
Definition: devicelist.c:470
#define DRVM_MAPPER_PREFERRED_GET
Definition: mmsys.h:37
UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2541
_In_ USHORT DeviceID
Definition: iotypes.h:860
UINT MMRESULT
Definition: mmsystem.h:962
UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2816
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
_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 DS_OK
Definition: dsound.h:116
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define WAVE_MAPPER
Definition: mmsystem.h:187
#define UlongToHandle(ul)
Definition: basetsd.h:97
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define GUID_NULL
Definition: ks.h:106
uint32_t DWORD_PTR
Definition: typedefs.h:63
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
BOOL FindDeviceByMappedId(IN ULONG DeviceID, LPFILTERINFO *Filter, BOOL bPlayback)
Definition: devicelist.c:442
#define ULONG_MAX
Definition: limits.h:44

Referenced by CDirectSoundCapture_fnInitialize(), DirectSoundCaptureDevice_Initialize(), DirectSoundDevice_Initialize(), DSPROPERTY_DescriptionW(), IDirectSound8_fnInitialize(), and KSPropertySetImpl_Get().

Variable Documentation

◆ dsound_hInstance

HINSTANCE dsound_hInstance

Definition at line 12 of file dsound.c.

Referenced by DllMain(), and LoadResourceString().

◆ InterfaceTable

INTERFACE_TABLE InterfaceTable[]
static
Initial value:
=
{
{
&CLSID_DirectSoundPrivate,
},
{
&CLSID_DirectSoundCapture,
},
{
&CLSID_DirectSoundCapture8,
},
{
&CLSID_DirectSound,
},
{
&CLSID_DirectSound8,
},
{
}
}
smooth NULL
Definition: ftsmooth.c:416
HRESULT CALLBACK NewDirectSound(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: directsound.c:449
HRESULT CALLBACK NewKsPropertySet(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: property.c:244
HRESULT CALLBACK NewDirectSoundCapture(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: capture.c:284

Definition at line 15 of file dsound.c.

Referenced by DllGetClassObject().

◆ RootInfo