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

  1. /*****************************************************************************************************************
  2. File Name: Error.cpp
  3. COPYRIGHT 2001 Microsoft Corporation and Executive Software International, Inc.
  4. */
  5. #include "stdafx.h"
  6. #include <windows.h>
  7. #include "Message.h"
  8. #include "ErrLog.h"
  9. /*****************************************************************************************************************
  10. COPYRIGHT 2001 Microsoft Corporation and Executive Software International, Inc.
  11. ROUTINE DESCRIPTION:
  12. Perform the logging functions of the ErrMacro macros.
  13. USAGE:
  14. LogErrMacro(TEXT(__FILE__), TEXT(__TIMESTAMP__), __LINE__);
  15. */
  16. void LogErrForMacro(LPTSTR filename, LPTSTR timestamp, UINT lineno)
  17. {
  18. DWORD hr = GetLastError();
  19. TCHAR cErrorLocation[2 * MAX_PATH];
  20. TCHAR cCompileTime[2 * 128];
  21. // prepare logging messages
  22. wsprintf(cErrorLocation, TEXT( "Error in file %s line %d"), filename, lineno);
  23. wsprintf(cCompileTime, TEXT( "Compiled %s"), timestamp);
  24. // log to message window
  25. Message(cErrorLocation, hr, cCompileTime);
  26. // log to error log file
  27. WriteErrorToErrorLog(cErrorLocation, hr, cCompileTime);
  28. }