diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c index 840b8053e27..b84aef7b627 100644 --- a/dlls/dsound/dsound_main.c +++ b/dlls/dsound/dsound_main.c @@ -72,6 +72,7 @@ typedef struct IDirectSound3DListenerImpl IDirectSound3DListenerImpl; typedef struct IDirectSound3DBufferImpl IDirectSound3DBufferImpl; typedef struct IDirectSoundCaptureImpl IDirectSoundCaptureImpl; typedef struct IDirectSoundCaptureBufferImpl IDirectSoundCaptureBufferImpl; +typedef struct IKsPropertySetImpl IKsPropertySetImpl; /***************************************************************************** * IDirectSound implementation structure @@ -161,6 +162,15 @@ struct IDirectSound3DListenerImpl CRITICAL_SECTION lock; }; +struct IKsPropertySetImpl +{ + /* IUnknown fields */ + ICOM_VFIELD(IKsPropertySet); + DWORD ref; + /* IKsPropertySetImpl fields */ + IDirectSound3DBufferImpl *ds3db; /* backptr, no ref */ +}; + /***************************************************************************** * IDirectSound3DBuffer implementation structure */ @@ -175,6 +185,7 @@ struct IDirectSound3DBufferImpl LPBYTE buffer; DWORD buflen; CRITICAL_SECTION lock; + IKsPropertySetImpl* iks; }; @@ -317,6 +328,76 @@ static void _dump_DSBCAPS(DWORD xmask) { DPRINTF("%s ",flags[i].name); } +/******************************************************************************* + * IKsPropertySet + */ + +/* IUnknown methods */ +static HRESULT WINAPI IKsPropertySetImpl_QueryInterface( + LPKSPROPERTYSET iface, REFIID riid, LPVOID *ppobj +) { + ICOM_THIS(IKsPropertySetImpl,iface); + + FIXME("(%p,%s,%p), stub!\n",This,debugstr_guid(riid),ppobj); + return E_FAIL; +} + +static ULONG WINAPI IKsPropertySetImpl_AddRef(LPKSPROPERTYSET iface) { + ICOM_THIS(IKsPropertySetImpl,iface); + + This->ref++; + return This->ref; +} + +static ULONG WINAPI IKsPropertySetImpl_Release(LPKSPROPERTYSET iface) { + ICOM_THIS(IKsPropertySetImpl,iface); + + This->ref--; + return This->ref; +} + +static HRESULT WINAPI IKsPropertySetImpl_Get(LPKSPROPERTYSET iface, + REFGUID guidPropSet, ULONG dwPropID, + LPVOID pInstanceData, ULONG cbInstanceData, + LPVOID pPropData, ULONG cbPropData, + PULONG pcbReturned +) { + ICOM_THIS(IKsPropertySetImpl,iface); + + FIXME("(%p,%s,%ld,%p,%ld,%p,%ld,%p), stub!\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned); + return E_PROP_ID_UNSUPPORTED; +} + +static HRESULT WINAPI IKsPropertySetImpl_Set(LPKSPROPERTYSET iface, + REFGUID guidPropSet, ULONG dwPropID, + LPVOID pInstanceData, ULONG cbInstanceData, + LPVOID pPropData, ULONG cbPropData +) { + ICOM_THIS(IKsPropertySetImpl,iface); + + FIXME("(%p,%s,%ld,%p,%ld,%p,%ld), stub!\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData); + return E_PROP_ID_UNSUPPORTED; +} + +static HRESULT WINAPI IKsPropertySetImpl_QuerySupport(LPKSPROPERTYSET iface, + REFGUID guidPropSet, ULONG dwPropID, PULONG pTypeSupport +) { + ICOM_THIS(IKsPropertySetImpl,iface); + + FIXME("(%p,%s,%ld,%p), stub!\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport); + return E_PROP_ID_UNSUPPORTED; +} + +static ICOM_VTABLE(IKsPropertySet) iksvt = { + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IKsPropertySetImpl_QueryInterface, + IKsPropertySetImpl_AddRef, + IKsPropertySetImpl_Release, + IKsPropertySetImpl_Get, + IKsPropertySetImpl_Set, + IKsPropertySetImpl_QuerySupport +}; + /******************************************************************************* * IDirectSound3DBuffer */ @@ -328,7 +409,13 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_QueryInterface( { ICOM_THIS(IDirectSound3DBufferImpl,iface); - TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); + if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) { + IDirectSound3DBuffer_AddRef(iface); + *ppobj = This->iks; + return S_OK; + } + + FIXME("(%p,%s,%p), no such interface.\n",This,debugstr_guid(riid),ppobj); return E_FAIL; } #endif @@ -1777,7 +1864,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface( ICOM_VTBL(ds3db) = &ds3dbvt; InitializeCriticalSection(&ds3db->lock); - IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER)This); + IDirectSoundBuffer_AddRef(iface); ds3db->ds3db.dwSize = sizeof(DS3DBUFFER); ds3db->ds3db.vPosition.u1.x = 0.0; @@ -1802,6 +1889,11 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface( ds3db->ds3db.dwMode = DS3DMODE_DISABLE; } + ds3db->iks = (IKsPropertySetImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(*(ds3db->iks))); + ds3db->iks->ref = 1; + ds3db->iks->ds3db = ds3db; + ICOM_VTBL(ds3db->iks) = &iksvt; + return S_OK; } #else @@ -2067,7 +2159,7 @@ static HRESULT WINAPI IDirectSoundImpl_CreateSoundBuffer( (*ippdsb)->ds3db = ds3db; ds3db->dsb = (*ippdsb); - IDirectSoundBufferImpl_AddRef((LPDIRECTSOUNDBUFFER)ippdsb); + IDirectSoundBufferImpl_AddRef((LPDIRECTSOUNDBUFFER)(*ippdsb)); InitializeCriticalSection(&ds3db->lock); @@ -2094,6 +2186,11 @@ static HRESULT WINAPI IDirectSoundImpl_CreateSoundBuffer( ds3db->buflen = 0; ds3db->ds3db.dwMode = DS3DMODE_DISABLE; } + ds3db->iks = (IKsPropertySetImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(*(ds3db->iks))); + ds3db->iks->ref = 1; + ds3db->iks->ds3db = ds3db; + ICOM_VTBL(ds3db->iks) = &iksvt; + } #endif return DS_OK; diff --git a/include/dsound.h b/include/dsound.h index db0b2d9e148..1af21d7702d 100644 --- a/include/dsound.h +++ b/include/dsound.h @@ -36,6 +36,7 @@ DEFINE_GUID(IID_IDirectSoundCaptureBuffer,0xB0210782,0x89CD,0x11D0,0xAF,0x08,0x0 typedef struct IDirectSoundCaptureBuffer IDirectSoundCaptureBuffer,*LPDIRECTSOUNDCAPTUREBUFFER; DEFINE_GUID(IID_IKsPropertySet, 0x31EFAC30,0x515C,0x11D0,0xA9,0xAA,0x00,0xAA,0x00,0x61,0xBE,0x93); +typedef struct IKsPropertySet IKsPropertySet,*LPKSPROPERTYSET; #define _FACDS 0x878 @@ -554,7 +555,26 @@ ICOM_DEFINE(IDirectSound3DBuffer,IUnknown) /***************************************************************************** * IKsPropertySet interface */ -/* FIXME: not implemented yet */ +#define KSPROPERTY_SUPPORT_GET 1 +#define KSPROPERTY_SUPPORT_SET 2 + +#define ICOM_INTERFACE IKsPropertySet +#define IKsPropertySet_METHODS \ + ICOM_METHOD7(HRESULT,Get,REFGUID,rgid,ULONG,x1,LPVOID,p1,ULONG,x2,LPVOID,p2,ULONG,x3,ULONG*,px4);\ + ICOM_METHOD6(HRESULT,Set,REFGUID,rgid,ULONG,x1,LPVOID,p1,ULONG,x2,LPVOID,p2,ULONG,x3);\ + ICOM_METHOD3(HRESULT,QuerySupport,REFGUID,rgid,ULONG,x1,ULONG*,px2); +#define IKsPropertySet_IMETHODS \ + IUnknown_IMETHODS \ + IKsPropertySet_METHODS +ICOM_DEFINE(IKsPropertySet,IUnknown) +#undef ICOM_INTERFACE + +#define IKsPropertySet_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IKsPropertySet_AddRef(p) ICOM_CALL (AddRef,p) +#define IKsPropertySet_Release(p) ICOM_CALL (Release,p) +#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) ICOM_CALL7(Get,p,a,b,c,d,e,f,g) +#define IKsPropertySet_Set(p,a,b,c,d,e,f) ICOM_CALL6(Set,p,a,b,c,d,e,f) +#define IKsPropertySet_QuerySupport(p,a,b,c) ICOM_CALL3(QuerySupport,p,a,b,c) #ifdef __cplusplus } /* extern "C" */ diff --git a/include/winerror.h b/include/winerror.h index c5a4dc22d9d..41f3a725b63 100644 --- a/include/winerror.h +++ b/include/winerror.h @@ -1879,6 +1879,10 @@ extern int WIN32_LastError; #define E_OUTOFMEMORY 0x8007000EL #define E_INVALIDARG 0x80070057L +/* For IKsPropertySets */ +#define E_PROP_ID_UNSUPPORTED 0x80070490L +#define E_PROP_SET_UNSUPPORTED 0x80070492L + #define CO_S_NOTALLINTERFACES 0x00080012L #define CO_E_CLASS_CREATE_FAILED 0x80080001L