mirror of
https://github.com/reactos/reactos.git
synced 2026-07-06 04:44:29 +08:00
add ConErrMessage to deal with error msg and ConOutMessage for other msg. Copy error msg are always pipe with ConOut and CD error msg with ConErr. Thx harmut that remmid me about it. All error msg need to check if they goes with ConErr or ConOut
svn path=/trunk/; revision=16651
This commit is contained in:
@@ -152,6 +152,7 @@ VOID ConErrChar (TCHAR);
|
||||
VOID ConErrPuts (LPTSTR);
|
||||
VOID ConErrPrintf (LPTSTR, ...);
|
||||
VOID ConOutFormatMessage (DWORD MessageId, ...);
|
||||
VOID ConErrFormatMessage (DWORD MessageId, ...);
|
||||
|
||||
SHORT GetCursorX (VOID);
|
||||
SHORT GetCursorY (VOID);
|
||||
|
||||
@@ -330,6 +330,35 @@ VOID ConPrintfPaging(BOOL NewPage, LPTSTR szFormat, va_list arg_ptr, DWORD nStdH
|
||||
#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 @@ VOID ConOutFormatMessage (DWORD MessageId, ...)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
|
||||
{
|
||||
if(hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
ConOutFormatMessage (GetLastError(), szFinalPath);
|
||||
ConErrFormatMessage (GetLastError(), szFinalPath);
|
||||
nErrorLevel = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user