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.

236 lines
7.5 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. log_bin.h
  5. Abstract:
  6. <abstract>
  7. --*/
  8. #ifndef _LOG_BIN_H_
  9. #define _LOG_BIN_H_
  10. // define record locations in the file
  11. #define BINLOG_TYPE_ID_RECORD ((DWORD)1)
  12. #define BINLOG_HEADER_RECORD ((DWORD)2)
  13. #define BINLOG_FIRST_DATA_RECORD ((DWORD)3)
  14. // Record type definition
  15. // low WORD of the type header field is "BL" to help re-sync records
  16. // that may have been corrupted
  17. #define BINLOG_START_WORD ((WORD)0x4C42)
  18. #define BINLOG_TYPE_HEADER ((DWORD)(0x00010000 | (DWORD)(BINLOG_START_WORD)))
  19. #define BINLOG_TYPE_CATALOG ((DWORD)(0x00020000 | (DWORD)(BINLOG_START_WORD)))
  20. #define BINLOG_TYPE_CATALOG_LIST ((DWORD)(0x01020000 | (DWORD)(BINLOG_START_WORD)))
  21. #define BINLOG_TYPE_CATALOG_HEAD ((DWORD)(0x02020000 | (DWORD)(BINLOG_START_WORD)))
  22. #define BINLOG_TYPE_CATALOG_ITEM ((DWORD)(0x03020000 | (DWORD)(BINLOG_START_WORD)))
  23. #define BINLOG_TYPE_DATA ((DWORD)(0x00030000 | (DWORD)(BINLOG_START_WORD)))
  24. #define BINLOG_TYPE_DATA_SINGLE ((DWORD)(0x01030000 | (DWORD)(BINLOG_START_WORD)))
  25. #define BINLOG_TYPE_DATA_MULTI ((DWORD)(0x02030000 | (DWORD)(BINLOG_START_WORD)))
  26. #define BINLOG_TYPE_DATA_PSEUDO ((DWORD)(0x03030000 | (DWORD)(BINLOG_START_WORD)))
  27. #define BINLOG_TYPE_DATA_OBJECT ((DWORD)(0x04030000 | (DWORD)(BINLOG_START_WORD)))
  28. #define BINLOG_TYPE_DATA_LOC_OBJECT ((DWORD)(0x05030000 | (DWORD)(BINLOG_START_WORD)))
  29. #define BINLOG_VERSION ((DWORD)(0x000005ff)) // debug value for now
  30. //
  31. // this is the field at the beginning of each record in the log file
  32. // after the text log file type record
  33. //
  34. typedef struct _PDHI_BINARY_LOG_RECORD_HEADER {
  35. DWORD dwType;
  36. DWORD dwLength;
  37. } PDHI_BINARY_LOG_RECORD_HEADER, *PPDHI_BINARY_LOG_RECORD_HEADER;
  38. //
  39. // the first data record after the log file type record is
  40. // an information record followed by the list of counters contained in this
  41. // log file. the record length is the size of the info header record and
  42. // all the counter info blocks in bytes.
  43. // note that this record can occur later in the log file if the query
  44. // is changed or the log file is appended.
  45. //
  46. typedef struct _PDHI_BINARY_LOG_INFO {
  47. LONGLONG FileLength; // file space allocated (optional)
  48. DWORD dwLogVersion; // version stamp
  49. DWORD dwFlags; // option flags
  50. LONGLONG StartTime;
  51. LONGLONG EndTime;
  52. LONGLONG CatalogOffset; // offset in file to wild card catalog
  53. LONGLONG CatalogChecksum; // checksum of catalog header
  54. LONGLONG CatalogDate; // date/time catalog was updated
  55. LONGLONG FirstRecordOffset; // pointer to first record [to read] in log
  56. LONGLONG LastRecordOffset; // pointer to last record [to read] in log
  57. LONGLONG NextRecordOffset; // pointer to where next one goes
  58. LONGLONG WrapOffset; // pointer to last byte used in file
  59. LONGLONG LastUpdateTime; // date/time last record was written
  60. LONGLONG FirstDataRecordOffset; // location of first data record in file
  61. // makes the info struct 256 bytes
  62. // and leaves room for future information
  63. DWORD dwReserved[38];
  64. } PDHI_BINARY_LOG_INFO, *PPDHI_BINARY_LOG_INFO;
  65. typedef struct _PDHI_BINARY_LOG_HEADER_RECORD {
  66. PDHI_BINARY_LOG_RECORD_HEADER RecHeader;
  67. PDHI_BINARY_LOG_INFO Info;
  68. } PDHI_BINARY_LOG_HEADER_RECORD, *PPDHI_BINARY_LOG_HEADER_RECORD;
  69. typedef struct _PDHI_LOG_COUNTER_PATH {
  70. // this value is in bytes used by the entire structure & buffers
  71. DWORD dwLength; // total structure Length (including strings)
  72. DWORD dwFlags; // flags that describe the counter
  73. DWORD dwUserData; // user data from PDH Counter
  74. DWORD dwCounterType; // perflib counter type value
  75. LONGLONG llTimeBase; // time base (freq) used by this counter
  76. LONG lDefaultScale; // default display scaling factor
  77. // the following values are in BYTES from the first byte in
  78. // the Buffer array.
  79. LONG lMachineNameOffset; // offset to start of machine name
  80. LONG lObjectNameOffset; // offset to start of object name
  81. LONG lInstanceOffset; // offset to start of instance name
  82. LONG lParentOffset; // offset to start of parent instance name
  83. DWORD dwIndex; // index value for duplicate instances
  84. LONG lCounterOffset; // offset to start of counter name
  85. WCHAR Buffer[1]; // start of string storage
  86. } PDHI_LOG_COUNTER_PATH, *PPDHI_LOG_COUNTER_PATH;
  87. typedef struct _PDHI_LOG_CAT_ENTRY {
  88. DWORD dwEntrySize; // size of this machine\object entry
  89. DWORD dwStringSize; // size of MSZ containing instance strings
  90. DWORD dwMachineObjNameOffset; // offset from the base of this struct to the machine name
  91. DWORD dwInstanceStringOffset; // offset to the first object entry in the list
  92. } PDHI_LOG_CAT_ENTRY, *PPDHI_LOG_CAT_ENTRY;
  93. PDH_FUNCTION
  94. PdhiOpenInputBinaryLog (
  95. IN PPDHI_LOG pLog
  96. );
  97. PDH_FUNCTION
  98. PdhiOpenOutputBinaryLog (
  99. IN PPDHI_LOG pLog
  100. );
  101. PDH_FUNCTION
  102. PdhiOpenUpdateBinaryLog (
  103. IN PPDHI_LOG pLog
  104. );
  105. PDH_FUNCTION
  106. PdhiUpdateBinaryLogFileCatalog (
  107. IN PPDHI_LOG pLog
  108. );
  109. PDH_FUNCTION
  110. PdhiCloseBinaryLog (
  111. IN PPDHI_LOG pLog,
  112. IN DWORD dwFlags
  113. );
  114. PDH_FUNCTION
  115. PdhiGetBinaryLogCounterInfo (
  116. IN PPDHI_LOG pLog,
  117. IN PPDHI_COUNTER pCounter
  118. );
  119. PDH_FUNCTION
  120. PdhiWriteBinaryLogHeader (
  121. IN PPDHI_LOG pLog,
  122. IN LPCWSTR szUserCaption
  123. );
  124. PDH_FUNCTION
  125. PdhiWriteBinaryLogRecord (
  126. IN PPDHI_LOG pLog,
  127. IN SYSTEMTIME *stTimeStamp,
  128. IN LPCWSTR szUserString
  129. );
  130. PDH_FUNCTION
  131. PdhiEnumMachinesFromBinaryLog (
  132. PPDHI_LOG pLog,
  133. LPVOID pBuffer,
  134. LPDWORD lpdwBufferSize,
  135. BOOL bUnicodeDest
  136. );
  137. PDH_FUNCTION
  138. PdhiEnumObjectsFromBinaryLog (
  139. IN PPDHI_LOG pLog,
  140. IN LPCWSTR szMachineName,
  141. IN LPVOID mszObjectList,
  142. IN LPDWORD pcchBufferSize,
  143. IN DWORD dwDetailLevel,
  144. IN BOOL bUnicode
  145. );
  146. PDH_FUNCTION
  147. PdhiEnumObjectItemsFromBinaryLog (
  148. IN PPDHI_LOG hDataSource,
  149. IN LPCWSTR szMachineName,
  150. IN LPCWSTR szObjectName,
  151. IN PDHI_COUNTER_TABLE CounterTable,
  152. IN DWORD dwDetailLevel,
  153. IN DWORD dwFlags
  154. );
  155. PDH_FUNCTION
  156. PdhiGetMatchingBinaryLogRecord (
  157. IN PPDHI_LOG pLog,
  158. IN LONGLONG *pStartTime,
  159. IN LPDWORD pdwIndex
  160. );
  161. PDH_FUNCTION
  162. PdhiGetCounterValueFromBinaryLog (
  163. IN PPDHI_LOG hLog,
  164. IN DWORD dwIndex,
  165. IN PPDHI_COUNTER pCounter
  166. );
  167. PDH_FUNCTION
  168. PdhiGetTimeRangeFromBinaryLog (
  169. IN PPDHI_LOG hLog,
  170. IN LPDWORD pdwNumEntries,
  171. IN PPDH_TIME_INFO pInfo,
  172. IN LPDWORD dwBufferSize
  173. );
  174. PDH_FUNCTION
  175. PdhiReadRawBinaryLogRecord (
  176. IN PPDHI_LOG pLog,
  177. IN FILETIME *ftRecord,
  178. IN PPDH_RAW_LOG_RECORD pBuffer,
  179. IN LPDWORD pdwBufferLength
  180. );
  181. PDH_FUNCTION
  182. PdhiListHeaderFromBinaryLog (
  183. IN PPDHI_LOG pLogFile,
  184. IN LPVOID pBufferArg,
  185. IN LPDWORD pcchBufferSize,
  186. IN BOOL bUnicode
  187. );
  188. PDH_FUNCTION
  189. PdhiGetCounterArrayFromBinaryLog (
  190. IN PPDHI_LOG pLog,
  191. IN DWORD dwIndex,
  192. IN PPDHI_COUNTER pCounter,
  193. IN OUT PPDHI_RAW_COUNTER_ITEM_BLOCK *ppValue
  194. );
  195. PPDHI_BINARY_LOG_RECORD_HEADER
  196. PdhiGetSubRecord (
  197. IN PPDHI_BINARY_LOG_RECORD_HEADER pRecord,
  198. IN DWORD dwRecordId
  199. );
  200. #endif // _LOG_BIN_H_