Handle FormatMessage failures from LoadLibrary oddities (bug 3760, r=fyren).

This commit is contained in:
David Anderson 2009-03-29 09:01:40 -04:00
parent 3ac9ecb4b7
commit 16756e550f

View File

@ -285,14 +285,16 @@ void LibrarySystem::GetPlatformErrorEx(int code, char *error, size_t maxlength)
if (error && maxlength)
{
#if defined PLATFORM_WINDOWS
FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
(DWORD)code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)error,
maxlength,
NULL);
if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
(DWORD)code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)error,
maxlength,
NULL) == 0)
{
UTIL_Format(error, maxlength, "error code %08x", code);
}
#elif defined PLATFORM_LINUX
const char *ae = strerror_r(code, error, maxlength);
if (ae != error)