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
4f2afdd0
Commit
4f2afdd0
authored
Sep 22, 2010
by
Peter Oberndorfer
Committed by
Alexandre Julliard
Sep 23, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Add test for WaitForSingleObject with lower 2 bits of handles set.
parent
577fb4d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
0 deletions
+89
-0
sync.c
dlls/kernel32/tests/sync.c
+89
-0
No files found.
dlls/kernel32/tests/sync.c
View file @
4f2afdd0
...
...
@@ -939,6 +939,94 @@ static void test_timer_queue(void)
GetLastError
());
}
static
HANDLE
modify_handle
(
HANDLE
handle
,
DWORD
modify
)
{
DWORD
tmp
=
HandleToULong
(
handle
);
tmp
|=
modify
;
return
ULongToHandle
(
tmp
);
}
static
void
test_WaitForSingleObject
(
void
)
{
HANDLE
signaled
,
nonsignaled
,
invalid
;
DWORD
ret
;
signaled
=
CreateEventW
(
NULL
,
TRUE
,
TRUE
,
NULL
);
if
(
signaled
==
0
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
{
win_skip
(
"Handles work differently on win9x
\n
"
);
return
;
}
nonsignaled
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
invalid
=
(
HANDLE
)
0xdeadbee0
;
/* invalid handle with different values for lower 2 bits */
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
invalid
,
0
);
ok
(
ret
==
WAIT_FAILED
,
"expected WAIT_FAILED, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
modify_handle
(
invalid
,
1
),
0
);
ok
(
ret
==
WAIT_FAILED
,
"expected WAIT_FAILED, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
modify_handle
(
invalid
,
2
),
0
);
ok
(
ret
==
WAIT_FAILED
,
"expected WAIT_FAILED, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
modify_handle
(
invalid
,
3
),
0
);
todo_wine
ok
(
ret
==
WAIT_FAILED
,
"expected WAIT_FAILED, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %d
\n
"
,
GetLastError
());
/* valid handle with different values for lower 2 bits */
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
nonsignaled
,
0
);
ok
(
ret
==
WAIT_TIMEOUT
,
"expected WAIT_TIMEOUT, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
modify_handle
(
nonsignaled
,
1
),
0
);
ok
(
ret
==
WAIT_TIMEOUT
,
"expected WAIT_TIMEOUT, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
modify_handle
(
nonsignaled
,
2
),
0
);
ok
(
ret
==
WAIT_TIMEOUT
,
"expected WAIT_TIMEOUT, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
modify_handle
(
nonsignaled
,
3
),
0
);
todo_wine
ok
(
ret
==
WAIT_TIMEOUT
,
"expected WAIT_TIMEOUT, got %d
\n
"
,
ret
);
todo_wine
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %d
\n
"
,
GetLastError
());
/* valid handle with different values for lower 2 bits */
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
signaled
,
0
);
ok
(
ret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
modify_handle
(
signaled
,
1
),
0
);
ok
(
ret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
modify_handle
(
signaled
,
2
),
0
);
ok
(
ret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %d
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WaitForSingleObject
(
modify_handle
(
signaled
,
3
),
0
);
ok
(
ret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %d
\n
"
,
ret
);
todo_wine
ok
(
GetLastError
()
==
0xdeadbeef
,
"expected 0xdeadbeef, got %d
\n
"
,
GetLastError
());
CloseHandle
(
signaled
);
CloseHandle
(
nonsignaled
);
}
START_TEST
(
sync
)
{
HMODULE
hdll
=
GetModuleHandle
(
"kernel32"
);
...
...
@@ -958,4 +1046,5 @@ START_TEST(sync)
test_waitable_timer
();
test_iocp_callback
();
test_timer_queue
();
test_WaitForSingleObject
();
}
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