Did you ever hear about IMAGE_FILE_UP_SYSTEM_ONLY flag in NtHeader->FileHeader->Characteristics of an exe file? Microsoft says it will make the exe run ONLY on single-cpu machines. In practice it works on multi-cpu machines as well, but the affinity is automatically set to one CPU only! And the allowed CPU is rotated, which is cool imho.
There is even a linker flag for it. You can set it with /DRIVER:UPONLY
But there is more! IMAGE_LOAD_CONFIG_DIRECTORY contains ProcessAffinityMask providing full flexibility with setting affinity. And here comes my question: how to manage it within an exe? I know it theoretically on binary level, but I hope nice editor exists... Maybe SetImageConfigInformation()? Any hints?