diff --git a/reactos/subsys/system/cmd/console.c b/reactos/subsys/system/cmd/console.c index 33e925092da..e5e22648284 100644 --- a/reactos/subsys/system/cmd/console.c +++ b/reactos/subsys/system/cmd/console.c @@ -1,4 +1,4 @@ -/* $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. * @@ -225,17 +225,29 @@ VOID ConPrintf(LPTSTR szFormat, va_list arg_ptr, DWORD nStdHandle) 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, ...)