Am Freitag, den 02.06.2006, 11:30 +0200 schrieb Alexandre Julliard: > Detlef Riekenberg <[EMAIL PROTECTED]> writes: > > > + if (ret) { > > + needed = WideCharToMultiByte( CP_ACP, 0, InfoW, -1, (LPSTR)Info, > > cbBuf, NULL, NULL); > > + if (pcbNeeded) *pcbNeeded = needed; > > + ret = (needed > cbBuf) ? FALSE : TRUE; > > This check is wrong, WideCharToMultiByte will return 0 if the buffer > is too small. Hm. Our documentation and MSDN states for WC2MB: Success: If dstlen > 0, the number of characters written to dst.
http://source.winehq.org/WineAPI/WideCharToMultiByte.html I took the code from GetPrinterDriverDirectoryA. The UNICODE-Buffer was allocated with: HeapAlloc(GetProcessHeap(), 0, cbBuf * sizeof(WCHAR)); The only Situation for WC2MB to run out of space here is, that the ANSI-String has MultiByte-Characters in it. Since our WC2MB returns 0, when the Destination-Buffer is to small, something is wrong. This situation is not tested in dlls/kernel/tests/* I investigate in this. -- By By ... ... Detlef