Search code examples
windowswinapishellexecuteex

What are the default access rights for a process started with ShellExecuteEx?


I need to perform certain operations on a process started with ShellExecuteEx - like waiting for it, duplicating handles, querying and setting information etc. Now I am wondering if I can do all these things on the hProcess member which is returned in the SHELLEXECUTEINFO structure I pass to ShellExecuteEx. Does anybody know this?

Does the process that called ShellExecuteEx have rights like PROCESS_DUP_HANDLE, SYNCHRONIZE, PROCESS_SET_INFORMATION, PROCESS_QUERY_INFORMATION (and so on) by default, when using the returned hProcess?


Solution

  • I would guess that it is the same as what you get from CreateProcess, though even that documentation doesn't say (I would venture PROCESS_ALL_ACCESS). In any event, you could always do GetProcessId() and OpenProcess() to open it with whatever access you need.