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
ea7f9737
Commit
ea7f9737
authored
Sep 10, 2013
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Sep 11, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add support to NtWriteFile for special offset -1.
parent
d71bf64e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
file.c
dlls/ntdll/file.c
+16
-2
file.c
dlls/ntdll/tests/file.c
+0
-15
No files found.
dlls/ntdll/file.c
View file @
ea7f9737
...
...
@@ -969,8 +969,22 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
if
(
offset
&&
offset
->
QuadPart
!=
(
LONGLONG
)
-
2
/* FILE_USE_FILE_POINTER_POSITION */
)
{
off_t
off
=
offset
->
QuadPart
;
if
(
offset
->
QuadPart
==
(
LONGLONG
)
-
1
/* FILE_WRITE_TO_END_OF_FILE */
)
{
struct
stat
st
;
if
(
fstat
(
unix_handle
,
&
st
)
==
-
1
)
{
status
=
FILE_GetNtStatus
();
goto
done
;
}
off
=
st
.
st_size
;
}
/* async I/O doesn't make sense on regular files */
while
((
result
=
pwrite
(
unix_handle
,
buffer
,
length
,
off
set
->
QuadPart
))
==
-
1
)
while
((
result
=
pwrite
(
unix_handle
,
buffer
,
length
,
off
))
==
-
1
)
{
if
(
errno
!=
EINTR
)
{
...
...
@@ -982,7 +996,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
if
(
options
&
(
FILE_SYNCHRONOUS_IO_ALERT
|
FILE_SYNCHRONOUS_IO_NONALERT
))
/* update file pointer position */
lseek
(
unix_handle
,
off
set
->
QuadPart
+
result
,
SEEK_SET
);
lseek
(
unix_handle
,
off
+
result
,
SEEK_SET
);
total
=
result
;
status
=
STATUS_SUCCESS
;
...
...
dlls/ntdll/tests/file.c
View file @
ea7f9737
...
...
@@ -1976,25 +1976,10 @@ static void test_read_write(void)
iob
.
Information
=
-
1
;
offset
.
QuadPart
=
(
LONGLONG
)
-
1
/* FILE_WRITE_TO_END_OF_FILE */
;
status
=
pNtWriteFile
(
hfile
,
0
,
NULL
,
NULL
,
&
iob
,
contents
+
7
,
sizeof
(
contents
)
-
7
,
&
offset
,
NULL
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"NtWriteFile error %#x
\n
"
,
status
);
todo_wine
ok
(
iob
.
Status
==
STATUS_SUCCESS
,
"expected STATUS_SUCCESS, got %#x
\n
"
,
iob
.
Status
);
todo_wine
ok
(
iob
.
Information
==
sizeof
(
contents
)
-
7
,
"expected sizeof(contents)-7, got %lu
\n
"
,
iob
.
Information
);
/* FIXME: Remove once Wine is fixed */
if
(
status
!=
STATUS_SUCCESS
)
{
iob
.
Status
=
-
1
;
iob
.
Information
=
-
1
;
offset
.
QuadPart
=
7
;
status
=
pNtWriteFile
(
hfile
,
0
,
NULL
,
NULL
,
&
iob
,
contents
+
7
,
sizeof
(
contents
)
-
7
,
&
offset
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"NtWriteFile error %#x
\n
"
,
status
);
ok
(
iob
.
Status
==
STATUS_SUCCESS
,
"expected STATUS_SUCCESS, got %#x
\n
"
,
iob
.
Status
);
ok
(
iob
.
Information
==
sizeof
(
contents
)
-
7
,
"expected sizeof(contents)-7, got %lu
\n
"
,
iob
.
Information
);
}
off
=
SetFilePointer
(
hfile
,
0
,
NULL
,
FILE_CURRENT
);
ok
(
off
==
sizeof
(
contents
),
"expected sizeof(contents), got %u
\n
"
,
off
);
...
...
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