Commit 421b3867 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

kernelbase: Forward SetThreadIdealProcessor() to ntdll.

parent dd30d429
......@@ -512,13 +512,13 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetThreadGroupAffinity( HANDLE thread, const GROUP
*/
DWORD WINAPI DECLSPEC_HOTPATCH SetThreadIdealProcessor( HANDLE thread, DWORD proc )
{
FIXME( "(%p %lu): stub\n", thread, proc );
if (proc > MAXIMUM_PROCESSORS)
{
SetLastError( ERROR_INVALID_PARAMETER );
return ~0u;
}
return 0;
NTSTATUS status;
status = NtSetInformationThread( thread, ThreadIdealProcessor, &proc, sizeof(proc) );
if (NT_SUCCESS(status)) return status;
SetLastError( RtlNtStatusToDosError( status ));
return ~0u;
}
......
......@@ -3356,6 +3356,27 @@ static void test_thread_lookup(void)
ok( !handle || broken(handle == (HANDLE)0xdeadbeef) /* vista */, "handle set %p\n", handle );
}
static void test_thread_ideal_processor(void)
{
ULONG number, len;
NTSTATUS status;
number = 0;
status = pNtSetInformationThread( GetCurrentThread(), ThreadIdealProcessor, &number, sizeof(number) );
ok(NT_SUCCESS(status), "Unexpected status %#lx.\n", status);
number = 64 + 1;
status = pNtSetInformationThread( GetCurrentThread(), ThreadIdealProcessor, &number, sizeof(number) );
ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %#lx.\n", status);
number = 0;
status = pNtSetInformationThread( GetCurrentThread(), ThreadIdealProcessor, &number, sizeof(number) );
ok(!status, "Unexpected status %#lx.\n", status);
status = pNtQueryInformationThread( GetCurrentThread(), ThreadIdealProcessor, &number, sizeof(number), &len );
ok(status == STATUS_INVALID_INFO_CLASS, "Unexpected status %#lx.\n", status);
}
static void test_thread_info(void)
{
NTSTATUS status;
......@@ -3613,6 +3634,7 @@ START_TEST(info)
test_HideFromDebugger();
test_thread_start_address();
test_thread_lookup();
test_thread_ideal_processor();
test_affinity();
test_debug_object();
......
......@@ -2177,6 +2177,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
if (ret_len) *ret_len = sizeof(BOOLEAN);
return STATUS_SUCCESS;
case ThreadIdealProcessor:
case ThreadEnableAlignmentFaultFixup:
return STATUS_INVALID_INFO_CLASS;
......@@ -2186,7 +2187,6 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
case ThreadEventPair_Reusable:
case ThreadZeroTlsCell:
case ThreadPerformanceCount:
case ThreadIdealProcessor:
case ThreadPriorityBoost:
case ThreadSetTlsArrayAddress:
default:
......@@ -2379,6 +2379,16 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
FIXME( "ThreadPowerThrottling stub!\n" );
return STATUS_SUCCESS;
case ThreadIdealProcessor:
{
const ULONG *number = data;
if (length != sizeof(*number)) return STATUS_INFO_LENGTH_MISMATCH;
if (*number > MAXIMUM_PROCESSORS) return STATUS_INVALID_PARAMETER;
FIXME( "ThreadIdealProcessor stub!\n" );
return STATUS_SUCCESS;
}
case ThreadBasicInformation:
case ThreadTimes:
case ThreadPriority:
......@@ -2386,7 +2396,6 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
case ThreadEventPair_Reusable:
case ThreadPerformanceCount:
case ThreadAmILastThread:
case ThreadIdealProcessor:
case ThreadPriorityBoost:
case ThreadSetTlsArrayAddress:
case ThreadIsIoPending:
......
......@@ -1162,6 +1162,7 @@ NTSTATUS WINAPI wow64_NtSetInformationThread( UINT *args )
case ThreadHideFromDebugger: /* void */
case ThreadEnableAlignmentFaultFixup: /* BOOLEAN */
case ThreadPowerThrottlingState: /* THREAD_POWER_THROTTLING_STATE */
case ThreadIdealProcessor: /* ULONG */
return NtSetInformationThread( handle, class, ptr, len );
case ThreadImpersonationToken: /* HANDLE */
......
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