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.

216 lines
10 KiB

  1. Attribute VB_Name = "PDH Definitions"
  2. '
  3. '
  4. ' Visual Basic 4.0 definitions file for use with
  5. ' PDH.DLL the Peformance Data Helper DLL
  6. '
  7. ' Copyright (c) 1996-1999 by Microsoft Corporation
  8. '
  9. ' 19-Apr-1996 Bob Watson
  10. '
  11. ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  12. '
  13. ' Pdh Error status return values
  14. '
  15. Public Const ERROR_SUCCESS = 0
  16. Public Const PDH_CSTATUS_VALID_DATA = &H20000000
  17. Public Const PDH_CSTATUS_NEW_DATA = &H20000001
  18. Public Const PDH_CSTATUS_NO_MACHINE = &HA00007D0
  19. Public Const PDH_CSTATUS_NO_INSTANCE = &HA00007D1
  20. Public Const PDH_MORE_DATA = &HA00007D2
  21. Public Const PDH_CSTATUS_ITEM_NOT_VALIDATED = &HA00007D3
  22. Public Const PDH_RETRY = &HA00007D4
  23. Public Const PDH_NO_DATA = &HA00007D5
  24. Public Const PDH_CALC_NEGATIVE_DENOMINATOR = &HA00007D6
  25. Public Const PDH_CALC_NEGATIVE_TIMEBASE = &HA00007D7
  26. Public Const PDH_CALC_NEGATIVE_VALUE = &HA00007D8
  27. Public Const PDH_DIALOG_CANCELLED = &HA00007D9
  28. Public Const PDH_CSTATUS_NO_OBJECT = &HE0000BB8
  29. Public Const PDH_CSTATUS_NO_COUNTER = &HE0000BB9
  30. Public Const PDH_CSTATUS_INVALID_DATA = &HE0000BBA
  31. Public Const PDH_MEMORY_ALLOCATION_FAILURE = &HE0000BBB
  32. Public Const PDH_INVALID_HANDLE = &HE0000BBC
  33. Public Const PDH_INVALID_ARGUMENT = &HE0000BBD
  34. Public Const PDH_FUNCTION_NOT_FOUND = &HE0000BBE
  35. Public Const PDH_CSTATUS_NO_COUNTERNAME = &HE0000BBF
  36. Public Const PDH_CSTATUS_BAD_COUNTERNAME = &HE0000BC0
  37. Public Const PDH_INVALID_BUFFER = &HE0000BC1
  38. Public Const PDH_INSUFFICIENT_BUFFER = &HE0000BC2
  39. Public Const PDH_CANNOT_CONNECT_MACHINE = &HE0000BC3
  40. Public Const PDH_INVALID_PATH = &HE0000BC4
  41. Public Const PDH_INVALID_INSTANCE = &HE0000BC5
  42. Public Const PDH_INVALID_DATA = &HE0000BC6
  43. Public Const PDH_NO_DIALOG_DATA = &HE0000BC7
  44. Public Const PDH_CANNOT_READ_NAME_STRINGS = &HE0000BC8
  45. '
  46. ' Counter Browser Detail Level Definitions
  47. '
  48. Public Const PERF_DETAIL_NOVICE = 100
  49. Public Const PERF_DETAIL_ADVANCED = 200
  50. Public Const PERF_DETAIL_EXPERT = 300
  51. Public Const PERF_DETAIL_WIZARD = 400
  52. '
  53. ' Standard PDH Function prototypes
  54. '
  55. Public Declare Function PdhOpenQuery Lib "Pdh.Dll" Alias "PdhVbOpenQuery" ( _
  56. ByRef QueryHandle As Long) As Long
  57. '
  58. ' PdhOpenQuery Creates an empty performance data query structure
  59. ' QueryHandle The Id of the query created is returned in this buffer
  60. ' Return Value an error code from the list above. ERROR_SUCCESS
  61. ' indicates a valid query was created and
  62. ' the value returned in QueryHandle is valid
  63. '
  64. Public Declare Function PdhAddCounter Lib "Pdh.Dll" Alias "PdhVbAddCounter" ( _
  65. ByVal QueryHandle As Long, _
  66. ByVal CounterPath As String, _
  67. ByRef CounterHandle As Long) As Long
  68. '
  69. ' PdhAddCounter Adds a counter to the specified query
  70. ' QueryHandle the QueryHandle of the query to add the counter to.
  71. ' This is the value initialized by the PdhOpenQuery
  72. ' function
  73. ' CounterPath the counter path string of the counter to add. This
  74. ' value can be obtained by either the
  75. ' PdhGetOneCounterPath or the PdhCreateCounterPathList
  76. ' functions
  77. ' CounterHandle The handle to the counter that is added to the query
  78. ' Return Value an error code from the list above. ERROR_SUCCESS
  79. ' indicates a valid counter was created
  80. '
  81. Public Declare Function PdhRemoveCounter Lib "Pdh.Dll" ( _
  82. ByVal CounterHandle As Long) As Long
  83. '
  84. ' PdhRemoveCounter Removes the specified counter from the query to which
  85. ' it belongs
  86. ' CounterHandle Handle of the counter to remove
  87. ' Return Value an error code from the list above. ERROR_SUCCESS
  88. ' indicates the counter was removed
  89. '
  90. Public Declare Function PdhCollectQueryData Lib "Pdh.Dll" ( _
  91. ByVal QueryHandle As Long) As Long
  92. '
  93. ' PdhCollectQueryData Obtains the current values of each counter in the
  94. ' query (the value of each counter must be retrieved
  95. ' individually using the PdhGetDoubleCounterValue,
  96. ' after the data has been updated)
  97. ' QueryHandle Handle of the query to refresh
  98. ' Return Value an error code from the list above. ERROR_SUCCESS
  99. ' indicates the function completed successfully
  100. '
  101. Public Declare Function PdhCloseQuery Lib "Pdh.Dll" ( _
  102. ByVal QueryHandle As Long) As Long
  103. '
  104. ' PdhCloseQuery Terminates data collection and frees the resources
  105. ' associated with the query
  106. ' QueryHandle Handle of query to close and free
  107. ' Return Value an error code from the list above. ERROR_SUCCESS
  108. ' indicates the query was freed
  109. '
  110. ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  111. '
  112. ' DPH VB Helper Functions
  113. '
  114. Public Declare Function PdhGetDoubleCounterValue Lib "Pdh.Dll" _
  115. Alias "PdhVbGetDoubleCounterValue" ( _
  116. ByVal CounterHandle As Long, _
  117. ByRef CounterStatus As Long) As Double
  118. '
  119. ' PdhGetDoubleCounterValue retrieves the value of the specified counter
  120. ' as a double precision real number
  121. ' CounterHandle The handle of the counter to retrive
  122. ' CounterStatus returns the current status of the counter
  123. ' as a PDH_ status value defined above
  124. ' Return Value The double precision real value of the counter
  125. '
  126. Public Declare Function PdhGetOneCounterPath Lib "Pdh.Dll" _
  127. Alias "PdhVbGetOneCounterPath" ( _
  128. ByVal PathString As String, _
  129. ByVal PathLength As Long, _
  130. ByVal DetailLevel As Long, _
  131. ByVal CaptionString As String) As Long
  132. '
  133. ' PdhGetOneCounterPath Displays a dialog box prompting the user to
  134. ' select one counter path
  135. ' PathString Preinitialized buffer to retrieve the path string
  136. ' PathLength Sise of initialized buffer
  137. ' DetailLevel Level of detail to filter counter display. 0
  138. ' shows all counters and hides detail combo
  139. ' box.
  140. ' CaptionString String to display in caption bar of browser
  141. ' dialog box
  142. ' Return Value returns the number of characters written to the
  143. ' PathString buffer.
  144. '
  145. Public Declare Function PdhCreateCounterPathList Lib "Pdh.Dll" _
  146. Alias "PdhVbCreateCounterPathList" ( _
  147. ByVal DetailLevel As Long, _
  148. ByVal CaptionString As String) As Long
  149. '
  150. ' PdhCreateCounterPathList Displays a dialog box prompting the user to
  151. ' select multiple counters Use the next
  152. ' function to read the selected path strings
  153. ' DetailLevel Level of detail to filter counter display. 0
  154. ' shows all counters and hides detail combo
  155. ' box.
  156. ' CaptionString String to display in caption bar of browser
  157. ' dialog box
  158. ' Return Value returns the number of path strings selected
  159. '
  160. Public Declare Function PdhGetCounterPathFromList Lib "Pdh.Dll" _
  161. Alias "PdhVbGetCounterPathFromList" ( _
  162. ByVal Index As Long, _
  163. ByVal Buffer As String, _
  164. ByVal BufferLength As Long) _
  165. As Long
  166. '
  167. ' PdhGetCounterPathFromList Retrieves an individual path string from the
  168. ' list created by the PdhCreateCounterPathList
  169. ' function call
  170. ' Index Index of the path string to retrieve starting
  171. ' at 1 and going to the value returned by
  172. ' the previous call to PdhCreateCounterPathList
  173. ' Buffer An initialized string buffer to retrieve the
  174. ' selected string
  175. ' BufferLength The maximum size of the buffer
  176. ' Return Value The number of characters copied to Buffer
  177. '
  178. '
  179. Public Declare Function PdhGetCounterPathElements Lib "Pdh.Dll" _
  180. Alias "PdhVbGetCounterPathElements" ( _
  181. ByVal PathString As String, _
  182. ByVal MachineName As String, _
  183. ByVal ObjectName As String, _
  184. ByVal InstanceName As String, _
  185. ByVal ParentInstance As String, _
  186. ByVal CounterName As String, _
  187. ByVal BufferSize As Long) As Long
  188. '
  189. ' PdhGetCounterPathElements Reads a performance counter path
  190. ' string and returns the components
  191. ' as individual strings
  192. ' PathString The full path string to read
  193. ' MachineName The buffer to receive the machine name
  194. ' ObjectName The buffer to receive the object name
  195. ' InstanceName The buffer to receive the instance name
  196. ' ParentInstance The buffer to receive the parent instance
  197. ' CounterName The buffer to receive the counter name
  198. ' BufferSize The size of the string buffers
  199. '
  200. ' ReturnValue DPH status code. 0 means the function succeeded.
  201. '
  202. '
  203. Public Declare Function PdhIsGoodStatus Lib "Pdh.Dll" _
  204. Alias "PdhVbIsGoodStatus" ( _
  205. ByVal StatusValue As Long ) As Long
  206. '
  207. ' PdhIsGoodStatus tests the status value returned by a PDH function
  208. ' to determine if the function or value returned
  209. ' is good/success (nozero) or bad/error (zero)
  210. '
  211. ' StatusValue the value returned by a call to a PDH function
  212. '
  213. ' Return Value 0 if the status is not good
  214. ' non-zero if the status is good
  215. '
  216. 'END OF PdhDefs.TXT
  217.