Frodolon
Frodolon
CC#
Created by Frodolon on 6/20/2023 in #help
❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?
17 replies
CC#
Created by Frodolon on 6/20/2023 in #help
❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?
Hmm, CreateProcess gives error 87 - The Parameter is Incorrect - the reason I'm even trying to do all this is that I'm trying to reimplement https://scorpiosoftware.net/2019/01/15/fun-with-appcontainers/ in C# to play around with AppContainers...
17 replies
CC#
Created by Frodolon on 6/20/2023 in #help
❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?
Still doesn't work but runs
17 replies
CC#
Created by Frodolon on 6/20/2023 in #help
❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?
Already fixed that :P
17 replies
CC#
Created by Frodolon on 6/20/2023 in #help
❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?
Ah, got it working: PInvoke.CreateProcess(null, cmdLine, null, null, false, PROCESS_CREATION_FLAGS.EXTENDED_STARTUPINFO_PRESENT, null, null, (STARTUPINFOW*)&info, procInfoPtr);
17 replies
CC#
Created by Frodolon on 6/20/2023 in #help
❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?
(Can't convert STARTUPINFOEXW to STARTUPINFOW etc.)
17 replies
CC#
Created by Frodolon on 6/20/2023 in #help
❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?
This feels like it should work:
string execPath = "notepad.exe\0";
nuint* size = default;
PInvoke.InitializeProcThreadAttributeList(default, 1, 0, size);
STARTUPINFOEXW info = new STARTUPINFOEXW();
info.lpAttributeList = (LPPROC_THREAD_ATTRIBUTE_LIST)Windows.Win32.PInvoke.LocalAlloc(0, (nuint)size).Value;
fixed (char* cmdLine = execPath)
{
PROCESS_INFORMATION* procInfoPtr = default;
PInvoke.CreateProcess(null, cmdLine, null, null, false, PROCESS_CREATION_FLAGS.EXTENDED_STARTUPINFO_PRESENT, null, null, &info, procInfoPtr);
}
string execPath = "notepad.exe\0";
nuint* size = default;
PInvoke.InitializeProcThreadAttributeList(default, 1, 0, size);
STARTUPINFOEXW info = new STARTUPINFOEXW();
info.lpAttributeList = (LPPROC_THREAD_ATTRIBUTE_LIST)Windows.Win32.PInvoke.LocalAlloc(0, (nuint)size).Value;
fixed (char* cmdLine = execPath)
{
PROCESS_INFORMATION* procInfoPtr = default;
PInvoke.CreateProcess(null, cmdLine, null, null, false, PROCESS_CREATION_FLAGS.EXTENDED_STARTUPINFO_PRESENT, null, null, &info, procInfoPtr);
}
It still complains about the CreateProcess arguments though
17 replies
CC#
Created by Frodolon on 6/20/2023 in #help
❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?
I already had another string Really, the main problem is Visual Studio displaying the error messages for the version using refs etc. making the error messages utterly useless
17 replies
CC#
Created by Frodolon on 6/20/2023 in #help
❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?
Ok, I managed to get a char* through fixed (char* cmdLine = execPath) { /* code */ }
17 replies
CC#
Created by Frodolon on 6/20/2023 in #help
❔ Using STARTUPINFOEXW on PInvoke.CreateProcess - how to move from ref / out to pointer?
17 replies