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.

232 lines
7.6 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. PPDHI_LOG pLog
  96. );
  97. #if 0
  98. PDH_FUNCTION
  99. PdhiOpenOutputBinaryLog(
  100. PPDHI_LOG pLog
  101. );
  102. PDH_FUNCTION
  103. PdhiOpenUpdateBinaryLog(
  104. PPDHI_LOG pLog
  105. );
  106. PDH_FUNCTION
  107. PdhiUpdateBinaryLogFileCatalog(
  108. PPDHI_LOG pLog
  109. );
  110. PDH_FUNCTION
  111. PdhiWriteBinaryLogHeader(
  112. PPDHI_LOG pLog,
  113. LPCWSTR szUserCaption
  114. );
  115. PDH_FUNCTION
  116. PdhiWriteBinaryLogRecord(
  117. PPDHI_LOG pLog,
  118. SYSTEMTIME * stTimeStamp,
  119. LPCWSTR szUserString
  120. );
  121. #endif
  122. PDH_FUNCTION
  123. PdhiCloseBinaryLog(
  124. PPDHI_LOG pLog,
  125. DWORD dwFlags
  126. );
  127. PDH_FUNCTION
  128. PdhiGetBinaryLogCounterInfo(
  129. PPDHI_LOG pLog,
  130. PPDHI_COUNTER pCounter
  131. );
  132. PDH_FUNCTION
  133. PdhiEnumMachinesFromBinaryLog(
  134. PPDHI_LOG pLog,
  135. LPVOID pBuffer,
  136. LPDWORD lpdwBufferSize,
  137. BOOL bUnicodeDest
  138. );
  139. PDH_FUNCTION
  140. PdhiEnumObjectsFromBinaryLog(
  141. PPDHI_LOG pLog,
  142. LPCWSTR szMachineName,
  143. LPVOID mszObjectList,
  144. LPDWORD pcchBufferSize,
  145. DWORD dwDetailLevel,
  146. BOOL bUnicode
  147. );
  148. PDH_FUNCTION
  149. PdhiEnumObjectItemsFromBinaryLog(
  150. PPDHI_LOG hDataSource,
  151. LPCWSTR szMachineName,
  152. LPCWSTR szObjectName,
  153. PDHI_COUNTER_TABLE CounterTable,
  154. DWORD dwDetailLevel,
  155. DWORD dwFlags
  156. );
  157. PDH_FUNCTION
  158. PdhiGetMatchingBinaryLogRecord(
  159. PPDHI_LOG pLog,
  160. LONGLONG * pStartTime,
  161. LPDWORD pdwIndex
  162. );
  163. PDH_FUNCTION
  164. PdhiGetCounterValueFromBinaryLog(
  165. PPDHI_LOG hLog,
  166. DWORD dwIndex,
  167. PPDHI_COUNTER pCounter
  168. );
  169. PDH_FUNCTION
  170. PdhiGetTimeRangeFromBinaryLog(
  171. PPDHI_LOG hLog,
  172. LPDWORD pdwNumEntries,
  173. PPDH_TIME_INFO pInfo,
  174. LPDWORD dwBufferSize
  175. );
  176. PDH_FUNCTION
  177. PdhiReadRawBinaryLogRecord(
  178. PPDHI_LOG pLog,
  179. FILETIME * ftRecord,
  180. PPDH_RAW_LOG_RECORD pBuffer,
  181. LPDWORD pdwBufferLength
  182. );
  183. PDH_FUNCTION
  184. PdhiListHeaderFromBinaryLog(
  185. PPDHI_LOG pLogFile,
  186. LPVOID pBufferArg,
  187. LPDWORD pcchBufferSize,
  188. BOOL bUnicode
  189. );
  190. PDH_FUNCTION
  191. PdhiGetCounterArrayFromBinaryLog(
  192. PPDHI_LOG pLog,
  193. DWORD dwIndex,
  194. PPDHI_COUNTER pCounter,
  195. PPDHI_RAW_COUNTER_ITEM_BLOCK * ppValue
  196. );
  197. PPDHI_BINARY_LOG_RECORD_HEADER
  198. PdhiGetSubRecord(
  199. PPDHI_BINARY_LOG_RECORD_HEADER pRecord,
  200. DWORD dwRecordId
  201. );
  202. #endif // _LOG_BIN_H_