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
6ad60648
Commit
6ad60648
authored
Apr 03, 2024
by
Paul Gofman
Committed by
Alexandre Julliard
Apr 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Try to handle broken IStream_Stat implementation in WM reader OpenStream().
parent
939b3d19
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
wm_reader.c
dlls/winegstreamer/wm_reader.c
+18
-0
No files found.
dlls/winegstreamer/wm_reader.c
View file @
6ad60648
...
...
@@ -2224,18 +2224,36 @@ static HRESULT WINAPI reader_Open(IWMSyncReader2 *iface, const WCHAR *filename)
static
HRESULT
WINAPI
reader_OpenStream
(
IWMSyncReader2
*
iface
,
IStream
*
stream
)
{
static
const
ULONG64
canary_size
=
0xdeadbeeffeedcafe
;
struct
wm_reader
*
reader
=
impl_from_IWMSyncReader2
(
iface
);
STATSTG
stat
;
HRESULT
hr
;
TRACE
(
"reader %p, stream %p.
\n
"
,
reader
,
stream
);
stat
.
cbSize
.
QuadPart
=
canary_size
;
if
(
FAILED
(
hr
=
IStream_Stat
(
stream
,
&
stat
,
STATFLAG_NONAME
)))
{
ERR
(
"Failed to stat stream, hr %#lx.
\n
"
,
hr
);
return
hr
;
}
if
(
stat
.
cbSize
.
QuadPart
==
canary_size
)
{
/* Call of Juarez: Gunslinger implements IStream_Stat as an empty function returning S_OK, leaving
* the output stat unchanged. Windows doesn't call IStream_Seek(_SEEK_END) and probably validates
* the size against WMV file headers so the bigger cbSize doesn't change anything.
* Such streams work as soon as the uninitialized cbSize is big enough which is usually the case
* (if that is not the case Windows will favour shorter cbSize). */
static
const
LARGE_INTEGER
zero
=
{
0
};
ULARGE_INTEGER
pos
=
{
.
QuadPart
=
canary_size
};
if
(
SUCCEEDED
(
hr
=
IStream_Seek
(
stream
,
zero
,
STREAM_SEEK_END
,
&
pos
)))
IStream_Seek
(
stream
,
zero
,
STREAM_SEEK_SET
,
NULL
);
stat
.
cbSize
.
QuadPart
=
pos
.
QuadPart
==
canary_size
?
0
:
pos
.
QuadPart
;
ERR
(
"IStream_Stat did not fill the stream size, size from _Seek %I64u.
\n
"
,
stat
.
cbSize
.
QuadPart
);
}
EnterCriticalSection
(
&
reader
->
cs
);
if
(
reader
->
wg_parser
)
...
...
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