[start][start] Output with console encoding

Dmitry Timoshkov dmitry at codeweavers.com
Sun Feb 18 22:34:30 CST 2007


"Anatoly Lyutin" <vostok at etersoft.ru> wrote:

> @@ -33,7 +33,20 @@
> static void output(const char *message)
> {
>  DWORD count;
> - WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), message, strlen(message), &count, NULL);
> +       WCHAR *bufW;
> +       char  *bufC;
> +       int   len = strlen(message);
> +       bufW = calloc(len+1,sizeof(WCHAR));
> +       bufC = calloc(len+1,sizeof(CHAR));

Please do not use calloc/malloc calls in the Wine code, use win32 API HeapAlloc instead.

> +       MultiByteToWideChar( CP_ACP, 0, message, len, bufW, len );
> +       WideCharToMultiByte( GetConsoleOutputCP(), 0, bufW, len, bufC, len, NULL, NULL );
> +       bufC[len] = '\0';

Please refer to other parts of Wine code how to properly allocate space for this kind
of a conversion.

-- 
Dmitry.



More information about the wine-devel mailing list