ntdll: Fix affinity mask check for 64-bit.

oldstable
Alexandre Julliard 2010-04-08 21:16:29 +02:00
parent fc81e45af6
commit 5189eef6bb
2 changed files with 12 additions and 2 deletions

View File

@ -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);

View File

@ -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 )