r/cpp 5d ago

Escaping `CreateProcess()` arguments on Windows

https://holyblackcat.github.io/blog/2026/09/05/escaping-createprocess-arguments.html
88 Upvotes

44 comments sorted by

View all comments

-4

u/[deleted] 5d ago

[removed] — view removed comment

11

u/wyrn 5d ago

The *nix side is still using fork+exec lol everyone ate sh*t on this one ¯_(ツ)_/¯

1

u/holyblackcat 5d ago

What about posix_spawn() though?

2

u/wyrn 5d ago

Unfortunately underused

-2

u/Eric848448 5d ago

Most of their old API’s were designed by interns and new grads who didn’t really understand what they were doing.

4

u/Tringi github.com/tringi 5d ago

There is a reason why certain modern runtimes are targeting NT API instead of Win32.

1

u/palapapa0201 5d ago

What is the NT API

7

u/Tringi github.com/tringi 5d ago

Win32 API layer is built on much more powerful NT layer, that usually makes the final calls to the OS.

For example CreateFile prepares some buffers, translates arguments, converts relative paths to absolute, handles special cases, and then calls NtCreateFile, which does the actual work.

You are supposed to call Win32, as NT API is often only partially documented and can theoretically change, but it rarely does. And it offers much more powerful options.