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
ab8d704e
Commit
ab8d704e
authored
Sep 20, 2013
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Sep 23, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Extend the FILE_APPEND_DATA test.
parent
2c9774f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
23 deletions
+65
-23
file.c
dlls/ntdll/tests/file.c
+65
-23
No files found.
dlls/ntdll/tests/file.c
View file @
ab8d704e
...
...
@@ -851,43 +851,85 @@ todo_wine
static
void
append_file_test
(
void
)
{
const
char
text
[
]
=
"foobar"
;
static
const
char
text
[
6
]
=
"foobar"
;
HANDLE
handle
;
NTSTATUS
status
;
IO_STATUS_BLOCK
iosb
;
DWORD
written
;
char
path
[
MAX_PATH
],
buffer
[
MAX_PATH
];
LARGE_INTEGER
offset
;
char
path
[
MAX_PATH
],
buffer
[
MAX_PATH
]
,
buf
[
16
]
;
GetTempPathA
(
MAX_PATH
,
path
);
GetTempFileNameA
(
path
,
"foo"
,
0
,
buffer
);
handle
=
CreateFile
(
buffer
,
FILE_WRITE_DATA
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"CreateFile error %d
\n
"
,
GetLastError
());
U
(
iosb
).
Status
=
-
1
;
iosb
.
Information
=
-
1
;
status
=
pNtWriteFile
(
handle
,
NULL
,
NULL
,
NULL
,
&
iosb
,
text
,
3
,
NULL
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"NtWriteFile error %#x
\n
"
,
status
);
ok
(
iosb
.
Status
==
STATUS_SUCCESS
,
"expected STATUS_SUCCESS, got %#x
\n
"
,
iosb
.
Status
);
ok
(
iosb
.
Information
==
3
,
"expected 3, got %lu
\n
"
,
iosb
.
Information
);
CloseHandle
(
handle
);
/* It is possible to open a file with only FILE_APPEND_DATA access flags.
It matches the O_WRONLY|O_APPEND open() posix behavior */
handle
=
CreateFileA
(
buffer
,
FILE_APPEND_DATA
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_DELETE_ON_CLOSE
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"Failed to create a temp file in FILE_APPEND_DATA mode.
\n
"
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
{
skip
(
"Couldn't create a temporary file, skipping FILE_APPEND_DATA test
\n
"
);
return
;
}
handle
=
CreateFile
(
buffer
,
FILE_APPEND_DATA
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"CreateFile error %d
\n
"
,
GetLastError
());
U
(
iosb
).
Status
=
-
1
;
iosb
.
Information
=
-
1
;
offset
.
QuadPart
=
0
;
status
=
pNtWriteFile
(
handle
,
NULL
,
NULL
,
NULL
,
&
iosb
,
text
+
3
,
3
,
&
offset
,
NULL
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"NtWriteFile error %#x
\n
"
,
status
);
todo_wine
ok
(
iosb
.
Status
==
STATUS_SUCCESS
,
"expected STATUS_SUCCESS, got %#x
\n
"
,
iosb
.
Status
);
todo_wine
ok
(
iosb
.
Information
==
3
,
"expected 3, got %lu
\n
"
,
iosb
.
Information
);
U
(
iosb
).
Status
=
STATUS_PENDING
;
iosb
.
Information
=
0
;
CloseHandle
(
handle
);
status
=
pNtWriteFile
(
handle
,
NULL
,
NULL
,
NULL
,
&
iosb
,
text
,
sizeof
(
text
),
NULL
,
NULL
);
handle
=
CreateFile
(
buffer
,
FILE_READ_DATA
|
FILE_WRITE_DATA
|
FILE_APPEND_DATA
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"CreateFile error %d
\n
"
,
GetLastError
()
);
if
(
status
==
STATUS_PENDING
)
{
WaitForSingleObject
(
handle
,
1000
);
status
=
U
(
iosb
).
Status
;
}
written
=
iosb
.
Information
;
memset
(
buf
,
0
,
sizeof
(
buf
));
U
(
iosb
).
Status
=
-
1
;
iosb
.
Information
=
-
1
;
offset
.
QuadPart
=
0
;
status
=
pNtReadFile
(
handle
,
0
,
NULL
,
NULL
,
&
iosb
,
buf
,
sizeof
(
buf
),
&
offset
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"NtReadFile error %#x
\n
"
,
status
);
ok
(
iosb
.
Status
==
STATUS_SUCCESS
,
"expected STATUS_SUCCESS, got %#x
\n
"
,
iosb
.
Status
);
todo_wine
ok
(
iosb
.
Information
==
6
,
"expected 6, got %lu
\n
"
,
iosb
.
Information
);
buf
[
6
]
=
0
;
todo_wine
ok
(
memcmp
(
buf
,
text
,
6
)
==
0
,
"wrong file contents: %s
\n
"
,
buf
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
&&
written
==
sizeof
(
text
),
"FILE_APPEND_DATA NtWriteFile failed
\n
"
);
U
(
iosb
).
Status
=
-
1
;
iosb
.
Information
=
-
1
;
offset
.
QuadPart
=
0
;
status
=
pNtWriteFile
(
handle
,
NULL
,
NULL
,
NULL
,
&
iosb
,
text
+
3
,
3
,
&
offset
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"NtWriteFile error %#x
\n
"
,
status
);
ok
(
iosb
.
Status
==
STATUS_SUCCESS
,
"expected STATUS_SUCCESS, got %#x
\n
"
,
iosb
.
Status
);
ok
(
iosb
.
Information
==
3
,
"expected 3, got %lu
\n
"
,
iosb
.
Information
);
memset
(
buf
,
0
,
sizeof
(
buf
));
U
(
iosb
).
Status
=
-
1
;
iosb
.
Information
=
-
1
;
offset
.
QuadPart
=
0
;
status
=
pNtReadFile
(
handle
,
0
,
NULL
,
NULL
,
&
iosb
,
buf
,
sizeof
(
buf
),
&
offset
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"NtReadFile error %#x
\n
"
,
status
);
ok
(
iosb
.
Status
==
STATUS_SUCCESS
,
"expected STATUS_SUCCESS, got %#x
\n
"
,
iosb
.
Status
);
todo_wine
ok
(
iosb
.
Information
==
6
,
"expected 6, got %lu
\n
"
,
iosb
.
Information
);
buf
[
6
]
=
0
;
todo_wine
ok
(
memcmp
(
buf
,
"barbar"
,
6
)
==
0
,
"wrong file contents: %s
\n
"
,
buf
);
CloseHandle
(
handle
);
DeleteFile
(
buffer
);
}
static
void
nt_mailslot_test
(
void
)
...
...
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