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
37d2b584
Commit
37d2b584
authored
Oct 03, 2019
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Add write watch test on OVERLAPPED structure.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fd60406e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
1 deletion
+62
-1
virtual.c
dlls/kernel32/tests/virtual.c
+62
-1
No files found.
dlls/kernel32/tests/virtual.c
View file @
37d2b584
...
...
@@ -1602,7 +1602,7 @@ static void test_write_watch(void)
DWORD
ret
,
size
,
old_prot
,
num_bytes
;
MEMORY_BASIC_INFORMATION
info
;
HANDLE
readpipe
,
writepipe
,
file
;
OVERLAPPED
overlapped
;
OVERLAPPED
overlapped
,
*
overlapped2
;
void
*
results
[
64
];
ULONG_PTR
count
;
ULONG
i
,
pagesize
;
...
...
@@ -1906,6 +1906,67 @@ static void test_write_watch(void)
ok
(
!
ret
,
"GetWriteWatch failed %u
\n
"
,
GetLastError
()
);
ok
(
count
==
0
,
"wrong count %lu
\n
"
,
count
);
/* OVERLAPPED structure write watch */
memset
(
&
overlapped
,
0
,
sizeof
(
overlapped
)
);
overlapped
.
hEvent
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
readpipe
=
CreateNamedPipeA
(
pipename
,
FILE_FLAG_OVERLAPPED
|
PIPE_ACCESS_INBOUND
,
PIPE_TYPE_MESSAGE
|
PIPE_WAIT
,
1
,
1024
,
1024
,
NMPWAIT_USE_DEFAULT_WAIT
,
NULL
);
ok
(
readpipe
!=
INVALID_HANDLE_VALUE
,
"CreateNamedPipeA failed %u
\n
"
,
GetLastError
()
);
success
=
ConnectNamedPipe
(
readpipe
,
&
overlapped
);
ok
(
!
success
,
"ConnectNamedPipe unexpectedly succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_IO_PENDING
,
"expected ERROR_IO_PENDING, got %u
\n
"
,
GetLastError
()
);
writepipe
=
CreateFileA
(
pipename
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
ok
(
writepipe
!=
INVALID_HANDLE_VALUE
,
"CreateFileA failed %u
\n
"
,
GetLastError
()
);
ret
=
WaitForSingleObject
(
overlapped
.
hEvent
,
1000
);
ok
(
ret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %u
\n
"
,
ret
);
memset
(
base
,
0
,
size
);
overlapped2
=
(
OVERLAPPED
*
)(
base
+
size
-
sizeof
(
*
overlapped2
));
overlapped2
->
hEvent
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
count
=
64
;
ret
=
pGetWriteWatch
(
WRITE_WATCH_FLAG_RESET
,
base
,
size
,
results
,
&
count
,
&
pagesize
);
ok
(
!
ret
,
"GetWriteWatch failed %u
\n
"
,
GetLastError
()
);
ok
(
count
==
16
,
"wrong count %lu
\n
"
,
count
);
success
=
ReadFile
(
readpipe
,
base
,
sizeof
(
testdata
),
NULL
,
overlapped2
);
ok
(
!
success
,
"ReadFile unexpectedly succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_IO_PENDING
,
"expected ERROR_IO_PENDING, got %u
\n
"
,
GetLastError
()
);
overlapped2
->
Internal
=
0xdeadbeef
;
count
=
64
;
ret
=
pGetWriteWatch
(
WRITE_WATCH_FLAG_RESET
,
base
,
size
,
results
,
&
count
,
&
pagesize
);
ok
(
!
ret
,
"GetWriteWatch failed %u
\n
"
,
GetLastError
()
);
ok
(
count
==
2
,
"wrong count %lu
\n
"
,
count
);
num_bytes
=
0
;
success
=
WriteFile
(
writepipe
,
testdata
,
sizeof
(
testdata
),
&
num_bytes
,
NULL
);
ok
(
success
,
"WriteFile failed %u
\n
"
,
GetLastError
()
);
ok
(
num_bytes
==
sizeof
(
testdata
),
"wrong number of bytes written %u
\n
"
,
num_bytes
);
num_bytes
=
0
;
success
=
GetOverlappedResult
(
readpipe
,
overlapped2
,
&
num_bytes
,
TRUE
);
ok
(
success
,
"GetOverlappedResult failed %u
\n
"
,
GetLastError
()
);
ok
(
num_bytes
==
sizeof
(
testdata
),
"wrong number of bytes read %u
\n
"
,
num_bytes
);
ok
(
!
memcmp
(
base
,
testdata
,
sizeof
(
testdata
)),
"didn't receive expected data
\n
"
);
count
=
64
;
memset
(
results
,
0
,
sizeof
(
results
)
);
ret
=
pGetWriteWatch
(
WRITE_WATCH_FLAG_RESET
,
base
,
size
,
results
,
&
count
,
&
pagesize
);
ok
(
!
ret
,
"GetWriteWatch failed %u
\n
"
,
GetLastError
()
);
ok
(
count
==
2
,
"wrong count %lu
\n
"
,
count
);
ok
(
results
[
0
]
==
base
,
"wrong result %p
\n
"
,
results
[
0
]
);
CloseHandle
(
readpipe
);
CloseHandle
(
writepipe
);
CloseHandle
(
overlapped
.
hEvent
);
CloseHandle
(
overlapped2
->
hEvent
);
/* some invalid parameter tests */
SetLastError
(
0xdeadbeef
);
...
...
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