dsound: Class factory cleanup.

Consolidate all class factories into a single implementation.
Fixes a problem discovered by oleview.
This commit is contained in:
Robert Reif 2006-08-18 01:13:31 -04:00 committed by Alexandre Julliard
parent 2164502322
commit 595d6aa6fb
6 changed files with 137 additions and 345 deletions

View File

@ -85,13 +85,19 @@ static const char * captureStateString[] = {
"STATE_STOPPING"
};
static HRESULT DSOUND_CaptureCreate(
LPDIRECTSOUNDCAPTURE *ppDSC,
IUnknown *pUnkOuter)
HRESULT DSOUND_CaptureCreate(
REFIID riid,
LPDIRECTSOUNDCAPTURE *ppDSC)
{
LPDIRECTSOUNDCAPTURE pDSC;
HRESULT hr;
TRACE("(%p,%p)\n",ppDSC,pUnkOuter);
TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSC);
if (!IsEqualIID(riid, &IID_IUnknown) &&
!IsEqualIID(riid, &IID_IDirectSoundCapture)) {
*ppDSC = 0;
return E_NOINTERFACE;
}
/* Get dsound configuration */
setup_dsound_options();
@ -108,13 +114,19 @@ static HRESULT DSOUND_CaptureCreate(
return hr;
}
static HRESULT DSOUND_CaptureCreate8(
LPDIRECTSOUNDCAPTURE8 *ppDSC8,
IUnknown *pUnkOuter)
HRESULT DSOUND_CaptureCreate8(
REFIID riid,
LPDIRECTSOUNDCAPTURE8 *ppDSC8)
{
LPDIRECTSOUNDCAPTURE8 pDSC8;
HRESULT hr;
TRACE("(%p,%p)\n",ppDSC8,pUnkOuter);
TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSC8);
if (!IsEqualIID(riid, &IID_IUnknown) &&
!IsEqualIID(riid, &IID_IDirectSoundCapture8)) {
*ppDSC8 = 0;
return E_NOINTERFACE;
}
/* Get dsound configuration */
setup_dsound_options();
@ -173,7 +185,7 @@ HRESULT WINAPI DirectSoundCaptureCreate(
return DSERR_NOAGGREGATION;
}
hr = DSOUND_CaptureCreate(&pDSC, (IUnknown *)pUnkOuter);
hr = DSOUND_CaptureCreate(&IID_IDirectSoundCapture, &pDSC);
if (hr == DS_OK) {
hr = IDirectSoundCapture_Initialize(pDSC, lpcGUID);
if (hr != DS_OK) {
@ -229,7 +241,7 @@ HRESULT WINAPI DirectSoundCaptureCreate8(
return DSERR_NOAGGREGATION;
}
hr = DSOUND_CaptureCreate8(&pDSC8, (IUnknown *)pUnkOuter);
hr = DSOUND_CaptureCreate8(&IID_IDirectSoundCapture8, &pDSC8);
if (hr == DS_OK) {
hr = IDirectSoundCapture_Initialize(pDSC8, lpcGUID);
if (hr != DS_OK) {
@ -1694,80 +1706,3 @@ ULONG DirectSoundCaptureDevice_Release(
}
return ref;
}
/*******************************************************************************
* DirectSoundCapture ClassFactory
*/
static HRESULT WINAPI
DSCCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI
DSCCF_AddRef(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
ULONG ref = InterlockedIncrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
}
static ULONG WINAPI
DSCCF_Release(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
/* static class, won't be freed */
return ref;
}
static HRESULT WINAPI
DSCCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj )
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if (pOuter) {
WARN("aggregation not supported\n");
return CLASS_E_NOAGGREGATION;
}
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL;
if ( IsEqualGUID( &IID_IDirectSoundCapture, riid ) )
return DSOUND_CaptureCreate8((LPDIRECTSOUNDCAPTURE*)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)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
static const IClassFactoryVtbl DSCCF_Vtbl =
{
DSCCF_QueryInterface,
DSCCF_AddRef,
DSCCF_Release,
DSCCF_CreateInstance,
DSCCF_LockServer
};
IClassFactoryImpl DSOUND_CAPTURE_CF = { &DSCCF_Vtbl, 1 };

View File

@ -977,12 +977,18 @@ static HRESULT IDirectSound8_IDirectSound8_Create(
}
HRESULT DSOUND_Create(
LPDIRECTSOUND *ppDS,
IUnknown *pUnkOuter)
REFIID riid,
LPDIRECTSOUND *ppDS)
{
LPDIRECTSOUND8 pDS;
HRESULT hr;
TRACE("(%p,%p)\n",ppDS,pUnkOuter);
TRACE("(%s, %p)\n", debugstr_guid(riid), ppDS);
if (!IsEqualIID(riid, &IID_IUnknown) &&
!IsEqualIID(riid, &IID_IDirectSound)) {
*ppDS = 0;
return E_NOINTERFACE;
}
/* Get dsound configuration */
setup_dsound_options();
@ -1040,7 +1046,7 @@ HRESULT WINAPI DirectSoundCreate(
return DSERR_INVALIDPARAM;
}
hr = DSOUND_Create(&pDS, pUnkOuter);
hr = DSOUND_Create(&IID_IDirectSound, &pDS);
if (hr == DS_OK) {
hr = IDirectSound_Initialize(pDS, lpcGUID);
if (hr != DS_OK) {
@ -1058,12 +1064,18 @@ HRESULT WINAPI DirectSoundCreate(
}
HRESULT DSOUND_Create8(
LPDIRECTSOUND8 *ppDS,
IUnknown *pUnkOuter)
REFIID riid,
LPDIRECTSOUND8 *ppDS)
{
LPDIRECTSOUND8 pDS;
HRESULT hr;
TRACE("(%p,%p)\n",ppDS,pUnkOuter);
TRACE("(%s, %p)\n", debugstr_guid(riid), ppDS);
if (!IsEqualIID(riid, &IID_IUnknown) &&
!IsEqualIID(riid, &IID_IDirectSound8)) {
*ppDS = 0;
return E_NOINTERFACE;
}
/* Get dsound configuration */
setup_dsound_options();
@ -1121,7 +1133,7 @@ HRESULT WINAPI DirectSoundCreate8(
return DSERR_INVALIDPARAM;
}
hr = DSOUND_Create8(&pDS, pUnkOuter);
hr = DSOUND_Create8(&IID_IDirectSound8, &pDS);
if (hr == DS_OK) {
hr = IDirectSound8_Initialize(pDS, lpcGUID);
if (hr != DS_OK) {

View File

@ -426,12 +426,23 @@ HRESULT WINAPI DirectSoundEnumerateW(
* DirectSound ClassFactory
*/
static HRESULT WINAPI
DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
typedef HRESULT (*FnCreateInstance)(REFIID riid, LPVOID *ppobj);
typedef struct {
const IClassFactoryVtbl *lpVtbl;
LONG ref;
REFCLSID rclsid;
FnCreateInstance pfnCreateInstance;
} IClassFactoryImpl;
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
static HRESULT WINAPI
DSCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p) stub!\n", This, debugstr_guid(riid), ppobj);
if (ppobj == NULL)
return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
@ -452,115 +463,50 @@ static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
}
static HRESULT WINAPI DSCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
LPCLASSFACTORY iface,
LPUNKNOWN pOuter,
REFIID riid,
LPVOID *ppobj)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), ppobj);
if (pOuter)
return CLASS_E_NOAGGREGATION;
if (pOuter)
return CLASS_E_NOAGGREGATION;
if (ppobj == NULL) {
WARN("invalid parameter\n");
return DSERR_INVALIDPARAM;
}
*ppobj = NULL;
if ( IsEqualIID( &IID_IDirectSound, riid ) )
return DSOUND_Create((LPDIRECTSOUND*)ppobj,pOuter);
if ( IsEqualIID( &IID_IDirectSound8, riid ) )
return DSOUND_Create8((LPDIRECTSOUND8*)ppobj,pOuter);
WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
if (ppobj == NULL) {
WARN("invalid parameter\n");
return DSERR_INVALIDPARAM;
}
*ppobj = NULL;
return This->pfnCreateInstance(riid, ppobj);
}
static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d) stub!\n", This, dolock);
return S_OK;
}
static const IClassFactoryVtbl DSCF_Vtbl = {
DSCF_QueryInterface,
DSCF_AddRef,
DSCF_Release,
DSCF_CreateInstance,
DSCF_LockServer
DSCF_QueryInterface,
DSCF_AddRef,
DSCF_Release,
DSCF_CreateInstance,
DSCF_LockServer
};
static IClassFactoryImpl DSOUND_CF = { &DSCF_Vtbl, 1 };
/*******************************************************************************
* DirectSoundPrivate ClassFactory
*/
static HRESULT WINAPI
DSPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI DSPCF_AddRef(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
ULONG ref = InterlockedIncrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
}
static ULONG WINAPI DSPCF_Release(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
/* static class, won't be freed */
return ref;
}
static HRESULT WINAPI
DSPCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
) {
IClassFactoryImpl *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 IKsPrivatePropertySetImpl_Create((IKsPrivatePropertySetImpl**)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) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
static const IClassFactoryVtbl DSPCF_Vtbl = {
DSPCF_QueryInterface,
DSPCF_AddRef,
DSPCF_Release,
DSPCF_CreateInstance,
DSPCF_LockServer
static IClassFactoryImpl DSOUND_CF[] = {
{ &DSCF_Vtbl, 1, &CLSID_DirectSound, (FnCreateInstance)DSOUND_Create },
{ &DSCF_Vtbl, 1, &CLSID_DirectSound8, (FnCreateInstance)DSOUND_Create8 },
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundCapture, (FnCreateInstance)DSOUND_CaptureCreate },
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundCapture8, (FnCreateInstance)DSOUND_CaptureCreate8 },
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundFullDuplex, (FnCreateInstance)DSOUND_FullDuplexCreate },
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundPrivate, (FnCreateInstance)IKsPrivatePropertySetImpl_Create },
{ NULL, 0, NULL, NULL }
};
static IClassFactoryImpl DSOUND_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
/*******************************************************************************
* DllGetClassObject [DSOUND.@]
* Retrieves class object from a DLL object
@ -580,62 +526,33 @@ static IClassFactoryImpl DSOUND_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
*/
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
int i = 0;
TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
if (ppv == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
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 (!IsEqualIID(riid, &IID_IClassFactory) &&
!IsEqualIID(riid, &IID_IUnknown)) {
WARN("no interface for %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
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;
while (NULL != DSOUND_CF[i].rclsid) {
if (IsEqualGUID(rclsid, DSOUND_CF[i].rclsid)) {
DSCF_AddRef((IClassFactory*) &DSOUND_CF[i]);
*ppv = &DSOUND_CF[i];
return S_OK;
}
i++;
}
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;
}
WARN("(%s,%s,%p): no class 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;
}

View File

@ -68,7 +68,6 @@ typedef struct IKsBufferPropertySetImpl IKsBufferPropertySetImpl;
typedef struct IKsPrivatePropertySetImpl IKsPrivatePropertySetImpl;
typedef struct PrimaryBufferImpl PrimaryBufferImpl;
typedef struct SecondaryBufferImpl SecondaryBufferImpl;
typedef struct IClassFactoryImpl IClassFactoryImpl;
typedef struct DirectSoundDevice DirectSoundDevice;
typedef struct DirectSoundCaptureDevice DirectSoundCaptureDevice;
@ -391,6 +390,7 @@ struct IKsPrivatePropertySetImpl
};
HRESULT IKsPrivatePropertySetImpl_Create(
REFIID riid,
IKsPrivatePropertySetImpl **piks);
/*****************************************************************************
@ -411,26 +411,13 @@ HRESULT IDirectSound3DBufferImpl_Create(
HRESULT IDirectSound3DBufferImpl_Destroy(
IDirectSound3DBufferImpl *pds3db);
/*******************************************************************************
* DirectSound ClassFactory implementation structure
*/
struct IClassFactoryImpl
{
/* IUnknown fields */
const IClassFactoryVtbl *lpVtbl;
LONG ref;
};
extern IClassFactoryImpl DSOUND_CAPTURE_CF;
extern IClassFactoryImpl DSOUND_FULLDUPLEX_CF;
/*******************************************************************************
*/
/* dsound.c */
HRESULT DSOUND_Create(LPDIRECTSOUND *ppDS, IUnknown *pUnkOuter);
HRESULT DSOUND_Create8(LPDIRECTSOUND8 *ppDS, IUnknown *pUnkOuter);
HRESULT DSOUND_Create(REFIID riid, LPDIRECTSOUND *ppDS);
HRESULT DSOUND_Create8(REFIID riid, LPDIRECTSOUND8 *ppDS);
/* primary.c */
@ -441,6 +428,10 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device);
HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LPDWORD writepos);
HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex);
/* duplex.c */
HRESULT DSOUND_FullDuplexCreate(REFIID riid, LPDIRECTSOUNDFULLDUPLEX* ppDSFD);
/* buffer.c */
DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD pwrite);
@ -462,7 +453,9 @@ void CALLBACK DSOUND_callback(HWAVEOUT hwo, UINT msg, DWORD dwUser, DWORD dw1, D
void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb);
/* capture.c */
HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC);
HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8);
HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(
LPDIRECTSOUNDCAPTURE iface,
LPCDSCBUFFERDESC lpcDSCBufferDesc,

View File

@ -760,21 +760,24 @@ static const IDirectSoundFullDuplexVtbl dsfdvt =
IDirectSoundFullDuplexImpl_Initialize
};
static HRESULT DSOUND_FullDuplexCreate(LPDIRECTSOUNDFULLDUPLEX* ppDSFD, IUnknown *pUnkOuter)
HRESULT DSOUND_FullDuplexCreate(
REFIID riid,
LPDIRECTSOUNDFULLDUPLEX* ppDSFD)
{
IDirectSoundFullDuplexImpl *This = NULL;
if (pUnkOuter) {
WARN("pUnkOuter != 0\n");
*ppDSFD = NULL;
return DSERR_NOAGGREGATION;
}
TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSFD);
if (ppDSFD == NULL) {
WARN("invalid parameter: ppDSFD == NULL\n");
return DSERR_INVALIDPARAM;
}
if (!IsEqualIID(riid, &IID_IUnknown) &&
!IsEqualIID(riid, &IID_IDirectSoundFullDuplex)) {
*ppDSFD = 0;
return E_NOINTERFACE;
}
/* Get dsound configuration */
setup_dsound_options();
@ -907,79 +910,3 @@ DirectSoundFullDuplexCreate(
return hres;
}
/*******************************************************************************
* DirectSoundFullDuplex ClassFactory
*/
static HRESULT WINAPI
DSFDCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI
DSFDCF_AddRef(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p) ref was %ld\n", This, This->ref);
return InterlockedIncrement(&(This->ref));
}
static ULONG WINAPI
DSFDCF_Release(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
TRACE("(%p) ref was %ld\n", This, This->ref);
return InterlockedDecrement(&(This->ref));
}
static HRESULT WINAPI
DSFDCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj )
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if (pOuter) {
WARN("aggregation not supported\n");
return CLASS_E_NOAGGREGATION;
}
if (ppobj == NULL) {
WARN("invalid parameter\n");
return E_INVALIDARG;
}
*ppobj = NULL;
if ( IsEqualGUID( &IID_IDirectSoundFullDuplex, riid ) )
return DSOUND_FullDuplexCreate((LPDIRECTSOUNDFULLDUPLEX*)ppobj,pOuter);
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)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
static const IClassFactoryVtbl DSFDCF_Vtbl =
{
DSFDCF_QueryInterface,
DSFDCF_AddRef,
DSFDCF_Release,
DSFDCF_CreateInstance,
DSFDCF_LockServer
};
IClassFactoryImpl DSOUND_FULLDUPLEX_CF = { &DSFDCF_Vtbl, 1 };

View File

@ -1504,9 +1504,17 @@ static const IKsPropertySetVtbl ikspvt = {
};
HRESULT IKsPrivatePropertySetImpl_Create(
REFIID riid,
IKsPrivatePropertySetImpl **piks)
{
IKsPrivatePropertySetImpl *iks;
TRACE("(%s, %p)\n", debugstr_guid(riid), piks);
if (!IsEqualIID(riid, &IID_IUnknown) &&
!IsEqualIID(riid, &IID_IKsPropertySet)) {
*piks = 0;
return E_NOINTERFACE;
}
iks = HeapAlloc(GetProcessHeap(),0,sizeof(*iks));
iks->ref = 1;