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
91195437
Commit
91195437
authored
Jan 01, 2002
by
Mike McCormack
Committed by
Alexandre Julliard
Jan 01, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set an overlapped's hEvent for ReadFile/WriteFile in an overlapped
completion function, not in ReadFileEx or WriteFileEx.
parent
193cf50a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
file.c
files/file.c
+20
-13
synchro.c
scheduler/synchro.c
+0
-1
No files found.
files/file.c
View file @
91195437
...
...
@@ -1335,10 +1335,9 @@ static BOOL FILE_ReadFileEx(HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
TRACE
(
"file %d to buf %p num %ld %p func %p
\n
"
,
hFile
,
buffer
,
bytesToRead
,
overlapped
,
lpCompletionRoutine
);
/* check that there is an overlapped struct
with an event flag
*/
if
(
(
overlapped
==
NULL
)
||
NtResetEvent
(
overlapped
->
hEvent
,
NULL
)
)
/* check that there is an overlapped struct */
if
(
overlapped
==
NULL
)
{
TRACE
(
"Overlapped not specified or invalid event flag
\n
"
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
...
...
@@ -1391,13 +1390,12 @@ BOOL WINAPI ReadFileEx(HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
LPOVERLAPPED
overlapped
,
LPOVERLAPPED_COMPLETION_ROUTINE
lpCompletionRoutine
)
{
/* FIXME: MS docs say we shouldn't set overlapped->hEvent */
overlapped
->
Internal
=
STATUS_PENDING
;
overlapped
->
InternalHigh
=
0
;
return
FILE_ReadFileEx
(
hFile
,
buffer
,
bytesToRead
,
overlapped
,
lpCompletionRoutine
);
}
static
VOID
CALLBACK
FILE_
Timeout
Complete
(
DWORD
status
,
DWORD
count
,
LPOVERLAPPED
ov
)
static
VOID
CALLBACK
FILE_
Overlapped
Complete
(
DWORD
status
,
DWORD
count
,
LPOVERLAPPED
ov
)
{
NtSetEvent
(
ov
->
hEvent
,
NULL
);
}
...
...
@@ -1412,7 +1410,7 @@ static BOOL FILE_TimeoutRead(HANDLE hFile, LPVOID buffer, DWORD bytesToRead, LPD
ZeroMemory
(
&
ov
,
sizeof
(
OVERLAPPED
));
if
(
STATUS_SUCCESS
==
NtCreateEvent
(
&
ov
.
hEvent
,
SYNCHRONIZE
,
NULL
,
0
,
0
))
{
if
(
ReadFileEx
(
hFile
,
buffer
,
bytesToRead
,
&
ov
,
FILE_
Timeout
Complete
))
if
(
ReadFileEx
(
hFile
,
buffer
,
bytesToRead
,
&
ov
,
FILE_
Overlapped
Complete
))
{
r
=
GetOverlappedResult
(
hFile
,
&
ov
,
bytesRead
,
TRUE
);
}
...
...
@@ -1442,8 +1440,9 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
{
case
FD_TYPE_OVERLAPPED
:
if
(
unix_handle
==
-
1
)
return
FALSE
;
if
(
!
overlapped
)
if
(
(
overlapped
==
NULL
)
||
NtResetEvent
(
overlapped
->
hEvent
,
NULL
)
)
{
TRACE
(
"Overlapped not specified or invalid event flag
\n
"
);
close
(
unix_handle
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
...
...
@@ -1476,7 +1475,7 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
overlapped
->
Internal
=
STATUS_PENDING
;
overlapped
->
InternalHigh
=
result
;
if
(
!
FILE_ReadFileEx
(
hFile
,
buffer
,
bytesToRead
,
overlapped
,
NULL
))
if
(
!
FILE_ReadFileEx
(
hFile
,
buffer
,
bytesToRead
,
overlapped
,
FILE_OverlappedComplete
))
return
FALSE
;
/* fail on return, with ERROR_IO_PENDING */
...
...
@@ -1573,7 +1572,7 @@ BOOL WINAPI WriteFileEx(HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
TRACE
(
"file %d to buf %p num %ld %p func %p stub
\n
"
,
hFile
,
buffer
,
bytesToWrite
,
overlapped
,
lpCompletionRoutine
);
if
(
(
overlapped
==
NULL
)
||
NtResetEvent
(
overlapped
->
hEvent
,
NULL
)
)
if
(
overlapped
==
NULL
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
...
...
@@ -1638,14 +1637,22 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
if
(
bytesWritten
)
*
bytesWritten
=
0
;
/* Do this before anything else */
if
(
!
bytesToWrite
)
return
TRUE
;
/* this will only have impact if the overlappd structure is specified */
if
(
overlapped
)
return
WriteFileEx
(
hFile
,
buffer
,
bytesToWrite
,
overlapped
,
NULL
);
unix_handle
=
FILE_GetUnixHandleType
(
hFile
,
GENERIC_WRITE
,
&
type
);
switch
(
type
)
{
case
FD_TYPE_OVERLAPPED
:
if
(
unix_handle
==
-
1
)
return
FALSE
;
if
(
(
overlapped
==
NULL
)
||
NtResetEvent
(
overlapped
->
hEvent
,
NULL
)
)
{
TRACE
(
"Overlapped not specified or invalid event flag
\n
"
);
close
(
unix_handle
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
/* FIXME: try write immediately before starting overlapped operation */
return
WriteFileEx
(
hFile
,
buffer
,
bytesToWrite
,
overlapped
,
FILE_OverlappedComplete
);
case
FD_TYPE_CONSOLE
:
TRACE
(
"%d %s %ld %p %p
\n
"
,
hFile
,
debugstr_an
(
buffer
,
bytesToWrite
),
bytesToWrite
,
bytesWritten
,
overlapped
);
...
...
scheduler/synchro.c
View file @
91195437
...
...
@@ -70,7 +70,6 @@ static void finish_async(async_private *ovp, DWORD status)
ovp
->
prev
=
NULL
;
close
(
ovp
->
fd
);
NtSetEvent
(
ovp
->
lpOverlapped
->
hEvent
,
NULL
);
if
(
!
ovp
->
completion_func
)
HeapFree
(
GetProcessHeap
(),
0
,
ovp
);
}
...
...
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