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.

235 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. logfmt.h
  5. Abstract:
  6. contains format for log header and entries
  7. Author:
  8. Kanwaljit Marok (kmarok) 01-March-2000
  9. Revision History:
  10. --*/
  11. #ifndef _LOGFMT_H_
  12. #define _LOGFMT_H_
  13. #define SR_LOG_VERSION 2
  14. #define SR_LOG_MAGIC_NUMBER 0xabcdef12
  15. #define SR_LOG_PROCNAME_SIZE 16
  16. #define SR_LOG_FIXED_SUBRECORDS 3
  17. #define ACL_FILE_PREFIX L"S"
  18. #define ACL_FILE_SUFFIX L".Acl"
  19. //
  20. // these are the interesting types of entries
  21. //
  22. typedef enum _RECORD_TYPE
  23. {
  24. RecordTypeLogHeader = 0, // Log header for SR Log
  25. RecordTypeLogEntry = 1, // Log Entry for SR Log
  26. RecordTypeVolumePath = 2, // Log Entry Volume Path ( SubRec )
  27. RecordTypeFirstPath = 3, // Log Entry First Path ( SubRec )
  28. RecordTypeSecondPath = 4, // Log Entry Second Path ( SubRec )
  29. RecordTypeTempPath = 5, // Log Entry Temp File ( SubRec )
  30. RecordTypeAclInline = 6, // Log Entry ACL Info ( SubRec )
  31. RecordTypeAclFile = 7, // Log Entry ACL Info ( SubRec )
  32. RecordTypeDebugInfo = 8, // Option rec for debug ( SubRec )
  33. RecordTypeShortName = 9, // Option rec for short names ( SubRec )
  34. RecordTypeMaximum
  35. } RECORD_TYPE;
  36. //
  37. // this struct is the basic template for a log entry
  38. //
  39. typedef struct _RECORD_HEADER
  40. {
  41. //
  42. // size of the entry including the trailing dword size
  43. //
  44. DWORD RecordSize;
  45. //
  46. // type of record
  47. //
  48. DWORD RecordType;
  49. } RECORD_HEADER, *PRECORD_HEADER;
  50. #define RECORD_SIZE(pRecord) ( ((PRECORD_HEADER)pRecord)->RecordSize )
  51. #define RECORD_TYPE(pRecord) ( ((PRECORD_HEADER)pRecord)->RecordType )
  52. //
  53. // this struct is the basic template for a SR log entry
  54. //
  55. typedef struct _SR_LOG_ENTRY
  56. {
  57. //
  58. // Log entry header
  59. //
  60. RECORD_HEADER Header;
  61. //
  62. // magic number for consistency check
  63. //
  64. DWORD MagicNum;
  65. //
  66. // event type for this entry , create, delete...
  67. //
  68. DWORD EntryType;
  69. //
  70. // any special flags to be passed
  71. //
  72. DWORD EntryFlags;
  73. //
  74. // attributes for the entry
  75. //
  76. DWORD Attributes;
  77. //
  78. // sequence number for the entry
  79. //
  80. INT64 SequenceNum;
  81. //
  82. // process name making this change
  83. //
  84. WCHAR ProcName[ SR_LOG_PROCNAME_SIZE ];
  85. //
  86. // start of variable length data, data includes subrecords and
  87. // the end size
  88. //
  89. BYTE SubRecords[1];
  90. } SR_LOG_ENTRY, *PSR_LOG_ENTRY;
  91. #define ENTRYFLAGS_TEMPPATH 0x01
  92. #define ENTRYFLAGS_SECONDPATH 0x02
  93. #define ENTRYFLAGS_ACLINFO 0x04
  94. #define ENTRYFLAGS_DEBUGINFO 0x08
  95. #define ENTRYFLAGS_SHORTNAME 0x10
  96. //
  97. // this struct defines SR Log header
  98. //
  99. typedef struct _SR_LOG_HEADER
  100. {
  101. //
  102. // Log entry header
  103. //
  104. RECORD_HEADER Header;
  105. //
  106. // magic number for consistency check
  107. //
  108. DWORD MagicNum;
  109. //
  110. // log version number
  111. //
  112. DWORD LogVersion;
  113. //
  114. // end size
  115. //
  116. //
  117. // start of variable length data, data includes subrecords and
  118. // the end size
  119. //
  120. BYTE SubRecords[1];
  121. } SR_LOG_HEADER, *PSR_LOG_HEADER;
  122. //
  123. // this struct defines SR Log debugInfo struct
  124. //
  125. #define PROCESS_NAME_MAX 12
  126. #define PROCESS_NAME_OFFSET 0x194
  127. typedef struct _SR_LOG_DEBUG_INFO
  128. {
  129. //
  130. // Log entry header
  131. //
  132. RECORD_HEADER Header;
  133. //
  134. // Thread Id
  135. //
  136. HANDLE ThreadId;
  137. //
  138. // ProcessId
  139. //
  140. HANDLE ProcessId;
  141. //
  142. // Event time stamp
  143. //
  144. ULARGE_INTEGER TimeStamp;
  145. //
  146. // Process Name
  147. //
  148. CHAR ProcessName[ PROCESS_NAME_MAX + 1 ];
  149. } SR_LOG_DEBUG_INFO, *PSR_LOG_DEBUG_INFO;
  150. //
  151. // Some useful macros
  152. //
  153. #define GET_END_SIZE( a ) \
  154. *((PDWORD)((PBYTE)a+((PRECORD_HEADER)a)->RecordSize-sizeof(DWORD)))
  155. #define UPDATE_END_SIZE( a, b ) \
  156. GET_END_SIZE(a)=b;
  157. #define STRING_RECORD_SIZE(pRecord) ( sizeof( RECORD_HEADER ) + \
  158. (pRecord)->Length + \
  159. sizeof(WCHAR) ) // NULL term extra
  160. #endif