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.

181 lines
6.6 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Abstract:
  4. Declaration of stock Log Providers.
  5. Author:
  6. Souren Aghajanyan (sourenag) 24-Sep-2001
  7. Revision History:
  8. <alias> <date> <comments>
  9. --*/
  10. #pragma once
  11. #include "sysfunc.h"
  12. #define UNDEFINED_FIELD_INDEX ((UINT)-1)
  13. #define DEFAULT_MEMORY_SIZE (1 << 14)
  14. #define MAX_MSG DEFAULT_MEMORY_SIZE
  15. #define DEBUG_STRING_DEFAULT_PADDING_SIZE ((DEFAULT_MEMORY_SIZE)>>1)
  16. typedef struct tagFIELD_VALIDATION_DATA{
  17. PCWSTR FieldName;
  18. LOGTYPE Type;
  19. UINT * FieldIndexPtr;
  20. BOOL Mandatory;
  21. }FIELD_VALIDATION_DATA, *PFIELD_VALIDATION_DATA;
  22. class CStandardSetupLogFilter : public ILogProvider
  23. {
  24. UINT m_uiSeverityFieldNumber;
  25. LOG_SETUPLOG_SEVERITY m_SeverityThreshold;
  26. BOOL m_bSuppressDebugMessages;
  27. public:
  28. CStandardSetupLogFilter();
  29. virtual LOG_PROVIDER_TYPE GetType(){return LOG_FILTER_TYPE;};
  30. virtual VOID GetGUID(GUID *pGUID){if(pGUID){*pGUID = CStandardSetupLogFilter::GetGUID();}};
  31. virtual LOGRESULT Init(PVOID pvCustomData, ILogContext * pLogContext);
  32. virtual VOID PreProcess(ILogContext * pLogContext, BOOL bFirstInstance){};
  33. virtual LOGRESULT Process(ILogContext * pLogContext);
  34. virtual VOID PreDestroy(ILogContext * pLogContext, BOOL bLastInstance){}
  35. virtual PCWSTR ToString(){return L"StandardSetupLogFilter";};
  36. virtual VOID DestroyObject(){delete this;}
  37. static const GUID& GetGUID(){return __uuidof(CStandardSetupLogFilter);}
  38. static ILogProvider * CreateObject(){return new CStandardSetupLogFilter;}
  39. };
  40. class CStandardSetupLogFormatter : public ILogProvider
  41. {
  42. UINT m_uiSeverityFieldNumber;
  43. UINT m_uiMessageFieldNumber;
  44. public:
  45. CStandardSetupLogFormatter();
  46. virtual LOG_PROVIDER_TYPE GetType(){return LOG_FORMATTER_TYPE;};
  47. virtual VOID GetGUID(GUID *pGUID){if(pGUID){*pGUID = CStandardSetupLogFormatter::GetGUID();}};
  48. virtual LOGRESULT Init(PVOID pvCustomData, ILogContext * pLogContext);
  49. virtual VOID PreProcess(ILogContext * pLogContext, BOOL bFirstInstance){};
  50. virtual LOGRESULT Process(ILogContext * pLogContext);
  51. virtual VOID PreDestroy(ILogContext * pLogContext, BOOL bLastInstance){}
  52. virtual PCWSTR ToString(){return L"StandardSetupLogFormatter";};
  53. virtual VOID DestroyObject(){delete this;}
  54. static const GUID& GetGUID(){return __uuidof(CStandardSetupLogFormatter);}
  55. static ILogProvider * CreateObject(){return new CStandardSetupLogFormatter;}
  56. };
  57. class CFileDevice : public ILogProvider
  58. {
  59. PWSTR m_pPath;
  60. CSharedAccessFile m_File;
  61. public:
  62. CFileDevice() : m_File(), m_pPath(NULL){};
  63. ~CFileDevice();
  64. virtual LOG_PROVIDER_TYPE GetType(){return LOG_DEVICE_TYPE;};
  65. virtual VOID GetGUID(GUID *pGUID){if(pGUID){*pGUID = CFileDevice::GetGUID();}};
  66. virtual LOGRESULT Init(PVOID pvCustomData, ILogContext * pLogContext);
  67. virtual VOID PreProcess(ILogContext * pLogContext, BOOL bFirstInstance){Process(pLogContext);};
  68. virtual LOGRESULT Process(ILogContext * pLogContext);
  69. virtual VOID PreDestroy(ILogContext * pLogContext, BOOL bLastInstance){Process(pLogContext);}
  70. virtual PCWSTR ToString(){return m_pPath;};
  71. virtual VOID DestroyObject(){delete this;}
  72. static const GUID& GetGUID(){return __uuidof(CFileDevice);}
  73. static ILogProvider * CreateObject(){return new CFileDevice;}
  74. };
  75. class CDebugFormatterAndDevice : public ILogProvider
  76. {
  77. UINT m_uiSeverityFieldNumber;
  78. UINT m_uiMessageFieldNumber;
  79. UINT m_uiConditionFieldNumber;
  80. UINT m_uiSourceLineFieldNumber;
  81. UINT m_uiSourceFileFieldNumber;
  82. UINT m_uiSourceFunctionFieldNumber;
  83. public:
  84. CDebugFormatterAndDevice();
  85. virtual LOG_PROVIDER_TYPE GetType(){return LOG_FORMATTER_TYPE;};
  86. virtual VOID GetGUID(GUID *pGUID){if(pGUID){*pGUID = CDebugFormatterAndDevice::GetGUID();}};
  87. virtual LOGRESULT Init(PVOID pvCustomData, ILogContext * pLogContext);
  88. virtual VOID PreProcess(ILogContext * pLogContext, BOOL bFirstInstance){};
  89. virtual LOGRESULT Process(ILogContext * pLogContext);
  90. virtual VOID PreDestroy(ILogContext * pLogContext, BOOL bLastInstance){}
  91. virtual PCWSTR ToString(){return L"DebugFormatterAndDevice";};
  92. virtual VOID DestroyObject(){delete this;}
  93. static const GUID& GetGUID(){return __uuidof(CDebugFormatterAndDevice);}
  94. static ILogProvider * CreateObject(){return new CDebugFormatterAndDevice;}
  95. };
  96. class CDebugFilter : public ILogProvider
  97. {
  98. UINT m_uiSeverityFieldNumber;
  99. UINT m_uiMessageFieldNumber;
  100. UINT m_uiConditionFieldNumber;
  101. UINT m_uiSourceLineFieldNumber;
  102. UINT m_uiSourceFileFieldNumber;
  103. UINT m_uiSourceFunctionFieldNumber;
  104. CHAR m_ProgramName[MAX_PATH];
  105. LOGRESULT ShowAssert(PCSTR pMessage);
  106. public:
  107. CDebugFilter();
  108. virtual LOG_PROVIDER_TYPE GetType(){return LOG_FILTER_TYPE;};
  109. virtual VOID GetGUID(GUID *pGUID){if(pGUID){*pGUID = CDebugFilter::GetGUID();}};
  110. virtual LOGRESULT Init(PVOID pvCustomData, ILogContext * pLogContext);
  111. virtual VOID PreProcess(ILogContext * pLogContext, BOOL bFirstInstance){};
  112. virtual LOGRESULT Process(ILogContext * pLogContext);
  113. virtual VOID PreDestroy(ILogContext * pLogContext, BOOL bLastInstance){}
  114. virtual PCWSTR ToString(){return L"DebugFilter";};
  115. virtual VOID DestroyObject(){delete this;}
  116. static const GUID& GetGUID(){return __uuidof(CDebugFilter);}
  117. static ILogProvider * CreateObject(){return new CDebugFilter;}
  118. };
  119. class CXMLLogFormatter : public ILogProvider
  120. {
  121. CHAR m_xmlDataFormatString[MAX_MSG];
  122. LOGRESULT WriteHeader(PVOID pvCustomData, ILogContext * pLogContext);
  123. public:
  124. CXMLLogFormatter(){};
  125. ~CXMLLogFormatter(){};
  126. virtual LOG_PROVIDER_TYPE GetType(){return LOG_FORMATTER_TYPE;};
  127. virtual VOID GetGUID(GUID *pGUID){if(pGUID){*pGUID = CXMLLogFormatter::GetGUID();}};
  128. virtual LOGRESULT Init(PVOID pvCustomData, ILogContext * pLogContext);
  129. virtual VOID PreProcess(ILogContext * pLogContext, BOOL bFirstInstance);
  130. virtual LOGRESULT Process(ILogContext * pLogContext);
  131. virtual VOID PreDestroy(ILogContext * pLogContext, BOOL bLastInstance);
  132. virtual PCWSTR ToString(){return L"XMLLogFormatter";};
  133. virtual VOID DestroyObject(){delete this;}
  134. static const GUID& GetGUID(){return __uuidof(CXMLLogFormatter);}
  135. static ILogProvider * CreateObject(){return new CXMLLogFormatter;}
  136. };
  137. #define XML_HEADER_INITIAL_SIZE 10000