dmusic: Merge the IClassFactory implementations.
This commit is contained in:
parent
3ff39057d2
commit
0c4ec942ba
|
@ -31,106 +31,85 @@ static HINSTANCE instance;
|
||||||
LONG DMUSIC_refCount = 0;
|
LONG DMUSIC_refCount = 0;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const IClassFactoryVtbl *lpVtbl;
|
IClassFactory IClassFactory_iface;
|
||||||
|
HRESULT WINAPI (*fnCreateInstance)(REFIID riid, void **ppv, IUnknown *pUnkOuter);
|
||||||
} IClassFactoryImpl;
|
} IClassFactoryImpl;
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* DirectMusic ClassFactory
|
* IClassFactory implementation
|
||||||
*/
|
*/
|
||||||
static HRESULT WINAPI DirectMusicCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
|
||||||
FIXME("- no interface IID: %s\n", debugstr_guid(riid));
|
{
|
||||||
|
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
|
||||||
if (ppobj == NULL) return E_POINTER;
|
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI DirectMusicCF_AddRef(LPCLASSFACTORY iface) {
|
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
|
||||||
DMUSIC_LockModule();
|
{
|
||||||
|
if (ppv == NULL)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
return 2; /* non-heap based object */
|
if (IsEqualGUID(&IID_IUnknown, riid))
|
||||||
|
TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
|
||||||
|
else if (IsEqualGUID(&IID_IClassFactory, riid))
|
||||||
|
TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
|
||||||
|
else {
|
||||||
|
FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
|
||||||
|
*ppv = NULL;
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppv = iface;
|
||||||
|
IUnknown_AddRef((IUnknown*)*ppv);
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI DirectMusicCF_Release(LPCLASSFACTORY iface) {
|
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
|
||||||
DMUSIC_UnlockModule();
|
{
|
||||||
|
DMUSIC_LockModule();
|
||||||
|
|
||||||
return 1; /* non-heap based object */
|
return 2; /* non-heap based object */
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI DirectMusicCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
|
||||||
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
|
{
|
||||||
return DMUSIC_CreateDirectMusicImpl (riid, ppobj, pOuter);
|
DMUSIC_UnlockModule();
|
||||||
|
|
||||||
|
return 1; /* non-heap based object */
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI DirectMusicCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
|
||||||
TRACE("(%d)\n", dolock);
|
REFIID riid, void **ppv)
|
||||||
|
{
|
||||||
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||||
|
|
||||||
if (dolock)
|
TRACE ("(%p, %s, %p)\n", pUnkOuter, debugstr_dmguid(riid), ppv);
|
||||||
DMUSIC_LockModule();
|
|
||||||
else
|
return This->fnCreateInstance(riid, ppv, pUnkOuter);
|
||||||
DMUSIC_UnlockModule();
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IClassFactoryVtbl DirectMusicCF_Vtbl = {
|
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
|
||||||
DirectMusicCF_QueryInterface,
|
{
|
||||||
DirectMusicCF_AddRef,
|
TRACE("(%d)\n", dolock);
|
||||||
DirectMusicCF_Release,
|
|
||||||
DirectMusicCF_CreateInstance,
|
if (dolock)
|
||||||
DirectMusicCF_LockServer
|
DMUSIC_LockModule();
|
||||||
|
else
|
||||||
|
DMUSIC_UnlockModule();
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IClassFactoryVtbl classfactory_vtbl = {
|
||||||
|
ClassFactory_QueryInterface,
|
||||||
|
ClassFactory_AddRef,
|
||||||
|
ClassFactory_Release,
|
||||||
|
ClassFactory_CreateInstance,
|
||||||
|
ClassFactory_LockServer
|
||||||
};
|
};
|
||||||
|
|
||||||
static IClassFactoryImpl DirectMusic_CF = {&DirectMusicCF_Vtbl};
|
static IClassFactoryImpl DirectMusic_CF = {{&classfactory_vtbl}, DMUSIC_CreateDirectMusicImpl};
|
||||||
|
static IClassFactoryImpl Collection_CF = {{&classfactory_vtbl},
|
||||||
/******************************************************************
|
DMUSIC_CreateDirectMusicCollectionImpl};
|
||||||
* DirectMusicCollection ClassFactory
|
|
||||||
*/
|
|
||||||
static HRESULT WINAPI CollectionCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
|
||||||
FIXME("- no interface IID: %s\n", debugstr_guid(riid));
|
|
||||||
|
|
||||||
if (ppobj == NULL) return E_POINTER;
|
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI CollectionCF_AddRef(LPCLASSFACTORY iface) {
|
|
||||||
DMUSIC_LockModule();
|
|
||||||
|
|
||||||
return 2; /* non-heap based object */
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI CollectionCF_Release(LPCLASSFACTORY iface) {
|
|
||||||
DMUSIC_UnlockModule();
|
|
||||||
|
|
||||||
return 1; /* non-heap based object */
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI CollectionCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
|
||||||
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
|
|
||||||
return DMUSIC_CreateDirectMusicCollectionImpl (riid, ppobj, pOuter);
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI CollectionCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
|
||||||
TRACE("(%d)\n", dolock);
|
|
||||||
|
|
||||||
if (dolock)
|
|
||||||
DMUSIC_LockModule();
|
|
||||||
else
|
|
||||||
DMUSIC_UnlockModule();
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const IClassFactoryVtbl CollectionCF_Vtbl = {
|
|
||||||
CollectionCF_QueryInterface,
|
|
||||||
CollectionCF_AddRef,
|
|
||||||
CollectionCF_Release,
|
|
||||||
CollectionCF_CreateInstance,
|
|
||||||
CollectionCF_LockServer
|
|
||||||
};
|
|
||||||
|
|
||||||
static IClassFactoryImpl Collection_CF = {&CollectionCF_Vtbl};
|
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* DllMain
|
* DllMain
|
||||||
|
|
Loading…
Reference in New Issue