'Trying to set ThreadIoPriority

I wonder if any of you fine folks can explain why this piece of code is not working?

IO_PRIORITY_HINT priority;
priority = IoPriorityHigh;
NTSTATUS status = NtSetInformationThread(ZwCurrentThread(), ThreadIoPriority, &priority, sizeof(priority));

The status returns -1073741819 which in hex is FFFF FFFF C000 0005 which probably means STATUS_ACCESS_VIOLATION.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source