I want to set the process affinity to a specific process.
Like: I have a process called "word.exe" with PID: 2045 How I can set the process affinity to it?
I searched online and I didn't find much. I only found the GetCurrentProcess(), but it sets the process affinity only to the current process.
int main()
{
DWORD processID = GetCurrentProcessId();
HANDLE process = GetCurrentProcess();
DWORD_PTR processAffinityMask = 1;
BOOL success = SetProcessAffinityMask(process, processAffinityMask);
SetPriorityClass(GetCurrentProcess(), THREAD_PRIORITY_TIME_CRITICAL);
cout << success << " " << processID << endl; //returns 1 if everything goes okay
}
EDIT What I meant is: there is a substitute of GetCurrentProcess() that instead of setting the affinity to the current process, sets the affinity to a specific process that I want?