Commit 5189eef6 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Fix affinity mask check for 64-bit.

parent fc81e45a
......@@ -814,9 +814,19 @@ static VOID test_thread_processor(void)
ok(SetThreadAffinityMask(curthread,processMask+1)==0,
"SetThreadAffinityMask passed for an illegal processor\n");
/* NOTE: Pre-Vista does not recognize the "all processors" flag (all bits set) */
retMask = SetThreadAffinityMask(curthread,~0UL);
retMask = SetThreadAffinityMask(curthread,~0);
ok(broken(retMask==0) || retMask==processMask,
"SetThreadAffinityMask(thread,-1) failed to request all processors.\n");
if (retMask == processMask && sizeof(ULONG_PTR) > sizeof(ULONG))
{
/* only the low 32-bits matter */
retMask = SetThreadAffinityMask(curthread,~(ULONG_PTR)0);
ok(retMask == processMask, "SetThreadAffinityMask failed\n");
retMask = SetThreadAffinityMask(curthread,~(ULONG_PTR)0 >> 3);
ok(retMask == processMask, "SetThreadAffinityMask failed\n");
retMask = SetThreadAffinityMask(curthread,~(ULONG_PTR)1);
ok(retMask == 0, "SetThreadAffinityMask succeeded\n");
}
/* NOTE: This only works on WinNT/2000/XP) */
if (pSetThreadIdealProcessor) {
SetLastError(0xdeadbeef);
......
......@@ -1138,7 +1138,7 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
if (length != sizeof(ULONG_PTR)) return STATUS_INVALID_PARAMETER;
req_aff = *(const ULONG_PTR *)data;
if (req_aff == ~0UL) req_aff = affinity_mask;
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;
SERVER_START_REQ( set_thread_info )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment