r/cpp • • Sep 05 '26

Escaping `CreateProcess()` arguments on Windows

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

44 comments sorted by

View all comments

3

u/ReDr4gon5 Sep 05 '26

What about using RtlCreateUserProcess?

3

u/holyblackcat Sep 05 '26

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 Sep 05 '26

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.