windows-nt/Source/XPSP1/NT/base/fs/utils/dfrg/error.cpp
2020-09-26 16:20:57 +08:00

43 lines
1.2 KiB
C++

/*****************************************************************************************************************
File Name: Error.cpp
COPYRIGHT© 2001 Microsoft Corporation and Executive Software International, Inc.
*/
#include "stdafx.h"
#include <windows.h>
#include "Message.h"
#include "ErrLog.h"
/*****************************************************************************************************************
COPYRIGHT© 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);
}