diff --git a/dlls/dmime/audiopath.c b/dlls/dmime/audiopath.c index 15c3e46d6179e728ee1e72143ada4194fec94a49..591fdb240d4aab778b944d8c60a87419ca953d03 100644 --- a/dlls/dmime/audiopath.c +++ b/dlls/dmime/audiopath.c @@ -54,14 +54,17 @@ HRESULT WINAPI IDirectMusicAudioPathImpl_IUnknown_QueryInterface (LPUNKNOWN ifac ULONG WINAPI IDirectMusicAudioPathImpl_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicAudioPathImpl_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { if (This->pDSBuffer) { IDirectSoundBuffer8_Release(This->pDSBuffer); diff --git a/dlls/dmime/dmime_main.c b/dlls/dmime/dmime_main.c index 74287976076e074792a661f80de9184a84a3e97b..7c3fb3cb802664a795d37268920c53381eb6d904 100644 --- a/dlls/dmime/dmime_main.c +++ b/dlls/dmime/dmime_main.c @@ -40,13 +40,13 @@ static HRESULT WINAPI PerformanceCF_QueryInterface(LPCLASSFACTORY iface,REFIID r static ULONG WINAPI PerformanceCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI PerformanceCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI PerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -82,13 +82,13 @@ static HRESULT WINAPI SegmentCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, static ULONG WINAPI SegmentCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI SegmentCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI SegmentCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -124,13 +124,13 @@ static HRESULT WINAPI SegmentStateCF_QueryInterface(LPCLASSFACTORY iface,REFIID static ULONG WINAPI SegmentStateCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI SegmentStateCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI SegmentStateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -166,13 +166,13 @@ static HRESULT WINAPI GraphCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LP static ULONG WINAPI GraphCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI GraphCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI GraphCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -208,13 +208,13 @@ static HRESULT WINAPI TempoTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID ri static ULONG WINAPI TempoTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI TempoTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI TempoTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -250,13 +250,13 @@ static HRESULT WINAPI SeqTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid static ULONG WINAPI SeqTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI SeqTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI SeqTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -292,13 +292,13 @@ static HRESULT WINAPI SysExTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID ri static ULONG WINAPI SysExTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI SysExTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI SysExTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -334,13 +334,13 @@ static HRESULT WINAPI TimeSigTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID static ULONG WINAPI TimeSigTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI TimeSigTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI TimeSigTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -376,13 +376,13 @@ static HRESULT WINAPI ParamControlTrackCF_QueryInterface(LPCLASSFACTORY iface,RE static ULONG WINAPI ParamControlTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI ParamControlTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI ParamControlTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -418,13 +418,13 @@ static HRESULT WINAPI MarkerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID r static ULONG WINAPI MarkerTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI MarkerTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI MarkerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -460,13 +460,13 @@ static HRESULT WINAPI LyricsTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID r static ULONG WINAPI LyricsTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI LyricsTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI LyricsTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -503,13 +503,13 @@ static HRESULT WINAPI SegTriggerTrackCF_QueryInterface(LPCLASSFACTORY iface,REFI static ULONG WINAPI SegTriggerTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI SegTriggerTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI SegTriggerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -545,13 +545,13 @@ static HRESULT WINAPI AudioPathCF_QueryInterface(LPCLASSFACTORY iface,REFIID rii static ULONG WINAPI AudioPathCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI AudioPathCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI AudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -587,13 +587,13 @@ static HRESULT WINAPI WaveTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID rii static ULONG WINAPI WaveTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI WaveTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI WaveTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { diff --git a/dlls/dmime/graph.c b/dlls/dmime/graph.c index 0aed58d7ff0307603668ee93423d365d7c128ad3..8b5f74841c38d3d140452590f582978fb6b4a722 100644 --- a/dlls/dmime/graph.c +++ b/dlls/dmime/graph.c @@ -54,14 +54,17 @@ HRESULT WINAPI IDirectMusicGraphImpl_IUnknown_QueryInterface (LPUNKNOWN iface, R ULONG WINAPI IDirectMusicGraphImpl_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicGraphImpl_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/lyricstrack.c b/dlls/dmime/lyricstrack.c index 975f00561d8387c7f331f5037eccd5204c2fc58d..8e52798067df1a103f074440565838271ded3176 100644 --- a/dlls/dmime/lyricstrack.c +++ b/dlls/dmime/lyricstrack.c @@ -51,14 +51,17 @@ HRESULT WINAPI IDirectMusicLyricsTrack_IUnknown_QueryInterface (LPUNKNOWN iface, ULONG WINAPI IDirectMusicLyricsTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicLyricsTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicLyricsTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicLyricsTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/markertrack.c b/dlls/dmime/markertrack.c index f6ed666277d9ae807cfd2ccb1534bbfc1277037f..d51ca177f04fc2bfba7ea64e123f018087557937 100644 --- a/dlls/dmime/markertrack.c +++ b/dlls/dmime/markertrack.c @@ -51,14 +51,17 @@ HRESULT WINAPI IDirectMusicMarkerTrack_IUnknown_QueryInterface (LPUNKNOWN iface, ULONG WINAPI IDirectMusicMarkerTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicMarkerTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicMarkerTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicMarkerTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/paramcontroltrack.c b/dlls/dmime/paramcontroltrack.c index 3201b281e83c6fd2c518a46aefb13d577333fb35..9563b9aa03cac0e34e7a26a784fbec1aee12d0f7 100644 --- a/dlls/dmime/paramcontroltrack.c +++ b/dlls/dmime/paramcontroltrack.c @@ -51,14 +51,17 @@ HRESULT WINAPI IDirectMusicParamControlTrack_IUnknown_QueryInterface (LPUNKNOWN ULONG WINAPI IDirectMusicParamControlTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicParamControlTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicParamControlTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicParamControlTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/patterntrack.c b/dlls/dmime/patterntrack.c index dc54628af3d60b89ac6ff1e641d07b2c40387bfa..8032999a824409ffc3a39d586617619f28dff460 100644 --- a/dlls/dmime/patterntrack.c +++ b/dlls/dmime/patterntrack.c @@ -39,14 +39,17 @@ HRESULT WINAPI IDirectMusicPatternTrackImpl_QueryInterface (LPDIRECTMUSICPATTERN ULONG WINAPI IDirectMusicPatternTrackImpl_AddRef (LPDIRECTMUSICPATTERNTRACK iface) { IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface; - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicPatternTrackImpl_Release (LPDIRECTMUSICPATTERNTRACK iface) { IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface; - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index dc89129826ccca90859b7fbe44ac3d42827b0905..95a8406b8ddebe81ab4958daa15b10f95ab306d1 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -182,14 +182,17 @@ HRESULT WINAPI IDirectMusicPerformance8Impl_QueryInterface (LPDIRECTMUSICPERFORM ULONG WINAPI IDirectMusicPerformance8Impl_AddRef (LPDIRECTMUSICPERFORMANCE8 iface) { IDirectMusicPerformance8Impl *This = (IDirectMusicPerformance8Impl *)iface; - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicPerformance8Impl_Release (LPDIRECTMUSICPERFORMANCE8 iface) { IDirectMusicPerformance8Impl *This = (IDirectMusicPerformance8Impl *)iface; - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { DeleteCriticalSection(&This->safe); HeapFree(GetProcessHeap(), 0, This); diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c index f96f746ff350dccf63a21ba77da4a58e4d8f3076..3a3df8edeeebfc0f46199148d4841301815ca99a 100644 --- a/dlls/dmime/segment.c +++ b/dlls/dmime/segment.c @@ -57,14 +57,17 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IUnknown_QueryInterface (LPUNKNOWN iface ULONG WINAPI IDirectMusicSegment8Impl_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSegment8Impl, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicSegment8Impl_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSegment8Impl, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/segmentstate.c b/dlls/dmime/segmentstate.c index adc2dfcdfec4802993cbe79cd3316d1f02ff8c04..39b0527d4ed2dab773097e511d42c537cf2caa92 100644 --- a/dlls/dmime/segmentstate.c +++ b/dlls/dmime/segmentstate.c @@ -39,14 +39,17 @@ HRESULT WINAPI IDirectMusicSegmentState8Impl_QueryInterface (LPDIRECTMUSICSEGMEN ULONG WINAPI IDirectMusicSegmentState8Impl_AddRef (LPDIRECTMUSICSEGMENTSTATE8 iface) { IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicSegmentState8Impl_Release (LPDIRECTMUSICSEGMENTSTATE8 iface) { IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/segtriggertrack.c b/dlls/dmime/segtriggertrack.c index 3e396e12916eb4593cb21a9f071a2409127c2252..ea118314f1c817e5db205ddece7a7165726cb45b 100644 --- a/dlls/dmime/segtriggertrack.c +++ b/dlls/dmime/segtriggertrack.c @@ -52,14 +52,17 @@ HRESULT WINAPI IDirectMusicSegTriggerTrack_IUnknown_QueryInterface (LPUNKNOWN if ULONG WINAPI IDirectMusicSegTriggerTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicSegTriggerTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/seqtrack.c b/dlls/dmime/seqtrack.c index 6601633fcc46889aab5e4af6026526fd47730cac..7e229180fb310635dc959206fd98a5c4d3cb033b 100644 --- a/dlls/dmime/seqtrack.c +++ b/dlls/dmime/seqtrack.c @@ -51,14 +51,17 @@ HRESULT WINAPI IDirectMusicSeqTrack_IUnknown_QueryInterface (LPUNKNOWN iface, RE ULONG WINAPI IDirectMusicSeqTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSeqTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicSeqTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSeqTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/sysextrack.c b/dlls/dmime/sysextrack.c index eb5c6d2358dcd629cdd5b3734656088922d1d51a..c90fa9e25832654278ed92274f0afb3fb26fbffd 100644 --- a/dlls/dmime/sysextrack.c +++ b/dlls/dmime/sysextrack.c @@ -51,14 +51,17 @@ HRESULT WINAPI IDirectMusicSysExTrack_IUnknown_QueryInterface (LPUNKNOWN iface, ULONG WINAPI IDirectMusicSysExTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSysExTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicSysExTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSysExTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/tempotrack.c b/dlls/dmime/tempotrack.c index 1e3a07fc47ecf75a3eb61fb4f05b22ddf01c82bb..3359dbfb6d7ed20a27f1f8730b67e563c9f4f8b9 100644 --- a/dlls/dmime/tempotrack.c +++ b/dlls/dmime/tempotrack.c @@ -52,14 +52,17 @@ HRESULT WINAPI IDirectMusicTempoTrack_IUnknown_QueryInterface (LPUNKNOWN iface, ULONG WINAPI IDirectMusicTempoTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicTempoTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/timesigtrack.c b/dlls/dmime/timesigtrack.c index ea96bcab2a449e7b50e00d0e5b98a0f25fa9b2a7..bb0266d8012da64de3722fcdbedcd75e9916dbc4 100644 --- a/dlls/dmime/timesigtrack.c +++ b/dlls/dmime/timesigtrack.c @@ -51,14 +51,17 @@ HRESULT WINAPI IDirectMusicTimeSigTrack_IUnknown_QueryInterface (LPUNKNOWN iface ULONG WINAPI IDirectMusicTimeSigTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicTimeSigTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicTimeSigTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicTimeSigTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/tool.c b/dlls/dmime/tool.c index 8c285ab628e508b001cab67cb02a6dae9f503c80..8fc4268da48973789591d8ec2805ef04b881551c 100644 --- a/dlls/dmime/tool.c +++ b/dlls/dmime/tool.c @@ -38,14 +38,17 @@ HRESULT WINAPI IDirectMusicTool8Impl_QueryInterface (LPDIRECTMUSICTOOL8 iface, R ULONG WINAPI IDirectMusicTool8Impl_AddRef (LPDIRECTMUSICTOOL8 iface) { IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface; - TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) : AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicTool8Impl_Release (LPDIRECTMUSICTOOL8 iface) { IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface; - ULONG ref = --This->ref; - TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p) : ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } diff --git a/dlls/dmime/wavetrack.c b/dlls/dmime/wavetrack.c index f3d67a4423e5fd55a8a9d587afadb372aebdf141..77b141c17e83a3d36e2840a12bffebb7cacbb369 100644 --- a/dlls/dmime/wavetrack.c +++ b/dlls/dmime/wavetrack.c @@ -51,14 +51,17 @@ HRESULT WINAPI IDirectMusicWaveTrack_IUnknown_QueryInterface (LPUNKNOWN iface, R ULONG WINAPI IDirectMusicWaveTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicWaveTrack, UnknownVtbl, iface); - TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) : AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicWaveTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicWaveTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p) : ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); }