Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <004001c2378c$24e14f50$a352a518@samsystem> From: "Samuel" To: References: <3D41BDDE DOT 20054 DOT 4C6376DA AT localhost> Subject: Re: Mysterious gdb behavior. Date: Mon, 29 Jul 2002 22:44:15 -0700 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_003D_01C23751.77A361F0" X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 ------=_NextPart_000_003D_01C23751.77A361F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit ----- Original Message ----- From: "Paul Derbyshire" To: Sent: Friday, July 26, 2002 6:23 PM Subject: Mysterious gdb behavior. > > Error: Error creating process , (error 193) > > Then you look at the documentation. There's no documentation of the > error codes. Attached is a small Windows console program that will send to standard output all Windows error messages associated with a Windows error code. It can be used as-is by redirecting standard output to a file but the program is intended to just be a sample. I am not sure what would be the most useful way for CygWin users to use this. Obviously the best solution is for FormatMessage, as used by this small sample, to be called for Windows error codes (usually returned by Windows GetLastError function) so that the error message can be provided with or instead of the error code. In other words, if FormatMessage is called with 193 as error code, it will return "%1 is not a valid Win32 application" where %1 will be the exe file. Well I just executed a compiled version of the program and the output is not perfect so perhaps this can only be used as a sample. The important thing is that it shows how FormatMessage can be used. ------=_NextPart_000_003D_01C23751.77A361F0 Content-Type: application/octet-stream; name="WinErrors.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="WinErrors.cpp" #pragma warning(disable:4786) #define STRICT 1 #define WIN32_LEAN_AND_MEAN #include #include using namespace std; #pragma hdrstop // * * * * * * * * * * LONG lErrorCodeCount=3D0; bool DisplayError(LONG lErrorCode) { LPTSTR lpMsgBuf=3DNULL; int ReturnSize; ReturnSize =3D FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |=20 FORMAT_MESSAGE_FROM_SYSTEM |=20 FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR)&lpMsgBuf, 0, NULL); if (!lpMsgBuf || !ReturnSize) return false; ++lErrorCodeCount; cout << lErrorCode << ' ' << lpMsgBuf; LocalFree(lpMsgBuf); return true; } // * * * * * * * * * * int main(int argc, char *argv[], char *envp[]) { LONG lLastErrorCode, lErrorCode; // First find the last error code for (lLastErrorCode=3D0x4FFF; !DisplayError(lLastErrorCode); = --lLastErrorCode); cout << lLastErrorCode << " last error code\n"; for (lErrorCode=3D0; lErrorCode