From e6a3064cd7d3dbd94a8ef10e9e506aa2539b50d1 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sat, 23 Jul 2011 11:43:57 +0000 Subject: [PATCH] [KERNEL32]: Bug #42: GetThreadPriority was only returning -2, -1, 0, 1, 2 or 15 and -15. For realtime threads, priorities of 3, 4, 5, 6, 7, and their negatives, are also valid. Also, GetThreadPriority was returning -15/15 for any priorty outside the -2/2 range, instead of just the special saturation values (I should count this as a separate bug, really...) svn path=/trunk/; revision=52802 --- reactos/dll/win32/kernel32/client/thread.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/kernel32/client/thread.c b/reactos/dll/win32/kernel32/client/thread.c index 69657238f4e..24b1ebac386 100644 --- a/reactos/dll/win32/kernel32/client/thread.c +++ b/reactos/dll/win32/kernel32/client/thread.c @@ -621,13 +621,15 @@ GetThreadPriority(HANDLE hThread) return THREAD_PRIORITY_ERROR_RETURN; } - /* Do some conversions for out of boundary values */ - if (ThreadBasic.BasePriority > THREAD_BASE_PRIORITY_MAX) + /* Do some conversions for saturation values */ + if (ThreadBasic.BasePriority == ((HIGH_PRIORITY + 1) / 2)) { + /* Win32 calls this "time critical" */ ThreadBasic.BasePriority = THREAD_PRIORITY_TIME_CRITICAL; } - else if (ThreadBasic.BasePriority < THREAD_BASE_PRIORITY_MIN) + else if (ThreadBasic.BasePriority == -((HIGH_PRIORITY + 1) / 2)) { + /* Win32 calls this "idle" */ ThreadBasic.BasePriority = THREAD_PRIORITY_IDLE; }