Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
1.2 KiB

/*****************************************************************************************************************
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);
}