This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] windows-nat: Decode system error numbers
On Wednesday 09 November 2011 17:00:50, Eli Zaretskii wrote:
> > From: Pedro Alves <pedro@codesourcery.com>
> > Date: Wed, 9 Nov 2011 16:58:00 +0000
> > Cc: "Maciej W. Rozycki" <macro@codesourcery.com>
> >
> > > Will this DTRT with Cygwin, which AFAIK wants the wide versions of the
> > > APIs? Is, for example, "char buf[1025];" appropriate in that case?
> >
> > Yeah, if UNICODE is defined, FormatMessage maps to FormatMessageW and
> > buf will be filled with a wide string, though I'm not sure
> > if __USEWIDE implies UNICODE.
>
> But buf[] should be TCHAR then, shouldn't it?
Right, and that's what strwinerror does. But looking at the windows-nat.c
code, indeed __USEWISE does not seem to imply UNICODE. Otherwise e.g.,
this
HANDLE hconsole = CreateFile ("CONOUT$", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
wouldn't compile on cygwin. So I don't think we support building
windows-nat.c with UNICODE on currently (gdbserver/win32-low.c does
build that way though, since it builds on Windows CE too, and that
is always UNICODE), and char would be fine.
--
Pedro Alves