C#C
C#3y ago
16 replies
Frodolon

❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?

I'm using CsWin32 but I'm having trouble calling PInvoke.CreateProcess using a STARTUPINFOEXW instead of a STARTUPINFOW at argument 9 (in info).
Looking at https://github.com/microsoft/CsWin32/issues/917 it says to instead of doing
PInvoke.CreateProcess(null, ref cmdLine, null, null, false, PROCESS_CREATION_FLAGS.EXTENDED_STARTUPINFO_PRESENT, null, null, in info, out var processInformation);

I should use the variant using pointers... but I can't seem to figure out how to correctly refer to my Span<char> cmdLine = stackalloc char[execPath.Length]; and my STARTUPINFOEXW info = new STARTUPINFOEXW() using pointers or replacing out var with pointers
Was this page helpful?