mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 00:41:36 +00:00
[CMD] Fix the ErrorMessage() function.
Specify its szFormat parameter optional, and correctly initialize the szMessage buffer.
This commit is contained in:
parent
d5784d6345
commit
d0ced4ffdf
|
@ -165,7 +165,11 @@ INT CommandEchoerr (LPTSTR);
|
||||||
INT CommandEchoserr (LPTSTR);
|
INT CommandEchoserr (LPTSTR);
|
||||||
|
|
||||||
/* Prototypes for ERROR.C */
|
/* Prototypes for ERROR.C */
|
||||||
VOID ErrorMessage (DWORD, LPTSTR, ...);
|
VOID
|
||||||
|
ErrorMessage(
|
||||||
|
IN DWORD dwErrorCode,
|
||||||
|
IN LPTSTR szFormat OPTIONAL,
|
||||||
|
...);
|
||||||
|
|
||||||
VOID error_no_pipe (VOID);
|
VOID error_no_pipe (VOID);
|
||||||
VOID error_bad_command (LPTSTR);
|
VOID error_bad_command (LPTSTR);
|
||||||
|
|
|
@ -263,7 +263,7 @@ DeleteFiles(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ErrorMessage (GetLastError(), _T(""));
|
ErrorMessage (GetLastError(), NULL);
|
||||||
// FindClose(hFile);
|
// FindClose(hFile);
|
||||||
// return -1;
|
// return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,19 +22,23 @@
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
|
VOID
|
||||||
VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
ErrorMessage(
|
||||||
|
IN DWORD dwErrorCode,
|
||||||
|
IN LPTSTR szFormat OPTIONAL,
|
||||||
|
...)
|
||||||
{
|
{
|
||||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
|
||||||
TCHAR szMessage[1024];
|
|
||||||
LPTSTR szError;
|
|
||||||
va_list arg_ptr;
|
va_list arg_ptr;
|
||||||
|
LPTSTR szError;
|
||||||
|
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
|
TCHAR szMessage[1024];
|
||||||
|
|
||||||
if (dwErrorCode == ERROR_SUCCESS)
|
if (dwErrorCode == ERROR_SUCCESS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nErrorLevel = 1;
|
nErrorLevel = 1;
|
||||||
|
|
||||||
|
*szMessage = 0;
|
||||||
if (szFormat)
|
if (szFormat)
|
||||||
{
|
{
|
||||||
va_start(arg_ptr, szFormat);
|
va_start(arg_ptr, szFormat);
|
||||||
|
@ -48,7 +52,7 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
||||||
{
|
{
|
||||||
ConErrPrintf(_T("%s %s\n"), szError, szMessage);
|
ConErrPrintf(_T("%s %s\n"), szError, szMessage);
|
||||||
if (szError)
|
if (szError)
|
||||||
LocalFree (szError);
|
LocalFree(szError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ PrintVolumeHeader (LPTSTR pszRootPath)
|
||||||
NULL,
|
NULL,
|
||||||
0))
|
0))
|
||||||
{
|
{
|
||||||
ErrorMessage(GetLastError (), _T(""));
|
ErrorMessage(GetLastError (), NULL);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue