http://bugs.winehq.org/show_bug.cgi?id=19759
--- Comment #4 from Sunil Mohan Adapa sunilmohan@fsf.org.in 2009-08-17 10:11:37 --- (In reply to comment #3)
Something doesn't look right in your patch. SysAllocStringLen already zero-terminates it. This means something overwrites that last \0, which is the problem.
MSDN documentation for SysAllocStringLen says that when the input string is NULL, the newly allocated buffer will be uninitialized. I assumed Wine was doing the same while it seems to zero-fill. It may not be good to depend on this Wine-only behaviour.
In light of this, our bug is purely because of the incorrect length (-1) passed to SysAllocStringLen. MultiByteToWideChar's length will only include the NULL if the input string has it.
The only thing that can do that in this code is MultiByteToWideChar because it gets the wrong size...
These are purely ASCII strings with correctly interpreted length values (I checked the binary file)