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
c448550e
Commit
c448550e
authored
Apr 23, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl.exe/tests: Add more NtOpenThread tests.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
05864617
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
1 deletion
+62
-1
thread.c
dlls/kernel32/thread.c
+1
-1
info.c
dlls/ntdll/tests/info.c
+61
-0
No files found.
dlls/kernel32/thread.c
View file @
c448550e
...
...
@@ -142,7 +142,7 @@ HANDLE WINAPI OpenThread( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwTh
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
cid
.
UniqueProcess
=
0
;
/* FIXME */
cid
.
UniqueProcess
=
0
;
cid
.
UniqueThread
=
ULongToHandle
(
dwThreadId
);
status
=
NtOpenThread
(
&
handle
,
dwDesiredAccess
,
&
attr
,
&
cid
);
if
(
status
)
...
...
dlls/ntdll/tests/info.c
View file @
c448550e
...
...
@@ -39,6 +39,8 @@ static ULONG (WINAPI * pNtGetCurrentProcessorNumber)(void);
static
BOOL
(
WINAPI
*
pIsWow64Process
)(
HANDLE
,
PBOOL
);
static
BOOL
(
WINAPI
*
pGetLogicalProcessorInformationEx
)(
LOGICAL_PROCESSOR_RELATIONSHIP
,
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
*
,
DWORD
*
);
static
DEP_SYSTEM_POLICY_TYPE
(
WINAPI
*
pGetSystemDEPPolicy
)(
void
);
static
NTSTATUS
(
WINAPI
*
pNtOpenThread
)(
HANDLE
*
,
ACCESS_MASK
,
const
OBJECT_ATTRIBUTES
*
,
const
CLIENT_ID
*
);
static
NTSTATUS
(
WINAPI
*
pNtQueryObject
)(
HANDLE
,
OBJECT_INFORMATION_CLASS
,
void
*
,
ULONG
,
ULONG
*
);
static
BOOL
is_wow64
;
...
...
@@ -84,6 +86,8 @@ static BOOL InitFunctionPtrs(void)
NTDLL_GET_PROC
(
NtCreateSection
);
NTDLL_GET_PROC
(
NtMapViewOfSection
);
NTDLL_GET_PROC
(
NtUnmapViewOfSection
);
NTDLL_GET_PROC
(
NtOpenThread
);
NTDLL_GET_PROC
(
NtQueryObject
);
/* not present before XP */
pNtGetCurrentProcessorNumber
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtGetCurrentProcessorNumber"
);
...
...
@@ -2247,6 +2251,61 @@ static void test_query_data_alignment(void)
ok
(
value
==
64
,
"Expected 64, got %u
\n
"
,
value
);
}
static
void
test_thread_lookup
(
void
)
{
OBJECT_BASIC_INFORMATION
obj_info
;
THREAD_BASIC_INFORMATION
info
;
OBJECT_ATTRIBUTES
attr
;
CLIENT_ID
cid
;
HANDLE
handle
;
NTSTATUS
status
;
InitializeObjectAttributes
(
&
attr
,
NULL
,
0
,
NULL
,
NULL
);
cid
.
UniqueProcess
=
ULongToHandle
(
GetCurrentProcessId
());
cid
.
UniqueThread
=
ULongToHandle
(
GetCurrentThreadId
());
status
=
pNtOpenThread
(
&
handle
,
THREAD_QUERY_INFORMATION
,
&
attr
,
&
cid
);
ok
(
!
status
,
"NtOpenThread returned %#x
\n
"
,
status
);
status
=
pNtQueryObject
(
handle
,
ObjectBasicInformation
,
&
obj_info
,
sizeof
(
obj_info
),
NULL
);
ok
(
!
status
,
"NtQueryObject returned: %#x
\n
"
,
status
);
ok
(
obj_info
.
GrantedAccess
==
(
THREAD_QUERY_LIMITED_INFORMATION
|
THREAD_QUERY_INFORMATION
)
||
broken
(
obj_info
.
GrantedAccess
==
THREAD_QUERY_INFORMATION
),
/* winxp */
"GrantedAccess = %x
\n
"
,
obj_info
.
GrantedAccess
);
status
=
pNtQueryInformationThread
(
handle
,
ThreadBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
);
ok
(
!
status
,
"NtQueryInformationThread returned %#x
\n
"
,
status
);
ok
(
info
.
ClientId
.
UniqueProcess
==
ULongToHandle
(
GetCurrentProcessId
()),
"UniqueProcess = %p expected %x
\n
"
,
info
.
ClientId
.
UniqueProcess
,
GetCurrentProcessId
());
ok
(
info
.
ClientId
.
UniqueThread
==
ULongToHandle
(
GetCurrentThreadId
()),
"UniqueThread = %p expected %x
\n
"
,
info
.
ClientId
.
UniqueThread
,
GetCurrentThreadId
());
pNtClose
(
handle
);
cid
.
UniqueProcess
=
0
;
cid
.
UniqueThread
=
ULongToHandle
(
GetCurrentThreadId
());
status
=
pNtOpenThread
(
&
handle
,
THREAD_QUERY_INFORMATION
,
&
attr
,
&
cid
);
ok
(
!
status
,
"NtOpenThread returned %#x
\n
"
,
status
);
status
=
pNtQueryInformationThread
(
handle
,
ThreadBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
);
ok
(
!
status
,
"NtQueryInformationThread returned %#x
\n
"
,
status
);
ok
(
info
.
ClientId
.
UniqueProcess
==
ULongToHandle
(
GetCurrentProcessId
()),
"UniqueProcess = %p expected %x
\n
"
,
info
.
ClientId
.
UniqueProcess
,
GetCurrentProcessId
());
ok
(
info
.
ClientId
.
UniqueThread
==
ULongToHandle
(
GetCurrentThreadId
()),
"UniqueThread = %p expected %x
\n
"
,
info
.
ClientId
.
UniqueThread
,
GetCurrentThreadId
());
pNtClose
(
handle
);
cid
.
UniqueProcess
=
ULongToHandle
(
0xdeadbeef
);
cid
.
UniqueThread
=
ULongToHandle
(
GetCurrentThreadId
());
status
=
pNtOpenThread
(
&
handle
,
THREAD_QUERY_INFORMATION
,
&
attr
,
&
cid
);
todo_wine
ok
(
status
==
STATUS_INVALID_CID
,
"NtOpenThread returned %#x
\n
"
,
status
);
if
(
!
status
)
pNtClose
(
handle
);
cid
.
UniqueProcess
=
0
;
cid
.
UniqueThread
=
ULongToHandle
(
0xdeadbeef
);
status
=
pNtOpenThread
(
&
handle
,
THREAD_QUERY_INFORMATION
,
&
attr
,
&
cid
);
ok
(
status
==
STATUS_INVALID_CID
||
broken
(
status
==
STATUS_INVALID_PARAMETER
)
/* winxp */
,
"NtOpenThread returned %#x
\n
"
,
status
);
}
START_TEST
(
info
)
{
char
**
argv
;
...
...
@@ -2390,4 +2449,6 @@ START_TEST(info)
trace
(
"Starting test_query_data_alignment()
\n
"
);
test_query_data_alignment
();
test_thread_lookup
();
}
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