This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin] cygwin: regtool: encode error messages correctly
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 20 Jun 2017 11:18:47 -0000
- Subject: [newlib-cygwin] cygwin: regtool: encode error messages correctly
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4d336756fa7f47aa0a79e98fb4dea5c3e1b35d31
commit 4d336756fa7f47aa0a79e98fb4dea5c3e1b35d31
Author: Fujii Hironori <fujii.hironori@gmail.com>
Date: Tue Jun 20 13:17:09 2017 +0200
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.
Diff:
---
winsup/utils/regtool.cc | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc
index ad746ad..a44d907 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);