Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. From the process creation flags documentation, I grab the values for each flag I'm trying to pass. Then, I pass the flags using like so:
  2.  
  3. const uint CREATE_SUSPENDED = 0x00000004;
  4. const uint CREATE_NEW_CONSOLE = 0x00000010;
  5.  
  6. [DllImport("kernel32.dll", SetLastError = true)]
  7. private static extern Boolean CreateProcess(String lpApplicationName, String lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes,
  8. Boolean bInheritHandles, UInt32 dwCreationFlags, IntPtr lpEnvironment, String lpCurrentDirectory, Byte[] lpStartupInfo,
  9. out PROCESS_INFORMATION lpProcessInfo);
  10.  
  11. public static MyCreateProcess(path, QuotedPath) {
  12. CreateProcess(path, QuotedPath, IntPtr.Zero, IntPtr.Zero, false, CREATE_SUSPENDED | CREATE_NEW_CONSOLE , IntPtr.Zero, null, ref SI, ref PI);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement