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
930e0cdc
Commit
930e0cdc
authored
Feb 22, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz/filesource: Correctly report short reads from IAsyncReader_SyncRead().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e2f37558
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
+19
-18
filesource.c
dlls/quartz/filesource.c
+19
-16
filesource.c
dlls/quartz/tests/filesource.c
+0
-2
No files found.
dlls/quartz/filesource.c
View file @
930e0cdc
...
@@ -1309,34 +1309,37 @@ static HRESULT WINAPI FileAsyncReader_SyncReadAligned(IAsyncReader * iface, IMed
...
@@ -1309,34 +1309,37 @@ static HRESULT WINAPI FileAsyncReader_SyncReadAligned(IAsyncReader * iface, IMed
return
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
FileAsyncReader_SyncRead
(
IAsyncReader
*
iface
,
LONGLONG
llPosition
,
LONG
lLength
,
BYTE
*
pBuffer
)
static
HRESULT
WINAPI
FileAsyncReader_SyncRead
(
IAsyncReader
*
iface
,
LONGLONG
offset
,
LONG
length
,
BYTE
*
buffer
)
{
{
OVERLAPPED
ovl
;
OVERLAPPED
ovl
;
HRESULT
hr
=
S_OK
;
FileAsyncReader
*
filter
=
impl_from_IAsyncReader
(
iface
);
FileAsyncReader
*
This
=
impl_from_IAsyncReader
(
iface
);
DWORD
read_len
;
HRESULT
hr
;
BOOL
ret
;
TRACE
(
"%p->(%s, %d, %p)
\n
"
,
This
,
wine_dbgstr_longlong
(
llPosition
),
lLength
,
pBuffer
);
TRACE
(
"filter %p, offset %s, length %d, buffer %p.
\n
"
,
filter
,
wine_dbgstr_longlong
(
offset
),
length
,
buffer
);
ZeroMemory
(
&
ovl
,
sizeof
(
ovl
));
ZeroMemory
(
&
ovl
,
sizeof
(
ovl
));
ovl
.
hEvent
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
ovl
.
hEvent
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
/* NOTE: llPosition is the actual byte position to start reading from */
/* NOTE: llPosition is the actual byte position to start reading from */
ovl
.
u
.
s
.
Offset
=
(
DWORD
)
llPosition
;
ovl
.
u
.
s
.
Offset
=
(
DWORD
)
offset
;
ovl
.
u
.
s
.
OffsetHigh
=
(
DWORD
)
(
llPosition
>>
(
sizeof
(
DWORD
)
*
8
));
ovl
.
u
.
s
.
OffsetHigh
=
(
DWORD
)(
offset
>>
(
sizeof
(
DWORD
)
*
8
));
if
(
!
ReadFile
(
This
->
hFile
,
pBuffer
,
lLength
,
NULL
,
&
ovl
))
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
if
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_IO_PENDING
))
hr
=
S_OK
;
if
(
SUCCEEDED
(
hr
))
ret
=
ReadFile
(
filter
->
hFile
,
buffer
,
length
,
NULL
,
&
ovl
);
if
(
ret
||
GetLastError
()
==
ERROR_IO_PENDING
)
{
{
DWORD
dwBytesRead
;
if
(
GetOverlappedResult
(
filter
->
hFile
,
&
ovl
,
&
read_len
,
TRUE
))
hr
=
(
read_len
==
length
)
?
S_OK
:
S_FALSE
;
if
(
!
GetOverlappedResult
(
This
->
hFile
,
&
ovl
,
&
dwBytesRead
,
TRUE
))
else
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
}
}
else
if
(
GetLastError
()
==
ERROR_HANDLE_EOF
)
hr
=
S_FALSE
;
else
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
CloseHandle
(
ovl
.
hEvent
);
CloseHandle
(
ovl
.
hEvent
);
...
...
dlls/quartz/tests/filesource.c
View file @
930e0cdc
...
@@ -722,7 +722,6 @@ static void test_async_reader(void)
...
@@ -722,7 +722,6 @@ static void test_async_reader(void)
ok
(
buffer
[
i
]
==
(
10
+
i
)
%
111
,
"Got wrong byte %02x at %u.
\n
"
,
buffer
[
i
],
i
);
ok
(
buffer
[
i
]
==
(
10
+
i
)
%
111
,
"Got wrong byte %02x at %u.
\n
"
,
buffer
[
i
],
i
);
hr
=
IAsyncReader_SyncRead
(
reader
,
590
,
20
,
buffer
);
hr
=
IAsyncReader_SyncRead
(
reader
,
590
,
20
,
buffer
);
todo_wine
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
10
;
i
++
)
for
(
i
=
0
;
i
<
10
;
i
++
)
ok
(
buffer
[
i
]
==
(
590
+
i
)
%
111
,
"Got wrong byte %02x at %u.
\n
"
,
buffer
[
i
],
i
);
ok
(
buffer
[
i
]
==
(
590
+
i
)
%
111
,
"Got wrong byte %02x at %u.
\n
"
,
buffer
[
i
],
i
);
...
@@ -731,7 +730,6 @@ todo_wine
...
@@ -731,7 +730,6 @@ todo_wine
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
hr
=
IAsyncReader_SyncRead
(
reader
,
600
,
10
,
buffer
);
hr
=
IAsyncReader_SyncRead
(
reader
,
600
,
10
,
buffer
);
todo_wine
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
buffer
[
0
]
==
0xcc
,
"Got wrong byte %02x.
\n
"
,
buffer
[
0
]);
ok
(
buffer
[
0
]
==
0xcc
,
"Got wrong byte %02x.
\n
"
,
buffer
[
0
]);
...
...
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