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
35ef5df7
Commit
35ef5df7
authored
Jun 04, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Rewrite GetOverlappedResult for the new async I/O behavior.
parent
7c6bc78b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
54 deletions
+15
-54
file.c
dlls/kernel32/file.c
+15
-52
file.c
dlls/kernel32/tests/file.c
+0
-2
No files found.
dlls/kernel32/file.c
View file @
35ef5df7
...
...
@@ -539,17 +539,11 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
*
* If successful (and relevant) lpTransferred will hold the number of
* bytes transferred during the async operation.
*
* BUGS
*
* Currently only works for WaitCommEvent, ReadFile, WriteFile
* with communications ports.
*
*/
BOOL
WINAPI
GetOverlappedResult
(
HANDLE
hFile
,
LPOVERLAPPED
lpOverlapped
,
LPDWORD
lpTransferred
,
BOOL
bWait
)
{
DWORD
r
=
WAIT_OBJECT_0
;
NTSTATUS
status
;
TRACE
(
"(%p %p %p %x)
\n
"
,
hFile
,
lpOverlapped
,
lpTransferred
,
bWait
);
...
...
@@ -558,57 +552,26 @@ BOOL WINAPI GetOverlappedResult(HANDLE hFile, LPOVERLAPPED lpOverlapped,
ERR
(
"lpOverlapped was null
\n
"
);
return
FALSE
;
}
if
(
bWait
)
status
=
lpOverlapped
->
Internal
;
if
(
status
==
STATUS_PENDING
)
{
if
(
lpOverlapped
->
hEvent
)
if
(
!
bWait
)
{
do
{
TRACE
(
"waiting on %p
\n
"
,
lpOverlapped
);
r
=
WaitForSingleObjectEx
(
lpOverlapped
->
hEvent
,
INFINITE
,
TRUE
);
TRACE
(
"wait on %p returned %d
\n
"
,
lpOverlapped
,
r
);
}
while
(
r
==
WAIT_IO_COMPLETION
);
SetLastError
(
ERROR_IO_INCOMPLETE
);
return
FALSE
;
}
else
{
/* busy loop */
while
(
((
volatile
OVERLAPPED
*
)
lpOverlapped
)
->
Internal
==
STATUS_PENDING
)
Sleep
(
10
);
}
}
else
if
(
lpOverlapped
->
Internal
==
STATUS_PENDING
)
{
/* Wait in order to give APCs a chance to run. */
/* This is cheating, so we must set the event again in case of success -
it may be a non-manual reset event. */
do
{
TRACE
(
"waiting on %p
\n
"
,
lpOverlapped
);
r
=
WaitForSingleObjectEx
(
lpOverlapped
->
hEvent
,
0
,
TRUE
);
TRACE
(
"wait on %p returned %d
\n
"
,
lpOverlapped
,
r
);
}
while
(
r
==
WAIT_IO_COMPLETION
);
if
(
r
==
WAIT_OBJECT_0
&&
lpOverlapped
->
hEvent
)
NtSetEvent
(
lpOverlapped
->
hEvent
,
NULL
);
}
if
(
r
==
WAIT_FAILED
)
{
WARN
(
"wait operation failed
\n
"
);
return
FALSE
;
if
(
WaitForSingleObject
(
lpOverlapped
->
hEvent
?
lpOverlapped
->
hEvent
:
hFile
,
INFINITE
)
==
WAIT_FAILED
)
return
FALSE
;
status
=
lpOverlapped
->
Internal
;
}
if
(
lpTransferred
)
*
lpTransferred
=
lpOverlapped
->
InternalHigh
;
switch
(
lpOverlapped
->
Internal
)
{
case
STATUS_SUCCESS
:
return
TRUE
;
case
STATUS_PENDING
:
SetLastError
(
ERROR_IO_INCOMPLETE
);
if
(
bWait
)
ERR
(
"PENDING status after waiting!
\n
"
);
return
FALSE
;
default:
SetLastError
(
RtlNtStatusToDosError
(
lpOverlapped
->
Internal
)
);
return
FALSE
;
}
if
(
status
)
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
!
status
;
}
/***********************************************************************
...
...
dlls/kernel32/tests/file.c
View file @
35ef5df7
...
...
@@ -1768,9 +1768,7 @@ static void test_overlapped(void)
ov
.
Internal
=
STATUS_PENDING
;
ov
.
InternalHigh
=
0xabcd
;
r
=
GetOverlappedResult
(
0
,
&
ov
,
&
result
,
0
);
todo_wine
{
ok
(
GetLastError
()
==
ERROR_IO_INCOMPLETE
,
"wrong error %u
\n
"
,
GetLastError
()
);
}
ok
(
r
==
FALSE
,
"should return false
\n
"
);
ok
(
result
==
0
,
"wrong result %u
\n
"
,
result
);
...
...
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