'wtypes.ab

Type RemHGLOBAL
	fNullHGlobal As Long
	cbData As DWord
	data[1] As Byte
End Type

Type RemHMETAFILEPICT
	mm As Long
	xExt As Long
	yExt As Long
	cbData As DWord
	data[1] As Byte
End Type

Type RemHENHMETAFILE
	cbData As DWord
	data[1] As Byte
End Type

Type RemHBITMAP
	cbData As DWord
	data[1] As Byte
End Type

Type RemHPALETTE
	cbData As DWord
	data[1] As Byte
End Type

Type RemBRUSH
	cbData As DWord
	data[1] As Byte
End Type

'HANDLE
'HMODULE
'HINSTANCE
'HTASK
'HKEY
'HDESK
TypeDef HMF = HANDLE
TypeDef HEMF = HANDLE
'HPEN
'HRSRC
'HSTR
'HWINSTA
'HKL
'HGDIOBJ
TypeDef HDWP = HANDLE

'HFILE

TypeDef OLECHAR = WCHAR
TypeDef LPOLESTR = *OLECHAR
TypeDef LPCOLESTR = LPOLESTR

Type COAUTHIDENTITY
	User As *Word
	UserLength As DWord
	Domain As *Word
	DomainLength As DWord
	Password As *Word
	PasswordLength As DWord
	Flags As DWord
End Type

Type COAUTHINFO
	dwAuthnSvc As DWord
	dwAuthzSvc As DWord
	pwszServerPrincName As LPWSTR
	dwAuthnLevel As DWord
	dwImpersonationLevel As DWord
	pAuthIdentityData As *COAUTHIDENTITY
	dwCapabilities As DWord
End Type

TypeDef SCODE = Long

'HRESULT

'OBJECTID

Const Enum MEMCTX
	MEMCTX_TASK = 1
	MEMCTX_SHARED = 2
	MEMCTX_MACSYSTEM = 3
	MEMCTX_UNKNOWN = -1
	MEMCTX_SAME = -2
End Enum

Const ROTFLAGS_REGISTRATIONKEEPSALIVE = &h1
Const ROTFLAGS_ALLOWANYCLIENT = &h2
Const ROTREGFLAGS_ALLOWANYCLIENT = &h1
Const ROT_COMPARE_MAX = 2048
Const DCOMSCM_ACTIVATION_USE_ALL_AUTHNSERVICES = &h1
Const DCOMSCM_ACTIVATION_DISALLOW_UNSECURE_CALL = &h2
Const DCOMSCM_RESOLVE_USE_ALL_AUTHNSERVICES = &h4
Const DCOMSCM_RESOLVE_DISALLOW_UNSECURE_CALL = &h8
Const DCOMSCM_PING_USE_MID_AUTHNSERVICE = &h10
Const DCOMSCM_PING_DISALLOW_UNSECURE_CALL = &h20

Const Enum CLSCTX
	CLSCTX_INPROC_SERVER = &h1
	CLSCTX_INPROC_HANDLER = &h2
	CLSCTX_LOCAL_SERVER = &h4
	CLSCTX_INPROC_SERVER16 = &h8
	CLSCTX_REMOTE_SERVER = &h10
	CLSCTX_INPROC_HANDLER16 = &h20
	CLSCTX_RESERVED1 = &h40
	CLSCTX_RESERVED2 = &h80
	CLSCTX_RESERVED3 = &h100
	CLSCTX_RESERVED4 = &h200
	CLSCTX_NO_CODE_DOWNLOAD = &h400
	CLSCTX_RESERVED5 = &h800
	CLSCTX_NO_CUSTOM_MARSHAL = &h1000
	CLSCTX_ENABLE_CODE_DOWNLOAD = &h2000
	CLSCTX_NO_FAILURE_LOG = &h4000
	CLSCTX_DISABLE_AAA = &h8000
	CLSCTX_ENABLE_AAA = &h10000
	CLSCTX_FROM_DEFAULT_CONTEXT = &h20000
	CLSCTX_ACTIVATE_32_BIT_SERVER = &h40000
	CLSCTX_ACTIVATE_64_BIT_SERVER = &h80000
	CLSCTX_ENABLE_CLOAKING = &h100000
	CLSCTX_PS_DLL = &h80000000
End Enum

Const CLSCTX_VALID_MASK = (
	CLSCTX_INPROC_SERVER Or _
	CLSCTX_INPROC_HANDLER Or _
	CLSCTX_LOCAL_SERVER Or _
	CLSCTX_INPROC_SERVER16 Or _
	CLSCTX_REMOTE_SERVER Or _
	CLSCTX_NO_CODE_DOWNLOAD Or _
	CLSCTX_NO_CUSTOM_MARSHAL Or _
	CLSCTX_ENABLE_CODE_DOWNLOAD Or _
	CLSCTX_NO_FAILURE_LOG Or _
	CLSCTX_DISABLE_AAA Or _
	CLSCTX_ENABLE_AAA Or _
	CLSCTX_FROM_DEFAULT_CONTEXT Or _
	CLSCTX_ACTIVATE_32_BIT_SERVER Or _
	CLSCTX_ACTIVATE_64_BIT_SERVER Or _
	CLSCTX_ENABLE_CLOAKING Or _
	CLSCTX_PS_DLL)

Const Enum MSHLFLAGS
	MSHLFLAGS_NORMAL = 0
	MSHLFLAGS_TABLESTRONG = 1
	MSHLFLAGS_TABLEWEAK = 2
	MSHLFLAGS_NOPING = 4
	MSHLFLAGS_RESERVED1 = 8
	MSHLFLAGS_RESERVED2 = 16
	MSHLFLAGS_RESERVED3 = 32
	MSHLFLAGS_RESERVED4 = 64
End Enum

Const Enum MSHCTX
	MSHCTX_LOCAL = 0
	MSHCTX_NOSHAREDMEM = 1
	MSHCTX_DIFFERENTMACHINE = 2
	MSHCTX_INPROC = 3
	MSHCTX_CROSSCTX = 4
End Enum

Const Enum DVASPECT
	DVASPECT_CONTENT = 1
	DVASPECT_THUMBNAIL = 2
	DVASPECT_ICON = 4
	DVASPECT_DOCPRINT = 8
End Enum

Const Enum STGC
	STGC_DEFAULT = 0
	STGC_OVERWRITE = 1
	STGC_ONLYIFCURRENT = 2
	STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4
	STGC_CONSOLIDATE = 8
End Enum

Const Enum STGMOVE
	STGMOVE_MOVE = 0
	STGMOVE_COPY = 1
	STGMOVE_SHALLOWCOPY = 2
End Enum

Const Enum STATFLAG
	STATFLAG_DEFAULT = 0
	STATFLAG_NONAME = 1
	STATFLAG_NOOPEN = 2
End Enum

TypeDef HCONTEXT = /* [context_handle] */ VoidPtr

'LCID
'LANGID

Type BYTE_BLOB
	clSize As DWord
	abData[0] As Byte
End Type

TypeDef UP_BYTE_BLOB = /* [unique] */ *BYTE_BLOB

Type WORD_BLOB
	clSize As DWord
	asData[0] As Word
End Type

TypeDef UP_WORD_BLOB = /* [unique] */ *WORD_BLOB

Type DWORD_BLOB
	clSize As DWord
	alData[0] As DWord
End Type

TypeDef UP_DWORD_BLOB = /* [unique] */ *DWORD_BLOB

Type FLAGGED_BYTE_BLOB
	fFlags As DWord
	clSize As DWord
	abData[0] As Byte
End Type

TypeDef UP_FLAGGED_BYTE_BLOB = /* [unique] */ *FLAGGED_BYTE_BLOB

Type FLAGGED_WORD_BLOB
	fFlags As DWord
	clSize As DWord
	asData[0] As Word
End Type

TypeDef UP_FLAGGED_WORD_BLOB = /* [unique] */ *FLAGGED_WORD_BLOB

Type BYTE_SIZEDARR
	clSize As DWord
	pData As *Byte
End Type

Type WORD_SIZEDARR
	clSize As DWord
	pData As *Word
End Type

Type DWORD_SIZEDARR
	clSize As DWord
	pData As *DWord
End Type

Type HYPER_SIZEDARR
	clSize As DWord
	pData As *QWord
End Type

Const WDT_INPROC_CALL = &h48746457
Const WDT_REMOTE_CALL = &h52746457
Const WDT_INPROC64_CALL = &h50746457

Type userCLIPFORMAT
	fContext As Long
	'u As Union
		'dwValue As DWord
		pwszName As *WCHAR
	'End Union
End Type

TypeDef wireCLIPFORMAT = /* [unique] */ *userCLIPFORMAT
TypeDef CLIPFORMAT = /* [wire_marshal] */ WORD

Type GDI_NONREMOTE
	fContext As Long
	'u As Union
		'hInproc As Long
		hRemote As *DWORD_BLOB
	'End Union
End Type

Type userHGLOBAL
	fContext As Long
	'u As Union
		'hInproc As Long
		'hRemote As *FLAGGED_BYTE_BLOB
		hInproc64 As Int64
	'End Union
End Type

TypeDef wireHGLOBAL = /* [unique] */ *userHGLOBAL

Type userHMETAFILE
	fContext As Long
	'u As Union
		'hInproc As Long
		'hRemote As *BYTE_BLOB
		hInproc64 As Int64
	'End Union
End Type

Type remoteMETAFILEPICT
	mm As Long
	xExt As Long
	yExt As Long
End Type

Type userHMETAFILEPICT
	fContext As Long
	'u As Union
		'hInproc As Long
		'hRemote As *remoteMETAFILEPICT
		hInproc64 As Int64
	'End Union
End Type

Type userHENHMETAFILE
	fContext As Long
	'u As Union
		'hInproc As Long
		'hRemote As *BYTE_BLOB
		hInproc64 As Int64
	'End Union
End Type

Type userBITMAP
	bmType As Long
	bmWidth As Long
	bmHeight As Long
	bmWidthBytes As Long
	bmPlanes As Word
	bmBitsPixel As Word
	cbSize As DWord
	pBuffer[1] As Byte
End Type

Type userHBITMAP
	fContext As Long
	'u As Union
		'hInproc As Long
		'hRemote As *userBITMAP
		hInproc64 As Int64
	'End Union
End Type

Type userHPALETTE
	fContext As Long
	'u As Union
		'hInproc As Long
		'hRemote As *LOGPALETTE
		hInproc64 As Int64
	'End Union
End Type

Type RemotableHandle
	fContext As Long
	'u As Union
		'hInproc As Long
		hRemote As Long
	'End Union
End Type

TypeDef wireHWND = /* [unique] */ *RemotableHandle
TypeDef wireHMENU = /* [unique] */ *RemotableHandle
TypeDef wireHACCEL = /* [unique] */ *RemotableHandle
TypeDef wireHBRUSH = /* [unique] */ *RemotableHandle
TypeDef wireHFONT = /* [unique] */ *RemotableHandle
TypeDef wireHDC = /* [unique] */ *RemotableHandle
TypeDef wireHICON = /* [unique] */ *RemotableHandle
TypeDef wireHRGN = /* [unique] */ *RemotableHandle
TypeDef wireHBITMAP = /* [unique] */ *RemotableHandle
TypeDef wireHPALETTE = /* [unique] */ *RemotableHandle
TypeDef wireHENHMETAFILE = /* [unique] */ *RemotableHandle
TypeDef wireHMETAFILE = /* [unique] */ *RemotableHandle
TypeDef wireHMETAFILEPICT = /* [unique] */ *RemotableHandle
TypeDef HMETAFILEPICT = /* [wire_marshal] */ VoidPtr

'extern RPC_IF_HANDLE IWinTypes_v0_1_c_ifspec;
'extern RPC_IF_HANDLE IWinTypes_v0_1_s_ifspec;

/* interface __MIDL_itf_wtypes_0000_0001 */
/* [local] */

TypeDef DATE = Double

TypeDef CY = Int64
'Type /*Class*/ CY ' WTypes.ab
'Public
'	int64 As Int64
/*
	Function Lo() As DWord
		Return GetDWord(VarPtr(int64))
	End Function

	Sub Lo(lo As DWord)
		SetDWord(VarPtr(int64), lo)
	End Sub

	Function Hi() As Long
		Return GetDWord(VarPtr(int64) + SizeOf (DWord)) As Long
	End Function

	Sub Lo(lo As Long)
		SetDWord(VarPtr(int64) + SizeOf (DWord, lo As DWord))
	End Sub
*/
'End Type'Class

TypeDef LPCY = *CY

Type /*Class*/ DECIMAL 'WTypes.ab
'Public
	wReserved As Word
	signscale As Word
	Hi32 As DWord
	Lo64 As QWord
/*
	Function scale() As Byte
		Return GetByte(VarPtr(signscale))
	End Function

	Sub scale(s As Byte)
		SetByte(VarPtr(signscale), s)
	End Sub

	Function sign() As Byte
		Return GetByte(VarPtr(signscale) + SizeOf (Byte))
	End Function

	Sub sign(s As Byte)
		SetByte(VarPtr(signscale) + SizeOf (Byte), s)
	End Sub

	Function Lo32() As DWord
		Return GetDWord(VarPtr(Lo64) As *DWord)
	End Function

	Sub Lo32(l As DWord)
		SetDWord(VarPtr(Lo64) As *DWord, l)
	End Sub

	Function Mid32() As DWord
		Return GetDWord(VarPtr(Lo64) As *DWord)
	End Function

	Sub Mid32(m As DWord)
		SetDWord(VarPtr(Lo64) As *DWord + SizeOf (DWord), m)
	End Sub
*/
End Type ' Class

Const DECIMAL_NEG = (&h80 As Byte) 'WTypes.ab
'DECIMAL_SETZERO(dec)
TypeDef LPDECIMAL = *DECIMAL

TypeDef wireBSTR = /* [unique] */ *FLAGGED_WORD_BLOB
TypeDef BSTR = /* [wire_marshal] */ *OLECHAR
TypeDef LPBSTR = *BSTR

TypeDef VARIANT_BOOL = Integer

'BOOLEAN

Type BSTRBLOB
	cbSize As DWord
	pData As *Byte
End Type

TypeDef LPBSTRBLOB = *BSTRBLOB

Const VARIANT_TRUE = (-1 As VARIANT_BOOL) ' WTypes.ab
Const VARIANT_FALSE = (0 As VARIANT_BOOL) ' WTypes.ab

'Type BLOB
'TypeDef LPBLOB

Type CLIPDATA
	cbSize As DWord
	ulClipFmt As Long
	pClipData As *Byte
End Type

Const CBPCLIPDATA(clipdata) =  ((clipdata).cbSize - SizeOf ((clipdata).ulClipFmt))
TypeDef VARTYPE = Word
Const Enum VARENUM 'WTypes.idl
	VT_EMPTY	= 0
	VT_NULL	= 1
	VT_I2	= 2
	VT_I4	= 3
	VT_R4	= 4
	VT_R8	= 5
	VT_CY	= 6
	VT_DATE	= 7
	VT_BSTR	= 8
	VT_DISPATCH	= 9
	VT_ERROR	= 10
	VT_BOOL	= 11
	VT_VARIANT	= 12
	VT_UNKNOWN	= 13
	VT_DECIMAL	= 14
	VT_I1	= 16
	VT_UI1	= 17
	VT_UI2	= 18
	VT_UI4	= 19
	VT_I8	= 20
	VT_UI8	= 21
	VT_INT	= 22
	VT_UINT	= 23
	VT_VOID	= 24
	VT_HRESULT	= 25
	VT_PTR	= 26
	VT_SAFEARRAY	= 27
	VT_CARRAY	= 28
	VT_USERDEFINED	= 29
	VT_LPSTR	= 30
	VT_LPWSTR	= 31
	VT_RECORD	= 36
	VT_INT_PTR	= 37
	VT_UINT_PTR	= 38
	VT_FILETIME	= 64
	VT_BLOB	= 65
	VT_STREAM	= 66
	VT_STORAGE	= 67
	VT_STREAMED_OBJECT	= 68
	VT_STORED_OBJECT	= 69
	VT_BLOB_OBJECT	= 70
	VT_CF	= 71
	VT_CLSID	= 72
	VT_VERSIONED_STREAM	= 73
	VT_BSTR_BLOB	= &hfff
	VT_VECTOR	= &h1000
	VT_ARRAY	= &h2000
	VT_BYREF	= &h4000
	VT_RESERVED	= &h8000
	VT_ILLEGAL	= &hffff
	VT_ILLEGALMASKED	= &hfff
	VT_TYPEMASK	= &hfff
End Enum

Type PROPERTYKEY
	fmtid As GUID
	pid As DWord
End Type

'SID_IDENTIFIER_AUTHORITY
'PSID_IDENTIFIER_AUTHORITY

'SID
'PSID

'SID_AND_ATTRIBUTES
'PSID_AND_ATTRIBUTES

Type CSPLATFORM
	dwPlatformId As DWord
	dwVersionHi As DWord
	dwVersionLo As DWord
	dwProcessorArch As DWord
End Type

Type QUERYCONTEXT
	dwContext As DWord
	latform As CSPLATFORM
	Locale As LCID
	dwVersionHi As DWord
	dwVersionLo As DWord
End Type

/* [v1_enum] */ Const Enum TYSPEC
	TYSPEC_CLSID = 0
	TYSPEC_FILEEXT = 1
	TYSPEC_MIMETYPE = 2
	TYSPEC_FILENAME = 3
	TYSPEC_PROGID = 4
	TYSPEC_PACKAGENAME = 5
	TYSPEC_OBJECTID = 6
End Enum

/* [public] */ Type uCLSSPEC
	tyspec As DWord
	/* [switch_type] */ 'tagged_union As Union
		'clsid As CLSID
		'pFileExt As LPOLESTR
		'pMimeType As LPOLESTR
		'pProgId As LPOLESTR
		'pFileName As LPOLESTR
		'ByName As Type
			'pPackageName As LPOLESTR
			'PolicyId As GUID
		'End Type
		'ByObjectId As Type
			ObjectId As GUID
			PolicyId As GUID
		'End Type
'	End Union
End Type

'extern RPC_IF_HANDLE __MIDL_itf_wtypes_0000_0001_v0_0_c_ifspec
'extern RPC_IF_HANDLE __MIDL_itf_wtypes_0000_0001_v0_0_s_ifspec
