' ########################################################################################
' Microsoft Windows
' File: WMIUtils.inc
' 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.
' ########################################################################################
' ========================================================================================
' The interfaces included in this file require Windows XP.
' Windows 2000/NT: Requires the WMI SDK Update or the Microsoft .NET Framework SDK.
' Windows NT: Requires the Microsoft .NET Framework SDK.
' ========================================================================================
#IF NOT %DEF(PBX_WMIUtils_PBI)
#DEFINE PBX_WMIUtils_PBI
%EQUATE `WMIUTILS_INC = 1
$CLSID_WbemDefPath = GUID$("{CF4CC405-E2C5-4DDD-B3CE-5E7582D8C9FA}")
$CLSID_WbemQuery = GUID$("{EAC8A024-21E2-4523-AD73-A71A0AA2F56A}")
' ========================================================================================
' WBEM_PATH_STATUS_FLAG enum
' ========================================================================================
%EQUATE `WBEMPATH_INFO_ANON_LOCAL_MACHINE = &H1
%EQUATE `WBEMPATH_INFO_HAS_MACHINE_NAME = &H2
%EQUATE `WBEMPATH_INFO_IS_CLASS_REF = &H4
%EQUATE `WBEMPATH_INFO_IS_INST_REF = &H8
%EQUATE `WBEMPATH_INFO_HAS_SUBSCOPES = &H10
%EQUATE `WBEMPATH_INFO_IS_COMPOUND = &H20
%EQUATE `WBEMPATH_INFO_HAS_V2_REF_PATHS = &H40
%EQUATE `WBEMPATH_INFO_HAS_IMPLIED_KEY = &H80
%EQUATE `WBEMPATH_INFO_CONTAINS_SINGLETON = &H100
%EQUATE `WBEMPATH_INFO_V1_COMPLIANT = &H200
%EQUATE `WBEMPATH_INFO_V2_COMPLIANT = &H400
%EQUATE `WBEMPATH_INFO_CIM_COMPLIANT = &H800
%EQUATE `WBEMPATH_INFO_IS_SINGLETON = &H1000
%EQUATE `WBEMPATH_INFO_IS_PARENT = &H2000
%EQUATE `WBEMPATH_INFO_SERVER_NAMESPACE_ONLY = &H4000
%EQUATE `WBEMPATH_INFO_NATIVE_PATH = &H8000
%EQUATE `WBEMPATH_INFO_WMI_PATH = &H10000
%EQUATE `WBEMPATH_INFO_PATH_HAD_SERVER = &H20000
' ========================================================================================
' WBEM_PATH_CREATE_FLAG enum
' ========================================================================================
%EQUATE `WBEMPATH_CREATE_ACCEPT_RELATIVE = &H1
%EQUATE `WBEMPATH_CREATE_ACCEPT_ABSOLUTE = &H2
%EQUATE `WBEMPATH_CREATE_ACCEPT_ALL = &H4
%EQUATE `WBEMPATH_TREAT_SINGLE_IDENT_AS_NS = &H8
' ========================================================================================
' WBEM_GET_TEXT_FLAGS enum
' ========================================================================================
%EQUATE `WBEMPATH_COMPRESSED = &H1
%EQUATE `WBEMPATH_GET_RELATIVE_ONLY = &H2
%EQUATE `WBEMPATH_GET_SERVER_TOO = &H4
%EQUATE `WBEMPATH_GET_SERVER_AND_NAMESPACE_ONLY = &H8
%EQUATE `WBEMPATH_GET_NAMESPACE_ONLY = &H10
%EQUATE `WBEMPATH_GET_ORIGINAL = &H20
' ========================================================================================
' WBEM_GET_KEY_FLAGS enum
' ========================================================================================
%EQUATE `WBEMPATH_TEXT = &H1
%EQUATE `WBEMPATH_QUOTEDTEXT = &H2
' ========================================================================================
' IWbemPathKeyList interface
' The IWbemPathKeyList interface is used to access the details of the path key(s).
' ========================================================================================
$IID_IWbemPathKeyList = GUID$("{9AE62877-7544-4bb0-AA26-A13824659ED6}")
INTERFACE IWbemPathKeyList $IID_IWbemPathKeyList
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetCount ( ' VTable offset = 12
 BYREF puKeyCount AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetKey ( ' VTable offset = 16
 BYREF wszName AS WSTRINGZ
 , BYVAL uFlags AS DWORD
 , BYVAL uCimType AS DWORD
 , BYVAL pKeyVal AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetKey2 ( ' VTable offset = 20
 BYREF wszName AS WSTRINGZ
 , BYVAL uFlags AS DWORD
 , BYVAL uCimType AS DWORD
 , BYREF pKeyVal AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD GetKey ( ' VTable offset = 24
 BYVAL uKeyIx AS DWORD
 , BYVAL uFlags AS DWORD
 , BYREF puNameBufSize AS DWORD
 , BYREF pszKeyName AS WSTRINGZ
 , BYREF puKeyValBufSize AS DWORD
 , BYVAL pKeyVal AS DWORD
 , BYREF puApparentCimType AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetKey2 ( ' VTable offset = 28
 BYVAL uKeyIx AS DWORD
 , BYVAL uFlags AS DWORD
 , BYREF puNameBufSize AS DWORD
 , BYREF pszKeyName AS WSTRINGZ
 , BYREF pKeyValue AS VARIANT
 , BYREF puApparentCimType AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveKey ( ' VTable offset = 32
 BYREF wszName AS WSTRINGZ
 , BYVAL uFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveAllKeys ( ' VTable offset = 36
 BYVAL uFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD MakeSingleton ( ' VTable offset = 40
 BYVAL bSet AS BYTE
 ) AS LONG
 ' =====================================================================================
 METHOD GetInfo ( ' VTable offset = 44
 BYVAL uRequestedInfo AS DWORD
 , BYREF puResponse AS QUAD
 ) AS LONG
 ' =====================================================================================
 METHOD GetText ( ' VTable offset = 48
 BYVAL lFlags AS LONG
 , BYREF puBuffLength AS DWORD
 , BYREF pszText AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
END INTERFACE
' ========================================================================================
' ========================================================================================
' IWbemPath interface
' The IWbemPath interface is the primary interface for the object path parser and makes
' parsing a path available to programs in a standard way. This interface is the main
' interface for setting and retrieving path information.
' ========================================================================================
$IID_IWbemPath = GUID$("{3BC15AF2-736C-477E-9E51-238AF8667DCC}")
INTERFACE IWbemPath $IID_IWbemPath
 INHERIT IUnknown
 ' =====================================================================================
 METHOD SetText ( ' VTable offset = 12
 BYVAL puKeyCount AS DWORD
 , BYREF pszPath AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD GetText ( ' VTable offset = 16
 BYVAL lFlags AS LONG
 , BYREF puBuffLength AS DWORD
 , BYREF pszText AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD GetInfo ( ' VTable offset = 20
 BYVAL uRequestedInfo AS DWORD
 , BYREF puResponse AS QUAD
 ) AS LONG
 ' =====================================================================================
 METHOD SetServer ( ' VTable offset = 24
 BYREF Name AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD GetServer ( ' VTable offset = 28
 BYREF puNameBufLength AS DWORD
 , BYREF pName AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD GetNamespaceCount ( ' VTable offset = 32
 BYREF puCount AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetNamespaceAt ( ' VTable offset = 36
 BYVAL uIndex AS DWORD
 , BYREF pszName AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD GetNamespaceAt ( ' VTable offset = 40
 BYVAL uIndex AS DWORD
 , BYREF puNameBufLength AS DWORD
 , BYREF pName AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveNamespaceAt ( ' VTable offset = 44
 BYVAL uIndex AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveAllNamespaces ( ' VTable offset = 48
 ) AS LONG
 ' =====================================================================================
 METHOD GetScopeCount ( ' VTable offset = 52
 BYREF puCount AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetScope ( ' VTable offset = 56
 BYVAL uIndex AS DWORD
 , BYREF pszClass AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD SetScopeFromText ( ' VTable offset = 60
 BYVAL uIndex AS DWORD
 , BYREF pszText AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD GetScope ( ' VTable offset = 64
 BYVAL uIndex AS DWORD
 , BYREF puClassNameBufSize AS DWORD
 , BYREF pszClass AS WSTRINGZ
 , BYREF pKeyList AS IWbemPathKeyList
 ) AS LONG
 ' =====================================================================================
 METHOD GetScopeAsText ( ' VTable offset = 68
 BYVAL uIndex AS DWORD
 , BYREF puTextBufSize AS DWORD
 , BYREF pszText AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveScope ( ' VTable offset = 72
 BYVAL uIndex AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveAllScopes ( ' VTable offset = 76
 ) AS LONG
 ' =====================================================================================
 METHOD SetClassName ( ' VTable offset = 80
 BYREF Name AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD GetClassName ( ' VTable offset = 84
 BYREF puBuffLength AS DWORD
 , BYREF pszName AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD GetKeyList ( ' VTable offset = 88
 BYREF pOut AS IWbemPathKeyList
 ) AS LONG
 ' =====================================================================================
 METHOD CreateClassPart ( ' VTable offset = 92
 BYVAL lFlags AS LONG
 , BYREF Name AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD DeleteClassPart ( ' VTable offset = 96
 BYVAL lFlags AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD IsRelative ( ' VTable offset = 100
 BYREF wszMachine AS WSTRINGZ
 , BYREF wszNamespace AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD IsRelativeOrChild ( ' VTable offset = 104
 BYREF wszMachine AS WSTRINGZ
 , BYREF wszNamespace AS WSTRINGZ
 , BYVAL lFlags AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD IsLocal ( ' VTable offset = 108
 BYREF wszMachine AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
 METHOD IsSameClassName ( ' VTable offset = 112
 BYREF wszClass AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
END INTERFACE
' ========================================================================================
' IWbemQuery interface
' The IWbemQuery interface provides an entry point through which a WMI Query Language
' (WQL) query can be parsed. This interface was added in Windows XP.
' ========================================================================================
$IID_IWbemQuery = GUID$("{81166F58-DD98-11D3-A120-00105A1F515A}")
INTERFACE IWbemQuery $IID_IWbemQuery
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Empty ( ' VTable offset = 12
 ) AS LONG
 ' =====================================================================================
 METHOD SetLanguageFeatures ( ' VTable offset = 16
 BYVAL uFlags AS DWORD
 , BYVAL uArraySize AS DWORD
 , BYVAL puFeatures AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD TestLanguageFeatures ( ' VTable offset = 20
 BYVAL uFlags AS DWORD
 , BYREF uArraySize AS DWORD
 , BYREF puFeatures AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Parse ( ' VTable offset = 24
 BYREF pszLang AS WSTRINGZ
 , BYREF pszQuery AS WSTRINGZ
 , BYVAL uFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetAnalysis ( ' VTable offset = 28
 BYVAL uAnalysisType AS DWORD
 , BYVAL uFlags AS DWORD
 , BYREF pAnalysis AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD FreeMemory ( ' VTable offset = 32
 BYVAL pMem AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetQueryInfo ( ' VTable offset = 36
 BYVAL uAnalysisType AS DWORD
 , BYVAL uInfoId AS DWORD
 , BYVAL uBufSize AS DWORD
 , BYVAL pDestBuf AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
' ========================================================================================
' WMIQ_ANALYSIS_TYPE enum
' ========================================================================================
%EQUATE `WMIQ_ANALYSIS_RPN_SEQUENCE = &H1
%EQUATE `WMIQ_ANALYSIS_ASSOC_QUERY = &H2
%EQUATE `WMIQ_ANALYSIS_PROP_ANALYSIS_MATRIX = &H3
%EQUATE `WMIQ_ANALYSIS_QUERY_TEXT = &H4
%EQUATE `WMIQ_ANALYSIS_RESERVED = &H8000000
' ========================================================================================
' WMIQ_RPN_TOKEN_FLAGS enum
' ========================================================================================
%EQUATE `WMIQ_RPN_TOKEN_EXPRESSION = 1
%EQUATE `WMIQ_RPN_TOKEN_AND = 2
%EQUATE `WMIQ_RPN_TOKEN_OR = 3
%EQUATE `WMIQ_RPN_TOKEN_NOT = 4
%EQUATE `WMIQ_RPN_OP_UNDEFINED = 0
%EQUATE `WMIQ_RPN_OP_EQ = 1
%EQUATE `WMIQ_RPN_OP_NE = 2
%EQUATE `WMIQ_RPN_OP_GE = 3
%EQUATE `WMIQ_RPN_OP_LE = 4
%EQUATE `WMIQ_RPN_OP_LT = 5
%EQUATE `WMIQ_RPN_OP_GT = 6
%EQUATE `WMIQ_RPN_OP_LIKE = 7
%EQUATE `WMIQ_RPN_OP_ISA = 8
%EQUATE `WMIQ_RPN_OP_ISNOTA = 9
%EQUATE `WMIQ_RPN_OP_ISNULL = 10
%EQUATE `WMIQ_RPN_OP_ISNOTNULL = 11
%EQUATE `WMIQ_RPN_LEFT_PROPERTY_NAME = &H1
%EQUATE `WMIQ_RPN_RIGHT_PROPERTY_NAME = &H2
%EQUATE `WMIQ_RPN_CONST2 = &H4
%EQUATE `WMIQ_RPN_CONST = &H8
%EQUATE `WMIQ_RPN_RELOP = &H10
%EQUATE `WMIQ_RPN_LEFT_FUNCTION = &H20
%EQUATE `WMIQ_RPN_RIGHT_FUNCTION = &H40
%EQUATE `WMIQ_RPN_GET_TOKEN_TYPE = 1
%EQUATE `WMIQ_RPN_GET_EXPR_SHAPE = 2
%EQUATE `WMIQ_RPN_GET_LEFT_FUNCTION = 3
%EQUATE `WMIQ_RPN_GET_RIGHT_FUNCTION = 4
%EQUATE `WMIQ_RPN_GET_RELOP = 5
%EQUATE `WMIQ_RPN_NEXT_TOKEN = 1
%EQUATE `WMIQ_RPN_FROM_UNARY = &H1
%EQUATE `WMIQ_RPN_FROM_PATH = &H2
%EQUATE `WMIQ_RPN_FROM_CLASS_LIST = &H4
%EQUATE `WMIQ_RPN_FROM_MULTIPLE = &H8
' ========================================================================================
' WMIQ_ASSOCQ_FLAGS enum
' ========================================================================================
%EQUATE `WMIQ_ASSOCQ_ASSOCIATORS = &H1
%EQUATE `WMIQ_ASSOCQ_REFERENCES = &H2
%EQUATE `WMIQ_ASSOCQ_RESULTCLASS = &H4
%EQUATE `WMIQ_ASSOCQ_ASSOCCLASS = &H8
%EQUATE `WMIQ_ASSOCQ_ROLE = &H10
%EQUATE `WMIQ_ASSOCQ_RESULTROLE = &H20
%EQUATE `WMIQ_ASSOCQ_REQUIREDQUALIFIER = &H40
%EQUATE `WMIQ_ASSOCQ_REQUIREDASSOCQUALIFIER = &H80
%EQUATE `WMIQ_ASSOCQ_CLASSDEFSONLY = &H100
%EQUATE `WMIQ_ASSOCQ_KEYSONLY = &H200
%EQUATE `WMIQ_ASSOCQ_SCHEMAONLY = &H400
%EQUATE `WMIQ_ASSOCQ_CLASSREFSONLY = &H800
' ========================================================================================
' SWbemQueryQualifiedName structure
' ========================================================================================
' // Size = 28 bytes
TYPE SWbemQueryQualifiedName DWORD
 m_uVersion AS DWORD ' ULONG
 m_uTokenType AS DWORD ' ULONG
 m_uNameListSize AS DWORD ' ULONG
 m_ppszNameList AS WSTRINGZ PTR ' LPCWSTR *
 m_bArraysUsed AS LONG
 m_pbArrayElUsed AS LONG PTR ' BOOL *
 m_puArrayIndex AS DWORD PTR ' ULONG *
END TYPE
' ========================================================================================
' SWbemRpnConst union
' ========================================================================================
' // Size = 8 bytes
UNION SWbemRpnConst ' Must be 8 byte aligned
 m_pszStrVal AS WSTRINGZ PTR
 m_bBoolVal AS LONG
 m_lLongVal AS LONG
 m_uLongVal AS DWORD ' ULONG
 m_dblVal AS DOUBLE ' double
 m_lVal64 AS QUAD
 m_uVal64 AS QUAD
END UNION
' ========================================================================================
' SWbemRpnQueryToken structure
' ========================================================================================
' // Size = 64 bytes
TYPE SWbemRpnQueryToken QWORD FILL
 m_uVersion AS DWORD ' ULONG
 m_uTokenType AS DWORD ' ULONG
 m_uSubexpressionShape AS DWORD ' ULONG
 m_uOperator AS DWORD ' ULONG
 m_pRightIdent AS SWbemQueryQualifiedName PTR ' SWbemQueryQualifiedName *
 m_pLeftIdent AS SWbemQueryQualifiedName PTR ' SWbemQueryQualifiedName *
 m_uConstApparentType AS DWORD ' ULONG
 m_Const AS SWbemRpnConst ' SWbemRpnConst
 m_uConst2ApparentType AS DWORD ' ULONG
 m_Const2 AS SWbemRpnConst ' SWbemRpnConst
 m_pszRightFunc AS WSTRINGZ PTR
 m_pszLeftFunc AS WSTRINGZ PTR
END TYPE
' ========================================================================================
' SWbemRpnTokenList structure
' ========================================================================================
' // Size = 12 bytes
TYPE SWbemRpnTokenList DWORD
 m_uVersion AS DWORD ' ULONG
 m_uTokenType AS DWORD ' ULONG
 m_uNumTokens AS DWORD ' ULONG
END TYPE
' ========================================================================================
' WMIQ_LANGUAGE_FEATURES enum
' ========================================================================================
%EQUATE `WMIQ_LF1_BASIC_SELECT = 1
%EQUATE `WMIQ_LF2_CLASS_NAME_IN_QUERY = 2
%EQUATE `WMIQ_LF3_STRING_CASE_FUNCTIONS = 3
%EQUATE `WMIQ_LF4_PROP_TO_PROP_TESTS = 4
%EQUATE `WMIQ_LF5_COUNT_STAR = 5
%EQUATE `WMIQ_LF6_ORDER_BY = 6
%EQUATE `WMIQ_LF7_DISTINCT = 7
%EQUATE `WMIQ_LF8_ISA = 8
%EQUATE `WMIQ_LF9_THIS = 9
%EQUATE `WMIQ_LF10_COMPEX_SUBEXPRESSIONS = 10
%EQUATE `WMIQ_LF11_ALIASING = 11
%EQUATE `WMIQ_LF12_GROUP_BY_HAVING = 12
%EQUATE `WMIQ_LF13_WMI_WITHIN = 13
%EQUATE `WMIQ_LF14_SQL_WRITE_OPERATIONS = 14
%EQUATE `WMIQ_LF15_GO = 15
%EQUATE `WMIQ_LF16_SINGLE_LEVEL_TRANSACTIONS = 16
%EQUATE `WMIQ_LF17_QUALIFIED_NAMES = 17
%EQUATE `WMIQ_LF18_ASSOCIATONS = 18
%EQUATE `WMIQ_LF19_SYSTEM_PROPERTIES = 19
%EQUATE `WMIQ_LF20_EXTENDED_SYSTEM_PROPERTIES = 20
%EQUATE `WMIQ_LF21_SQL89_JOINS = 21
%EQUATE `WMIQ_LF22_SQL92_JOINS = 22
%EQUATE `WMIQ_LF23_SUBSELECTS = 23
%EQUATE `WMIQ_LF24_UMI_EXTENSIONS = 24
%EQUATE `WMIQ_LF25_DATEPART = 25
%EQUATE `WMIQ_LF26_LIKE = 26
%EQUATE `WMIQ_LF27_CIM_TEMPORAL_CONSTRUCTS = 27
%EQUATE `WMIQ_LF28_STANDARD_AGGREGATES = 28
%EQUATE `WMIQ_LF29_MULTI_LEVEL_ORDER_BY = 29
%EQUATE `WMIQ_LF30_WMI_PRAGMAS = 30
%EQUATE `WMIQ_LF31_QUALIFIER_TESTS = 31
%EQUATE `WMIQ_LF32_SP_EXECUTE = 32
%EQUATE `WMIQ_LF33_ARRAY_ACCESS = 33
%EQUATE `WMIQ_LF34_UNION = 34
%EQUATE `WMIQ_LF35_COMPLEX_SELECT_TARGET = 35
%EQUATE `WMIQ_LF36_REFERENCE_TESTS = 36
%EQUATE `WMIQ_LF37_SELECT_INTO = 37
%EQUATE `WMIQ_LF38_BASIC_DATETIME_TESTS = 38
%EQUATE `WMIQ_LF39_COUNT_COLUMN = 39
%EQUATE `WMIQ_LF40_BETWEEN = 40
%EQUATE `WMIQ_LF_LAST = 40
' ========================================================================================
' WMIQ_RPNQ_FEATURE enum
' ========================================================================================
%EQUATE `WMIQ_RPNF_WHERE_CLAUSE_PRESENT = &H1
%EQUATE `WMIQ_RPNF_QUERY_IS_CONJUNCTIVE = &H2
%EQUATE `WMIQ_RPNF_QUERY_IS_DISJUNCTIVE = &H4
%EQUATE `WMIQ_RPNF_PROJECTION = &H8
%EQUATE `WMIQ_RPNF_FEATURE_SELECT_STAR = &H10
%EQUATE `WMIQ_RPNF_EQUALITY_TESTS_ONLY = &H20
%EQUATE `WMIQ_RPNF_COUNT_STAR = &H40
%EQUATE `WMIQ_RPNF_QUALIFIED_NAMES_USED = &H80
%EQUATE `WMIQ_RPNF_SYSPROP_CLASS_USED = &H100
%EQUATE `WMIQ_RPNF_PROP_TO_PROP_TESTS = &H200
%EQUATE `WMIQ_RPNF_ORDER_BY = &H400
%EQUATE `WMIQ_RPNF_ISA_USED = &H800
%EQUATE `WMIQ_RPNF_GROUP_BY_HAVING = &H1000
%EQUATE `WMIQ_RPNF_ARRAY_ACCESS_USED = &H2000
' ========================================================================================
' SWbemRpnEncodedQuery structure
' ========================================================================================
' // Size = 88 bytes
TYPE SWbemRpnEncodedQuery ' Must be 8 byte aligned
 m_uVersion AS DWORD ' ULONG
 m_uTokenType AS DWORD ' ULONG
 m_uParsedFeatureMask AS QUAD ' unsigned __int64
 m_uDetectedArraySize AS DWORD ' ULONG
 m_puDetectedFeatures AS DWORD PTR ' ULONG *
 m_uSelectListSize AS DWORD ' ULONG
 m_ppSelectList AS SWbemQueryQualifiedName PTR ' SWbemQueryQualifiedName **
 m_uFromTargetType AS DWORD ' ULONG
 m_pszOptionalFromPath AS WSTRINGZ PTR
 m_uFromListSize AS DWORD ' ULONG
 m_ppszFromList AS WSTRINGZ PTR
 m_uWhereClauseSize AS DWORD ' ULONG
 m_ppRpnWhereClause AS SWbemRpnQueryToken PTR ' SWbemRpnQueryToken **
 m_dblWithinPolling AS DOUBLE ' double
 m_dblWithinWindow AS DOUBLE ' double
 m_uOrderByListSize AS DWORD ' ULONG
 m_ppszOrderByList AS WSTRINGZ PTR ' LPCWSTR *
 m_uOrderDirectionEl AS DWORD PTR ' ULONG *
 alignment__ AS DWORD ' // To keep 8 byte alignment
END TYPE
' ========================================================================================
' SWbemAnalysisMatrix structure
' ========================================================================================
' // Size = 28 bytes
TYPE SWbemAnalysisMatrix DWORD
 m_uVersion AS DWORD ' ULONG
 m_uMatrixType AS DWORD ' ULONG
 m_pszProperty AS WSTRINGZ PTR
 m_uPropertyType AS DWORD ' ULONG
 m_uEntries AS DWORD ' ULONG
 m_pValues AS DWORD ' LPVOID *
 m_pbTruthTable AS LONG PTR ' BOOL *
END TYPE
' ========================================================================================
' SWbemAnalysisMatrixList structure
' ========================================================================================
' // Size = 16 bytes
TYPE SWbemAnalysisMatrixList DWORD
 m_uVersion AS DWORD ' ULONG
 m_uMatrixType AS DWORD ' ULONG
 m_uNumMatrices AS DWORD ' ULONG
 m_pMatrices AS SWbemAnalysisMatrix PTR ' SWbemAnalysisMatrix *
END TYPE
' ========================================================================================
' SWbemAssocQueryInf structure
' ========================================================================================
' // Size = 48 bytes
TYPE SWbemAssocQueryInf DWORD
 m_uVersion AS DWORD ' ULONG
 m_uAnalysisType AS DWORD ' ULONG
 m_uFeatureMask AS DWORD ' ULONG
 m_pPath AS DWORD ' IWbemPath *
 m_pszPath AS WSTRINGZ PTR
 m_pszQueryText AS WSTRINGZ PTR
 m_pszResultClass AS WSTRINGZ PTR
 m_pszAssocClass AS WSTRINGZ PTR
 m_pszRole AS WSTRINGZ PTR
 m_pszResultRole AS WSTRINGZ PTR
 m_pszRequiredQualifier AS WSTRINGZ PTR
 m_pszRequiredAssocQualifier AS WSTRINGZ PTR
END TYPE
#ENDIF
