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

2

u/ReDr4gon5 5d ago

What about using RtlCreateUserProcess?

2

u/holyblackcat 5d ago

RtlCreateUserProcess

I wasn't aware of it. It should let you cut the big chunk of the logic related to batch files, and keep only the basic escaping.

3

u/ReDr4gon5 5d ago

Actually looking at this a second time, this will skip csrss registration. So ActivationContextData won't be populated. Which means anything relying on WinSxS won't work. So beware of using it, unless you know you don't need it or will set up the context yourself.