Make cmdline writable (cmdline4)

Alexandre Julliard julliard at winehq.com
Fri Sep 7 13:39:32 CDT 2001


Francois Gouget <fgouget at 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 at winehq.com




More information about the wine-devel mailing list