Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7946edf2
Commit
7946edf2
authored
Jan 31, 2005
by
James Hawkins
Committed by
Alexandre Julliard
Jan 31, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly implement DllCanUnloadNow ref counting.
parent
932a65dd
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
116 additions
and
57 deletions
+116
-57
band.c
dlls/dmband/band.c
+5
-0
bandtrack.c
dlls/dmband/bandtrack.c
+5
-0
dmband_main.c
dlls/dmband/dmband_main.c
+43
-29
dmband_private.h
dlls/dmband/dmband_private.h
+6
-0
dmsynth_main.c
dlls/dmsynth/dmsynth_main.c
+41
-28
dmsynth_private.h
dlls/dmsynth/dmsynth_private.h
+6
-0
synth.c
dlls/dmsynth/synth.c
+5
-0
synthsink.c
dlls/dmsynth/synthsink.c
+5
-0
No files found.
dlls/dmband/band.c
View file @
7946edf2
...
...
@@ -60,6 +60,8 @@ ULONG WINAPI IDirectMusicBandImpl_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE
(
"(%p) : AddRef from %ld
\n
"
,
This
,
ref
-
1
);
DMBAND_LockModule
();
return
ref
;
}
...
...
@@ -72,6 +74,9 @@ ULONG WINAPI IDirectMusicBandImpl_IUnknown_Release (LPUNKNOWN iface) {
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMBAND_UnlockModule
();
return
ref
;
}
...
...
dlls/dmband/bandtrack.c
View file @
7946edf2
...
...
@@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicBandTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE
(
"(%p) : AddRef from %ld
\n
"
,
This
,
ref
-
1
);
DMBAND_LockModule
();
return
ref
;
}
...
...
@@ -67,6 +69,9 @@ ULONG WINAPI IDirectMusicBandTrack_IUnknown_Release (LPUNKNOWN iface) {
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMBAND_UnlockModule
();
return
ref
;
}
...
...
dlls/dmband/dmband_main.c
View file @
7946edf2
...
...
@@ -21,10 +21,10 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmband
);
LONG
DMBAND_refCount
=
0
;
typedef
struct
{
/* IUnknown fields */
IClassFactoryVtbl
*
lpVtbl
;
DWORD
ref
;
}
IClassFactoryImpl
;
/******************************************************************
...
...
@@ -32,31 +32,39 @@ typedef struct {
*/
static
HRESULT
WINAPI
BandCF_QueryInterface
(
LPCLASSFACTORY
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
FIXME
(
"(%p, %s, %p): stub
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
FIXME
(
"- no interface
\n\t
IID:
\t
%s
\n
"
,
debugstr_guid
(
riid
));
if
(
ppobj
==
NULL
)
return
E_POINTER
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
BandCF_AddRef
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
return
InterlockedIncrement
(
&
This
->
ref
);
DMBAND_LockModule
();
return
2
;
/* non-heap based object */
}
static
ULONG
WINAPI
BandCF_Release
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
/* static class, won't be freed */
return
InterlockedDecrement
(
&
This
->
ref
);
DMBAND_UnlockModule
()
;
return
1
;
/* non-heap based object */
}
static
HRESULT
WINAPI
BandCF_CreateInstance
(
LPCLASSFACTORY
iface
,
LPUNKNOWN
pOuter
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
TRACE
(
"(%p, %p, %s, %p)
\n
"
,
This
,
pOuter
,
debugstr_dmguid
(
riid
),
ppobj
);
TRACE
(
"(%p, %s, %p)
\n
"
,
pOuter
,
debugstr_dmguid
(
riid
),
ppobj
)
;
return
DMUSIC_CreateDirectMusicBandImpl
(
riid
,
ppobj
,
pOuter
);
}
static
HRESULT
WINAPI
BandCF_LockServer
(
LPCLASSFACTORY
iface
,
BOOL
dolock
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
FIXME
(
"(%p, %d): stub
\n
"
,
This
,
dolock
);
TRACE
(
"(%d)
\n
"
,
dolock
);
if
(
dolock
)
DMBAND_LockModule
();
else
DMBAND_UnlockModule
();
return
S_OK
;
}
...
...
@@ -68,7 +76,7 @@ static IClassFactoryVtbl BandCF_Vtbl = {
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
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
FIXME
(
"(%p, %s, %p): stub
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
FIXME
(
"- no interface
\n\t
IID:
\t
%s
\n
"
,
debugstr_guid
(
riid
));
if
(
ppobj
==
NULL
)
return
E_POINTER
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
BandTrackCF_AddRef
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
return
InterlockedIncrement
(
&
This
->
ref
);
DMBAND_LockModule
();
return
2
;
/* non-heap based object */
}
static
ULONG
WINAPI
BandTrackCF_Release
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
/* static class, won't be freed */
return
InterlockedDecrement
(
&
This
->
ref
);
DMBAND_UnlockModule
()
;
return
1
;
/* non-heap based object */
}
static
HRESULT
WINAPI
BandTrackCF_CreateInstance
(
LPCLASSFACTORY
iface
,
LPUNKNOWN
pOuter
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
TRACE
(
"(%p, %p, %s, %p)
\n
"
,
This
,
pOuter
,
debugstr_dmguid
(
riid
),
ppobj
);
TRACE
(
"(%p, %s, %p)
\n
"
,
pOuter
,
debugstr_dmguid
(
riid
),
ppobj
)
;
return
DMUSIC_CreateDirectMusicBandTrack
(
riid
,
ppobj
,
pOuter
);
}
static
HRESULT
WINAPI
BandTrackCF_LockServer
(
LPCLASSFACTORY
iface
,
BOOL
dolock
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
FIXME
(
"(%p, %d): stub
\n
"
,
This
,
dolock
);
TRACE
(
"(%d)
\n
"
,
dolock
);
if
(
dolock
)
DMBAND_LockModule
();
else
DMBAND_UnlockModule
();
return
S_OK
;
}
...
...
@@ -113,7 +128,7 @@ static IClassFactoryVtbl BandTrackCF_Vtbl = {
BandTrackCF_LockServer
};
static
IClassFactoryImpl
BandTrack_CF
=
{
&
BandTrackCF_Vtbl
,
1
};
static
IClassFactoryImpl
BandTrack_CF
=
{
&
BandTrackCF_Vtbl
};
/******************************************************************
* DllMain
...
...
@@ -138,8 +153,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
*
*/
HRESULT
WINAPI
DMBAND_DllCanUnloadNow
(
void
)
{
FIXME
(
"(void): stub
\n
"
);
return
S_FALSE
;
return
DMBAND_refCount
!=
0
?
S_FALSE
:
S_OK
;
}
...
...
dlls/dmband/dmband_private.h
View file @
7946edf2
...
...
@@ -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_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.
...
...
dlls/dmsynth/dmsynth_main.c
View file @
7946edf2
...
...
@@ -23,41 +23,48 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmsynth
);
LONG
DMSYNTH_refCount
=
0
;
typedef
struct
{
/* IUnknown fields */
IClassFactoryVtbl
*
lpVtbl
;
DWORD
ref
;
}
IClassFactoryImpl
;
/******************************************************************
* DirectMusicSynth ClassFactory
*/
static
HRESULT
WINAPI
SynthCF_QueryInterface
(
LPCLASSFACTORY
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
FIXME
(
"(%p, %s, %p): stub
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
FIXME
(
"- no interface
\n\t
IID:
\t
%s
\n
"
,
debugstr_guid
(
riid
));
if
(
ppobj
==
NULL
)
return
E_POINTER
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
SynthCF_AddRef
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
return
InterlockedIncrement
(
&
This
->
ref
);
DMSYNTH_LockModule
();
return
2
;
/* non-heap based object */
}
static
ULONG
WINAPI
SynthCF_Release
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
/* static class, won't be freed */
return
InterlockedDecrement
(
&
This
->
ref
);
DMSYNTH_UnlockModule
()
;
return
1
;
/* non-heap based object */
}
static
HRESULT
WINAPI
SynthCF_CreateInstance
(
LPCLASSFACTORY
iface
,
LPUNKNOWN
pOuter
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
TRACE
(
"(%p, %p, %s, %p)
\n
"
,
This
,
pOuter
,
debugstr_dmguid
(
riid
),
ppobj
);
TRACE
(
"(%p, %s, %p)
\n
"
,
pOuter
,
debugstr_dmguid
(
riid
),
ppobj
);
return
DMUSIC_CreateDirectMusicSynthImpl
(
riid
,
ppobj
,
pOuter
);
}
static
HRESULT
WINAPI
SynthCF_LockServer
(
LPCLASSFACTORY
iface
,
BOOL
dolock
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
FIXME
(
"(%p, %d): stub
\n
"
,
This
,
dolock
);
TRACE
(
"(%d)
\n
"
,
dolock
);
if
(
dolock
)
DMSYNTH_LockModule
();
else
DMSYNTH_UnlockModule
();
return
S_OK
;
}
...
...
@@ -69,37 +76,44 @@ static IClassFactoryVtbl SynthCF_Vtbl = {
SynthCF_LockServer
};
static
IClassFactoryImpl
Synth_CF
=
{
&
SynthCF_Vtbl
,
1
};
static
IClassFactoryImpl
Synth_CF
=
{
&
SynthCF_Vtbl
};
/******************************************************************
* DirectMusicSynthSink ClassFactory
*/
static
HRESULT
WINAPI
SynthSinkCF_QueryInterface
(
LPCLASSFACTORY
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
FIXME
(
"(%p, %s, %p): stub
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
FIXME
(
"- no interface
\n\t
IID:
\t
%s
\n
"
,
debugstr_guid
(
riid
));
if
(
ppobj
==
NULL
)
return
E_POINTER
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
SynthSinkCF_AddRef
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
return
InterlockedIncrement
(
&
This
->
ref
);
DMSYNTH_LockModule
();
return
2
;
/* non-heap based object */
}
static
ULONG
WINAPI
SynthSinkCF_Release
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
/* static class, won't be freed */
return
InterlockedDecrement
(
&
This
->
ref
);
DMSYNTH_UnlockModule
()
;
return
1
;
/* non-heap based object */
}
static
HRESULT
WINAPI
SynthSinkCF_CreateInstance
(
LPCLASSFACTORY
iface
,
LPUNKNOWN
pOuter
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
TRACE
(
"(%p, %p, %s, %p)
\n
"
,
This
,
pOuter
,
debugstr_dmguid
(
riid
),
ppobj
);
TRACE
(
"(%p, %s, %p)
\n
"
,
pOuter
,
debugstr_dmguid
(
riid
),
ppobj
);
return
DMUSIC_CreateDirectMusicSynthSinkImpl
(
riid
,
ppobj
,
pOuter
);
}
static
HRESULT
WINAPI
SynthSinkCF_LockServer
(
LPCLASSFACTORY
iface
,
BOOL
dolock
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
FIXME
(
"(%p, %d): stub
\n
"
,
This
,
dolock
);
TRACE
(
"(%d)
\n
"
,
dolock
);
if
(
dolock
)
DMSYNTH_LockModule
();
else
DMSYNTH_UnlockModule
();
return
S_OK
;
}
...
...
@@ -111,7 +125,7 @@ static IClassFactoryVtbl SynthSinkCF_Vtbl = {
SynthSinkCF_LockServer
};
static
IClassFactoryImpl
SynthSink_CF
=
{
&
SynthSinkCF_Vtbl
,
1
};
static
IClassFactoryImpl
SynthSink_CF
=
{
&
SynthSinkCF_Vtbl
};
/******************************************************************
* DllMain
...
...
@@ -136,8 +150,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
*
*/
HRESULT
WINAPI
DMSYNTH_DllCanUnloadNow
(
void
)
{
FIXME
(
"(void): stub
\n
"
);
return
S_FALSE
;
return
DMSYNTH_refCount
!=
0
?
S_FALSE
:
S_OK
;
}
...
...
dlls/dmsynth/dmsynth_private.h
View file @
7946edf2
...
...
@@ -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_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.
...
...
dlls/dmsynth/synth.c
View file @
7946edf2
...
...
@@ -43,6 +43,8 @@ ULONG WINAPI IDirectMusicSynth8Impl_AddRef (LPDIRECTMUSICSYNTH8 iface) {
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMSYNTH_LockModule
();
return
refCount
;
}
...
...
@@ -55,6 +57,9 @@ ULONG WINAPI IDirectMusicSynth8Impl_Release (LPDIRECTMUSICSYNTH8 iface) {
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMSYNTH_UnlockModule
();
return
refCount
;
}
...
...
dlls/dmsynth/synthsink.c
View file @
7946edf2
...
...
@@ -42,6 +42,8 @@ ULONG WINAPI IDirectMusicSynthSinkImpl_AddRef (LPDIRECTMUSICSYNTHSINK iface) {
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMSYNTH_LockModule
();
return
refCount
;
}
...
...
@@ -54,6 +56,9 @@ ULONG WINAPI IDirectMusicSynthSinkImpl_Release (LPDIRECTMUSICSYNTHSINK iface) {
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMSYNTH_UnlockModule
();
return
refCount
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment