' ########################################################################################
' Microsoft Windows
' File: Pdh.inc
' Contents: Header file for the Performance Data Helper (PDH) DLL functions
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_Pdh_PBI)
#DEFINE PBX_Pdh_PBI
%EQUATE `PDH_INC = 1
'// system include files required for datatype and constant definitions
#INCLUDE ONCE "Core/Windows.inc" ' // necessary for data types used in this file
#INCLUDE ONCE "Legacy/Platform/WinPerf.inc" ' // necessary for the Detail Level definitions
#INCLUDE ONCE "Legacy/System/PdhMsg.inc"
'typedef LONG PDH_STATUS;
'// version info
%EQUATE `PDH_CVERSION_WIN40 = &H0400
%EQUATE `PDH_CVERSION_WIN50 = &H0500
'// v1.1 revision of PDH -- basic log functions
'// v1.2 of the PDH -- adds variable instance counters
'// v1.3 of the PDH -- adds log service control & stubs for NT5/PDH v2 fn's
'// v2.0 of the PDH -- is the NT v 5.0 B2 version
%EQUATE `PDH_VERSION = %PDH_CVERSION_WIN50 + &H0003
'// define severity masks
'#define IsSuccessSeverity(ErrorCode) ((((DWORD)(ErrorCode) & (0xC0000000L)) == 0x00000000L) ? TRUE : FALSE)
'#define IsInformationalSeverity(ErrorCode) ((((DWORD)(ErrorCode) & (0xC0000000L)) == 0x40000000L) ? TRUE : FALSE)
'#define IsWarningSeverity(ErrorCode) ((((DWORD)(ErrorCode) & (0xC0000000L)) == 0x80000000L) ? TRUE : FALSE)
'#define IsErrorSeverity(ErrorCode) ((((DWORD)(ErrorCode) & (0xC0000000L)) == 0xC0000000L) ? TRUE : FALSE)
MACRO IsSuccessSeverity(ErrorCode) = IIF&((ErrorCode AND &HC0000000) = &H00000000, %TRUE, %FALSE)
MACRO IsInformationalSeverity(ErrorCode) = IIF&((ErrorCode AND &HC0000000) = &H40000000, %TRUE, %FALSE)
MACRO IsWarningSeverity(ErrorCode) = IIF&((ErrorCode AND &HC0000000) = &H80000000, %TRUE, %FALSE)
MACRO IsErrorSeverity(ErrorCode) = IIF&((ErrorCode AND &HC0000000) = &HC0000000), %TRUE, %FALSE)
%EQUATE `MAX_COUNTER_PATH = 256 ' // Maximum counter path length. This is an obsolute constance.
%EQUATE `PDH_MAX_COUNTER_NAME = 1024 ' // Maximum counter name length.
%EQUATE `PDH_MAX_INSTANCE_NAME = 1024 ' // Maximum counter instance name length.
%EQUATE `PDH_MAX_COUNTER_PATH = 2048 ' // Maximum full counter path length.
%EQUATE `PDH_MAX_DATASOURCE_PATH = 1024 ' // MAximum full counter log name length.
%EQUATE `PDH_OBJECT_HAS_INSTANCES = &H00000001
'// data type definitions
'typedef HANDLE PDH_HCOUNTER;
'typedef HANDLE PDH_HQUERY;
'typedef HANDLE PDH_HLOG;
'typedef PDH_HCOUNTER HCOUNTER;
'typedef PDH_HQUERY HQUERY;
'#ifndef _LMHLOGDEFINED_
'typedef PDH_HLOG HLOG;
'#endif
'#ifdef INVALID_HANDLE_VALUE
'#undef INVALID_HANDLE_VALUE
'#define INVALID_HANDLE_VALUE ((HANDLE)((LONG_PTR)-1))
'#endif
'#define H_REALTIME_DATASOURCE NULL
'#define H_WBEM_DATASOURCE INVALID_HANDLE_VALUE
%EQUATE `H_REALTIME_DATASOURCE = %NULL
%EQUATE `H_WBEM_DATASOURCE = %INVALID_HANDLE_VALUE
' // Size = 40 bytes
TYPE PDH_RAW_COUNTER QWORD
 CStatus AS DWORD
 TimeStamp AS FILETIME ' FILETIME
 FirstValue AS QUAD ' LONGLONG
 SecondValue AS QUAD ' LONGLONG
 MultiCount AS DWORD
END TYPE
' // Size = 48 bytes
TYPE PDH_RAW_COUNTER_ITEM_A QWORD
 szName AS ASCIIZ PTR
 RawValue AS PDH_RAW_COUNTER ' PDH_RAW_COUNTER
END TYPE
' // Size = 48 bytes
TYPE PDH_RAW_COUNTER_ITEM_W QWORD
 szName AS WSTRINGZ PTR
 RawValue AS PDH_RAW_COUNTER ' PDH_RAW_COUNTER
END TYPE
MACRO PDH_RAW_COUNTER_ITEM = PDH_RAW_COUNTER_ITEMA
' // Size = 8 bytes
UNION PDH_FMT_COUNTERVALUE_UNION QWORD
 longValue AS LONG
 doubleValue AS DOUBLE ' double
 largeValue AS QUAD ' LONGLONG
 AnsiStringValue AS ASCIIZ PTR
 WideStringValue AS WSTRINGZ PTR
END UNION
' // Size = 16 bytes
TYPE PDH_FMT_COUNTERVALUE QWORD
 CStatus AS DWORD
 PDH_FMT_COUNTERVALUE_UNION
END TYPE
' // Size = 24 bytes
TYPE PDH_FMT_COUNTERVALUE_ITEM_A QWORD
 szName AS ASCIIZ PTR
 FmtValue AS PDH_FMT_COUNTERVALUE
END TYPE
' // Size = 24 bytes
TYPE PDH_FMT_COUNTERVALUE_ITEM_W QWORD
 szName AS WSTRINGZ PTR
 FmtValue AS PDH_FMT_COUNTERVALUE
END TYPE
MACRO PDH_FMT_COUNTERVALUE_ITEM = PDH_FMT_COUNTERVALUE_ITEM_A
' // Size = 56 bytes
TYPE PDH_STATISTICS QWORD FILL
 dwFormat AS DWORD
 count AS DWORD
 min AS PDH_FMT_COUNTERVALUE
 max AS PDH_FMT_COUNTERVALUE
 mean AS PDH_FMT_COUNTERVALUE
END TYPE
' // Size = 24 bytes
TYPE PDH_COUNTER_PATH_ELEMENTS_A DWORD
 szMachineName AS ASCIIZ PTR
 szObjectName AS ASCIIZ PTR
 szInstanceName AS ASCIIZ PTR
 szParentInstance AS ASCIIZ PTR
 dwInstanceIndex AS DWORD
 szCounterName AS ASCIIZ PTR
END TYPE
' // Size = 24 bytes
TYPE PDH_COUNTER_PATH_ELEMENTS_W DWORD
 szMachineName AS WSTRINGZ PTR
 szObjectName AS WSTRINGZ PTR
 szInstanceName AS WSTRINGZ PTR
 szParentInstance AS WSTRINGZ PTR
 dwInstanceIndex AS DWORD
 szCounterName AS WSTRINGZ PTR
END TYPE
MACRO PDH_COUNTER_PATH_ELEMENTS = PDH_COUNTER_PATH_ELEMENTS_A
' // Size = 28 bytes
TYPE PDH_DATA_ITEM_PATH_ELEMENTS_A DWORD
 szMachineName AS ASCIIZ PTR
 ObjectGUID AS GUID ' GUID
 dwItemId AS DWORD
 szInstanceName AS ASCIIZ PTR
END TYPE
' // Size = 28 bytes
TYPE PDH_DATA_ITEM_PATH_ELEMENTS_W DWORD
 szMachineName AS WSTRINGZ PTR
 ObjectGUID AS GUID ' GUID
 dwItemId AS DWORD
 szInstanceName AS WSTRINGZ PTR
END TYPE
MACRO PDH_DATA_ITEM_PATH_ELEMENTS = PDH_DATA_ITEM_PATH_ELEMENTS_A
' // Size = 24 bytes
TYPE PDH_COUNTER_INFO_A_UNION_STRUCT
 szMachineName AS ASCIIZ PTR
 szObjectName AS ASCIIZ PTR
 szInstanceName AS ASCIIZ PTR
 szParentInstance AS ASCIIZ PTR
 dwInstanceIndex AS DWORD
 szCounterName AS ASCIIZ PTR
END TYPE
' // Size = 28 bytes
UNION PDH_COUNTER_INFO_A_UNION
 DataItemPath AS PDH_DATA_ITEM_PATH_ELEMENTS_A
 CounterPath AS PDH_COUNTER_PATH_ELEMENTS_A
 PDH_COUNTER_INFO_A_UNION_STRUCT
END UNION
' // Size = 72 bytes
TYPE PDH_COUNTER_INFO_A DWORD
 dwLength AS DWORD
 dwType AS DWORD
 CVersion AS DWORD
 CStatus AS DWORD
 lScale AS LONG
 lDefaultScale AS LONG
 dwUserData AS DWORD ' DWORD_PTR
 dwQueryUserData AS DWORD ' DWORD_PTR
 szFullPath AS ASCIIZ PTR
 PDH_COUNTER_INFO_A_UNION
 szExplainText AS ASCIIZ PTR
 DataBuffer(0) AS DWORD
END TYPE
' // Size = 24 bytes
TYPE PDH_COUNTER_INFO_W_UNION_STRUCT DWORD
 szMachineName AS WSTRINGZ PTR
 szObjectName AS WSTRINGZ PTR
 szInstanceName AS WSTRINGZ PTR
 szParentInstance AS WSTRINGZ PTR
 dwInstanceIndex AS DWORD
 szCounterName AS WSTRINGZ PTR
END TYPE
' // Size = 28 bytes
UNION PDH_COUNTER_INFO_W_UNION
 DataItemPath AS PDH_DATA_ITEM_PATH_ELEMENTS_W
 CounterPath AS PDH_COUNTER_PATH_ELEMENTS_W
 PDH_COUNTER_INFO_W_UNION_STRUCT
END UNION
' // Size = 72 bytes
TYPE PDH_COUNTER_INFO_W DWORD
 dwLength AS DWORD
 dwType AS DWORD
 CVersion AS DWORD
 CStatus AS DWORD
 lScale AS LONG
 lDefaultScale AS LONG
 dwUserData AS DWORD ' DWORD_PTR
 dwQueryUserData AS DWORD ' DWORD_PTR
 szFullPath AS WSTRINGZ PTR
 PDH_COUNTER_INFO_A_UNION
 szExplainText AS WSTRINGZ PTR
 DataBuffer(0) AS DWORD
END TYPE
MACRO PDH_COUNTER_INFO = PDH_COUNTER_INFO_A
' // Size = 24 bytes
TYPE PDH_TIME_INFO QWORD
 StartTime AS QUAD ' LONGLONG
 EndTime AS QUAD ' LONGLONG
 SampleCount AS DWORD
END TYPE
' // Size = 16 bytes
TYPE PDH_RAW_LOG_RECORD DWORD
 dwStructureSize AS DWORD
 dwRecordType AS DWORD
 dwItems AS DWORD
 RawBytes(0) AS BYTE ' UCHAR
END TYPE
' // Size = 40 bytes
TYPE PDH_LOG_SERVICE_QUERY_INFO_A_UNION_STRUCT1 DWORD
 PdlAutoNameInterval AS DWORD
 PdlAutoNameUnits AS DWORD
 PdlCommandFilename AS ASCIIZ PTR
 PdlCounterList AS ASCIIZ PTR
 PdlAutoNameFormat AS DWORD
 PdlSampleInterval AS DWORD
 PdlLogStartTime AS FILETIME ' FILETIME
 PdlLogEndTime AS FILETIME ' FILETIME
END TYPE
' // Size = 40 bytes
TYPE PDH_LOG_SERVICE_QUERY_INFO_A_UNION_STRUCT2 DWORD
 TlNumberOfBuffers AS DWORD
 TlMinimumBuffers AS DWORD
 TlMaximumBuffers AS DWORD
 TlFreeBuffers AS DWORD
 TlBufferSize AS DWORD
 TlEventsLost AS DWORD
 TlLoggerThreadId AS DWORD
 TlBuffersWritten AS DWORD
 TlLogHandle AS DWORD
 TlLogFileName AS ASCIIZ PTR
END TYPE
' // Size = 40 bytes
UNION PDH_LOG_SERVICE_QUERY_INFO_A_UNION
 PDH_LOG_SERVICE_QUERY_INFO_A_UNION_STRUCT1
 PDH_LOG_SERVICE_QUERY_INFO_A_UNION_STRUCT2
END UNION
' // Size = 72 bytes
TYPE PDH_LOG_SERVICE_QUERY_INFO_A DWORD
 dwSize AS DWORD
 dwFlags AS DWORD
 dwLogQuota AS DWORD
 szLogFileCaption AS ASCIIZ PTR
 szDefaultDir AS ASCIIZ PTR
 szBaseFileName AS ASCIIZ PTR
 dwFileType AS DWORD
 dwReserved AS DWORD
 PDH_LOG_SERVICE_QUERY_INFO_A_UNION
END TYPE
' // Size = 40 bytes
TYPE PDH_LOG_SERVICE_QUERY_INFO_W_UNION_STRUCT1 DWORD
 PdlAutoNameInterval AS DWORD
 PdlAutoNameUnits AS DWORD
 PdlCommandFilename AS WSTRINGZ PTR
 PdlCounterList AS WSTRINGZ PTR
 PdlAutoNameFormat AS DWORD
 PdlSampleInterval AS DWORD
 PdlLogStartTime AS FILETIME ' FILETIME
 PdlLogEndTime AS FILETIME ' FILETIME
END TYPE
' // Size = 40 bytes
TYPE PDH_LOG_SERVICE_QUERY_INFO_W_UNION_STRUCT2 DWORD
 TlNumberOfBuffers AS DWORD
 TlMinimumBuffers AS DWORD
 TlMaximumBuffers AS DWORD
 TlFreeBuffers AS DWORD
 TlBufferSize AS DWORD
 TlEventsLost AS DWORD
 TlLoggerThreadId AS DWORD
 TlBuffersWritten AS DWORD
 TlLogHandle AS DWORD
 TlLogFileName AS WSTRINGZ PTR
END TYPE
' // Size = 40 bytes
UNION PDH_LOG_SERVICE_QUERY_INFO_W_UNION
 PDH_LOG_SERVICE_QUERY_INFO_W_UNION_STRUCT1
 PDH_LOG_SERVICE_QUERY_INFO_W_UNION_STRUCT2
END UNION
' // Size = 72 bytes
TYPE PDH_LOG_SERVICE_QUERY_INFO_W DWORD
 dwSize AS DWORD
 dwFlags AS DWORD
 dwLogQuota AS DWORD
 szLogFileCaption AS WSTRINGZ PTR
 szDefaultDir AS WSTRINGZ PTR
 szBaseFileName AS WSTRINGZ PTR
 dwFileType AS DWORD
 dwReserved AS DWORD
 PDH_LOG_SERVICE_QUERY_INFO_W_UNION
END TYPE
MACRO PDH_LOG_SERVICE_QUERY_INFO = PDH_LOG_SERVICE_QUERY_INFOA
'//
'// Time value constants
'//
'#define MAX_TIME_VALUE ((LONGLONG) 0x7FFFFFFFFFFFFFFF)
'#define MIN_TIME_VALUE ((LONGLONG) 0)
%EQUATE `MAX_TIME_VALUE = &H7FFFFFFFFFFFFFFF&&
%EQUATE `MIN_TIME_VALUE = 0&&
'// function definitions
' Returns the version of the currently installed Pdh.dll file.
' Note This function is obsolete and no longer supported.
DECLARE FUNCTION PdhGetDllVersion LIB "pdh.dll" ALIAS "PdhGetDllVersion" ( BYREF lpdwVersion AS QUAD ) AS LONG ' PDH_STATUS
'//
'// Query Functions
'//
' Creates a new query that is used to manage the collection of performance data.
' To use handles to data sources, use the PdhOpenQueryH function.
DECLARE FUNCTION PdhOpenQueryW LIB "pdh.dll" ALIAS "PdhOpenQueryW" ( BYREF szDataSource AS WSTRINGZ , BYVAL dwUserData AS QUAD , BYREF phQuery AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhOpenQueryA LIB "pdh.dll" ALIAS "PdhOpenQueryA" ( BYREF szDataSource AS ASCIIZ , BYVAL dwUserData AS QUAD , BYREF phQuery AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhOpenQuery = PdhOpenQueryW
#ELSE
 MACRO PdhOpenQuery = PdhOpenQueryA
#ENDIF
' Adds the specified counter to the query.
DECLARE FUNCTION PdhAddCounterW LIB "pdh.dll" ALIAS "PdhAddCounterW" ( BYVAL hQuery AS QUAD , BYREF szFullCounterPath AS WSTRINGZ , BYVAL dwUserData AS QUAD , BYREF phCounter AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhAddCounterA LIB "pdh.dll" ALIAS "PdhAddCounterA" ( BYVAL hQuery AS QUAD , BYREF szFullCounterPath AS ASCIIZ , BYVAL dwUserData AS QUAD , BYREF phCounter AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhAddCounter = PdhAddCounterW
#ELSE
 MACRO PdhAddCounter = PdhAddCounterA
#ENDIF
'#if (_WIN32_WINDOWS >= 0x0600 || _WIN32_WINNT >= 0x0600 || (defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_VISTA))
DECLARE FUNCTION PdhAddEnglishCounterW LIB "pdh.dll" ALIAS "PdhAddEnglishCounterW" ( BYVAL hQuery AS QUAD , BYREF szFullCounterPath AS WSTRINGZ , BYVAL dwUserData AS QUAD , BYREF phCounter AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhAddEnglishCounterA LIB "pdh.dll" ALIAS "PdhAddEnglishCounterA" ( BYVAL hQuery AS QUAD , BYREF szFullCounterPath AS ASCIIZ , BYVAL dwUserData AS QUAD , BYREF phCounter AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhAddEnglishCounter = PdhAddEnglishCounterW
#ELSE
 MACRO PdhAddEnglishCounter = PdhAddEnglishCounterA
#ENDIF
DECLARE FUNCTION PdhCollectQueryDataWithTime LIB "pdh.dll" ALIAS "PdhCollectQueryDataWithTime" ( BYVAL hQuery AS QUAD , BYREF pllTimeStamp AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhValidatePathExW LIB "pdh.dll" ALIAS "PdhValidatePathExW" ( BYVAL hDataSource AS QUAD , BYREF szFullPathBuffer AS WSTRINGZ ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhValidatePathExA LIB "pdh.dll" ALIAS "PdhValidatePathExA" ( BYVAL hDataSource AS QUAD , BYREF szFullPathBuffer AS ASCIIZ ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhValidatePathEx = PdhValidatePathExW
#ELSE
 MACRO PdhValidatePathEx = PdhValidatePathExA
#ENDIF
'#endif
' Removes a counter from a query.
DECLARE FUNCTION PdhRemoveCounter LIB "pdh.dll" ALIAS "PdhRemoveCounter" ( BYVAL hCounter AS QUAD ) AS LONG ' PDH_STATUS
' Collects the current raw data value for all counters in the specified query and updates the status code of each counter.
DECLARE FUNCTION PdhCollectQueryData LIB "pdh.dll" ALIAS "PdhCollectQueryData" ( BYVAL hQuery AS QUAD ) AS LONG ' PDH_STATUS
' Closes all counters contained in the specified query, closes all handles related to the query, and frees all memory associated with the query.
DECLARE FUNCTION PdhCloseQuery LIB "pdh.dll" ALIAS "PdhCloseQuery" ( BYVAL hQuery AS QUAD ) AS LONG ' PDH_STATUS
'//
'// Counter Functions
'//
' Computes a displayable value for the specified counter.
DECLARE FUNCTION PdhGetFormattedCounterValue LIB "pdh.dll" ALIAS "PdhGetFormattedCounterValue" ( BYVAL hCounter AS QUAD , BYVAL dwFormat AS QUAD , BYREF lpdwType AS QUAD , BYREF pValue AS PDH_FMT_COUNTERVALUE ) AS LONG ' PDH_STATUS
' Returns an array of formatted counter values. Use this function when you want to format
' the counter values of a counter that contains a wildcard character for the instance name.
DECLARE FUNCTION PdhGetFormattedCounterArrayA LIB "pdh.dll" ALIAS "PdhGetFormattedCounterArrayA" ( BYVAL hCounter AS QUAD , BYVAL dwFormat AS QUAD , BYREF lpdwBufferSize AS QUAD , BYREF lpdwBufferCount AS QUAD , BYREF ItemBuffer AS PDH_FMT_COUNTERVALUE_ITEM_A ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhGetFormattedCounterArrayW LIB "pdh.dll" ALIAS "PdhGetFormattedCounterArrayW" ( BYVAL hCounter AS QUAD , BYVAL dwFormat AS QUAD , BYREF lpdwBufferSize AS QUAD , BYREF lpdwBufferCount AS QUAD , BYREF ItemBuffer AS PDH_FMT_COUNTERVALUE_ITEM_W ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhGetFormattedCounterArray = PdhGetFormattedCounterArrayW
#ELSE
 MACRO PdhGetFormattedCounterArray = PdhGetFormattedCounterArrayA
#ENDIF
'// dwFormat flag values
'//
%EQUATE `PDH_FMT_RAW = &H00000010
%EQUATE `PDH_FMT_ANSI = &H00000020
%EQUATE `PDH_FMT_UNICODE = &H00000040
%EQUATE `PDH_FMT_LONG = &H00000100
%EQUATE `PDH_FMT_DOUBLE = &H00000200
%EQUATE `PDH_FMT_LARGE = &H00000400
%EQUATE `PDH_FMT_NOSCALE = &H00001000
%EQUATE `PDH_FMT_1000 = &H00002000
%EQUATE `PDH_FMT_NODATA = &H00004000
%EQUATE `PDH_FMT_NOCAP100 = &H00008000
%EQUATE `PERF_DETAIL_COSTLY = &H00010000
%EQUATE `PERF_DETAIL_STANDARD = &H0000FFFF
' Returns the current raw value of the counter.
DECLARE FUNCTION PdhGetRawCounterValue LIB "pdh.dll" ALIAS "PdhGetRawCounterValue" ( BYVAL hCounter AS QUAD , BYREF lpdwType AS QUAD , BYREF pValue AS PDH_RAW_COUNTER ) AS LONG ' PDH_STATUS
' Returns an array of raw values from the specified counter. Use this function when you want to
' retrieve the raw counter values of a counter that contains a wildcard character for the instance name.
DECLARE FUNCTION PdhGetRawCounterArrayA LIB "pdh.dll" ALIAS "PdhGetRawCounterArrayA" ( BYVAL hCounter AS QUAD , BYREF lpdwBufferSize AS QUAD , BYREF lpdwItemCount AS QUAD , BYREF ItemBuffer AS PDH_RAW_COUNTER_ITEM_A ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhGetRawCounterArrayW LIB "pdh.dll" ALIAS "PdhGetRawCounterArrayW" ( BYVAL hCounter AS QUAD , BYREF lpdwBufferSize AS QUAD , BYREF lpdwItemCount AS QUAD , BYREF ItemBuffer AS PDH_RAW_COUNTER_ITEM_W ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhGetRawCounterArray = PdhGetRawCounterArrayW
#ELSE
 MACRO PdhGetRawCounterArray = PdhGetRawCounterArrayA
#ENDIF
' Calculates the displayable value of two raw counter values
DECLARE FUNCTION PdhCalculateCounterFromRawValue LIB "pdh.dll" ALIAS "PdhCalculateCounterFromRawValue" ( BYVAL hCounter AS QUAD , BYVAL dwFormat AS QUAD , BYVAL rawValue1 AS QUAD , BYVAL rawValue2 AS QUAD , BYREF fmtValue AS PDH_FMT_COUNTERVALUE ) AS LONG ' PDH_STATUS
' Computes statistics for a counter from an array of raw values.
DECLARE FUNCTION PdhComputeCounterStatistics LIB "pdh.dll" ALIAS "PdhComputeCounterStatistics" ( BYVAL hCounter AS QUAD , BYVAL dwFormat AS QUAD , BYVAL dwFirstEntry AS QUAD , BYVAL dwNumEntries AS QUAD , BYREF lpRawValueArray AS PDH_RAW_COUNTER , BYREF data AS PDH_STATISTICS ) AS LONG ' PDH_STATUS
' Retrieves information about a counter, such as data size, counter type, path, and user-supplied data values.
DECLARE FUNCTION PdhGetCounterInfoW LIB "pdh.dll" ALIAS "PdhGetCounterInfoW" ( BYVAL hCounter AS QUAD , BYVAL bRetrieveExplainText AS BYTE , BYREF pdwBufferSize AS QUAD , BYREF lpBuffer AS PDH_COUNTER_INFO_W ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhGetCounterInfoA LIB "pdh.dll" ALIAS "PdhGetCounterInfoA" ( BYVAL hCounter AS QUAD , BYVAL bRetrieveExplainText AS BYTE , BYREF pdwBufferSize AS QUAD , BYREF lpBuffer AS PDH_COUNTER_INFO_A ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhGetCounterInfo = PdhGetCounterInfoW
#ELSE
 MACRO PdhGetCounterInfo = PdhGetCounterInfoA
#ENDIF
%EQUATE `PDH_MAX_SCALE = 7&
%EQUATE `PDH_MIN_SCALE = -7&
' Sets the scale factor that is applied to the calculated value of the specified counter
' when you request the formatted counter value. If the PDH_FMT_NOSCALE flag is set, then
' this scale factor is ignored.
DECLARE FUNCTION PdhSetCounterScaleFactor LIB "pdh.dll" ALIAS "PdhSetCounterScaleFactor" ( BYVAL hCounter AS QUAD , BYVAL lFactor AS LONG ) AS LONG ' PDH_STATUS
'//
'// Browsing and enumeration functions
'//
' Connects to the specified computer.
DECLARE FUNCTION PdhConnectMachineW LIB "pdh.dll" ALIAS "PdhConnectMachineW" ( BYREF szMachineName AS WSTRINGZ ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhConnectMachineA LIB "pdh.dll" ALIAS "PdhConnectMachineA" ( BYREF szMachineName AS ASCIIZ ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhConnectMachine = PdhConnectMachineW
#ELSE
 MACRO PdhConnectMachine = PdhConnectMachineA
#ENDIF
' Returns a list of the computer names associated with counters in a log file. The computer
' names were either specified when adding counters to the query or when calling the
' PdhConnectMachine function. The computers listed include those that are currently
' connected and online, in addition to those that are offline or not returning performance data.
' To use handles to data sources, use the PdhEnumMachinesH function.
DECLARE FUNCTION PdhEnumMachinesW LIB "pdh.dll" ALIAS "PdhEnumMachinesW" ( BYREF szDataSource AS WSTRINGZ , BYREF mszMachineNameList AS WSTRINGZ , BYREF pcchBufferLength AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhEnumMachinesA LIB "pdh.dll" ALIAS "PdhEnumMachinesA" ( BYREF szDataSource AS ASCIIZ , BYVAL mszMachineNameList AS QUAD , BYREF pcchBufferLength AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhEnumMachines = PdhEnumMachinesW
#ELSE
 MACRO PdhEnumMachines = PdhEnumMachinesA
#ENDIF
' Returns a list of objects available on the specified computer or in the specified log file.
' To use handles to data sources, use the PdhEnumObjectsH function.
DECLARE FUNCTION PdhEnumObjectsW LIB "pdh.dll" ALIAS "PdhEnumObjectsW" ( BYREF szDataSource AS WSTRINGZ , BYREF szMachineName AS WSTRINGZ , BYREF mszObjectList AS WSTRINGZ , BYREF pcchBufferLength AS QUAD , BYVAL dwDetailLevel AS QUAD , BYVAL bRefresh AS LONG ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhEnumObjectsA LIB "pdh.dll" ALIAS "PdhEnumObjectsA" ( BYREF szDataSource AS ASCIIZ , BYREF szMachineName AS ASCIIZ , BYVAL mszObjectList AS QUAD , BYREF pcchBufferLength AS QUAD , BYVAL dwDetailLevel AS QUAD , BYVAL bRefresh AS LONG ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhEnumObjects = PdhEnumObjectsW
#ELSE
 MACRO PdhEnumObjects = PdhEnumObjectsA
#ENDIF
' Returns the specified object's counter and instance names that exist on the
' specified computer or in the specified log file.
' To use handles to data sources, use the PdhEnumObjectItemsH function.
DECLARE FUNCTION PdhEnumObjectItemsW LIB "pdh.dll" ALIAS "PdhEnumObjectItemsW" ( BYREF szDataSource AS WSTRINGZ , BYREF szMachineName AS WSTRINGZ , BYREF szObjectName AS WSTRINGZ , BYREF mszCounterList AS WSTRINGZ , BYREF pcchCounterListLength AS QUAD , BYREF mszInstanceList AS WSTRINGZ , BYREF pcchInstanceListLength AS QUAD , BYVAL dwDetailLevel AS QUAD , BYVAL dwFlags AS LONG ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhEnumObjectItemsA LIB "pdh.dll" ALIAS "PdhEnumObjectItemsA" ( BYREF szDataSource AS ASCIIZ , BYREF szMachineName AS ASCIIZ , BYREF szObjectName AS ASCIIZ , BYVAL mszCounterList AS QUAD , BYREF pcchCounterListLength AS QUAD , BYVAL mszInstanceList AS QUAD , BYREF pcchInstanceListLength AS QUAD , BYVAL dwDetailLevel AS QUAD , BYVAL dwFlags AS LONG ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhEnumObjectItems = PdhEnumObjectItemsW
#ELSE
 MACRO PdhEnumObjectItems = PdhEnumObjectItemsA
#ENDIF
%EQUATE `PDH_OBJECT_HAS_INSTANCES = &H00000001
' Creates a full counter path using the members specified in the PDH_COUNTER_PATH_ELEMENTS structure.
DECLARE FUNCTION PdhMakeCounterPathW LIB "pdh.dll" ALIAS "PdhMakeCounterPathW" ( BYREF pCounterPathElements AS PDH_COUNTER_PATH_ELEMENTS_W , BYREF szFullPathBuffer AS WSTRINGZ , BYREF pcchBufferSize AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhMakeCounterPathA LIB "pdh.dll" ALIAS "PdhMakeCounterPathA" ( BYREF pCounterPathElements AS PDH_COUNTER_PATH_ELEMENTS_A , BYREF szFullPathBuffer AS ASCIIZ , BYREF pcchBufferSize AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhMakeCounterPath = PdhMakeCounterPathW
#ELSE
 MACRO PdhMakeCounterPath = PdhMakeCounterPathA
#ENDIF
' Parses the elements of the counter path and stores the results in the PDH_COUNTER_PATH_ELEMENTS structure.
DECLARE FUNCTION PdhParseCounterPathW LIB "pdh.dll" ALIAS "PdhParseCounterPathW" ( BYREF szFullPathBuffer AS WSTRINGZ , BYREF pCounterPathElements AS PDH_COUNTER_PATH_ELEMENTS_W , BYREF pdwBufferSize AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhParseCounterPathA LIB "pdh.dll" ALIAS "PdhParseCounterPathA" ( BYREF szFullPathBuffer AS ASCIIZ , BYREF pCounterPathElements AS PDH_COUNTER_PATH_ELEMENTS_A , BYREF pdwBufferSize AS QUAD , BYVAL dwFlags AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhParseCounterPath = PdhParseCounterPathW
#ELSE
 MACRO PdhParseCounterPath = PdhParseCounterPathA
#ENDIF
%EQUATE `PDH_PATH_WBEM_RESULT = &H00000001
%EQUATE `PDH_PATH_WBEM_INPUT = &H00000002
'#define PDH_PATH_LANG_FLAGS(LangId, Flags) ((DWORD)(((LangId & 0x0000FFFF) << 16) | (Flags & 0x0000FFFF)))
MACRO PDH_PATH_LANG_FLAGS(LangId, Flags) = LO(DWORD,((LangId AND &H0000FFFF) * 65536) OR (Flags AND &H0000FFFF))
' Parses the elements of an instance string.
DECLARE FUNCTION PdhParseInstanceNameW LIB "pdh.dll" ALIAS "PdhParseInstanceNameW" ( BYREF szInstanceString AS WSTRINGZ , BYREF szInstanceName AS WSTRINGZ , BYREF pcchInstanceNameLength AS QUAD , BYREF szParentName AS WSTRINGZ , BYREF pcchParentNameLength AS QUAD , BYREF lpIndex AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhParseInstanceNameA LIB "pdh.dll" ALIAS "PdhParseInstanceNameA" ( BYREF szInstanceString AS ASCIIZ , BYREF szInstanceName AS ASCIIZ , BYREF pcchInstanceNameLength AS QUAD , BYREF szParentName AS ASCIIZ , BYREF pcchParentNameLength AS QUAD , BYREF lpIndex AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhParseInstanceName = PdhParseInstanceNameW
#ELSE
 MACRO PdhParseInstanceName = PdhParseInstanceNameA
#ENDIF
' Validates that the counter is present on the computer specified in the counter path.
DECLARE FUNCTION PdhValidatePathW LIB "pdh.dll" ALIAS "PdhValidatePathW" ( BYREF szFullPathBuffer AS WSTRINGZ ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhValidatePathA LIB "pdh.dll" ALIAS "PdhValidatePathA" ( BYREF szFullPathBuffer AS ASCIIZ ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhValidatePath = PdhValidatePathW
#ELSE
 MACRO PdhValidatePath = PdhValidatePathA
#ENDIF
' Retrieves the name of the default object. This name can be used to set
' the initial object selection in the Browse Counter dialog box.
' To use handles to data sources, use the PdhGetDefaultPerfObjectH function.
DECLARE FUNCTION PdhGetDefaultPerfObjectW LIB "pdh.dll" ALIAS "PdhGetDefaultPerfObjectW" ( BYREF szDataSource AS WSTRINGZ , BYREF szMachineName AS WSTRINGZ , BYREF szDefaultObjectName AS WSTRINGZ , BYREF pcchBufferSize AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhGetDefaultPerfObjectA LIB "pdh.dll" ALIAS "PdhGetDefaultPerfObjectA" ( BYREF szDataSource AS ASCIIZ , BYREF szMachineName AS ASCIIZ , BYREF szDefaultObjectName AS ASCIIZ , BYREF pcchBufferSize AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhGetDefaultPerfObject = PdhGetDefaultPerfObjectW
#ELSE
 MACRO PdhGetDefaultPerfObject = PdhGetDefaultPerfObjectA
#ENDIF
' Retrieves the name of the default counter for the specified object. This name can be
' used to set the initial counter selection in the Browse Counter dialog box.
' This function is identical to PdhGetDefaultPerfCounter, except that it supports the use of handles to data sources.
DECLARE FUNCTION PdhGetDefaultPerfCounterW LIB "pdh.dll" ALIAS "PdhGetDefaultPerfCounterW" ( BYREF szDataSource AS WSTRINGZ , BYREF szMachineName AS WSTRINGZ , BYREF szObjectName AS WSTRINGZ , BYREF szDefaultCounterName AS WSTRINGZ , BYREF pcchBufferSize AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhGetDefaultPerfCounterA LIB "pdh.dll" ALIAS "PdhGetDefaultPerfCounterA" ( BYREF szDataSource AS ASCIIZ , BYREF szMachineName AS ASCIIZ , BYREF szObjectName AS ASCIIZ , BYREF szDefaultCounterName AS ASCIIZ , BYREF pcchBufferSize AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhGetDefaultPerfCounter = PdhGetDefaultPerfCounterW
#ELSE
 MACRO PdhGetDefaultPerfCounter = PdhGetDefaultPerfCounterA
#ENDIF
'typedef PDH_STATUS (__stdcall * CounterPathCallBack)(DWORD_PTR);
'FUNCTION CounterPathCallBack (BYVAL dwArg AS DWORD) AS LONG
'END FUNCTION
' // Size = 40 bytes
TYPE PDH_BROWSE_DLG_CONFIG_HW DWORD
 bIncludeInstanceIndex AS BIT * 1 IN DWORD
 bSingleCounterPerAdd AS BIT * 1
 bSingleCounterPerDialog AS BIT * 1
 bLocalCountersOnly AS BIT * 1
 bWildCardInstances AS BIT * 1
 bHideDetailBox AS BIT * 1
 bInitializePath AS BIT * 1
 bDisableMachineSelection AS BIT * 1
 bIncludeCostlyObjects AS BIT * 1
 bShowObjectBrowser AS BIT * 1
 bReserved AS BIT * 22
 hWndOwner AS DWORD
 hDataSource AS DWORD ' PDH_HLOG
 szReturnPathBuffer AS WSTRINGZ PTR
 cchReturnPathLength AS DWORD
 pCallBack AS DWORD ' CounterPathCallBack
 dwCallBackArg AS DWORD ' DWORD_PTR
 CallBackStatus AS LONG ' PDH_STATUS
 dwDefaultDetailLevel AS DWORD
 szDialogBoxCaption AS WSTRINGZ PTR
END TYPE
' // Size = 40 bytes
TYPE PDH_BROWSE_DLG_CONFIG_HA DWORD
 bIncludeInstanceIndex AS BIT * 1 IN DWORD
 bSingleCounterPerAdd AS BIT * 1
 bSingleCounterPerDialog AS BIT * 1
 bLocalCountersOnly AS BIT * 1
 bWildCardInstances AS BIT * 1
 bHideDetailBox AS BIT * 1
 bInitializePath AS BIT * 1
 bDisableMachineSelection AS BIT * 1
 bIncludeCostlyObjects AS BIT * 1
 bShowObjectBrowser AS BIT * 1
 bReserved AS BIT * 22
 hWndOwner AS DWORD
 hDataSource AS DWORD ' PDH_HLOG
 szReturnPathBuffer AS ASCIIZ PTR
 cchReturnPathLength AS DWORD
 pCallBack AS DWORD ' CounterPathCallBack
 dwCallBackArg AS DWORD ' DWORD_PTR
 CallBackStatus AS LONG ' PDH_STATUS
 dwDefaultDetailLevel AS DWORD
 szDialogBoxCaption AS ASCIIZ PTR
END TYPE
MACRO PDH_BROWSE_DLG_CONFIG_H = PDH_BROWSE_DLG_CONFIG_HA
' // Size = 40 bytes
TYPE PDH_BROWSE_DLG_CONFIG_W DWORD
 bIncludeInstanceIndex AS BIT * 1 IN DWORD
 bSingleCounterPerAdd AS BIT * 1
 bSingleCounterPerDialog AS BIT * 1
 bLocalCountersOnly AS BIT * 1
 bWildCardInstances AS BIT * 1
 bHideDetailBox AS BIT * 1
 bInitializePath AS BIT * 1
 bDisableMachineSelection AS BIT * 1
 bIncludeCostlyObjects AS BIT * 1
 bShowObjectBrowser AS BIT * 1
 bReserved AS BIT * 22
 hWndOwner AS DWORD
 szDataSource AS WSTRINGZ PTR
 szReturnPathBuffer AS WSTRINGZ PTR
 cchReturnPathLength AS DWORD
 pCallBack AS DWORD ' CounterPathCallBack
 dwCallBackArg AS DWORD ' DWORD_PTR
 CallBackStatus AS LONG ' PDH_STATUS
 dwDefaultDetailLevel AS DWORD
 szDialogBoxCaption AS WSTRINGZ PTR
END TYPE
' // Size = 40 bytes
TYPE PDH_BROWSE_DLG_CONFIG_A DWORD
 bIncludeInstanceIndex AS BIT * 1 IN DWORD
 bSingleCounterPerAdd AS BIT * 1
 bSingleCounterPerDialog AS BIT * 1
 bLocalCountersOnly AS BIT * 1
 bWildCardInstances AS BIT * 1
 bHideDetailBox AS BIT * 1
 bInitializePath AS BIT * 1
 bDisableMachineSelection AS BIT * 1
 bIncludeCostlyObjects AS BIT * 1
 bShowObjectBrowser AS BIT * 1
 bReserved AS BIT * 22
 hWndOwner AS DWORD
 szDataSource AS ASCIIZ PTR
 szReturnPathBuffer AS ASCIIZ PTR
 cchReturnPathLength AS DWORD
 pCallBack AS DWORD ' CounterPathCallBack
 dwCallBackArg AS DWORD ' DWORD_PTR
 CallBackStatus AS LONG ' PDH_STATUS
 dwDefaultDetailLevel AS DWORD
 szDialogBoxCaption AS ASCIIZ PTR
END TYPE
MACRO PDH_BROWSE_DLG_CONFIG = PDH_BROWSE_DLG_CONFIG_A
' Displays a Browse Counters dialog box that the user can use to select one
' or more counters that they want to add to the query.
' To use handles to data sources, use the PdhBrowseCountersH function.
DECLARE FUNCTION PdhBrowseCountersW LIB "pdh.dll" ALIAS "PdhBrowseCountersW" ( BYREF pBrowseDlgData AS PDH_BROWSE_DLG_CONFIG_W ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhBrowseCountersA LIB "pdh.dll" ALIAS "PdhBrowseCountersA" ( BYREF pBrowseDlgData AS PDH_BROWSE_DLG_CONFIG_A ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhBrowseCounters = PdhBrowseCountersW
#ELSE
 MACRO PdhBrowseCounters = PdhBrowseCountersA
#ENDIF
' Examines the specified computer (or local computer if none is specified) for
' counters and instances of counters that match the wildcard strings in the counter path.
' Note This function is superseded by the PdhExpandWildCardPath function.
DECLARE FUNCTION PdhExpandCounterPathW LIB "pdh.dll" ALIAS "PdhExpandCounterPathW" (_
 BYREF szWildCardPath AS WSTRINGZ
 , BYREF mszExpandedPathList AS WSTRINGZ
 , BYREF pcchPathListLength AS DWORD
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhExpandCounterPathA LIB "pdh.dll" ALIAS "PdhExpandCounterPathA" (_
 BYREF szWildCardPath AS ASCIIZ
 , BYREF mszExpandedPathList AS ASCIIZ
 , BYREF pcchPathListLength AS DWORD
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhExpandCounterPath = PdhExpandCounterPathW
#ELSE
 MACRO PdhExpandCounterPath = PdhExpandCounterPathA
#ENDIF
'//
'// v2.0 functions
'//
' Returns the performance object name or counter name corresponding to the specified index.
DECLARE FUNCTION PdhLookupPerfNameByIndexW LIB "pdh.dll" ALIAS "PdhLookupPerfNameByIndexW" (_
 BYREF szMachineName AS WSTRINGZ
 , BYVAL dwNameIndex AS DWORD
 , BYREF szNameBuffer AS WSTRINGZ
 , BYREF pcchNameBufferSize AS DWORD
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhLookupPerfNameByIndexA LIB "pdh.dll" ALIAS "PdhLookupPerfNameByIndexA" (_
 BYREF szMachineName AS ASCIIZ
 , BYVAL dwNameIndex AS DWORD
 , BYREF szNameBuffer AS ASCIIZ
 , BYREF pcchNameBufferSize AS DWORD
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhLookupPerfNameByIndex = PdhLookupPerfNameByIndexW
#ELSE
 MACRO PdhLookupPerfNameByIndex = PdhLookupPerfNameByIndexA
#ENDIF
' Returns the counter index corresponding to the specified counter name.
DECLARE FUNCTION PdhLookupPerfIndexByNameW LIB "pdh.dll" ALIAS "PdhLookupPerfIndexByNameW" (_
 BYREF szMachineName AS WSTRINGZ
 , BYREF szNameBuffer AS WSTRINGZ
 , BYREF pdwIndex AS DWORD
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhLookupPerfIndexByNameA LIB "pdh.dll" ALIAS "PdhLookupPerfIndexByNameA" (_
 BYREF szMachineName AS ASCIIZ
 , BYREF szNameBuffer AS ASCIIZ
 , BYREF pdwIndex AS DWORD
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhLookupPerfIndexByName = PdhLookupPerfIndexByNameW
#ELSE
 MACRO PdhLookupPerfIndexByName = PdhLookupPerfIndexByNameA
#ENDIF
%EQUATE `PDH_NOEXPANDCOUNTERS = 1
%EQUATE `PDH_NOEXPANDINSTANCES = 2
'#if (_WIN32_WINDOWS >= 0x0502 || _WIN32_WINNT >= 0x0502 || (defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WIN2003))
%EQUATE `PDH_REFRESHCOUNTERS = 4
'#endif
' Examines the specified computer or log file and returns those counter paths
' that match the given counter path which contains wildcard characters.
' To use handles to data sources, use the PdhExpandWildCardPathH function.
DECLARE FUNCTION PdhExpandWildCardPathA LIB "pdh.dll" ALIAS "PdhExpandWildCardPathA" (_
 BYREF szDataSource AS ASCIIZ
 , BYREF szWildCardPath AS ASCIIZ
 , BYREF mszExpandedPathList AS ASCIIZ
 , BYREF pcchPathListLength AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhExpandWildCardPathW LIB "pdh.dll" ALIAS "PdhExpandWildCardPathW" (_
 BYREF szDataSource AS WSTRINGZ
 , BYREF szWildCardPath AS WSTRINGZ
 , BYREF mszExpandedPathList AS WSTRINGZ
 , BYREF pcchPathListLength AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhExpandWildCardPath = PdhExpandWildCardPathW
#ELSE
 MACRO PdhExpandWildCardPath = PdhExpandWildCardPathA
#ENDIF
'//
'// Logging Functions
'//
%EQUATE `PDH_LOG_READ_ACCESS = &H00010000
%EQUATE `PDH_LOG_WRITE_ACCESS = &H00020000
%EQUATE `PDH_LOG_UPDATE_ACCESS = &H00040000
%EQUATE `PDH_LOG_ACCESS_MASK = &H000F0000
%EQUATE `PDH_LOG_CREATE_NEW = &H00000001
%EQUATE `PDH_LOG_CREATE_ALWAYS = &H00000002
%EQUATE `PDH_LOG_OPEN_ALWAYS = &H00000003
%EQUATE `PDH_LOG_OPEN_EXISTING = &H00000004
%EQUATE `PDH_LOG_CREATE_MASK = &H0000000F
%EQUATE `PDH_LOG_OPT_USER_STRING = &H01000000
%EQUATE `PDH_LOG_OPT_CIRCULAR = &H02000000
%EQUATE `PDH_LOG_OPT_MAX_IS_BYTES = &H04000000
'#if (_WIN32_WINDOWS >= 0x0501 || _WIN32_WINNT >= 0x0501 || (defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WINXP))
%EQUATE `PDH_LOG_OPT_APPEND = &H08000000
'#endif
%EQUATE `PDH_LOG_OPT_MASK = &H0F000000
%EQUATE `PDH_LOG_TYPE_UNDEFINED = 0
%EQUATE `PDH_LOG_TYPE_CSV = 1
%EQUATE `PDH_LOG_TYPE_TSV = 2
%EQUATE `PDH_LOG_TYPE_TRACE_KERNEL = 4
%EQUATE `PDH_LOG_TYPE_TRACE_GENERIC = 5
%EQUATE `PDH_LOG_TYPE_PERFMON = 6
'%PDH_LOG_TYPE_BINARY = 3 ' // this is the retired binary format
%EQUATE `PDH_LOG_TYPE_SQL = 7
%EQUATE `PDH_LOG_TYPE_BINARY = 8
' Opens the specified log file for reading or writing.
DECLARE FUNCTION PdhOpenLogW LIB "pdh.dll" ALIAS "PdhOpenLogW" (_
 BYREF szLogFileName AS WSTRINGZ
 , BYVAL dwAccessFlags AS DWORD
 , BYREF lpdwLogType AS DWORD
 , BYVAL hQuery AS DWORD
 , BYVAL dwMaxSize AS DWORD
 , BYREF szUserCaption AS WSTRINGZ
 , BYREF phLog AS DWORD
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhOpenLogA LIB "pdh.dll" ALIAS "PdhOpenLogA" (_
 BYREF szLogFileName AS ASCIIZ
 , BYVAL dwAccessFlags AS DWORD
 , BYREF lpdwLogType AS DWORD
 , BYVAL hQuery AS DWORD
 , BYVAL dwMaxSize AS DWORD
 , BYREF szUserCaption AS ASCIIZ
 , BYREF phLog AS DWORD
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhOpenLog = PdhOpenLogW
#ELSE
 MACRO PdhOpenLog = PdhOpenLogA
#ENDIF
' Collects counter data for the current query and writes the data to the log file.
DECLARE FUNCTION PdhUpdateLogW LIB "pdh.dll" ALIAS "PdhUpdateLogW" (_
 BYVAL hLog AS DWORD
 , BYREF szUserString AS WSTRINGZ
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhUpdateLogA LIB "pdh.dll" ALIAS "PdhUpdateLogA" (_
 BYVAL hLog AS DWORD
 , BYREF szUserString AS ASCIIZ
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhUpdateLog = PdhUpdateLogW
#ELSE
 MACRO PdhUpdateLog = PdhUpdateLogA
#ENDIF
' Synchronizes the information in the log file catalog with the performance data in the log file.
' Note This function is obsolete.
DECLARE FUNCTION PdhUpdateLogFileCatalog LIB "pdh.dll" ALIAS "PdhUpdateLogFileCatalog" (_
 BYVAL hLog AS DWORD
 ) AS LONG ' PDH_STATUS
' Returns the size of the specified log file.
DECLARE FUNCTION PdhGetLogFileSize LIB "pdh.dll" ALIAS "PdhGetLogFileSize" (_
 BYVAL hLog AS DWORD
 , BYREF llSize AS QUAD
 ) AS LONG ' PDH_STATUS
' Closes the specified log file.
DECLARE FUNCTION PdhCloseLog LIB "pdh.dll" ALIAS "PdhCloseLog" (_
 BYVAL hLog AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG ' PDH_STATUS
%EQUATE `PDH_FLAGS_CLOSE_QUERY = &H00000001
'//
'// Data source selection dialog
'//
%EQUATE `PDH_FLAGS_FILE_BROWSER_ONLY = &H00000001
' Displays a dialog window that prompts the user to specify the source of the performance data.
DECLARE FUNCTION PdhSelectDataSourceW LIB "pdh.dll" ALIAS "PdhSelectDataSourceW" (_
 BYVAL hWndOwner AS DWORD
 , BYVAL dwFlags AS DWORD
 , BYREF szDataSource AS WSTRINGZ
 , BYREF pcchBufferLength As DWORD
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhSelectDataSourceA LIB "pdh.dll" ALIAS "PdhSelectDataSourceA" (_
 BYVAL hWndOwner AS DWORD
 , BYVAL dwFlags AS DWORD
 , BYREF szDataSource AS ASCIIZ
 , BYREF pcchBufferLength AS DWORD
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhSelectDataSource = PdhSelectDataSourceW
#ELSE
 MACRO PdhSelectDataSource = PdhSelectDataSourceA
#ENDIF
' Determines if the specified query is a real-time query.
DECLARE FUNCTION PdhIsRealTimeQuery LIB "pdh.dll" ALIAS "PdhIsRealTimeQuery" (_
 BYVAL hQuery AS DWORD
 ) AS LONG
' Limits the samples that you can read from a log file to those within the specified time range, inclusively.
DECLARE FUNCTION PdhSetQueryTimeRange LIB "pdh.dll" ALIAS "PdhSetQueryTimeRange" (_
 BYVAL hQuery AS DWORD
 , BYREF pInfo AS PDH_TIME_INFO
 ) AS LONG ' PDH_STATUS
' Determines the time range, number of entries and, if applicable, the size
' of the buffer containing the performance data from the specified input source.
' To use handles to data sources, use the PdhGetDataSourceTimeRangeH function.
DECLARE FUNCTION PdhGetDataSourceTimeRangeW LIB "pdh.dll" ALIAS "PdhGetDataSourceTimeRangeW" (_
 BYREF szDataSource AS WSTRINGZ
 , BYREF pdwNumEntries AS DWORD
 , BYREF pInfo AS PDH_TIME_INFO
 , BYVAL pdwBufferSize AS DWORD
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhGetDataSourceTimeRangeA LIB "pdh.dll" ALIAS "PdhGetDataSourceTimeRangeA" (_
 BYREF szDataSource AS ASCIIZ
 , BYREF pdwNumEntries AS DWORD
 , BYREF pInfo AS PDH_TIME_INFO
 , BYVAL pdwBufferSize As DWORD
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhGetDataSourceTimeRange = PdhGetDataSourceTimeRangeW
#ELSE
 MACRO PdhGetDataSourceTimeRange = PdhGetDataSourceTimeRangeA
#ENDIF
' Uses a separate thread to collect the current raw data value for all counters in the specified query.
' The function then signals the application-defined event and waits the specified time interval before returning.
DECLARE FUNCTION PdhCollectQueryDataEx LIB "pdh.dll" ALIAS "PdhCollectQueryDataEx" (_
 BYVAL hQuery AS DWORD
 , BYVAL dwIntervalTime AS DWORD
 , BYVAL hNewDataEvent AS DWORD
 ) AS LONG ' PDH_STATUS
' Computes a displayable value for the given raw counter values.
DECLARE FUNCTION PdhFormatFromRawValue LIB "pdh.dll" ALIAS "PdhFormatFromRawValue" (_
 BYVAL dwCounterType AS DWORD
 , BYVAL dwFormat AS DWORD
 , BYVAL pTimeBase AS QUAD
 , BYREF pRawValue1 AS PDH_RAW_COUNTER
 , BYREF pRawValue2 AS PDH_RAW_COUNTER
 , BYREF pFmtValue AS PDH_FMT_COUNTERVALUE
 ) AS LONG ' PDH_STATUS
' Returns the time base of the specified counter.
DECLARE FUNCTION PdhGetCounterTimeBase LIB "pdh.dll" ALIAS "PdhGetCounterTimeBase" (_
 BYVAL hCounter AS DWORD
 , BYREF pTimeBase AS QUAD
 ) AS LONG ' PDH_STATUS
' Reads the information in the specified binary trace log file.
DECLARE FUNCTION PdhReadRawLogRecord LIB "pdh.dll" ALIAS "PdhReadRawLogRecord" (_
 BYVAL hLog AS DWORD
 , BYVAL ftRecord AS FILETIME
 , BYREF pRawLogRecord AS PDH_RAW_LOG_RECORD
 , BYREF pdwBufferLength AS DWORD
 ) AS LONG ' PDH_STATUS
%EQUATE `DATA_SOURCE_REGISTRY = &H00000001
%EQUATE `DATA_SOURCE_LOGFILE = &H00000002
%EQUATE `DATA_SOURCE_WBEM = &H00000004
' Specifies the source of the real-time data.
DECLARE FUNCTION PdhSetDefaultRealTimeDataSource LIB "pdh.dll" ALIAS "PdhSetDefaultRealTimeDataSource" (_
 BYVAL dwDataSourceId AS DWORD
 ) AS LONG ' PDH_STATUS
'#if (_WIN32_WINDOWS >= 0x0501 || _WIN32_WINNT >= 0x0501 || (defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WINXP))
'// Extended API for WMI event trace logfile format
'//
' Binds one or more binary log files together for reading log data.
DECLARE FUNCTION PdhBindInputDataSourceW LIB "pdh.dll" ALIAS "PdhBindInputDataSourceW" (_
 BYREF phDataSource AS DWORD
 , BYREF LogFileNameList AS WSTRINGZ
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhBindInputDataSourceA LIB "pdh.dll" ALIAS "PdhBindInputDataSourceA" (_
 BYREF phDataSource AS DWORD
 , BYREF LogFileNameList AS ASCIIZ
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhBindInputDataSource = PdhBindInputDataSourceW
#ELSE
 MACRO PdhBindInputDataSource = PdhBindInputDataSourceA
#ENDIF
' Creates a new query that is used to manage the collection of performance data.
' This function is identical to the PdhOpenQuery function, except that it supports
' the use of handles to data sources.
DECLARE FUNCTION PdhOpenQueryH LIB "pdh.dll" ALIAS "PdhOpenQueryH" (_
 BYVAL hDataSource AS DWORD
 , BYVAL dwUserData AS DWORD
 , BYREF phQuery AS DWORD
 ) AS LONG ' PDH_STATUS
' Returns a list of the computer names associated with counters in a log file.
' The computer names were either specified when adding counters to the query or when
' calling the PdhConnectMachine function. The computers listed include those that
' are currently connected and online, in addition to those that are offline or
' not returning performance data.
' This function is identical to the PdhEnumMachines function, except that it supports
' the use of handles to data sources.
DECLARE FUNCTION PdhEnumMachinesHW LIB "pdh.dll" ALIAS "PdhEnumMachinesHW" (_
 BYVAL hDataSource AS DWORD
 , BYREF mszMachineList AS WSTRINGZ
 , BYREF pcchBufferSize AS DWORD
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhEnumMachinesHA LIB "pdh.dll" ALIAS "PdhEnumMachinesHA" (_
 BYVAL hDataSource AS DWORD
 , BYREF mszMachineList AS ASCIIZ
 , BYREF pcchBufferSize AS DWORD
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhEnumMachinesH = PdhEnumMachinesHW
#ELSE
 MACRO PdhEnumMachinesH = PdhEnumMachinesHA
#ENDIF
' Returns a list of objects available on the specified computer or in the specified log file.
' This function is identical to PdhEnumObjects, except that it supports the use of handles to data sources.
DECLARE FUNCTION PdhEnumObjectsHW LIB "pdh.dll" ALIAS "PdhEnumObjectsHW" (_
 BYVAL hDataSource AS DWORD
 , BYREF szMachineName AS WSTRINGZ
 , BYREF mszObjectList AS WSTRINGZ
 , BYREF pcchBufferSize AS DWORD
 , BYVAL dwDetailLevel AS DWORD
 , BYVAL bRefresh AS LONG
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhEnumObjectsHA LIB "pdh.dll" ALIAS "PdhEnumObjectsHA" (_
 BYVAL hDataSource AS DWORD
 , BYREF szMachineName AS ASCIIZ
 , BYREF mszObjectList AS ASCIIZ
 , BYREF pcchBufferSize AS DWORD
 , BYVAL dwDetailLevel AS DWORD
 , BYVAL bRefresh AS LONG
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhEnumObjectsH = PdhEnumObjectsHW
#ELSE
 MACRO PdhEnumObjectsH = PdhEnumObjectsHA
#ENDIF
' Returns the specified object's counter and instance names that exist on the
' specified computer or in the specified log file.
' This function is identical to the PdhEnumObjectItems function, except that
' it supports the use of handles to data sources.
DECLARE FUNCTION PdhEnumObjectItemsHW LIB "pdh.dll" ALIAS "PdhEnumObjectItemsHW" ( BYVAL hDataSource AS QUAD , BYREF szMachineName AS WSTRINGZ , BYREF szObjectName AS WSTRINGZ , BYREF mszCounterList AS WSTRINGZ , BYREF pcchCounterListLength AS QUAD , BYREF mszInstanceList AS WSTRINGZ , BYREF pcchInstanceListLength AS QUAD , BYVAL dwDetailLevel AS QUAD , BYVAL dwFlags AS LONG ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhEnumObjectItemsHA LIB "pdh.dll" ALIAS "PdhEnumObjectItemsHA" ( BYVAL hDataSource AS QUAD , BYREF szMachineName AS ASCIIZ , BYREF szObjectName AS ASCIIZ , BYVAL mszCounterList AS QUAD , BYREF pcchCounterListLength AS QUAD , BYVAL mszInstanceList AS QUAD , BYREF pcchInstanceListLength AS QUAD , BYVAL dwDetailLevel AS QUAD , BYVAL dwFlags AS LONG ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhEnumObjectItemsH = PdhEnumObjectItemsHW
#ELSE
 MACRO PdhEnumObjectItemsH = PdhEnumObjectItemsHA
#ENDIF
' Examines the specified computer or log file and returns those counter paths that
' match the given counter path which contains wildcard characters.
' This function is identical to the PdhExpandWildCardPath function, except that
' it supports the use of handles to data sources.
DECLARE FUNCTION PdhExpandWildCardPathHW LIB "pdh.dll" ALIAS "PdhExpandWildCardPathHW" (_
 BYVAL hDataSource AS DWORD
 , BYREF szWildCardPath AS WSTRINGZ
 , BYREF mszExpandedPathList AS WSTRINGZ
 , BYREF pcchPathListLength AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhExpandWildCardPathHA LIB "pdh.dll" ALIAS "PdhExpandWildCardPathHA" (_
 BYREF hDataSource AS DWORD
 , BYREF szWildCardPath AS ASCIIZ
 , BYREF mszExpandedPathList AS ASCIIZ
 , BYREF pcchPathListLength AS DWORD
 , BYVAL dwFlags AS DWORD
 ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhExpandWildCardPathH = PdhExpandWildCardPathHW
#ELSE
 MACRO PdhExpandWildCardPathH = PdhExpandWildCardPathHA
#ENDIF
' Determines the time range, number of entries and, if applicable, the size of the
' buffer containing the performance data from the specified input source.
' This function is identical to the PdhGetDataSourceTimeRange function, except that
' it supports the use of handles to data sources.
DECLARE FUNCTION PdhGetDataSourceTimeRangeH LIB "pdh.dll" ALIAS "PdhGetDataSourceTimeRangeH" (_
 BYREF hDataSource AS DWORD
 , BYREF pdwNumEntries AS DWORD
 , BYREF pInfo AS PDH_TIME_INFO
 , BYVAL pdwBufferSize AS DWORD
 ) AS LONG ' PDH_STATUS
' Retrieves the name of the default object. This name can be used to set the initial
' object selection in the Browse Counter dialog box.
' To use handles to data sources, use the PdhGetDefaultPerfObjectH function.
DECLARE FUNCTION PdhGetDefaultPerfObjectHW LIB "pdh.dll" ALIAS "PdhGetDefaultPerfObjectHW" ( BYVAL hDataSource AS QUAD , BYREF szMachineName AS WSTRINGZ , BYREF szDefaultObjectName AS WSTRINGZ , BYREF pcchBufferSize AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhGetDefaultPerfObjectHA LIB "pdh.dll" ALIAS "PdhGetDefaultPerfObjectHA" ( BYREF hDataSource AS QUAD , BYREF szMachineName AS ASCIIZ , BYREF szDefaultObjectName AS ASCIIZ , BYREF pcchBufferSize AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhGetDefaultPerfObjectH = PdhGetDefaultPerfObjectHW
#ELSE
 MACRO PdhGetDefaultPerfObjectH = PdhGetDefaultPerfObjectHA
#ENDIF
' Retrieves the name of the default counter for the specified object. This name
' can be used to set the initial counter selection in the Browse Counter dialog box.
' To use handles to data sources, use the PdhGetDefaultPerfCounterH function.
DECLARE FUNCTION PdhGetDefaultPerfCounterHW LIB "pdh.dll" ALIAS "PdhGetDefaultPerfCounterHW" ( BYVAL hDataSource AS QUAD , BYREF szMachineName AS WSTRINGZ , BYREF szObjectName AS WSTRINGZ , BYREF szDefaultCounterName AS WSTRINGZ , BYREF pcchBufferSize AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhGetDefaultPerfCounterHA LIB "pdh.dll" ALIAS "PdhGetDefaultPerfCounterHA" ( BYREF hDataSource AS QUAD , BYREF szMachineName AS ASCIIZ , BYREF szObjectName AS ASCIIZ , BYREF szDefaultCounterName AS ASCIIZ , BYREF pcchBufferSize AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhGetDefaultPerfCounterH = PdhGetDefaultPerfCounterHW
#ELSE
 MACRO PdhGetDefaultPerfCounterH = PdhGetDefaultPerfCounterHA
#ENDIF
' Displays a Browse Counters dialog box that the user can use to select one
' or more counters that they want to add to the query.
' This function is identical to the PdhBrowseCounters function, except that it supports the use of handles to data sources.
DECLARE FUNCTION PdhBrowseCountersHW LIB "pdh.dll" ALIAS "PdhBrowseCountersHW" ( BYREF pBrowseDlgData AS PDH_BROWSE_DLG_CONFIG_HW ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhBrowseCountersHA LIB "pdh.dll" ALIAS "PdhBrowseCountersHA" ( BYREF pBrowseDlgData AS PDH_BROWSE_DLG_CONFIG_HA ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhBrowseCountersH = PdhBrowseCountersHW
#ELSE
 MACRO PdhBrowseCountersH = PdhBrowseCountersHA
#ENDIF
'//Check that a DSN points to a database that contains the correct Perfmon tables.
DECLARE FUNCTION PdhVerifySQLDBW LIB "pdh.dll" ALIAS "PdhVerifySQLDBW" ( BYREF szDataSource AS WSTRINGZ ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhVerifySQLDBA LIB "pdh.dll" ALIAS "PdhVerifySQLDBA" ( BYREF szDataSource AS ASCIIZ ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhVerifySQLDB = PdhVerifySQLDBW
#ELSE
 MACRO PdhVerifySQLDB = PdhVerifySQLDBA
#ENDIF
'//Create the correct perfmon tables in the database pointed to by a DSN.
DECLARE FUNCTION PdhCreateSQLTablesW LIB "pdh.dll" ALIAS "PdhCreateSQLTablesW" ( BYREF szDataSource AS WSTRINGZ ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhCreateSQLTablesA LIB "pdh.dll" ALIAS "PdhCreateSQLTablesA" ( BYREF szDataSource AS ASCIIZ ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhCreateSQLTables = PdhCreateSQLTablesW
#ELSE
 MACRO PdhCreateSQLTables = PdhCreateSQLTablesA
#ENDIF
'//Return the list of Log set names in the database pointed to by the DSN.
DECLARE FUNCTION PdhEnumLogSetNamesW LIB "pdh.dll" ALIAS "PdhEnumLogSetNamesW" ( BYREF szDataSource AS WSTRINGZ , BYREF mszDataSetNameList AS WSTRINGZ , BYREF pcchBufferLength AS QUAD ) AS LONG ' PDH_STATUS
DECLARE FUNCTION PdhEnumLogSetNamesA LIB "pdh.dll" ALIAS "PdhEnumLogSetNamesA" ( BYREF szDataSource AS ASCIIZ , BYREF mszDataSetNameList AS ASCIIZ , BYREF pcchBufferLength AS QUAD ) AS LONG ' PDH_STATUS
#IF %DEF(%UNICODE)
 MACRO PdhEnumLogSetNames = PdhEnumLogSetNamesW
#ELSE
 MACRO PdhEnumLogSetNames = PdhEnumLogSetNamesA
#ENDIF
'//Retrieve the GUID for an open Log Set
DECLARE FUNCTION PdhGetLogSetGUID LIB "pdh.dll" ALIAS "PdhGetLogSetGUID" ( BYVAL hLog AS QUAD , BYREF pGuid AS GUID , BYVAL pRunId AS LONG ) AS LONG ' PDH_STATUS
'//Set the RunID for an open Log Set
DECLARE FUNCTION PdhSetLogSetRunID LIB "pdh.dll" ALIAS "PdhSetLogSetRunID" ( BYVAL hLog AS QUAD , BYVAL RunId AS LONG ) AS LONG ' PDH_STATUS
'#endif
#ENDIF
