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
575c1c90
Commit
575c1c90
authored
Sep 11, 2018
by
Roger Zoellner
Committed by
Alexandre Julliard
Sep 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Relax checks for valid affinity mask in NtSetInformationThread().
Signed-off-by:
Roger Zoellner
<
zoellner.roger@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3b0d0642
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
info.c
dlls/ntdll/tests/info.c
+21
-0
thread.c
dlls/ntdll/thread.c
+3
-4
No files found.
dlls/ntdll/tests/info.c
View file @
575c1c90
...
...
@@ -2049,6 +2049,27 @@ static void test_affinity(void)
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
tbi
.
AffinityMask
==
1
,
"Unexpected thread affinity
\n
"
);
/* NOTE: Pre-Vista does not allow bits to be set that are higher than the highest set bit in process affinity mask */
thread_affinity
=
(
pbi
.
AffinityMask
<<
1
)
|
pbi
.
AffinityMask
;
status
=
pNtSetInformationThread
(
GetCurrentThread
(),
ThreadAffinityMask
,
&
thread_affinity
,
sizeof
(
thread_affinity
)
);
ok
(
broken
(
status
==
STATUS_INVALID_PARAMETER
)
||
(
status
==
STATUS_SUCCESS
),
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
if
(
status
==
STATUS_SUCCESS
)
{
status
=
pNtQueryInformationThread
(
GetCurrentThread
(),
ThreadBasicInformation
,
&
tbi
,
sizeof
(
tbi
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
tbi
.
AffinityMask
==
pbi
.
AffinityMask
,
"Unexpected thread affinity. Expected %lx, got %lx
\n
"
,
pbi
.
AffinityMask
,
tbi
.
AffinityMask
);
}
thread_affinity
=
~
(
DWORD_PTR
)
0
-
1
;
status
=
pNtSetInformationThread
(
GetCurrentThread
(),
ThreadAffinityMask
,
&
thread_affinity
,
sizeof
(
thread_affinity
)
);
ok
(
broken
(
status
==
STATUS_INVALID_PARAMETER
)
||
(
status
==
STATUS_SUCCESS
),
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
if
(
status
==
STATUS_SUCCESS
)
{
status
=
pNtQueryInformationThread
(
GetCurrentThread
(),
ThreadBasicInformation
,
&
tbi
,
sizeof
(
tbi
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
tbi
.
AffinityMask
==
(
pbi
.
AffinityMask
&
(
~
(
DWORD_PTR
)
0
-
1
)),
"Unexpected thread affinity. Expected %lx, got %lx
\n
"
,
pbi
.
AffinityMask
&
(
~
(
DWORD_PTR
)
0
-
1
),
tbi
.
AffinityMask
);
}
/* NOTE: Pre-Vista does not recognize the "all processors" flag (all bits set) */
thread_affinity
=
~
(
DWORD_PTR
)
0
;
status
=
pNtSetInformationThread
(
GetCurrentThread
(),
ThreadAffinityMask
,
&
thread_affinity
,
sizeof
(
thread_affinity
)
);
...
...
dlls/ntdll/thread.c
View file @
575c1c90
...
...
@@ -1288,10 +1288,9 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
ULONG_PTR
req_aff
;
if
(
length
!=
sizeof
(
ULONG_PTR
))
return
STATUS_INVALID_PARAMETER
;
req_aff
=
*
(
const
ULONG_PTR
*
)
data
;
if
((
ULONG
)
req_aff
==
~
0u
)
req_aff
=
affinity_mask
;
else
if
(
req_aff
&
~
affinity_mask
)
return
STATUS_INVALID_PARAMETER
;
else
if
(
!
req_aff
)
return
STATUS_INVALID_PARAMETER
;
req_aff
=
*
(
const
ULONG_PTR
*
)
data
&
affinity_mask
;
if
(
!
req_aff
)
return
STATUS_INVALID_PARAMETER
;
SERVER_START_REQ
(
set_thread_info
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
...
...
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