DSOUND: class factory cleanup with tests
Robert Reif
reif at earthlink.net
Tue Jul 4 08:52:43 CDT 2006
Consolidate all class factories into a single implementation. Fixes
problem discovered by oleview.
Add more class factory tests.
-------------- next part --------------
Index: dlls/dsound/capture.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/capture.c,v
retrieving revision 1.65
diff -p -u -r1.65 capture.c
--- dlls/dsound/capture.c 14 Jun 2006 11:55:02 -0000 1.65
+++ dlls/dsound/capture.c 4 Jul 2006 13:43:44 -0000
@@ -55,13 +55,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();
@@ -78,13 +84,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();
@@ -143,7 +155,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) {
@@ -199,7 +211,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) {
@@ -1664,80 +1676,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 };
Index: dlls/dsound/dsound.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound.c,v
retrieving revision 1.51
diff -p -u -r1.51 dsound.c
--- dlls/dsound/dsound.c 14 Jun 2006 11:55:02 -0000 1.51
+++ dlls/dsound/dsound.c 4 Jul 2006 13:43:45 -0000
@@ -914,12 +914,18 @@ HRESULT IDirectSound8_IDirectSound8_Crea
}
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();
@@ -977,7 +983,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) {
@@ -995,12 +1001,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();
@@ -1058,7 +1070,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) {
Index: dlls/dsound/dsound_main.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound_main.c,v
retrieving revision 1.132
diff -p -u -r1.132 dsound_main.c
--- dlls/dsound/dsound_main.c 23 May 2006 12:47:56 -0000 1.132
+++ dlls/dsound/dsound_main.c 4 Jul 2006 13:43:45 -0000
@@ -425,13 +425,23 @@ HRESULT WINAPI DirectSoundEnumerateW(
/*******************************************************************************
* DirectSound ClassFactory
*/
+typedef HRESULT (*FnCreateInstance)(REFIID riid, LPVOID *ppobj);
-static HRESULT WINAPI
-DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+typedef struct {
+ const IClassFactoryVtbl *lpVtbl;
+ ULONG 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,114 +462,50 @@ static ULONG WINAPI DSCF_Release(LPCLASS
}
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);
-
- 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;
-}
-
-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
-};
-
-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)
+ LPCLASSFACTORY iface,
+ LPUNKNOWN pOuter,
+ REFIID riid,
+ LPVOID *ppobj)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
- ULONG ref = InterlockedIncrement(&(This->ref));
- TRACE("(%p) ref was %ld\n", This, ref - 1);
- return ref;
-}
+ TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), ppobj);
-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;
-}
+ if (pOuter)
+ return CLASS_E_NOAGGREGATION;
-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);
- }
+ if (ppobj == NULL) {
+ WARN("invalid parameter\n");
+ return DSERR_INVALIDPARAM;
+ }
- WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
- return E_NOINTERFACE;
+ *ppobj = NULL;
+ return This->pfnCreateInstance(riid, ppobj);
}
-static HRESULT WINAPI
-DSPCF_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 DSPCF_Vtbl = {
- DSPCF_QueryInterface,
- DSPCF_AddRef,
- DSPCF_Release,
- DSPCF_CreateInstance,
- DSPCF_LockServer
+static const IClassFactoryVtbl DSCF_Vtbl = {
+ DSCF_QueryInterface,
+ DSCF_AddRef,
+ DSCF_Release,
+ DSCF_CreateInstance,
+ DSCF_LockServer
};
-static IClassFactoryImpl DSOUND_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
+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 }
+};
/*******************************************************************************
* DllGetClassObject [DSOUND.@]
@@ -580,66 +526,36 @@ static IClassFactoryImpl DSOUND_PRIVATE_
*/
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;
- }
-
- 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;
+ 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++;
}
- 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;
}
-
/*******************************************************************************
* DllCanUnloadNow [DSOUND.4]
* Determines whether the DLL is in use.
Index: dlls/dsound/dsound_private.h
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound_private.h,v
retrieving revision 1.46
diff -p -u -r1.46 dsound_private.h
--- dlls/dsound/dsound_private.h 10 Jun 2006 11:30:12 -0000 1.46
+++ dlls/dsound/dsound_private.h 4 Jul 2006 13:43:46 -0000
@@ -68,7 +68,6 @@ typedef struct 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;
@@ -517,6 +516,7 @@ struct IKsPrivatePropertySetImpl
};
HRESULT IKsPrivatePropertySetImpl_Create(
+ REFIID riid,
IKsPrivatePropertySetImpl **piks);
/*****************************************************************************
@@ -538,25 +538,12 @@ 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 *ppDS8);
/* primary.c */
@@ -590,10 +577,12 @@ void DSOUND_Calc3DBuffer(IDirectSoundBuf
/* duplex.c */
-HRESULT DSOUND_FullDuplexCreate(LPDIRECTSOUNDFULLDUPLEX* ppDSFD, IUnknown *pUnkOuter);
+HRESULT DSOUND_FullDuplexCreate(REFIID riid, LPDIRECTSOUNDFULLDUPLEX* ppDSFD);
/* capture.c */
+HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC);
+HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8);
HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(
LPDIRECTSOUNDCAPTURE iface,
LPCDSCBUFFERDESC lpcDSCBufferDesc,
Index: dlls/dsound/duplex.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/duplex.c,v
retrieving revision 1.9
diff -p -u -r1.9 duplex.c
--- dlls/dsound/duplex.c 10 Jun 2006 11:30:12 -0000 1.9
+++ dlls/dsound/duplex.c 4 Jul 2006 13:43:46 -0000
@@ -760,21 +760,22 @@ static const IDirectSoundFullDuplexVtbl
IDirectSoundFullDuplexImpl_Initialize
};
-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 +908,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 };
Index: dlls/dsound/propset.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/propset.c,v
retrieving revision 1.48
diff -p -u -r1.48 propset.c
--- dlls/dsound/propset.c 23 May 2006 12:47:56 -0000 1.48
+++ dlls/dsound/propset.c 4 Jul 2006 13:43:47 -0000
@@ -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;
Index: dlls/dsound/tests/capture.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/capture.c,v
retrieving revision 1.28
diff -p -u -r1.28 capture.c
--- dlls/dsound/tests/capture.c 23 May 2006 12:47:56 -0000 1.28
+++ dlls/dsound/tests/capture.c 4 Jul 2006 13:43:48 -0000
@@ -192,9 +192,20 @@ static void IDirectSoundCapture_tests(vo
{
HRESULT rc;
LPDIRECTSOUNDCAPTURE dsco=NULL;
+ LPCLASSFACTORY cf=NULL;
trace("Testing IDirectSoundCapture\n");
+ rc=CoGetClassObject(&CLSID_DirectSoundCapture, CLSCTX_INPROC_SERVER, NULL,
+ &IID_IClassFactory, (void**)&cf);
+ ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
+ "failed: %s\n", DXGetErrorString8(rc));
+
+ rc=CoGetClassObject(&CLSID_DirectSoundCapture, CLSCTX_INPROC_SERVER, NULL,
+ &IID_IUnknown, (void**)&cf);
+ ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSoundCapture, IID_IUnknown) "
+ "failed: %s\n", DXGetErrorString8(rc));
+
/* try the COM class factory method of creation with no device specified */
rc=CoCreateInstance(&CLSID_DirectSoundCapture, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSoundCapture, (void**)&dsco);
Index: dlls/dsound/tests/dsound.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/dsound.c,v
retrieving revision 1.59
diff -p -u -r1.59 dsound.c
--- dlls/dsound/tests/dsound.c 23 May 2006 12:47:57 -0000 1.59
+++ dlls/dsound/tests/dsound.c 4 Jul 2006 13:43:48 -0000
@@ -172,9 +172,20 @@ static void IDirectSound_tests(void)
{
HRESULT rc;
LPDIRECTSOUND dso=NULL;
+ LPCLASSFACTORY cf=NULL;
trace("Testing IDirectSound\n");
+ rc=CoGetClassObject(&CLSID_DirectSound, CLSCTX_INPROC_SERVER, NULL,
+ &IID_IClassFactory, (void**)&cf);
+ ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
+ "failed: %s\n", DXGetErrorString8(rc));
+
+ rc=CoGetClassObject(&CLSID_DirectSound, CLSCTX_INPROC_SERVER, NULL,
+ &IID_IUnknown, (void**)&cf);
+ ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound, IID_IUnknown) "
+ "failed: %s\n", DXGetErrorString8(rc));
+
/* try the COM class factory method of creation with no device specified */
rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound, (void**)&dso);
Index: dlls/dsound/tests/dsound8.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/dsound8.c,v
retrieving revision 1.30
diff -p -u -r1.30 dsound8.c
--- dlls/dsound/tests/dsound8.c 23 May 2006 12:47:57 -0000 1.30
+++ dlls/dsound/tests/dsound8.c 4 Jul 2006 13:43:49 -0000
@@ -191,9 +191,20 @@ static void IDirectSound8_tests(void)
{
HRESULT rc;
LPDIRECTSOUND8 dso=NULL;
+ LPCLASSFACTORY cf=NULL;
trace("Testing IDirectSound8\n");
+ rc=CoGetClassObject(&CLSID_DirectSound8, CLSCTX_INPROC_SERVER, NULL,
+ &IID_IClassFactory, (void**)&cf);
+ ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
+ "failed: %s\n", DXGetErrorString8(rc));
+
+ rc=CoGetClassObject(&CLSID_DirectSound8, CLSCTX_INPROC_SERVER, NULL,
+ &IID_IUnknown, (void**)&cf);
+ ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound8, IID_IUnknown) "
+ "failed: %s\n", DXGetErrorString8(rc));
+
/* try the COM class factory method of creation with no device specified */
rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound8, (void**)&dso);
Index: dlls/dsound/tests/duplex.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/duplex.c,v
retrieving revision 1.4
diff -p -u -r1.4 duplex.c
--- dlls/dsound/tests/duplex.c 23 May 2006 12:47:57 -0000 1.4
+++ dlls/dsound/tests/duplex.c 4 Jul 2006 13:43:49 -0000
@@ -66,7 +66,7 @@ static void IDirectSoundFullDuplex_test(
ok(ref==0, "IDirectSound_Release() has %d references, "
"should have 0\n", ref);
}
-
+
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSound8,(LPVOID*)&ds8);
ok(rc==(initialized?DS_OK:E_NOINTERFACE),"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSound8) "
"failed: %s\n",DXGetErrorString8(rc));
@@ -136,7 +136,7 @@ static void IDirectSoundFullDuplex_tests
if (dsfdo)
IDirectSoundFullDuplex_test(dsfdo, FALSE, NULL, NULL);
- /* try the COM class factory method of creation with default devices
+ /* try the COM class factory method of creation with default devices
* specified */
rc=CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL,
CLSCTX_INPROC_SERVER, &IID_IDirectSoundFullDuplex,
Index: dlls/dsound/tests/propset.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/propset.c,v
retrieving revision 1.20
diff -p -u -r1.20 propset.c
--- dlls/dsound/tests/propset.c 23 May 2006 12:47:57 -0000 1.20
+++ dlls/dsound/tests/propset.c 4 Jul 2006 13:43:50 -0000
@@ -202,6 +202,15 @@ static void propset_private_tests(void)
"IID_IClassFactory) should have returned DSERR_INVALIDPARAM, "
"returned: %s\n",DXGetErrorString8(rc));
+ rc = (fProc)(&CLSID_DirectSound, &IID_IDirectSound, (void **)(&pcf));
+ ok(rc==E_NOINTERFACE,"DllGetClassObject(CLSID_DirectSound, "
+ "IID_IDirectSound) should have returned E_NOINTERFACE, "
+ "returned: %s\n",DXGetErrorString8(rc));
+
+ rc = (fProc)(&CLSID_DirectSound, &IID_IUnknown, (void **)(&pcf));
+ ok(rc==DS_OK,"DllGetClassObject(CLSID_DirectSound, "
+ "IID_IUnknown) failed: %s\n",DXGetErrorString8(rc));
+
rc = (fProc)(&CLSID_DirectSound, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
"failed: %s\n",DXGetErrorString8(rc));
More information about the wine-patches
mailing list