mirror of
https://github.com/reactos/reactos.git
synced 2026-06-02 09:20:43 +08:00
[CMD] Fix the ErrorMessage() function.
Specify its szFormat parameter optional, and correctly initialize the szMessage buffer.
This commit is contained in:
@@ -22,19 +22,23 @@
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
|
||||
VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
||||
VOID
|
||||
ErrorMessage(
|
||||
IN DWORD dwErrorCode,
|
||||
IN LPTSTR szFormat OPTIONAL,
|
||||
...)
|
||||
{
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR szMessage[1024];
|
||||
LPTSTR szError;
|
||||
va_list arg_ptr;
|
||||
LPTSTR szError;
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR szMessage[1024];
|
||||
|
||||
if (dwErrorCode == ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
nErrorLevel = 1;
|
||||
|
||||
*szMessage = 0;
|
||||
if (szFormat)
|
||||
{
|
||||
va_start(arg_ptr, szFormat);
|
||||
@@ -48,7 +52,7 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
||||
{
|
||||
ConErrPrintf(_T("%s %s\n"), szError, szMessage);
|
||||
if (szError)
|
||||
LocalFree (szError);
|
||||
LocalFree(szError);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user