ifndef _WMISTR_
define _WMISTR_

WNODE_HEADER		STRUC
BufferSize		ULONG ?
ProviderId		ULONG ?
UNION
 HistoricalContext	ULONG64 ?
 STRUC
  Version		ULONG ?
  Linkage		ULONG ?
 ENDS
ENDS
UNION
 CountLost		ULONG ?
 KernelHandle		HANDLE ?
 TimeStamp		LARGE_INTEGER <>
ENDS
Guid			GUID <>
ClientContext		ULONG ?
Flags			ULONG ?
WNODE_HEADER		ENDS
PWNODE_HEADER		typedef ptr WNODE_HEADER

WNODE_FLAG_ALL_DATA	equ 0x00000001
WNODE_FLAG_SINGLE_INSTANCE equ 0x00000002
WNODE_FLAG_SINGLE_ITEM	equ 0x00000004
WNODE_FLAG_EVENT_ITEM	equ 0x00000008
WNODE_FLAG_FIXED_INSTANCE_SIZE equ 0x00000010
WNODE_FLAG_TOO_SMALL	equ 0x00000020
WNODE_FLAG_INSTANCES_SAME equ 0x00000040
WNODE_FLAG_STATIC_INSTANCE_NAMES equ 0x00000080
WNODE_FLAG_INTERNAL	equ 0x00000100
WNODE_FLAG_USE_TIMESTAMP equ 0x00000200
if (NTDDI_VERSION GE NTDDI_WINXP)
WNODE_FLAG_PERSIST_EVENT equ 0x00000400
endif
WNODE_FLAG_EVENT_REFERENCE equ 0x00002000
WNODE_FLAG_ANSI_INSTANCENAMES equ 0x00004000
WNODE_FLAG_METHOD_ITEM	equ 0x00008000
WNODE_FLAG_PDO_INSTANCE_NAMES equ 0x00010000
WNODE_FLAG_TRACED_GUID	equ 0x00020000
WNODE_FLAG_LOG_WNODE	equ 0x00040000
WNODE_FLAG_USE_GUID_PTR equ 0x00080000
WNODE_FLAG_USE_MOF_PTR	equ 0x00100000
if (NTDDI_VERSION GE NTDDI_WINXP)
WNODE_FLAG_NO_HEADER	equ 0x00200000
endif
if (NTDDI_VERSION GE NTDDI_VISTA)
WNODE_FLAG_SEND_DATA_BLOCK equ 0x00400000
endif
WNODE_FLAG_SEVERITY_MASK equ 0xff000000

OFFSETINSTANCEDATAANDLENGTH STRUC
OffsetInstanceData	ULONG ?
LengthInstanceData	ULONG ?
OFFSETINSTANCEDATAANDLENGTH ENDS
POFFSETINSTANCEDATAANDLENGTH typedef ptr OFFSETINSTANCEDATAANDLENGTH

WNODE_ALL_DATA		STRUC
WnodeHeader		WNODE_HEADER <>
DataBlockOffset		ULONG ?
InstanceCount		ULONG ?
OffsetInstanceNameOffsets ULONG ?
UNION
 FixedInstanceSize	 ULONG ?
 OffsetInstanceDataAndLength OFFSETINSTANCEDATAANDLENGTH 1 dup(<>)
ENDS
WNODE_ALL_DATA		ENDS
PWNODE_ALL_DATA		typedef ptr WNODE_ALL_DATA

WNODE_SINGLE_INSTANCE	STRUC
WnodeHeader		WNODE_HEADER <>
OffsetInstanceName	ULONG ?
InstanceIndex		ULONG ?
DataBlockOffset		ULONG ?
SizeDataBlock		ULONG ?
VariableData		UCHAR 1 dup(?)
WNODE_SINGLE_INSTANCE	ENDS
PWNODE_SINGLE_INSTANCE	typedef ptr WNODE_SINGLE_INSTANCE


WNODE_SINGLE_ITEM	STRUC
WnodeHeader		WNODE_HEADER <>
OffsetInstanceName	ULONG ?
InstanceIndex		ULONG ?
ItemId			ULONG ?
DataBlockOffset		ULONG ?
SizeDataItem		ULONG ?
VariableData		UCHAR 1 dup(?)
WNODE_SINGLE_ITEM	ENDS
PWNODE_SINGLE_ITEM	typedef ptr WNODE_SINGLE_ITEM

WNODE_METHOD_ITEM	STRUC
WnodeHeader		WNODE_HEADER <>
OffsetInstanceName	ULONG ?
InstanceIndex		ULONG ?
MethodId		ULONG ?
DataBlockOffset		ULONG ?
SizeDataBlock		ULONG ?
VariableData		UCHAR 1 dup(?)
WNODE_METHOD_ITEM	ENDS
PWNODE_METHOD_ITEM	typedef ptr WNODE_METHOD_ITEM

WNODE_EVENT_ITEM	STRUC
WnodeHeader		WNODE_HEADER <>
WNODE_EVENT_ITEM	ENDS
PWNODE_EVENT_ITEM	typedef ptr WNODE_EVENT_ITEM

WNODE_EVENT_REFERENCE	STRUC
WnodeHeader		WNODE_HEADER <>
TargetGuid		GUID <>
TargetDataBlockSize	ULONG ?
UNION
 TargetInstanceIndex	ULONG ?
 TargetInstanceName	WCHAR 1 dup(?)
ENDS
WNODE_EVENT_REFERENCE	ENDS
PWNODE_EVENT_REFERENCE	typedef ptr WNODE_EVENT_REFERENCE


WNODE_TOO_SMALL		STRUC
WnodeHeader		WNODE_HEADER <>
SizeNeeded		ULONG ?
WNODE_TOO_SMALL		ENDS
PWNODE_TOO_SMALL	typedef ptr WNODE_TOO_SMALL

WMIREGGUIDW		STRUC
Guid			GUID <>
Flags			ULONG ?
InstanceCount		ULONG ?
UNION
 InstanceNameList	ULONG ?
 BaseNameOffset		ULONG ?
 Pdo			ULONG_PTR ?
 InstanceInfo		ULONG_PTR ?
ENDS
WMIREGGUIDW		ENDS
PWMIREGGUIDW		typedef ptr WMIREGGUIDW

WMIREGGUID		typedef WMIREGGUIDW
PWMIREGGUID		typedef PWMIREGGUIDW

WMIREG_FLAG_EXPENSIVE	equ 0x00000001
WMIREG_FLAG_INSTANCE_LIST equ 0x00000004
WMIREG_FLAG_INSTANCE_BASENAME equ 0x00000008
WMIREG_FLAG_INSTANCE_PDO equ 0x00000020
WMIREG_FLAG_REMOVE_GUID equ 0x00010000
WMIREG_FLAG_RESERVED1	equ 0x00020000
WMIREG_FLAG_RESERVED2	equ 0x00040000
WMIREG_FLAG_TRACED_GUID equ 0x00080000
WMIREG_FLAG_TRACE_CONTROL_GUID equ 0x00001000
WMIREG_FLAG_EVENT_ONLY_GUID equ 0x00000040

WMIREGINFOW		STRUC
BufferSize		ULONG ?
NextWmiRegInfo		ULONG ?
RegistryPath		ULONG ?
MofResourceName		ULONG ?
GuidCount		ULONG ?
WmiRegGuid		WMIREGGUIDW 1 dup(<>)
WMIREGINFOW		ENDS
PWMIREGINFOW		typedef ptr WMIREGINFOW

WMIREGINFO		typedef WMIREGINFOW
PWMIREGINFO		typedef PWMIREGINFOW

.enum WMIDPREQUESTCODE {
ifndef _WMIKM_
    WMI_GET_ALL_DATA = 0,
    WMI_GET_SINGLE_INSTANCE = 1,
    WMI_SET_SINGLE_INSTANCE = 2,
    WMI_SET_SINGLE_ITEM = 3,
    WMI_ENABLE_EVENTS = 4,
    WMI_DISABLE_EVENTS	= 5,
    WMI_ENABLE_COLLECTION = 6,
    WMI_DISABLE_COLLECTION = 7,
    WMI_REGINFO = 8,
    WMI_EXECUTE_METHOD = 9,
    WMI_CAPTURE_STATE = 10
endif
    }

if defined(_WINNT_) OR defined(WINNT)

;;#ifndef _WMIKM_
WMI_GUIDTYPE_TRACECONTROL equ 0
WMI_GUIDTYPE_TRACE	equ 1
WMI_GUIDTYPE_DATA	equ 2
WMI_GUIDTYPE_EVENT	equ 3
;;#endif

WMIGUID_QUERY		equ 0x0001
WMIGUID_SET		equ 0x0002
WMIGUID_NOTIFICATION	equ 0x0004
WMIGUID_READ_DESCRIPTION equ 0x0008
WMIGUID_EXECUTE		equ 0x0010
TRACELOG_CREATE_REALTIME equ 0x0020
TRACELOG_CREATE_ONDISK	equ 0x0040
TRACELOG_GUID_ENABLE	equ 0x0080
TRACELOG_ACCESS_KERNEL_LOGGER equ 0x0100
TRACELOG_LOG_EVENT	equ 0x0200 ;; used on Vista and greater
TRACELOG_CREATE_INPROC	equ 0x0200 ;; used pre-Vista
TRACELOG_ACCESS_REALTIME equ 0x0400
TRACELOG_REGISTER_GUIDS equ 0x0800

WMIGUID_ALL_ACCESS_WIN2K equ (STANDARD_RIGHTS_READ OR \
			WMIGUID_QUERY OR \
			WMIGUID_SET OR \
			WMIGUID_NOTIFICATION OR \
			WMIGUID_READ_DESCRIPTION OR \
			WMIGUID_EXECUTE OR \
			TRACELOG_CREATE_REALTIME OR \
			TRACELOG_CREATE_ONDISK OR \
			TRACELOG_GUID_ENABLE OR \
			TRACELOG_ACCESS_KERNEL_LOGGER OR \
			TRACELOG_CREATE_INPROC OR \
			TRACELOG_ACCESS_REALTIME)

WMIGUID_ALL_ACCESS_WINXP equ (WMIGUID_ALL_ACCESS_WIN2K OR SYNCHRONIZE OR TRACELOG_REGISTER_GUIDS)

if (NTDDI_VERSION GE NTDDI_WINXP)
WMIGUID_ALL_ACCESS	equ WMIGUID_ALL_ACCESS_WINXP
else
WMIGUID_ALL_ACCESS	equ WMIGUID_ALL_ACCESS_WIN2K
endif
WMI_GLOBAL_LOGGER_ID	equ 0x0001
endif
endif
