windows-nt/Source/XPSP1/NT/base/fs/utils/dfrg/error.cpp

43 lines
1.2 KiB
C++
Raw Normal View History

2020-09-26 03:20:57 -05:00
/*****************************************************************************************************************
File Name: Error.cpp
COPYRIGHT<EFBFBD> 2001 Microsoft Corporation and Executive Software International, Inc.
*/
#include "stdafx.h"
#include <windows.h>
#include "Message.h"
#include "ErrLog.h"
/*****************************************************************************************************************
COPYRIGHT<EFBFBD> 2001 Microsoft Corporation and Executive Software International, Inc.
ROUTINE DESCRIPTION:
Perform the logging functions of the ErrMacro macros.
USAGE:
LogErrMacro(TEXT(__FILE__), TEXT(__TIMESTAMP__), __LINE__);
*/
void LogErrForMacro(LPTSTR filename, LPTSTR timestamp, UINT lineno)
{
DWORD hr = GetLastError();
TCHAR cErrorLocation[2 * MAX_PATH];
TCHAR cCompileTime[2 * 128];
// prepare logging messages
wsprintf(cErrorLocation, TEXT( "Error in file %s line %d"), filename, lineno);
wsprintf(cCompileTime, TEXT( "Compiled %s"), timestamp);
// log to message window
Message(cErrorLocation, hr, cCompileTime);
// log to error log file
WriteErrorToErrorLog(cErrorLocation, hr, cCompileTime);
}