- Use Interlocked* instead of ++/-- in AddRef/Release.

- Use only stored result of Interlocked* in AddRef/Release.
- Expand TRACEs to display the ref count.
This commit is contained in:
James Hawkins 2005-01-14 16:02:20 +00:00 committed by Alexandre Julliard
parent 516a9c70ed
commit ba92d2924a
48 changed files with 480 additions and 315 deletions

View File

@ -40,13 +40,13 @@ static HRESULT WINAPI SynthCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LP
static ULONG WINAPI SynthCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI SynthCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return --(This->ref);
return InterlockedDecrement(&This->ref);
}
static HRESULT WINAPI SynthCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
@ -82,13 +82,13 @@ static HRESULT WINAPI SynthSinkCF_QueryInterface(LPCLASSFACTORY iface,REFIID rii
static ULONG WINAPI SynthSinkCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI SynthSinkCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return --(This->ref);
return InterlockedDecrement(&This->ref);
}
static HRESULT WINAPI SynthSinkCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {

View File

@ -39,18 +39,23 @@ HRESULT WINAPI IDirectMusicSynth8Impl_QueryInterface (LPDIRECTMUSICSYNTH8 iface,
ULONG WINAPI IDirectMusicSynth8Impl_AddRef (LPDIRECTMUSICSYNTH8 iface) {
IDirectMusicSynth8Impl *This = (IDirectMusicSynth8Impl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicSynth8Impl_Release (LPDIRECTMUSICSYNTH8 iface) {
IDirectMusicSynth8Impl *This = (IDirectMusicSynth8Impl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectMusicSynth8Impl IDirectMusicSynth part: */

View File

@ -38,18 +38,23 @@ HRESULT WINAPI IDirectMusicSynthSinkImpl_QueryInterface (LPDIRECTMUSICSYNTHSINK
ULONG WINAPI IDirectMusicSynthSinkImpl_AddRef (LPDIRECTMUSICSYNTHSINK iface) {
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicSynthSinkImpl_Release (LPDIRECTMUSICSYNTHSINK iface) {
IDirectMusicSynthSinkImpl *This = (IDirectMusicSynthSinkImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectMusicSynthSinkImpl IDirectMusicSynthSink part: */

View File

@ -37,18 +37,23 @@ HRESULT WINAPI IDirectMusicBufferImpl_QueryInterface (LPDIRECTMUSICBUFFER iface,
ULONG WINAPI IDirectMusicBufferImpl_AddRef (LPDIRECTMUSICBUFFER iface) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicBufferImpl_Release (LPDIRECTMUSICBUFFER iface) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectMusicBufferImpl IDirectMusicBuffer part: */

View File

@ -38,18 +38,23 @@ HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface, REFII
ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IReferenceClockImpl IReferenceClock part: */

View File

@ -54,18 +54,23 @@ HRESULT WINAPI IDirectMusicCollectionImpl_IUnknown_QueryInterface (LPUNKNOWN ifa
ULONG WINAPI IDirectMusicCollectionImpl_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, UnknownVtbl, iface);
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicCollectionImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, UnknownVtbl, iface);
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
IUnknownVtbl DirectMusicCollection_Unknown_Vtbl = {

View File

@ -40,18 +40,23 @@ HRESULT WINAPI IDirectMusic8Impl_QueryInterface (LPDIRECTMUSIC8 iface, REFIID ri
ULONG WINAPI IDirectMusic8Impl_AddRef (LPDIRECTMUSIC8 iface) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusic8Impl_Release (LPDIRECTMUSIC8 iface) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectMusic8Impl IDirectMusic part: */

View File

@ -40,13 +40,13 @@ static HRESULT WINAPI DirectMusicCF_QueryInterface(LPCLASSFACTORY iface,REFIID r
static ULONG WINAPI DirectMusicCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI DirectMusicCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return --(This->ref);
return InterlockedDecrement(&This->ref);
}
static HRESULT WINAPI DirectMusicCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
@ -82,13 +82,13 @@ static HRESULT WINAPI CollectionCF_QueryInterface(LPCLASSFACTORY iface,REFIID ri
static ULONG WINAPI CollectionCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI CollectionCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return --(This->ref);
return InterlockedDecrement(&This->ref);
}
static HRESULT WINAPI CollectionCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {

View File

@ -38,18 +38,23 @@ HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface (LPDIRECTMUSICDOWNLOAD if
ULONG WINAPI IDirectMusicDownloadImpl_AddRef (LPDIRECTMUSICDOWNLOAD iface) {
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicDownloadImpl_Release (LPDIRECTMUSICDOWNLOAD iface) {
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectMusicDownloadImpl IDirectMusicDownload part: */

View File

@ -38,18 +38,23 @@ HRESULT WINAPI IDirectMusicDownloadedInstrumentImpl_QueryInterface (LPDIRECTMUSI
ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_AddRef (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface) {
IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_Release (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface) {
IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrument part: */

View File

@ -54,18 +54,23 @@ HRESULT WINAPI IDirectMusicInstrumentImpl_IUnknown_QueryInterface (LPUNKNOWN ifa
ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
IUnknownVtbl DirectMusicInstrument_Unknown_Vtbl = {

View File

@ -37,18 +37,23 @@ HRESULT WINAPI IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT iface, REF
ULONG WINAPI IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface) {
IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectMusicPortImpl IDirectMusicPort part: */

View File

@ -37,18 +37,23 @@ HRESULT WINAPI IDirectMusicPortDownloadImpl_QueryInterface (LPDIRECTMUSICPORTDOW
ULONG WINAPI IDirectMusicPortDownloadImpl_AddRef (LPDIRECTMUSICPORTDOWNLOAD iface) {
IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicPortDownloadImpl_Release (LPDIRECTMUSICPORTDOWNLOAD iface) {
IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectMusicPortDownload Interface follow: */

View File

@ -38,18 +38,23 @@ HRESULT WINAPI IDirectMusicThruImpl_QueryInterface (LPDIRECTMUSICTHRU iface, REF
ULONG WINAPI IDirectMusicThruImpl_AddRef (LPDIRECTMUSICTHRU iface) {
IDirectMusicThruImpl *This = (IDirectMusicThruImpl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicThruImpl_Release (LPDIRECTMUSICTHRU iface) {
IDirectMusicThruImpl *This = (IDirectMusicThruImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectMusicThru Interface follow: */

View File

@ -54,18 +54,23 @@ HRESULT WINAPI IDirectPlay8AddressImpl_QueryInterface(PDIRECTPLAY8ADDRESS iface,
ULONG WINAPI IDirectPlay8AddressImpl_AddRef(PDIRECTPLAY8ADDRESS iface) {
IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
TRACE("(%p) : AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectPlay8AddressImpl_Release(PDIRECTPLAY8ADDRESS iface) {
IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectPlay8Address Interface follow: */

View File

@ -54,18 +54,23 @@ HRESULT WINAPI IDirectPlay8ClientImpl_QueryInterface(PDIRECTPLAY8CLIENT iface, R
ULONG WINAPI IDirectPlay8ClientImpl_AddRef(PDIRECTPLAY8CLIENT iface) {
IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
TRACE("(%p) : AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectPlay8ClientImpl_Release(PDIRECTPLAY8CLIENT iface) {
IDirectPlay8ClientImpl *This = (IDirectPlay8ClientImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDirectPlay8Client Interface follow: */

View File

@ -64,18 +64,23 @@ HRESULT WINAPI IDirectMusicWaveImpl_IUnknown_QueryInterface (LPUNKNOWN iface, RE
ULONG WINAPI IDirectMusicWaveImpl_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicWaveImpl, UnknownVtbl, iface);
TRACE("(%p): AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDirectMusicWaveImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicWaveImpl, UnknownVtbl, iface);
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
IUnknownVtbl DirectMusicWave_Unknown_Vtbl = {

View File

@ -40,13 +40,13 @@ static HRESULT WINAPI WaveCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPV
static ULONG WINAPI WaveCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI WaveCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */
return --(This->ref);
return InterlockedDecrement(&This->ref);
}
static HRESULT WINAPI WaveCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {

View File

@ -44,18 +44,23 @@ HRESULT WINAPI IDxDiagContainerImpl_QueryInterface(PDXDIAGCONTAINER iface, REFII
ULONG WINAPI IDxDiagContainerImpl_AddRef(PDXDIAGCONTAINER iface) {
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
TRACE("(%p) : AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDxDiagContainerImpl_Release(PDXDIAGCONTAINER iface) {
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDxDiagContainer Interface follow: */

View File

@ -43,18 +43,23 @@ HRESULT WINAPI IDxDiagProviderImpl_QueryInterface(PDXDIAGPROVIDER iface, REFIID
ULONG WINAPI IDxDiagProviderImpl_AddRef(PDXDIAGPROVIDER iface) {
IDxDiagProviderImpl *This = (IDxDiagProviderImpl *)iface;
TRACE("(%p) : AddRef from %ld\n", This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
ULONG WINAPI IDxDiagProviderImpl_Release(PDXDIAGPROVIDER iface) {
IDxDiagProviderImpl *This = (IDxDiagProviderImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
return refCount;
}
/* IDxDiagProvider Interface follow: */

View File

@ -383,7 +383,7 @@ lerr:
static ULONG WINAPI IEnumDMO_fnAddRef(IEnumDMO * iface)
{
IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
@ -420,15 +420,14 @@ static HRESULT WINAPI IEnumDMO_fnQueryInterface(
static ULONG WINAPI IEnumDMO_fnRelease(IEnumDMO * iface)
{
IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
if (!--(This->ref))
if (!refCount)
{
IEnumDMO_Destructor((IEnumDMO*)This);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}

View File

@ -196,8 +196,11 @@ static HRESULT WINAPI ConnectionPointImpl_QueryInterface(
static ULONG WINAPI ConnectionPointImpl_AddRef(IConnectionPoint* iface)
{
ConnectionPointImpl *This = (ConnectionPointImpl *)iface;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
return InterlockedIncrement(&This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount - 1);
return refCount;
}
/************************************************************************
@ -209,20 +212,16 @@ static ULONG WINAPI ConnectionPointImpl_Release(
IConnectionPoint* iface)
{
ConnectionPointImpl *This = (ConnectionPointImpl *)iface;
ULONG ref;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
ULONG refCount = InterlockedDecrement(&This->ref);
/*
* Decrease the reference count on this object.
*/
ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount + 1);
/*
* If the reference count goes down to 0, perform suicide.
*/
if (ref == 0) ConnectionPointImpl_Destroy(This);
if (!refCount) ConnectionPointImpl_Destroy(This);
return ref;
return refCount;
}
/************************************************************************
@ -470,11 +469,12 @@ static HRESULT WINAPI EnumConnectionsImpl_QueryInterface(
static ULONG WINAPI EnumConnectionsImpl_AddRef(IEnumConnections* iface)
{
EnumConnectionsImpl *This = (EnumConnectionsImpl *)iface;
ULONG ref;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
ref = InterlockedIncrement(&This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount - 1);
IUnknown_AddRef(This->pUnk);
return ref;
return refCount;
}
/************************************************************************
@ -485,22 +485,18 @@ static ULONG WINAPI EnumConnectionsImpl_AddRef(IEnumConnections* iface)
static ULONG WINAPI EnumConnectionsImpl_Release(IEnumConnections* iface)
{
EnumConnectionsImpl *This = (EnumConnectionsImpl *)iface;
ULONG ref;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount + 1);
IUnknown_Release(This->pUnk);
/*
* Decrease the reference count on this object.
*/
ref = InterlockedDecrement(&This->ref);
/*
* If the reference count goes down to 0, perform suicide.
*/
if (ref == 0) EnumConnectionsImpl_Destroy(This);
if (!refCount) EnumConnectionsImpl_Destroy(This);
return ref;
return refCount;
}
/************************************************************************

View File

@ -256,9 +256,11 @@ static HRESULT WINAPI StdDispatch_QueryInterface(
static ULONG WINAPI StdDispatch_AddRef(LPDISPATCH iface)
{
StdDispatch *This = (StdDispatch *)iface;
TRACE("()\n");
ULONG refCount = InterlockedIncrement(&This->ref);
return InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
return refCount;
}
/******************************************************************************
@ -269,18 +271,17 @@ static ULONG WINAPI StdDispatch_AddRef(LPDISPATCH iface)
static ULONG WINAPI StdDispatch_Release(LPDISPATCH iface)
{
StdDispatch *This = (StdDispatch *)iface;
ULONG ref;
TRACE("(%p)->()\n", This);
ULONG refCount = InterlockedDecrement(&This->ref);
ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
if (ref == 0)
if (!refCount)
{
ITypeInfo_Release(This->pTypeInfo);
CoTaskMemFree(This);
}
return ref;
return refCount;
}
/******************************************************************************

View File

@ -409,8 +409,11 @@ static ULONG WINAPI OLEPictureImpl_AddRef(
IPicture* iface)
{
OLEPictureImpl *This = (OLEPictureImpl *)iface;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
return InterlockedIncrement(&This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount - 1);
return refCount;
}
/************************************************************************
@ -422,20 +425,16 @@ static ULONG WINAPI OLEPictureImpl_Release(
IPicture* iface)
{
OLEPictureImpl *This = (OLEPictureImpl *)iface;
ULONG ret;
TRACE("(%p)->(ref=%ld)\n", This, This->ref);
ULONG refCount = InterlockedDecrement(&This->ref);
/*
* Decrease the reference count on this object.
*/
ret = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%ld)\n", This, refCount + 1);
/*
* If the reference count goes down to 0, perform suicide.
*/
if (ret==0) OLEPictureImpl_Destroy(This);
if (!refCount) OLEPictureImpl_Destroy(This);
return ret;
return refCount;
}

View File

@ -336,29 +336,29 @@ static ULONG WINAPI
TMProxyImpl_AddRef(LPRPCPROXYBUFFER iface)
{
ICOM_THIS_MULTI(TMProxyImpl,lpvtbl2,iface);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("()\n");
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
return InterlockedIncrement(&This->ref);
return refCount;
}
static ULONG WINAPI
TMProxyImpl_Release(LPRPCPROXYBUFFER iface)
{
ULONG refs;
ICOM_THIS_MULTI(TMProxyImpl,lpvtbl2,iface);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("()\n");
TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
refs = InterlockedDecrement(&This->ref);
if (!refs)
if (!refCount)
{
DeleteCriticalSection(&This->crit);
if (This->chanbuf) IRpcChannelBuffer_Release(This->chanbuf);
VirtualFree(This->asmstubs, 0, MEM_RELEASE);
CoTaskMemFree(This);
}
return refs;
return refCount;
}
static HRESULT WINAPI
@ -1505,27 +1505,27 @@ static ULONG WINAPI
TMStubImpl_AddRef(LPRPCSTUBBUFFER iface)
{
TMStubImpl *This = (TMStubImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p) before %lu\n", This, This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return InterlockedIncrement(&This->ref);
return refCount;
}
static ULONG WINAPI
TMStubImpl_Release(LPRPCSTUBBUFFER iface)
{
ULONG refs;
TMStubImpl *This = (TMStubImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p) after %lu\n", This, This->ref-1);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
refs = InterlockedDecrement(&This->ref);
if (!refs)
if (!refCount)
{
IRpcStubBuffer_Disconnect(iface);
CoTaskMemFree(This);
}
return refs;
return refCount;
}
static HRESULT WINAPI

View File

@ -47,18 +47,22 @@ static HRESULT WINAPI WBPCI_QueryInterface(LPPROVIDECLASSINFO iface,
static ULONG WINAPI WBPCI_AddRef(LPPROVIDECLASSINFO iface)
{
IProvideClassInfoImpl *This = (IProvideClassInfoImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI WBPCI_Release(LPPROVIDECLASSINFO iface)
{
IProvideClassInfoImpl *This = (IProvideClassInfoImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
/* Return an ITypeInfo interface to retrieve type library info about
@ -102,18 +106,22 @@ static HRESULT WINAPI WBPCI2_QueryInterface(LPPROVIDECLASSINFO2 iface,
static ULONG WINAPI WBPCI2_AddRef(LPPROVIDECLASSINFO2 iface)
{
IProvideClassInfo2Impl *This = (IProvideClassInfo2Impl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI WBPCI2_Release(LPPROVIDECLASSINFO2 iface)
{
IProvideClassInfo2Impl *This = (IProvideClassInfo2Impl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
/* Return an ITypeInfo interface to retrieve type library info about

View File

@ -47,18 +47,22 @@ static HRESULT WINAPI WBCPC_QueryInterface(LPCONNECTIONPOINTCONTAINER iface,
static ULONG WINAPI WBCPC_AddRef(LPCONNECTIONPOINTCONTAINER iface)
{
IConnectionPointContainerImpl *This = (IConnectionPointContainerImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI WBCPC_Release(LPCONNECTIONPOINTCONTAINER iface)
{
IConnectionPointContainerImpl *This = (IConnectionPointContainerImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
/* Get a list of connection points inside this container. */
@ -131,18 +135,22 @@ static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface,
static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface)
{
IConnectionPointImpl *This = (IConnectionPointImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface)
{
IConnectionPointImpl *This = (IConnectionPointImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId)

View File

@ -55,9 +55,11 @@ static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface,
static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
/************************************************************************
@ -66,10 +68,12 @@ static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface)
static ULONG WINAPI WBCF_Release(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
/************************************************************************

View File

@ -41,18 +41,22 @@ static HRESULT WINAPI WBQA_QueryInterface(LPQUICKACTIVATE iface,
static ULONG WINAPI WBQA_AddRef(LPQUICKACTIVATE iface)
{
IQuickActivateImpl *This = (IQuickActivateImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI WBQA_Release(LPQUICKACTIVATE iface)
{
IQuickActivateImpl *This = (IQuickActivateImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
/* Alternative interface for quicker, easier activation of a control. */

View File

@ -144,9 +144,11 @@ static HRESULT WINAPI WBOOBJ_QueryInterface(LPOLEOBJECT iface,
static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface)
{
IOleObjectImpl *This = (IOleObjectImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
/************************************************************************
@ -155,10 +157,12 @@ static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface)
static ULONG WINAPI WBOOBJ_Release(LPOLEOBJECT iface)
{
IOleObjectImpl *This = (IOleObjectImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
/************************************************************************
@ -457,18 +461,22 @@ static HRESULT WINAPI WBOIPO_QueryInterface(LPOLEINPLACEOBJECT iface,
static ULONG WINAPI WBOIPO_AddRef(LPOLEINPLACEOBJECT iface)
{
IOleInPlaceObjectImpl *This = (IOleInPlaceObjectImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI WBOIPO_Release(LPOLEINPLACEOBJECT iface)
{
IOleInPlaceObjectImpl *This = (IOleInPlaceObjectImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
static HRESULT WINAPI WBOIPO_GetWindow(LPOLEINPLACEOBJECT iface, HWND* phwnd)
@ -559,18 +567,22 @@ static HRESULT WINAPI WBOC_QueryInterface(LPOLECONTROL iface,
static ULONG WINAPI WBOC_AddRef(LPOLECONTROL iface)
{
IOleControlImpl *This = (IOleControlImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI WBOC_Release(LPOLECONTROL iface)
{
IOleControlImpl *This = (IOleControlImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
static HRESULT WINAPI WBOC_GetControlInfo(LPOLECONTROL iface, LPCONTROLINFO pCI)

View File

@ -39,18 +39,22 @@ static HRESULT WINAPI WBPS_QueryInterface(LPPERSISTSTORAGE iface,
static ULONG WINAPI WBPS_AddRef(LPPERSISTSTORAGE iface)
{
IPersistStorageImpl *This = (IPersistStorageImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI WBPS_Release(LPPERSISTSTORAGE iface)
{
IPersistStorageImpl *This = (IPersistStorageImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
static HRESULT WINAPI WBPS_GetClassID(LPPERSISTSTORAGE iface, CLSID *pClassID)
@ -126,18 +130,22 @@ static HRESULT WINAPI WBPSI_QueryInterface(LPPERSISTSTREAMINIT iface,
static ULONG WINAPI WBPSI_AddRef(LPPERSISTSTREAMINIT iface)
{
IPersistStreamInitImpl *This = (IPersistStreamInitImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI WBPSI_Release(LPPERSISTSTREAMINIT iface)
{
IPersistStreamInitImpl *This = (IPersistStreamInitImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
static HRESULT WINAPI WBPSI_GetClassID(LPPERSISTSTREAMINIT iface, CLSID *pClassID)

View File

@ -38,18 +38,22 @@ static HRESULT WINAPI WB_QueryInterface(IWebBrowser *iface, REFIID riid, LPVOID
static ULONG WINAPI WB_AddRef(IWebBrowser *iface)
{
IWebBrowserImpl *This = (IWebBrowserImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("\n");
return ++(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI WB_Release(IWebBrowser *iface)
{
IWebBrowserImpl *This = (IWebBrowserImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
/* static class, won't be freed */
TRACE("\n");
return --(This->ref);
TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
return refCount;
}
/* IDispatch methods */

View File

@ -170,9 +170,11 @@ static ULONG WINAPI IAutoComplete_fnAddRef(
IAutoComplete * iface)
{
IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%lu)\n",This,This->ref);
return ++(This->ref);
TRACE("(%p)->(%lu)\n", This, refCount - 1);
return refCount;
}
/******************************************************************************
@ -182,10 +184,11 @@ static ULONG WINAPI IAutoComplete_fnRelease(
IAutoComplete * iface)
{
IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%lu)\n",This,This->ref);
TRACE("(%p)->(%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE(" destroying IAutoComplete(%p)\n",This);
HeapFree(GetProcessHeap(), 0, This->quickComplete);
HeapFree(GetProcessHeap(), 0, This->txtbackup);
@ -194,9 +197,8 @@ static ULONG WINAPI IAutoComplete_fnRelease(
if (This->enumstr)
IEnumString_Release(This->enumstr);
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return This->ref;
return refCount;
}
/******************************************************************************

View File

@ -181,26 +181,27 @@ static HRESULT WINAPI ISF_ControlPanel_fnQueryInterface(IShellFolder2 * iface, R
static ULONG WINAPI ISF_ControlPanel_fnAddRef(IShellFolder2 * iface)
{
ICPanelImpl *This = (ICPanelImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
static ULONG WINAPI ISF_ControlPanel_fnRelease(IShellFolder2 * iface)
{
ICPanelImpl *This = (ICPanelImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE("-- destroying IShellFolder(%p)\n", This);
if (This->pidlRoot)
SHFree(This->pidlRoot);
LocalFree((HLOCAL) This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View File

@ -124,16 +124,21 @@ static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(LPENUMFORMATETC iface, REF
static ULONG WINAPI IEnumFORMATETC_fnAddRef(LPENUMFORMATETC iface)
{
IEnumFORMATETCImpl *This = (IEnumFORMATETCImpl *)iface;
TRACE("(%p)->(count=%lu)\n",This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface)
{
IEnumFORMATETCImpl *This = (IEnumFORMATETCImpl *)iface;
TRACE("(%p)->()\n",This);
ULONG refCount = InterlockedDecrement(&This->ref);
if (!--(This->ref))
TRACE("(%p)->(%lu)\n", This, refCount + 1);
if (!refCount)
{
TRACE(" destroying IEnumFORMATETC(%p)\n",This);
if (This->pFmt)
@ -143,7 +148,7 @@ static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface)
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
static HRESULT WINAPI IEnumFORMATETC_fnNext(LPENUMFORMATETC iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFethed)
@ -291,8 +296,11 @@ static HRESULT WINAPI IDataObject_fnQueryInterface(LPDATAOBJECT iface, REFIID ri
static ULONG WINAPI IDataObject_fnAddRef(LPDATAOBJECT iface)
{
IDataObjectImpl *This = (IDataObjectImpl *)iface;
TRACE("(%p)->(count=%lu)\n",This, This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return refCount;
}
/**************************************************************************
@ -301,17 +309,18 @@ static ULONG WINAPI IDataObject_fnAddRef(LPDATAOBJECT iface)
static ULONG WINAPI IDataObject_fnRelease(LPDATAOBJECT iface)
{
IDataObjectImpl *This = (IDataObjectImpl *)iface;
TRACE("(%p)->()\n",This);
ULONG refCount = InterlockedDecrement(&This->ref);
if (!--(This->ref))
TRACE("(%p)->(%lu)\n", This, refCount + 1);
if (!refCount)
{
TRACE(" destroying IDataObject(%p)\n",This);
_ILFreeaPidl(This->apidl, This->cidl);
ILFree(This->pidl),
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View File

@ -113,24 +113,26 @@ static HRESULT WINAPI IDropTargetHelper_fnQueryInterface (IDropTargetHelper * if
static ULONG WINAPI IDropTargetHelper_fnAddRef (IDropTargetHelper * iface)
{
IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
static ULONG WINAPI IDropTargetHelper_fnRelease (IDropTargetHelper * iface)
{
IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE("-- destroying (%p)\n", This);
LocalFree ((HLOCAL) This);
return 0;
}
return This->ref;
return refCount;
}
static HRESULT WINAPI IDropTargetHelper_fnDragEnter (

View File

@ -240,8 +240,11 @@ static ULONG WINAPI IEnumIDList_fnAddRef(
IEnumIDList * iface)
{
IEnumIDListImpl *This = (IEnumIDListImpl *)iface;
TRACE("(%p)->(%lu)\n",This,This->ref);
return ++(This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%lu)\n", This, refCount - 1);
return refCount;
}
/******************************************************************************
* IEnumIDList_fnRelease
@ -250,16 +253,16 @@ static ULONG WINAPI IEnumIDList_fnRelease(
IEnumIDList * iface)
{
IEnumIDListImpl *This = (IEnumIDListImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%lu)\n",This,This->ref);
TRACE("(%p)->(%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE(" destroying IEnumIDList(%p)\n",This);
DeleteList((IEnumIDList*)This);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View File

@ -130,10 +130,11 @@ static HRESULT WINAPI IExtractIconW_fnQueryInterface(IExtractIconW *iface, REFII
static ULONG WINAPI IExtractIconW_fnAddRef(IExtractIconW * iface)
{
IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This, This->ref );
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/**************************************************************************
* IExtractIconW_Release
@ -141,17 +142,18 @@ static ULONG WINAPI IExtractIconW_fnAddRef(IExtractIconW * iface)
static ULONG WINAPI IExtractIconW_fnRelease(IExtractIconW * iface)
{
IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n",This);
TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref))
if (!refCount)
{
TRACE(" destroying IExtractIcon(%p)\n",This);
SHFree(This->pidl);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
static HRESULT getIconLocationForFolder(IExtractIconW *iface, UINT uFlags,

View File

@ -127,10 +127,11 @@ static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVO
static ULONG WINAPI IStream_fnAddRef(IStream *iface)
{
ISHFileStream *This = (ISHFileStream *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This, This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/**************************************************************************
@ -139,16 +140,17 @@ static ULONG WINAPI IStream_fnAddRef(IStream *iface)
static ULONG WINAPI IStream_fnRelease(IStream *iface)
{
ISHFileStream *This = (ISHFileStream *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n",This);
TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref))
if (!refCount)
{
TRACE(" destroying SHFileStream (%p)\n",This);
CloseHandle(This->handle);
HeapFree(GetProcessHeap(),0,This);
}
return This->ref;
return refCount;
}
static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG* pcbRead)

View File

@ -974,10 +974,11 @@ static HRESULT WINAPI IShellLinkA_fnQueryInterface( IShellLinkA * iface, REFIID
static ULONG WINAPI IShellLinkA_fnAddRef(IShellLinkA * iface)
{
IShellLinkImpl *This = (IShellLinkImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This,This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/******************************************************************************
* IShellLinkA_Release
@ -985,11 +986,12 @@ static ULONG WINAPI IShellLinkA_fnAddRef(IShellLinkA * iface)
static ULONG WINAPI IShellLinkA_fnRelease(IShellLinkA * iface)
{
IShellLinkImpl *This = (IShellLinkImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This,This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
if (--(This->ref))
return This->ref;
if (refCount)
return refCount;
TRACE("-- destroying IShellLink(%p)\n",This);

View File

@ -556,9 +556,11 @@ static HRESULT WINAPI IDefClF_fnQueryInterface(
static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
{
IDefClFImpl *This = (IDefClFImpl *)iface;
TRACE("(%p)->(count=%lu)\n",This,This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
return InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return refCount;
}
/******************************************************************************
* IDefClF_fnRelease
@ -566,9 +568,11 @@ static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
{
IDefClFImpl *This = (IDefClFImpl *)iface;
TRACE("(%p)->(count=%lu)\n",This,This->ref);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount + 1);
if (!InterlockedDecrement(&This->ref))
if (!refCount)
{
if (This->pcRefDll) InterlockedDecrement(This->pcRefDll);
@ -576,7 +580,7 @@ static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/******************************************************************************
* IDefClF_fnCreateInstance

View File

@ -157,19 +157,21 @@ static HRESULT WINAPI ISF_Desktop_fnQueryInterface (IShellFolder2 * iface, REFII
static ULONG WINAPI ISF_Desktop_fnAddRef (IShellFolder2 * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE ("-- destroying IShellFolder(%p)\n", This);
if (This->pidlRoot)
SHFree (This->pidlRoot);
@ -178,7 +180,7 @@ static ULONG WINAPI ISF_Desktop_fnRelease (IShellFolder2 * iface)
LocalFree ((HLOCAL) This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View File

@ -173,19 +173,21 @@ static HRESULT WINAPI IUnknown_fnQueryInterface (IUnknown * iface, REFIID riid,
static ULONG WINAPI IUnknown_fnAddRef (IUnknown * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
static ULONG WINAPI IUnknown_fnRelease (IUnknown * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE ("-- destroying IShellFolder(%p)\n", This);
if (This->pidlRoot)
@ -193,9 +195,8 @@ static ULONG WINAPI IUnknown_fnRelease (IUnknown * iface)
if (This->sPathTarget)
SHFree (This->sPathTarget);
LocalFree ((HLOCAL) This);
return 0;
}
return This->ref;
return refCount;
}
static IUnknownVtbl unkvt =

View File

@ -160,26 +160,27 @@ static HRESULT WINAPI ISF_MyComputer_fnQueryInterface (IShellFolder2 * iface, RE
static ULONG WINAPI ISF_MyComputer_fnAddRef (IShellFolder2 * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
static ULONG WINAPI ISF_MyComputer_fnRelease (IShellFolder2 * iface)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE ("(%p)->(count=%lu)\n", This, This->ref);
TRACE ("(%p)->(count=%lu)\n", This, refCount + 1);
if (!--(This->ref)) {
if (!refCount) {
TRACE ("-- destroying IShellFolder(%p)\n", This);
if (This->pidlRoot)
SHFree (This->pidlRoot);
LocalFree ((HLOCAL) This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View File

@ -179,22 +179,26 @@ static HRESULT WINAPI IFileSystemBindData_fnQueryInterface(IFileSystemBindData *
static ULONG WINAPI IFileSystemBindData_fnAddRef(IFileSystemBindData *iface)
{
IFileSystemBindDataImpl *This = (IFileSystemBindDataImpl *)iface;
TRACE("(%p)\n", This);
return InterlockedIncrement(&This->ref);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%li)\n", This, refCount - 1);
return refCount;
}
static ULONG WINAPI IFileSystemBindData_fnRelease(IFileSystemBindData *iface)
{
IFileSystemBindDataImpl *This = (IFileSystemBindDataImpl *)iface;
TRACE("(%p)\n", This);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%li)\n", This, refCount + 1);
if (!InterlockedDecrement(&This->ref))
if (!refCount)
{
TRACE(" destroying ISFBindPidl(%p)\n",This);
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return This->ref;
return refCount;
}
static HRESULT WINAPI IFileSystemBindData_fnGetFindData(IFileSystemBindData *iface, WIN32_FIND_DATAW *pfd)

View File

@ -1636,10 +1636,11 @@ static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid
static ULONG WINAPI IShellView_fnAddRef(IShellView * iface)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This,This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/**********************************************************
* IShellView_Release
@ -1647,10 +1648,11 @@ static ULONG WINAPI IShellView_fnAddRef(IShellView * iface)
static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
{
IShellViewImpl *This = (IShellViewImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n",This);
TRACE("(%p)->(count=%li)\n", This, refCount + 1);
if (!--(This->ref))
if (!refCount)
{
TRACE(" destroying IShellView(%p)\n",This);
@ -1666,9 +1668,8 @@ static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
SHFree(This->apidl);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/**********************************************************

View File

@ -106,10 +106,11 @@ static HRESULT WINAPI ISVBgCm_fnQueryInterface(IContextMenu2 *iface, REFIID riid
static ULONG WINAPI ISVBgCm_fnAddRef(IContextMenu2 *iface)
{
BgCmImpl *This = (BgCmImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This, This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/**************************************************************************
@ -118,10 +119,11 @@ static ULONG WINAPI ISVBgCm_fnAddRef(IContextMenu2 *iface)
static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu2 *iface)
{
BgCmImpl *This = (BgCmImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n",This);
TRACE("(%p)->(count=%li)\n", This, refCount + 1);
if (!--(This->ref))
if (!refCount)
{
TRACE(" destroying IContextMenu(%p)\n",This);
@ -129,10 +131,8 @@ static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu2 *iface)
IShellFolder_Release(This->pSFParent);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************

View File

@ -142,10 +142,11 @@ static HRESULT WINAPI ISvItemCm_fnQueryInterface(IContextMenu2 *iface, REFIID ri
static ULONG WINAPI ISvItemCm_fnAddRef(IContextMenu2 *iface)
{
ItemCmImpl *This = (ItemCmImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%lu)\n",This, This->ref);
TRACE("(%p)->(count=%lu)\n", This, refCount - 1);
return ++(This->ref);
return refCount;
}
/**************************************************************************
@ -154,10 +155,11 @@ static ULONG WINAPI ISvItemCm_fnAddRef(IContextMenu2 *iface)
static ULONG WINAPI ISvItemCm_fnRelease(IContextMenu2 *iface)
{
ItemCmImpl *This = (ItemCmImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n",This);
TRACE("(%p)->(count=%li)\n", This, refCount + 1);
if (!--(This->ref))
if (!refCount)
{
TRACE(" destroying IContextMenu(%p)\n",This);
@ -171,9 +173,8 @@ static ULONG WINAPI ISvItemCm_fnRelease(IContextMenu2 *iface)
_ILFreeaPidl(This->apidl, This->cidl);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return refCount;
}
/**************************************************************************