Bug 732664 - Use FormatMessageA so that XPCOM stack walker prints error message correctly. r=dbaron

This commit is contained in:
Cameron McCormack 2012-03-06 10:04:40 +11:00
parent 001abedc5d
commit 24ec15b64b

View File

@ -258,19 +258,19 @@ void PrintError(char *prefix)
{
LPVOID lpMsgBuf;
DWORD lastErr = GetLastError();
FormatMessage(
FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
lastErr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
(LPSTR) &lpMsgBuf,
0,
NULL
);
fprintf(stderr, "### ERROR: %s: %s",
prefix, lpMsgBuf ? lpMsgBuf : "(null)\n");
fflush(stderr);
LocalFree( lpMsgBuf );
LocalFree(lpMsgBuf);
}
bool