Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e8cafa57
Commit
e8cafa57
authored
Jan 26, 2005
by
James Hawkins
Committed by
Alexandre Julliard
Jan 26, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly implement DllCanUnloadNow ref counting.
parent
475a81a8
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
97 additions
and
28 deletions
+97
-28
buffer.c
dlls/dmusic/buffer.c
+5
-0
clock.c
dlls/dmusic/clock.c
+5
-0
collection.c
dlls/dmusic/collection.c
+5
-0
dmusic.c
dlls/dmusic/dmusic.c
+5
-0
dmusic_main.c
dlls/dmusic/dmusic_main.c
+41
-28
dmusic_private.h
dlls/dmusic/dmusic_private.h
+6
-0
download.c
dlls/dmusic/download.c
+5
-0
downloadedinstrument.c
dlls/dmusic/downloadedinstrument.c
+5
-0
instrument.c
dlls/dmusic/instrument.c
+5
-0
port.c
dlls/dmusic/port.c
+5
-0
portdownload.c
dlls/dmusic/portdownload.c
+5
-0
thru.c
dlls/dmusic/thru.c
+5
-0
No files found.
dlls/dmusic/buffer.c
View file @
e8cafa57
...
...
@@ -41,6 +41,8 @@ ULONG WINAPI IDirectMusicBufferImpl_AddRef (LPDIRECTMUSICBUFFER iface) {
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMUSIC_LockModule
();
return
refCount
;
}
...
...
@@ -53,6 +55,9 @@ ULONG WINAPI IDirectMusicBufferImpl_Release (LPDIRECTMUSICBUFFER iface) {
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_UnlockModule
();
return
refCount
;
}
...
...
dlls/dmusic/clock.c
View file @
e8cafa57
...
...
@@ -42,6 +42,8 @@ ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) {
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMUSIC_LockModule
();
return
refCount
;
}
...
...
@@ -54,6 +56,9 @@ ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) {
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_UnlockModule
();
return
refCount
;
}
...
...
dlls/dmusic/collection.c
View file @
e8cafa57
...
...
@@ -58,6 +58,8 @@ ULONG WINAPI IDirectMusicCollectionImpl_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMUSIC_LockModule
();
return
refCount
;
}
...
...
@@ -70,6 +72,9 @@ ULONG WINAPI IDirectMusicCollectionImpl_IUnknown_Release (LPUNKNOWN iface) {
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_UnlockModule
();
return
refCount
;
}
...
...
dlls/dmusic/dmusic.c
View file @
e8cafa57
...
...
@@ -44,6 +44,8 @@ ULONG WINAPI IDirectMusic8Impl_AddRef (LPDIRECTMUSIC8 iface) {
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMUSIC_LockModule
();
return
refCount
;
}
...
...
@@ -56,6 +58,9 @@ ULONG WINAPI IDirectMusic8Impl_Release (LPDIRECTMUSIC8 iface) {
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_UnlockModule
();
return
refCount
;
}
...
...
dlls/dmusic/dmusic_main.c
View file @
e8cafa57
...
...
@@ -23,41 +23,48 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmusic
);
LONG
DMUSIC_refCount
=
0
;
typedef
struct
{
/* IUnknown fields */
IClassFactoryVtbl
*
lpVtbl
;
DWORD
ref
;
}
IClassFactoryImpl
;
/******************************************************************
* DirectMusic ClassFactory
*/
static
HRESULT
WINAPI
DirectMusicCF_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
DirectMusicCF_AddRef
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
return
InterlockedIncrement
(
&
This
->
ref
);
DMUSIC_LockModule
();
return
2
;
/* non-heap based object */
}
static
ULONG
WINAPI
DirectMusicCF_Release
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
/* static class, won't be freed */
return
InterlockedDecrement
(
&
This
->
ref
);
DMUSIC_UnlockModule
()
;
return
1
;
/* non-heap based object */
}
static
HRESULT
WINAPI
DirectMusicCF_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_CreateDirectMusicImpl
(
riid
,
(
LPVOID
*
)
ppobj
,
pOuter
);
}
static
HRESULT
WINAPI
DirectMusicCF_LockServer
(
LPCLASSFACTORY
iface
,
BOOL
dolock
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
FIXME
(
"(%p, %d): stub
\n
"
,
This
,
dolock
);
TRACE
(
"(%d)
\n
"
,
dolock
);
if
(
dolock
)
DMUSIC_LockModule
();
else
DMUSIC_UnlockModule
();
return
S_OK
;
}
...
...
@@ -69,37 +76,44 @@ static IClassFactoryVtbl DirectMusicCF_Vtbl = {
DirectMusicCF_LockServer
};
static
IClassFactoryImpl
DirectMusic_CF
=
{
&
DirectMusicCF_Vtbl
,
1
};
static
IClassFactoryImpl
DirectMusic_CF
=
{
&
DirectMusicCF_Vtbl
};
/******************************************************************
* DirectMusicCollection ClassFactory
*/
static
HRESULT
WINAPI
CollectionCF_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
CollectionCF_AddRef
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
return
InterlockedIncrement
(
&
This
->
ref
);
DMUSIC_LockModule
();
return
2
;
/* non-heap based object */
}
static
ULONG
WINAPI
CollectionCF_Release
(
LPCLASSFACTORY
iface
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
/* static class, won't be freed */
return
InterlockedDecrement
(
&
This
->
ref
);
DMUSIC_UnlockModule
()
;
return
1
;
/* non-heap based object */
}
static
HRESULT
WINAPI
CollectionCF_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_CreateDirectMusicCollectionImpl
(
riid
,
ppobj
,
pOuter
);
}
static
HRESULT
WINAPI
CollectionCF_LockServer
(
LPCLASSFACTORY
iface
,
BOOL
dolock
)
{
IClassFactoryImpl
*
This
=
(
IClassFactoryImpl
*
)
iface
;
FIXME
(
"(%p, %d): stub
\n
"
,
This
,
dolock
);
TRACE
(
"(%d)
\n
"
,
dolock
);
if
(
dolock
)
DMUSIC_LockModule
();
else
DMUSIC_UnlockModule
();
return
S_OK
;
}
...
...
@@ -111,7 +125,7 @@ static IClassFactoryVtbl CollectionCF_Vtbl = {
CollectionCF_LockServer
};
static
IClassFactoryImpl
Collection_CF
=
{
&
CollectionCF_Vtbl
,
1
};
static
IClassFactoryImpl
Collection_CF
=
{
&
CollectionCF_Vtbl
};
/******************************************************************
* DllMain
...
...
@@ -136,8 +150,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
*
*/
HRESULT
WINAPI
DMUSIC_DllCanUnloadNow
(
void
)
{
FIXME
(
"(void): stub
\n
"
);
return
S_FALSE
;
return
DMUSIC_refCount
!=
0
?
S_FALSE
:
S_OK
;
}
...
...
dlls/dmusic/dmusic_private.h
View file @
e8cafa57
...
...
@@ -402,6 +402,12 @@ extern HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_SetPatch
/* custom :) */
extern
HRESULT
WINAPI
IDirectMusicInstrumentImpl_Custom_Load
(
LPDIRECTMUSICINSTRUMENT
iface
,
LPSTREAM
pStm
);
/**********************************************************************
* Dll lifetime tracking declaration for dmusic.dll
*/
extern
LONG
DMUSIC_refCount
;
static
inline
void
DMUSIC_LockModule
()
{
InterlockedIncrement
(
&
DMUSIC_refCount
);
}
static
inline
void
DMUSIC_UnlockModule
()
{
InterlockedDecrement
(
&
DMUSIC_refCount
);
}
/*****************************************************************************
* Helper Functions
...
...
dlls/dmusic/download.c
View file @
e8cafa57
...
...
@@ -42,6 +42,8 @@ ULONG WINAPI IDirectMusicDownloadImpl_AddRef (LPDIRECTMUSICDOWNLOAD iface) {
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMUSIC_LockModule
();
return
refCount
;
}
...
...
@@ -54,6 +56,9 @@ ULONG WINAPI IDirectMusicDownloadImpl_Release (LPDIRECTMUSICDOWNLOAD iface) {
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_UnlockModule
();
return
refCount
;
}
...
...
dlls/dmusic/downloadedinstrument.c
View file @
e8cafa57
...
...
@@ -42,6 +42,8 @@ ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_AddRef (LPDIRECTMUSICDOWNLOADE
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMUSIC_LockModule
();
return
refCount
;
}
...
...
@@ -54,6 +56,9 @@ ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_Release (LPDIRECTMUSICDOWNLOAD
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_UnlockModule
();
return
refCount
;
}
...
...
dlls/dmusic/instrument.c
View file @
e8cafa57
...
...
@@ -58,6 +58,8 @@ ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMUSIC_LockModule
();
return
refCount
;
}
...
...
@@ -70,6 +72,9 @@ ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_Release (LPUNKNOWN iface) {
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_UnlockModule
();
return
refCount
;
}
...
...
dlls/dmusic/port.c
View file @
e8cafa57
...
...
@@ -41,6 +41,8 @@ ULONG WINAPI IDirectMusicPortImpl_AddRef (LPDIRECTMUSICPORT iface) {
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMUSIC_LockModule
();
return
refCount
;
}
...
...
@@ -53,6 +55,9 @@ ULONG WINAPI IDirectMusicPortImpl_Release (LPDIRECTMUSICPORT iface) {
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_UnlockModule
();
return
refCount
;
}
...
...
dlls/dmusic/portdownload.c
View file @
e8cafa57
...
...
@@ -41,6 +41,8 @@ ULONG WINAPI IDirectMusicPortDownloadImpl_AddRef (LPDIRECTMUSICPORTDOWNLOAD ifac
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMUSIC_LockModule
();
return
refCount
;
}
...
...
@@ -53,6 +55,9 @@ ULONG WINAPI IDirectMusicPortDownloadImpl_Release (LPDIRECTMUSICPORTDOWNLOAD ifa
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_UnlockModule
();
return
refCount
;
}
...
...
dlls/dmusic/thru.c
View file @
e8cafa57
...
...
@@ -42,6 +42,8 @@ ULONG WINAPI IDirectMusicThruImpl_AddRef (LPDIRECTMUSICTHRU iface) {
TRACE
(
"(%p)->(ref before=%lu)
\n
"
,
This
,
refCount
-
1
);
DMUSIC_LockModule
();
return
refCount
;
}
...
...
@@ -54,6 +56,9 @@ ULONG WINAPI IDirectMusicThruImpl_Release (LPDIRECTMUSICTHRU iface) {
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
DMUSIC_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