KeSetBasePriorityThread vs ZwSetInformationThread

Hi. I was trying to boost the thread base priorities of two threads which I
have created. One was created by PsCreateSystemThread, and one was created
in usermode by CreateThreadEx.

While I have succeeded with KeSetBasePriorityThread, I have gotten a invalid
parameter for ZwSetInformationThread (with ThreadBasePriority as
THREADINFOCLASS parameter). I did not try and cross over to a realtime
class, but merely specified 15 as a priority. I stepped into the assembly
of NtSetInformationtThread. I found that is compared the
EPROCESS.PriorityClass of the current process to a hard coded “4”. Since
the current EPROCESS.PriorityClass was 3, 0xC000000D was returned. Was I
somehow misusing the system call? Any ideas?

My call:

status = ZwSetInformationThread(hThreadToApply,
ThreadBasePriority,
&newThreadPriority,
sizeof(KPRIORITY));

Where:
-hThreadToApply is NtCurrentThread(). Used in the correct thread context!
-newThreadPri was a parameter to this function, and was 15.

As I mentioned, I was successful with KeSetBasePriorityThread, so I am not
very worried, but merely curious about what I did wrong.

thanks for any pointers,

Philip Lukidis < mailto:xxxxx@guillemot.com>
Software Engineer - Guillemot R&D inc. http://www.guillemot.com
Tel: (514) 279-9960 ext:4111 Fax: (514) 279-2558
5800 St-Denis, Suite 1102, Montreal, Quebec, H2S 3L5, Canada