The KeSetSystemAffinityThread routine sets the system affinity of the current thread.
VOID KeSetSystemAffinityThread( _In_ KAFFINITY Affinity );
A KAFFINITY-typed variable that specifies the new system affinity of the current thread.
The implementation of KeSetSystemAffinityThread in Windows 7 and later versions of Windows provides compatibility for drivers that were written for earlier versions of Windows, which do not support processor groups. In this implementation, KeSetSystemAffinityThread assigns the thread to group 0, and uses the affinity mask to specify a set of logical processors in this group on which the thread can run.
If KeSetSystemAffinityThread is called at IRQL <= APC_LEVEL and the call is successful, the new affinity mask takes effect immediately. When the call returns, the calling thread is already running on a processor that is specified in the new affinity mask. If KeSetSystemAffinityThread is called at IRQL = DISPATCH_LEVEL and the call is successful, the pending processor change is deferred until the caller lowers the IRQL below DISPATCH_LEVEL.
|Windows version||Available in Windows 2000 and later versions of Windows. Use KeSetSystemAffinityThread only on systems before Windows Vista. In Windows Vista and later versions of the Windows operating system, use KeSetSystemAffinityThreadEx instead.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|IRQL||"<= DISPATCH_LEVEL (see Remarks section)."|
|DDI compliance rules||PowerIrpDDis, HwStorPortProhibitedDDIs|