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
e4e906c8
Commit
e4e906c8
authored
Dec 21, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Dec 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add more tests for SystemHandleInformation.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
723146ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
11 deletions
+43
-11
info.c
dlls/ntdll/tests/info.c
+43
-11
No files found.
dlls/ntdll/tests/info.c
View file @
e4e906c8
...
...
@@ -474,30 +474,62 @@ static void test_query_module(void)
static
void
test_query_handle
(
void
)
{
NTSTATUS
status
;
ULONG
ReturnLength
;
ULONG
ExpectedLength
,
ReturnLength
;
ULONG
SystemInformationLength
=
sizeof
(
SYSTEM_HANDLE_INFORMATION
);
SYSTEM_HANDLE_INFORMATION
*
shi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
SystemInformationLength
);
HANDLE
EventHandle
;
BOOL
found
;
INT
i
;
EventHandle
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
EventHandle
!=
NULL
,
"CreateEventA failed %u
\n
"
,
GetLastError
()
);
/* Request the needed length : a SystemInformationLength greater than one struct sets ReturnLength */
ReturnLength
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
shi
,
SystemInformationLength
,
&
ReturnLength
);
todo_wine
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08x
\n
"
,
status
);
ok
(
ReturnLength
!=
0xdeadbeef
,
"Expected valid ReturnLength
\n
"
);
SystemInformationLength
=
ReturnLength
;
shi
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
shi
,
SystemInformationLength
);
ReturnLength
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
shi
,
SystemInformationLength
,
&
ReturnLength
);
if
(
status
!=
STATUS_INFO_LENGTH_MISMATCH
)
/* vista
*/
while
(
status
==
STATUS_INFO_LENGTH_MISMATCH
)
/* Vista / 2008
*/
{
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
SystemInformationLength
*=
2
;
shi
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
shi
,
SystemInformationLength
);
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
shi
,
SystemInformationLength
,
&
ReturnLength
);
}
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ExpectedLength
=
FIELD_OFFSET
(
SYSTEM_HANDLE_INFORMATION
,
Handle
[
shi
->
Count
]);
todo_wine
ok
(
ReturnLength
==
ExpectedLength
||
broken
(
ReturnLength
==
ExpectedLength
-
sizeof
(
DWORD
)),
/* Vista / 2008 */
"Expected length %u, got %u
\n
"
,
ExpectedLength
,
ReturnLength
);
todo_wine
ok
(
shi
->
Count
>
1
,
"Expected more than 1 handle, got %u
\n
"
,
shi
->
Count
);
for
(
i
=
0
,
found
=
FALSE
;
i
<
shi
->
Count
&&
!
found
;
i
++
)
found
=
(
shi
->
Handle
[
i
].
OwnerPid
==
GetCurrentProcessId
())
&&
((
HANDLE
)(
ULONG_PTR
)
shi
->
Handle
[
i
].
HandleValue
==
EventHandle
);
todo_wine
ok
(
found
,
"Expected to find event handle in handle list
\n
"
);
CloseHandle
(
EventHandle
);
/* Check if we have some return values */
trace
(
"Number of Handles : %d
\n
"
,
shi
->
Count
);
todo_wine
{
/* our implementation is a stub for now */
ok
(
shi
->
Count
>
1
,
"Expected more than 1 handles, got (%d)
\n
"
,
shi
->
Count
);
}
ReturnLength
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
shi
,
SystemInformationLength
,
&
ReturnLength
);
while
(
status
==
STATUS_INFO_LENGTH_MISMATCH
)
/* Vista / 2008 */
{
SystemInformationLength
*=
2
;
shi
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
shi
,
SystemInformationLength
);
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
shi
,
SystemInformationLength
,
&
ReturnLength
);
}
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
for
(
i
=
0
,
found
=
FALSE
;
i
<
shi
->
Count
&&
!
found
;
i
++
)
found
=
(
shi
->
Handle
[
i
].
OwnerPid
==
GetCurrentProcessId
())
&&
((
HANDLE
)(
ULONG_PTR
)
shi
->
Handle
[
i
].
HandleValue
==
EventHandle
);
ok
(
!
found
,
"Unexpectedly found event handle in handle list
\n
"
);
status
=
pNtQuerySystemInformation
(
SystemHandleInformation
,
NULL
,
SystemInformationLength
,
&
ReturnLength
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got %08x
\n
"
,
status
);
HeapFree
(
GetProcessHeap
(),
0
,
shi
);
}
...
...
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