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
003bdbd5
Commit
003bdbd5
authored
Jul 15, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jul 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmcompos: Reimplement ParseDescriptor() for DirectMusicChordMap.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9348c093
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
149 deletions
+37
-149
chordmap.c
dlls/dmcompos/chordmap.c
+25
-144
dmcompos.c
dlls/dmcompos/tests/dmcompos.c
+12
-5
No files found.
dlls/dmcompos/chordmap.c
View file @
003bdbd5
...
...
@@ -103,153 +103,34 @@ static const IDirectMusicChordMapVtbl dmchordmap_vtbl = {
};
/* IDirectMusicChordMapImpl IDirectMusicObject part: */
static
HRESULT
WINAPI
IDirectMusicObjectImpl
_ParseDescriptor
(
IDirectMusicObject
*
iface
,
IStream
*
pStream
,
DMUS_OBJECTDESC
*
pD
esc
)
static
HRESULT
WINAPI
chord_IDirectMusicObject
_ParseDescriptor
(
IDirectMusicObject
*
iface
,
IStream
*
stream
,
DMUS_OBJECTDESC
*
d
esc
)
{
DMUS_PRIVATE_CHUNK
Chunk
;
DWORD
StreamSize
,
StreamCount
,
ListSize
[
1
],
ListCount
[
1
];
LARGE_INTEGER
liMove
;
/* used when skipping chunks */
struct
chunk_entry
riff
=
{
0
};
HRESULT
hr
;
TRACE
(
"(%p, %p)
\n
"
,
pStream
,
pD
esc
);
TRACE
(
"(%p, %p, %p)
\n
"
,
iface
,
stream
,
d
esc
);
/* FIXME: should this be determined from stream? */
pDesc
->
dwValidData
|=
DMUS_OBJ_CLASS
;
pDesc
->
guidClass
=
CLSID_DirectMusicChordMap
;
if
(
!
stream
||
!
desc
)
return
E_POINTER
;
IStream_Read
(
pStream
,
&
Chunk
,
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
),
NULL
);
TRACE_
(
dmfile
)(
": %s chunk (size = 0x%04x)"
,
debugstr_fourcc
(
Chunk
.
fccID
),
Chunk
.
dwSize
);
switch
(
Chunk
.
fccID
)
{
case
FOURCC_RIFF
:
{
IStream_Read
(
pStream
,
&
Chunk
.
fccID
,
sizeof
(
FOURCC
),
NULL
);
TRACE_
(
dmfile
)(
": RIFF chunk of type %s"
,
debugstr_fourcc
(
Chunk
.
fccID
));
StreamSize
=
Chunk
.
dwSize
-
sizeof
(
FOURCC
);
StreamCount
=
0
;
if
(
Chunk
.
fccID
==
DMUS_FOURCC_CHORDMAP_FORM
)
{
TRACE_
(
dmfile
)(
": chord map form
\n
"
);
do
{
IStream_Read
(
pStream
,
&
Chunk
,
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
),
NULL
);
StreamCount
+=
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
)
+
Chunk
.
dwSize
;
TRACE_
(
dmfile
)(
": %s chunk (size = 0x%04x)"
,
debugstr_fourcc
(
Chunk
.
fccID
),
Chunk
.
dwSize
);
switch
(
Chunk
.
fccID
)
{
case
DMUS_FOURCC_GUID_CHUNK
:
{
TRACE_
(
dmfile
)(
": GUID chunk
\n
"
);
pDesc
->
dwValidData
|=
DMUS_OBJ_OBJECT
;
IStream_Read
(
pStream
,
&
pDesc
->
guidObject
,
Chunk
.
dwSize
,
NULL
);
break
;
}
case
DMUS_FOURCC_VERSION_CHUNK
:
{
TRACE_
(
dmfile
)(
": version chunk
\n
"
);
pDesc
->
dwValidData
|=
DMUS_OBJ_VERSION
;
IStream_Read
(
pStream
,
&
pDesc
->
vVersion
,
Chunk
.
dwSize
,
NULL
);
break
;
}
case
DMUS_FOURCC_CATEGORY_CHUNK
:
{
TRACE_
(
dmfile
)(
": category chunk
\n
"
);
pDesc
->
dwValidData
|=
DMUS_OBJ_CATEGORY
;
IStream_Read
(
pStream
,
pDesc
->
wszCategory
,
Chunk
.
dwSize
,
NULL
);
break
;
}
case
FOURCC_LIST
:
{
IStream_Read
(
pStream
,
&
Chunk
.
fccID
,
sizeof
(
FOURCC
),
NULL
);
TRACE_
(
dmfile
)(
": LIST chunk of type %s"
,
debugstr_fourcc
(
Chunk
.
fccID
));
ListSize
[
0
]
=
Chunk
.
dwSize
-
sizeof
(
FOURCC
);
ListCount
[
0
]
=
0
;
switch
(
Chunk
.
fccID
)
{
/* evil M$ UNFO list, which can (!?) contain INFO elements */
case
DMUS_FOURCC_UNFO_LIST
:
{
TRACE_
(
dmfile
)(
": UNFO list
\n
"
);
do
{
IStream_Read
(
pStream
,
&
Chunk
,
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
),
NULL
);
ListCount
[
0
]
+=
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
)
+
Chunk
.
dwSize
;
TRACE_
(
dmfile
)(
": %s chunk (size = 0x%04x)"
,
debugstr_fourcc
(
Chunk
.
fccID
),
Chunk
.
dwSize
);
switch
(
Chunk
.
fccID
)
{
/* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
(though strings seem to be valid unicode) */
case
mmioFOURCC
(
'I'
,
'N'
,
'A'
,
'M'
):
case
DMUS_FOURCC_UNAM_CHUNK
:
{
TRACE_
(
dmfile
)(
": name chunk
\n
"
);
pDesc
->
dwValidData
|=
DMUS_OBJ_NAME
;
IStream_Read
(
pStream
,
pDesc
->
wszName
,
Chunk
.
dwSize
,
NULL
);
break
;
}
case
mmioFOURCC
(
'I'
,
'A'
,
'R'
,
'T'
):
case
DMUS_FOURCC_UART_CHUNK
:
{
TRACE_
(
dmfile
)(
": artist chunk (ignored)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStream
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
case
mmioFOURCC
(
'I'
,
'C'
,
'O'
,
'P'
):
case
DMUS_FOURCC_UCOP_CHUNK
:
{
TRACE_
(
dmfile
)(
": copyright chunk (ignored)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStream
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
case
mmioFOURCC
(
'I'
,
'S'
,
'B'
,
'J'
):
case
DMUS_FOURCC_USBJ_CHUNK
:
{
TRACE_
(
dmfile
)(
": subject chunk (ignored)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStream
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
case
mmioFOURCC
(
'I'
,
'C'
,
'M'
,
'T'
):
case
DMUS_FOURCC_UCMT_CHUNK
:
{
TRACE_
(
dmfile
)(
": comment chunk (ignored)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStream
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unknown chunk (irrelevant & skipping)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStream
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
}
TRACE_
(
dmfile
)(
": ListCount[0] = %d < ListSize[0] = %d
\n
"
,
ListCount
[
0
],
ListSize
[
0
]);
}
while
(
ListCount
[
0
]
<
ListSize
[
0
]);
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unknown (skipping)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
-
sizeof
(
FOURCC
);
IStream_Seek
(
pStream
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
}
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unknown chunk (irrelevant & skipping)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStream
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
}
TRACE_
(
dmfile
)(
": StreamCount[0] = %d < StreamSize[0] = %d
\n
"
,
StreamCount
,
StreamSize
);
}
while
(
StreamCount
<
StreamSize
);
}
else
{
TRACE_
(
dmfile
)(
": unexpected chunk; loading failed)
\n
"
);
liMove
.
QuadPart
=
StreamSize
;
IStream_Seek
(
pStream
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
/* skip the rest of the chunk */
return
E_FAIL
;
}
TRACE_
(
dmfile
)(
": reading finished
\n
"
);
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unexpected chunk; loading failed)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStream
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
/* skip the rest of the chunk */
return
DMUS_E_INVALIDFILE
;
}
}
TRACE
(
": returning descriptor:
\n
%s
\n
"
,
debugstr_DMUS_OBJECTDESC
(
pDesc
));
return
S_OK
;
if
((
hr
=
stream_get_chunk
(
stream
,
&
riff
))
!=
S_OK
)
return
hr
;
if
(
riff
.
id
!=
FOURCC_RIFF
||
riff
.
type
!=
DMUS_FOURCC_CHORDMAP_FORM
)
{
TRACE
(
"loading failed: unexpected %s
\n
"
,
debugstr_chunk
(
&
riff
));
stream_skip_chunk
(
stream
,
&
riff
);
return
DMUS_E_CHUNKNOTFOUND
;
}
hr
=
dmobj_parsedescriptor
(
stream
,
&
riff
,
desc
,
DMUS_OBJ_OBJECT
);
if
(
FAILED
(
hr
))
return
hr
;
desc
->
guidClass
=
CLSID_DirectMusicChordMap
;
desc
->
dwValidData
|=
DMUS_OBJ_CLASS
;
TRACE
(
"returning descriptor:
\n
%s
\n
"
,
debugstr_DMUS_OBJECTDESC
(
desc
));
return
S_OK
;
}
static
const
IDirectMusicObjectVtbl
dmobject_vtbl
=
{
...
...
@@ -258,7 +139,7 @@ static const IDirectMusicObjectVtbl dmobject_vtbl = {
dmobj_IDirectMusicObject_Release
,
dmobj_IDirectMusicObject_GetDescriptor
,
dmobj_IDirectMusicObject_SetDescriptor
,
IDirectMusicObjectImpl
_ParseDescriptor
chord_IDirectMusicObject
_ParseDescriptor
};
/* IDirectMusicChordMapImpl IPersistStream part: */
...
...
dlls/dmcompos/tests/dmcompos.c
View file @
003bdbd5
...
...
@@ -530,11 +530,18 @@ static void test_parsedescriptor(void)
wine_dbgstr_guid
(
&
desc
.
guidClass
));
IStream_Release
(
stream
);
/* NULL pointers */
memset
(
&
desc
,
0
,
sizeof
(
desc
));
hr
=
IDirectMusicObject_ParseDescriptor
(
dmo
,
NULL
,
&
desc
);
ok
(
hr
==
E_POINTER
,
"ParseDescriptor failed: %08x, expected E_POINTER
\n
"
,
hr
);
hr
=
IDirectMusicObject_ParseDescriptor
(
dmo
,
stream
,
NULL
);
ok
(
hr
==
E_POINTER
,
"ParseDescriptor failed: %08x, expected E_POINTER
\n
"
,
hr
);
/* Wrong form */
empty
[
1
]
=
DMUS_FOURCC_CONTAINER_FORM
;
stream
=
gen_riff_stream
(
empty
);
hr
=
IDirectMusicObject_ParseDescriptor
(
dmo
,
stream
,
&
desc
);
todo_wine
ok
(
hr
==
DMUS_E_CHUNKNOTFOUND
,
ok
(
hr
==
DMUS_E_CHUNKNOTFOUND
,
"ParseDescriptor failed: %08x, expected DMUS_E_CHUNKNOTFOUND
\n
"
,
hr
);
/* All desc chunks, only DMUS_OBJ_OBJECT and DMUS_OBJ_CLASS supported */
...
...
@@ -542,7 +549,7 @@ static void test_parsedescriptor(void)
memset
(
&
desc
,
0
,
sizeof
(
desc
));
hr
=
IDirectMusicObject_ParseDescriptor
(
dmo
,
stream
,
&
desc
);
ok
(
hr
==
S_OK
,
"ParseDescriptor failed: %08x, expected S_OK
\n
"
,
hr
);
todo_wine
ok
(
desc
.
dwValidData
==
(
DMUS_OBJ_OBJECT
|
DMUS_OBJ_CLASS
),
ok
(
desc
.
dwValidData
==
(
DMUS_OBJ_OBJECT
|
DMUS_OBJ_CLASS
),
"Got valid data %#x, expected DMUS_OBJ_OBJECT | DMUS_OBJ_CLASS
\n
"
,
desc
.
dwValidData
);
ok
(
IsEqualGUID
(
&
desc
.
guidClass
,
&
CLSID_DirectMusicChordMap
),
"Got class guid %s, expected CLSID_DirectMusicChordMap
\n
"
,
...
...
@@ -557,8 +564,8 @@ static void test_parsedescriptor(void)
memset
(
&
desc
,
0
,
sizeof
(
desc
));
hr
=
IDirectMusicObject_ParseDescriptor
(
dmo
,
stream
,
&
desc
);
ok
(
hr
==
S_OK
,
"ParseDescriptor failed: %08x, expected S_OK
\n
"
,
hr
);
todo_wine
ok
(
desc
.
dwValidData
==
DMUS_OBJ_CLASS
,
"Got valid data %#x, expected DMUS_OBJ_CLASS
\n
"
,
desc
.
dwValidData
);
ok
(
desc
.
dwValidData
==
DMUS_OBJ_CLASS
,
"Got valid data %#x, expected DMUS_OBJ_CLASS
\n
"
,
desc
.
dwValidData
);
IStream_Release
(
stream
);
/* INFO list with INAM */
...
...
@@ -576,7 +583,7 @@ static void test_parsedescriptor(void)
memset
(
&
desc
,
0
,
sizeof
(
desc
));
hr
=
IDirectMusicObject_ParseDescriptor
(
dmo
,
stream
,
&
desc
);
ok
(
hr
==
S_OK
,
"ParseDescriptor failed: %08x, expected S_OK
\n
"
,
hr
);
todo_wine
ok
(
desc
.
dwValidData
==
(
DMUS_OBJ_OBJECT
|
DMUS_OBJ_CLASS
),
ok
(
desc
.
dwValidData
==
(
DMUS_OBJ_OBJECT
|
DMUS_OBJ_CLASS
),
"Got valid data %#x, expected DMUS_OBJ_OBJECT | DMUS_OBJ_CLASS
\n
"
,
desc
.
dwValidData
);
IStream_Release
(
stream
);
...
...
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