I am using CreateProcess and I would like to pass CREATE_SUSPENDED
and CREATE_NO_WINDOW
as the Process Creation Flags.
This is my pinvoke signature:
[DllImport("kernel32.dll", SetLastError = true)]
private static extern Boolean CreateProcess(String lpApplicationName, String lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes,
Boolean bInheritHandles, UInt32 dwCreationFlags, IntPtr lpEnvironment, String lpCurrentDirectory, Byte[] lpStartupInfo,
out PROCESS_INFORMATION lpProcessInfo);
The question is: How to pass multiple flags?
Since all the flags have a single 1
in a single binary position, you can combine them together by OR-ing or by adding them together:
CREATE_SUSPENDED | CREATE_NO_WINDOW
Here is how it works:
CREATE_NO_WINDOW is 0x08000000
CREATE_SUSPENDED is 0x00000004
The result of OR-ing them together is 0x08000004
.