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
ade8d0c1
Commit
ade8d0c1
authored
Apr 28, 2015
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Apr 28, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmloader: Use the generic DirectMusicObject implementation for DMContainer.
parent
f9fe3293
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
276 additions
and
166 deletions
+276
-166
Makefile.in
dlls/dmloader/Makefile.in
+1
-0
container.c
dlls/dmloader/container.c
+51
-165
dmobject.c
dlls/dmloader/dmobject.c
+170
-0
dmobject.h
dlls/dmloader/dmobject.h
+53
-0
loader.c
dlls/dmloader/tests/loader.c
+1
-1
No files found.
dlls/dmloader/Makefile.in
View file @
ade8d0c1
...
...
@@ -5,6 +5,7 @@ C_SRCS = \
container.c
\
debug.c
\
dmloader_main.c
\
dmobject.c
\
loader.c
\
loaderstream.c
...
...
dlls/dmloader/container.c
View file @
ade8d0c1
...
...
@@ -18,6 +18,7 @@
*/
#include "dmloader_private.h"
#include "dmobject.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dmloader
);
WINE_DECLARE_DEBUG_CHANNEL
(
dmfile
);
...
...
@@ -32,13 +33,11 @@ WINE_DECLARE_DEBUG_CHANNEL(dmdump);
*/
typedef
struct
IDirectMusicContainerImpl
{
IDirectMusicContainer
IDirectMusicContainer_iface
;
const
IDirectMusicObjectVtbl
*
ObjectVtbl
;
const
IPersistStreamVtbl
*
PersistStreamVtbl
;
struct
dmobject
dmobj
;
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
)
...
...
@@ -91,9 +90,9 @@ static HRESULT WINAPI IDirectMusicContainerImpl_QueryInterface(IDirectMusicConta
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDirectMusicContainer
))
*
ret_iface
=
&
This
->
IDirectMusicContainer_iface
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IDirectMusicObject
))
*
ret_iface
=
&
This
->
ObjectVtbl
;
*
ret_iface
=
&
This
->
dmobj
.
IDirectMusicObject_iface
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistStream
))
*
ret_iface
=
&
This
->
PersistStreamVtbl
;
*
ret_iface
=
&
This
->
dmobj
.
IPersistStream_iface
;
else
{
WARN
(
"Unknown interface %s
\n
"
,
debugstr_dmguid
(
riid
));
*
ret_iface
=
NULL
;
...
...
@@ -180,103 +179,13 @@ static const IDirectMusicContainerVtbl dmcontainer_vtbl = {
};
/* IDirectMusicObject part: */
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_QueryInterface
(
LPDIRECTMUSICOBJECT
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ObjectVtbl
,
iface
);
return
IDirectMusicContainerImpl_QueryInterface
(
&
This
->
IDirectMusicContainer_iface
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_AddRef
(
LPDIRECTMUSICOBJECT
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ObjectVtbl
,
iface
);
return
IDirectMusicContainer_AddRef
(
&
This
->
IDirectMusicContainer_iface
);
}
static
ULONG
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_Release
(
LPDIRECTMUSICOBJECT
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ObjectVtbl
,
iface
);
return
IDirectMusicContainerImpl_Release
(
&
This
->
IDirectMusicContainer_iface
);
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_GetDescriptor
(
LPDIRECTMUSICOBJECT
iface
,
LPDMUS_OBJECTDESC
pDesc
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ObjectVtbl
,
iface
);
TRACE
(
"(%p, %p):
\n
"
,
This
,
pDesc
);
/* check if we can write to whole pDesc */
if
(
IsBadReadPtr
(
pDesc
,
sizeof
(
DWORD
)))
{
ERR
(
": pDesc->dwSize bad read pointer
\n
"
);
return
E_POINTER
;
}
if
(
pDesc
->
dwSize
!=
sizeof
(
DMUS_OBJECTDESC
))
{
ERR
(
": invalid pDesc->dwSize
\n
"
);
return
E_INVALIDARG
;
}
if
(
IsBadWritePtr
(
pDesc
,
sizeof
(
DMUS_OBJECTDESC
)))
{
ERR
(
": pDesc bad write pointer
\n
"
);
return
E_POINTER
;
}
DM_STRUCT_INIT
(
pDesc
);
*
pDesc
=
This
->
Desc
;
return
S_OK
;
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_SetDescriptor
(
LPDIRECTMUSICOBJECT
iface
,
LPDMUS_OBJECTDESC
pDesc
)
{
DWORD
dwNewFlags
=
0
;
DWORD
dwFlagDifference
;
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ObjectVtbl
,
iface
);
TRACE
(
"(%p, %p):
\n
"
,
This
,
pDesc
);
/* check if we can read whole pDesc */
if
(
IsBadReadPtr
(
pDesc
,
sizeof
(
DWORD
)))
{
ERR
(
": pDesc->dwSize bad read pointer
\n
"
);
return
E_POINTER
;
}
if
(
pDesc
->
dwSize
!=
sizeof
(
DMUS_OBJECTDESC
))
{
ERR
(
": invalid pDesc->dwSize
\n
"
);
return
E_INVALIDARG
;
}
if
(
IsBadReadPtr
(
pDesc
,
sizeof
(
DMUS_OBJECTDESC
)))
{
ERR
(
": pDesc bad read pointer
\n
"
);
return
E_POINTER
;
}
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_OBJECT
)
{
This
->
Desc
.
guidObject
=
pDesc
->
guidObject
;
dwNewFlags
|=
DMUS_OBJ_OBJECT
;
}
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_NAME
)
{
lstrcpynW
(
This
->
Desc
.
wszName
,
pDesc
->
wszName
,
DMUS_MAX_NAME
);
dwNewFlags
|=
DMUS_OBJ_NAME
;
}
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_CATEGORY
)
{
lstrcpynW
(
This
->
Desc
.
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
dwNewFlags
|=
DMUS_OBJ_CATEGORY
;
}
if
(
pDesc
->
dwValidData
&
(
DMUS_OBJ_FILENAME
|
DMUS_OBJ_FULLPATH
))
{
lstrcpynW
(
This
->
Desc
.
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
dwNewFlags
|=
(
pDesc
->
dwValidData
&
(
DMUS_OBJ_FILENAME
|
DMUS_OBJ_FULLPATH
));
}
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_VERSION
)
{
This
->
Desc
.
vVersion
.
dwVersionLS
=
pDesc
->
vVersion
.
dwVersionLS
;
This
->
Desc
.
vVersion
.
dwVersionMS
=
pDesc
->
vVersion
.
dwVersionMS
;
dwNewFlags
|=
DMUS_OBJ_VERSION
;
}
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_DATE
)
{
This
->
Desc
.
ftDate
.
dwHighDateTime
=
pDesc
->
ftDate
.
dwHighDateTime
;
This
->
Desc
.
ftDate
.
dwLowDateTime
=
pDesc
->
ftDate
.
dwLowDateTime
;
dwNewFlags
|=
DMUS_OBJ_DATE
;
}
/* set new flags */
This
->
Desc
.
dwValidData
|=
dwNewFlags
;
dwFlagDifference
=
pDesc
->
dwValidData
-
dwNewFlags
;
if
(
dwFlagDifference
)
{
pDesc
->
dwValidData
&=
~
dwFlagDifference
;
/* and with bitwise complement */
return
S_FALSE
;
}
else
return
S_OK
;
static
inline
IDirectMusicContainerImpl
*
impl_from_IDirectMusicObject
(
IDirectMusicObject
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirectMusicContainerImpl
,
dmobj
.
IDirectMusicObject_iface
);
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IDirectMusicObject_ParseDescriptor
(
LPDIRECTMUSICOBJECT
iface
,
LPSTREAM
pStream
,
LPDMUS_OBJECTDESC
pDesc
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
ObjectVtbl
,
iface
);
IDirectMusicContainerImpl
*
This
=
impl_from_IDirectMusicObject
(
iface
);
WINE_CHUNK
Chunk
;
DWORD
StreamSize
,
StreamCount
,
ListSize
[
1
],
ListCount
[
1
];
LARGE_INTEGER
liMove
;
/* used when skipping chunks */
...
...
@@ -444,34 +353,24 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_ParseDescript
return
S_OK
;
}
static
const
IDirectMusicObjectVtbl
DirectMusicContainer_Object_V
tbl
=
{
IDirectMusicContainerImpl
_IDirectMusicObject_QueryInterface
,
IDirectMusicContainerImpl
_IDirectMusicObject_AddRef
,
IDirectMusicContainerImpl
_IDirectMusicObject_Release
,
IDirectMusicContainerImpl
_IDirectMusicObject_GetDescriptor
,
IDirectMusicContainerImpl
_IDirectMusicObject_SetDescriptor
,
static
const
IDirectMusicObjectVtbl
dmobject_v
tbl
=
{
dmobj
_IDirectMusicObject_QueryInterface
,
dmobj
_IDirectMusicObject_AddRef
,
dmobj
_IDirectMusicObject_Release
,
dmobj
_IDirectMusicObject_GetDescriptor
,
dmobj
_IDirectMusicObject_SetDescriptor
,
IDirectMusicContainerImpl_IDirectMusicObject_ParseDescriptor
};
/* IPersistStream part: */
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IPersistStream_QueryInterface
(
LPPERSISTSTREAM
iface
,
REFIID
riid
,
LPVOID
*
ppobj
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
PersistStreamVtbl
,
iface
);
return
IDirectMusicContainerImpl_QueryInterface
(
&
This
->
IDirectMusicContainer_iface
,
riid
,
ppobj
);
}
static
ULONG
WINAPI
IDirectMusicContainerImpl_IPersistStream_AddRef
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
PersistStreamVtbl
,
iface
);
return
IDirectMusicContainer_AddRef
(
&
This
->
IDirectMusicContainer_iface
);
}
static
ULONG
WINAPI
IDirectMusicContainerImpl_IPersistStream_Release
(
LPPERSISTSTREAM
iface
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
PersistStreamVtbl
,
iface
);
return
IDirectMusicContainerImpl_Release
(
&
This
->
IDirectMusicContainer_iface
);
static
inline
IDirectMusicContainerImpl
*
impl_from_IPersistStream
(
IPersistStream
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IDirectMusicContainerImpl
,
dmobj
.
IPersistStream_iface
);
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IPersistStream_GetClassID
(
LPPERSISTSTREAM
iface
,
CLSID
*
pClassID
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
PersistStreamVtbl
,
iface
);
IDirectMusicContainerImpl
*
This
=
impl_from_IPersistStream
(
iface
);
TRACE
(
"(%p, %p)
\n
"
,
This
,
pClassID
);
if
(
IsBadWritePtr
(
pClassID
,
sizeof
(
CLSID
)))
{
ERR
(
": pClassID bad write pointer
\n
"
);
...
...
@@ -482,13 +381,8 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_GetClassID (LPPER
return
S_OK
;
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IPersistStream_IsDirty
(
LPPERSISTSTREAM
iface
)
{
/* FIXME: is implemented (somehow) */
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IPersistStream_Load
(
LPPERSISTSTREAM
iface
,
IStream
*
pStm
)
{
ICOM_THIS_MULTI
(
IDirectMusicContainerImpl
,
PersistStreamVtbl
,
iface
);
IDirectMusicContainerImpl
*
This
=
impl_from_IPersistStream
(
iface
);
WINE_CHUNK
Chunk
;
DWORD
StreamSize
,
StreamCount
,
ListSize
[
3
],
ListCount
[
3
];
LARGE_INTEGER
liMove
;
/* used when skipping chunks */
...
...
@@ -533,8 +427,8 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTST
switch
(
Chunk
.
fccID
)
{
case
DMUS_FOURCC_CONTAINER_FORM
:
{
TRACE_
(
dmfile
)(
": container form
\n
"
);
This
->
D
esc
.
guidClass
=
CLSID_DirectMusicContainer
;
This
->
D
esc
.
dwValidData
|=
DMUS_OBJ_CLASS
;
This
->
dmobj
.
d
esc
.
guidClass
=
CLSID_DirectMusicContainer
;
This
->
dmobj
.
d
esc
.
dwValidData
|=
DMUS_OBJ_CLASS
;
do
{
IStream_Read
(
pStm
,
&
Chunk
,
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
),
NULL
);
StreamCount
+=
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
)
+
Chunk
.
dwSize
;
...
...
@@ -548,23 +442,23 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTST
}
case
DMUS_FOURCC_GUID_CHUNK
:
{
TRACE_
(
dmfile
)(
": GUID chunk
\n
"
);
IStream_Read
(
pStm
,
&
This
->
D
esc
.
guidObject
,
Chunk
.
dwSize
,
NULL
);
This
->
D
esc
.
dwValidData
|=
DMUS_OBJ_OBJECT
;
TRACE_
(
dmdump
)(
": GUID: %s
\n
"
,
debugstr_guid
(
&
This
->
D
esc
.
guidObject
));
IStream_Read
(
pStm
,
&
This
->
dmobj
.
d
esc
.
guidObject
,
Chunk
.
dwSize
,
NULL
);
This
->
dmobj
.
d
esc
.
dwValidData
|=
DMUS_OBJ_OBJECT
;
TRACE_
(
dmdump
)(
": GUID: %s
\n
"
,
debugstr_guid
(
&
This
->
dmobj
.
d
esc
.
guidObject
));
break
;
}
case
DMUS_FOURCC_VERSION_CHUNK
:
{
TRACE_
(
dmfile
)(
": version chunk
\n
"
);
IStream_Read
(
pStm
,
&
This
->
D
esc
.
vVersion
,
Chunk
.
dwSize
,
NULL
);
This
->
D
esc
.
dwValidData
|=
DMUS_OBJ_VERSION
;
TRACE_
(
dmdump
)(
": version: %s
\n
"
,
debugstr_dmversion
(
&
This
->
D
esc
.
vVersion
));
IStream_Read
(
pStm
,
&
This
->
dmobj
.
d
esc
.
vVersion
,
Chunk
.
dwSize
,
NULL
);
This
->
dmobj
.
d
esc
.
dwValidData
|=
DMUS_OBJ_VERSION
;
TRACE_
(
dmdump
)(
": version: %s
\n
"
,
debugstr_dmversion
(
&
This
->
dmobj
.
d
esc
.
vVersion
));
break
;
}
case
DMUS_FOURCC_DATE_CHUNK
:
{
TRACE_
(
dmfile
)(
": date chunk
\n
"
);
IStream_Read
(
pStm
,
&
This
->
D
esc
.
ftDate
,
Chunk
.
dwSize
,
NULL
);
This
->
D
esc
.
dwValidData
|=
DMUS_OBJ_DATE
;
TRACE_
(
dmdump
)(
": date: %s
\n
"
,
debugstr_filetime
(
&
This
->
D
esc
.
ftDate
));
IStream_Read
(
pStm
,
&
This
->
dmobj
.
d
esc
.
ftDate
,
Chunk
.
dwSize
,
NULL
);
This
->
dmobj
.
d
esc
.
dwValidData
|=
DMUS_OBJ_DATE
;
TRACE_
(
dmdump
)(
": date: %s
\n
"
,
debugstr_filetime
(
&
This
->
dmobj
.
d
esc
.
ftDate
));
break
;
}
case
DMUS_FOURCC_CATEGORY_CHUNK
:
{
...
...
@@ -572,14 +466,14 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTST
/* if it happens that string is too long,
read what we can and skip the rest*/
if
(
Chunk
.
dwSize
>
DMUS_MAX_CATEGORY_SIZE
)
{
IStream_Read
(
pStm
,
This
->
D
esc
.
wszCategory
,
DMUS_MAX_CATEGORY_SIZE
,
NULL
);
IStream_Read
(
pStm
,
This
->
dmobj
.
d
esc
.
wszCategory
,
DMUS_MAX_CATEGORY_SIZE
,
NULL
);
liMove
.
QuadPart
=
Chunk
.
dwSize
-
DMUS_MAX_CATEGORY_SIZE
;
IStream_Seek
(
pStm
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
}
else
{
IStream_Read
(
pStm
,
This
->
D
esc
.
wszCategory
,
Chunk
.
dwSize
,
NULL
);
IStream_Read
(
pStm
,
This
->
dmobj
.
d
esc
.
wszCategory
,
Chunk
.
dwSize
,
NULL
);
}
This
->
D
esc
.
dwValidData
|=
DMUS_OBJ_CATEGORY
;
TRACE_
(
dmdump
)(
": category: %s
\n
"
,
debugstr_w
(
This
->
Desc
.
wszCategory
));
This
->
dmobj
.
d
esc
.
dwValidData
|=
DMUS_OBJ_CATEGORY
;
TRACE_
(
dmdump
)(
": category: %s
\n
"
,
debugstr_w
(
This
->
dmobj
.
desc
.
wszCategory
));
break
;
}
case
FOURCC_LIST
:
{
...
...
@@ -603,14 +497,14 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTST
/* if it happens that string is too long,
read what we can and skip the rest*/
if
(
Chunk
.
dwSize
>
DMUS_MAX_NAME_SIZE
)
{
IStream_Read
(
pStm
,
This
->
D
esc
.
wszName
,
DMUS_MAX_NAME_SIZE
,
NULL
);
IStream_Read
(
pStm
,
This
->
dmobj
.
d
esc
.
wszName
,
DMUS_MAX_NAME_SIZE
,
NULL
);
liMove
.
QuadPart
=
Chunk
.
dwSize
-
DMUS_MAX_NAME_SIZE
;
IStream_Seek
(
pStm
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
}
else
{
IStream_Read
(
pStm
,
This
->
D
esc
.
wszName
,
Chunk
.
dwSize
,
NULL
);
IStream_Read
(
pStm
,
This
->
dmobj
.
d
esc
.
wszName
,
Chunk
.
dwSize
,
NULL
);
}
This
->
D
esc
.
dwValidData
|=
DMUS_OBJ_NAME
;
TRACE_
(
dmdump
)(
": name: %s
\n
"
,
debugstr_w
(
This
->
D
esc
.
wszName
));
This
->
dmobj
.
d
esc
.
dwValidData
|=
DMUS_OBJ_NAME
;
TRACE_
(
dmdump
)(
": name: %s
\n
"
,
debugstr_w
(
This
->
dmobj
.
d
esc
.
wszName
));
break
;
}
default:
{
...
...
@@ -848,7 +742,7 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTST
}
}
TRACE_
(
dmfile
)(
": reading finished
\n
"
);
This
->
D
esc
.
dwValidData
|=
DMUS_OBJ_LOADED
;
This
->
dmobj
.
d
esc
.
dwValidData
|=
DMUS_OBJ_LOADED
;
break
;
}
default:
{
...
...
@@ -905,25 +799,15 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTST
return
result
;
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IPersistStream_Save
(
LPPERSISTSTREAM
iface
,
IStream
*
pStm
,
BOOL
fClearDirty
)
{
ERR
(
": should not be needed
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
IDirectMusicContainerImpl_IPersistStream_GetSizeMax
(
LPPERSISTSTREAM
iface
,
ULARGE_INTEGER
*
pcbSize
)
{
ERR
(
": should not be needed
\n
"
);
return
E_NOTIMPL
;
}
static
const
IPersistStreamVtbl
DirectMusicContainer_PersistStream_Vtbl
=
{
IDirectMusicContainerImpl_IPersistStream_QueryInterface
,
IDirectMusicContainerImpl_IPersistStream_AddRef
,
IDirectMusicContainerImpl_IPersistStream_Release
,
static
const
IPersistStreamVtbl
persiststream_vtbl
=
{
dmobj_IPersistStream_QueryInterface
,
dmobj_IPersistStream_AddRef
,
dmobj_IPersistStream_Release
,
IDirectMusicContainerImpl_IPersistStream_GetClassID
,
IDirectMusicContainerI
mpl_IPersistStream_IsDirty
,
uni
mpl_IPersistStream_IsDirty
,
IDirectMusicContainerImpl_IPersistStream_Load
,
IDirectMusicContainerI
mpl_IPersistStream_Save
,
IDirectMusicContainerI
mpl_IPersistStream_GetSizeMax
uni
mpl_IPersistStream_Save
,
uni
mpl_IPersistStream_GetSizeMax
};
/* for ClassFactory */
...
...
@@ -938,9 +822,11 @@ HRESULT WINAPI create_dmcontainer(REFIID lpcGUID, void **ppobj)
return
E_OUTOFMEMORY
;
}
obj
->
IDirectMusicContainer_iface
.
lpVtbl
=
&
dmcontainer_vtbl
;
obj
->
ObjectVtbl
=
&
DirectMusicContainer_Object_Vtbl
;
obj
->
PersistStreamVtbl
=
&
DirectMusicContainer_PersistStream_Vtbl
;
obj
->
ref
=
1
;
dmobject_init
(
&
obj
->
dmobj
,
&
CLSID_DirectMusicContainer
,
(
IUnknown
*
)
&
obj
->
IDirectMusicContainer_iface
);
obj
->
dmobj
.
IDirectMusicObject_iface
.
lpVtbl
=
&
dmobject_vtbl
;
obj
->
dmobj
.
IPersistStream_iface
.
lpVtbl
=
&
persiststream_vtbl
;
obj
->
pContainedObjects
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
list
));
list_init
(
obj
->
pContainedObjects
);
...
...
dlls/dmloader/dmobject.c
0 → 100644
View file @
ade8d0c1
/*
* Base IDirectMusicObject Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2014 Michael Stefaniuc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "objbase.h"
#include "dmusici.h"
#include "dmobject.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dmobj
);
/* Generic IDirectMusicObject methods */
static
inline
struct
dmobject
*
impl_from_IDirectMusicObject
(
IDirectMusicObject
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
dmobject
,
IDirectMusicObject_iface
);
}
HRESULT
WINAPI
dmobj_IDirectMusicObject_QueryInterface
(
IDirectMusicObject
*
iface
,
REFIID
riid
,
void
**
ret_iface
)
{
struct
dmobject
*
This
=
impl_from_IDirectMusicObject
(
iface
);
return
IUnknown_QueryInterface
(
This
->
outer_unk
,
riid
,
ret_iface
);
}
ULONG
WINAPI
dmobj_IDirectMusicObject_AddRef
(
IDirectMusicObject
*
iface
)
{
struct
dmobject
*
This
=
impl_from_IDirectMusicObject
(
iface
);
return
IUnknown_AddRef
(
This
->
outer_unk
);
}
ULONG
WINAPI
dmobj_IDirectMusicObject_Release
(
IDirectMusicObject
*
iface
)
{
struct
dmobject
*
This
=
impl_from_IDirectMusicObject
(
iface
);
return
IUnknown_Release
(
This
->
outer_unk
);
}
HRESULT
WINAPI
dmobj_IDirectMusicObject_GetDescriptor
(
IDirectMusicObject
*
iface
,
DMUS_OBJECTDESC
*
desc
)
{
struct
dmobject
*
This
=
impl_from_IDirectMusicObject
(
iface
);
TRACE
(
"(%p/%p)->(%p)
\n
"
,
iface
,
This
,
desc
);
if
(
!
desc
)
return
E_POINTER
;
memcpy
(
desc
,
&
This
->
desc
,
This
->
desc
.
dwSize
);
return
S_OK
;
}
HRESULT
WINAPI
dmobj_IDirectMusicObject_SetDescriptor
(
IDirectMusicObject
*
iface
,
DMUS_OBJECTDESC
*
desc
)
{
struct
dmobject
*
This
=
impl_from_IDirectMusicObject
(
iface
);
HRESULT
ret
=
S_OK
;
TRACE
(
"(%p, %p)
\n
"
,
iface
,
desc
);
if
(
!
desc
)
return
E_POINTER
;
/* Immutable property */
if
(
desc
->
dwValidData
&
DMUS_OBJ_CLASS
)
{
desc
->
dwValidData
&=
~
DMUS_OBJ_CLASS
;
ret
=
S_FALSE
;
}
/* Set only valid fields */
if
(
desc
->
dwValidData
&
DMUS_OBJ_OBJECT
)
This
->
desc
.
guidObject
=
desc
->
guidObject
;
if
(
desc
->
dwValidData
&
DMUS_OBJ_NAME
)
lstrcpynW
(
This
->
desc
.
wszName
,
desc
->
wszName
,
DMUS_MAX_NAME
);
if
(
desc
->
dwValidData
&
DMUS_OBJ_CATEGORY
)
lstrcpynW
(
This
->
desc
.
wszCategory
,
desc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
if
(
desc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
lstrcpynW
(
This
->
desc
.
wszFileName
,
desc
->
wszFileName
,
DMUS_MAX_FILENAME
);
if
(
desc
->
dwValidData
&
DMUS_OBJ_VERSION
)
This
->
desc
.
vVersion
=
desc
->
vVersion
;
if
(
desc
->
dwValidData
&
DMUS_OBJ_DATE
)
This
->
desc
.
ftDate
=
desc
->
ftDate
;
if
(
desc
->
dwValidData
&
DMUS_OBJ_MEMORY
)
{
This
->
desc
.
llMemLength
=
desc
->
llMemLength
;
memcpy
(
This
->
desc
.
pbMemData
,
desc
->
pbMemData
,
desc
->
llMemLength
);
}
if
(
desc
->
dwValidData
&
DMUS_OBJ_STREAM
)
IStream_Clone
(
desc
->
pStream
,
&
This
->
desc
.
pStream
);
This
->
desc
.
dwValidData
|=
desc
->
dwValidData
;
return
ret
;
}
/* Generic IPersistStream methods */
static
inline
struct
dmobject
*
impl_from_IPersistStream
(
IPersistStream
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
dmobject
,
IPersistStream_iface
);
}
HRESULT
WINAPI
dmobj_IPersistStream_QueryInterface
(
IPersistStream
*
iface
,
REFIID
riid
,
void
**
ret_iface
)
{
struct
dmobject
*
This
=
impl_from_IPersistStream
(
iface
);
return
IUnknown_QueryInterface
(
This
->
outer_unk
,
riid
,
ret_iface
);
}
ULONG
WINAPI
dmobj_IPersistStream_AddRef
(
IPersistStream
*
iface
)
{
struct
dmobject
*
This
=
impl_from_IPersistStream
(
iface
);
return
IUnknown_AddRef
(
This
->
outer_unk
);
}
ULONG
WINAPI
dmobj_IPersistStream_Release
(
IPersistStream
*
iface
)
{
struct
dmobject
*
This
=
impl_from_IPersistStream
(
iface
);
return
IUnknown_Release
(
This
->
outer_unk
);
}
/* IPersistStream methods not implemented in native */
HRESULT
WINAPI
unimpl_IPersistStream_GetClassID
(
IPersistStream
*
iface
,
CLSID
*
class
)
{
TRACE
(
"(%p, %p): method not implemented
\n
"
,
iface
,
class
);
return
E_NOTIMPL
;
}
HRESULT
WINAPI
unimpl_IPersistStream_IsDirty
(
IPersistStream
*
iface
)
{
TRACE
(
"(%p): method not implemented, always returning S_FALSE
\n
"
,
iface
);
return
S_FALSE
;
}
HRESULT
WINAPI
unimpl_IPersistStream_Save
(
IPersistStream
*
iface
,
IStream
*
stream
,
BOOL
clear_dirty
)
{
TRACE
(
"(%p, %p, %d): method not implemented
\n
"
,
iface
,
stream
,
clear_dirty
);
return
E_NOTIMPL
;
}
HRESULT
WINAPI
unimpl_IPersistStream_GetSizeMax
(
IPersistStream
*
iface
,
ULARGE_INTEGER
*
size
)
{
TRACE
(
"(%p, %p): method not implemented
\n
"
,
iface
,
size
);
return
E_NOTIMPL
;
}
void
dmobject_init
(
struct
dmobject
*
dmobj
,
const
GUID
*
class
,
IUnknown
*
outer_unk
)
{
dmobj
->
outer_unk
=
outer_unk
;
dmobj
->
desc
.
dwSize
=
sizeof
(
dmobj
->
desc
);
dmobj
->
desc
.
dwValidData
=
DMUS_OBJ_CLASS
;
dmobj
->
desc
.
guidClass
=
*
class
;
}
dlls/dmloader/dmobject.h
0 → 100644
View file @
ade8d0c1
/*
* Base IDirectMusicObject Implementation
*
* Copyright (C) 2014 Michael Stefaniuc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
struct
dmobject
{
IDirectMusicObject
IDirectMusicObject_iface
;
IPersistStream
IPersistStream_iface
;
IUnknown
*
outer_unk
;
DMUS_OBJECTDESC
desc
;
};
void
dmobject_init
(
struct
dmobject
*
dmobj
,
const
GUID
*
class
,
IUnknown
*
outer_unk
)
DECLSPEC_HIDDEN
;
/* Generic IDirectMusicObject methods */
HRESULT
WINAPI
dmobj_IDirectMusicObject_QueryInterface
(
IDirectMusicObject
*
iface
,
REFIID
riid
,
void
**
ret_iface
)
DECLSPEC_HIDDEN
;
ULONG
WINAPI
dmobj_IDirectMusicObject_AddRef
(
IDirectMusicObject
*
iface
)
DECLSPEC_HIDDEN
;
ULONG
WINAPI
dmobj_IDirectMusicObject_Release
(
IDirectMusicObject
*
iface
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
dmobj_IDirectMusicObject_GetDescriptor
(
IDirectMusicObject
*
iface
,
DMUS_OBJECTDESC
*
desc
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
dmobj_IDirectMusicObject_SetDescriptor
(
IDirectMusicObject
*
iface
,
DMUS_OBJECTDESC
*
desc
)
DECLSPEC_HIDDEN
;
/* Generic IPersistStream methods */
HRESULT
WINAPI
dmobj_IPersistStream_QueryInterface
(
IPersistStream
*
iface
,
REFIID
riid
,
void
**
ret_iface
)
DECLSPEC_HIDDEN
;
ULONG
WINAPI
dmobj_IPersistStream_AddRef
(
IPersistStream
*
iface
)
DECLSPEC_HIDDEN
;
ULONG
WINAPI
dmobj_IPersistStream_Release
(
IPersistStream
*
iface
)
DECLSPEC_HIDDEN
;
/* IPersistStream methods not implemented in native */
HRESULT
WINAPI
unimpl_IPersistStream_GetClassID
(
IPersistStream
*
iface
,
CLSID
*
class
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
unimpl_IPersistStream_IsDirty
(
IPersistStream
*
iface
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
unimpl_IPersistStream_Save
(
IPersistStream
*
iface
,
IStream
*
stream
,
BOOL
clear_dirty
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
unimpl_IPersistStream_GetSizeMax
(
IPersistStream
*
iface
,
ULARGE_INTEGER
*
size
)
DECLSPEC_HIDDEN
;
dlls/dmloader/tests/loader.c
View file @
ade8d0c1
...
...
@@ -241,7 +241,7 @@ static void test_container(void)
/* Unimplemented IPersistStream methods */
hr
=
IPersistStream_IsDirty
(
ps
);
todo_wine
ok
(
hr
==
S_FALSE
,
"IPersistStream_IsDirty failed: %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"IPersistStream_IsDirty failed: %08x
\n
"
,
hr
);
hr
=
IPersistStream_GetSizeMax
(
ps
,
&
size
);
ok
(
hr
==
E_NOTIMPL
,
"IPersistStream_GetSizeMax failed: %08x
\n
"
,
hr
);
hr
=
IPersistStream_Save
(
ps
,
NULL
,
TRUE
);
...
...
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