ReactOS 0.4.16-dev-92-g0c2cdca
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}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
IClassFactory * IClassFactory_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, REFIID riidInst)
Definition: classfactory.c:125
#define NULL
Definition: types.h:112
static INTERFACE_TABLE InterfaceTable[]
Definition: dsound.c:15
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
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
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT hres
Definition: protocol.c:465
static LPOLESTR
Definition: stg_prop.c:27
unsigned int UINT
Definition: ndis.h:50
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define DPRINT
Definition: sndvol32.h:73
const GUID * riid
Definition: precomp.h:26
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

◆ DllMain()

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

Definition at line 169 of file dsound.c.

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

◆ 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 UlongToHandle(ul)
Definition: basetsd.h:97
#define FALSE
Definition: types.h:117
BOOL FindDeviceByMappedId(IN ULONG DeviceID, LPFILTERINFO *Filter, BOOL bPlayback)
Definition: devicelist.c:442
BOOL FindDeviceByGuid(LPCGUID pGuidSrc, LPFILTERINFO *Filter)
Definition: devicelist.c:470
#define DS_OK
Definition: dsound.h:116
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
#define ULONG_MAX
Definition: limits.h:44
#define GUID_NULL
Definition: ks.h:106
#define DRVM_MAPPER_PREFERRED_GET
Definition: mmsys.h:39
UINT MMRESULT
Definition: mmsystem.h:962
#define WAVE_MAPPER
Definition: mmsystem.h:187
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define ASSERT(a)
Definition: mode.c:44
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceID
Definition: wdfpdo.h:278
UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2813
UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2538
_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
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

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,
},
{
}
}
HRESULT CALLBACK NewDirectSound(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: directsound.c:449
HRESULT CALLBACK NewDirectSoundCapture(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: capture.c:284
HRESULT CALLBACK NewKsPropertySet(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
Definition: property.c:244

Definition at line 15 of file dsound.c.

Referenced by DllGetClassObject().

◆ RootInfo