c++winapivisual-c++

CreateProcess lpCommand buffer size


According to the Microsoft documentation, CreateProcessW can modify the contents of the LPWSTR lpCommandLine parameter.

Do I need to account for extra space in the size of the buffer for lpCommandLine?

What happens if it needs to add characters and the buffer size is too small?


Solution

  • from CreateProcessW

    The system adds a terminating null character to the command-line string to separate the file name from the arguments. This divides the original string into two strings for internal processing.

    it just converts some spaces to null bytes, it won't go over the end of the buffer.