Francois Gouget <fgouget(a)free.fr> writes:
No I don't have a 'real world' exemple where this is a problem. I became aware of the issue because of warnings when I was working on dlls/msvcrt/process.c: system is const char* so I made msvcrt_spawn const char* but then I had to add a cast when calling CreateProcessA (see second hunk of cmdline3).
The cast is wrong, we should do a copy there. CreateProcess takes a char*, not a const char*. Casting off the const and relying on CreateProcess to not modify the string is broken. Even better would be to convert the string to Unicode and call CreateProcessW; this would avoid a copy (well, right now it will cost an extra copy, but that's because CreateProcess should be fixed to do everything in Unicode). -- Alexandre Julliard julliard(a)winehq.com