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
5843a1a0
Commit
5843a1a0
authored
Jun 10, 2015
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jun 10, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dswave: COM cleanup for the IUnknown interface of DirectSoundWave.
Also lock/unlock the module only on creation/destruction of the object.
parent
770f7de1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
79 deletions
+71
-79
dswave.c
dlls/dswave/dswave.c
+71
-58
dswave_private.h
dlls/dswave/dswave_private.h
+0
-21
No files found.
dlls/dswave/dswave.c
View file @
5843a1a0
...
...
@@ -26,86 +26,95 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile);
as some sort of bridge between object and loader? */
static
const
GUID
IID_IDirectMusicWavePRIVATE
=
{
0x69e934e4
,
0x97f1
,
0x4f1d
,{
0x88
,
0xe8
,
0xf2
,
0xac
,
0x88
,
0x67
,
0x13
,
0x27
}};
static
ULONG
WINAPI
IDirectMusicWaveImpl_IUnknown_AddRef
(
LPUNKNOWN
iface
);
static
ULONG
WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_AddRef
(
LPDIRECTMUSICOBJECT
iface
);
static
ULONG
WINAPI
IDirectMusicWaveImpl_IPersistStream_AddRef
(
LPPERSISTSTREAM
iface
);
/*****************************************************************************
* IDirectMusicWaveImpl implementation
*/
typedef
struct
IDirectMusicWaveImpl
{
IUnknown
IUnknown_iface
;
const
IDirectMusicObjectVtbl
*
ObjectVtbl
;
const
IPersistStreamVtbl
*
PersistStreamVtbl
;
LONG
ref
;
LPDMUS_OBJECTDESC
pDesc
;
}
IDirectMusicWaveImpl
;
/* IDirectMusicWaveImpl IUnknown part: */
static
HRESULT
WINAPI
IDirectMusicWaveImpl_IUnknown_QueryInterface
(
LPUNKNOWN
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicWaveImpl
,
UnknownVtbl
,
iface
);
TRACE
(
"(%p, %s, %p)
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
ppobj
=
&
This
->
UnknownVtbl
;
IDirectMusicWaveImpl_IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicObject
))
{
*
ppobj
=
&
This
->
ObjectVtbl
;
IDirectMusicWaveImpl_IDirectMusicObject_AddRef
((
LPDIRECTMUSICOBJECT
)
&
This
->
ObjectVtbl
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistStream
))
{
*
ppobj
=
&
This
->
PersistStreamVtbl
;
IDirectMusicWaveImpl_IPersistStream_AddRef
((
LPPERSISTSTREAM
)
&
This
->
PersistStreamVtbl
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicWavePRIVATE
))
{
WARN
(
": requested private interface, expect crash
\n
"
);
return
E_NOINTERFACE
;
}
WARN
(
"(%p, %s, %p): not found
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
return
E_NOINTERFACE
;
static
inline
IDirectMusicWaveImpl
*
impl_from_IUnknown
(
IUnknown
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirectMusicWaveImpl
,
IUnknown_iface
);
}
static
ULONG
WINAPI
IDirectMusicWaveImpl_IUnknown_AddRef
(
LPUNKNOWN
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicWaveImpl
,
UnknownVtbl
,
iface
);
ULONG
refCount
=
InterlockedIncrement
(
&
This
->
ref
);
static
HRESULT
WINAPI
IUnknownImpl_QueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
void
**
ret_iface
)
{
IDirectMusicWaveImpl
*
This
=
impl_from_IUnknown
(
iface
);
TRACE
(
"(%p, %s, %p)
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ret_iface
);
*
ret_iface
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
*
ret_iface
=
iface
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicObject
))
*
ret_iface
=
&
This
->
ObjectVtbl
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistStream
))
*
ret_iface
=
&
This
->
PersistStreamVtbl
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicWavePRIVATE
))
{
FIXME
(
"(%p, %s, %p): Unsupported private interface
\n
"
,
This
,
debugstr_guid
(
riid
),
ret_iface
);
return
E_NOINTERFACE
;
}
else
{
WARN
(
"(%p, %s, %p): not found
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ret_iface
);
return
E_NOINTERFACE
;
}
IUnknown_AddRef
((
IUnknown
*
)
*
ret_iface
);
return
S_OK
;
}
TRACE
(
"(%p)->(ref before=%u)
\n
"
,
This
,
refCount
-
1
);
static
ULONG
WINAPI
IUnknownImpl_AddRef
(
IUnknown
*
iface
)
{
IDirectMusicWaveImpl
*
This
=
impl_from_IUnknown
(
iface
);
LONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
DSWAVE_LockModule
(
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
return
refCount
;
return
ref
;
}
static
ULONG
WINAPI
IDirectMusicWaveImpl_IUnknown_Release
(
LPUNKNOWN
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicWaveImpl
,
UnknownVtbl
,
iface
);
ULONG
refCount
=
InterlockedDecrement
(
&
This
->
ref
);
static
ULONG
WINAPI
IUnknownImpl_Release
(
IUnknown
*
iface
)
{
IDirectMusicWaveImpl
*
This
=
impl_from_IUnknown
(
iface
);
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(ref before=%u)
\n
"
,
This
,
refCount
+
1
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
if
(
!
refCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
if
(
!
ref
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pDesc
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
DSWAVE_UnlockModule
();
}
DSWAVE_UnlockModule
();
return
refCount
;
return
ref
;
}
static
const
IUnknownVtbl
DirectMusicWave_Unknown_V
tbl
=
{
IDirectMusicWaveImpl_IUnknown
_QueryInterface
,
IDirectMusicWaveImpl_IUnknown
_AddRef
,
IDirectMusicWaveImpl_IUnknown
_Release
static
const
IUnknownVtbl
unknown_v
tbl
=
{
IUnknownImpl
_QueryInterface
,
IUnknownImpl
_AddRef
,
IUnknownImpl
_Release
};
/* IDirectMusicWaveImpl IDirectMusicObject part: */
static
HRESULT
WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_QueryInterface
(
LPDIRECTMUSICOBJECT
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicWaveImpl
,
ObjectVtbl
,
iface
);
return
I
DirectMusicWaveImpl_IUnknown_QueryInterface
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
,
riid
,
ppobj
);
return
I
Unknown_QueryInterface
(
&
This
->
IUnknown_iface
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_AddRef
(
LPDIRECTMUSICOBJECT
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicWaveImpl
,
ObjectVtbl
,
iface
);
return
I
DirectMusicWaveImpl_IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
I
Unknown_AddRef
(
&
This
->
IUnknown_iface
);
}
static
ULONG
WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_Release
(
LPDIRECTMUSICOBJECT
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicWaveImpl
,
ObjectVtbl
,
iface
);
return
I
DirectMusicWaveImpl_IUnknown_Release
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
I
Unknown_Release
(
&
This
->
IUnknown_iface
);
}
static
HRESULT
WINAPI
IDirectMusicWaveImpl_IDirectMusicObject_GetDescriptor
(
LPDIRECTMUSICOBJECT
iface
,
LPDMUS_OBJECTDESC
pDesc
)
{
...
...
@@ -309,17 +318,17 @@ static const IDirectMusicObjectVtbl DirectMusicWave_Object_Vtbl = {
/* IDirectMusicWaveImpl IPersistStream part: */
static
HRESULT
WINAPI
IDirectMusicWaveImpl_IPersistStream_QueryInterface
(
LPPERSISTSTREAM
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicWaveImpl
,
PersistStreamVtbl
,
iface
);
return
I
DirectMusicWaveImpl_IUnknown_QueryInterface
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
,
riid
,
ppobj
);
return
I
Unknown_QueryInterface
(
&
This
->
IUnknown_iface
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectMusicWaveImpl_IPersistStream_AddRef
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicWaveImpl
,
PersistStreamVtbl
,
iface
);
return
I
DirectMusicWaveImpl_IUnknown_AddRef
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
I
Unknown_AddRef
(
&
This
->
IUnknown_iface
);
}
static
ULONG
WINAPI
IDirectMusicWaveImpl_IPersistStream_Release
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicWaveImpl
,
PersistStreamVtbl
,
iface
);
return
I
DirectMusicWaveImpl_IUnknown_Release
((
LPUNKNOWN
)
&
This
->
UnknownVtbl
);
return
I
Unknown_Release
(
&
This
->
IUnknown_iface
);
}
static
HRESULT
WINAPI
IDirectMusicWaveImpl_IPersistStream_GetClassID
(
LPPERSISTSTREAM
iface
,
CLSID
*
pClassID
)
{
...
...
@@ -501,20 +510,24 @@ static const IPersistStreamVtbl DirectMusicWave_PersistStream_Vtbl = {
HRESULT
WINAPI
create_dswave
(
REFIID
lpcGUID
,
void
**
ppobj
)
{
IDirectMusicWaveImpl
*
obj
;
HRESULT
hr
;
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectMusicWaveImpl
));
if
(
NULL
==
obj
)
{
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
obj
->
UnknownVtbl
=
&
DirectMusicWave_Unknown_V
tbl
;
obj
->
IUnknown_iface
.
lpVtbl
=
&
unknown_v
tbl
;
obj
->
ObjectVtbl
=
&
DirectMusicWave_Object_Vtbl
;
obj
->
PersistStreamVtbl
=
&
DirectMusicWave_PersistStream_Vtbl
;
obj
->
pDesc
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
DMUS_OBJECTDESC
));
DM_STRUCT_INIT
(
obj
->
pDesc
);
obj
->
pDesc
->
dwValidData
|=
DMUS_OBJ_CLASS
;
obj
->
pDesc
->
guidClass
=
CLSID_DirectMusicSegment
;
/* shown by tests */
obj
->
ref
=
0
;
/* will be inited by QueryInterface */
obj
->
ref
=
1
;
return
IDirectMusicWaveImpl_IUnknown_QueryInterface
((
LPUNKNOWN
)
&
obj
->
UnknownVtbl
,
lpcGUID
,
ppobj
);
DSWAVE_LockModule
();
hr
=
IUnknown_QueryInterface
(
&
obj
->
IUnknown_iface
,
lpcGUID
,
ppobj
);
IUnknown_Release
(
&
obj
->
IUnknown_iface
);
return
hr
;
}
dlls/dswave/dswave_private.h
View file @
5843a1a0
...
...
@@ -41,31 +41,10 @@
#include "dmusics.h"
/*****************************************************************************
* Interfaces
*/
typedef
struct
IDirectMusicWaveImpl
IDirectMusicWaveImpl
;
/*****************************************************************************
* ClassFactory
*/
extern
HRESULT
WINAPI
create_dswave
(
REFIID
lpcGUID
,
void
**
ret_iface
)
DECLSPEC_HIDDEN
;
/*****************************************************************************
* IDirectMusicWaveImpl implementation structure
*/
struct
IDirectMusicWaveImpl
{
/* IUnknown fields */
const
IUnknownVtbl
*
UnknownVtbl
;
const
IDirectMusicObjectVtbl
*
ObjectVtbl
;
const
IPersistStreamVtbl
*
PersistStreamVtbl
;
LONG
ref
;
/* IDirectMusicWaveImpl fields */
LPDMUS_OBJECTDESC
pDesc
;
};
/**********************************************************************
* Dll lifetime tracking declaration for dswave.dll
*/
...
...
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