cygwin: regtool: encode error messages correctly

Error messages of regtool can't be read, which are encoded in,
for instance, SHIFT_JIS in Japanese Windows.  Fix by using
wide chars instead of multibyte.
This commit is contained in:
Fujii Hironori 2017-06-20 13:17:09 +02:00 committed by Corinna Vinschen
parent c5ca43f359
commit 4d336756fa
1 changed files with 6 additions and 5 deletions

View File

@ -197,13 +197,14 @@ print_version ()
void void
Fail (unsigned int rv) Fail (unsigned int rv)
{ {
char *buf; wchar_t *buf;
if (!quiet) if (!quiet)
{ {
FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM, | FORMAT_MESSAGE_FROM_SYSTEM,
0, rv, 0, (CHAR *) & buf, 0, 0); 0, rv, 0, (WCHAR *)& buf, 0, 0);
fprintf (stderr, "Error (%d): %s\n", rv, buf); fprintf (stderr, "Error (%d): %ls\n", rv, buf);
LocalFree (buf); LocalFree (buf);
} }
exit (1); exit (1);