I’m trying to use the CreateProcessWithTokenW() win32 API function to start a new process with a token. The problem is that I’m quite new to the win32 API and I have no idea how to use the function properly, and which structs etc. that are needed. Could someone provide me with an example of how to use the function correctly in C#?
I’m trying to use the CreateProcessWithTokenW() win32 API function to start a new process
Share
This is unmanaged code so you need to use P/Invoke (Platform Invoke), here’s the function signature for
CreateProcessWithTokenW():You can use an enum like this to pass in the
LogonFlagsparam (to keep the .net feeling 🙂 ) :Here’s the enum for the
CreationFlagsfollowing the documentation available here :