diff options
author | Fujii Hironori <fujii.hironori@gmail.com> | 2017-06-20 14:17:09 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2017-06-20 14:17:49 +0300 |
commit | 4d336756fa7f47aa0a79e98fb4dea5c3e1b35d31 (patch) | |
tree | 8080739c1996f09ceb9aa545f6f09a6a0738131c /winsup/utils/regtool.cc | |
parent | c5ca43f35913a7d0b2ec786e27c629d1c5ed0715 (diff) |
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.
Diffstat (limited to 'winsup/utils/regtool.cc')
-rw-r--r-- | winsup/utils/regtool.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc index ad746adf7..a44d90768 100644 --- a/winsup/utils/regtool.cc +++ b/winsup/utils/regtool.cc @@ -197,13 +197,14 @@ print_version () void Fail (unsigned int rv) { - char *buf; + wchar_t *buf; + if (!quiet) { - FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_SYSTEM, - 0, rv, 0, (CHAR *) & buf, 0, 0); - fprintf (stderr, "Error (%d): %s\n", rv, buf); + FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_FROM_SYSTEM, + 0, rv, 0, (WCHAR *)& buf, 0, 0); + fprintf (stderr, "Error (%d): %ls\n", rv, buf); LocalFree (buf); } exit (1); |