Commit f5080c86 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Added class factories for DirectSoundCapture, DirectSoundFullDuplex

and DirectSoundPrivate. Added error checking to QueryInterface and CreateInterface. Added some more functionality to property sets.
parent d7fca891
......@@ -58,6 +58,11 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_QueryInterface(
ICOM_THIS(IDirectSoundNotifyImpl,iface);
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL; /* assume error */
if ( IsEqualGUID(riid, &IID_IUnknown) ||
......@@ -905,6 +910,11 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL; /* assume failure */
if ( IsEqualGUID(riid, &IID_IUnknown) ||
......
......@@ -353,6 +353,13 @@ IDirectSoundCaptureImpl_QueryInterface(
ICOM_THIS(IDirectSoundCaptureImpl,iface);
TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL;
if (This->driver) {
HRESULT hres;
hres = IDsCaptureDriver_QueryInterface(This->driver, riid, ppobj);
......@@ -767,6 +774,13 @@ IDirectSoundCaptureBufferImpl_QueryInterface(
ICOM_THIS(IDirectSoundCaptureBufferImpl,iface);
TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL;
if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ||
IsEqualGUID( &IID_IDirectSoundNotify8, riid ) ) {
if (!This->notify) {
......@@ -1422,6 +1436,79 @@ static ICOM_VTABLE(IDirectSoundCaptureBuffer8) dscbvt =
IDirectSoundCaptureBufferImpl_GetFXStatus
};
/*******************************************************************************
* DirectSoundCapture ClassFactory
*/
static HRESULT WINAPI
DSCCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl,iface);
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI
DSCCF_AddRef(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p) ref was %ld\n", This, This->ref);
return ++(This->ref);
}
static ULONG WINAPI
DSCCF_Release(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl,iface);
/* static class, won't be freed */
TRACE("(%p) ref was %ld\n", This, This->ref);
return --(This->ref);
}
static HRESULT WINAPI
DSCCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj )
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL;
if ( IsEqualGUID( &IID_IDirectSoundCapture, riid ) ||
IsEqualGUID( &IID_IDirectSoundCapture8, riid ) ) {
return DirectSoundCaptureCreate8(0,(LPDIRECTSOUNDCAPTURE8*)ppobj,pOuter);
}
WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static HRESULT WINAPI
DSCCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
{
ICOM_THIS(IClassFactoryImpl,iface);
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
static ICOM_VTABLE(IClassFactory) DSCCF_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
DSCCF_QueryInterface,
DSCCF_AddRef,
DSCCF_Release,
DSCCF_CreateInstance,
DSCCF_LockServer
};
IClassFactoryImpl DSOUND_CAPTURE_CF = { &DSCCF_Vtbl, 1 };
/***************************************************************************
* DirectSoundFullDuplexCreate8 [DSOUND.10]
*
......@@ -1503,7 +1590,13 @@ IDirectSoundFullDuplexImpl_QueryInterface(
ICOM_THIS(IDirectSoundFullDuplexImpl,iface);
TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
return E_FAIL;
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI
......@@ -1578,3 +1671,78 @@ static ICOM_VTABLE(IDirectSoundFullDuplex) dsfdvt =
/* IDirectSoundFullDuplex methods */
IDirectSoundFullDuplexImpl_Initialize
};
/*******************************************************************************
* DirectSoundFullDuplex ClassFactory
*/
static HRESULT WINAPI
DSFDCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl,iface);
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI
DSFDCF_AddRef(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p) ref was %ld\n", This, This->ref);
return ++(This->ref);
}
static ULONG WINAPI
DSFDCF_Release(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl,iface);
/* static class, won't be freed */
TRACE("(%p) ref was %ld\n", This, This->ref);
return --(This->ref);
}
static HRESULT WINAPI
DSFDCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj )
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL;
if ( IsEqualGUID( &IID_IDirectSoundFullDuplex, riid ) ) {
/* FIXME: how do we do this one ? */
FIXME("not implemented\n");
return E_NOINTERFACE;
}
WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static HRESULT WINAPI
DSFDCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
{
ICOM_THIS(IClassFactoryImpl,iface);
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
static ICOM_VTABLE(IClassFactory) DSFDCF_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
DSFDCF_QueryInterface,
DSFDCF_AddRef,
DSFDCF_Release,
DSFDCF_CreateInstance,
DSFDCF_LockServer
};
IClassFactoryImpl DSOUND_FULLDUPLEX_CF = { &DSFDCF_Vtbl, 1 };
......@@ -68,6 +68,7 @@
#include "dsound.h"
#include "dsdriver.h"
#include "dsound_private.h"
#include "dsconf.h"
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
......@@ -757,6 +758,11 @@ static HRESULT WINAPI IDirectSoundImpl_QueryInterface(
ICOM_THIS(IDirectSoundImpl,iface);
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL; /* assume failure */
if ( IsEqualGUID(riid, &IID_IUnknown) ||
......@@ -1124,12 +1130,6 @@ HRESULT WINAPI DirectSoundCreate8(LPCGUID lpcGUID,LPDIRECTSOUND8 *ppDS,IUnknown
/*******************************************************************************
* DirectSound ClassFactory
*/
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IClassFactory);
DWORD ref;
} IClassFactoryImpl;
static HRESULT WINAPI
DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
......@@ -1157,22 +1157,22 @@ static HRESULT WINAPI DSCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
) {
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if (ppobj == NULL) {
WARN("invalid parameter\n");
return DSERR_INVALIDPARAM;
}
*ppobj = NULL;
if ( IsEqualGUID( &IID_IDirectSound, riid ) ||
IsEqualGUID( &IID_IDirectSound8, riid ) ) {
/* FIXME: reuse already created dsound if present? */
return DirectSoundCreate8(0,(LPDIRECTSOUND8*)ppobj,pOuter);
}
if ( IsEqualGUID( &IID_IDirectSoundCapture, riid ) ||
IsEqualGUID( &IID_IDirectSoundCapture8, riid ) ) {
return DirectSoundCaptureCreate8(0,(LPDIRECTSOUNDCAPTURE8*)ppobj,pOuter);
}
if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) {
return IKsPropertySetImpl_Create(0,(IKsPropertySetImpl**)ppobj);
}
FIXME("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
......@@ -1190,7 +1190,75 @@ static ICOM_VTABLE(IClassFactory) DSCF_Vtbl = {
DSCF_CreateInstance,
DSCF_LockServer
};
static IClassFactoryImpl DSOUND_CF = {&DSCF_Vtbl, 1 };
static IClassFactoryImpl DSOUND_CF = { &DSCF_Vtbl, 1 };
/*******************************************************************************
* DirectSoundPrivate ClassFactory
*/
static HRESULT WINAPI
DSPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
ICOM_THIS(IClassFactoryImpl,iface);
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI
DSPCF_AddRef(LPCLASSFACTORY iface) {
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p) ref was %ld\n", This, This->ref);
return ++(This->ref);
}
static ULONG WINAPI
DSPCF_Release(LPCLASSFACTORY iface) {
ICOM_THIS(IClassFactoryImpl,iface);
/* static class, won't be freed */
TRACE("(%p) ref was %ld\n", This, This->ref);
return --(This->ref);
}
static HRESULT WINAPI
DSPCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
) {
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if (ppobj == NULL) {
WARN("invalid parameter\n");
return DSERR_INVALIDPARAM;
}
*ppobj = NULL;
if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) {
return IKsPropertySetImpl_Create(0,(IKsPropertySetImpl**)ppobj);
}
WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static HRESULT WINAPI
DSPCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
ICOM_THIS(IClassFactoryImpl,iface);
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
static ICOM_VTABLE(IClassFactory) DSPCF_Vtbl = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
DSPCF_QueryInterface,
DSPCF_AddRef,
DSPCF_Release,
DSPCF_CreateInstance,
DSPCF_LockServer
};
static IClassFactoryImpl DSOUND_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
/*******************************************************************************
* DllGetClassObject [DSOUND.5]
......@@ -1212,13 +1280,61 @@ static IClassFactoryImpl DSOUND_CF = {&DSCF_Vtbl, 1 };
DWORD WINAPI DSOUND_DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv)
{
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
*ppv = (LPVOID)&DSOUND_CF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
if (ppv == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppv = NULL;
if ( IsEqualCLSID( &CLSID_DirectSound, rclsid ) ||
IsEqualCLSID( &CLSID_DirectSound8, rclsid ) ) {
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
*ppv = (LPVOID)&DSOUND_CF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
}
WARN("(%s,%s,%p): no interface found.\n",
debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return S_FALSE;
}
if ( IsEqualCLSID( &CLSID_DirectSoundCapture, rclsid ) ||
IsEqualCLSID( &CLSID_DirectSoundCapture8, rclsid ) ) {
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
*ppv = (LPVOID)&DSOUND_CAPTURE_CF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
}
WARN("(%s,%s,%p): no interface found.\n",
debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return S_FALSE;
}
if ( IsEqualCLSID( &CLSID_DirectSoundFullDuplex, rclsid ) ) {
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
*ppv = (LPVOID)&DSOUND_FULLDUPLEX_CF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
}
WARN("(%s,%s,%p): no interface found.\n",
debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return S_FALSE;
}
if ( IsEqualCLSID( &CLSID_DirectSoundPrivate, rclsid ) ) {
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
*ppv = (LPVOID)&DSOUND_PRIVATE_CF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
}
WARN("(%s,%s,%p): no interface found.\n",
debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return S_FALSE;
}
FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
WARN("(%s,%s,%p): no class found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return CLASS_E_CLASSNOTAVAILABLE;
}
......
......@@ -54,6 +54,7 @@ typedef struct IDirectSound3DListenerImpl IDirectSound3DListenerImpl;
typedef struct IDirectSound3DBufferImpl IDirectSound3DBufferImpl;
typedef struct IKsPropertySetImpl IKsPropertySetImpl;
typedef struct PrimaryBufferImpl PrimaryBufferImpl;
typedef struct IClassFactoryImpl IClassFactoryImpl;
/*****************************************************************************
* IDirectSound implementation structure
......@@ -287,6 +288,19 @@ HRESULT WINAPI IDirectSound3DBufferImpl_Create(
IDirectSoundBufferImpl *This,
IDirectSound3DBufferImpl **pds3db);
/*******************************************************************************
* DirectSound ClassFactory implementation structure
*/
struct IClassFactoryImpl
{
/* IUnknown fields */
ICOM_VFIELD(IClassFactory);
DWORD ref;
};
extern IClassFactoryImpl DSOUND_CAPTURE_CF;
extern IClassFactoryImpl DSOUND_FULLDUPLEX_CF;
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan);
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb);
......
......@@ -909,6 +909,11 @@ static HRESULT WINAPI PrimaryBufferImpl_QueryInterface(
ICOM_THIS(PrimaryBufferImpl,iface);
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL; /* assume failure */
if ( IsEqualGUID(riid, &IID_IUnknown) ||
......
......@@ -61,6 +61,13 @@ static HRESULT WINAPI IKsPropertySetImpl_QueryInterface(
ICOM_THIS(IKsPropertySetImpl,iface);
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
/* FIXME: split this for DirectSoundPrivate */
if (This->dsb == NULL) {
FIXME("not used on a buffer\n");
return DSERR_INVALIDPARAM;
}
return IDirectSoundBuffer_QueryInterface((LPDIRECTSOUNDBUFFER8)This->dsb, riid, ppobj);
}
......@@ -416,8 +423,69 @@ static HRESULT WINAPI DSPROPERTY_EnumerateA(
ULONG cbPropData,
PULONG pcbReturned )
{
FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA) pPropData;
HRESULT err;
TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
if (ppd) {
if (ppd->Callback) {
unsigned devs, wod, wid;
DSDRIVERDESC desc;
GUID guid;
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA data;
devs = waveOutGetNumDevs();
for (wod = 0; wod < devs; ++wod) {
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
if (err == DS_OK) {
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDGUID,(DWORD)&guid,0));
if (err == DS_OK) {
memset(&data, 0, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
data.WaveDeviceId = wod;
data.DeviceId = guid;
data.Description = desc.szDesc;
data.Module = desc.szDrvName;
data.Interface = "Interface";
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
(ppd->Callback)(&data, ppd->Context);
}
}
}
devs = waveInGetNumDevs();
for (wid = 0; wid < devs; ++wid) {
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
if (err == DS_OK) {
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDGUID,(DWORD)&guid,0));
if (err == DS_OK) {
memset(&data, 0, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
data.WaveDeviceId = wid;
data.DeviceId = guid;
data.Description = desc.szDesc;
data.Module = desc.szDrvName;
data.Interface = "Interface";
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
(ppd->Callback)(&data, ppd->Context);
}
}
}
return S_OK;
}
}
} else {
FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
}
if (pcbReturned) {
*pcbReturned = 0;
FIXME("*pcbReturned=%ld\n", *pcbReturned);
}
return E_PROP_ID_UNSUPPORTED;
}
......@@ -427,53 +495,132 @@ static HRESULT WINAPI DSPROPERTY_EnumerateW(
ULONG cbPropData,
PULONG pcbReturned )
{
FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA) pPropData;
HRESULT err;
TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned);
if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
if (ppd) {
if (ppd->Callback) {
unsigned devs, wod, wid;
DSDRIVERDESC desc;
GUID guid;
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data;
devs = waveOutGetNumDevs();
for (wod = 0; wod < devs; ++wod) {
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
if (err == DS_OK) {
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDGUID,(DWORD)&guid,0));
if (err == DS_OK) {
memset(&data, 0, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
data.WaveDeviceId = wod;
data.DeviceId = guid;
/* FIXME: this is a memory leak */
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
MultiByteToWideChar( CP_ACP, 0, desc.szDrvName, -1, wModule, 0x100 );
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
data.Description = wDescription;
data.Module = wModule;
data.Interface = wInterface;
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
(ppd->Callback)(&data, ppd->Context);
}
}
}
devs = waveInGetNumDevs();
for (wid = 0; wid < devs; ++wid) {
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
if (err == DS_OK) {
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDGUID,(DWORD)&guid,0));
if (err == DS_OK) {
memset(&data, 0, sizeof(data));
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
data.WaveDeviceId = wid;
data.DeviceId = guid;
/* FIXME: this is a memory leak */
WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200);
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200);
MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 );
MultiByteToWideChar( CP_ACP, 0, desc.szDrvName, -1, wModule, 0x100 );
MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 );
data.Description = wDescription;
data.Module = wModule;
data.Interface = wInterface;
TRACE("calling Callback(%p,%p)\n", &data, ppd->Context);
(ppd->Callback)(&data, ppd->Context);
}
}
}
return S_OK;
}
}
} else {
FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
}
if (pcbReturned) {
*pcbReturned = 0;
FIXME("*pcbReturned=%ld\n", *pcbReturned);
}
return E_PROP_ID_UNSUPPORTED;
}
static HRESULT WINAPI IKsPropertySetImpl_Get(LPKSPROPERTYSET iface,
REFGUID guidPropSet, ULONG dwPropID,
LPVOID pInstanceData, ULONG cbInstanceData,
LPVOID pPropData, ULONG cbPropData,
PULONG pcbReturned
REFGUID guidPropSet, ULONG dwPropID,
LPVOID pInstanceData, ULONG cbInstanceData,
LPVOID pPropData, ULONG cbPropData,
PULONG pcbReturned
) {
ICOM_THIS(IKsPropertySetImpl,iface);
TRACE("(iface=%p,guidPropSet=%s,dwPropID=%ld,pInstanceData=%p,cbInstanceData=%ld,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
switch (dwPropID) {
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
return DSPROPERTY_WaveDeviceMappingA(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
return DSPROPERTY_Description1(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
return DSPROPERTY_Enumerate1(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
return DSPROPERTY_WaveDeviceMappingW(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
return DSPROPERTY_DescriptionA(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
return DSPROPERTY_DescriptionW(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
return DSPROPERTY_EnumerateA(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
return DSPROPERTY_EnumerateW(guidPropSet,pPropData,cbPropData,pcbReturned);
default:
FIXME("unsupported ID: %ld\n",dwPropID);
break;
}
} else {
FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
ICOM_THIS(IKsPropertySetImpl,iface);
TRACE("(iface=%p,guidPropSet=%s,dwPropID=%ld,pInstanceData=%p,cbInstanceData=%ld,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n",
This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned);
if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
switch (dwPropID) {
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
return DSPROPERTY_WaveDeviceMappingA(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
return DSPROPERTY_Description1(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
return DSPROPERTY_Enumerate1(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
return DSPROPERTY_WaveDeviceMappingW(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
return DSPROPERTY_DescriptionA(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
return DSPROPERTY_DescriptionW(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
return DSPROPERTY_EnumerateA(guidPropSet,pPropData,cbPropData,pcbReturned);
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
return DSPROPERTY_EnumerateW(guidPropSet,pPropData,cbPropData,pcbReturned);
default:
FIXME("unsupported ID: %ld\n",dwPropID);
break;
}
} else {
FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
}
if (pcbReturned) {
*pcbReturned = 0;
FIXME("*pcbReturned=%ld\n", *pcbReturned);
}
if (pcbReturned) {
*pcbReturned = 0;
FIXME("*pcbReturned=%ld\n", *pcbReturned);
}
return E_PROP_ID_UNSUPPORTED;
return E_PROP_ID_UNSUPPORTED;
}
static HRESULT WINAPI IKsPropertySetImpl_Set(LPKSPROPERTYSET iface,
......@@ -490,10 +637,44 @@ static HRESULT WINAPI IKsPropertySetImpl_Set(LPKSPROPERTYSET iface,
static HRESULT WINAPI IKsPropertySetImpl_QuerySupport(LPKSPROPERTYSET iface,
REFGUID guidPropSet, ULONG dwPropID, PULONG pTypeSupport
) {
ICOM_THIS(IKsPropertySetImpl,iface);
ICOM_THIS(IKsPropertySetImpl,iface);
TRACE("(%p,%s,%ld,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) {
switch (dwPropID) {
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
case DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
return S_OK;
default:
FIXME("unsupported ID: %ld\n",dwPropID);
break;
}
} else {
FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet));
}
FIXME("(%p,%s,%ld,%p), stub!\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
return E_PROP_ID_UNSUPPORTED;
return E_PROP_ID_UNSUPPORTED;
}
static ICOM_VTABLE(IKsPropertySet) iksvt = {
......
......@@ -821,6 +821,13 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_QueryInterface(
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL; /* assume failure */
if ( IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirectSound3DListener ) ) {
IDirectSound3DListener_AddRef((LPDIRECTSOUND3DLISTENER)This);
......@@ -835,7 +842,6 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_QueryInterface(
}
FIXME( "Unknown IID %s\n", debugstr_guid( riid ) );
*ppobj = NULL;
return E_NOINTERFACE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment