Reputation: 332
Based on microsoft documentation, dwDesiredAccess parameter can be one or more of the process access rights.
I want to pass two different dwDesiredAccess (PROCESS_QUERY_INFORMATION and PROCESS_TERMINATE) when I call openProcess function. Can anyone show me how to call the function?
HANDLE hprocess = OpenProcess(PROCESS_QUERY_INFORMATION, 0, static_cast<DWORD>(proc.th32ProcessID));
Please note that the above code is for one access right.
Upvotes: 1
Views: 1028
Reputation: 9837
Like most Win32 functions where you can set multiple parameters in a single argument, you need to simply bitwise OR in the parameters together:
HANDLE hprocess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_TERMINATE, 0, static_cast<DWORD>(proc.th32ProcessID));
Upvotes: 4