Properly implement DllCanUnloadNow ref counting.

This commit is contained in:
James Hawkins 2005-02-02 09:31:06 +00:00 committed by Alexandre Julliard
parent 3b38dc6864
commit 1727eb485e
18 changed files with 384 additions and 172 deletions

View File

@ -58,6 +58,8 @@ ULONG WINAPI IDirectMusicAudioPathImpl_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -65,12 +67,16 @@ ULONG WINAPI IDirectMusicAudioPathImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
if (This->pDSBuffer) {
IDirectSoundBuffer8_Release(This->pDSBuffer);
}
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -23,41 +23,49 @@
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
LONG DMIME_refCount = 0;
typedef struct {
/* IUnknown fields */
IClassFactoryVtbl *lpVtbl;
DWORD ref;
} IClassFactoryImpl;
/******************************************************************
* DirectMusicPerformance ClassFactory
*/
static HRESULT WINAPI PerformanceCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI PerformanceCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI PerformanceCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI PerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicPerformanceImpl (riid, ppobj, pOuter);
}
static HRESULT WINAPI PerformanceCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -69,37 +77,45 @@ static IClassFactoryVtbl PerformanceCF_Vtbl = {
PerformanceCF_LockServer
};
static IClassFactoryImpl Performance_CF = {&PerformanceCF_Vtbl, 1 };
static IClassFactoryImpl Performance_CF = {&PerformanceCF_Vtbl};
/******************************************************************
* DirectMusicSegment ClassFactory
*/
static HRESULT WINAPI SegmentCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI SegmentCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI SegmentCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI SegmentCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicSegmentImpl (riid, ppobj, pOuter);
}
static HRESULT WINAPI SegmentCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -111,37 +127,45 @@ static IClassFactoryVtbl SegmentCF_Vtbl = {
SegmentCF_LockServer
};
static IClassFactoryImpl Segment_CF = {&SegmentCF_Vtbl, 1 };
static IClassFactoryImpl Segment_CF = {&SegmentCF_Vtbl};
/******************************************************************
* DirectMusicSegmentState ClassFactory
*/
static HRESULT WINAPI SegmentStateCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI SegmentStateCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based objects */
}
static ULONG WINAPI SegmentStateCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI SegmentStateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicSegmentStateImpl (riid, ppobj, pOuter);
}
static HRESULT WINAPI SegmentStateCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -153,37 +177,45 @@ static IClassFactoryVtbl SegmentStateCF_Vtbl = {
SegmentStateCF_LockServer
};
static IClassFactoryImpl SegmentState_CF = {&SegmentStateCF_Vtbl, 1 };
static IClassFactoryImpl SegmentState_CF = {&SegmentStateCF_Vtbl};
/******************************************************************
* DirectMusicGraph ClassFactory
*/
static HRESULT WINAPI GraphCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI GraphCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI GraphCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI GraphCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicGraphImpl (riid, ppobj, pOuter);
}
static HRESULT WINAPI GraphCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -195,37 +227,45 @@ static IClassFactoryVtbl GraphCF_Vtbl = {
GraphCF_LockServer
};
static IClassFactoryImpl Graph_CF = {&GraphCF_Vtbl, 1 };
static IClassFactoryImpl Graph_CF = {&GraphCF_Vtbl};
/******************************************************************
* DirectMusicTempoTrack ClassFactory
*/
static HRESULT WINAPI TempoTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI TempoTrackCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI TempoTrackCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI TempoTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicTempoTrack (riid, ppobj, pOuter);
}
static HRESULT WINAPI TempoTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -237,37 +277,45 @@ static IClassFactoryVtbl TempoTrackCF_Vtbl = {
TempoTrackCF_LockServer
};
static IClassFactoryImpl TempoTrack_CF = {&TempoTrackCF_Vtbl, 1 };
static IClassFactoryImpl TempoTrack_CF = {&TempoTrackCF_Vtbl};
/******************************************************************
* DirectMusicSeqTrack ClassFactory
*/
static HRESULT WINAPI SeqTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI SeqTrackCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI SeqTrackCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI SeqTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicSeqTrack (riid, ppobj, pOuter);
}
static HRESULT WINAPI SeqTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -279,37 +327,44 @@ static IClassFactoryVtbl SeqTrackCF_Vtbl = {
SeqTrackCF_LockServer
};
static IClassFactoryImpl SeqTrack_CF = {&SeqTrackCF_Vtbl, 1 };
static IClassFactoryImpl SeqTrack_CF = {&SeqTrackCF_Vtbl};
/******************************************************************
* DirectMusicSysExTrack ClassFactory
*/
static HRESULT WINAPI SysExTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI SysExTrackCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI SysExTrackCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI SysExTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicSysExTrack (riid, ppobj, pOuter);
}
static HRESULT WINAPI SysExTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -321,37 +376,45 @@ static IClassFactoryVtbl SysExTrackCF_Vtbl = {
SysExTrackCF_LockServer
};
static IClassFactoryImpl SysExTrack_CF = {&SysExTrackCF_Vtbl, 1 };
static IClassFactoryImpl SysExTrack_CF = {&SysExTrackCF_Vtbl};
/******************************************************************
* DirectMusicTimeSigTrack ClassFactory
*/
static HRESULT WINAPI TimeSigTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI TimeSigTrackCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI TimeSigTrackCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI TimeSigTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicTimeSigTrack (riid, ppobj, pOuter);
}
static HRESULT WINAPI TimeSigTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -363,37 +426,45 @@ static IClassFactoryVtbl TimeSigTrackCF_Vtbl = {
TimeSigTrackCF_LockServer
};
static IClassFactoryImpl TimeSigTrack_CF = {&TimeSigTrackCF_Vtbl, 1 };
static IClassFactoryImpl TimeSigTrack_CF = {&TimeSigTrackCF_Vtbl};
/******************************************************************
* DirectMusicParamControlTrack ClassFactory
*/
static HRESULT WINAPI ParamControlTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI ParamControlTrackCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI ParamControlTrackCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI ParamControlTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicParamControlTrack (riid, ppobj, pOuter);
}
static HRESULT WINAPI ParamControlTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -405,37 +476,45 @@ static IClassFactoryVtbl ParamControlTrackCF_Vtbl = {
ParamControlTrackCF_LockServer
};
static IClassFactoryImpl ParamControlTrack_CF = {&ParamControlTrackCF_Vtbl, 1 };
static IClassFactoryImpl ParamControlTrack_CF = {&ParamControlTrackCF_Vtbl};
/******************************************************************
* DirectMusicMarkerTrack ClassFactory
*/
static HRESULT WINAPI MarkerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI MarkerTrackCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI MarkerTrackCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI MarkerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicMarkerTrack (riid, ppobj, pOuter);
}
static HRESULT WINAPI MarkerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -447,37 +526,45 @@ static IClassFactoryVtbl MarkerTrackCF_Vtbl = {
MarkerTrackCF_LockServer
};
static IClassFactoryImpl MarkerTrack_CF = {&MarkerTrackCF_Vtbl, 1 };
static IClassFactoryImpl MarkerTrack_CF = {&MarkerTrackCF_Vtbl};
/******************************************************************
* DirectMusicLyricsTrack ClassFactory
*/
static HRESULT WINAPI LyricsTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI LyricsTrackCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI LyricsTrackCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI LyricsTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicLyricsTrack (riid, ppobj, pOuter);
}
static HRESULT WINAPI LyricsTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -489,38 +576,46 @@ static IClassFactoryVtbl LyricsTrackCF_Vtbl = {
LyricsTrackCF_LockServer
};
static IClassFactoryImpl LyricsTrack_CF = {&LyricsTrackCF_Vtbl, 1 };
static IClassFactoryImpl LyricsTrack_CF = {&LyricsTrackCF_Vtbl};
/******************************************************************
* DirectMusicSegTriggerTrack ClassFactory
*/
static HRESULT WINAPI SegTriggerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI SegTriggerTrackCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI SegTriggerTrackCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI SegTriggerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicSegTriggerTrack (riid, ppobj, pOuter);
}
static HRESULT WINAPI SegTriggerTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -532,37 +627,45 @@ static IClassFactoryVtbl SegTriggerTrackCF_Vtbl = {
SegTriggerTrackCF_LockServer
};
static IClassFactoryImpl SegTriggerTrack_CF = {&SegTriggerTrackCF_Vtbl, 1 };
static IClassFactoryImpl SegTriggerTrack_CF = {&SegTriggerTrackCF_Vtbl};
/******************************************************************
* DirectMusicAudioPath ClassFactory
*/
static HRESULT WINAPI AudioPathCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI AudioPathCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI AudioPathCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI AudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicAudioPathImpl (riid, ppobj, pOuter);
}
static HRESULT WINAPI AudioPathCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -574,37 +677,45 @@ static IClassFactoryVtbl AudioPathCF_Vtbl = {
AudioPathCF_LockServer
};
static IClassFactoryImpl AudioPath_CF = {&AudioPathCF_Vtbl, 1 };
static IClassFactoryImpl AudioPath_CF = {&AudioPathCF_Vtbl};
/******************************************************************
* DirectMusicWaveTrack ClassFactory
*/
static HRESULT WINAPI WaveTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI WaveTrackCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return InterlockedIncrement(&This->ref);
DMIME_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI WaveTrackCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return InterlockedDecrement(&This->ref);
DMIME_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI WaveTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicWaveTrack (riid, ppobj, pOuter);
}
static HRESULT WINAPI WaveTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
FIXME("(%p, %d): stub\n", This, dolock);
TRACE("(%d)\n", dolock);
if (dolock)
DMIME_LockModule();
else
DMIME_UnlockModule();
return S_OK;
}
@ -616,7 +727,7 @@ static IClassFactoryVtbl WaveTrackCF_Vtbl = {
WaveTrackCF_LockServer
};
static IClassFactoryImpl WaveTrack_CF = {&WaveTrackCF_Vtbl, 1 };
static IClassFactoryImpl WaveTrack_CF = {&WaveTrackCF_Vtbl};
/******************************************************************
* DllMain
@ -642,8 +753,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
*
*/
HRESULT WINAPI DMIME_DllCanUnloadNow(void) {
FIXME("(void): stub\n");
return S_FALSE;
return DMIME_refCount != 0 ? S_FALSE : S_OK;
}

View File

@ -949,6 +949,12 @@ extern HRESULT WINAPI IDirectMusicWaveTrack_IPersistStream_Load (LPPERSISTSTREAM
extern HRESULT WINAPI IDirectMusicWaveTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty);
extern HRESULT WINAPI IDirectMusicWaveTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize);
/**********************************************************************
* Dll lifetime tracking declaration for dmime.dll
*/
extern LONG DMIME_refCount;
static inline void DMIME_LockModule() { InterlockedIncrement( &DMIME_refCount ); }
static inline void DMIME_UnlockModule() { InterlockedDecrement( &DMIME_refCount ); }
/*****************************************************************************
* Misc.

View File

@ -58,6 +58,8 @@ ULONG WINAPI IDirectMusicGraphImpl_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -65,9 +67,13 @@ ULONG WINAPI IDirectMusicGraphImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicLyricsTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -62,9 +64,13 @@ ULONG WINAPI IDirectMusicLyricsTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicLyricsTrack, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicMarkerTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -62,9 +64,13 @@ ULONG WINAPI IDirectMusicMarkerTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicMarkerTrack, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicParamControlTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -62,9 +64,13 @@ ULONG WINAPI IDirectMusicParamControlTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicParamControlTrack, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -43,6 +43,8 @@ ULONG WINAPI IDirectMusicPatternTrackImpl_AddRef (LPDIRECTMUSICPATTERNTRACK ifac
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -50,9 +52,13 @@ ULONG WINAPI IDirectMusicPatternTrackImpl_Release (LPDIRECTMUSICPATTERNTRACK ifa
IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -186,6 +186,8 @@ ULONG WINAPI IDirectMusicPerformance8Impl_AddRef (LPDIRECTMUSICPERFORMANCE8 ifac
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -193,10 +195,14 @@ ULONG WINAPI IDirectMusicPerformance8Impl_Release (LPDIRECTMUSICPERFORMANCE8 ifa
IDirectMusicPerformance8Impl *This = (IDirectMusicPerformance8Impl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
DeleteCriticalSection(&This->safe);
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -61,6 +61,8 @@ ULONG WINAPI IDirectMusicSegment8Impl_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -68,9 +70,13 @@ ULONG WINAPI IDirectMusicSegment8Impl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -43,6 +43,8 @@ ULONG WINAPI IDirectMusicSegmentState8Impl_AddRef (LPDIRECTMUSICSEGMENTSTATE8 if
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -50,9 +52,13 @@ ULONG WINAPI IDirectMusicSegmentState8Impl_Release (LPDIRECTMUSICSEGMENTSTATE8 i
IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -56,6 +56,8 @@ ULONG WINAPI IDirectMusicSegTriggerTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -63,9 +65,13 @@ ULONG WINAPI IDirectMusicSegTriggerTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicSeqTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -62,9 +64,13 @@ ULONG WINAPI IDirectMusicSeqTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicSeqTrack, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicSysExTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -62,9 +64,13 @@ ULONG WINAPI IDirectMusicSysExTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicSysExTrack, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -56,6 +56,8 @@ ULONG WINAPI IDirectMusicTempoTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -63,9 +65,13 @@ ULONG WINAPI IDirectMusicTempoTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicTimeSigTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -62,9 +64,13 @@ ULONG WINAPI IDirectMusicTimeSigTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicTimeSigTrack, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -42,6 +42,8 @@ ULONG WINAPI IDirectMusicTool8Impl_AddRef (LPDIRECTMUSICTOOL8 iface) {
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -49,9 +51,13 @@ ULONG WINAPI IDirectMusicTool8Impl_Release (LPDIRECTMUSICTOOL8 iface) {
IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}

View File

@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicWaveTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
DMIME_LockModule();
return ref;
}
@ -62,9 +64,13 @@ ULONG WINAPI IDirectMusicWaveTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicWaveTrack, UnknownVtbl, iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMIME_UnlockModule();
return ref;
}