Leaked source code of windows server 2003
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.

79 lines
2.1 KiB

  1. //
  2. // Wrapper function for Logging events to the system event logger
  3. //
  4. // ANSI version
  5. inline
  6. void SmtpLogEvent( DWORD idMessage, // id for log message
  7. WORD cSubStrings, // count of substrings
  8. const CHAR * apszSubStrings[], // substrings in the msg
  9. DWORD errCode = 0) // error code if any
  10. {
  11. //
  12. // Just call the log event function of the EVENT_LOG object
  13. //
  14. WORD wType;
  15. if (NT_INFORMATION(idMessage)) {
  16. wType = EVENTLOG_INFORMATION_TYPE;
  17. } else {
  18. if (NT_WARNING(idMessage)) {
  19. wType = EVENTLOG_WARNING_TYPE;
  20. } else {
  21. wType = EVENTLOG_ERROR_TYPE;
  22. }
  23. }
  24. g_EventLog.LogEvent(idMessage,
  25. cSubStrings,
  26. apszSubStrings,
  27. wType,
  28. errCode,
  29. LOGEVENT_DEBUGLEVEL_MEDIUM,
  30. "",
  31. LOGEVENT_FLAG_ALWAYS);
  32. }
  33. inline void SmtpLogEventEx(DWORD MessageId, const char * ErrorString, DWORD ErrorCode)
  34. {
  35. const char * apszSubStrings[1];
  36. apszSubStrings[0] = ErrorString;
  37. SmtpLogEvent(MessageId ,1, apszSubStrings, ErrorCode);
  38. }
  39. inline void SmtpLogEventSimple(DWORD MessageId, DWORD ErrorCode=0)
  40. {
  41. SmtpLogEvent(MessageId, 0, (const char **)NULL, ErrorCode);
  42. }
  43. // UNICODE version
  44. inline
  45. void SmtpLogEvent( DWORD idMessage, // id for log message
  46. WORD cSubStrings, // count of substrings
  47. WCHAR * apszSubStrings[], // substrings in the msg
  48. DWORD errCode = 0) // error code if any
  49. {
  50. //
  51. // Just call the log event function of the EVENT_LOG object
  52. //
  53. //g_pInetSvc->LogEvent( idMessage, cSubStrings, apszSubStrings, errCode);
  54. }
  55. inline void SmtpLogEventEx(DWORD MessageId, WCHAR * ErrorString, DWORD ErrorCode)
  56. {
  57. WCHAR * apszSubStrings[1];
  58. apszSubStrings[0] = ErrorString;
  59. //SmtpLogEvent(MessageId ,1, apszSubStrings, ErrorCode);
  60. }