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
47c36560
Commit
47c36560
authored
Nov 28, 2021
by
Jinoh Kang
Committed by
Alexandre Julliard
Nov 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add tests for NtCompareObjects.
Signed-off-by:
Jinoh Kang
<
jinoh.kang.kr@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0dea2b61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
om.c
dlls/ntdll/tests/om.c
+56
-0
No files found.
dlls/ntdll/tests/om.c
View file @
47c36560
...
...
@@ -71,6 +71,7 @@ static NTSTATUS (WINAPI *pNtOpenProcessToken)(HANDLE,DWORD,HANDLE*);
static
NTSTATUS
(
WINAPI
*
pNtOpenThreadToken
)(
HANDLE
,
DWORD
,
BOOLEAN
,
HANDLE
*
);
static
NTSTATUS
(
WINAPI
*
pNtDuplicateToken
)(
HANDLE
,
ACCESS_MASK
,
OBJECT_ATTRIBUTES
*
,
SECURITY_IMPERSONATION_LEVEL
,
TOKEN_TYPE
,
HANDLE
*
);
static
NTSTATUS
(
WINAPI
*
pNtDuplicateObject
)(
HANDLE
,
HANDLE
,
HANDLE
,
HANDLE
*
,
ACCESS_MASK
,
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pNtCompareObjects
)(
HANDLE
,
HANDLE
);
#define KEYEDEVENT_WAIT 0x0001
#define KEYEDEVENT_WAKE 0x0002
...
...
@@ -2446,6 +2447,59 @@ static void test_globalroot(void)
pNtClose
(
h
);
}
static
void
test_object_identity
(
void
)
{
NTSTATUS
status
;
HANDLE
h1
,
h2
;
if
(
!
pNtCompareObjects
)
{
skip
(
"NtCompareObjects is not available.
\n
"
);
return
;
}
status
=
pNtCompareObjects
(
GetCurrentProcess
(),
GetCurrentProcess
()
);
ok
(
status
==
STATUS_SUCCESS
,
"comparing GetCurrentProcess() to self failed with %08x
\n
"
,
status
);
status
=
pNtCompareObjects
(
GetCurrentThread
(),
GetCurrentThread
()
);
ok
(
status
==
STATUS_SUCCESS
,
"comparing GetCurrentThread() to self failed with %08x
\n
"
,
status
);
status
=
pNtCompareObjects
(
GetCurrentProcess
(),
GetCurrentThread
()
);
ok
(
status
==
STATUS_NOT_SAME_OBJECT
,
"comparing GetCurrentProcess() to GetCurrentThread() returned %08x
\n
"
,
status
);
h1
=
NULL
;
status
=
pNtDuplicateObject
(
GetCurrentProcess
(),
GetCurrentProcess
(),
GetCurrentProcess
(),
&
h1
,
0
,
0
,
DUPLICATE_SAME_ACCESS
);
ok
(
status
==
STATUS_SUCCESS
,
"failed to duplicate current process handle: %08x
\n
"
,
status
);
status
=
pNtCompareObjects
(
GetCurrentProcess
(),
h1
);
ok
(
status
==
STATUS_SUCCESS
,
"comparing GetCurrentProcess() with %p failed with %08x
\n
"
,
h1
,
status
);
pNtClose
(
h1
);
h1
=
CreateFileA
(
"
\\\\
.
\\
NUL"
,
GENERIC_ALL
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
h1
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed (%d)
\n
"
,
GetLastError
()
);
h2
=
NULL
;
status
=
pNtDuplicateObject
(
GetCurrentProcess
(),
h1
,
GetCurrentProcess
(),
&
h2
,
0
,
0
,
DUPLICATE_SAME_ACCESS
);
ok
(
status
==
STATUS_SUCCESS
,
"failed to duplicate handle %p: %08x
\n
"
,
h1
,
status
);
status
=
pNtCompareObjects
(
h1
,
h2
);
ok
(
status
==
STATUS_SUCCESS
,
"comparing %p with %p failed with %08x
\n
"
,
h1
,
h2
,
status
);
pNtClose
(
h2
);
h2
=
CreateFileA
(
"
\\\\
.
\\
NUL"
,
GENERIC_ALL
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
h2
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed (%d)
\n
"
,
GetLastError
()
);
status
=
pNtCompareObjects
(
h1
,
h2
);
ok
(
status
==
STATUS_NOT_SAME_OBJECT
,
"comparing %p with %p returned %08x
\n
"
,
h1
,
h2
,
status
);
pNtClose
(
h2
);
pNtClose
(
h1
);
}
START_TEST
(
om
)
{
HMODULE
hntdll
=
GetModuleHandleA
(
"ntdll.dll"
);
...
...
@@ -2489,6 +2543,7 @@ START_TEST(om)
pNtOpenThreadToken
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtOpenThreadToken"
);
pNtDuplicateToken
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtDuplicateToken"
);
pNtDuplicateObject
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtDuplicateObject"
);
pNtCompareObjects
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCompareObjects"
);
test_case_sensitive
();
test_namespace_pipe
();
...
...
@@ -2505,4 +2560,5 @@ START_TEST(om)
test_object_types
();
test_get_next_thread
();
test_globalroot
();
test_object_identity
();
}
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