From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29596 invoked by alias); 9 Nov 2011 16:45:50 -0000 Received: (qmail 29587 invoked by uid 22791); 9 Nov 2011 16:45:49 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout23.012.net.il (HELO mtaout23.012.net.il) (80.179.55.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Nov 2011 16:45:17 +0000 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0LUE00H00JPUAT00@a-mtaout23.012.net.il> for gdb-patches@sourceware.org; Wed, 09 Nov 2011 18:44:49 +0200 (IST) Received: from HOME-C4E4A596F7 ([84.228.42.212]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LUE00HPQJUO3E50@a-mtaout23.012.net.il>; Wed, 09 Nov 2011 18:44:49 +0200 (IST) Date: Wed, 09 Nov 2011 16:45:00 -0000 From: Eli Zaretskii Subject: Re: [PATCH] windows-nat: Decode system error numbers In-reply-to: To: "Maciej W. Rozycki" Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83obwlgsc5.fsf@gnu.org> References: X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-11/txt/msg00234.txt.bz2 > Date: Wed, 9 Nov 2011 12:02:40 +0000 > From: "Maciej W. Rozycki" > > + const char *msg = "Unspecified error."; > + unsigned long err; > + char buf[1025]; > + size_t size; > + > + if (ok) > + return; > + > + err = GetLastError(); > + size = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM > + | FORMAT_MESSAGE_IGNORE_INSERTS, > + NULL, > + err, > + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), > + buf, (sizeof (buf) - 1) / sizeof (TCHAR), NULL); Will this DTRT with Cygwin, which AFAIK wants the wide versions of the APIs? Is, for example, "char buf[1025];" appropriate in that case?