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
3117370a
Commit
3117370a
authored
Feb 15, 2019
by
Paul Gofman
Committed by
Alexandre Julliard
Feb 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add test for overlapped file read.
Signed-off-by:
Paul Gofman
<
gofmanp@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8acdd597
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
file.c
dlls/kernel32/tests/file.c
+65
-0
No files found.
dlls/kernel32/tests/file.c
View file @
3117370a
...
...
@@ -5140,6 +5140,70 @@ static void test_post_completion(void)
CloseHandle
(
port
);
}
#define TEST_OVERLAPPED_READ_SIZE 4096
static
void
test_overlapped_read
(
void
)
{
DECLSPEC_ALIGN
(
TEST_OVERLAPPED_READ_SIZE
)
static
unsigned
char
buffer
[
TEST_OVERLAPPED_READ_SIZE
];
static
const
char
prefix
[]
=
"pfx"
;
char
temp_path
[
MAX_PATH
];
char
file_name
[
MAX_PATH
];
DWORD
bytes_count
;
OVERLAPPED
ov
;
HANDLE
hfile
;
DWORD
err
;
DWORD
ret
;
ret
=
GetTempPathA
(
MAX_PATH
,
temp_path
);
ok
(
ret
,
"Unexpect error %u.
\n
"
,
GetLastError
());
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
file_name
);
ok
(
ret
,
"Unexpected error %u.
\n
"
,
GetLastError
());
hfile
=
CreateFileA
(
file_name
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_NO_BUFFERING
,
NULL
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"Failed to create file, GetLastError() %u.
\n
"
,
GetLastError
());
memset
(
buffer
,
0x55
,
sizeof
(
buffer
));
ret
=
WriteFile
(
hfile
,
buffer
,
TEST_OVERLAPPED_READ_SIZE
,
&
bytes_count
,
NULL
);
ok
(
ret
&&
bytes_count
==
TEST_OVERLAPPED_READ_SIZE
,
"Unexpected WriteFile result, ret %#x, bytes_count %u, GetLastError() %u.
\n
"
,
ret
,
bytes_count
,
GetLastError
());
CloseHandle
(
hfile
);
hfile
=
CreateFileA
(
file_name
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_OVERLAPPED
|
FILE_FLAG_NO_BUFFERING
,
NULL
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"Failed to create file, GetLastError() %u.
\n
"
,
GetLastError
());
memset
(
&
ov
,
0
,
sizeof
(
ov
));
bytes_count
=
0xffffffff
;
ret
=
ReadFile
(
hfile
,
buffer
,
TEST_OVERLAPPED_READ_SIZE
,
&
bytes_count
,
&
ov
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_IO_PENDING
,
"Unexpected ReadFile result, ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
todo_wine
ok
(
!
bytes_count
,
"Unexpected read size %u.
\n
"
,
bytes_count
);
ret
=
GetOverlappedResult
(
hfile
,
&
ov
,
&
bytes_count
,
TRUE
);
ok
(
ret
,
"Unexpected error %u.
\n
"
,
GetLastError
());
ok
(
bytes_count
==
TEST_OVERLAPPED_READ_SIZE
,
"Unexpected read size %u.
\n
"
,
bytes_count
);
S
(
U
(
ov
)).
Offset
=
bytes_count
;
ret
=
ReadFile
(
hfile
,
buffer
,
TEST_OVERLAPPED_READ_SIZE
,
&
bytes_count
,
&
ov
);
err
=
GetLastError
();
/* Win8+ return ERROR_IO_PENDING like stated in MSDN, while older ones
* return ERROR_HANDLE_EOF right away. */
ok
(
!
ret
&&
(
err
==
ERROR_HANDLE_EOF
||
err
==
ERROR_IO_PENDING
),
"Unexpected ReadFile result, ret %#x, GetLastError() %u.
\n
"
,
ret
,
GetLastError
());
if
(
err
==
ERROR_IO_PENDING
)
{
ret
=
GetOverlappedResult
(
hfile
,
&
ov
,
&
bytes_count
,
TRUE
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_HANDLE_EOF
,
"Unexpected result %#x, GetLasttError() %u.
\n
"
,
ret
,
GetLastError
());
}
ok
(
!
bytes_count
,
"Unexpected read size %u.
\n
"
,
bytes_count
);
CloseHandle
(
hfile
);
ret
=
DeleteFileA
(
file_name
);
ok
(
ret
,
"Unexpected error %u.
\n
"
,
GetLastError
());
}
START_TEST
(
file
)
{
char
temp_path
[
MAX_PATH
];
...
...
@@ -5209,4 +5273,5 @@ START_TEST(file)
test_SetFileInformationByHandle
();
test_GetFileAttributesExW
();
test_post_completion
();
test_overlapped_read
();
}
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