ifndef _WINPERF_
define _WINPERF_
.pragma list(push, 0)
ifndef __LIBC_INC
 include libc.inc
endif

PERF_DATA_VERSION	equ 1
PERF_DATA_REVISION	equ 1

PERF_DATA_BLOCK		STRUC
Signature		dw 4 dup(?)
LittleEndian		dd ?
Version			dd ?
Revision		dd ?
TotalByteLength		dd ?
HeaderLength		dd ?
NumObjectTypes		dd ?
DefaultObject		LONG ?
SystemTime		SYSTEMTIME <>
PerfTime		LARGE_INTEGER <>
PerfFreq		LARGE_INTEGER <>
PerfTime100nSec		LARGE_INTEGER <>
SystemNameLength	dd ?
SystemNameOffset	dd ?
PERF_DATA_BLOCK		ENDS
PPERF_DATA_BLOCK	typedef ptr PERF_DATA_BLOCK

PERF_OBJECT_TYPE	STRUC
TotalByteLength		dd ?
DefinitionLength	dd ?
HeaderLength		dd ?
ObjectNameTitleIndex	dd ?
ObjectNameTitle		LPWSTR ?
ObjectHelpTitleIndex	dd ?
ObjectHelpTitle		LPWSTR ?
DetailLevel		dd ?
NumCounters		dd ?
DefaultCounter		LONG ?
NumInstances		LONG ?
PerfTime		LARGE_INTEGER <>
PerfFreq		LARGE_INTEGER <>
PERF_OBJECT_TYPE	ENDS
PPERF_OBJECT_TYPE	typedef ptr PERF_OBJECT_TYPE

PERF_NO_INSTANCES	equ -1
PERF_SIZE_DWORD		equ 0x00000000
PERF_SIZE_LARGE		equ 0x00000100
PERF_SIZE_ZERO		equ 0x00000200
PERF_SIZE_VARIABLE_LEN	equ 0x00000300
PERF_TYPE_NUMBER	equ 0x00000000
PERF_TYPE_COUNTER	equ 0x00000400
PERF_TYPE_TEXT		equ 0x00000800
PERF_TYPE_ZERO		equ 0x00000C00
PERF_NUMBER_HEX		equ 0x00000000
PERF_NUMBER_DECIMAL	equ 0x00010000
PERF_NUMBER_DEC_1000	equ 0x00020000
PERF_COUNTER_VALUE	equ 0x00000000
PERF_COUNTER_RATE	equ 0x00010000
PERF_COUNTER_FRACTION	equ 0x00020000
PERF_COUNTER_BASE	equ 0x00030000
PERF_COUNTER_ELAPSED	equ 0x00040000
PERF_COUNTER_QUEUELEN	equ 0x00050000
PERF_COUNTER_HISTOGRAM	equ 0x00060000
PERF_TEXT_UNICODE	equ 0x00000000
PERF_TEXT_ASCII		equ 0x00010000
PERF_TIMER_TICK		equ 0x00000000
PERF_TIMER_100NS	equ 0x00100000
PERF_OBJECT_TIMER	equ 0x00200000
PERF_DELTA_COUNTER	equ 0x00400000
PERF_DELTA_BASE		equ 0x00800000
PERF_INVERSE_COUNTER	equ 0x01000000
PERF_MULTI_COUNTER	equ 0x02000000
PERF_DISPLAY_NO_SUFFIX	equ 0x00000000
PERF_DISPLAY_PER_SEC	equ 0x10000000
PERF_DISPLAY_PERCENT	equ 0x20000000
PERF_DISPLAY_SECONDS	equ 0x30000000
PERF_DISPLAY_NOSHOW	equ 0x40000000

PERF_COUNTER_COUNTER	equ (PERF_SIZE_DWORD OR PERF_TYPE_COUNTER OR PERF_COUNTER_RATE OR PERF_TIMER_TICK OR PERF_DELTA_COUNTER OR PERF_DISPLAY_PER_SEC)
PERF_COUNTER_TIMER	equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_RATE OR PERF_TIMER_TICK OR PERF_DELTA_COUNTER OR PERF_DISPLAY_PERCENT)
PERF_COUNTER_QUEUELEN_TYPE equ (PERF_SIZE_DWORD OR PERF_TYPE_COUNTER OR PERF_COUNTER_QUEUELEN OR PERF_TIMER_TICK OR PERF_DELTA_COUNTER OR PERF_DISPLAY_NO_SUFFIX)
PERF_COUNTER_LARGE_QUEUELEN_TYPE equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_QUEUELEN OR PERF_TIMER_TICK OR PERF_DELTA_COUNTER OR PERF_DISPLAY_NO_SUFFIX)
PERF_COUNTER_BULK_COUNT equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_RATE OR PERF_TIMER_TICK OR PERF_DELTA_COUNTER OR PERF_DISPLAY_PER_SEC)
PERF_COUNTER_TEXT	equ (PERF_SIZE_VARIABLE_LEN OR PERF_TYPE_TEXT OR PERF_TEXT_UNICODE OR PERF_DISPLAY_NO_SUFFIX)
PERF_COUNTER_RAWCOUNT	equ (PERF_SIZE_DWORD OR PERF_TYPE_NUMBER OR PERF_NUMBER_DECIMAL OR PERF_DISPLAY_NO_SUFFIX)
PERF_COUNTER_LARGE_RAWCOUNT equ (PERF_SIZE_LARGE OR PERF_TYPE_NUMBER OR PERF_NUMBER_DECIMAL OR PERF_DISPLAY_NO_SUFFIX)
PERF_COUNTER_RAWCOUNT_HEX equ (PERF_SIZE_DWORD OR PERF_TYPE_NUMBER OR PERF_NUMBER_HEX OR PERF_DISPLAY_NO_SUFFIX)
PERF_COUNTER_LARGE_RAWCOUNT_HEX equ (PERF_SIZE_LARGE OR PERF_TYPE_NUMBER OR PERF_NUMBER_HEX OR PERF_DISPLAY_NO_SUFFIX)

PERF_SAMPLE_FRACTION	equ (PERF_SIZE_DWORD OR PERF_TYPE_COUNTER OR PERF_COUNTER_FRACTION OR PERF_DELTA_COUNTER OR PERF_DELTA_BASE OR PERF_DISPLAY_PERCENT)
PERF_SAMPLE_COUNTER	equ (PERF_SIZE_DWORD OR PERF_TYPE_COUNTER OR PERF_COUNTER_RATE OR PERF_TIMER_TICK OR PERF_DELTA_COUNTER OR PERF_DISPLAY_NO_SUFFIX)
PERF_COUNTER_NODATA	equ (PERF_SIZE_ZERO OR PERF_DISPLAY_NOSHOW)
PERF_COUNTER_TIMER_INV	equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_RATE OR PERF_TIMER_TICK OR PERF_DELTA_COUNTER OR PERF_INVERSE_COUNTER OR PERF_DISPLAY_PERCENT)
PERF_SAMPLE_BASE	equ (PERF_SIZE_DWORD OR PERF_TYPE_COUNTER OR PERF_COUNTER_BASE OR PERF_DISPLAY_NOSHOW OR 0x00000001)
PERF_AVERAGE_TIMER	equ (PERF_SIZE_DWORD OR PERF_TYPE_COUNTER OR PERF_COUNTER_FRACTION OR PERF_DISPLAY_SECONDS)
PERF_AVERAGE_BASE	equ (PERF_SIZE_DWORD OR PERF_TYPE_COUNTER OR PERF_COUNTER_BASE OR PERF_DISPLAY_NOSHOW OR 0x00000002)

PERF_AVERAGE_BULK	equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_FRACTION OR PERF_DISPLAY_NOSHOW)
PERF_100NSEC_TIMER	equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_RATE OR PERF_TIMER_100NS OR PERF_DELTA_COUNTER OR PERF_DISPLAY_PERCENT)
PERF_100NSEC_TIMER_INV	equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_RATE OR PERF_TIMER_100NS OR PERF_DELTA_COUNTER OR PERF_INVERSE_COUNTER OR PERF_DISPLAY_PERCENT)
PERF_COUNTER_MULTI_TIMER equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_RATE OR PERF_DELTA_COUNTER OR PERF_TIMER_TICK OR PERF_MULTI_COUNTER OR PERF_DISPLAY_PERCENT)
PERF_COUNTER_MULTI_TIMER_INV equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_RATE OR PERF_DELTA_COUNTER OR PERF_MULTI_COUNTER OR PERF_TIMER_TICK OR PERF_INVERSE_COUNTER OR PERF_DISPLAY_PERCENT)
PERF_COUNTER_MULTI_BASE equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_BASE OR PERF_MULTI_COUNTER OR PERF_DISPLAY_NOSHOW)
PERF_100NSEC_MULTI_TIMER equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_DELTA_COUNTER OR PERF_COUNTER_RATE OR PERF_TIMER_100NS OR PERF_MULTI_COUNTER OR PERF_DISPLAY_PERCENT)
PERF_100NSEC_MULTI_TIMER_INV equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_DELTA_COUNTER OR PERF_COUNTER_RATE OR PERF_TIMER_100NS OR PERF_MULTI_COUNTER OR PERF_INVERSE_COUNTER OR PERF_DISPLAY_PERCENT)
PERF_RAW_FRACTION	equ (PERF_SIZE_DWORD OR PERF_TYPE_COUNTER OR PERF_COUNTER_FRACTION OR PERF_DISPLAY_PERCENT)
PERF_RAW_BASE		equ (PERF_SIZE_DWORD OR PERF_TYPE_COUNTER OR PERF_COUNTER_BASE OR PERF_DISPLAY_NOSHOW OR 0x00000003)
PERF_ELAPSED_TIME	equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_ELAPSED OR PERF_OBJECT_TIMER OR PERF_DISPLAY_SECONDS)
PERF_COUNTER_HISTOGRAM_TYPE equ 0x80000000
PERF_COUNTER_DELTA	equ (PERF_SIZE_DWORD OR PERF_TYPE_COUNTER OR PERF_COUNTER_VALUE OR PERF_DELTA_COUNTER OR PERF_DISPLAY_NO_SUFFIX)
PERF_COUNTER_LARGE_DELTA equ (PERF_SIZE_LARGE OR PERF_TYPE_COUNTER OR PERF_COUNTER_VALUE OR PERF_DELTA_COUNTER OR PERF_DISPLAY_NO_SUFFIX)

PERF_DETAIL_NOVICE	equ 100
PERF_DETAIL_ADVANCED	equ 200
PERF_DETAIL_EXPERT	equ 300
PERF_DETAIL_WIZARD	equ 400

PERF_COUNTER_DEFINITION	 STRUC
ByteLength		dd ?
CounterNameTitleIndex	dd ?
CounterNameTitle	LPWSTR ?
CounterHelpTitleIndex	dd ?
CounterHelpTitle	LPWSTR ?
DefaultScale		LONG ?
DetailLevel		dd ?
CounterType		dd ?
CounterSize		dd ?
CounterOffset		dd ?
PERF_COUNTER_DEFINITION ENDS
PPERF_COUNTER_DEFINITION typedef ptr PERF_COUNTER_DEFINITION

PERF_NO_UNIQUE_ID	equ -1

PERF_INSTANCE_DEFINITION  STRUC
ByteLength		dd ?
ParentObjectTitleIndex	dd ?
ParentObjectInstance	dd ?
UniqueID		LONG ?
NameOffset		dd ?
NameLength		dd ?
PERF_INSTANCE_DEFINITION ENDS
PPERF_INSTANCE_DEFINITION typedef ptr PERF_INSTANCE_DEFINITION

PERF_COUNTER_BLOCK	STRUC
ByteLength		dd ?
PERF_COUNTER_BLOCK	ENDS
PPERF_COUNTER_BLOCK	typedef ptr PERF_COUNTER_BLOCK

PERF_QUERY_OBJECTS	equ 0x80000000
PERF_QUERY_GLOBAL	equ 0x80000001
PERF_QUERY_COSTLY	equ 0x80000002

CALLBACK(PM_OPEN_PROC, :LPWSTR)
CALLBACK(PM_COLLECT_PROC, :LPWSTR, :LPVOID, :LPDWORD, :LPDWORD)
CALLBACK(PM_CLOSE_PROC)
CALLBACK(PM_QUERY_PROC, :LPDWORD, :LPVOID, :LPDWORD, :LPDWORD)

MAX_PERF_OBJECTS_IN_QUERY_FUNCTION equ (8)

.pragma list(pop)
endif
