Properly implement DllCanUnloadNow ref counting.
This commit is contained in:
parent
932a65dddc
commit
7946edf27a
|
@ -60,6 +60,8 @@ ULONG WINAPI IDirectMusicBandImpl_IUnknown_AddRef (LPUNKNOWN iface) {
|
||||||
|
|
||||||
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
|
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
|
||||||
|
|
||||||
|
DMBAND_LockModule();
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +74,9 @@ ULONG WINAPI IDirectMusicBandImpl_IUnknown_Release (LPUNKNOWN iface) {
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DMBAND_UnlockModule();
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicBandTrack_IUnknown_AddRef (LPUNKNOWN iface) {
|
||||||
|
|
||||||
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
|
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
|
||||||
|
|
||||||
|
DMBAND_LockModule();
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +69,9 @@ ULONG WINAPI IDirectMusicBandTrack_IUnknown_Release (LPUNKNOWN iface) {
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DMBAND_UnlockModule();
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dmband);
|
WINE_DEFAULT_DEBUG_CHANNEL(dmband);
|
||||||
|
|
||||||
|
LONG DMBAND_refCount = 0;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* IUnknown fields */
|
|
||||||
IClassFactoryVtbl *lpVtbl;
|
IClassFactoryVtbl *lpVtbl;
|
||||||
DWORD ref;
|
|
||||||
} IClassFactoryImpl;
|
} IClassFactoryImpl;
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
|
@ -32,31 +32,39 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static HRESULT WINAPI BandCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
static HRESULT WINAPI BandCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
|
||||||
FIXME("(%p, %s, %p): stub\n",This, debugstr_dmguid(riid), ppobj);
|
|
||||||
|
if (ppobj == NULL) return E_POINTER;
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI BandCF_AddRef(LPCLASSFACTORY iface) {
|
static ULONG WINAPI BandCF_AddRef(LPCLASSFACTORY iface) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
DMBAND_LockModule();
|
||||||
return InterlockedIncrement(&This->ref);
|
|
||||||
|
return 2; /* non-heap based object */
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI BandCF_Release(LPCLASSFACTORY iface) {
|
static ULONG WINAPI BandCF_Release(LPCLASSFACTORY iface) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
DMBAND_UnlockModule();
|
||||||
/* static class, won't be freed */
|
|
||||||
return InterlockedDecrement(&This->ref);
|
return 1; /* non-heap based object */
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI BandCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
static HRESULT WINAPI BandCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
|
||||||
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
|
|
||||||
return DMUSIC_CreateDirectMusicBandImpl (riid, ppobj, pOuter);
|
return DMUSIC_CreateDirectMusicBandImpl (riid, ppobj, pOuter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI BandCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
static HRESULT WINAPI BandCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
TRACE("(%d)\n", dolock);
|
||||||
FIXME("(%p, %d): stub\n", This, dolock);
|
|
||||||
|
if (dolock)
|
||||||
|
DMBAND_LockModule();
|
||||||
|
else
|
||||||
|
DMBAND_UnlockModule();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +76,7 @@ static IClassFactoryVtbl BandCF_Vtbl = {
|
||||||
BandCF_LockServer
|
BandCF_LockServer
|
||||||
};
|
};
|
||||||
|
|
||||||
static IClassFactoryImpl Band_CF = {&BandCF_Vtbl, 1 };
|
static IClassFactoryImpl Band_CF = {&BandCF_Vtbl};
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
|
@ -76,32 +84,39 @@ static IClassFactoryImpl Band_CF = {&BandCF_Vtbl, 1 };
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static HRESULT WINAPI BandTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
static HRESULT WINAPI BandTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
|
||||||
|
|
||||||
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
|
if (ppobj == NULL) return E_POINTER;
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI BandTrackCF_AddRef(LPCLASSFACTORY iface) {
|
static ULONG WINAPI BandTrackCF_AddRef(LPCLASSFACTORY iface) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
DMBAND_LockModule();
|
||||||
return InterlockedIncrement(&This->ref);
|
|
||||||
|
return 2; /* non-heap based object */
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI BandTrackCF_Release(LPCLASSFACTORY iface) {
|
static ULONG WINAPI BandTrackCF_Release(LPCLASSFACTORY iface) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
DMBAND_UnlockModule();
|
||||||
/* static class, won't be freed */
|
|
||||||
return InterlockedDecrement(&This->ref);
|
return 1; /* non-heap based object */
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI BandTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
static HRESULT WINAPI BandTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
|
||||||
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
|
|
||||||
return DMUSIC_CreateDirectMusicBandTrack (riid, ppobj, pOuter);
|
return DMUSIC_CreateDirectMusicBandTrack (riid, ppobj, pOuter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI BandTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
static HRESULT WINAPI BandTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
TRACE("(%d)\n", dolock);
|
||||||
FIXME("(%p, %d): stub\n", This, dolock);
|
|
||||||
|
if (dolock)
|
||||||
|
DMBAND_LockModule();
|
||||||
|
else
|
||||||
|
DMBAND_UnlockModule();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +128,7 @@ static IClassFactoryVtbl BandTrackCF_Vtbl = {
|
||||||
BandTrackCF_LockServer
|
BandTrackCF_LockServer
|
||||||
};
|
};
|
||||||
|
|
||||||
static IClassFactoryImpl BandTrack_CF = {&BandTrackCF_Vtbl, 1 };
|
static IClassFactoryImpl BandTrack_CF = {&BandTrackCF_Vtbl};
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* DllMain
|
* DllMain
|
||||||
|
@ -138,8 +153,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI DMBAND_DllCanUnloadNow(void) {
|
HRESULT WINAPI DMBAND_DllCanUnloadNow(void) {
|
||||||
FIXME("(void): stub\n");
|
return DMBAND_refCount != 0 ? S_FALSE : S_OK;
|
||||||
return S_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -192,6 +192,12 @@ extern HRESULT WINAPI IDirectMusicBandTrack_IPersistStream_Load (LPPERSISTSTREAM
|
||||||
extern HRESULT WINAPI IDirectMusicBandTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty);
|
extern HRESULT WINAPI IDirectMusicBandTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty);
|
||||||
extern HRESULT WINAPI IDirectMusicBandTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize);
|
extern HRESULT WINAPI IDirectMusicBandTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize);
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* Dll lifetime tracking declaration for dmband.dll
|
||||||
|
*/
|
||||||
|
extern LONG DMBAND_refCount;
|
||||||
|
static inline void DMBAND_LockModule() { InterlockedIncrement( &DMBAND_refCount ); }
|
||||||
|
static inline void DMBAND_UnlockModule() { InterlockedDecrement( &DMBAND_refCount ); }
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Misc.
|
* Misc.
|
||||||
|
|
|
@ -23,41 +23,48 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
|
WINE_DEFAULT_DEBUG_CHANNEL(dmsynth);
|
||||||
|
|
||||||
|
LONG DMSYNTH_refCount = 0;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* IUnknown fields */
|
|
||||||
IClassFactoryVtbl *lpVtbl;
|
IClassFactoryVtbl *lpVtbl;
|
||||||
DWORD ref;
|
|
||||||
} IClassFactoryImpl;
|
} IClassFactoryImpl;
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* DirectMusicSynth ClassFactory
|
* DirectMusicSynth ClassFactory
|
||||||
*/
|
*/
|
||||||
static HRESULT WINAPI SynthCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
static HRESULT WINAPI SynthCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
|
||||||
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
|
|
||||||
|
if (ppobj == NULL) return E_POINTER;
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI SynthCF_AddRef(LPCLASSFACTORY iface) {
|
static ULONG WINAPI SynthCF_AddRef(LPCLASSFACTORY iface) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
DMSYNTH_LockModule();
|
||||||
return InterlockedIncrement(&This->ref);
|
|
||||||
|
return 2; /* non-heap based object */
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI SynthCF_Release(LPCLASSFACTORY iface) {
|
static ULONG WINAPI SynthCF_Release(LPCLASSFACTORY iface) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
DMSYNTH_UnlockModule();
|
||||||
/* static class, won't be freed */
|
|
||||||
return InterlockedDecrement(&This->ref);
|
return 1; /* non-heap based object */
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SynthCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
static HRESULT WINAPI SynthCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
|
||||||
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
|
|
||||||
return DMUSIC_CreateDirectMusicSynthImpl (riid, ppobj, pOuter);
|
return DMUSIC_CreateDirectMusicSynthImpl (riid, ppobj, pOuter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SynthCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
static HRESULT WINAPI SynthCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
TRACE("(%d)\n", dolock);
|
||||||
FIXME("(%p, %d): stub\n", This, dolock);
|
|
||||||
|
if (dolock)
|
||||||
|
DMSYNTH_LockModule();
|
||||||
|
else
|
||||||
|
DMSYNTH_UnlockModule();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,37 +76,44 @@ static IClassFactoryVtbl SynthCF_Vtbl = {
|
||||||
SynthCF_LockServer
|
SynthCF_LockServer
|
||||||
};
|
};
|
||||||
|
|
||||||
static IClassFactoryImpl Synth_CF = {&SynthCF_Vtbl, 1 };
|
static IClassFactoryImpl Synth_CF = {&SynthCF_Vtbl};
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* DirectMusicSynthSink ClassFactory
|
* DirectMusicSynthSink ClassFactory
|
||||||
*/
|
*/
|
||||||
static HRESULT WINAPI SynthSinkCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
static HRESULT WINAPI SynthSinkCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
|
||||||
FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj);
|
|
||||||
|
if (ppobj == NULL) return E_POINTER;
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI SynthSinkCF_AddRef(LPCLASSFACTORY iface) {
|
static ULONG WINAPI SynthSinkCF_AddRef(LPCLASSFACTORY iface) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
DMSYNTH_LockModule();
|
||||||
return InterlockedIncrement(&This->ref);
|
|
||||||
|
return 2; /* non-heap based object */
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI SynthSinkCF_Release(LPCLASSFACTORY iface) {
|
static ULONG WINAPI SynthSinkCF_Release(LPCLASSFACTORY iface) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
DMSYNTH_UnlockModule();
|
||||||
/* static class, won't be freed */
|
|
||||||
return InterlockedDecrement(&This->ref);
|
return 1; /* non-heap based object */
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SynthSinkCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
static HRESULT WINAPI SynthSinkCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
|
||||||
TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj);
|
|
||||||
return DMUSIC_CreateDirectMusicSynthSinkImpl (riid, ppobj, pOuter);
|
return DMUSIC_CreateDirectMusicSynthSinkImpl (riid, ppobj, pOuter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SynthSinkCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
static HRESULT WINAPI SynthSinkCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
TRACE("(%d)\n", dolock);
|
||||||
FIXME("(%p, %d): stub\n", This, dolock);
|
|
||||||
|
if (dolock)
|
||||||
|
DMSYNTH_LockModule();
|
||||||
|
else
|
||||||
|
DMSYNTH_UnlockModule();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +125,7 @@ static IClassFactoryVtbl SynthSinkCF_Vtbl = {
|
||||||
SynthSinkCF_LockServer
|
SynthSinkCF_LockServer
|
||||||
};
|
};
|
||||||
|
|
||||||
static IClassFactoryImpl SynthSink_CF = {&SynthSinkCF_Vtbl, 1 };
|
static IClassFactoryImpl SynthSink_CF = {&SynthSinkCF_Vtbl};
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* DllMain
|
* DllMain
|
||||||
|
@ -136,8 +150,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI DMSYNTH_DllCanUnloadNow(void) {
|
HRESULT WINAPI DMSYNTH_DllCanUnloadNow(void) {
|
||||||
FIXME("(void): stub\n");
|
return DMSYNTH_refCount != 0 ? S_FALSE : S_OK;
|
||||||
return S_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,12 @@ extern HRESULT WINAPI IDirectMusicSynthSinkImpl_RefTimeToSample (LPDIRECTMUSICSY
|
||||||
extern HRESULT WINAPI IDirectMusicSynthSinkImpl_SetDirectSound (LPDIRECTMUSICSYNTHSINK iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer);
|
extern HRESULT WINAPI IDirectMusicSynthSinkImpl_SetDirectSound (LPDIRECTMUSICSYNTHSINK iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer);
|
||||||
extern HRESULT WINAPI IDirectMusicSynthSinkImpl_GetDesiredBufferSize (LPDIRECTMUSICSYNTHSINK iface, LPDWORD pdwBufferSizeInSamples);
|
extern HRESULT WINAPI IDirectMusicSynthSinkImpl_GetDesiredBufferSize (LPDIRECTMUSICSYNTHSINK iface, LPDWORD pdwBufferSizeInSamples);
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* Dll lifetime tracking declaration for dmsynth.dll
|
||||||
|
*/
|
||||||
|
extern LONG DMSYNTH_refCount;
|
||||||
|
static inline void DMSYNTH_LockModule() { InterlockedIncrement( &DMSYNTH_refCount ); }
|
||||||
|
static inline void DMSYNTH_UnlockModule() { InterlockedDecrement( &DMSYNTH_refCount ); }
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Misc.
|
* Misc.
|
||||||
|
|
|
@ -43,6 +43,8 @@ ULONG WINAPI IDirectMusicSynth8Impl_AddRef (LPDIRECTMUSICSYNTH8 iface) {
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
|
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
|
||||||
|
|
||||||
|
DMSYNTH_LockModule();
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +57,9 @@ ULONG WINAPI IDirectMusicSynth8Impl_Release (LPDIRECTMUSICSYNTH8 iface) {
|
||||||
if (!refCount) {
|
if (!refCount) {
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DMSYNTH_UnlockModule();
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ ULONG WINAPI IDirectMusicSynthSinkImpl_AddRef (LPDIRECTMUSICSYNTHSINK iface) {
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
|
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
|
||||||
|
|
||||||
|
DMSYNTH_LockModule();
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +56,9 @@ ULONG WINAPI IDirectMusicSynthSinkImpl_Release (LPDIRECTMUSICSYNTHSINK iface) {
|
||||||
if (!refCount) {
|
if (!refCount) {
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DMSYNTH_UnlockModule();
|
||||||
|
|
||||||
return refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue