reference to MSDN: OpenProcessToken AdjustTokenPrivileges
Platform SDK: DLLs, Processes, and Threads Process Security and Access Rights Windows NT/Windows 2000 security enables you to control access to process objects. For more information about security, see Access-Control Model.You can specify a security descriptor for a process when you call the CreateProcess, CreateProcessAsUser, or CreateProcessWithLogonW function. To retrieve a process's security descriptor, call the GetSecurityInfo function. To change a process's security descriptor, call the SetSecurityInfo function. notice to the last sentence ,it says that you can call "GetSecurityInfo" function to figure out your problem.
oho.....sorry .I typed wrong ..should be 'SetSecurityInfo'
HANDLE hProcess = GetCurrentProcess(); // Get the priority class for your process,commonly ,this value is 32(#define NORMAL_PRIORITY_CLASS 0x00000020) DWORD dwPriorityClass = GetPriorityClass(hProcess); // Set the high priority class for the specified process SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS);
SetPriorityClass()来设置进程的优先级
OpenProcessToken
AdjustTokenPrivileges
Process Security and Access Rights
Windows NT/Windows 2000 security enables you to control access to process objects. For more information about security, see Access-Control Model.You can specify a security descriptor for a process when you call the CreateProcess, CreateProcessAsUser, or CreateProcessWithLogonW function. To retrieve a process's security descriptor, call the GetSecurityInfo function. To change a process's security descriptor, call the SetSecurityInfo function. notice to the last sentence ,it says that you can call "GetSecurityInfo" function to figure out your problem.
// Get the priority class for your process,commonly ,this value is 32(#define NORMAL_PRIORITY_CLASS 0x00000020)
DWORD dwPriorityClass = GetPriorityClass(hProcess);
// Set the high priority class for the specified process
SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS);