--- trunk/reactos/subsys/system/cmd/cmd.h 2005-07-19 21:04:19 UTC (rev 16650)
+++ trunk/reactos/subsys/system/cmd/cmd.h 2005-07-19 22:48:35 UTC (rev 16651)
@@ -152,6 +152,7 @@
VOID ConErrPuts (LPTSTR);
VOID ConErrPrintf (LPTSTR, ...);
VOID ConOutFormatMessage (DWORD MessageId, ...);
+VOID ConErrFormatMessage (DWORD MessageId, ...);
SHORT GetCursorX (VOID);
SHORT GetCursorY (VOID);
--- trunk/reactos/subsys/system/cmd/console.c 2005-07-19 21:04:19 UTC (rev 16650)
+++ trunk/reactos/subsys/system/cmd/console.c 2005-07-19 22:48:35 UTC (rev 16651)
@@ -330,6 +330,35 @@
#endif
}
+VOID ConErrFormatMessage (DWORD MessageId, ...)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ DWORD ret;
+ LPTSTR text;
+ va_list arg_ptr;
+
+ 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);
+
+ va_end (arg_ptr);
+ if(ret > 0)
+ {
+ ConErrPuts (text);
+ LocalFree(text);
+ }
+ else
+ {
+ LoadString(CMD_ModuleHandle, STRING_CONSOLE_ERROR, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg);
+ }
+}
+
VOID ConOutFormatMessage (DWORD MessageId, ...)
{
TCHAR szMsg[RC_STRING_MAX_SIZE];
@@ -349,13 +378,13 @@
va_end (arg_ptr);
if(ret > 0)
{
- ConOutPuts (text);
+ ConErrPuts (text);
LocalFree(text);
}
else
{
LoadString(CMD_ModuleHandle, STRING_CONSOLE_ERROR, szMsg, RC_STRING_MAX_SIZE);
- ConOutPrintf(szMsg);
+ ConErrPrintf(szMsg);
}
}
--- trunk/reactos/subsys/system/cmd/internal.c 2005-07-19 21:04:19 UTC (rev 16650)
+++ trunk/reactos/subsys/system/cmd/internal.c 2005-07-19 22:48:35 UTC (rev 16651)
@@ -364,7 +364,7 @@
{
if(hFile == INVALID_HANDLE_VALUE)
{
- ConOutFormatMessage (GetLastError(), szFinalPath);
+ ConErrFormatMessage (GetLastError(), szFinalPath);
nErrorLevel = 1;
return 1;
}