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
99a5cfea
Commit
99a5cfea
authored
Jan 07, 2002
by
Mike McCormack
Committed by
Alexandre Julliard
Jan 07, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Attempt write before going overlapped in Writefile.
- Fix return codes in WriteFileEx.
parent
de339f30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
7 deletions
+49
-7
file.c
files/file.c
+49
-7
No files found.
files/file.c
View file @
99a5cfea
...
...
@@ -1577,9 +1577,9 @@ async_end:
}
/***********************************************************************
* WriteFileEx (KERNEL32.@)
*
FILE_
WriteFileEx (KERNEL32.@)
*/
BOOL
WINAPI
WriteFileEx
(
HANDLE
hFile
,
LPCVOID
buffer
,
DWORD
bytesToWrite
,
BOOL
WINAPI
FILE_
WriteFileEx
(
HANDLE
hFile
,
LPCVOID
buffer
,
DWORD
bytesToWrite
,
LPOVERLAPPED
overlapped
,
LPOVERLAPPED_COMPLETION_ROUTINE
lpCompletionRoutine
)
{
...
...
@@ -1632,10 +1632,20 @@ BOOL WINAPI WriteFileEx(HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
ovp
->
next
->
prev
=
ovp
;
NtCurrentTeb
()
->
pending_list
=
ovp
;
SetLastError
(
ERROR_IO_PENDING
);
return
TRUE
;
}
/* always fail on return, either ERROR_IO_PENDING or other error */
return
FALSE
;
/***********************************************************************
* WriteFileEx (KERNEL32.@)
*/
BOOL
WINAPI
WriteFileEx
(
HANDLE
hFile
,
LPCVOID
buffer
,
DWORD
bytesToWrite
,
LPOVERLAPPED
overlapped
,
LPOVERLAPPED_COMPLETION_ROUTINE
lpCompletionRoutine
)
{
overlapped
->
Internal
=
STATUS_PENDING
;
overlapped
->
InternalHigh
=
0
;
return
FILE_WriteFileEx
(
hFile
,
buffer
,
bytesToWrite
,
overlapped
,
lpCompletionRoutine
);
}
/***********************************************************************
...
...
@@ -1666,8 +1676,40 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
/* FIXME: try write immediately before starting overlapped operation */
return
WriteFileEx
(
hFile
,
buffer
,
bytesToWrite
,
overlapped
,
FILE_OverlappedComplete
);
/* see if we can write some data already (this shouldn't block) */
result
=
write
(
unix_handle
,
buffer
,
bytesToWrite
);
close
(
unix_handle
);
if
(
result
<
0
)
{
if
(
(
errno
!=
EAGAIN
)
&&
(
errno
!=
EINTR
)
&&
((
errno
!=
EFAULT
)
||
IsBadReadPtr
(
buffer
,
bytesToWrite
))
)
{
FILE_SetDosError
();
return
FALSE
;
}
else
result
=
0
;
}
/* if we read enough to keep the app happy, then return now */
if
(
result
>=
bytesToWrite
)
{
*
bytesWritten
=
result
;
return
TRUE
;
}
/* at last resort, do an overlapped read */
overlapped
->
Internal
=
STATUS_PENDING
;
overlapped
->
InternalHigh
=
result
;
if
(
!
FILE_WriteFileEx
(
hFile
,
buffer
,
bytesToWrite
,
overlapped
,
FILE_OverlappedComplete
))
return
FALSE
;
/* fail on return, with ERROR_IO_PENDING */
SetLastError
(
ERROR_IO_PENDING
);
return
FALSE
;
case
FD_TYPE_CONSOLE
:
TRACE
(
"%d %s %ld %p %p
\n
"
,
hFile
,
debugstr_an
(
buffer
,
bytesToWrite
),
bytesToWrite
,
...
...
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