dsound: Class factory cleanup.
Consolidate all class factories into a single implementation. Fixes a problem discovered by oleview.
This commit is contained in:
parent
2164502322
commit
595d6aa6fb
|
@ -85,13 +85,19 @@ static const char * captureStateString[] = {
|
||||||
"STATE_STOPPING"
|
"STATE_STOPPING"
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT DSOUND_CaptureCreate(
|
HRESULT DSOUND_CaptureCreate(
|
||||||
LPDIRECTSOUNDCAPTURE *ppDSC,
|
REFIID riid,
|
||||||
IUnknown *pUnkOuter)
|
LPDIRECTSOUNDCAPTURE *ppDSC)
|
||||||
{
|
{
|
||||||
LPDIRECTSOUNDCAPTURE pDSC;
|
LPDIRECTSOUNDCAPTURE pDSC;
|
||||||
HRESULT hr;
|
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 */
|
/* Get dsound configuration */
|
||||||
setup_dsound_options();
|
setup_dsound_options();
|
||||||
|
@ -108,13 +114,19 @@ static HRESULT DSOUND_CaptureCreate(
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT DSOUND_CaptureCreate8(
|
HRESULT DSOUND_CaptureCreate8(
|
||||||
LPDIRECTSOUNDCAPTURE8 *ppDSC8,
|
REFIID riid,
|
||||||
IUnknown *pUnkOuter)
|
LPDIRECTSOUNDCAPTURE8 *ppDSC8)
|
||||||
{
|
{
|
||||||
LPDIRECTSOUNDCAPTURE8 pDSC8;
|
LPDIRECTSOUNDCAPTURE8 pDSC8;
|
||||||
HRESULT hr;
|
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 */
|
/* Get dsound configuration */
|
||||||
setup_dsound_options();
|
setup_dsound_options();
|
||||||
|
@ -173,7 +185,7 @@ HRESULT WINAPI DirectSoundCaptureCreate(
|
||||||
return DSERR_NOAGGREGATION;
|
return DSERR_NOAGGREGATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = DSOUND_CaptureCreate(&pDSC, (IUnknown *)pUnkOuter);
|
hr = DSOUND_CaptureCreate(&IID_IDirectSoundCapture, &pDSC);
|
||||||
if (hr == DS_OK) {
|
if (hr == DS_OK) {
|
||||||
hr = IDirectSoundCapture_Initialize(pDSC, lpcGUID);
|
hr = IDirectSoundCapture_Initialize(pDSC, lpcGUID);
|
||||||
if (hr != DS_OK) {
|
if (hr != DS_OK) {
|
||||||
|
@ -229,7 +241,7 @@ HRESULT WINAPI DirectSoundCaptureCreate8(
|
||||||
return DSERR_NOAGGREGATION;
|
return DSERR_NOAGGREGATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = DSOUND_CaptureCreate8(&pDSC8, (IUnknown *)pUnkOuter);
|
hr = DSOUND_CaptureCreate8(&IID_IDirectSoundCapture8, &pDSC8);
|
||||||
if (hr == DS_OK) {
|
if (hr == DS_OK) {
|
||||||
hr = IDirectSoundCapture_Initialize(pDSC8, lpcGUID);
|
hr = IDirectSoundCapture_Initialize(pDSC8, lpcGUID);
|
||||||
if (hr != DS_OK) {
|
if (hr != DS_OK) {
|
||||||
|
@ -1694,80 +1706,3 @@ ULONG DirectSoundCaptureDevice_Release(
|
||||||
}
|
}
|
||||||
return ref;
|
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 };
|
|
||||||
|
|
|
@ -977,12 +977,18 @@ static HRESULT IDirectSound8_IDirectSound8_Create(
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT DSOUND_Create(
|
HRESULT DSOUND_Create(
|
||||||
LPDIRECTSOUND *ppDS,
|
REFIID riid,
|
||||||
IUnknown *pUnkOuter)
|
LPDIRECTSOUND *ppDS)
|
||||||
{
|
{
|
||||||
LPDIRECTSOUND8 pDS;
|
LPDIRECTSOUND8 pDS;
|
||||||
HRESULT hr;
|
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 */
|
/* Get dsound configuration */
|
||||||
setup_dsound_options();
|
setup_dsound_options();
|
||||||
|
@ -1040,7 +1046,7 @@ HRESULT WINAPI DirectSoundCreate(
|
||||||
return DSERR_INVALIDPARAM;
|
return DSERR_INVALIDPARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = DSOUND_Create(&pDS, pUnkOuter);
|
hr = DSOUND_Create(&IID_IDirectSound, &pDS);
|
||||||
if (hr == DS_OK) {
|
if (hr == DS_OK) {
|
||||||
hr = IDirectSound_Initialize(pDS, lpcGUID);
|
hr = IDirectSound_Initialize(pDS, lpcGUID);
|
||||||
if (hr != DS_OK) {
|
if (hr != DS_OK) {
|
||||||
|
@ -1058,12 +1064,18 @@ HRESULT WINAPI DirectSoundCreate(
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT DSOUND_Create8(
|
HRESULT DSOUND_Create8(
|
||||||
LPDIRECTSOUND8 *ppDS,
|
REFIID riid,
|
||||||
IUnknown *pUnkOuter)
|
LPDIRECTSOUND8 *ppDS)
|
||||||
{
|
{
|
||||||
LPDIRECTSOUND8 pDS;
|
LPDIRECTSOUND8 pDS;
|
||||||
HRESULT hr;
|
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 */
|
/* Get dsound configuration */
|
||||||
setup_dsound_options();
|
setup_dsound_options();
|
||||||
|
@ -1121,7 +1133,7 @@ HRESULT WINAPI DirectSoundCreate8(
|
||||||
return DSERR_INVALIDPARAM;
|
return DSERR_INVALIDPARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = DSOUND_Create8(&pDS, pUnkOuter);
|
hr = DSOUND_Create8(&IID_IDirectSound8, &pDS);
|
||||||
if (hr == DS_OK) {
|
if (hr == DS_OK) {
|
||||||
hr = IDirectSound8_Initialize(pDS, lpcGUID);
|
hr = IDirectSound8_Initialize(pDS, lpcGUID);
|
||||||
if (hr != DS_OK) {
|
if (hr != DS_OK) {
|
||||||
|
|
|
@ -426,12 +426,23 @@ HRESULT WINAPI DirectSoundEnumerateW(
|
||||||
* DirectSound ClassFactory
|
* DirectSound ClassFactory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static HRESULT WINAPI
|
typedef HRESULT (*FnCreateInstance)(REFIID riid, LPVOID *ppobj);
|
||||||
DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
typedef struct {
|
||||||
|
const IClassFactoryVtbl *lpVtbl;
|
||||||
|
LONG ref;
|
||||||
|
REFCLSID rclsid;
|
||||||
|
FnCreateInstance pfnCreateInstance;
|
||||||
|
} IClassFactoryImpl;
|
||||||
|
|
||||||
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
|
static HRESULT WINAPI
|
||||||
return E_NOINTERFACE;
|
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)
|
static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
|
||||||
|
@ -452,115 +463,50 @@ static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI DSCF_CreateInstance(
|
static HRESULT WINAPI DSCF_CreateInstance(
|
||||||
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
|
LPCLASSFACTORY iface,
|
||||||
) {
|
LPUNKNOWN pOuter,
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
REFIID riid,
|
||||||
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
|
LPVOID *ppobj)
|
||||||
|
{
|
||||||
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||||
|
TRACE("(%p, %p, %s, %p)\n", This, pOuter, debugstr_guid(riid), ppobj);
|
||||||
|
|
||||||
if (pOuter)
|
if (pOuter)
|
||||||
return CLASS_E_NOAGGREGATION;
|
return CLASS_E_NOAGGREGATION;
|
||||||
|
|
||||||
if (ppobj == NULL) {
|
if (ppobj == NULL) {
|
||||||
WARN("invalid parameter\n");
|
WARN("invalid parameter\n");
|
||||||
return DSERR_INVALIDPARAM;
|
return DSERR_INVALIDPARAM;
|
||||||
}
|
}
|
||||||
|
*ppobj = NULL;
|
||||||
*ppobj = NULL;
|
return This->pfnCreateInstance(riid, ppobj);
|
||||||
|
|
||||||
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) {
|
static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
{
|
||||||
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||||
return S_OK;
|
FIXME("(%p, %d) stub!\n", This, dolock);
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IClassFactoryVtbl DSCF_Vtbl = {
|
static const IClassFactoryVtbl DSCF_Vtbl = {
|
||||||
DSCF_QueryInterface,
|
DSCF_QueryInterface,
|
||||||
DSCF_AddRef,
|
DSCF_AddRef,
|
||||||
DSCF_Release,
|
DSCF_Release,
|
||||||
DSCF_CreateInstance,
|
DSCF_CreateInstance,
|
||||||
DSCF_LockServer
|
DSCF_LockServer
|
||||||
};
|
};
|
||||||
|
|
||||||
static IClassFactoryImpl DSOUND_CF = { &DSCF_Vtbl, 1 };
|
static IClassFactoryImpl DSOUND_CF[] = {
|
||||||
|
{ &DSCF_Vtbl, 1, &CLSID_DirectSound, (FnCreateInstance)DSOUND_Create },
|
||||||
/*******************************************************************************
|
{ &DSCF_Vtbl, 1, &CLSID_DirectSound8, (FnCreateInstance)DSOUND_Create8 },
|
||||||
* DirectSoundPrivate ClassFactory
|
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundCapture, (FnCreateInstance)DSOUND_CaptureCreate },
|
||||||
*/
|
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundCapture8, (FnCreateInstance)DSOUND_CaptureCreate8 },
|
||||||
|
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundFullDuplex, (FnCreateInstance)DSOUND_FullDuplexCreate },
|
||||||
static HRESULT WINAPI
|
{ &DSCF_Vtbl, 1, &CLSID_DirectSoundPrivate, (FnCreateInstance)IKsPrivatePropertySetImpl_Create },
|
||||||
DSPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
{ NULL, 0, NULL, NULL }
|
||||||
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_PRIVATE_CF = { &DSPCF_Vtbl, 1 };
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* DllGetClassObject [DSOUND.@]
|
* DllGetClassObject [DSOUND.@]
|
||||||
* Retrieves class object from a DLL object
|
* 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)
|
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) {
|
if (ppv == NULL) {
|
||||||
WARN("invalid parameter\n");
|
WARN("invalid parameter\n");
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ppv = NULL;
|
*ppv = NULL;
|
||||||
|
|
||||||
if ( IsEqualCLSID( &CLSID_DirectSound, rclsid ) ||
|
if (!IsEqualIID(riid, &IID_IClassFactory) &&
|
||||||
IsEqualCLSID( &CLSID_DirectSound8, rclsid ) ) {
|
!IsEqualIID(riid, &IID_IUnknown)) {
|
||||||
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
|
WARN("no interface for %s\n", debugstr_guid(riid));
|
||||||
*ppv = (LPVOID)&DSOUND_CF;
|
return E_NOINTERFACE;
|
||||||
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 ) ||
|
while (NULL != DSOUND_CF[i].rclsid) {
|
||||||
IsEqualCLSID( &CLSID_DirectSoundCapture8, rclsid ) ) {
|
if (IsEqualGUID(rclsid, DSOUND_CF[i].rclsid)) {
|
||||||
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
|
DSCF_AddRef((IClassFactory*) &DSOUND_CF[i]);
|
||||||
*ppv = (LPVOID)&DSOUND_CAPTURE_CF;
|
*ppv = &DSOUND_CF[i];
|
||||||
IClassFactory_AddRef((IClassFactory*)*ppv);
|
return S_OK;
|
||||||
return S_OK;
|
}
|
||||||
}
|
i++;
|
||||||
WARN("(%s,%s,%p): no interface found.\n",
|
|
||||||
debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( IsEqualCLSID( &CLSID_DirectSoundFullDuplex, rclsid ) ) {
|
WARN("(%s, %s, %p): no class found.\n", debugstr_guid(rclsid),
|
||||||
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
|
debugstr_guid(riid), ppv);
|
||||||
*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);
|
|
||||||
return CLASS_E_CLASSNOTAVAILABLE;
|
return CLASS_E_CLASSNOTAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,6 @@ typedef struct IKsBufferPropertySetImpl IKsBufferPropertySetImpl;
|
||||||
typedef struct IKsPrivatePropertySetImpl IKsPrivatePropertySetImpl;
|
typedef struct IKsPrivatePropertySetImpl IKsPrivatePropertySetImpl;
|
||||||
typedef struct PrimaryBufferImpl PrimaryBufferImpl;
|
typedef struct PrimaryBufferImpl PrimaryBufferImpl;
|
||||||
typedef struct SecondaryBufferImpl SecondaryBufferImpl;
|
typedef struct SecondaryBufferImpl SecondaryBufferImpl;
|
||||||
typedef struct IClassFactoryImpl IClassFactoryImpl;
|
|
||||||
typedef struct DirectSoundDevice DirectSoundDevice;
|
typedef struct DirectSoundDevice DirectSoundDevice;
|
||||||
typedef struct DirectSoundCaptureDevice DirectSoundCaptureDevice;
|
typedef struct DirectSoundCaptureDevice DirectSoundCaptureDevice;
|
||||||
|
|
||||||
|
@ -391,6 +390,7 @@ struct IKsPrivatePropertySetImpl
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT IKsPrivatePropertySetImpl_Create(
|
HRESULT IKsPrivatePropertySetImpl_Create(
|
||||||
|
REFIID riid,
|
||||||
IKsPrivatePropertySetImpl **piks);
|
IKsPrivatePropertySetImpl **piks);
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -411,26 +411,13 @@ HRESULT IDirectSound3DBufferImpl_Create(
|
||||||
HRESULT IDirectSound3DBufferImpl_Destroy(
|
HRESULT IDirectSound3DBufferImpl_Destroy(
|
||||||
IDirectSound3DBufferImpl *pds3db);
|
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 */
|
/* dsound.c */
|
||||||
|
|
||||||
HRESULT DSOUND_Create(LPDIRECTSOUND *ppDS, IUnknown *pUnkOuter);
|
HRESULT DSOUND_Create(REFIID riid, LPDIRECTSOUND *ppDS);
|
||||||
HRESULT DSOUND_Create8(LPDIRECTSOUND8 *ppDS, IUnknown *pUnkOuter);
|
HRESULT DSOUND_Create8(REFIID riid, LPDIRECTSOUND8 *ppDS);
|
||||||
|
|
||||||
/* primary.c */
|
/* primary.c */
|
||||||
|
|
||||||
|
@ -441,6 +428,10 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device);
|
||||||
HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LPDWORD writepos);
|
HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LPDWORD writepos);
|
||||||
HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex);
|
HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex);
|
||||||
|
|
||||||
|
/* duplex.c */
|
||||||
|
|
||||||
|
HRESULT DSOUND_FullDuplexCreate(REFIID riid, LPDIRECTSOUNDFULLDUPLEX* ppDSFD);
|
||||||
|
|
||||||
/* buffer.c */
|
/* buffer.c */
|
||||||
|
|
||||||
DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD pwrite);
|
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);
|
void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb);
|
||||||
|
|
||||||
/* capture.c */
|
/* capture.c */
|
||||||
|
|
||||||
|
HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC);
|
||||||
|
HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8);
|
||||||
HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(
|
HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(
|
||||||
LPDIRECTSOUNDCAPTURE iface,
|
LPDIRECTSOUNDCAPTURE iface,
|
||||||
LPCDSCBUFFERDESC lpcDSCBufferDesc,
|
LPCDSCBUFFERDESC lpcDSCBufferDesc,
|
||||||
|
|
|
@ -760,21 +760,24 @@ static const IDirectSoundFullDuplexVtbl dsfdvt =
|
||||||
IDirectSoundFullDuplexImpl_Initialize
|
IDirectSoundFullDuplexImpl_Initialize
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT DSOUND_FullDuplexCreate(LPDIRECTSOUNDFULLDUPLEX* ppDSFD, IUnknown *pUnkOuter)
|
HRESULT DSOUND_FullDuplexCreate(
|
||||||
|
REFIID riid,
|
||||||
|
LPDIRECTSOUNDFULLDUPLEX* ppDSFD)
|
||||||
{
|
{
|
||||||
IDirectSoundFullDuplexImpl *This = NULL;
|
IDirectSoundFullDuplexImpl *This = NULL;
|
||||||
|
TRACE("(%s, %p)\n", debugstr_guid(riid), ppDSFD);
|
||||||
if (pUnkOuter) {
|
|
||||||
WARN("pUnkOuter != 0\n");
|
|
||||||
*ppDSFD = NULL;
|
|
||||||
return DSERR_NOAGGREGATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ppDSFD == NULL) {
|
if (ppDSFD == NULL) {
|
||||||
WARN("invalid parameter: ppDSFD == NULL\n");
|
WARN("invalid parameter: ppDSFD == NULL\n");
|
||||||
return DSERR_INVALIDPARAM;
|
return DSERR_INVALIDPARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!IsEqualIID(riid, &IID_IUnknown) &&
|
||||||
|
!IsEqualIID(riid, &IID_IDirectSoundFullDuplex)) {
|
||||||
|
*ppDSFD = 0;
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get dsound configuration */
|
/* Get dsound configuration */
|
||||||
setup_dsound_options();
|
setup_dsound_options();
|
||||||
|
|
||||||
|
@ -907,79 +910,3 @@ DirectSoundFullDuplexCreate(
|
||||||
|
|
||||||
return hres;
|
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 };
|
|
||||||
|
|
|
@ -1504,9 +1504,17 @@ static const IKsPropertySetVtbl ikspvt = {
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT IKsPrivatePropertySetImpl_Create(
|
HRESULT IKsPrivatePropertySetImpl_Create(
|
||||||
|
REFIID riid,
|
||||||
IKsPrivatePropertySetImpl **piks)
|
IKsPrivatePropertySetImpl **piks)
|
||||||
{
|
{
|
||||||
IKsPrivatePropertySetImpl *iks;
|
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 = HeapAlloc(GetProcessHeap(),0,sizeof(*iks));
|
||||||
iks->ref = 1;
|
iks->ref = 1;
|
||||||
|
|
Loading…
Reference in New Issue