-/* $Id: console.c,v 1.6 2004/06/21 18:57:22 weiden Exp $
+/* $Id: console.c,v 1.7 2004/06/23 19:32:17 weiden Exp $
*
* CONSOLE.C - console input/output functions.
*
VOID ConOutFormatMessage (DWORD MessageId, ...)
{
- DWORD temp;
+ DWORD ret;
LPTSTR text;
va_list arg_ptr;
- temp = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+
+ va_start (arg_ptr, MessageId);
+ ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
MessageId,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &text,
0,
&arg_ptr);
- ConErrPrintf (text);
+
+ va_end (arg_ptr);
+ if(ret > 0)
+ {
+ ConErrPuts (text);
+ LocalFree(text);
+ }
+ else
+ {
+ ConErrPrintf (_T("Unknown error: %d\n"), MessageId);
+ }
}
VOID ConOutPrintf (LPTSTR szFormat, ...)