-
Process Affinity
Hey all,
I'm having some access privilege issues with trying to get a process's affinity. I'm writing an app that will list all running processes and their corresponding affinity. Basically something like 'SetAffinity II' from this site.
The following code works for some processes but not for others:
Code:
Process[] temp = Process.GetProcessesByName("PROCESS_NAME");
MessageBox.Show( "" + temp[0].ProcessorAffinity );
For instance, 'notepad' works just fine, but 'winlogon' causes a Win32Exception, 'access denied.' What puzzles me is that the program linked above can both list and set affinity without any access issues or UAC prompts. When I try to run my app though, it fails. If I run my app as admin from the right-click context menu, it works just fine though.
Is this some restriction that the .NET framework is imposing? Is there some way I can use native APIs to get the job done without needing admin rights?
Thanks,
Lunchboxtheman