' ########################################################################################
' Microsoft Windows
' File: DbgProp.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.
' ########################################################################################
'/* IDebugProperty Intro
' *
' * The IDebugProperty interface provides a language-neutral way to browse entities such as:
' *
' * 	- object properties, methods, and events
' * 	- interfaces
' * 	- local variables
' * 	-?etc.
' *
' * IDebugProperty is not intended to be a general replacement for ITypeInfo.
' * For example, it does not include enough low-level information to construct vtable
' * calls or implement IDispatch.
' *
' * Instead, IDebugProperty is intended to provide human-readable information to
' * allow IDE users to browse and modify objects at design
' * or run-time. Because of this more limited scope, IDebugProperty is much easier
' * to use and to implement than ITypeInfo.
' *
' * INTERFACE NOTES:
' * ===============
' * 1) Run-time type vs. declared type
' * The type of a DebugProperty can be determined via two methods. When the type
' * is obtained via GetPropertyInfo, the type is the *run-time* type. However,
' * when the type obtained via a GetMemberEnum on the parent, the type is the
' * *declared* type. In other words, object 'A' will give you its run-time
' * type, but A's parent will give you A's declared type.
' *
' * ISSUE: other guids? guidSuperClass, guidMostDerived?
' * ISSUE: too many QIs to get IDebugExtendedProp
' * ISSUE: out of attrib bits
' * ISSUE: specify filters (thru guids?)
' */
#IF NOT %DEF(PBX_DbgProp_PBI)
#DEFINE PBX_DbgProp_PBI
%EQUATE `DBGPROP_INC = 1
'/* header files for imported files */
#INCLUDE ONCE "Legacy/COM/OCIdl.inc"
'// -----------------------------------------------------------------------
'// OBJECT ATTRIBUTES
'// AD1 type was OBJECT_ATTRIB, enums were OBJECTATTRIB_foo, struct was PropertyInfo
'// AD2 type is OBJECTATTRIB, enums are OBJECT_ATTRIB_foo,struct is DebugPropertyInfo
'// confusing, oh yes indeed, please someone come up with a better solution
' enum OBJECT_ATTRIB_FLAG
'// ---------------------
'// Slot Characteristics
%EQUATE `OBJECT_ATTRIB_NO_ATTRIB = 0
%EQUATE `OBJECT_ATTRIB_NO_NAME = &H1 ' // this slot has no name
%EQUATE `OBJECT_ATTRIB_NO_TYPE = &H2 ' // this slot has no type
%EQUATE `OBJECT_ATTRIB_NO_VALUE = &H4 ' // this slot has no value
%EQUATE `OBJECT_ATTRIB_VALUE_IS_INVALID = &H8 ' // the value in this slot is invalid
%EQUATE `OBJECT_ATTRIB_VALUE_IS_OBJECT = &H10 ' // value is an object that can be expanded into a new object browser
%EQUATE `OBJECT_ATTRIB_VALUE_IS_ENUM = &H20 ' // value has enumerated values that might go into a drop down
%EQUATE `OBJECT_ATTRIB_VALUE_IS_CUSTOM = &H40 ' // value has a custom viewer (use custom view CLSID)
%EQUATE `OBJECT_ATTRIB_OBJECT_IS_EXPANDABLE = &H70 ' // the object has children
%EQUATE `OBJECT_ATTRIB_VALUE_HAS_CODE = &H80 ' // the value has associated code
'// ---------------------
'// Attributes about a slot's type
%EQUATE `OBJECT_ATTRIB_TYPE_IS_OBJECT = &H100 ' // the type has an object browser
%EQUATE `OBJECT_ATTRIB_TYPE_HAS_CODE = &H200 ' // the type has associated code
%EQUATE `OBJECT_ATTRIB_TYPE_IS_EXPANDABLE = &H100 ' // the type is expandable
%EQUATE `OBJECT_ATTRIB_SLOT_IS_CATEGORY = &H400 ' // indication that this slot is a category
%EQUATE `OBJECT_ATTRIB_VALUE_READONLY = &H800 ' // the value is read-only
'// ---------------------
'// Common attributes
'// field access control
%EQUATE `OBJECT_ATTRIB_ACCESS_PUBLIC = &H1000
%EQUATE `OBJECT_ATTRIB_ACCESS_PRIVATE = &H2000
%EQUATE `OBJECT_ATTRIB_ACCESS_PROTECTED = &H4000
%EQUATE `OBJECT_ATTRIB_ACCESS_FINAL = &H8000
'// storage types
%EQUATE `OBJECT_ATTRIB_STORAGE_GLOBAL = &H10000
%EQUATE `OBJECT_ATTRIB_STORAGE_STATIC = &H20000
%EQUATE `OBJECT_ATTRIB_STORAGE_FIELD = &H40000
'// type modifiers
%EQUATE `OBJECT_ATTRIB_STORAGE_VIRTUAL = &H80000 ' // this slot is virtual (do we need pure virtual?)
%EQUATE `OBJECT_ATTRIB_TYPE_IS_CONSTANT = &H100000 ' // this slot is a constant value
%EQUATE `OBJECT_ATTRIB_TYPE_IS_SYNCHRONIZED = &H200000 ' // this slot is thread synchronized
%EQUATE `OBJECT_ATTRIB_TYPE_IS_VOLATILE = &H400000 ' // this slot is volatile WRT persistent storage
%EQUATE `OBJECT_ATTRIB_HAS_EXTENDED_ATTRIBS = &H800000 ' // has attributes above and beyond these predefined bits
'// ---------------------
'// Kind information (I'm not sure how useful these are)
%EQUATE `OBJECT_ATTRIB_IS_CLASS = &H1000000
%EQUATE `OBJECT_ATTRIB_IS_FUNCTION = &H2000000
%EQUATE `OBJECT_ATTRIB_IS_VARIABLE = &H4000000
%EQUATE `OBJECT_ATTRIB_IS_PROPERTY = &H8000000
%EQUATE `OBJECT_ATTRIB_IS_MACRO = &H10000000
%EQUATE `OBJECT_ATTRIB_IS_TYPE = &H20000000
%EQUATE `OBJECT_ATTRIB_IS_INHERITED = &H40000000
%EQUATE `OBJECT_ATTRIB_IS_INTERFACE = &H80000000
'// -----------------------------------------------------------------------
'// DebugPropertyInfo
'// Basic info that all IDebugProperty implementations must support
'// Flags used to specify DebugPropertyInfo (and ExtendedDebugPropertyInfo) fields
' enum PROP_INFO_FLAGS
%EQUATE `PROP_INFO_NAME = &H1 ' // init the bstrName field
%EQUATE `PROP_INFO_TYPE = &H2 ' // init the bstrType field
%EQUATE `PROP_INFO_VALUE = &H4 ' // init the bstrValue field
%EQUATE `PROP_INFO_FULLNAME = &H20 ' // init the full name field
%EQUATE `PROP_INFO_ATTRIBUTES = &H8 ' // init the dwAttrib field
%EQUATE `PROP_INFO_DEBUGPROP = &H10 ' // init the pDebugProp field
%EQUATE `PROP_INFO_AUTOEXPAND = &H8000000 ' // make the Value result auto-expand
%EQUATE `PROP_INFO_STANDARD = ((((%PROP_INFO_NAME OR %PROP_INFO_TYPE) OR %PROP_INFO_VALUE) OR %PROP_INFO_ATTRIBUTES))
%EQUATE `PROP_INFO_ALL = ((((((%PROP_INFO_NAME OR %PROP_INFO_TYPE) OR %PROP_INFO_VALUE) OR %PROP_INFO_FULLNAME) OR %PROP_INFO_ATTRIBUTES) OR %PROP_INFO_DEBUGPROP))
' // Size = 28 bytes
TYPE DebugPropertyInfo DWORD
 m_dwValidFields AS DWORD
 m_bstrName AS DWORD ' BSTR
 m_bstrType AS DWORD ' BSTR
 m_bstrValue AS DWORD ' BSTR
 m_bstrFullName AS DWORD ' BSTR
 m_dwAttrib AS DWORD
 m_pDebugProp AS DWORD PTR ' IDebugProperty *
END TYPE
'// -----------------------------------------------------------------------
'// Extended info that some IDebugProperty implementations support
'// Flags used to specify ExtendedDebugPropertyInfo fields
' enum EX_PROP_INFO_FLAGS
%EQUATE `EX_PROP_INFO_ID = &H100 ' // init the nDISPID field
%EQUATE `EX_PROP_INFO_NTYPE = &H200 ' // init the nType field
%EQUATE `EX_PROP_INFO_NVALUE = &H400 ' // init the varValue field
%EQUATE `EX_PROP_INFO_LOCKBYTES = &H800 ' // init the plb field
%EQUATE `EX_PROP_INFO_DEBUGEXTPROP = &H1000 ' // init the pDebugExtProp field
' // Size = 64 bytes
TYPE ExtendedDebugPropertyInfo QWORD FILL
 dwValidFields AS DWORD
 pszName AS WSTRINGZ PTR
 pszType AS WSTRINGZ PTR
 pszValue AS WSTRINGZ PTR
 pszFullName AS WSTRINGZ PTR
 dwAttrib AS DWORD
 pDebugProp AS DWORD PTR ' IDebugProperty *
 nDISPID AS DWORD
 nType AS DWORD
 varValue AS tagVARIANT ' VARIANT
 plbValue AS DWORD PTR ' ILockBytes *
 pDebugExtProp AS DWORD PTR ' IDebugExtendedProperty *
END TYPE
' ########################################################################################
' Interface name = IDebugProperty
' IID = 51973C41-CB0C-11d0-B5C9-00A0244A0E7A
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IDebugProperty_INTERFACE_DEFINED)
 %IDebugProperty_INTERFACE_DEFINED = 1
$IID_IDebugProperty = GUID$("{51973C50-CB0C-11d0-B5C9-00A0244A0E7A}")
INTERFACE IDebugProperty $IID_IDebugProperty
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetPropertyInfo ( ' VTable offset = 12
 BYVAL dwFieldSpec AS DWORD
 , BYVAL nRadix AS DWORD
 , BYREF pPropertyInfo AS DebugPropertyInfo
 ) AS LONG
 ' =====================================================================================
 METHOD GetExtendedInfo ( ' VTable offset = 16
 BYVAL cInfos AS DWORD
 , BYREF rgguidExtendedInfo AS GUID
 , BYREF rgvar AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD SetValueAsString ( ' VTable offset = 20
 BYREF pszValue AS WSTRINGZ
 , BYVAL nRadix AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD EnumMembers ( ' VTable offset = 24
 BYVAL dwFieldSpec AS DWORD
 , BYVAL nRadix AS DWORD
 , BYREF refiid AS GUID
 , BYREF ppepi AS IEnumDebugPropertyInfo
 ) AS LONG
 ' =====================================================================================
 METHOD GetParent ( ' VTable offset = 28
 BYREF ppDebugProp AS IDebugProperty
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IDebugProperty_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IEnumDebugPropertyInfo
' IID = 51973C51-CB0C-11d0-B5C9-00A0244A0E7A
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IEnumDebugPropertyInfo_INTERFACE_DEFINED)
 %IEnumDebugPropertyInfo_INTERFACE_DEFINED = 1
$IID_IEnumDebugPropertyInfo = GUID$("{51973C51-CB0C-11d0-B5C9-00A0244A0E7A}")
INTERFACE IEnumDebugPropertyInfo $IID_IEnumDebugPropertyInfo
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Next ( ' VTable offset = 12
 BYVAL celt AS DWORD
 , BYREF pi AS DebugPropertyInfo
 , BYREF pcEltsfetched AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Skip ( ' VTable offset = 16
 BYVAL celt AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Reset ( ' VTable offset = 20
 ) AS LONG
 ' =====================================================================================
 METHOD Clone ( ' VTable offset = 24
 BYREF ppepi AS IEnumDebugPropertyInfo
 ) AS LONG
 ' =====================================================================================
 METHOD GetCount ( ' VTable offset = 28
 BYREF pcelt AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IEnumDebugPropertyInfo_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IDebugExtendedProperty
' IID = 51973C52-CB0C-11d0-B5C9-00A0244A0E7A
' Inherited interface = IDebugProperty
' ########################################################################################
#IF NOT %DEF(%IDebugExtendedProperty_INTERFACE_DEFINED)
 %IDebugExtendedProperty_INTERFACE_DEFINED = 1
$IID_IDebugExtendedProperty = GUID$("{51973C52-CB0C-11d0-B5C9-00A0244A0E7A}")
INTERFACE IDebugExtendedProperty $IID_IDebugExtendedProperty
 INHERIT IUnknown
 ' =====================================================================================
 ' IDebugProperty methods
 ' =====================================================================================
 METHOD GetPropertyInfo ( ' VTable offset = 12
 BYVAL dwFieldSpec AS DWORD
 , BYVAL nRadix AS DWORD
 , BYREF pPropertyInfo AS DebugPropertyInfo
 ) AS LONG
 ' =====================================================================================
 METHOD GetExtendedInfo ( ' VTable offset = 16
 BYVAL cInfos AS DWORD
 , BYREF rgguidExtendedInfo AS GUID
 , BYREF rgvar AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD SetValueAsString ( ' VTable offset = 20
 BYREF pszValue AS WSTRINGZ
 , BYVAL nRadix AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD EnumMembers ( ' VTable offset = 24
 BYVAL dwFieldSpec AS DWORD
 , BYVAL nRadix AS DWORD
 , BYREF refiid AS GUID
 , BYREF ppepi AS IEnumDebugPropertyInfo
 ) AS LONG
 ' =====================================================================================
 METHOD GetParent ( ' VTable offset = 28
 BYREF ppDebugProp AS IDebugProperty
 ) AS LONG
 ' =====================================================================================
 ' =====================================================================================
 ' IDebugExtendedProperty methods
 ' =====================================================================================
 METHOD GetExtendedPropertyInfo ( ' VTable offset = 32
 BYVAL dwFieldSpec AS DWORD
 , BYVAL nRadix AS DWORD
 , BYREF pExtendedPropertyInfo AS ExtendedDebugPropertyInfo
 ) AS LONG
 ' =====================================================================================
 METHOD EnumExtendedMembers ( ' VTable offset = 36
 BYVAL dwFieldSpec AS DWORD
 , BYVAL nRadix AS DWORD
 , BYREF ppeepi AS IEnumDebugExtendedPropertyInfo
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IDebugExtendedProperty_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IEnumDebugExtendedPropertyInfo
' IID = 51973C53-CB0C-11d0-B5C9-00A0244A0E7A
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IEnumDebugExtendedPropertyInfo_INTERFACE_DEFINED)
 %IEnumDebugExtendedPropertyInfo_INTERFACE_DEFINED = 1
$IID_IEnumDebugExtendedPropertyInfo = GUID$("{51973C53-CB0C-11d0-B5C9-00A0244A0E7A}")
INTERFACE IEnumDebugExtendedPropertyInfo $IID_IEnumDebugExtendedPropertyInfo
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Next ( ' VTable offset = 12
 BYVAL celt AS DWORD
 , BYREF rgExtendedPropertyInfo AS ExtendedDebugPropertyInfo
 , BYREF pcEltsfetched AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Skip ( ' VTable offset = 16
 BYVAL celt AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Reset ( ' VTable offset = 20
 ) AS LONG
 ' =====================================================================================
 METHOD Clone ( ' VTable offset = 24
 BYREF pedpe AS IEnumDebugExtendedPropertyInfo
 ) AS LONG
 ' =====================================================================================
 METHOD GetCount ( ' VTable offset = 28
 BYREF pcelt AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IEnumDebugExtendedPropertyInfo_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IPerPropertyBrowsing2
' IID = 51973C54-CB0C-11d0-B5C9-00A0244A0E7A
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IPerPropertyBrowsing2_INTERFACE_DEFINED)
 %IPerPropertyBrowsing2_INTERFACE_DEFINED = 1
$IID_IPerPropertyBrowsing2 = GUID$("{51973C54-CB0C-11d0-B5C9-00A0244A0E7A}")
INTERFACE IPerPropertyBrowsing2 $IID_IPerPropertyBrowsing2
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetDisplayString ( ' VTable offset = 12
 BYVAL dispid AS LONG
 , BYREF pBstr AS WSTRING
 ) AS LONG
 ' =====================================================================================
 METHOD MapPropertyToPage ( ' VTable offset = 16
 BYVAL dispid AS LONG
 , BYREF pClsidPropPage AS GUID
 ) AS LONG
 ' =====================================================================================
 METHOD GetPredefinedStrings ( ' VTable offset = 20
 BYVAL dispid AS LONG
 , BYREF pCaStrings AS CALPOLESTR
 , BYREF pCaCookies AS CADWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetPredefinedValue ( ' VTable offset = 24
 BYVAL dispid AS LONG
 , BYVAL dwCookie AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IPerPropertyBrowsing2_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IDebugPropertyEnumType_All
' IID = 51973C55-CB0C-11d0-B5C9-00A0244A0E7A
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IDebugPropertyEnumType_All_INTERFACE_DEFINED)
 %IDebugPropertyEnumType_All_INTERFACE_DEFINED = 1
$IID_IDebugPropertyEnumType_All = GUID$("{51973C55-CB0C-11d0-B5C9-00A0244A0E7A}")
INTERFACE IDebugPropertyEnumType_All $IID_IDebugPropertyEnumType_All
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetName ( ' VTable offset = 12
 BYREF pname AS WSTRING
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IDebugPropertyEnumType_All_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IDebugPropertyEnumType_Locals
' IID = 51973C56-CB0C-11d0-B5C9-00A0244A0E7A
' Inherited interface = IDebugPropertyEnumType_All
' ########################################################################################
#IF NOT %DEF(%IDebugPropertyEnumType_Locals_INTERFACE_DEFINED)
 %IDebugPropertyEnumType_Locals_INTERFACE_DEFINED = 1
$IID_IDebugPropertyEnumType_Locals = GUID$("{51973C56-CB0C-11d0-B5C9-00A0244A0E7A}")
INTERFACE IDebugPropertyEnumType_Locals $IID_IDebugPropertyEnumType_Locals
 INHERIT IUnknown
 ' =====================================================================================
 ' IDebugPropertyEnumType_All method
 ' =====================================================================================
 METHOD GetName ( ' VTable offset = 12
 BYREF pname AS WSTRING
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IDebugPropertyEnumType_Locals_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IDebugPropertyEnumType_Arguments
' IID = 51973C57-CB0C-11d0-B5C9-00A0244A0E7A
' Inherited interface = IDebugPropertyEnumType_All
' ########################################################################################
#IF NOT %DEF(%IDebugPropertyEnumType_Arguments_INTERFACE_DEFINED)
 %IDebugPropertyEnumType_Arguments_INTERFACE_DEFINED = 1
$IID_IDebugPropertyEnumType_Arguments = GUID$("{51973C57-CB0C-11d0-B5C9-00A0244A0E7A}")
INTERFACE IDebugPropertyEnumType_Arguments $IID_IDebugPropertyEnumType_Arguments
 INHERIT IUnknown
 ' =====================================================================================
 ' IDebugPropertyEnumType_All method
 ' =====================================================================================
 METHOD GetName ( ' VTable offset = 12
 BYREF pname AS WSTRING
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IDebugPropertyEnumType_Arguments_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IDebugPropertyEnumType_LocalsPlusArgs
' IID = 51973C58-CB0C-11d0-B5C9-00A0244A0E7A
' Inherited interface = IDebugPropertyEnumType_All
' ########################################################################################
#IF NOT %DEF(%IDebugPropertyEnumType_LocalsPlusArgs_INTERFACE_DEFINED)
 %IDebugPropertyEnumType_LocalsPlusArgs_INTERFACE_DEFINED = 1
$IID_IDebugPropertyEnumType_LocalsPlusArgs = GUID$("{51973C58-CB0C-11d0-B5C9-00A0244A0E7A}")
INTERFACE IDebugPropertyEnumType_LocalsPlusArgs $IID_IDebugPropertyEnumType_LocalsPlusArgs
 INHERIT IUnknown
 ' =====================================================================================
 ' IDebugPropertyEnumType_All method
 ' =====================================================================================
 METHOD GetName ( ' VTable offset = 12
 BYREF pname AS WSTRING
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IDebugPropertyEnumType_LocalsPlusArgs_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IDebugPropertyEnumType_Registers
' IID = 51973C59-CB0C-11d0-B5C9-00A0244A0E7A
' Inherited interface = IDebugPropertyEnumType_All
' ########################################################################################
#IF NOT %DEF(%IDebugPropertyEnumType_Registers_INTERFACE_DEFINED)
 %IDebugPropertyEnumType_Registers_INTERFACE_DEFINED = 1
$IID_IDebugPropertyEnumType_Registers = GUID$("{51973C59-CB0C-11d0-B5C9-00A0244A0E7A}")
INTERFACE IDebugPropertyEnumType_Registers $IID_IDebugPropertyEnumType_Registers
 INHERIT IUnknown
 ' =====================================================================================
 ' IDebugPropertyEnumType_All method
 ' =====================================================================================
 METHOD GetName ( ' VTable offset = 12
 BYREF pname AS WSTRING
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IDebugPropertyEnumType_Registers_INTERFACE_DEFINED__ */
#ENDIF
