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
9ab1cfb5
Commit
9ab1cfb5
authored
Jun 04, 2014
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jun 12, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmloader: COM cleanup for IDirectMusicContainer.
parent
8a15ea11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
80 deletions
+80
-80
container.c
dlls/dmloader/container.c
+80
-59
dmloader_private.h
dlls/dmloader/dmloader_private.h
+0
-21
No files found.
dlls/dmloader/container.c
View file @
9ab1cfb5
...
...
@@ -27,14 +27,24 @@ WINE_DECLARE_DEBUG_CHANNEL(dmdump);
#define DMUS_MAX_NAME_SIZE DMUS_MAX_NAME*sizeof(WCHAR)
#define DMUS_MAX_FILENAME_SIZE DMUS_MAX_FILENAME*sizeof(WCHAR)
static
ULONG
WINAPI
IDirectMusicContainerImpl_IDirectMusicContainer_AddRef
(
LPDIRECTMUSICCONTAINER
iface
);
static
ULONG
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_AddRef
(
LPDIRECTMUSICOBJECT
iface
);
static
ULONG
WINAPI
IDirectMusicContainerImpl_IPersistStream_AddRef
(
LPPERSISTSTREAM
iface
);
/*****************************************************************************
* IDirectMusicContainerImpl implementation
*/
/* IUnknown/IDirectMusicContainer part: */
typedef
struct
IDirectMusicContainerImpl
{
IDirectMusicContainer
IDirectMusicContainer_iface
;
const
IDirectMusicObjectVtbl
*
ObjectVtbl
;
const
IPersistStreamVtbl
*
PersistStreamVtbl
;
LONG
ref
;
IStream
*
pStream
;
DMUS_IO_CONTAINER_HEADER
Header
;
/* header */
struct
list
*
pContainedObjects
;
/* data */
DMUS_OBJECTDESC
Desc
;
}
IDirectMusicContainerImpl
;
static
inline
IDirectMusicContainerImpl
*
impl_from_IDirectMusicContainer
(
IDirectMusicContainer
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirectMusicContainerImpl
,
IDirectMusicContainer_iface
);
}
static
HRESULT
destroy_dmcontainer
(
IDirectMusicContainerImpl
*
This
)
{
...
...
@@ -72,52 +82,59 @@ static HRESULT destroy_dmcontainer(IDirectMusicContainerImpl *This)
return
S_OK
;
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IDirectMusicContainer_QueryInterface
(
LPDIRECTMUSICCONTAINER
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ContainerVtbl
,
iface
);
TRACE
(
"(%p, %s, %p)
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ppobj
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDirectMusicContainer
))
{
*
ppobj
=
&
This
->
ContainerVtbl
;
IDirectMusicContainerImpl_IDirectMusicContainer_AddRef
((
LPDIRECTMUSICCONTAINER
)
&
This
->
ContainerVtbl
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicObject
))
{
*
ppobj
=
&
This
->
ObjectVtbl
;
IDirectMusicContainerImpl_IDirectMusicObject_AddRef
((
LPDIRECTMUSICOBJECT
)
&
This
->
ObjectVtbl
);
return
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistStream
))
{
*
ppobj
=
&
This
->
PersistStreamVtbl
;
IDirectMusicContainerImpl_IPersistStream_AddRef
((
LPPERSISTSTREAM
)
&
This
->
PersistStreamVtbl
);
return
S_OK
;
}
WARN
(
": not found
\n
"
);
return
E_NOINTERFACE
;
static
HRESULT
WINAPI
IDirectMusicContainerImpl_QueryInterface
(
IDirectMusicContainer
*
iface
,
REFIID
riid
,
void
**
ret_iface
)
{
IDirectMusicContainerImpl
*
This
=
impl_from_IDirectMusicContainer
(
iface
);
TRACE
(
"(%p, %s, %p)
\n
"
,
This
,
debugstr_dmguid
(
riid
),
ret_iface
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDirectMusicContainer
))
*
ret_iface
=
&
This
->
IDirectMusicContainer_iface
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicObject
))
*
ret_iface
=
&
This
->
ObjectVtbl
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistStream
))
*
ret_iface
=
&
This
->
PersistStreamVtbl
;
else
{
WARN
(
"Unknown interface %s
\n
"
,
debugstr_dmguid
(
riid
));
*
ret_iface
=
NULL
;
return
E_NOINTERFACE
;
}
IUnknown_AddRef
((
IUnknown
*
)
*
ret_iface
);
return
S_OK
;
}
static
ULONG
WINAPI
IDirectMusicContainerImpl_IDirectMusicContainer_AddRef
(
LPDIRECTMUSICCONTAINER
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ContainerVtbl
,
iface
);
TRACE
(
"(%p): AddRef from %d
\n
"
,
This
,
This
->
dwRef
);
return
InterlockedIncrement
(
&
This
->
dwRef
);
static
ULONG
WINAPI
IDirectMusicContainerImpl_AddRef
(
IDirectMusicContainer
*
iface
)
{
IDirectMusicContainerImpl
*
This
=
impl_from_IDirectMusicContainer
(
iface
);
LONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
IDirectMusicContainerImpl_IDirectMusicContainer_Release
(
LPDIRECTMUSICCONTAINER
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ContainerVtbl
,
iface
);
DWORD
dwRef
=
InterlockedDecrement
(
&
This
->
dwRef
);
TRACE
(
"(%p): ReleaseRef to %d
\n
"
,
This
,
dwRef
);
if
(
dwRef
==
0
)
{
if
(
This
->
pStream
)
destroy_dmcontainer
(
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
unlock_module
();
}
return
dwRef
;
static
ULONG
WINAPI
IDirectMusicContainerImpl_Release
(
IDirectMusicContainer
*
iface
)
{
IDirectMusicContainerImpl
*
This
=
impl_from_IDirectMusicContainer
(
iface
);
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
if
(
This
->
pStream
)
destroy_dmcontainer
(
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
unlock_module
();
}
return
ref
;
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IDirectMusicContainer_EnumObject
(
LPDIRECTMUSICCONTAINER
iface
,
REFGUID
rguidClass
,
DWORD
dwIndex
,
LPDMUS_OBJECTDESC
pDesc
,
WCHAR
*
pwszAlias
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ContainerVtbl
,
iface
);
static
HRESULT
WINAPI
IDirectMusicContainerImpl_EnumObject
(
IDirectMusicContainer
*
iface
,
REFGUID
rguidClass
,
DWORD
dwIndex
,
DMUS_OBJECTDESC
*
pDesc
,
WCHAR
*
pwszAlias
)
{
IDirectMusicContainerImpl
*
This
=
impl_from_IDirectMusicContainer
(
iface
);
struct
list
*
pEntry
;
LPWINE_CONTAINER_ENTRY
pContainedObject
;
DWORD
dwCount
=
0
;
...
...
@@ -155,27 +172,27 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_EnumObject
return
S_FALSE
;
}
static
const
IDirectMusicContainerVtbl
DirectMusicContainer_Container_V
tbl
=
{
IDirectMusicContainerImpl_IDirectMusicContainer
_QueryInterface
,
IDirectMusicContainerImpl_IDirectMusicContainer
_AddRef
,
IDirectMusicContainerImpl_IDirectMusicContainer
_Release
,
IDirectMusicContainerImpl_IDirectMusicContainer
_EnumObject
static
const
IDirectMusicContainerVtbl
dmcontainer_v
tbl
=
{
IDirectMusicContainerImpl
_QueryInterface
,
IDirectMusicContainerImpl
_AddRef
,
IDirectMusicContainerImpl
_Release
,
IDirectMusicContainerImpl
_EnumObject
};
/* IDirectMusicObject part: */
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_QueryInterface
(
LPDIRECTMUSICOBJECT
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ObjectVtbl
,
iface
);
return
IDirectMusicContainerImpl_
IDirectMusicContainer_QueryInterface
((
LPDIRECTMUSICCONTAINER
)
&
This
->
ContainerVtbl
,
riid
,
ppobj
);
return
IDirectMusicContainerImpl_
QueryInterface
(
&
This
->
IDirectMusicContainer_iface
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_AddRef
(
LPDIRECTMUSICOBJECT
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ObjectVtbl
,
iface
);
return
IDirectMusicContainer
Impl_IDirectMusicContainer_AddRef
((
LPDIRECTMUSICCONTAINER
)
&
This
->
ContainerVtbl
);
return
IDirectMusicContainer
_AddRef
(
&
This
->
IDirectMusicContainer_iface
);
}
static
ULONG
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_Release
(
LPDIRECTMUSICOBJECT
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ObjectVtbl
,
iface
);
return
IDirectMusicContainerImpl_
IDirectMusicContainer_Release
((
LPDIRECTMUSICCONTAINER
)
&
This
->
ContainerVtbl
);
return
IDirectMusicContainerImpl_
Release
(
&
This
->
IDirectMusicContainer_iface
);
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_GetDescriptor
(
LPDIRECTMUSICOBJECT
iface
,
LPDMUS_OBJECTDESC
pDesc
)
{
...
...
@@ -439,17 +456,17 @@ static const IDirectMusicObjectVtbl DirectMusicContainer_Object_Vtbl = {
/* IPersistStream part: */
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IPersistStream_QueryInterface
(
LPPERSISTSTREAM
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
PersistStreamVtbl
,
iface
);
return
IDirectMusicContainerImpl_
IDirectMusicContainer_QueryInterface
((
LPDIRECTMUSICCONTAINER
)
&
This
->
ContainerVtbl
,
riid
,
ppobj
);
return
IDirectMusicContainerImpl_
QueryInterface
(
&
This
->
IDirectMusicContainer_iface
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectMusicContainerImpl_IPersistStream_AddRef
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
PersistStreamVtbl
,
iface
);
return
IDirectMusicContainer
Impl_IDirectMusicContainer_AddRef
((
LPDIRECTMUSICCONTAINER
)
&
This
->
ContainerVtbl
);
return
IDirectMusicContainer
_AddRef
(
&
This
->
IDirectMusicContainer_iface
);
}
static
ULONG
WINAPI
IDirectMusicContainerImpl_IPersistStream_Release
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
PersistStreamVtbl
,
iface
);
return
IDirectMusicContainerImpl_
IDirectMusicContainer_Release
((
LPDIRECTMUSICCONTAINER
)
&
This
->
ContainerVtbl
);
return
IDirectMusicContainerImpl_
Release
(
&
This
->
IDirectMusicContainer_iface
);
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IPersistStream_GetClassID
(
LPPERSISTSTREAM
iface
,
CLSID
*
pClassID
)
{
...
...
@@ -913,20 +930,24 @@ static const IPersistStreamVtbl DirectMusicContainer_PersistStream_Vtbl = {
HRESULT
WINAPI
create_dmcontainer
(
REFIID
lpcGUID
,
void
**
ppobj
)
{
IDirectMusicContainerImpl
*
obj
;
HRESULT
hr
;
obj
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectMusicContainerImpl
));
if
(
NULL
==
obj
)
{
*
ppobj
=
NULL
;
return
E_OUTOFMEMORY
;
}
obj
->
ContainerVtbl
=
&
DirectMusicContainer_Container_V
tbl
;
obj
->
IDirectMusicContainer_iface
.
lpVtbl
=
&
dmcontainer_v
tbl
;
obj
->
ObjectVtbl
=
&
DirectMusicContainer_Object_Vtbl
;
obj
->
PersistStreamVtbl
=
&
DirectMusicContainer_PersistStream_Vtbl
;
obj
->
dwRef
=
0
;
/* will be inited by QueryInterface */
obj
->
ref
=
1
;
obj
->
pContainedObjects
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
list
));
list_init
(
obj
->
pContainedObjects
);
lock_module
();
return
IDirectMusicContainerImpl_IDirectMusicContainer_QueryInterface
((
LPDIRECTMUSICCONTAINER
)
&
obj
->
ContainerVtbl
,
lpcGUID
,
ppobj
);
hr
=
IDirectMusicContainer_QueryInterface
(
&
obj
->
IDirectMusicContainer_iface
,
lpcGUID
,
ppobj
);
IDirectMusicContainer_Release
(
&
obj
->
IDirectMusicContainer_iface
);
return
hr
;
}
dlls/dmloader/dmloader_private.h
View file @
9ab1cfb5
...
...
@@ -56,7 +56,6 @@ typedef struct IDirectMusicLoaderCF IDirectMusicLoaderCF;
typedef
struct
IDirectMusicContainerCF
IDirectMusicContainerCF
;
typedef
struct
IDirectMusicLoaderImpl
IDirectMusicLoaderImpl
;
typedef
struct
IDirectMusicContainerImpl
IDirectMusicContainerImpl
;
typedef
struct
IDirectMusicLoaderFileStream
IDirectMusicLoaderFileStream
;
typedef
struct
IDirectMusicLoaderResourceStream
IDirectMusicLoaderResourceStream
;
...
...
@@ -110,26 +109,6 @@ typedef struct _WINE_CONTAINER_ENTRY {
}
WINE_CONTAINER_ENTRY
,
*
LPWINE_CONTAINER_ENTRY
;
/*****************************************************************************
* IDirectMusicContainerImpl implementation structure
*/
struct
IDirectMusicContainerImpl
{
/* VTABLEs */
const
IDirectMusicContainerVtbl
*
ContainerVtbl
;
const
IDirectMusicObjectVtbl
*
ObjectVtbl
;
const
IPersistStreamVtbl
*
PersistStreamVtbl
;
/* reference counter */
LONG
dwRef
;
/* stream */
LPSTREAM
pStream
;
/* header */
DMUS_IO_CONTAINER_HEADER
Header
;
/* data */
struct
list
*
pContainedObjects
;
/* descriptor */
DMUS_OBJECTDESC
Desc
;
};
/*****************************************************************************
* IDirectMusicLoaderFileStream implementation structure
*/
struct
IDirectMusicLoaderFileStream
{
...
...
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