Does the Process.Start method call the underlying Windows API function CreateProcess?
Looking at the Microsoft documentation it appears Process.Start can be used in either C++ or C# but CreateProcess can only be used in C++.
I'm just trying to determine if one function utilizes the other and if that's the general case for API calls in C# vs C++.
There are 3 possible native functions it could call depending on the settings in the StartInfo
you passed in.
UseShellExecute = true
it will call ShellExecuteEx
. UseShellExecute = false
and you set a username then it will call CreateProcessWithLogonW
. UseShellExecute = false
and you did not set a username then it will call CreateProcess
. You can follow the code yourself via the reference source .
If you wanted to call CreateProcess
directly (or any native function) you would need to perform a " Platform Invoke (P/Invoke) ". There are websites that help you figure out the P/Invoke signatures for common functions . This process is a lot more complex and involved and it is just simpler to just use Process.Start
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.