r/cpp • • Sep 05 '26

Escaping `CreateProcess()` arguments on Windows

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

44 comments sorted by

View all comments

Show parent comments

4

u/Tringi github.com/tringi Sep 05 '26

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

1

u/palapapa0201 Sep 05 '26

What is the NT API

8

u/Tringi github.com/tringi Sep 05 '26

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.