Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/CType/CType.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/CType/CType.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/CType/CType.ab	(revision 506)
@@ -0,0 +1,260 @@
+/*!
+@file	Classes/ActiveBasic/CType/CType.ab
+@brief	ASCII文字分類関数群
+@author	Egtra
+@date	2007/11/25
+*/
+
+Namespace ActiveBasic
+Namespace CType
+
+Namespace Detail
+
+Function Widen(c As CHAR) As WCHAR
+	Return c As Byte As WCHAR
+End Function
+
+Function Narrow(c As WCHAR) As CHAR
+	Return c As Byte As CHAR
+End Function
+
+End Namespace 'Detail
+
+/*!
+@brief	ASCIIのアルファベットまたは数字かどうか
+@author	Egtra
+@date	2007/11/25
+*/
+Function IsAlnum(c As WCHAR) As Boolean
+	Return IsUpper(c) Or IsLower(c) Or IsDigit(c)
+End Function
+
+/*!
+@brief	ASCIIのアルファベットかどうか
+@author	Egtra
+@date	2007/11/25
+*/
+Function IsAlpha(c As WCHAR) As Boolean
+	Return IsUpper(c) Or IsLower(c)
+End Function
+
+/*!
+@brief	ASCIIの行内に置ける空白文字かどうか
+@author	Egtra
+@date	2007/11/25
+ようするにASCIIでは空白とタブ
+*/
+Function IsBlank(c As WCHAR) As Boolean
+	Return c = &h20 Or c = &h09 'space or tab
+End Function
+
+/*!
+@brief	ASCIIの制御文字かどうか
+@author	Egtra
+@date	2007/11/25
+*/
+Function IsCntrl(c As WCHAR) As Boolean
+	Return c < &h20 Or c = &h7f
+End Function
+
+/*!
+@brief	ASCIIの数字かどうか
+@author	Egtra
+@date	2007/11/25
+*/
+Function IsDigit(c As WCHAR) As Boolean
+	Return (c As DWord Xor &h30) < 10
+End Function
+
+/*!
+@brief	ASCIIの図形文字かどうか
+@author	Egtra
+@date	2007/11/25
+図形文字とは、空白以外の表示文字
+*/
+Function IsGraph(c As WCHAR) As Boolean
+	Return (c As DWord - &h21) < (&h7e - &h21)
+End Function
+
+/*!
+@brief	ASCIIのアルファベッの小文字かどうか
+@author	Egtra
+@date	2007/11/25
+*/
+Function IsLower(c As WCHAR) As Boolean
+	Return c As DWord - &h61 < 26 ' &h61 = Asc("a")
+End Function
+
+/*!
+@brief	ASCIIの表示文字かどうか
+@author	Egtra
+@date	2007/11/25
+制御文字でないもの、空白も表示文字に含む
+*/
+Function IsPrint(c As WCHAR) As Boolean
+	Return (c As DWord - &h20) < (&h7e - &h20)
+End Function
+
+/*!
+@brief	ASCIIの区切り数字かどうか
+@author	Egtra
+@date	2007/11/25
+アルファベットでも数字でもない図形文字のこと
+*/
+Function IsPunct(c As WCHAR) As Boolean
+	Return c < &h7f And IsGraph(c) And (Not IsAlnum(c))
+End Function
+
+/*!
+@brief	ASCIIの空白文字かどうか
+@author	Egtra
+@date	2008/01/22
+*/
+Function IsSpace(c As WCHAR) As Boolean
+	Return c As DWord - 9 < 4 Or c = &h20 ' &h41 = Asc("A")
+End Function
+
+/*!
+@brief	ASCIIのアルファベットの大文字かどうか
+@author	Egtra
+@date	2007/11/25
+*/
+Function IsUpper(c As WCHAR) As Boolean
+	Return c As DWord - &h41 < 26 ' &h41 = Asc("A")
+End Function
+
+/*!
+@brief	ASCIIの十六進法で記す際に用いられる文字かどうか
+@author	Egtra
+@date	2007/11/25
+*/
+Function IsXDigit(c As WCHAR) As Boolean
+	Return IsDigit(c) Or ((c As DWord And (Not &h20)) - &h41 < 5)
+End Function
+
+/*!
+@brief	ASCIIのアルファベット大文字を小文字にする
+@author	Egtra
+@date	2007/11/25
+*/
+Function ToLower(c As WCHAR) As WCHAR
+	If IsUpper(c) Then
+		Return c Or &h20
+	Else
+		Return c
+	End If
+End Function
+
+/*!
+@brief	ASCIIのアルファベット小文字を大文字にする
+@author	Egtra
+@date	2007/11/25
+*/
+Function ToUpper(c As WCHAR) As WCHAR
+	If IsLower(c) Then
+		Return c And (Not &h20)
+	Else
+		Return c
+	End If
+End Function
+
+/*!
+@overload
+*/
+Function IsAlnum(c As CHAR) As Boolean
+	Return IsAlnum(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsAlpha(c As CHAR) As Boolean
+	Return IsAlpha(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsBlank(c As CHAR) As Boolean
+	Return IsBlank(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsCntrl(c As CHAR) As Boolean
+	Return IsCntrl(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsDigit(c As CHAR) As Boolean
+	Return IsDigit(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsGraph(c As CHAR) As Boolean
+	Return IsGraph(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsLower(c As CHAR) As Boolean
+	Return IsLower(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsPrint(c As CHAR) As Boolean
+	Return IsPrint(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsPunct(c As CHAR) As Boolean
+	Return IsPunct(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsSpace(c As CHAR) As Boolean
+	Return IsSpace(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsUpper(c As CHAR) As Boolean
+	Return IsUpper(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function IsXDigit(c As CHAR) As Boolean
+	Return IsXDigit(Detail.Widen(c))
+End Function
+
+/*!
+@overload
+*/
+Function ToLower(c As CHAR) As CHAR
+	Return Detail.Narrow(ToLower(Detail.Widen(c)))
+End Function
+
+/*!
+@overload
+*/
+Function ToUpper(c As CHAR) As CHAR
+	Return Detail.Narrow(ToUpper(Detail.Widen(c)))
+End Function
+
+End Namespace 'CType
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Core/InterfaceInfo.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Core/InterfaceInfo.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Core/InterfaceInfo.ab	(revision 506)
@@ -0,0 +1,17 @@
+Namespace ActiveBasic
+Namespace Core
+
+
+Class InterfaceInfo
+	__this As VoidPtr
+	__vtbl As VoidPtr
+Public
+	Sub InterfaceInfo( pThis As VoidPtr, pVtbl As VoidPtr )
+		__this = pThis
+		__vtbl = pVtbl
+	End Sub
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Core/TypeInfo.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Core/TypeInfo.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Core/TypeInfo.ab	(revision 506)
@@ -0,0 +1,386 @@
+Namespace ActiveBasic
+Namespace Core
+
+
+' 中間的な実装（継承専用）
+Class TypeBaseImpl
+	Inherits System.TypeInfo
+
+	strNamespace As String
+	name As String
+	fullName As String
+
+	ptrType As TypeBaseImpl
+	ptrLevel As Long
+
+	' メンバ情報
+	memberNames As *String				' 名前リスト
+	memberTypeFullNames As *String		' 型名リスト
+	memberOffsets As *LONG_PTR			' クラスの先頭ポインタからのオフセット値
+	memberCounts As Long				' 個数
+	memberInfosCache As System.Collections.Generic.List<System.Reflection.MemberInfo>
+
+Protected
+
+	baseType As System.TypeInfo
+	'interfaces As f(^^;;;
+
+	Sub TypeBaseImpl( strNamespace As String, name As String, fullName As String )
+		This.strNamespace = strNamespace
+		This.name = name
+		This.fullName = fullName
+		This.baseType = Nothing
+
+		ptrType = Nothing
+		ptrLevel = 0
+	End Sub
+
+	Sub ~TypeBaseImpl()
+	End Sub
+
+	Sub PtrLevelUp()
+		ptrLevel ++
+		fullName = "*" + fullName
+	End Sub
+
+	Function Clone() As TypeBaseImpl
+		Dim result = New TypeBaseImpl( strNamespace, name, fullName )
+		result.SetBaseType( baseType )
+		result.SetMembers( memberNames, memberTypeFullNames, memberOffsets, memberCounts )
+		result.memberInfosCache = This.memberInfosCache
+		result.ptrLevel = This.ptrLevel
+		Return result
+	End Function
+
+Public
+
+	Sub SetMembers( memberNames As *String, memberTypeFullNames As *String, memberOffsets As *LONG_PTR, num As Long )
+		This.memberNames = memberNames
+		This.memberTypeFullNames = memberTypeFullNames
+		This.memberOffsets = memberOffsets
+		This.memberCounts = num
+
+		/*
+		OutputDebugString( Ex"\r\n" )
+		Dim i As Long
+		For i=0 To ELM(num)
+			OutputDebugString( memberNames[i] )
+			OutputDebugString( ", " )
+			OutputDebugString( memberTypeFullNames[i] )
+			OutputDebugString( Ex"\r\n" )
+		Next
+		*/
+	End Sub
+
+	Sub SetBaseType( baseType As System.TypeInfo )
+		This.baseType = baseType
+	End Sub
+
+	Function GetPtrType() As TypeBaseImpl
+		If Object.ReferenceEquals( ptrType, Nothing ) Then
+			Dim clone = This.Clone()
+
+			ptrType = clone
+			ptrType.PtrLevelUp()
+		End If
+		Return ptrType
+	End Function
+
+
+	'----------------------------------------------------------------
+	' Public properties
+	'----------------------------------------------------------------
+
+	Override Function BaseType() As System.TypeInfo
+		Return baseType
+	End Function
+
+	Override Function FullName() As String
+		Return fullName
+	End Function
+
+	Override Function IsArray() As Boolean
+		Return False
+	End Function
+
+	Override Function IsByRef() As Boolean
+		Return False
+	End Function
+
+	Override Function IsClass() As Boolean
+		Return False
+	End Function
+
+	Override Function IsEnum() As Boolean
+		Return False
+	End Function
+
+	Override Function IsInterface() As Boolean
+		Return False
+	End Function
+
+	Override Function IsPointer() As Boolean
+		Return ( ptrLevel > 0 )
+	End Function
+
+	Override Function IsValueType() As Boolean
+		Return False
+	End Function
+
+	Override Function Name() As String
+		Return name
+	End Function
+
+	Override Function Namespace() As String
+		Return strNamespace
+	End Function
+
+
+
+	'----------------------------------------------------------------
+	' Public methods
+	'----------------------------------------------------------------
+
+	Override Function GetMembers() As System.Collections.Generic.List<System.Reflection.MemberInfo>
+		If Object.ReferenceEquals( memberInfosCache, Nothing ) Then
+			' キャッシュにないときは生成する
+			memberInfosCache = New System.Collections.Generic.List
+			Dim i As Long
+			For i=0 To ELM(memberCounts)
+				memberInfosCache.Add( New System.Reflection.MemberInfo( memberNames[i], _System_TypeBase_Search( memberTypeFullNames[i] ), memberOffsets[i] ) )
+			Next
+		End If
+
+		Return memberInfosCache
+	End Function
+
+End Class
+
+
+' 値型を管理するためのクラス
+Class _System_TypeForValueType
+	Inherits TypeBaseImpl
+Public
+	Sub _System_TypeForValueType( name As String )
+		TypeBaseImpl( "", name, name )
+	End Sub
+
+	Override Function IsValueType() As Boolean
+		Return True
+	End Function
+End Class
+
+TypeDef _SYSTEM_CONSTRUCTOR_PROC = *Sub( pThis As *Object )
+TypeDef _SYSTEM_DESTRUCTOR_PROC = *Sub( pThis As *Object )
+
+' クラスを管理するためのクラス
+Class _System_TypeForClass
+	Inherits TypeBaseImpl
+
+	Static Const _SYSTEM_OBJECT_HEAD_SIZE = SizeOf(LONG_PTR) * 4
+
+	size As SIZE_T
+	comVtbl As VoidPtr
+	vtblList As VoidPtr
+	pDefaultConstructor As _SYSTEM_CONSTRUCTOR_PROC
+	pDestructor As _SYSTEM_DESTRUCTOR_PROC
+
+Public
+	referenceOffsets As *Long
+	numOfReference As Long
+
+	Sub _System_TypeForClass( strNamespace As String, name As String, fullName As String, referenceOffsets As *Long, numOfReference As Long )
+		TypeBaseImpl( strNamespace, name, fullName )
+
+		This.referenceOffsets = referenceOffsets
+		This.numOfReference = numOfReference
+	End Sub
+	Sub _System_TypeForClass( strNamespace As String, name As String, fullName As String )
+		TypeBaseImpl( strNamespace, name, fullName )
+	End Sub
+	Sub ~_System_TypeForClass()
+	End Sub
+
+	Sub SetClassInfo( size As SIZE_T, comVtbl As VoidPtr, vtblList As VoidPtr, pDefaultConstructor As _SYSTEM_CONSTRUCTOR_PROC, pDestructor As _SYSTEM_DESTRUCTOR_PROC )
+		This.size = size
+		This.comVtbl = comVtbl
+		This.vtblList = vtblList
+		This.pDefaultConstructor = pDefaultConstructor
+		This.pDestructor = pDestructor
+	End Sub
+
+	Override Function IsClass() As Boolean
+		Return True
+	End Function
+
+
+	Static Function _System_New( typeForClass As ActiveBasic.Core._System_TypeForClass ) As Object
+		If typeForClass.pDefaultConstructor = NULL Then
+			Throw New System.SystemException( "デフォルトコンストラクタを持たないクラスに対して_System_New関数は使えません。" )
+		End If
+
+		' まずはメモリを確保
+		Dim pPtr = _System_GC_malloc_ForObject( typeForClass.size + _SYSTEM_OBJECT_HEAD_SIZE ) As VoidPtr
+
+		' pPtr[0]=オブジェクトの個数
+		Set_LONG_PTR( pPtr, 1 )
+		pPtr += SizeOf(LONG_PTR)
+
+		' pPtr[1]=オブジェクトのサイズ
+		Set_LONG_PTR( pPtr, typeForClass.size )
+		pPtr += SizeOf(LONG_PTR)
+
+		' pPtr[2]=デストラクタの関数ポインタ
+		Set_LONG_PTR( pPtr, typeForClass.pDestructor As LONG_PTR )
+		pPtr += SizeOf(LONG_PTR)
+
+		' pPtr[3]=reserve
+		pPtr += SizeOf(LONG_PTR)
+
+		Dim pObject = pPtr As *Object
+
+		' com_vtblをセット
+		Set_LONG_PTR( pObject, typeForClass.comVtbl As LONG_PTR )
+
+		' vtbl_listをセット
+		Set_LONG_PTR( pObject + SizeOf(LONG_PTR), typeForClass.vtblList As LONG_PTR )
+
+		' 動的型情報をセットする
+		pObject->_System_SetType( typeForClass )
+
+		' コンストラクタを呼び出す
+		Dim proc = typeForClass.pDefaultConstructor
+		proc( pObject )
+
+		Return ByVal pObject
+	End Function
+End Class
+
+' インターフェイスを管理するためのクラス
+Class _System_TypeForInterface
+	Inherits TypeBaseImpl
+Public
+End Class
+
+' 列挙体を管理するためのクラス
+Class _System_TypeForEnum
+	Inherits TypeBaseImpl
+Public
+End Class
+
+' デリゲートを管理するためのクラス
+Class _System_TypeForDelegate
+	Inherits TypeBaseImpl
+Public
+End Class
+
+
+'--------------------------------------------------------------------
+' プロセスに存在するすべての型を管理する
+'--------------------------------------------------------------------
+Class _System_TypeBase
+	Static types As System.Collections.Generic.Dictionary<String, TypeBaseImpl>
+
+	Static isReady = False
+
+	Static Sub Add( typeInfo As TypeBaseImpl )
+		types.Add( typeInfo.FullName, typeInfo )
+	End Sub
+
+	Static Sub InitializeValueType()
+		types = New System.Collections.Generic.Dictionary<String, TypeBaseImpl>(8191)
+
+		' 値型の追加
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "Byte", fullName = "Byte" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "SByte", fullName = "SByte" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "Word", fullName = "Word" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "Integer", fullName = "Integer" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "DWord", fullName = "DWord" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "Long", fullName = "Long" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "QWord", fullName = "QWord" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "Int64", fullName = "Int64" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "Boolean", fullName = "Boolean" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "Single", fullName = "Single" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "Double", fullName = "Double" ] )
+		Add( _System_Static_New _System_TypeForValueType[ strNamespace = "", name = "VoidPtr", fullName = "VoidPtr" ] )
+	End Sub
+
+	Static Sub InitializeUserTypes()
+		' このメソッドの実装はコンパイラが自動生成する
+
+		'例:
+		'Add( New _System_TypeForClass( "System", "String", "System.String", [__offsets...], __numOfOffsets ) )
+		'...
+	End Sub
+	Static Sub InitializeUserTypesForBaseType()
+		' このメソッドの実装はコンパイラが自動生成する
+
+		'例:
+		'Search( "System.String" ).SetBaseType( Search( "System.Object" ) )
+		'...
+	End Sub
+
+Public
+	Static Sub Initialize()
+		' 値型を初期化
+		InitializeValueType()
+
+		' Class / Interface / Enum / Delegate を初期化
+		InitializeUserTypes()
+
+		isReady = True
+
+		' 基底クラスを登録
+		InitializeUserTypesForBaseType()
+
+		selfTypeInfo = _System_TypeBase.Search( "System.TypeInfo" ) As System.TypeInfo
+
+		_System_DebugOnly_OutputDebugString( Ex"ready dynamic meta datas!\r\n" )
+	End Sub
+
+	Static Sub _NextPointerForGC()
+		' TODO: 実装
+	End Sub
+
+	Static Function Search( fullName As String ) As TypeBaseImpl
+		If Object.ReferenceEquals(types, Nothing) Then
+			Return Nothing
+		End If
+
+		If isReady = False Then
+			Return Nothing
+		End If
+
+		If fullName[0] = &H2A Then		' fullName[0] = '*'
+			Dim result = Search( fullName.Substring( 1 ) )
+			Return result.GetPtrType()
+		End If
+
+		Search = types.Item(fullName)
+
+		If Object.ReferenceEquals( Search, Nothing ) Then
+			OutputDebugString("TypeSearch Failed: ")
+			If Not ActiveBasic.IsNothing(fullName) Then
+				OutputDebugStringW(StrPtr(fullName) As PWSTR)
+				OutputDebugString(Ex"\r\n")
+				OutputDebugStringA(StrPtr(fullName) As PSTR)
+			End If
+			OutputDebugString(Ex"\r\n")
+		End If
+	End Function
+
+	Static Function IsReady() As Boolean
+		Return isReady
+	End Function
+
+	Static selfTypeInfo As System.TypeInfo
+
+End Class
+
+
+End Namespace
+End Namespace
+
+Function _System_TypeBase_Search( fullName As String ) As ActiveBasic.Core.TypeBaseImpl
+	Return ActiveBasic.Core._System_TypeBase.Search( fullName )
+End Function
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Math/Math.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Math/Math.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Math/Math.ab	(revision 506)
@@ -0,0 +1,144 @@
+'Classes/ActiveBasic/Math/Math.ab
+
+Namespace ActiveBasic
+Namespace Math
+
+'xの符号だけをyのものにした値を返す。
+'引数 x 元となる絶対値
+'引数 y 元となる符号
+Function CopySign(x As Double, y As Double) As Double
+	SetQWord(VarPtr(CopySign), (GetQWord(VarPtr(x)) And &h7fffffffffffffff) Or (GetQWord(VarPtr(y)) And &h8000000000000000))
+End Function
+
+Function CopySign(x As Single, y As Single) As Single
+	SetDWord(VarPtr(CopySign), (GetDWord(VarPtr(x)) And &h7fffffff) Or (GetDWord(VarPtr(y)) And &h80000000))
+End Function
+
+Function Hypot(x As Double, y As Double) As Double
+	If x = 0 Then
+		Hypot = Abs(y)
+	Else If y = 0 Then
+		Hypot = Abs(x)
+	Else
+		Dim ax = Abs(x)
+		Dim ay = Abs(y)
+		If ay > ax Then
+			Dim t = x / y
+			Hypot = ay * Sqr(1 + t * t)
+		Else
+			Dim t = y / x
+			Hypot = ax * Sqr(1 + t * t)
+		End If
+	End If
+End Function
+
+Function Log1p(x As Double) As Double
+	If x < -1 Or IsNaN(x) Then
+		Log1p = ActiveBasic.Math.Detail.GetNaN()
+	ElseIf x = 0 Then
+		x = 0
+	ElseIf IsInf(x) Then
+		Log1p = x
+	Else
+		Log1p = ActiveBasic.Math.Detail.Log1p(x)
+	End If
+End Function
+
+Function IsNaN(ByVal x As Double) As Boolean
+	Dim p = VarPtr(x) As *DWord
+	IsNaN = False
+	If (p[1] And &H7FF00000) = &H7FF00000 Then
+		If (p[0] <> 0) Or ((p[1] And &HFFFFF) <> 0) Then
+			IsNaN = True
+		End If
+	End If
+End Function
+
+Function IsInf(x As Double) As Boolean
+	Dim p = VarPtr(x) As *DWord
+	p[1] And= &h7fffffff
+	Dim inf = ActiveBasic.Math.Detail.GetInf(False)
+	IsInf = (memcmp(p As *Byte, VarPtr(inf), SizeOf (Double)) = 0)
+End Function
+
+Function IsFinite(x As Double) As Boolean
+	Dim p = VarPtr(x) As *DWord
+	p[1] And= &H7FF00000
+	IsFinite = ( p[1] And &H7FF00000 ) = &H7FF00000
+End Function
+
+Namespace Detail
+
+Function SetSign(x As Double, isNegative As Long) As Double
+#ifdef _WIN64
+	SetQWord(AddressOf(CopySign), (GetQWord(VarPtr(x)) And &h7fffffffffffffff) Or (isNegative << 63))
+#else
+	SetDWord(AddressOf(CopySign), GetDWord(VarPtr(x)))
+	SetDWord(AddressOf(CopySign) + SizeOf (DWord), GetQWord(VarPtr(x) + SizeOf (DWord)) And &h7fffffff Or (isNegative << 31))
+#endif
+End Function
+
+#ifdef _WIN64
+
+Function GetNaN() As Double
+	SetQWord(VarPtr(GetNaN) As *QWord, &H7FF8000000000000)
+End Function
+
+Function GetInf(sign As Boolean) As Double
+	Dim s = 0 As QWord
+	If sign Then s = 1 << 63
+	SetQWord(VarPtr(GetInf) As *QWord, &h7FF0000000000000 Or s)
+End Function
+
+#else
+
+Function GetNaN() As Double
+	Dim p = VarPtr(GetNaN) As *DWord
+	p[0] = 0
+	p[1] = &H7FF80000
+End Function
+
+Function GetInf(sign As Boolean) As Double
+	Dim s = 0 As DWord
+	If sign Then s = (1 As DWord) << 31
+	Dim p = VarPtr(GetInf) As *DWord
+	p[0] = 0
+	p[1] = &h7FF00000 Or s
+End Function
+
+#endif
+
+Function Log1p(x As Double) As Double
+	Dim s = 0 As Double
+	Dim i = 7 As Long
+	While i >= 1
+		Dim t = (i * x) As Double
+		s = t * (2 * i + 1 + s) / (2 + t)
+		i--
+	Wend
+	Return x / (1 + s)
+End Function
+
+Function _Support_tan(x As Double, ByRef k As Long) As Double
+	If x>=0 Then
+		k=Fix(x/(_System_PI/2)+0.5)
+	Else
+		k=Fix(x/(_System_PI/2)-0.5)
+	End If
+
+	x=(x-(CDbl(3217)/CDbl(2048))*k)+4.4544551033807686783083602485579e-6*k
+
+	Dim x2 = x * x
+	Dim t = 0 As Double
+
+	Dim i As Long
+	For i=19 To 3 Step -2
+		t=x2/(i-t)
+	Next
+
+	_Support_tan=x/(1-t)
+End Function
+
+End Namespace 'Detail
+End Namespace 'Math
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Strings/SPrintF.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Strings/SPrintF.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Strings/SPrintF.ab	(revision 506)
@@ -0,0 +1,1724 @@
+/*!
+@file Include/Classes/ActiveBasic/Strings/SPrintF.ab
+@brief SPrintfとその補助ルーチンが含まれるファイル。
+
+SPrintfで数値変換が行われるとき、呼出の階層は、
+SPrintf→FormatInteger, FormatFloat→FormatIntegerEx, FormatFloatExとなる。
+
+また、次のような変換ルーチンが存在する。
+@li FormatFloatE
+@li FormatFloatF
+@li FormatFloatG
+@li FormatFloatA
+@li FormatIntegerD
+@li FormatIntegerU
+@li FormatIntegerO
+@li FormatIntegerX
+@li FormatCharacter
+@li FormatString
+*/
+
+Namespace ActiveBasic
+Namespace Strings
+
+Namespace Detail
+
+/*!
+@brief	浮動小数点数を文字列化する低水準な関数。符号、指数、仮数に分けて出力。
+@author	Egtra
+@date	2007/09/18
+@param[in]	x	文字列化する浮動小数点数
+@param[out]	e	指数
+@param[out]	sign	符号
+@return 仮数
+仮数は1の位から下へ17桁で、小数点を含まない。そのため、誤差を無視すればVal(仮数) * 10 ^ (e - 17) = Abs(x)が成り立つ。
+
+xに無限大、非数を渡した場合の動作は未定義。
+*/
+Function FloatToChars(x As Double, ByRef e As Long, ByRef sign As Boolean) As String
+	Imports System
+
+	'0を弾く
+	If x = 0 Then
+		If GetQWord(VarPtr(x) As *QWord) And &h8000000000000000 Then
+			sign = True
+		Else
+			sign = False
+		End If
+
+		e = 0
+		FloatToChars = "00000000000000000"
+		Exit Function
+	End If
+
+	'符号の判断（同時に符号を取り除く）
+	If x < 0 Then
+		sign = True
+		x = -x
+	Else
+		sign = False
+	End If
+
+	'1e16 <= x < 1e17へ正規化
+	'(元のx) = (正規化後のx) ^ (d - 17)である。
+	Dim d = Math.Floor(Math.Log10(x)) As Long
+	If d < 16 Then
+		x *= ipow(10, +17 - d)
+	ElseIf d > 16 Then
+		x /= ipow(10, -17 + d)
+	End If
+
+	'補正
+	While x < 1e16
+		x *= 10
+		d--
+	Wend
+	While x >= 1e17
+		x /= 10
+		d++
+	Wend
+
+	d--
+	e = d
+
+	FloatToChars = FormatIntegerLU((x As Int64) As QWord, 17, 0, None)
+End Function
+
+/*!
+@brief	書式化関数群で使用するフラグ。
+@author	Egtra
+@date	2007/09/18
+*/
+Const Enum FormatFlags
+	'! 何も指定がない。
+	None = &h0
+	/*!
+	符号、+。符号付変換[diAaEeFfGg]のとき、正の値でも符号を付ける。
+	AdjustFieldWidthの仕様から、Format関数郡内からAdjustFieldWidthにかけて、
+	単に数値が符号付である（負の値である）ことを示す意味でも用いられる。
+	*/
+	Sign = &h1
+	/*! 空白、空白文字。
+	符号付変換[diAaEeFfGg]のとき、正の値ならば符号分の空白を開ける。Signが立っているときには無視される。
+	*/
+	Blank = &h2
+	/*! ゼロ、0。
+	[diouXxAaEeFfGg]で、フィールドの空きを0で埋める。leftが立っているときには無視される。
+	*/
+	Zero = &h4
+	'! 左揃え、-。フィールド内で左揃えにする。
+	LeftSide = &h8
+	/*! 代替表記、#。
+	@li [OoXx]では、値が0でない場合、先頭に0、0xを付ける。</ul>
+	@li [AaEeFfGg]では、精度0でも小数点を付ける。</ul>
+	@li [Gg]では、それに加え、小数部末尾の0の省略を行わないようにする。</ul>
+	*/
+	Alt = &h10
+	'! 大文字。使用するアルファベットを大文字にする。[aefgx]を[AEFGX]化する。
+	Cap = &h20
+
+	'!BASIC接頭辞。&h, &oなど。
+	BPrefix = &h40
+
+	/*!
+	内部処理用に予約。
+	@note	Minusとして使用されている。
+	*/
+	Reserved = &h80000000
+End Enum
+
+/*!
+@brief	浮動小数点数をprintfの%e, %E（指数形式、十進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2007/09/18
+@param[in] x	文字列化する浮動小数点数値。
+@param[in] precision	精度。小数点以下の桁数。DWORD_MAXのとき、指定なしとして既定値6となる。
+@param[in] field	フィールド幅。
+@param[in] flags	書式フラグ。
+@return	xの文字列表現
+*/
+Function FormatFloatE(x As Double, precision As DWord, field As DWord, flags As FormatFlags) As String
+	FormatFloatE = FormatFloatEx(AddressOf(FormatFloatE_Convert), x, precision, field, flags)
+End Function
+
+/*
+@brief	浮動小数点数をprintfの%e, %E（指数形式、十進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2008/03/08
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in] x	文字列化する浮動小数点数値。
+@param[in] precision	精度。小数点以下の桁数。DWORD_MAXのとき、指定なしとして既定値6となる。
+@param[in] field	フィールド幅。
+@param[in] flags	書式フラグ。
+*/
+Sub FormatFloatE(sb As System.Text.StringBuilder, x As Double, precision As DWord, field As DWord, ByRef flags As FormatFlags)
+	FormatFloatEx(sb, AddressOf(FormatFloatE_Convert), x, precision, field, flags)
+End Sub
+
+/*!
+@brief	浮動小数点数をprintfの%e, %E（指数形式、十進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2008/03/07
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in] x	文字列化する浮動小数点数値。
+@param[in] precision	精度。小数点以下の桁数。DWORD_MAXのとき、指定なしとして15となる。
+@param[in] field	フィールド幅。
+@param[in,out] flags	書式フラグ。
+@todo	他の実装での末尾桁の扱いを調べる（このコードでは何もしていないので切捨となっている）。
+*/
+Sub FormatFloatE_Convert(sb As System.Text.StringBuilder, x As Double, precision As DWord, field As DWord, ByRef flags As FormatFlags)
+	If precision = DWORD_MAX Then
+		precision = 15
+	End If
+	Dim e As Long, negative As Boolean
+	Dim s = FloatToChars(x, e, negative)
+	FormatFloatE_Base(sb, s, negative, precision, flags)
+	FormatFloatE_Exponent(sb, e, flags)
+End Sub
+
+/**
+@brief	FormatFloatEの符号・基数部の出力用。
+@author	Egtra
+@date	2007/10/27
+*/
+Sub FormatFloatE_Base(sb As System.Text.StringBuilder, s As String, negative As Boolean, precision As DWord, ByRef flags As FormatFlags)
+	With sb
+		AppendSign(sb, negative, flags)
+		.Append(s[0])
+		If (flags And Alt) Or precision > 0 Then
+			.Append(".")
+			Dim outputLen = s.Length - 1
+			If outputLen >= precision Then
+				.Append(s, 1, precision)
+			Else 'sで用意された桁が指定された精度より少ないとき
+				.Append(s, 1, outputLen)
+				.Append(&h30 As Char, precision - outputLen) '足りない桁は0埋め
+			End If
+		End If
+	End With
+End Sub
+
+/**
+@brief	FormatFloatEの指数部の出力用。
+@author	Egtra
+@date	2007/10/27
+*/
+Sub FormatFloatE_Exponent(sb As System.Text.StringBuilder, e As Long, flags As FormatFlags)
+	With sb
+		If flags And Cap Then
+			.Append("E")
+		Else
+			.Append("e")
+		End If
+		FormatIntegerD(sb, e, 2, 0, Sign Or Zero)
+	End With
+End Sub
+
+/*!
+@brief	浮動小数点数をprintfの%f（小数形式、十進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2007/10/23
+@param[in]	x	文字列化する浮動小数点数値。
+@param[in]	precision	精度。小数点以下の桁数。DWORD_MAXのとき、指定なしとして既定値15となる。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+@return xの文字列表現
+*/
+Function FormatFloatF(x As Double, precision As DWord, field As DWord, flags As FormatFlags) As String
+	FormatFloatF = FormatFloatEx(AddressOf(FormatFloatF_Convert), x, precision, field, flags)
+End Function
+
+/*
+@brief	浮動小数点数をprintfの%f（小数形式、十進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2008/03/08
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in] x	文字列化する浮動小数点数値。
+@param[in] precision	精度。小数点以下の桁数。DWORD_MAXのとき、指定なしとして既定値6となる。
+@param[in] field	フィールド幅。
+@param[in] flags	書式フラグ。
+*/
+Sub FormatFloatF(sb As System.Text.StringBuilder, x As Double, precision As DWord, field As DWord, ByRef flags As FormatFlags)
+	FormatFloatEx(sb, AddressOf(FormatFloatF_Convert), x, precision, field, flags)
+End Sub
+
+/*!
+@brief	浮動小数点数をprintfの%f（小数形式、十進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2008/03/07
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in]	x	文字列化する浮動小数点数値。
+@param[in]	precision	精度。小数点以下の桁数。DWORD_MAXのとき、指定なしとして既定値15となる。
+@param[in]	field	フィールド幅。
+@param[in,out]	flags	書式フラグ。
+*/
+Sub FormatFloatF_Convert(sb As System.Text.StringBuilder, x As Double, precision As DWord, field As DWord, ByRef flags As FormatFlags)
+	If precision = DWORD_MAX Then
+		precision = 15
+	End If
+	Dim e As Long, negative As Boolean
+	Dim s = FloatToChars(x, e, negative)
+	FormatFloatF_Core(sb, s, e, negative, precision, flags)
+End Sub
+
+/**
+@author	Egtra
+@date	2007/10/27
+*/
+Sub FormatFloatF_Core(sb As System.Text.StringBuilder, s As String, e As Long, negative As Boolean, precision As DWord, ByRef flags As FormatFlags)
+	With sb
+		AppendSign(sb, negative, flags)
+
+		Dim intPartLen = e + 1
+		Dim outputDigit = 0 As DWord
+		If intPartLen >= 17 Then
+			'有効桁が全て整数部に収まる場合
+			.Append(s)
+			.Append(&h30 As Char, intPartLen - 17)
+			outputDigit = 17
+		ElseIf intPartLen > 0 Then
+			'有効桁の一部が整数部にかかる場合
+			.Append(s, 0, intPartLen)
+			outputDigit = intPartLen
+		Else
+			'有効桁が全く整数部にかからない場合
+			.Append(&h30 As Char)
+		End If
+
+		If precision > 0 Or (flags And Alt) Then
+			.Append(".")
+
+			Dim lastDigit = s.Length - outputDigit
+			If lastDigit >= precision Then '変換して得られた文字列の桁数が精度以上ある場合
+				Dim zeroDigit = 0
+				If intPartLen < 0 Then
+					'1.23e-4 = 0.000123のように指数が負のため小数点以下に0が続く場合
+					zeroDigit = System.Math.Min(-intPartLen As DWord, precision)
+					.Append(&h30 As Char, zeroDigit As Long)
+				End If
+				.Append(s, outputDigit, (precision - zeroDigit) As Long)
+			Else
+				.Append(s, outputDigit, lastDigit)
+				.Append(&h30 As Char, (precision - lastDigit) As Long) '残りの桁は0埋め
+			End If
+		End If
+	End With
+End Sub
+
+/*!
+@brief	浮動小数点数をprintfの%g, %G（小数・指数、十進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2007/10/23
+@param[in]	x	文字列化する浮動小数点数値。
+@param[in]	precision	精度。小数点以下の桁数。DWORD_MAXまたは0のとき、指定なしとして既定値15となる。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+@return xの文字列表現
+@todo	下位桁の扱いの調査。
+*/
+Function FormatFloatG(x As Double, precision As DWord, field As DWord, flags As FormatFlags) As String
+	FormatFloatG = FormatFloatEx(AddressOf(FormatFloatG_Convert), x, precision, field, flags)
+End Function
+
+/*
+@brief	浮動小数点数をprintfの%g, %G（小数・指数、十進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2008/03/08
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in] x	文字列化する浮動小数点数値。
+@param[in] precision	精度。小数点以下の桁数。DWORD_MAXのとき、指定なしとして既定値6となる。
+@param[in] field	フィールド幅。
+@param[in] flags	書式フラグ。
+*/
+Sub FormatFloatG(sb As System.Text.StringBuilder, x As Double, precision As DWord, field As DWord, ByRef flags As FormatFlags)
+	FormatFloatEx(sb, AddressOf(FormatFloatG_Convert), x, precision, field, flags)
+End Sub
+
+/*!
+@brief	浮動小数点数をprintfの%g, %G（小数・指数、十進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2007/10/23
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in]	x	文字列化する浮動小数点数値。
+@param[in]	precision	精度。小数点以下の桁数。DWORD_MAXまたは0のとき、指定なしとして既定値15となる。
+@param[in]	field	フィールド幅。
+@param[in,out]	flags	書式フラグ。
+@todo	下位桁の扱いの調査。
+*/
+Sub FormatFloatG_Convert(sb As System.Text.StringBuilder, x As Double, precision As DWord, field As DWord, ByRef flags As FormatFlags)
+	'GではE/Fと違い整数部も有効桁数に数えるのでその分を引いておく。
+	If precision = DWORD_MAX Or precision = 0 Then
+		precision = 14
+	Else
+		precision--
+	End If
+	Dim lastLength = sb.Length
+	Dim e As Long, negative As Boolean
+	Dim s = FloatToChars(x, e, negative)
+	If -5 < e And e < precision Then
+		FormatFloatF_Core(sb, s, e, negative, -e + precision, flags)
+		FormatFloatG_RemoveLowDigit(sb, lastLength, flags)
+	Else
+		FormatFloatE_Base(sb, s, negative, precision, flags)
+		FormatFloatG_RemoveLowDigit(sb, lastLength, flags)
+		FormatFloatE_Exponent(sb, e, flags)
+	End If
+End Sub
+
+/*!
+@brief	FormatFloatG/A用の小数点以下末尾の0を削除するルーチン
+@author	Egtra
+@date	2007/10/27
+@param[in, out]	sb 文字列バッファ
+@param[in]	flags フラグ
+flagsでAltが立っているとき、この関数は何もしない。
+*/
+Sub FormatFloatG_RemoveLowDigit(sb As System.Text.StringBuilder, start As Long, flags As FormatFlags)
+	Imports ActiveBasic.Strings
+	
+	Dim count = sb.Length
+	If (flags And Alt) = 0 Then
+		Dim p = StrPtr(sb)
+		Dim point = ChrFind(VarPtr(p[start]), (count - start) As SIZE_T, Asc("."))
+		If point = -1 Then
+			Debug
+		End If
+
+		Dim i As Long
+		For i = count - 1 To point + 1 Step -1
+			If sb[i] <> &h30 Then
+				Exit For
+			End If
+		Next
+		If i <> point Then
+			i++
+		End If
+		sb.Length = i
+	End If
+End Sub
+
+/*!
+@brief	浮動小数点数をprintfの%a, %A（指数形式、十六進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2007/09/18
+@param[in] x	文字列化する浮動小数点数値。
+@param[in] precision	精度。小数点以下の桁数。DWORD_MAXのとき、指定なしとして既定値13となる。
+@param[in] field	フィールド幅。
+@param[in] flags	書式フラグ。
+@return	xの文字列表現
+
+C99では、末尾の0を取り除いても良いとあるので、
+このルーチンでは取り除くことにしている。
+*/
+Function FormatFloatA(x As Double, precision As DWord, field As DWord, flags As FormatFlags) As String
+	FormatFloatA = FormatFloatEx(AddressOf(FormatFloatA_Convert), x, precision, field, flags)
+End Function
+
+/*
+@brief	浮動小数点数をprintfの%a, %A（指数形式、十六進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2008/03/08
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in] x	文字列化する浮動小数点数値。
+@param[in] precision	精度。小数点以下の桁数。DWORD_MAXのとき、指定なしとして既定値6となる。
+@param[in] field	フィールド幅。
+@param[in] flags	書式フラグ。
+*/
+Sub FormatFloatA(sb As System.Text.StringBuilder, x As Double, precision As DWord, field As DWord, ByRef flags As FormatFlags)
+	FormatFloatEx(sb, AddressOf(FormatFloatA_Convert), x, precision, field, flags)
+End Sub
+
+/*!
+@brief	浮動小数点数をprintfの%a, %A（指数形式、十六進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2008/03/07
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in] x	文字列化する浮動小数点数値。
+@param[in] precision	精度。小数点以下の桁数。DWORD_MAXのとき、指定なしとして既定値13となる。
+@param[in] field	フィールド幅。
+@param[in,out] flags	書式フラグ。
+
+C99では、末尾の0を取り除いても良いとあるので、
+このルーチンでは取り除くことにしている。
+*/
+Sub FormatFloatA_Convert(sb As System.Text.StringBuilder, x As Double, precision As DWord, field As DWord, ByRef flags As FormatFlags)
+	If precision = DWORD_MAX Then
+		precision = 13
+	End If
+	Dim lastLength = sb.Length
+	Dim pqw = VarPtr(x) As *QWord
+
+	With sb
+		Dim sign = (GetQWord(pqw) And &H8000000000000000) As Boolean
+		pqw[0] And= &h7fffffffffffffff
+
+		AppendSign(sb, sign, flags)
+
+		If flags And BPrefix Then
+			.Append("&H")
+		Else
+			.Append("0X")
+		End If
+
+		Dim biasedExp = (GetQWord(pqw) >> 52) As DWord And &h7FF
+		Dim exp As Long
+		If biasedExp = 0 Then
+			If GetQWord(pqw) <> 0 Then
+				exp = -1022 '非正規化数への対応
+			Else
+				exp = 0
+			End If
+			.Append("0")
+		Else
+			exp = biasedExp - 1023
+			.Append("1")
+		End If
+
+		If precision > 0 Or (flags And Alt) Then
+			.Append(".")
+			Dim fraction = GetQWord(pqw) And &h000fffffffffffff
+			If precision < 13 Then
+				Dim dropped = 13 - precision
+				fraction >>= dropped * 4
+				FormatIntegerLX(sb, fraction, precision, 0, flags And Cap)
+			Else
+				FormatIntegerLX(sb, fraction, 13, 0, flags And Cap)
+				.Append(&h30, precision - 13)
+			End If
+		End If
+		FormatFloatG_RemoveLowDigit(sb, lastLength, flags)
+		.Append("P")
+		FormatIntegerD(sb, exp, 1, 0, Sign)
+		AdjustAlphabet(sb, flags, lastLength)
+	End With
+End Sub
+
+/*!
+@brief 先頭に符号もしくはその分の空白を出力する。FormatFloat用。
+@author	Egtra
+@date 2007/10/23
+@param[in, out] sb	出力先
+@param[in] negative	符号
+@param[in, out] flags	フラグ。negative = Trueなら、Signを立てて返す。
+*/
+Sub AppendSign(sb As System.Text.StringBuilder, negative As Boolean, ByRef flags As FormatFlags)
+	With sb
+		If negative Then
+			.Append("-")
+			flags Or= Sign
+		Else
+			If flags And Sign Then
+				.Append("+")
+			ElseIf flags And Blank Then
+				.Append(" ")
+			End If
+		End If
+	End With
+End Sub
+
+/*!
+@brief	符号無し整数をprintfの%u（十進法表現）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2007/09/18
+@param[in]	x	文字列化する整数値。
+@param[in]	d	精度、最小限表示される桁数。DWORD_MAXのとき、指定なしとして、既定値1となる。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+@return xの文字列表現
+*/
+Function FormatIntegerU(x As DWord, d As DWord, field As DWord, flags As FormatFlags) As String
+	Return FormatIntegerEx(TraitsIntegerU[0], x, d, field, flags And (Not (Sign Or Blank)))
+End Function
+
+/*!
+@brief	符号無し整数をprintfの%u（十進法表現）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2008/03/07
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in]	x	文字列化する整数値。
+@param[in]	d	精度、最小限表示される桁数。DWORD_MAXのとき、指定なしとして、既定値1となる。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+*/
+Sub FormatIntegerU(sb As System.Text.StringBuilder, x As DWord, d As DWord, field As DWord, flags As FormatFlags)
+	FormatIntegerEx(sb, TraitsIntegerU[0], x As QWord, d, field, flags And (Not (Sign Or Blank)))
+End Sub
+
+/*!
+@brief	FormatIntegerUのQWord版
+@author	Egtra
+@date	2007/10/26
+*/
+Function FormatIntegerLU(x As QWord, d As DWord, field As DWord, flags As FormatFlags) As String
+	Return FormatIntegerEx(TraitsIntegerU[1], x, d, field, flags And (Not (Sign Or Blank)))
+End Function
+
+/*!
+@brief	FormatIntegerUのQWord版
+@author	Egtra
+@date	2008/03/07
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in]	x	文字列化する整数値。
+@param[in]	d	精度、最小限表示される桁数。DWORD_MAXのとき、指定なしとして、既定値1となる。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+*/
+Sub FormatIntegerLU(sb As System.Text.StringBuilder, x As QWord, d As DWord, field As DWord, flags As FormatFlags)
+	FormatIntegerEx(sb, TraitsIntegerU[0], x, d, field, flags And (Not (Sign Or Blank)))
+End Sub
+
+/*!
+@brief	符号有り整数をprintfの%d（十進法表現）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2007/10/13
+@param[in]	x	文字列化する整数値。
+@param[in]	d	精度、最小限表示される桁数。DWORD_MAXのとき、指定なしとして、既定値1となる。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+@return xの文字列表現
+*/
+Function FormatIntegerD(x As Long, d As DWord, field As DWord, flags As FormatFlags) As String
+	Return FormatIntegerEx(TraitsIntegerD[0], (x As Int64) As QWord, d, field, flags)
+End Function
+
+/*!
+@brief	符号有り整数をprintfの%d（十進法表現）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2008/03/07
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in]	x	文字列化する整数値。
+@param[in]	d	精度、最小限表示される桁数。DWORD_MAXのとき、指定なしとして、既定値1となる。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+*/
+Sub FormatIntegerD(sb As System.Text.StringBuilder, x As Long, d As DWord, field As DWord, flags As FormatFlags)
+	FormatIntegerEx(sb, TraitsIntegerD[0], (x As Int64) As QWord, d, field, flags)
+End Sub
+
+/*!
+@brief	FormatIntegerDのInt64版
+@author	Egtra
+@date	2007/10/26
+*/
+Function FormatIntegerLD(x As Int64, d As DWord, field As DWord, flags As FormatFlags) As String
+	Return FormatIntegerEx(TraitsIntegerD[1], x As QWord, d, field, flags)
+End Function
+
+/*!
+@brief	FormatIntegerDのInt64版
+@author	Egtra
+@date	2007/10/26
+*/
+Sub FormatIntegerLD(sb As System.Text.StringBuilder, x As Int64, d As DWord, field As DWord, flags As FormatFlags)
+	FormatIntegerEx(sb, TraitsIntegerD[1], x As QWord, d, field, flags)
+End Sub
+
+/*!
+@author	Egtra
+@date	2007/10/26
+*/
+Dim TraitsIntegerU[1] As IntegerConvertTraits
+With TraitsIntegerU[0]
+	.Convert = AddressOf(IntegerU_Convert)
+	.Prefix = AddressOf(IntegerU_Prefix)
+End With
+
+With TraitsIntegerU[1]
+	.Convert = AddressOf(IntegerLU_Convert)
+	.Prefix = AddressOf(IntegerU_Prefix)
+End With
+
+/*!
+@author	Egtra
+@date	2007/10/28
+*/
+Dim TraitsIntegerD[1] As IntegerConvertTraits
+With TraitsIntegerD[0]
+	.Convert = AddressOf(IntegerD_Convert)
+	.Prefix = AddressOf(IntegerD_Prefix)
+End With
+
+With TraitsIntegerD[1]
+	.Convert = AddressOf(IntegerLD_Convert)
+	.Prefix = AddressOf(IntegerD_Prefix)
+End With
+
+/*!
+@brief	負数を表すフラグ。FormatIntegerD, LDからIntegerDU_Prefixまでの内部処理用。
+@author	Egtra
+@date	2007/10/26
+*/
+Const Minus = Reserved
+
+/*!
+@author	Egtra
+@date	2007/10/26
+*/
+Function IntegerU_Convert(buf As *Char, xq As QWord, flags As FormatFlags) As DWord
+	Dim x = xq As DWord
+	Dim i = MaxSizeLO
+	While x <> 0
+		buf[i] = (x As Int64 Mod 10 + &h30) As Char 'Int64への型変換は#117対策
+		x \= 10
+		i--
+	Wend
+	Return i
+End Function
+
+/*!
+@brief	IntegerU_ConvertのQWord版
+@author	Egtra
+@date	2007/10/26
+@bug	#117のため、現在Int64の最大値を超える値を正しく処理できない。
+*/
+Function IntegerLU_Convert(buf As *Char, x As QWord, flags As FormatFlags) As DWord
+	Dim i = MaxSizeLO
+	While x <> 0
+		buf[i] = (x As Int64 Mod 10 + &h30) As Char 'Int64への型変換は#117対策
+		x \= 10
+		i--
+	Wend
+	Return i
+End Function
+
+/*!
+@author	Egtra
+@date	2007/10/26
+*/
+Function IntegerU_Prefix(x As QWord, flags As FormatFlags) As String
+End Function
+
+/*!
+@author	Egtra
+@date	2007/10/28
+*/
+Function IntegerD_Convert(buf As *Char, xq As QWord, flags As FormatFlags) As DWord
+	Return IntegerU_Convert(buf, Abs((xq As DWord) As Long) As DWord, flags)
+End Function
+
+/*!
+@brief	IntegerD_ConvertのInt64版
+@author	Egtra
+@date	2007/10/28
+*/
+Function IntegerLD_Convert(buf As *Char, x As QWord, flags As FormatFlags) As DWord
+	Return IntegerLU_Convert(buf, Abs(x As Int64) As QWord, flags)
+End Function
+
+/*!
+@author	Egtra
+@date	2007/10/28
+*/
+Function IntegerD_Prefix(x As QWord, flags As FormatFlags) As String
+	If (x As Int64) < 0 Then
+		IntegerD_Prefix = "-"
+	ElseIf flags And Sign Then
+		IntegerD_Prefix = "+"
+	ElseIf flags And Blank Then
+		IntegerD_Prefix = " "
+	End If
+End Function
+
+
+
+/*!
+@brief	QWordの最大値の八進法表現1777777777777777777777の文字数 - 1 + 1。IntegerO_Convert内で使用。
+@author	Egtra
+@date	2007/10/26
+上の式で1を加えているのは、八進接頭辞の分。
+*/
+Const MaxSizeLO = 22
+
+/*!
+@author	Egtra
+@date	2007/10/22
+*/
+Dim TraitsIntegerO[1] As IntegerConvertTraits
+With TraitsIntegerO[0]
+	.Convert = AddressOf(IntegerO_Convert)
+	.Prefix = AddressOf(IntegerO_Prefix)
+End With
+
+With TraitsIntegerO[1]
+	.Convert = AddressOf(IntegerLO_Convert)
+	.Prefix = AddressOf(IntegerO_Prefix)
+End With
+
+/*!
+@brief	符号無し整数をprintfの%o（八進法表現）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2007/10/19
+@param[in]	x	文字列化する整数値。
+@param[in]	d	精度、最小限表示される桁数。DWORD_MAXのとき、指定なしとして、既定値1となる。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+@return xの文字列表現
+*/
+Function FormatIntegerO(x As DWord, d As DWord, field As DWord, flags As FormatFlags) As String
+	Return FormatIntegerEx(TraitsIntegerO[0], x, d, field, flags)
+End Function
+
+/*!
+@brief	FormatIntegerOのQWord版。
+@author	Egtra
+@date	2007/10/26
+*/
+Function FormatIntegerLO(x As QWord, d As DWord, field As DWord, flags As FormatFlags) As String
+	Return FormatIntegerEx(TraitsIntegerO[1], x, d, field, flags)
+End Function
+
+/*!
+@author	Egtra
+@date	2007/10/22
+*/
+Function IntegerO_Convert(buf As *Char, xq As QWord, flags As FormatFlags) As DWord
+	Dim x = xq As DWord
+	Dim i = MaxSizeLO
+	While x <> 0
+		buf[i] = ((x And &o7) + &h30) As Char
+		x >>= 3
+		i--
+	Wend
+	If flags And Alt Then
+		buf[i] = &h30
+		i--
+	End If
+	Return i
+End Function
+
+/*!
+@brief	IntegerO_ConvertのQWord版。
+@author	Egtra
+@date	2007/10/26
+*/
+Function IntegerLO_Convert(buf As *Char, x As QWord, flags As FormatFlags) As DWord
+	Dim i = MaxSizeLO
+	While x <> 0
+		buf[i] = ((x And &o7) + &h30) As Char
+		x >>= 3
+		i--
+	Wend
+	If flags And Alt Then
+		buf[i] = &h30
+		i--
+	End If
+	Return i
+End Function
+
+/*!
+@author	Egtra
+@date	2007/10/22
+@note	#フラグ (Alt)の処理は、IntegerO/LO_Convert内で行うので、ここで処理することはない。
+*/
+Function IntegerO_Prefix(x As QWord, flags As FormatFlags) As String
+	If flags And BPrefix Then
+		If x <> 0 Then
+			IntegerO_Prefix = "&O"
+		End If
+	End If
+End Function
+
+/*!
+@author	Egtra
+@date	2007/10/24
+*/
+Dim TraitsIntegerX[1] As IntegerConvertTraits
+With TraitsIntegerX[0]
+	.Convert = AddressOf(IntegerX_Convert)
+	.Prefix = AddressOf(IntegerX_Prefix)
+End With
+
+With TraitsIntegerX[1]
+	.Convert = AddressOf(IntegerLX_Convert)
+	.Prefix = AddressOf(IntegerX_Prefix)
+End With
+
+/*!
+@brief	整数をprintfの%x, %X（十六進法）相当の変換で文字列化する関数。
+@author	Egtra
+@date	2007/10/19
+@param[in]	x	文字列化する整数値。
+@param[in]	d	精度、最小限表示される桁数。DWORD_MAXのとき、指定なしとして、既定値1となる。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+@return xの文字列表現
+*/
+Function FormatIntegerX(x As DWord, d As DWord, field As DWord, flags As FormatFlags) As String
+	Return FormatIntegerEx(TraitsIntegerX[0], x, d, field, flags)
+End Function
+
+/*!
+@brief	FormatIntegerXのQWord版。
+@author	Egtra
+@date	2007/10/22
+*/
+Function FormatIntegerLX(x As QWord, d As DWord, field As DWord, flags As FormatFlags) As String
+	Return FormatIntegerEx(TraitsIntegerX[1], x, d, field, flags)
+End Function
+
+/*!
+@brief	FormatIntegerXのQWord, StringBuilder版。
+@author	Egtra
+@date	2008/03/07
+*/
+Sub FormatIntegerLX(sb As System.Text.StringBuilder, x As QWord, d As DWord, field As DWord, flags As FormatFlags)
+	FormatIntegerEx(sb, TraitsIntegerX[1], x, d, field, flags)
+End Sub
+
+/*
+@brief	0からFまでの文字を収めた表
+@author	egtra
+*/
+Dim HexadecimalTable[&h10] = [&h30, &h31, &h32, &h33, &h34, &h35, &h36, &h37, &h38, &h39, &h41, &h42, &h43, &h44, &h45, &h46] As Byte
+
+/*!
+@author	Egtra
+@date	2007/10/22
+*/
+Function IntegerX_Convert(buf As *Char, xq As QWord, flags As FormatFlags) As DWord
+	Dim i = MaxSizeLO
+	Dim x = xq As DWord
+	While x <> 0
+		buf[i] = HexadecimalTable[x And &h0f]
+		x >>= 4
+		i--
+	Wend
+	Return i
+End Function
+
+/*!
+@brief	IntegerX_ConvertのQWord版。
+@author	Egtra
+@date	2007/10/22
+*/
+Function IntegerLX_Convert(buf As *Char, x As QWord, flags As FormatFlags) As DWord
+	Dim i = MaxSizeLO
+	While x <> 0
+		buf[i] = HexadecimalTable[x And &h0f]
+		x >>= 4
+		i--
+	Wend
+	Return i
+End Function
+
+/*!
+@author	Egtra
+@date	2007/10/24
+*/
+Function IntegerX_Prefix(x As QWord, flags As FormatFlags) As String
+	If x <> 0 Then
+		If flags And Alt Then
+			IntegerX_Prefix = "0X"
+		ElseIf flags And BPrefix Then
+			IntegerX_Prefix = "&H"
+		End If
+	End If
+End Function
+
+/*!
+@brief	FormatIntegerExへ渡す変換特性を表す構造体型。
+@author	Egtra
+@date	2007/10/22
+
+FormatIntegerの都合上、このファイル内で宣言しているIntegerConvertTraits型の
+変数は全て配列となっている；[0]が32ビット変換、[1]が64ビット変換である。
+*/
+Type IntegerConvertTraits
+	'!変換を行う関数へのポインタ。
+	Convert As *Function(buf As *Char, x As QWord, flags As FormatFlags) As DWord
+	'!接頭辞を取得する関数へのポインタ。
+	Prefix As *Function(x As QWord, flags As FormatFlags) As String
+End Type
+
+/*!
+@brief	整数変換全てを行う関数。
+@author	Egtra
+@date 2007/10/22
+@param[in] tr	特性情報。
+@param[in] x	変換元の数値。
+@param[in] d	精度。ここでは最低限出力する桁数。
+@param[in] field	フィールド幅。
+@param[in] flags	フラグ。
+@return 変換された文字列
+*/
+Function FormatIntegerEx(ByRef tr As IntegerConvertTraits, x As QWord, d As DWord, field As DWord, flags As FormatFlags) As String
+	Dim sb = New System.Text.StringBuilder(32)
+	FormatIntegerEx(sb, tr, x, d, field, flags)
+	FormatIntegerEx = sb.ToString
+End Function
+
+/*!
+@brief	整数変換全てを行う関数。これを雛形とし、形式毎の差異はIntegerConvertTraitsで表現する。
+@author	Egtra
+@date 2008/03/06
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in] tr	特性情報。
+@param[in] x	変換元の数値。
+@param[in] d	精度。ここでは最低限出力する桁数。
+@param[in] field	フィールド幅。
+@param[in] flags	フラグ。
+*/
+Sub FormatIntegerEx(sb As System.Text.StringBuilder, ByRef tr As IntegerConvertTraits, x As QWord, d As DWord, field As DWord, flags As FormatFlags)
+	If d = DWORD_MAX Then
+		d = 1
+	Else
+		'精度が指定されているとき、ゼロフラグは無視される。
+		'仕様上、左揃えのときも無視されるが、それはAdjustFieldWidthが行ってくれる。
+		flags And= Not Zero
+	End If
+
+	Dim lastLength = sb.Length
+
+	With sb
+		Dim prefixFunc = tr.Prefix
+		Dim prefix = prefixFunc(x, flags)
+		sb.Append(prefix)
+
+		Dim prefixLen = 0 As DWord
+		If String.IsNullOrEmpty(prefix) = False Then
+			prefixLen = prefix.Length As DWord
+		End If
+
+		'バッファの量は最も必要文字数の多くなるUInt64の8進法変換にあわせている
+		Dim buf[MaxSizeLO] As Char
+		Dim convertFunc = tr.Convert
+		Dim bufStartPos = convertFunc(buf, x, flags)
+
+		Dim len = (MaxSizeLO - bufStartPos) As Long
+		If len < 0 Then
+			Debug
+		End If
+		If len < d Then
+			.Append(&h30 As Char, d - len)
+		End If
+		.Append(buf, bufStartPos + 1, len)
+		AdjustFieldWidth(sb, field, flags And (Not (Sign Or Blank)), prefixLen, lastLength)
+		AdjustAlphabet(sb, flags, lastLength)
+	End With
+End Sub
+
+/*!
+@brief 浮動小数点数変換全てを行う関数。これを雛形とし、実際の変換関数は引数converterで与える。
+@author Egtra
+@date 2008/03/07
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in] converter 変換関数。
+@param[in] x 変換元の数値。
+@param[in] d 精度。ここでは最低限出力する桁数。
+@param[in] field フィールド幅。
+@param[in] flags フラグ。
+*/
+Sub FormatFloatEx(sb As System.Text.StringBuilder, converter As FormatFloatProc, x As Double, precision As DWord, field As DWord, flags As FormatFlags)
+	Dim lastLength = sb.Length
+	If Math.IsNaN(x) Then
+		sb.Append("NAN")
+		AdjustAlphabet(sb, flags, lastLength)
+	ElseIf Math.IsInf(x) Then
+		AppendSign(sb, (GetQWord(VarPtr(x)) >> 63) As Boolean, flags)
+		sb.Append("INFINITY")
+		AdjustAlphabet(sb, flags, lastLength)
+	Else
+		converter(sb, x, precision, field, flags)
+	End If
+	AdjustFieldWidth(sb, field, flags, 0, lastLength)
+End Sub
+
+
+/*!
+@brief 浮動小数点数変換全てを行う関数。
+@author Egtra
+@date 2008/03/08
+@param[in] converter 変換関数。
+@param[in] x 変換元の数値。
+@param[in] d 精度。ここでは最低限出力する桁数。
+@param[in] field フィールド幅。
+@param[in] flags フラグ。
+@return 変換された文字列。
+*/
+Function FormatFloatEx(converter As FormatFloatProc, x As Double, precision As DWord, field As DWord, flags As FormatFlags) As String
+	Dim sb = New System.Text.StringBuilder
+	FormatFloatEx(sb, converter, x, precision, field, flags)
+	FormatFloatEx = sb.ToString
+End Function
+
+/*!
+@brief	書式化の仕上げとして、Capフラグが指定されていないときに小文字化する作業を行う。
+@author	Egtra
+@date 2008/03/06
+@param[in,out] sb 書式化した文字列を格納しているバッファ。
+@param[in] flags フラグ。
+@param[in] offset 書式変換した部分の開始位置。
+*/
+Sub AdjustAlphabet(sb As System.Text.StringBuilder, flags As FormatFlags, offset As Long)
+	If (flags And Cap) = 0 Then
+		Dim len = sb.Length
+		Dim i As Long
+		For i = offset To ELM(len)
+			sb[i] = CType.ToLower(sb[i])
+		Next
+	End If
+End Sub
+
+/*!
+@brief	書式化の仕上げとして、変換部分がフィールド幅まで満たされるように空白などを挿入する。
+@author	Egtra
+@date	2007/10/13
+@param[in,out] sb	対象文字列
+@param[in] field	フィールド幅
+@param[in] hasSign	符号を持っている（負の値か）か否か
+@param[in] flags	フラグ
+@param[in] prefixLen	（あれば）接頭辞の文字数。ゼロ埋めする際、この数だけ挿入位置を後ろにする。
+@param[in] offset	変換した部分へのオフセット。AppendではなくInsertを行う際に用いられる。
+sbが"-1"のように負符号を持っている場合は、呼出元でSignフラグ（またはBlank）を立てること。
+*/
+Sub AdjustFieldWidth(sb As System.Text.StringBuilder, field As DWord, flags As FormatFlags, prefixLen = 0 As DWord, offset = 0 As Long)
+	With sb
+		Dim len = .Length - offset
+		If len < field Then
+			Dim embeddedSize = field - len
+			If flags And LeftSide Then
+				.Append(&h20, embeddedSize)
+			Else
+				If (flags And Zero) <> 0 Then
+					offset += prefixLen
+					If (flags And Blank) Or (flags And Sign) Then
+						offset++
+					End If
+					.Insert(offset, String$(embeddedSize, "0"))
+				Else
+					.Insert(offset, String$(embeddedSize, " "))
+				End If
+			End If
+		End If
+	End With
+End Sub
+
+/*!
+@brief	文字列をprintfの%s相当の変換で書式化する関数。
+@author	Egtra
+@date	2007/10/27
+@param[in]	x	文字列。
+@param[in]	d	精度、最大の文字数。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+@return 書式化された文字列。
+*/
+Function FormatString(x As String, d As DWord, field As DWord, flags As FormatFlags) As String
+	Imports System
+	Dim sb = New System.Text.StringBuilder(
+		Math.Max(Math.Min(x.Length As DWord, d), field) As Long + 1)
+	FormatString(sb, x, d, field, flags)
+	AdjustFieldWidth(sb, field, flags And LeftSide)
+	FormatString = sb.ToString()
+End Function
+
+/*!
+@brief	文字列をprintfの%s相当の変換で書式化する関数。
+@author	Egtra
+@date	2008/03/07
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in] x 文字列。
+@param[in] d 精度、最大の文字数。
+@param[in] field フィールド幅。
+@param[in] flags 書式フラグ。
+@return 書式化された文字列。
+*/
+Sub FormatString(sb As System.Text.StringBuilder, x As String, d As DWord, field As DWord, flags As FormatFlags)
+	Dim len = sb.Length
+	sb.Append(x, 0, System.Math.Min(x.Length As DWord, d) As Long)
+	AdjustFieldWidth(sb, field, flags And LeftSide, 0, len)
+End Sub
+
+/*!
+@brief	文字をprintfの%c相当の変換で書式化する関数。
+@author	Egtra
+@date	2007/10/27
+@param[in]	x	文字。
+@param[in]	d	精度、最大の文字数。
+@param[in]	field	フィールド幅。
+@param[in]	flags	書式フラグ。
+@return 書式化された文字列。
+*/
+Function FormatCharacter(x As Char, d As DWord, field As DWord, flags As FormatFlags) As String
+	Dim sb = New System.Text.StringBuilder(field + 2)
+	FormatCharacter(sb, x, d, field, flags)
+	FormatCharacter = sb.ToString()
+End Function
+
+/*!
+@brief	文字列をprintfの%s相当の変換で書式化する関数。
+@author	Egtra
+@date	2008/03/07
+@param[in,out] sb 書式化した文字列を追加するバッファ。
+@param[in] x 文字。
+@param[in] d 精度、最大の文字数。
+@param[in] field フィールド幅。
+@param[in] flags 書式フラグ。
+@return 書式化された文字列。
+*/
+Sub FormatCharacter(sb As System.Text.StringBuilder, x As Char, d As DWord, field As DWord, flags As FormatFlags)
+	Dim len = sb.Length
+	sb.Append(x)
+	AdjustFieldWidth(sb, field, flags And LeftSide, 0, len)
+End Sub
+
+/*!
+@author	Egtra
+@date	2007/10/28
+*/
+TypeDef FormatFloatProc = *Sub(sb As System.Text.StringBuilder, x As Double, precision As DWord, fieldWidth As DWord, ByRef flags As FormatFlags)
+
+/*!
+@brief	SPrintfから呼ばれる浮動小数点数用書式文字列化関数
+@author	Egtra
+@date	2007/10/28
+*/
+Sub FormatFloat(s As System.Text.StringBuilder, formatProc As FormatFloatProc,
+	param As Object, precision As DWord, field As DWord, flags As FormatFlags)
+
+	Dim x As Double
+	Dim typeName = param.GetType().FullName
+	If typeName = "System.Double" Then
+		x = param As System.Double
+	ElseIf typeName = "System.Single" Then
+		x = param As System.Single
+	End If
+	FormatFloatEx(s, formatProc, x, precision, field, flags)
+End Sub
+
+/*!
+@brief	SPrintfから呼ばれる整数用書式文字列化関数
+@author	Egtra
+@date	2007/10/28
+*/
+Sub FormatInteger(s As System.Text.StringBuilder, traits As *IntegerConvertTraits,
+	param As Object, signed As Boolean, typeWidth As Long, precision As DWord, field As DWord, flags As FormatFlags)
+
+	Dim x As QWord
+	Dim typeName = param.GetType().FullName
+	If typeName = "System.UInt64" Then
+		x = param As System.UInt64
+	ElseIf typeName = "System.Int64" Then
+		x = (param As System.Int64) As QWord
+	ElseIf typeName = "System.UInt32" Then
+		x = param As System.UInt32
+	ElseIf typeName = "System.Int32" Then
+		x = (param As System.Int32) As QWord
+	ElseIf typeName = "System.UInt16" Then
+		x = param As System.UInt16
+	ElseIf typeName = "System.Int16" Then
+		x = (param As System.Int16) As QWord
+	ElseIf typeName = "System.UInt8" Then
+		x = param As System.Byte
+	ElseIf typeName = "System.Int8" Then
+		x = (param As System.SByte) As QWord
+	End If
+	'一旦縮めた後、符号・ゼロ拡張させる。
+	'また、64ビット整数なら64ビット変換Traitsを選択する。
+	If signed Then
+		If typeWidth = 1 Then
+			traits = VarPtr(traits[1])
+		ElseIf typeWidth = 0 Then
+			x = (((x As DWord) As Long) As Int64) As QWord
+		ElseIf typeWidth = -1 Then
+			x = (((x As Word) As Integer) As Int64) As QWord
+		ElseIf typeWidth = -2 Then
+			x = (((x As Byte) As SByte) As Int64) As QWord
+		End If
+	Else
+		If typeWidth = 1 Then
+			traits = VarPtr(traits[1])
+		ElseIf typeWidth = 0 Then
+			x = x As DWord
+		ElseIf typeWidth = -1 Then
+			x = x As Word
+		ElseIf typeWidth = -2 Then
+			x = x As Byte
+		End If
+	End If
+	FormatIntegerEx(s, ByVal traits, x, precision, field, flags)
+End Sub
+
+'Format関数群ここまで
+'----
+
+/*!
+@brief	文字列から数値への変換。さらに変換に使われなかった文字列の位置を返す。
+@author	Egtra
+@date	2007/11/11
+@param[in] s	変換する文字
+@param[out] p	変換に使われなかった部分の先頭を指すポインタ
+@return	変換して得られた数値。変換できなければ0。
+*/
+Function StrToLong(s As *Char, ByRef p As *Char) As Long
+	Dim negative As Boolean
+	Dim i = 0 As Long
+	If s[i] = &h2d Then 'Asc("-")
+		i++
+		negative = True
+	End If
+	Do
+		Dim c = s[i]
+		If Not CType.IsDigit(c) Then Exit Do
+		StrToLong *= 10
+		StrToLong += ((c As DWord) And &h0f) As Long
+		i++
+	Loop
+	If negative Then
+		StrToLong = -StrToLong
+	End If
+	p = VarPtr(s[i])
+End Function
+
+/*!
+@brief	フィールド幅、精度用の数値読取
+@author	Egtra
+@date	2007/11/11
+@param[in, out] fmt	読み途中の書式指定
+@param[in] params
+@param[in, out] paramsCount
+@param[out]	ret	読み取った数値。読み取られなかったときの値は不定。
+@retval True	読取を行った
+@retval False	行わなかった
+fmt[0]が*のときにはparamsから1つ読み取る。
+そうでなく、fmtに数字（先頭に-符号があっても可）が並んでいれば、それを読み取る。
+*/
+Function ReadInt(ByRef fmt As *Char, params As *Object, ByRef paramsCount As SIZE_T, ByRef ret As Long) As Boolean
+	If fmt[0] = &h2a Then '*
+		fmt = VarPtr(fmt[1]) 'po
+		ret = params[paramsCount] As System.Int32
+		paramsCount++
+		ReadInt = True
+	Else
+		Dim p As *Char
+		ret = StrToLong(fmt, p)
+		If fmt <> p Then
+			fmt = p
+			ReadInt = True
+		Else
+			ReadInt = False
+		End If
+	End If
+End Function
+
+/*!
+@brief	フラグ指定の読み込み
+@author	Egtra
+@date	2007/10/28
+@param[in, out] fmt
+@param[out] flags
+@retval True	読み込みが完了した。
+@retval False	読み取り中に文字列が終了した（ヌル文字が現れた）。
+*/
+Function ReadFlags(ByRef fmt As *Char, ByRef flags As FormatFlags) As Boolean
+	ReadFlags = False
+	Do
+		Select Case fmt[0]
+			Case &h23 '#
+				flags Or= Alt
+			Case &h30 '0
+				flags Or= Zero
+			Case &h20 '空白
+				flags Or= Blank
+			Case &h2b '+
+				flags Or= Sign
+			Case &h2d '-
+				flags Or = LeftSide
+			Case &h26 '&
+				flags Or= BPrefix
+			Case 0
+				Exit Function
+			Case Else
+				Exit Do
+		End Select
+		fmt = VarPtr(fmt[1]) 'po
+	Loop
+	ReadFlags = True
+End Function
+
+/*!
+@brief	フィールド幅指定の読み込み
+@author	Egtra
+@date	2007/10/29
+@param[in, out] fmt
+@param[in] params
+@param[in, out] paramsCount
+@param[out] fieldWidth
+@param[in, out] flags
+*/
+Sub ReadFieldWidth(ByRef fmt As *Char, params As *Object, ByRef paramsCount As SIZE_T,
+	ByRef fieldWidth As DWord, ByRef flags As FormatFlags)
+	Dim t As Long
+	If ReadInt(fmt, params, paramsCount, t) Then
+		If t < 0 Then
+			flags Or= LeftSide
+			fieldWidth = -t As DWord
+		Else
+			fieldWidth = t As DWord
+		End If
+	Else
+		fieldWidth = 0
+	End If
+End Sub
+
+/*!
+@brief	精度の読み込み
+@author	Egtra
+@date	2007/10/29
+@param[in, out] fmt
+@param[in] params
+@param[in, out] paramsCount
+@return	読み取った精度。指定がなかったときには、DWORD_MAX。
+*/
+Function ReadPrecision(ByRef fmt As *Char,
+	params As *Object, ByRef paramsCount As SIZE_T) As DWord
+
+	If fmt[0] = &h2e Then '.
+		fmt = VarPtr(fmt[1]) 'po
+		Dim t As Long
+		ReadPrecision = 0
+		If ReadInt(fmt, params, paramsCount, t) Then
+			If t > 0 Then
+				ReadPrecision = t As DWord
+			End If
+		End If
+	Else
+		ReadPrecision = DWORD_MAX
+	End If
+End Function
+
+#ifdef _WIN64
+Const PtrLength = 1
+#else
+Const PtrLength = 0
+#endif
+
+/*!
+@biref	長さ指定の読み込み
+@author	Egtra
+@date	2007/10/29
+@param[in, out] fmt
+@param[out] lengthSpec
+*/
+Sub ReadLength(ByRef fmt As *Char, ByRef lengthSpec As Long)
+	Do
+		Select Case fmt[0]
+			Case &h6c 'l
+				lengthSpec++
+			Case &h68 'h
+				lengthSpec--
+			Case &h6a 'j (u)intmax_t = QWord, Int64
+				lengthSpec = 1
+			Case &h74 't ptrdiff_t
+				lengthSpec = PtrLength
+			Case &h7a 'z (s)size_t
+				lengthSpec = PtrLength
+			Case &h70 'p VoidPtr 本来は変換指定子だが、ここで先読み
+				lengthSpec = PtrLength
+				Exit Sub 'fmtを進められると困るので、ここで脱出
+			Case Else
+				Exit Sub
+		End Select
+		fmt = VarPtr(fmt[1]) 'po
+	Loop
+End Sub
+
+/*!
+@brief efg変換用に、精度が指定されていないときに既定の精度を設定する。
+@auther Egtra
+@date 2008/03/07
+*/
+Sub AdjustPrecision(ByRef precision As DWord)
+	If precision = DWORD_MAX Then
+		precision = 6
+	End If
+End Sub
+
+/*!
+@biref	Cのsprintfのような書式文字列出力関数
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式文字列。詳細は開発Wiki参照。
+@param[in, out] params	変換対象の配列。n = 0のときにはNULLも可。
+@param[in] n	paramsの個数。
+@return	書式化された文字列。
+@todo	%nへの対応
+*/
+Function SPrintf(format As String, params As *Object, n As SIZE_T) As String
+	Dim i = 0 As SIZE_T
+	Dim paramsCount = 0 As SIZE_T
+	Dim fmt = StrPtr(format)
+	Dim s = New System.Text.StringBuilder
+	Do
+		Dim last = format.Length - (((fmt - StrPtr(format)) \ SizeOf (Char)) As LONG_PTR) As Long 'po
+		Dim pos = ChrFind(fmt, last, &h25 As Char) As Long '&h25 = %
+		If pos = -1 Then
+			s.Append(fmt, 0, last)
+			Exit Do
+		End If
+		'%以前の部分
+		s.Append(fmt, 0, pos)
+		fmt = VarPtr(fmt[pos + 1]) 'po
+		'フラグの読取
+		Dim flags = None As FormatFlags
+		If ReadFlags(fmt, flags) = False Then
+			Exit Do
+		End If
+		'フィールド幅
+		Dim fieldWidth As DWord
+		ReadFieldWidth(fmt, params, i, fieldWidth, flags)
+		'精度
+		Dim precision = ReadPrecision(fmt, params, i)
+		'幅指定の読取
+		Dim typeWidth As Long
+		ReadLength(fmt, typeWidth)
+
+		Select Case fmt[0]
+			Case &h64 'd
+				FormatInteger(s, TraitsIntegerD, params[i], True, typeWidth, precision, fieldWidth, flags)
+			Case &h69 'i
+				FormatInteger(s, TraitsIntegerD, params[i], True, typeWidth, precision, fieldWidth, flags)
+			Case &h75 'u
+				FormatInteger(s, TraitsIntegerU, params[i], False, typeWidth, precision, fieldWidth, flags)
+			Case &h4f 'O
+				flags Or= Cap
+				Goto *O
+			Case &h6f 'o
+			*O
+				FormatInteger(s, TraitsIntegerO, params[i], False, typeWidth, precision, fieldWidth, flags)
+			Case &h58 'X
+				flags Or= Cap
+				Goto *X
+			Case &h78 'x
+			*X
+				FormatInteger(s, TraitsIntegerX, params[i], False, typeWidth, precision, fieldWidth, flags)
+'現状ではVoidPtrを引数にする手段は無いはず
+'			Case &h58 'p
+'				FormatInteger(s, TraitsIntegerX, params[i], False, typeWidth, precision, fieldWidth, flags Or Cap)
+			Case &h45 'E
+				flags Or= Cap
+				Goto *E
+			Case &h65 'e
+			*E
+				AdjustPrecision(precision)
+				FormatFloat(s, AddressOf(FormatFloatE_Convert), params[i], precision, fieldWidth, flags)
+			Case &h46 'F
+				flags Or= Cap
+				Goto *F
+			Case &h66 'f
+			*F
+				AdjustPrecision(precision)
+				FormatFloat(s, AddressOf(FormatFloatF_Convert), params[i], precision, fieldWidth, flags)
+			Case &h47 'G
+				flags Or= Cap
+				Goto *G
+			Case &h67 'g
+			*G
+				AdjustPrecision(precision)
+				FormatFloat(s, AddressOf(FormatFloatG_Convert), params[i], precision, fieldWidth, flags)
+			Case &h41 'A
+				flags Or= Cap
+				Goto *A
+			Case &h61 'a
+			*A
+				FormatFloat(s, AddressOf(FormatFloatA), params[i], precision, fieldWidth, flags)
+			Case &h73 's
+				FormatString(s, params[i] As String, precision, fieldWidth, flags)
+			Case &h63 'c
+				FormatCharacter(s, params[i] As BoxedStrChar, precision, fieldWidth, flags)
+'			Case &h6e 'n
+			Case &h25 '%
+				s.Append(&h25 As Char)
+				i--
+			Case 0
+				Exit Do
+		End Select
+		fmt = VarPtr(fmt[1]) 'po
+		i++
+	Loop
+	SPrintf = s.ToString
+End Function
+
+End Namespace 'Detail
+
+/*!
+@brief	Cのsprintfのような書式化関数10引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+
+Function SPrintf(format As String, param0 As Object,
+	param1 As Object, param2 As Object, param3 As Object,
+	param4 As Object, param5 As Object, param6 As Object,
+	param7 As Object, param8 As Object, param9 As Object) As String
+
+	Dim params = VarPtr(param0) As *Object
+
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, params, 10)
+End Function
+
+/*!
+@brief	Cのsprintfのような書式化関数9引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+Function SPrintf(format As String, param0 As Object,
+	param1 As Object, param2 As Object, param3 As Object,
+	param4 As Object, param5 As Object, param6 As Object,
+	param7 As Object, param8 As Object) As String
+
+	Dim params = VarPtr(param0) As *Object
+
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, params, 9)
+End Function
+
+/*!
+@brief	Cのsprintfのような書式化関数8引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+Function SPrintf(format As String, param0 As Object,
+	param1 As Object, param2 As Object, param3 As Object,
+	param4 As Object, param5 As Object, param6 As Object,
+	param7 As Object) As String
+
+	Dim params = VarPtr(param0) As *Object
+
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, params, 8)
+End Function
+
+/*!
+@brief	Cのsprintfのような書式化関数7引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+Function SPrintf(format As String, param0 As Object,
+	param1 As Object, param2 As Object, param3 As Object,
+	param4 As Object, param5 As Object, param6 As Object) As String
+
+	Dim params = VarPtr(param0) As *Object
+
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, params, 7)
+End Function
+
+/*!
+@brief	Cのsprintfのような書式化関数6引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+Function SPrintf(format As String, param0 As Object,
+	param1 As Object, param2 As Object, param3 As Object,
+	param4 As Object, param5 As Object) As String
+
+	Dim params = VarPtr(param0) As *Object
+
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, params, 6)
+End Function
+
+/*!
+@brief	Cのsprintfのような書式化関数5引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+Function SPrintf(format As String, param0 As Object,
+	param1 As Object, param2 As Object, param3 As Object,
+	param4 As Object) As String
+
+	Dim params = VarPtr(param0) As *Object
+
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, params, 5)
+End Function
+
+/*!
+@brief	Cのsprintfのような書式化関数4引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+Function SPrintf(format As String, param0 As Object,
+	param1 As Object, param2 As Object, param3 As Object) As String
+
+	Dim params = VarPtr(param0) As *Object
+
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, params, 4)
+End Function
+
+/*!
+@brief	Cのsprintfのような書式化関数3引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+Function SPrintf(format As String, param0 As Object,
+	param1 As Object, param2 As Object) As String
+
+	Dim params = VarPtr(param0) As *Object
+
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, params, 3)
+End Function
+
+/*!
+@brief	Cのsprintfのような書式化関数2引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+Function SPrintf(format As String, param0 As Object,
+	param1 As Object) As String
+
+	Dim params = VarPtr(param0) As *Object
+
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, params, 2)
+End Function
+
+/*!
+@brief	Cのsprintfのような書式化関数1引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+Function SPrintf(format As String, param0 As Object) As String
+	Dim params = VarPtr(param0) As *Object
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, params, 1)
+End Function
+
+/*!
+@brief	Cのsprintfのような書式化関数0引数版
+@author	Egtra
+@date	2007/10/27
+@param[in] format	書式指定
+@param[in] paramN	引数
+@return 書式化された文字列
+*/
+Function SPrintf(format As String) As String
+	SPrintf = ActiveBasic.Strings.Detail.SPrintf(format, 0, 0)
+End Function
+
+End Namespace 'Strings
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Strings/Strings.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Strings/Strings.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Strings/Strings.ab	(revision 506)
@@ -0,0 +1,215 @@
+'Classes/ActiveBasic/Strings/Strings.ab
+
+Namespace ActiveBasic
+Namespace Strings
+
+Sub ChrFill(p As PWSTR, n As SIZE_T, c As WCHAR)
+	Dim i = 0 As SIZE_T
+	While i <> n
+		p[i] = c
+		i++
+	Wend
+End Sub
+
+Sub ChrFill(p As PSTR, n As SIZE_T, c As SByte)
+	Dim i = 0 As SIZE_T
+	While i <> n
+		p[i] = c
+		i++
+	Wend
+End Sub
+
+Function ChrCopy(dst As PCWSTR, src As PCWSTR, size As SIZE_T) As PCWSTR
+	memcpy(dst, src, size * SizeOf (WCHAR))
+	Return dst
+End Function
+
+Function ChrCopy(dst As PCSTR, src As PCSTR, size As SIZE_T) As PCSTR
+	memcpy(dst, src, size)
+	Return dst
+End Function
+
+Function ChrMove(dst As PCWSTR, src As PCWSTR, size As SIZE_T) As PCWSTR
+	MoveMemory(dst, src, size * SizeOf (WCHAR))
+	Return dst
+End Function
+
+Function ChrMove(dst As PCSTR, src As PCSTR, size As SIZE_T) As PCSTR
+	MoveMemory(dst, src, size)
+	Return dst
+End Function
+
+Function StrCmp(s1 As PCWSTR, s2 As PCWSTR) As Long
+	Dim i = 0 As SIZE_T
+	While s1[i] = s2[i]
+		If s1[i] = 0 Then
+			Exit While
+		End If
+		i++
+	Wend
+	Return s1[i] As Long - s2[i]
+End Function
+
+Function StrCmp(s1 As PCSTR, s2 As PCSTR) As Long
+	Dim i = 0 As SIZE_T
+	While s1[i] = s2[i]
+		If s1[i] = 0 Then
+			Exit While
+		End If
+		i++
+	Wend
+	Return s1[i] As Long - s2[i]
+End Function
+
+Function ChrCmp(s1 As PCWSTR, s2 As PCWSTR, size As SIZE_T) As Long
+	Dim i = 0 As SIZE_T
+	While i <> size 'Forではsize = 0のときにまずい
+		ChrCmp = s1[i] As Long - s2[i]
+		If ChrCmp <> 0 Then
+			Exit Function
+		End If
+		i++
+	Wend
+End Function
+
+Function ChrCmp(s1 As PCSTR, s2 As PCSTR, size As SIZE_T) As Long
+	Dim i = 0 As SIZE_T
+	While i <> size
+		ChrCmp = s1[i] As Long - s2[i]
+		If ChrCmp <> 0 Then
+			Exit Function
+		End If
+		i++
+	Wend
+End Function
+
+Function ChrCmp(s1 As PCWSTR, size1 As SIZE_T, s2 As PCWSTR, size2 As SIZE_T) As Long
+	ChrCmp = ChrCmp(s1, s2, System.Math.Min(size1, size2))
+	If ChrCmp = 0 Then
+		ChrCmp = (( size1 - size2 ) As LONG_PTR) As Long
+	End If
+End Function
+
+Function ChrCmp(s1 As PCSTR, size1 As SIZE_T, s2 As PCSTR, size2 As SIZE_T) As Long
+	ChrCmp = ChrCmp(s1, s2, System.Math.Min(size1, size2))
+	If ChrCmp = 0 Then
+		ChrCmp = (( size1 - size2 ) As LONG_PTR) As Long
+	End If
+End Function
+
+Function ChrPBrk(str As PCWSTR, cStr As SIZE_T, chars As PCWSTR, cChars As SIZE_T) As SIZE_T
+	Dim i = 0 As SIZE_T
+	While i <> cStr
+		If ChrFind(chars, cChars, str[i]) <> -1 Then
+			Return i
+		End If
+		i++
+	Wend
+	Return -1 As SIZE_T
+End Function
+
+Function ChrPBrk(str As PCSTR, cStr As SIZE_T, Chars As PCSTR, cChars As SIZE_T) As SIZE_T
+	Dim i = 0 As SIZE_T
+	While i <> cStr
+		If ChrFind(Chars, cChars, str[i]) <> -1 Then
+			Return i
+		End If
+		i++
+	Wend
+	Return -1 As SIZE_T
+End Function
+
+Function ChrFind(s As PCWSTR, size As SIZE_T, c As WCHAR) As SIZE_T
+	Dim i = 0 As SIZE_T
+	While i <> size
+		If s[i] = c Then
+			Return i
+		End If
+		i++
+	Wend
+	Return -1 As SIZE_T
+End Function
+
+Function ChrFind(s As PCSTR, size As SIZE_T, c As CHAR) As SIZE_T
+	Dim i = 0 As SIZE_T
+	While i <> size
+		If s[i] = c Then
+			Return i
+		End If
+		i++
+	Wend
+	Return -1 As SIZE_T
+End Function
+
+Function ChrFind(s1 As PCWSTR, len1 As SIZE_T, s2 As PCWSTR, len2 As SIZE_T) As SIZE_T
+	If len2 = 0 Then
+		'ChrFind = 0
+		Exit Function
+	End If
+	Do
+		Dim prev = ChrFind
+		ChrFind = ChrFind(VarPtr(s1[prev]), (len1 - prev) As SIZE_T, s2[0])
+		If ChrFind = -1 As SIZE_T Then
+			Exit Function
+		End If
+		ChrFind += prev
+
+		If ChrCmp(VarPtr(s1[ChrFind]), s2, len2) = 0 Then
+			Exit Function
+		End If
+		ChrFind++
+		If ChrFind = len1 Then
+			ChrFind = -1
+			Exit Function
+		End If
+	Loop
+End Function
+
+Function ChrFind(s1 As PCSTR, len1 As SIZE_T, s2 As PCSTR, len2 As SIZE_T) As SIZE_T
+	If len2 = 0 Then
+		'ChrFind = 0
+		Exit Function
+	End If
+	Do
+		Dim prev = ChrFind
+		ChrFind = ChrFind(VarPtr(s1[prev]), (len1 - prev) As SIZE_T, s2[0])
+		If ChrFind = -1 As SIZE_T Then
+			Exit Function
+		End If
+		ChrFind += prev
+
+		If ChrCmp(VarPtr(s1[ChrFind]), s2, len2) = 0 Then
+			Exit Function
+		End If
+		ChrFind++
+		If ChrFind = len1 Then
+			ChrFind = -1
+			Exit Function
+		End If
+	Loop
+End Function
+
+Namespace Detail
+Function Split(s As String, c As Char) As System.Collections.Generic.List<String>
+	Split = New System.Collections.Generic.List<String>
+
+	Dim last = 0 As Long
+	Do
+		Dim i = s.IndexOf(c, last)
+		If i < 0 Then
+			Split.Add(s.Substring(last, s.Length - last))
+			Exit Function
+		End If
+		Split.Add(s.Substring(last, i - last))
+		last = i + 1
+		If last > s.Length Then
+			Split.Add(System.String.Empty)
+		End If
+	Loop
+End Function
+
+End Namespace 'Detail
+
+End Namespace 'Strings
+End Namespace 'ActiveBasic
+
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/CriticalSection.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/CriticalSection.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/CriticalSection.ab	(revision 506)
@@ -0,0 +1,64 @@
+'Classes/ActiveBasic/Windows/CriticalSection.ab
+
+Namespace ActiveBasic
+Namespace Windows
+
+Namespace Detail
+	Const InterlockedExchangeAnyPointer(p, x) = InterlockedExchangePointer(ByVal VarPtr(p) As *VoidPtr, x)
+End Namespace
+
+Class CriticalSection
+	Implements System.IDisposable
+Public
+	Sub CriticalSection()
+		disposed = 0
+		InitializeCriticalSection(cs)
+	End Sub
+
+	Sub ~CriticalSection()
+		Dispose()
+	End Sub
+
+	Sub Dispose()
+		If InterlockedIncrement(disposed) = 0 Then
+			DeleteCriticalSection(cs)
+		End If
+	End Sub
+
+	Function Enter() As ActiveBasic.Windows.CriticalSectionLock
+		Return New CriticalSectionLock(cs)
+	End Function
+Private
+	cs As CRITICAL_SECTION
+	disposed As Long
+End Class
+
+Class CriticalSectionLock
+'	Inherits System.IDisposable
+Public
+	Sub CriticalSectionLock(ByRef cs As CRITICAL_SECTION)
+		pcs = VarPtr(cs)
+		EnterCriticalSection(cs)
+	End Sub
+
+	Sub ~CriticalSectionLock()
+		Dispose()
+	End Sub
+
+	Sub Leave()
+		Dispose()
+	End Sub
+
+	/*Override*/ Sub Dispose()
+'		Dim pcsOld = ActiveBasic.Windows.Detail.InterlockedExchangeAnyPointer(pcs, 0)
+		Dim pcsOld = InterlockedExchangePointer(ByVal VarPtr(pcs) As *VoidPtr, 0) As *CRITICAL_SECTION
+		If pcsOld <> 0 Then
+			LeaveCriticalSection(ByVal pcsOld)
+		End If
+	End Sub
+Private
+	pcs As *CRITICAL_SECTION
+End Class
+
+End Namespace 'Windows
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/Control.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/Control.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/Control.ab	(revision 506)
@@ -0,0 +1,332 @@
+'Classes/ActiveBasic/Windows/UI/Control.ab
+
+#require <Classes/ActiveBasic/Windows/UI/Forms/EventArgs.ab>
+
+Namespace ActiveBasic
+Namespace Windows
+Namespace UI
+Namespace Forms
+
+Class Control
+Public
+
+'1
+
+	Sub Control()
+	End Sub
+
+	Virtual Sub ~Control()
+	End Sub
+
+	Function Handle() As WindowHandle
+		Handle = wnd
+	End Function
+
+	Static Function FromHWnd(hwnd As HWND) As Control
+		FromHWnd = Nothing
+		If IsWindow(hwnd) Then
+			FromHWnd = FromHWndCore(hwnd)
+		End If
+	End Function
+
+Private
+	Static Function FromHWndCore(hwnd As HWND) As Control
+		If GetClassLongPtr(hwnd, GCW_ATOM) = atom Then
+			Dim gchValue = GetProp(hwnd, PropertyInstance As ULONG_PTR As PCTSTR) As ULONG_PTR
+			If gchValue <> 0 Then
+				Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(gchValue)
+				FromHWndCore = gch.Target As Control
+				Exit Function
+			End If
+		End If
+	End Function
+
+'--------------------------------
+' 1 ウィンドウ作成
+/*
+	Function Create(
+		parent As HWND,
+		rect As RECT,
+		name As String,
+		style As DWord,
+		exStyle = 0 As DWord,
+		menu = 0 As HMENU) As HWND
+*/
+Public
+	Function Create() As Boolean
+		Dim cs As CREATESTRUCT
+		cs.hInstance = hInstance
+		cs.lpszClass = (atom As ULONG_PTR) As LPCTSTR
+		GetCreateStruct(cs)
+		Create = createImpl(cs)
+	End Function
+
+Protected
+	Abstract Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
+
+	Function createImpl(ByRef cs As CREATESTRUCT) As Boolean
+		Imports System.Runtime.InteropServices
+
+		Dim gch = GCHandle.Alloc(This)
+		TlsSetValue(tlsIndex, GCHandle.ToIntPtr(gch) As VoidPtr)
+
+		With cs
+			Dim hwnd = CreateWindowEx(.dwExStyle, .lpszClass, .lpszName, .style,
+				.x, .y, .cx, .cy, .hwndParent, .hMenu, .hInstance, .lpCreateParams)
+			createImpl = hwnd <> 0
+		End With
+	End Function
+
+'--------------------------------
+' ウィンドウプロシージャ
+'Protected
+Public
+	Virtual Function WndProc(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+		Select Case msg
+			Case WM_ERASEBKGND
+				Dim rc = wnd.ClientRect
+				Dim e = New PaintDCHandledEventArgs(wp As HDC, rc)
+				OnPaintBackground(e)
+				WndProc = e.Handled
+			Case WM_PAINT
+				Dim ps As PAINTSTRUCT
+				wnd.BeginPaint(ps)
+				Try
+					Dim e = New PaintDCEventArgs(ps.hdc, ps.rcPaint)
+					OnPaintDC(e)
+				Finally
+					wnd.EndPaint(ps)
+				End Try
+			Case WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN, WM_XBUTTONDOWN
+				OnMouseDown(New MouseEventArgs(LOWORD(wp) As MouseButtons, 1, GET_X_LPARAM(lp), GET_Y_LPARAM(lp), 0))
+			Case WM_LBUTTONUP, WM_RBUTTONUP, WM_MBUTTONUP, WM_XBUTTONUP
+				OnMouseUp(New MouseEventArgs(LOWORD(wp) As MouseButtons, 1, GET_X_LPARAM(lp), GET_Y_LPARAM(lp), 0))
+/*
+			Case WM_KEYDOWN
+				OnKeyDown(New KeyEventArgs(makeKeysFormWPLP(wp, lp)))
+			Case WM_KEYUP
+				OnKeyUp(New KeyEventArgs(makeKeysFormWPLP(wp, lp)))
+			Case WM_CHAR
+				OnKeyPress(New KeyPressEventArgs(wParam As Char))
+			Case WM_ENABLE
+				OnEnableChanged(EventArgs.Empty)
+			Case WM_MOVE
+				OnMove(EventArgs.Empty)
+			Case WM_SIZE
+				OnResize(EventArgs.Empty)
+*/
+			Case Else
+			WndProc = DefWndProc(msg, wp, lp)
+		End Select
+	End Function
+
+	Virtual Function DefWndProc(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+		DefWndProc = DefWindowProc(wnd.HWnd, msg, wp, lp)
+	End Function
+
+Private
+	Function makeKeysFormWPLP(wp As WPARAM, lp As LPARAM) As Keys
+		Dim t As DWord
+		t = wp And Keys.KeyCode
+		t Or= (GetKeyState(VK_SHIFT) As Word And &h8000) << 1
+		t Or= (GetKeyState(VK_CONTROL) As Word And &h8000) << 2
+		t Or= (GetKeyState(VK_MENU) As Word And &h8000) << 3
+		makeKeysFormWPLP = t As Keys
+	End Function
+
+
+'--------------------------------
+' ウィンドウメッセージ処理
+
+'--------
+' 2
+
+Protected
+	/*!
+	@biref	ウィンドウの背景を描画する。
+	@date	2007/12/04
+	*/
+	Virtual Sub OnPaintBackground(e As PaintDCBackGroundEventArgs)
+		Dim hbr = (COLOR_3DFACE + 1) As HBRUSH
+		FillRect(e.Handle, e.ClipRect, hbr)
+		e.Handled = True
+	End Sub
+
+'--------
+'イベント
+' 3
+
+#include "ControlEvent.sbp"
+
+'--------------------------------
+' 1 インスタンスメンバ変数
+Private
+	wnd As WindowHandle
+
+'--------------------------------
+' 1 初期ウィンドウクラス
+Private
+	Static Function WndProcFirst(hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+		Imports System.Runtime.InteropServices
+
+		Dim rThis = Control.FromHWndCore(hwnd)
+		If IsNothing(rThis) Then
+			Dim gchValue = TlsGetValue(tlsIndex) As LONG_PTR
+			TlsSetValue(tlsIndex, 0)
+			If gchValue = 0 Then
+				Goto *InstanceIsNotFound
+			End If
+			Dim gch = GCHandle.FromIntPtr(gchValue)
+			rThis = gch.Target As Control
+			' ウィンドウが作られて最初にWndProcFirstが呼ばれたとき
+
+			If IsNothing(rThis) Then
+				Goto *InstanceIsNotFound
+			End If
+			rThis.wnd = New WindowHandle(hwnd)
+			rThis.wnd.SetProp(PropertyInstance, gchValue As HANDLE)
+		End If
+		WndProcFirst = rThis.WndProc(msg, wp, lp)
+		If msg = WM_NCDESTROY Then
+			Dim gchValue = GetProp(hwnd, PropertyInstance As ULONG_PTR As PCTSTR) As ULONG_PTR
+			If gchValue <> 0 Then
+				Dim gch = GCHandle.FromIntPtr(gchValue)
+				gch.Free()
+			End If
+		End If
+
+		Exit Function
+
+	*InstanceIsNotFound
+		OutputDebugString("ActiveBasic.Windows.UI.Control.WndProcFirst: The attached instance is not found.")
+		WndProcFirst = DefWindowProc(hwnd, msg, wp, lp)
+	End Function
+	
+'	Static Const WM_CONTROL_INVOKE = WM_USER + 0 As DWord
+'	Static Const WM_CONTROL_BEGININVOKE = WM_USER + 1 As DWord
+
+'--------------------------------
+' 1 初期化終了関連（特にウィンドウクラス）
+
+	'ウィンドウ作成時にウィンドウプロシージャへThisを伝えるためのもの
+	Static tlsIndex As DWord
+
+	Static hInstance As HINSTANCE
+	Static atom As ATOM
+
+	Static Const WindowClassName = "ActiveBasic.Windows.UI.Control"
+	Static Const PropertyInstance = 0 As ATOM
+Public
+	Static Sub Initialize(hinst As HINSTANCE)
+		tlsIndex = TlsAlloc()
+		hInstance = hinst
+
+		Dim PropertyInstanceString = WindowClassName + " " + Hex$(GetCurrentProcessId())
+		PropertyInstance = GlobalAddAtom(ToTCStr(PropertyInstanceString))
+
+		Dim wcx As WNDCLASSEX
+		With wcx
+			.cbSize = Len (wcx)
+			.style = CS_HREDRAW Or CS_VREDRAW Or CS_DBLCLKS
+			.lpfnWndProc = AddressOf (WndProcFirst)
+			.cbClsExtra = 0
+			.cbWndExtra = 0
+			.hInstance = hinst
+			.hIcon = 0
+			.hCursor = LoadImage(0, MAKEINTRESOURCE(IDC_ARROW), IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE Or LR_SHARED) As HCURSOR
+			.hbrBackground = 0
+			.lpszMenuName = 0
+			.lpszClassName = ToTCStr(WindowClassName)
+			.hIconSm = 0
+		End With
+		atom = RegisterClassEx(wcx)
+		If atom = 0 Then
+			Dim buf[1023] As TCHAR
+			wsprintf(buf, Ex"ActiveBasic.Windows.UI.Control.Control: RegisterClasseEx failed. Error code: &h%08X\r\n", GetLastError())
+			OutputDebugString(buf)
+			Debug
+			ExitThread(0)
+		End If
+	End Sub
+
+	Static Sub Uninitialize()
+		UnregisterClass(atom As ULONG_PTR As PCSTR, hInstance)
+		TlsFree(tlsIndex)
+		GlobalDeleteAtom(PropertyInstance)
+	End Sub
+End Class
+
+Namespace Detail
+Class _System_ControlIinitializer
+Public
+	Sub _System_ControlIinitializer(hinst As HINSTANCE)
+		Control.Initialize(hinst)
+	End Sub
+
+	Sub ~_System_ControlIinitializer()
+		Control.Uninitialize()
+	End Sub
+End Class
+
+#ifndef _SYSTEM_NO_INITIALIZE_CONTROL_
+Dim _System_ControlInitializer As _System_ControlIinitializer(GetModuleHandle(0))
+#endif '_SYSTEM_NO_INITIALIZE_CONTROL_
+
+End Namespace 'Detail
+
+Class Form
+	Inherits Control
+Protected
+	Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
+		With cs
+			.lpCreateParams = 0
+			'.hInstance
+			.hMenu = 0
+			.hwndParent = 0
+			.cy = CW_USEDEFAULT
+			.cx = CW_USEDEFAULT
+			.y = CW_USEDEFAULT
+			.x = CW_USEDEFAULT
+			.style = WS_OVERLAPPEDWINDOW
+			.lpszName = ""
+			'.lpszClass
+			.dwExStyle = 0
+		End With
+	End Sub
+Public '仮
+	Override Function WndProc(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+		WndProc = 0
+		Select Case msg
+			Case WM_DESTROY
+				PostQuitMessage(0)
+			Case Else
+				WndProc = Super.WndProc(msg, wp, lp)
+		End Select
+	End Function
+End Class
+
+End Namespace 'Forms
+End Namespace 'UI
+End Namespace 'Widnows
+End Namespace 'ActiveBasic
+
+'----------
+'テスト実行用
+
+Imports ActiveBasic.Windows.UI.Forms
+
+Class Bar
+Public
+Static Sub PaintDCEvent(sender As Object, et As PaintDCEventArgs) 
+	Dim e = et As PaintDCEventArgs
+	TextOut(e.Handle, 10, 10, "Hello, world", 12)
+End Sub
+End Class
+
+Dim f = New Form
+f.Create()
+Dim v = New PaintDCEventHandler(AddressOf (Bar.PaintDCEvent))
+f.AddPaintDC(v)
+f.Handle.Show(SW_SHOW)
+
+MessageBox(0, "hello", "", 0)
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/ControlEvent.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/ControlEvent.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/ControlEvent.sbp	(revision 506)
@@ -0,0 +1,150 @@
+Public
+	/*!
+	@brief PaintDCイベントハンドラを追加する
+	*/
+	Sub AddPaintDC(h As PaintDCEventHandler)
+		If IsNothing(paintDC) Then
+			paintDC = New PaintDCEventHandler
+		End If
+		paintDC += h
+	End Sub
+	/*!
+	@brief PaintDCイベントハンドラを削除する
+	*/
+	Sub RemovePaintDC(h As PaintDCEventHandler)
+		If Not IsNothing(paintDC) Then
+			paintDC -= h
+		End If
+	End Sub
+Protected
+	/*!
+	@brief ウィンドウの描画が必要なときに呼び出されます。
+	*/
+	Virtual Sub OnPaintDC(e As PaintDCEventArgs)
+		If Not IsNothing(paintDC) Then
+			paintDC(This, e)
+		End If
+	End Sub
+Private
+	paintDC As PaintDCEventHandler
+
+Public
+	/*!
+	@brief Clickイベントハンドラを追加する
+	*/
+	Sub AddClick(h As EventHandler)
+		If IsNothing(click) Then
+			click = New EventHandler
+		End If
+		click += h
+	End Sub
+	/*!
+	@brief Clickイベントハンドラを削除する
+	*/
+	Sub RemoveClick(h As EventHandler)
+		If Not IsNothing(click) Then
+			click -= h
+		End If
+	End Sub
+Protected
+	/*!
+	@brief クリックされたときに呼び出されます。
+	*/
+	Virtual Sub OnClick(e As EventArgs)
+		If Not IsNothing(click) Then
+			click(This, e)
+		End If
+	End Sub
+Private
+	click As EventHandler
+
+Public
+	/*!
+	@brief DoubleClickイベントハンドラを追加する
+	*/
+	Sub AddDoubleClick(h As EventHandler)
+		If IsNothing(doubleClick) Then
+			doubleClick = New EventHandler
+		End If
+		doubleClick += h
+	End Sub
+	/*!
+	@brief DoubleClickイベントハンドラを削除する
+	*/
+	Sub RemoveDoubleClick(h As EventHandler)
+		If Not IsNothing(doubleClick) Then
+			doubleClick -= h
+		End If
+	End Sub
+Protected
+	/*!
+	@brief ダブルクリックされたときに呼び出されます。
+	*/
+	Virtual Sub OnDoubleClick(e As EventArgs)
+		If Not IsNothing(doubleClick) Then
+			doubleClick(This, e)
+		End If
+	End Sub
+Private
+	doubleClick As EventHandler
+
+Public
+	/*!
+	@brief MouseDownイベントハンドラを追加する
+	*/
+	Sub AddMouseDown(h As MouseEventHandler)
+		If IsNothing(mouseDown) Then
+			mouseDown = New MouseEventHandler
+		End If
+		mouseDown += h
+	End Sub
+	/*!
+	@brief MouseDownイベントハンドラを削除する
+	*/
+	Sub RemoveMouseDown(h As MouseEventHandler)
+		If Not IsNothing(mouseDown) Then
+			mouseDown -= h
+		End If
+	End Sub
+Protected
+	/*!
+	@brief マウスボタンが押されたときに呼び出されます。
+	*/
+	Virtual Sub OnMouseDown(e As MouseEventArgs)
+		If Not IsNothing(mouseDown) Then
+			mouseDown(This, e)
+		End If
+	End Sub
+Private
+	mouseDown As MouseEventHandler
+
+Public
+	/*!
+	@brief MouseUpイベントハンドラを追加する
+	*/
+	Sub AddMouseUp(h As MouseEventHandler)
+		If IsNothing(mouseUp) Then
+			mouseUp = New MouseEventHandler
+		End If
+		mouseUp += h
+	End Sub
+	/*!
+	@brief MouseUpイベントハンドラを削除する
+	*/
+	Sub RemoveMouseUp(h As MouseEventHandler)
+		If Not IsNothing(mouseUp) Then
+			mouseUp -= h
+		End If
+	End Sub
+Protected
+	/*!
+	@brief マウスボタンが離されたときに呼び出されます。
+	*/
+	Virtual Sub OnMouseUp(e As MouseEventArgs)
+		If Not IsNothing(mouseUp) Then
+			mouseUp(This, e)
+		End If
+	End Sub
+Private
+	mouseUp As MouseEventHandler
+
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/ControlEventList.txt
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/ControlEventList.txt	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/ControlEventList.txt	(revision 506)
@@ -0,0 +1,21 @@
+PaintDC	PaintDCEvent	ウィンドウの描画が必要なときに呼び出されます。
+Click	Event	クリックされたときに呼び出されます。
+DoubleClick	Event	ダブルクリックされたときに呼び出されます。
+'EnableChanged	Event	有効状態が変化したときに呼び出されます。
+'Move	Event	ウィンドウが移動したときに呼び出されます。
+'Resize	Event	ウィンドウの大きさが変化したときに呼び出されます。
+'VisibleChanged	Event	ウィンドウの表示状態が変化したときに呼び出されます。
+'GotFocus	Event	フォーカスを得たときに呼び出されます。
+'LostFocus	Event	フォーカスを失ったときに呼び出されます。
+'MouseEnter	MouseEvent	マウスカーソルがコントロールに入ってくると呼び出されます。
+'MouseMove	MouseEvent	マウスカーソルがコントロール上で移動すると呼び出されます
+'MouseHover	MouseEvent	マウスカーソルがコントロール上で静止すると呼び出されます。
+'MouseLeave	MouseEvent	マウスカーソルがコントロールから出て行くと呼び出されます。
+MouseDown	MouseEvent	マウスボタンが押されたときに呼び出されます。
+'MouseClick	MouseEvent	マウスでクリックされたときに呼び出されます。
+'MouseDoubleClick	MouseEvent	マウスでダブルクリックされたときに呼び出されます。
+MouseUp	MouseEvent	マウスボタンが離されたときに呼び出されます。
+'MouseWheel	MouseEvent	マウスホイールが回されたときに呼び出されます。
+'KeyDown	KeyEvent	キーが押されたときに呼ばれます。
+'KeyUp	KeyEvent	キーが離されたときに呼ばれます。
+'KeyPress	KeyPressEvent	キーが押されて文字が打たれたときに呼ばれます。
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/EventArgs.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/EventArgs.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/EventArgs.ab	(revision 506)
@@ -0,0 +1,387 @@
+/**
+@file Include/Classes/ActiveBasic/Windows/UI/EventArgs.ab
+@brief イベントハンドラ関連
+*/
+
+Namespace ActiveBasic
+Namespace Windows
+Namespace UI
+Namespace Forms
+
+TypeDef EventArgs = System.EventArgs
+TypeDef EventHandler = System.EventHandler
+
+Class PaintDCEventArgs
+	Inherits EventArgs
+Public
+	Sub PaintDCEventArgs(hdcTarget As HDC, ByRef rect As RECT)
+		hdc = hdcTarget
+		rc = rect
+	End Sub
+
+	Function Handle() As HDC
+		Handle = hdc
+	End Function
+
+	Function ClipRect() As RECT
+		ClipRect = rc
+	End Function
+
+Private
+	hdc As HDC
+	rc As RECT
+End Class
+
+Delegate Sub PaintDCEventHandler(sender As Object, e As PaintDCEventArgs)
+
+Class PaintDCHandledEventArgs
+	Inherits PaintDCEventArgs
+Public
+	Sub PaintDCHandledEventArgs(hdcTarget As HDC, ByRef rect As RECT)
+		PaintDCEventArgs(hdcTarget, rect)
+	End Sub
+
+	Function Handled() As Boolean
+		Handled = h
+	End Function
+
+	Sub Handled(handled As Boolean)
+		h = handled
+	End Sub
+
+Private
+	h As Boolean
+End Class
+
+TypeDef PaintDCBackGroundEventArgs = PaintDCHandledEventArgs
+
+Enum MouseButtons
+	None = 0
+	Left = MK_LBUTTON
+	Right = MK_RBUTTON
+	Middle = MK_MBUTTON
+	XButton1 = MK_XBUTTON1
+	XButton2 = MK_XBUTTON2
+End Enum
+
+Class MouseEventArgs
+	Inherits EventArgs
+Public
+	Sub MouseEventArgs(button As MouseButtons, clicks As Long, x As Long, y As Long, delta As Long)
+		This.button = button
+		This.clicks = clicks
+		This.pt = New System.Drawing.Point(x, y)
+		This.delta = delta
+	End Sub
+
+	Const Function Button() As MouseButtons
+		Button = button
+	End Function
+
+	Const Function Clicks() As Long
+		Clicks = clicks
+	End Function
+
+	Const Function Delta() As Long
+		Delta = delta
+	End Function
+
+	Const Function Locale() As System.Drawing.Point
+		Locale = New System.Drawing.Point(pt.X, pt.Y)
+	End Function
+
+	Const Function X() As Long
+		X = pt.X
+	End Function
+
+	Const Function Y() As Long
+		Y = pt.Y
+	End Function
+
+Private
+	pt As System.Drawing.Point
+	button As MouseButtons
+	clicks As Long
+	delta As Long
+End Class
+
+Delegate Sub MouseEventHandler(sender As Object, e As MouseEventArgs)
+
+Class KeyPressEventArgs
+	Inherits EventArgs
+Public
+	Sub KeyPressEventArgs(keyChar As Char)
+		key = keyChar
+	End Sub
+
+	Sub KeyChar(keyChar As Char)
+		key = keyChar
+	End Sub
+
+	Const Function KeyChar() As Char
+		KeyChar = key
+	End Function
+
+	Sub Handled(handled As Boolean)
+		h = handled
+	End Sub
+
+	Const Function Handled() As Boolean
+		Handled = h
+	End Function
+Private
+	key As Char
+	h As Boolean
+End Class
+
+Delegate Sub KeyPressEventHandler(sender As Object, e As KeyPressEventArgs)
+
+Enum Keys
+	None = 0
+	LButton = VK_LBUTTON
+	RButton = VK_RBUTTON
+	Cancel = VK_CANCEL
+	MButton = VK_MBUTTON
+	XButton1 = VK_XBUTTON1
+	XButton2 = VK_XBUTTON2
+	Back = VK_BACK
+	Tab = VK_TAB
+	LineFeed = &ha
+	Clear = VK_CLEAR
+	Enter = VK_RETURN
+	Return_ = VK_RETURN
+	ShiftKey = VK_SHIFT
+	ControlKey = VK_CONTROL
+	Menu = VK_MENU
+	Pause = VK_PAUSE
+	Capital = VK_CAPITAL
+	KanaMode = VK_KANA
+	HangulMode = VK_HANGUL
+	JunjaMode = VK_JUNJA
+	FinalMode = VK_FINAL
+	KanjiMode = VK_KANJI
+	HanjaMode = VK_HANJA
+	Escape = VK_ESCAPE
+	IMEConvert = VK_CONVERT
+	IMENonconvert = VK_NONCONVERT
+	IMEAccept = VK_ACCEPT
+	IMEModeChange = VK_MODECHANGE
+	Space = VK_SPACE
+	Prior = VK_PRIOR
+	PageUp = VK_PRIOR
+	PageDown = VK_NEXT
+	Next_ = VK_NEXT
+	End_ = VK_END
+	Home = VK_HOME
+	Left = VK_LEFT
+	Up = VK_UP
+	Right = VK_RIGHT
+	Down = VK_DOWN
+	Select_ = VK_SELECT
+	Print = VK_PRINT
+	Execute = VK_EXECUTE
+	Snapshot = VK_SNAPSHOT
+	Insert = VK_INSERT
+	Delete_ = VK_DELETE
+	Help = VK_HELP
+	D0 = &h30
+	D1 = &h31
+	D2 = &h32
+	D3 = &h33
+	D4 = &h34
+	D5 = &h35
+	D6 = &h36
+	D7 = &h37
+	D8 = &h38
+	D9 = &h39
+	A = &h41
+	B = &h42
+	C = &h43
+	D = &h44
+	E = &h45
+	F = &h46
+	G = &h47
+	H = &h48
+	I = &h49
+	J = &h4a
+	K = &h4b
+	L = &h4c
+	M = &h4d
+	N = &h4e
+	O = &h4f
+	P = &h50
+	Q = &h51
+	R = &h52
+	S = &h53
+	T = &h54
+	U = &h55
+	V = &h56
+	W = &h57
+	X = &h58
+	Y = &h59
+	Z = &h5A
+	LWin = VK_LWIN
+	RWin = VK_RWIN
+	Apps = VK_APPS
+	Sleep = VK_SLEEP
+	NumPad0 = VK_NUMPAD0
+	NumPad1 = VK_NUMPAD1
+	NumPad2 = VK_NUMPAD2
+	NumPad3 = VK_NUMPAD3
+	NumPad4 = VK_NUMPAD4
+	NumPad5 = VK_NUMPAD5
+	NumPad6 = VK_NUMPAD6
+	NumPad7 = VK_NUMPAD7
+	NumPad8 = VK_NUMPAD8
+	NumPad9 = VK_NUMPAD9
+	Multiply = VK_MULTIPLY
+	Add = VK_ADD
+	Separator = VK_SEPARATOR
+	Substract = VK_SUBTRACT
+	Decimal = VK_DECIMAL
+	Divide = VK_DIVIDE
+	F1 = VK_F1
+	F2 = VK_F2
+	F3 = VK_F3
+	F4 = VK_F4
+	F5 = VK_F5
+	F6 = VK_F6
+	F7 = VK_F7
+	F8 = VK_F8
+	F9 = VK_F9
+	F10 = VK_F10
+	F11 = VK_F11
+	F12 = VK_F12
+	F13 = VK_F13
+	F14 = VK_F14
+	F15 = VK_F15
+	F16 = VK_F16
+	F17 = VK_F17
+	F18 = VK_F18
+	F19 = VK_F19
+	F20 = VK_F20
+	F21 = VK_F21
+	F22 = VK_F22
+	F23 = VK_F23
+	F24 = VK_F24
+	NumLock = VK_NUMLOCK
+	Scroll = VK_SCROLL
+	LShiftKey = VK_LSHIFT
+	RShiftKey = VK_RSHIFT
+	LControlKey = VK_LCONTROL
+	RControlKey = VK_RCONTROL
+	LMenu = VK_LMENU
+	RMenu = VK_RMENU
+	BrowserBack = VK_BROWSER_BACK
+	BrowserForward = VK_BROWSER_FORWARD
+	BrowserRefresh = VK_BROWSER_REFRESH
+	BrowserStop = VK_BROWSER_STOP
+	BrowserSearch = VK_BROWSER_SEARCH
+	BrowserFavorites = VK_BROWSER_FAVORITES
+	BrowserHome = VK_BROWSER_HOME
+	VolumeMute = VK_VOLUME_MUTE
+	VolumeDown = VK_VOLUME_DOWN
+	VolumeUp = VK_VOLUME_UP
+	MediaNextTrack = VK_MEDIA_NEXT_TRACK
+	MediaPreviousTrack = VK_MEDIA_PREV_TRACK
+	MediaStop = VK_MEDIA_STOP
+	MediaPlayPause = VK_MEDIA_PLAY_PAUSE
+	LaunchMail = VK_LAUNCH_MAIL
+	SelectMedia = VK_LAUNCH_MEDIA_SELECT
+	LaunchApplication1 = VK_LAUNCH_APP1
+	LaunchApplication2 = VK_LAUNCH_APP2
+	Oem1 = VK_OEM_1
+	Oemplus = VK_OEM_PLUS
+	Oemcomma = VK_OEM_COMMA
+	OemMinus = VK_OEM_MINUS
+	OemPeriod = VK_OEM_PERIOD
+	Oem2 = VK_OEM_2
+	OemQuestion = VK_OEM_2
+	Oem3 = VK_OEM_3
+	Oemtilde = VK_OEM_3
+	Oem4 = VK_OEM_4
+	OemOpenBrackets = VK_OEM_4
+	Oem5 = VK_OEM_5
+	OemPipe = VK_OEM_5
+	Oem6 = VK_OEM_6
+	OemCloseBrackets = VK_OEM_6
+	Oem7 = VK_OEM_7
+	OemQuotes = VK_OEM_7
+	Oem8 = VK_OEM_8
+	Oem102 = VK_OEM_102
+	OemBackslash = VK_OEM_102
+	ProcessKey = VK_PROCESSKEY
+	Packet = VK_PACKET
+	Attn = VK_ATTN
+	Crsel = VK_CRSEL
+	Exsel = VK_EXSEL
+	EraseEof = VK_EREOF
+	Play = VK_PLAY
+	NoName = VK_NONAME
+	Zoom = VK_ZOOM
+	Pa1 = VK_PA1
+	OemClear = VK_OEM_CLEAR
+
+	KeyCode = &hffff
+
+	Shift = &h10000
+	Control = &h20000
+	Alt = &h40000
+
+	Modifiers = &hffff
+End Enum
+
+Class KeyEventArgs
+	Inherits EventArgs
+Public
+	Sub KeyEventArgs(keyData As Keys)
+		key = keyData
+	End Sub
+
+	Function Alt() As Boolean
+		Alt = key And Keys.Menu
+	End Function
+
+	Function Control() As Boolean
+		Control = key And Keys.Control
+	End Function
+
+	Function Shift() As Boolean
+		Shift = key And Keys.Shift
+	End Function
+
+	Function KeyCode() As Keys
+		KeyCode = key And Keys.KeyCode
+	End Function
+
+	Function KeyData() As Keys
+		KeyData = key
+	End Function
+
+	Function Modifiers() As Keys
+		Modifiers = key And Keys.Modifiers
+	End Function
+
+	Function KeyValue() As Long
+		KeyValue = key As Long
+	End Function
+
+	Sub Handled(handled As Boolean)
+		h = handled
+	End Sub
+
+	Function Handled() As Boolean
+		Handled = h
+	End Function
+
+Private
+	key As Keys
+	h As Boolean
+End Class
+
+Delegate Sub KeyEventHandler(sender As Object, e As KeyEventArgs)
+
+End Namespace 'Forms
+End Namespace 'UI
+End Namespace 'Widnows
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/MakeControlEventHandler.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/MakeControlEventHandler.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Forms/MakeControlEventHandler.ab	(revision 506)
@@ -0,0 +1,79 @@
+/*
+注意：インクルードファイルではありません。
+イベント処理の実装コード生成プログラム。
+*/
+
+Imports System
+Imports System.IO
+Imports System.Text
+Imports ActiveBasic
+Imports ActiveBasic.CType
+
+Function EventNameToMemberVariableName(eventName As String) As String
+	'先頭1字を小文字化
+	Dim t = New StringBuilder(eventName)
+	t[0] = ToLower(t[0])
+	Return t.ToString
+End Function
+
+Sub OutputEventHandlerCode(out As TextWriter, eventName As String, argBase As String, comment As String)
+	Dim eventMember = EventNameToMemberVariableName(eventName)
+	Dim handlerType = argBase & "Handler"
+	Dim argsType = argBase & "Args"
+	out.WriteLine("Public")
+	out.WriteLine(Ex"\t/*!")
+	out.WriteLine(Ex"\t@brief " & eventName & "イベントハンドラを追加する")
+	out.WriteLine(Ex"\t*/")
+	out.WriteLine(Ex"\tSub Add" & eventName & "(h As " & handlerType & ")")
+	out.WriteLine(Ex"\t\tIf IsNothing(" & eventMember & ") Then")
+	out.WriteLine(Ex"\t\t\t" & eventMember & " = New " & handlerType)
+	out.WriteLine(Ex"\t\tEnd If")
+	out.WriteLine(Ex"\t\t" & eventMember & " += h")
+	out.WriteLine(Ex"\tEnd Sub")
+	out.WriteLine(Ex"\t/*!")
+	out.WriteLine(Ex"\t@brief " & eventName & "イベントハンドラを削除する")
+	out.WriteLine(Ex"\t*/")
+	out.WriteLine(Ex"\tSub Remove" & eventName & "(h As " & handlerType & ")")
+	out.WriteLine(Ex"\t\tIf Not IsNothing(" & eventMember & ") Then")
+	out.WriteLine(Ex"\t\t\t" & eventMember & " -= h")
+	out.WriteLine(Ex"\t\tEnd If")
+	out.WriteLine(Ex"\tEnd Sub")
+	out.WriteLine("Protected")
+	out.WriteLine(Ex"\t/*!")
+	out.WriteLine(Ex"\t@brief " & comment)
+	out.WriteLine(Ex"\t*/")
+	out.WriteLine(Ex"\tVirtual Sub On" & eventName & "(e As " & argsType & ")")
+	out.WriteLine(Ex"\t\tIf Not IsNothing(" & eventMember & ") Then")
+	out.WriteLine(Ex"\t\t\t" & eventMember & "(This, e)")
+	out.WriteLine(Ex"\t\tEnd If")
+	out.WriteLine(Ex"\tEnd Sub")
+	out.WriteLine("Private")
+	out.WriteLine(Ex"\t" & eventMember & " As " & handlerType)
+	out.WriteLine()
+End Sub
+
+'OutputEventHandlerCode("PaintDC", "PaintDCEventHandler", 
+'	"ウィンドウの描画が必要なときに呼び出されます。")
+
+Sub MakeControlEvent(t As String)
+	Dim event As String, handler As String, comment As String
+	Dim n As DWord, i As DWord
+	/*Using*/ Dim in = New StreamReader(t + "EventList.txt")
+		/*Using*/ Dim out = New StreamWriter(t + "Event.sbp")
+			Do
+				Dim s = in.ReadLine
+				If IsNothing(s) Then
+					Exit Do
+				End If
+				If s[0] = Asc("'") Then Continue
+				Dim a = ActiveBasic.Strings.Detail.Split(s, 9) 'Tab
+				If a.Count >= 3 Then
+					OutputEventHandlerCode(out, a[0], a[1], a[2])
+				End If
+			Loop
+		in.Close() 'End Using
+	out.Close() 'End Using
+End Sub
+
+MakeControlEvent("Control")
+End
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/WindowHandle.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/WindowHandle.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/WindowHandle.sbp	(revision 506)
@@ -0,0 +1,800 @@
+'Classes/ActiveBasic/Windows/WindowHandle.sbp
+
+#ifdef _WIN64
+Declare Function _System_GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
+Declare Function _System_SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLongPtr (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
+Declare Function _System_GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
+Declare Function _System_SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLongPtr (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
+#else
+Declare Function _System_GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLong (hWnd As HWND, nIndex As Long) As LONG_PTR
+Declare Function _System_SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLong (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
+Declare Function _System_GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLong (hWnd As HWND, nIndex As Long) As LONG_PTR
+Declare Function _System_SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLong (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
+#endif
+Declare Function _System_GetParent Lib "user32" Alias "GetParent" (hWnd As HWND) As HWND
+Declare Function _System_SetParent Lib "user32" Alias "SetParent" (hWnd As HWND, hwndParent As HWND) As HWND
+Declare Function _System_GetMenu Lib "user32" Alias "GetMenu" (hWnd As HWND) As HMENU
+Declare Function _System_SetMenu Lib "user32" Alias "SetMenu" (hWnd As HWND, hmenu As HMENU) As HMENU
+Declare Function _System_InvalidateRect Lib "user32" Alias "InvalidateRect" (hWnd As HWND, ByRef Rect As RECT, bErase As BOOL) As BOOL
+Declare Function _System_InvalidateRgn Lib "user32" Alias "InvalidateRgn" (hWnd As HWND, hRgn As HRGN, bErase As BOOL) As BOOL
+Declare Function _System_ValidateRect Lib "user32" Alias "ValidateRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL
+Declare Function _System_ValidateRgn Lib "user32" Alias "ValidateRgn" (hWnd As HWND, hRgn As HRGN) As BOOL
+Declare Function _System_BeginPaint Lib "user32" Alias "BeginPaint" (hWnd As HWND, ByRef ps As PAINTSTRUCT) As HDC
+Declare Function _System_EndPaint Lib "user32" Alias "EndPaint" (hWnd As HWND, ByRef ps As PAINTSTRUCT) As HDC
+Declare Function _System_ClientToScreen Lib "user32" Alias "ClientToScreen" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
+Declare Function _System_ScreenToClient Lib "user32" Alias "ScreenToClient" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
+Declare Function _System_CreateCaret Lib "user32" Alias "CreateCaret" (hWnd As HWND, hBitmap As HBITMAP, nWidth As Long, nHeight As Long) As BOOL
+Declare Function _System_HideCaret Lib "user32" Alias "HideCaret" (hWnd As HWND) As BOOL
+Declare Function _System_ShowCaret Lib "user32" Alias "ShowCaret" (hWnd As HWND) As BOOL
+Declare Function _System_DrawMenuBar Lib "user32" Alias "DrawMenuBar" (hwnd As HWND) As BOOL
+Declare Function _System_GetWindowRect Lib "user32" Alias "DrawMenuBar" (hWnd As HWND, ByRef Rect As RECT) As BOOL
+Declare Function _System_IsWindow Lib "user32" Alias "IsWindow" (hWnd As HWND) As BOOL
+Declare Function _System_IsIconic Lib "user32" Alias "IsIconic" (hWnd As HWND) As BOOL
+Declare Function _System_GetClientRect Lib "user32" Alias "GetClientRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL
+Declare Function _System_GetProp Lib "user32" Alias _FuncName_GetProp (hWnd As HWND, pString As PCTSTR) As HANDLE
+Declare Function _System_SetProp Lib "user32" Alias _FuncName_SetProp (hWnd As HWND, pString As PCTSTR, hData As HANDLE) As BOOL
+Declare Function _System_GetClassName Lib "user32" Alias _FuncName_GetClassName (hWnd As HWND, lpClassName As PTSTR, nMaxCount As Long) As Long
+Declare Function _System_GetScrollInfo Lib "user32" Alias "GetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO) As BOOL
+Declare Function _System_SetScrollInfo Lib "user32" Alias "SetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO, bRedraw As Long) As BOOL
+Declare Function _System_GetSystemMenu Lib "user32" Alias "GetSystemMenu" (hWnd As HWND, bRevert As BOOL) As HMENU
+Declare Function _System_GetDC Lib "user32" Alias "GetDC" (hwnd As HWND) As HDC
+Declare Function _System_GetDCEx Lib "user32" Alias "GetDCEx" (hwnd As HWND, hrgnClip As HRGN, flags As DWord) As HDC
+Declare Function _System_GetWindowDC Lib "user32" Alias "GetWindowDC" (hwnd As HWND) As HDC
+Declare Function _System_ReleaseDC Lib "user32" Alias "ReleaseDC" (hwnd As HWND, hdc As HDC) As BOOL
+Declare Function _System_SendMessage Lib "user32" Alias _FuncName_SendMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+Declare Function _System_PostMessage Lib "user32" Alias _FuncName_PostMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+Declare Function _System_SendDlgItemMessage Lib "user32" Alias _FuncName_SendDlgItemMessage (hwnd As HWND, id As DWord, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+Declare Function _System_GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (hwnd As HWND, pdwProcessId As *DWord) As DWord
+
+Namespace ActiveBasic
+Namespace Windows
+
+Class WindowHandle
+	hwnd As HWND
+Public
+	Sub WindowHandle()
+		hwnd = 0
+	End Sub
+
+	Sub WindowHandle(hwndNew As HWND)
+		hwnd = hwndNew
+	End Sub
+
+	Const Function HWnd() As HWND
+		Return hwnd
+	End Function
+
+	Const Function Operator() As HWND
+		Return hwnd
+	End Function
+
+	Function BringToTop() As Boolean
+		Return BringWindowToTop(hwnd) As Boolean
+	End Function
+
+	Function BeginPaint(ByRef ps As PAINTSTRUCT) As HDC
+		Return _System_BeginPaint(hwnd, ps)
+	End Function
+/*
+	Const Function ChildFromPoint(x As Long, y As Long) As WindowHandle
+		Return New WindowHandle(ChildWindowFromPoint(hwnd, x, y))
+	End Function
+
+	Const Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As WindowHandle
+		Return New WindowHandle(ChildWindowFromPointEx(hwnd, x, y, flags))
+	End Function
+*/
+	Const Function ClientToScreen(ByRef pt As POINTAPI) As Boolean
+		Return _System_ClientToScreen(hwnd, pt) As Boolean
+	End Function
+
+	Const Function ClientToScreen(ByRef rc As RECT) As Boolean
+		Dim ppt = VarPtr(rc) As *POINTAPI
+		Return (_System_ClientToScreen(hwnd, ppt[0]) <> FALSE And _System_ClientToScreen(hwnd, ppt[1]) <> FALSE) As Boolean
+	End Function
+
+	Function Close() As Boolean
+		Return CloseWindow(hwnd) As Boolean
+	End Function
+
+	Function CreateCaret(hbmp As HBITMAP, width As Long, height As Long) As Boolean
+		Return _System_CreateCaret(hwnd, hbmp, width, height) As Boolean
+	End Function
+
+	Function Destroy() As Boolean
+		Return DestroyWindow(hwnd) As Boolean
+	End Function
+
+	Function DrawMenuBar() As Boolean
+		Return _System_DrawMenuBar(hwnd) As Boolean
+	End Function
+/*
+	Function EnableScrollBar(SBFlags As DWord, arrows As DWord) As Boolean
+		Return EnableScrollBar(hwnd, SBFlags, arrows) As Boolean
+	End Function
+*/
+	Function Enable(enable As Boolean) As Boolean
+		Return EnableWindow(hwnd, enable) As Boolean
+	End Function
+
+	Function EndPaint(ByRef ps As PAINTSTRUCT) As Boolean
+		Return _System_EndPaint(hwnd, ps) As Boolean
+	End Function
+
+	Const Function EnumChilds(enumFunc As WNDENUMPROC, lp As LPARAM) As Boolean
+		Return EnumChildWindows(hwnd, enumFunc, lp) As Boolean
+	End Function
+
+	Function Flash(invert As Boolean) As Boolean
+		Return FlashWindow(hwnd, invert) As Boolean
+	End Function
+
+	Const Function GetClassLongPtr(index As Long) As LONG_PTR
+		Return _System_GetClassLongPtr(hwnd, index)
+	End Function
+
+	Const Function GetClassName(className As PTSTR, maxCount As Long) As Long
+		Return _System_GetClassName(hwnd, className, maxCount)
+	End Function
+
+	Const Function GetClientRect(ByRef rc As RECT) As Boolean
+		Return _System_GetClientRect(hwnd, rc) As Boolean
+	End Function
+/*
+	Const Function GetContextHelpId() As DWord
+		Return GetWindowContextHelpId(hwnd)
+	End Function
+*/
+	Function GetDC() As HDC
+		Return _System_GetDC(hwnd)
+	End Function
+
+	Function GetDCEx(hrgnClip As HRGN, flags As DWord) As HDC
+		Return _System_GetDCEx(hwnd, hrgnClip, flags)
+	End Function
+/*
+	Const Function GetDlgCtrlID() As Long
+		Return GetDlgCtrlID(hwnd)
+	End Function
+
+	Const Function GetDlgItem(idDlgItem As Long) As WindowHandle
+		Return GetDlgItem(hwnd, idDlgItem)
+	End Function
+
+	Const Function GetDlgItemText(idDlgItem As Long, ps As PTSTR, maxCount As Long) As Long
+		Return GetDlgItemText(hwnd, idDlgItem, ps, maxCount)
+	End Function
+*/
+	Const Function GetMenu() As HMENU
+		Return _System_GetMenu(hwnd)
+	End Function
+/*
+	Const Function GetParent() As WindowHandle
+		Return New WindowHandle(_System_GetParent(hwnd))
+	End Function
+*/
+	Const Function GetProp(str As String) As HANDLE
+		Return _System_GetProp(hwnd, ToTCStr(str))
+	End Function
+
+	Const Function GetProp(psz As PCTSTR) As HANDLE
+		Return _System_GetProp(hwnd, psz)
+	End Function
+
+	Const Function GetProp(atom As ATOM) As HANDLE
+		Return _System_GetProp(hwnd, atom As ULONG_PTR As PCTSTR)
+	End Function
+
+	Const Function GetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As Boolean
+		Return _System_GetScrollInfo(hwnd, fnBar, si) As Boolean
+	End Function
+/*
+	Const Function GetSystemMenu(revert As Boolean) As HMENU
+		Return GetSystemMenu(hwnd, revert)
+	End Function
+
+	Const Function GetUpdateRect(ByRef rc As RECT, erase As Boolean) As Boolean
+		Return GetUpdateRact(hwnd, rc, erase) As Boolean
+	End Function
+
+	Const Function GetUpdateRgn(hrgn As HRGN, erase As Boolean) As Boolean
+		Return GetUpdateRgn(hwnd, hrgn, erase) As Boolean
+	End Function
+
+	Const Function GetWindow(cmd As DWord) As WindowHandle
+		Return GetWindow(hwnd, cmd)
+	End Function
+*/
+	Function GetWindowDC() As HDC
+		Return _System_GetWindowDC(hwnd)
+	End Function
+
+	Const Function GetWindowLongPtr(index As Long) As LONG_PTR
+		Return _System_GetWindowLongPtr(hwnd, index)
+	End Function
+/*
+	Const Function GetWindowPlasement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
+		Return GetWindowPlasement(hwnd, wndpl) As Boolean
+	End Function
+*/
+	Const Function GetWindowRect(ByRef rc As RECT) As Boolean
+		Return _System_GetWindowRect(hwnd, rc) As Boolean
+	End Function
+
+	Const Function GetText(ps As PTSTR, maxCount As Long) As Boolean
+		Return GetWindowText(hwnd, ps, maxCount) As Boolean
+	End Function
+
+	Const Function GetTextLength() As Long
+		Return GetWindowTextLength(hwnd)
+	End Function
+
+	Const Function GetWindowThreadId() As DWord
+		Return _System_GetWindowThreadProcessId(hwnd, 0)
+	End Function
+
+	Const Function GetWindowThreadProcessId(ByRef processId As DWord) As DWord
+		Return _System_GetWindowThreadProcessId(hwnd, VarPtr(processId))
+	End Function
+
+	Function HideCaret() As Boolean
+		Return _System_HideCaret(hwnd) As Boolean
+	End Function
+
+	Function InvalidateRect(ByRef rc As RECT, erace As Boolean) As Boolean
+		Return _System_InvalidateRect(hwnd, rc, erace) As Boolean
+	End Function
+
+	Function InvalidateRect(ByRef rc As RECT) As Boolean
+		Return _System_InvalidateRect(hwnd, rc, TRUE) As Boolean
+	End Function
+
+	Function InvalidateRgn(hrgn As HRGN, erace As Boolean) As Boolean
+		Return _System_InvalidateRgn(hwnd, hrgn, erace) As Boolean
+	End Function
+
+	Function InvalidateRgn(hrgn As HRGN) As Boolean
+		Return _System_InvalidateRgn(hwnd, hrgn, TRUE) As Boolean
+	End Function
+
+	Function Invalidate(erace As Boolean) As Boolean
+		Return _System_InvalidateRect(hwnd, ByVal 0, erace) As Boolean
+	End Function
+
+	Function Invalidate() As Boolean
+		Return _System_InvalidateRect(hwnd, ByVal 0, TRUE) As Boolean
+	End Function
+/*
+	Const Function IsChild(hwnd As HWND) As Boolean
+		Return IsChild(This.hwnd, hwnd) As Boolean
+	End Function
+
+	Const Function IsDialogMessage(ByRef msg As MSG) As Boolean
+		Return IsDialogMessage(hwnd, msg) As Boolean
+	End Function
+*/
+	Const Function IsIconic() As Boolean
+		Return _System_IsIconic(hwnd) As Boolean
+	End Function
+
+	Const Function IsWindow() As Boolean
+		Return _System_IsWindow(hwnd) As Boolean
+	End Function
+
+	Const Function IsEnabled() As Boolean
+		Return IsWindowEnabled(hwnd) As Boolean
+	End Function
+
+	Const Function IsUnicode() As Boolean
+		Return IsWindowUnicode(hwnd) As Boolean
+	End Function
+
+	Const Function IsVisible() As Boolean
+		Return IsWindowVisible(hwnd) As Boolean
+	End Function
+/*
+	Const Function IsZoomed() As Boolean
+		Return IsZoomed(hwnd) As Boolean
+	End Function
+
+	Function KillTimer(idEvent As ULONG_PTR) As Boolean
+		Return KillTimer(idEvent) As Boolean
+	End Function
+*/
+	Function LockUpdate() As Boolean
+		Return LockWindowUpdate(hwnd) As Boolean
+	End Function
+/*
+	Function MapPoints(hwndTo As HWND, pPoints As *POINTAPI, cPoints As DWord) As Long
+		Return MapWindowPoints(hwnd, hwndTo, pPoints, cPoints)
+	End Function
+
+	Function MapPoints(hwndTo As HWND, ByRef rc As RECT) As Long
+		Return MapWindowPoints(hwnd, hwndTo, VarPtr(rc) As *POINTAPI, 2)
+	End Function
+
+	Const Function MessageBox(text As PCTSTR, caption As PCTSTR, uType As DWord) As Long
+		Return MessageBox(hwnd, text, caption, uType)
+	End Function
+
+	Const Function MessageBox(text As PCTSTR, caption As PCTSTR) As Long
+		Return MessageBox(hwnd, text, caption, MB_OK)
+	End Function
+
+	Const Function MessageBox(text As PCTSTR) As Long
+		Return MessageBox(hwnd, text, 0, MB_OK)
+	End Function
+*/
+	Function Move(x As Long, y As Long, width As Long, height As Long, repaint As Boolean) As Boolean
+		Return MoveWindow(hwnd, x, y, width, height, repaint) As Boolean
+	End Function
+
+	Function Move(x As Long, y As Long, width As Long, height As Long) As Boolean
+		Return MoveWindow(hwnd, x, y, width, height, TRUE) As Boolean
+	End Function
+
+	Function Move(ByRef rc As RECT, repaint As Boolean) As Boolean
+		With rc
+			Return MoveWindow(hwnd, .left, .top, .right - .left, .bottom - .top, repaint) As Boolean
+		End With
+	End Function
+
+	Function Move(ByRef rc As RECT) As Boolean
+		With rc
+			Return MoveWindow(hwnd, .left, .top, .right - .left, .bottom - .top, TRUE) As Boolean
+		End With
+	End Function
+/*
+	Function OpenClipboard() As Boolean
+		Return OpenClipboard(hwnd) As Boolean
+	End Function
+
+	Function OpenIcon() As Boolean
+		Return OpenIcon(hwnd) As Boolean
+	End Function
+*/
+	Function PostMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As Boolean
+		Return _System_PostMessage(hwnd, msg, wp, lp) As Boolean
+	End Function
+
+	Function PostMessage(msg As DWord) As Boolean
+		Return _System_PostMessage(hwnd, msg, 0, 0) As Boolean
+	End Function
+/*
+	Function RedrawWindow(ByRef rcUpdate As RECT, hrgnUpdate As HRGN, flags As DWord) As Boolean
+		Return RedrawWindow(hwnd, rcUpdatre, hrgnUpdate, flags) As Boolean
+	End Function
+*/
+	Function ReleaseDC(hdc As HDC) As Boolean
+		Return _System_ReleaseDC(hwnd, hdc) As Boolean
+	End Function
+/*
+	Function RemoveProp(str As String) As HANDLE
+		Return RemoveProp(hwnd, ToTCStr(str))
+	End Function
+
+	Function RemoveProp(psz As PCTSTR) As HANDLE
+		Return RemoveProp(hwnd, psz)
+	End Function
+
+	Function RemoveProp(atom As ATOM) As HANDLE
+		Return RemoveProp(hwnd, atom As ULONG_PTR As PCTSTR)
+	End Function
+*/
+	Const Function ScreenToClient(ByRef pt As POINTAPI) As Boolean
+		Return _System_ScreenToClient(hwnd, pt) As Boolean
+	End Function
+
+	Const Function ScreenToClient(ByRef rc As RECT) As Boolean
+		Dim ppt = VarPtr(rc) As *POINTAPI
+		Return (_System_ScreenToClient(hwnd, ppt[0]) <> FALSE And _System_ScreenToClient(hwnd, ppt[1]) <> FALSE) As Boolean
+	End Function
+
+	Function Scroll(dx As Long, dy As Long, ByRef rcScroll As RECT, ByRef rcClip As RECT, hrgnUpdate As HRGN, ByRef rcUpdate As RECT, flags As DWord) As Boolean
+		Return ScrollWindowEx(hwnd, dx, dy, rcScroll, rcClip, hrgnUpdate, rcUpdate, flags) As Boolean
+	End Function
+
+	Function SendDlgItemMessage(idDlgItem As Long, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+		Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, wp, lp)
+	End Function
+
+	Function SendDlgItemMessage(idDlgItem As Long, msg As DWord) As LRESULT
+		Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, 0, 0)
+	End Function
+
+	Function SendMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+		Return _System_SendMessage(hwnd, msg, wp, lp)
+	End Function
+
+	Function SendMessage(msg As DWord) As LRESULT
+		Return _System_SendMessage(hwnd, msg, 0, 0)
+	End Function
+/*
+	Function SetActiveWindow() As WindowHandle
+		Return New WindowHandle(SetActiveWindow(hwnd))
+	End Function
+
+	Function SetDlgItemText(idDlgItem As Long, psz As PCTSTR) As Boolean
+		Return SetDlgItemText(hwnd, idDlgItem, psz) As Boolean
+	End Function
+
+	Function SetCapture() As WindowHandle
+		Return New WindowHandle(SetCapture(hwnd))
+	End Function
+*/
+	Function SetClassLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
+		Return _System_SetClassLongPtr(hwnd, index, newLong)
+	End Function
+/*
+	Function SetFocus() As WindowHandle
+		Return New WindowHandle(SetFocus(hwnd))
+	End Function
+*/
+	Function SetForeground() As Boolean
+		Return SetForegroundWindow(hwnd) As Boolean
+	End Function
+
+	Function SetMenu(hmenu As HMENU) As Boolean
+		Return _System_SetMenu(hwnd, hmenu) As Boolean
+	End Function
+
+	Function SetParent(hwndNewParent As HWND) As WindowHandle
+		Return New WindowHandle(_System_SetParent(hwnd, hwndNewParent))
+	End Function
+
+	Function SetProp(str As String, hData As HANDLE) As Boolean
+		Return _System_SetProp(hwnd, ToTCStr(str), hData) As Boolean
+	End Function
+
+	Function SetProp(psz As PCTSTR, hData As HANDLE) As Boolean
+		Return _System_SetProp(hwnd, psz, hData) As Boolean
+	End Function
+
+	Function SetProp(atom As ATOM, hData As HANDLE) As Boolean
+		Return This.SetProp((atom As ULONG_PTR) As PCTSTR, hData) As Boolean
+	End Function
+
+	Function SetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO, redraw As Boolean) As Boolean
+		Return _System_SetScrollInfo(hwnd, fnBar, si, redraw) As Boolean
+	End Function
+
+	Function SetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As Boolean
+		Return _System_SetScrollInfo(hwnd, fnBar, si, TRUE) As Boolean
+	End Function
+/*
+	Function SetTimer(idEvent As ULONG_PTR, elapse As DWord, timerFunc As TIMERPROC) As ULONG_PTR
+		Return SetTmer(hwnd, idEvent, elapse, timerFunc)
+	End Function
+
+	Function SetTimer(idEvent As ULONG_PTR, elapse As DWord) As ULONG_PTR
+		Return This.SetTmer(hwnd, idEvent, elapse, 0)
+	End Function
+
+	Function SetContextHelpId(contextHelpId As DWord) As Boolean
+		Return SetContextHelpId(hwnd, contextHelpId) As Boolean
+	End Function
+*/
+	Function SetWindowLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
+		Return _System_SetWindowLongPtr(hwnd, index, newLong)
+	End Function
+/*
+	Function SetWindowPlacement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
+		Return SetWindowPlacement(hwnd, wndpl) As Boolean
+	End Function
+*/
+	Function SetPos(hwndInsertAfter As HWND, x As Long, y As Long, cx As Long, cy As Long, flags As DWord) As Boolean
+		Return SetWindowPos(hwnd, hwndInsertAfter, x, y, cx, cy, flags) As Boolean
+	End Function
+
+	Function SetPos(hwndInsertAfter As HWND, ByRef rc As RECT, flags As DWord) As Boolean
+		With rc
+			Return SetWindowPos(hwnd, hwndInsertAfter, .left, .top, .right - .left, .bottom - .top, flags) As Boolean
+		End With
+	End Function
+
+	Function SetRgn(hrgn As HRGN, redraw As Boolean) As Boolean
+		Return SetWindowRgn(hwnd, hrgn, redraw) As Boolean
+	End Function
+
+	Function SetRgn(hrgn As HRGN) As Boolean
+		Return SetWindowRgn(hwnd, hrgn, TRUE) As Boolean
+	End Function
+
+	Function SetText(psz As PCTSTR) As Boolean
+		Return SetWindowText(hwnd, psz) As Boolean
+	End Function
+
+	Function SetText(str As String) As Boolean
+		Return SetWindowText(hwnd, ToTCStr(str)) As Boolean
+	End Function
+
+	Function ShowCaret() As Boolean
+		Return _System_ShowCaret(hwnd) As Boolean
+	End Function
+/*
+	Function ShowScrollBar(bar As DWord, show As Boolean) As Boolean
+		Return ShowScrollBar(hwnd, bar, show) As Boolean
+	End Function
+
+	Function ShowScrollBar(bar As DWord) As Boolean
+		Return ShowScrollBar(hwnd, bar, TRUE) As Boolean
+	End Function
+*/
+	Function Show(cmdShow As DWord) As Boolean
+		Return ShowWindow(hwnd, cmdShow) As Boolean
+	End Function
+
+	Function ShowAsync(cmdShow As DWord) As Boolean
+		Return ShowWindowAsync(hwnd, cmdShow) As Boolean
+	End Function
+
+	Function Update() As Boolean
+		Return UpdateWindow(hwnd) As Boolean
+	End Function
+
+	Function ValidateRect(ByRef rc As RECT) As Boolean
+		Return _System_ValidateRect(hwnd, rc) As Boolean
+	End Function
+
+	Function ValidateRgn(hrgn As HRGN) As Boolean
+		Return _System_ValidateRgn(hwnd, hrgn) As Boolean
+	End Function
+
+	Function Validate() As Boolean
+		Return _System_ValidateRect(hwnd, ByVal 0) As Boolean
+	End Function
+
+	' Get/SetWindowLongPtr Wrappers
+
+	Const Function GetExStyle() As DWord
+		Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
+	End Function
+
+	Const Function GetStyle() As DWord
+		Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
+	End Function
+#ifdef _UNDEF
+	Const Function GetWndProc() As WNDPROC
+		Return _System_GetWindowLongPtr(hwnd, GWLP_WNDPROC) As WNDPROC
+	End Function
+#endif
+	Const Function GetInstance() As HINSTANCE
+		Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
+	End Function
+
+	Const Function GetUserData() As LONG_PTR
+		Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
+	End Function
+
+	Function SetExStyle(style As DWord) As DWord
+		Return _System_SetWindowLongPtr(hwnd, GWL_EXSTYLE, style) As DWord
+	End Function
+
+	Function SetStyle(style As DWord) As DWord
+		Return _System_SetWindowLongPtr(hwnd, GWL_STYLE, style) As DWord
+	End Function
+#ifdef _UNDEF
+	Function SetWndProc(wndProc As WNDPROC) As WNDPROC
+		Return _System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, wndProc As WNDPROC) As WNDPROC
+	End Function
+#endif
+	Function SetUserData(value As LONG_PTR) As LONG_PTR
+		Return _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, value As LONG_PTR)
+	End Function
+
+	' Propaties
+
+	Const Function ClientRect() As RECT
+		_System_GetClientRect(hwnd, ClientRect)
+	End Function
+#ifdef _UNDEF
+	Sub ClientRect(ByRef rc As RECT)
+		Dim hasMenu As BOOL
+		If IsChild() = False And GetMenu() <> 0 Then
+			hasMenu = TRUE
+		Else
+			hasMenu = FALSE
+		End If
+		AdjustWindowRectEx(rc, GetStyle(), hasMenu, GetExStyle())
+		This.Move(rc) ' WindowRect = rc
+	End Sub
+#endif
+	Const Function WindowRect() As RECT
+		_System_GetWindowRect(hwnd, WindowRect)
+	End Function
+
+	Sub WindowRect(ByRef rc As RECT)
+		This.Move(rc)
+	End Sub
+#ifdef _UNDEF
+	Const Function ContextHelpID() As DWord
+		Return GetContextHelpId(hwnd)
+	End Function
+
+	Sub ContextHelpID(newID As DWord)
+		_System_SetContextHelpId(hwnd, newId)
+	End Sub
+
+	Const Function DlgCtrlID() As Long
+		Return GetDlgCtrlID(hwnd)
+	End Function
+
+	Sub DlgCtrlId(newId As Long)
+		_System_SetWindowLongPtr(hwnd, GWLP_ID, newId)
+	End Sub
+
+	Function DlgItem(idDlgItem As Long) As WindowHandle
+		Dim w As WindowHandle(GetDlgItem(hwnd, idDlgItem))
+		Return w
+	End Function
+#endif
+	Const Function ExStyle() As DWord
+		Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
+	End Function
+
+	Sub ExStyle(newExStyle As DWord)
+		_System_SetWindowLongPtr(hwnd, GWL_EXSTYLE, newExStyle)
+	End Sub
+
+	Const Function Style() As DWord
+		Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
+	End Function
+
+	Sub Style(newStyle As DWord)
+		_System_SetWindowLongPtr(hwnd, GWL_STYLE, newStyle)
+	End Sub
+
+	Const Function Enabled() As Boolean
+		Return IsWindowEnabled(hwnd) As Boolean
+	End Function
+
+	Sub Enabled(enable As Boolean)
+		EnableWindow(hwnd, enable)
+	End Sub
+
+	Const Function Font() As HFONT
+		Return _System_SendMessage(hwnd, WM_GETFONT, 0, 0) As HFONT
+	End Function
+
+	Sub Font(hfntNew As HFONT)
+		_System_SendMessage(hwnd, WM_SETFONT, hfntNew As WPARAM, TRUE)
+	End Sub
+
+	Const Function Maximized() As Boolean
+		Return IsIconic() As Boolean
+	End Function
+
+	Sub Maximized(maximized As Boolean)
+		If maximized <> False Then
+			ShowWindow(hwnd, SW_SHOWMAXIMIZED)
+		Else
+			ShowWindow(hwnd, SW_RESTORE)
+		End If
+	End Sub
+
+	Const Function Minimized() As Boolean
+		Return _System_IsIconic(hwnd) As Boolean
+	End Function
+
+	Sub Minimized(minimized As Boolean)
+		If minimized <> False Then
+			CloseWindow(hwnd)
+		Else
+			OpenIcon(hwnd)
+		End If
+	End Sub
+
+	Const Function Instance() As HINSTANCE
+		Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
+	End Function
+
+	' IsWindow, IsUnicodeはメソッドと同じ。
+
+	Const Function Parent() As WindowHandle
+		Return New WindowHandle(_System_GetParent(hwnd))
+	End Function
+
+	Sub Parent(hwndNewParent As HWND)
+		_System_SetParent(hwnd, hwndNewParent)
+	End Sub
+
+	Const Function ProcessId() As DWord
+		GetWindowThreadProcessId(ProcessId)
+	End Function
+
+	Const Function ThreadId() As DWord
+		Return GetWindowThreadProcessId(ByVal 0)
+	End Function
+
+	Const Function Menu() As HMENU
+		Return _System_GetMenu(hwnd)
+	End Function
+
+	Sub Menu(hmenuNew As HMENU)
+		_System_SetMenu(hwnd, hmenuNew)
+	End Sub
+
+	Const Function Prop(str As String) As HANDLE
+		Return GetProp(str)
+	End Function
+
+	Const Function Prop(psz As PCTSTR) As HANDLE
+		Return GetProp(psz)
+	End Function
+
+	Const Function Prop(atom As ATOM) As HANDLE
+		Return GetProp(atom)
+	End Function
+
+	Sub Prop(str As PCTSTR, h As HANDLE)
+		SetProp(str, h)
+	End Sub
+
+	Sub Prop(atom As ATOM, h As HANDLE)
+		SetProp(atom, h)
+	End Sub
+
+	Const Function Text() As String
+		Dim size = GetWindowTextLength(hwnd) + 1
+		Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR
+		Dim length = GetWindowText(hwnd, p, size)
+		Text = New String(p, length As Long)
+	End Function
+
+	Sub Text(newText As String)
+		SetWindowText(hwnd, ToTCStr(newText))
+	End Sub
+
+	Sub Text(newText As PCTSTR)
+		SetWindowText(hwnd, newText)
+	End Sub
+
+	Const Function TextLength() As Long
+		Return GetWindowTextLength(hwnd)
+	End Function
+#ifdef _UNDEF
+	Const Function UserData() As LONG_PTR
+		Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
+	End Function
+
+	Sub UserData(newValue As LONG_PTR)
+		_System_SetWindowLongPtr(hwnd, GWLP_USERDATA, newValue)
+	End Sub
+#endif
+	Const Function Visible() As Boolean
+		Return IsWindowVisible(hwnd) As Boolean
+	End Function
+
+	Sub Visible(visible As Boolean)
+		If visible <> False Then
+			ShowWindow(hwnd, SW_SHOW)
+		Else
+			ShowWindow(hwnd, SW_HIDE)
+		EndIf
+	End Sub
+#ifdef _UNDEF
+	Const Function WindowPlacement() As WINDOWPLACEMENT
+		WindowPlacement.length = Len(WindowPlacement)
+		GetWindowPlacement(hwnd, WindowPlacement)
+	End Function
+
+	Sub WindowPlacement(ByRef wndpl As WINDOWPLACEMENT)
+		SetWindowPlacement(wndpl)
+	End Sub
+
+	Const Function WndProc() As WNDPROC
+		Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
+	End Function
+
+	Sub WndProc(newWndProc As WNDPROC)
+		_System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, newWndProc As LONG_PTR)
+	End Sub
+#endif
+Protected
+	Sub SetHWnd(hwndNew As HWND)
+		hwnd = hwndNew
+	End Sub
+End Class
+
+End Namespace 'Widnows
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/Windows.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/Windows.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/Windows.ab	(revision 506)
@@ -0,0 +1,50 @@
+'Classes/ActiveBasic/Windows/Windows.ab
+
+Namespace ActiveBasic
+Namespace Windows
+
+Function GetPathFromIDList(pidl As LPITEMIDLIST) As String
+	Dim buf[ELM(MAX_PATH)] As TCHAR
+	If SHGetPathFromIDList(pidl, buf) Then
+		Return New String(buf)
+	Else
+		Return ""
+	End If
+End Function
+
+Function GetFolderPath(hwnd As HWND, folder As Long) As String
+	Dim pidl As LPITEMIDLIST
+	Dim hr = SHGetSpecialFolderLocation(hwnd, folder, pidl)
+	If SUCCEEDED(hr) Then
+		GetFolderPath = GetPathFromIDList(pidl)
+		CoTaskMemFree(pidl)
+	Else
+		GetFolderPath = ""
+	End If
+End Function
+
+Function GetFolderPath(folder As Long) As String
+	Return GetFolderPath(0, folder)
+End Function
+/*
+Function MessageBox(hw As HWND, s As PCSTR, t As PCSTR, b As DWord) As DWord
+	Return MessageBoxA(hw, s, t, b)
+End Function
+
+Function MessageBox(hw As HWND, s As PCWSTR, t As PCWSTR, b As DWord) As DWord
+	Return MessageBoxW(hw, s, t, b)
+End Function
+*/
+
+Namespace Detail
+Function _System_MessageBox(hw As HWND, s As PCSTR, t As PCSTR, b As DWord) As DWord
+	Return MessageBoxA(hw, s, t, b)
+End Function
+
+Function _System_MessageBox(hw As HWND, s As PCWSTR, t As PCWSTR, b As DWord) As DWord
+	Return MessageBoxW(hw, s, t, b)
+End Function
+End Namespace
+
+End Namespace 'Widnows
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Xml/Parser.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Xml/Parser.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/Xml/Parser.ab	(revision 506)
@@ -0,0 +1,290 @@
+Namespace ActiveBasic	
+Namespace Xml
+
+
+Class ParserException
+	Inherits System.Exception
+Public
+	Sub ParserException( message As String )
+		Exception( message )
+	End Sub
+End Class
+
+Class Parser
+	xmlString As String
+	currentIndex As Long
+
+	doc As System.Xml.XmlDocument
+
+	Static Const tokenLPar = &H3C		' <
+	Static Const tokenRPar = &H3E		' >
+	Static Const tokenSlash = &H2F	' /
+	Static Const xmlHeaderStr = "<?xml"
+	Static Const commentHeader = "<!--"
+	Static Const cdataHeader = "<![CDATA["
+	Static Const dtdHeader = "<!"
+	Static Const versionAttributeName = "version"
+	Static Const encodingAttributeName = "encoding"
+
+	Static Function IsAlpha( c As Char ) As Boolean
+		Return ( &H41 <= c and c <= &H5A or &H61 <= c and c <= &H7A )
+	End Function
+
+	Static Function IsUnderscore( c As Char ) As Boolean
+		Return ( c = &H5F )
+	End Function
+
+	Static Function IsNumber( c As Char ) As Boolean
+		Return ( &H30 <= c and c <= &H39 )
+	End Function
+
+	Static Function IsWhiteSpace( c As Char ) As Boolean
+		If c = &H20 Then
+			' 空白
+			Return True
+		ElseIf c = &H09 Then
+			' タブ文字
+			Return True
+		ElseIf c = &H0A or c = &H0D Then
+			' 改行
+			Return True
+		End If
+		' その他
+		Return False
+	End Function
+
+	Sub ts()
+		MessageBox(0,xmlString.Substring(currentIndex),"test",0)
+	End Sub
+
+	Function StringWordEquals( src As String ) As Boolean
+		Dim nextChar = xmlString[currentIndex + src.Length] As Char
+		Return ( xmlString.Substring( currentIndex, src.Length ) = src and Not (IsAlpha( nextChar ) or IsUnderscore( nextChar ) or IsNumber( nextChar ) ) )
+	End Function
+
+	Function ReadName() As String
+		Dim startIndex = currentIndex
+
+		Dim c = xmlString[currentIndex] As Char
+
+		If Not( IsAlpha( c ) or IsUnderscore( c ) ) Then
+			Throw New ParserException( Ex"タグ名がアルファベットまたはアンダースコアから始まっていない" )
+		End If
+
+		While IsAlpha( c ) or IsUnderscore( c ) or IsNumber( c )
+			currentIndex++
+			c = xmlString[currentIndex] As Char
+		Wend
+
+		Return xmlString.Substring( startIndex, currentIndex - startIndex )
+	End Function
+
+	Function ReadStringInDoubleQuotes() As String
+		' '\"'分を進める
+		currentIndex++
+
+		Dim startIndex = currentIndex
+		Dim endIndex = 0 As Long
+
+		Do
+			If xmlString[currentIndex] = 0 Then
+				Throw New ParserException( Ex"属性の値の閉じ側のダブルクォートが存在しない" )
+			End If
+
+			If xmlString[currentIndex] = &H and xmlString[currentIndex+1] = &H22 Then
+				' エスケープシーケンス付きのダブルクォートは無視
+				currentIndex += 2
+				Continue
+			End If
+
+			If xmlString[currentIndex] = &H22 Then	' '\"'
+				' 閉じ側のダブルクォート
+				endIndex = currentIndex
+				currentIndex++
+				Exit Do
+			End If
+
+			currentIndex++
+		Loop
+
+		Return xmlString.Substring( startIndex, endIndex - startIndex )
+	End Function
+
+	Function ReadAttribute() As System.Xml.XmlAttribute
+		Dim attributeName = ReadName()
+		SkipWhiteSpace()
+
+		Dim atr = doc.CreateAttribute( attributeName )
+
+		If Not xmlString[currentIndex] = &H3D Then	' '='
+			Return atr
+		End If
+
+		currentIndex++ ' '='分を進める
+		SkipWhiteSpace()
+
+		If Not xmlString[currentIndex] = &H22 Then	'\"'
+			Throw New ParserException( Ex"属性の値がダブルクォートで囲まれていない" )
+		End If
+
+		atr.Value = ReadStringInDoubleQuotes()
+
+		Return atr
+	End Function
+
+	Function ReadTextArea() As String
+		Dim startIndex = currentIndex
+
+		While Not ( xmlString[currentIndex] = tokenLPar or xmlString[currentIndex] = 0 )
+			currentIndex++
+		Wend
+
+		Return xmlString.Substring( startIndex, currentIndex - startIndex )
+	End Function
+
+	Sub SkipWhiteSpace()
+		While IsWhiteSpace( xmlString[currentIndex] )
+			currentIndex++
+		Wend
+	End Sub
+
+	Function ParseDeclaration() As System.Xml.XmlDeclaration
+		Dim versionStr = Nothing As String
+		Dim encodingStr = Nothing As String
+		currentIndex += xmlHeaderStr.Length
+
+		SkipWhiteSpace()
+
+		Do
+			If xmlString[currentIndex] = 0 Then
+				Throw New ParserException( Ex"タグの閉じ括弧が見つからない" )
+			End If
+			If xmlString[currentIndex] = tokenRPar Then
+				currentIndex ++
+				Exit Do
+			End If
+
+			currentIndex ++
+		Loop
+
+		Return doc.CreateXmlDeclaration( "1.0", "shift-jis", Nothing )
+	End Function
+	Function ParseComment() As System.Xml.XmlNode
+	End Function
+	Function ParseCData() As System.Xml.XmlNode
+	End Function
+	Function ParseDtd() As System.Xml.XmlNode
+	End Function
+	Function ParseElement() As System.Xml.XmlElement
+		' '<'分を進める
+		currentIndex++
+
+		' タグ名を取得し、要素を作成
+		Dim name = ReadName()
+		Dim xmlElement = doc.CreateElement( name )
+
+		SkipWhiteSpace()
+
+		Do
+			If xmlString[currentIndex] = 0 Then
+				Throw New ParserException( Ex"タグの閉じ括弧が見つからない" )
+			End If
+			If xmlString[currentIndex] = tokenRPar or ( xmlString[currentIndex] = tokenSlash and xmlString[currentIndex+1] = tokenRPar ) Then
+				Exit Do
+			End If
+
+			' 属性を取得し、要素に追加
+			xmlElement.Attributes.Add( ReadAttribute() )
+
+			SkipWhiteSpace()
+		Loop
+
+		Dim closeTagStr = "</" + xmlElement.LocalName + ">"
+
+		If xmlString[currentIndex] = tokenRPar Then	' '>'
+			' ">" で閉じられている
+			currentIndex ++
+
+			Do
+				SkipWhiteSpace()
+
+				If xmlString[currentIndex] = 0 Then
+					Throw New ParserException( xmlElement.LocalName + Ex"の閉じタグが見つからない" )
+				End If
+
+				If xmlString[currentIndex] = tokenLPar Then	' '<'
+					' タグ
+					If StringWordEquals( closeTagStr ) Then
+						' タグが閉じられた
+						currentIndex += closeTagStr.Length
+						Exit Do
+					End If
+
+					xmlElement.AppendChild( ParseNode() )
+				Else
+					' タグ以外
+					xmlElement.AppendChild( doc.CreateTextNode( ReadTextArea() ) )
+				End If
+			Loop
+		Else
+			' "/>" で閉じられている
+			currentIndex += 2
+		End If
+
+		Return xmlElement
+	End Function
+
+	Function ParseNode() As System.Xml.XmlNode
+		If Not xmlString[currentIndex] = tokenLPar Then
+			' "<" で開始できないとき
+			Throw New ParserException( Ex"\q<\q で開始できない" )
+		End If
+
+		If StringWordEquals( xmlHeaderStr ) Then
+			' XMLヘッダ
+			Return ParseDeclaration()
+		ElseIf StringWordEquals( commentHeader ) Then
+			' コメントヘッダ
+			Return ParseComment()
+		ElseIf StringWordEquals( cdataHeader ) Then
+			' CDATAヘッダ
+			Return ParseCData()
+		ElseIf StringWordEquals( dtdHeader ) Then
+			' DTDヘッダ
+			Return ParseDtd()
+		Else
+			' その他のタグ
+			Return ParseElement()
+		End If
+	End Function
+
+Public
+
+	Sub Parser( xmlString As String, doc As System.Xml.XmlDocument )
+		This.xmlString = xmlString
+		This.doc = doc
+	End Sub
+
+	Sub Parse()
+		This.currentIndex = 0
+		This.doc.RemoveAll()
+
+		SkipWhiteSpace()
+
+		While currentIndex < xmlString.Length
+
+			This.doc.AppendChild( ParseNode() )
+
+			SkipWhiteSpace()
+		Wend
+	End Sub
+
+	Static Sub Parse( xmlString As String, doc As System.Xml.XmlDocument )
+		Dim parser = New Parser( xmlString, doc )
+		parser.Parse()
+	End Sub
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/ActiveBasic/misc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/ActiveBasic/misc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/ActiveBasic/misc.ab	(revision 506)
@@ -0,0 +1,35 @@
+'Classes/ActiveBasic/misc.ab
+
+Namespace ActiveBasic
+	Namespace Detail
+		/*!
+		@brief baseがderivedの基底クラスかどうか判定する。
+		@param[in] base 基底クラス
+		@param[in] derived 派生クラス
+		@retval True baseがderivedの基底クラスである
+		@retval False 基底クラスでない
+		@exception ArgumentNullException 引数のどちらか又は双方がNoghing
+		@auther Egtra
+		@date 2008/01/21
+		*/
+		Function IsBaseOf(base As System.TypeInfo, derived As System.TypeInfo) As Boolean
+			Imports System
+			If IsNothing(base) Then
+				Throw New ArgumentNullException("base")
+			ElseIf IsNothing(derived) Then
+				Throw New ArgumentNullException("derived")
+			End If
+			Do
+				IsBaseOf = derived.Equals(base)
+				If IsBaseOf Then
+					Exit Function
+				End If
+				derived = derived.BaseType
+			Loop Until IsNothing(derived)
+		End Function
+	End Namespace
+
+	Function IsNothing(o As Object) As Boolean
+		Return Object.ReferenceEquals(o, Nothing)
+	End Function
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Blittable.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Blittable.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Blittable.ab	(revision 506)
@@ -0,0 +1,413 @@
+Namespace System
+
+	Class Blittable(SByte) SByte
+		value As SByte
+	Public
+		Static Function MaxValue() As SByte
+			Return 127
+		End Function
+		Static Function MinValue() As SByte
+			Return -128
+		End Function
+
+		Sub SByte( value As SByte )
+			This.value = value
+		End Sub
+
+		Override Function ToString() As String
+			Return Str$(value)
+		End Function
+
+		Override Function Equals(y As Object) As Boolean
+			If Object.ReferenceEquals(GetType(), y.GetType()) Then
+				Return Equals(y As System.SByte)
+			End If
+		End Function
+
+		Function Equals(y As SByte) As Boolean
+			Return value = y
+		End Function
+
+		Override Function GetHashCode() As Long
+			Return value
+		End Function
+
+		Function Operator() As SByte
+			Return value
+		End Function
+
+		Static Function _Create( value As SByte ) As System.SByte
+			Return New System.SByte( value )
+		End Function
+	End Class
+
+	Class Blittable(Byte) Byte
+		value As Byte
+	Public
+		Static Function MaxValue() As Byte
+			Return 255
+		End Function
+		Static Function MinValue() As Byte
+			Return 0
+		End Function
+
+		Sub Byte( value As Byte )
+			This.value = value
+		End Sub
+
+		Override Function ToString() As String
+			Return Str$(value)
+		End Function
+
+		Override Function Equals(y As Object) As Boolean
+			If Object.ReferenceEquals(GetType(), y.GetType()) Then
+				Return Equals(y As System.Byte)
+			End If
+		End Function
+
+		Function Equals(y As Byte) As Boolean
+			Return value = y
+		End Function
+
+		Override Function GetHashCode() As Long
+			Return value
+		End Function
+
+		Function Operator() As Byte
+			Return value
+		End Function
+
+		Static Function _Create( value As Byte ) As System.Byte
+			Return New System.Byte( value )
+		End Function
+	End Class
+
+	Class Blittable(Integer) Int16
+		value As Integer
+	Public
+		Static Function MaxValue() As Integer
+			Return 32767
+		End Function
+		Static Function MinValue() As Integer
+			Return -32768
+		End Function
+
+		Sub Int16( value As Integer )
+			This.value = value
+		End Sub
+
+		Override Function ToString() As String
+			Return Str$(value)
+		End Function
+
+		Override Function Equals(y As Object) As Boolean
+			If Object.ReferenceEquals(GetType(), y.GetType()) Then
+				Return Equals(y As System.Int16)
+			End If
+		End Function
+
+		Function Equals(y As Integer) As Boolean
+			Return value = y
+		End Function
+
+		Override Function GetHashCode() As Long
+			Return value
+		End Function
+
+		Function Operator() As Integer
+			Return value
+		End Function
+
+		Static Function _Create( value As Integer ) As System.Int16
+			Return New System.Int16( value )
+		End Function
+	End Class
+
+	Class Blittable(Word) UInt16
+		value As Word
+	Public
+		Static Function MaxValue() As Word
+			Return 65535
+		End Function
+		Static Function MinValue() As Word
+			Return 0
+		End Function
+
+		Sub UInt16( value As Word )
+			This.value = value
+		End Sub
+
+		Override Function ToString() As String
+			Return Str$(value)
+		End Function
+
+		Override Function Equals(y As Object) As Boolean
+			If Object.ReferenceEquals(GetType(), y.GetType()) Then
+				Return Equals(y As UInt16)
+			End If
+		End Function
+
+		Function Equals(y As Word) As Boolean
+			Return value = y
+		End Function
+
+		Override Function GetHashCode() As Long
+			Return value
+		End Function
+
+		Function Operator() As Word
+			Return value
+		End Function
+
+		Static Function _Create( value As Word ) As UInt16
+			Return New UInt16( value )
+		End Function
+	End Class
+
+	Class Blittable(Long) Int32
+		value As Long
+	Public
+		Static Function MaxValue() As Long
+			Return 2147483647
+		End Function
+		Static Function MinValue() As Long
+			Return -2147483648
+		End Function
+
+		Sub Int32( value As Long )
+			This.value = value
+		End Sub
+
+		Override Function ToString() As String
+			Return Str$(value)
+		End Function
+
+		Override Function Equals(y As Object) As Boolean
+			If Object.ReferenceEquals(GetType(), y.GetType()) Then
+				Return Equals(y As Int32)
+			End If
+		End Function
+
+		Function Equals(y As Long) As Boolean
+			Return value = y
+		End Function
+
+		Override Function GetHashCode() As Long
+			Return value
+		End Function
+
+		Function Operator() As Long
+			Return value
+		End Function
+
+		Static Function _Create( value As Long ) As Int32
+			Return New Int32( value )
+		End Function
+	End Class
+
+	Class Blittable(DWord) UInt32
+		value As DWord
+	Public
+		Static Function MaxValue() As DWord
+			Return 4294967295
+		End Function
+		Static Function MinValue() As DWord
+			Return 0
+		End Function
+
+		Sub UInt32( value As DWord )
+			This.value = value
+		End Sub
+
+		Override Function ToString() As String
+			Return Str$(value)
+		End Function
+
+		Override Function Equals(y As Object) As Boolean
+			If Object.ReferenceEquals(GetType(), y.GetType()) Then
+				Return Equals(y As UInt32)
+			End If
+		End Function
+
+		Function Equals(y As DWord) As Boolean
+			Return value = y
+		End Function
+
+		Override Function GetHashCode() As Long
+			Return value As Long
+		End Function
+
+		Function Operator() As DWord
+			Return value
+		End Function
+
+		Static Function _Create( value As DWord ) As UInt32
+			Return New UInt32( value )
+		End Function
+	End Class
+
+	Class Blittable(Int64) Int64
+		value As Int64
+	Public
+		Static Function MaxValue() As Int64
+			Return &H7FFFFFFFFFFFFFFF As Int64
+		End Function
+		Static Function MinValue() As Int64
+			Return &H8000000000000000 As Int64
+		End Function
+
+		Sub Int64( value As Int64 )
+			This.value = value
+		End Sub
+
+		Override Function ToString() As String
+			Return Str$(value)
+		End Function
+
+		Override Function Equals(y As Object) As Boolean
+			If Object.ReferenceEquals(GetType(), y.GetType()) Then
+				Return Equals(y As System.Int64)
+			End If
+		End Function
+
+		Function Equals(y As Int64) As Boolean
+			Return value = y
+		End Function
+
+		Override Function GetHashCode() As Long
+			Return _System_HashFromUInt(value As QWord)
+		End Function
+
+		Function Operator() As Int64
+			Return value
+		End Function
+
+		Static Function _Create( value As Int64 ) As System.Int64
+			Return New System.Int64( value )
+		End Function
+	End Class
+
+	Class Blittable(QWord) UInt64
+		value As QWord
+	Public
+		Static Function MaxValue() As QWord
+			Return &HFFFFFFFFFFFFFFFF
+		End Function
+		Static Function MinValue() As QWord
+			Return 0
+		End Function
+
+		Sub UInt64( value As QWord )
+			This.value = value
+		End Sub
+
+		Override Function ToString() As String
+			Return Str$(value)
+		End Function
+
+		Override Function Equals(y As Object) As Boolean
+			If Object.ReferenceEquals(GetType(), y.GetType()) Then
+				Return Equals(y As UInt64)
+			End If
+		End Function
+
+		Function Equals(y As QWord) As Boolean
+			Return value = y
+		End Function
+
+		Override Function GetHashCode() As Long
+			Return _System_HashFromUInt(value)
+		End Function
+
+		Function Operator() As QWord
+			Return value
+		End Function
+
+		Static Function _Create( value As QWord ) As System.UInt64
+			Return New System.UInt64( value )
+		End Function
+	End Class
+
+	Class Blittable(Single) Single
+		value As Single
+	Public
+		Static Function MaxValue() As Single
+			Return 3.4e+38
+		End Function
+		Static Function MinValue() As Single
+			Return 3.4e-38
+		End Function
+
+		Sub Single( value As Single )
+			This.value = value
+		End Sub
+
+		Override Function ToString() As String
+			Return Str$(value)
+		End Function
+
+		Override Function Equals(y As Object) As Boolean
+			If Object.ReferenceEquals(GetType(), y.GetType()) Then
+				Return Equals(y As System.Single)
+			End If
+		End Function
+
+		Function Equals(y As Single) As Boolean
+			Return value = y
+		End Function
+
+		Override Function GetHashCode() As Long
+			Return GetDWord(VarPtr(value)) As Long
+		End Function
+
+		Function Operator() As Single
+			Return value
+		End Function
+
+		Static Function _Create( value As Single ) As System.Single
+			Return New System.Single( value )
+		End Function
+	End Class
+
+	Class Blittable(Double) Double
+		value As Double
+	Public
+		Static Function MaxValue() As Double
+			Return 1.7e+308
+		End Function
+		Static Function MinValue() As Double
+			Return 1.7e-308
+		End Function
+
+		Sub Double( value As Double )
+			This.value = value
+		End Sub
+
+		Override Function ToString() As String
+			Return Str$(value)
+		End Function
+
+		Override Function Equals(y As Object) As Boolean
+			If Object.ReferenceEquals(GetType(), y.GetType()) Then
+				Return Equals(y As System.Double)
+			End If
+		End Function
+
+		Function Equals(y As Double) As Boolean
+			Return value = y
+		End Function
+
+		Override Function GetHashCode() As Long
+			Return _System_HashFromUInt(GetQWord(VarPtr(value)))
+		End Function
+
+		Function Operator() As Double
+			Return value
+		End Function
+
+		Static Function _Create( value As Double ) As System.Double
+			Return New System.Double( value )
+		End Function
+	End Class
+
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Collections/ArrayList.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Collections/ArrayList.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Collections/ArrayList.ab	(revision 506)
@@ -0,0 +1,357 @@
+' Classes/System/Collections/ArrayList.ab
+
+#require <Classes/System/Collections/misc.ab>
+
+Namespace System
+Namespace Collections
+
+Class ArrayList
+	'Implements IList /*, ICollection, IEnumerable, ICloneable*/
+
+	pObject As *Object
+	size As Long
+	capacity As Long
+
+	Sub Init( capacity As Long )
+		If size < 0 Then
+			' Error
+			debug
+		End If
+
+		This.size = 0
+		This.capacity = size
+
+		pObject = GC_malloc( SizeOf(*Object) * size )
+		If pObject = 0 Then
+			' OutOfMemoryException
+			Debug
+		End If
+	End Sub
+
+	Sub Realloc( newSize As Long )
+'		If newSize > capacity Then
+'			' miss!
+'			Debug
+'		End If
+
+		Dim p = realloc( pObject, SizeOf(*Object) * newSize  )
+		If p = 0 Then
+			' OutOfMemoryException
+			Debug
+		Else
+			pObject = p
+		End If
+		capacity = newSize
+	End Sub
+
+	Sub SetLeastCapacity( capacity As Long )
+		If This.capacity < capacity Then
+			Realloc(capacity)
+		End If
+	End Sub
+
+Public
+
+	'----------------------------------------------------------------
+	' Properties
+	'----------------------------------------------------------------
+
+	/*Const*/ Virtual Function Capacity() As Long
+		Return capacity
+	End Function
+
+	Virtual Sub Capacity(c As Long)
+		If c <> capacity Then
+			If c < size Then
+				'Throw ArgumentOutOfRangeException
+				Debug
+			Else
+				Realloc(c)
+			End If
+		End If
+	End Sub
+
+	/*Const*/ /*Override*/ Virtual Function Count() As Long
+		Return size
+	End Function
+
+	/*Const*/ Function IsFixedSize() As Boolean
+		Return False
+	End Function
+
+	/*Const*/ Function IsReadOnly() As Boolean
+		Return False
+	End Function
+
+	/*Const*/ /*Override*/ Virtual Function IsSynchronized() As Boolean
+		Return False
+	End Function
+	' SyncRoot
+
+	' Operators
+	/*Const*/ /*Override*/ Virtual Function Operator [](index As Long) As Object
+		If 0 <= index And index < size Then
+			Return pObject[index]
+		Else
+			'Throw OutOfRangeException?
+			Debug
+		End If
+	End Function
+	
+	/*Override*/ Virtual Sub Operator []=(index As Long, object As Object)
+		If 0 <= index And index < size Then
+			pObject[index] = object
+		Else
+			'Throw OutOfRangeException?
+			Debug
+		End If
+	End Sub
+
+
+
+	'----------------------------------------------------------------
+	' Methods
+	'----------------------------------------------------------------
+
+	'   Constractors
+	Sub ArrayList()
+		Init( 16 )
+	End Sub
+/*
+	Sub ArrayList(c As ICollection)
+		' 未実装
+		Debug
+	End Sub
+*/
+	Sub ArrayList(c As Long)
+		Init( c )
+	End Sub
+
+	'   Destractor
+	Virtual Sub ~ArrayList()
+	End Sub
+
+'	Sub Operator =(a As ArrayList)
+
+	/*Override*/ Virtual Function Add( object As Object ) As Long
+		SetLeastCapacity( size + 1 )
+		pObject[size] = object
+		Add = size
+		size++
+	End Function
+
+	Virtual Sub AddRange(c As ICollection)
+		' TODO: 実装
+	End Sub
+
+	Const Virtual Function BinarySearch(x As Object) As Long
+		' TODO: 実装
+	End Function
+
+	Const Virtual Function BinarySearch(x As Object, c As IComparer) As Long
+		Return BinarySearch(0, size, x, c)
+	End Function
+
+	Const Virtual Function BinarySearch(index As Long, count As Long, x As Object, c As IComparer) As Long
+		Dim l = index
+		Dim r = index + ELM(count)
+		While l <= r
+			Dim mid = (l + r) >> 2
+			Dim ret = c.Compare(pObject[mid], x)
+			If ret = 0 Then
+				Return mid
+			Else If ret < 0 Then 'pObject[mid] < x
+				If l = r Then
+					If mid + 1 <= index + ELM(count) Then
+						Return Not (mid + 1)
+					Else
+						Return count
+					End If
+				End If
+				l = mid + 1
+			Else 'pObject[mid] > x
+				If l = r And mid + 1 <= index + ELM(count) Then
+					Return Not mid
+				End If
+				r = mid - 1
+			End If
+		Wend
+		If l = index Then
+			Return Not index
+		Else 'r = index + ELM(count)
+			Return Not count
+		End If
+	End Function
+
+	/*Override*/ Virtual Sub Clear()
+		size = 0
+	End Sub
+
+	Virtual Function Clone() As ArrayList
+		Dim arrayList = New ArrayList( size )
+		memcpy( arrayList.pObject, This.pObject, SizeOf(*Object) * size )
+		arrayList.size = This.size
+		Return arrayList
+	End Function
+
+	/*Const*/ /*Override*/ /*Virtual Function Contains(x As *Object) As Boolean
+		Dim i As Long
+		For i = 0 To ELM(size)
+			If x->Equals(data.Elm[i]) Then
+				Return True
+			End If
+		Next
+	End Function*/
+
+	' CopyTo
+
+'	
+'	/*Const*/ /*Override*/ Virtual Function GetEnumerator() As IEnumerator
+'		'Return GetEnumerator(index, count)
+'	End Function
+
+'	Const Virtual Function GetEnumerator(index As Long, count As Long) As IEnumerator
+'		' TODO: 実装
+'	End Function
+
+	Virtual Function GetRange(index As Long, count As Long) As ArrayList
+		' TODO: 実装
+	End Function
+
+	/*Const*/ Function IndexOf(object As Object) As Long
+		Return IndexOf(object, 0, size)
+	End Function
+
+	/*Const*/ Virtual Function IndexOf(object As Object, startIndex As Long) As Long
+		Return IndexOf(object, startIndex, size - startIndex)
+	End Function
+
+	/*Const*/ Virtual Function IndexOf(object As Object, startIndex As Long, count As Long) As Long
+		Dim i As Long
+		Dim last = System.Math.Min(startIndex + count - 1, size)
+		For i = startIndex To last
+			If object.Equals( pObject[i] ) Then
+				Return i
+			End If
+		Next
+		Return -1
+	End Function
+
+	Sub Insert(i As Long, object As Object)
+		SetLeastCapacity(size + 1)
+		memmove(VarPtr(pObject[i + 1]), VarPtr(pObject[i]), SizeOf (*Object) * (size - i))
+		pObject[i] = object
+		size++
+	End Sub
+
+	Virtual Sub InsertRange(index As Long, c As ICollection)
+		' TODO: 実装
+	End Sub
+
+	/*Const*/ Virtual Function LastIndexOf(object As Object) As Long
+		LastIndexOf(object, 0, size)
+	End Function
+
+	/*Const*/ Virtual Function LastIndexOf(object As Object, startIndex As Long) As Long
+		Return LastIndexOf(object, startIndex, size - startIndex)
+	End Function
+
+	/*Const*/ Virtual Function LastIndexOf(object As Object, startIndex As Long, count As Long) As Long
+		' TODO: 実装
+	End Function
+
+	Sub Remove(object As Object)
+		Dim i = IndexOf(object)
+		If i > 0 Then
+			RemoveAt(i)
+		End If
+	End Sub
+
+	Sub RemoveAt(i As Long)
+		RemoveRange(i, 1)
+	End Sub
+	
+	Virtual Sub RemoveRange(i As Long, count As Long)
+		Dim removeLastPos = i + count
+		memmove(VarPtr(pObject[i]), VarPtr(pObject[removeLastPos]), SizeOf(*Object) * (size - removeLastPos))
+		size -= count
+	End Sub
+
+	Virtual Sub Reverse()
+		Reverse(0, size)
+	End Sub
+
+	Virtual Sub Reverse(startIndex As Long, count As Long)
+		' TODO: 実装
+	End Sub
+
+	Virtual Sub SetRange(index As Long, c As ICollection)
+		' TODO: 実装
+	End Sub
+
+	Virtual Sub Sort()
+		' TODO: 実装
+	End Sub
+
+	Virtual Sub Sort(c As IComparer)
+		Sort(0, size, c)
+	End Sub
+
+	Virtual Sub Sort(index As Long, count As Long, c As IComparer)
+		' TODO: 実装
+	End Sub
+
+	' ToArray
+	Virtual Sub TrimToSize()
+		Realloc(size)
+	End Sub
+
+	Override Function ToString() As String
+		Return "System.Collections.ArrayList"
+	End Function
+
+	' --------------------------------
+	' static methods
+	Static Function Adapter(l As IList) As ArrayList
+		' TODO: 実装
+	End Function
+
+	Static Function FixedSize(l As ArrayList) As ArrayList
+		' TODO: 実装
+	End Function
+
+	Static Function FixedSize(l As IList) As IList
+		' TODO: 実装
+		'Return FixedSize(Adapter(l))
+	End Function
+
+	Static Function ReadOnly(l As ArrayList) As ArrayList
+		' TODO: 実装
+	End Function
+
+	Static Function ReadOnly(l As IList) As IList
+		' TODO: 実装
+		'Return ReadOnly(Adapter(l))
+	End Function
+
+	Static Function Repeat(x As Object, c As Long) As ArrayList
+		Repeat = New ArrayList(c)
+		Dim i As Long
+		For i = 0 To ELM(c)
+			Repeat.Add(x)
+		Next
+	End Function
+
+	Static Function Synchronized(l As ArrayList) As ArrayList
+		' TODO: 実装
+	End Function
+
+	Static Function Synchronized(l As IList) As IList
+		' TODO: 実装
+		'Return Synchronized(Adapter(l))
+	End Function
+
+End Class
+
+End Namespace 'Collections
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/Dictionary.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/Dictionary.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/Dictionary.ab	(revision 506)
@@ -0,0 +1,174 @@
+'Classes/System/Collections/Generic/Dictionary.ab
+
+'#require <Classes/System/Collections/Generic/EqualityComparer.ab>
+
+Namespace System
+Namespace Collections
+Namespace Generic
+
+Namespace Detail
+	Class Pair
+	Public
+		Sub Pair(key As Object, value As Object)
+			Key = key
+			Value = value
+		End Sub
+
+		Key As Object
+		Value As Object
+	End Class
+End Namespace 'Detail
+
+Class Dictionary<Key, T>
+Public
+	'Constructor
+	Sub Dictionary()
+		initialize(23)
+	End Sub
+'	Sub Dictionary(d As IDictionary<Key, T>)
+'	Sub Dictionary(comparer As IEqualityComparer<Key>)
+	Sub Dictionary(capacity As Long)
+		initialize(capacity)
+	End Sub
+'	Sub Dictionary(d As IDictionary<Key, T>, comparer As IEqualityComparer<Key>)
+'	Sub Dictionary(capacity As Long, comparer As IEqualityComparer<Key>)
+
+	'Properties
+'	Function Comparer() As IEqualityComparer<Key>
+'	Virtual Function Count() As Long
+'	End Function
+
+	Virtual Function Item(key As Key) As T
+		If Object.ReferenceEquals(key, Nothing) Then
+			Throw New ArgumentNullException("key")
+		End If
+
+		Dim hash = getHash(key)
+		Dim a = al[hash] As ArrayList
+
+		If Not Object.ReferenceEquals(a, Nothing) Then
+			Dim i As Long
+			For i = 0 To ELM(a.Count)
+				Dim pair = a[i] As Detail.Pair
+				If pair.Key.Equals(key) Then
+					Return pair.Value
+				End If
+			Next
+		End If
+
+		Throw New KeyNotFoundException
+	End Function
+
+	Virtual Sub Item(key As Key, value As T)
+		If Object.ReferenceEquals(key, Nothing) Then
+			'Throw ArgumentNullError
+			Exit Sub
+		End If
+
+		Dim hash = getHash(key)
+		Dim a = al[hash] As ArrayList
+
+		If Object.ReferenceEquals(a, Nothing) Then
+			a = New ArrayList
+			al[hash] = a
+		Else
+			Dim i As Long
+			For i = 0 To ELM(a.Count)
+				Dim pair = a[i] As Detail.Pair
+				If pair.Key.Equals(key) Then
+					pair.Value = value
+				End If
+			Next
+		End If
+
+		a.Add(New Detail.Pair(key, value))
+	End Sub
+
+'	Function Keys() As KeyCollection
+'	Function Values() As ValuesCollection
+/*
+	'Operators
+'	Function Operator [](key As Key) As T
+	Function Operator [](key As Key) As Object
+		Return Item[key]
+	End Function
+
+	Sub Operator []=(key As Key, value As T)
+'		Item[key] = vaule
+	End Sub
+*/
+	'Methods
+	Sub Add(key As Key, value As T)
+		If Object.ReferenceEquals(key, Nothing) Then
+			'Throw ArgumentNullError
+			Exit Sub
+		End If
+
+		Dim hash = getHash(key)
+		Dim a = al[hash] As ArrayList
+
+		If Object.ReferenceEquals(a, Nothing) Then
+			a = New ArrayList
+			al[hash] = a
+		Else
+			Dim i As Long
+			For i = 0 To ELM(a.Count)
+				Dim pair = a[i] As Detail.Pair
+				If pair.Key.Equals(key) Then
+					'Throw ArgumentError
+				End If
+			Next
+		End If
+
+		a.Add(New Detail.Pair(key, value))
+
+		count++
+	End Sub
+
+	Sub Clear()
+		Dim i As Long
+		For i = 0 To ELM(al.Count)
+			al[i] = Nothing
+		Next
+	End Sub
+
+	Function Count() As Long
+		Return count
+	End Function
+
+'	Function ContainsKey(key As Key) As Boolean
+'	End Function
+'	Function ContainsValue(value As T) As Boolean
+'	End Function
+'	Function GetEnumerator() As Enumerator
+'	Function Remove(key As Key) As Boolean
+'	End Function
+'	Function TryGetValue(key As Key, ByRef value As T) As Boolean
+'	End Function
+
+	'Classses
+'	Class KeyCollection
+'	Class ValuesCollection
+'	Class Enumerator
+
+Private
+
+'	comp As System.Collections.Generic.Detail.DefaultEqualityComparer<Key> 'IEqualityComparer<Key>
+
+	Sub initialize(c As Long)
+		al = ArrayList.Repeat(Nothing, c)
+		count = 0
+	End Sub
+
+	Function getHash(key As Object) As Long
+		Return (key.GetHashCode As DWord) Mod al.Count
+	End Function
+
+	al As ArrayList
+	count As Long
+
+End Class
+
+End Namespace 'Generic
+End Namespace 'Collections
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/KeyNotFoundException.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/KeyNotFoundException.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/KeyNotFoundException.ab	(revision 506)
@@ -0,0 +1,40 @@
+'System/Collections/Generic/KeyNotFoundException.ab
+
+Namespace System
+Namespace Collections
+Namespace Generic
+
+
+Class KeyNotFoundException
+	Inherits System.SystemException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub KeyNotFoundException()
+		SystemException(GetType().FullName, Nothing)
+		HResult = ActiveBasic.AB_E_KEYNOTFOUND
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub KeyNotFoundException(message As String)
+		SystemException(message, Nothing)
+		HResult = ActiveBasic.AB_E_KEYNOTFOUND
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub KeyNotFoundException(message As String, innerException As Exception)
+		SystemException(message, innerException)
+		HResult = ActiveBasic.AB_E_KEYNOTFOUND
+	End Sub
+End Class
+
+
+End Namespace
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/List.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/List.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Collections/Generic/List.ab	(revision 506)
@@ -0,0 +1,199 @@
+
+Namespace System
+Namespace Collections
+Namespace Generic
+
+Interface IEnumerable<T>
+	' Method
+	Function GetEnumerator() As IEnumerator<T>
+End Interface
+
+Interface IEnumerator<T>
+	' Methods
+	Function MoveNext() As Boolean
+	Sub Reset()
+	' Property
+	Function Current() As T
+End Interface
+
+Class List<T>
+	Implements IEnumerable<T>, IEnumerator<T>
+	items As *T
+	size As Long
+
+	currentIndexForEnumerator As Long
+
+	Sub Realloc( allocateSize As Long )
+		items = realloc( items, allocateSize * SizeOf(VoidPtr) )
+	End Sub
+
+Public
+	Sub List()
+		items = GC_malloc( 1 )
+
+		' 列挙子の位置を初期化
+		Reset()
+	End Sub
+	Sub ~List()
+	End Sub
+
+	/*!
+	@brief	インデクサ
+	@author	Daisuke Yamamoto
+	@date	2007/08/22
+	@param	インデックス
+	*/
+	Function Operator[] ( index As Long ) As T
+		Return items[index]
+	End Function
+
+
+	'----------------------------------------------------------------
+	' パブリック プロパティ
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	Listに格納されている要素の数を取得する
+	@author	Daisuke Yamamoto
+	@date	2007/08/22
+	*/
+	Function Count() As Long
+		Return size
+	End Function
+
+
+	'----------------------------------------------------------------
+	' パブリック メソッド
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	Listの末端に要素を追加する
+	@author	Daisuke Yamamoto
+	@date	2007/08/22
+	@param	追加するオブジェクト
+	*/
+	Sub Add( item As T )
+		Realloc( size + 1 )
+
+		items[size] = item
+		size++
+	End Sub
+
+	/*!
+	@brief	Listからすべての要素を削除する
+	@author	Daisuke Yamamoto
+	@date	2007/08/22
+	*/
+	Sub Clear()
+		size = 0
+	End Sub
+
+	/*!
+	@brief	List内から、最初に出現する値のインデックスを取得する
+	@author	Daisuke Yamamoto
+	@date	2007/08/22
+	@return	インデックス（見つからなかったときは-1）
+	*/
+	Function IndexOf( item As T ) As Long
+		Dim i As Long
+		For i = 0 To ELM(size)
+			If items[i].Equals(item) Then
+				Return i
+			End If
+		Next
+		Return -1
+	End Function
+
+	/*!
+	@brief	List内の指定したインデックスの位置に要素を挿入する
+	@author	Daisuke Yamamoto
+	@date	2007/08/22
+	*/
+	Sub Insert( index As Long, item As T )
+		Realloc( size + 1 )
+		memmove( items + (index+1)*SizeOf(VoidPtr), items + index*SizeOf(VoidPtr), (size-index)*SizeOf(VoidPtr) )
+		items[index] = item
+		size++
+	End Sub
+
+	/*!
+	@brief	List内で最初に出現する値を削除する
+	@author	Daisuke Yamamoto
+	@date	2007/09/28
+	@return	値が削除されたときはTrue、されなかったときはFlaseが返る
+	*/
+	Function Remove( item As T ) As Boolean
+		Dim index = IndexOf( item )
+		If index = -1 Then
+			Return False
+		End If
+
+		RemoveAt( index )
+		Return True
+	End Function
+
+	/*!
+	@brief	List内の指定したインデックスの要素を削除する
+	@author	Daisuke Yamamoto
+	@date	2007/10/03
+	@return	値が削除されたときはTrue、されなかったときはFlaseが返る
+	*/
+	Sub RemoveAt( index As Long )
+		memmove( items + index*SizeOf(VoidPtr), items + (index+1)*SizeOf(VoidPtr), (size-(index+1))*SizeOf(VoidPtr) )
+		Realloc( size - 1 )
+		size--
+	End Sub
+
+	/*!
+	@brief	IEnumeratorインターフェイスを取得する
+	@author	Daisuke Yamamoto
+	@date	2007/11/19
+	@return	IEnumeratorインターフェイスが返る
+	*/
+	Function GetEnumerator() As IEnumerator<T>
+		Return This
+	End Function
+
+	/*!
+	@brief	イテレータのカレントインデックスを増加させる
+	@author	Daisuke Yamamoto
+	@date	2007/11/19
+	@return	上限に達していなければTrueが、達していればFalseが返る
+	*/
+	Function MoveNext() As Boolean
+		If currentIndexForEnumerator + 1 >= size Then
+			' 上限に達した
+			Return False
+		End If
+
+		currentIndexForEnumerator ++
+		Return True
+	End Function
+
+	/*!
+	@brief	イテレータをリセットする
+	@author	Daisuke Yamamoto
+	@date	2007/11/19
+	*/
+	Sub Reset()
+		currentIndexForEnumerator = -1
+	End Sub
+
+	/*!
+	@brief	イテレータのカレントオブジェクトを取得する
+	@author	Daisuke Yamamoto
+	@date	2007/11/19
+	@return	カレントオブジェクトが返る
+	*/
+	Function Current() As T
+		If currentIndexForEnumerator = -1 Then
+			' MoveNextメソッドがReset後、一度も呼び出されなかった
+			Return Nothing
+		End If
+		Return items[currentIndexForEnumerator]
+	End Function
+End Class
+
+End Namespace
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Collections/misc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Collections/misc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Collections/misc.ab	(revision 506)
@@ -0,0 +1,122 @@
+' Classes/System/Collections/misc.ab
+
+#ifndef __SYSTEM_COLLECTIONS_MISC_AB__
+#define __SYSTEM_COLLECTIONS_MISC_AB__
+
+Namespace System
+Namespace Collections
+
+Interface ICollection
+	Inherits IEnumerable
+	' Properties
+	'/*Const*/ Function Count() As Long
+	'/*Const*/ Function IsSynchronized() As Boolean
+	' Function SyncRoot() As ...
+	' Methods
+	' Sub CopyTo(ByRef array As ..., index As Long)
+End Interface
+
+Interface IComparer
+	' Methods
+	Function Compare(ByRef x As Object, ByRef y As Object) As Long
+End Interface
+
+Interface IDictionary
+	Inherits ICollection /*, IEnumerable */
+	' Methods
+	Sub Add(ByRef key As Object, ByRef value As Object)
+	Sub Clear()
+	/*Const*/ Function Contains(ByRef key As Object) As Boolean
+'	/*Const*/ Function GetEnumerator() As *IDictionaryEnumerator
+	/*Const*/ Function Remove(ByRef key As Object) As Boolean
+	' Properties
+	/*Const*/ Function IsFixedSize() As Boolean
+	/*Const*/ Function IsReadOnly() As Boolean
+'	/*Const*/ Function Operator [](ByRef key As Object) As *Object
+'	Sub Operator []=(ByRef key As Object, ByRef value As Object)
+	/*Const*/ Function Keys() As *ICollection
+	/*Const*/ Function Values() As ICollection
+End Interface
+
+Interface IDictionaryEnumerator
+	Inherits IEnumerator
+	' Properties
+	/*Const*/ Function Entry() As DictionaryEntry
+	/*Const*/ Function Key() As *Object
+	/*Const*/ Function Value() As *Object
+End Interface
+
+Interface IEnumerable
+	' Method
+	Function GetEnumerator() As IEnumerator
+End Interface
+
+Interface IEnumerator
+	' Methods
+	Function MoveNext() As Boolean
+	Sub Reset()
+	' Property
+	Function Current() As Object
+End Interface
+
+Interface IEqualityComparer
+	' Methods
+	Function Equals(ByRef x As Object, ByRef y As Object) As Boolean
+	Function GetHashCode(ByRef obj As Object) As Long
+End Interface
+
+Interface IList
+	Inherits ICollection /*, IEnumerable */
+	' Methods
+	'Function Add(value As *Object) As Long
+	'Sub Clear()
+	'/*Const*/ Function Contains(value As *Object) As Boolean
+	/*Const*/ Function IndexOf(value As Object) As Long
+	Sub Insert(index As Long, value As Object)
+	Sub Remove(value As Object)
+	Sub RemoveAt(index As Long)
+	' Properties
+	/*Const*/ Function IsFixedSize() As Boolean
+	/*Const*/ Function IsReadOnly() As Boolean
+	'/*Const*/ Function Operator [](index As Long) As *Object
+	'/*Const*/ Sub Operator []=(index As Long, obj As *Object)
+End Interface
+
+Class DictionaryEntry
+Public
+	' /*Const*/ructors
+	Sub DictionaryEntry()
+		k = 0
+		v = 0
+	End Sub
+
+	Sub DictionaryEntry(ByRef key As Object, ByRef value As Object)
+		k = VarPtr(key)
+		v = VarPtr(value)
+	End Sub
+
+	' Properties
+	/*Const*/ Function Key() As *Object
+		Return k
+	End Function
+
+	Sub Key(ByRef key As Object)
+		k = VarPtr(key)
+	End Sub
+
+	/*Const*/ Function Value() As *Object
+		Return v
+	End Function
+
+	Sub Value(ByRef value As Object)
+		v = VarPtr(value)
+	End Sub
+Private
+	k As *Object
+	v As *Object
+End Class
+
+End Namespace 'Collections
+End Namespace 'System
+
+#endif '__SYSTEM_COLLECTIONS_MISC_AB__
Index: /trunk/ab5.0/ablib/src/Classes/System/Console.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Console.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Console.ab	(revision 506)
@@ -0,0 +1,69 @@
+'Classes/System/Console.ab
+
+Namespace System
+
+/*
+@brief コンソール入出力・ウィンドウなどのクラス
+@date 2008/02/26
+@auther Egtra
+*/
+Class Console
+Public
+	/*
+	@brief 標準入力を設定する
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Static Sub SetIn(newIn As IO.TextReader)
+		If ActiveBasic.IsNothing(newIn) Then
+			Throw New ArgumentNullException("newIn")
+		End If
+		in = newIn
+	End Sub
+	/*
+	@brief 標準入力を取得する
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Static Function In() As IO.TextReader
+		In = in
+	End Function
+
+	/*
+	@brief 標準入力から1行読み込む
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Static Function ReadLine() As String
+		ReadLine = in.ReadLine()
+	End Function
+
+	/*
+	@brief 標準入力から1行読み込む
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Static Function Read() As Long
+		Read = in.Read()
+	End Function
+Private
+	Function enter() As ActiveBasic.Windows.CriticalSectionLock
+		Imports ActiveBasic.Windows
+		If ActiveBasic.IsNothing(cs) Then
+			Dim lock = New CriticalSectionLock(_System_CriticalSection)
+			Try
+				If ActiveBasic.IsNothing(cs) Then
+					cs = New CriticalSection
+				End If
+			Finally
+				lock.Dispose()
+			End Try
+		End If
+		enter = cs.Enter
+	End Function
+
+	Static in = Nothing As IO.TextReader
+	Static cs = Nothing As ActiveBasic.Windows.CriticalSection
+End Class
+
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Data/Odbc/Odbc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Data/Odbc/Odbc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Data/Odbc/Odbc.ab	(revision 506)
@@ -0,0 +1,341 @@
+' odbc.sbp
+
+#require <api_sqlext.sbp>
+
+'===========================================================
+' IOdbcConnection インターフェイス
+
+Dim IID_IOdbcConnection = [&HE0FC6F3C,&HDD4C,&H40f6,[&H82,&H8F,&H42,&H90,&H67,&H27,&H9C,&HDC]] As GUID
+Interface IOdbcConnection
+	Inherits IUnknown
+	Function Connect(lpszDataSource As LPSTR) As SQLRETURN
+	Function Disconnect() As SQLRETURN
+	Function CreateCommand() As *COdbcCommand
+End Interface
+
+Function OdbcConnection_CreateInstance() As *IOdbcConnection
+	Dim pobj_OdbcConnection As *COdbcConnection
+	pobj_OdbcConnection=New COdbcConnection()
+
+	pobj_OdbcConnection->QueryInterface(IID_IOdbcConnection,VarPtr(OdbcConnection_CreateInstance))
+End Function
+
+' ここまで
+'===========================================================
+
+
+
+Class COdbcConnection
+	m_ref As Long		'参照カウンタ
+
+	hEnv As SQLHENV		'環境ハンドル
+	hDbc As SQLHDBC		'接続ハンドル
+
+Public
+	Sub COdbcConnection()
+		'環境ハンドルを取得
+		SQLAllocHandle( SQL_HANDLE_ENV, 0   , hEnv )
+		SQLSetEnvAttr ( hEnv, SQL_ATTR_ODBC_VERSION, SQL_OV_ODBC3 As SQLPOINTER, 0 )
+
+		'接続ハンドルを取得
+		SQLAllocHandle( SQL_HANDLE_DBC, hEnv, hDbc )
+	End Sub
+	Sub ~COdbcConnection()
+		'切断
+		Disconnect()
+
+		'接続ハンドルを解放
+		SQLFreeHandle( SQL_HANDLE_DBC, hDbc )
+
+		'環境ハンドルを解放
+		SQLFreeHandle( SQL_HANDLE_ENV, hEnv )
+	End Sub
+
+
+	Function GetEnvHandle() As SQLHENV
+		GetEnvHandle = hEnv
+	End Function
+	Function GetDbcHandle() As SQLHDBC
+		GetDbcHandle = hDbc
+	End Function
+
+
+
+	'-------------------------------------------------------
+	' COMインターフェイス用IUnknownメソッド
+
+	Virtual Function QueryInterface(ByRef riid As IID, ppvObj As *VoidPtr) As HRESULT
+		If IsEqualIID(riid,IID_IOdbcConnection)<>0 or IsEqualIID(riid,IID_IUnknown)<>0 Then
+			Set_LONG_PTR(ppvObj,VarPtr(This) As LONG_PTR)
+			AddRef()
+			QueryInterface=S_OK
+		Else
+			Set_LONG_PTR(ppvObj,0)
+			QueryInterface=E_NOINTERFACE
+		End If
+	End Function
+
+	Virtual Function AddRef() As DWord
+		m_ref++
+		AddRef=m_ref
+	End Function
+	Virtual Function Release() As DWord
+		m_ref--
+		If m_ref=0 Then
+			Delete VarPtr(This)
+		End If
+		Release=m_ref
+	End Function
+
+	' ここまで
+	'-------------------------------------------------------
+
+
+	'-------------------------------------------------------
+	' 接続を確立
+	'-------------------------------------------------------
+	Virtual Function Connect(lpszDataSource As LPSTR) As SQLRETURN
+		Dim szConnStrOut[ELM(1024)] As Byte
+		Dim cbConnStrOut As SQLSMALLINT
+
+		'データベースへ接続する
+		Dim ret As SQLRETURN
+		ret=SQLDriverConnect(hDbc,
+			0,
+			lpszDataSource,
+			SQL_NTS,
+			szConnStrOut,
+			1024,
+			cbConnStrOut,
+			SQL_DRIVER_COMPLETE_REQUIRED)
+
+		Connect=ret
+	End Function
+
+
+	'-------------------------------------------------------
+	' 切断
+	'-------------------------------------------------------
+	Virtual Function Disconnect() As SQLRETURN
+		Disconnect = SQLDisconnect(hDbc)
+	End Function
+
+
+	'--------------------------------
+	' コマンド インスタンスを生成
+	'--------------------------------
+
+	Virtual Function CreateCommand() As *COdbcCommand
+		Dim pobj_Command As *COdbcCommand
+		pobj_Command=New COdbcCommand(VarPtr(This))
+
+		Return pobj_Command
+	End Function
+
+/*
+	Function ExecDirect(lpszSQL As LPSTR) As SQLRETURN
+		'前回のステートメントハンドルを解放
+		StmtFreeHandle()
+
+		'ステートメントハンドルを取得する
+		SQLAllocHandle( SQL_HANDLE_STMT, hDbc, hStmt )
+
+		'SQL文を発行
+		ExecDirect = SQLExecDirect( hStmt, lpszSQL, SQL_NTS  )
+	End Function
+
+	Function Prepare(lpszSQL As LPSTR) As SQLRETURN
+		'前回のステートメントハンドルを解放
+		StmtFreeHandle()
+
+		'ステートメントハンドルを取得する
+		SQLAllocHandle( SQL_HANDLE_STMT, hDbc, hStmt )
+
+		Prepare = SQLPrepare( hStmt, lpszSQL, SQL_NTS )	'SQL文を設定する
+	End Function
+
+	Function Execute() As SQLRETURN
+		Execute = SQLExecute( hStmt )
+	End Function*/
+End Class
+
+
+
+Class COdbcCommand
+Public
+	pobj_Connection As *COdbcConnection
+	hStmt As SQLHSTMT
+	CommandText As String
+
+	Sub COdbcCommand(pobj_Connection As *COdbcConnection)
+		This.pobj_Connection=pobj_Connection
+	End Sub
+	Sub ~COdbcCommand()
+		If hStmt Then
+			SQLFreeHandle( SQL_HANDLE_STMT, hStmt )
+			hStmt=0
+		End If
+	End Sub
+
+
+	Function ExecuteReader() As *COdbcDataReader
+		'DataReaderを構築
+		Dim pobj_DataReader As *COdbcDataReader
+		pobj_DataReader=New COdbcDataReader(VarPtr(This))
+
+		Return pobj_DataReader
+	End Function
+
+	Function Release() As DWord
+		Delete VarPtr(This)
+	End Function
+End Class
+
+
+Class COdbcData
+Public
+	lpszName As LPSTR
+	iType As SQLSMALLINT
+	iSize As SQLINTEGER
+
+	lpszValue As LPSTR
+
+	Sub COdbcData(lpszName As LPSTR, iType As SQLSMALLINT, iSize As SQLINTEGER)
+		This.lpszName=malloc(lstrlen(lpszName)+1)
+		lstrcpy(This.lpszName,lpszName)
+
+		This.iType=iType
+
+		This.iSize=iSize
+
+		lpszValue=malloc(iSize+1)
+	End Sub
+	Sub ~COdbcData()
+		free(lpszName)
+		lpszName=0
+
+		free(lpszValue)
+		lpszValue=0
+	End Sub
+End Class
+
+
+Class COdbcDataReader
+	pobj_Command As *COdbcCommand
+
+	Item As **COdbcData
+	iColNum As SQLSMALLINT
+
+	bFirstRead As BOOL
+
+	hStmt As SQLHSTMT
+
+Public
+
+	Sub COdbcDataReader(pobj_Command As *COdbcCommand)
+		This.pobj_Command=pobj_Command
+
+
+		'ステートメントハンドルを取得する
+		SQLAllocHandle( SQL_HANDLE_STMT,
+			pobj_Command->pobj_Connection->GetDbcHandle(),
+			hStmt )
+
+		'SQL文を発行
+		SQLExecDirect( hStmt, pobj_Command->CommandText, SQL_NTS  )
+
+
+		'列数を取得
+		SQLNumResultCols(hStmt, iColNum)
+
+		'列データ格納領域を確保
+		Item=malloc(iColNum*SizeOf(*COdbcData))
+
+		Dim i As SQLSMALLINT
+		Dim szColName[255] As Byte
+		Dim acc_bytes As SQLSMALLINT
+		Dim iType As SQLSMALLINT, iSize As SQLINTEGER, scale As SQLSMALLINT, nullable As SQLSMALLINT
+		Dim displaysize As SQLINTEGER
+		For i=0 To ELM(iColNum)
+			'列属性を取得
+			SQLDescribeCol(hStmt,
+				i+1,
+				szColName,255,acc_bytes,
+				iType,
+				iSize,
+				scale,
+				nullable)
+
+			'文字列に換算したときの長さを取得
+			SQLColAttributes (hStmt,
+				i+1, SQL_COLUMN_DISPLAY_SIZE, NULL, 0,
+				ByVal NULL, displaysize)
+
+			If displaysize<lstrlen(szColName) Then
+				iSize=lstrlen(szColName)+1
+			Else
+				iSize=displaysize+1
+			End If
+
+			'単一データを生成
+			Item[i]=New COdbcData(szColName,iType,iSize)
+
+			'バインド
+			Dim idummy As SQLLEN
+			SQLBindCol(hStmt, i+1, SQL_CHAR, ByVal Item[i]->lpszValue, iSize, idummy)
+		Next
+
+		bFirstRead=1
+	End Sub
+	Sub ~COdbcDataReader()
+		Dim i As Long
+		For i=0 To ELM(iColNum)
+			Delete Item[i]
+		Next
+		free(Item)
+		Item=0
+
+		If hStmt Then
+			SQLFreeHandle( SQL_HANDLE_STMT, hStmt )
+			hStmt=0
+		End If
+	End Sub
+
+	Function GetFieldType(i As Long) As SQLSMALLINT
+		If i>=iColNum Then Return 0
+		Return Item[i]->iType
+	End Function
+
+	Function GetName(i As Long) As LPSTR
+		If i>=iColNum Then Return 0
+		Return Item[i]->lpszName
+	End Function
+
+	Function GetStrPtr(i As Long) As LPSTR
+		If i>=iColNum Then Return 0
+		Return Item[i]->lpszValue
+	End Function
+
+	Function Read() As BOOL
+		Dim ret As SQLRETURN
+		If bFirstRead Then
+			'先頭行へ移動する
+			SQLFetchScroll( hStmt, SQL_FETCH_FIRST, 0 )
+
+			ret = SQLFetch( hStmt )
+			If (ret = SQL_NO_DATA) Then Return 0
+
+			bFirstRead=0
+		Else
+			'次の行へ移動する
+			ret = SQLFetchScroll( hStmt, SQL_FETCH_NEXT, 0 )
+			If (ret = SQL_NO_DATA) Then Return 0
+		End If
+
+		Return 1
+	End Function
+
+	Virtual Function Release() As DWord
+		Delete VarPtr(This)
+	End Function
+End Class
Index: /trunk/ab5.0/ablib/src/Classes/System/DateTime.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/DateTime.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/DateTime.ab	(revision 506)
@@ -0,0 +1,823 @@
+Namespace System
+
+/*!
+	@brief	時刻の種類
+*/
+Enum DateTimeKind
+	Local
+	Unspecified
+	Utc
+End Enum
+
+/*!
+	@brief	曜日
+*/
+Enum DayOfWeek
+	Sunday = 0
+	Monday
+	Tuesday
+	Wednesday
+	Thursday
+	Friday
+	Saturday
+End Enum
+
+
+/*!
+	@brief	時刻を表すクラス
+*/
+
+Class DateTime
+	m_Date As Int64
+Public
+	Static Const MaxValue = 3162240000000000000 As Int64 'Const TicksPerDay*366*10000
+	Static Const MinValue = 316224000000000 As Int64     'Const TicksPerDay*366
+
+	'----------------------------------------------------------------
+	' パブリック コンストラクタ
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	コンストラクタ
+	*/
+	Sub DateTime()
+		initialize(MinValue, DateTimeKind.Unspecified)
+	End Sub
+
+	/*!
+	@brief	時刻を指定して初期化する
+	@param  100ナノ秒単位で表した時刻
+	*/
+	Sub DateTime(ticks As Int64)
+		initialize(ticks, DateTimeKind.Unspecified)
+	End Sub
+
+	/*!
+	@brief	時刻を指定して初期化する
+	@param  100ナノ秒単位で表した時刻
+	@param  時刻の種類
+	*/
+	Sub DateTime(ticks As Int64, kind As DateTimeKind)
+		initialize(ticks, kind)
+	End Sub
+
+	/*!
+	@brief	時刻を指定して初期化する
+	@param  西暦
+	@param  月
+	@param  日
+	*/
+	Sub DateTime(year As Long, month As Long, day As Long)
+		initialize(year, month, day, 0, 0, 0, 0, DateTimeKind.Unspecified)
+	End Sub
+
+	/*!
+	@brief	時刻を指定して初期化する
+	@param  西暦
+	@param  月
+	@param  日
+	@param  時刻の種類
+	*/
+	Sub DateTime(year As Long, month As Long, day As Long, kind As DateTimeKind)
+		initialize(year, month, day, 0, 0, 0, 0, kind)
+	End Sub
+
+	/*!
+	@brief	時刻を指定して初期化する
+	@param  西暦
+	@param  月
+	@param  日
+	@param  時
+	@param  分
+	@param  秒
+	*/
+	Sub DateTime(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long)
+		initialize(year, month, day, hour, minute, second, 0, DateTimeKind.Unspecified)
+	End Sub
+
+	/*!
+	@brief	時刻を指定して初期化する
+	@param  西暦
+	@param  月
+	@param  日
+	@param  時
+	@param  分
+	@param  秒
+	@param  時刻の種類
+	*/
+	Sub DateTime(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long, kind As DateTimeKind)
+		initialize(year, month, day, hour, minute, second, 0, kind)
+	End Sub
+
+	/*!
+	@brief	時刻を指定して初期化する
+	@param  西暦
+	@param  月
+	@param  日
+	@param  時
+	@param  分
+	@param  秒
+	@param  ミリ秒
+	*/
+	Sub DateTime(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long, millisecond As Long)
+		initialize(year, month, day, hour, minute, second, millisecond, DateTimeKind.Unspecified)
+	End Sub
+
+	/*!
+	@brief	時刻を指定して初期化する
+	@param  西暦
+	@param  月
+	@param  日
+	@param  時
+	@param  分
+	@param  秒
+	@param  ミリ秒
+	@param  時刻の種類
+	*/
+	Sub DateTime(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long, millisecond As Long, kind As DateTimeKind)
+		initialize(year, month, day, hour, minute, second, millisecond, kind)
+	End Sub
+
+	/*!
+	@brief	時刻を指定して初期化する
+	@param  SYSTEMTIME構造体
+	*/
+	Sub DateTime(ByRef time As SYSTEMTIME)
+		initialize(time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond, time.wMilliseconds, DateTimeKind.Unspecified)
+	End Sub
+
+	/*!
+	@brief	時刻を指定して初期化する
+	@param  SYSTEMTIME構造体
+	@param  時刻の種類
+	*/
+	Sub DateTime(ByRef time As SYSTEMTIME, kind As DateTimeKind)
+		initialize(time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond, time.wMilliseconds, kind)
+	End Sub
+
+	/*!
+	@brief	コピーコンストラクタ
+	@param  コピーするDateTime
+	*/
+	Sub DateTime(dateTime As DateTime)
+		This.m_Date = dateTime.m_Date
+	End Sub
+
+	'----------------------------------------------------------------
+	' オペレータ
+	'----------------------------------------------------------------
+
+	Function Operator + (value As TimeSpan) As DateTime
+		Return New DateTime(Ticks + value.Ticks)
+	End Function
+
+	Function Operator - (value As DateTime) As TimeSpan
+		Return TimeSpan.FromTicks(Ticks - value.Ticks)
+	End Function
+
+	Function Operator - (value As TimeSpan) As DateTime
+		Return New DateTime(Ticks - value.Ticks)
+	End Function
+
+	Function Operator == (value As DateTime) As Boolean
+		Return Equals(value)
+	End Function
+
+	Function Operator <> (value As DateTime) As Boolean
+		Return Not Equals(value)
+	End Function
+
+	Function Operator > (value As DateTime) As Boolean
+		If DateTime.Compare(This, value) > 0 Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	Function Operator < (value As DateTime) As Boolean
+		If DateTime.Compare(This, value) < 0 Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	Function Operator >= (value As DateTime) As Boolean
+		If DateTime.Compare(This, value) => 0 Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	Function Operator <= (value As DateTime) As Boolean
+		If DateTime.Compare(This, value) <= 0 Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	
+	'----------------------------------------------------------------
+	' パブリック プロパティ
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	時刻を100ナノ秒単位で取得する
+	@return 時刻
+	*/
+	Function Ticks() As Int64
+		Return (m_Date And &H3FFFFFFFFFFFFFFF)
+	End Function
+
+	/*!
+	@brief	時刻のミリ秒単位部分を取得する
+	@return ミリ秒の部分
+	*/
+	Function Millisecond() As Long
+		Return (Ticks \ TimeSpan.TicksPerMillisecond Mod 1000) As Long
+	End Function
+
+	/*!
+	@brief	時刻の秒単位部分を取得する
+	@return 秒の部分
+	*/
+	Function Second() As Long
+		Return (Ticks \ TimeSpan.TicksPerSecond Mod 60) As Long
+	End Function
+
+	/*!
+	@brief	時刻の分単位部分を取得する
+	@return 分の部分
+	*/
+	Function Minute() As Long
+		Return (Ticks \ TimeSpan.TicksPerMinute Mod 60) As Long
+	End Function
+
+	/*!
+	@brief	時刻の時単位部分を取得する
+	@return 時の部分
+	*/
+	Function Hour() As Long
+		Return (Ticks \ TimeSpan.TicksPerHour Mod 24) As Long
+	End Function
+
+	/*!
+	@brief	時刻の日単位部分を取得する
+	@return 日の部分
+	*/
+	Function Day() As Long
+		Return DayOfYear - totalDaysOfMonth(Year, Month - 1)
+	End Function
+
+	/*!
+	@brief	時刻の月単位部分を取得する
+	@return 月の部分
+	*/
+	Function Month() As Long
+		Dim year = Year As Long
+		Dim day = DayOfYear As Long
+		Dim i = 1 As Long
+		While day > totalDaysOfMonth(year, i)
+			i++
+		Wend
+		Return i
+	End Function
+
+	/*!
+	@brief	時刻の年単位部分を取得する
+	@return 西暦
+	*/
+	Function Year() As Long
+		Dim day = (Ticks \ TimeSpan.TicksPerDay) As Long
+		Dim year = Int((day + day \ 36524 - day \ 146097) / 365.25) + 1 As Long
+		If day - yearToDay(year - 1) + 1 = 366 Then
+			Return year + 1
+		Else
+			Return year
+		End If
+	End Function
+
+	/*!
+	@brief	時刻の曜日部分を取得する
+	@return 曜日の部分
+	*/
+	Function DayOfWeek() As DayOfWeek
+		Return New DayOfWeek( (((Ticks \ TimeSpan.TicksPerDay) Mod 7) + 1) As Long, "DayOfWeek")
+	End Function
+
+	/*!
+	@brief	時刻の種類を取得する
+	@return 種類
+	*/
+	Function Kind() As DateTimeKind
+		Return kindFromBinary(m_Date)
+	End Function
+
+	/*!
+	@brief	その年の何日目かを取得する
+	@return 日数
+	*/
+	Function DayOfYear() As Long
+		Return ((Ticks \ TimeSpan.TicksPerDay) - yearToDay(Year) + 1) As Long
+	End Function
+
+	/*!
+	@brief	時刻の日付の部分を取得する
+	@return 日付
+	*/
+	Function Date() As DateTime
+		Return New DateTime(Year, Month, Day, Kind)
+	End Function
+
+	/*!
+	@brief	現在の時刻を取得する
+	@return 時刻
+	*/
+	Static Function Now() As DateTime
+		Dim time As SYSTEMTIME
+		GetLocalTime(time)
+		Return New DateTime(time, DateTimeKind.Local)
+	End Function
+
+	/*!
+	@brief	今日を表す時刻を取得する(時間は0時0分)
+	@return 時刻
+	*/
+	Static Function Today() As DateTime
+		Dim time As SYSTEMTIME
+		GetLocalTime(time)
+		Return New DateTime(time.wYear, time.wMonth, time.wDay, DateTimeKind.Local)
+	End Function
+
+	/*!
+	@brief	現在の時刻をUTC時刻で取得する
+	@return 時刻
+	*/
+	Static Function UtcNow() As DateTime
+		Dim time As SYSTEMTIME
+		GetSystemTime(time)
+		Return New DateTime(time, DateTimeKind.Utc)
+	End Function
+		
+	'----------------------------------------------------------------
+	' パブリック メソッド
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	二つの時刻の差を求める
+	@return 差(単位は100ナノ秒)
+	*/
+	Static Function Compare(t1 As DateTime, t2 As DateTime) As Int64
+		Return t1.Ticks - t2.Ticks
+	End Function
+
+	/*!
+	@brief	等しいどうかを取得する
+	@param  比較する値
+	@retval True  等しい
+	@retval False 等しくない
+	*/
+	Function Equals(value As DateTime) As Boolean
+		If value.m_Date = m_Date Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	/*!
+	@brief	等しいどうかを取得する
+	@param  比較される値
+	@param  比較する値
+	@retval True  等しい
+	@retval False 等しくない
+	*/
+	Static Function Equals(t1 As DateTime, t2 As DateTime) As Boolean
+		If t1.m_Date = t2.m_Date Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	/*!
+	@brief	ハッシュコードを取得する
+	@return ハッシュコード
+	*/
+	Override Function GetHashCode() As Long
+		Return HIDWORD(m_Date) Xor LODWORD(m_Date)
+	End Function
+
+	/*!
+	@brief	時刻を進める
+	@param  進める時間
+	@return 進めた後の時刻
+	*/
+	Function Add(value As TimeSpan) As DateTime
+		Return This + value
+	End Function
+
+	/*!
+	@brief	時刻を進める
+	@param  進める時間(100ナノ秒単位)
+	@return 進めた後の時刻
+	*/
+	Function AddTicks(value As Int64) As DateTime
+		Return New DateTime(Ticks + value, Kind )
+	End Function
+
+	/*!
+	@brief	時刻を進める
+	@param  進める時間(ミリ秒単位)
+	@return 進めた後の時刻
+	*/
+	Function AddMilliseconds(value As Double) As DateTime
+		Return AddTicks((value * TimeSpan.TicksPerMillisecond) As Int64)
+	End Function
+
+	/*!
+	@brief	時刻を進める
+	@param  進める時間(秒単位)
+	@return 進めた後の時刻
+	*/
+	Function AddSeconds(value As Double) As DateTime
+		Return AddTicks((value * TimeSpan.TicksPerSecond) As Int64)
+	End Function
+
+	/*!
+	@brief	時刻を進める
+	@param  進める時間(分単位)
+	@return 進めた後の時刻
+	*/
+	Function AddMinutes(value As Double) As DateTime
+		Return AddTicks((value * TimeSpan.TicksPerMinute) As Int64)
+	End Function
+
+	/*!
+	@brief	時刻を進める
+	@param  進める時間(時単位)
+	@return 進めた後の時刻
+	*/
+	Function AddHours(value As Double) As DateTime
+		Return AddTicks((value * TimeSpan.TicksPerHour) As Int64)
+	End Function
+
+	/*!
+	@brief	時刻を進める
+	@param  進める時間(日単位)
+	@return 進めた後の時刻
+	*/
+	Function AddDays(value As Double) As DateTime
+		Return AddTicks((value * TimeSpan.TicksPerDay) As Int64)
+	End Function
+
+	/*!
+	@brief	時刻を進める
+	@param  進める時間(年単位)
+	@return 進めた後の時刻
+	*/
+	Function AddYears(value As Double) As DateTime
+		Dim date = New DateTime(Year + Int(value), Month, Day, Hour, Minute, Second, Millisecond, Kind)
+		Dim ticks = Ticks _
+				- (yearToDay(Year) + totalDaysOfMonth(Year, Month - 1) + Day - 1) * TimeSpan.TicksPerDay _
+				- Hour * TimeSpan.TicksPerHour _
+				- Minute * TimeSpan.TicksPerMinute _
+				- Second * TimeSpan.TicksPerSecond _
+				- Millisecond * TimeSpan.TicksPerMillisecond As Int64
+		If IsLeapYear(Year + Int(value)) Then
+			ticks += ( (value - Int(value)) * 366 * TimeSpan.TicksPerDay ) As Int64
+		Else
+			ticks += ( (value - Int(value)) * 365 * TimeSpan.TicksPerDay ) As Int64
+		End If
+		Return date.AddTicks(ticks)
+	End Function
+
+	/*!
+	@brief	時刻の差を取得する
+	@param  比較する値
+	@return 時刻の差
+	*/
+	Function Subtract(value As DateTime) As TimeSpan
+		Return This - value
+	End Function
+
+	/*!
+	@brief	時刻を戻す
+	@param  戻す時間
+	@return 時刻
+	*/
+	Function Subtract(value As TimeSpan) As DateTime
+		Return This - value
+	End Function
+
+	/*!
+	@brief	指定した年月が、その月の何日目かを取得する
+	@param  西暦
+	@param  月
+	@return 日数
+	*/
+	Static Function DaysInMonth(year As Long, month As Long) As Long
+		If year < 1 Or year > 9999 Then
+			Throw New ArgumentOutOfRangeException("DateTime.DaysInMonth: One or more arguments are out of range value.", "year")
+		End If
+		If month < 1 Or month > 12 Then
+			Throw New ArgumentOutOfRangeException("DateTime.DaysInMonth: One or more arguments are out of range value.", "month")
+		End If
+
+		If IsLeapYear(year) And month = 2 Then
+			Return 29
+		Else
+			Dim daysInMonth[11] = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] As Byte
+			Return daysInMonth[month - 1]
+		End If
+	End Function
+
+	/*!
+	@brief	年が閏年かどうかを取得する
+	@param  西暦
+	@retval True  閏年
+	@retval False 閏年でない
+	*/
+	Static Function IsLeapYear(year As Long) As Boolean
+		If (year Mod 400) = 0 Then Return True
+		If (year Mod 100) = 0 Then Return False
+		If (year Mod 4) = 0 Then Return True
+		Return False
+	End Function
+
+	/*!
+	@brief	時刻を文字列に変換する
+	@return 時刻を表した文字列
+	*/
+	Function GetDateTimeFormats() As String
+		Dim time = getSystemTime() 'As SYSTEMTIME を記述すると内部エラーが発生
+		Dim dateFormatSize = GetDateFormat(LOCALE_USER_DEFAULT, 0, time, NULL, NULL, 0)
+		Dim timeFormatSize = GetTimeFormat(LOCALE_USER_DEFAULT, 0, time, NULL, NULL, 0)
+		Dim strLength = dateFormatSize + timeFormatSize
+		Dim dateTimeFormats = GC_malloc_atomic(SizeOf (TCHAR) * (strLength)) As PTSTR
+		GetDateFormat(LOCALE_USER_DEFAULT, 0, time, NULL, dateTimeFormats, dateFormatSize)
+		dateTimeFormats[dateFormatSize - 1] = &H20 As TCHAR 'Asc(" ") As TCHAR
+		GetTimeFormat(LOCALE_USER_DEFAULT, 0, time, NULL, dateTimeFormats + dateFormatSize, timeFormatSize)
+		Return New String(dateTimeFormats, strLength)
+	End Function
+
+	/*!
+	@brief	時刻を指定した書式で文字列に変換する
+	@param  書式
+	@return 時刻を表した文字列
+	*/
+	Function GetDateTimeFormats(format As *TCHAR) As String
+		Dim time = getSystemTime() 'As SYSTEMTIME を記述すると内部エラーが発生
+		Dim dateFormatSize = GetDateFormat(LOCALE_USER_DEFAULT, 0, time, format, NULL, 0)
+		Dim dateFormats = malloc(dateFormatSize) As PTSTR
+		GetDateFormat(LOCALE_USER_DEFAULT, 0, time, format, dateFormats, dateFormatSize)
+
+		Dim dateTimeFormatSize = GetTimeFormat(LOCALE_USER_DEFAULT, 0, time, dateFormats, NULL, 0)
+		Dim dateTimeFormats = malloc(dateTimeFormatSize) As PTSTR
+		GetTimeFormat(LOCALE_USER_DEFAULT, 0, time, dateFormats, dateTimeFormats, dateTimeFormatSize)
+
+		Return New String(dateTimeFormats)
+	End Function
+
+	/*!
+	@brief	バイナリデータからDateTimeを作成する
+	@return DateTimeクラス
+	*/
+	Static Function FromBinary(date As Int64) As DateTime
+		Return New DateTime((date And &H3FFFFFFFFFFFFFFF), kindFromBinary(date))
+	End Function
+
+	/*!
+	@brief	バイナリデータに変換する
+	@return バイナリデータ
+	*/
+	Function ToBinary() As Int64
+		Return m_Date
+	End Function
+
+	/*!
+	@brief	FILETIME構造体からDateTimeを作成する
+	@return DateTimeクラス
+	*/
+	Static Function FromFileTime(ByRef fileTime As FILETIME) As DateTime
+		Dim localTime As FILETIME
+		Dim time As SYSTEMTIME
+		FileTimeToLocalFileTime(fileTime, localTime)
+		FileTimeToSystemTime(localTime, time)
+		Return New DateTime(time, DateTimeKind.Local)
+	End Function
+
+	/*!
+	@brief	FILETIME構造体に変換する
+	@return FILETIME構造体
+	*/
+	Function ToFileTime() As FILETIME
+		Dim time = getSystemTime() 'As SYSTEMTIME を記述すると内部エラーが発生 rev.207
+		Dim fileTime As FILETIME
+		SystemTimeToFileTime(time, fileTime)
+		Return fileTime
+	End Function
+
+	/*!
+	@brief	UTC時刻を表すFILETIME構造体からDateTimeを作成する
+	@return DateTimeクラス
+	*/
+	Static Function FromFileTimeUtc(ByRef fileTime As FILETIME) As DateTime
+		Dim time As SYSTEMTIME
+		FileTimeToSystemTime(fileTime, time)
+		Return New DateTime(time, DateTimeKind.Utc)
+	End Function
+
+	/*!
+	@brief	UTC時刻のFILETIME構造体に変換する
+	@return FILETIME構造体
+	*/
+	Function ToFileTimeUtc() As FILETIME
+		Dim fileTime = ToFileTime() 'As FILETIME を記述すると内部エラー rev.207
+		If Kind = DateTimeKind.Utc Then
+			Return fileTime
+		Else
+			Dim utcTime As FILETIME
+			LocalFileTimeToFileTime(fileTime, utcTime)
+			Return utcTime
+		End If
+	End Function
+
+	/*!
+	@brief	現地時刻に変換する
+	@return 現地時刻に変換したDateTime
+	*/
+	Function ToLocalTime() As DateTime
+		If Kind = DateTimeKind.Local Then
+			Return New DateTime(This)
+		Else
+			Dim fileTime = ToFileTime() '直接入れると計算できなくなります。 rev.207
+			Return DateTime.FromFileTime(fileTime)
+		End If
+	End Function
+
+	/*!
+	@brief	このインスタンスを文字列で取得する
+	@return 文字列
+	*/
+	Override Function ToString() As String
+		Return GetDateTimeFormats()
+	End Function
+
+	/*!
+	@brief	世界協定時刻(UTC)に変換する
+	@return 世界協定時刻(UTC)に変換したDateTime
+	*/
+	Function ToUniversalTime() As DateTime
+		If Kind = DateTimeKind.Utc Then
+			Return New DateTime(m_Date)
+		Else
+			Dim fileTime = ToFileTimeUtc() '直接入れると計算できなくなります。 rev.207
+			Return DateTime.FromFileTimeUtc(fileTime)
+		End If
+	End Function
+
+	'----------------------------------------------------------------
+	' プライベート メソッド
+	'----------------------------------------------------------------
+Private
+
+	/*!
+	@brief	インスタンスを初期化する
+	@param  時刻(100ナノ秒単位)
+	@param  時刻の種類
+	*/
+	Sub initialize(ticks As Int64, kind As DateTimeKind)
+		Kind = kind
+		Ticks = ticks
+	End Sub
+
+	/*!
+	@brief	インスタンスを初期化する
+	@param  西暦
+	@param  月
+	@param  日
+	@param  時
+	@param  分
+	@param  秒
+	@param  ミリ秒
+	@param  時刻の種類
+	*/
+	Sub initialize(year As Long, month As Long, day As Long, hour As Long, minute As Long, second As Long, millisecond As Long, kind As DateTimeKind)
+		If month < 1 Or month > 12 Then
+			Throw New ArgumentOutOfRangeException("DateTime.initialize: One or more arguments are out of range value.", "month")
+		End If
+		If day < 1 Or day > DaysInMonth(year, month) Then
+			Throw New ArgumentOutOfRangeException("DateTime.initialize: One or more arguments are out of range value.", "day")
+		End If
+		If hour < 0 Or hour => 24 Then
+			Throw New ArgumentOutOfRangeException("DateTime.initialize: One or more arguments are out of range value.", "hour")
+		End If
+		If minute < 0 Or minute => 60 Then
+			Throw New ArgumentOutOfRangeException("DateTime.initialize: One or more arguments are out of range value.", "minute")
+		End If
+		If second < 0 Or second => 60 Then
+			Throw New ArgumentOutOfRangeException("DateTime.initialize: One or more arguments are out of range value.", "second")
+		End If
+		If millisecond < 0 Or millisecond  => 1000 Then
+			Throw New ArgumentOutOfRangeException("DateTime.initialize: One or more arguments are out of range value.", "millisecond")
+		End If
+
+		initialize(
+			yearToDay(year) * TimeSpan.TicksPerDay _
+			+ totalDaysOfMonth(year, month - 1) * TimeSpan.TicksPerDay _
+			+ (day - 1) * TimeSpan.TicksPerDay _
+			+ hour * TimeSpan.TicksPerHour _
+			+ minute * TimeSpan.TicksPerMinute _
+			+ second * TimeSpan.TicksPerSecond _
+			+ millisecond * TimeSpan.TicksPerMillisecond,
+			kind
+			)
+	End Sub
+
+	/*!
+	@brief	時刻を設定する
+	@param  時刻(100ナノ秒単位)
+	*/
+	Sub Ticks(value As Int64)
+		If value < MinValue Or value > MaxValue Then
+			Throw New ArgumentOutOfRangeException("DateTime.value: One or more arguments are out of range value.", "value")
+		End If
+
+		Dim temp = Kind As DateTimeKind
+		m_Date = value
+		Kind = temp
+	End Sub
+
+	/*!
+	@brief	時刻の種類を設定する
+	@param  時刻の種類
+	*/
+	Sub Kind(kind As DateTimeKind)
+		Dim temp As Int64
+		temp = kind
+		temp = (temp << 62) And &HC000000000000000
+		m_Date = (m_Date And &H3FFFFFFFFFFFFFFF) Or temp
+	End Sub
+
+	/*!
+	@brief	バイナリデータから時刻の種類を取得する
+	@return 時刻の種類
+	*/
+	Static Function kindFromBinary(date As Int64) As DateTimeKind
+		date = (date >> 62) And &H03
+		If date = &H01 Then
+			Return DateTimeKind.Local
+		ElseIf date = &H02 Then
+			Return DateTimeKind.Unspecified
+		ElseIf date = &H03 Then
+			Return DateTimeKind.Utc
+		End If
+	End Function
+
+	/*!
+	@brief	インスタンスをSYSTEMTIME構造体に変換する
+	@return SYSTEMTIME構造体
+	*/
+	Function getSystemTime() As SYSTEMTIME
+		Dim dayOfWeek = DayOfWeek As Long
+		Dim time As SYSTEMTIME
+		With time
+			.wYear = Year As Word
+			.wMonth = Month As Word
+			.wDayOfWeek = dayOfWeek As Word
+			.wDay = Day As Word
+			.wHour = Hour As Word
+			.wMinute = Minute As Word
+			.wSecond = Second As Word
+			.wMilliseconds = Millisecond As Word
+		End With
+		Return time
+	End Function
+
+	/*!
+	@brief	西暦から日数に変換する
+	@return 日数
+	*/
+	Static Function yearToDay(year As Long) As Long
+		year--
+		Return (Int(year * 365.25) - Int(year * 0.01) + Int(year * 0.0025))
+	End Function
+
+	/*!
+	@brief	その月までその年の元旦から何日経っているかを取得する
+	@return 日数
+	*/
+	Static Function totalDaysOfMonth(year As Long, month As Long) As Long
+		Dim days As Long
+		Dim i As Long
+		For i = 1 To month
+			days += DaysInMonth(year, i)
+		Next
+		Return days
+	End Function
+End Class
+
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Delegate.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Delegate.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Delegate.ab	(revision 506)
@@ -0,0 +1,74 @@
+Namespace System
+
+
+Class _SimpleDelegate
+Public
+	hasThisPtr As Boolean
+	object As Object
+	methodPtr As VoidPtr
+
+	Sub _SimpleDelegate( object As Object, methodPtr As VoidPtr )
+		This.hasThisPtr = True
+		This.object = object
+		This.methodPtr = methodPtr
+	End Sub
+	Sub _SimpleDelegate( methodPtr As VoidPtr )
+		This.hasThisPtr = False
+		This.object = Nothing
+		This.methodPtr = methodPtr
+	End Sub
+
+	Function IsEqual( sd As _SimpleDelegate ) As Boolean
+		Return ( This.hasThisPtr = sd.hasThisPtr and ObjPtr(This.object) = ObjPtr(sd.object) and This.methodPtr = sd.methodPtr )
+	End Function
+End Class
+
+Class DelegateBase
+Protected
+	simpleDelegates As System.Collections.Generic.List<_SimpleDelegate>
+
+	Sub _Add( dg As DelegateBase )
+		Dim i As Long
+		For i=0 To ELM(dg.simpleDelegates.Count)
+			simpleDelegates.Add( dg.simpleDelegates[i] )
+		Next
+	End Sub
+
+	Sub _Delete( dg As DelegateBase )
+		Dim i As Long
+		For i=0 To ELM(This.simpleDelegates.Count)
+			Dim i2 As Long
+			Dim isExist = False
+			For i2=0 To ELM(dg.simpleDelegates.Count)
+				If This.simpleDelegates[i].IsEqual( dg.simpleDelegates[i2] ) Then
+					isExist = True
+				End If
+			Next
+			If isExist Then
+				This.simpleDelegates.RemoveAt( i )
+			End If
+		Next
+	End Sub
+
+Public
+	Sub DelegateBase()
+		simpleDelegates = New System.Collections.Generic.List<_SimpleDelegate>()
+	End Sub
+
+/*
+	Sub Operator + ( sd As System._SimpleDelegate )
+		Add( sd )
+	End Sub*/
+Public
+End Class
+
+
+End Namespace
+
+
+Function _System_CreateSimpleDynamicDelegate( object As Object, methodPtr As VoidPtr ) As System._SimpleDelegate
+	Return New System._SimpleDelegate( object, methodPtr )
+End Function
+Function _System_CreateSimpleStaticDelegate( methodPtr As VoidPtr ) As System._SimpleDelegate
+	Return New System._SimpleDelegate( methodPtr )
+End Function
Index: /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/Debug.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/Debug.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/Debug.ab	(revision 506)
@@ -0,0 +1,248 @@
+Namespace System
+	Namespace Diagnostics
+
+
+#ifdef _DEBUG
+
+		Class Debug
+			Static base As _System_TraceBase()
+
+		Public
+
+			'----------------------------------------------------------------
+			' パブリック メソッド
+			'----------------------------------------------------------------
+
+			' アサート（コールスタックを表示）
+			Static Sub Assert( condition As Boolean )
+				base.Assert( condition )
+			End Sub
+
+			' アサート（メッセージ文字列を表示）
+			Static Sub Assert( condition As Boolean, message As String )
+				base.Assert( condition, message )
+			End Sub
+
+			' アサート（メッセージ文字列と詳細文字列を表示）
+			Static Sub Assert( condition As Boolean, message As String, detailMessage As String )
+				base.Assert( condition, message, detailMessage )
+			End Sub
+
+
+			' インデントレベルを上げる
+			Static Sub Indent()
+				base.Indent()
+			End Sub
+
+			' インデントレベルを下げる
+			Static Sub Unindent()
+				base.Unindent()
+			End Sub
+
+			' 文字列を出力
+			Static Sub Write( value As Object )
+				base.Write( value )
+			End Sub
+			Static Sub Write( message As String )
+				base.Write( message )
+			End Sub
+			Static Sub Write( value As Object, category As String )
+				base.Write( value, category )
+			End Sub
+			Static Sub Write( message As String, category As String )
+				base.Write( message, category )
+			End Sub
+
+			' 一行の文字列を出力
+			Static Sub WriteLine( value As Object )
+				base.WriteLine( value )
+			End Sub
+			Static Sub WriteLine( message As String )
+				base.WriteLine( message )
+			End Sub
+			Static Sub WriteLine( value As Object, category As String )
+				base.WriteLine( value, category )
+			End Sub
+			Static Sub WriteLine( message As String, category As String )
+				base.WriteLine( message, category )
+			End Sub
+
+			' 条件をもとに文字列を出力
+			Static Sub WriteIf( condition As Boolean, value As Object )
+				base.WriteIf( condition, value )
+			End Sub
+			Static Sub WriteIf( condition As Boolean, message As String )
+				base.WriteIf( condition, message )
+			End Sub
+			Static Sub WriteIf( condition As Boolean, value As Object, category As String )
+				base.WriteIf( condition, value, category )
+			End Sub
+			Static Sub WriteIf( condition As Boolean, message As String, category As String )
+				base.WriteIf( condition, message, category )
+			End Sub
+
+			' 条件をもとに一行の文字列を出力
+			Static Sub WriteLineIf( condition As Boolean, message As String )
+				base.WriteLineIf( condition, message )
+			End Sub
+			Static Sub WriteLineIf( condition As Boolean, value As Object )
+				base.WriteLineIf( condition, value )
+			End Sub
+			Static Sub WriteLineIf( condition As Boolean, value As Object, category As String )
+				base.WriteLineIf( condition, value, category )
+			End Sub
+			Static Sub WriteLineIf( condition As Boolean, message As String, category As String )
+				base.WriteLineIf( condition, message, category )
+			End Sub
+
+
+			'----------------------------------------------------------------
+			' パブリック プロパティ
+			'----------------------------------------------------------------
+
+			' IndentLevelプロパティ
+			Static Function IndentLevel() As Long
+				Return base.IndentLevel
+			End Function
+			Static Sub IndentLevel( indentLevel As Long )
+				base.IndentLevel = indentLevel
+			End Sub
+
+			' IndentSizeプロパティ
+			Static Function IndentSize() As Long
+				Return base.IndentSize
+			End Function
+			Static Sub IndentSize( size As Long )
+				base.IndentSize = size
+			End Sub
+
+			' Listenersプロパティ
+			Static Function Listeners() As TraceListenerCollection
+				Return base.Listeners
+			End Function
+		End Class
+
+#else
+
+		Class Debug
+			Static base As _System_TraceBase()
+
+		Public
+
+			'----------------------------------------------------------------
+			' パブリック メソッド
+			'----------------------------------------------------------------
+
+			' アサート（コールスタックを表示）
+			Static Sub Assert( condition As Boolean )
+				'base.Assert( condition )
+			End Sub
+
+			' アサート（メッセージ文字列を表示）
+			Static Sub Assert( condition As Boolean, message As String )
+				'base.Assert( condition, message )
+			End Sub
+
+			' アサート（メッセージ文字列と詳細文字列を表示）
+			Static Sub Assert( condition As Boolean, message As String, detailMessage As String )
+				'base.Assert( condition, message, detailMessage )
+			End Sub
+
+
+			' インデントレベルを上げる
+			Static Sub Indent()
+				base.Indent()
+			End Sub
+
+			' インデントレベルを下げる
+			Static Sub Unindent()
+				base.Unindent()
+			End Sub
+
+			' 文字列を出力
+			Static Sub Write( value As Object )
+				'base.Write( value )
+			End Sub
+			Static Sub Write( message As String )
+				'base.Write( message )
+			End Sub
+			Static Sub Write( value As Object, category As String )
+				'base.Write( value, category )
+			End Sub
+			Static Sub Write( message As String, category As String )
+				'base.Write( message, category )
+			End Sub
+
+			' 一行の文字列を出力
+			Static Sub WriteLine( value As Object )
+				'base.WriteLine( value )
+			End Sub
+			Static Sub WriteLine( message As String )
+				'base.WriteLine( message )
+			End Sub
+			Static Sub WriteLine( value As Object, category As String )
+				'base.WriteLine( value, category )
+			End Sub
+			Static Sub WriteLine( message As String, category As String )
+				'base.WriteLine( message, category )
+			End Sub
+
+			' 条件をもとに文字列を出力
+			Static Sub WriteIf( condition As Boolean, value As Object )
+				'base.WriteIf( condition, value )
+			End Sub
+			Static Sub WriteIf( condition As Boolean, message As String )
+				'base.WriteIf( condition, message )
+			End Sub
+			Static Sub WriteIf( condition As Boolean, value As Object, category As String )
+				'base.WriteIf( condition, value, category )
+			End Sub
+			Static Sub WriteIf( condition As Boolean, message As String, category As String )
+				'base.WriteIf( condition, message, category )
+			End Sub
+
+			' 条件をもとに一行の文字列を出力
+			Static Sub WriteLineIf( condition As Boolean, message As String )
+				'base.WriteLineIf( condition, message )
+			End Sub
+			Static Sub WriteLineIf( condition As Boolean, value As Object )
+				'base.WriteLineIf( condition, value )
+			End Sub
+			Static Sub WriteLineIf( condition As Boolean, value As Object, category As String )
+				'base.WriteLineIf( condition, value, category )
+			End Sub
+			Static Sub WriteLineIf( condition As Boolean, message As String, category As String )
+				'base.WriteLineIf( condition, message, category )
+			End Sub
+
+
+			'----------------------------------------------------------------
+			' パブリック プロパティ
+			'----------------------------------------------------------------
+
+			' IndentLevelプロパティ
+			Static Function IndentLevel() As Long
+				Return base.IndentLevel
+			End Function
+			Static Sub IndentLevel( indentLevel As Long )
+				base.IndentLevel = indentLevel
+			End Sub
+
+			' IndentSizeプロパティ
+			Static Function IndentSize() As Long
+				Return base.IndentSize
+			End Function
+			Static Sub IndentSize( size As Long )
+				base.IndentSize = size
+			End Sub
+
+			' Listenersプロパティ
+			Static Function Listeners() As TraceListenerCollection
+				Return base.Listeners
+			End Function
+		End Class
+
+#endif
+
+	End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/Trace.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/Trace.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/Trace.ab	(revision 506)
@@ -0,0 +1,124 @@
+Namespace System
+	Namespace Diagnostics
+
+		Class Trace
+			Static base As _System_TraceBase()
+
+		Public
+
+			'----------------------------------------------------------------
+			' パブリック メソッド
+			'----------------------------------------------------------------
+
+			' アサート（コールスタックを表示）
+			Static Sub Assert( condition As Boolean )
+				base.Assert( condition )
+			End Sub
+
+			' アサート（メッセージ文字列を表示）
+			Static Sub Assert( condition As Boolean, message As String )
+				base.Assert( condition, message )
+			End Sub
+
+			' アサート（メッセージ文字列と詳細文字列を表示）
+			Static Sub Assert( condition As Boolean, message As String, detailMessage As String )
+				base.Assert( condition, message, detailMessage )
+			End Sub
+
+
+			' インデントレベルを上げる
+			Static Sub Indent()
+				base.Indent()
+			End Sub
+
+			' インデントレベルを下げる
+			Static Sub Unindent()
+				base.Unindent()
+			End Sub
+
+			' 文字列を出力
+			Static Sub Write( value As Object )
+				base.Write( value )
+			End Sub
+			Static Sub Write( message As String )
+				base.Write( message )
+			End Sub
+			Static Sub Write( value As Object, category As String )
+				base.Write( value, category )
+			End Sub
+			Static Sub Write( message As String, category As String )
+				base.Write( message, category )
+			End Sub
+
+			' 一行の文字列を出力
+			Static Sub WriteLine( value As Object )
+				base.WriteLine( value )
+			End Sub
+			Static Sub WriteLine( message As String )
+				base.WriteLine( message )
+			End Sub
+			Static Sub WriteLine( value As Object, category As String )
+				base.WriteLine( value, category )
+			End Sub
+			Static Sub WriteLine( message As String, category As String )
+				base.WriteLine( message, category )
+			End Sub
+
+			' 条件をもとに文字列を出力
+			Static Sub WriteIf( condition As Boolean, value As Object )
+				base.WriteIf( condition, value )
+			End Sub
+			Static Sub WriteIf( condition As Boolean, message As String )
+				base.WriteIf( condition, message )
+			End Sub
+			Static Sub WriteIf( condition As Boolean, value As Object, category As String )
+				base.WriteIf( condition, value, category )
+			End Sub
+			Static Sub WriteIf( condition As Boolean, message As String, category As String )
+				base.WriteIf( condition, message, category )
+			End Sub
+
+			' 条件をもとに一行の文字列を出力
+			Static Sub WriteLineIf( condition As Boolean, message As String )
+				base.WriteLineIf( condition, message )
+			End Sub
+			Static Sub WriteLineIf( condition As Boolean, value As Object )
+				base.WriteLineIf( condition, value )
+			End Sub
+			Static Sub WriteLineIf( condition As Boolean, value As Object, category As String )
+				base.WriteLineIf( condition, value, category )
+			End Sub
+			Static Sub WriteLineIf( condition As Boolean, message As String, category As String )
+				base.WriteLineIf( condition, message, category )
+			End Sub
+
+
+			'----------------------------------------------------------------
+			' パブリック プロパティ
+			'----------------------------------------------------------------
+
+			' IndentLevelプロパティ
+			Static Function IndentLevel() As Long
+				Return base.IndentLevel
+			End Function
+			Static Sub IndentLevel( indentLevel As Long )
+				base.IndentLevel = indentLevel
+			End Sub
+
+			' IndentSizeプロパティ
+			Static Function IndentSize() As Long
+				Return base.IndentSize
+			End Function
+			Static Sub IndentSize( size As Long )
+				base.IndentSize = size
+			End Sub
+
+			' Listenersプロパティ
+			Static Function Listeners() As TraceListenerCollection
+				Return base.Listeners
+			End Function
+
+		End Class
+
+	End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/TraceListener.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/TraceListener.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/TraceListener.ab	(revision 506)
@@ -0,0 +1,155 @@
+Namespace System
+	Namespace Diagnostics
+
+		' リスナ
+		Class TraceListener
+			indentLevel As Long
+			indentSize As Long
+
+		Protected
+			Function GetIndentString() As String
+				Dim i As Long
+
+				Dim IndentStr = ""
+				For i = 0 To ELM( indentSize )
+					IndentStr = IndentStr + " "
+				Next
+
+				Dim ResultStr = ""
+				For i = 0 To ELM( indentLevel )
+					ResultStr = ResultStr + IndentStr
+				Next
+
+				Return ResultStr
+			End Function
+
+		Public
+			Sub TraceListener()
+				indentLevel = 0
+				indentSize = 4
+			End Sub
+
+			' コピーコンストラクタ
+			Sub TraceListener( ByRef listener As TraceListener )
+				indentLevel = listener.indentLevel
+				indentSize = listener.indentSize
+			End Sub
+
+
+			'----------------------------------------------------------------
+			' パブリック メソッド
+			'----------------------------------------------------------------
+
+			Virtual Sub Write( message As String )
+				'派生クラスで実装 (基底では何もしない）
+			End Sub
+			Virtual Sub Write( value As Object )
+				Write( value.ToString() )
+			End Sub
+			Virtual Sub Write( value As Object, category As String )
+				Write( category + ": " + value.ToString() )
+			End Sub
+			Virtual Sub Write( message As String, category As String )
+				Write( category + ": " + message )
+			End Sub
+
+			Virtual Sub WriteLine( message As String )
+				'派生クラスで実装 (基底では何もしない）
+			End Sub
+			Virtual Sub WriteLine( value As Object )
+				WriteLine( value.ToString() )
+			End Sub
+			Virtual Sub WriteLine( value As Object, category As String )
+				WriteLine( category + ": " + value.ToString() )
+			End Sub
+			Virtual Sub WriteLine( message As String, category As String )
+				WriteLine( category + ": " + message )
+			End Sub
+
+			' 条件をもとに文字列を出力
+			Sub WriteIf( condition As Boolean, value As Object )
+				If condition Then
+					Write( value )
+				End If
+			End Sub
+			Sub WriteIf( condition As Boolean, message As String )
+				If condition Then
+					Write( message )
+				End If
+			End Sub
+			Sub WriteIf( condition As Boolean, value As Object, category As String )
+				If condition Then
+					Write( value, category )
+				End If
+			End Sub
+			Sub WriteIf( condition As Boolean, message As String, category As String )
+				If condition Then
+					Write( message, category )
+				End If
+			End Sub
+
+			' 条件をもとに文字列を出力
+			Sub WriteLineIf( condition As Boolean, value As Object )
+				If condition Then
+					WriteLine( value )
+				End If
+			End Sub
+			Sub WriteLineIf( condition As Boolean, message As String )
+				If condition Then
+					WriteLine( message )
+				End If
+			End Sub
+			Sub WriteLineIf( condition As Boolean, value As Object, category As String )
+				If condition Then
+					WriteLine( value, category )
+				End If
+			End Sub
+			Sub WriteLineIf( condition As Boolean, message As String, category As String )
+				If condition Then
+					WriteLine( message, category )
+				End If
+			End Sub
+
+
+			'----------------------------------------------------------------
+			' パブリック プロパティ
+			'----------------------------------------------------------------
+
+			' IndentLevelプロパティ
+			Function IndentLevel() As Long
+				Return indentLevel
+			End Function
+			Sub IndentLevel( indentLevel As Long )
+				This.indentLevel = indentLevel
+			End Sub
+
+			' IndentSizeプロパティ
+			Function IndentSize() As Long
+				Return indentSize
+			End Function
+			Sub IndentSize( size As Long )
+				indentSize = size
+			End Sub
+		End Class
+
+		' デフォルトリスナ（デバッガビューへの出力）
+		Class DefaultTraceListener
+			Inherits TraceListener
+		Public
+
+			Override Sub Write( message As String )
+				' デバッグビューへ出力
+				Dim tempStr = GetIndentString() + message
+				OutputDebugString( ToTCStr(tempStr) )
+
+				' デバッグログへ書き込む
+				' TODO: 実装
+			End Sub
+
+			Override Sub WriteLine( message As String )
+				Write( GetIndentString() + message + Ex"\r\n" )
+			End Sub
+		End Class
+
+	End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/TraceListenerCollection.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/TraceListenerCollection.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/TraceListenerCollection.ab	(revision 506)
@@ -0,0 +1,7 @@
+Namespace System
+	Namespace Diagnostics
+
+		TypeDef TraceListenerCollection = System.Collections.Generic.List<TraceListener>
+
+	End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/base.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/base.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Diagnostics/base.ab	(revision 506)
@@ -0,0 +1,226 @@
+Namespace System
+	Namespace Diagnostics
+
+		Class _System_TraceBase
+			indentLevel As Long
+			indentSize As Long
+
+
+			' リスナ管理
+			listeners As TraceListenerCollection
+
+		Public
+
+			' コンストラクタ
+			Sub _System_TraceBase()
+				listeners = New TraceListenerCollection
+				listeners.Add( New DefaultTraceListener() )
+
+				indentLevel = 0
+				indentSize = 4
+			End Sub
+
+			'----------------------------------------------------------------
+			' パブリック メソッド
+			'----------------------------------------------------------------
+
+			' アサート（コールスタックを表示）
+			Sub Assert( condition As Boolean )
+				If condition = False then
+					'TODO: コールスタックを表示
+				End If
+			End Sub
+
+			' アサート（メッセージ文字列を表示）
+			Sub Assert( condition As Boolean, message As String )
+				If condition = False then
+					' TODO: メッセージボックス形式での表示に対応
+					WriteLine( message )
+				End If
+			End Sub
+
+			' アサート（メッセージ文字列と詳細文字列を表示）
+			Sub Assert( condition As Boolean, message As String, detailMessage As String )
+				If condition = False then
+					' TODO: メッセージボックス形式での表示に対応
+					WriteLine( message )
+				End If
+			End Sub
+
+
+			' インデントレベルを上げる
+			Sub Indent()
+				IndentLevel = indentLevel + 1
+			End Sub
+
+			' インデントレベルを下げる
+			Sub Unindent()
+				If indentLevel <= 0 Then
+					indentLevel = 0
+					Return
+				End If
+				IndentLevel = indentLevel - 1
+			End Sub
+
+			' 文字列を出力
+			Sub Write( value As Object )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.Write( value )
+				Next
+			End Sub
+			Sub Write( message As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.Write( message )
+				Next
+			End Sub
+			Sub Write( value As Object, category As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.Write( value, category )
+				Next
+			End Sub
+			Sub Write( message As String, category As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.Write( message, category )
+				Next
+			End Sub
+
+			' 一行の文字列を出力
+			Sub WriteLine( value As Object )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteLine( value )
+				Next
+			End Sub
+			Sub WriteLine( message As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteLine( message )
+				Next
+			End Sub
+			Sub WriteLine( value As Object, category As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteLine( value, category )
+				Next
+			End Sub
+			Sub WriteLine( message As String, category As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteLine( message, category )
+				Next
+			End Sub
+
+			' 条件をもとに文字列を出力
+			Sub WriteIf( condition As Boolean, value As Object )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteIf( condition, value )
+				Next
+			End Sub
+			Sub WriteIf( condition As Boolean, message As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteIf( condition, message )
+				Next
+			End Sub
+			Sub WriteIf( condition As Boolean, value As Object, category As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteIf( condition, value, category )
+				Next
+			End Sub
+			Sub WriteIf( condition As Boolean, message As String, category As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteIf( condition, message, category )
+				Next
+			End Sub
+
+			' 条件をもとに一行の文字列を出力
+			Sub WriteLineIf( condition As Boolean, value As Object )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteLineIf( condition, value )
+				Next
+			End Sub
+			Sub WriteLineIf( condition As Boolean, message As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteLineIf( condition, message )
+				Next
+			End Sub
+			Sub WriteLineIf( condition As Boolean, value As Object, category As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteLineIf( condition, value, category )
+				Next
+			End Sub
+			Sub WriteLineIf( condition As Boolean, message As String, category As String )
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.WriteLineIf( condition, message, category )
+				Next
+			End Sub
+
+
+			'----------------------------------------------------------------
+			' パブリック プロパティ
+			'----------------------------------------------------------------
+
+			' IndentLevelプロパティ
+			Function IndentLevel() As Long
+				Return indentLevel
+			End Function
+			Sub IndentLevel( indentLevel As Long )
+				This.indentLevel = indentLevel
+
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.IndentLevel = indentLevel
+				Next
+			End Sub
+
+			' IndentSizeプロパティ
+			Function IndentSize() As Long
+				Return indentSize
+			End Function
+			Sub IndentSize( size As Long )
+				indentSize = size
+
+				Dim i As Long
+				For i = 0 To ELM( listeners.Count )
+					Dim listener = listeners[i]
+					listener.IndentSize = indentSize
+				Next
+			End Sub
+
+			' Listenersプロパティ
+			Function Listeners() As TraceListenerCollection
+				Return listeners
+			End Function
+
+		End Class
+
+	End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/CharacterRange.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/CharacterRange.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/CharacterRange.ab	(revision 506)
@@ -0,0 +1,50 @@
+' Classes/System/Drawing/CharacterRange.ab
+
+Class CharacterRange
+Public
+	Sub CharacterRange(f As Long, l As Long)
+		first = f
+		length = l
+	End Sub
+
+	Sub CharacterRange()
+		First = 0
+		Length = 0
+	End Sub
+
+	Function First() As Long
+		Return first
+	End Function
+
+	Sub First(f As Long)
+		first = f
+	End Sub
+
+	Function Length() As Long
+		Return length
+	End Function
+
+	Sub Length(l As Long)
+		length = l
+	End Sub
+
+	Function Operator ==(c As CharacterRange) As Boolean
+		Return Equals(c)
+	End Function
+
+	Function Operator <>(c As CharacterRange) As Boolean
+		Return Not Equals(c)
+	End Function
+
+	Function Equals(c As CharacterRange) As Boolean
+		Return first = c.first And length = c.length
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return first Xor length
+	End Function
+
+Private
+	first As Long
+	length As Long
+End Class
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Color.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Color.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Color.ab	(revision 506)
@@ -0,0 +1,307 @@
+' Classes/System/Drawing/Color.ab
+
+#require <Classes/System/Drawing/Imaging/misc.ab>
+
+Class Color
+Public
+	Sub Color()
+		argb = MakeARGB(255, 0, 0, 0) ' Black
+	End Sub
+
+	Sub Color(ByRef c As Color)
+		argb = c.argb
+	End Sub
+
+	Sub Color(r As Byte, g As Byte, b As Byte)
+		argb = MakeARGB(255, r, g, b)
+	End Sub
+
+	Sub Color(a As Byte, r As Byte, g As Byte, b As Byte)
+		argb = MakeARGB(a, r, g, b)
+	End Sub
+
+	Sub Color(newArgb As ARGB)
+		argb = newArgb
+	End Sub
+
+	Function Operator ==(c As Color) As Boolean
+		Return Equals(c)
+	End Function
+
+	Function Operator <>(c As Color) As Boolean
+		Return Not Equals(c)
+	End Function
+
+	Function A() As Byte
+		A = (argb >> ALPHA_SHIFT) As Byte
+	End Function
+
+	Function R() As Byte
+		R = (argb >> RED_SHIFT) As Byte
+	End Function
+
+	Function G() As Byte
+		G = (argb >> GREEN_SHIFT) As Byte
+	End Function
+
+	Function B() As Byte
+		B = (argb >> BLUE_SHIFT) As Byte
+	End Function
+
+	Function Value() As ARGB
+		Value = argb
+	End Function
+
+	Sub Value(value As ARGB)
+		argb = value
+	End Sub
+
+	Sub SetFromCOLORREF(rgb As COLORREF)
+		If (rgb And &hff000000) = &h01000000 Then
+			Exit Sub ' パレットインデックス指定は無効
+		Else
+			argb = MakeARGB(255, GetRValue(rgb) As Byte, GetGValue(rgb) As Byte, GetBValue(rgb) As Byte)
+		End If
+	End Sub
+
+	Function ToCOLORREF() As COLORREF
+		ToCOLORREF = RGB(R, G, B)
+	End Function
+/*
+	Function ToArgb() As ARGB
+		ToArgb = argb
+	End Function
+*/
+	Static Function FromArgb(argb As ARGB) As Color
+		Return New Color(argb)
+	End Function
+
+	Static Function FromArgb(a As Byte, base As Color) As Color
+		Return New Color(a, base.R, base.G, base.B)
+	End Function
+
+	Static Function FromArgb(r As Byte, g As Byte, b As Byte) As Color
+		Return New Color(r, g, b)
+	End Function
+
+	Static Function FromArgb(a As Byte, r As Byte, g As Byte, b As Byte) As Color
+		Return New Color(a, r, g, b)
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return argb As Long
+	End Function
+
+	Function Equals(c As Color) As Boolean
+		Return argb = c.argb
+	End Function
+
+	' HSBを求める式はhttp://ofo.jp/osakana/cgtips/hsb.phtmlを参考にしました。
+	Function GetHue() As Single
+		Dim max As Long, min As Long, d As Long
+		Dim r = R
+		Dim g = G
+		Dim b = B
+		max = System.Math.Max(System.Math.Max(r, g), b)
+		min = System.Math.Min(System.Math.Min(r, g), b)
+		d = max - min
+		If g = max Then
+			Return ((b - r) As Double / d * 60.0 + 120.0) As Single
+		ElseIf b = max Then
+			Return ((r - g) As Double / d * 60 + 240) As Single
+		ElseIf g < b Then
+			Return ((g - b) As Double / d * 60 + 360) As Single
+		Else
+			Return ((g - b) As Double / d * 60) As Single
+		EndIf
+	End Function
+
+	Function GetSaturation() As Single
+		Dim r = R
+		Dim g = G
+		Dim b = B
+		Dim max = System.Math.Max(System.Math.Max(r, g), b) As Long
+		Dim min = System.Math.Min(System.Math.Min(r, g), b) As Long
+		Return ( (max - min) / max ) As Single
+	End Function
+
+	Function GetBrightness() As Single
+		Dim r = R
+		Dim g = G
+		Dim b = B
+		Dim max = System.Math.Max(System.Math.Max(r, g), b)
+		Return ( max * (1 / 255) ) As Single
+	End Function
+
+/*
+	' Common color constants
+	Const Enum
+		AliceBlue            = &hFFF0F8FF
+		AntiqueWhite         = &hFFFAEBD7
+		Aqua                 = &hFF00FFFF
+		Aquamarine           = &hFF7FFFD4
+		Azure                = &hFFF0FFFF
+		Beige                = &hFFF5F5DC
+		Bisque               = &hFFFFE4C4
+		Black                = &hFF000000
+		BlanchedAlmond       = &hFFFFEBCD
+		Blue                 = &hFF0000FF
+		BlueViolet           = &hFF8A2BE2
+		Brown                = &hFFA52A2A
+		BurlyWood            = &hFFDEB887
+		CadetBlue            = &hFF5F9EA0
+		Chartreuse           = &hFF7FFF00
+		Chocolate            = &hFFD2691E
+		Coral                = &hFFFF7F50
+		CornflowerBlue       = &hFF6495ED
+		Cornsilk             = &hFFFFF8DC
+		Crimson              = &hFFDC143C
+		Cyan                 = &hFF00FFFF
+		DarkBlue             = &hFF00008B
+		DarkCyan             = &hFF008B8B
+		DarkGoldenrod        = &hFFB8860B
+		DarkGray             = &hFFA9A9A9
+		DarkGreen            = &hFF006400
+		DarkKhaki            = &hFFBDB76B
+		DarkMagenta          = &hFF8B008B
+		DarkOliveGreen       = &hFF556B2F
+		DarkOrange           = &hFFFF8C00
+		DarkOrchid           = &hFF9932CC
+		DarkRed              = &hFF8B0000
+		DarkSalmon           = &hFFE9967A
+		DarkSeaGreen         = &hFF8FBC8B
+		DarkSlateBlue        = &hFF483D8B
+		DarkSlateGray        = &hFF2F4F4F
+		DarkTurquoise        = &hFF00CED1
+		DarkViolet           = &hFF9400D3
+		DeepPink             = &hFFFF1493
+		DeepSkyBlue          = &hFF00BFFF
+		DimGray              = &hFF696969
+		DodgerBlue           = &hFF1E90FF
+		Firebrick            = &hFFB22222
+		FloralWhite          = &hFFFFFAF0
+		ForestGreen          = &hFF228B22
+		Fuchsia              = &hFFFF00FF
+		Gainsboro            = &hFFDCDCDC
+		GhostWhite           = &hFFF8F8FF
+		Gold                 = &hFFFFD700
+		Goldenrod            = &hFFDAA520
+		Gray                 = &hFF808080
+		Green                = &hFF008000
+		GreenYellow          = &hFFADFF2F
+		Honeydew             = &hFFF0FFF0
+		HotPink              = &hFFFF69B4
+		IndianRed            = &hFFCD5C5C
+		Indigo               = &hFF4B0082
+		Ivory                = &hFFFFFFF0
+		Khaki                = &hFFF0E68C
+		Lavender             = &hFFE6E6FA
+		LavenderBlush        = &hFFFFF0F5
+		LawnGreen            = &hFF7CFC00
+		LemonChiffon         = &hFFFFFACD
+		LightBlue            = &hFFADD8E6
+		LightCoral           = &hFFF08080
+		LightCyan            = &hFFE0FFFF
+		LightGoldenrodYellow = &hFFFAFAD2
+		LightGray            = &hFFD3D3D3
+		LightGreen           = &hFF90EE90
+		LightPink            = &hFFFFB6C1
+		LightSalmon          = &hFFFFA07A
+		LightSeaGreen        = &hFF20B2AA
+		LightSkyBlue         = &hFF87CEFA
+		LightSlateGray       = &hFF778899
+		LightSteelBlue       = &hFFB0C4DE
+		LightYellow          = &hFFFFFFE0
+		Lime                 = &hFF00FF00
+		LimeGreen            = &hFF32CD32
+		Linen                = &hFFFAF0E6
+		Magenta              = &hFFFF00FF
+		Maroon               = &hFF800000
+		MediumAquamarine     = &hFF66CDAA
+		MediumBlue           = &hFF0000CD
+		MediumOrchid         = &hFFBA55D3
+		MediumPurple         = &hFF9370DB
+		MediumSeaGreen       = &hFF3CB371
+		MediumSlateBlue      = &hFF7B68EE
+		MediumSpringGreen    = &hFF00FA9A
+		MediumTurquoise      = &hFF48D1CC
+		MediumVioletRed      = &hFFC71585
+		MidnightBlue         = &hFF191970
+		MintCream            = &hFFF5FFFA
+		MistyRose            = &hFFFFE4E1
+		Moccasin             = &hFFFFE4B5
+		NavajoWhite          = &hFFFFDEAD
+		Navy                 = &hFF000080
+		OldLace              = &hFFFDF5E6
+		Olive                = &hFF808000
+		OliveDrab            = &hFF6B8E23
+		Orange               = &hFFFFA500
+		OrangeRed            = &hFFFF4500
+		Orchid               = &hFFDA70D6
+		PaleGoldenrod        = &hFFEEE8AA
+		PaleGreen            = &hFF98FB98
+		PaleTurquoise        = &hFFAFEEEE
+		PaleVioletRed        = &hFFDB7093
+		PapayaWhip           = &hFFFFEFD5
+		PeachPuff            = &hFFFFDAB9
+		Peru                 = &hFFCD853F
+		Pink                 = &hFFFFC0CB
+		Plum                 = &hFFDDA0DD
+		PowderBlue           = &hFFB0E0E6
+		Purple               = &hFF800080
+		Red                  = &hFFFF0000
+		RosyBrown            = &hFFBC8F8F
+		RoyalBlue            = &hFF4169E1
+		SaddleBrown          = &hFF8B4513
+		Salmon               = &hFFFA8072
+		SandyBrown           = &hFFF4A460
+		SeaGreen             = &hFF2E8B57
+		SeaShell             = &hFFFFF5EE
+		Sienna               = &hFFA0522D
+		Silver               = &hFFC0C0C0
+		SkyBlue              = &hFF87CEEB
+		SlateBlue            = &hFF6A5ACD
+		SlateGray            = &hFF708090
+		Snow                 = &hFFFFFAFA
+		SpringGreen          = &hFF00FF7F
+		SteelBlue            = &hFF4682B4
+		Tan                  = &hFFD2B48C
+		Teal                 = &hFF008080
+		Thistle              = &hFFD8BFD8
+		Tomato               = &hFFFF6347
+		Transparent          = &h00FFFFFF
+		Turquoise            = &hFF40E0D0
+		Violet               = &hFFEE82EE
+		Wheat                = &hFFF5DEB3
+		White                = &hFFFFFFFF
+		WhiteSmoke           = &hFFF5F5F5
+		Yellow               = &hFFFFFF00
+		YellowGreen          = &hFF9ACD32
+	End Enum
+
+	' Shift count and bit mask for A, R, G, B components
+
+	Const Enum
+		AlphaShift  = 24
+		RedShift    = 16
+		GreenShift  = 8
+		BlueShift   = 0
+	End Enum
+
+	Const Enum
+		AlphaMask   = &hff000000
+		RedMask     = &h00ff0000
+		GreenMask   = &h0000ff00
+		BlueMask    = &h000000ff
+	End Enum
+*/
+	Static Function MakeARGB(a As Byte, r As Byte, g As Byte, b As Byte) As ARGB
+		MakeARGB = (((b As ARGB) <<  BLUE_SHIFT) Or _
+		            ((g As ARGB) << GREEN_SHIFT) Or _
+		            ((r As ARGB) <<   RED_SHIFT) Or _
+		            ((a As ARGB) << ALPHA_SHIFT))
+	End Function
+
+Protected
+	argb As ARGB
+End Class
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Drawing2D/Matrix.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Drawing2D/Matrix.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Drawing2D/Matrix.ab	(revision 506)
@@ -0,0 +1,4 @@
+' Classes/System/Drawing/Drawing2D/Matrix.ab
+
+Class Matrix
+End Class
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Drawing2D/misc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Drawing2D/misc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Drawing2D/misc.ab	(revision 506)
@@ -0,0 +1,82 @@
+' Classes/System/Drawing/Drawing2D/misc.ab
+
+Enum CombineMode
+	Replace      ' 0
+	Intersect    ' 1
+	Union        ' 2
+	Xor          ' 3
+	Exclude      ' 4
+	Complement   ' 5
+End Enum
+
+Enum CompositingMode
+	ModeSourceOver     ' 0
+	ModeSourceCopy     ' 1
+End Enum
+
+Enum QualityMode
+	Invalid   = -1
+	Default   = 0
+	Low       = 1  ' Best performance
+	High      = 2  ' Best rendering quality
+End Enum
+
+Enum CompositingQuality
+	Invalid          = QualityMode.Invalid
+	Default          = QualityMode.Default
+	HighSpeed        = QualityMode.Low
+	HighQuality      = QualityMode.High
+	GammaCorrected
+	AssumeLinear
+End Enum
+
+Enum InterpolationMode
+	Invalid          = QualityMode.Invalid
+	Default          = QualityMode.Default
+	LowQuality       = QualityMode.Low
+	HighQuality      = QualityMode.High
+	Bilinear
+	Bicubic
+	NearestNeighbor
+	HighQualityBilinear
+	HighQualityBicubic
+End Enum
+
+Enum SmoothingMode
+	Invalid     = QualityMode.Invalid
+	Default     = QualityMode.Default
+	HighSpeed   = QualityMode.Low
+	HighQuality = QualityMode.High
+	None
+	AntiAlias
+End Enum
+
+Enum PixelOffsetMode
+	Invalid     = QualityMode.Invalid
+	Default     = QualityMode.Default
+	HighSpeed   = QualityMode.Low
+	HighQuality = QualityMode.High
+	None
+	Half
+End Enum
+
+Enum FlushIntention
+	Flush
+	Sync
+End Enum
+
+Enum FillMode
+	Alternate
+	Winding
+End Enum
+
+Enum MatrixOrder
+	Prepend
+	Append
+End Enum
+
+Enum CoordinateSpace
+	World
+	Page
+	Device
+End Enum
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Font.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Font.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Font.ab	(revision 506)
@@ -0,0 +1,330 @@
+/**
+@file Classes/System/Drawing/Font.ab
+@brief Fontクラスなどの実装。
+*/
+
+#require <Classes/System/Drawing/Graphics.ab>
+
+Class FontFamily : End Class
+Class FontCollection : End Class
+
+Class Font
+	Implements System.IDisposable
+Public
+'	 friend class Graphics
+
+	Sub Font(/*IN*/ hdc As HDC)
+		Dim font = 0 As *GpFont
+		lastResult = GdipCreateFontFromDC(hdc, font)
+		SetNativeFont(font)
+	End Sub
+
+	Sub Font(/*IN*/ hdc As HDC, /*IN const*/ ByRef logfont As LOGFONTA)
+		Dim font = 0 As *GpFont
+		lastResult =GdipCreateFontFromLogfontA(hdc, logfont, font)
+		SetNativeFont(font)
+	End Sub
+
+	Sub Font(/*IN*/ hdc As HDC, /*IN const*/ ByRef logfont As LOGFONTW)
+		Dim font = 0 As *GpFont
+		lastResult =GdipCreateFontFromLogfontW(hdc, logfont, font)
+		SetNativeFont(font)
+	End Sub
+
+	Sub Font(/*IN*/ hdc As HDC, /*IN const*/ hfont As HFONT)
+		Dim font = 0 As *GpFont
+		If hfont <> 0 Then
+			Dim lf As LOGFONTA
+			If GetObjectA(hfont, sizeof (LOGFONTA), lf) <> 0 Then
+				lastResult = GdipCreateFontFromLogfontA(hdc, lf, font)
+			Else
+				lastResult = GdipCreateFontFromDC(hdc, font)
+			End If
+		Else
+			lastResult = GdipCreateFontFromDC(hdc, font)
+		End If
+		SetNativeFont(font)
+	End Sub
+
+	Sub Font(/*IN const*/ family As FontFamily, /*IN*/ emSize As Single)
+		Font(family, emSize, FontStyleRegular, UnitPoint)
+	End Sub
+
+	Sub Font(/*IN const*/ family As FontFamily,
+		/*IN*/ emSize As Single, /*IN*/ style As Long)
+
+		Font(family, emSize, style, UnitPoint)
+	End Sub
+
+	Sub Font(/*IN const*/ family As FontFamily, /*IN*/ emSize As Single,
+		/*IN*/ style As Long, /*IN*/ unit As GraphicsUnit)
+
+		Dim font = 0 As *GpFont
+		lastResult = GdipCreateFont(
+			family.NativeFamily, emSize, style, unit, font)
+		SetNativeFont(font)
+	End Sub
+
+	Sub Font(/*IN const*/ familyName As PCWSTR, /*IN*/ emSize As Single)
+		Font(familyName, emSize, FontStyleRegular, Unit.Point, ByVal 0)
+	End Sub
+
+	Sub Font(/*IN const*/ familyName As String, /*IN*/ emSize As Single)
+		Font(familyName, emSize, FontStyleRegular, Unit.Point, ByVal 0)
+	End Sub
+
+	Sub Font(/*IN const*/ familyName As PCWSTR, /*IN*/ emSize As Single,
+		 /*IN*/ style As Long)
+		Font(familyName, emSize, style, Unit.Point, ByVal 0)
+	End Sub
+
+	Sub Font(/*IN const*/ familyName As String, /*IN*/ emSize As Single,
+		 /*IN*/ style As Long)
+		Font(familyName, emSize, style, Unit.Point, ByVal 0)
+	End Sub
+
+	Sub Font(/*IN const*/ familyName As PCWSTR, /*IN*/ emSize As Single,
+		 /*IN*/ style As Long, /*IN*/ unit As GraphicsUnit)
+		Font(familyName, emSize, style, unit, ByVal 0)
+	End Sub
+
+	Sub Font(/*IN const*/ familyName As String, /*IN*/ emSize As Single,
+		 /*IN*/ style As Long, /*IN*/ unit As GraphicsUnit)
+		Font(familyName, emSize, style, unit, ByVal 0)
+	End Sub
+
+	Sub Font(/*IN const*/ familyName As PCWSTR, /*IN*/ emSize As Single,
+		/*IN*/ style As Long, /*IN*/ unit As GraphicsUnit,
+		/*IN const*/ ByRef fontCollection As FontCollection)
+
+		nativeFont = 0
+
+		Dim family As FontFamily(familyName, fontCollection)
+		Dim nativeFamily = family.NativeFamily As *GpFontFamily
+
+		lastResult = family.GetLastStatus()
+
+		If lastResult <> Ok Then
+			nativeFamily = FontFamily.GenericSansSerif()->NativeFamily
+			lastResult = FontFamily.GenericSansSerif()->lastResult
+			If lastResult <> Ok Then
+				Exit Sub
+			End If
+		End If
+
+		lastResult = GdipCreateFont(
+			nativeFamily, emSize, style, unit, nativeFont)
+
+		If lastResult <> Ok Then
+			nativeFamily = FontFamily.GenericSansSerif()->NativeFamily
+			lastResult = FontFamily.GenericSansSerif()->lastResult
+			If lastResult <> Ok Then
+				Exit Sub
+			End If
+
+			lastResult = GdipCreateFont(
+				nativeFamily, emSize, style, unit, nativeFont)
+		End If
+	End Sub
+
+	Sub Font(/*IN const*/ familyName As String, /*IN*/ emSize As Single,
+		/*IN*/ style As Long, /*IN*/ unit As GraphicsUnit,
+		/*IN const*/ fontCollection As FontCollection)
+		Font(ToWCStr(familyName), emSize, style, unit, fontCollection)
+	End Sub
+
+	Const Function GetLogFontA(/*IN const*/ g As Graphics, /*OUT*/ ByRef lf As LOGFONTA) As Status
+		Dim nativeGraphics As *GpGraphics
+		If Not ActiveBasic.IsNothing(g) Then
+			nativeGraphics = g.nativeGraphics
+		End If
+		Return SetStatus(GdipGetLogFontA(nativeFont, nativeGraphics, lf))
+	End Function
+
+	Const Function GetLogFontW(/*IN const*/ g As Graphics, /*OUT*/ ByRef lf As LOGFONTW) As Status
+		Dim nativeGraphics As *GpGraphics
+		If Not ActiveBasic.IsNothing(g) Then
+			nativeGraphics = g.nativeGraphics
+		End If
+		Return SetStatus(GdipGetLogFontW(nativeFont, nativeGraphics, lf))
+	End Function
+
+	Const Function GetLogFont(/*IN const*/ g As Graphics, /*OUT*/ ByRef lf As LOGFONT) As Status
+		Dim nativeGraphics As *GpGraphics
+		If Not ActiveBasic.IsNothing(g) Then
+			nativeGraphics = g.nativeGraphics
+		End If
+#ifdef UNICODE
+		Return SetStatus(GdipGetLogFontW(nativeFont, nativeGraphics, lf))
+#else
+		Return SetStatus(GdipGetLogFontA(nativeFont, nativeGraphics, lf))
+#endif
+	End Function
+
+	Const Function Clone() As Font
+		Dim cloneFont = 0 As *GpFont
+		SetStatus(GdipCloneFont(nativeFont, cloneFont))
+		Return New Font(cloneFont, lastResult)
+	End Function
+
+	Sub ~Font()
+		GdipDeleteFont(nativeFont)
+	End Sub
+
+	Const Function IsAvailable() As Boolean
+		Return nativeFont <> 0
+	End Function
+
+	Const Function Style() As Long
+		SetStatus(GdipGetFontStyle(nativeFont, Style))
+	End Function
+
+	Const Function Size() As Single
+		SetStatus(GdipGetFontSize(nativeFont, Size))
+	End Function
+
+	Const Function SizeInPoints() As Single
+
+	Const Function Unit() As GraphicsUnit
+		SetStatus(GdipGetFontUnit(nativeFont, Unit))
+	End Function
+
+	Const Function LastStatus() As Status
+		Return lastResult
+	End Function
+
+	Const Function Height() As Long
+		Return GetHeight() As Long
+	End Function
+
+	Const Function GetHeight() As Single
+		SetStatus(GdipGetFontHeight(nativeFont, 0, GetHeight))
+	End Function
+
+	Const Function GetHeight(/*IN const*/ g As Graphics) As Single
+		Dim nativeGraphics As *GpGraphics
+		If Not ActiveBasic.IsNothing(g) Then
+			nativeGraphics = g.NativeGraphics
+		End If
+		SetStatus(GdipGetFontHeight(nativeFont, nativeGraphics, GetHeight))
+	End Function
+
+	Const Function GetHeight(/*IN*/ dpi As Single) As Single
+		SetStatus(GdipGetFontHeightGivenDPI(nativeFont, dpi, GetHeight))
+	End Function
+
+'	 Const Function FontFamily(/*OUT*/ ByRef family As FontFamily)
+'		If VarPtr(family) = 0 Then
+'			Return SetStatus(Status.InvalidParameter)
+'		End If
+'		Dim status = GdipGetFamily(nativeFont, family->nativeFamily)
+'		family->SetStatus(status)
+'		Return SetStatus(status)
+'	End Function
+
+	Const Function Bold() As Boolean
+		Dim lf As LOGFONT
+		GetLogFont(0, lf)
+		Return lf.lfWeight > FW_BOLD
+	End Function
+
+	Const Function GdiCharSet() As Byte
+		Dim lf As LOGFONT
+		GetLogFont(0, lf)
+		Return lf.lfCharSet
+	End Function
+
+	'Const Function GdiVerticalFont() As Boolean
+
+	Const Function NativeFont() As *GpFont
+		Return nativeFont
+	End Function
+
+	'Const Function IsSystemFont() As Boolean
+
+	Const Function Italic() As Boolean
+		Dim lf As LOGFONT
+		GetLogFont(0, lf)
+		Return lf.lfItalic <> FALSE
+	End Function
+
+	Const Function Name() As String
+#ifdef UNICODE
+		Dim lf As LOGFONTW
+		GetLogFontW(0, lf)
+#else
+		Dim lf As LOGFONTA
+		GetLogFontA(0, lf)
+#endif
+		Return lf.lfFaceName
+	End Function
+
+	'Const Function SizeInPoint() As Boolean
+
+	Const Function StrikeOut() As Boolean
+		Dim lf As LOGFONT
+		GetLogFont(0, lf)
+		Return lf.fdwStrikeOut <> FALSE
+	End Function
+
+	Const Function Style() As FontStyle
+		Dim lf As LOGFONT
+		GetLogFont(0, lf)
+		Return (((lf.lfWeight > FW_BOLD) And FontStyle.Bold) Or _
+			((lf.lfItatlic <> FALSE) And FontStyle.Italic) Or _
+			((lf.fdwStrikeOut <> FALSE) And FontStyle.Strickeout) Or _
+			((lf.fdwUnderline <> FALSE) And FontStyle.Underline)) As FontStyle
+	End Function
+
+	'Const Function SystemFontName() As String
+
+	Const Function Underline() As Boolean
+		Dim lf As LOGFONT
+		GetLogFont(0, lf)
+		Return lf.fdwUnderline <> FALSE
+	End Function
+
+	Override Function ToString() As String
+		Return Name
+	End Function
+
+	Const Function ToHfont() As HFONT
+		Dim lf As LOGFONT
+		GetLogFont(ByVal 0, lf)
+		Return CreateFontIndirect(lf)
+	End Function
+
+	Const Sub ToLogFont(ByRef lf As LOGFONT)
+		GetLogFont(ByVal 0, lf)
+	End Sub
+
+	Const Sub ToLogFont(ByRef lf As LOGFONT, g As Graphics)
+		GetLogFont(g, lf)
+	End Sub
+
+Private
+'	Sub Font(ByRef f As Font)
+
+Protected
+	Sub Font(f As *GpFont, status As Status)
+		lastResult = status
+		SetNativeFont(f)
+	End Sub
+
+	Sub SetNativeFont(f As *GpFont)
+		nativeFont = f
+	End Sub
+
+	Const Function SetStatus(s As Status) As Status
+		If s <> Status.Ok Then
+			lastResult = s
+			Return s
+		Else
+			Return s
+		End If
+	End Function
+
+Protected
+	nativeFont As *GpFont
+	/*mutable*/ lastResult As Status
+End Class
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Graphics.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Graphics.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Graphics.ab	(revision 506)
@@ -0,0 +1,2009 @@
+' Classes/System/Drawing/Graphics.ab
+
+Class Brush : End Class
+Class Pen : End Class
+Class StringFormat : End Class
+Class Image : End Class
+Class ImageAttributes : End Class
+Class Metafile : End Class
+Class Region : End Class
+Class GraphicsPath : End Class
+Class CachedBitmap : End Class
+
+Class Graphics
+Public
+	'=========================================================================
+	' Properties
+	'=========================================================================
+	Const Function Clip() As Region
+		Dim r As Region
+		GetClip(r)
+		Return r
+	End Function
+
+	Sub Clip(region As /*Const*/ Region)
+		SetClip(region, CombineMode.Replace)
+	End Sub
+
+	Const Function ClipBounds() As RectangleF
+		Dim rc As RectangleF
+		GetClipBounds(rc)
+		Return rc
+	End Function
+
+	Sub ClipBounds(rc As RectangleF)
+		SetClipBounds(rc)
+	End Sub
+
+	Function CompositingMode() As CompositingMode
+		Return GetCompositingMode()
+	End Function
+
+	Sub CompositingMode(mode As CompositingMode)
+		SetCompositingMode(mode)
+	End Sub
+
+	Function CompositingQuality() As CompositingQuality
+		Return GetCompositingQuality()
+	End Function
+
+	Sub CompositingQuality(cq As CompositingQuality)
+		SetCompositingQuality(cq)
+	End Sub
+
+	Const Function DpiX() As Single
+		Dim dpi As Single
+		SetStatus(GdipGetDpiX(nativeGraphics, dpi))
+		Return dpi
+	End Function
+
+	Const Function DpiY() As Single
+		Dim dpi As Single
+		SetStatus(GdipGetDpiY(nativeGraphics, dpi))
+		Return dpi
+	End Function
+
+	Const Function InterpolationMode() As InterpolationMode
+		Return GetInterpolationMode()
+	End Function
+
+	Sub InterpolationMode(im As InterpolationMode)
+		SetInterpolationMode(im)
+	End Sub
+
+	Const Function IsClipEmpty() As BOOL
+		Dim b = FALSE As BOOL
+		SetStatus(GdipIsClipEmpty(nativeGraphics, b))
+		Return b
+	End Function
+
+	Const Function IsVisibleClipEmpty() As BOOL
+		Dim b = FALSE As BOOL
+		SetStatus(GdipIsVisibleClipEmpty(nativeGraphics, b))
+		Return b
+	End Function
+
+	Function PageScale(scale As Single) As Status
+		Return SetStatus(GdipSetPageScale(nativeGraphics, scale))
+	End Function
+
+	Const Function PageScale() As Single
+		Dim scale As Single
+		SetStatus(GdipGetPageScale(nativeGraphics, scale))
+		Return scale
+	End Function
+
+	Const Function PageUnit() As GraphicsUnit
+		Dim unit As GraphicsUnit
+		SetStatus(GdipGetPageUnit(nativeGraphics, unit))
+		Return unit
+	End Function
+
+	Function PageUnit(unit As GraphicsUnit) As Status
+		Return SetStatus(GdipSetPageUnit(nativeGraphics, unit))
+	End Function
+
+	Function PixelOffsetMode() As PixelOffsetMode
+		Return GetPixelOffsetMode()
+	End Function
+
+	Sub PixelOffsetMode(mode  As PixelOffsetMode)
+		SetPixelOffsetMode(mode)
+	End Sub
+
+	Function RenderingOrigin() As Point
+		Dim pt As Point
+		GetRenderingOrigin(pt.X, pt.Y)
+		Return pt
+	End Function
+
+	Sub RenderingOrigin(pt As Point)
+		SetRenderingOrigin(pt.X, pt.Y)
+	End Sub
+
+	Function SmoothingMode() As SmoothingMode
+		Return GetSmoothingMode()
+	End Function
+
+	Sub SmoothingMode(mode As SmoothingMode)
+		SetSmoothingMode(mode)
+	End Sub
+
+	Function TextContrast() As DWord
+		Return GetTextContrast()
+	End Function
+
+	Sub TextContrast(contrast As DWord)
+		SetTextContrast(contrast)
+	End Sub
+
+	Function TextRenderingHint() As TextRenderingHint
+		Return GetTextRenderingHint()
+	End Function
+
+	Sub TextRenderingHint(mode As TextRenderingHint)
+		SetTextRenderingHint(mode)
+	End Sub
+
+	Function Transform() As Matrix
+		Dim matrix As Matrix
+		GetTransform(matrix)
+		Return matrix
+	End Function
+
+	Sub Transform(matrix As Matrix)
+		SetTransform(matirx)
+	End Sub
+
+	Function VisibleClipBounds() As RectangleF
+		Dim rc As RectangleF
+		GetVisibleClipBounds(rc)
+		Return rc
+	End Function
+
+	'=========================================================================
+	' Methods
+	'=========================================================================
+	Static Function FromHDC(hdc As HDC) As Graphics
+		Return New Graphics(hdc)
+	End Function
+
+	Static Function FromHDC(hdc As HDC, hdevice As HANDLE) As Graphics
+		Return New Graphics(hdc, hdevice)
+	End Function
+
+	Static Function FromHWND(hwnd As HWND) As Graphics
+		Return New Graphics(hwnd, FALSE)
+	End Function
+
+	Static Function FromHWND(hwnd As DWord, icm As BOOL) As Graphics
+		Return New Graphics(hwnd, icm)
+	End Function
+
+	Static Function FromImage(image As Image) As Graphics
+		Return New Graphics(image)
+	End Function
+
+	Sub Graphics(hdc As HDC)
+		Dim graphics = 0 As GpGraphics
+		lastResult = GdipCreateFromHDC(hdc, graphics)
+		SetNativeGraphics(graphics)
+	End Sub
+
+	Sub Graphics(hdc As HDC, hdevice As HANDLE)
+		Dim graphics = 0 As *GpGraphics
+		lastResult = GdipCreateFromHDC2(hdc, hdevice, graphics)
+		SetNativeGraphics(graphics)
+	End Sub
+
+	Sub Graphics(hwnd As HWND)
+		Dim graphics = 0 As *GpGraphics
+		lastResult = GdipCreateFromHWND(hwnd, graphics)
+		SetNativeGraphics(graphics)
+	End Sub
+
+	Sub Graphics(hwnd As HWND, icm As BOOL)
+		Dim graphics = 0 As *GpGraphics
+		If icm <> FALSE Then
+			lastResult = GdipCreateFromHWNDICM(hwnd, graphics)
+		Else
+			lastResult = GdipCreateFromHWND(hwnd, graphics)
+		End If
+		SetNativeGraphics(graphics)
+	End Sub
+
+	Sub Graphics(image As Image)
+		Dim graphics = 0 As *GpGraphics
+		If (image != 0)
+			lastResult = GdipGetImageGraphicsContext(image->NativeImage, graphics)
+		End If
+		SetNativeGraphics(graphics)
+	End Sub
+
+	Sub ~Graphics()
+		GdipDeleteGraphics(nativeGraphics)
+	End Sub
+
+	Sub Flush()
+		GdipFlush(nativeGraphics, FlushIntention.Flush)
+	End Sub
+
+	Sub Flush(intention As FlushIntention)
+		GdipFlush(nativeGraphics, intention)
+	End Sub
+
+	'------------------------------------------------------------------------
+	' GDI Interop methods
+	'------------------------------------------------------------------------
+
+	' Locks the graphics until ReleaseDC is called
+
+	Function GetHDC() As HDC
+		Dim hdc = 0 As HDC
+		SetStatus(GdipGetDC(nativeGraphics, hdc))
+		Return hdc
+	End Function
+
+	Sub ReleaseHDC(hdc As HDC)
+		SetStatus(GdipReleaseDC(nativeGraphics, hdc))
+	End Sub
+
+	'------------------------------------------------------------------------
+	' Rendering modes
+	'------------------------------------------------------------------------
+
+	Function SetRenderingOrigin(x As Long, y As Long) As Status
+		Return SetStatus(GdipSetRenderingOrigin(nativeGraphics, x, y))
+	End Function
+
+	Const Function GetRenderingOrigin(x As Long, y As Long) As Status
+		Return SetStatus(GdipGetRenderingOrigin(nativeGraphics, x, y))
+	End Function
+
+	Function SetCompositingMode(compositingMode As CompositingMode) As Status
+		Return SetStatus(GdipSetCompositingMode(nativeGraphics, compositingMode))
+	End Function
+
+	Const Function GetCompositingMode() As CompositingMode
+		Dim mode As CompositingMode
+		SetStatus(GdipGetCompositingMode(nativeGraphics, mode))
+		Return mode
+	End Function
+
+	Function SetCompositingQuality(compositingQuality As CompositingQuality)
+		Return SetStatus(GdipSetCompositingQuality(nativeGraphics, compositingQuality))
+	End Function
+
+	Const Function GetCompositingQuality() As CompositingQuality
+		Dim quality As CompositingQuality
+		SetStatus(GdipGetCompositingQuality(nativeGraphics, quality))
+		Return quality
+	End Function
+
+	Function SetTextRenderingHint(newMode As TextRenderingHint) As Status
+		Return SetStatus(GdipSetTextRenderingHint(nativeGraphics, newMode))
+	End Function
+
+	Const Function GetTextRenderingHint() As TextRenderingHint
+		Dim hint As TextRenderingHint
+		SetStatus(GdipGetTextRenderingHint(nativeGraphics, hint))
+		Return hint
+	End Function
+
+	Function SetTextContrast(contrast As DWord) As Status
+		Return SetStatus(GdipSetTextContrast(nativeGraphics, contrast))
+	End Function
+
+	Const Function GetTextContrast() As DWord
+		Dim contrast As DWord
+		SetStatus(GdipGetTextContrast(nativeGraphics, contrast))
+		Return contrast
+	End Function
+
+	Const Function GetInterpolationMode() As InterpolationMode
+		Dim mode = InterpolationMode.Invalid As InterpolationMode
+		SetStatus(GdipGetInterpolationMode(nativeGraphics, mode))
+		Return mode
+	End Function
+
+	Function SetInterpolationMode(interpolationMode As InterpolationMode) As Status
+		Return SetStatus(GdipSetInterpolationMode(nativeGraphics, interpolationMode))
+	End Function
+
+	Const Function GetSmoothingMode() As SmoothingMode
+		Dim smoothingMode = SmoothingMode.Invalid As SmoothingMode
+		SetStatus(GdipGetSmoothingMode(nativeGraphics, smoothingMode))
+		Return smoothingMode
+	End Function
+
+	Function SetSmoothingMode(smoothingMode As SmoothingMode) As Status
+		Return SetStatus(GdipSetSmoothingMode(nativeGraphics, smoothingMode))
+	End Function
+
+	Const Function GetPixelOffsetMode() As PixelOffsetMode
+		Dim pixelOffsetMode = PixelOffsetMode.Invalid As PixelOffsetMode
+		SetStatus(GdipGetPixelOffsetMode(nativeGraphics, pixelOffsetMode))
+		Return pixelOffsetMode
+	End Function
+
+	Function SetPixelOffsetMode(pixelOffsetMode As PixelOffsetMode) As Status
+		Return SetStatus(GdipSetPixelOffsetMode(nativeGraphics, pixelOffsetMode))
+	End Function
+
+	'------------------------------------------------------------------------
+	' Manipulate current world transform
+	'------------------------------------------------------------------------
+
+	Function SetTransform(matrix As /*Const*/ *Matrix) As Status
+		Return SetStatus(GdipSetWorldTransform(nativeGraphics, matrix->nativeMatrix))
+	End Function
+
+	Function ResetTransform() As Status
+		Return SetStatus(GdipResetWorldTransform(nativeGraphics))
+	End Function
+
+	Function MultiplyTransform(matrix As /*Const*/ Matrix) As Status
+		Return SetStatus(GdipMultiplyWorldTransform(nativeGraphics, matrix->nativeMatrix, MatrixOrder.Prepend))
+	End Function
+
+	Function MultiplyTransform(matrix As /*Const*/ Matrix, order As MatrixOrder) As Status
+		Return SetStatus(GdipMultiplyWorldTransform(nativeGraphics, matrix->nativeMatrix, order))
+	End Function
+
+	Function TranslateTransform(dx As Single, dy As Single) As Status
+		Return SetStatus(GdipTranslateWorldTransform(nativeGraphics, dx, dy, MatrixOrder.Prepend))
+	End Function
+
+	Function TranslateTransform(dx As Single, dy As Single, order As MatrixOrder) As Status
+		Return SetStatus(GdipTranslateWorldTransform(nativeGraphics, dx, dy, order))
+	End Function
+
+	Function ScaleTransform(sx As Single, sy As Single) As Status
+		Return SetStatus(GdipScaleWorldTransform(nativeGraphics, sx, sy, MatrixOrder.Prepend))
+	End Function
+
+	Function ScaleTransform(sx As Single, sy As Single, order As MatrixOrder) As Status
+		Return SetStatus(GdipScaleWorldTransform(nativeGraphics, sx, sy, order))
+	End Function
+
+	Function RotateTransform(angle As Single) As Status
+		Return SetStatus(GdipRotateWorldTransform(nativeGraphics, angle, MatrixOrder.Prepend))
+	End Function
+
+	Function RotateTransform(angle As Single, order As MatrixOrder) As Status
+		Return SetStatus(GdipRotateWorldTransform(nativeGraphics, angle, order))
+	End Function
+
+	Const Function GetTransform(matrix As Matrix) As Status
+		Return SetStatus(GdipGetWorldTransform(nativeGraphics, matrix->nativeMatrix))
+	End Function
+
+	Const Function TransformPoints(destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As PointF, count As Long) As Status
+		Return SetStatus(GdipTransformPoints(nativeGraphics, destSpace, srcSpace, pts, count))
+	End Function
+
+	Const Function TransformPoints(destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As Point, count As Long) As Status
+		Return SetStatus(GdipTransformPointsI(nativeGraphics, destSpace, srcSpace, pts, count))
+	End Function
+
+	'------------------------------------------------------------------------
+	' GetNearestColor (for <= 8bpp surfaces).	Note: Alpha is ignored.
+	'------------------------------------------------------------------------
+
+	Const Function GetNearestColor(color As Color) As Status
+		Dim argb = color->Value
+		Dim status = SetStatus(GdipGetNearestColor(nativeGraphics, argb))
+		color->Value = argb
+		Return status
+	End Function
+
+	Function DrawLine(pen As /*Const*/ Pen, x1 As Single, y1 As Single, x2 As Single, y2 As Single) As Status
+		Return SetStatus(GdipDrawLine(nativeGraphics, pen->nativePen, x1, y1, x2, y2))
+	End Function
+
+	Function DrawLine(pen As /*Const*/ Pen, pt1 As /*Const*/ PointF, pt2 As /*Const*/ PointF) As Status
+		Return DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y)
+	End Function
+
+	Function DrawLines(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status
+		Return SetStatus(GdipDrawLines(nativeGraphics, pen->nativePen, points, count))
+	End Function
+
+	Function DrawLine(pen As /*Const*/ Pen, x1 As Long, y1 As Long, x2 As Long, y2 As Long) As Status
+		Return SetStatus(GdipDrawLineI(nativeGraphics, pen->nativePen, x1, y1, x2, y2))
+	End Function
+
+	Function DrawLine(pen As /*Const*/ Pen, pt1 As /*Const*/ Point, pt2 As /*Const*/ Point) As Status
+		Return DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y)
+	End Function
+
+	Function DrawLines(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
+		Return SetStatus(GdipDrawLinesI(nativeGraphics, pen->nativePen, points, count))
+	End Function
+
+	Function DrawArc(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single) As Status
+		Return SetStatus(GdipDrawArc(nativeGraphics, pen->nativePen, x, y, width, height, startAngle, sweepAngle))
+	End Function
+
+	Function DrawArc(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF, startAngle As Single, sweepAngle As Single) As Status
+		Return DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Function
+
+	Function DrawArc(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single) As Status
+		Return SetStatus(GdipDrawArcI(nativeGraphics, pen->nativePen, x, y, width, height, startAngle, sweepAngle))
+	End Function
+
+	Function DrawArc(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle, startAngle As Single, sweepAngle As Single) As Status
+		Return DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Function
+
+	Function DrawBezier(pen As /*Const*/ Pen, x1 As Single, y1 As Single, x2 As Single, y2 As Single, x3 As Single, y3 As Single, x4 As Single, y4 As Single) As Status
+		Return SetStatus(GdipDrawBezier(nativeGraphics, pen->nativePen, x1, y1,x2, y2, x3, y3, x4, y4))
+	End Function
+
+	Function DrawBezier(pen As /*Const*/ Pen, pt1 As /*Const*/ PointF, pt2 As /*Const*/ PointF, pt3 As /*Const*/ PointF, pt4 As /*Const*/ PointF) As Status
+		Return DrawBezier(pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y)
+	End Function
+
+	Function DrawBeziers(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status
+		Return SetStatus(GdipDrawBeziers(nativeGraphics, pen->nativePen, points, count))
+	End Function
+
+	Function DrawBezier(pen As /*Const*/ Pen, x1 As Long, y1 As Long, x2 As Long, y2 As Long, x3 As Long, y3 As Long, x4 As Long, y4 As Long) As Status
+		Return SetStatus(GdipDrawBezierI(nativeGraphics, pen->nativePen, x1, y1, x2, y2, x3, y3, x4, y4))
+	End Function
+
+	Function DrawBezier(pen As /*Const*/ Pen, pt1 As /*Const*/ Point, pt2 As /*Const*/ Point, pt3 As /*Const*/ Point, pt4 As /*Const*/ Point) As Status
+		Return DrawBezier(pen pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y)
+	End Function
+
+	Function DrawBeziers(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
+		Return SetStatus(GdipDrawBeziersI(nativeGraphics, pen->nativePen, points, count))
+	End Function
+
+	Function DrawRectangle(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF) As Status
+		Return DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height)
+	End Function
+
+	Function DrawRectangle(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single) As Status
+		Return SetStatus(GdipDrawRectangle(nativeGraphics, pen->nativePen, x, y, width, height))
+	End Function
+
+	Function DrawRectangles(pen As /*Const*/ Pen, rects As /*Const*/ *RectangleF, count As Long) As Status
+		Return SetStatus(GdipDrawRectangles(nativeGraphics, pen->nativePen, rects, count))
+	End Function
+
+	Function DrawRectangle(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle) As Status
+		Return DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height)
+	End Function
+
+	Function DrawRectangle(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long) As Status
+		Return SetStatus(GdipDrawRectangleI(nativeGraphics, pen->nativePen, x, y, width, height))
+	End Function
+
+	Function DrawRectangles(pen As /*Const*/ Pen, rects As /*Const*/ *Rectangle,  count As Long) As Status
+		Return SetStatus(GdipDrawRectanglesI(nativeGraphics, pen->nativePen, rects, count))
+	End Function
+
+	Function DrawEllipse(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF) As Status
+		Return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height)
+	End Function
+
+	Function DrawEllipse(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single) As Status
+		Return SetStatus(GdipDrawEllipse(nativeGraphics, pen->nativePen, x, y, width, height))
+	End Function
+
+	Function DrawEllipse(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle) As Status
+		Return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height)
+	End Function
+
+	Function DrawEllipse(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long) As Status
+		Return SetStatus(GdipDrawEllipseI(nativeGraphics, pen->nativePen, x, y, width, height))
+	End Function
+
+	Function DrawPie(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF, startAngle As Single, sweepAngle As Single) As Status
+		Return DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Function
+
+	Function DrawPie(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single) As Status
+		Return SetStatus(GdipDrawPie(nativeGraphics, pen->nativePen, x, y, width, height, startAngle, sweepAngle))
+	End Function
+
+	Function DrawPie(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle, startAngle As Single, sweepAngle As Single) As Status
+		Return DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Function
+
+	Function DrawPie(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single) As Status
+		Return SetStatus(GdipDrawPieI(nativeGraphics, pen->nativePen, x, y, width, height, startAngle, sweepAngle))
+	End Function
+
+	Function DrawPolygon(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status
+		Return SetStatus(GdipDrawPolygon(nativeGraphics, pen->nativePen, points, count))
+	End Function
+
+	Function DrawPolygon(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
+		Return SetStatus(GdipDrawPolygonI(nativeGraphics, pen->nativePen, points, count))
+	End Function
+
+	Function DrawPath(pen As /*Const*/ Pen, path As /*Const*/ GraphicsPath) As Status
+		Return SetStatus(GdipDrawPath(nativeGraphics, pen->nativePen, path->nativePath))
+'		Return SetStatus(GdipDrawPath(nativeGraphics, pen ? pen->nativePen : NULL, path ? path->nativePath : NULL))
+	End Function
+
+	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status
+		Return SetStatus(GdipDrawCurve(nativeGraphics, pen->nativePen, points, count))
+	End Function
+
+	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, tension As Single) As Status
+		Return SetStatus(GdipDrawCurve2(nativeGraphics, pen->nativePen, points,count, tension))
+	End Function
+
+	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, offset As Long, numberOfSegments As Long) As Status
+		Return SetStatus(GdipDrawCurve3(nativeGraphics, pen->nativePen, points, count, offset,numberOfSegments, 0.5))
+	End Function
+
+	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, offset As Long, numberOfSegments As Long, tension As Single) As Status
+		Return SetStatus(GdipDrawCurve3(nativeGraphics, pen->nativePen, points, count, offset,numberOfSegments, tension))
+	End Function
+
+	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
+		Return SetStatus(GdipDrawCurveI(nativeGraphics, pen->nativePen, points, count))
+	End Function
+
+	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, tension As Single) As Status
+		Return SetStatus(GdipDrawCurve2I(nativeGraphics, pen->nativePen, points, count, tension))
+	End Function
+
+	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, offset As Long, numberOfSegments As Long) As Status
+		Return SetStatus(GdipDrawCurve3I(nativeGraphics, pen->nativePen, points, count, offset, numberOfSegments, 0.5))
+	End Function
+
+	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, offset As Long, numberOfSegments As Long, tension As Single) As Status
+		Return SetStatus(GdipDrawCurve3I(nativeGraphics, pen->nativePen, points, count, offset, numberOfSegments, tension))
+	End Function
+
+	Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status
+		Return SetStatus(GdipDrawClosedCurve(nativeGraphics, pen->nativePen, points, count))
+	End Function
+
+	Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, tension As Single) As Status
+		Return SetStatus(GdipDrawClosedCurve2(nativeGraphics, pen->nativePen, points, count, tension))
+	End Function
+
+	Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
+		Return SetStatus(GdipDrawClosedCurveI(nativeGraphics, pen->nativePen, points, count))
+	End Function
+
+	Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, tension As Single) As Status
+		Return SetStatus(GdipDrawClosedCurve2I(nativeGraphics, pen->nativePen, points, count, tension))
+	End Function
+
+	Function Clear(color As /*Const*/ Color) As Status
+		Return SetStatus(GdipGraphicsClear(nativeGraphics, color.Value))
+	End Function
+
+	Function FillRectangle(brush As /*Const*/ Brush, rect As /*Const*/ RectangleF) As Status
+		Return FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height)
+	End Function
+
+	Function FillRectangle(brush As /*Const*/ Brush, x As Single, y As Single, width As Single, height As Single) As Status
+		Return SetStatus(GdipFillRectangle(nativeGraphics, brush->nativeBrush, x, y, width, height))
+	End Function
+
+	Function FillRectangles(brush As /*Const*/ Brush, rects As /*Const*/ *RectangleF, count As Long) As Status
+		Return SetStatus(GdipFillRectangles(nativeGraphics,brush->nativeBrush,rects, count))
+	End Function
+
+	Function FillRectangle(brush As /*Const*/ Brush, rect As /*Const*/ Rectangle) As Status
+		Return FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height)
+	End Function
+
+	Function FillRectangle(brush As /*Const*/ Brush, x As Long, y As Long, width As Long, height As Long) As Status
+		Return SetStatus(GdipFillRectangleI(nativeGraphics, brush->nativeBrush, x, y, width, height))
+	End Function
+
+	Function FillRectangles(brush As /*Const*/ Brush, rects As /*Const*/ *Rectangle, count As Long) As Status
+		Return SetStatus(GdipFillRectanglesI(nativeGraphics, brush->nativeBrush, rects, count))
+	End Function
+
+	Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long) As Status
+		Return FillPolygon(brush, points, count, FillModeAlternate)
+	End Function
+
+	Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long, fillMode As FillMode) As Status
+		Return SetStatus(GdipFillPolygon(nativeGraphics, brush->nativeBrush, points, count, fillMode))
+	End Function
+
+	Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long) As Status
+		Return FillPolygon(brush, points, count, FillModeAlternate)
+	End Function
+
+	Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long, fillMode As FillMode) As Status
+		Return SetStatus(GdipFillPolygonI(nativeGraphics, brush->nativeBrush, points, count, fillMode))
+	End Function
+
+	Function FillEllipse(brush As /*Const*/ Brush, rect As /*Const*/ RectangleF) As Status
+		Return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height)
+	End Function
+
+	Function FillEllipse(brush As /*Const*/ Brush, x As Single, y As Single, width As Single, height As Single) As Status
+		Return SetStatus(GdipFillEllipse(nativeGraphics, brush->nativeBrush, x, y, width, height))
+	End Function
+
+	Function FillEllipse(brush As /*Const*/ Brush, rect As /*Const*/ Rectangle) As Status
+		Return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height)
+	End Function
+
+	Function FillEllipse(brush As /*Const*/ Brush, x As Long, y As Long, width As Long, height As Long) As Status
+		Return SetStatus(GdipFillEllipseI(nativeGraphics, brush->nativeBrush, x, y, width, height))
+	End Function
+
+	Function FillPie(brush As /*Const*/ Brush, rect As /*Const*/ RectangleF, startAngle As Single, sweepAngle As Single) As Status
+		Return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Function
+
+	Function FillPie(brush As /*Const*/ Brush, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single) As Status
+		Return SetStatus(GdipFillPie(nativeGraphics, brush->nativeBrush, x, y, width, height, startAngle, sweepAngle))
+	End Function
+
+	Function FillPie(brush As /*Const*/ Brush, rect As /*Const*/ Rectangle, startAngle As Single, sweepAngle As Single) As Status
+		Return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Function
+
+	Function FillPie(brush As /*Const*/ Brush, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single) As Status
+		Return SetStatus(GdipFillPieI(nativeGraphics, brush->nativeBrush, x, y, width, height, startAngle, sweepAngle))
+	End Function
+
+	Function FillPath(brush As /*Const*/ Brush, path As /*Const*/ GraphicsPath) As Status
+		Return SetStatus(GdipFillPath(nativeGraphics, brush->nativeBrush, path->nativePath))
+	End Function
+
+	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long) As Status
+		Return SetStatus(GdipFillClosedCurve(nativeGraphics, brush->nativeBrush, points, count))
+	End Function
+
+	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long, fillMode As FillMode) As Status
+		Return SetStatus(GdipFillClosedCurve2(nativeGraphics, brush->nativeBrush, points, count, 0.5, fillMode))
+	End Function
+
+	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long, fillMode As FillMode, tension As Single) As Status
+		Return SetStatus(GdipFillClosedCurve2(nativeGraphics, brush->nativeBrush, points, count, tension, fillMode))
+	End Function
+
+	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long) As Status
+		Return SetStatus(GdipFillClosedCurveI(nativeGraphics, brush->nativeBrush, points, count))
+	End Function
+
+	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long, fillMode As FillMode) As Status
+		Return SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush->nativeBrush, points, count, 0.5, fillMode))
+	End Function
+
+	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long, fillMode As FillMode, tension As Single) As Status
+		Return SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush->nativeBrush, points, count, tension, fillMode))
+	End Function
+
+	Function FillRegion(brush As /*Const*/ Brush, region As /*Const*/ Region) As Status
+		Return SetStatus(GdipFillRegion(nativeGraphics, brush->nativeBrush, region->nativeRegion))
+	End Function
+
+	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF) As Status
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Return SetStatus(GdipDrawString( nativeGraphics, str, length, nativeFont, layoutRect, 0, 0))
+	End Function
+
+	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ Rectangle,
+		stringFormat As /*Const*/ StringFormat, brush As /*Const*/ Brush) As Status
+
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeFormat As *GpStringFormat
+		If VarPtr(layoutRect) <> 0 Then
+			nativeFormat = layoutRect.nativeFormat
+		Else
+			nativeFormat = 0
+		End If
+		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, 0))
+	End Function
+
+	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF,
+		stringFormat As /*Const*/ StringFormat, brush As /*Const*/ Brush) As Status
+
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeFormat As *GpStringFormat
+		If VarPtr(stringFormat) <> 0 Then
+			nativeFormat = stringFormat.nativeFormat
+		Else
+			nativeFormat = 0
+		End If
+		Dim nativeBrush As *GpBrush
+		If VarPtr(brush) <> 0 Then
+			nativeBrush = brush.nativeFormat
+		Else
+			nativeBrush = 0
+		End If
+		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, nativeBrush))
+	End Function
+
+	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ Point) As Status
+		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, rect, 0, 0))
+	End Function
+
+	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF,
+		brush As /*Const*/ Brush) As Status
+
+		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeBrush As *GpBrush
+		If VarPtr(brush) <> 0 Then
+			nativeBrush = brush.nativeFormat
+		Else
+			nativeBrush = 0
+		End If
+		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, rect, 0, nativeBrush))
+	End Function
+
+	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF) As Status
+		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, rect, 0, 0))
+	End Function
+
+	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF,
+		stringFormat As /*Const*/ StringFormat) As Status
+
+		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeFormat As *GpStringFormat
+		If VarPtr(stringFormat) <> 0 Then
+			nativeFormat = stringFormat.nativeFormat
+		Else
+			nativeFormat = 0
+		End If
+		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, rect, nativeFormat, 0))
+	End Function
+
+	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF,
+		stringFormat As /*Const*/ StringFormat, brush As /*Const*/ Brush) As Status
+
+		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeFormat As *GpStringFormat
+		If VarPtr(stringFormat) <> 0 Then
+			nativeFormat = stringFormat.nativeFormat
+		Else
+			nativeFormat = 0
+		End If
+		If VarPtr(brush) <> 0 Then
+			nativeBrush = brush.nativeFormat
+		Else
+			nativeBrush = 0
+		End If
+		Return SetStatus(GdipDrawString( nativeGraphics, str, length, nativeFont, rect, nativeFormat, nativeBrush))
+	End Function
+
+	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF,
+		stringFormat As /*Const*/ StringFormat, boundingBox As RectangleF) As Status
+
+		Return MeasureString(str, length, font, layoutRect, stringFormat, boundingBox, ByVal 0, ByVal 0)
+	End Function
+
+	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF,
+		stringFormat As /*Const*/ StringFormat, boundingBox As RectangleF,
+		codepointsFitted As Long) As Status
+
+		Return MeasureString(str, length, font, layoutRect, stringFormat, boundingBox, codepointsFitted, ByVal 0)
+	End Function
+
+	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF,
+		stringFormat As /*Const*/ StringFormat, boundingBox As RectangleF,
+		codepointsFitted As Long, linesFilled As Long) As Status
+
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeFormat As *GpStringFormat
+		If VarPtr(stringFormat) <> 0 Then
+			nativeFormat = stringFormat.nativeFormat
+		Else
+			nativeFormat = 0
+		End If
+		Return SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat,
+			boundingBox, codepointsFitted, linesFilled))
+	End Function
+
+	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
+		layoutRectSize As /*Const*/ SizeF, stringFormat As /*Const*/ StringFormat,
+		size As SizeF) As Status
+
+			Return MeasureString(str, length, font, layoutRectSize, stringFormat, size, ByVal 0, ByVal 0)
+	End Function
+
+	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
+		layoutRectSize As /*Const*/ SizeF, stringFormat As /*Const*/ StringFormat,
+		size As SizeF, codepointsFitted As Long) As Status
+
+			Return MeasureString(str, length, font, layoutRectSize, stringFormat, size, codepointsFitted, ByVal 0)
+	End Function
+
+	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
+		layoutRectSize As /*Const*/ SizeF, stringFormat As /*Const*/ StringFormat,
+		size As SizeF, codepointsFitted As Long, linesFilled As Long) As Status
+
+		Dim layoutRect As RectangleF(0, 0, layoutRectSize.Width, layoutRectSize.Height)
+		Dim boundingBox As RectangleF, pBoundingBox As *RectangleF
+		If VarPtr(size) <> 0 Then
+			pBoundingBox = VarPtr(boundingBox)
+		Else
+			pBoundingBox = 0
+		End If
+
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeFormat As *GpStringFormat
+		If VarPtr(stringFormat) <> 0 Then
+			nativeFormat = stringFormat.nativeFormat
+		Else
+			nativeFormat = 0
+		End If
+		Dim status = SetStatus(GdipMeasureString(nativeGraphics, str, length,
+			nativeFont, layoutRect, nativeFormat, pBoundingBox, codepointsFitted, linesFilled))
+
+		If VarPtr(size) <> 0 And status = Status.Ok Then
+			size.Width  = boundingBox.Width
+			size.Height = boundingBox.Height
+		End Function
+
+		Return status
+	End Function
+
+	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
+		origin As /*Const*/ PointF, stringFormat As /*Const*/ StringFormat,
+		boundingBox As RectangleF) As Status
+
+		Dim rect As RectangleF(origin.X, origin.Y, 0.0f, 0.0f)
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeFormat As *GpStringFormat
+		If VarPtr(stringFormat) <> 0 Then
+			nativeFormat = stringFormat.nativeFormat
+		Else
+			nativeFormat = 0
+		End If
+
+		Return SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, rect, nativeFormat, boundingBox, 0, 0))
+	End Function
+
+	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
+		layoutRect As /*Const*/ RectangleF, boundingBox As RectangleF) As Status
+
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+
+		Return SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, layoutRect, 0, boundingBox, 0, 0))
+	End Function
+
+	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
+		origin As /*Const*/ PointF, boundingBox As RectangleF) As Status
+		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
+
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Return SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, rect, 0, boundingBox, 0, 0))
+	End Function
+
+	Const Function MeasureCharacterRanges(str As PCWSTR, length As Long, font As /*Const*/ Font,
+		layoutRect As /*Const*/ RectangleF, stringFormat As /*Const*/ StringFormat,
+		regionCount As Long, regions As *Region) As Status
+		If regions = 0 Or regionCount <= 0 Then
+			Return InvalidParameter
+		End If
+
+		Dim nativeRegions = _System_malloc(regionCount * SizeOf (GpRegion*)) As **GpRegion
+
+		If nativeRegions = 0 Then
+			Return OutOfMemory
+		End If
+
+		Dim i As Long
+		For i = 0 To regionCount
+			nativeRegions[i] = regions[i].nativeRegion
+		Next
+
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeFormat As *GpStringFormat
+		If VarPtr(stringFormat) <> 0 Then
+			nativeFormat = stringFormat.nativeFormat
+		Else
+			nativeFormat = 0
+		End If
+
+		Dim status = SetStatus(GdipMeasureCharacterRanges(nativeGraphics,
+			str, length, nativeFont, layoutRect, nativeFormat,regionCount, nativeRegions))
+		_System_free(nativeRegions)
+		Return status
+	End Function
+
+	Function DrawDriverString(text As /*Const*/ Word, length As Long, font As /*Const*/ Font,
+		brush As /*Const*/ Brush, positions As /*Const*/ *PointF, flags As Long) As Status
+
+		Return DrawDriverString(text, length, font, brush, positions, flags, ByVal 0)
+	End Function
+
+	Function DrawDriverString(text As /*Const*/ Word, length As Long, font As /*Const*/ Font,
+		brush As /*Const*/ Brush, positions As /*Const*/ *PointF, flags As Long, matrix As /*Const*/ Matrix) As Status
+
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeBrush As *GpBrush
+		If VarPtr(brush) <> 0 Then
+			nativeBrush = brush.nativeBrush
+		Else
+			nativeBrush = 0
+		End If
+		Dim nativeMatrix As *GpMatrix
+		If VarPtr(matrix) <> 0 Then
+			nativeMatrix = matrix.nativeMatrix
+		Else
+			nativeMatrix = 0
+		End If
+		Return SetStatus(GdipDrawDriverString(nativeGraphics, text, length, nativeFont, nativeBrush, positions, flags, nativeMatrix))
+	End Function
+
+	Const Function MeasureDriverString(text As /*Const*/ Word, length As Long, font As /*Const*/ Font,
+		positions As /*Const*/ *PointF, flags As Long, matrix As /*Const*/ Matrix, boundingBox As RectangleF) As Status
+
+		Dim nativeFont As *GpFont
+		If VarPtr(font) <> 0 Then
+			nativeFont = font.nativeFormat
+		Else
+			nativeFont = 0
+		End If
+		Dim nativeMatrix As *GpMatrix
+		If VarPtr(matrix) <> 0 Then
+			nativeMatrix = matrix.nativeMatrix
+		Else
+			nativeMatrix = 0
+		End If
+		Return SetStatus(GdipMeasureDriverString(nativeGraphics, text, length, nativeFont, positions, flags, nativeMatrix, boundingBox))
+	End Function
+
+	' Draw a cached bitmap on this graphics destination offset by
+	' x, y. Note this will fail with WrongState if the CachedBitmap
+	' native format differs from this Graphics.
+
+	Function DrawCachedBitmap(cb As CachedBitmap, x As Long, y As Long) As Status
+		Return SetStatus(GdipDrawCachedBitmap(nativeGraphics, cb->nativeCachedBitmap, x, y))
+	End Function
+
+	Function DrawImage(image As Image, point As /*Const*/ PointF) As Status
+		Return DrawImage(image, point.X, point.Y)
+	End Function
+
+	Function DrawImage(image As Image, x As Single, y As Single) As Status
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Return SetStatus(GdipDrawImage(nativeGraphics, nativeImage, x, y))
+	End Function
+
+	Function DrawImage(image As Image, rect As /*Const*/ RectangleF) As Status
+		Return DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height)
+	End Function
+
+	Function DrawImage(image As Image, x As Single, y As Single, width As Single, height As Single) As Status
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Return SetStatus(GdipDrawImageRect(nativeGraphics, nativeImage, x, y, width, height))
+	End Function
+
+	Function DrawImage(image As Image, point As /*Const*/ Point) As Status
+		Return DrawImage(image, point.X, point.Y) As Status
+	End Function
+
+	Function DrawImage(image As Image, x As Long, y As Long) As Status
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Return SetStatus(GdipDrawImageI(nativeGraphics, nativeImage, x, y))
+	End Function
+
+	Function DrawImage(image As Image, rect As /*Const*/ Rectangle) As Status
+		Return DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height)
+	End Function
+
+	Function DrawImage(image As Image, x As Long, y As Long, width As Long, height As Long) As Status
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Return SetStatus(GdipDrawImageRectI(nativeGraphics, nativeImage, x, y, width, height))
+	End Function
+
+	' Affine Draw Image
+	' destPoints.length = 3: rect => parallelogram
+	'	   destPoints[0] <=> top-left corner of the source rectangle
+	'	   destPoints[1] <=> top-right corner
+	'	   destPoints[2] <=> bottom-left corner
+	' destPoints.length = 4: rect => quad
+	'	   destPoints[3] <=> bottom-right corner
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ PointF, count As Long) As Status
+		If count <> 3 And count <> 4 Then
+			Return SetStatus(InvalidParameter)
+		End If
+
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Return SetStatus(GdipDrawImagePoints(nativeGraphics, nativeImage, destPoints, count))
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ Point, count As Long) As Status
+		If count <> 3 And count <> 4 Then
+			Return SetStatus(InvalidParameter)
+		End If
+
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Return SetStatus(GdipDrawImagePointsI(nativeGraphics, nativeImage, destPoints, count))
+	End Function
+
+	Function DrawImage(image As Image, x As Single, y As Single,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit) As Status
+
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Return SetStatus(GdipDrawImagePointRect(nativeGraphics, nativeImage, x, y, srcx, srcy, srcwidth, srcheight, srcUnit))
+	End Function
+
+	Function DrawImage(image As Image, destRect As /*Const*/ RectangleF,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit) As Status
+
+		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, 0, 0, 0)
+	End Function
+
+	Function DrawImage(image As Image, destRect As /*Const*/ RectangleF,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, 0, 0)
+	End Function
+
+	Function DrawImage(image As Image, destRect As /*Const*/ RectangleF,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes,
+		callback As DrawImageAbort) As Status
+
+		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, 0)
+	End Function
+
+	Function DrawImage(image As Image, destRect As /*Const*/ RectangleF,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
+
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipDrawImageRectRect(nativeGraphics, nativeImageAttr,
+			destRect.X, destRect.Y, destRect.Width, destRect.Height, srcx, srcy, srcwidth, srcheight,
+			srcUnit, nativeImageAttr, callback, callbackData))
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ PointF, count As Long,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit) As Status
+
+		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, 0, 0, 0)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ PointF, count As Long,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, 0, 0)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ PointF, count As Long,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes,
+		callback As DrawImageAbort) As Status
+
+		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, 0)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ PointF, count As Long,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
+
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipDrawImagePointsRect(nativeGraphics, nativeImage, destPoints, count,
+			srcx, srcy, srcwidth, srcheight, srcUnit, nativeImageAttr, callback, callbackData))
+	End Function
+
+	Function DrawImage(image As Image, x As Long, y As Long,
+		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit) As Status
+
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Return SetStatus(GdipDrawImagePointRectI(nativeGraphics, nativeImage, x, y, srcx, srcy, srcwidth, srcheight, srcUnit))
+	End Function
+
+	Function DrawImage(image As Image, destRect As /*Const*/ Rectangle,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit) As Status
+
+		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, 0, 0, 0)
+	End Function
+
+	Function DrawImage(image As Image, destRect As /*Const*/ Rectangle,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, 0, 0)
+	End Function
+
+	Function DrawImage(image As Image, destRect As /*Const*/ Rectangle,
+		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort) As Status
+
+		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, 0)
+	End Function
+
+	Function DrawImage(image As Image, destRect As /*Const*/ Rectangle,
+		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
+
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipDrawImageRectRectI(nativeGraphics, nativeImage,
+			destRect.X, destRect.Y, destRect.Width, destRect.Height,
+			srcx, srcy, srcwidth, srcheight, srcUnit, nativeImageAttr, callback, callbackData))
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ Point, count As Long,
+		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit) As Status
+
+		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, 0, 0, 0)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ Point, count As Long,
+		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, 0, 0)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ Point, count As Long, _
+		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit, _
+		imageAttributes As /*Const*/ ImageAttributes,
+		callback As DrawImageAbort) As Status
+
+		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, 0)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ Point, count As Long,
+		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit,
+		imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
+
+		Dim nativeImage As *GpImage
+		If VarPtr(image) <> 0 Then
+			nativeImage = image.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipDrawImagePointsRectI(nativeGraphics, nativeImage, destPoints, count,
+			srcx, srcy, srcwidth, srcheight, srcUnit, nativeImageAttr, callback, callbackData))
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ *Point, count As Long, srcRect As Rectangle, srcUnit As GraphicsUnit) As Status
+		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ *PointF, count As Long, srcRect As RectangleF, srcUnit As GraphicsUnit) As Status
+		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit)
+	End Function
+
+	Function DrawImage(image As Image, x As Long, y As Long, srcRect As Rectangle, srcUnit As GraphicsUnit) As Status
+		Return DrawImage(image, x, y, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit)
+	End Function
+
+	Function DrawImage(image As Image, x As Single, y As Single, srcRect As RectangleF, srcUnit As GraphicsUnit) As Status
+		Return DrawImage(image, x, y, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ *Point, count As Long, srcRect As Rectangle, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes) As Status
+		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ *PointF, count As Long, srcRect As RectangleF, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes) As Status
+		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ *Point, count As Long, srcRect As Rectangle, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort) As Status
+		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes, callback)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ *PointF, count As Long, srcRect As RectangleF, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort) As Status
+		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes, callback)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ *Point, count As Long, srcRect As Rectangle, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
+		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes, callback, callbackData)
+	End Function
+
+	Function DrawImage(image As Image, destPoints As /*Const*/ *PointF, count As Long, srcRect As RectangleF, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
+		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes, callback, callbackData)
+	End Function
+
+	' The following methods are for playing an EMF+ to a graphics
+	' via the enumeration interface.  Each record of the EMF+ is
+	' sent to the callback (along with the callbackData).	Then
+	' the callback can invoke the Metafile::PlayRecord method
+	' to play the particular record.
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ PointF,
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destPoint, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ PointF,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destPoint, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ PointF,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileDestPoint(nativeGraphics,
+			nativeImage, destPoint, callback, callbackData,nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ Point,
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destPoint, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ Point,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destPoint, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ Point,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileDestPointI(nativeGraphics,
+			nativeImage, destPoint, callback, callbackData,nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ RectangleF,
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destRect, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ RectangleF,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destRect, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ RectangleF,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileDestRect(nativeGraphics,
+			nativeImage, destRect, callback, callbackData, nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ Rectangle,
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destRect, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ Rectangle,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destRect, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ Rectangle,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileDestRectI(nativeGraphics,
+			nativeImage, destRect, callback, callbackData, nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *PointF, count As Long,
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destPoints, count, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *PointF, count As Long,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destPoints, count, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *PointF, count As Long,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileDestPoints(nativeGraphics,
+			nativeImage,destPoints, count, callback, callbackData, nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *Point, count As Long,
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destPoints, count, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *Point, count As Long,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destPoints, count, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *Point, count As Long,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileDestPointsI(nativeGraphics,
+			nativeImage,destPoints, count, callback, callbackData, nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile,
+		destPoint As /*Const*/ PointF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit,
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destPoint, count, srcUnit, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile,
+		destPoint As /*Const*/ PointF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destPoint, srcRect, srcUnit, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile,
+		destPoint As /*Const*/ PointF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit,
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileSrcRectDestPoint(nativeGraphics, _
+			nativeImage, destPoint, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destPoint As /*Const*/ Point, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destPoint, count, srcUnit, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destPoint As /*Const*/ Point, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destPoint, srcRect, srcUnit, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destPoint As /*Const*/ Point, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileSrcRectDestPointI(nativeGraphics, _
+			nativeImage, destPoint, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destRect As /*Const*/ RectangleF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destRect, count, srcUnit, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destRect As /*Const*/ RectangleF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destRect, srcRect, srcUnit, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destRect As /*Const*/ RectangleF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileSrcRectDestRect(nativeGraphics, _
+			nativeImage, destRect, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destRect As /*Const*/ Rectangle, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destRect, srcRect, srcUnit, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destRect As /*Const*/ Rectangle, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destRect, srcRect, srcUnit, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destRect As /*Const*/ Rectangle, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileSrcRectDestRectI(nativeGraphics, _
+			nativeImage, destRect, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destPoints As /*Const*/ *PointF, count As Long, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destPoints, count, srcRect, srcUnit, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destPoints As /*Const*/ *PointF, count As Long, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destPoints, count, srcRect, srcUnit, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destPoints As /*Const*/ *PointF, count As Long, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileSrcRectDestPoints(nativeGraphics, _
+			nativeImage, destPoints, count, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destPoints As /*Const*/ *Point, count As Long, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc) As Status
+
+		Return EnumerateMetafile(metafile, destPoints, count, srcRect, srcUnit, callback, 0, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destPoints As /*Const*/ *Point, count As Long, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
+
+		Return EnumerateMetafile(metafile, destPoints, count, srcRect, srcUnit, callback, callbackData, 0)
+	End Function
+
+	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
+		destPoints As /*Const*/ *Point, count As Long, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
+		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
+
+		Dim nativeImage As /*Const*/ *GpMetafile
+		If VarPtr(metafile) <> 0 Then
+			nativeImage = metafile.NativeImage
+		Else
+			nativeImage = 0
+		End If
+		Dim nativeImageAttr As *GpImageAttributes
+		If VarPtr(imageAttributes) <> 0 Then
+			nativeImageAttr = image.NativeImageAttr
+		Else
+			nativeImageAttr = 0
+		End If
+
+		Return SetStatus(GdipEnumerateMetafileSrcRectDestPointsI(nativeGraphics, nativeImage, _
+			destPoints, count, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
+	End Function
+
+	Function SetClip(g As /*Const*/ Graphics) As Status
+		Return SetClip(g, CombineMode.Replace)
+	End Function
+
+	Function SetClip(rc As /*Const*/ RectangleF) As Status
+		Return SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Replace))
+	End Function
+
+	Function SetClip(rc As /*Const*/ Rectangle) As Status
+		Return SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Replace))
+	End Function
+
+	Function SetClip(path As /*Const*/ GraphicsPath) As Status
+		Return SetStatus(GdipSetClipPath(nativeGraphics, path->nativePath, CombineMode.Replace))
+	End Function
+
+	Function SetClip(region As /*Const*/ Region) As Status
+		Return SetStatus(GdipSetClipRegion(nativeGraphics, region->nativeRegion, CombineMode.Replace))
+	End Function
+
+	Function SetClip(g As /*Const*/ Graphics, combineMode As CombineMode) As Status
+		Return SetStatus(GdipSetClipGraphics(nativeGraphics, g->nativeGraphics, combineMode))
+	End Function
+
+	Function SetClip(rc As /*Const*/ RectangleF, combineMode As CombineMode) As Status
+		Return SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, combineMode))
+	End Function
+
+	Function SetClip(rc As /*Const*/ Rectangle, combineMode As CombineMode) As Status
+		Return SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, combineMode))
+	End Function
+
+	Function SetClip(path As /*Const*/ GraphicsPath, combineMode As CombineMode) As Status
+		Return SetStatus(GdipSetClipPath(nativeGraphics, path->nativePath, combineMode))
+	End Function
+
+	Function SetClip(region As /*Const*/ Region, combineMode As CombineMode) As Status
+		Return SetStatus(GdipSetClipRegion(nativeGraphics, region->nativeRegion, combineMode))
+	End Function
+
+	' This is different than the other SetClip methods because it assumes
+	' that the HRGN is already in device units, so it doesn't transform
+	' the coordinates in the HRGN.
+
+	Function SetClip(hrgn As HRGN, combineMode As CombineMode /* = CombineModeReplace*/) As Status
+		Return SetStatus(GdipSetClipHrgn(nativeGraphics, hrgn, combineMode))
+	End Function
+
+	Function IntersectClip(rc As /*Const*/ RectangleF) As Status
+		Return SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Intersect))
+	End Function
+
+	Function IntersectClip(rc As /*Const*/ Rectangle) As Status
+		Return SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Intersect))
+	End Function
+
+	Function IntersectClip(region As /*Const*/ Region) As Status
+		Return SetStatus(GdipSetClipRegion(nativeGraphics, region->nativeRegion, CombineMode.Intersect))
+	End Function
+
+	Function ExcludeClip(rc As /*Const*/ RectangleF) As Status
+		Return SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Exclude))
+	End Function
+
+	Function ExcludeClip(rc As /*Const*/ Rectangle) As Status
+		Return SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Exclude))
+	End Function
+
+	Function ExcludeClip(region As /*Const*/ Region) As Status
+		Return SetStatus(GdipSetClipRegion(nativeGraphics, region->nativeRegion, CombineMode.Exclude))
+	End Function
+
+	Function ResetClip() As Status
+		Return SetStatus(GdipResetClip(nativeGraphics))
+	End Function
+
+	Function TranslateClip(dx As Single, dy As Single) As Status
+		Return SetStatus(GdipTranslateClip(nativeGraphics, dx, dy))
+	End Function
+
+	Function TranslateClip(dx As Long, dy As Long) As Status
+		Return SetStatus(GdipTranslateClipI(nativeGraphics, dx, dy))
+	End Function
+
+	Const Function GetClip(region As Region) As Status
+		Return SetStatus(GdipGetClip(nativeGraphics, region->nativeRegion))
+	End Function
+
+	Const Function GetClipBounds(rc As RectangleF) As Status
+		Return SetStatus(GdipGetClipBounds(nativeGraphics, rc))
+	End Function
+
+	Const Function GetClipBounds(rc As Rectangle) As Status
+		Return SetStatus(GdipGetClipBoundsI(nativeGraphics, rc))
+	End Function
+
+	Const Function GetVisibleClipBounds(rc As RectangleF) As Status
+		Return SetStatus(GdipGetVisibleClipBounds(nativeGraphics, rc))
+	End Function
+
+	Const Function GetVisibleClipBounds(rc As Rectangle) As Status
+		Return SetStatus(GdipGetVisibleClipBoundsI(nativeGraphics, rc))
+	End Function
+
+	Const Function IsVisible(x As Long, y As Long) As BOOL
+		Dim b = FALSE As BOOL
+		SetStatus(GdipIsVisiblePointI(nativeGraphics, x, y, b))
+		Return b
+	End Function
+
+	Const Function IsVisible(pt As /*Const*/ Point) As BOOL
+		Return IsVisible(pt.X, pt.Y)
+	End Function
+
+	Const Function IsVisible(x As Long, y As Long, width As Long, height As Long) As BOOL
+		Dim b = FALSE As BOOL
+		SetStatus(GdipIsVisibleRectI(nativeGraphics, x, y, width, height, b))
+		Return b
+	End Function
+
+	Const Function IsVisible(rc As /*Const*/ Rectangle) As BOOL
+		Return IsVisible(rc.X, rc.Y, rc.Width, rc.Height)
+	End Function
+
+	Const Function IsVisible(x As Single, y As Single) As BOOL
+		Dim b = FALSE As BOOL
+		SetStatus(GdipIsVisiblePoint(nativeGraphics, x, y, b))
+		Return b
+	End Function
+
+	Const Function IsVisible(point As /*Const*/ PointF) As BOOL
+		Return IsVisible(pt.X, pt.Y)
+	End Function
+
+	Const Function IsVisible(x As Single, y As Single, width As Single, height As Single) As BOOL
+		Dim b = FALSE As BOOL
+		SetStatus(GdipIsVisibleRect(nativeGraphics, x, y, width, height, b))
+		Return b
+	End Function
+
+	Const Function IsVisible(rect As /*Const*/ RectangleF) As BOOL
+		Return IsVisible(rc.X, rc.Y, rc.Width, rc.Height)
+	End Function
+
+	Const Function Save() As GraphicsState
+		Dim gstate As GraphicsState
+		SetStatus(GdipSaveGraphics(nativeGraphics, state))
+		Return gstate
+	End Function
+
+	Function Restore(gstate As GraphicsState)
+		Return SetStatus(GdipRestoreGraphics(nativeGraphics, gstate))
+	End Function
+
+	Function BeginContainer(dstrect As /*Const*/ RectangleF, srcrect As /*Const*/ RectangleF, unit As GraphicsUnit) As GraphicsContainer
+		Dim state As GraphicsContainer
+		SetStatus(GdipBeginContainer(nativeGraphics, dstrect, srcrect, unit, state))
+		Return state
+	End Function
+
+	Function BeginContainer(dstrect As /*Const*/ Rectangle, srcrect As /*Const*/ Rectangle, unit As GraphicsUnit) As GraphicsContainer
+		Dim state As GraphicsContainer
+		SetStatus(GdipBeginContainerI(nativeGraphics, dstrect, srcrect, unit, state))
+		Return state
+	End Function
+
+	Function BeginContainer() As GraphicsContainer
+		Dim state As GraphicsContainer
+		SetStatus(GdipBeginContainer2(nativeGraphics, state))
+		Return state
+	End Function
+
+	Function EndContainer(state As GraphicsContainer) As Status
+		Return SetStatus(GdipEndContainer(nativeGraphics, state))
+	End Function
+
+	' Only valid when recording metafiles.
+
+	Function AddMetafileComment(data As /*Const*/ *Byte, sizeData As DWord)
+		Return SetStatus(GdipComment(nativeGraphics, sizeData, data))
+	End Function
+
+	Static Function GetHalftonePalette() As HPALETTE
+		Return GdipCreateHalftonePalette()
+	End Function
+
+	Const Function GetLastStatus() As Status
+		Dim lastStatus = lastResult
+		lastResult = Status.Ok
+		Return lastStatus
+	End Function
+
+Private
+'	Sub Graphics(gr As Graphics)
+'		Debug
+'	End Sub
+	Sub Operator =(gr As Graphics)
+		Debug
+	End Sub
+
+Protected
+	Sub Graphics(graphics As *GpGraphics)
+		lastResult = Status.Ok
+		SetNativeGraphics(graphics)
+	End Sub
+
+	Sub SetNativeGraphics(graphics As *GpGraphics)
+		This.nativeGraphics = graphics
+	End Sub
+
+	Const Function SetStatus(status As Status) As Status
+		If status <> Status.Ok Then
+			lastResult = status
+		End If
+		Return status
+	End Function
+
+	Const Function GetNativeGraphics() As *GpGraphics
+		Return This.nativeGraphics
+	End Function
+
+	Function GetNativePen(pen As /*Const*/ *Pen) As *GpPen
+		Return pen->nativePen
+	End Function
+
+Protected
+	nativeGraphics As *GpGraphics
+	lastResult As /*Mutable*/ Status
+End Class
+
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Image.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Image.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Image.ab	(revision 506)
@@ -0,0 +1,10 @@
+' Classes/System/Drawing/Image.ab
+
+Class Image
+Public
+	Function NativeImage() As *GpImage
+		Return nativeImage
+	End Function
+Private
+	nativeImage As *GpImage
+End Class
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Imaging/MetafileHeader.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Imaging/MetafileHeader.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Imaging/MetafileHeader.ab	(revision 506)
@@ -0,0 +1,152 @@
+' Classes/System/Drawing/Imaging/MetafileHeader.ab
+
+Type Align(8) ENHMETAHEADER3
+	iType As DWord
+	nSize As DWord
+
+	rclBounds As RECTL
+	rclFrame As RECTL
+	dSignature As DWord
+	nVersion As DWord
+	nBytes As DWord
+	nRecords As DWord
+	nHandles As Word
+
+	sReserved As Word
+	nDescription As DWord
+
+	offDescription As DWord
+
+	nPalEntries As DWord
+	szlDevice As SIZEL
+	szlMillimeters As SIZEL
+End Type
+
+' Placeable WMFs
+
+Type Align(2) PWMFRect16
+	Left As Word
+	Top As Word
+	Right As Word
+	Bottom As Word
+End Type
+
+Type Align(2) WmfPlaceableFileHeader
+	Key As DWord
+	Hmf As Word
+	BoundingBox As PWMFRect16
+	Inch As Word
+	Reserved As DWord
+	Checksum As Word
+End Type
+
+Const GDIP_EMFPLUSFLAGS_DISPLAY      = &h00000001
+
+Class MetafileHeader
+Private
+	mfType As MetafileType
+	Size As DWord
+	version As DWord
+	emfPlusFlags As DWord
+	dpiX As Single
+	dpiY As Single
+	X As Long
+	Y As Long
+	Width As Long
+	Height As Long
+	'Union
+	'	WmfHeader As METAHEADER
+		EmfHeader As ENHMETAHEADER3
+	'End Union
+	emfPlusHeaderSize As Long
+	logicalDpiX As Long
+	logicalDpiY As Long
+Public
+	Function MetafileType() As MetafileType
+		Return mfType
+	End Function
+
+	Function EmfPlusHeaderSize() As DWord
+		Return emfPlusHeaderSize
+	End Function
+
+	Function Version() As DWord
+		Return version
+	End Function
+
+	Function EmfPlusFlags() As DWord
+		Return emfPlusFlags
+	End Function
+
+	Function DpiX() As Single
+		Return dpiX
+	End Function
+
+	Function DpiY() As Single
+		Return dpiY
+	End Function
+
+	Function Bounds() As Rectangle
+		Dim r(X, Y, Width, Height)
+		Return r
+	End Function
+
+	Function LogicalDpiX() As Single
+		Return logicalDpiX
+	End Function
+
+	Function LogicalDpiY() As Single
+		Return logicalDpiY
+	End Function
+
+	Function IsWmf() As BOOL
+		IsWmf = (mfType = MetafileTypeWmf Or mfType = MetafileTypeWmfPlaceable)
+	End Function
+
+	Function IsWmfPlaceable() As BOOL
+		IsWmfPlaceable = (mfType = MetafileTypeWmfPlaceable)
+	End Function
+
+	Function IsEmf() As BOOL
+		IsEmf = (mfType = MetafileTypeEmf)
+	End Function
+
+	Function IsEmfOrEmfPlus() As BOOL
+		IsEmfOrEmfPlus = (mfType >= MetafileTypeEmf)
+	End Function
+
+	Function IsEmfPlus() As BOOL
+		IsEmfPlus = (mfType >= MetafileTypeEmfPlusOnly)
+	End Function
+
+	Function IsEmfPlusDual() As BOOL
+		IsEmfPlusDual = (mfType = MetafileTypeEmfPlusDual)
+	End Function
+
+	Function IsEmfPlusOnly() As BOOL /*const*/
+		IsEmfPlusOnly = (mfType = MetafileTypeEmfPlusOnly)
+	End Function
+
+	Function IsDisplay() As BOOL
+		If IsEmfPlus() <> FALSE And ((EmfPlusFlags And GDIP_EMFPLUSFLAGS_DISPLAY) <> 0) Then
+			IsDisplay = _System_TRUE
+		Else
+			IsDisplay = _System_FALSE
+	End Function
+
+	Function WmfHeader() As *METAHEADER 'const METAHEADER* const
+		If IsWmf() Then
+			Return VarPtr(EmfHeader) 'VarPtr(WmfHeader)
+		Else
+			Return 0
+		End If
+	End Function
+
+	Function GetEmfHeader() As * /*const*/ ENHMETAHEADER3 /*const*/
+		If IsEmfOrEmfPlus() Then
+			Return VarPtr(EmfHeader) 'VarPtr(WmfHeader)
+		Else
+			Return 0
+		End If
+	End Function
+End Class
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Imaging/misc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Imaging/misc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Imaging/misc.ab	(revision 506)
@@ -0,0 +1,434 @@
+' Classes/System/Drawing/Imaging/misc.ab
+
+#require <Classes/System/Drawing/Color.ab>
+
+TypeDef ARGB = DWord
+TypeDef ARGB64 = QWord
+
+Enum ColorMode
+	ARGB32 = 0
+	ARGB64 = 1
+End Enum
+
+Const ALPHA_SHIFT = 24 As DWord
+Const RED_SHIFT   = 16 As DWord
+Const GREEN_SHIFT = 8 As DWord
+Const BLUE_SHIFT  = 0 As DWord
+Const ALPHA_MASK  = ((&hff As ARGB) << ALPHA_SHIFT)
+
+' In-memory pixel data formats:
+' bits 0-7 = format index
+' bits 8-15 = pixel size (in bits)
+' bits 16-23 = flags
+' bits 24-31 = reserved
+
+Enum PixelFormat
+	Indexed      = &h00010000
+	Gdi          = &h00020000
+	Alpha        = &h00040000
+	PAlpha       = &h00080000
+	Extended     = &h00100000
+	Canonical    = &h00200000
+
+	Undefined       = 0
+	DontCare        = 0
+
+	Format1bppIndexed     = (1 Or ( 1 << 8) Or PixelFormat.Indexed Or PixelFormat.Gdi)
+	Format4bppIndexed     = (2 Or ( 4 << 8) Or PixelFormat.Indexed Or PixelFormat.Gdi)
+	Format8bppIndexed     = (3 Or ( 8 << 8) Or PixelFormat.Indexed Or PixelFormat.Gdi)
+	Format16bppGrayScale  = (4 Or (16 << 8) Or PixelFormat.Extended)
+	Format16bppRGB555     = (5 Or (16 << 8) Or PixelFormat.Gdi)
+	Format16bppRGB565     = (6 Or (16 << 8) Or PixelFormat.Gdi)
+	Format16bppARGB1555   = (7 Or (16 << 8) Or PixelFormat.Alpha Or PixelFormat.Gdi)
+	Format24bppRGB        = (8 Or (24 << 8) Or PixelFormat.Gdi)
+	Format32bppRGB        = (9 Or (32 << 8) Or PixelFormat.Gdi)
+	Format32bppARGB       = (10 Or (32 << 8) Or PixelFormat.Alpha Or PixelFormat.Gdi Or PixelFormat.Canonical)
+	Format32bppPARGB      = (11 Or (32 << 8) Or PixelFormat.Alpha Or PixelFormat.PAlpha Or PixelFormat.Gdi)
+	Format48bppRGB        = (12 Or (48 << 8) Or PixelFormat.Extended)
+	Format64bppARGB       = (13 Or (64 << 8) Or PixelFormat.Alpha Or PixelFormat.Canonical Or PixelFormat.Extended)
+	Format64bppPARGB      = (14 Or (64 << 8) Or PixelFormat.Alpha Or PixelFormat.PAlpha Or PixelFormat.Extended)
+	Max                   = 15
+End Enum
+
+Const GetPixelFormatSize(pixfmt) = ((((pixfmt As PixelFormat) >> 8) And &hff) As DWord)
+
+Const IsIndexedPixelFormat(pixfmt) = ((((pixfmt As PixelFormat) And PixelFormat.Indexed) <> 0) As BOOL)
+
+Const IsAlphaPixelFormat(pixfmt) = ((((pixfmt As PixelFormat) And PixelFormat.Alpha) <> 0) As BOOL)
+
+Const IsExtendedPixelFormat(pixfmt) = ((((pixfmt As PixelFormat) And PixelFormat.Extended) <> 0) As BOOL)
+
+Const IsCanonicalPixelFormat(pixfmt) = ((((pixfmt As PixelFormat) And PixelFormat.Canonical) <> 0) As BOOL)
+
+Enum PaletteFlags
+	PaletteFlagsHasAlpha    = &h0001
+	PaletteFlagsGrayScale   = &h0002
+	PaletteFlagsHalftone    = &h0004
+End Enum
+
+Type Align(8) ColorPalette
+	Flags As DWord
+	Count As DWord
+	Entries[1] As ARGB
+End Type
+
+Enum ColorAdjustType
+	Default
+	Bitmap
+	Brush
+	Pen
+	Text
+	Count
+	Any
+End Enum
+
+Type ColorMatrix
+	m[5][5] As Single
+End Type
+
+Type ColorMap
+	OldColor As Color
+	NewColor As Color
+End Type
+
+Enum ColorMatrixFlag
+	Default   = 0
+	SkipGrays = 1
+	AltGray   = 2
+End Enum
+
+Enum ImageCodecFlags
+	Encoder            = &h00000001
+	Decoder            = &h00000002
+	SupportBitmap      = &h00000004
+	SupportVector      = &h00000008
+	SeekableEncode     = &h00000010
+	BlockingDecode     = &h00000020
+
+	Builtin            = &h00010000
+	System             = &h00020000
+	User               = &h00040000
+End Enum
+
+Enum ImageLockMode
+	Read        = &h0001
+	Write       = &h0002
+	UserInputBuf= &h0004
+End Enum
+
+Type Align(8) BitmapData
+	Width As DWord
+	Height As DWord
+	Stride As Long
+	PixelFormat As PixelFormat
+	Scan0 As VoidPtr
+	Reserved As ULONG_PTR
+End Type
+
+Type Align(8) EncoderParameter
+	Guid As GUID
+	NumberOfValues As DWord
+	EncoderType As DWord '元はTypeという名前
+	Value As VoidPtr
+End Type
+
+Type Align(8) EncoderParameters
+	Count As DWord
+	Parameter[1] As EncoderParameter
+End Type
+
+Type Align(8) PropertyItem
+	id As PROPID
+	length As DWord
+	piType As Word
+	value As VoidPtr
+End Type
+
+Const PropertyTagTypeByte        = 1
+Const PropertyTagTypeASCII       = 2
+Const PropertyTagTypeShort       = 3
+Const PropertyTagTypeLong        = 4
+Const PropertyTagTypeRational    = 5
+Const PropertyTagTypeUndefined   = 7
+Const PropertyTagTypeSLONG       = 9
+Const PropertyTagTypeSRational  = 10
+
+Const PropertyTagExifIFD             = &h8769
+Const PropertyTagGpsIFD              = &h8825
+
+Const PropertyTagNewSubfileType      = &h00FE
+Const PropertyTagSubfileType         = &h00FF
+Const PropertyTagImageWidth          = &h0100
+Const PropertyTagImageHeight         = &h0101
+Const PropertyTagBitsPerSample       = &h0102
+Const PropertyTagCompression         = &h0103
+Const PropertyTagPhotometricInterp   = &h0106
+Const PropertyTagThreshHolding       = &h0107
+Const PropertyTagCellWidth           = &h0108
+Const PropertyTagCellHeight          = &h0109
+Const PropertyTagFillOrder           = &h010A
+Const PropertyTagDocumentName        = &h010D
+Const PropertyTagImageDescription    = &h010E
+Const PropertyTagEquipMake           = &h010F
+Const PropertyTagEquipModel          = &h0110
+Const PropertyTagStripOffsets        = &h0111
+Const PropertyTagOrientation         = &h0112
+Const PropertyTagSamplesPerPixel     = &h0115
+Const PropertyTagRowsPerStrip        = &h0116
+Const PropertyTagStripBytesCount     = &h0117
+Const PropertyTagMinSampleValue      = &h0118
+Const PropertyTagMaxSampleValue      = &h0119
+Const PropertyTagXResolution         = &h011A   ' Image resolution in width direction
+Const PropertyTagYResolution         = &h011B   ' Image resolution in height direction
+Const PropertyTagPlanarConfig        = &h011C   ' Image data arrangement
+Const PropertyTagPageName            = &h011D
+Const PropertyTagXPosition           = &h011E
+Const PropertyTagYPosition           = &h011F
+Const PropertyTagFreeOffset          = &h0120
+Const PropertyTagFreeByteCounts      = &h0121
+Const PropertyTagGrayResponseUnit    = &h0122
+Const PropertyTagGrayResponseCurve   = &h0123
+Const PropertyTagT4Option            = &h0124
+Const PropertyTagT6Option            = &h0125
+Const PropertyTagResolutionUnit      = &h0128   ' Unit of X and Y resolution
+Const PropertyTagPageNumber          = &h0129
+Const PropertyTagTransferFuncition   = &h012D
+Const PropertyTagSoftwareUsed        = &h0131
+Const PropertyTagDateTime            = &h0132
+Const PropertyTagArtist              = &h013B
+Const PropertyTagHostComputer        = &h013C
+Const PropertyTagPredictor           = &h013D
+Const PropertyTagWhitePoint          = &h013E
+Const PropertyTagPrimaryChromaticities = &h013F
+Const PropertyTagColorMap            = &h0140
+Const PropertyTagHalftoneHints       = &h0141
+Const PropertyTagTileWidth           = &h0142
+Const PropertyTagTileLength          = &h0143
+Const PropertyTagTileOffset          = &h0144
+Const PropertyTagTileByteCounts      = &h0145
+Const PropertyTagInkSet              = &h014C
+Const PropertyTagInkNames            = &h014D
+Const PropertyTagNumberOfInks        = &h014E
+Const PropertyTagDotRange            = &h0150
+Const PropertyTagTargetPrinter       = &h0151
+Const PropertyTagExtraSamples        = &h0152
+Const PropertyTagSampleFormat        = &h0153
+Const PropertyTagSMinSampleValue     = &h0154
+Const PropertyTagSMaxSampleValue     = &h0155
+Const PropertyTagTransferRange       = &h0156
+
+Const PropertyTagJPEGProc            = &h0200
+Const PropertyTagJPEGInterFormat     = &h0201
+Const PropertyTagJPEGInterLength     = &h0202
+Const PropertyTagJPEGRestartInterval = &h0203
+Const PropertyTagJPEGLosslessPredictors  = &h0205
+Const PropertyTagJPEGPointTransforms     = &h0206
+Const PropertyTagJPEGQTables         = &h0207
+Const PropertyTagJPEGDCTables        = &h0208
+Const PropertyTagJPEGACTables        = &h0209
+
+Const PropertyTagYCbCrCoefficients   = &h0211
+Const PropertyTagYCbCrSubsampling    = &h0212
+Const PropertyTagYCbCrPositioning    = &h0213
+Const PropertyTagREFBlackWhite       = &h0214
+
+Const PropertyTagICCProfile          = &h8773   ' This TAG is defined by ICC
+                                                ' for embedded ICC in TIFF
+Const PropertyTagGamma               = &h0301
+Const PropertyTagICCProfileDescriptor = &h0302
+Const PropertyTagSRGBRenderingIntent = &h0303
+
+Const PropertyTagImageTitle          = &h0320
+Const PropertyTagCopyright           = &h8298
+
+' Extra TAGs (Like Adobe Image Information tags etc.)
+
+Const PropertyTagResolutionXUnit           = &h5001
+Const PropertyTagResolutionYUnit           = &h5002
+Const PropertyTagResolutionXLengthUnit     = &h5003
+Const PropertyTagResolutionYLengthUnit     = &h5004
+Const PropertyTagPrintFlags                = &h5005
+Const PropertyTagPrintFlagsVersion         = &h5006
+Const PropertyTagPrintFlagsCrop            = &h5007
+Const PropertyTagPrintFlagsBleedWidth      = &h5008
+Const PropertyTagPrintFlagsBleedWidthScale = &h5009
+Const PropertyTagHalftoneLPI               = &h500A
+Const PropertyTagHalftoneLPIUnit           = &h500B
+Const PropertyTagHalftoneDegree            = &h500C
+Const PropertyTagHalftoneShape             = &h500D
+Const PropertyTagHalftoneMisc              = &h500E
+Const PropertyTagHalftoneScreen            = &h500F
+Const PropertyTagJPEGQuality               = &h5010
+Const PropertyTagGridSize                  = &h5011
+Const PropertyTagThumbnailFormat           = &h5012  ' 1 = JPEG, 0 = RAW RGB
+Const PropertyTagThumbnailWidth            = &h5013
+Const PropertyTagThumbnailHeight           = &h5014
+Const PropertyTagThumbnailColorDepth       = &h5015
+Const PropertyTagThumbnailPlanes           = &h5016
+Const PropertyTagThumbnailRawBytes         = &h5017
+Const PropertyTagThumbnailSize             = &h5018
+Const PropertyTagThumbnailCompressedSize   = &h5019
+Const PropertyTagColorTransferFunction     = &h501A
+Const PropertyTagThumbnailData             = &h501B' RAW thumbnail bits in
+                                                   ' JPEG format or RGB format
+                                                   ' depends on
+                                                   ' PropertyTagThumbnailFormat
+
+' Thumbnail related TAGs
+
+Const PropertyTagThumbnailImageWidth       = &h5020  ' Thumbnail width
+Const PropertyTagThumbnailImageHeight      = &h5021  ' Thumbnail height
+Const PropertyTagThumbnailBitsPerSample    = &h5022  ' Number of bits per
+                                                     ' component
+Const PropertyTagThumbnailCompression      = &h5023  ' Compression Scheme
+Const PropertyTagThumbnailPhotometricInterp = &h5024 ' Pixel composition
+Const PropertyTagThumbnailImageDescription = &h5025  ' Image Tile
+Const PropertyTagThumbnailEquipMake        = &h5026  ' Manufacturer of Image
+                                                     ' Input equipment
+Const PropertyTagThumbnailEquipModel       = &h5027  ' Model of Image input
+                                                     ' equipment
+Const PropertyTagThumbnailStripOffsets     = &h5028  ' Image data location
+Const PropertyTagThumbnailOrientation      = &h5029  ' Orientation of image
+Const PropertyTagThumbnailSamplesPerPixel  = &h502A  ' Number of components
+Const PropertyTagThumbnailRowsPerStrip     = &h502B  ' Number of rows per strip
+Const PropertyTagThumbnailStripBytesCount  = &h502C  ' Bytes per compressed
+                                                     ' strip
+Const PropertyTagThumbnailResolutionX      = &h502D  ' Resolution in width
+                                                     ' direction
+Const PropertyTagThumbnailResolutionY      = &h502E  ' Resolution in height
+                                                     ' direction
+Const PropertyTagThumbnailPlanarConfig     = &h502F  ' Image data arrangement
+Const PropertyTagThumbnailResolutionUnit   = &h5030  ' Unit of X and Y
+                                                     ' Resolution
+Const PropertyTagThumbnailTransferFunction = &h5031  ' Transfer function
+Const PropertyTagThumbnailSoftwareUsed     = &h5032  ' Software used
+Const PropertyTagThumbnailDateTime         = &h5033  ' File change date and
+                                                     ' time
+Const PropertyTagThumbnailArtist           = &h5034  ' Person who created the
+                                                     ' image
+Const PropertyTagThumbnailWhitePoint       = &h5035  ' White point chromaticity
+Const PropertyTagThumbnailPrimaryChromaticities = &h5036
+                                                     ' Chromaticities of
+                                                     ' primaries
+Const PropertyTagThumbnailYCbCrCoefficients = &h5037 ' Color space transforma-
+                                                     ' tion coefficients
+Const PropertyTagThumbnailYCbCrSubsampling = &h5038  ' Subsampling ratio of Y
+                                                     ' to C
+Const PropertyTagThumbnailYCbCrPositioning = &h5039  ' Y and C position
+Const PropertyTagThumbnailRefBlackWhite    = &h503A  ' Pair of black and white
+                                                     ' reference values
+Const PropertyTagThumbnailCopyRight        = &h503B  ' CopyRight holder
+
+Const PropertyTagLuminanceTable            = &h5090
+Const PropertyTagChrominanceTable          = &h5091
+
+Const PropertyTagFrameDelay                = &h5100
+Const PropertyTagLoopCount                 = &h5101
+
+Const PropertyTagPixelUnit         = &h5110  ' Unit specifier for pixel/unit
+Const PropertyTagPixelPerUnitX     = &h5111  ' Pixels per unit in X
+Const PropertyTagPixelPerUnitY     = &h5112  ' Pixels per unit in Y
+Const PropertyTagPaletteHistogram  = &h5113  ' Palette histogram
+
+' EXIF specific tag
+
+Const PropertyTagExifExposureTime  = &h829A
+Const PropertyTagExifFNumber       = &h829D
+
+Const PropertyTagExifExposureProg  = &h8822
+Const PropertyTagExifSpectralSense = &h8824
+Const PropertyTagExifISOSpeed      = &h8827
+Const PropertyTagExifOECF          = &h8828
+
+Const PropertyTagExifVer            = &h9000
+Const PropertyTagExifDTOrig         = &h9003 ' Date & time of original
+Const PropertyTagExifDTDigitized    = &h9004 ' Date & time of digital data generation
+
+Const PropertyTagExifCompConfig     = &h9101
+Const PropertyTagExifCompBPP        = &h9102
+
+Const PropertyTagExifShutterSpeed   = &h9201
+Const PropertyTagExifAperture       = &h9202
+Const PropertyTagExifBrightness     = &h9203
+Const PropertyTagExifExposureBias   = &h9204
+Const PropertyTagExifMaxAperture    = &h9205
+Const PropertyTagExifSubjectDist    = &h9206
+Const PropertyTagExifMeteringMode   = &h9207
+Const PropertyTagExifLightSource    = &h9208
+Const PropertyTagExifFlash          = &h9209
+Const PropertyTagExifFocalLength    = &h920A
+Const PropertyTagExifMakerNote      = &h927C
+Const PropertyTagExifUserComment    = &h9286
+Const PropertyTagExifDTSubsec       = &h9290  ' Date & Time subseconds
+Const PropertyTagExifDTOrigSS       = &h9291  ' Date & Time original subseconds
+Const PropertyTagExifDTDigSS        = &h9292  ' Date & TIme digitized subseconds
+
+Const PropertyTagExifFPXVer         = &hA000
+Const PropertyTagExifColorSpace     = &hA001
+Const PropertyTagExifPixXDim        = &hA002
+Const PropertyTagExifPixYDim        = &hA003
+Const PropertyTagExifRelatedWav     = &hA004  ' related sound file
+Const PropertyTagExifInterop        = &hA005
+Const PropertyTagExifFlashEnergy    = &hA20B
+Const PropertyTagExifSpatialFR      = &hA20C  ' Spatial Frequency Response
+Const PropertyTagExifFocalXRes      = &hA20E  ' Focal Plane X Resolution
+Const PropertyTagExifFocalYRes      = &hA20F  ' Focal Plane Y Resolution
+Const PropertyTagExifFocalResUnit   = &hA210  ' Focal Plane Resolution Unit
+Const PropertyTagExifSubjectLoc     = &hA214
+Const PropertyTagExifExposureIndex  = &hA215
+Const PropertyTagExifSensingMethod  = &hA217
+Const PropertyTagExifFileSource     = &hA300
+Const PropertyTagExifSceneType      = &hA301
+Const PropertyTagExifCfaPattern     = &hA302
+
+Const PropertyTagGpsVer             = &h0000
+Const PropertyTagGpsLatitudeRef     = &h0001
+Const PropertyTagGpsLatitude        = &h0002
+Const PropertyTagGpsLongitudeRef    = &h0003
+Const PropertyTagGpsLongitude       = &h0004
+Const PropertyTagGpsAltitudeRef     = &h0005
+Const PropertyTagGpsAltitude        = &h0006
+Const PropertyTagGpsGpsTime         = &h0007
+Const PropertyTagGpsGpsSatellites   = &h0008
+Const PropertyTagGpsGpsStatus       = &h0009
+Const PropertyTagGpsGpsMeasureMode  = &h00A
+Const PropertyTagGpsGpsDop          = &h000B  ' Measurement precision
+Const PropertyTagGpsSpeedRef        = &h000C
+Const PropertyTagGpsSpeed           = &h000D
+Const PropertyTagGpsTrackRef        = &h000E
+Const PropertyTagGpsTrack           = &h000F
+Const PropertyTagGpsImgDirRef       = &h0010
+Const PropertyTagGpsImgDir          = &h0011
+Const PropertyTagGpsMapDatum        = &h0012
+Const PropertyTagGpsDestLatRef      = &h0013
+Const PropertyTagGpsDestLat         = &h0014
+Const PropertyTagGpsDestLongRef     = &h0015
+Const PropertyTagGpsDestLong        = &h0016
+Const PropertyTagGpsDestBearRef     = &h0017
+Const PropertyTagGpsDestBear        = &h0018
+Const PropertyTagGpsDestDistRef     = &h0019
+Const PropertyTagGpsDestDist        = &h001A
+
+Type ImageCodecInfo
+	Clsid As CLSID
+	FormatID As GUID
+	CodecName As PCWSTR
+	DllName As PCWSTR
+	FormatDescription As PCWSTR
+	FilenameExtension As PCWSTR
+	MimeType As PCWSTR
+	Flags As DWord
+	Version As DWord
+	SigCount As DWord
+	SigSize As DWord
+	SigPattern As *Byte
+	SigMask As DWord
+End Type
+
+Enum ColorChannelFlag
+	ColorChannelC = 0
+	ColorChannelM
+	ColorChannelY
+	ColorChannelK
+	ColorChannelLast
+End Enum
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Point.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Point.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Point.ab	(revision 506)
@@ -0,0 +1,127 @@
+' Classes/System/Drawing/Point.ab
+
+Namespace System
+Namespace Drawing
+
+Class Point
+Public
+	Sub Point()
+		x = 0
+		y = 0
+	End Sub
+
+	Sub Point(initX As Long, initY As Long)
+		x = initX
+		y = initY
+	End Sub
+
+	Sub Point(sz As Size)
+		x = sz.Width
+		y = sz.Height
+	End Sub
+
+	Sub Point(dw As DWord)
+		x = LOWORD(dw)
+		y = HIWORD(dw)
+	End Sub
+
+	Function X() As Long
+		X = x
+	End Function
+
+	Sub X(newX As Long)
+		x = newX
+	End Sub
+
+	Function Y() As Long
+		X = y
+	End Function
+
+	Sub Y(newY As Long)
+		y = newY
+	End Sub
+
+	Function IsEmpty() As Boolean
+		Return x = 0 And y = 0
+	End Function
+
+	Function Operator +(pt As Point) As Point
+		Return Add(This, pt)
+	End Function
+
+	Function Operator +(sz As Size) As Point
+		Return Add(This, sz)
+	End Function
+
+	Function Operator -(pt As Point) As Point
+		Return Substract(This, pt)
+	End Function
+
+	Function Operator -(sz As Size) As Point
+		Return Substract(This, sz)
+	End Function
+
+	Function Operator ==(sz As Point) As Boolean
+		Return Equals(sz)
+	End Function
+
+	Function Operator <>(sz As Point) As Boolean
+		Return Not Equals(sz)
+	End Function
+
+	Static Function Add(pt1 As Point, pt2 As Point) As Point
+		Return New Point(pt1.x + pt2.x, pt1.y + pt2.y)
+	End Function
+
+	Static Function Add(pt As Point, sz As Size) As Point
+		Return New Point(pt.x + sz.Width, pt.y + sz.Height)
+	End Function
+
+	Function Offset(pt As Point) As Point
+		Return New Point(x + pt.x, y + pt.y)
+	End Function
+
+	Sub Offset(dx As Long, dy As Long)
+		x += dx
+		y += dy
+	End Sub
+
+	Static Function Substract(pt1 As Point, pt2 As Point) As Point
+		Return New Point(pt1.x - pt2.x, pt1.y - pt2.y)
+	End Function
+
+	Static Function Substract(pt As Point, sz As Size) As Point
+		Return New Point(pt.x - sz.Width, pt.y - sz.Height)
+	End Function
+
+	Function Equals(pt As Point) As Boolean
+		Return x = pt.x And y = pt.y
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return x Xor _System_BSwap(y As DWord)
+	End Function
+
+	Static Function Ceiling(ptf As PointF) As Point
+		Return New Point(Math.Ceiling(ptf.X) As Long, Math.Ceiling(ptf.Y) As Long)
+	End Function
+
+	Static Function Round(ptf As PointF) As Point
+		Return New Point(Math.Round(ptf.X) As Long, Math.Round(ptf.Y) As Long)
+	End Function
+
+	Static Function Truncate(ptf As PointF) As Point
+		Return New Point(Math.Truncate(ptf.X) As Long, Math.Truncate(ptf.Y) As Long)
+	End Function
+
+	Function Operator () As PointF
+		Return New PointF(X, Y)
+	End Function
+
+Private
+	x As Long
+	y As Long
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/PointF.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/PointF.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/PointF.ab	(revision 506)
@@ -0,0 +1,118 @@
+' Classes/System/Drawing/PointF.ab
+
+Namespace System
+Namespace Drawing
+
+Class PointF
+Public
+	Sub PointF()
+		x = 0
+		y = 0
+	End Sub
+
+	Sub PointF(initX As Single, initY As Single)
+		x = initX
+		y = initY
+	End Sub
+
+	Sub PointF(pt As PointF)
+		x = pt.x
+		y = pt.y
+	End Sub
+
+	Sub PointF(sz As SizeF)
+		x = sz.Width
+		y = sz.Height
+	End Sub
+
+	Function X() As Single
+		X = x
+	End Function
+
+	Sub X(newX As Single)
+		x = newX
+	End Sub
+
+	Function Y() As Single
+		Y = y
+	End Function
+
+	Sub Y(newY As Single)
+		y = newY
+	End Sub
+
+	Function IsEmpty() As Boolean
+		Return x = 0 And y = 0
+	End Function
+
+	Function Operator + (pt As PointF) As PointF
+		Return Add(This, pt)
+	End Function
+
+	Function Operator + (sz As Size) As PointF
+		Return Add(This, sz)
+	End Function
+
+	Function Operator + (sz As SizeF) As PointF
+		Return Add(This, sz)
+	End Function
+
+	Function Operator - (pt As PointF) As PointF
+		Return Substract(This, pt)
+	End Function
+
+	Function Operator - (sz As Size) As PointF
+		Return Substract(This, sz)
+	End Function
+
+	Function Operator - (sz As SizeF) As PointF
+		Return Substract(This, sz)
+	End Function
+
+	Function Operator == (sz As PointF) As Boolean
+		Return Equals(sz)
+	End Function
+
+	Function Operator <> (sz As PointF) As Boolean
+		Return Not Equals(sz)
+	End Function
+
+	Static Function Add(pt1 As PointF, pt2 As PointF) As PointF
+		Return New PointF(pt1.x + pt2.x, pt1.y + pt2.y)
+	End Function
+
+	Static Function Add(pt As PointF, sz As Size) As PointF
+		Return New PointF(pt.x + sz.Width, pt.y + sz.Height)
+	End Function
+
+	Static Function Add(pt As PointF, sz As SizeF) As PointF
+		Return New PointF(pt.x + sz.Width, pt.y + sz.Height)
+	End Function
+
+	Static Function Substract(pt1 As PointF, pt2 As PointF) As PointF
+		Return New PointF(pt1.x - pt2.x, pt1.y - pt2.y)
+	End Function
+
+	Static Function Substract(pt As PointF, sz As Size) As PointF
+		Return New PointF(pt.x - sz.Width, pt.y - sz.Height)
+	End Function
+
+	Static Function Substract(pt As PointF, sz As SizeF) As PointF
+		Return New PointF(pt.x - sz.Width, pt.y - sz.Height)
+	End Function
+
+	Function Equals(pt As PointF) As Boolean
+		Return x = pt.x And y = pt.y
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return (GetDWord(VarPtr(x)) Xor _System_BSwap(GetDWord(VarPtr(x)))) As Long
+	End Function
+
+Private
+	x As Single
+	y As Single
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Rectangle.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Rectangle.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Rectangle.ab	(revision 506)
@@ -0,0 +1,244 @@
+' Classes/System/Drawing/Rectangle.ab
+
+Namespace System
+Namespace Drawing
+
+Class Rectangle
+Public
+	Sub Rectangle()
+		x = 0
+		y = 0
+		width = 0
+		height = 0
+	End Sub
+
+	Sub Rectangle(x As Long, y As Long, width As Long, height As Long)
+		x = x
+		y = y
+		width = width
+		height = height
+	End Sub
+
+	Sub Rectangle(l As Point, s As Size)
+		x = l.X
+		y = l.Y
+		width = s.Height
+		height = s.Height
+	End Sub
+
+	Sub Rectangle(ByRef r As RECT)
+		x = r.left
+		y = r.top
+		width = r.right - r.left
+		height = r.top - r.bottom
+	End Sub
+
+	Function Location() As Point
+		Location = New Point(x, y)
+	End Function
+
+	Sub Location(point As Point)
+		x = point.X
+		y = point.Y
+	End Sub
+
+	Function Size() As Size
+		Size = New Size(width, height)
+	End Function
+
+	Sub Size(size As Size)
+		width = size.Width
+		height = size.Height
+	End Sub
+
+	Function X() As Long
+		X = x
+	End Function
+
+	Sub X(value As Long)
+		x = value
+	End Sub
+
+	Function Y() As Long
+		Y = y
+	End Function
+
+	Sub Y(value As Long)
+		y = value
+	End Sub
+
+	Function Width() As Long
+		Width = width
+	End Function
+
+	Sub Width(value As Long)
+		width = value
+	End Sub
+
+	Function Height() As Long
+		Height = height
+	End Function
+
+	Sub Height(value As Long)
+		height = value
+	End Sub
+
+	Function Left() As Long
+		Left = X
+	End Function
+
+	Function Top() As Long
+		Top = Y
+	End Function
+
+	Function Right() As Long
+		Right = X + Width
+	End Function
+
+	Function Bottom() As Long
+		Bottom = Y + Height
+	End Function
+
+	Function IsEmpty() As Boolean
+		Return Width <= 0 Or Height <= 0
+	End Function
+
+	Function Operator ==(rc As Rectangle) As Boolean
+		Return Equals(rc)
+	End Function
+
+	Function Operator <>(rc As Rectangle) As Boolean
+		Return (Not Equals(rc))
+	End Function
+
+	Function Operator () As RectangleF
+		Return New RectangleF(x, y, width, height)
+	End Function
+
+	Function Equals(rc As Rectangle) As Boolean
+		Return X = rc.X And Y = rc.Y And Width = rc.Width And Height = rc.Height
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return x As DWord Xor _System_BSwap(y As DWord) Xor width As DWord Xor _System_BSwap(height As DWord)
+	End Function
+
+	Static Function FromLTRB(l As Long, t As Long, r As Long, b As Long) As Rectangle
+		return New Rectangle(l, t, r - l, b - t)
+	End Function
+
+	Function Contains(x As Long, y As Long) As Boolean
+		Return x >= X And x < X + Width And y >= Y And y < Y + Height
+	End Function
+
+	Function Contains(pt As Point) As Boolean
+		Return Contains(pt.X, pt.Y)
+	End Function
+
+	Function Contains(rc As Rectangle) As Boolean
+		Return X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom
+	End Function
+
+	Sub Inflate(dx As Long, dy As Long)
+		x -= dx
+		y -= dy
+		width += dx + dx
+		height += dy + dy
+	End Sub
+
+	Sub Inflate(sz As Size)
+		Inflate(sz.Width, sz.Height)
+	End Sub
+
+	Static Function Inflate(rc As Rectangle, x As Long, y As Long) As Rectangle
+		Inflate = New Rectangle(rc.X, rc.Y, rc.Width, rc.Height)
+		Inflate.Inflate(x, y)
+	End Function
+
+	Sub Intersect(rect As Rectangle)
+		Dim r = Rectangle.Intersect(This, rect)
+		x = r.x
+		y = r.y
+		width = r.width
+		height = r.height
+	End Sub
+
+	Static Function Intersect(a As Rectangle, ByRef b As Rectangle) As Rectangle
+		Dim right As Long, bottom As Long, left As Long, top As Long
+		right = System.Math.Min(a.Right, b.Right)
+		bottom = System.Math.Min(a.Bottom, b.Bottom)
+		left = System.Math.Min(a.Left, b.Left)
+		top = System.Math.Min(a.Top, b.Top)
+		Return Rectangle.FromLTRB(left, top, right, bottom)
+	End Function
+
+	Function IntersectsWith(rc As Rectangle) As Boolean
+		Return Left < rc.Right And _
+			Top < rc.Bottom And _
+			Right > rc.Left And _
+			Bottom > rc.Top
+	End Function
+
+	Static Function Union(a As Rectangle, b As Rectangle) As Rectangle
+		Dim right As Long, bottom As Long, left As Long, top As Long
+		right = System.Math.Max(a.Right(), b.Right())
+		bottom = System.Math.Max(a.Bottom(), b.Bottom())
+		left = System.Math.Max(a.Left(), b.Left())
+		top = System.Math.Max(a.Top(), b.Top())
+		Return FromLTRB(left, top, right, bottom)
+	End Function
+
+	Sub Offset(pt As Point)
+		Offset(pt.X, pt.Y)
+	End Sub
+
+	Sub Offset(dx As Long, dy As Long)
+		x += dx
+		y += dy
+	End Sub
+
+	Static Function Ceiling(rcf As RectangleF) As Rectangle
+		Dim r As Rectangle(
+			Math.Ceiling(rcf.X) As Long,
+			Math.Ceiling(rcf.Y) As Long,
+			Math.Ceiling(rcf.Width) As Long,
+			Math.Ceiling(rcf.Height) As Long)
+		Return r
+	End Function
+
+	Static Function Round(rcf As RectangleF) As Rectangle
+		Dim r As Rectangle(
+			Math.Round(rcf.X) As Long,
+			Math.Round(rcf.Y) As Long,
+			Math.Round(rcf.Width) As Long,
+			Math.Round(rcf.Height) As Long)
+		Return r
+	End Function
+
+	Static Function Truncate(rcf As RectangleF) As Rectangle
+		Dim r As Rectangle(
+			Math.Truncate(rcf.X) As Long,
+			Math.Truncate(rcf.Y) As Long,
+			Math.Truncate(rcf.Width) As Long,
+			Math.Truncate(rcf.Height) As Long)
+		Return r
+	End Function
+
+	Function ToRECT() As RECT
+		With ToRECT
+			.left = x
+			.top = y
+			.right = x + width
+			.bottom = y + height
+		End With
+	End Function
+
+Public
+	x As Long
+	y As Long
+	width As Long
+	height As Long
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/RectangleF.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/RectangleF.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/RectangleF.ab	(revision 506)
@@ -0,0 +1,208 @@
+' Classes/System/Drawing/RectangleF.ab
+
+Namespace System
+Namespace Drawing
+
+Class RectangleF
+Public
+	Sub RectangleF()
+		x = 0
+		y = 0
+		width = 0
+		height = 0
+	End Sub
+
+	Sub RectangleF(x As Single, y As Single, width As Single, height As Single)
+		x = x
+		y = y
+		width = width
+		height = height
+	End Sub
+
+	Sub RectangleF(location As PointF, size As SizeF)
+		x = location.X
+		y = location.Y
+		width = size.Height
+		height = size.Height
+	End Sub
+
+	Sub RectangleF(rc As RectangleF)
+		x = rc.x
+		y = rc.y
+		width = rc.width
+		height = rc.height
+	End Sub
+
+	Function Location() As PointF
+		Location = New PointF(x, y)
+	End Function
+
+	Sub Location(point As PointF)
+		x = point.X
+		y = point.Y
+	End Sub
+
+	Function Size() As SizeF
+		Size = New SizeF(width, height)
+	End Function
+
+	Sub Size(size As SizeF)
+		width = size.Width
+		height = size.Height
+	End Sub
+
+	Function X() As Single
+		X = x
+	End Function
+
+	Sub X(value As Single)
+		x = value
+	End Sub
+
+	Function Y() As Single
+		Y = y
+	End Function
+
+	Sub Y(value As Single)
+		y = value
+	End Sub
+
+	Function Width() As Single
+		Width = width
+	End Function
+
+	Sub Width(value As Single)
+		width = value
+	End Sub
+
+	Function Height() As Single
+		Height = height
+	End Function
+
+	Sub Height(value As Single)
+		height = value
+	End Sub
+
+	Function Left() As Single
+		Left = X
+	End Function
+
+	Function Top() As Single
+		Top = Y
+	End Function
+
+	Function Right() As Single
+		Right = X + Width
+	End Function
+
+	Function Bottom() As Single
+		Bottom = Y + Height
+	End Function
+
+	Function IsEmpty() As Boolean
+		Return Width <= 0 Or Height <= 0
+	End Function
+
+	Function Operator ==(rc As RectangleF) As Boolean
+		Return Equals(rc)
+	End Function
+
+	Function Operator <>(rc As RectangleF) As Boolean
+		Return Not Equals(rc)
+	End Function
+
+	Function Equals(rc As RectangleF) As Boolean
+		Equals = (X = rc.X And Y = rc.Y And Width = rc.Width And Height = rc.Height)
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return GetDWord(VarPtr(x)) Xor _System_BSwap(GetDWord(VarPtr(y))) Xor GetDWord(VarPtr(width)) Xor _System_BSwap(GetDWord(VarPtr(height)))
+	End Function
+
+	Static Function FromLTRB(l As Single, t As Single, r As Single, b As Single) As RectangleF
+		return New RectangleF(l, t, r - l, b - t)
+	End Function
+
+	Function Contains(x As Single, y As Single) As Boolean
+		Contains = (x >= X And x < X + Width And y >= Y And y < Y + Height)
+	End Function
+
+	Function Contains(pt As PointF) As Boolean
+		Return Contains(pt.X, pt.Y)
+	End Function
+
+	Function Contains(rc As RectangleF) As Boolean
+		Contains = (X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom)
+	End Function
+
+	Sub Inflate(dx As Single, dy As Single)
+		x -= dx
+		y -= dy
+		width += dx + dx
+		height += dy + dy
+	End Sub
+
+	Sub Inflate(sz As SizeF)
+		Inflate(sz.Width, sz.Height)
+	End Sub
+
+	Static Function Inflate(rc As RectangleF, x As Single, y As Single) As RectangleF
+		Inflate = New RectangleF(rc.X, rc.Y, rc.Width, rc.Height)
+		Inflate.Inflate(x, y)
+	End Function
+
+	Sub Intersect(rect As RectangleF)
+		Dim r = RectangleF.Intersect(This, rect)
+		x = r.x
+		y = r.y
+		width = r.width
+		height = r.height
+	End Sub
+	
+	Static Function Intersect(a As RectangleF, b As RectangleF) As RectangleF
+		Dim right As Single, bottom As Single, left As Single, top As Single
+		right = System.Math.Min(a.Right, b.Right)
+		bottom = System.Math.Min(a.Bottom, b.Bottom)
+		left = System.Math.Min(a.Left, b.Left)
+		top = System.Math.Min(a.Top, b.Top)
+		Return FromLTRB(left, top, right, bottom)
+	End Function
+
+	Function IntersectsWith(rc As RectangleF) As Boolean
+		If Left < rc.Right And _
+			Top < rc.Bottom And _
+			Right > rc.Left And _
+			Bottom > rc.Top Then
+			IntersectsWith = True
+		Else
+			IntersectsWith = False
+		End If
+	End Function
+
+	Static Function Union(a As RectangleF, b As RectangleF) As RectangleF
+		Dim right As Single, bottom As Single, left As Single, top As Single
+		right = System.Math.Max(a.Right(), b.Right())
+		bottom = System.Math.Max(a.Bottom(), b.Bottom())
+		left = System.Math.Max(a.Left(), b.Left())
+		top = System.Math.Max(a.Top(), b.Top())
+		Return FromLTRB(left, top, right, bottom)
+	End Function
+
+	Sub Offset(pt As PointF)
+		Offset(pt.X, pt.Y)
+	End Sub
+
+	Sub Offset(dx As Single, dy As Single)
+		x += dx
+		y += dy
+	End Sub
+
+Public
+	x As Single
+	y As Single
+	width As Single
+	height As Single
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Size.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Size.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Size.ab	(revision 506)
@@ -0,0 +1,101 @@
+' Classes/System/Drawing/Size.ab
+
+Namespace System
+Namespace Drawing
+
+Class Size
+Public
+	Sub Size()
+		width = 0
+		height = 0
+	End Sub
+
+	Sub Size(initWidth As Long, initHeight As Long)
+		width = initWidth
+		height = initHeight
+	End Sub
+
+	Sub Size(sz As Size)
+		width = sz.width
+		height = sz.height
+	End Sub
+
+	Function Width() As Long
+		Return width
+	End Function
+
+	Sub Width(w As Long)
+		width = w
+	End Sub
+
+	Function Height() As Long
+		Return height
+	End Function
+
+	Sub Height(h As Long)
+		height = h
+	End Sub
+
+	Function Operator +(sz As Size) As Size
+		Return New Size(width + sz.width, height + sz.height)
+	End Function
+
+	Function Operator -(sz As Size) As Size
+		Return New Size(width - sz.width, height - sz.height)
+	End Function
+
+	Function Operator () As SizeF
+		Return New SizeF(width, height)
+	End Function
+
+	Function Operator ==(sz As Size) As Boolean
+		Return Equals(sz)
+	End Function
+
+	Function Operator <>(sz As Size) As Boolean
+		Return Not Equals(sz)
+	End Function
+
+	Function Equals(sz As Size) As Boolean
+		If width = sz.width And height = sz.height Then
+			Equals = True
+		Else
+			Equals = False
+		End If
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return width As DWord Xor _System_BSwap(height As DWord)
+	End Function
+
+	Function IsEmpty() As Boolean
+		Return width = 0 And height = 0
+	End Function
+
+	Function Add(sz As Size) As Size
+		Return This + sz
+	End Function
+
+	Function Subtract(sz As Size) As Size
+		Return This - sz
+	End Function
+
+	Static Function Ceiling(szf As SizeF) As Size
+		Return New Size(System.Math.Ceiling(szf.Width) As Long, System.Math.Ceiling(szf.Height) As Long)
+	End Function
+
+	Static Function Round(szf As SizeF) As Size
+		Return New Size(System.Math.Round(szf.Width) As Long, System.Math.Round(szf.Height) As Long)
+	End Function
+
+	Static Function Truncate(szf As SizeF) As Size
+		Return New Size(System.Math.Truncate(szf.Width) As Long, System.Math.Truncate(szf.Height) As Long)
+	End Function
+
+Private
+	width As Long
+	height As Long
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/SizeF.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/SizeF.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/SizeF.ab	(revision 506)
@@ -0,0 +1,88 @@
+' Classes/System/Drawing/SizeF.ab
+
+Namespace System
+Namespace Drawing
+
+Class SizeF
+Public
+	Sub SizeF()
+		width = 0
+		height = 0
+	End Sub
+
+	Sub SizeF(initWidth As Single, initHeight As Single)
+		width = initWidth
+		height = initHeight
+	End Sub
+
+	Sub SizeF(sz As SizeF)
+		width = sz.width
+		height = sz.height
+	End Sub
+
+	Function Width() As Single
+		Return width
+	End Function
+
+	Sub Width(w As Single)
+		width = w
+	End Sub
+
+	Function Height() As Single
+		Return height
+	End Function
+
+	Sub Height(h As Single)
+		height = h
+	End Sub
+
+	Function Operator +(sz As SizeF) As SizeF
+		Return New SizeF(width + sz.width, height + sz.height)
+	End Function
+
+	Function Operator -(sz As SizeF) As SizeF
+		Return New SizeF(width - sz.width, height - sz.height)
+	End Function
+
+	Function Operator ==(sz As SizeF) As Boolean
+		Return Equals(sz)
+	End Function
+
+	Function Operator <>(sz As SizeF) As Boolean
+		Return Not Equals(sz)
+	End Function
+
+	Function Equals(sz As SizeF) As Boolean
+		Return width = sz.width And height = sz.height
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return GetDWord(VarPtr(width)) Xor _System_BSwap(GetDWord(VarPtr(height)))
+	End Function
+
+	Function IsEmpty() As Boolean
+		Return width = 0 And height = 0
+	End Function
+
+	Function Add(sz As SizeF) As SizeF
+		Return This + sz
+	End Function
+
+	Function Subtract(sz As SizeF) As SizeF
+		Return This - sz
+	End Function
+
+	Function ToSize() As Size
+		Return Size.Round(This)
+	End Function
+
+	Function ToPointF() As PointF
+		Return New PointF(width, height)
+	End Function
+Private
+	width As Single
+	height As Single
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/Text/misc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/Text/misc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/Text/misc.ab	(revision 506)
@@ -0,0 +1,10 @@
+' Classes/System/Drawing/Text/misc.ab
+
+Enum TextRenderingHint
+	SystemDefault = 0
+	SingleBitPerPixelGridFit
+	SingleBitPerPixel
+	AntiAliasGridFit
+	AntiAlias
+	ClearTypeGridFit
+End Enum
Index: /trunk/ab5.0/ablib/src/Classes/System/Drawing/misc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Drawing/misc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Drawing/misc.ab	(revision 506)
@@ -0,0 +1,49 @@
+' Classes/System/Drawing/misc.ab
+
+#ifndef __SYSTEM_DRAWING_MISC_AB__
+#define __SYSTEM_DRAWING_MISC_AB__
+
+Enum RotateFlipType
+	RotateNoneFlipNone = 0
+	Rotate90FlipNone   = 1
+	Rotate180FlipNone  = 2
+	Rotate270FlipNone  = 3
+
+	RotateNoneFlipX    = 4
+	Rotate90FlipX      = 5
+	Rotate180FlipX     = 6
+	Rotate270FlipX     = 7
+
+	RotateNoneFlipY    = 6
+	Rotate90FlipY      = 7
+	Rotate180FlipY     = 4
+	Rotate270FlipY     = 5
+
+	RotateNoneFlipXY   = 2
+	Rotate90FlipXY     = 3
+	Rotate180FlipXY    = 0
+	Rotate270FlipXY    = 1
+End Enum
+
+Enum GraphicsUnit
+	World       ' 0
+	Display     ' 1
+	Pixel       ' 2
+	Point       ' 3
+	Inch        ' 4
+	Document    ' 5
+	Millimeter  ' 6
+End Enum
+
+Enum FontStyle
+/*
+	Regular = 0
+	Bold = 1
+	Italic = 2
+	Strikeout = 4
+	Underline  = 8
+*/
+End Enum
+
+
+#endif '__SYSTEM_DRAWING_MISC_AB__
Index: /trunk/ab5.0/ablib/src/Classes/System/Environment.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Environment.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Environment.ab	(revision 506)
@@ -0,0 +1,229 @@
+' System/Environment.ab
+
+#require <api_psapi.sbp>
+
+Declare Function _System_SetEnvironmentVariable Lib "kernel32" Alias _FuncName_SetEnvironmentVariable (lpName As LPCTSTR, lpValue As LPTSTR) As BOOL
+Declare Function _System_GetEnvironmentVariable Lib "kernel32" Alias _FuncName_GetEnvironmentVariable (lpName As PCTSTR, lpBuffer As PTSTR, nSize As DWord) As DWord
+
+Namespace System
+
+Namespace Detail
+	TypeDef PFNGetProcessMemoryInfo = *Function(Process As HANDLE, ByRef mc As PROCESS_MEMORY_COUNTERS, cb As DWord) As BOOL
+
+	Dim hasShutdownStarted As Boolean
+End Namespace
+
+Class Environment
+Public
+	' Properties
+
+	Static Function CommandLine() As String
+		If Object.ReferenceEquals(cmdLine, Nothing) Then
+#ifdef UNICODE
+			cmdLine = New String(GetCommandLineW())
+#else
+			cmdLine = New String(GetCommandLineA())
+#endif
+		End If
+		Return cmdLine
+	End Function
+
+	Static Function CurrentDirectory() As String
+		Dim size = GetCurrentDirectory(0, 0)
+		Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PCTSTR
+		Dim len = GetCurrentDirectory(size, p)
+		If len < size Then
+			CurrentDirectory = New String(p, len As Long)
+		End If
+	End Function
+
+	Static Sub CurrentDirectory(cd As String)
+		SetCurrentDirectory(ToTCStr(cd))
+	End Sub
+
+	Static Function ExitCode() As Long
+		Return exitCode
+	End Function
+
+	Static Sub ExitCode(code As Long)
+		exitCode = code
+	End Sub
+
+	Static Function HasShutdownStarted() As Boolean
+		Return Detail.hasShutdownStarted
+	End Function
+
+	Static Function MachineName() As String
+		If Object.ReferenceEquals(machineName, Nothing) Then
+			Dim buf[MAX_COMPUTERNAME_LENGTH] As TCHAR
+			Dim len = (MAX_COMPUTERNAME_LENGTH + 1) As DWord
+			GetComputerName(buf, len)
+			machineName = New String(buf, len As Long)
+		End If
+		Return machineName
+	End Function
+
+	Static Function NewLine() As String
+		Return Ex"\r\n"
+	End Function
+
+	Static Function OSVersion() As OperatingSystem
+		If Object.ReferenceEquals(osVer, Nothing) Then
+			Dim vi As OSVERSIONINFO
+			GetVersionEx(vi)
+			osVer = New OperatingSystem(vi)
+		End If
+		Return osVer
+	End Function
+
+	Static Function ProcessorCount() As Long
+		If processorCount = 0 Then
+			Dim si As SYSTEM_INFO
+			GetSystemInfo(si)
+			processorCount = si.dwNumberOfProcessors
+		End If
+		Return processorCount
+	End Function
+
+	' StackTrace
+
+	Static Function SystemDirectory() As String
+		If Object.ReferenceEquals(sysDir, Nothing) Then
+			Dim size = GetSystemDirectory(0, 0)
+			Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR
+			Dim len = GetSystemDirectory(p, size)
+			sysDir = New String(p, len As Long)
+		End If
+		Return sysDir
+	End Function
+
+	Static Function TickCount() As Long
+		Return GetTickCount() As Long
+	End Function
+
+	' UserDomainName
+
+	' UserInteractive
+
+	Static Function UserName() As String
+		If Object.ReferenceEquals(userName, Nothing) Then
+			Dim buf[UNLEN] As TCHAR
+			Dim len = (UNLEN + 1) As DWord
+			GetUserName(buf, len)
+			userName = New String(buf, len As Long)
+		End If
+		Return userName
+	End Function
+
+	' Version
+
+Public
+	'NTでしか使用できない仕様
+	Static Function WorkingSet() As SIZE_T
+		Dim hmodPSAPI = LoadLibrary("PSAPI.DLL")
+		If hmodPSAPI = 0 Then Return 0
+		Dim pGetProcessMemoryInfo = GetProcAddress(hmodPSAPI, ToMBStr("GetProcessMemoryInfo")) As Detail.PFNGetProcessMemoryInfo
+		If pGetProcessMemoryInfo <> 0 Then
+			Dim mc As PROCESS_MEMORY_COUNTERS
+			If pGetProcessMemoryInfo(GetCurrentProcess(), mc, Len (mc)) <> FALSE Then
+				WorkingSet = mc.WorkingSetSize
+			End If
+		End If
+		FreeLibrary(hmodPSAPI)
+	End Function
+
+	' Methods
+
+	Static Sub Exit(exitCode As Long)
+		Environment.exitCode = exitCode
+		End
+	End Sub
+
+	Static Function ExpandEnvironmentVariables(s As String) As String
+		If ActiveBasic.IsNothing(s) Then
+			Throw New ArgumentNullException("s")
+		End If
+		Dim src = ToTCStr(s)
+		Dim size = ExpandEnvironmentStrings(src, 0, 0)
+		Dim dst = New Text.StringBuilder
+		dst.Length = size As Long
+		ExpandEnvironmentStrings(src, StrPtr(dst), size)
+		dst.Length = (size - 1) As Long
+		ExpandEnvironmentVariables = dst.ToString
+	End Function
+
+	Static Sub FailFast(message As String)
+		FatalAppExit(0, ToTCStr(message))
+	End Sub
+
+	' GetCommandLineArgs
+
+	Static Function GetEnvironmentVariable(variable As String) As String
+		If ActiveBasic.IsNothing(variable) Then
+			Throw New ArgumentNullException("variable")
+		End If
+		Dim tcsVariable = ToTCStr(variable)
+		Dim size = _System_GetEnvironmentVariable(tcsVariable, 0, 0)
+		Dim buf = New Text.StringBuilder
+		buf.Length = size As Long
+		buf.Length  = _System_GetEnvironmentVariable(tcsVariable, StrPtr(buf), size)
+		GetEnvironmentVariable = buf.ToString
+	End Function
+
+	' GetEnvironmentVariables
+
+	Static Function GetFolderPath(f As Environment_SpecialFolder) As String
+'		If ... Then
+'			Throw New ArgumentException
+'		End If
+		Dim x As Long
+		x = f
+		Return ActiveBasic.Windows.GetFolderPath(x)
+	End Function
+
+	' GetLogicalDrives
+
+	Static Sub SetEnvironmentVariable(variable As String, value As String)
+		If ActiveBasic.IsNothing(variable) Then
+			Throw New ArgumentNullException("variable")
+		End If
+		_System_SetEnvironmentVariable(ToTCStr(variable), ToTCStr(value))
+	End Sub
+
+Private
+	Static cmdLine = Nothing As String
+	Static exitCode = 0 As Long
+	Static machineName = Nothing As String
+	Static osVer = Nothing As OperatingSystem
+	Static processorCount = 0 As Long
+	Static sysDir = Nothing As String
+	Static userName = Nothing As String
+End Class
+
+Enum Environment_SpecialFolder
+	Desktop = CSIDL_DESKTOP
+	Programs = CSIDL_PROGRAMS
+	Personal = CSIDL_PERSONAL
+	MyDocuments = CSIDL_PERSONAL
+	Favorites = CSIDL_FAVORITES
+	Startup = CSIDL_STARTUP
+	Recent = CSIDL_RECENT
+	SendTo = CSIDL_SENDTO
+	StartMenu = CSIDL_STARTMENU
+	MyMusic = CSIDL_MYMUSIC
+	DesktopDirectory = CSIDL_DESKTOPDIRECTORY
+	MyComputer = CSIDL_DRIVES
+	Templates = CSIDL_TEMPLATES
+	ApplicationData = CSIDL_APPDATA '4.71
+	LocalApplicationData = CSIDL_LOCAL_APPDATA
+	InternetCache = CSIDL_INTERNET_CACHE
+	Cookies = CSIDL_COOKIES
+	History = CSIDL_HISTORY
+	CommonApplicationData = CSIDL_COMMON_APPDATA '5.0
+	System = CSIDL_SYSTEM
+	CommonProgramFiles = CSIDL_PROGRAM_FILES
+	ProgramFiles = CSIDL_PROGRAM_FILES
+	MyPictures = CSIDL_MYPICTURES
+End Enum
+
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Exception.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Exception.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Exception.ab	(revision 506)
@@ -0,0 +1,701 @@
+'Classses/System/Exception.ab
+
+#require <Classes/ActiveBasic/misc.ab>
+
+Namespace ActiveBasic
+'右のコメントは対応するCOR_E_ナントカのコード
+Const AB_E_EXCEPTION = &h80041500 '80131500
+Const AB_E_SYSTEM = &h80041501 '80131501
+Const AB_E_ARGUMENT = E_INVALIDARG '80070057
+Const AB_E_ARGUMENTOUTOFRANGE = E_INVALIDARG '80131502
+Const AB_E_INDEXOUTOFRANGE = &h80041508 '80131508
+Const AB_E_INVALIDOPERATION = &h80041509 '80131509
+Const AB_E_NOTSUPPORTED = &h80041515 '80131515
+Const AB_E_PLATFORMNOTSUPPORTED = &h80041539 '80131539
+Const AB_E_KEYNOTFOUND = &h80041577 '80131577
+
+End Namespace
+
+/*
+現時点で不要そうなもの（System名前空間直下のもののみ）
+AccessViolationException
+ArrayTypeMismatchException
+ArithmeticException
+BadImageFormatException
+DataMisalignedException
+FormatException
+InvalidCastException
+
+当分（一部は未来永劫）不要そうなもの（System名前空間直下のもののみ）
+AppDomainUnloadedException
+CannotUnloadAppDomainException
+ExecutionEngineException
+InvalidProgramException
+MemberAccessException
+	FieldAccessException 
+	MethodAccessException 
+	MissingMemberException 
+MulticastNotSupportedException
+NullReferenceException
+OverflowException
+RankException
+StackOverflowException
+TypeInitializationException
+TypeLoadException
+TypeUnloadedException
+UnauthorizedAccessException
+*/
+
+Namespace System
+
+/*!
+@brief	例外クラスの基本クラス
+@author	Egtra
+@date	2007/11/16
+*/
+Class Exception
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub Exception()
+		init(GetType().FullName, Nothing)
+		hr = ActiveBasic.AB_E_EXCEPTION
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub Exception(message As String)
+		init(message, Nothing)
+		hr = ActiveBasic.AB_E_EXCEPTION
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub Exception(message As String, innerException As Exception)
+		init(message, innerException)
+		hr = ActiveBasic.AB_E_EXCEPTION
+	End Sub
+
+	'Methods
+
+	/*!
+	@brief	基本例外を返す
+	@return	最初に投げられた大本の例外
+	*/
+	Function GetBaseException() As Exception
+		GetBaseException = This
+		While ActiveBasic.IsNothing(GetBaseException.inner) = False
+			GetBaseException = GetBaseException.inner
+		Wend
+	End Function
+
+	/*!
+	@brief	文字列化する
+	@return	エラー内容を表す文字列
+	*/
+	Override Function ToString() As String
+		If Object.ReferenceEquals(toStr, Nothing) Then
+			Dim sb = New System.Text.StringBuilder
+			sb.Append(GetType().FullName).Append(": ")
+			sb.Append(Message)
+			toStr = sb.ToString
+		End If
+		Return toStr
+	End Function
+
+	'Properties
+
+	/*!
+	@brief	内部例外を返す
+	@return	これが保持している内部例外。無ければNothing。
+	*/
+	Function InnerException() As Exception
+		Return inner
+	End Function
+
+	/*!
+	@brief	エラーメッセージの取得
+	*/
+	Virtual Function Message() As String
+		Return msg
+	End Function
+
+	/*!
+	@brief	この例外に関連付けられたヘルプへのURLもしくはURNの設定
+	*/
+	Virtual Sub HelpLink(help As String)
+		helpLink = help
+	End Sub
+
+	/*!
+	@brief	この例外に関連付けられたヘルプへのURLもしくはURNの取得
+	*/
+	Virtual Function HelpLink() As String
+		Return helpLink
+	End Function
+
+	/*!
+	@brief	この例外の発生元のアプリケーションもしくはオブジェクトの設定
+	*/
+	Virtual Sub Source(source As String)
+		src = source
+	End Sub
+
+	/*!
+	@brief	この例外の発生元のアプリケーションもしくはオブジェクトの取得
+	*/
+	Virtual Function Source() As String
+		Return src
+	End Function
+
+	/*!
+	@brief	HRESULT値の設定
+	*/
+	Sub HResult(hres As HRESULT)
+		hr = hres
+	End Sub
+
+	/*!
+	@brief	HRESULT値の取得
+	*/
+	Function HResult() As HRESULT
+		Return hr
+	End Function
+
+Private
+	Sub init(message As String, innerException As Exception)
+		msg = message
+		inner = innerException
+	End Sub
+
+	msg As String
+	toStr As String
+	inner As Exception
+	helpLink As String
+	src As String
+	hr As HRESULT
+End Class
+
+/*!
+@brief	システム定義の例外の基底クラス
+@author	Egtra
+@date	2007/11/17
+*/
+Class SystemException
+	Inherits Exception
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub SystemException()
+		Exception(GetType().FullName, Nothing)
+		HResult = ActiveBasic.AB_E_SYSTEM
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub SystemException(message As String)
+		Exception(message, Nothing)
+		HResult = ActiveBasic.AB_E_SYSTEM
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub SystemException(message As String, innerException As Exception)
+		Exception(message, innerException)
+		HResult = ActiveBasic.AB_E_SYSTEM
+	End Sub
+End Class
+
+/*!
+@brief	実引数に問題があることを表す例外
+@author	Egtra
+@date	2007/11/19
+*/
+Class ArgumentException
+	Inherits SystemException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub ArgumentException()
+		SystemException("One or more arguments have invalid value.", Nothing)
+		HResult = ActiveBasic.AB_E_ARGUMENT
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub ArgumentException(message As String)
+		SystemException(message, Nothing)
+		HResult = ActiveBasic.AB_E_ARGUMENT
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub ArgumentException(message As String, innerException As Exception)
+		SystemException(message, innerException)
+		HResult = ActiveBasic.AB_E_ARGUMENT
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] paramName	原因となった仮引数名
+	*/
+	Sub ArgumentException(message As String, paramName As String)
+		SystemException(message, Nothing)
+		param = paramName
+		HResult = ActiveBasic.AB_E_ARGUMENT
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	@param[in] paramName	原因となった仮引数名
+	*/
+	Sub ArgumentException(message As String, paramName As String, innerException As Exception)
+		SystemException(message, innerException)
+		param = paramName
+		HResult = ActiveBasic.AB_E_ARGUMENT
+	End Sub
+
+	Override Function Message() As String
+		Dim sb = New System.Text.StringBuilder
+		sb.Append(param).Append(": ").Append(Super.Message)
+		Return sb.ToString
+	End Function
+
+	/*!
+	@brief	この例外の発生原因の仮引数名の取得
+	*/
+	Virtual Function Param() As String
+		Return param
+	End Function
+Private
+	param As String
+End Class
+
+/*!
+@brief	NothingまたはNULLを受け付けない引数にそれらが渡されたことを表す例外
+@author	Egtra
+@date	2007/11/19
+*/
+Class ArgumentNullException
+	Inherits ArgumentException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub ArgumentNullException()
+		ArgumentException("One or more arguments have Nothing or Null value.", "", Nothing)
+		HResult = E_POINTER
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub ArgumentNullException(message As String)
+		ArgumentException(message, "", Nothing)
+		HResult = E_POINTER
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub ArgumentNullException(message As String, innerException As Exception)
+		ArgumentException(message, "", innerException)
+		HResult = E_POINTER
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] paramName	原因となった仮引数名
+	*/
+	Sub ArgumentNullException(message As String, paramName As String)
+		ArgumentException(message, paramName)
+		HResult = E_POINTER
+	End Sub
+End Class
+
+/*!
+@brief	規定された範囲を超える実引数が渡されたことを表す例外
+@author	Egtra
+@date	2007/11/19
+*/
+Class ArgumentOutOfRangeException
+	Inherits ArgumentException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub ArgumentOutOfRangeException()
+		ArgumentException("One or more arguments ware out of range value.", "", Nothing)
+		HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub ArgumentOutOfRangeException(message As String)
+		ArgumentException(message, "", Nothing)
+		HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub ArgumentOutOfRangeException(message As String, innerException As Exception)
+		ArgumentException(message, "", innerException)
+		HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] paramName	原因となった仮引数名
+	*/
+	Sub ArgumentOutOfRangeException(message As String, paramName As String)
+		ArgumentException(message, paramName, Nothing)
+		HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] actualValue	問題となった仮引数の値
+	@param[in] paramName	原因となった仮引数名
+	*/
+	Sub ArgumentOutOfRangeException(message As String, actualValue As Object, paramName As String)
+		ArgumentException(message, paramName, Nothing)
+		actualValueObject = actualValue
+		HResult = ActiveBasic.AB_E_ARGUMENTOUTOFRANGE
+	End Sub
+
+	/*!
+	@brief	この例外の発生原因の実引数の値の取得
+	*/
+	Virtual Function ActualValue() As Object
+		Return actualValueObject
+	End Function
+
+	Override Function Message() As String
+		If ActiveBasic.IsNothing(actualValueObject) Then
+			Return Super.Message
+		Else
+			Dim sb = New System.Text.StringBuilder
+			sb.Append(Param).Append(" = ").Append(actualValueObject)
+			sb.Append(": ").Append(Super.Message)
+			Return sb.ToString
+		End If
+	End Function
+Private
+	actualValueObject As Object
+End Class
+
+/*!
+@brief	配列の範囲外の要素を読み書きしようとしたことを表す例外
+@author	Egtra
+@date	2007/11/19
+*/
+Class IndexOutOfRangeException
+	Inherits SystemException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub IndexOutOfRangeException()
+		SystemException("The index was out of range value.", Nothing)
+		HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub IndexOutOfRangeException(message As String)
+		SystemException(message, Nothing)
+		HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub IndexOutOfRangeException(message As String, innerException As Exception)
+		SystemException(message, innerException)
+		HResult = ActiveBasic.AB_E_INDEXOUTOFRANGE
+	End Sub
+End Class
+
+/*!
+@brief	無効な操作を行おうとしたことを表す例外
+@author	Egtra
+@date	2007/11/19
+*/
+Class InvalidOperationException
+	Inherits SystemException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub InvalidOperationException()
+		SystemException("The operation is invalid.", Nothing)
+		HResult = ActiveBasic.AB_E_INVALIDOPERATION
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub InvalidOperationException(message As String)
+		SystemException(message, Nothing)
+		HResult = ActiveBasic.AB_E_INVALIDOPERATION
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub InvalidOperationException(message As String, innerException As Exception)
+		SystemException(message, innerException)
+		HResult = ActiveBasic.AB_E_INVALIDOPERATION
+	End Sub
+End Class
+
+/*!
+@brief	博されたオブジェクトを操作しようとしたことを表す例外
+@author	Egtra
+@date	2007/12/06
+*/
+Class ObjectDisposedException
+	Inherits InvalidOperationException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub ObjectDisposedException()
+		InvalidOperationException("The object has been disposed.", Nothing)
+		HResult = ActiveBasic.AB_E_INVALIDOPERATION
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub ObjectDisposedException(message As String)
+		InvalidOperationException(message, Nothing)
+		HResult = ActiveBasic.AB_E_INVALIDOPERATION
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub ObjectDisposedException(message As String, innerException As Exception)
+		InvalidOperationException(message, innerException)
+		HResult = ActiveBasic.AB_E_INVALIDOPERATION
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] objectName	操作しようとしたオブジェクトの名前
+	@param[in] message	エラーメッセージ
+	*/
+	Sub ObjectDisposedException(objectName As String, message As String)
+		InvalidOperationException(message, Nothing)
+		HResult = ActiveBasic.AB_E_INVALIDOPERATION
+		objName = " object: " + objectName
+	End Sub
+	/*!
+	@brief	この例外が発生したとき、操作しようとしていたオブジェクトの名前を返す。
+	*/
+	Function ObjectName() As String
+		Return objName
+	End Function
+
+	Override Function ToString() As String
+		ToString = Super.ToString()
+		If Not ActiveBasic.IsNothing(objName) Then
+			ToString += objName
+		End If
+	End Function
+Private
+	objName As String
+End Class
+
+/*!
+@brief	そのメソッド・関数ないし操作が実装されていないことを表す例外
+@author	Egtra
+@date	2007/11/19
+*/
+Class NotImplementedException
+	Inherits SystemException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub NotImplementedException()
+		SystemException("Not implemented.", Nothing)
+		HResult = E_NOTIMPL
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub NotImplementedException(message As String)
+		SystemException(message, Nothing)
+		HResult = E_NOTIMPL
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub NotImplementedException(message As String, innerException As Exception)
+		SystemException(message, innerException)
+		HResult = E_NOTIMPL
+	End Sub
+End Class
+
+/*!
+@brief	対応していないメソッド・関数ないし操作を行おうとしたことを表す例外
+@author	Egtra
+@date	2007/11/19
+*/
+Class NotSupportedException
+	Inherits SystemException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub NotSupportedException()
+		SystemException("This operation is not supported,", Nothing)
+		HResult = ActiveBasic.AB_E_NOTSUPPORTED
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub NotSupportedException(message As String)
+		SystemException(message, Nothing)
+		HResult = ActiveBasic.AB_E_NOTSUPPORTED
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub NotSupportedException(message As String, innerException As Exception)
+		SystemException(message, innerException)
+		HResult = ActiveBasic.AB_E_NOTSUPPORTED
+	End Sub
+End Class
+
+/*!
+@brief	実行しているプラットフォームで対応していないメソッド・関数ないし操作を行おうとしたことを表す例外
+@author	Egtra
+@date	2007/11/19
+*/
+Class PlatformNotSupportedException
+	Inherits NotSupportedException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub PlatformNotSupportedException()
+		NotSupportedException("This operation is not supported in this platform.", Nothing)
+		HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub PlatformNotSupportedException(message As String)
+		NotSupportedException(message, Nothing)
+		HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub PlatformNotSupportedException(message As String, innerException As Exception)
+		NotSupportedException(message, innerException)
+		HResult = ActiveBasic.AB_E_PLATFORMNOTSUPPORTED
+	End Sub
+End Class
+
+/*!
+@brief	操作が取り止められたことを表す例外
+@author	Egtra
+@date	2007/11/19
+@todo	HResultの調査
+*/
+Class OperationCanceledException
+	Inherits SystemException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub OperationCanceledException()
+		SystemException("The operation was canceled.", Nothing)
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub OperationCanceledException(message As String)
+		SystemException(message, Nothing)
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub OperationCanceledException(message As String, innerException As Exception)
+		SystemException(message, innerException)
+	End Sub
+End Class
+
+/*!
+@brief	メモリ不足例外
+@author	Egtra
+@date	2007/11/19
+@todo	HResultの調査
+*/
+Class OutOfMemoryException
+	Inherits SystemException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub OutOfMemoryException()
+		SystemException("Out of memory.", Nothing)
+		HResult = E_OUTOFMEMORY
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub OutOfMemoryException(message As String)
+		SystemException(message, Nothing)
+		HResult = E_OUTOFMEMORY
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub OutOfMemoryException(message As String, innerException As Exception)
+		SystemException(message, innerException)
+		HResult = E_OUTOFMEMORY
+	End Sub
+End Class
+
+
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/GC.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/GC.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/GC.ab	(revision 506)
@@ -0,0 +1,24 @@
+Namespace System
+
+
+/*!
+@brief	GCを管理するためのクラス
+@author	Daisuke Yamamoto
+@date	2007/10/21
+*/
+Class GC
+Public
+
+	/*!
+	@brief	強制的にガベージコレクションを行う
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Static Sub Collect()
+		_System_pGC->Sweep()
+	End Sub
+
+End Class
+
+	
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/BinaryReader.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/BinaryReader.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/BinaryReader.ab	(revision 506)
@@ -0,0 +1,286 @@
+NameSpace System
+NameSpace IO
+
+Class BinaryReader
+
+Public 'constructor
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief BinaryReaderクラスの新しいインスタンスを初期化します。
+	@param 対象となるストリーム
+	*/
+	Sub BinaryReader(input As Stream)
+		stream = input
+		coding = New System.Text.UTF8Encoding()
+	End Sub
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief BinaryReaderクラスの新しいインスタンスを初期化します。
+	@param 対象となるストリーム
+	@param 文字列操作時のエンコーディングを指定
+	*/
+	Sub BinaryReader(input As Stream, encoding As System.Text.Encoding)
+		This.stream = input
+		This.coding = encoding
+	End Sub
+
+	Sub ~BinaryReader()
+		This.Close()
+	End Sub
+
+Public 'propaty
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief BinaryReader の基になるストリームへのアクセスを公開します。
+	@return 基となったストリーム
+	*/	
+	Function BaseStream() As System.IO.Stream
+		Return stream
+	End Function
+
+Public 'method
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のBinaryReaderの基となったストリームをクローズします。
+	*/	 
+	Virtual Sub Close()
+		This.Dispose()
+	End Sub
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief BinaryReaderクラスで使われたリソースを解放します。
+	*/	 
+	Virtual Sub Dispose()
+		This.Dispose(True)
+	End Sub
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 読み取り可能な次の文字を返します。バイトの位置または文字の位置は変化しません。
+	@return 読み取り可能な次の文字
+	*/
+	Virtual Function PeekChar() As Long
+		'TODO
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 基になるストリームからエンコーディングに従って文字を読み取り、ストリームの現在位置を進めます。
+	@return 読み込んだ文字
+	*/
+	Virtual Function Read() As Long
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 基になるストリームからデータを読み取り、ストリームの現在位置を進めます。
+	@param ストリームから読み込んだデータを格納するバッファ
+	@param データを格納するバッファの読み取り開始位置
+	@param 読み込むデータサイズ
+	@retval 実際に読み込んだデータのバイト数
+	@retval 0 ストリームの末尾に達している
+	*/
+	Virtual Function Read(buffer As *Byte, index As Long, count As Long) As Long
+		Return This.stream.Read(buffer, index, count)
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 基になるストリームから指定されたエンコーディングに従って文字列を読み取り、ストリームの現在位置を進めます。
+	@param ストリームから読み込んだ文字列を格納する文字列バッファ
+	@param データを格納する文字配列の読み取り開始位置
+	@param 読み込む文字の長さ
+	@retval 実際に読み込んだ合計文字数
+	@retval 0 ストリームの末尾に達している
+	*/
+	Virtual Function Read(buffer As *Char, index As Long, count As Long) As Long
+		Return This.stream.Read(buffer As *Byte, index, count)
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから Boolean値を読み取り、ストリームの現在位置を 1 バイトだけ進めます。
+	@return 1byteのBoolean値
+	*/
+	Virtual Function ReadBoolean() As Boolean
+		Return This.stream.ReadByte() As Boolean
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから次のバイトを読み取り、ストリームの現在位置を 1 バイトだけ進めます。
+	@return 符号無しの1バイト整数
+	*/
+	Virtual Function ReadByte() As Byte
+		Return This.stream.ReadByte() As Byte
+	End Function
+
+	'現在のストリームからバイト配列に count で指定したバイト数分のバイトを読み取り、count で指定したバイト数だけ現在位置を進めます。
+/*	Virtual Function ReadBytes() As Array<Byte>
+		TODO:
+	End Function*/
+
+	'現在のストリームの次の文字を読み取り、使用した Encoding とストリームから読み取った特定の文字に従ってストリームの現在位置を進めます。
+/*	Virtual Function ReadChar() As Char
+	End Function*/
+
+	'現在のストリームから count で指定した文字数分の文字を読み取り、そのデータを文字配列として返します。使用した Encoding とストリームから読み取った特定の文字に従って現在位置を進めます。
+/*	Virtual Function ReadChars() As Array<Char>
+		TODO:
+	End Function*/
+
+	'現在のストリームから10進数値を読み取り、ストリームの現在位置を16バイトだけ進めます。
+/*	Virtual Function ReadDecimal() As ActiveBasic.COM.Decimal
+		TODO:
+	End Function*/
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから8バイト浮動小数点値を読み取り、ストリームの現在位置を8バイトだけ進めます。
+	@return 8バイト浮動小数点値
+	*/
+	Virtual Function ReadDouble() As Double
+		Dim buffer As Double
+		This.stream.Read(VarPtr(buffer) As *Byte, 0, 8)
+		Return buffer
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから2バイト符号付き整数を読み取り、ストリームの現在位置を2バイトだけ進めます。
+	@return 2バイト符号付き整数値
+	*/
+	Virtual Function ReadInt16() As Integer
+		Dim buffer As Integer
+		This.stream.Read(VarPtr(buffer) As *Byte, 0, 2)
+		Return buffer
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから4バイト符号付き整数を読み取り、ストリームの現在位置を4バイトだけ進めます。
+	@return 4バイト符号付き整数値
+	*/
+	Virtual Function ReadInt32() As Long
+		Dim buffer As Long
+		This.stream.Read(VarPtr(buffer) As *Byte, 0, 4)
+		Return buffer
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから8バイト符号付き整数を読み取り、ストリームの現在位置を8バイトだけ進めます。
+	@return 8バイト符号付き整数値
+	*/
+	Virtual Function ReadInt64() As Int64
+		Dim buffer As Int64
+		This.stream.Read(VarPtr(buffer) As *Byte, 0, 8)
+		Return buffer
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから符号付きバイトを読み取り、ストリームの現在位置を1バイトだけ進めます。
+	@return 1バイト符号付き整数値
+	*/
+	Virtual Function ReadSByte() As SByte
+		Dim buffer As SByte
+		This.stream.Read(VarPtr(buffer) As *Byte, 0, 1)
+		Return buffer
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから4バイト浮動小数点値を読み取り、ストリームの現在位置を4バイトだけ進めます。
+	@return 4バイト浮動小数点値
+	*/
+	Virtual Function ReadSingle() As Single
+		Dim buffer As Single
+		This.stream.Read(VarPtr(buffer) As *Byte, 0, 4)
+		Return buffer
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから文字列を読み取ります。文字列の先頭に長さを付け、7ビットの整数としてまとめてエンコードします。
+	@return String値
+	*/
+	Virtual Function ReadString() As String
+		Return ""
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief リトルエンディアンエンコーディングを使用して現在のストリームから2バイト符号なし整数を読み取り、ストリームの位置を2バイトだけ進めます。
+	@return 2バイト符号なし整数値
+	*/
+	Virtual Function ReadUInt16() As Word
+		Dim buffer As Word
+		This.stream.Read(VarPtr(buffer) As *Byte, 0, 2)
+		Return buffer
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから4バイト符号なし整数を読み取り、ストリームの位置を4バイトだけ進めます。
+	@return 4バイト符号なし整数値
+	*/
+	Virtual Function ReadUInt32() As DWord
+		Dim buffer As DWord
+		This.stream.Read(VarPtr(buffer) As *Byte, 0, 4)
+		Return buffer
+	End Function
+
+	/*!
+	@date 2008/02/27
+	@auther NoWest
+	@brief 現在のストリームから8バイト符号なし整数を読み取り、ストリームの位置を8バイトだけ進めます。
+	@return 8バイト符号なし整数値
+	*/
+	Virtual Function ReadUInt64() As QWord
+		Dim buffer As QWord
+		This.stream.Read(VarPtr(buffer) As *Byte, 0, 8)
+		Return buffer
+	End Function
+
+Protected 'method
+	'BinaryReader によって使用されているアンマネージ リソースを解放し、オプションでマネージリソースも解放します。
+	Virtual Sub Dispose(disposing As Boolean)
+		This.stream.Close()
+	End Sub
+
+	'指定したバイト数分だけストリームから読み取ったバイトを内部バッファに格納します。
+	Virtual Sub FillBuffer(numBytes As Long)
+		'TODO:
+	End Sub
+
+'	Read7BitEncodedInt	32 ビット整数を圧縮形式で読み取ります。
+
+Private
+	stream As Stream
+	coding As System.Text.Encoding
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/BinaryWriter.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/BinaryWriter.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/BinaryWriter.ab	(revision 506)
@@ -0,0 +1,203 @@
+
+NameSpace System
+NameSpace IO
+
+Class BinaryWriter
+	Implements IDisposable
+
+Public 'constructor
+	/*
+	ストリームへの書き込みを行う BinaryWriter クラスの新しいインスタンスを初期化します。
+	*/
+	Sub BinaryWriter()
+		This.OutStream=Nothing
+	End Sub
+
+	/*
+	ストリームへの書き込みを行う BinaryWriter クラスの新しいインスタンスを初期化します。
+	*/
+	Sub BinaryWriter(output As System.IO.Stream)
+	End Sub
+
+	/*
+	ストリームへの書き込みを行う BinaryWriter クラスの新しいインスタンスを初期化します。
+	*/
+	Sub BinaryWriter(output As System.IO.Stream, encoding As System.Text.Encoding)
+	End Sub
+
+	Sub ~BinaryWriter()
+		This.Dispose()
+	End Sub
+
+Public 'field
+	/*
+	バッキング ストアを持たない BinaryWriter を指定します。
+	*/
+/*	Null As BinaryWriter*/
+
+Protected 'field
+	/*
+	基になるストリームを保持します。
+	*/
+	OutStream As System.IO.Stream
+
+Public 'property
+	/*
+	BinaryWriter の基になるストリームを取得します。
+	*/
+	Function BaseStream() As Stream
+		Return OutStream
+	End Function
+
+Public 'method
+	/*
+	現在の BinaryWriter と基になるストリームを閉じます。
+	*/
+	Sub Close()
+		This.Disposed()
+	End Sub
+
+	/*
+	現在のライタのすべてのバッファをクリアし、バッファ内のデータを基になるデバイスに書き込みます。
+	*/
+	Sub Flush()
+	End Sub
+
+	/*
+	現在のストリーム内の位置を設定します。
+	*/
+	Function Seek(offset As Long, origin As SeekOrigin) As Int64
+		This.OutStream.Seek(offset, origin)
+	End Function
+
+
+	/*
+		現在のストリームに1バイトBoolean値を書き込みます。値0はFalseを表し、値1はTrueを表します。
+	*/
+	Sub Write(value As Boolean)
+	End Sub
+ 
+	/*
+		現在のストリームに符号なしバイトを書き込み、ストリームの位置を1バイトだけ進めます。
+	*/
+	Sub WriteByte(value As Byte)
+	End Sub
+ 
+	/*
+		基になるストリームにバイト配列を書き込みます。
+	*/
+/*	Sub Write(value As Array<Byte>)
+		TODO
+	End Sub*/
+ 
+	/*
+		現在のストリームにUnicode 文字を書き込み、使用した Encoding とストリームに書き込んだ特定の文字に従ってストリームの現在位置を進めます。
+	*/
+	Sub Write(value As Char)
+	End Sub
+ 
+	/*
+		現在のストリームに文字配列を書き込み、使用した Encoding とストリームに書き込んだ特定の文字に従ってストリームの現在位置を進めます。
+	*/
+/*	Sub Write(value As Array<Char>)
+		TODO
+	End Sub*/
+ 
+	/*
+		現在のストリームに10進数値を書き込み、ストリームの位置を16バイトだけ進めます。 
+	*/
+/*	Sub Write(value As Decimal)
+		TODO
+	End Sub*/
+
+	/*
+		現在のストリームに8バイト浮動小数点値を書き込み、ストリームの位置を 8バイトだけ進めます。
+	*/
+	Sub Write(value As Double)
+	End Sub
+ 
+	/*
+		現在のストリームに2バイト符号付き整数を書き込み、ストリームの位置を 2バイトだけ進めます。
+	*/
+	Sub Write(value As Integer)
+	End Sub
+ 
+	/*
+		現在のストリームに4バイト符号付き整数を書き込み、ストリームの位置を 4バイトだけ進めます。
+	*/
+	Sub Write(value As Long)
+	End Sub
+ 
+	/*
+		現在のストリームに8バイト符号付き整数を書き込み、ストリームの位置を 8バイトだけ進めます。
+	*/
+	Sub Write(value As Int64)
+	End Sub
+ 
+	/*
+		現在のストリームに符号付きバイトを書き込み、ストリームの位置を1バイトだけ進めます。
+	*/
+	Sub WriteSByte(value As SByte)
+	End Sub
+ 
+	/*
+		現在のストリームに4バイト浮動小数点値を書き込み、ストリームの位置を 4バイトだけ進めます。
+	*/
+	Sub Write(value As Single)
+	End Sub
+ 
+	/*
+		文字長プリフィックスを持つ文字列を、BinaryWriter の現在のエンコーディングでこのストリームに書き込み、使用したエンコーディングとストリームに書き込んだ特定の文字に従ってストリームの現在位置を進めます。
+	*/
+	Sub Write(value As String)
+	End Sub
+ 
+	/*
+		現在のストリームに2バイト符号なし整数を書き込み、ストリームの位置を 2バイトだけ進めます。
+	*/
+	Sub Write(value As Word)
+	End Sub
+ 
+	/*
+		現在のストリームに4バイト符号なし整数を書き込み、ストリームの位置を 4バイトだけ進めます。
+	*/
+	Sub Write(value As DWord)
+	End Sub
+ 
+	/*
+		現在のストリームに8バイト符号なし整数を書き込み、ストリームの位置を 8バイトだけ進めます。
+	*/
+	Sub Write(value As QWord)
+	End Sub
+ 
+	/*
+		現在のストリームにバイト配列の特定の領域を書き込みます。
+	*/
+	Sub Write(buffer As *Byte, index As Long, count As Long)
+	End Sub
+ 
+	/*
+		現在のストリームに文字配列の特定の領域を書き込み、使用した Encoding とストリームに書き込んだ特定の文字に従ってストリームの現在位置を進めます。
+	*/
+	Sub Write(chars As *Char, index As Long, count As Long)
+	End Sub 
+
+	/*
+	32 ビット整数を圧縮形式で書き込みます。
+	*/
+	Sub Write7BitEncodedInt()
+	End Sub
+
+	/*
+	BinaryWriter によって使用されているアンマネージ リソースを解放し、オプションでマネージ リソースも解放します。
+	*/
+	Sub Dispose()
+		This.OutStream.Close()
+	End Sub
+
+Private
+	Enc As System.Text.Encoding
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/Directory.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/Directory.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/Directory.ab	(revision 506)
@@ -0,0 +1,367 @@
+Imports System.Collections.Generic
+
+Namespace System
+Namespace IO
+
+/*!
+@brief	ディレクトリの情報を取得したり操作するクラス
+*/
+
+Class Directory
+Public
+
+	'----------------------------------------------------------------
+	' パブリック メソッド
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	ディレクトリを作成する
+	@param  作成するディレクトリのファイルパス
+	@return 作成されたディレクトリのDirctoryInfo
+	*/
+	Static Function CreateDirectory(path As String) As DirectoryInfo
+		Dim info = New DirectoryInfo(path)
+		info.Create()
+		Return info
+	End Function
+
+	/*
+	Static Function CreateDirectory(path As String, directorySecurity As DirectorySecurity) As DirectoryInfo
+	End Function */
+
+	/*!
+	@brief	ディレクトリを削除する
+	ディレクトリが開き出ない場合は削除されない
+	@param  消去するディレクトリのファイルパス
+	*/
+	Static Sub Delete(path As String)
+		Dim info = New DirectoryInfo(path)
+		info.Delete()
+	End Sub
+
+	/*!
+	@brief	ディレクトリを削除する
+	@param  削除するディレクトリのファイルパス
+	@param  ディレクトリの中身も消去する場合True
+	*/
+	Static Sub Delete(path As String, recursive As Boolean)
+		Dim info = New DirectoryInfo(path)
+		info.Delete(recursive)
+	End Sub
+
+	/*!
+	@brief	ディレクトリが存在するかどうか
+	@param  調べるディレクトリのファイルパス
+	@retval True  存在する
+	@retval False 存在しない
+	*/
+	Static Function Exists(path As String) As Boolean
+		Dim info = New DirectoryInfo(path)
+		Return info.Exists
+	End Function
+
+	/*!
+	@brief	カレントディレクトリを取得する
+	@return カレントディレクトリを示すパス
+	*/
+	Static Function GetCurrentDirectory() As String
+		Return System.Environment.CurrentDirectory
+	End Function
+
+	/*
+	Static Function GetAccessControl(path As String) As DirectorySecurity
+	End Function
+
+	Static Function GetAccessControl(path As String, includeSections As System.Security.AccessControl.AccessControlSections) As DirectorySecurity
+	End Function
+	*/
+
+	/*!
+	@brief	ディレクトリの作成日を取得する
+	@param  ディレクトリを示すパス
+	@return 作成日
+	*/
+	Static Function GetCreationTime(path As String) As DateTime
+		Dim info = New DirectoryInfo(path)
+		Return info.CreationTime
+	End Function
+
+	/*!
+	@brief	ディレクトリの作成日をUTC時刻で取得する
+	@param  ディレクトリを示すパス
+	@return 作成日(UTC)
+	*/
+	Static Function GetCreationTimeUtc(path As String) As DateTime
+		Dim info = New DirectoryInfo(path)
+		Return info.CreationTimeUtc
+	End Function
+
+	/*!
+	@brief	ディレクトリ内のディレクトリを列挙する
+	@param  中身を調べるディレクトリのパス
+	@return ディレクトリのパス文字列が列挙された配列
+	*/
+	Static Function GetDirectories(path As String) As List<String>
+		Return GetDirectories(path, "?*", SearchOption.TopDirectoryOnly)
+	End Function
+
+	/*!
+	@brief	ディレクトリ内のディレクトリを列挙する
+	@param  中身を調べるディレクトリのパス
+	@param  サーチするディレクトリ名のパターン
+	@return ディレクトリのパス文字列が列挙された配列
+	*/
+	Static Function GetDirectories(path As String, searchPattern As String) As List<String>
+		Return GetDirectories(path, searchPattern, SearchOption.TopDirectoryOnly)
+	End Function
+
+	/*!
+	@brief	ディレクトリ内のディレクトリを列挙する
+	@param  中身を調べるディレクトリのパス
+	@param  サーチするディレクトリ名のパターン
+	@param  サーチする範囲
+	@return ディレクトリのパス文字列が列挙された配列
+	*/
+	Static Function GetDirectories(path As String, searchPattern As String, searchOption As SearchOption) As List<String>
+		Dim info = New DirectoryInfo(path)
+		Dim infos = info.GetDirectories(searchPattern, searchOption) As List<DirectoryInfo>
+		Dim enumerator = infos.GetEnumerator()
+		Dim list As List<String>
+		While enumerator.MoveNext()
+			list.Add(enumerator.Current.ToString)
+		Wend
+		Return list
+	End Function
+
+	/*!
+	@brief	ディレクトリのルートディレクトリを取得する
+	@param  ディレクトリのパス
+	@return ルートディレクトリ
+	*/
+	Static Function GetDirectoryRoot(path As String) As String
+		Return Path.GetPathRoot(path)
+	End Function
+
+	/*!
+	@brief	ディレクトリ内のファイルを列挙する
+	@param  中身を調べるディレクトリのパス
+	@return ファイルのパス文字列が列挙された配列
+	*/
+	Static Function GetFiles(path As String) As List<String>
+		Return GetFiles(path, "?*", SearchOption.TopDirectoryOnly)
+	End Function
+
+	/*!
+	@brief	ディレクトリ内のファイルを列挙する
+	@param  中身を調べるディレクトリのパス
+	@param  サーチするファイル名のパターン
+	@return ファイルのパス文字列が列挙された配列
+	*/
+	Static Function GetFiles(path As String, searchPattern As String) As List<String>
+		Return GetFiles(path, searchPattern, SearchOption.TopDirectoryOnly)
+	End Function
+
+	/*!
+	@brief	ディレクトリ内のファイルを列挙する
+	@param  中身を調べるディレクトリのパス
+	@param  サーチするファイル名のパターン
+	@param  サーチする範囲
+	@return ファイルのパス文字列が列挙された配列
+	*/
+	Static Function GetFiles(path As String, searchPattern As String, searchOption As SearchOption) As List<String>
+		Dim info = New DirectoryInfo(path)
+		Dim infos = info.GetFiles(searchPattern, searchOption) As List<FileInfo>
+		Dim enumerator = infos.GetEnumerator()
+		Dim list As List<String>
+		While enumerator.MoveNext()
+			list.Add(enumerator.Current.ToString)
+		Wend
+		Return list
+	End Function
+
+	/*!
+	@brief	ディレクトリ内を列挙する
+	@param  中身を調べるディレクトリのパス
+	@return ファイルやディレクトリのパス文字列が列挙された配列
+	*/
+	Static Function GetFileSystemEnties(path As String) As List<String>
+		Return GetFileSystemEnties(path, "?*")
+	End Function
+
+	/*!
+	@brief	ディレクトリ内を列挙する
+	@param  中身を調べるディレクトリのパス
+	@param  サーチするファイル名のパターン
+	@return ファイルやディレクトリのパス文字列が列挙された配列
+	*/
+	Static Function GetFileSystemEnties(path As String, searchPattern As String) As List<String>
+		Dim info = New DirectoryInfo(path)
+		Dim infos = info.GetFileSystemInfos(searchPattern) As List<FileSystemInfo>
+		Dim enumerator = infos.GetEnumerator()
+		Dim list As List<String>
+		While enumerator.MoveNext()
+			list.Add(enumerator.Current.ToString)
+		Wend
+		Return list
+	End Function
+
+	/*!
+	@brief	ディレクトリの最終アクセス日を取得する
+	@param  ディレクトリのパス
+	@return 最終アクセス日
+	*/
+	Static Function GetLastAccessTime(path As String) As DateTime
+		Dim info = New DirectoryInfo(path)
+		Return info.LastAccessTime
+	End Function
+
+	/*!
+	@brief	ディレクトリの最終アクセス日をUTC時刻で取得する
+	@param  ディレクトリのパス
+	@return 最終アクセス日(UTC)
+	*/
+	Static Function GetLastAccessTimeUtc(path As String) As DateTime
+		Dim info = New DirectoryInfo(path)
+		Return info.LastAccessTimeUtc
+	End Function
+
+	/*!
+	@brief	ディレクトリの最終書き込み日を取得する
+	@param  ディレクトリのパス
+	@return 最終書き込み日
+	*/
+	Static Function GetLastWriteTime(path As String) As DateTime
+		Dim info = New DirectoryInfo(path)
+		Return info.LastWriteTime
+	End Function
+
+	/*!
+	@brief	ディレクトリの最終書き込み日をUTC時刻で取得する
+	@param  ディレクトリのパス
+	@return 最終書き込み日(UTC)
+	*/
+	Static Function GetLastWriteTimeUtc(path As String) As DateTime
+		Dim info = New DirectoryInfo(path)
+		Return info.LastWriteTimeUtc
+	End Function
+
+	/*!
+	@brief	使用可能な論理ドライブを列挙する
+	@return 論理ドライブを列挙したパス文字列
+	*/
+	Static Function GetLogicalDrives() As List<String>
+		Dim drives = WIN32API_GetLogicalDrives() As DWord
+		If drives <> 0 Then
+			Dim list As List<String>
+			Dim i As SByte
+			For i = 0 To 25
+				If (drives and (1 << i)) <> 0 Then
+					list.Add(Chr$(Asc("A") + i) + ":\")
+				End If
+			Next
+			Return list
+		Else
+			Throw New IOException("Directory.GetLogicalDrives: Failed to GetLogicalDirives.")
+		End If
+	End Function
+
+	/*!
+	@brief	ディレクトリのひとつ上のディレクトリを取得する
+	@param  ディレクトリのパス
+	@return ひとつ上のディレクトリ
+	*/
+	Static Function GetParent(path As String) As DirectoryInfo
+		Return New DirectoryInfo(Path.GetDirectoryName(path))
+	End Function
+
+	/*!
+	@brief	ディレクトリを移動する
+	@param  移動元のディレクトリのパス
+	@param  移動後のディレクトリのパス
+	*/
+	Static Sub Move(sourceDirName As String, destDirName As String)
+		Dim info = New DirectoryInfo(sourceDirName)
+		info.MoveTo(destDirName)
+	End Sub
+
+	/*
+	Static Sub SetAccessControl(path As String, directorySecurity As DirectorySecurity)
+	End Sub
+	*/
+
+	/*!
+	@brief	ディレクトリの作成日を設定する
+	@param  ディレクトリのパス
+	@param  作成日
+	*/
+	Static Sub SetCreationTime(path As String, creationTime As DateTime)
+		Dim info = New DirectoryInfo(path)
+		info.CreationTime = creationTime
+	End Sub
+
+	/*!
+	@brief	ディレクトリの作成日をUTC時刻で設定する
+	@param  ディレクトリのパス
+	@param  作成日(UTC)
+	*/
+	Static Sub SetCreationTimeUtc(path As String, creationTime As DateTime)
+		Dim info = New DirectoryInfo(path)
+		info.CreationTimeUtc = creationTime
+	End Sub
+
+	/*!
+	@brief	カレントディレクトリを設定する
+	@param  ディレクトリのパス
+	*/
+	Static Sub SetCurrentDirectory(path As String)
+		System.Environment.CurrentDirectory = path
+	End Sub
+
+	/*!
+	@brief	ディレクトリの最終アクセス日を設定する
+	@param  ディレクトリのパス
+	@param  最終アクセス日
+	*/
+	Static Sub SetLastAccessTime(path As String, lastAccessTime As DateTime)
+		Dim info = New DirectoryInfo(path)
+		info.LastAccessTime = lastAccessTime
+	End Sub
+
+	/*!
+	@brief	ディレクトリの最終アクセス日をUTC時刻で設定する
+	@param  ディレクトリのパス
+	@param  最終アクセス日(UTC)
+	*/
+	Static Sub SetLastAccessTimeUtc(path As String, lastAccessTime As DateTime)
+		Dim info = New DirectoryInfo(path)
+		info.LastAccessTimeUtc = lastAccessTime
+	End Sub
+
+	/*!
+	@brief	ディレクトリの最終書き込み日を設定する
+	@param  ディレクトリのパス
+	@param  最終書き込み日
+	*/
+	Static Sub SetLastWriteTime(path As String, lastWriteTime As DateTime)
+		Dim info = New DirectoryInfo(path)
+		info.LastWriteTime = lastWriteTime
+	End Sub
+
+	/*!
+	@brief	ディレクトリの最終書き込み日をUTC時刻で設定する
+	@param  ディレクトリのパス
+	@param  最終書き込み日(UTC)
+	*/
+	Static Sub SetLastWriteTimeUtc(path As String, lastWriteTime As DateTime)
+		Dim info = New DirectoryInfo(path)
+		info.LastWriteTimeUtc = lastWriteTime
+	End Sub
+End Class
+
+/* 名前が被ってメソッドから呼び出せない */
+Function WIN32API_GetLogicalDrives() As DWord
+	Return GetLogicalDrives()
+End Function
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/DirectoryInfo.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/DirectoryInfo.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/DirectoryInfo.ab	(revision 506)
@@ -0,0 +1,307 @@
+Imports System.Collections.Generic
+
+Namespace System
+Namespace IO
+
+Class DirectoryInfo
+	Inherits FileSystemInfo
+Public
+	/*!
+	@brief	コンストラクタ
+	@author	OverTaker
+	@date	2007/11/11
+	@param	ディレクトリのパス
+	*/
+	Sub DirectoryInfo(path As String)
+		OriginalPath = path
+		FullPath = Path.GetFullPath(path)
+	End Sub
+
+	Sub ~DirectoryInfo()
+	End Sub
+
+	'----------------------------------------------------------------
+	' パブリック プロパティ
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	ひとつ上のディレクトリを取得する
+	@author	OverTaker
+	@date	2007/11/11
+	@return	親ディレクトリ
+	*/
+	Function Parent() As DirectoryInfo
+		Return New DirectoryInfo(Path.GetDirectoryName(FullPath))
+	End Function
+
+	/*!
+	@brief	ルートディレクトリを取得する
+	@author	OverTaker
+	@date	2007/11/11
+	@return	ルートディレクトリ
+	*/
+	Function Root() As DirectoryInfo
+		Return New DirectoryInfo(Path.GetPathRoot(FullPath))
+	End Function
+
+	'----------------------------------------------------------------
+	' パブリック メソッド
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	ディレクトリを作成する
+	@author	OverTaker
+	@date	2007/11/11
+	*/
+	Sub Create()
+		If CreateDirectory(ToTCStr(FullPath), NULL) = False Then
+			Dim error = GetLastError()
+			Select Case error
+				Case ERROR_ALREADY_EXISTS
+					Exit Sub 'ディレクトリが既に存在するときは、何もしない。
+				Case Else
+					Throw New IOException("DirectoryInfo.CreateDirectory: Failed to CreateDirectory")
+			End Select
+		End If
+	End Sub
+
+/*	Sub Create(directorySecurity As DirectorySecurity)
+	End Sub*/
+
+	/*!
+	@brief	ディレクトリを削除する。ただしディレクトリが空の場合
+	@author	OverTaker
+	@date	2007/11/11
+	*/
+	Override Sub Delete()
+		RemoveDirectory(ToTCStr(FullPath))
+	End Sub
+
+	/*!
+	@brief	ディレクトリを削除する
+	@author	OverTaker
+	@date	2007/11/11
+	@param	ディレクトリのファイルごと消すかどうか
+	*/
+	Sub Delete(recursive As Boolean)
+		If recursive Then
+			' ディレクトリ内のすべての情報を削除する
+
+			Dim dirPath = FullPath As String
+
+			' 終端の '\' を除去
+			If dirPath[dirPath.Length-1] = Asc("\") Then
+				dirPath = dirPath.Substring(0, dirPath.Length-1)
+			End If
+
+			' double null-terminated にする
+			dirPath = dirPath + Chr$(0)
+
+			Dim op As SHFILEOPSTRUCT
+			op.hwnd = NULL
+			op.wFunc = FO_DELETE
+			op.pFrom = ToTCStr(dirPath)
+			op.pTo = NULL
+			op.fFlags = FOF_NOCONFIRMATION or FOF_NOERRORUI or FOF_SILENT
+
+			If SHFileOperation(op) <> 0 Then
+				Throw New IOException("DirectoryInfo.Delete: Failed to SHFileOperation.")
+			End If
+		Else
+			' ディレクトリが空の場合は削除する
+			This.Delete()
+		End If
+	End Sub
+
+/*	Function GetAccessControl() As DirectorySecurity
+	End Function*/
+
+/*	Function GetAccessControl(includeSections As AccessControlSections) As DirectorySecurity
+	End Function*/
+
+	/*!
+	@brief	ディレクトリの中にあるディレクトリを取得する
+	@author	OverTaker
+	@date	2007/11/11
+	@return	ディレクトリの配列
+	*/
+	Function GetDirectories() As List<DirectoryInfo>
+		Return GetDirectories("?*")
+	End Function
+
+	/*!
+	@brief	ディレクトリの中にあるディレクトリを取得する
+	@author	OverTaker
+	@date	2007/11/11
+	@param	サーチするディレクトリ名のパターン
+	@return	パターンに適合したディレクトリの配列
+	*/
+	Function GetDirectories(searchPattern As String) As List<DirectoryInfo>
+		Dim infos As List<FileSystemInfo>
+		infos = GetFileSystemInfos(searchPattern)
+
+		Dim dirs As List<DirectoryInfo>
+		Dim i As Long
+		For i = 0 To ELM(infos.Count)
+			If (infos[i].Attributes and FileAttributes.Directory) = FileAttributes.Directory Then
+				dirs.Add(infos[i] As DirectoryInfo)
+			End If
+		Next
+		Return dirs
+	End Function
+
+	/*!
+	@brief	ディレクトリの中にあるディレクトリを取得する
+	@author	OverTaker
+	@date	2007/11/11
+	@param	サーチするディレクトリ名のパターン
+	@param	サーチする範囲
+	@return	サーチした範囲にあるパターンに適合したディレクトリの配列
+	*/
+	Function GetDirectories(searchPattern As String, searchOption As SearchOption) As List<DirectoryInfo>
+		Select Case searchOption
+			Case SearchOption.TopDirectoryOnly
+				Return GetDirectories(searchPattern)
+			Case SearchOption.AllDirectories
+				Dim dirs As List<DirectoryInfo>
+				dirs = GetDirectories(searchPattern)
+
+				Dim subdirs As List<DirectoryInfo>
+				Dim i As Long, j As Long
+				For i = 0 To ELM(dirs.Count)
+					subdirs = dirs[i].GetDirectories(searchPattern)
+					For j = 0 To ELM(subdirs.Count)
+						dirs.Add(subdirs[j])
+					Next
+				Next
+				Return dirs
+		End Select
+	End Function
+
+	/*!
+	@brief	ディレクトリの中にあるファイルを取得する
+	@author	OverTaker
+	@date	2007/11/11
+	@return	ファイルの配列
+	*/
+	Function GetFiles() As List<FileInfo>
+		Return GetFiles("?*")
+	End Function
+
+	/*!
+	@brief	ディレクトリの中にあるファイルを取得する
+	@author	OverTaker
+	@date	2007/11/11
+	@param	サーチするファイル名のパターン
+	@return	パターンに適合したファイルの配列
+	*/
+	Function GetFiles(searchPattern As String) As List<FileInfo>
+		Dim infos As List<FileSystemInfo>
+		infos = GetFileSystemInfos(searchPattern)
+
+		Dim files As List<FileInfo>
+		Dim i As Long
+		For i = 0 To ELM(infos.Count)
+			If (infos[i].Attributes and FileAttributes.Directory) <> FileAttributes.Directory Then
+				files.Add(infos[i] As FileInfo)
+			End If
+		Next
+		Return files
+	End Function
+
+	/*!
+	@brief	ディレクトリの中にあるファイルを取得する
+	@author	OverTaker
+	@date	2007/11/11
+	@param	サーチするファイル名のパターン
+	@param	サーチする範囲
+	@return	サーチした範囲にあるパターンに適合したディレクトリの配列
+	*/
+	Function GetFiles(searchPattern As String, searchOption As SearchOption) As List<FileInfo>
+		Select Case searchOption
+			Case SearchOption.TopDirectoryOnly
+				Return GetFiles(searchPattern)
+			Case SearchOption.AllDirectories
+				Dim dirs As List<DirectoryInfo>
+				dirs = GetDirectories("?*", SearchOption.AllDirectories)
+
+				Dim files As List<FileInfo>
+				files = GetFiles(searchPattern)
+				Dim i As Long, j As Long, subfiles As List<FileInfo>
+				For i = 0 To ELM(dirs.Count)
+					subfiles = dirs[i].GetFiles(searchPattern)
+					For j = 0 To ELM(subfiles.Count)
+						files.Add(subfiles[j])
+					Next
+				Next
+				Return files
+		End Select
+	End Function
+
+	/*!
+	@brief	ディレクトリの中にあるディレクトリやファイルを取得する
+	@author	OverTaker
+	@date	2007/11/11
+	@return	ディレクトリやファイルの配列
+	*/
+	Function GetFileSystemInfos() As List<FileSystemInfo>
+		Return GetFileSystemInfos("?*")
+	End Function
+
+	/*!
+	@brief	ディレクトリの中にあるディレクトリやファイルを取得する
+	@author	OverTaker
+	@date	2007/11/11
+	@param	サーチする名前のパターン
+	@return	パターンに適合したディレクトリやファイルの配列
+	*/
+	Function GetFileSystemInfos(searchPattern As String) As List<FileSystemInfo>
+		Dim find As HANDLE
+		Dim findData As WIN32_FIND_DATA
+		find = FindFirstFile(ToTCStr(Path.Combine(FullPath, searchPattern)), findData)
+		If find = INVALID_HANDLE_VALUE Then
+			Throw New IOException("DirectoryInfo.GetFileSystemInfos: Failed to FindFirstFile.")
+			Return Nothing
+		End If
+
+		Dim files As List<FileSystemInfo>
+		Do
+			Dim s = New String(findData.cFileName As PCTSTR)
+			If (findData.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY Then
+				files.Add(New DirectoryInfo(Path.Combine(FullPath, s)))
+			Else
+				files.Add(New FileInfo(Path.Combine(FullPath, s)))
+			End If
+		Loop While FindNextFile(find, findData)
+		FindClose(find)
+
+		files.Remove(New DirectoryInfo(Path.Combine(FullPath, ".")))
+		files.Remove(New DirectoryInfo(Path.Combine(FullPath, "..")))
+
+		If GetLastError() = ERROR_NO_MORE_FILES Then
+			Return files
+		Else
+			Throw New IOException("DirectoryInfo.GetFileSystemInfos: Failed to FindNextFile.")
+			Return Nothing
+		End If
+	End Function
+
+	/*!
+	@brief	ディレクトリを移動する
+	@author	OverTaker
+	@date	2007/11/11
+	@param	移動先
+	*/
+	Sub MoveTo(destDirName As String)
+		If MoveFile(ToTCStr(FullPath), ToTCStr(destDirName)) = FALSE Then
+			Throw New IOException("DirectoryInfo.MoveTo: Failed to MoveFile.")
+		End If
+	End Sub
+
+/*	Sub SetAccessControl(directorySecurity As DirectorySecurity)
+	End Sub*/
+
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/DirectorySecurity.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/DirectorySecurity.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/DirectorySecurity.ab	(revision 506)
@@ -0,0 +1,11 @@
+Namespace System
+Namespace IO
+
+
+Class DirectorySecurity
+	' TODO: 実装
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/DriveInfo.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/DriveInfo.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/DriveInfo.ab	(revision 506)
@@ -0,0 +1,84 @@
+Namespace System
+Namespace IO
+
+
+Enum DriveType
+	Unknown = 0
+	NoRootDirectory
+	Removable
+	Fixed
+	CDRom
+	Network
+	Ram
+End Enum
+
+Class DriveInfo
+	m_DriveName As String
+Public
+	Sub DriveInfo(driveName As String)
+		m_DriveName = driveName.ToUpper()
+	End Sub
+
+	Sub ~DriveInfo()
+	End Sub
+
+	'property
+	Function AvailableFreeSpace() As QWord
+		If GetDiskFreeSpaceEx(ToTCStr(m_DriveName), ByVal VarPtr(AvailableFreeSpace) As *ULARGE_INTEGER, ByVal 0, ByVal 0) = FALSE Then
+			Throw New IOException("DriveInfo.AvailableFreeSpace: Failed to GetDiskFreeSpaceEx.")
+		End If
+	End Function
+
+	Function DriveFormat() As String
+		Dim systemName[15] As TCHAR
+		If GetVolumeInformation(ToTCStr(m_DriveName), NULL, 0, NULL, NULL, NULL, systemName, Len (systemName) \ SizeOf (TCHAR)) Then
+			DriveFormat = New String( systemName )
+		Else
+			Throw New IOException("DriveInfo.DriveFormat: Failed to GetVolumeInformation.")
+		End If
+	End Function
+
+	Function DriveType() As Long
+		Return GetDriveType(ToTCStr(m_DriveName))
+	End Function
+
+	Function IsReady() As Boolean
+		If GetVolumeInformation(ToTCStr(m_DriveName), NULL, 0, NULL, NULL, NULL, NULL, 0) Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	Function Name() As String
+		Return m_DriveName
+	End Function
+
+/*	Function RootDirectory() As DirectoryInfo
+	End Function*/
+
+	Function TotalFreeSpace() As QWord
+		If GetDiskFreeSpaceEx(ToTCStr(m_DriveName), ByVal 0, ByVal 0, ByVal VarPtr(TotalFreeSpace) As *ULARGE_INTEGER) = FALSE Then
+			Throw New IOException("DriveInfo.TotalFreeSpace: Failed to GetDiskFreeSpaceEx.")
+		End If
+	End Function
+
+	Function TotalSize() As QWord
+		If GetDiskFreeSpaceEx(ToTCStr(m_DriveName), ByVal 0, ByVal VarPtr(TotalSize) As *ULARGE_INTEGER, ByVal 0) = FALSE Then
+			Throw New IOException("DriveInfo.TotalSize: Failed to GetDiskFreeSpaceEx.")
+		End If
+	End Function
+
+	Function VolumeLabel() As String
+		Dim volumeName[63] As TCHAR
+		If GetVolumeInformation(ToTCStr(m_DriveName), volumeName, Len (volumeName) \ SizeOf (TCHAR), NULL, NULL, NULL, NULL, 0) Then
+			VolumeLabel = New String( volumeName )
+		Else
+			Throw New IOException("DriveInfo.VolumeLabel: Failed to GetVolumeInformation.")
+		End If
+	End Function
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/Exception.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/Exception.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/Exception.ab	(revision 506)
@@ -0,0 +1,81 @@
+/*!
+@file
+@brief	System.IOに属す例外クラスの定義
+*/
+
+Namespace ActiveBasic
+
+Const AB_E_IO = &h80041620 '80131620
+
+End Namespace
+
+Namespace System
+Namespace IO
+
+/*!
+@brief	IO処理に関する例外のクラス
+@author	Egtra
+@date	2007/12/06
+*/
+Class IOException
+	Inherits SystemException
+Public
+	/*!
+	@biref	コンストラクタ
+	*/
+	Sub IOException()
+		Exception(GetType().FullName, Nothing)
+		HResult = ActiveBasic.AB_E_IO
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	*/
+	Sub IOException(message As String)
+		Exception(message, Nothing)
+		HResult = ActiveBasic.AB_E_IO
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] innerException	内部例外
+	*/
+	Sub IOException(message As String, innerException As Exception)
+		Exception(message, innerException)
+		HResult = ActiveBasic.AB_E_IO
+	End Sub
+	/*!
+	@biref	コンストラクタ
+	@param[in] message	エラーメッセージ
+	@param[in] hr	HRESULT例外値
+	*/
+	Sub IOException(message As String, hr As HRESULT)
+		Exception(message, Nothing)
+		HResult = hr
+	End Sub
+End Class
+
+Namespace Detail
+	/*!
+	@brief	Windowsエラー値を基にIOExceptionを投げる。
+	@param[in] message	エラーメッセージ
+	@author	Egtra
+	@date	2007/12/06
+	*/
+	Sub ThrowWinIOException(msg As String, error As DWord)
+		Throw New IOException(msg, HRESULT_FROM_WIN32(error))
+	End Sub
+
+	/*!
+	@brief	GetLastError()の値を基にIOExceptionを投げる。
+	@param[in] message	エラーメッセージ
+	@author	Egtra
+	@date	2007/12/06
+	*/
+	Sub ThrowWinLastErrorIOException(msg As String)
+		Throw New IOException(msg, HRESULT_FROM_WIN32(GetLastError()))
+	End Sub
+End Namespace
+
+End Namespace 'IO
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/File.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/File.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/File.ab	(revision 506)
@@ -0,0 +1,530 @@
+Namespace System
+Namespace IO
+
+/*
+@brief ファイルのアクセス方法を表す
+*/
+Enum FileAccess
+	Read      = GENERIC_READ
+	ReadWrite = GENERIC_READ Or GENERIC_WRITE
+	Write     = GENERIC_WRITE
+End Enum
+
+/*
+@brief ファイルの属性を表す
+*/
+Enum FileAttributes
+	Archive           = FILE_ATTRIBUTE_ARCHIVE
+	Compressed        = FILE_ATTRIBUTE_COMPRESSED
+	Device            = FILE_ATTRIBUTE_DEVICE
+	Directory         = FILE_ATTRIBUTE_DIRECTORY
+	Encrypted         = FILE_ATTRIBUTE_ENCRYPTED
+	Hidden            = FILE_ATTRIBUTE_HIDDEN
+	Normal            = FILE_ATTRIBUTE_NORMAL
+	NotContentIndexed = FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
+	Offline           = FILE_ATTRIBUTE_OFFLINE
+	ReadOnly          = FILE_ATTRIBUTE_READONLY
+	ReparsePoint      = FILE_ATTRIBUTE_REPARSE_POINT
+	SparseFile        = FILE_ATTRIBUTE_SPARSE_FILE
+	System            = FILE_ATTRIBUTE_SYSTEM
+	Temporary         = FILE_ATTRIBUTE_TEMPORARY
+End Enum
+
+/*
+@brief ファイルの作成モードを表す
+*/
+Enum FileMode
+	Append       = OPEN_ALWAYS
+	Create       = CREATE_ALWAYS
+	CreateNew    = CREATE_NEW
+	Open         = OPEN_EXISTING
+	OpenOrCreate = OPEN_ALWAYS
+	Truncate     = TRUNCATE_EXISTING
+End Enum
+
+/*
+@brief ファイルの共有を表す
+*/
+Enum FileShare
+	None       = 0
+	Read       = FILE_SHARE_READ
+	Write      = FILE_SHARE_WRITE
+	ReadWrite  = FILE_SHARE_READ Or FILE_SHARE_WRITE
+	DeleteFile = FILE_SHARE_DELETE
+End Enum
+
+/*
+@brief  ファイルの操作,情報を取得するクラス
+@date   2008/03/13
+@author OverTaker
+*/
+
+Imports System.Collections.Generic
+
+Class File
+Public
+
+	'----------------------------------------------------------------
+	' パブリック　メソッド
+	'----------------------------------------------------------------
+
+	/*
+	@brief ファイルにテキストを追加する
+	@param ファイルパス
+	@param 追加するテキスト
+	*/
+	Static Sub AppendAllText( path As String, contents As String )
+		Dim stream = AppendText(path) As StreamWriter
+		stream.Write(contents)
+		stream.Close()
+	End Sub
+
+/*	Static Sub AppendAllText( path As String, contents As String, encoding As Encoding )
+		' TODO: 実装
+	End Sub */
+
+	/*
+	@brief  ファイルにテキストを追加するストリームを作成する
+	@param  ファイルパス
+	@return ストリームライター
+	*/
+	Static Function AppendText( path As String ) As StreamWriter
+		Return New StreamWriter(Open(path, FileMode.Append))
+	End Function
+
+	/*
+	@brief  ファイルをコピーする(上書きできない)
+	@param  コピー元のファイルパス
+	@param  コピー先のファイルパス
+	*/
+	Static Sub Copy( sourceFileName As String, destFileName As String )
+		Copy(sourceFileName, destFileName, False)
+	End Sub
+
+	/*
+	@brief  ファイルをコピーする
+	@param  コピー元のファイルパス
+	@param  コピー先のファイルパス
+	@param  上書きする場合True,しない場合False
+	*/
+	Static Sub Copy( sourceFileName As String, destFileName As String, overwrite As Boolean )
+		If Not CopyFile(Path.GetFullPath(sourceFileName), Path.GetFullPath(destFileName), overwrite) Then
+			Throw New IOException( "FileInfo: Failed to CopyFile." )
+		End If
+	End Sub
+
+	/*
+	@brief  新しいファイルを作成し、そのストリームを取得する
+	@param  ファイルパス
+	@return ファイルストリーム
+	*/
+	Static Function Create( path As String ) As FileStream
+		Return New FileStream(path, FileMode.CreateNew, FileAccess.ReadWrite)
+	End Function
+
+/*	Static Function Create( path As String, bufferSize As Long ) As FileStream
+		' TODO: 実装
+	End Function */
+
+/*	Static Function Create( path As String, bufferSize As Long, options As FileOptions ) As FileStream
+		' TODO: 実装
+	End Function */
+
+/*	Static Function Create( path As String, bufferSize As Long, options As FileOptions, fileSecurity As FileSecurity ) As FileStream
+		' TODO: 実装
+	End Function */
+
+/*	Static Function CreateText( path As String ) As StreamWriter
+		' TODO: 実装
+	End Function*/
+
+/*	Static Sub Decrypt( path As String )
+		' TODO: 実装
+	End Sub*/
+
+	/*
+	@brief ファイルを削除する
+	@param ファイルパス
+	*/
+	Static Sub Delete( path As String )
+		If Not DeleteFile(Path.GetFullPath(path)) Then
+			Throw New IOException("File.Delete: Failed to DeleteFile.")
+		End If
+	End Sub
+
+/*	Static Sub Encrypt( path As String )
+		' TODO: 実装
+	End Sub*/
+
+	/*
+	@brief  ファイルが存在するかどうかを取得する
+	@param  ファイルパス
+	@retval True  存在する
+	@retval False 存在しない
+	*/
+	Static Function Exists( path As String ) As Boolean
+		Dim data As WIN32_FIND_DATA
+		Dim hFind = FindFirstFile(ToTCStr(Path.GetFullPath(path)), data)
+		FindClose(hFind)
+
+		If hFind <> INVALID_HANDLE_VALUE Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+/*	Static Function GetAccessControl( path As String ) As FileSecurity
+		' TODO: 実装
+	End Function */
+
+/*	Static Function GetAccessControl( path As String, includeSections As AccessControlSections ) As FileSecurity
+		' TODO: 実装
+	End Function */
+
+	/*
+	@brief  ファイルの属性を取得する
+	@param  ファイルパス
+	@return ファイル属性
+	*/
+	Static Function GetAttributes( path As String ) As FileAttributes
+		Return New FileAttributes(getFileData(path).dwFileAttributes As Long, "FileAttributes")
+	End Function
+
+	/*
+	@brief  ファイルの作成日時を取得する
+	@param  ファイルパス
+	@return 作成日時
+	*/
+	Static Function GetCreationTime( path As String ) As DateTime
+		Return System.DateTime.FromFileTime(getFileData(path).ftCreationTime)
+	End Function
+
+	/*
+	@brief  ファイルの作成日時をUTC時刻で取得する
+	@param  ファイルパス
+	@return 作成日時
+	*/
+	Static Function GetCreationTimeUtc( path As String ) As DateTime
+		Return System.DateTime.FromFileTimeUtc(getFileData(path).ftCreationTime)
+	End Function
+
+	/*
+	@brief  ファイルの最終アクセス日時を取得する
+	@param  ファイルパス
+	@return 最終アクセス日時
+	*/
+	Static Function GetLastAccessTime( path As String ) As DateTime
+		Return System.DateTime.FromFileTime(getFileData(path).ftLastAccessTime)
+	End Function
+
+	/*
+	@brief  ファイルの最終アクセス日時をUTC時刻で取得する
+	@param  ファイルパス
+	@return 最終アクセス日時
+	*/
+	Static Function GetLastAccessTimeUtc( path As String ) As DateTime
+		Return System.DateTime.FromFileTimeUtc(getFileData(path).ftLastAccessTime)
+	End Function
+
+	/*
+	@brief  ファイルの最終書き込み日時を取得する
+	@param  ファイルパス
+	@return 最終書き込み日時
+	*/
+	Static Function GetLastWriteTime( path As String ) As DateTime
+		Return System.DateTime.FromFileTime(getFileData(path).ftLastWriteTime)
+	End Function
+
+	/*
+	@brief  ファイルの最終書き込み日時をUTC時刻で取得する
+	@param  ファイルパス
+	@return 最終書き込み日時
+	*/
+	Static Function GetLastWriteTimeUtc( path As String ) As DateTime
+		Return System.DateTime.FromFileTimeUtc(getFileData(path).ftLastWriteTime)
+	End Function
+
+	/*
+	@brief  ファイルを移動する
+	@param  移動元のファイルパス
+	@param  移動先のファイルパス
+	*/
+	Static Sub Move( sourceFileName As String, destFileName As String )
+		If Not MoveFile(Path.GetFullPath(sourceFileName), Path.GetFullPath(destFileName)) Then
+			Throw New IOException("File.Move: Failed to MoveFile.")
+		End If
+	End Sub
+
+	/*
+	@brief  ファイルストリームを作成する
+	@param  ファイルパス
+	@param  ファイルモード
+	@return ファイルストリーム
+	*/
+	Static Function Open( path As String, mode As FileMode ) As FileStream
+		Return New FileStream(path, mode)
+	End Function
+
+	/*
+	@brief  ファイルストリームを作成する
+	@param  ファイルパス
+	@param  ファイルモード
+	@param  ファイルアクセス
+	@return ファイルストリーム
+	*/
+	Static Function Open( path As String, mode As FileMode, access As FileAccess ) As FileStream
+		Return New FileStream(path, mode, access)
+	End Function
+
+	/*
+	@brief  ファイルストリームを作成する
+	@param  ファイルパス
+	@param  ファイルモード
+	@param  ファイルアクセス
+	@param  ファイル共有
+	@return ファイルストリーム
+	*/
+	Static Function Open( path As String, mode As FileMode, access As FileAccess, share As FileShare ) As FileStream
+		Return New FileStream(path, mode, access, share)
+	End Function
+
+	/*
+	@brief  読み取り専用のファイルストリームを作成する
+	@param  ファイルパス
+	@return ファイルストリーム
+	*/
+	Static Function OpenRead( path As String ) As FileStream
+		Return Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)
+	End Function
+
+	/*
+	@brief  読み取り専用のストリームを作成する
+	@param  ファイルパス
+	@return ストリームリーダー
+	*/
+	Static Function OpenText( path As String ) As StreamReader
+		Return New StreamReader(path)
+	End Function
+
+	/*
+	@brief  書き込み専用のファイルストリームを作成する
+	@param  ファイルパス
+	@return ファイルストリーム
+	*/
+	Static Function OpenWrite( path As String ) As FileStream
+		Return Open(path, FileMode.Open, FileAccess.Write)
+	End Function
+
+/*	Static Function ReadAllBytes( path As String ) As *Byte
+		' TODO: 実装
+	End Function*/
+
+	/*
+	@brief  ファイルのすべての行を読み取る
+	@param  ファイルパス
+	@return 各行の文字列が格納されたリスト
+	*/
+	Static Function ReadAllLines( path As String ) As List<String>
+		Dim stream = New StreamReader(path)
+		Dim readLines As List<String>
+		Dim readLine = stream.ReadLine() As String
+		While Not ActiveBasic.IsNothing(readLine)
+			readLines.Add(readLine)
+			readLine = stream.ReadLine()
+		Wend
+		stream.Close()
+		Return readLines
+	End Function
+
+/*	Static Function ReadAllLines( path As String, encoding As Encoding ) As Strings
+		' TODO: 実装
+	End Function */
+
+	/*
+	@brief  ファイルをすべて文字列として読み込む
+	@param  ファイルパス
+	@return ファイルの内容
+	*/
+	Static Function ReadAllText( path As String ) As String
+		Dim stream = OpenText(path)
+		Dim string = stream.ReadToEnd()
+		stream.Close()
+		Return string
+	End Function
+
+/*	Static Function ReadAllText( path As String, encoding As Encoding ) As String
+		' TODO: 実装
+	End Function */
+
+	/*
+	@brief  ファイルを置き換える
+	@param  置き換えるファイルパス
+	@param  置き換えられるファイルパス
+	@param  置き換えられるファイルのバックアップを作成するファイルパス
+	*/
+	Static Sub Replace( sourceFileName As String, destinationFileName As String, destinationBackupFileName As String )
+		Copy(destinationFileName, destinationBackupFileName)
+		Copy(sourceFileName, destinationFileName, True)
+	End Sub
+
+/*	Static Sub Replace( sourceFileName As String, destinationFileName As String, destinationBackupFileName As String, ignoreMetadataErrors As Boolean )
+		' TODO: 実装
+	End Sub*/
+
+/*	Static Sub SetAccessControl( path As String, fileSecurity As FileSecurity )
+		' TODO: 実装
+	End Sub */
+
+	/*
+	@brief  ファイルの属性を設定する
+	@param  ファイルパス
+	@param  ファイル属性
+	*/
+	Static Sub SetAttributes( path As String, fileAttributes As FileAttributes )
+		If Not SetFileAttributes(ToTCStr(path), fileAttributes) Then
+			Throw New IOException("File.SetAttributes: Failed to SetFileAttributes.")
+		End If
+	End Sub
+
+	/*
+	@brief  ファイルの作成日時を設定する
+	@param  ファイルパス
+	@param  作成日時
+	*/
+	Static Sub SetCreationTime( path As String, creationTime As DateTime )
+		SetCreationTimeUtc(path, creationTime)
+	End Sub
+
+	/*
+	@brief  ファイルの作成日時をUTC時刻で設定する
+	@param  ファイルパス
+	@param  作成日時
+	*/
+	Static Sub SetCreationTimeUtc( path As String, creationTimeUtc As DateTime )
+		Dim hFile = createFileToSetTime(path) As HANDLE
+		SetFileTime(hFile, creationTimeUtc.ToFileTimeUtc(), ByVal 0, ByVal 0)
+		CloseHandle(hFile)
+	End Sub
+
+	/*
+	@brief  ファイルの最終アクセス日時を設定する
+	@param  ファイルパス
+	@param  最終アクセス日時
+	*/
+	Static Sub SetLastAccessTime( path As String, lastAccessTime As DateTime )
+		SetLastAccessTimeUtc(path, lastAccessTime)
+	End Sub
+
+	/*
+	@brief  ファイルの最終アクセス日時をUTC時刻で設定する
+	@param  ファイルパス
+	@param  最終アクセス日時
+	*/
+	Static Sub SetLastAccessTimeUtc( path As String, lastAccessTimeUtc As DateTime )
+		Dim hFile = createFileToSetTime(path) As HANDLE
+		SetFileTime(hFile, ByVal 0, lastAccessTimeUtc.ToFileTimeUtc(), ByVal 0)
+		CloseHandle(hFile)
+	End Sub
+
+	
+	/*
+	@brief  ファイルの最終書き込み日時を設定する
+	@param  ファイルパス
+	@param  最終書き込み日時
+	*/
+	Static Sub SetLastWriteTime( path As String, lastWriteTime As DateTime )
+		SetLastWriteTimeUtc(path, lastWriteTime)
+	End Sub
+
+	/*
+	@brief  ファイルの最終書き込み日時をUTC時刻で設定する
+	@param  ファイルパス
+	@param  最終書き込み日時
+	*/
+	Static Sub SetLastWriteTimeUtc( path As String, lastWriteTimeUtc As DateTime )
+		Dim hFile = createFileToSetTime(path) As HANDLE
+		SetFileTime(hFile, ByVal 0, ByVal 0, lastWriteTimeUtc.ToFileTimeUtc())
+		CloseHandle(hFile)
+	End Sub
+
+/*	Static Sub WriteAllBytes( path As String, bytes As *Byte )
+		' TODO: 実装
+	End Sub*/
+
+	/*
+	@brief  リストに格納された文字列を一行ずつファイルに書き込む
+	@param  ファイルパス
+	@param  書き込む文字列リスト
+	*/
+	Static Sub WriteAllLines( path As String, contents As List<String> )
+		Dim stream = New StreamWriter(path)
+		Dim enumerator = contents.GetEnumerator()
+		enumerator.Reset()
+		While enumerator.MoveNext()
+			stream.WriteLine(enumerator.Current)
+		Wend
+		stream.Close()
+	End Sub
+
+/*	Static Sub WriteAllLines( path As String, contents As Strings, encoding As Enconding )
+		' TODO: 実装
+	End Sub */
+
+	/*
+	@brief  ファイルに文字列を書き込む
+	@param  ファイルパス
+	@param  書き込む文字列
+	*/
+	Static Sub WriteAllText( path As String, contents As String )
+		Dim stream = New StreamWriter(path)
+		stream.Write(contents)
+		stream.Close()
+	End Sub
+
+/*	Static Sub WriteAllText( path As String, contents As String, encoding As Enconding )
+		' TODO: 実装
+	End Sub */
+
+Private
+	'----------------------------------------------------------------
+	' プライベート メソッド
+	'----------------------------------------------------------------
+
+	/*
+	@brief  ファイルの情報を取得する
+	@param  ファイルパス
+	@return WIN32_FIND_DATA構造体
+	*/
+	Static Function getFileData(path As String) As WIN32_FIND_DATA
+		Dim data As WIN32_FIND_DATA
+		Dim hFind = FindFirstFile(ToTCStr(Path.GetFullPath(path)), data)
+		FindClose(hFind)
+
+		If hFind <> INVALID_HANDLE_VALUE Then
+			Return data
+		Else
+			Throw New IOException("File.getFileData: Failed to FindFirstFile.")
+		End If
+	End Function
+
+	/*
+	@brief  ファイルの各種日時を変更するためのファイル作成を行う
+	@param  ファイルパス
+	@return ファイルハンドル
+	*/
+	Static Function createFileToSetTime(path As String) As HANDLE
+		Dim hFile As HANDLE
+		hFile = CreateFile(ToTCStr(path), GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)
+		If hFile = INVALID_HANDLE_VALUE Then
+			CloseHandle(hFile)
+			Throw New IOException("File.setFileTime: Failed to CreateFile.")
+			Exit Function
+		End If
+		Return hFile
+	End Function
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/FileInfo.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/FileInfo.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/FileInfo.ab	(revision 506)
@@ -0,0 +1,233 @@
+Namespace System
+Namespace IO
+
+/*
+@brief  ファイルの情報取得,操作をするクラス
+@date   2008/03/14
+@author OverTaker
+*/
+
+Class FileInfo
+	Inherits FileSystemInfo
+Public
+	/*
+	@brief  コンストラクタ
+	@param  ファイルパス
+	*/
+	Sub FileInfo(path As String)
+		OriginalPath = path
+		FullPath = Path.GetFullPath(path)
+	End Sub
+
+	'----------------------------------------------------------------
+	' パブリック　プロパティ
+	'----------------------------------------------------------------
+
+	/*
+	@brief  ひとう上のフォルダを取得する
+	@return フォルダを表すDirectoryInfo
+	*/
+	Function Directory() As DirectoryInfo
+		Return New DirectoryInfo(Path.GetDirectoryName(FullPath))
+	End Function
+
+	/*
+	@brief  ひとつ上のフォルダ名を取得する
+	@return フォルダを表すファイルパス
+	*/
+	Function DirectoryName() As String
+		Return Path.GetDirectoryName(FullPath)
+	End Function
+
+	/*
+	@brief  ファイルが読み取り専用かどうかを取得する
+	@retval True  読み取り専用ファイル
+	@retval False 読み取り専用ファイルではない
+	*/
+	Function IsReadOnly() As Boolean
+		If (Attributes and FileAttributes.ReadOnly) = FileAttributes.ReadOnly Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	/*
+	@brief  ファイルサイズを取得する
+	@return ファイルサイズ
+	*/
+	Function Length() As QWord
+		Dim hFile = CreateFile(ToTCStr(FullPath), GENERIC_READ, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
+		If hFile = INVALID_HANDLE_VALUE Then
+			Throw New IOException("FileInfo.Length: Failed to CreateFile.")
+			Exit Function
+		End If
+
+		Dim length As QWord
+		If GetFileSizeEx(hFile, VarPtr(length)) Then
+			CloseHandle(hFile)
+			Return length
+		Else
+			CloseHandle(hFile)
+			Throw New IOException("FileInfo.Length: Failed to GetFileSize")
+		End If
+	End Function
+
+	'----------------------------------------------------------------
+	' パブリック　メソッド
+	'----------------------------------------------------------------
+
+	/*
+	@brief  ファイルにテキストを追加するストリームライターを作成する
+	@return ストリームライター
+	*/
+	Function AppendText() As StreamWriter
+		Return File.AppendText(FullPath)
+	End Function
+
+	/*
+	@brief  ファイルをコピーする(上書きしない)
+	@param  コピー先のファイルパス
+	@return コピー先のファイルを表すFileInfo
+	*/
+	Function CopyTo(destFileName As String) As FileInfo
+		Return CopyTo(destFileName, False)
+	End Function
+
+	/*
+	@brief  ファイルをコピーする
+	@param  コピー先のファイルパス
+	@param  ファイルを上書きするかどうか
+	@return コピー先のファイルを表すFileInfo
+	*/
+	Function CopyTo(destFileName As String, overwrite As Boolean) As FileInfo
+		File.Copy(FullPath, destFileName, overwrite)
+		Return New FileInfo(destFileName)
+	End Function
+
+	/*
+	@brief  ファイルを作成する
+	@return ファイルストリーム
+	*/
+	Function Create() As FileStream
+		Return File.Create(FullPath)
+	End Function
+
+	/*
+	@brief  ファイルを作成し、そのストリームライターを取得する
+	@return ストリームライター
+	*/
+	Function CreateText() As StreamWriter
+		Return New StreamWriter(Create())
+	End Function
+
+/*	Sub Decrypt()
+	End Sub*/
+
+	/*
+	@brief  ファイルを削除する
+	*/
+	Override Sub Delete()
+		File.Delete(FullPath)
+	End Sub
+
+/*	Sub Encrypt()
+	End Sub*/
+
+/*	Function GetAccessControl() As FileSecurity
+	End Function*/
+
+/*	Function GetAccessControl(includeSections As AccessControlSections) As FileScurity
+	End Function*/
+
+	/*
+	@brief  ファイルを移動する
+	@param  移動先のファイルパス
+	*/
+	Sub MoveTo(destFileName As String)
+		File.Move(FullPath, destFileName)
+	End Sub
+
+	/*
+	@brief  ファイルストリームを作成する
+	@param  ファイルモード
+	@return ファイルストリーム
+	*/
+	Function Open(mode As FileMode) As FileStream
+		Return New FileStream(FullPath, mode)
+	End Function
+
+	/*
+	@brief  ファイルストリームを作成する
+	@param  ファイルモード
+	@param  ファイルアクセス
+	@return ファイルストリーム
+	*/
+	Function Open(mode As FileMode, access As FileAccess) As FileStream
+		Return New FileStream(FullPath, mode, access)
+	End Function
+
+	/*
+	@brief  ファイルストリームを作成する
+	@param  ファイルモード
+	@param  ファイルアクセス
+	@param  ファイル共有
+	@return ファイルストリーム
+	*/
+	Function Open(mode As FileMode, access As FileAccess, share As FileShare ) As FileStream
+		Return New FileStream(FullPath, mode, access, share)
+	End Function
+
+	/*
+	@brief  読み取り専用のファイルストリームを作成する
+	@return ファイルストリーム
+	*/
+	Function OpenRead() As FileStream
+		Return Open(FileMode.Open, FileAccess.Read, FileShare.Read)
+	End Function
+
+	/*
+	@brief  読み取り専用のストリームを作成する
+	@param  ファイルパス
+	@return ストリームリーダー
+	*/
+	Function OpenText() As StreamReader
+		Return New StreamReader(FullPath)
+	End Function
+
+	/*
+	@brief  書き込み専用のファイルストリームを作成する
+	@return ファイルストリーム
+	*/
+	Function OpenWrite() As FileStream
+		Return Open(FileMode.Open, FileAccess.Write)
+	End Function
+
+	/*
+	@brief  ファイルを置き換える
+	@param  置き換え先のファイルパス
+	@param  置き換えられるファイルのバックアップを作成するファイルパス
+	*/
+	Function Replace(destinationFileName As String, destinationBackupFileName As String) As FileInfo
+		File.Replace(FullPath, destinationFileName, destinationBackupFileName)
+	End Function
+
+/*	Function Replace(destinationFileName As String, destinationBackupFileName As String, ignoreMetadataErrors As Boolean) As FileInfo
+	End Function*/
+
+/*	Sub SetAccessControl(fileSecurity As FileSecurity)
+	End Sub*/
+
+	/*
+	@brief  インスタンスを文字列で表す
+	@return ファイルパス
+	*/
+	Override Function ToString() As String
+		Return FullPath
+	End Function
+
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/FileStream.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/FileStream.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/FileStream.ab	(revision 506)
@@ -0,0 +1,454 @@
+Namespace System
+Namespace IO
+
+/* ほんとはmiscに入れるかかファイルを分けたほうがいいかもしれないが一先ず実装 */
+Enum FileOptions
+	None = 0
+	Asynchronous = FILE_FLAG_OVERLAPPED
+	DeleteOnClose = FILE_FLAG_DELETE_ON_CLOSE
+	Encrypted = FILE_ATTRIBUTE_ENCRYPTED
+	RandomAccess = FILE_FLAG_RANDOM_ACCESS
+	SequentialScan = FILE_FLAG_SEQUENTIAL_SCAN
+	WriteThrough = FILE_FLAG_WRITE_THROUGH
+End Enum
+
+Class FileStream
+	Inherits Stream
+
+	handle As HANDLE
+
+	/*
+	ファイルハンドルからこれらを取得できれば、これらは入らないが
+	今のところは不明なので自前で実装するしかない
+	*/
+	filePath As String
+	fileMode As DWord
+	fileAccess As DWord
+	fileShare As DWord
+	fileOptions As DWord
+	ownsHandle As Boolean
+	
+	offset As QWord 'オーバーラップドIO用
+
+Public
+	/* コンストラクタ.NETと同じように実装は難しい、一先ず動くものを実装したが変更が必要だと思う */
+	Sub FileStream(path As String, mode As FileMode, access As FileAccess, share As FileShare, options As FileOptions)
+		If ActiveBasic.IsNothing(path) Then
+			Throw New ArgumentNullException("path")
+		ElseIf path.Length = 0 Then
+			Throw New ArgumentException
+		End If
+
+
+		Dim ac = access As DWord
+		Dim sh = share As DWord
+		Dim mo = mode As DWord
+		Dim op = options As DWord
+'		If (Environment.OSVersion.Platform As DWord) <> (PlatformID.Win32NT As DWord) Then 'ToDo: なぜかアクセス違反になる
+			op And= Not FILE_FLAG_OVERLAPPED
+'		End If
+
+		This.handle=CreateFile(ToTCStr(path),ac,sh,ByVal NULL,mo,op,0)
+		If This.handle=INVALID_HANDLE_VALUE Then
+		'エラー処理
+		'Throw ArgumentException
+		'Throw IOException
+		'Throw System.IO.FileNotFoundException 
+			This.handle=0
+			Detail.ThrowWinLastErrorIOException("Failed to open/create file.")
+			Exit Sub
+		End If
+
+		This.filePath = path
+		This.fileMode = mo
+		This.fileAccess = ac
+		This.fileShare = sh
+		This.fileOptions = op
+		This.offset = 0
+		This.ownsHandle = True
+
+		If FileMode.Append = This.fileMode Then
+			Seek(0, SeekOrigin.End)
+		End If
+	End Sub
+	Sub FileStream(path As String, mode As FileMode, access As FileAccess, share As FileShare)
+		This.FileStream(path,mode,access,share,FileOptions.None)
+	End Sub
+	Sub FileStream(path As String, mode As FileMode, access As FileAccess)
+		This.FileStream(path,mode,access,FileShare.None,FileOptions.None)
+	End Sub
+	Sub FileStream(path As String, mode As FileMode)
+		Dim access As FileAccess
+		Select Case mode
+			Case FileMode.Append
+				access=FileAccess.Write
+			Case FileMode.Create
+				access=FileAccess.ReadWrite
+			Case FileMode.CreateNew
+				access=FileAccess.ReadWrite
+			Case FileMode.Open
+				access=FileAccess.ReadWrite
+			Case FileMode.OpenOrCreate
+				access=FileAccess.ReadWrite
+			Case FileMode.Truncate
+				access=FileAccess.Write
+		End Select
+		This.FileStream(path,mode,access,FileShare.None,FileOptions.None)
+	End Sub
+	/*
+	@date 2008/02/26
+	@auther Egtra
+	'不要になったら削除すること
+	*/
+	Sub FileStream(h As HANDLE, access As FileAccess, owns As Boolean)
+		handle = h
+		fileAccess = access As DWord
+		ownsHandle = owns
+	End Sub
+
+Public
+	/*!
+	@brief	ファイルが読み込みに対応しているかを返す
+	*/
+	Override Function CanRead() As Boolean
+		If This.fileAccess And GENERIC_READ Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	/*!
+	@brief	ファイルがシークに対応しているかを返す
+	*/
+	Override Function CanSeek() As Boolean
+		If GetFileType(This.handle)=FILE_TYPE_DISK Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+'	Override Function CanTimeout() As Boolean
+'		/* ファイルがタイムアウトに対応しているかを返す */
+'		Return False /*今のところ対応していないのでFalse*/
+'	End Function*/
+
+	/*!
+	@brief	ファイルが書き込みに対応しているかを返す
+	*/
+	Override Function CanWrite() As Boolean
+		If This.fileAccess And GENERIC_WRITE Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	/*Handle*/
+
+	/*!
+	@brief	ファイルが非同期操作に対応しているかを返す
+	*/
+	Function IsAsync() As Boolean
+		If This.fileOptions And FILE_FLAG_OVERLAPPED /*FileOptions.Asynchronous*/ Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	Override Function Length() As Int64
+		disposedCheck()
+		If This.CanSeek() Then
+			Dim length = VarPtr(Length) As *ULARGE_INTEGER
+			length->LowPart = GetFileSize(This.handle, VarPtr(length->HighPart))
+			If LODWORD(Length) = INVALID_FILE_SIZE Then
+				Dim error = GetLastError()
+				If error <> NO_ERROR Then
+'					Detail.ThrowWinIOException("FileStream.Read: Failed to read.", error)
+				End If
+			End If
+			
+			If Length < 0 Then
+				Debug 'Throw OverflowException
+			End If
+		End If
+	End Function
+
+	Function Name() As String
+		Return This.filePath
+	End Function
+	
+	Override Sub Position(value As Int64)
+		disposedCheck()
+		If This.CanSeek() Then
+			If This.IsAsync() Then
+				offset = value As QWord
+			Else
+				Dim position As LARGE_INTEGER
+				position.LowPart=LODWORD(value)
+				position.HighPart=HIDWORD(value)
+				SetFilePointer(This.handle,position.LowPart,VarPtr(position.HighPart) As *DWord,FILE_BEGIN)
+			End If
+		End If
+	End Sub
+	Override Function Position() As Int64
+		disposedCheck()
+		If This.CanSeek() Then
+			If This.IsAsync() Then
+				Return offset As Int64
+			Else
+				Dim position As LARGE_INTEGER
+				ZeroMemory(VarPtr(position),SizeOf(LARGE_INTEGER))
+				position.LowPart=SetFilePointer(This.handle,position.LowPart,VarPtr(position.HighPart) As *DWord,FILE_CURRENT)
+				Return MAKEQWORD(position.LowPart,position.HighPart) As Int64
+			End If
+		End If
+	End Function
+
+/*	Override Sub ReadTimeout(value As Long)
+		'TODO
+	End Sub
+	Override Function ReadTimeout() As Long
+		'TODO
+	End Function*/
+
+	/* Safe～Handle系の実装は要相談！！ */
+/*	Function SafeFileHandle() As SafeFileHandle
+	End Function*/
+
+	Override Sub WriteTimeout(value As Long)
+		'TODO
+	End Sub
+	Override Function WriteTimeout() As Long
+		'TODO
+	End Function
+	
+
+Public
+	Override Function BeginRead(buffer As *Byte, offset As Long, count As Long, callback As AsyncCallback, state As Object) As System.IAsyncResult
+		If This.IsAsync() Then
+		Else
+			Read(buffer,offset,count)
+		End If
+	End Function
+
+	Override Function BeginWrite(buffer As *Byte, offset As Long, count As Long, callback As AsyncCallback, state As Object) As System.IAsyncResult
+		If This.IsAsync() Then
+		Else
+			Write(buffer,offset,count)
+		End If
+	End Function
+
+/*	CreateObjRef*/
+	
+	Override Function EndRead(asyncResult As System.IAsyncResult) As Long
+		'TODO
+	End Function
+
+	Override Sub EndWrite(asyncResult As System.IAsyncResult)
+		'TODO
+	End Sub
+
+/*	Equals*/
+
+	Override Sub Flush()
+		disposedCheck()
+		Dim ret = FlushFileBuffers(This.handle)
+		If ret = FALSE Then
+'			Detail.ThrowWinLastErrorIOException("FileStream.Read: Failed to read.")
+		End If
+	End Sub
+
+/*	Function GetAccessControl() As FileSecurity
+	FileSecurityの実装がまだできてない。
+	End Function*/
+
+/*	GetLifetimeService*/
+
+/*	Override Function GetType() As TypeInfo
+		Return Super.GetType()
+	End Function*/
+
+/*	InitializeLifetimeService*/
+
+	Sub Lock(position As Int64, length As Int64)
+		disposedCheck()
+		If position < 0 Then
+			Throw New ArgumentOutOfRangeException("FileStream.Lock: An argument is negative value.", New System.Int64(position), "position")
+		ElseIf length < 0 Then
+			Throw New ArgumentOutOfRangeException("FileStream.Lock: An argument is negative value.", New System.Int64(length), "length")
+		End If
+		LockFile(handle, LODWORD(position As QWord), HIDWORD(position As QWord),
+			LODWORD(length As QWord), HIDWORD(length As QWord))
+	End Sub
+
+	Override Function Read(buffer As *Byte, offset As Long, count As Long) As Long
+		disposedCheck()
+		If buffer = 0 Then
+			Throw New ArgumentNullException("FileStream.Read: An argument is null value.", "buffer")
+		ElseIf Not This.CanRead() Then
+			Throw New NotSupportedException("FileStream.Read: This stream is not readable.")
+		End If
+
+		Dim ret As BOOL
+		Dim readBytes As DWord
+		If This.IsAsync() Then
+			Dim overlapped As OVERLAPPED
+			SetQWord(VarPtr(overlapped.Offset), offset)
+			overlapped.hEvent = CreateEvent(0, TRUE, FALSE, 0)
+			If overlapped.hEvent = 0 Then
+				Throw New OutOfMemoryException("FileStream.Read: Failed to create an event object.")
+			End If
+			Try
+				ret = ReadFile(This.handle, VarPtr(buffer[offset]), count, 0, overlapped)
+				If ret = FALSE Then
+					Dim error = GetLastError()
+					If error <> ERROR_IO_PENDING Then
+						Detail.ThrowWinIOException("FileStream.Read: Failed to read.", error)
+					End If
+				End If
+				ret = GetOverlappedResult(This.handle, overlapped, readBytes, TRUE)
+				If ret = FALSE Then
+					Detail.ThrowWinLastErrorIOException("FileStream.Read: Failed to read.")
+				End If
+				offset += Read
+			Finally
+				CloseHandle(overlapped.hEvent)
+			End Try
+		Else
+			ret = ReadFile(This.handle,VarPtr(buffer[offset]),count,VarPtr(readBytes),ByVal NULL)
+			If ret = FALSE Then
+				Detail.ThrowWinLastErrorIOException("FileStream.Read: Failed to read.")
+			End If
+		End If
+		Read = readBytes As Long
+	End Function
+
+	/*!
+	@brief	ストリームの現在位置を移動させる。
+	@param[in] offset	originからの移動量
+	@param[in] origin	移動の基準位置
+	@return	移動後の新しい現在位置
+	@exception DisposedException	既にストリームが閉じられている場合
+	@exception ArgumentException	移動後の位置が負の位置（ファイル先頭より手前）になる場合
+	@exception IOException	その他エラーが発生した場合
+	*/
+	Override Function Seek(offset As Int64, origin As SeekOrigin) As Int64
+		disposedCheck()
+		If This.CanSeek() Then
+			If This.IsAsync() Then
+				Select Case origin
+					Case SeekOrigin.Begin
+						This.offset = offset
+					Case SeekOrigin.Current
+						This.offset += offset
+					Case SeekOrigin.End
+						This.offset = This.Length + offset
+				End Select
+				Seek = This.offset As Int64
+				If Seek < 0 Then
+'					Throw ArgumentException("FileStream.Seek: Cannot seek to negative offset.")
+				End If
+			Else
+				Dim seek = VarPtr(offset) As *ULARGE_INTEGER
+				Dim ret = SetFilePointer(This.handle, seek->LowPart, VarPtr(seek->HighPart), origin As DWord)
+				If ret = INVALID_SET_FILE_POINTER Then
+					Dim error = GetLastError()
+					If error = ERROR_NEGATIVE_SEEK Then
+'						Throw ArgumentException("FileStream.Seek: Cannot seek to negative offset.")
+					ElseIf error <> NO_ERROR Then
+'						Throw Detail.ThrowWinIOException("FileStream.Seek: Failed to seek.", error)
+					End If
+				End If
+				seek->LowPart = ret
+				Seek = offset
+			End If
+		End If
+	End Function
+
+/*	Sub SetAccessControl(fileSecurity As FileSecurity)
+	FileSecurityの実装がまだできてない。
+	End Sub*/
+
+	Override Sub SetLength(value As Int64)
+		disposedCheck()
+		If This.CanWrite() and This.CanSeek() Then
+			If This.IsAsync() Then
+			Else
+				Dim current = This.Position()
+				This.Position(value)
+				Dim ret = SetEndOfFile(This.handle)
+				If ret = FALSE Then
+					Detail.ThrowWinLastErrorIOException("FileStream.Read: Failed to read.")
+				End If
+				Position = current
+			End If
+		End If
+	End Sub
+
+/*	Synchronized*/
+
+	Override Function ToString() As String
+		Return This.Name()
+	End Function
+
+	Sub Unlock(position As Int64, length As Int64)
+		disposedCheck()
+		If position < 0 Then
+			Throw New ArgumentOutOfRangeException("FileStream.Lock: An argument is negative value.", New System.Int64(position), "position")
+		ElseIf length < 0 Then
+			Throw New ArgumentOutOfRangeException("FileStream.Lock: An argument is negative value.", New System.Int64(length), "length")
+		End If
+		Dim ret = UnlockFile(handle, LODWORD(position As QWord), HIDWORD(position As QWord),
+			LODWORD(length As QWord), HIDWORD(length As QWord))
+		If ret = FALSE Then
+			Detail.ThrowWinLastErrorIOException("FileStream.Read: Failed to read.")
+		End If
+	End Sub
+
+	Override Sub Write(buffer As *Byte, offset As Long, count As Long)
+		disposedCheck()
+		If This.CanWrite() Then
+			Dim writeBytes As DWord
+			If This.IsAsync() Then
+				Dim overlapped As OVERLAPPED
+				SetQWord(VarPtr(overlapped.Offset), offset)
+				overlapped.hEvent = CreateEvent(0, TRUE, FALSE, 0)
+				Dim ret = WriteFile(This.handle, VarPtr(buffer[offset]), count, 0, overlapped)
+				If ret <> FALSE Or GetLastError() = ERROR_IO_PENDING Then
+					GetOverlappedResult(This.handle, overlapped, writeBytes, TRUE)
+				End If
+				offset += writeBytes
+				CloseHandle(overlapped.hEvent)
+			Else
+				WriteFile(This.handle, VarPtr(buffer[offset]), count, VarPtr(writeBytes), ByVal NULL)
+			End If
+		End If
+	End Sub
+
+Protected
+	Override Sub Dispose(disposing As Boolean)
+		If handle <> 0 Then
+			Flush()
+			CloseHandle(InterlockedExchangePointer(ByVal VarPtr(handle), NULL))
+		End If
+	End Sub
+
+	Override Function CreateWaitHandle() As System.Threading.WaitHandle
+		Return New System.Threading.AutoResetEvent(False)
+	End Function
+
+Private
+	Sub disposedCheck()
+		If handle = 0 Then
+'			Throw ObjectDisposedException("FileStream: This stream has closed.")
+		End If
+	End Sub
+
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/FileSystemInfo.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/FileSystemInfo.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/FileSystemInfo.ab	(revision 506)
@@ -0,0 +1,294 @@
+Namespace System
+Namespace IO
+
+
+Class FileSystemInfo
+	m_CreationTime As FILETIME
+	m_LastAccessTime As FILETIME
+	m_LastWriteTime As FILETIME
+	m_FileAttributes As FileAttributes
+
+	m_IsFreshed As Boolean
+Protected
+	FullPath As String
+	OriginalPath As String
+Public
+
+	/*!
+	@brief	コンストラクタ
+	@author	OverTaker
+	*/
+	Sub FileSystemInfo()
+		m_IsFreshed = False
+	End Sub
+
+	/*!
+	@brief	デストラクタ
+	@author	OverTaker
+	*/
+	Sub ~FileSystemInfo()
+	End Sub
+
+	/*!
+	@brief	値が等しいか比較する
+	@author	OverTaker
+	@param  比較するオブジェクト
+	@return 等しい場合True,そうでない場合False
+	*/
+	Override Function Equals( object As Object ) As Boolean
+		If This.ToString = object.ToString Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	/*!
+	@brief	文字列で表したオブジェクトを取得する
+	@author	OverTaker
+	@return オブジェクトの文字列(ファイルパス)
+	*/
+	Override Function ToString() As String
+		Return FullPath
+	End Function
+
+	'----------------------------------------------------------------
+	' パブリック プロパティ
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	ファイルの属性を取得する
+	@author	OverTaker
+	@return ファイル属性
+	*/
+	Function Attributes() As FileAttributes
+		If Not m_IsFreshed Then Refresh()
+		Return m_FileAttributes
+	End Function
+
+	/*!
+	@brief	ファイル属性を設定する
+	@author	OverTaker
+	@param  ファイル属性
+	*/
+	Sub Attributes(value As FileAttributes)
+		If Not SetFileAttributes(ToTCStr(FullPath), value) Then
+			Throw New IOException("FileSystemInfo.Attributes: Failed to SetFileAttributes.")
+		End If
+	End Sub
+
+	/*!
+	@brief	ファイル作成日を取得する
+	@author	OverTaker
+	@return ファイルの作成日
+	*/
+	Function CreationTime() As DateTime
+		If Not m_IsFreshed Then Refresh()
+		Return DateTime.FromFileTime(m_CreationTime)
+	End Function
+
+	/*!
+	@brief	ファイル作成日を設定する
+	@author	OverTaker
+	@param  ファイルの作成日
+	*/
+	Sub CreationTime(ByRef value As DateTime)
+		m_CreationTime = value.ToFileTimeUtc()
+		setFileTime()
+	End Sub
+
+	/*!
+	@brief	ファイル作成日をUTC時刻で取得する
+	@author	OverTaker
+	@return ファイルの作成日(UTC)
+	*/
+	Function CreationTimeUtc() As DateTime
+		Return CreationTime.ToUniversalTime()
+	End Function
+
+	/*!
+	@brief	ファイル作成日をUTC時刻で設定する
+	@author	OverTaker
+	@param  ファイルの作成日(UTC)
+	*/
+	Sub CreationTimeUtc(ByRef value As DateTime)
+		CreationTime = value
+	End Sub
+
+	/*!
+	@brief	ファイル最終アクセス日を取得する
+	@author	OverTaker
+	@return ファイルの最終アクセス日
+	*/
+	Function LastAccessTime() As DateTime
+		If Not m_IsFreshed Then Refresh()
+		Return DateTime.FromFileTime(m_LastAccessTime)
+	End Function
+
+	/*!
+	@brief	ファイル最終アクセス日を設定する
+	@author	OverTaker
+	@param  ファイルの最終アクセス日
+	*/
+	Sub LastAccessTime(ByRef value As DateTime)
+		m_LastAccessTime = value.ToFileTimeUtc()
+		setFileTime()
+	End Sub
+
+	/*!
+	@brief	ファイル最終アクセス日をUTC時刻で取得する
+	@author	OverTaker
+	@return ファイルの最終アクセス日(UTC)
+	*/
+	Function LastAccessTimeUtc() As DateTime
+		Return LastAccessTime.ToUniversalTime()
+	End Function
+
+	/*!
+	@brief	ファイル最終アクセス日をUTC時刻で設定する
+	@author	OverTaker
+	@param  ファイルの最終アクセス日(UTC)
+	*/
+	Sub LastAccessTimeUtc(ByRef value As DateTime)
+		LastAccessTime = value
+	End Sub
+
+	/*!
+	@brief	ファイルの最終書き込み日を取得する
+	@author	OverTaker
+	@return ファイルの最終書き込み日
+	*/
+	Function LastWriteTime() As DateTime
+		If Not m_IsFreshed Then Refresh()
+		Return DateTime.FromFileTime(m_LastWriteTime)
+	End Function
+
+	/*!
+	@brief	ファイルの最終書き込み日を設定する
+	@author	OverTaker
+	@param  ファイルの最終書き込み日
+	*/
+	Sub LastWriteTime(ByRef value As DateTime)
+		m_LastWriteTime = value.ToFileTimeUtc()
+		setFileTime()
+	End Sub
+
+	/*!
+	@brief	ファイルの最終書き込み日をUTC時刻で取得する
+	@author	OverTaker
+	@return ファイルの最終書き込み日(UTC)
+	*/
+	Function LastWriteTimeUtc() As DateTime
+		Return LastWriteTime.ToUniversalTime()
+	End Function
+
+	/*!
+	@brief	ファイルの最終書き込み日をUTC時刻で設定する
+	@author	OverTaker
+	@param  ファイルの最終書き込み日(UTC)
+	*/
+	Sub LastWriteTimeUtc(ByRef value As DateTime)
+		LastWriteTime = value
+	End Sub
+
+	/*!
+	@brief	ファイルが存在するかどうかを取得する
+	@author	OverTaker
+	@return ファイルが存在する場合True,そうでない場合False
+	*/
+	Function Exists() As Boolean
+		Return File.Exists(FullPath)
+	End Function
+
+	/*!
+	@brief	ファイル拡張子を取得する
+	@author	OverTaker
+	@return ファイル拡張子
+	*/
+	Function Extension() As String
+		Return Path.GetExtension(FullPath)
+	End Function
+
+	/*!
+	@brief	ファイルパスを取得する
+	@author	OverTaker
+	@return ファイルパス
+	*/
+	Function FullName() As String
+		Return FullPath
+	End Function
+
+	/*!
+	@brief	ファイル名を取得する
+	@author	OverTaker
+	@return ファイル名
+	*/
+	Function Name() As String
+		Return Path.GetFileName(FullPath)
+	End Function
+
+
+	'----------------------------------------------------------------
+	' パブリック メソッド
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	ファイルを削除する
+	@author	OverTaker
+	*/
+	Virtual Sub Delete()
+		If DeleteFile(ToTCStr(FullPath)) = FALSE Then
+			Throw New IOException("FileSystemInfo.Delete: Failed to DeleteFile.")
+		End If
+	End Sub
+
+	/*!
+	@brief  ファイルを最新の情報に更新する
+	@author	OverTaker
+	*/
+	Virtual Sub Refresh()
+		Dim data As WIN32_FIND_DATA
+		Dim hFind = FindFirstFile(ToTCStr(FullPath), data)
+		FindClose(hFind)
+
+		If hFind <> INVALID_HANDLE_VALUE Then
+			m_FileAttributes = New FileAttributes(data.dwFileAttributes As Long, "FileAttributes")
+			m_CreationTime = data.ftCreationTime
+			m_LastAccessTime = data.ftLastAccessTime
+			m_LastWriteTime = data.ftLastWriteTime
+			m_IsFreshed = True
+		Else
+			Throw New IOException("FileSystemInfo.Refresh: Failed to FindFirstFile.")
+		End If
+	End Sub
+
+	
+	'----------------------------------------------------------------
+	' パブリック プライベート
+	'----------------------------------------------------------------
+Private
+
+	/*!
+	@brief  ファイルの時間を更新する
+	@author	OverTaker
+	*/
+	Sub setFileTime()
+		If Not m_IsFreshed Then Refresh()
+		Dim hFile = CreateFile(ToTCStr(FullPath), GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)
+		If hFile = INVALID_HANDLE_VALUE Then
+			Throw New IOException("FileSystemInfo.setFileTime: Failed to CreateFile.")
+			Exit Function
+		End If
+
+		If SetFileTime(hFile, m_CreationTime, m_LastAccessTime, m_LastWriteTime) = False Then
+			CloseHandle(hFile)
+			Throw New IOException("FileSystemInfo.setFileTime: Failed to SetFileTime.")
+		End If
+
+		CloseHandle(hFile)
+	End Sub
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/MemoryStream.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/MemoryStream.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/MemoryStream.ab	(revision 506)
@@ -0,0 +1,418 @@
+
+NameSpace System
+NameSpace IO
+
+Class MemoryStream
+	Inherits Stream
+
+Public
+	/*!
+	@brief	MemoryStreamクラスの新しいインスタンスを初期化します。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Sub MemoryStream()
+		This.writable = True
+		This.resizable = True
+		This.visible = False
+		This.create()
+		This.pointer = This.allocate(0)
+		This.streamLength = 0
+		This.currentPosition = 0
+	End Sub
+
+	/*!
+	@brief	MemoryStreamクラスの新しいインスタンスを初期容量を指定して初期化します。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Sub MemoryStream(capacity As Long)
+		This.writable = True
+		This.resizable = True
+		This.visible = False
+		This.create()
+		This.pointer = This.allocate(capacity)
+		This.streamLength = capacity
+		This.currentPosition = 0
+	End Sub
+
+	/*!
+	@brief	MemoryStreamクラスの新しいインスタンスを指定したバッファに基づいて初期化します。容量を変更することはできません。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Sub MemoryStream(buffer As *Byte, length As Long)
+		This.writable = True
+		This.resizable = False
+		This.visible = False
+		This.create()
+		This.pointer = This.allocate(length)
+		MoveMemory(This.pointer,buffer,length)
+		This.streamLength = length
+		This.currentPosition = 0
+	End Sub
+
+	/*!
+	@brief	MemoryStreamクラスの新しいインスタンスを指定したバッファに基づいて初期化します。容量を変更することはできません。また、書き込みをサポートするかどうかも指定できます。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Sub MemoryStream(buffer As *Byte, length As Long, writable As Boolean)
+		This.writable = writable
+		This.resizable = False
+		This.visible = False
+		This.create()
+		This.pointer = This.allocate(length)
+		MoveMemory(This.pointer,buffer,length)
+		This.streamLength = length
+		This.currentPosition = 0
+	End Sub
+
+	/*!
+	@brief	MemoryStreamクラスの新しいインスタンスを指定したバッファの指定された領域に基づいて初期化します。容量を変更することはできません。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Sub MemoryStream(buffer As *Byte, index As Long, count As Long)
+		This.writable = True
+		This.resizable = False
+		This.visible = False
+		This.create()
+		This.pointer = This.allocate(count)
+		MoveMemory(This.pointer,VarPtr(buffer[index]),count)
+		This.streamLength = count
+		This.currentPosition = 0
+	End Sub
+
+	/*!
+	@brief	MemoryStreamクラスの新しいインスタンスを指定したバッファの指定された領域に基づいて初期化します。容量を変更することはできません。また、書き込みをサポートするかどうかを指定できます。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Sub MemoryStream(buffer As *Byte, index As Long, count As Long, writable As Boolean)
+		This.writable = writable
+		This.resizable = False
+		This.visible = False
+		This.create()
+		This.pointer = This.allocate(count)
+		MoveMemory(This.pointer,VarPtr(buffer[index]),count)
+		This.streamLength = count
+		This.currentPosition = 0
+	End Sub
+
+	/*!
+	@brief	MemoryStreamクラスの新しいインスタンスを指定したバッファの指定された領域に基づいて初期化します。容量を変更することはできません。また、書き込みをサポートするかどうかを指定できます。GetBufferメソッドをサポートするかどうかを指定できます。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Sub MemoryStream(buffer As *Byte, index As Long, count As Long, writable As Boolean, visible As Boolean)
+		This.writable = writable
+		This.resizable = False
+		This.visible = visible
+		This.create()
+		This.pointer = This.allocate(count)
+		MoveMemory(This.pointer,VarPtr(buffer[index]),count)
+		This.streamLength = count
+		This.currentPosition = 0
+	End Sub
+
+	/*!
+	@brief	MemoryStreamクラスのデストラクタです。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Sub ~MemoryStream()
+		This.Close()
+	End Sub
+
+Public
+	/*!
+	@brief	ストリームが読み取りをサポートしているかどうかを示す値を取得します。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Function CanRead() As Boolean
+		If This.pointer Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	/*!
+	@brief	ストリームがシークをサポートしているかどうかを示す値を取得します。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Function CanSeek() As Boolean
+		If This.pointer Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	/*!
+	@brief	ストリームが書き込みをサポートしているかどうかを示す値を取得します。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Function CanWrite() As Boolean
+		If This.pointer Then
+			Return This.writable
+		Else
+			Return False
+		End If
+	End Function
+
+	/*!
+	@brief	ストリームに割り当てるメモリ容量をバイト単位で設定します。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Virtual Sub Capacity(value As Long)
+		If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
+		If value < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Capacity: A capacity is set to negative value.", New System.Int64(value),"Capacity")
+		If value < This.streamLength Then Throw New ArgumentOutOfRangeException("MemoryStream.Capacity: A capacity is less than the current length of the stream.",New System.Int64(value),"Capacity")
+		This.pointer = This.reallocate(This.pointer,value)
+	End Sub
+
+	/*!
+	@brief	ストリームに割り当てられたメモリ容量をバイト単位で取得します。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Virtual Function Capacity() As Long
+		If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
+		Return This.size(This.pointer)
+	End Function
+
+	/*!
+	@brief	ストリームの長さをバイト単位で取得します。Capacityプロパティの値より小さい場合があります。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Function Length() As Int64
+		If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
+		Return This.streamLength
+	End Function
+
+	/*!
+	@brief	ストリームの現在位置を設定します。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Sub Position(value As Int64)
+		If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
+		If value < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Position: The position is set to a negative value.", New System.Int64(value), "Position")
+		If value > Int32.MaxValue() Then Throw New ArgumentOutOfRangeException("MemoryStream.Position: The position is a value greater than MaxValue.", New System.Int64(value), "Position")
+		This.currentPosition = value As Long
+	End Sub
+
+	/*!
+	@brief	ストリームの現在位置を取得します。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Function Position() As Int64
+		If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
+		Return This.currentPosition As Int64
+	End Function
+
+	Override Sub Flush()
+	End Sub
+
+/*	Virtual Function GetBuffer() As Array<Byte>
+		If visible = False Then Return NULL
+		Return p
+	End Function*/
+
+	/*!
+	@brief	ストリームから指定されたバイト数を読み取り、bufferに書き込みます。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Function Read(buffer As *Byte, offset As Long, count As Long) As Long
+		If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
+		If buffer = 0 Then Throw New ArgumentNullException("FileStream.Read: An argument is a null value.", "buffer")
+		If offset < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Read: An argument is a negative value.", New System.Int64(offset), "offset")
+		If count < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Read: An argument is a negative value.", New System.Int64(count), "count")
+		If (This.streamLength - (This.currentPosition + count)) < 0 Then
+			count + = (This.streamLength - (This.currentPosition + count))
+		ElseIf count < 1 Then
+			Return 0
+		End If
+		MoveMemory(VarPtr(buffer[offset]),VarPtr(This.pointer[This.currentPosition]),count)
+		This.currentPosition + = count
+		Return count
+	End Function
+
+	/*!
+	@brief	ストリームから指定された1バイト読み取ります。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Function ReadByte() As Long
+		Dim b As Byte
+		Dim ret = Read(VarPtr(b), 0, 1)
+		If ret <> 0 Then
+			Return b
+		Else
+			Return -1
+		End If
+	End Function
+
+	/*!
+	@brief	ストリーム内の位置を指定した値に設定します。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Function Seek(offset As Int64, origin As SeekOrigin) As Int64
+		If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
+		If offset > Int32.MaxValue() Then Throw New ArgumentOutOfRangeException("MemoryStream.Seek: The offset is a value greater than MaxValue.", New System.Int64(offset), "offset")
+		Select Case origin
+			Case SeekOrigin.Begin
+				If offset < 0 Then Throw New IOException("MemoryStream.Seek: Seeking is attempted before the beginning of the stream.")
+				This.currentPosition = offset As Long
+			Case SeekOrigin.Current
+				Beep(440,10)
+				If (This.currentPosition + offset) < 0 Then Throw New IOException("MemoryStream.Seek: Seeking is attempted before the beginning of the stream.")
+				This.currentPosition += offset As Long
+			Case SeekOrigin.End
+				If (This.streamLength + offset) < 0 Then Throw New IOException("MemoryStream.Seek: Seeking is attempted before the beginning of the stream.")
+				This.currentPosition = (This.streamLength + offset) As Long
+			Case Else
+				Throw New ArgumentException("MemoryStream.Seek: An argument is an invalid SeekOrigin","origin")
+		End Select
+		Return This.currentPosition As Int64
+	End Function
+
+	/*!
+	@brief	ストリームの長さを設定します。メモリ容量を超えては設定できません。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Sub SetLength(value As Int64)
+		If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
+		If This.writable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not writable")
+		If This.resizable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not resizable")
+		If value > This.Capacity() Then Throw New NotSupportedException("MemoryStream.SetLength: This stream length is larger than the current capacity.")
+		If value < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Read: An argument is a negative value.", New System.Int64(value), "value")
+		If value > Int32.MaxValue() Then Throw New ArgumentOutOfRangeException("MemoryStream.SetLength: The length is a value greater than MaxValue.", New System.Int64(value), "value")
+		This.pointer = This.reallocate(This.pointer,value As Long)
+		This.streamLength = value As Long
+	End Sub
+
+	/*!
+	@brief	ストリームにbufferの内容を指定したバイト数書き込みます。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Sub Write(buffer As *Byte, offset As Long, count As Long)
+		If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
+		If This.writable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not writable")
+		If buffer = 0 Then Throw New ArgumentNullException("MemoryStream.Write: An argument is a null value.", "buffer")
+		If offset < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Write: An argument is a negative value.", New System.Int64(offset), "offset")
+		If count < 0 Then Throw New ArgumentOutOfRangeException("MemoryStream.Write: An argument is a negative value.", New System.Int64(count), "count")
+		If count > (This.streamLength - This.currentPosition) Then 
+			If This.resizable = False Then Throw New NotSupportedException("MemoryStream: The current stream is not resizable")
+			If (This.Capacity() - This.currentPosition) < count Then 
+				This.pointer = This.reallocate(This.pointer,This.currentPosition+count)
+			End If
+			This.streamLength = This.currentPosition+count
+		End If
+		MoveMemory(VarPtr(This.pointer[This.currentPosition]),VarPtr(buffer[offset]),count)
+		This.currentPosition + = count
+	End Sub
+
+	/*!
+	@brief	ストリームに1バイト書き込みます。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Sub WriteByte(b As Byte)
+		Write(VarPtr(b), 0, 1)
+	End Sub
+
+/*	Virtual Function ToArray() As Array<Byte>
+		TODO:
+	End Function*/
+
+	/*!
+	@brief	ストリームの内容全体をまるごと別のストリームに書き込みます。
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Virtual Sub WriteTo(stream As Stream)
+		If This.pointer = 0 Then Throw New ObjectDisposedException("MemoryStream: This stream has closed.")
+		If ActiveBasic.IsNothing(stream) Then Throw New ArgumentNullException("MemoryStream.WriteTo: An argument is a null value.", "stream")
+		stream.Write(This.pointer,0,This.Capacity())
+	End Sub
+
+Protected
+
+	/*!
+	@brief	Streamクラスから継承
+	@author	NoWest
+	@date	2008/3/12
+	*/
+	Override Sub Dispose(disposing As Boolean)
+		This.destroy()
+	End Sub
+
+Private
+	/* Heap memory address */
+	pointer As *Byte
+	/* MemoryStream status */
+	writable As Boolean
+	resizable As Boolean
+	visible As Boolean
+	streamLength As Long
+	currentPosition As Long
+
+	/*
+	バッファ管理用のPrivate関数類
+	一応初期設定ではGC_mallocでメモリを確保しています。
+	*/
+	handle As HANDLE
+	Sub create()
+#ifdef NOT_USE_GC
+		This.handle = HeapCreate(0,0,0)
+#endif
+	End Sub
+
+	Sub destroy()
+#ifdef NOT_USE_GC
+		HeapFree(This.handle,0,InterlockedExchangePointer(ByVal VarPtr(This.pointer) As VoidPtr,NULL) As VoidPtr)
+		HeapDestroy(InterlockedExchangePointer(ByVal VarPtr(This.handle) As VoidPtr,NULL) As HANDLE)
+#endif
+	End Sub
+
+	Function allocate(length As SIZE_T) As VoidPtr
+#ifdef NOT_USE_GC
+		Return HeapAlloc(This.handle,HEAP_ZERO_MEMORY,length)
+#else
+		Return GC_malloc_atomic(length)
+#endif
+	End Function
+
+	Function reallocate(p As VoidPtr, length As SIZE_T) As VoidPtr
+#ifdef NOT_USE_GC
+		Return HeapReAlloc(This.handle,HEAP_ZERO_MEMORY,p,This.currentPosition+count)
+#else
+		Return _System_pGC->__realloc(p,length)
+#endif
+	End Function
+
+	Function size(p As VoidPtr) As Long
+#ifdef NOT_USE_GC
+		Return HeapSize(This.handle,0,p)
+#else
+		Dim pmemobj = _System_pGC->GetMemoryObjectPtr(p)
+		Return pmemobj->size
+#endif
+	End Function
+End Class
+
+End NameSpace 'IO
+End NameSpace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/Path.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/Path.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/Path.ab	(revision 506)
@@ -0,0 +1,290 @@
+/*!
+@file	Classes/System/IO/Path.ab
+@brief	ファイルパス文字列を操作する
+@author	OverTaker
+*/
+
+Namespace System
+Namespace IO
+
+Class Path
+Public
+	Static Const AltDirectorySeparatorChar = &H2F As Char '/
+	Static Const DirectorySeparatorChar    = &H5C As Char '\
+	Static Const PathSeparator             = &H3B As Char ';
+	Static Const VolumeSeparatorChar       = &H3A As Char ':
+
+	'----------------------------------------------------------------
+	' パブリック メソッド
+	'----------------------------------------------------------------
+
+	/*
+	@brief  拡張子を変更する
+	@param  パス
+	@param  変更する拡張子(.を含む)
+	@return 拡張子変更後のパス
+	*/
+	Static Function ChangeExtension(path As String, extension As String) As String
+		path = CheckPath(path)
+		If HasExtension(path) Then
+			Return path.Remove(GetExtensionIndex(path)) + extension
+		Else
+			Return path + extension
+		End If
+	End Function
+
+	/*
+	@brief  二つのパスを結合する
+	@param  結合されるパス
+	@param  結合するパス
+	@return パス
+	*/
+	Static Function Combine(path1 As String, path2 As String) As String
+		path1 = CheckPath(path1)
+		path2 = CheckPath(path2)
+		If IsPathRooted(path2) Then
+			Return path2
+		Else
+			If Not path1.EndsWith(DirectorySeparatorChar) Then
+				path1 += Chr$(DirectorySeparatorChar)
+			End If
+			Return path1 + path2
+		End If
+	End Function
+
+	/*
+	@brief  パス文字列からファイル名を取得する
+	@param  パス
+	@return ファイル名
+	*/
+	Static Function GetFileName(path As String) As String
+		path = CheckPath(path)
+		Dim lastSeparatorIndex = GetLastSeparatorIndex(path) As Long
+		If lastSeparatorIndex <> -1 Then
+			Return path.Substring(lastSeparatorIndex + 1)
+		Else
+			Return path
+		End If
+	End Function
+
+	/*
+	@brief  パス文字列からファイル名を拡張子を除いて取得する
+	@param  パス
+	@return 拡張子を除いたファイル名
+	*/
+	Static Function GetFileNameWithoutExtension(path As String) As String
+		path = GetFileName(path)
+		If HasExtension(path) Then
+			Return path.Remove(GetExtensionIndex(path))
+		Else
+			Return path
+		End If
+	End Function
+
+	/*
+	@brief  絶対パスを取得する
+	@param  相対パス
+	@return 絶対パス
+	*/
+	Static Function GetFullPath(path As String) As String
+		path = CheckPath(path)
+		If IsPathRooted(path) Then
+			Return path
+		Else
+			Return Combine(System.Environment.CurrentDirectory, path)
+		End If
+	End Function
+
+	/*
+	@brief  パス文字列から拡張子を取得する
+	@param  パス
+	@return .を含む拡張子
+	*/
+	Static Function GetExtension(path As String) As String
+		path = CheckPath(path)
+		Dim extensionIndex = GetExtensionIndex(path)
+		If extensionIndex <> -1 Then
+			Return path.Substring(extensionIndex)
+		Else
+			Return New String()
+		End If
+	End Function
+
+	/*
+	@brief  ひとつ上のディレクトリを取得する
+	@param  パス
+	@return ディレクトリパス
+	*/
+	Static Function GetDirectoryName(path As String) As String
+		path = CheckPath(path)
+		Dim lastSeparatorIndex = GetLastSeparatorIndex(path)
+		If lastSeparatorIndex = -1 Then
+			Return New String()
+		Else
+			Return path.Substring(0, lastSeparatorIndex)
+		End If
+	End Function
+
+	/*
+	@brief  ルートディレクトリを取得する
+	@param  パス
+	@return ルートディレクトリ
+	*/
+	Static Function GetPathRoot(path As String) As String
+		path = CheckPath(path)
+		If IsPathRooted(path) Then
+			If path.Contains(UniformNamingConventionString) Then
+				Return path.Remove(path.IndexOf(DirectorySeparatorChar,
+													  UniformNamingConventionString.Length) + 1)
+			Else
+				Return path.Remove(3)
+			End If
+		Else
+			Return New String()
+		End If
+	End Function
+
+	/*!
+	@brief	ランダムなファイル名を取得する
+	@param	ファイルパス
+	@return ファイル名
+	手抜き実装
+	*/
+	Static Function GetRandomFileName() As String
+		Randomize
+		Return Str$(((Rnd() * 900000000) As Long) + 10000000)
+	End Function
+
+	/*!
+	@brief	一時ファイルを作成し、ファイルパスを取得する
+	@return パス
+	*/
+	Static Function GetTempFileName() As String
+		Dim tempFileName[ELM(MAX_PATH)] As TCHAR
+		Dim len = WIN32API_GetTempFileName(GetTempPath(), "ABT", 0, tempFileName)
+		If len <> 0 Then
+			Return New String(tempFileName, len As Long)
+		Else
+			Throw New IOException("Path.GetTempFileName: Failed to GetTempFileName.")
+		End If
+	End Function
+
+
+	/*
+	@brief  システムの一時フォルダのパス取得する
+	@return パス
+	*/
+	Static Function GetTempPath() As String
+		Dim size = WIN32API_GetTempPath(0, 0)
+		Dim buf = New Text.StringBuilder(size)
+		buf.Length = size
+		Dim len = WIN32API_GetTempPath(size, StrPtr(buf))
+		If (len > size) or len = 0 Then
+			Throw New IOException("Path.GetTempPath: Failed to GetTempPath.")
+		Else
+			buf.Length = len
+			Return buf.ToString
+		End If
+	End Function
+
+
+	/*
+	@brief  パスに拡張子が含まれるかどうか
+	@param  パス
+	@retval True  含まれる
+	@retval False 含まれない
+	*/
+	Static Function HasExtension(path As String) As Boolean
+		path = CheckPath(path)
+		Return GetExtensionIndex(path) <> -1
+	End Function
+
+	/*
+	@brief  パスが絶対パスか取得する
+	@param  パス
+	@retval True  絶対パス
+	@retval False 相対パス
+	*/
+	Static Function IsPathRooted(path As String) As Boolean
+		path = CheckPath(path)
+		Return path.StartsWith(UniformNamingConventionString) _
+			or path.Contains(VolumeSeparatorChar) _
+			or path.StartsWith(DirectorySeparatorChar)
+	End Function
+
+Private
+	Static Const ExtensionSeparatorChar = &H2E As Char
+	Static Const InvalidPathChars = Ex"\q<>|\0\t" As String
+	Static Const UniformNamingConventionString = "\\" As String
+
+	'----------------------------------------------------------------
+	' プライベート　メソッド
+	'----------------------------------------------------------------
+
+	/*
+	@brief  パスに不正な文字が含まれていないか調べる。
+	@param  パス
+	@return 正しく直されたパス
+	パス末端にディレクトリ区切り記号があった場合除去する
+	..\などが含まれるパスについては未実装
+	*/
+	Static Function CheckPath(path As String) As String
+		path = path.Replace(AltDirectorySeparatorChar, DirectorySeparatorChar)
+
+		Dim i As Long
+		For i = 0 To ELM(InvalidPathChars.Length)
+			If path.Contains(InvalidPathChars[i]) Then
+				Throw New IOException("Path.CheckPath: The path contains invalidPathChars.")
+			End If
+		Next
+
+		Dim continuousIndex = path.IndexOf("\\", 1)
+		While continuousIndex <> -1
+			path = path.Remove(continuousIndex, 1)
+			continuousIndex = path.IndexOf("\\", continuousIndex)
+		Wend
+
+		If path.EndsWith(DirectorySeparatorChar) Then
+			Return path.Remove(path.Length - 1)
+		Else
+			Return path
+		End If
+	End Function
+
+	/*
+	@brief  パスの最も後ろにあるディレクトリ区切り記号の位置を取得する
+	@param  パス
+	@return インデックス
+	*/
+	Static Function GetLastSeparatorIndex(path As String) As Long
+		Return System.Math.Max(path.LastIndexOf(DirectorySeparatorChar),
+							   path.LastIndexOf(AltDirectorySeparatorChar)) As Long
+	End Function
+
+	/*
+	@brief  拡張子の位置を取得する。
+	@param  パス
+	@return インデックス
+	*/
+	Static Function GetExtensionIndex(path As String) As Long
+		Dim extensionIndex = path.LastIndexOf(ExtensionSeparatorChar) As Long
+		If extensionIndex > GetLastSeparatorIndex(path) Then
+			Return extensionIndex
+		Else
+			Return -1
+		End If
+	End Function
+End Class
+
+'メソッドと名前が被るAPI
+Function WIN32API_GetTempPath(nBufferLength As DWord, lpBuffer As PTSTR) As DWord
+	Return GetTempPath(nBufferLength, lpBuffer)
+End Function
+
+Function WIN32API_GetTempFileName (pPathName As PCTSTR, pPrefixString As PCTSTR, uUnique As DWord, pTempFileName As PTSTR) As DWord
+	Return GetTempFileName(pPathName, pPrefixString, uUnique, pTempFileName)
+End Function
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/Stream.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/Stream.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/Stream.ab	(revision 506)
@@ -0,0 +1,89 @@
+Namespace System
+Namespace IO
+
+
+Class Stream
+	Implements System.IDisposable
+
+Public 'Protected
+	Sub Stream()
+	End Sub
+Public
+	Virtual Sub ~Stream()
+		This.Dispose(False)
+	End Sub
+Public
+	Abstract Function CanRead() As Boolean
+	Abstract Function CanSeek() As Boolean
+
+	Virtual Function CanTimeout() As Boolean
+		Return True
+	End Function
+
+	Abstract Function CanWrite() As Boolean
+	Abstract Function Length() As Int64
+	Abstract Sub Position(value As Int64)
+	Abstract Function Position() As Int64
+
+	Virtual Sub ReadTimeout(value As Long)
+		' Throw InvalidOperationException
+	End Sub
+
+	Virtual Function ReadTimeout() As Long
+		' Throw InvalidOperationException
+	End Function
+
+	Virtual Sub WriteTimeout(value As Long)
+		' Throw InvalidOperationException
+	End Sub
+
+	Virtual Function WriteTimeout() As Long
+		' Throw InvalidOperationException
+	End Function
+
+Public
+	Virtual Function BeginRead(buffer As *Byte, offset As Long, count As Long, callback As AsyncCallback, state As Object) As System.IAsyncResult
+		Read(buffer,offset,count)
+	End Function
+	Virtual Function BeginWrite(buffer As *Byte, offset As Long, count As Long, callback As AsyncCallback, state As Object) As System.IAsyncResult
+		Write(buffer,offset,count)
+	End Function
+	Sub Close()
+		Dispose(True)
+	End Sub
+	Sub Dispose()
+		Dispose(True)
+	End Sub
+	Virtual Function EndRead(ByRef asyncResult As System.IAsyncResult) As Long
+	End Function
+	Virtual Sub EndWrite(ByRef asyncResult As System.IAsyncResult)
+	End Sub
+	Abstract Sub Flush()
+	Abstract Function Read(buffer As *Byte, offset As Long, count As Long) As Long
+
+	Virtual Function ReadByte() As Long
+		Dim b As Byte
+		Dim ret = Read(VarPtr(b), 0, 1)
+		If ret <> 0 Then
+			Return b
+		Else
+			Return -1
+		End If
+	End Function
+
+	Abstract Function Seek(offset As Int64, origin As SeekOrigin) As Int64
+	Abstract Sub SetLength(value As Int64)
+	Abstract Sub Write(buffer As *Byte, offset As Long, count As Long)
+	Virtual Sub WriteByte(b As Byte)
+		Write(VarPtr(b), 0, 1)
+	End Sub
+Protected
+	Virtual Sub Dispose(disposing As Boolean)
+	End Sub
+	Virtual Function CreateWaitHandle() As System.Threading.WaitHandle
+	End Function
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/StreamReader.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/StreamReader.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/StreamReader.ab	(revision 506)
@@ -0,0 +1,159 @@
+'Classes/System/IO/StreamReader.ab
+
+Namespace System
+Namespace IO
+
+/*
+@brief ストリームから読み取りを行うTextReaderの実装。
+@date 2008/02/25
+@auther Egtra
+*/
+Class StreamReader
+	Inherits TextReader
+Public
+	/*
+	@date 2008/02/25
+	@auther Egtra
+	*/
+	Sub StreamReader(path As String)
+		init(New FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
+	End Sub
+
+	/*
+	@date 2008/02/25
+	@auther Egtra
+	*/
+	Sub StreamReader(stream As Stream)
+		init(stream)
+	End Sub
+
+	/*
+	@date 2008/02/25
+	@auther Egtra
+	*/
+	Override Function Peek() As Long
+		If cur = last Then
+			last = s.Read(buf, 0, size)
+			cur = 0
+			If last = 0 Then
+				Peek = -1
+				Exit Function
+			End If
+		End If
+		Peek = buf[cur]
+	End Function
+
+	/*
+	@date 2008/02/25
+	@auther Egtra
+	*/
+	Override Function Read() As Long
+		Read = Peek()
+		If Read <> -1 Then
+			cur++
+		End If
+	End Function
+
+	/*
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Override Function ReadToEnd() As String
+		Dim sb = New Text.StringBuilder(65536)
+		sb.Append(buf, cur, last - cur)
+		Do
+			Dim read = Read(buf, 0, size)
+			sb.Append(buf, 0, read)
+			If read < size Then
+				ReadToEnd = sb.ToString
+				Exit Function
+			End If
+		Loop
+	End Function
+
+Protected
+	/*
+	@date 2008/02/25
+	@auther Egtra
+	*/
+	Override Sub Dispose(disposing As Boolean)
+		If disposing Then
+			If Not ActiveBasic.IsNothing(s) Then
+				s.Dispose(True)
+			End If
+		End If
+		s = Nothing
+		size = 0
+		cur = 0
+		last = 0
+	End Sub
+
+	/*
+	@date 2008/02/25
+	@auther Egtra
+	*/
+	Override Function ReadImpl(buffer As *Char, index As Long, count As Long) As Long
+		Dim n = last - cur
+		If count <= n Then
+			ReadImpl = ReadFromBuffer(buffer, index, count)
+			Exit Function
+		End If
+		Dim p = VarPtr(buffer[index])
+		ReadImpl = ReadFromBuffer(p, 0, n)
+		If ReadImpl = count Then 'バッファの中身で足りた場合
+			Exit Function
+		End If
+		p = VarPtr(p[n])
+		count -= n
+		If count > size Then
+			n = (count \ size) * size 'sizeの倍数分だけは直接bufferへ読み込ませる
+			Dim read = s.Read(p, 0, n)
+			If read = 0 Then 'EOF
+				Exit Function
+			End If
+			p = VarPtr(p[n])
+			ReadImpl += n
+			count -= n
+		End If
+		last = s.Read(buffer, 0, size)
+		cur = 0
+		If last = 0 Then 'EOF
+			Exit Function
+		End If
+		ReadImpl += ReadFromBuffer(p, 0, Math.Min(last, count))
+	End Function
+
+Private
+	/*
+	@date 2008/02/25
+	@auther Egtra
+	*/
+	Sub init(str As Stream)
+		s = str
+		size = 4096
+		last = 0
+		cur = 0
+		buf = GC_malloc(size)
+	End Sub
+
+	/**
+	@brief バッファの中身から読み取る。
+	@date 2008/02/25
+	@auther Egtra
+	文字数が足りなくても、元のストリームまで読みには行かない。
+	*/
+	Function ReadFromBuffer(p As *Char, index As Long, count As Long) As Long
+		memcpy(VarPtr(p[index]), VarPtr(buf[cur]), count * SizeOf (Char))
+		cur += count
+		ReadFromBuffer = count
+	End Function
+
+	s As Stream
+	size As Long
+	cur As Long
+	last As Long '中身の終わり
+	buf As *SByte '暫定
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/StreamWriter.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/StreamWriter.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/StreamWriter.ab	(revision 506)
@@ -0,0 +1,124 @@
+/*
+@file Include/Classes/System/IO/StreamWriter.ab
+@brief StreamWriterの実装。
+*/
+
+Namespace System
+Namespace IO
+
+/*
+@brief ストリームへの書き込みを行うTextWriterの派生。
+@date 2008/03/09
+@auther Egtra
+*/
+Class StreamWriter
+	Inherits TextWriter
+Public
+	/*
+	@date 2008/03/09
+	@auther Egtra
+	*/
+	Sub StreamWriter(path As String)
+		init(New FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None))
+	End Sub
+
+	/*
+	@date 2008/03/09
+	@auther Egtra
+	*/
+	Sub StreamWriter(stream As Stream)
+		init(stream)
+	End Sub
+
+	Override Sub Flush()
+		Dim len = buf.Length
+		If len > 0 Then
+			s.Write(StrPtr(buf) As *Byte, 0, len)
+			buf.Length = 0
+		End If
+	End Sub
+
+	Override Sub Write(str As String)
+		buf.Append(str)
+		Dim len = buf.Length
+		If len >= 2048 Then
+			s.Write(StrPtr(buf) As *Byte, 0, len)
+			buf.Length = 0
+		End If
+	End Sub
+
+	Override Sub Write(x As Boolean)
+		buf.Append(x)
+	End Sub
+	
+	Override Sub Write(x As Char)
+		buf.Append(x)
+	End Sub
+
+	Override Sub Write(x As Byte)
+		buf.Append(x)
+	End Sub
+#ifdef UNICODE
+	Override Sub Write(x As SByte)
+		buf.Append(x)
+	End Sub
+#else
+	Override Sub Write(x As Word)
+		buf.Append(x)
+	End Sub
+#endif
+	Override Sub Write(x As Integer)
+		buf.Append(x)
+	End Sub
+
+	Override Sub Write(x As DWord)
+		buf.Append(x)
+	End Sub
+
+	Override Sub Write(x As Long)
+		buf.Append(x)
+	End Sub
+
+	Override Sub Write(x As QWord)
+		buf.Append(x)
+	End Sub
+
+	Override Sub Write(x As Int64)
+		buf.Append(x)
+	End Sub
+
+	Override Sub Write(x As Single)
+		buf.Append(x)
+	End Sub
+
+	Override Sub Write(x As Double)
+		buf.Append(x)
+	End Sub
+
+	Override Sub Write(x As Object)
+		Write(x.ToString)
+	End Sub
+
+Protected
+	Override Sub Dispose(disposing As Boolean)
+		If disposing Then
+			Dim len = buf.Length
+			If len > 0 Then
+				s.Write(StrPtr(buf) As *Byte, 0, len)
+			End If
+			s.Dispose()
+		End If
+	End Sub
+
+Private
+	Sub init(stream As Stream)
+		s = stream
+		buf = New System.Text.StringBuilder(4096)
+	End Sub
+
+	buf As Text.StringBuilder
+	s As System.IO.Stream
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/StringReader.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/StringReader.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/StringReader.ab	(revision 506)
@@ -0,0 +1,88 @@
+'Classes/System/IO/StringReader.ab
+
+Namespace System
+Namespace IO
+
+/*
+@brief Stringから読み込みを行うTextReaderの実装。
+@date 2008/02/26
+@auther Egtra
+*/
+Class StringReader
+	Inherits TextReader
+Public
+	/*
+	@brief コンストラクタ
+	@date 2008/02/26
+	@auther Egtra
+	@param str 読み取る基となる文字列。
+	@exception ArgumentNullException strがNothingのとき。
+	*/
+	Sub StringReader(str As String)
+		If ActiveBasic.IsNothing(str) Then
+			Throw New ArgumentNullException("str")
+		End If
+		s = str
+		i = 0
+	End Sub
+
+	/*
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Override Function Peek() As Long
+		If i = s.Length Then
+			Peek = -1
+		Else
+			Peek = s[i]
+		End If
+	End Function
+
+	/*
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Override Function Read() As Long
+		If i = s.Length Then
+			Read = -1
+		Else
+			Read = s[i]
+			i++
+		End If
+	End Function
+
+	/*
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Override Function ReadToEnd() As String
+		ReadToEnd = s.Substring(i)
+		i = s.Length
+	End Function
+
+Protected
+	/*
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Override Sub Dispose(disposing As Boolean)
+		s = Nothing
+		i = 0
+	End Sub
+
+	/*
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Override Function ReadImpl(buffer As *Char, index As Long, count As Long) As Long
+		ReadImpl = Math.Min(count, s.Length - i)
+		ActiveBasic.Strings.ChrCopy(VarPtr(buffer[index]) As *Char, (StrPtr(s) + i * SizeOf (Char)) As *Char, ReadImpl As SIZE_T) 'ToDo: ポインタに対する+演算
+	End Function
+
+Private
+	s As String
+	i As Long
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/TextReader.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/TextReader.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/TextReader.ab	(revision 506)
@@ -0,0 +1,186 @@
+NameSpace System
+NameSpace IO
+
+Class TextReader
+	Implements System.IDisposable
+
+Public
+'Protected
+	Sub TextReader()
+	End Sub
+Public
+	Virtual Sub ~TextReader()
+		Dispose(False)
+	End Sub
+
+'	Static Null = StreamReader.Null As TextReader
+
+Public
+	Sub Close()
+		Dispose(True)
+	End Sub
+
+	Sub Dispose()
+		Dispose(True)
+	End Sub
+
+	Abstract Function Peek() As Long
+	Abstract Function Read() As Long
+	/*
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Function Read(buffer As *Char, index As Long, count As Long) As Long
+		If buffer = 0 Then
+		ElseIf index < 0 Then
+		ElseIf count < 0 Then
+		End If
+		Read = ReadImpl(buffer, index, count)
+	End Function
+
+	/*
+	@date 2008/02/26
+	@auther Egtra
+	@retval Nothing EOFに達しているとき
+	@retval 有効なStringインスタンス 読み取った1行
+	*/
+	Virtual Function ReadLine() As String
+		If Peek() = -1 Then
+			Exit Function
+		End If
+		Dim sb = New Text.StringBuilder(256)
+		Do
+			Dim ch = Read()
+			If ch = &h0D Then
+				If Peek() = &h0A Then
+					Read() 'CR LFの場合
+				End If
+				Exit Do
+			End If
+			Select Case ch
+				Case -1 'EOF
+					Exit Do
+				Case &h0A 'LF
+					Exit Do
+				Case &h0B 'VT
+					Exit Do
+				Case &h0C 'FF
+					Exit Do
+				Case &h0D 'CR
+					Exit Do
+'				Case &h85 'NEL
+'					Exit Do
+'				Case &h2028 'LS
+'					Exit Do
+'				Case &h2029 'PS
+'					Exit Do
+			End Select
+			sb.Append(ch As Char) 'ToDo キャスト不要にすべきというチケットを書くこと
+		Loop
+		ReadLine = sb.ToString
+	End Function
+	/*
+	@brief 現在位置からストリームの終わりまで読み込む。
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Virtual Function ReadToEnd() As String
+		Dim sb = New Text.StringBuilder(8192)
+		Do
+			Dim ch = Read()
+			If ch = -1 Then
+				ReadToEnd = sb.ToString
+				Exit Function
+			End If
+			sb.Append(ch As Char)
+		Loop
+	End Function
+
+	Static Function Synchronized(reader As TextReader) As TextReader
+		Synchronized = New Detail.SynchronizedTextReader(reader)
+	End Function
+
+Protected
+	Virtual Sub Dispose(disposing As Boolean)
+	End Sub
+
+	/*
+	@date 2008/02/26
+	@auther Egtra
+	*/
+	Virtual Function ReadImpl(buffer As *Char, index As Long, count As Long) As Long
+		Dim i As Long
+		Dim p = VarPtr(buffer[index])
+		For i = 0 To ELM(count)
+			Dim c = Read()
+			If c = -1 Then
+				ReadImpl = i - 1
+				Exit Function
+			Else
+				p[i] = c As Char
+			End If
+		Next
+		ReadImpl = i - 1
+	End Function
+End Class
+
+Namespace Detail
+
+Class SynchronizedTextReader
+	Inherits TextReader
+Public
+	Sub SynchronizedTextReader(reader As TextReader)
+		cs = New ActiveBasic.Windows.CriticalSection
+		base = reader
+	End Sub
+
+	Override Function Peek() As Long
+'		Using lock = cs.Lock
+			Peek = base.Peek
+'		End Using
+	End Function
+
+	Override Function Read() As Long
+'		Using lock = cs.Lock
+			Read = base.Read
+'		End Using
+	End Function
+
+	Override Function ReadLine() As String
+'		Using lock = cs.Lock
+			ReadLine = base.ReadLine
+'		End Using
+	End Function
+
+	Override Function ReadToEnd() As String
+'		Using lock = cs.Lock
+			ReadToEnd = base.ReadToEnd
+'		End Using
+	End Function
+
+Protected
+	Override Sub Dispose(disposing As Boolean)
+		Dim s = Nothing As Stream
+		SetPointer(VarPtr(s) As *VoidPtr, InterlockedExchangePointer(ByVal VarPtr(base) As *VoidPtr, 0))
+		If disposing Then
+			If Not ActiveBasic.IsNothing(s) Then
+				s.Dispose()
+			End If
+			cs.Dispose()
+		End If
+	End Sub
+
+	Override Function ReadImpl(buffer As *Char, index As Long, count As Long) As Long
+'		Using lock = cs.Lock
+			ReadImpl = base.ReadImpl(buffer, index, count)
+'		End Using
+	End Function
+Private
+	cs As ActiveBasic.Windows.CriticalSection
+	base As TextReader
+End Class
+
+End Namespace
+
+End NameSpace
+End NameSpace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/TextWriter.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/TextWriter.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/TextWriter.ab	(revision 506)
@@ -0,0 +1,187 @@
+'Classes/System/IO/TextWriter.ab
+
+Namespace System
+Namespace IO
+
+/*
+@brief テキスト書き込みの抽象基底クラス
+@date 2007/03/05
+@auther Egtra
+*/
+Class TextWriter
+Public
+	Virtual Sub ~TextWriter()
+		Dispose(False)
+	End Sub
+
+'	Static Null = StreamWriter.Null As StreamWriter
+
+Public
+	Sub Close()
+		Dispose(True)
+	End Sub
+
+	Sub Dispose()
+		Dispose(True)
+	End Sub
+
+	Sub TextWriter()
+		newLine = Environment.NewLine
+	End Sub
+
+	Virtual Sub Flush()
+	End Sub
+
+	Abstract Sub Write(s As String)
+	Virtual Sub Write(x As Boolean)
+		Write(Str$(x))
+	End Sub
+	
+	Virtual Sub Write(x As Char)
+		Write(Chr$(x))
+	End Sub
+
+	Virtual Sub Write(x As Byte)
+		Write(Str$(x))
+	End Sub
+#ifdef UNICODE
+	Virtual Sub Write(x As SByte)
+		Write(Str$(x))
+	End Sub
+#else
+	Virtual Sub Write(x As Word)
+		Write(Str$(x))
+	End Sub
+#endif
+	Virtual Sub Write(x As Integer)
+		Write(Str$(x))
+	End Sub
+
+	Virtual Sub Write(x As DWord)
+		Write(Str$(x))
+	End Sub
+
+	Virtual Sub Write(x As Long)
+		Write(Str$(x))
+	End Sub
+
+	Virtual Sub Write(x As QWord)
+		Write(Str$(x))
+	End Sub
+
+	Virtual Sub Write(x As Int64)
+		Write(Str$(x))
+	End Sub
+
+	Virtual Sub Write(x As Single)
+		Write(Str$(x))
+	End Sub
+
+	Virtual Sub Write(x As Double)
+		Write(Str$(x))
+	End Sub
+
+	Virtual Sub Write(x As Object)
+		Write(x.ToString)
+	End Sub
+
+	Sub WriteLine()
+		Write(newLine)
+	End Sub
+
+	Sub WriteLine(s As String)
+		Write(s)
+		WriteLine()
+	End Sub
+
+	Sub WriteLine(x As Boolean)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+	
+	Sub WriteLine(x As Char)
+		Write(Chr$(x))
+		WriteLine()
+	End Sub
+
+	Sub WriteLine(x As Byte)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+#ifdef UNICODE
+	Sub WriteLine(x As SByte)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+#else
+	Sub WriteLine(x As Word)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+#endif
+	Sub WriteLine(x As Integer)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+
+	Sub WriteLine(x As DWord)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+
+	Sub WriteLine(x As Long)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+
+	Sub WriteLine(x As QWord)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+
+	Sub WriteLine(x As Int64)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+
+	Sub WriteLine(x As Single)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+
+	Sub WriteLine(x As Double)
+		Write(Str$(x))
+		WriteLine()
+	End Sub
+
+	Sub WriteLine(x As Object)
+		Write(x.ToString)
+		WriteLine()
+	End Sub
+
+	/*
+	@brief 改行文字の設定
+	@date 2007/03/05
+	@auther Egtra
+	*/
+	Sub NewLine(n As String)
+		newLine = n
+	End Sub
+	/*
+	@brief 改行文字の取得
+	@date 2007/03/05
+	@auther Egtra
+	*/
+	Function NewLine() As String
+	End Function
+
+Protected
+	Virtual Sub Dispose(disposing As Boolean)
+	End Sub
+
+Private
+	newLine As String
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/IO/misc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/IO/misc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/IO/misc.ab	(revision 506)
@@ -0,0 +1,17 @@
+
+Namespace System
+Namespace IO
+
+Enum SeekOrigin
+	Begin = FILE_BEGIN
+	Current = FILE_CURRENT
+	End = FILE_END
+End Enum
+
+Enum SearchOption
+	AllDirectories
+	TopDirectoryOnly
+End Enum
+
+End Namespace 'IO
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Math.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Math.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Math.ab	(revision 506)
@@ -0,0 +1,598 @@
+' Classes/System/Math.ab
+
+#require <Classes/ActiveBasic/Math/Math.ab>
+
+Namespace System
+
+Class Math
+Public
+	Static Function E() As Double
+		return 2.7182818284590452354
+	End Function
+/*
+	Static Function PI() As Double
+		return _System_PI
+	End Function
+*/
+	Static Function Abs(value As Double) As Double
+		SetQWord(VarPtr(Abs), GetQWord(VarPtr(value)) And &h7fffffffffffffff)
+	End Function
+
+	Static Function Abs(value As Single) As Single
+		SetDWord(VarPtr(Abs), GetDWord(VarPtr(value)) And &h7fffffff)
+	End Function
+
+	Static Function Abs(value As SByte) As SByte
+		If value<0 then
+			return -value
+		Else
+			return value
+		End If
+	End Function
+
+	Static Function Abs(value As Integer) As Integer
+		If value<0 then
+			return -value
+		Else
+			return value
+		End If
+	End Function
+
+	Static Function Abs(value As Long) As Long
+		If value<0 then
+			return -value
+		Else
+			return value
+		End If
+	End Function
+
+	Static Function Abs(value As Int64) As Int64
+		If value<0 then
+			return -value
+		Else
+			return value
+		End If
+	End Function
+
+	Static Function Acos(x As Double) As Double
+		If x < -1 Or x > 1 Then
+			Acos = ActiveBasic.Math.Detail.GetNaN()
+		Else
+			Acos = _System_HalfPI - Asin(x)
+		End If
+	End Function
+
+	Static Function Asin(x As Double) As Double
+		If x < -1 Or x > 1 Then
+			Asin = ActiveBasic.Math.Detail.GetNaN()
+		Else
+			Asin = Math.Atan(x / Sqrt(1 - x * x))
+		End If
+	End Function
+
+	Static Function Atan(x As Double) As Double
+		If ActiveBasic.Math.IsNaN(x) Then
+			Atan = x
+			Exit Function
+		ElseIf ActiveBasic.Math.IsInf(x) Then
+			Atan = ActiveBasic.Math.CopySign(_System_PI, x)
+			Exit Function
+		End If
+		Dim i As Long
+		Dim sgn As Long
+		Dim dbl = 0 As Double
+
+		If x > 1 Then
+			sgn = 1
+			x = 1 / x
+		ElseIf x < -1 Then
+			sgn = -1
+			x = 1 / x
+		Else
+			sgn = 0
+		End If
+
+		For i = _System_Atan_N To 1 Step -1
+			Dim t As Double
+			t = i * x
+			dbl = (t * t) / (2 * i + 1 + dbl)
+		Next
+
+		If sgn > 0 Then
+			Atan = _System_HalfPI - x / (1 + dbl)
+		ElseIf sgn < 0 Then
+			Atan = -_System_HalfPI - x / (1 + dbl)
+		Else
+			Atan = x / (1 + dbl)
+		End If
+	End Function
+
+	Static Function Atan2(y As Double, x As Double) As Double
+		If x = 0 Then
+			Atan2 = Sgn(y) * _System_HalfPI
+		Else
+			Atan2 = Atn(y / x)
+			If x < 0 Then
+				Atan2 += ActiveBasic.Math.CopySign(_System_PI, y)
+			End If
+		End If
+	End Function
+
+	Static Function BigMul(x As Long, y As Long) As Int64
+		Return (x As Int64) * y
+	End Function
+
+	Static Function Ceiling(x As Double) As Long
+		Ceiling = Floor(x)
+		If Ceiling <> x Then
+			Ceiling++
+		End If
+	End Function
+
+	Static Function Cos(x As Double) As Double
+		If ActiveBasic.Math.IsNaN(x) Then
+			Return x
+		ElseIf ActiveBasic.Math.IsInf(x) Then
+			Return ActiveBasic.Math.Detail.GetNaN()
+		End If
+
+		Return Math.Sin((_System_HalfPI - Math.Abs(x)) As Double)
+	End Function
+
+	Static Function Cosh(value As Double) As Double
+		Dim t = Math.Exp(value)
+		return (t + 1 / t) * 0.5
+	End Function
+
+	Static Function DivRem(x As Long, y As Long, ByRef ret As Long) As Long
+		ret = x Mod y
+		return x \ y
+	End Function
+
+	Static Function DivRem(x As Int64, y As Int64, ByRef ret As Int64) As Int64
+		DivRem = x \ y
+		ret = x - (DivRem) * y
+	End Function
+
+	'Equals
+
+	Static Function Exp(x As Double) As Double
+		If ActiveBasic.Math.IsNaN(x) Then
+			Return x
+		Else If ActiveBasic.Math.IsInf(x) Then
+			If 0 > x Then
+				Return 0
+			Else
+				Return x
+			End If
+		End If
+		Dim k As Long
+		If x >= 0 Then
+			k = Fix(x / _System_LOG2 + 0.5)
+		Else
+			k = Fix(x / _System_LOG2 - 0.5)
+		End If
+
+		x -= k * _System_LOG2
+
+		Dim x2 = x * x
+		Dim w = x2 / 22
+
+		Dim i = 18
+		While i >= 6
+			w = x2 / (w + i)
+			i -= 4
+		Wend
+
+		Return ldexp((2 + w + x) / (2 + w - x), k)
+	End Function
+
+	Static Function Floor(value As Double) As Long
+		Return Int(value)
+	End Function
+
+	Static Function IEEERemainder(x As Double, y As Double) As Double
+		If y = 0 Then Return ActiveBasic.Math.Detail.GetNaN()
+		Dim q = x / y
+		If q <> Int(q) Then
+			If q + 0.5 <> Int(q + 0.5) Then
+				q = Int(q + 0.5)
+			ElseIf Int(q + 0.5) = Int(q * 2 + 1) / 2 Then
+				q = Int(q + 0.5)
+			Else
+				q = Int(q - 0.5)
+			End If
+		End If
+		If x - y * q = 0 Then
+			If x > 0 Then
+				Return +0
+			Else
+				Return -0
+			End If
+		Else
+			Return x-y*q
+		End If
+	End Function
+
+	Static Function Log(x As Double) As Double
+		If x = 0 Then
+			Log = ActiveBasic.Math.Detail.GetInf(True)
+		ElseIf x < 0 Or ActiveBasic.Math.IsNaN(x) Then
+			Log = ActiveBasic.Math.Detail.GetNaN()
+		ElseIf ActiveBasic.Math.IsInf(x) Then
+			Log = x
+		Else
+			Dim tmp = x * _System_InverseSqrt2
+			Dim p = VarPtr(tmp) As *QWord
+			Dim m = GetQWord(p) And &h7FF0000000000000
+			Dim k = ((m >> 52) As DWord) As Long - 1022
+			SetQWord(p, m + &h0010000000000000)
+			x /= tmp
+			Log = _System_LOG2 * k + ActiveBasic.Math.Detail.Log1p(x - 1)
+		End If
+	End Function
+
+	Static Function Log10(x As Double) As Double
+		Return Math.Log(x) * _System_InverseLn10
+	End Function
+
+	Static Function Max(value1 As Byte, value2 As Byte) As Byte
+		If value1>value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Max(value1 As SByte, value2 As SByte) As SByte
+		If value1>value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Max(value1 As Word, value2 As Word) As Word
+		If value1>value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Max(value1 As Integer, value2 As Integer) As Integer
+		If value1>value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Max(value1 As DWord, value2 As DWord) As DWord
+		If value1>value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Max(value1 As Long, value2 As Long) As Long
+		If value1>value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Max(value1 As QWord, value2 As QWord) As QWord
+		If value1>value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Max(value1 As Int64, value2 As Int64) As Int64
+		If value1>value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Max(value1 As Single, value2 As Single) As Single
+		If value1>value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Max(value1 As Double, value2 As Double) As Double
+		If value1>value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Min(value1 As Byte, value2 As Byte) As Byte
+		If value1<value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Min(value1 As SByte, value2 As SByte) As SByte
+		If value1<value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Min(value1 As Word, value2 As Word) As Word
+		If value1<value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Min(value1 As Integer, value2 As Integer) As Integer
+		If value1<value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Min(value1 As DWord, value2 As DWord) As DWord
+		If value1<value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Min(value1 As Long, value2 As Long) As Long
+		If value1<value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Min(value1 As QWord, value2 As QWord) As QWord
+		If value1<value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Min(value1 As Int64, value2 As Int64) As Int64
+		If value1<value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Min(value1 As Single, value2 As Single) As Single
+		If value1<value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Min(value1 As Double, value2 As Double) As Double
+		If value1<value2 then
+			return value1
+		Else
+			return value2
+		End If
+	End Function
+
+	Static Function Pow(x As Double, y As Double) As Double
+		return pow(x, y)
+	End Function
+
+	'ReferenceEquals
+
+	Static Function Round(value As Double) As Double'他のバージョン、誰か頼む。
+		If value+0.5<>Int(value+0.5) then
+			value=Int(value+0.5)
+		ElseIf Int(value+0.5)=Int(value*2+1)/2 then
+			value=Int(value+0.5)
+		Else
+			value=Int(value-0.5)
+		End If
+	End Function
+
+	Static Function Sign(value As Double) As Long
+		If value = 0 then
+			return 0
+		ElseIf value > 0 then
+			return 1
+		Else
+			return -1
+		End If
+	End Function
+
+	Static Function Sign(value As SByte) As Long
+		If value = 0 then
+			return 0
+		ElseIf value > 0 then
+			return 1
+		Else
+			return -1
+		End If
+	End Function
+
+	Static Function Sign(value As Integer) As Long
+		If value = 0 then
+			return 0
+		ElseIf value > 0 then
+			return 1
+		Else
+			return -1
+		End If
+	End Function
+
+	Static Function Sign(value As Long) As Long
+		If value = 0 then
+			return 0
+		ElseIf value > 0 then
+			return 1
+		Else
+			return -1
+		End If
+	End Function
+
+	Static Function Sign(value As Int64) As Long
+		If value = 0 then
+			return 0
+		ElseIf value > 0 then
+			return 1
+		Else
+			return -1
+		End If
+	End Function
+
+	Static Function Sign(value As Single) As Long
+		If value = 0 then
+			return 0
+		ElseIf value > 0 then
+			return 1
+		Else
+			return -1
+		End If
+	End Function
+
+	Static Function Sin(value As Double) As Double
+		If ActiveBasic.Math.IsNaN(value) Then
+			Return value
+		ElseIf ActiveBasic.Math.IsInf(value) Then
+			Return ActiveBasic.Math.Detail.GetNaN()
+			Exit Function
+		End If
+
+		Dim k As Long
+		Dim t As Double
+
+		t = urTan((value * 0.5) As Double, k)
+		t = 2 * t / (1 + t * t)
+		If (k And 1) = 0 Then 'k mod 2 = 0 Then
+			Return t
+		Else
+			Return -t
+		End If
+	End Function
+
+	Static Function Sinh(x As Double) As Double
+		If Math.Abs(x) > _System_EPS5 Then
+			Dim t As Double
+			t = Math.Exp(x)
+			Return (t - 1 / t) * 0.5
+		Else
+			Return x * (1 + x * x * 0.166666666666667) ' x * (1 + x * x / 6)
+		End If
+	End Function
+
+	Static Function Sqrt(x As Double) As Double
+		If x > 0 Then
+			If ActiveBasic.Math.IsInf(x) Then
+				Sqrt = x
+			Else
+				Sqrt = x
+				Dim i = (VarPtr(Sqrt) + 6) As *Word
+				Dim jj = GetWord(i) As Long
+				Dim j = jj >> 5 As Long
+				Dim k = (jj And &h0000001f) As Long
+				j = (j + 511) << 4 + k
+				SetWord(i, j)
+				Dim last As Double
+				Do
+					last = Sqrt
+					Sqrt = (x / Sqrt + Sqrt) * 0.5
+				Loop While Sqrt <> last
+			End If
+		ElseIf x < 0 Then
+			Sqrt = ActiveBasic.Math.Detail.GetNaN()
+		Else
+			'x = 0 Or NaN
+			Sqrt = x
+		End If
+	End Function
+
+	Static Function Tan(x As Double) As Double
+		If ActiveBasic.Math.IsNaN(x) Then
+			Tan = x
+			Exit Function
+		ElseIf ActiveBasic.Math.IsInf(x) Then
+			Tan = ActiveBasic.Math.Detail.GetNaN()
+			Exit Function
+		End If
+
+		Dim k As Long
+		Dim t As Double
+		t = urTan(x, k)
+		If (k And 1) = 0 Then 'k mod 2 = 0 Then
+			Return t
+		ElseIf t <> 0 Then
+			Return -1 / t
+		Else
+			Return ActiveBasic.Math.CopySign(ActiveBasic.Math.Detail.GetInf(False), -t)
+		End If
+	End Function
+
+	Static Function Tanh(x As Double) As Double
+		If x > _System_EPS5 Then
+			Return 2 / (1 + Math.Exp(-2 * x)) - 1
+		ElseIf x < -_System_EPS5 Then
+			Return 1 - 2 / (Math.Exp(2 * x) + 1)
+		Else
+			Return x * (1 - x * x * 0.333333333333333) 'x * (1 - x * x / 3)
+		End If
+	End Function
+
+	'ToString
+
+	Static Function Truncate(x As Double) As Double
+		Return Fix(x)
+	End Function
+
+'Private
+	Static Function urTan(x As Double, ByRef k As Long) As Double
+		Dim i As Long
+		Dim t As Double, x2 As Double
+
+		If x >= 0 Then
+			k = ( Fix(x * _System_InverseHalfPI) + 0.5 ) As Long
+		Else
+			k = ( Fix(x * _System_InverseHalfPI) - 0.5 ) As Long
+		End If
+		x = (x - (3217.0 / 2048.0) * k) + _System_D * k
+		x2 = x * x
+		t = 0
+		For i = _System_UrTan_N To 3 Step -2
+			t = x2 / (i - t)
+		Next i
+		urTan =  x / (1 - t)
+	End Function
+Private
+	Static Const _System_Atan_N = 20 As Long
+	Static Const _System_UrTan_N = 17 As Long
+	Static Const _System_D = 4.4544551033807686783083602485579e-6 As Double
+	Static Const _System_EPS5 = 0.001 As Double
+End Class
+
+End Namespace
+
+Const _System_HalfPI = (_System_PI * 0.5)
+Const _System_InverseHalfPI = (2 / _System_PI) '1 / (PI / 2)
+Const _System_InverseLn10 = 0.43429448190325182765112891891661 '1 / (ln 10)
+Const _System_InverseSqrt2 = 0.70710678118654752440084436210485 '1 / (√2)
Index: /trunk/ab5.0/ablib/src/Classes/System/Media/SystemSound.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Media/SystemSound.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Media/SystemSound.ab	(revision 506)
@@ -0,0 +1,24 @@
+Class SystemSound
+	SoundID As Long
+
+Public
+	Sub SystemSound()
+		SoundID=SND_ALIAS_SYSTEMDEFAULT
+	End Sub
+	Sub SystemSound(value As Long)
+		SoundID=value
+	End Sub
+	Sub SystemSound(ByRef ss As SystemSound)
+		SoundID=ss.SoundID
+	End Sub
+
+Public
+	Sub Play()
+		PlaySound(SoundID As LPCTSTR, GetModuleHandle(NULL), SND_ALIAS_ID)
+	End Sub
+
+Public
+	Override Function ToString() As String
+		Return "SystemSound"
+	End Function
+End Class
Index: /trunk/ab5.0/ablib/src/Classes/System/Media/SystemSounds.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Media/SystemSounds.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Media/SystemSounds.ab	(revision 506)
@@ -0,0 +1,22 @@
+Class SystemSounds
+Public
+	Static Function Asterisk() As SystemSound
+		Return New SystemSound(SND_ALIAS_SYSTEMASTERISK)
+	End Function
+	Static Function Beep() As SystemSound
+		Return New SystemSound(SND_ALIAS_SYSTEMDEFAULT)
+	End Function
+	Static Function Exclamation() As SystemSound
+		Return New SystemSound(SND_ALIAS_SYSTEMEXCLAMATION)
+	End Function
+	Static Function Hand() As SystemSound
+		Return New SystemSound(SND_ALIAS_SYSTEMHAND)
+	End Function
+	Static Function Question() As SystemSound
+		Return New SystemSound(SND_ALIAS_SYSTEMQUESTION)
+	End Function
+
+	Override Function ToString() As String
+		Return "SystemSounds"
+	End Function
+End Class
Index: /trunk/ab5.0/ablib/src/Classes/System/Object.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Object.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Object.ab	(revision 506)
@@ -0,0 +1,78 @@
+
+Namespace System
+
+	Class Object
+
+	Public
+
+		Sub Object()
+		End Sub
+		Sub ~Object()
+		End Sub
+
+		' 2つのオブジェクトが等しいかどうかを判断する
+		Virtual Function Equals( object As Object ) As Boolean
+			If ObjPtr(This) = ObjPtr(object) Then
+	'		If This.GetHashCode() = object.GetHashCode() Then
+				Return True
+			Else
+				Return False
+			End If
+		End Function
+		
+		Static Function Equals( objectA As Object, objectB As Object ) As Boolean
+			If ObjPtr(objectA) = NULL /*objectA = Nothing*/ Then
+				Return ObjPtr(objectB) = NULL 'objectB = Nothing
+			Else
+				Return objectA.Equals(objectB)
+			End If
+		End Function
+
+		' 参照先が等しいか判断する
+		Static Function ReferenceEquals(objectA As Object, objectB As Object) As Boolean
+			If ObjPtr( objectA ) = ObjPtr( objectB) Then
+				Return True
+			Else
+				Return False
+			End If
+		End Function
+
+		' ハッシュコードを取得する
+		Virtual Function GetHashCode() As Long
+			Return ObjPtr( This ) As Long
+		End Function
+
+		' オブジェクトに関係する文字列を返す
+		Virtual Function ToString() As String
+			Return GetType().Name
+		End Function
+
+	/*
+		Function Operator Downcast() As VoidPtr
+		End Function
+	*/
+
+
+		'----------------------------------------------------------------
+		' 実行時型情報
+		'----------------------------------------------------------------
+
+	Private
+		_system_object_member_typeInfo As TypeInfo
+
+	Public
+		Sub _System_SetType( typeInfo As TypeInfo )
+			If ActiveBasic.Core._System_TypeBase.IsReady() = False Then
+				Return
+			End If
+
+			This._system_object_member_typeInfo = typeInfo
+		End Sub
+
+		Virtual Function GetType() As TypeInfo
+			Return _system_object_member_typeInfo
+		End Function
+
+	End Class
+
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/OperatingSystem.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/OperatingSystem.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/OperatingSystem.ab	(revision 506)
@@ -0,0 +1,84 @@
+' Classes/System/OperatingSystem.ab
+
+#require <Classes/System/Version.ab>
+
+Namespace System
+
+Class OperatingSystem
+	' Inherits ICloneable', ISerializable
+Public
+	' Constractor
+	Sub OperatingSystem(platform As PlatformID, version As Version)
+		pf = platform
+		ver = version
+		sp = ""
+	End Sub
+
+	Sub OperatingSystem(vi As OSVERSIONINFOA)
+		pf = vi.dwPlatformId As PlatformID
+		ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)
+		sp = New String(vi.szCSDVersion As PCSTR)
+	End Sub
+
+	Sub OperatingSystem(vi As OSVERSIONINFOW)
+		pf = vi.dwPlatformId As PlatformID
+		ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)
+		sp = New String(vi.szCSDVersion As PCSTR)
+	End Sub
+
+	' Properties
+	Const Function Platform() As PlatformID
+		Return pf
+	End Function
+
+	Const Function Version() As Version
+		Return ver
+	End Function
+
+	Const Function ServicePack() As String
+		Return sp
+	End Function
+
+	Const Function VersionString() As String
+		Select Case pf
+			Case PlatformID.Win32S
+				VersionString = "Microsoft Win32S "
+			Case PlatformID.Win32Windows
+				VersionString = "Microsoft Windows "
+			Case PlatformID.Win32NT
+				VersionString = "Microsoft Windows NT "
+			Case PlatformID.WinCE
+				VersionString = "Microsoft Windows CE "
+			Case PlatformID.Unix
+				VersionString = "<unknown> "
+		End Select
+		VersionString = VersionString + ver.ToString
+		If String.IsNullOrEmpty(sp) <> False Then
+			VersionString = VersionString + " " + sp
+		End If
+	End Function
+
+	' Methods
+	Override Function ToString() As String
+		Return VersionString
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return pf.GetHashCode Xor ver.GetHashCode Xor sp.GetHashCode
+	End Function
+
+Private
+	pf As PlatformID
+	ver As Version
+	sp As String
+End Class
+
+Enum PlatformID
+	Win32S = VER_PLATFORM_WIN32s '0
+	Win32Windows = VER_PLATFORM_WIN32_WINDOWS '1
+	Win32NT = VER_PLATFORM_WIN32_NT '2
+	WinCE = VER_PLATFORM_WIN32_CE '3
+	Unix = 4
+End Enum
+
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Reflection/MemberInfo.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Reflection/MemberInfo.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Reflection/MemberInfo.ab	(revision 506)
@@ -0,0 +1,52 @@
+Namespace System
+Namespace Reflection
+
+
+/*!
+@brief	メンバの属性に関する情報を取得し、メンバのメタデータにアクセスできるようにします。
+*/
+Class MemberInfo
+	name As String
+	memberType As TypeInfo
+	offset As LONG_PTR
+Public
+
+	/*!
+	@brief	コンストラクタ
+	@param	name メンバの名前
+			memberType メンバの型
+	*/
+	Sub MemberInfo( name As String, memberType As TypeInfo, offset As LONG_PTR )
+		This.name = name
+		This.memberType = memberType
+		This.offset = offset
+	End Sub
+
+	/*!
+	@brief	メンバの名前を取得する。
+	@return	メンバの名前。
+	*/
+	Function Name() As String
+		Return name
+	End Function
+
+	/*!
+	@brief	メンバの型を取得する。
+	@return	メンバの型。
+	*/
+	Function MemberType() As TypeInfo
+		Return memberType
+	End Function
+
+	/*!
+	@brief	クラスの先頭ポインタからのオフセット値を取得する。
+	@return	クラスの先頭ポインタからのオフセット値。
+	*/
+	Function _System_Offset() As LONG_PTR
+		Return offset
+	End Function
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Runtime/InteropServices/GCHandle.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Runtime/InteropServices/GCHandle.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Runtime/InteropServices/GCHandle.ab	(revision 506)
@@ -0,0 +1,77 @@
+' Classes/System/Runtime/InteropServices/GCHandle.ab
+
+Namespace System
+Namespace Runtime
+Namespace InteropServices
+
+Class GCHandle
+Public
+	Function Target() As Object
+		Dim pobj = VarPtr(handle) As *Object
+		Return pobj[0]
+	End Function
+
+	Sub Target(obj As Object)
+		allocated.Add(obj)
+		handle = ObjPtr(obj)
+	End Sub
+
+	Const Function IsAllocated() As Boolean
+		Return handle <> 0
+	End Function
+
+	Static Function Alloc(obj As Object) As GCHandle
+		Alloc = New GCHandle
+		Alloc.Target = obj
+	End Function
+
+	Sub Free()
+		allocated.Remove(Target)
+		handle = 0
+	End Sub
+
+	Static Function ToIntPtr(h As GCHandle) As LONG_PTR
+		Return h.handle As LONG_PTR
+ 	End Function
+
+	Static Function FromIntPtr(ip As LONG_PTR) As GCHandle
+		If ip = 0 Then
+			Throw New InvalidOperationException("GCHandle.FromIntPtr: ip is 0.")
+		End If
+		FromIntPtr = New GCHandle
+		FromIntPtr.handle = ip As VoidPtr
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return _System_HashFromPtr(handle)
+	End Function
+
+	Function Equals(y As GCHandle) As Boolean
+		Return handle = y.handle
+	End Function
+
+	Function Operator == (y As GCHandle) As Boolean
+		Return Equals(y)
+	End Function
+
+	Function Operator <> (y As GCHandle) As Boolean
+		Return Not Equals(y)
+	End Function
+
+	Override Function ToString() As String
+		Return "System.Runtime.InteropServices.GCHandle"
+	End Function
+
+'Private
+	Sub GCHandle()
+	End Sub
+
+Private
+	handle As VoidPtr
+
+	Static allocated = New System.Collections.Generic.List<Object>
+End Class
+
+End Namespace 'System
+End Namespace 'Runtime
+End Namespace 'InteropServices
Index: /trunk/ab5.0/ablib/src/Classes/System/Security/AccessControl/misc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Security/AccessControl/misc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Security/AccessControl/misc.ab	(revision 506)
@@ -0,0 +1,18 @@
+Namespace System
+Namespace Security
+Namespace AccessControl
+
+
+Enum AccessControlSections
+	Access	' 随意アクセス制御リスト (DACL: Discretionary Access Control List)
+	All		' セキュリティ記述子全体
+	Audit	' システム アクセス制御リスト (SACL: System Access Control List)
+	Group	' プライマリ グループ
+	None	' セクションを指定しません
+	Owner	' 所有者
+End Enum
+
+
+End Namespace
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/String.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/String.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/String.ab	(revision 506)
@@ -0,0 +1,671 @@
+' Classes/System/String.ab
+
+Namespace System
+
+	Class String
+		Implements /*IComparable, ICloneable, IConvertible, IComparable<String>, IEnumerable, IEnumerable<Char>, IEquatable<String>*/
+
+		m_Length As Long
+		Chars As *Char
+
+		Sub validPointerCheck(p As VoidPtr, size = 1 As Long)
+			If p As ULONG_PTR < &h10000 Then
+				Throw New ArgumentException
+			ElseIf IsBadReadPtr(p, size As ULONG_PTR) Then
+				Throw New ArgumentException
+			End If
+		End Sub
+	Public
+		Static Const Empty = New String
+
+		Sub String()
+'			Chars = 0
+'			m_Length = 0
+		End Sub
+
+		Sub String(initStr As PCWSTR)
+			validPointerCheck(initStr)
+			Assign(initStr, lstrlenW(initStr))
+		End Sub
+
+		Sub String(initStr As PCWSTR, length As Long)
+			validPointerCheck(initStr, length)
+			Assign(initStr, length)
+		End Sub
+
+		Sub String(initStr As PCWSTR, start As Long, length As Long)
+			If start < 0 Or length Or start + length < 0 Then
+				Throw New ArgumentOutOfRangeException("String constractor: One or more arguments are out of range value.", "start or length or both")
+			End If
+			validPointerCheck(initStr + start, length)
+			Assign(initStr + start, length)
+		End Sub
+
+		Sub String(initStr As PCSTR)
+			validPointerCheck(initStr)
+			Assign(initStr, lstrlenA(initStr))
+		End Sub
+
+		Sub String(initStr As PCSTR, length As Long)
+			validPointerCheck(initStr, length)
+			Assign(initStr, length)
+		End Sub
+
+		Sub String(initStr As PCSTR, start As Long, length As Long)
+			If start < 0 Or length < 0 Then
+				Throw New ArgumentOutOfRangeException("String constructor: One or more arguments are out of range value.", "start or length or both")
+			End If
+			validPointerCheck(initStr + start, length)
+			Assign(initStr + start, length)
+		End Sub
+
+		Sub String(initStr As String)
+			If Not String.IsNullOrEmpty(initStr) Then
+				Assign(initStr.Chars, initStr.m_Length)
+			End If
+		End Sub
+
+		Sub String(initChar As Char, length As Long)
+			AllocStringBuffer(length)
+			ActiveBasic.Strings.ChrFill(Chars, length, initChar)
+			Chars[length] = 0
+		End Sub
+
+		Sub String(sb As Text.StringBuilder)
+			Chars = StrPtr(sb)
+			m_Length = sb.Length
+			sb.__Stringized()
+		End Sub
+
+		Const Function Length() As Long
+			Return m_Length
+		End Function
+
+		Function Operator() As *Char
+			Return Chars
+		End Function
+
+		Const Function Operator [] (n As Long) As Char
+			rangeCheck(n)
+			Return Chars[n]
+		End Function
+
+		Const Function Operator + (y As PCSTR) As String
+			If y = 0 Then
+				Return This
+			Else
+				Return Concat(y, lstrlenA(y))
+			End If
+		End Function
+
+		Const Function Operator + (y As PCWSTR) As String
+			If y = 0 Then
+				Return This
+			Else
+				Return Concat(y, lstrlenW(y))
+			End If
+		End Function
+
+		Const Function Operator + (y As String) As String
+			If ActiveBasic.IsNothing(y) Then
+				Return This
+			Else
+				Return Concat(y.Chars, y.m_Length)
+			End If
+		End Function
+
+		Const Function Operator & (y As PCSTR) As String
+			Return This + y
+		End Function
+
+		Const Function Operator & (y As PCWSTR) As String
+			Return This + y
+		End Function
+
+		Const Function Operator & (y As String) As String
+			Return This + y
+		End Function
+
+		Const Function Operator == (y As String) As Boolean
+			Return Compare(This, y) = 0
+		End Function
+
+		Const Function Operator == (y As *Char) As Boolean
+			Return Compare(This, y) = 0
+		End Function
+
+		Const Function Operator <> (y As String) As Boolean
+			Return Compare(This, y) <> 0
+		End Function
+
+		Const Function Operator <> (y As *Char) As Boolean
+			Return Compare(This, y) <> 0
+		End Function
+
+		Const Function Operator < (y As String) As Boolean
+			Return Compare(This, y) < 0
+		End Function
+
+		Const Function Operator < (y As *Char) As Boolean
+			Return Compare(This, y) < 0
+		End Function
+
+		Const Function Operator > (y As String) As Boolean
+			Return Compare(This, y) > 0
+		End Function
+
+		Const Function Operator > (y As *Char) As Boolean
+			Return Compare(This, y) > 0
+		End Function
+
+		Const Function Operator <= (y As String) As Boolean
+			Return Compare(This, y) <= 0
+		End Function
+
+		Const Function Operator <= (y As *Char) As Boolean
+			Return Compare(This, y) <= 0
+		End Function
+
+		Const Function Operator >= (y As String) As Boolean
+			Return Compare(This, y) >= 0
+		End Function
+
+		Const Function Operator >= (y As *Char) As Boolean
+			Return Compare(This, y) >= 0
+		End Function
+
+		Static Function Compare(x As String, y As String) As Long
+			Return CompareOrdinal(x, y)
+		End Function
+
+	Public
+		'Compareなどで、x.Charsではなく、StrPtr(x)と書く理由は、xがNothingの場合のため。
+
+		Static Function Compare(x As String, indexX As Long, y As String, indexY As Long, length As Long) As Long
+			Return CompareOrdinal(x, indexX, y, indexY, length)
+		End Function
+
+		Static Function CompareOrdinal(x As String, y As String) As Long
+			Return CompareOrdinal(StrPtr(x), StrPtr(y))
+		End Function
+
+		Static Function CompareOrdinal(x As String, indexX As Long, y As String, indexY As Long, length As Long) As Long
+			Return CompareOrdinal(StrPtr(x), indexX, StrPtr(y), indexY, length)
+		End Function
+	Private
+		Static Function Compare(x As String, y As *Char) As Long
+			Return CompareOrdinal(x, y)
+		End Function
+
+		Static Function CompareOrdinal(x As String, y As *Char) As Long
+			Return CompareOrdinal(StrPtr(x), y)
+		End Function
+
+		Static Function CompareOrdinal(x As *Char, y As *Char) As Long
+			If x = 0 Then
+				If y = 0 Then
+					Return 0
+				Else
+					Return -1
+				End If
+			ElseIf y = 0 Then
+				Return 1
+			End If
+			Return ActiveBasic.Strings.StrCmp(x, y)
+		End Function
+
+		Static Function CompareOrdinal(x As *Char, indexX As Long, y As *Char, indexY As Long, length As Long) As Long
+			If x = 0 Then
+				If y = 0 Then
+					Return 0
+				Else
+					Return -1
+				End If
+			ElseIf y = 0 Then
+				Return 1
+			End If
+			Return ActiveBasic.Strings.ChrCmp(VarPtr(x[indexX]), VarPtr(y[indexY]), length As SIZE_T)
+		End Function
+	Public
+		Function CompareTo(y As String) As Long
+			Return String.Compare(This, y)
+		End Function
+
+		Function CompareTo(y As Object) As Long
+			If Not Object.Equals(This.GetType(), y.GetType()) Then
+				Throw New ArgumentException("String.CompareTo: The type of the argument y is not String.", "y")
+			End If
+			Return CompareTo(y As String)
+		End Function
+
+		Function Equals(s As String) As Boolean
+			Return This = s
+		End Function
+
+		Override Function Equals(s As Object) As Boolean
+			If Not ActiveBasic.IsNothing(s) Then
+				If Object.Equals(This.GetType(), s.GetType()) Then
+					Return This.Equals(s As String)
+				End If
+			End If
+			Return False
+		End Function
+
+		Const Function StrPtr() As *Char
+			Return Chars
+		End Function
+Private
+
+		Sub Assign(text As PCSTR, textLengthA As Long)
+#ifdef UNICODE
+			Dim textLengthW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, 0, 0)
+			If AllocStringBuffer(textLengthW) <> 0 Then
+				MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, Chars, textLengthW)
+				Chars[textLengthW] = 0
+			End If
+#else
+			AssignFromCharPtr(text, textLengthA)
+#endif
+		End Sub
+
+		Sub Assign(text As PCWSTR, textLengthW As Long)
+#ifdef UNICODE
+			AssignFromCharPtr(text, textLengthW)
+#else
+			Dim textLengthA = WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, 0, 0, 0, 0)
+			If AllocStringBuffer(textLengthA) <> 0 Then
+				WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, Chars, textLengthA, 0, 0)
+				Chars[textLengthA] = 0
+			End If
+#endif
+		End Sub
+
+	Private
+		Static Function ConcatChar(text1 As *Char, text1Length As Long, text2 As *Char, text2Length As Long) As String
+			ConcatChar = New String()
+			With ConcatChar
+				.AllocStringBuffer(text1Length + text2Length)
+				ActiveBasic.Strings.ChrCopy(.Chars, text1, text1Length As SIZE_T)
+				ActiveBasic.Strings.ChrCopy(VarPtr(.Chars[text1Length]), text2, text2Length As SIZE_T)
+				.Chars[text1Length + text2Length] = 0
+			End With
+		End Function
+	Public
+		Const Function Concat(text As PCSTR, len As Long) As String
+#ifdef UNICODE
+			With Concat
+				Dim lenW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, len, 0, 0)
+				Concat = New String
+				.AllocStringBuffer(m_Length + lenW)
+				ActiveBasic.Strings.ChrCopy(.Chars, This.Chars, m_Length As SIZE_T)
+				MultiByteToWideChar(CP_THREAD_ACP, 0, text, len, VarPtr(.Chars[m_Length]), lenW)
+				.Chars[m_Length + lenW] = 0
+			End With
+#else
+			Return ConcatChar(This.Chars, m_Length, text, len)
+#endif
+		End Function
+
+		Const Function Concat(text As PCWSTR, len As Long) As String
+#ifdef UNICODE
+			Return ConcatChar(This.Chars, m_Length, text, len)
+#else
+			With Concat
+				Concat = New String
+				Dim lenA = WideCharToMultiByte(CP_THREAD_ACP, 0, text, len, 0, 0, 0, 0)
+				.AllocStringBuffer(m_Length + lenA)
+				ActiveBasic.Strings.ChrCopy(.Chars, This.Chars, m_Length As SIZE_T)
+				WideCharToMultiByte(CP_THREAD_ACP, 0, text, len, VarPtr(.Chars[m_Length]), lenA, 0, 0)
+				.Chars[m_Length + lenA] = 0
+			End With
+#endif
+		End Function
+
+		Static Function Concat(x As String, y As String) As String
+			If String.IsNullOrEmpty(x) Then
+				Return y
+			Else
+				Return x.Concat(y.Chars, y.m_Length)
+			End If
+		End Function
+
+		Static Function Concat(x As String, y As String, z As String) As String
+			Dim sb = New Text.StringBuilder(removeNull(x).Length + removeNull(y).Length + removeNull(z).Length)
+			sb.Append(x).Append(y).Append(z)
+			Concat = sb.ToString
+		End Function
+
+		Static Function Concat(x As String, y As String, z As String, w As String) As String
+			Dim sb = New Text.StringBuilder(removeNull(x).Length + removeNull(y).Length + removeNull(z).Length + removeNull(w).Length)
+			sb.Append(x).Append(y).Append(z).Append(w)
+			Concat = sb.ToString
+		End Function
+
+		Static Function Concat(x As Object, y As Object) As String
+			Return Concat(x.ToString, y.ToString)
+		End Function
+
+		Static Function Concat(x As Object, y As Object, z As Object) As String
+			Return Concat(x.ToString, y.ToString, z.ToString)
+		End Function
+
+		Static Function Concat(x As Object, y As Object, z As Object, w As Object) As String
+			Return Concat(x.ToString, y.ToString, z.ToString, w.ToString)
+		End Function
+
+		Const Function Contains(c As Char) As Boolean
+			Return IndexOf(c) >= 0
+		End Function
+
+		Const Function Contains(s As String) As Boolean
+			If Object.ReferenceEquals(s, Nothing) Then
+				Throw New ArgumentNullException("String.Contains: An argument is null value.", "s")
+			ElseIf s = "" Then
+				Return True
+			Else
+				Return IndexOf(s, 0, m_Length) >= 0
+			End If
+		End Function
+
+		Const Function IndexOf(c As Char) As Long
+			Return indexOfCore(c, 0, m_Length)
+		End Function
+
+		Const Function IndexOf(c As Char, start As Long) As Long
+			rangeCheck(start)
+			Return indexOfCore(c, start, m_Length - start)
+		End Function
+
+		Const Function IndexOf(c As Char, start As Long, count As Long) As Long
+			rangeCheck(start, count)
+			Return indexOfCore(c, start, count)
+		End Function
+	Private
+		Const Function indexOfCore(c As Char, start As Long, count As Long) As Long
+			indexOfCore = ActiveBasic.Strings.ChrFind(VarPtr(Chars[start]), count, c) As Long
+			If indexOfCore <> -1 Then
+				indexOfCore += start
+			End If
+		End Function
+	Public
+		Const Function IndexOf(s As String) As Long
+			Return IndexOf(s, 0, m_Length)
+		End Function
+
+		Const Function IndexOf(s As String, startIndex As Long) As Long
+			Return IndexOf(s, startIndex, m_Length - startIndex)
+		End Function
+
+		Const Function IndexOf(s As String, startIndex As Long, count As Long) As Long
+			rangeCheck(startIndex, count)
+			If Object.ReferenceEquals(s, Nothing) Then
+				Throw New ArgumentNullException("String.IndexOf: An argument is out of range value.", "s")
+			End If
+
+			Dim length = s.Length
+			If length = 0 Then Return startIndex
+
+			Dim i As Long, j As Long
+			For i = startIndex To startIndex + count - 1
+				For j = 0 To length - 1
+					If Chars[i + j] = s[j] Then
+						If j = length - 1 Then Return i
+					Else
+						Exit For
+					End If
+				Next
+			Next
+			Return -1
+		End Function
+
+		Const Function LastIndexOf(c As Char) As Long
+			Return lastIndexOf(c, m_Length - 1, m_Length)
+		End Function
+
+		Const Function LastIndexOf(c As Char, start As Long) As Long
+			rangeCheck(start)
+			Return lastIndexOf(c, start, start + 1)
+		End Function
+
+		Const Function LastIndexOf(c As Char, start As Long, count As Long) As Long
+			rangeCheck(start)
+			Dim lastFindPos = start - (count - 1)
+			If Not (m_Length > lastFindPos And lastFindPos >= 0) Then
+				Throw New ArgumentOutOfRangeException("String.LastIndexOf: An argument is out of range value.", "count")
+			End If
+			Return lastIndexOf(c, start, count)
+		End Function
+	Private
+		Const Function lastIndexOf(c As Char, start As Long, count As Long) As Long
+			Dim lastFindPos = start - (count - 1)
+			Dim i As Long
+			For i = start To lastFindPos Step -1
+				If Chars[i] = c Then
+					Return i
+				End If
+			Next
+			Return -1
+		End Function
+
+	Public
+		Const Function LastIndexOf(s As String) As Long
+			Return LastIndexOf(s, m_Length - 1, m_Length)
+		End Function
+
+		Const Function LastIndexOf(s As String, startIndex As Long) As Long
+			Return LastIndexOf(s, startIndex, startIndex + 1)
+		End Function
+
+		Const Function LastIndexOf(s As String, start As Long, count As Long) As Long
+			If Object.ReferenceEquals(s, Nothing) Then
+				Throw New ArgumentNullException("String.LastIndexOf: An argument is out of range value.", "s")
+			End If
+
+			If start < 0 Or start > m_Length - 1 Or _
+				count < 0 Or count > start + 2 Then
+				Throw New ArgumentOutOfRangeException("String.LastIndexOf: One or more arguments are out of range value.", "start or count or both")
+			End If
+			Dim length = s.m_Length
+			If length > m_Length Then Return -1
+			If length = 0 Then Return start
+
+			Dim i As Long, j As Long
+			For i = start To  start - count + 1 Step -1
+				For j = length - 1 To 0 Step -1
+					If Chars[i + j] = s[j] Then
+						If j = 0 Then Return i
+					Else
+						Exit For
+					End If
+				Next
+			Next
+			Return -1
+		End Function
+
+		Const Function StartsWith(c As Char) As Boolean
+			Return IndexOf(c) = 0
+		End Function
+
+		Const Function StartsWith(s As String) As Boolean
+			Return IndexOf(s) = 0
+		End Function
+
+		Const Function EndsWith(c As Char) As Boolean
+			Return LastIndexOf(c) = m_Length - 1
+		End Function
+
+		Const Function EndsWith(s As String) As Boolean
+			Return LastIndexOf(s) = m_Length - s.Length
+		End Function
+
+		Const Function Insert(startIndex As Long, text As String) As String
+			Dim sb = New Text.StringBuilder(This)
+			sb.Insert(startIndex, text)
+			Return sb.ToString
+		End Function
+
+		Const Function Substring(startIndex As Long) As String
+			rangeCheck(startIndex)
+			Return Substring(startIndex, m_Length - startIndex)
+		End Function
+
+		Const Function Substring(startIndex As Long, length As Long) As String
+			rangeCheck(startIndex, length)
+			Return New String(Chars, startIndex, length)
+		End Function
+
+		Const Function Remove(startIndex As Long) As String
+			rangeCheck(startIndex)
+			Remove = Substring(0, startIndex)
+		End Function
+
+		Const Function Remove(startIndex As Long, count As Long) As String
+			Dim sb = New Text.StringBuilder(This)
+			sb.Remove(startIndex, count)
+			Remove = sb.ToString
+		End Function
+
+		Static Function IsNullOrEmpty(s As String) As Boolean
+			If Not Object.ReferenceEquals(s, Nothing) Then
+				If s.m_Length > 0 Then
+					Return False
+				End If
+			End If
+			Return True
+		End Function
+
+		Const Function Replace(oldChar As Char, newChar As Char) As String
+			Dim sb = New Text.StringBuilder(This)
+			sb.Replace(oldChar, newChar)
+			Replace = sb.ToString
+		End Function
+
+		Const Function Replace(oldStr As String, newStr As String) As String
+			Dim sb = New Text.StringBuilder(This)
+			sb.Replace(oldStr, newStr)
+			Return sb.ToString
+		End Function
+
+		Const Function ToLower() As String
+			Dim sb = New Text.StringBuilder(m_Length)
+			sb.Length = m_Length
+			Dim i As Long
+			For i = 0 To ELM(m_Length)
+				sb[i] = ActiveBasic.CType.ToLower(Chars[i])
+			Next
+			Return sb.ToString
+		End Function
+
+		Const Function ToUpper() As String
+			Dim sb = New Text.StringBuilder(m_Length)
+			sb.Length = m_Length
+			Dim i As Long
+			For i = 0 To ELM(m_Length)
+				sb[i] = ActiveBasic.CType.ToUpper(Chars[i])
+			Next
+			Return sb.ToString
+		End Function
+
+		Override Function ToString() As String
+			ToString = This
+		End Function
+
+		Const Function Clone() As String
+			Clone = This
+		End Function
+/*
+		Function Clone() As Object
+			Clone = This
+		End Function
+*/
+		Static Function Copy(s As String) As String
+			Copy = New String(s.Chars, s.m_Length)
+		End Function
+
+		Sub CopyTo(sourceIndex As Long, destination As *Char, destinationIndex As Long, count As Long)
+			ActiveBasic.Strings.ChrCopy(VarPtr(destination[destinationIndex]), VarPtr(Chars[sourceIndex]), count As SIZE_T)
+		End Sub
+
+		Override Function GetHashCode() As Long
+#ifdef UNICODE
+			Dim size = m_Length
+#else
+			Dim size = (m_Length + 1) >> 1
+#endif
+			Return _System_GetHashFromWordArray(Chars As *Word, size) Xor m_Length
+		End Function
+
+		Function PadLeft(total As Long) As String
+			PadLeft(total, &h30 As Char)
+		End Function
+
+		Function PadLeft(total As Long, c As Char) As String
+			If total < 0 Then
+				Throw New ArgumentOutOfRangeException("String.PadLeft: An arguments is out of range value.", "total")
+			End If
+			If total >= m_Length Then
+				Return This
+			End If
+			Dim sb = New Text.StringBuilder(total)
+			sb.Append(c, total - m_Length)
+			sb.Append(This)
+			Return sb.ToString
+		End Function
+
+		Function PadRight(total As Long) As String
+			PadRight(total, &h30 As Char)
+		End Function
+
+		Function PadRight(total As Long, c As Char) As String
+			If total < 0 Then
+				Throw New ArgumentOutOfRangeException("String.PadRight: An arguments is out of range value.", "total")
+			End If
+			If total >= m_Length Then
+				Return This
+			End If
+			Dim sb = New Text.StringBuilder(total)
+			sb.Append(This)
+			sb.Append(c, total - m_Length)
+			Return sb.ToString
+		End Function
+	Private
+		Function AllocStringBuffer(textLength As Long) As *Char
+			If textLength < 0 Then
+				Return 0
+			End If
+			AllocStringBuffer = GC_malloc_atomic(SizeOf(Char) * (textLength + 1))
+			If AllocStringBuffer = 0 Then
+				'Throw New OutOfMemoryException
+			End If
+			m_Length = textLength
+			Chars = AllocStringBuffer
+		End Function
+
+		Sub AssignFromCharPtr(text As *Char, textLength As Long)
+			AllocStringBuffer(textLength)
+			ActiveBasic.Strings.ChrCopy(Chars, text, textLength As SIZE_T)
+			Chars[m_Length] = 0
+		End Sub
+
+		Const Sub rangeCheck(index As Long)
+			If index < 0 Or index > m_Length Then
+				Throw New ArgumentOutOfRangeException("String: An arguments is out of range value.", "index")
+			End If
+		End Sub
+
+		Const Sub rangeCheck(start As Long, length As Long)
+			If start < 0 Or start > This.m_Length Or length < 0 Then
+				Throw New ArgumentOutOfRangeException("String: One or more arguments are out of range value.", "start or length or both")
+			End If
+		End Sub
+
+		Static Function removeNull(s As String) As String
+			If ActiveBasic.IsNothing(s) Then
+				removeNull = Empty
+			Else
+				removeNull = s
+			End If
+		End Function
+	End Class
+
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Text/DecoderFallback.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Text/DecoderFallback.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Text/DecoderFallback.ab	(revision 506)
@@ -0,0 +1,227 @@
+/*!
+@file	Classes/System/IO/Fallback.ab
+@date	2007/12/09
+*/
+
+Namespace System
+Namespace Text
+
+/*!
+@brief	復号時、復号できないバイト並びに遭遇したときの処理を提供する
+@date	2007/12/09
+@auther	Egtra
+*/
+Class DecoderFallback
+Public
+	/*!
+	@brief	フォールバックを行う
+	@param[in] bytesUnknown	復号中の文字列
+	@param[in] len	bytesUnknownの要素数
+	@param[in] index	問題の列の開始位置
+	@param[out] bufLen	戻り値の要素数
+	@return フォールバック文字列
+	*/
+	Abstract Function Fallback(bytesUnknown As *Byte, len As Long, index As Long, ByRef bufLen As Long) As *WCHAR
+
+	/*!
+	@brief	このDecoderFallbackの処理で生成される可能性のある最大の文字列の長さを返す。
+	*/
+	Abstract Function MaxCharCount() As Long
+
+	/*!
+	@brief	フォールバックとして、例外を投げるDecoderFallbackを返す。
+	@bug	未実装
+	*/
+	Static Function ExceptionFallback() As DecoderFallback
+	End Function
+
+	/*!
+	@brief	フォールバックとして、適当な文字に変換するDecoderFallbackを返す。
+	*/
+	Static Function ReplacementFallback() As DecoderFallback
+		ReplacementFallback = replacementFallback
+	End Function
+
+Private
+	Static replacementFallback = New DecoderReplacementFallback
+End Class
+
+/*!
+@brief	復号時、復号できないバイト並びに遭遇したときの処理を提供する
+@date	2007/12/09
+@auther	Egtra
+*/
+Class DecoderReplacementFallback
+	Inherits DecoderFallback
+Public
+	/*!
+	@brief	既定のフォールバック文字列でDecoderReplacementFallbackを構築する。
+	*/
+	Sub DecoderReplacementFallback()
+		str = VarPtr(default)
+		len = 1
+	End Sub
+
+	/*!
+	@brief	指定された文字列でDecoderReplacementFallbackを構築する。
+	@param[in] replacement	代替文字列
+	@param[in] length	replacementの長さ
+	*/
+	Sub DecoderReplacementFallback(replacement As *WCHAR, length As Long)
+		If replacement = 0 Then
+			Throw New ArgumentNullException("replacement")
+		ElseIf length < 0 Then
+			Throw New ArgumentOutOfRangeException("length")
+		End If
+		str = replacement
+		len = length
+	End Sub
+#ifdef UNICODE
+	/*!
+	@brief	指定された文字列でDecoderReplacementFallbackを構築する。
+	@param[in] replacement	代替文字列
+	*/
+	Sub DecoderReplacementFallback(replacement As String)
+		If ActiveBasic.IsNothing(replacement) Then
+			Throw New ArgumentNullException("replacement")
+		End If
+		With replacement
+			str = .StrPtr
+			len = .Length
+		End With
+	End Sub
+#endif
+	/*!
+	@brief	フォールバックを行う。
+	*/
+	Override Function Fallback(bytesUnknown As *Byte, bytesLen As Long, index As Long, ByRef bufLen As Long) As *WCHAR
+		bufLen = len
+		Dim bufSize = len * SizeOf (WCHAR)
+		Fallback = GC_malloc_atomic(bufSize)
+		memcpy(Fallback, str, bufSize)
+	End Function
+	/*!
+	@brief	このDecoderFallbackの処理で生成される可能性のある最大の文字列の長さを返す。
+	*/
+	Override Function MaxCharCount() As Long
+		MaxCharCount = len
+	End Function
+	/*!
+	@brief	代替文字列を返す
+	@return	代替文字列へのポインタ
+	
+	長さはDefaultStringLengthで得られる
+	*/
+	Function DefaultStringArray() As *WCHAR
+		DefaultStringArray = str
+	End Function
+
+	/*!
+	@brief	代替文字列の長さを返す
+	*/
+	Function DefaultStringLength() As Long
+		DefaultStringLength = len
+	End Function
+
+#ifdef UNICODE
+	/*!
+	@brief	代替文字列を返す
+	@return	代替文字列
+	*/
+	Function DefaultString() As String
+		DefaultString = New String(str, len)
+	End Function
+#endif
+
+Private
+	str As *WCHAR
+	len As Long
+
+	Static default = &h3f As WCHAR '? 疑問符
+End Class
+
+/*!
+@brief	
+@date	2007/12/27
+@auther	Egtra
+*/
+Class DecoderExceptionFallback
+	Inherits DecoderFallback
+Public
+	/*!
+	@brief
+	*/
+	Sub DecoderExceptionFallback()
+	End Sub
+
+	/*!
+	@brief	指定された文字列でDecoderReplacementFallbackを構築する。
+	@param[in] replacement	代替文字列
+	@param[in] length	replacementの長さ
+	*/
+	Sub DecoderReplacementFallback(replacement As *WCHAR, length As Long)
+		If replacement = 0 Then
+			Throw New ArgumentNullException("replacement")
+		ElseIf length < 0 Then
+			Throw New ArgumentOutOfRangeException("length")
+		End If
+	End Sub
+#ifdef UNICODE
+	/*!
+	@brief	指定された文字列でDecoderReplacementFallbackを構築する。
+	@param[in] replacement	代替文字列
+	*/
+	Sub DecoderReplacementFallback(replacement As String)
+		If ActiveBasic.IsNothing(replacement) Then
+			Throw New ArgumentNullException("replacement")
+		End If
+		With replacement
+			str = .StrPtr
+			len = .Length
+		End With
+	End Sub
+#endif
+	/*!
+	@brief	フォールバックを行う。
+	@exception DecoderFallbackException
+	*/
+	Override Function Fallback(bytesUnknown As *Byte, bytesLen As Long, index As Long, ByRef bufLen As Long) As *WCHAR
+		'Throw New DecoderFallbackException
+	End Function
+
+	/*!
+	@brief	このDecoderFallbackの処理で生成される可能性のある最大の文字列の長さを返す。
+	@return	常に0
+	*/
+	Override Function MaxCharCount() As Long
+		MaxCharCount = 0
+	End Function
+End Class
+
+/*!
+@brief	DecoderExceptionFallbackでフォールバックが起こった時に投げられる例外
+@date	2007/12/27
+@auther Egtra
+*/
+Class DecoderFallbackException
+	Inherits ArgumentException
+Public
+	Sub DecoderFallbackException()
+
+	End Sub
+
+	Sub DecoderFallbackException(message As String)
+	End Sub
+
+	Sub DecoderFallbackException(message As String, innerException As Exception)
+	End Sub
+
+'bytesの大きさはどうしよう
+	Sub DecoderFallbackException(message As String, bytesUnknown As *Byte, index As Long)
+	End Sub
+
+
+End Class
+
+End Namespace 'Text
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Text/Encoding.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Text/Encoding.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Text/Encoding.ab	(revision 506)
@@ -0,0 +1,777 @@
+/*!
+@file	Classes/System/Text/Encoding.ab
+@brief	Encodingクラスとそれに関係するクラスなどの宣言・定義
+*/
+
+Namespace System
+Namespace Text
+
+/*!
+@brief	各種の文字符号化（エンコーディング）を行うためのクラス
+@date	2007/12/07
+@auther	Egtra
+
+なお、このクラスで、文字列の長さやバッファの大きさを指定するときには、
+1 chars = 2バイト（UTF-16符号単位）、1 bytes = 1バイトの単位で指定する。
+
+*/
+Class Encoding
+	Implements ICloneable
+Public
+	/*!
+	@brief	簡易的複製を作成する。
+	*/
+	Abstract Function Clone() As Object
+
+'	Override Function Equals(y As Object) As Boolean
+'	End Function
+
+'	Override Function GetHashCode() As Long
+'	End Function
+
+Public
+	Sub Encoding()
+		decoderFallback = New DecoderReplacementFallback
+	End Sub
+
+	/*!
+	@brief	符号化して得られる文字列の長さを計算する。
+	@param[in] s	対象文字列
+	@param[in] n	sの長さ
+	@return	符号化して得られる文字列の長さ
+	@date	2007/12/08
+	*/
+	Function GetBytesCount(s As *WCHAR, n As Long) As Long
+		If s = 0 Then
+			Throw New ArgumentNullException("Encoding.GetBytesCount: An argument is null value.", "s")
+		ElseIf n < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytesCount: An argument is out of range value.", "n")
+		End If
+		Return GetBytesCountCore(s, n)
+	End Function
+#ifdef UNICODE
+	/*!
+	@brief	符号化して得られる文字列の長さを計算する。
+	@param[in] s	対象文字列
+	@return	符号化して得られる文字列の長さ
+	@date	2007/12/08
+	*/
+	Function GetBytesCount(s As String) As Long
+		If ActiveBasic.IsNothing(s) Then
+			Throw New ArgumentNullException("Encoding.GetBytesCount: An argument is null value.", "s")
+		End If
+		Return GetBytesCountCore(StrPtr(s), s.Length)
+	End Function
+#endif
+	/*!
+	@brief	符号化して得られる文字列の長さを計算する。
+	@param[in] s	対象文字列
+	@param[in] index	開始位置
+	@param[in] count	符号化する文字の数
+	@return	符号化して得られる文字列の長さ
+	@date	2007/12/08
+	*/
+	Function GetBytesCount(s As *WCHAR, index As Long, count As Long) As Long
+		If s = 0 Then
+			Throw New ArgumentNullException("Encoding.GetBytesCount: An argument is null value.", "s")
+		ElseIf index < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytesCount: An argument is out of range value.", "index")
+		ElseIf count < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytesCount: An argument is out of range value.", "count")
+		End If
+		Return GetBytesCountCore(VarPtr(s[index]), count)
+	End Function
+Protected
+	/*!
+	@brief	GetBytesCountの実装を行う。
+	@param[in] s	対象文字列
+	@param[in] n	sの長さ
+	@return	符号化して得られる文字列の長さ
+	@date	2007/12/08
+	*/
+	Abstract Function GetBytesCountCore(s As *WCHAR, n As Long) As Long
+Public
+	/*!
+	@brief	符号化する。
+	@param[in] chars	入力
+	@param[in] charCount	charsの長さ
+	@param[out] bytes	出力
+	@param[in] byteCount	bytesのバッファの大きさ
+	@return bytesに書き込まれたバイト数
+	@date	2007/12/08
+	*/
+	Function GetBytes(chars As *WCHAR, charCount As Long, bytes As *Byte, byteCount As Long) As Long
+		If chars = 0 Then
+			Throw New ArgumentNullException("Encoding.GetBytes: An argument is null value.", "chars")
+		ElseIf bytes = 0 Then
+			Throw New ArgumentNullException("Encoding.GetBytes: An argument is null value.", "bytes")
+		ElseIf charCount < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytes: An argument is out of range value.", "charCount")
+		ElseIf byteCount < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytes: An argument is out of range value.", "byteCount")
+		End If
+
+		Return GetBytesCore(chars, charCount, bytes, byteCount)
+	End Function
+	/*!
+	@brief	符号化する。
+	@param[in] chars	入力
+	@param[in] index	charsの開始位置
+	@param[in] count	符号化する文字の数
+	@param[out] bytes	出力
+	@param[in] byteCount	bytesのバッファの大きさ
+	@return bytesに書き込まれたバイト数
+	@date	2007/12/08
+	*/
+	Function GetBytes(chars As *WCHAR, index As Long, count As Long, bytes As *Byte, byteCount As Long) As Long
+		If chars = 0 Then
+			Throw New ArgumentNullException("Encoding.GetBytes: An argument is null value.", "chars")
+		ElseIf bytes = 0 Then
+			Throw New ArgumentNullException("Encoding.GetBytes: An argument is null value.", "bytes")
+		ElseIf index < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytesCount: An argument is out of range value.", "index")
+		ElseIf count < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytesCount: An argument is out of range value.", "count")
+		ElseIf byteCount < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytes: An argument is out of range value.", "byteCount")
+		End If
+
+		Return GetBytesCore(VarPtr(chars[index]), count, bytes, byteCount)
+	End Function
+#ifdef UNICODE
+	/*!
+	@brief	符号化する。
+	@param[in] s	入力
+	@param[in] index	sの開始位置
+	@param[in] count	符号化する文字の数
+	@param[out] bytes	出力
+	@param[in] byteCount	bytesのバッファの大きさ
+	@return bytesに書き込まれたバイト数
+	@date	2007/12/08
+	*/
+	Function GetBytes(s As String, index As Long, count As Long, bytes As *Byte, byteCount As Long) As Long
+		If chars = 0 Then
+			Throw New ArgumentNullException("Encoding.GetBytes: An argument is null value.", "chars")
+		ElseIf bytes = 0 Then
+			Throw New ArgumentNullException("Encoding.GetBytes: An argument is null value.", "bytes")
+		ElseIf index < 0 Or index >= s.Length Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytes: An argument is out of range value.", "index")
+		ElseIf count < 0 Or index + count >= s.Length Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytes: An argument is out of range value.", "count")
+		ElseIf byteCount < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetBytes: An argument is out of range value.", "byteCount")
+		End If
+		Dim p = StrPtr(s)
+		Return GetBytesCore(VarPtr(p[index]), count, bytes, byteCount)
+	End Function
+#endif
+Protected
+	/*!
+	@brief	GetBytesの処理を行う。
+	@param[in] chars	入力
+	@param[in] charCount	charsの長さ
+	@param[out] bytes	出力
+	@param[in] byteCount	bytesのバッファの大きさ
+	@return bytesに書き込まれたバイト数
+	@exception ArgumentException	バッファの大きさが足りない
+	@exception EncoderFallbackException	フォールバックが発生した
+	@date	2007/12/08
+	*/
+	Abstract Function GetBytesCore(chars As *WCHAR, charCount As Long, bytes As *Byte, byteCount As Long) As Long
+
+Public
+	/*!
+	@brief	復号して得られる文字列の長さを計算する。
+	@param[in] s	対象文字列
+	@param[in] n	sの長さ
+	@return	復号して得られる文字列の長さ
+	@date	2007/12/08
+	*/
+	Function GetCharsCount(s As *Byte, n As Long) As Long
+		If s = 0 Then
+			Throw New ArgumentNullException("Encoding.GetCharsCount: An argument is null value.", "s")
+		ElseIf n < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetCharsCount: An argument is out of range value.", "n")
+		End If
+		Return GetCharsCountCore(s, n)
+	End Function
+	/*!
+	@brief	復号して得られる文字列の長さを計算する。
+	@param[in] s	対象文字列
+	@param[in] index	開始位置
+	@param[in] count	符号化する文字の数
+	@return	符号化して得られる文字列の長さ
+	@date	2007/12/08
+	*/
+	Function GetCharsCount(s As *Byte, index As Long, count As Long) As Long
+		If s = 0 Then
+			Throw New ArgumentNullException("Encoding.GetCharsCount: An argument is null value.", "s")
+		ElseIf index < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetCharsCount: An argument is out of range value.", "index")
+		ElseIf count < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetCharsCount: An argument is out of range value.", "count")
+		End If
+		Return GetCharsCountCore(VarPtr(s[index]), count)
+	End Function
+Protected
+	/*!
+	@brief	GetCharsCountの処理を行う。
+	@param[in] s	対象文字列
+	@param[in] n	sの長さ
+	@return	符号化して得られる文字列の長さ
+	@date	2007/12/08
+	*/
+	Abstract Function GetCharsCountCore(s As *Byte, n As Long) As Long
+	/*!
+	*/
+Public
+	/*!
+	@brief	復号する。
+	@param[in] bytes	入力
+	@param[in] byteCount	charsの長さ
+	@param[out] chars	出力
+	@param[in] charCount	bytesのバッファの大きさ
+	@return bytesに書き込まれたバイト数
+	@date	2007/12/08
+	*/
+	Function GetChars(bytes As *Byte, byteCount As Long, chars As *WCHAR, charCount As Long) As Long
+		If chars = 0 Then
+			Throw New ArgumentNullException("Encoding.GetChars: An argument is null value.", "chars")
+		ElseIf bytes = 0 Then
+			Throw New ArgumentNullException("Encoding.GetChars: An argument is null value.", "bytes")
+		ElseIf charCount < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetChars: An argument is out of range value.", "charCount")
+		ElseIf byteCount < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetChars: An argument is out of range value.", "byteCount")
+		End If
+
+		Return GetCharsCore(bytes, byteCount, chars, charCount)
+	End Function
+	/*!
+	@brief	復号する。
+	@param[in] bytes	入力
+	@param[in] index	charsの開始位置
+	@param[in] count	符号化する文字の数
+	@param[out] chars	出力
+	@param[in] charCount	bytesのバッファの大きさ
+	@return bytesに書き込まれたバイト数
+	@date	2007/12/08
+	*/
+	Function GetChars(bytes As *Byte, index As Long, count As Long, chars As *WCHAR, charCount As Long) As Long
+		If chars = 0 Then
+			Throw New ArgumentNullException("Encoding.GetChars: An argument is null value.", "chars")
+		ElseIf bytes = 0 Then
+			Throw New ArgumentNullException("Encoding.GetChars: An argument is null value.", "bytes")
+		ElseIf index < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetChars: An argument is out of range value.", "index")
+		ElseIf count < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetChars: An argument is out of range value.", "count")
+		ElseIf charCount < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetChars: An argument is out of range value.", "byteCount")
+		End If
+
+		Return GetCharsCore(VarPtr(bytes[index]), count, chars, charCount)
+	End Function
+Protected
+	/*!
+	@brief	GetCharsの処理を行う。
+	@param[in] bytes	入力
+	@param[in] byteCount	charsの長さ
+	@param[out] chars	出力
+	@param[in] charCount	bytesのバッファの大きさ
+	@return bytesに書き込まれたバイト数
+	@exception ArgumentException	バッファの大きさが足りない
+	@exception EncoderFallbackException	フォールバックが発生した
+	@date	2007/12/08
+	*/
+	Abstract Function GetCharsCore(bytes As *Byte, byteCount As Long, chars As *WCHAR, charCount As Long) As Long
+Public
+#ifdef UNICODE
+	/*!
+	@brief	復号し、Stringで結果を返す。
+	@param[in] bytes	入力
+	@param[in] byteCount	charsの長さ
+	@return	変換結果の文字列
+	@date	2007/12/08
+	*/
+	Function GetString(bytes As *Byte, byteCount As Long) As String
+		If bytes = 0 Then
+			Throw New ArgumentNullException("Encoding.GetString: An argument is null value.", "bytes")
+		ElseIf byteCount < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetString: An argument is out of range value.", "byteCount")
+		End If
+		Return getStringCore(bytes, byteCount)
+	End Function
+	/*!
+	@brief	復号し、Stringで結果を返す。
+	@param[in] bytes	入力
+	@param[in] index	charsの開始位置
+	@param[in] count	符号化する文字の数
+	@return	変換結果の文字列
+	@date	2007/12/08
+	*/
+	Function GetString(bytes As *Byte, index As Long, count As Long) As String
+		If bytes = 0 Then
+			Throw New ArgumentNullException("Encoding.GetString: An argument is null value.", "bytes")
+		ElseIf index < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetString: An argument is out of range value.", "index")
+		ElseIf count < 0 Then
+			Throw New ArgumentOutOfRangeException("Encoding.GetString: An argument is out of range value.", "count")
+		End If
+		Return getStringCore(VarPtr(bytes[index]), count)
+	End Function
+Private
+
+	Function getStringCore(bytes As *Byte, byteCount As Long) As String
+		Dim sb = New StringBuilder
+		Dim bufSize = GetMaxCharCount(byteCount)
+		sb.Length = bufSize
+		Dim len = GetCharsCore(bytes, byteCount, StrPtr(sb), bufSize)
+		sb.Length = len
+		getStringCore = sb.ToString
+	End Function
+#endif
+
+Public
+	/*!
+	@brief	符号器を取得する。
+	*/
+	Abstract Function GetDecoder() As Decoder
+
+	/*!
+	@brief	復号器を取得する。
+	*/
+	Abstract Function GetEncoder() As Encoder
+
+	/*!
+	@brief	ある長さの文字列を符号化して得られるバイト列の最大の長さを返す。
+	*/
+	Abstract Function GetMaxByteCount(charCount As Long) As Long
+
+	/*!
+	@brief	ある長さのバイト列を復号して得られる文字列の最大の長さを返す。
+	*/
+	Abstract Function GetMaxCharCount(charCount As Long) As Long
+
+	/*!
+	@brief	符号化された文字列の先頭につける識別文字列の取得
+	ようするにUTFのBOM
+	*/
+	Virtual Function GetPreamble() As *Byte
+		Return 0
+	End Function
+
+	/*!
+	@brief	GetPreambleの配列の要素数
+	*/
+	Virtual Function GetPreambleLength() As Long
+		Return 0
+	End Function
+
+	/*!
+	@brief	正規化されるかどうか。
+	*/
+	Abstract Function IsAlwaysNormalized() As Boolean
+
+	/*!
+	@brief	指定された方式で正規化されるかどうか。
+	*/
+	Abstract Function IsAlwaysNormalized(form As NormalizationForm) As Boolean
+
+	Abstract Function BodyName() As String
+	Abstract Function HeaderName() As String
+
+	/*!
+	@brief	コードページの取得。
+	*/
+'	Abstract Function CodePage() As Long
+	/*!
+	@brief	最も厳密に対応するWindowsコードページの取得。
+	*/
+'	Abstract Function WindowsCodePage() As Long
+
+	Function DecoderFallback() As DecoderFallback
+		Return decoderFallback
+	End Function
+
+	Sub DecoderFallback(f As DecoderFallback)
+		If ActiveBasic.IsNothing(f) Then
+			Throw New ArgumentNullException("f")
+		End If
+		decoderFallback = f
+	End Sub
+
+	Function EncoderFallback() As EncoderFallback
+		Return encoderFallback
+	End Function
+
+	Sub EncoderFallback(f As EncoderFallback)
+		If ActiveBasic.IsNothing(f) Then
+			Throw New ArgumentNullException("f")
+		End If
+		encoderFallback = f
+	End Sub
+
+Private
+	decoderFallback As DecoderFallback
+	encoderFallback As EncoderFallback
+Public
+	/*!
+	@brief	この符号化形式の名前の取得。
+	*/
+	Abstract Function EncodingName() As String
+
+	/*!
+	@brief	この符号化形式のIANA登録名の取得。
+	*/
+	Abstract Function WebName() As String
+
+'	Abstract Function IsBrowserDisplay() As Boolean
+'	Abstract Function IsBrowserSave() As Boolean
+'	Abstract Function IsMailNewsDisplay() As Boolean
+'	Abstract Function IsMailNewsSave() As Boolean
+
+'	Abstract Function IsReadOnly() Boolean
+
+	/*!
+	@brief	この符号化形式が、1バイト文字だけを使う（複数バイト文字を使わない）かどうか。
+	*/
+	Abstract Function IsSingleByte() As Boolean
+
+	'GetPreamble
+
+	/*!
+	@brief	ある符号化文字列から別の符号化文字列へ変換する。
+	@param[in] srcEncoding	入力の符号化方式
+	@param[in] dstEncoding	出力の符号化方式
+	@param[in] bytes	入力文字列
+	@param[in] size	バイト単位での文字列の長さ
+	@return	出力文字列
+	@exception ArgumentNullException	srcEncoding, dstEncoding, bytesの少なくとも1つ以上がNothing/NULLのとき。
+	@exception ArgumentOutOfRangeException	sizeが明らかに範囲外（負の値など）のとき。
+	@exception DecoderFallbackException
+	@exception EncoderFallbackException
+	*/
+	Static Function Convert(srcEncoding As Encoding, dstEncoding As Encoding, bytes As *Byte, size As Long) As *Byte
+	End Function
+	
+	Static Function Convert(srcEncoding As Encoding, dstEncoding As Encoding, bytes As *Byte, index As Long, count As Long) As *Byte
+	End Function
+
+	/*!
+	@brief	指定したコードページ用のEncodingインスタンスの取得。
+	*/
+	Static Function GetEncoding(codepage As Long) As Encoding
+	End Function
+'	Static Function GetEncoding(codepage As Long, encoderFallback As EncoderFallback, decoderFallback As DecoderFallback) As Encoding
+'	End Function
+	/*!
+	@brief	指定した符号化形式名用のEncodingインスタンスの取得。
+	*/
+	Static Function GetEncoding(name As String) As Encoding
+	End Function
+'	Static Function GetEncoding(name As String, encoderFallback As EncoderFallback, decoderFallback As DecoderFallback) As Encoding
+'	End Function
+
+	/*!
+	@brief	システム既定のANSIコードページ用のEncodingインスタンスの取得。
+	*/
+	Static Function Default() As Encoding
+	End Function
+	/*!
+	@brief	UTF-7用のEncodingインスタンスの取得。
+	*/
+	Static Function UTF7() As Encoding
+	End Function
+	/*!
+	@brief	UTF-8用のEncodingインスタンスの取得。
+	*/
+	Static Function UTF8() As Encoding
+	End Function
+	/*!
+	@brief	UTF-16LE用のEncodingインスタンスの取得。
+	*/
+	Static Function UTF16() As Encoding
+	End Function
+	/*!
+	@brief	UTF-16BE用のEncodingインスタンスの取得。
+	*/
+	Static Function UTF16BE() As Encoding
+	End Function
+	/*!
+	@brief	UTF-32LE用のEncodingインスタンスの取得。
+	*/
+	Static Function UTF32() As Encoding
+	End Function
+End Class
+
+/*!
+@brief	復号を行うクラス
+@date	2007/12/19
+@auther	Egtra
+*/
+Class Decoder
+Public
+	/*!
+	@brief	変換する
+	@param[in] bytes	入力
+	@param[in] byteIndex 入力開始位置
+	@param[in] byteCount 入力要素数
+	@param[out] chars	出力
+	@param[in] charIndex 出力開始位置
+	@param[in] charCount 出力要素数
+	@param[in] flush	終了後に内部状態を初期化するかどうか
+	@param[out] charsUsed	使用された入力の要素数
+	@param[out] bytesUsed	出力の内、実際に書き込まれた要素数
+	@param[out] completed	入力の全ての文字が変換に使われたかどうか
+	*/
+	Sub Convert(bytes As *Byte, byteIndex As Long, byteCount As Long,
+		chars As *WCHAR, charIndex As Long, charCount As Long, flush As Boolean,
+		ByRef bytesUsed As Long, ByRef charsUsed As Long, ByRef completed As Boolean)
+
+		If bytes = 0 Then
+			Throw New ArgumentNullException("bytes")
+		ElseIf byteIndex < 0 Then
+			Throw New ArgumentOutOfRangeException("byteIndex")
+		ElseIf byteCount < 0 Then
+			Throw New ArgumentOutOfRangeException("byteCount")
+		ElseIf chars = 0 Then
+			Throw New ArgumentNullException("chars")
+		ElseIf charIndex < 0 Then
+			Throw New ArgumentOutOfRangeException("charIndex")
+		ElseIf charCount < 0 Then
+			Throw New ArgumentOutOfRangeException("charCount")
+		End If
+		ConvertCore(VarPtr(bytes[byteIndex]), byteCount, VarPtr(chars[charIndex]), charCount, flush, bytesUsed, charsUsed, completed)
+	End Sub
+
+	/*!
+	@overload Sub Convert(bytes As *Byte, byteIndex As Long, byteCount As Long,
+		chars As *WCHAR, charIndex As Long, charCount As Long, flush As Boolean,
+		ByRef bytesUsed As Long, ByRef charsUsed As Long, ByRef completed As Boolean)
+	*/
+	Sub Convert(bytes As *Byte, byteCount As Long,
+		chars As *WCHAR, charCount As Long, flush As Boolean,
+		ByRef bytesUsed As Long, ByRef charsUsed As Long, ByRef completed As Boolean)
+
+		If bytes = 0 Then
+			Throw New ArgumentNullException("bytes")
+		ElseIf byteCount < 0 Then
+			Throw New ArgumentOutOfRangeException("byteCount")
+		ElseIf chars = 0 Then
+			Throw New ArgumentNullException("chars")
+		ElseIf charCount < 0 Then
+			Throw New ArgumentOutOfRangeException("charCount")
+		End If
+		ConvertCore(bytes, byteCount, chars, charCount, flush, bytesUsed, charsUsed, completed)
+	End Sub
+
+	/*!
+	@brief	変換する
+	@param[in] bytes	入力
+	@param[in] byteIndex 入力開始位置
+	@param[in] byteCount 入力要素数
+	@param[out] chars	出力
+	@param[in] charIndex 出力開始位置
+	@param[in] charCount 出力要素数
+	@param[in] flush	終了後に内部状態を初期化するかどうか
+	@return	出力の内、実際に書き込まれた要素数
+	*/
+	Function GetChars(bytes As *Byte, byteIndex As Long, byteCount As Long, chars As *WCHAR, charIndex As Long, charCount As Long, flush As Boolean) As Long
+		Dim bytesUsed As Long
+		Dim completed As Boolean
+		Convert(bytes, byteIndex, byteCount, chars, charIndex, charCount, flush, bytesUsed, GetChars, completed)
+	End Function
+
+	/*!
+	@overload Function GetChars(bytes As *Byte, byteIndex As Long, byteCount As Long, chars As *WCHAR, charIndex As Long, charCount As Long, flush As Boolean) As Long
+	*/
+	Function GetChars(bytes As *Byte, byteCount As Long, chars As *WCHAR, charCount As Long, flush As Boolean) As Long
+		Dim bytesUsed As Long
+		Dim completed As Boolean
+		Convert(bytes, byteCount, chars, charCount, flush, bytesUsed, GetChars, completed)
+	End Function
+
+	/*!
+	@overload Function GetChars(bytes As *Byte, byteIndex As Long, byteCount As Long, chars As *WCHAR, charIndex As Long, charCount As Long, flush As Boolean) As Long
+	*/
+	Function GetChars(bytes As *Byte, byteIndex As Long, byteCount As Long, chars As *WCHAR, charIndex As Long, charCount As Long) As Long
+		GetChars = GetChars(bytes, byteIndex, byteCount, chars, charIndex, charCount, False)
+	End Function
+
+	/*!
+	@brief	フォールバックの取得
+	*/
+	Function Fallback() As DecoderFallback
+		Return fallback
+	End Function
+
+	/*!
+	@brief	フォールバックの設定
+	*/
+	Sub Fallback(newFallback As DecoderFallback)
+		If ActiveBasic.IsNothing(newFallback) Then
+			Throw New ArgumentNullException("newFallback")
+		End If
+		fallback = newFallback
+	End Sub
+Protected
+	/*!
+	@brief	実際に変換するメソッド
+	@param[in] bytes	入力
+	@param[in] byteCount 入力要素数
+	@param[out] chars	出力
+	@param[in] charCount 出力要素数
+	@param[in] flush	終了後に内部状態を初期化するかどうか
+	@param[out] charsUsed	使用された入力の要素数
+	@param[out] bytesUsed	出力の内、実際に書き込まれた要素数
+	@param[out] completed	入力の全ての文字が変換に使われたかどうか
+	*/
+	Abstract Sub ConvertCore(bytes As *Byte, byteCount As Long, chars As *WCHAR, charCount As Long, flush As Boolean,
+		ByRef bytesUsed As Long, ByRef charsUsed As Long, ByRef completed As Boolean)
+
+Private
+	fallback As DecoderFallback
+End Class
+
+/*!
+@brief	符号化を行うクラス
+@date	2007/12/19
+@auther	Egtra
+*/
+Class Encoder
+Public
+	/*!
+	@brief	変換する
+	@param[in] chars	入力
+	@param[in] charIndex 入力開始位置
+	@param[in] charCount 入力要素数
+	@param[out] bytes	出力
+	@param[in] byteIndex 出力開始位置
+	@param[in] byteCount 出力要素数
+	@param[in] flush	終了後に内部状態を初期化するかどうか
+	@param[out] charsUsed	使用された入力の要素数
+	@param[out] bytesUsed	出力の内、実際に書き込まれた要素数
+	@param[out] completed	入力の全ての文字が変換に使われたかどうか
+	*/
+	Sub Convert(chars As *WCHAR, charIndex As Long, charCount As Long,
+		bytes As *Byte, byteIndex As Long, byteCount As Long, flush As Boolean,
+		ByRef charsUsed As Long, ByRef bytesUsed As Long, ByRef completed As Boolean)
+
+		If chars = 0 Then
+			Throw New ArgumentNullException("chars")
+		ElseIf charIndex < 0 Then
+			Throw New ArgumentOutOfRangeException("charIndex")
+		ElseIf charCount < 0 Then
+			Throw New ArgumentOutOfRangeException("charCount")
+		ElseIf bytes = 0 Then
+			Throw New ArgumentNullException("bytes")
+		ElseIf byteIndex < 0 Then
+			Throw New ArgumentOutOfRangeException("byteIndex")
+		ElseIf byteCount < 0 Then
+			Throw New ArgumentOutOfRangeException("byteCount")
+		End If
+		ConvertCore(VarPtr(chars[charIndex]), charCount, VarPtr(bytes[byteIndex]), byteCount, flush, charsUsed, bytesUsed, completed)
+	End Sub
+
+	/*!
+	@overload Sub Convert(chars As *WCHAR, charIndex As Long, charCount As Long,
+		bytes As *Byte, byteIndex As Long, byteCount As Long, flush As Boolean,
+		ByRef charsUsed As Long, ByRef bytesUsed As Long, ByRef completed As Boolean)
+	*/
+	Sub Convert(chars As *WCHAR, charCount As Long,
+		bytes As *Byte, byteCount As Long, flush As Boolean,
+		ByRef charsUsed As Long, ByRef bytesUsed As Long, ByRef completed As Boolean)
+
+		If chars = 0 Then
+			Throw New ArgumentNullException("chars")
+		ElseIf charCount < 0 Then
+			Throw New ArgumentOutOfRangeException("charCount")
+		ElseIf bytes = 0 Then
+			Throw New ArgumentNullException("bytes")
+		ElseIf byteCount < 0 Then
+			Throw New ArgumentOutOfRangeException("byteCount")
+		End If
+		ConvertCore(chars, charCount, bytes, byteCount, flush, charsUsed, bytesUsed, completed)
+	End Sub
+
+	/*!
+	@brief	変換する
+	@param[in] chars	入力
+	@param[in] charIndex 入力開始位置
+	@param[in] charCount 入力要素数
+	@param[out] bytes	出力
+	@param[in] byteIndex 出力開始位置
+	@param[in] byteCount 出力要素数
+	@param[in] flush	終了後に内部状態を初期化するかどうか
+	@return bytesUsed	出力の内、実際に書き込まれた要素数
+	*/
+	Function GetBytes(chars As *WCHAR, charIndex As Long, charCount As Long, bytes As *Byte, byteIndex As Long, byteCount As Long, flush As Boolean) As Long
+		Dim charsUsed As Long
+		Dim completed As Boolean
+		Convert(chars, charIndex, charCount, bytes, byteIndex, byteCount, flush, charsUsed, GetBytes, completed)
+	End Function
+
+	/*!
+	@overload Function GetBytes(chars As *WCHAR, charIndex As Long, charCount As Long, bytes As *Byte, byteIndex As Long, byteCount As Long, flush As Boolean) As Long
+	*/
+	Function GetBytes(chars As *WCHAR, charCount As Long, bytes As *Byte, byteCount As Long, flush As Boolean) As Long
+		Dim charsUsed As Long
+		Dim completed As Boolean
+		Convert(chars, charCount, bytes, byteCount, flush, charsUsed, GetBytes, completed)
+	End Function
+
+	/*!
+	@overload Function GetBytes(chars As *WCHAR, charIndex As Long, charCount As Long, bytes As *Byte, byteIndex As Long, byteCount As Long, flush As Boolean) As Long
+	*/
+	Function GetBytes(chars As *WCHAR, charIndex As Long, charCount As Long, bytes As *Byte, byteIndex As Long, byteCount As Long) As Long
+		GetBytes = GetBytes(chars, charIndex, charCount, bytes, byteIndex, byteCount, False)
+	End Function
+
+	/*!
+	@brief	フォールバックの取得
+	*/
+	Function Fallback() As EncoderFallback
+		Return fallback
+	End Function
+
+	/*!
+	@brief	フォールバックの設定
+	*/
+	Sub Fallback(newFallback As EncoderFallback)
+		If ActiveBasic.IsNothing(newFallback) Then
+			Throw New ArgumentNullException("newFallback")
+		End If
+		fallback = newFallback
+	End Sub
+Protected
+	/*!
+	@brief	実際に変換するメソッド
+	@param[in] chars	入力
+	@param[in] charCount 入力要素数
+	@param[out] bytes	出力
+	@param[in] byteCount 出力要素数
+	@param[in] flush	終了後に内部状態を初期化するかどうか
+	@param[out] bytesUsed	使用された入力の要素数
+	@param[out] charsUsed	出力の内、実際に書き込まれた要素数
+	@param[out] completed	入力の全ての文字が変換に使われたかどうか
+	*/
+	Abstract Sub ConvertCore(chars As *WCHAR, charCount As Long, bytes As *Byte, byteCount As Long, flush As Boolean,
+		ByRef bytesUsed As Long, ByRef charsUsed As Long, ByRef completed As Boolean)
+
+Private
+	fallback As EncoderFallback
+End Class
+
+Enum NormalizationForm
+	FormC
+	FormD
+	FormKC
+	FormKD
+End Enum
+
+Class EncoderFallback
+End Class
+
+End Namespace 'Text
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Text/StringBuilder.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Text/StringBuilder.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Text/StringBuilder.ab	(revision 506)
@@ -0,0 +1,533 @@
+'Classes/System/Text/StringBuilder.ab
+
+Namespace System
+Namespace Text
+
+Class StringBuilder
+Public
+	Sub StringBuilder()
+		initialize(1024)
+	End Sub
+
+	Sub StringBuilder(capacity As Long)
+		initialize(capacity)
+	End Sub
+
+	Sub StringBuilder(s As String)
+		initialize(s, 0, s.Length, s.Length * 2)
+	End Sub
+
+	Sub StringBuilder(capacity As Long, maxCapacity As Long)
+		initialize(capacity, maxCapacity)
+	End Sub
+
+	Sub StringBuilder(s As String, capacity As Long)
+		initialize(s, 0, s.Length, capacity)
+	End Sub
+
+	Sub StringBuilder(s As String, startIndex As Long, length As Long, capacity As Long)
+		initialize(s, startIndex, length, capacity)
+	End Sub
+
+	'Methods
+
+	Function Append(x As Boolean) As StringBuilder
+		Append(Str$(x))
+		Return This
+	End Function
+
+	Function Append(x As Char) As StringBuilder
+		EnsureCapacity(size + 1)
+		separateBuffer()
+		chars[size] = x
+		size++
+		Return This
+	End Function
+#ifdef UNICODE
+	Function Append(x As SByte) As StringBuilder
+		ActiveBasic.Strings.Detail.FormatIntegerD(This, x, DWORD_MAX, 0, 0)
+		Return This
+	End Function
+#endif
+	Function Append(x As Byte) As StringBuilder
+		ActiveBasic.Strings.Detail.FormatIntegerU(This, x, DWORD_MAX, 0, 0)
+		Return This
+	End Function
+
+	Function Append(x As Integer) As StringBuilder
+		ActiveBasic.Strings.Detail.FormatIntegerD(This, x, DWORD_MAX, 0, 0)
+		Return This
+	End Function
+#ifndef UNICODE
+	Function Append(x As Word) As StringBuilder
+		ActiveBasic.Strings.Detail.FormatIntegerU(This, x, DWORD_MAX, 0, 0)
+		Return This
+	End Function
+#endif
+	Function Append(x As Long) As StringBuilder
+		ActiveBasic.Strings.Detail.FormatIntegerD(This, x, DWORD_MAX, 0, 0)
+		Return This
+	End Function
+
+	Function Append(x As DWord) As StringBuilder
+		ActiveBasic.Strings.Detail.FormatIntegerU(This, x, DWORD_MAX, 0, 0)
+		Return This
+	End Function
+
+	Function Append(x As Int64) As StringBuilder
+		ActiveBasic.Strings.Detail.FormatIntegerLD(This, x, DWORD_MAX, 0, 0)
+		Return This
+	End Function
+
+	Function Append(x As QWord) As StringBuilder
+		ActiveBasic.Strings.Detail.FormatIntegerLU(This, x, DWORD_MAX, 0, 0)
+		Return This
+	End Function
+
+	Function Append(x As Single) As StringBuilder
+		ActiveBasic.Strings.Detail.FormatFloatG(This, x, DWORD_MAX, 0, 0)
+		Return This
+	End Function
+
+	Function Append(x As Double) As StringBuilder
+		ActiveBasic.Strings.Detail.FormatFloatG(This, x, DWORD_MAX, 0, 0)
+		Return This
+	End Function
+
+	Function Append(x As Object) As StringBuilder
+		Append(x.ToString)
+		Return This
+	End Function
+
+	Function Append(c As Char, n As Long) As StringBuilder
+		EnsureCapacity(size + n)
+		ActiveBasic.Strings.ChrFill(VarPtr(chars[size]), n As SIZE_T, c)
+		size += n
+		Return This
+	End Function
+
+	Function Append(s As String) As StringBuilder
+		If Not String.IsNullOrEmpty(s) Then
+			appendCore(s, 0, s.Length)
+		End If
+		Return This
+	End Function
+
+	Function Append(s As String, startIndex As Long, count As Long) As StringBuilder
+		Return Append(StrPtr(s), startIndex, count)
+	End Function
+
+	Function Append(s As *Char, startIndex As Long, count As Long) As StringBuilder
+		If s = 0 Then
+			If startIndex = 0 And count = 0 Then
+				Return This
+			Else
+				Throw New ArgumentNullException("StringBuilder.Append: An argument is null", "s")
+			End If
+		ElseIf startIndex < 0 Or count < 0 Then
+			Throw New ArgumentOutOfRangeException("StringBuilder.Append: One or more arguments are out of range value.", "startIndex or count or both")
+		End If
+		appendCore(s, startIndex, count)
+		Return This
+	End Function
+Private
+	Sub appendCore(s As *Char, start As Long, count As Long)
+		EnsureCapacity(size + count)
+		separateBuffer()
+		ActiveBasic.Strings.ChrCopy(VarPtr(chars[size]), VarPtr(s[start]), count As SIZE_T)
+		size += count
+	End Sub
+
+	Sub appendCore(s As String, start As Long, count As Long)
+		EnsureCapacity(size + count)
+		separateBuffer()
+		s.CopyTo(start, chars, size, count)
+		size += count
+	End Sub
+Public
+	'AppendFormat
+
+	Function AppendLine() As StringBuilder
+		separateBuffer()
+		Append(Environment.NewLine)
+		Return This
+	End Function
+
+	Function AppendLine(s As String) As StringBuilder
+		EnsureCapacity(Capacity + s.Length + Environment.NewLine.Length)
+		separateBuffer()
+		Append(s)
+		Append(Environment.NewLine)
+		Return This
+	End Function
+
+	Const Sub CopyTo(sourceIndex As Long, ByRef dest[] As Char, destIndex As Long, count As Long)
+		If dest = 0 Then
+			Throw New ArgumentNullException("StringBuilder.CopyTo: An argument is null", "sourceIndex")
+		ElseIf size < sourceIndex + count Or sourceIndex < 0 Or destIndex < 0 Or count < 0 Then
+			Throw New ArgumentOutOfRangeException("StringBuilder.CopyTo: One or more arguments are out of range value.", "startIndex or count or both")
+		End If
+
+		memcpy(VarPtr(dest[destIndex]), VarPtr(chars[sourceIndex]), count * SizeOf (Char))
+	End Sub
+
+	Function EnsureCapacity(c As Long) As Long
+		If c < 0 Or c > MaxCapacity Then
+			Throw New ArgumentOutOfRangeException("StringBuilder.Append: An argument is out of range value.", "c")
+		ElseIf c > Capacity Then
+			Dim p = GC_malloc_atomic((c + 1) * SizeOf (Char)) As *Char
+			ActiveBasic.Strings.ChrCopy(p, chars, size As SIZE_T)
+			chars = p
+			capacity = c
+			stringized = False
+		End If
+	End Function
+
+	'Override Function Equals(o As Object) As Boolean
+
+	Const Function Equals(s As StringBuilder) As Boolean
+		Return ActiveBasic.Strings.StrCmp(chars, s.chars) = 0 _
+			And capacity = s.capacity _
+			And maxCapacity = s.maxCapacity
+	End Function
+
+	Override Function GetHashCode() As Long
+#ifdef UNICODE
+		Dim n = size
+#else
+		Dim n = (size + 1) >> 1
+#endif
+		Return _System_GetHashFromWordArray(chars As *Word, n As SIZE_T) Xor capacity Xor maxCapacity
+	End Function
+
+	Function Insert(i As Long, x As Boolean) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, Str$(x))
+		Return This
+	End Function
+
+	Function Insert(i As Long, x As Char) As StringBuilder
+		Insert(i, VarPtr(x), 0, 1)
+		Return This
+	End Function
+#ifdef UNICODE
+	Function Insert(i As Long, x As SByte) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, Str$(x As Long))
+		Return This
+	End Function
+#else
+	Function Insert(i As Long, x As Word) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, Str$(x As DWord))
+		Return This
+	End Function
+#endif
+
+	Function Insert(i As Long, x As Byte) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, Str$(x))
+		Return This
+	End Function
+
+	Function Insert(i As Long, x As Integer) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, Str$(x))
+		Return This
+	End Function
+
+	Function Insert(i As Long, x As Long) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, Str$(x))
+		Return This
+	End Function
+
+	Function Insert(i As Long, x As DWord) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, Str$(x))
+		Return This
+	End Function
+
+	Function Insert(i As Long, x As Int64) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, Str$(x))
+		Return This
+	End Function
+
+	Function Insert(i As Long, x As Single) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, Str$(x))
+		Return This
+	End Function
+
+	Function Insert(i As Long, x As Double) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, Str$(x))
+		Return This
+	End Function
+
+	Function Insert(i As Long, s As String) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, s)
+		Return This
+	End Function
+
+	Function Insert(i As Long, o As Object) As StringBuilder
+		rangeCheck(i)
+		insertCore(i, o.ToString)
+		Return This
+	End Function
+
+	Function Insert(index As Long, x As String, n As Long) As StringBuilder
+		rangeCheck(index)
+		If n < 0 Then
+			Throw New ArgumentOutOfRangeException("StringBuilder.Insert: An argument is out of range value.", "n")
+		End If
+		Dim len = x.Length
+		Dim lenTotal = len * n
+		Dim newSize = size + lenTotal
+		EnsureCapacity(newSize)
+		separateBuffer()
+
+		Dim i As Long
+		For i = 0 To ELM(n)
+			x.CopyTo(0, chars, size + i * len, len)
+		Next
+		size = newSize
+		Return This
+	End Function
+
+	Function Insert(i As Long, x As *Char, index As Long, count As Long) As StringBuilder
+		rangeCheck(i)
+		If x = 0 Then
+			Throw New ArgumentNullException("StringBuilder.Insert: An argument is null", "x")
+		ElseIf index < 0 Or count < 0 Then
+			Throw New ArgumentOutOfRangeException("StringBuilder.Append: One or more arguments are out of range value.", "index or count or both")
+		End If
+
+		Dim newSize = size + count
+		EnsureCapacity(newSize)
+		separateBuffer()
+		ActiveBasic.Strings.ChrMove(VarPtr(chars[i + count]), VarPtr(chars[i]), (size - i) As SIZE_T)
+		ActiveBasic.Strings.ChrCopy(VarPtr(chars[i]), VarPtr(x[index]), count As SIZE_T)
+		size = newSize
+		Return This
+	End Function
+
+Private
+	Sub insertCore(i As Long, s As String)
+		Dim newSize = size + s.Length
+		EnsureCapacity(newSize)
+		separateBuffer()
+		ActiveBasic.Strings.ChrMove(VarPtr(chars[i + s.Length]), VarPtr(chars[i]), (size - i) As SIZE_T)
+		s.CopyTo(0, chars, i, s.Length)
+		size = newSize
+	End Sub
+Public
+
+	Function Remove(startIndex As Long, length As Long) As StringBuilder
+		rangeCheck(startIndex, length)
+		separateBuffer()
+
+		Dim moveStart = startIndex + length
+		ActiveBasic.Strings.ChrMove(
+			VarPtr(chars[startIndex]), VarPtr(chars[moveStart]), (size - moveStart) As SIZE_T)
+		size -= length
+		Return This
+	End Function
+
+	Function Replace(oldChar As Char, newChar As Char) As StringBuilder
+		replaceCore(oldChar, newChar, 0, size)
+		Return This
+	End Function
+
+	Function Replace(oldStr As String, newStr As String) As StringBuilder
+		replaceCore(oldStr, newStr, 0, size)
+		Return This
+	End Function
+
+	Function Replace(oldChar As Char, newChar As Char, startIndex As Long, count As Long) As StringBuilder
+		rangeCheck(startIndex, count)
+		replaceCore(oldChar, newChar, startIndex, count)
+		Return This
+	End Function
+
+	Function Replace(oldStr As String, newStr As String, startIndex As Long, count As Long) As StringBuilder
+		rangeCheck(startIndex, count)
+		replaceCore(oldStr, newStr, startIndex, count)
+		Return This
+	End Function
+Private
+	Sub replaceCore(oldChar As Char, newChar As Char, start As Long, count As Long)
+		separateBuffer()
+		Dim i As Long
+		Dim last = ELM(start + count)
+		For i = start To last
+			If chars[i] = oldChar Then
+				chars[i] = newChar
+			End If
+		Next
+	End Sub
+
+	Sub replaceCore(oldStr As String, newStr As String, start As Long, count As Long)
+		If ActiveBasic.IsNothing(oldStr) Then
+			Throw New ArgumentNullException("StringBuilder.Replace: An argument is null", "oldStr")
+		ElseIf oldStr.Length = 0 Then
+			Throw New ArgumentException("StringBuilder.Replace: The argument 'oldStr' is empty string. ", "oldStr")
+		End If
+
+		Dim s = New StringBuilder(capacity, maxCapacity)
+		Dim curPos = start
+		Dim last = start + count
+		Do
+			Dim nextPos = ActiveBasic.Strings.ChrFind(VarPtr(chars[curPos]) As *Char, size As SIZE_T, StrPtr(oldStr), oldStr.Length As SIZE_T) As Long
+			If nextPos = -1 As SIZE_T Or curPos > last Then
+				s.appendCore(chars, curPos, size - curPos)
+				Exit Do
+			End If
+			
+			s.appendCore(chars, curPos, nextPos As Long)
+			s.Append(newStr)
+			curPos += nextPos As Long + oldStr.Length
+		Loop
+		chars = s.chars
+		size = s.size
+	End Sub
+
+Public
+	Override Function ToString() As String
+		chars[size] = 0
+		Return New String(This)
+	End Function
+
+	Const Function ToString(startIndex As Long, length As Long) As String
+		rangeCheck(startIndex, length)
+		Return New String(chars, startIndex, length)
+	End Function
+
+	Const Function Operator [](i As Long) As Char
+		Return Chars[i]
+	End Function
+
+	Sub Operator []=(i As Long, c As Char)
+		Chars[i] = c
+	End Sub
+
+	'Properties
+	Const Function Capacity() As Long
+		Return capacity
+	End Function
+
+	Sub Capacity(c As Long)
+		If c < size Or c > MaxCapacity Then 'sizeとの比較でcが負の場合も対応
+			Throw New ArgumentOutOfRangeException("StringBuilder.Capacity: An argument is out of range value.", "c")
+		End If
+		EnsureCapacity(c)
+	End Sub
+
+	Const Function Chars(i As Long) As Char
+		If i >= Length Or i < 0 Then
+			Throw New IndexOutOfRangeException("StringBuilder.Chars: The index argument 'i' is out of range value.")
+		End If
+		Return chars[i]
+	End Function
+
+	Sub Chars(i As Long, c As Char)
+		If i >= Length Or i < 0 Then
+			Throw New ArgumentOutOfRangeException("StringBuilder.Chars: An argument is out of range value.", "i")
+		End If
+		chars[i] = c
+	End Sub
+
+	Const Function Length() As Long
+		Return size
+	End Function
+
+	Sub Length(i As Long)
+		EnsureCapacity(i) 'iが適切な値かどうかの確認はこの中で行う
+		If size < i Then
+			ActiveBasic.Strings.ChrFill(VarPtr(chars[size]), (i - size + 1) As SIZE_T, 0 As Char)
+		End If
+		size = i
+	End Sub
+
+	Const Function MaxCapacity() As Long
+		Return maxCapacity
+	End Function
+
+	Function __Chars() As *Char
+		Return chars
+	End Function
+
+	Sub __Stringized()
+		stringized = True
+	End Sub
+
+Private
+	Sub initialize(capacity As Long, maxCapacity = LONG_MAX As Long)
+		If capacity < 0 Or maxCapacity < 1 Or maxCapacity < capacity Then
+			Throw New ArgumentOutOfRangeException("StringBuilder constructor: One or more arguments are out of range value.", "capacity or maxCapacity or both")
+		End If
+
+		If capacity = 0 Then
+			This.capacity = 1024
+		Else
+			This.capacity = capacity
+		End If
+
+		This.maxCapacity = maxCapacity
+		This.size = 0
+		This.chars = GC_malloc_atomic((This.capacity + 1) * SizeOf (Char))
+	End Sub
+
+	Sub initialize(s As String, startIndex As Long, length As Long, capacity As Long, maxCapacity = LONG_MAX As Long)
+		StringBuilder.rangeCheck2(s.Length, startIndex, length)
+
+		initialize(Math.Max(capacity, length), maxCapacity)
+
+		If Not String.IsNullOrEmpty(s) Then
+			s.CopyTo(startIndex, chars, 0, length)
+			size = length
+		End If
+	End Sub
+
+	Sub rangeCheck(index As Long)
+		If index < 0 Or index > size Then
+			Throw New ArgumentOutOfRangeException("StringBuilder: Index argument is out of range value.")
+		End If
+	End Sub
+
+	Sub rangeCheck(startIndex As Long, count As Long)
+		StringBuilder.rangeCheck2(size, startIndex, count)
+	End Sub
+
+	Static Sub rangeCheck2(length As Long, startIndex As Long, count As Long)
+		'length < 0は判定に入っていないことに注意
+		If startIndex < 0 Or count < 0 Or startIndex + count > length Then
+			Throw New ArgumentOutOfRangeException("StringBuilder: One or more arguments are out of range value.", "startIndex or count or both")
+		End If
+	End Sub
+
+	Sub separateBuffer()
+		If stringized Then
+			Dim newChars = GC_malloc_atomic(SizeOf (Char) * capacity) As *Char
+			ActiveBasic.Strings.ChrCopy(newChars, chars, capacity As SIZE_T)
+			chars = newChars
+			stringized = False
+		End If
+	End Sub
+
+	chars As *Char
+	maxCapacity As Long
+	capacity As Long
+	size As Long
+	stringized As Boolean
+End Class
+
+End Namespace 'Text
+End Namespace 'System
+
+'暫定
+Function StrPtr(sb As System.Text.StringBuilder) As *Char
+	Return sb.__Chars
+End Function
Index: /trunk/ab5.0/ablib/src/Classes/System/Text/UTF8Encoding.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Text/UTF8Encoding.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Text/UTF8Encoding.ab	(revision 506)
@@ -0,0 +1,265 @@
+/*!
+@file	Classes/System/Text/UTF8Encoding.ab
+@brief	UTF8Encodingクラスとそれに関係するクラスなどの宣言・定義
+*/
+
+Namespace System
+Namespace Text
+
+Namespace Detail
+
+Class UTF8Encoder
+	Inherits Encoder
+Protected
+	Override Sub ConvertCore(chars As *WCHAR, charCount As Long, bytes As *Byte, byteCount As Long, flush As Boolean,
+		ByRef bytesUsed As Long, ByRef charsUsed As Long, ByRef completed As Boolean)
+
+		Dim i As Long, j = 0 As Long
+		For i = 0 To ELM(charCount)
+			If chars[i] < &h80 Then
+				'1バイト変換
+				If j + 1 > byteCount Then
+					'バッファ不足
+					Goto *BufferOver
+				End If
+				bytes[j] = chars[i] As Byte
+				j++
+			ElseIf chars[i] < &h800 Then
+				'2バイト変換
+				If j + 2 > byteCount Then
+					Goto *BufferOver
+				End If
+				bytes[j] = ((chars[i] >> 6) Or &hC0) As Byte
+				j++
+				bytes[j] = (chars[i] And &h3F Or &h80) As Byte
+				j++
+			ElseIf _System_IsHighSurrogate(chars[i]) Then
+				If i + 1 >= charCount Then
+					'バッファに貯め込む
+					If flush = False Then
+						buffer = chars[i]
+						Exit Sub
+					End If
+					'ToDo: chars[i + 1]が範囲外になる場合が考慮されていない
+				ElseIf _System_IsLowSurrogate(chars[i + 1]) = False Then
+					'EncoderFallback
+				End If
+				If j + 4 > byteCount Then
+					Goto *BufferOver
+				End If
+				'UTF-16列からUnicodeコードポイントを復元
+				Dim c = (((chars[i] And &h3FF) As DWord << 10) Or (chars[i + 1] And &h3FF)) + &h10000
+				'4バイト変換
+				bytes[j] = ((c >> 18) Or &hf0) As Byte
+				j++
+				bytes[j] = ((c >> 12) And &h3F Or &h80) As Byte
+				j++
+				bytes[j] = ((c >> 6) And &h3F Or &h80) As Byte
+				j++
+				bytes[j] = (c And &h3F Or &h80) As Byte
+				j++
+				i++
+			ElseIf _System_IsLowSurrogate(chars[i]) Then
+				'EncoderFallback
+			Else
+				'3バイト変換
+				If j + 3 > byteCount Then
+					Goto *BufferOver
+				End If
+				bytes[j] = ((chars[i] >> 12) Or &hE0) As Byte
+				j++
+				bytes[j] = ((chars[i] >> 6) And &h3F Or &h80) As Byte
+				j++
+				bytes[j] = (chars[i] And &h3F Or &h80) As Byte
+				j++
+			End If
+		Next
+
+		Exit Sub
+	*BufferOver
+		'バッファ不足
+		Throw New ArgumentException("Buffer is not enough.", "bytes")
+	End Sub
+
+Private
+	buffer As WCHAR
+End Class
+
+Class UTF8Decoder
+	Inherits Decoder
+Protected
+	Override Sub ConvertCore(bytes As *Byte, byteCount As Long, chars As *WCHAR, charCount As Long, flush As Boolean,
+		ByRef bytesUsed As Long, ByRef charsUsed As Long, ByRef completed As Boolean)
+		Dim i As Long, j = 0 As Long
+		For i = 0 To ELM(byteCount)
+			If state = 0 Then
+				If bytes[i] <= &h80 Then
+					'1バイト変換
+					If j = charCount Then Goto *BufferOver
+					chars[j] = bytes[i]
+					j++
+				ElseIf bytes[i] < &hC0 Then
+					'マルチバイトの2バイト目以降
+					'DecoderFallback完成までの暫定
+					If j = charCount Then Goto *BufferOver
+					chars[j] = &hfffd
+					j++
+				ElseIf bytes[i] < &hD0 Then
+					'2バイト文字の始まり
+					last = 2
+					buf = bytes[i] And &h3f
+					state++
+				ElseIf bytes[i] < &hF0 Then
+					'3バイト文字の始まり
+					last = 3
+					buf = bytes[i] And &h1f
+					state++
+				Else
+					'4バイト文字の始まり
+					last = 4
+					buf = bytes[i] And &h0f
+					state++
+				End If
+			Else
+				If &h80 <= bytes[i] And bytes[i] < &hC0 Then
+					'マルチバイト文字の2バイト目以降
+					buf <<= 6
+					buf Or= bytes[i] And &h3F
+					state++
+					If state = last Then '最終バイトに到達
+						If state = 2 And buf >= &h80 Then
+							chars[j] = buf As WCHAR
+							j++
+						ElseIf state = 3 And buf >= &h800 And buf < &hD800 And &hE0000 >= buf Then
+							chars[j] = buf As WCHAR
+							j++
+						ElseIf state = 4 And buf <= &h10ffff Then
+							buf -= &h10000
+							chars[j] = (&hD800 Or (buf >> 10)) As WCHAR
+							j++
+							chars[j] = (&hDC00 Or (buf And &h3FF)) As WCHAR
+							j++
+						Else
+							'DecoderFallback
+							If j = charCount Then Goto *BufferOver
+							chars[j] = &hfffd
+							j++
+						End If
+						state = 0
+					End If
+				Else
+					'3, 4バイト文字の先頭
+					'DecoderFallback
+					If j = charCount Then Goto *BufferOver
+					chars[j] = &hfffd
+					j++
+				End If
+			End If
+		Next
+		Exit Sub
+	*BufferOver
+		'バッファ不足
+		Throw New ArgumentException("Buffer is not enough.", "bytes")
+	End Sub
+
+Private
+	buf As DWord
+	state As Long
+	last As Long
+End Class
+
+End Namespace 'Detail
+
+
+/*!
+@brief UTF-8用のEncoding
+@date 2007/12/21
+@auther Egtra
+*/
+Class UTF8Encoding
+	Inherits Encoding
+Public
+
+	Override Function Clone() As Object
+		Dim c = New UTF8Encoding
+		c.DecoderFallback = This.DecoderFallback
+		c.EncoderFallback = This.EncoderFallback
+		Return c
+	End Function
+
+	Override Function GetDecoder() As Decoder
+		GetDecoder = New Detail.UTF8Decoder
+'		GetDecoder.Fallback = DecoderFallback
+	End Function
+
+	Override Function GetEncoder() As Encoder
+		GetEncoder = New Detail.UTF8Encoder
+'		GetEncoder.Fallback = EncoderFallback
+	End Function
+
+	Override Function GetMaxByteCount(charCount As Long) As Long
+		Return charCount * 3
+		'全てがUTF-8で3バイトになる文字の場合が最大。
+
+		'UTF-8で4バイトになる列は、UTF-16だとサロゲートペアで表現するので、
+		'1単位あたりでは2バイトしか食わないことになる。
+	End Function
+
+	Override Function GetMaxCharCount(byteCount As Long) As Long
+		'全てU+7F以下の文字だけだった場合
+		Return byteCount
+	End Function
+Protected
+	Override Function GetBytesCountCore(s As *WCHAR, n As Long) As Long
+	End Function
+
+	Override Function GetBytesCore(chars As *WCHAR, charCount As Long, bytes As *Byte, byteCount As Long) As Long
+	End Function
+
+	Override Function GetCharsCountCore(s As *Byte, n As Long) As Long
+	End Function
+
+	Override Function GetCharsCore(bytes As *Byte, byteCount As Long, chars As *WCHAR, charCount As Long) As Long
+	End Function
+Public
+	Override Function GetPreamble() As *Byte
+		Return bom
+	End Function
+
+	Override Function GetPreambleLength() As Long
+		Return Len(bom)
+	End Function
+
+	Override Function IsAlwaysNormalized() As Boolean
+		IsAlwaysNormalized = False
+	End Function
+
+	Override Function IsAlwaysNormalized(f As NormalizationForm) As Boolean
+		IsAlwaysNormalized = False
+	End Function
+
+	Override Function BodyName() As String
+		Return "utf-8"
+	End Function
+
+	Override Function HeaderName() As String
+		Return "utf-8"
+	End Function
+
+	Override Function EncodingName() As String
+		Return "UTF-8"
+	End Function
+
+	Override Function WebName() As String
+		Return "utf-8"
+	End Function
+
+	Override Function IsSingleByte() As Boolean
+		Return False
+	End Function
+Private
+	Static bom[2] = [&hEF, &hBB, &hBF] As Byte
+End Class
+
+End Namespace 'Text
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Threading/AutoResetEvent.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Threading/AutoResetEvent.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Threading/AutoResetEvent.ab	(revision 506)
@@ -0,0 +1,17 @@
+' Classes/System/Threading/AutoResetEvent.ab
+
+NameSpace System
+NameSpace Threading
+
+Class AutoResetEvent
+	Inherits System.Threading.EventWaitHandle
+
+Public
+	Sub AutoResetEvent(initialState As Boolean)
+		This.EventWaitHandle(initialState,EventResetMode.AutoReset)
+	End Sub
+
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Threading/EventWaitHandle.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Threading/EventWaitHandle.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Threading/EventWaitHandle.ab	(revision 506)
@@ -0,0 +1,103 @@
+' Classes/System/Threading/EventWaitHandle.ab
+
+NameSpace System
+NameSpace Threading
+
+Enum EventResetMode
+	AutoReset = False
+	ManualReset = True
+End Enum
+
+Class EventWaitHandle
+	Inherits System.Threading.WaitHandle
+
+Public
+	Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode)
+		This.Handle(CreateEvent(NULL,mode As BOOL,initialState As BOOL,NULL))
+	End Sub
+	Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode, name As String)
+		This.Handle(CreateEvent(NULL,mode As BOOL,initialState As BOOL,ToTCStr(name)))
+	End Sub
+	Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode, name As String, ByRef createdNew As Boolean)
+		This.Handle(CreateEvent(NULL,mode As BOOL,initialState As BOOL,ToTCStr(name)))
+		If ERROR_ALREADY_EXISTS=GetLastError() Then createdNew=False Else createdNew=True
+	End Sub
+/*	Sub EventWaitHandle (initialState As Boolean, mode As EventResetMode, name As String, ByRef createdNew As Boolean, EventWaitHandleSecurity)
+	TODO
+	End Sub*/
+
+/*
+WaitHandle で保持されているすべてのリソースを解放します。
+WaitHandleから継承
+Virtual Sub Close()
+End Sub
+*/
+
+/*CreateObjRef*/
+
+/*
+WaitHandleから継承
+	Virtual Sub Dispose()
+	End Sub
+*/
+
+/*Equals*/
+/*Finalize*/
+/*GetAccessControl*/
+/*GetHashCode*/
+/*GetLifetimeService*/
+/*InitializeLifetimeService*/
+/*MemberwiseClone*/
+
+
+	/*
+	既存の名前付き同期イベントを開きます。
+	*/
+	Static Function OpenExisting(name As String) As WaitHandle
+		This.Handle(OpenEvent(EVENT_ALL_ACCESS,FALSE,ToTCStr(name)))
+	End Function
+
+	/*
+	セキリティアクセスを指定して既存の名前付き同期イベントを開きます。
+	*/
+/*	Static Function OpenExisting(name As String, rights As EventWaitHandleRights) As WaitHandle
+		TODO
+	End Function*/
+
+	/*
+	イベントの状態を非シグナル状態に設定し、スレッドをブロックします。
+	*/
+	Function Reset() As Boolean
+		If ResetEvent(This.Handle()) Then Return True
+		Reset=False
+	End Function
+
+
+	/*
+	イベントの状態をシグナル状態に設定し、待機している 1 つ以上のスレッドが進行できるようにします。
+	*/
+	Function Set() As Boolean
+		If SetEvent(This.Handle()) Then Return True
+		Set=False
+	End Function
+
+/*SetAccessControl*/
+/*ToString*/
+
+/*
+WaitHandleから継承
+WaitAll
+WaitAny
+WaitOne
+*/
+
+/*
+WaitHandle から継承
+Handle
+SafeWaitHandle 
+*/
+
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Threading/Exception.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Threading/Exception.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Threading/Exception.ab	(revision 506)
@@ -0,0 +1,107 @@
+NameSpace System
+NameSpace Threading
+
+Class AbandonedMutexException
+	Inherits System.SystemException
+Public'constructor
+	Sub AbandonedMutexException()
+		This.SystemException("", Nothing)
+	End Sub
+	Sub AbandonedMutexException(message As String)
+		This.SystemException(message, Nothing)
+	End Sub
+	Sub AbandonedMutexException(message As String, innerException As Exception)
+		This.SystemException(message, innerException)
+	End Sub
+
+End Class
+
+Class SemaphoreFullException
+	Inherits System.SystemException
+Public'constructor
+	Sub SemaphoreFullException()
+		This.SystemException("Too many semaphore countors.", Nothing)
+		This.HResult = ERROR_TOO_MANY_SEMAPHORES
+	End Sub
+	Sub SemaphoreFullException(message As String)
+		This.SystemException(message, Nothing)
+		This.HResult = ERROR_TOO_MANY_SEMAPHORES
+	End Sub
+	Sub SemaphoreFullException(message As String, innerException As Exception)
+		This.SystemException(message, innerException)
+		This.HResult = ERROR_TOO_MANY_SEMAPHORES
+	End Sub
+End Class
+
+Class SynchronizationLockException
+	Inherits System.SystemException
+Public'constructor
+	Sub SynchronizationLockException()
+		This.SystemException("", Nothing)
+	End Sub
+	Sub SynchronizationLockException(message As String)
+		This.SystemException(message, Nothing)
+	End Sub
+	Sub SynchronizationLockException(message As String, innerException As Exception)
+		This.SystemException(message, innerException)
+	End Sub
+End Class
+
+Class ThreadAbortException
+	Inherits System.SystemException
+Public'constructor
+	Sub ThreadAbortException()
+		This.SystemException("The thread was discontinued.", Nothing)
+	End Sub
+	Sub ThreadAbortException(message As String)
+		This.SystemException(message, Nothing)
+	End Sub
+	Sub ThreadAbortException(message As String, innerException As Exception)
+		This.SystemException(message, innerException)
+	End Sub
+End Class
+
+Class ThreadInterruptedException
+	Inherits System.SystemException
+Public'constructor
+	Sub ThreadInterruptedException()
+		This.SystemException("The thread was Interrupted.", Nothing)
+	End Sub
+	Sub ThreadInterruptedException(message As String)
+		This.SystemException(message, Nothing)
+	End Sub
+	Sub ThreadInterruptedException(message As String, innerException As Exception)
+		This.SystemException(message, innerException)
+	End Sub
+End Class
+
+Class ThreadStartException
+	Inherits System.SystemException
+Public'constructor
+	Sub ThreadStartException()
+		This.SystemException("The thread cannot be begun.", Nothing)
+	End Sub
+	Sub ThreadStartException(message As String)
+		This.SystemException(message, Nothing)
+	End Sub
+	Sub ThreadStartException(message As String, innerException As Exception)
+		This.SystemException(message, innerException)
+	End Sub
+End Class
+
+Class WaitHandleCannotBeOpenedException
+	Inherits System.SystemException
+Public'constructor
+	Sub WaitHandleCannotBeOpenedException()
+		This.SystemException("The wait handle can not be opened.", Nothing)
+	End Sub
+	Sub WaitHandleCannotBeOpenedException(message As String)
+		This.SystemException(message, Nothing)
+	End Sub
+	Sub WaitHandleCannotBeOpenedException(message As String, innerException As Exception)
+		This.SystemException(message, innerException)
+	End Sub
+End Class
+
+End NameSpace
+End NameSpace
Index: /trunk/ab5.0/ablib/src/Classes/System/Threading/ManualResetEvent.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Threading/ManualResetEvent.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Threading/ManualResetEvent.ab	(revision 506)
@@ -0,0 +1,17 @@
+' Classes/System/Threading/ManualResetEvent.ab
+
+NameSpace System
+NameSpace Threading
+
+Class ManualResetEvent
+	Inherits System.Threading.EventWaitHandle
+
+Public
+	Sub ManualResetEvent(initialState As Boolean)
+		This.EventWaitHandle(initialState,EventResetMode.ManualReset)
+	End Sub
+
+End Class
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Threading/Mutex.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Threading/Mutex.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Threading/Mutex.ab	(revision 506)
@@ -0,0 +1,53 @@
+' Classes/System/Threading/Mutex.ab
+
+Namespace System
+Namespace Threading
+
+Class Mutex
+	Inherits System.Threading.WaitHandle
+
+Public
+	Sub Mutex()
+		This.Handle(CreateMutex(NULL,FALSE,NULL))
+	End Sub
+	Sub Mutex(initiallyOwned As Boolean)
+		This.Handle(CreateMutex(NULL,initiallyOwned As BOOL,NULL))
+	End Sub
+	Sub Mutex(initiallyOwned As Boolean, name As String)
+		This.Handle(CreateMutex(NULL,initiallyOwned As BOOL,ToTCStr(name)))
+	End Sub
+	Sub Mutex(initiallyOwned As Boolean, name As String, ByRef createdNew As Boolean)
+		This.Handle(CreateMutex(NULL,initiallyOwned As BOOL,ToTCStr(name)))
+		If ERROR_ALREADY_EXISTS=GetLastError() Then createdNew=False Else createdNew=True
+		'Throw UnauthorizedAccessException
+		'Throw IOException
+		'Throw ApplicationException
+		'Throw ArgumentException
+	End Sub
+/*	Sub Mutex(Boolean, String, Boolean, MutexSecurity)  
+		TODO
+	End Sub*/
+
+	Static Function OpenExisting (name As String) As Mutex
+		This.Handle(OpenMutex(MUTEX_ALL_ACCESS,FALSE,ToTCStr(name)))
+		'Throw ArgumentException
+		'Throw ArgumentNullException
+		'Throw WaitHandleCannotBeOpenedException
+		'Throw IOException
+		'Throw UnauthorizedAccessException
+	End Function
+
+/*	Static Function OpenExisting (String, MutexRights) As Mutex
+		TODO
+	End Function*/
+
+	Sub Release()
+		If ReleaseMutex(This.Handle()) = 0 Then
+			'Throw ApplicationException
+		End If
+	End Sub
+
+End Class
+
+End Namespace 'Threading
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Threading/Semaphore.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Threading/Semaphore.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Threading/Semaphore.ab	(revision 506)
@@ -0,0 +1,61 @@
+' Classes/System/Threading/Semaphore.ab
+
+Namespace System
+Namespace Threading
+
+Class Semaphore
+	Inherits System.Threading.WaitHandle
+
+Public
+	Sub Semaphore(initialCount As Long, maximumCount As Long)
+		This.Handle(CreateSemaphore(NULL,initialCount,maximumCount,NULL))
+	End Sub
+	Sub Semaphore(initialCount As Long, maximumCount As Long, name As String)
+		This.Handle(CreateSemaphore(NULL,initialCount,maximumCount,ToTCStr(name)))
+	End Sub
+	Sub Semaphore(initialCount As Long, maximumCount As Long, name As String, ByRef createdNew As Boolean)
+		This.Handle(CreateSemaphore(NULL,initialCount,maximumCount,ToTCStr(name)))
+		If ERROR_ALREADY_EXISTS=GetLastError() Then createdNew=False Else createdNew=True
+		'Throw ArgumentException
+		'Throw ArgumentOutOfRangeException
+		'Throw IOException
+		'Throw UnauthorizedAccessException
+		'Throw WaitHandleCannotBeOpenedException
+	End Sub
+/*	Sub Semaphore(initialCount As Long, maximumCount As Long, name As String, ByRef createdNew As Boolean, semaphoreSecurity As SemaphoreSecurity)
+		TODO
+	End Sub*/
+
+	Static Function OpenExisting (name As String) As Semaphore
+		This.Handle(OpenSemaphore(SEMAPHORE_ALL_ACCESS,FALSE,ToTCStr(name)))
+		'Throw ArgumentException
+		'Throw ArgumentNullException
+		'Throw WaitHandleCannotBeOpenedException
+		'Throw IOException
+		'Throw UnauthorizedAccessException
+	End Function
+
+/*	Static Function OpenExisting (String, SemaphoreRights) As Semaphore
+		TODO
+	End Function*/
+
+	Function Release() As Long
+		If ReleaseSemaphore(This.Handle(),1,Release) = 0 Then
+			'SemaphoreFullException
+			'IOException
+			'UnauthorizedAccessException
+		End If
+	End Function
+	Function Release(releaseCount As Long) As Long
+		If ReleaseSemaphore(This.Handle(),releaseCount,Release) = 0 Then
+			'ArgumentOutOfRangeException
+			'SemaphoreFullException
+			'IOException
+			'UnauthorizedAccessException
+		End If
+	End Function
+
+End Class
+
+End Namespace 'Threading
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Threading/Thread.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Threading/Thread.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Threading/Thread.ab	(revision 506)
@@ -0,0 +1,498 @@
+'Thread.ab
+
+NameSpace System
+
+/*タイプ*/
+TypeDef LocalDataStoreSlot = Long
+
+
+NameSpace Threading
+
+/*列挙体*/
+Enum ThreadPriority
+	Highest =      2
+	AboveNormal =  1
+	Normal =       0
+	BelowNormal = -1
+	Lowest =      -2
+End Enum
+
+Enum ThreadState
+	'スレッド状態に AbortRequested が含まれ、そのスレッドは停止していますが、状態はまだ Stopped に変わっていません。  
+	Aborted
+	'スレッド上で Thread.Abort メソッドを呼び出しますが、そのスレッドの終了を試みる保留中の System.Threading.ThreadAbortException をスレッドが受け取っていません。  
+	AbortRequested
+	'スレッドは、フォアグラウンド スレッドではなく、バックグランド スレッドとして実行します。この状態は、Thread.IsBackground プロパティを設定して制御されます。  
+	Background
+	'スレッドをブロックせずに起動します。保留中の ThreadAbortException もありません。  
+	Running
+	'スレッドを停止します。  
+	Stopped
+	'スレッドの停止を要求します。これは、内部でだけ使用します。  
+	StopRequested
+	'スレッドを中断します。  
+	Suspended
+	'スレッドの中断を要求します。  
+	SuspendRequested
+	'スレッド上に Thread.Start メソッドを呼び出しません。  
+	Unstarted
+	'スレッドがブロックされています。これは、Thread.Sleep または Thread.Join の呼び出し、ロックの要求 (たとえば、Monitor.Enter や Monitor.Wait の呼び出しによる)、または ManualResetEvent などのスレッド同期オブジェクトの待機の結果である可能性があります。   
+	WaitSleepJoin
+End Enum
+
+/*
+デリゲート
+*/
+Delegate Sub ThreadStart()
+
+
+/*
+関数ポインタ
+*/
+TypeDef PTHREAD_START_ROUTINE = *Function(args As VoidPtr) As DWord
+
+
+/*
+クラス
+*/
+Class Thread
+	m_hThread As HANDLE
+	m_dwThreadId As DWord
+	m_Priority As ThreadPriority
+
+	m_fp As PTHREAD_START_ROUTINE
+	m_dg As ThreadStart
+	m_args As VoidPtr
+	name As String
+	state As ThreadState
+
+	isThrowing As Boolean
+	throwingParamObject As Object
+
+	needFreeStructurePointers As *VoidPtr
+	countOfNeedFreeStructurePointers As Long
+
+Public
+	Sub Thread()
+		m_hThread=0
+		m_dwThreadId=0
+		m_Priority=ThreadPriority.Normal
+
+		m_fp=0
+
+		name = "sub thread"
+		state = ThreadState.Unstarted
+
+		isThrowing = False
+		throwingParamObject = Nothing
+	End Sub
+	Sub Thread(fp As PTHREAD_START_ROUTINE, args As VoidPtr)
+		m_hThread=0
+		m_dwThreadId=0
+		m_Priority=ThreadPriority.Normal
+
+		m_fp=fp
+		m_args=args
+
+		name = "sub thread"
+		state = ThreadState.Unstarted
+
+		isThrowing = False
+		throwingParamObject = Nothing
+	End Sub
+
+	Sub Thread(obj As Thread)
+		m_hThread=obj.m_hThread
+		m_dwThreadId=obj.m_dwThreadId
+		m_Priority=obj.m_Priority
+		m_fp=obj.m_fp
+		m_args=obj.m_args
+
+		name = "sub thread"
+		state = ThreadState.Unstarted
+
+		isThrowing = False
+		throwingParamObject = Nothing
+	End Sub
+
+	Sub Thread(hThread As HANDLE, dwThreadId As DWord, dummy As Long)
+		m_hThread=hThread
+		m_dwThreadId=dwThreadId
+
+		name = "sub thread"
+		state = ThreadState.Unstarted
+
+		isThrowing = False
+		throwingParamObject = Nothing
+	End Sub
+
+	Sub ~Thread()
+	End Sub
+
+	Function Equals(thread As Thread) As Boolean
+		Return m_dwThreadId = thread.m_dwThreadId
+	End Function
+
+Public 'public property
+	Function IsAlive() As Boolean
+		Dim code As DWord
+		GetExitCodeThread(m_hThread,code)
+		If code=STILL_ACTIVE Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	
+	'Priority Property
+	Sub Priority(value As ThreadPriority)
+		m_Priority=value
+		SetThreadPriority(m_hThread,value)
+	End Sub
+	Function Priority() As ThreadPriority
+		Return m_Priority
+	End Function
+
+	'ThreadId
+	Function ThreadId() As DWord
+		Return m_dwThreadId
+	End Function
+
+	Function ThreadState() As System.Threading.ThreadState
+		Return This.state
+	End Function
+
+	Function Name() As String
+		Return name
+	End Function
+	Sub Name( name As String )
+		This.name = name
+	End Sub
+
+Public 'public method
+/*	Sub Abort()
+		TODO '実装のためにはかなり検討が必要
+		'This.__Throw(New ThreadAbortException)
+	End Sub*/
+
+	Sub Start()
+		Dim ThreadId As DWord
+		m_hThread=_beginthreadex(NULL,0,AddressOf(_run),VarPtr(This),CREATE_SUSPENDED,m_dwThreadId)
+		SetThreadPriority(m_hThread,m_Priority)
+		This.Resume()
+	End Sub
+
+	Virtual Function Run() As Long
+		If m_fp Then
+			Run=m_fp(m_args)
+		End If
+	End Function
+
+	Sub Suspend()
+		This.state = ThreadState.SuspendRequested
+		If SuspendThread(m_hThread) = &HFFFFFFFF Then
+			This.state = ThreadState.Unstarted
+			Debug 'Throw New ThreadStateException
+		End If
+		This.state = ThreadState.Suspended
+	End Sub
+	Sub Resume()
+		If ResumeThread(m_hThread) = &HFFFFFFFF Then
+			state = ThreadState.Unstarted
+			Debug 'Throw New ThreadStateException
+		End If
+		This.state = ThreadState.Running
+	End Sub
+
+/*	Function GetData(LocalDataStoreSlot)
+	End Function
+	Sub SetData(LocalDataStoreSlot)
+	End Sub*/
+
+	Static Function CurrentThread() As Thread
+		Return _System_pobj_AllThreads->CurrentThread()
+	End Function
+
+	/*------------------------ クラス内部用 --------------------------*/
+Private
+	Function Cdecl _run() As Long
+		'------------
+		' 前処理
+		'------------
+
+		' 構造体の一時メモリ退避用領域を作成
+		needFreeStructurePointers = _System_malloc( 1 )
+		countOfNeedFreeStructurePointers = 0
+
+		'GCにスレッド開始を通知
+		_System_pobj_AllThreads->BeginThread(This, _System_GetSp() As *LONG_PTR)
+
+
+		'------------
+		'実行
+		'------------
+		_run=Run()
+
+
+		'------------
+		'後処理
+		'------------
+
+		'GCにスレッド終了を通知
+		_System_pobj_AllThreads->EndThread(This)
+
+		' 構造体の一時メモリ退避用領域を破棄
+		_System_free( needFreeStructurePointers )
+
+		'自身のスレッドハンドルを閉じる
+		CloseHandle(InterlockedExchangePointer(VarPtr(m_hThread),NULL))
+		m_hThread=0
+
+	End Function
+
+	/*------------------------ システム用 --------------------------*/
+Public
+	Function __GetContext(ByRef Context As CONTEXT) As BOOL
+		Return GetThreadContext(m_hThread,Context)
+	End Function
+	Function __SetContext(ByRef Context As CONTEXT) As BOOL
+		Return SetThreadContext(m_hThread,Context)
+	End Function
+
+	Sub __Throw( ex As Object )
+		isThrowing = True
+		throwingParamObject = ex
+	End Sub
+	Sub __Catched()
+		isThrowing = False
+		throwingParamObject = Nothing
+	End Sub
+	Function __IsThrowing() As Boolean
+		Return isThrowing
+	End Function
+	Function __GetThrowintParamObject() As Object
+		Return throwingParamObject
+	End Function
+
+	Sub __AddNeedFreeTempStructure( structurePointer As VoidPtr )
+		needFreeStructurePointers = _System_realloc( needFreeStructurePointers, ( countOfNeedFreeStructurePointers + 1 ) * SizeOf(VoidPtr) )
+		needFreeStructurePointers[countOfNeedFreeStructurePointers] = structurePointer
+		countOfNeedFreeStructurePointers ++
+	End Sub
+
+	Sub __FreeTempStructure()
+		Dim i = 0 As Long
+		While i<countOfNeedFreeStructurePointers
+			free( needFreeStructurePointers[i] )
+			i++
+		Wend
+		countOfNeedFreeStructurePointers = 0
+	End Sub
+End Class
+
+
+Namespace Detail
+
+'--------------------------------------------------------------------
+' すべてのスレッドの管理
+'--------------------------------------------------------------------
+' TODO: このクラスをシングルトンにする
+
+Class _System_CThreadCollection
+Public
+	collection As *ThreadInfo
+	ThreadNum As Long
+
+	CriticalSection As CRITICAL_SECTION
+
+	Sub _System_CThreadCollection()
+		collection = GC_malloc(1)
+		ThreadNum = 0
+		InitializeCriticalSection(CriticalSection)
+	End Sub
+
+	Sub ~_System_CThreadCollection()
+		Dim i As Long
+		For i=0 To ELM(ThreadNum)
+			With collection[i]
+				If .thread Then
+					.thread = Nothing
+					.stackBase = 0
+					.exception = Nothing
+				End If
+			End With
+		Next
+		collection = 0
+		DeleteCriticalSection(CriticalSection)
+	End Sub
+
+	'スレッドを生成
+	Sub BeginThread(thread As Thread, NowSp As *LONG_PTR)
+		EnterCriticalSection(CriticalSection)
+		Dim i = FindFreeIndex
+		With collection[i]
+			.thread = thread
+			.stackBase = NowSp
+			.exception = New ExceptionService '例外処理管理用オブジェクトを生成
+		End With
+		LeaveCriticalSection(CriticalSection)
+	End Sub
+Private
+	'クリティカルセション内で呼ぶこと
+	Function FindFreeIndex() As Long
+		Dim i As Long
+		For i = 0 To ELM(ThreadNum)
+			If ActiveBasic.IsNothing(collection[i].thread) Then
+				FindFreeIndex = i
+				Exit Function
+			End If
+		Next
+		ThreadNum++
+		collection = realloc(collection, ThreadNum * SizeOf(ThreadInfo))
+		FindFreeIndex = i
+	End Function
+Public
+
+	'スレッドを終了
+	Sub EndThread(thread As Thread)
+		EnterCriticalSection(CriticalSection)
+			Dim i As Long
+			For i = 0 To ELM(ThreadNum)
+				With collection[i]
+					If thread.Equals(.thread) Then
+						.thread = Nothing
+						.stackBase = 0
+						.exception = Nothing
+						Exit For
+					End If
+				End With
+			Next
+		LeaveCriticalSection(CriticalSection)
+	End Sub
+
+	' すべてのスレッドを中断
+	Sub SuspendAllThread()
+		Dim i As Long
+		For i = 0 To ELM(ThreadNum)
+			With collection[i]
+				If Not ActiveBasic.IsNothing(.thread) Then
+					.thread.Suspend()
+				End If
+			End With
+		Next
+	End Sub
+
+	' すべてのスレッドを再開
+	Sub ResumeAllThread()
+		Dim i As Long
+		For i = 0 To ELM(ThreadNum)
+			With collection[i]
+				If Not ActiveBasic.IsNothing(.thread) Then
+					.thread.Resume()
+				End If
+			End With
+		Next
+	End Sub
+/*
+	' 自分以外のスレッドを中断
+	Sub SuspendAnotherThread()
+		Dim currentThread = CurrentThread()
+
+		Dim i As Long
+		For i=0 To ELM(ThreadNum)
+			With collection[i]
+				If currentThread.Equals(.thread) Then
+					Continue
+				ElseIf Not ActiveBasic.IsNothing(.thread) Then
+					.thread.Suspend()
+				End If
+			End With
+		Next
+	End Sub
+
+	' 自分以外のスレッドを再開
+	Sub ResumeAnotherThread()
+		Dim currentThread = CurrentThread()
+
+		Dim i As Long
+		For i=0 To ELM(ThreadNum)
+			With collection[i]
+				If currentThread.Equals(.thread) Then
+					Continue
+				ElseIf Not ActiveBasic.IsNothing(.thread) Then
+					.thread.Resume()
+				End If
+			End With
+		Next
+	End Sub
+*/
+	'カレントスレッドを取得
+	Function CurrentThread() As Thread
+		Dim p = CurrentThreadInfo()
+		If p = 0 Then
+			' TODO: エラー処理
+			OutputDebugString( Ex"カレントスレッドの取得に失敗\r\n" )
+			debug
+			Exit Function
+		End If
+		CurrentThread = p->thread
+	End Function
+
+	Function CurrentThreadInfo() As *ThreadInfo
+		CurrentThreadInfo = FindThreadInfo(GetCurrentThreadId())
+	End Function
+
+	Function FindThreadInfo(threadID As DWord) As *ThreadInfo
+		Dim i As Long
+		For i = 0 To ELM(ThreadNum)
+			If collection[i].thread.ThreadId = threadID Then
+				FindThreadInfo = VarPtr(collection[i])
+				Exit Function
+			End If
+		Next
+	End Function
+
+Private
+	'------------------------------------------
+	' スレッド固有の例外処理制御
+	'------------------------------------------
+
+Public
+	Function GetCurrentException() As ExceptionService
+		Dim dwNowThreadId = GetCurrentThreadId()
+
+		Dim i As Long
+		For i=0 To ELM(ThreadNum)
+			With collection[i]
+				If .thread.ThreadId = dwNowThreadId Then
+					Return .exception
+				End If
+			End With
+		Next
+
+		OutputDebugString( Ex"カレントスレッドの取得に失敗\r\n" )
+		Return Nothing
+	End Function
+End Class
+
+Type ThreadInfo
+	thread As Thread
+	stackBase As *LONG_PTR
+	exception As ExceptionService
+End Type
+
+End Namespace 'Detail
+End NameSpace 'Threading
+End NameSpace 'System
+
+
+/* システムが使う変数 */
+Dim _System_pobj_AllThreads As *System.Threading.Detail._System_CThreadCollection
+
+/* システムが呼び出す関数 */
+Sub _System_AddNeedFreeTempStructure( structurePointer As VoidPtr )
+	System.Threading.Thread.CurrentThread.__AddNeedFreeTempStructure( structurePointer )
+End Sub
+Sub _System_FreeTempStructure()
+	System.Threading.Thread.CurrentThread.__FreeTempStructure()
+End Sub
Index: /trunk/ab5.0/ablib/src/Classes/System/Threading/Timeout.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Threading/Timeout.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Threading/Timeout.ab	(revision 506)
@@ -0,0 +1,12 @@
+' Classes/System/Threading/Timeout.ab
+
+Namespace System
+Namespace Threading
+
+Class Timeout
+Public
+	Const Infinite = -1 As Long
+End Class
+
+End Namespace 'Threading
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Threading/WaitHandle.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Threading/WaitHandle.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Threading/WaitHandle.ab	(revision 506)
@@ -0,0 +1,128 @@
+' Classes/System/Threading/WaitHandle.ab
+
+Namespace System
+Namespace Threading
+
+Namespace Detail
+	TypeDef PFNSignalObjectAndWait = *Function(hObjectToSignal As HANDLE, hObjectToWaitOn As HANDLE, dwMilliseconds As DWord, bAlertable As DWord) As DWord
+End Namespace
+
+Class WaitHandle
+	Implements System.IDisposable
+Public
+	' Properties
+'	Const Function SafeWaitHandle() As SafeWaitHandle
+'	Sub SafeWaitHandle(h As SafeWaitHandle)
+
+	Const Virtual Function Handle() As HANDLE
+		Return h
+	End Function
+
+	Virtual Sub Handle(newHandle As HANDLE)
+		h = newHandle
+	End Sub
+
+	' Methods
+	Virtual Sub WaitHandle()
+	End Sub
+
+	Virtual Sub ~WaitHandle()
+		This.Dispose()
+	End Sub
+
+	Virtual Sub Close()
+		This.Dispose()
+	End Sub
+
+	Virtual Sub Dispose()
+		Dim hDisposing = InterlockedExchangePointer(h, 0)
+		If hDisposing <> 0 Then
+			CloseHandle(hDisposing)
+		End If
+	End Sub
+
+	Function WaitOne() As Boolean
+		Return WaitOne(INFINITE, FALSE)
+	End Function
+
+	Function WaitOne(millisecondsTimeout As Long, exitContext As Boolean) As Boolean
+		Return WaitHandle.AfterWait(WaitForSingleObject(h, millisecondsTimeout As DWord), 1)
+	End Function
+
+	Function WaitOne(timeout As System.TimeSpan, exitContext As Boolean) As Boolean
+		Return WaitHandle.AfterWait(WaitForSingleObject(h, timeout.TotalMilliseconds() As DWord), 1)
+	End Function
+
+	Static Function WaitAll(count As DWord, handles As *HANDLE) As Boolean
+		Return WaitAll(count, handles, INFINITE, FALSE)
+	End Function
+
+	Static Function WaitAll(count As DWord, handles As *HANDLE, millisecondsTimeout As Long, exitContext As Boolean) As Boolean
+		Return WaitHandle.AfterWait(WaitForMultipleObjects(count, handles, TRUE, millisecondsTimeout), count)
+	End Function
+
+	Static Function WaitAll(count As DWord, handles As *HANDLE, timeout As System.TimeSpan, exitContext As Boolean) As Boolean
+		Return WaitHandle.AfterWait(WaitForMultipleObjects(count, handles, TRUE, timeout.TotalMilliseconds() As DWord), count)
+	End Function
+
+	Static Function WaitAny(count As DWord, handles As *HANDLE) As Boolean
+		Return WaitAny(count, handles, INFINITE, FALSE)
+	End Function
+
+	Static Function WaitAny(count As DWord, handles As *HANDLE, millisecondsTimeout As Long, exitContext As Boolean) As Boolean
+		Return WaitHandle.AfterWait(WaitForMultipleObjects(count, handles, FALSE, millisecondsTimeout), count)
+	End Function
+
+	Static Function WaitAny(count As DWord, handles As *HANDLE, timeout As System.TimeSpan, exitContext As Boolean) As Boolean
+		Return WaitHandle.AfterWait(WaitForMultipleObjects(count, handles, FALSE, timeout.TotalMilliseconds() As DWord), count)
+	End Function
+
+	Static Function SignalAndWait(toSignal As WaitHandle, toWaitOn As WaitHandle) As Boolean
+		Return SignalAndWait(toSignal, toWaitOn, INFINITE, FALSE)
+	End Function
+
+	Static Function SignalAndWait (toSignal As WaitHandle, toWaitOn As WaitHandle, timeout As System.TimeSpan, exitContext As Boolean) As Boolean
+		Return SignalAndWait(toSignal, toWaitOn, timeout.TotalMilliseconds() As Long, FALSE)
+	End Function
+
+	Static Function SignalAndWait(toSignal As WaitHandle, toWaitOn As WaitHandle, millisecondsTimeout As Long, exitContext As Boolean) As Boolean
+		Dim pSignalObjectAndWait = GetProcAddress(GetModuleHandle("Kernel32.dll"), "SignalObjectAndWait") As Detail.PFNSignalObjectAndWait
+		If pSignalObjectAndWait = 0 Then
+			Throw New PlatformNotSupportedException("WaitHandle.SignalAndWait: This platform doesn't supoort this operation.")
+		End If
+		Return WaitHandle.AfterWait(pSignalObjectAndWait(toSignal.Handle, toWaitOn.Handle, millisecondsTimeout As DWord, FALSE), 1)
+	End Function
+
+Public
+	Function WaitTimeout() As Long
+		Return WAIT_TIMEOUT
+	End Function
+
+Protected
+	Static Const InvalidHandle = INVALID_HANDLE_VALUE As HANDLE
+
+Private
+	h As HANDLE
+
+	Static Function AfterWait(ret As DWord, n As DWord) As Boolean
+		Select Case ret
+			Case WAIT_TIMEOUT
+				Return False
+			Case WAIT_ABANDONED
+				' Throw AbandonedMutexException
+				Debug
+				ExitThread(0)
+			'Case WAIT_FAILED
+			Case Else
+				If WAIT_OBJECT_0 <= ret And ret < WAIT_OBJECT_0 + n Then
+					Return True
+				End If
+				' ObjectDisposedException?
+				Debug
+				ExitThread(0)
+		End Select
+	End Function
+End Class
+
+End Namespace 'Threading
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/TimeSpan.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/TimeSpan.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/TimeSpan.ab	(revision 506)
@@ -0,0 +1,206 @@
+Namespace System
+
+
+Class TimeSpan
+	m_Time As Int64
+Public
+	Static MaxValue = 3162240000000000000 As Int64
+	Static MinValue = -3162240000000000000 As Int64
+	Static TicksPerDay = 864000000000 As Int64
+	Static TicksPerHour = 36000000000 As Int64
+	Static TicksPerMinute = 600000000 As Int64
+	Static TicksPerSecond = 10000000 As Int64
+	Static TicksPerMillisecond = 10000 As Int64
+	Static Zero = 0 As Int64
+
+	Sub TimeSpan(ticks As Int64)
+		If (ticks > MaxValue) Or (ticks < MinValue) Then
+			'ArgumentOutOfRangeException
+			debug
+			Exit Sub
+		End If
+		m_Time = ticks
+	End Sub
+
+	Sub TimeSpan(ts As TimeSpan)
+		m_Time = ts.m_Time
+	End Sub
+
+	Sub ~TimeSpan()
+	End Sub
+
+	Function Operator+ (ts As TimeSpan) As TimeSpan
+		Return FromTicks(m_Time + ts.m_Time)
+	End Function
+
+	Function Operator- (ts As TimeSpan) As TimeSpan
+		Return FromTicks(m_Time - ts.m_Time)
+	End Function
+
+	Function Operator* (value As Long) As TimeSpan
+		Return FromTicks(m_Time * value)
+	End Function
+
+	Function Operator/ (value As Long) As TimeSpan
+		Return FromTicks(m_Time \ value)
+	End Function
+
+	Function Operator== (ts As TimeSpan) As Boolean
+		Return Equals(ts)
+	End Function
+
+	Function Operator<> (ts As TimeSpan) As Boolean
+		Return Not Equals(ts)
+	End Function
+
+	Function Operator> (ts As TimeSpan) As Boolean
+		If CompareTo(ts) > 0 Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	Function Operator< (ts As TimeSpan) As Boolean
+		If CompareTo(ts) < 0 Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	Function Operator>= (ts As TimeSpan) As Boolean
+		If CompareTo(ts) => 0 Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+	Function Operator<= (ts As TimeSpan) As Boolean
+		If CompareTo(ts) <= 0 Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+		
+	'Public Properties
+	Function Ticks() As Int64
+		Return m_Time
+	End Function
+
+	Function Milliseconds() As Long
+		Return (m_Time \ TicksPerMillisecond Mod 1000) As Long
+	End Function
+
+	Function Seconds() As Long
+		Return (m_Time \ TicksPerSecond Mod 60) As Long
+	End Function
+
+	Function Minutes() As Long
+		Return (m_Time \ TicksPerMinute Mod 60) As Long
+	End Function
+
+	Function Hours() As Long
+		Return (m_Time \ TicksPerHour Mod 24) As Long
+	End Function
+
+	Function Days() As Long
+		Return (m_Time \ TicksPerDay) As Long
+	End Function
+
+	Function TotalMilliseconds() As Double
+		Return m_Time / TicksPerMillisecond
+	End Function
+
+	Function TotalSeconds() As Double
+		Return m_Time / TicksPerSecond
+	End Function
+
+	Function TotalMinute() As Double
+		Return m_Time / TicksPerMinute
+	End Function
+
+	Function TotalHours() As Double
+		Return m_Time / TicksPerHour
+	End Function
+
+	Function TotalDays() As Double
+		Return m_Time / TicksPerDay
+	End Function
+
+	Function Add(ts As TimeSpan) As TimeSpan
+		Return FromTicks(m_Time + ts.m_Time)
+	End Function
+
+	Static Function Compare(ts1 As TimeSpan, ts2 As TimeSpan) As Long
+		If ts1.m_Time < ts2.m_Time Then
+			Return -1
+		ElseIf ts1.m_Time = ts2.m_Time Then
+			Return 0
+		ElseIf ts1.m_Time > ts2.m_Time Then
+			Return 1
+		End If
+	End Function
+
+	Function CompareTo(ts As TimeSpan) As Long
+		Return (m_Time - ts.m_Time) As Long
+	End Function
+
+	Function Duration() As TimeSpan
+		Return FromTicks(System.Math.Abs(m_Time))
+	End Function
+
+	Function Equals(ts As TimeSpan) As Boolean
+		Return Equals(This, ts)
+	End Function
+
+	Static Function Equals(ts1 As TimeSpan, ts2 As TimeSpan) As Boolean
+		If ts1.m_Time = ts2.m_Time Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	
+	Static Function FromTicks(ticks As Int64) As TimeSpan
+		If (ticks > MaxValue) Or (ticks < MinValue) Then
+			'ArgumentOutOfRangeException
+			debug
+			Exit Function
+		End If
+		Return New TimeSpan( ticks )
+	End Function
+
+	Static Function FromMilliseconds(value As Double) As TimeSpan
+		Return FromTicks((value * TicksPerMillisecond) As Int64)
+	End Function
+
+	Static Function FromSeconds(value As Double) As TimeSpan
+		Return FromTicks((value * TicksPerSecond)As Int64)
+	End Function
+
+	Static Function FromMinutes(value As Double) As TimeSpan
+		Return FromTicks((value * TicksPerMinute) As Int64)
+	End Function
+
+	Static Function FromHours(value As Double) As TimeSpan
+		Return FromTicks((value * TicksPerHour) As Int64)
+	End Function
+
+	Static Function FromDays(value As Double) As TimeSpan
+		Return FromTicks((value * TicksPerDay) As Int64)
+	End Function
+
+	Function Negate() As TimeSpan
+		Return FromTicks(m_Time * (-1))
+	End Function
+
+	Function Subtract(ts As TimeSpan) As TimeSpan
+		Return FromTicks(m_Time - ts.m_Time)
+	End Function
+End Class
+
+
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/TypeInfo.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/TypeInfo.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/TypeInfo.ab	(revision 506)
@@ -0,0 +1,48 @@
+Namespace System
+
+
+Class TypeInfo
+Public
+
+	Sub TypeInfo()
+	End Sub
+	Sub ~TypeInfo()
+	End Sub
+
+	Override Function GetType() As TypeInfo
+		Return ActiveBasic.Core._System_TypeBase.selfTypeInfo
+	End Function
+
+	Override Function ToString() As String
+		Return FullName()
+	End Function
+
+
+	'----------------------------------------------------------------
+	' Public properties
+	'----------------------------------------------------------------
+
+	Abstract Function BaseType() As TypeInfo
+	Abstract Function FullName() As String
+	Abstract Function IsArray() As Boolean
+	Abstract Function IsByRef() As Boolean
+	Abstract Function IsClass() As Boolean
+	Abstract Function IsEnum() As Boolean
+	Abstract Function IsInterface() As Boolean
+	Abstract Function IsPointer() As Boolean
+	Abstract Function IsValueType() As Boolean
+	Abstract Function Name() As String
+	Abstract Function Namespace() As String
+
+
+
+	'----------------------------------------------------------------
+	' Public methods
+	'----------------------------------------------------------------
+
+	Abstract Function GetMembers() As System.Collections.Generic.List<System.Reflection.MemberInfo>
+
+End Class
+
+
+End Namespace ' System
Index: /trunk/ab5.0/ablib/src/Classes/System/Version.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Version.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Version.ab	(revision 506)
@@ -0,0 +1,145 @@
+' Classes/System/Version.ab
+
+Namespace System
+
+Class Version
+	' Inherits ICloneable, IComparable, IComparable<Version>, IEquatable<Version>
+Public
+	' Constractor
+	Sub Version()
+		major = 0
+		minor = 0
+		build = -1
+		revision = -1
+	End Sub
+
+	'Sub Version(s As String)
+	'End Sub
+
+	Sub Version(major As Long, minor As Long)
+		This.major = major
+		This.minor = minor
+		This.build = -1
+		This.revision = -1
+	End Sub
+
+	Sub Version(major As Long, minor As Long, build As Long)
+		This.major = major
+		This.minor = minor
+		This.build = build
+		This.revision = -1
+	End Sub
+
+	Sub Version(major As Long, minor As Long, build As Long, revision As Long)
+		This.major = major
+		This.minor = minor
+		This.build = build
+		This.revision = revision
+	End Sub
+
+	Const Function Major() As Long
+		Return major
+	End Function
+
+	Const Function Minor() As Long
+		Return minor
+	End Function
+
+	Const Function Build() As Long
+		Return build
+	End Function
+
+	Const Function Revision() As Long
+		Return revision
+	End Function
+
+	Const Function MajorRevision() As Integer
+		Return HIWORD(revision) As Integer
+	End Function
+
+	Const Function MinorRevision() As Integer
+		Return LOWORD(revision) As Integer
+	End Function
+
+	Const Function CompareTo(v As Version) As Long
+		CompareTo = major - v.major
+		If CompareTo <> 0 Then Exit Function
+		CompareTo = minor - v.minor
+		If CompareTo <> 0 Then Exit Function
+		CompareTo = build - v.build
+		If CompareTo <> 0 Then Exit Function
+		CompareTo = revision - v.revision
+	End Function
+
+	Const Function Equals(v As Version) As Boolean
+		Return CompareTo(v) = 0
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return _System_BSwap(major As DWord) Xor minor Xor build Xor _System_BSwap(revision As DWord)
+	End Function
+
+	Function Operator ==(v As Version) As Boolean
+		Return CompareTo(v) = 0
+	End Function
+
+	Function Operator <>(v As Version) As Boolean
+		Return CompareTo(v) <> 0
+	End Function
+
+	Function Operator <(v As Version) As Boolean
+		Return CompareTo(v) < 0
+	End Function
+
+	Function Operator >(v As Version) As Boolean
+		Return CompareTo(v) > 0
+	End Function
+
+	Function Operator <=(v As Version) As Boolean
+		Return CompareTo(v) <= 0
+	End Function
+
+	Function Operator >=(v As Version) As Boolean
+		Return CompareTo(v) >= 0
+	End Function
+
+	Override Function ToString() As String
+		ToString = Str$(major) + "." + Str$(minor)
+		If build >= 0 Then
+			ToString = ToString + "." + Str$(build)
+			If revision >= 0 Then
+				ToString = ToString + "." + Str$(revision)
+			End If
+		End If
+	End Function
+
+	Function ToString(fieldCount As Long) As String
+		If fieldCount < 0 Or fieldCount > 4 Then
+			Throw New ArgumentOutOfRangeException("fieldCount")
+		End If
+		ToString = ""
+		If fieldCount = 0 Then Exit Function
+		ToString = Str$(major)
+		If fieldCount = 1 Then Exit Function
+		ToString = ToString + "." + Str$(minor)
+		If fieldCount = 2 Then Exit Function
+
+		If build < 0 Then
+			Throw New ArgumentException
+		End If
+		ToString = ToString + "." + Str$(build)
+		If fieldCount = 3 Then Exit Function
+
+		If revision < 0 Then
+			Throw New ArgumentException
+		End If
+		ToString = ToString + "." + Str$(revision)
+	End Function
+Private
+	major As Long
+	minor As Long
+	build As Long
+	revision As Long
+End Class
+
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Application.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Application.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Application.ab	(revision 506)
@@ -0,0 +1,55 @@
+Namespace System
+Namespace Windows
+Namespace Forms
+
+
+Class Application
+Public
+	/*!
+	@brief	アプリケーションの実行ファイルのパスを取得する。
+	@author	Daisuke Yamamoto
+	@date	2007/08/29
+	@return	アプリケーションの実行ファイルのパス文字列
+	*/
+	Static Function ExecutablePath() As String
+		Dim szModuleFilePath[MAX_PATH] As TCHAR
+		GetModuleFileName( NULL, szModuleFilePath, MAX_PATH )
+		Return New String( szModuleFilePath )
+	End Function
+
+	/*!
+	@brief	アプリケーション起動時のディレクトリパスを取得する。
+	@author	Daisuke Yamamoto
+	@date	2007/08/29
+	@return	アプリケーション起動時のディレクトリパス文字列
+	*/
+	Static Function StartupPath() As String
+		Return System.IO.Path.GetDirectoryName( ExecutablePath )
+	End Function
+
+	Static Sub ExitThread()
+		PostQuitMessage(0)
+	End Sub
+
+	/*!
+	@brief	現在のスレッドで標準のアプリケーション メッセージ ループの実行を開始し、
+			指定したフォームを表示します。
+	*/
+	Static Sub Run( form As Form )
+
+		' フォームを表示する
+		form.Show()
+
+		Dim msgMain As MSG, iResult As Long
+		Do
+			iResult=GetMessage(msgMain,0,0,0)
+			If iResult=0 or iResult=-1 Then Exit Do
+			TranslateMessage(msgMain)
+			DispatchMessage(msgMain)
+		Loop
+	End Sub
+End Class
+	
+End Namespace
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/ContainerControl.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/ContainerControl.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/ContainerControl.ab	(revision 506)
@@ -0,0 +1,13 @@
+Namespace System
+Namespace Windows
+Namespace Forms
+
+
+Class ContainerControl
+	Inherits ScrollableControl
+End Class
+
+
+End Namespace
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Control.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Control.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Control.ab	(revision 506)
@@ -0,0 +1,673 @@
+' Classes/System/Windows/Forms/Control.ab
+
+Namespace System
+Namespace Windows
+Namespace Forms
+
+Namespace Detail
+
+TypeDef InvokeProc = *Function(p As VoidPtr) As VoidPtr
+
+Class AsyncResultForInvoke
+	Implements System.IAsyncResult
+Public
+	' Properties
+	Sub AsyncResultForInvoke(h As HANDLE)
+		waitHandle.Handle = h
+	End Sub
+
+	Function AsyncState() As Object
+		Return Nothing
+	End Function
+
+	Function AsyncWaitHandle() As System.Threading.WaitHandle
+		Return waitHandle
+	End Function
+
+	Function CompletedSynchronously() As Boolean
+		Return False
+	End Function
+
+	Function IsCompleted() As Boolean
+		Return waitHandle.WaitOne(0, False)
+	End Function
+
+	Const Function Result() As VoidPtr
+		Return result
+	End Function
+
+	Sub Result(r As VoidPtr)
+		result = r
+	End Sub
+
+Private
+	waitHandle As System.Threading.WaitHandle
+	result As VoidPtr
+End Class
+
+Class AsyncInvokeData
+Public
+	FuncPtr As InvokeProc
+	Data As *VoidPtr
+	AsyncResult As AsyncResultForInvoke
+End Class
+
+End Namespace 'Detail
+
+Class Control
+	Implements IWin32Window
+Public
+	'---------------------------------------------------------------------------
+	' Public Properties
+	Function AllowDrop() As Boolean
+	End Function
+
+	'Anchor
+	'AutoScrollOffset 
+	'AutoSize
+	'BackColor下
+	'BackgroundImage
+	'BackgroundImageLayout
+	'-BindingContext
+	'Bottom 下
+	'Bounds 下
+	'CanFocus
+	'CanSelect
+	'Capture
+	'-CausesValidation
+	'CheckForIllegalCrossThreadCalls
+
+	Override Function Handle() As HWND
+		Return wnd.HWnd
+	End Function
+
+	' IDropTargetを実装するのでDragAcceptFiles関数は呼ばない。
+	Sub AllowDrop(a As Boolean)
+	End Sub
+
+	Const Function Visible() As Boolean
+		Return wnd.Visible
+	End Function
+
+	Sub Visible(v As Boolean)
+		wnd.Visible(v)
+	End Sub
+
+	Const Function Text() As String
+		Return text
+	End Function
+
+	Sub Text(t As String)
+		text = t
+		Dim e As EventArgs
+		OnTextChanged(e)
+	End Sub
+
+	Const Function Enabled() As Boolean
+		Return wnd.Enabled
+	End Function
+
+	Sub Enabled(e As Boolean)
+		' OnEnabledChangedはWM_ENABLE経由で呼ばれる
+		wnd.Enabled(e)
+	End Sub
+
+	Const Function Bounds() As Drawing.Rectangle
+		Dim wr As RECT
+		wr = wnd.WindowRect
+		Dim r = New Drawing.Rectangle(wr)
+		Dim parent = Parent
+		If Object.ReferenceEquals(parent, Nothing) Then
+			Return parent.RectangleToClient(r)
+		Else
+			Return r
+		End If
+	End Function
+/* BoundsSpecifiedが使用不能なのでコメントアウト
+	Sub Bounds(r As Rectangle)
+		SetBoundsCore(r.X, r.Y, r.Width, r.Height, BoundsSpecified.All)
+	End Sub
+*/
+	Const Function Location() As Drawing.Point
+		Return Bounds.Location
+	End Function
+/*
+	Sub Location(p As Point)
+		SetBoundsCore(p.X, p.Y, 0, 0, BoundsSpecified.Location)
+	End Sub
+*/
+	Const Function Size() As Drawing.Size
+		Return Bounds.Size
+	End Function
+/*
+	Sub Size(s As Size)
+		SetBoundsCore(0, 0, s.Width, s.Height, BoundsSpecified.Size)
+	End Sub
+
+	Const Function ClientRectangle() As Rectangle
+		Return New Rectangle(wnd.ClientRect)
+	End Function
+
+	Const Function ClientSize() As Size
+		Return ClientRectangle.Size
+	End Function
+*/
+	Const Function Left() As Long
+		Dim b = Bounds
+		Return b.Left
+	End Function
+/*
+	Sub Left(l As Long)
+		SetBoundsCore(l, 0, 0, 0, BoundsSpecified.X)
+	End Sub
+*/
+	Const Function Top() As Long
+		Dim b = Bounds
+		Return b.Top
+	End Function
+/*
+	Sub Top(t As Long)
+		SetBoundsCore(0, t, 0, 0, BoundsSpecified.Y)
+	End Sub
+*/
+	Const Function Width() As Long
+		Dim b = Bounds
+		Return b.Width
+	End Function
+/*
+	Sub Width(w As Long)
+		SetBoundsCore(0, 0, w, 0, BoundsSpecified.Width)
+	End Sub
+*/
+	Const Function Height() As Long
+		Dim b = Bounds
+		Return b.Height
+	End Function
+/*
+	Sub Height(h As Long)
+		SetBoundsCore(0, 0, 0, h, BoundsSpecified.Height)
+	End Sub
+*/
+	Const Function Right() As Long
+		Dim b = Bounds
+		Return b.Left + b.Width
+	End Function
+
+	Const Function Bottom() As Long
+		Dim b = Bounds
+		Return b.Top + b.Height
+	End Function
+/*
+	Const Function PointToScreen(p As Point) As Point
+		PointToScreen = New Point
+		PointToScreen.X = p.X
+		PointToScreen.Y = p.Y
+		wnd.ClientToScreen(ByVal ObjPtr(PointToScreen) As *POINTAPI)
+	End Function
+
+	Const Function PointToClient(p As Point) As Point
+		PointToScreen = New Point
+		PointToClient.X = p.X
+		PointToClient.Y = p.Y
+		wnd.ScreenToClient(ByVal ObjPtr(PointToClient) As *POINTAPI)
+	End Function
+*/
+	Const Function RectangleToScreen(r As Drawing.Rectangle) As Drawing.Rectangle
+		Dim rc = r.ToRECT
+		wnd.ClientToScreen(rc)
+		Return New Drawing.Rectangle(rc)
+	End Function
+
+	Const Function RectangleToClient(r As Drawing.Rectangle) As Drawing.Rectangle
+		Dim rc = r.ToRECT()
+		wnd.ScreenToClient(rc)
+		Return New Drawing.Rectangle(rc)
+	End Function
+
+	Const Function InvokeRequired() As Boolean
+		Return wnd.ThreadId <> GetCurrentThreadId()
+	End Function
+
+	Const Virtual Function BackColor() As Color
+		Return bkColor
+	End Function
+
+	Virtual Sub BackColor(c As Color)
+		c = bkColor
+		OnBackColorChanged(New EventArgs)
+	End Sub
+
+	Function Parent() As Control
+		Return parent
+	End Function
+
+	Const Function IsHandleCreated() As Boolean
+		Return wnd.HWnd <> 0 Or IsWindow(wnd.HWnd) <> FALSE
+	End Function
+
+	Static Function DefaultBackColor() As Color
+		Return Color.FromArgb(255, 255, 255)
+	End Function
+
+	'---------------------------------------------------------------------------
+	' Constractors
+
+	Sub Control()
+		Dim sz = DefaultSize()
+		init(Nothing, "", 100, 100, sz.Width, sz.Height)
+	End Sub
+
+	Sub Control(text As String)
+		Dim sz = DefaultSize()
+		init(Nothing, text, 100, 100, sz.Width, sz.Height)
+	End Sub
+
+	Sub Control(parent As Control, text As String)
+		Dim sz = DefaultSize()
+		init(parent, text, 100, 100, sz.Width, sz.Height)
+	End Sub
+
+	Sub Control(text As String, left As Long, top As Long, width As Long, height As Long)
+		init(Nothing, text, left, top, width, height)
+	End Sub
+
+	Sub Control(parent As Control, text As String, left As Long, top As Long, width As Long, height As Long)
+		init(parent, text, left, top, width, height)
+	End Sub
+
+Private
+
+	Sub init(parent As Control, text As String, left As Long, top As Long, width As Long, height As Long)
+		This.text = text
+		This.parent = parent
+
+		Dim rgb = GetSysColor( COLOR_HIGHLIGHT )
+		This.bkColor = New Color( GetRValue(rgb) As Byte, GetGValue(rgb) As Byte, GetBValue(rgb) As Byte )
+
+		Dim hParentWnd = NULL As HWND
+		If Not ActiveBasic.IsNothing( parent ) Then
+			hParentWnd = parent.Handle
+		End If
+
+		createParams = New CreateParams()
+		With createParams
+			.Caption = text
+			.X = left
+			.Y = top
+			.Width = width
+			.Height = height
+			.Parent = hParentWnd
+		End With
+
+		CreateControl()
+	End Sub
+	
+
+	'---------------------------------------------------------------------------
+	' Destractor
+Public
+	Virtual Sub ~Control()
+		If Not Object.ReferenceEquals(wnd, Nothing) Then
+			If wnd.IsWindow Then
+				wnd.Destroy() ' 暫定
+			End If
+		End If
+	End Sub
+
+	'---------------------------------------------------------------------------
+	' Public Methods
+/*
+	' 同期関数呼出、Controlが作成されたスレッドで関数を実行する。
+	' 関数は同期的に呼び出されるので、関数が終わるまでInvokeは制御を戻さない。
+	Function Invoke(pfn As System.Windows.Forms.Detail.InvokeProc, p As VoidPtr) As VoidPtr
+		Return wnd.SendMessage(WM_CONTROL_INVOKE, p As WPARAM, pfn As LPARAM) As VoidPtr
+	End Function
+
+	' 非同期関数呼出、Controlが作成されたスレッドで関数を実行する。
+	' 関数は非同期的に呼び出されるので、BeginInvokeはすぐに制御を戻す。
+	' 後にEndInvokeを呼び出すことにより、関数の戻り値を受け取れる。
+	Function BeginInvoke(pfn As System.Windows.Forms.Detail.InvokeProc, p As VoidPtr) As System.IAsyncResult
+		' EndInvokeがDeleteする
+		Dim asyncResult = New System.Windows.Forms.Detail.AsyncResultForInvoke(CreateEvent(0, FALSE, FALSE, 0))
+		Dim asyncInvokeData = New System.Windows.Forms.Detail.AsyncInvokeData
+		With asyncInvokeData
+			.FuncPtr = pfn
+			.Data = p
+			.AsyncResult = asyncResult
+		End With
+		Dim gch = System.Runtime.InteropServices.GCHandle.Alloc(asyncInvokeData)
+		wnd.PostMessage(WM_CONTROL_BEGININVOKE, 0, System.Runtime.InteropServices.GCHandle.ToIntPtr(gch))
+		Return asyncResult
+	End Function
+
+	' BeginInvokeで呼び出した関数の戻り値を受け取る。
+	' その関数がまだ終了していない場合、終了するまで待機する。
+	Function EndInvoke(ar As System.IAsyncResult) As VoidPtr
+		ar.WaitHandle.WaitOne()
+		Dim arInvoke = ar As System.Windows.Forms.Detail.AsyncResultForInvoke
+		Return arInvoke.Result
+	End Function
+*/
+	' 与えられたウィンドウハンドルがControl（若しくはその派生クラス）の
+	' インスタンスに対応するものであった場合、
+	' 元のインスタンスを返す。
+	' そうでなければNothingを返す。
+	Static Function FromHandle(hwnd As HWND) As Control
+		If IsWindow(hwnd) Then
+			If GetClassLongPtr(hwnd, GCW_ATOM) = atom Then
+				Dim lpValue = GetWindowLongPtr(hwnd, GWLP_THIS)
+				If lpValue Then
+					Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr( lpValue )
+					Return gch.Target As Control
+				End If
+			End If
+		End If
+		Return Nothing As Control
+	End Function
+
+	Virtual Sub ResetText()
+		text = ""
+	End Sub
+
+	Override Function ToString() As String
+		Return Super.ToString + ", Text: " + This.Text
+	End Function
+
+	' Wrapper Methods
+	Sub BringToFront()
+		wnd.BringToTop()
+	End Sub
+
+	Sub Hide()
+		wnd.Show(SW_HIDE)
+	End Sub
+
+	Sub Show()
+		wnd.Show(SW_SHOW)
+	End Sub
+
+	Sub Update()
+		wnd.Update()
+	End Sub
+
+	Sub CreateControl()
+		CreateHandle() '暫定
+	End Sub
+
+Protected
+
+	'---------------------------------------------------------------------------
+	' Protected Properties
+'	Const Virtual Function CanRaiseEvents() As Boolean
+	Virtual Function CreateParams() As CreateParams
+		Return createParams
+	End Function
+'	Virtual Function DefaultCursor() As Cursor
+
+	Virtual Function DefaultSize() As Drawing.Size
+		Return New Drawing.Size(300, 300)
+	End Function
+
+'	Function FontHeight() As Long
+'	Sub FontHeight(h As Long)
+
+'	Const Virtual Function Cursor() As Cursor
+'	Virtual Sub Cursor(c As Cursor)
+
+	'---------------------------------------------------------------------------
+	' Protected Methods
+	Virtual Sub CreateHandle()
+		If Not Object.ReferenceEquals(wnd, Nothing) Then
+			If wnd.HWnd <> 0 Then
+				Exit Sub
+			End If
+		End If
+
+		Dim gch = System.Runtime.InteropServices.GCHandle.Alloc(This)
+		TlsSetValue(tlsIndex, System.Runtime.InteropServices.GCHandle.ToIntPtr(gch) As VoidPtr)
+
+		Dim pText As PCTSTR
+		If String.IsNullOrEmpty(text) Then
+			pText = "" As PCTSTR
+		Else
+			pText = ToTCStr(text)
+		End If
+
+		Dim result As HANDLE
+		With This.CreateParams
+			result = CreateWindowEx(
+				.ExStyle,						' 拡張ウィンドウ スタイル
+				atom As ULONG_PTR As PCSTR,		' クラス名
+				pText,							' キャプション
+				.Style,							' ウィンドウ スタイル
+				.X,								' X座標
+				.Y,								' Y座標
+				.Width,							' 幅
+				.Height,						' 高さ
+				.Parent,						' 親ウィンドウ ハンドル
+				0,								' メニュー ハンドル
+				hInstance,						' アプリケーション インスタンス ハンドル
+				0)								' ウィンドウ作成データ
+		End With
+
+		If result = NULL Then
+			' Error
+			Dim buf[1023] As TCHAR
+			wsprintf(buf, ToTCStr(Ex"Control: CreateWindowEx failed. Error code: &h%08X\r\n"), GetLastError())
+			OutputDebugString(buf)
+
+			gch.Free()
+'				Debug
+			ExitThread(0)
+		End If
+		
+	End Sub
+
+	Virtual Sub DefWndProc(m As Message)
+		m.Result = DefWindowProc(m.HWnd, m.Msg, m.WParam, m.LParam)
+	End Sub
+
+	Virtual Sub WndProc(m As Message)
+		With m
+			Select Case .Msg
+				Case WM_GETTEXTLENGTH
+					.Result = text.Length 'ToDo: Unicode対応
+				Case WM_GETTEXT
+					Dim size = System.Math.Min(.WParam As SIZE_T, (text.Length + 1) As SIZE_T)
+					ActiveBasic.Strings.ChrCopy(.LParam As PCTSTR, ToTCStr(text), size)
+					.Result = size
+				Case WM_SETTEXT
+					text = New String(.LParam As PCTSTR)
+				Case WM_ENABLE
+					OnEnabledChanged(System.EventArgs.Empty)
+				Case WM_ERASEBKGND
+					' OnPaintBackgroundに移すべき
+					Dim hdc = .WParam As HDC
+					Dim hbr = CreateSolidBrush(bkColor.ToCOLORREF())
+					Dim hbrOld = SelectObject(hdc, hbr)
+					Dim rc = wnd.ClientRect
+					Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom)
+					SelectObject(hdc, hbrOld)
+					DeleteObject(hbr)
+				Case WM_CONTROL_INVOKE
+					Dim pfn = .LParam As System.Windows.Forms.Detail.InvokeProc
+					.Result = pfn(m.WParam As VoidPtr) As LRESULT
+				Case WM_CONTROL_BEGININVOKE
+					OnControlBeginInvoke(m)
+				Case WM_CREATE
+					OnHandleCreated(System.EventArgs.Empty)
+				Case WM_DESTROY
+					OnHandleDestroyed(System.EventArgs.Empty)
+
+				Case WM_LBUTTONDOWN
+					Goto *ButtonDown
+*ButtonDown
+				Case Else
+					DefWndProc(m)
+			End Select
+		End With
+	End Sub
+
+	Virtual Sub SetClientSizeCore(x As Long, y As Long)
+		Dim rc As RECT
+		With rc
+			.left = 0
+			.top = 0
+			.right = x
+			.bottom = y
+		End With
+		Dim hasMenu = FALSE As BOOL
+		If wnd.Parent As HWND = 0 Then
+			If wnd.Menu <> 0 Then
+				hasMenu = TRUE
+			End If
+		End If
+		AdjustWindowRectEx(rc, wnd.Style, hasMenu, wnd.ExStyle)
+		wnd.Move(rc)
+	End Sub
+
+	Virtual Sub SetBoundsCore(x As Long, y As Long, width As Long, height As Long, bs As BoundsSpecified)
+'		If Not (bs As DWord And BoundsSpecified.X As DWord) Then
+			x = Left
+'		End If
+'		If Not (bs As DWord And BoundsSpecified.Y As DWord) Then
+			y = Right
+'		End If
+'		If Not (bs As DWord And BoundsSpecified.Width As DWord) Then
+			width = Width
+'		End If
+'		If Not (bs As DWord And BoundsSpecified.Height As DWord) Then
+			height = Height
+'		End If
+		wnd.Move(x, y, width, height)
+	End Sub
+
+	Virtual Sub NotifyInvalidate(r As Drawing.Rectangle)
+		Dim rc As RECT
+		rc = r.ToRECT()
+		wnd.InvalidateRect(rc)
+	End Sub
+
+'	Virtual Sub OnPaintBackground(e As PaintEventArgs) : End Sub
+	Virtual Sub OnEnabledChanged(e As System.EventArgs) : End Sub
+	Virtual Sub OnBackColorChanged(e As System.EventArgs) : End Sub
+	Virtual Sub OnHandleCreated(e As System.EventArgs) : End Sub
+	Virtual Sub OnHandleDestroyed(e As System.EventArgs) : End Sub
+	Virtual Sub OnTextChanged(e As System.EventArgs)
+		wnd.SetText(ToTCStr(text))
+	End Sub
+
+Private
+	' Member variables
+	wnd As ActiveBasic.Windows.WindowHandle
+	createParams As CreateParams
+	text As String
+	parent As Control
+	bkColor As Color
+
+	'ウィンドウ作成時にウィンドウプロシージャへThisを伝えるためのもの
+	Static tlsIndex As DWord
+
+	Static hInstance As HINSTANCE
+	Static atom As ATOM
+
+	Static Const WM_CONTROL_INVOKE = WM_USER + 0 As DWord
+	Static Const WM_CONTROL_BEGININVOKE = WM_USER + 1 As DWord
+
+	Static Const WindowClassName = "ActiveBasic Control"
+Public
+	Static Sub Initialize(hinst As HINSTANCE)
+		tlsIndex = TlsAlloc()
+		hInstance = hinst
+
+		Dim wcx As WNDCLASSEX
+		With wcx
+			.cbSize = Len (wcx)
+			.style = CS_HREDRAW Or CS_VREDRAW Or CS_DBLCLKS
+			.lpfnWndProc = AddressOf (WndProcFirst)
+			.cbClsExtra = 0
+			.cbWndExtra = SizeOf (LONG_PTR) * 2
+			.hInstance = hinst
+			.hIcon = 0
+			.hCursor = LoadImage(0, MAKEINTRESOURCE(IDC_ARROW), IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE Or LR_SHARED) As HCURSOR
+			.hbrBackground = 0
+			.lpszMenuName = 0
+			.lpszClassName = ToTCStr(WindowClassName)
+			.hIconSm = 0
+		End With
+		atom = RegisterClassEx(wcx)
+		If atom = 0 Then
+			Dim buf[1023] As TCHAR
+			wsprintf(buf, ToTCStr(Ex"Control: RegisterClasseEx failed. Error code: &h%08X\r\n"), GetLastError())
+			OutputDebugString(buf)
+			Debug
+			ExitThread(0)
+		End If
+	End Sub
+
+	Static Sub Uninitialize()
+		UnregisterClass(atom As ULONG_PTR As PCSTR, hInstance)
+		TlsFree(tlsIndex)
+	End Sub
+Private
+	Static Const GWLP_THIS = SizeOf (LONG_PTR) * 0 As Long
+	Static Const GWLP_TAG = SizeOf (LONG_PTR) * 1 As Long
+
+	' Windowsから呼ばれるウィンドウプロシージャ。WndProc
+	Static Function WndProcFirst(hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+		Dim rThis = Control.FromHandle(hwnd) As Control
+		If Object.ReferenceEquals(rThis As Object, Nothing) Then
+			Dim gchValue = TlsGetValue(tlsIndex) As LONG_PTR
+			Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(gchValue)
+			rThis = gch.Target As Control
+			' ウィンドウが作られて最初にWndProcFirstが呼ばれたとき
+			If Object.ReferenceEquals(rThis, Nothing) Then
+				' あってはならない事態
+				Debug
+				ExitThread(-1)
+			End If
+			rThis.wnd = New ActiveBasic.Windows.WindowHandle(hwnd)
+			SetWindowLongPtr(hwnd, GWLP_THIS, gchValue)
+		ElseIf msg = WM_NCDESTROY Then
+			Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(GetWindowLongPtr(hwnd, GWLP_THIS))
+			 gch.Free()
+		End If
+
+		Dim m = Message.Create(hwnd, msg, wp, lp)
+		rThis.WndProc(m)
+		Return m.Result
+	End Function
+
+	' BeginInvokeが呼ばれたときの処理
+	Sub OnControlBeginInvoke(m As Message)
+		Dim gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(m.LParam)
+		Dim data = gch.Target As System.Windows.Forms.Detail.AsyncInvokeData
+		With data
+			Dim pfn = .FuncPtr
+			.AsyncResult.Result = pfn(.Data)
+			SetEvent(.AsyncResult.AsyncWaitHandle.Handle)
+		End With
+	End Sub
+End Class
+
+Namespace Detail
+Class _System_ControlIinitializer
+Public
+	Sub _System_ControlIinitializer(hinst As HINSTANCE)
+		System.Windows.Forms.Control.Initialize(hinst)
+	End Sub
+
+	Sub ~_System_ControlIinitializer()
+		System.Windows.Forms.Control.Uninitialize()
+	End Sub
+End Class
+
+#ifndef _SYSTEM_NO_INITIALIZE_CONTROL_
+Dim _System_ControlInitializer As _System_ControlIinitializer(GetModuleHandle(0))
+#endif '_SYSTEM_NO_INITIALIZE_CONTROL_
+
+End Namespace
+
+End Namespace 'Forms
+End Namespace 'Widnows
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/CreateParams.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/CreateParams.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/CreateParams.ab	(revision 506)
@@ -0,0 +1,23 @@
+
+Namespace System
+Namespace Windows
+Namespace Forms
+
+Class CreateParams
+Public
+	Caption As String
+	ClassName As String
+	ClassStyle As DWord
+	Style As DWord
+	ExStyle As DWord
+	X As Long
+	Y As Long
+	Width As Long
+	Height As Long
+	Parent As HWND
+	Param As VoidPtr
+End Class
+
+End Namespace 'Forms
+End Namespace 'Widnows
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Form.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Form.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Form.ab	(revision 506)
@@ -0,0 +1,64 @@
+Namespace System
+Namespace Windows
+Namespace Forms
+
+
+Enum DialogResult
+	None	= NULL		'ダイアログ ボックスから Nothing が返されます。つまり、モーダル ダイアログ ボックスの実行が継続します。 
+	Abort	= IDABORT	'ダイアログ ボックスの戻り値は Abort です (通常は "中止" というラベルが指定されたボタンから送られます)。 
+	Cancel	= IDCANCEL	'ダイアログ ボックスの戻り値は Cancel です (通常は "キャンセル" というラベルが指定されたボタンから送られます)。 
+	Ignore	= IDIGNORE	'ダイアログ ボックスの戻り値は Ignore です (通常は "無視" というラベルが指定されたボタンから送られます)。 
+	No		= IDNO		'ダイアログ ボックスの戻り値は No です (通常は "いいえ" というラベルが指定されたボタンから送られます)。 
+	OK		= IDOK		'ダイアログ ボックスの戻り値は OK です (通常は "OK" というラベルが指定されたボタンから送られます)。 
+	Retry	= IDRETRY	'ダイアログ ボックスの戻り値は Retry です (通常は "再試行" というラベルが指定されたボタンから送られます)。 
+	Yes		= IDYES		'ダイアログ ボックスの戻り値は Yes です (通常は "はい" というラベルが指定されたボタンから送られます)。 
+End Enum
+
+Class Form
+	Inherits ContainerControl
+Public
+
+	Sub Form()
+		With createParams
+			.Style		or= WS_OVERLAPPEDWINDOW or WS_VISIBLE or WS_CLIPSIBLINGS or WS_CLIPCHILDREN
+			.ExStyle	or= WS_EX_WINDOWEDGE or WS_EX_CONTROLPARENT or WS_EX_APPWINDOW
+			.Width		= 300
+			.Height		= 300
+		End With
+	End Sub
+
+	Function ShowDialog() As DialogResult
+		Dim isParentEnable = False
+		If Not ActiveBasic.IsNothing( This.Parent ) Then
+			' 親コントロールを無効にする
+			isParentEnable = This.Parent.Enabled
+			This.Parent.Enabled = False
+		End If
+
+		This.Show()
+
+		' メッセージループ
+		Dim msg As MSG, iResult As Long
+		Do
+			iResult=GetMessage(msg,0,0,0)
+			If iResult=0 or iResult=-1 Then Exit Do
+			If IsDialogMessage(This.Handle,msg) Then Continue
+			TranslateMessage(msg)
+			DispatchMessage(msg)
+		Loop
+
+		If Not ActiveBasic.IsNothing( This.Parent ) Then
+			' もともと親コントロールが有効だった場合には有効に戻す
+			If isParentEnable Then
+				This.Parent.Enabled = True
+			End If
+		End If
+
+		Return msg.wParam As DialogResult
+	End Function
+End Class
+
+
+End Namespace
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Message.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Message.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/Message.ab	(revision 506)
@@ -0,0 +1,97 @@
+' Classes/System/Windows/Forms/Message.ab
+
+#ifndef __SYSTEM_WINDOWS_FORMS_MESSAGE_AB__
+#define __SYSTEM_WINDOWS_FORMS_MESSAGE_AB__
+
+'#require <windows.sbp>
+
+Namespace System
+Namespace Windows
+Namespace Forms
+
+Class Message
+Public
+	Const Function HWnd() As HWND
+		Return hwnd
+	End Function
+
+	Sub HWnd(hw As HWND)
+		hwnd = hw
+	End Sub
+
+	Const Function Msg() As DWord
+		Return msg
+	End Function
+
+	Sub Msg(m As DWord)
+		msg = m
+	End Sub
+
+	Const Function WParam() As WPARAM
+		Return wp
+	End Function
+
+	Sub WParam(wParam As WPARAM)
+		wp = wParam
+	End Sub
+
+	Const Function LParam() As LPARAM
+		Return lp
+	End Function
+
+	Sub LParam(lParam As LPARAM)
+		lp = lParam
+	End Sub
+
+	Const Function Result() As LRESULT
+		Return lr
+	End Function
+
+	Sub Result(res As LRESULT)
+		lr = res
+	End Sub
+
+	/*Const*/ Function Equals(x As Message) As Boolean
+		Return hwnd = x.hwnd And _
+			msg = x.msg And _
+			wp = x.wp And _
+			lp = x.lp And _
+			lr = x.lr
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return _System_HashFromPtr(hwnd) Xor (Not msg) Xor _System_HashFromPtr(wp As VoidPtr) Xor _
+			(Not _System_HashFromPtr(lp As VoidPtr)) Xor _System_HashFromPtr(lr As VoidPtr)
+	End Function
+
+	Const Function Operator ==(x As Message) As Boolean
+		Return Equals(x)
+	End Function
+
+	Const Function Operator <>(x As Message) As Boolean
+		Return Not Equals(x)
+	End Function
+
+	Static Function Create(hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As Message
+		Create = New Message
+		With Create
+			.hwnd = hwnd
+			.msg = msg
+			.wp = wp
+			.lp = lp
+		End With
+	End Function
+
+Private
+	hwnd As HWND
+	msg As DWord
+	wp As WPARAM
+	lp As LPARAM
+	lr As LRESULT
+End Class
+
+End Namespace 'Forms
+End Namespace 'Widnows
+End Namespace 'System
+
+#endif '__SYSTEM_WINDOWS_FORMS_MESSAGE_AB__
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/MessageBox.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/MessageBox.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/MessageBox.ab	(revision 506)
@@ -0,0 +1,108 @@
+'Classes/System/Windows/Forms/MessageBox.ab
+
+'#require <Classes/System/Windows/Forms/misc.ab>
+'#require <Classes/ActiveBasic/Windows/Windows.ab>
+
+Namespace System
+Namespace Windows
+Namespace Forms
+
+Enum MessageBoxButtons
+	OK = MB_OK
+	OKCancel = MB_OKCANCEL
+	AbortRetryIgnore = MB_ABORTRETRYIGNORE
+	YesNoCancel = MB_ABORTRETRYIGNORE
+	YesNo = MB_YESNO
+	RetryCancel = MB_RETRYCANCEL
+End Enum
+
+Enum MessageBoxIcon
+	None = 0
+	Hand = MB_ICONHAND
+	Question = MB_ICONQUESTION
+	Exclamation = MB_ICONEXCLAMATION
+	Asterisk = MB_ICONASTERISK
+	Warning = MB_ICONWARNING
+	Error = MB_ICONERROR
+	Information = MB_ICONINFORMATION
+	Stop = MB_ICONSTOP
+End Enum
+
+Enum MessageBoxDefaultButton
+	Button1 = MB_DEFBUTTON1
+	Button2 = MB_DEFBUTTON2
+	Button3 = MB_DEFBUTTON3
+End Enum
+
+Enum MessageBoxOptions
+	None = 0
+	DefaultDesktopOnl = MB_DEFAULT_DESKTOP_ONLY
+	RightAlign = MB_RIGHT
+	RtlReading = MB_RTLREADING
+	ServiceNotification = MB_SERVICE_NOTIFICATION
+End Enum
+
+Class MessageBox
+Public
+	Static Function Show(text As String) As DialogResult
+		Show = Show(Nothing, text, "", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.None)
+	End Function
+
+	Static Function Show(owner As IWin32Window, text As String) As DialogResult
+		Show = Show(owner, text, "", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.None)
+	End Function
+
+	Static Function Show(text As String, caption As String) As DialogResult
+		Show = Show(Nothing, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.None)
+	End Function
+
+	Static Function Show(owner As IWin32Window, text As String, caption As String) As DialogResult
+		Show = Show(owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.None)
+	End Function
+
+	Static Function Show(text As String, caption As String, buttons As MessageBoxButtons) As DialogResult
+		Show = Show(Nothing, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.None)
+	End Function
+
+	Static Function Show(owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons) As DialogResult
+		Show = Show(owner, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.None)
+	End Function
+
+	Static Function Show(text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon) As DialogResult
+		Show = Show(Nothing, text, caption, buttons, icon, MessageBoxDefaultButton.Button1, MessageBoxOptions.None)
+	End Function
+
+	Static Function Show(owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon) As DialogResult
+		Show = Show(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1, MessageBoxOptions.None)
+	End Function
+
+	Static Function Show(text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton) As DialogResult
+		Show = Show(Nothing, text, caption, buttons, icon, defaultButtion, MessageBoxOptions.None)
+	End Function
+
+	Static Function Show(owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton) As DialogResult
+		Show = Show(owner, text, caption, buttons, icon, defaultButtion, MessageBoxOptions.None)
+	End Function
+
+	Static Function Show(text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions) As DialogResult
+		Show = Show(Nothing, text, caption, buttons, icon, defaultButtion, options)
+	End Function
+
+	Static Function Show(owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions) As DialogResult
+		'Show = ActiveBasic.Windows.Detail._System_MessageBox(owner.Handle, StrPtr(text), StrPtr(caption), buttons As DWord Or icon As DWord Or defaultButtion As DWord Or options As DWord) As DialogResult
+	End Function
+
+'	Static Function Show(text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions, displayHelpButton As Boolean) As DialogResult
+'	Static Function Show(text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String) As DialogResult
+'	Static Function Show(owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String) As DialogResult
+'	Static Function Show(text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, navigator As HelpNavigator) As DialogResult
+'	Static Function Show(owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, navigator As HelpNavigator) As DialogResult
+'	Static Function Show(text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, keyword As String) As DialogResult
+'	Static Function Show(owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, keyword As String) As DialogResult
+'	Static Function Show(text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, navigator As HelpNavigator, param As Object) As DialogResult
+'	Static Function Show(owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButtion As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, navigator As HelpNavigator, param As Object) As DialogResult
+End Class
+
+End Namespace 'Forms
+End Namespace 'Widnows
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/PaintEventArgs.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/PaintEventArgs.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/PaintEventArgs.ab	(revision 506)
@@ -0,0 +1,18 @@
+' Classes/System/Windows/Forms/PaintEventArgs.ab
+
+#ifndef __SYSTEM_WINDOWS_FORMS_PAINTEVENTARGS_AB__
+#define __SYSTEM_WINDOWS_FORMS_PAINTEVENTARGS_AB__
+
+Namespace System
+Namespace Windows
+Namespace Forms
+
+Class PaintEventArgs
+	Inherits System.EventArgs
+End Class
+
+End Namespace 'Forms
+End Namespace 'Widnows
+End Namespace 'System
+
+#endif '__SYSTEM_WINDOWS_FORMS_PAINTEVENTARGS_AB__
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/ScrollableControl.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/ScrollableControl.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/ScrollableControl.ab	(revision 506)
@@ -0,0 +1,13 @@
+Namespace System
+Namespace Windows
+Namespace Forms
+
+
+Class ScrollableControl
+	Inherits Control
+End Class
+
+
+End Namespace
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/WebBrowser.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/WebBrowser.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/WebBrowser.ab	(revision 506)
@@ -0,0 +1,13 @@
+Namespace System
+Namespace Windows
+Namespace Forms
+
+
+Class WebBrowser
+	Inherits WebBrowserBase
+End Class
+
+
+End Namespace
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/WebBrowserBase.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/WebBrowserBase.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/WebBrowserBase.ab	(revision 506)
@@ -0,0 +1,14 @@
+Namespace System
+Namespace Windows
+Namespace Forms
+
+
+Class WebBrowserBase
+	Inherits Control
+Public
+End Class
+
+
+End Namespace
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/misc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/misc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Windows/Forms/misc.ab	(revision 506)
@@ -0,0 +1,249 @@
+'Classes/System/Windows/Forms/misc.ab
+
+#ifndef __SYSTEM_WINDOWS_FORMS_MISC_AB__
+#define __SYSTEM_WINDOWS_FORMS_MISC_AB__
+
+Namespace System
+Namespace Windows
+Namespace Forms
+
+Interface IWin32Window
+	Function Handle() As HWND
+End Interface
+
+TypeDef BoundsSpecified = Long
+/*
+Enum BoundsSpecified
+	None = &h0
+	X = &h1
+	Y = &h2
+	Width = &h4
+	Height = &h8
+	Location = BoundsSpecified.X Or BoundsSpecified.Y
+	Size = BoundsSpecified.Width Or BoundsSpecified.Height
+	All = BoundsSpecified.Location Or BoundsSpecified.Size
+End Enum
+*/
+
+/*
+Enum Keys
+	LButton = VK_LBUTTON
+	RButton = VK_RBUTTON
+	Cancel = VK_CANCEL
+	MButton = VK_MBUTTON
+	XButton1 = VK_XBUTTON1
+	XButton2 = VK_XBUTTON2
+	Back = VK_BACK
+	Tab = VK_TAB
+	Clear = VK_CLEAR
+	Return_ = VK_RETURN
+	Shift = VK_SHIFT
+	Control = VK_CONTROL
+	Menu = VK_MENU
+	Pause = VK_PAUSE
+	Capital = VK_CAPITAL
+	KanaMode = VK_KANA
+	HangulMode = VK_HANGUL
+	JunjaMode = VK_JUNJA
+	FinalMode = VK_FINAL
+	HanjaMode = VK_HANJA
+	KanjiMode = VK_KANJI
+	Escape = VK_ESCAPE
+	IMEConvert = VK_CONVERT
+	IMENonconvert = VK_NONCONVERT
+	IMEAccept = VK_ACCEPT
+	IMEModeChange = VK_MODECHANGE
+	Space = VK_SPACE
+	PageUp = VK_PRIOR
+	PageDown = VK_NEXT
+	End_ = VK_END
+	Home = VK_HOME
+	Left = VK_LEFT
+	Up = VK_UP
+	Right = VK_RIGHT
+	Down = VK_DOWN
+	Select_ = VK_SELECT
+	Print = VK_PRINT
+	Execute = VK_EXECUTE
+	Snapshot = VK_SNAPSHOT
+	Insert = VK_INSERT
+	Delete_ = VK_DELETE
+	Help = VK_HELP
+	D0 = &h30
+	D1 = &h31
+	D2 = &h32
+	D3 = &h33
+	D4 = &h34
+	D5 = &h35
+	D6 = &h36
+	D7 = &h37
+	D8 = &h38
+	D9 = &h39
+	A = &h41
+	B = &h42
+	C = &h43
+	D = &h44
+	E = &h45
+	F = &h46
+	G = &h47
+	H = &h48
+	I = &h49
+	J = &h4a
+	K = &h4b
+	L = &h4c
+	M = &h4d
+	N = &h4e
+	O = &h4f
+	P = &h50
+	Q = &h51
+	R = &h52
+	S = &h53
+	T = &h54
+	U = &h55
+	V = &h56
+	W = &h57
+	X = &h58
+	Y = &h59
+	Z = &h5A
+	LWin = VK_LWIN
+	RWin = VK_RWIN
+	Apps = VK_APPS
+	Sleep = VK_SLEEP
+	NumPad0 = VK_NUMPAD0
+	NumPad1 = VK_NUMPAD1
+	NumPad2 = VK_NUMPAD2
+	NumPad3 = VK_NUMPAD3
+	NumPad4 = VK_NUMPAD4
+	NumPad5 = VK_NUMPAD5
+	NumPad6 = VK_NUMPAD6
+	NumPad7 = VK_NUMPAD7
+	NumPad8 = VK_NUMPAD8
+	NumPad9 = VK_NUMPAD9
+	Multiply = VK_MULTIPLY
+	Add = VK_ADD
+	Separator = VK_SEPARATOR
+	Substract = VK_SUBTRACT
+	Decimal = VK_DECIMAL
+	Divide = VK_DIVIDE
+	F1 = VK_F1
+	F2 = VK_F2
+	F3 = VK_F3
+	F4 = VK_F4
+	F5 = VK_F5
+	F6 = VK_F6
+	F7 = VK_F7
+	F8 = VK_F8
+	F9 = VK_F9
+	F10 = VK_F10
+	F11 = VK_F11
+	F12 = VK_F12
+	F13 = VK_F13
+	F14 = VK_F14
+	F15 = VK_F15
+	F16 = VK_F16
+	F17 = VK_F17
+	F18 = VK_F18
+	F19 = VK_F19
+	F20 = VK_F20
+	F21 = VK_F21
+	F22 = VK_F22
+	F23 = VK_F23
+	F24 = VK_F24
+	NumLock = VK_NUMLOCK
+	Scroll = VK_SCROLL
+	LShiftKey = VK_LSHIFT
+	RShiftKey = VK_RSHIFT
+	LControlKey = VK_LCONTROL
+	RControlKey = VK_RCONTROL
+	LMenu = VK_LMENU
+	RMenu = VK_RMENU
+	BrowserBack = VK_BROWSER_BACK
+	BrowserForward = VK_BROWSER_FORWARD
+	BrowserRefresh = VK_BROWSER_REFRESH
+	BrowserStop = VK_BROWSER_STOP
+	BrowserSearch = VK_BROWSER_SEARCH
+	BrowserFavorites = VK_BROWSER_FAVORITES
+	BrowserHome = VK_BROWSER_HOME
+	VolumeMute = VK_VOLUME_MUTE
+	VolumeDown = VK_VOLUME_DOWN
+	VolumeUp = VK_VOLUME_UP
+	MediaNextTrack = VK_MEDIA_NEXT_TRACK
+	MediaPreviousTrack = VK_MEDIA_PREV_TRACK
+	MediaStop = VK_MEDIA_STOP
+	MediaPlayPause = VK_MEDIA_PLAY_PAUSE
+	LaunchMail = VK_LAUNCH_MAIL
+	SelectMedia = VK_LAUNCH_MEDIA_SELECT
+	LaunchApplication1 = VK_LAUNCH_APP1
+	LaunchApplication2 = VK_LAUNCH_APP2
+	Oem1 = VK_OEM_1
+	Oemplus = VK_OEM_PLUS
+	Oemcomma = VK_OEM_COMMA
+	OemMinus = VK_OEM_MINUS
+	OemPeriod = VK_OEM_PERIOD
+	Oem2 = VK_OEM_2
+	Oem3 = VK_OEM_3
+	Oem4 = VK_OEM_4
+	Oem5 = VK_OEM_5
+	Oem6 = VK_OEM_6
+	Oem7 = VK_OEM_7
+	Oem8 = VK_OEM_8
+	Oem102 = VK_OEM_102
+	ProcessKey = VK_PROCESSKEY
+	Packet = VK_PACKET
+	Attn = VK_ATTN
+	Crsel = VK_CRSEL
+	Exsel = VK_EXSEL
+	EraseEof = VK_EREOF
+	Play = VK_PLAY
+	Zoom = VK_ZOOM
+	Pa1 = VK_PA1
+	OemClear = VK_OEM_CLEAR
+End Enum
+
+Enum DialogResult
+	None = 0
+	OK = IDOK
+	Abort = IDABORT
+	Cancel = IDCANCEL
+	Retry = IDRETRY
+	Ignore = IDIGNORE
+	Yes = IDYES
+	No = IDNO
+End Enum
+
+Enum MouseButtons
+	None = 0
+	Left = &h00100000
+	Right = &h00200000
+	Middle = &h00400000
+	XButton1 = &h00800000
+	XButton2 = &h01000000
+End Enum
+*/
+
+TypeDef MouseButtons = DWord
+
+Class MouseEventArgs
+	Inherits System.EventArgs
+Public
+
+	Sub MouseEventArgs(button As MouseButtons, clicks As Long, x As Long, y As Long, delta As Long)
+		MouseButton = button
+		Clicks = clicks
+		X = x
+		Y = y
+		Delta = delta
+	End Sub
+
+	Const MouseButton As MouseButtons
+	Const Clicks As Long
+	Const X As Long
+	Const Y As Long
+	Const Delta As Long
+End Class
+
+End Namespace 'Forms
+End Namespace 'Widnows
+End Namespace 'System
+
+#endif '__SYSTEM_WINDOWS_FORMS_MISC_AB__
Index: /trunk/ab5.0/ablib/src/Classes/System/Xml/Serialization/XmlSerializer.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Xml/Serialization/XmlSerializer.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Xml/Serialization/XmlSerializer.ab	(revision 506)
@@ -0,0 +1,225 @@
+Namespace System
+Namespace Xml
+Namespace Serialization
+
+
+Class XmlSerializer
+	m_typeInfo As System.TypeInfo
+
+
+	'----------------------------------------------------------------
+	' シリアライズ ロジック
+	'----------------------------------------------------------------
+
+	Static Sub SerializeForBasicType( typeInfo As TypeInfo, memoryOffset As LONG_PTR, o As Object, doc As XmlDocument, parentNode As XmlNode )
+		Dim valueStr = Nothing As String
+		If typeInfo.FullName = "Byte" Then
+			valueStr = Str$( GetByte( ObjPtr( o ) + memoryOffset ) As Byte )
+		ElseIf typeInfo.FullName = "SByte" Then
+			valueStr = Str$( GetByte( ObjPtr( o ) + memoryOffset ) As SByte )
+		ElseIf typeInfo.FullName = "Word" Then
+			valueStr = Str$( GetWord( ObjPtr( o ) + memoryOffset ) As Word )
+		ElseIf typeInfo.FullName = "Integer" Then
+			valueStr = Str$( GetWord( ObjPtr( o ) + memoryOffset ) As Integer )
+		ElseIf typeInfo.FullName = "DWord" Then
+			valueStr = Str$( GetDWord( ObjPtr( o ) + memoryOffset ) As DWord )
+		ElseIf typeInfo.FullName = "Long" Then
+			valueStr = Str$( GetDWord( ObjPtr( o ) + memoryOffset ) As Long )
+		ElseIf typeInfo.FullName = "QWord" Then
+			valueStr = Str$( GetQWord( ObjPtr( o ) + memoryOffset ) As QWord )
+		ElseIf typeInfo.FullName = "Int64" Then
+			valueStr = Str$( GetQWord( ObjPtr( o ) + memoryOffset ) As Int64 )
+		ElseIf typeInfo.FullName = "Boolean" Then
+			If GetByte( ObjPtr( o ) + memoryOffset ) As Boolean Then
+				valueStr = "True"
+			Else
+				valueStr = "False"
+			End If
+		ElseIf typeInfo.FullName = "Single" Then
+			valueStr = Str$( GetSingle( ObjPtr( o ) + memoryOffset ) As Single )
+		ElseIf typeInfo.FullName = "Double" Then
+			valueStr = Str$( GetDouble( ObjPtr( o ) + memoryOffset ) As Double )
+		ElseIf typeInfo.FullName = "VoidPtr" Then
+			valueStr = Str$( Get_LONG_PTR( ObjPtr( o ) + memoryOffset ) )
+		Else
+			Throw
+		End If
+
+		Dim childNode = doc.CreateElement( typeInfo.FullName )
+		parentNode.AppendChild( childNode )
+		childNode.AppendChild( doc.CreateTextNode( valueStr ) )
+	End Sub
+
+	Static Sub SerializeForClass( typeInfo As TypeInfo, o As Object, doc As XmlDocument, parentNode = Nothing As XmlNode )
+		If typeInfo.IsClass() and typeInfo.FullName = "System.Object" Then
+			' Object型はシリアライズしない
+			Return
+		End If
+
+		If ActiveBasic.IsNothing( parentNode ) Then
+			parentNode = doc
+		End If
+
+		Dim memberInfos = typeInfo.GetMembers()
+
+		' 子ノードを生成
+		Dim childNode = doc.CreateElement( typeInfo.Name )
+		Dim namespaceAttr = doc.CreateAttribute( "namespace" )
+		namespaceAttr.Value = typeInfo.Namespace
+		childNode.Attributes.Add( namespaceAttr )
+
+		' 親ノードへ追加
+		parentNode.AppendChild( childNode )
+
+		If Not ActiveBasic.IsNothing( typeInfo.BaseType ) Then
+			' 基底クラスが存在するとき
+
+			' 基底クラスをシリアライズ
+			SerializeForClass( typeInfo.BaseType, o, doc, childNode )
+		End If
+
+		' メンバをシリアライズ
+		Foreach memberInfo In memberInfos
+			If memberInfo.MemberType.IsPointer() Then
+				Throw
+			ElseIf memberInfo.MemberType.IsClass() Then
+				SerializeForClass( memberInfo.MemberType, o, doc, childNode )
+			ElseIf memberInfo.MemberType.IsValueType() Then
+				SerializeForBasicType( memberInfo.MemberType, memberInfo._System_Offset, o, doc, childNode )
+			End If
+		Next
+	End Sub
+
+
+	'----------------------------------------------------------------
+	' デシリアライズ ロジック
+	'----------------------------------------------------------------
+
+	Static Sub DeserializeForBasicType( typeInfo As TypeInfo, memoryOffset As LONG_PTR, object As Object, xmlNode As XmlNode )
+		If Not xmlNode.ChildNodes.Count = 1 Then
+			Throw
+		End If
+
+		Dim valueStr = xmlNode.ChildNodes[0].Value
+		Dim memberPtr = ObjPtr( object ) + memoryOffset
+
+		If typeInfo.FullName = "Byte" Then
+			SetByte( memberPtr, Val( valueStr ) )
+		ElseIf typeInfo.FullName = "SByte" Then
+			SetByte( memberPtr, Val( valueStr ) )
+		ElseIf typeInfo.FullName = "Word" Then
+			SetWord( memberPtr, Val( valueStr ) )
+		ElseIf typeInfo.FullName = "Integer" Then
+			SetWord( memberPtr, Val( valueStr ) )
+		ElseIf typeInfo.FullName = "DWord" Then
+			SetDWord( memberPtr, Val( valueStr ) )
+		ElseIf typeInfo.FullName = "Long" Then
+			SetDWord( memberPtr, Val( valueStr ) )
+		ElseIf typeInfo.FullName = "QWord" Then
+			SetQWord( memberPtr, Val( valueStr ) )
+		ElseIf typeInfo.FullName = "Int64" Then
+			SetQWord( memberPtr, Val( valueStr ) )
+		ElseIf typeInfo.FullName = "Boolean" Then
+			If valueStr = "True" Then
+				SetByte( memberPtr, 1 )
+			ElseIf valueStr = "False" Then
+				SetByte( memberPtr, 0 )
+			Else
+				Throw
+			End If
+		ElseIf typeInfo.FullName = "Single" Then
+			SetSingle( memberPtr, Val( valueStr ) )
+		ElseIf typeInfo.FullName = "Double" Then
+			SetDouble( memberPtr, Val( valueStr ) )
+		ElseIf typeInfo.FullName = "VoidPtr" Then
+			Set_LONG_PTR( memberPtr, Val( valueStr ) As LONG_PTR )
+		Else
+			Throw
+		End If
+	End Sub
+
+	Function DeserializeForClass( typeInfo As TypeInfo, xmlNode As XmlNode ) As Object
+		If typeInfo.IsClass() and typeInfo.FullName = "System.Object" Then
+			' Object型にたどり着いた場合
+
+			' 派生クラスのフルネームを元に特定されたクラスを生成し、デフォルトコンストラクタを呼ぶ
+			Return ActiveBasic.Core._System_TypeForClass._System_New( m_typeInfo As ActiveBasic.Core._System_TypeForClass )
+		End If
+
+		If typeInfo.Name <> xmlNode.LocalName Then
+			Throw
+		End If
+
+		Dim object = Nothing As Object
+		Dim memberInfos = typeInfo.GetMembers()
+
+		If Not ActiveBasic.IsNothing( typeInfo.BaseType ) Then
+			' 基底クラスが存在するとき
+
+			' 基底クラスをシリアライズ
+			object = DeserializeForClass( typeInfo.BaseType, xmlNode )
+		End If
+
+		' メンバをシリアライズ
+		Dim childNode = xmlNode.ChildNodes[0] As XmlNode
+		Foreach memberInfo In memberInfos
+			If ActiveBasic.IsNothing( childNode ) Then
+				Throw
+			End If
+
+			If memberInfo.MemberType.IsPointer() Then
+				Throw
+			ElseIf memberInfo.MemberType.IsClass() Then
+				Dim memberObject = DeserializeForClass( memberInfo.MemberType, childNode )
+				Set_LONG_PTR( ObjPtr( object ) + memberInfo._System_Offset, ObjPtr( memberObject ) As LONG_PTR )
+			ElseIf memberInfo.MemberType.IsValueType() Then
+				DeserializeForBasicType( memberInfo.MemberType, memberInfo._System_Offset, object, childNode )
+			End If
+
+			childNode = childNode.NextSibling
+		Next
+
+		If Not ActiveBasic.IsNothing( childNode ) Then
+			Throw
+		End If
+
+		Return object
+	End Function
+
+Public
+	Sub XmlSerializer( typeInfo As System.TypeInfo )
+		This.m_typeInfo = typeInfo
+	End Sub
+	Sub ~XmlSerializer()
+	End Sub
+
+
+	/*!
+	@brief	XML文書をオブジェクトに逆シリアライズします。
+	@author	Daisuke Yamamoto
+	*/
+	Function Deserialize( stream As System.IO.Stream ) As Object
+		Dim doc = New XmlDocument
+		doc.Load( stream )
+		Return DeserializeForClass( m_typeInfo, doc.ChildNodes[1] )
+	End Function
+
+	/*!
+	@brief	オブジェクトをXML文書にシリアライズします。
+	@author	Daisuke Yamamoto
+	*/
+	Sub Serialize( stream As System.IO.Stream, o As Object )
+		Dim doc = New XmlDocument
+		doc.AppendChild( doc.CreateXmlDeclaration( "1.0", "shift-jis", Nothing ) )
+
+		SerializeForClass( m_typeInfo, o, doc )
+
+		' ストリームに保存
+		doc.Save( stream )
+	End Sub
+End Class
+
+
+End Namespace
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlAttribute.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlAttribute.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlAttribute.ab	(revision 506)
@@ -0,0 +1,35 @@
+Namespace System
+Namespace Xml
+
+/*!
+@brief	属性を表します。
+*/
+Class XmlAttribute
+	Inherits XmlNode
+
+Public
+	Sub XmlAttribute( prefix As String, localName As String, namespaceURI As String, doc As XmlDocument )
+		XmlNode( XmlNodeType.Attribute, prefix, localName, namespaceURI, doc )
+	End Sub
+
+	/*!
+	@brief	このノードの子ノードだけを表すマークアップを取得または設定します。
+	*/
+	Override Function InnerXml() As String
+		Return This.Value
+	End Function
+
+	/*!
+	@brief	このノードとそのすべての子ノードを表すマークアップを取得します。
+	@return	このノードとそのすべての子ノードを格納しているマークアップ。
+	*/
+	Override Function OuterXml() As String
+		Return This.LocalName + Ex"=\q" + InnerXml + Ex"\q"
+	End Function
+End Class
+
+TypeDef XmlAttributeCollection = System.Collections.Generic.List<XmlAttribute>
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlCharacterData.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlCharacterData.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlCharacterData.ab	(revision 506)
@@ -0,0 +1,22 @@
+Namespace System
+Namespace Xml
+
+/*!
+@brief	複数のクラスで使用する、テキスト操作メソッドを提供します。
+*/
+Class XmlCharacterData
+	Inherits XmlLinkedNode
+
+Public
+
+	/*!
+	@brief	コンストラクタ
+	*/
+	Sub XmlCharacterData( nodeType As XmlNodeType, data As String, doc As XmlDocument )
+		XmlLinkedNode( nodeType, data, doc )
+	End Sub
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlDeclaration.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlDeclaration.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlDeclaration.ab	(revision 506)
@@ -0,0 +1,39 @@
+Namespace System
+Namespace Xml
+
+/*!
+@brief	XML 宣言ノード <?xml version='1.0' ...?> を表します。
+*/
+Class XmlDeclaration
+	Inherits XmlLinkedNode
+
+	version As String
+	encoding As String
+	standalone As String
+
+Public
+	Sub XmlDeclaration( version As String, encoding As String, standalone As String, doc As XmlDocument )
+		XmlLinkedNode( XmlNodeType.XmlDeclaration, "", "xml", "", doc )
+		This.version = version
+		This.encoding = encoding
+		This.standalone = standalone
+	End Sub
+
+Protected
+	Override Function InnerXmlSupportedIndent( isIndent = False As Boolean, indent = 0 As Long ) As String
+		Return Ex"version=\q" + This.version + Ex"\q encoding=\q" + This.encoding + Ex"\q"
+	End Function
+
+	Override Function OwnerXmlSupportedIndent( isIndent = False As Boolean, indent = 0 As Long ) As String
+		Dim crlfStr = ""
+		If isIndent Then
+			' インデントをサポートする場合
+			crlfStr = Ex"\r\n"
+		End If
+		Return "<?xml " + InnerXml + "?>" + crlfStr
+	End Function
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlDocument.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlDocument.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlDocument.ab	(revision 506)
@@ -0,0 +1,150 @@
+Namespace System
+Namespace Xml
+
+/*!
+@brief	XMLドキュメントを表す
+*/
+Class XmlDocument
+	Inherits XmlNode
+
+	Sub VerifyLocalName( name As String )
+		If Object.ReferenceEquals( name, Nothing ) Then
+			' Throw System.ArgumentException()
+		ElseIf name.Length = 0 Then
+			' Throw System.ArgumentException()
+		End If
+	End Sub
+
+Public
+
+	/*!
+	@brief	コンストラクタ
+	*/
+	Sub XmlDocument()
+		XmlNode( XmlNodeType.Document, "", "#document", "", Nothing )
+	End Sub
+
+	/*!
+	@brief	コンストラクタ
+	*/
+	'Sub XmlDocument( xmlImplementation As XmlImplementation )
+	'End Sub
+
+	/*!
+	@brief	コンストラクタ
+	*/
+	'Sub XmlDocument( xmlNameTable As XmlNameTable )
+	'End Sub
+
+
+	'----------------------------------------------------------------
+	' パブリック プロパティ
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	このノードとそのすべての子ノードを表すマークアップを取得します。
+	@return	このノードとそのすべての子ノードを格納しているマークアップ。
+	*/
+	Override Function OuterXml() As String
+		Return This.InnerXml
+	End Function
+
+
+	'----------------------------------------------------------------
+	' パブリック メソッド
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	指定した値を使用して、XmlDeclaration ノードを作成します。
+	@param	version XMLのバージョン番号。
+			encoding 文字コード。（例："shift-jis", "UTF-8", "EUC-JP"）
+			standalone 外部DTDの参照が必要かどうか。"yes" or "no"
+	*/
+	Function CreateXmlDeclaration( version As String, encoding As String, standalone As String ) As XmlDeclaration
+		Return New XmlDeclaration( version ,encoding, standalone, This )
+	End Function
+
+	/*!
+	@brief	指定した名前を使用して属性を作成します。
+	@param	name 属性名
+	*/
+	Function CreateAttribute( name As String) As XmlAttribute
+		VerifyLocalName( name )
+
+		Return New XmlAttribute( "", name, "", This )
+	End Function
+
+	/*!
+	@brief	指定した名前を使用して要素を作成します。
+	@param	name 要素名。
+	*/
+	Function CreateElement( name As String ) As XmlElement
+		VerifyLocalName( name )
+
+		Return New XmlElement( "", name, "", This )
+	End Function
+
+	/*!
+	@brief	指定した文字列を使用してテキストノードを作成します。
+	@param	text 文字列。
+	*/
+	Function CreateTextNode( text As String ) As XmlText
+		Return New XmlText( text, This )
+	End Function
+
+	/*!
+	@brief	指定したストリームからXML文書を読み込む。
+	@param	stream 読み込み先のストリーム。
+	*/
+	Virtual Sub Load( inStream As System.IO.Stream )
+		Dim length = inStream.Length As DWord
+		Dim xmlBuffer = calloc( length + 1 ) As *Char
+		inStream.Read( xmlBuffer As *Byte, 0, length )
+		inStream.Close()
+		Dim xmlString = New String( xmlBuffer )
+		free( xmlBuffer )
+
+		This.RemoveAll()
+		ActiveBasic.Xml.Parser.Parse( xmlString, This )
+	End Sub
+
+	/*!
+	@brief	指定したファイルからXML文書を読み込む。
+	@param	ファイルパス。
+	*/
+	Virtual Sub Load( filename As String )
+		Dim fileStream As System.IO.FileStream( filename, System.IO.FileMode.Open, System.IO.FileAccess.Read )
+		Load( fileStream )
+	End Sub
+
+	/*!
+	@brief	指定したストリームにXML文書を保存する。
+	@param	stream 保存先のストリーム。
+	*/
+	Virtual Sub Save( outStream As System.IO.Stream )
+		Dim xmlStr = InnerXmlSupportedIndent( True )
+		outStream.Write( xmlStr.StrPtr As *Byte, 0, xmlStr.Length * SizeOf( Char ) )
+		outStream.Close()
+	End Sub
+
+	/*!
+	@brief	指定したファイルにXML文書を保存する。
+	@param	ファイルパス。
+	*/
+	Virtual Sub Save( filename As String )
+		Dim fileStream As System.IO.FileStream( filename, System.IO.FileMode.Create, System.IO.FileAccess.Write )
+		Save( fileStream )
+	End Sub
+
+	/*!
+	@brief	指定したテキストライタにXML文書を保存する。
+	@param	テキストライタ。
+	*/
+	Virtual Sub Save( writer As System.IO.TextWriter )
+		writer.Write(InnerXmlSupportedIndent( True ))
+	End Sub
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlElement.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlElement.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlElement.ab	(revision 506)
@@ -0,0 +1,18 @@
+Namespace System
+Namespace Xml
+
+/*!
+@brief	要素を表します。
+*/
+Class XmlElement
+	Inherits XmlLinkedNode
+
+Public
+	Sub XmlElement( prefix As String, localName As String, namespaceURI As String, doc As XmlDocument )
+		XmlLinkedNode( XmlNodeType.Element, prefix, localName, namespaceURI, doc )
+	End Sub
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlLinkedNode.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlLinkedNode.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlLinkedNode.ab	(revision 506)
@@ -0,0 +1,28 @@
+Namespace System
+Namespace Xml
+
+/*!
+@brief	このノードの直前または直後のノードを取得します。
+*/
+Class XmlLinkedNode
+	Inherits XmlNode
+Public
+
+	/*!
+	@brief	コンストラクタ
+	*/
+	Sub XmlLinkedNode( nodeType As XmlNodeType, prefix As String, localName As String, namespaceURI As String, doc As XmlDocument )
+		XmlNode( nodeType, prefix, localName, namespaceURI, doc )
+	End Sub
+
+	/*!
+	@brief	コンストラクタ
+	*/
+	Sub XmlLinkedNode( nodeType As XmlNodeType, data As String, doc As XmlDocument )
+		XmlNode( nodeType, data, doc )
+	End Sub
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlNode.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlNode.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlNode.ab	(revision 506)
@@ -0,0 +1,390 @@
+Namespace System
+Namespace Xml
+
+Enum XmlNodeType
+	None
+	Element
+	Attribute
+	Text
+	CDATA
+	EntifyReference
+	Entity
+	ProcessingInstruction
+	Comment
+	Document
+	DocumentType
+	DocumentFragment
+	Notation
+	Whitespace
+	SignificantWhitespace
+	EndElement
+	EndEntity
+	XmlDeclaration
+End Enum
+
+/*!
+@brief	XMLドキュメント内の単一のノードを表す。
+*/
+Class XmlNode
+
+	nodeType As XmlNodeType
+	attributes As XmlAttributeCollection
+	childNodes As XmlNodeList
+	prefix As String
+	localName As String
+	namespaceURI As String
+	ownerDocument As XmlDocument
+	value As String
+	previousSibling As XmlNode
+	nextSibling As XmlNode
+
+Public
+
+	/*!
+	@brief	コンストラクタ
+	*/
+	Sub XmlNode( nodeType As XmlNodeType, prefix As String, localName As String, namespaceURI As String, doc As XmlDocument )
+		This.nodeType = nodeType
+		This.prefix = prefix
+		This.localName = localName
+		This.namespaceURI = namespaceURI
+		This.ownerDocument = doc
+		This.value = Nothing
+		This.previousSibling = Nothing
+		This.nextSibling = Nothing
+
+		attributes = New XmlAttributeCollection
+		childNodes = New XmlNodeList()
+	End Sub
+
+	/*!
+	@brief	コンストラクタ
+	*/
+	Sub XmlNode( nodeType As XmlNodeType, data As String, doc As XmlDocument )
+		This.nodeType = nodeType
+		This.prefix = Nothing
+		This.localName = Nothing
+		This.namespaceURI = Nothing
+		This.ownerDocument = doc
+		This.value = data
+		This.previousSibling = Nothing
+		This.nextSibling = Nothing
+
+		attributes = New XmlAttributeCollection
+		childNodes = Nothing
+	End Sub
+
+
+	'----------------------------------------------------------------
+	' パブリック プロパティ
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	名前またはインデックスによってアクセスできる属性のコレクションを表します。
+	*/
+	Virtual Function Attributes() As XmlAttributeCollection
+		Return attributes
+	End Function
+
+	/*!
+	@brief	子ノードリストを返します。
+	*/
+	Virtual Function ChildNodes() As XmlNodeList
+		Return childNodes
+	End Function
+
+	/*!
+	@brief	ノードの最初の子を取得します。
+	*/
+	Virtual Function FirstChild() As XmlNode
+		If childNodes.Count = 0 Then
+			' 子ノードが1つもないときはNothingを返す
+			Return Nothing
+		End If
+		Return childNodes[0]
+	End Function
+
+	/*!
+	@brief	子ノードが1つ以上あるかどうかを取得します。
+	*/
+	Virtual Function HasChildNodes() As Boolean
+		Return Not ( childNodes.Count = 0 )
+	End Function
+
+	/*!
+	@brief	このノードの子ノードだけを表すマークアップを取得または設定します。
+	*/
+	Virtual Function InnerXml() As String
+		Return InnerXmlSupportedIndent()
+	End Function
+
+	/*!
+	@brief	ノードの最後の子を取得します。
+	*/
+	Virtual Function LastChild() As XmlNode
+		If childNodes.Count = 0 Then
+			' 子ノードが1つもないときはNothingを返す
+			Return Nothing
+		End If
+		Return childNodes[childNodes.Count-1]
+	End Function
+
+	/*!
+	@brief	ノードのローカル名を取得します。 
+	@return	ノードのローカル名。
+	*/
+	Virtual Function LocalName() As String
+		return localName
+	End Function
+
+	/*!
+	@brief	このノードの名前空間 URI を取得します。
+	@return	このノードの名前空間 URI。
+	*/
+	Virtual Function NamespaceURI() As String
+		return NamespaceURI
+	End Function
+
+	/*!
+	@brief	このノードの直後のノードを取得します。
+	@return	このノードの直後のノード。
+	*/
+	Virtual Function NextSibling() As XmlNode
+		Return nextSibling
+	End Function
+
+	/*!
+	@brief	このノードのノードタイプを取得します。
+	@return	このノードのノードタイプ。
+	*/
+	Virtual Function NodeType() As XmlNodeType
+		return nodeType
+	End Function
+
+	/*!
+	@brief	このノードとそのすべての子ノードを表すマークアップを取得します。
+	@return	このノードとそのすべての子ノードを格納しているマークアップ。
+	*/
+	Virtual Function OuterXml() As String
+		Return OwnerXmlSupportedIndent()
+	End Function
+
+	/*!
+	@brief	このノードが属する XmlDocument を取得します。
+	@return	このノードが属する XmlDocument。
+	*/
+	Virtual Function OwnerDocument() As XmlDocument
+		Return ownerDocument
+	End Function
+
+	/*!
+	@brief	このノードの名前空間プリフィックスを取得または設定します。
+	@return	このノードの名前空間プリフィックス。たとえば、プリフィックスは要素 <bk:book> の bk です。プリフィックスがない場合、このプロパティは String.Empty を返します。
+	*/
+	Virtual Function Prefix() As String
+		return prefix
+	End Function
+
+	/*!
+	@brief	このノードの直前のノードを取得します。
+	@return	このノードの直前のノード。
+	*/
+	Virtual Function PreviousSibling() As XmlNode
+		Return previousSibling
+	End Function
+
+	/*!
+	@brief	このノードの値を取得します。
+	@return	このノードの値。
+	*/
+	Virtual Function Value() As String
+		return value
+	End Function
+
+	/*!
+	@brief	このノードの値を設定します。
+	@param	value 値文字列。
+	*/
+	Virtual Sub Value( value As String )
+		This.value = value
+	End Sub
+
+
+	'----------------------------------------------------------------
+	' パブリック メソッド
+	'----------------------------------------------------------------
+
+	/*!
+	@brief	このノードの子ノードリストの末尾に指定したノードを追加する。
+	*/
+	Virtual Function AppendChild( newChild As XmlNode ) As XmlNode
+		Dim lastChild = This.LastChild
+		childNodes.Add( newChild )
+
+		If Not ActiveBasic.IsNothing( lastChild ) Then
+			' 前後の兄弟要素を指定
+			lastChild.nextSibling = newChild
+			newChild.previousSibling = lastChild
+		End If
+
+		Return newChild
+	End Function
+
+	/*!
+	@brief	ノードを複製する。
+	*/
+	Virtual Function Clone() As XmlNode
+		' TODO: 実装
+	End Function
+
+	/*!
+	@brief	派生クラスでオーバーライドされた場合は、ノードの複製を作成する。
+	*/
+	Virtual Function CloneNode( deep As Boolean ) As XmlNode
+		' TODO: 実装
+	End Function
+
+	/*!
+	@brief	XmlNode のノードに対する Foreachスタイルの反復をサポートします。
+	*/
+	Virtual Function GetEnumerator() As IEnumerator
+		' TODO: 実装
+	End Function
+
+	/*!
+	@brief	指定したノードを指定した参照ノードの直後に挿入します。
+	@param	newChild 挿入するXmlNode。
+			refChild 参照ノードであるXmlNode。newNode は、refNode の後に配置されます。
+	@return	挿入されるノード。
+	*/
+	Virtual Function InsertAfter( newChild As XmlNode, refChild As XmlNode ) As XmlNode
+		' TODO: 実装
+	End Function
+
+	/*!
+	@brief	指定したノードを指定した参照ノードの直前に挿入します。
+	@param	newChild 挿入するXmlNode。
+			refChild 参照ノードであるXmlNode。newNode は、refNode の前に配置されます。
+	@return	挿入されるノード。
+	*/
+	Virtual Function InsertBefore( newChild As XmlNode, refChild As XmlNode ) As XmlNode
+		' TODO: 実装
+	End Function
+
+	/*!
+	@brief	このノードの子ノードのリストの先頭に、指定したノードを追加します。
+	@param	newChild 挿入するXmlNode。
+	@return	挿入されるノード。
+	*/
+	Virtual Function PrependChild( newChild As XmlNode ) As XmlNode
+		' TODO: 実装
+	End Function
+
+	/*!
+	@brief	現在のノードのすべての子ノードと属性の両方、またはそのいずれかを削除します。
+	*/
+	Virtual Sub RemoveAll()
+		If Not ActiveBasic.IsNothing( This.attributes ) Then
+			This.attributes.Clear()
+		End If
+		If Not ActiveBasic.IsNothing( This.childNodes ) Then
+			This.childNodes.Clear()
+		End If
+	End Sub
+
+	/*!
+	@brief	現在のノードのすべての子ノードを削除します。
+	@param	oldChild 削除するXmlNode。
+	@return	削除されたノード。
+	*/
+	Virtual Function RemoveChild( oldChild As XmlNode ) As XmlNode
+		childNodes.Remove( oldChild )
+	End Function
+
+	/*!
+	@brief	子ノード oldChild を newChild ノードに置き換えます。
+	@param	newChild 新しいノード。
+			oldChild 置換されノード。
+	@return	置き換えられたノード。
+	*/
+	Virtual Function ReplaceChild( newChild As XmlNode, oldChild As XmlNode ) As XmlNode
+		' TODO: 実装
+	End Function
+
+
+Protected
+
+	Function GetAttributesStr() As String
+		If attributes.Count = 0 Then
+			' 属性が1つもない場合
+			Return ""
+		End If
+
+		Dim result = ""
+		Foreach attribute In attributes
+			result += " " + attribute.OuterXml
+		Next
+		Return result
+	End Function
+
+	Virtual Function InnerXmlSupportedIndent( isIndent = False As Boolean, indent = 0 As Long ) As String
+		Dim result = ""
+		If Not ActiveBasic.IsNothing( childNodes ) Then
+			' 子ノード
+			Foreach childNode In childNodes
+				result += childNode.OwnerXmlSupportedIndent( isIndent, indent )
+			Next
+		End If
+		Return result
+	End Function
+
+	Virtual Function OwnerXmlSupportedIndent( isIndent = False As Boolean, indent = 0 As Long ) As String
+		Dim indentStr = ""
+		Dim crlfStr = ""
+		If isIndent Then
+			' インデントをサポートする場合
+			Dim i As Long
+			For i=0 To ELM(indent)
+				indentStr += Ex"\t"
+			Next
+
+			crlfStr = Ex"\r\n"
+		End If
+
+		If This.childNodes.Count = 0 Then
+			Return indentStr + "<" + localName + This.GetAttributesStr() + " />" + crlfStr
+		End If
+
+		Dim result = ""
+
+		If This.FirstChild.NodeType = XmlNodeType.Text Then
+			' 子ノードがテキストのときは開始タグ、終了タグの間にインデントや改行を入れない
+
+			' 開始タグ
+			result += indentStr + "<" + localName + This.GetAttributesStr() + ">"
+
+			' 子ノードリスト
+			result += InnerXmlSupportedIndent( isIndent, indent + 1 )
+
+			' 終了タグ
+			result += "</" + localName + ">" + crlfStr
+		Else
+			' 開始タグ
+			result += indentStr + "<" + localName + This.GetAttributesStr() + ">" + crlfStr
+
+			' 子ノードリスト
+			result += InnerXmlSupportedIndent( isIndent, indent + 1 )
+
+			' 終了タグ
+			result += indentStr + "</" + localName + ">" + crlfStr
+		End If
+
+		Return result
+	End Function
+End Class
+
+TypeDef XmlNodeList = System.Collections.Generic.List<XmlNode>
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlText.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlText.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/Xml/XmlText.ab	(revision 506)
@@ -0,0 +1,31 @@
+Namespace System
+Namespace Xml
+
+/*!
+@brief	複数のクラスで使用する、テキスト操作メソッドを提供します。
+*/
+Class XmlText
+	Inherits XmlCharacterData
+
+Public
+
+	/*!
+	@brief	コンストラクタ
+	*/
+	Sub XmlText( strData As String, doc As XmlDocument )
+		XmlCharacterData( XmlNodeType.Text, strData, doc )
+	End Sub
+
+Protected
+	Override Function InnerXmlSupportedIndent( isIndent = False As Boolean, indent = 0 As Long ) As String
+		Return Value
+	End Function
+
+	Override Function OwnerXmlSupportedIndent( isIndent = False As Boolean, indent = 0 As Long ) As String
+		Return Value
+	End Function
+End Class
+
+
+End Namespace
+End Namespace
Index: /trunk/ab5.0/ablib/src/Classes/System/misc.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/System/misc.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/System/misc.ab	(revision 506)
@@ -0,0 +1,37 @@
+' Classes/System/misc.ab
+
+Namespace System
+
+Interface IAsyncResult
+	' Properties
+	Function AsyncState() As Object
+	Function AsyncWaitHandle() As Threading.WaitHandle
+	Function CompletedSynchronously() As Boolean
+	Function IsCompleted() As Boolean
+End Interface
+
+Interface ICloneable
+	' Method
+	Function Clone() As Object
+End Interface
+
+Interface IComparable
+	' Method
+	Function CompareTo(obj As Object) As Long
+End Interface
+
+Interface IDisposable
+	' Method
+	Sub Dispose()
+End Interface
+
+Class EventArgs
+Public
+	Static Empty = New EventArgs
+End Class
+
+Delegate Sub EventHandler(sender As Object, e As EventArgs)
+
+Delegate Sub AsyncCallback(ar As IAsyncResult)
+
+End Namespace 'System
Index: /trunk/ab5.0/ablib/src/Classes/index.ab
===================================================================
--- /trunk/ab5.0/ablib/src/Classes/index.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/Classes/index.ab	(revision 506)
@@ -0,0 +1,113 @@
+#require "./ActiveBasic/misc.ab"
+#require "./ActiveBasic/Core/InterfaceInfo.ab"
+#require "./ActiveBasic/Core/TypeInfo.ab"
+#require "./ActiveBasic/CType/CType.ab"
+#require "./ActiveBasic/Math/Math.ab"
+#require "./ActiveBasic/Strings/SPrintF.ab"
+#require "./ActiveBasic/Strings/Strings.ab"
+#require "./ActiveBasic/Windows/CriticalSection.ab"
+#require "./ActiveBasic/Windows/WindowHandle.sbp"
+#require "./ActiveBasic/Windows/Windows.ab"
+#require "./ActiveBasic/Xml/Parser.ab"
+#require "./System/Blittable.ab"
+#require "./System/Console.ab"
+#require "./System/DateTime.ab"
+#require "./System/Delegate.ab"
+#require "./System/Environment.ab"
+#require "./System/Exception.ab"
+#require "./System/GC.ab"
+#require "./System/Math.ab"
+#require "./System/misc.ab"
+#require "./System/Object.ab"
+#require "./System/OperatingSystem.ab"
+#require "./System/String.ab"
+#require "./System/TimeSpan.ab"
+#require "./System/TypeInfo.ab"
+#require "./System/Version.ab"
+#require "./System/Collections/ArrayList.ab"
+#require "./System/Collections/misc.ab"
+#require "./System/Collections/Generic/Dictionary.ab"
+#require "./System/Collections/Generic/List.ab"
+#require "./System/Collections/Generic/KeyNotFoundException.ab"
+/*
+#require "./System/Data/Odbc/Odbc.ab"
+*/
+#require "./System/Diagnostics/base.ab"
+#require "./System/Diagnostics/Debug.ab"
+#require "./System/Diagnostics/Trace.ab"
+#require "./System/Diagnostics/TraceListener.ab"
+#require "./System/Diagnostics/TraceListenerCollection.ab"
+#require "./System/Drawing/CharacterRange.ab"
+#require "./System/Drawing/Color.ab"
+'#require "./System/Drawing/Font.ab"
+'#require "./System/Drawing/Graphics.ab"
+'#require "./System/Drawing/Image.ab"
+#require "./System/Drawing/misc.ab"
+#require "./System/Drawing/Point.ab"
+#require "./System/Drawing/PointF.ab"
+#require "./System/Drawing/Rectangle.ab"
+#require "./System/Drawing/RectangleF.ab"
+#require "./System/Drawing/Size.ab"
+#require "./System/Drawing/SizeF.ab"
+'#require "./System/Drawing/Drawing2D/Matrix.ab"
+'#require "./System/Drawing/Drawing2D/misc.ab"
+'#require "./System/Drawing/Imaging/MetafileHeader.ab"
+'#require "./System/Drawing/Imaging/misc.ab"
+'#require "./System/Drawing/Text/misc.ab"
+#require "./System/IO/Directory.ab"
+#require "./System/IO/DirectoryInfo.ab"
+#require "./System/IO/DirectorySecurity.ab"
+#require "./System/IO/DriveInfo.ab"
+#require "./System/IO/Exception.ab"
+#require "./System/IO/File.ab"
+#require "./System/IO/FileInfo.ab"
+#require "./System/IO/FileStream.ab"
+#require "./System/IO/FileSystemInfo.ab"
+#require "./System/IO/MemoryStream.ab"
+#require "./System/IO/misc.ab"
+#require "./System/IO/Path.ab"
+#require "./System/IO/Stream.ab"
+#require "./System/IO/TextReader.ab"
+#require "./System/IO/TextWriter.ab"
+#require "./System/IO/StreamReader.ab"
+#require "./System/IO/StringReader.ab"
+#require "./System/IO/StreamWriter.ab"
+#require "./System/IO/TextReader.ab"
+#require "./System/Media/SystemSound.ab"
+#require "./System/Media/SystemSounds.ab"
+#require "./System/Reflection/MemberInfo.ab"
+#require "./System/Runtime/InteropServices/GCHandle.ab"
+#require "./System/Security/AccessControl/misc.ab"
+#require "./System/Text/StringBuilder.ab"
+#require "./System/Text/Encoding.ab"
+#require "./System/Text/UTF8Encoding.ab"
+#require "./System/Text/DecoderFallback.ab"
+#require "./System/Threading/AutoResetEvent.ab"
+#require "./System/Threading/EventWaitHandle.ab"
+#require "./System/Threading/ManualResetEvent.ab"
+#require "./System/Threading/Mutex.ab"
+#require "./System/Threading/Semaphore.ab"
+#require "./System/Threading/Thread.ab"
+#require "./System/Threading/Timeout.ab"
+#require "./System/Threading/WaitHandle.ab"
+#require "./System/Windows/Forms/Application.ab"
+#require "./System/Windows/Forms/ContainerControl.ab"
+#require "./System/Windows/Forms/Control.ab"
+#require "./System/Windows/Forms/CreateParams.ab"
+#require "./System/Windows/Forms/Form.ab"
+#require "./System/Windows/Forms/Message.ab"
+#require "./System/Windows/Forms/MessageBox.ab"
+#require "./System/Windows/Forms/misc.ab"
+#require "./System/Windows/Forms/PaintEventArgs.ab"
+#require "./System/Windows/Forms/ScrollableControl.ab"
+#require "./System/Windows/Forms/WebBrowser.ab"
+#require "./System/Windows/Forms/WebBrowserBase.ab"
+#require "./System/Xml/XmlAttribute.ab"
+#require "./System/Xml/XmlCharacterData.ab"
+#require "./System/Xml/XmlDeclaration.ab"
+#require "./System/Xml/XmlDocument.ab"
+#require "./System/Xml/XmlElement.ab"
+#require "./System/Xml/XmlLinkedNode.ab"
+#require "./System/Xml/XmlNode.ab"
+#require "./System/Xml/XmlText.ab"
+#require "./System/Xml/Serialization/XmlSerializer.ab"
Index: /trunk/ab5.0/ablib/src/GdiPlus.ab
===================================================================
--- /trunk/ab5.0/ablib/src/GdiPlus.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/GdiPlus.ab	(revision 506)
@@ -0,0 +1,15 @@
+' Gdiplus.ab
+
+Declare Function GdipAlloc Lib "Gdiplus.dll" (size As SIZE_T) As VoidPtr
+Declare Sub GdipFree Lib "Gdiplus.dll" (ptr As VoidPtr)
+
+#require <GdiplusEnums.ab>
+#require <GdiplusTypes.ab>
+#require <GdiplusInit.ab>
+#require <GdiPlusGpStubs.ab>
+
+'#require <GdiplusFlat.ab>
+
+'#require <Classes/System/Drawing/misc.ab>
+'#require <Classes/System/Drawing/Imaging/misc.ab>
+'#require <Classes/System/Drawing/Imaging/MetafileHeader.ab>
Index: /trunk/ab5.0/ablib/src/GdiPlusEnums.ab
===================================================================
--- /trunk/ab5.0/ablib/src/GdiPlusEnums.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/GdiPlusEnums.ab	(revision 506)
@@ -0,0 +1,616 @@
+' GdiPlusEnums.ab
+
+Const FlatnessDefault = 1.0 / 4.0
+
+TypeDef GraphicsState = DWord
+TypeDef GraphicsContainer = DWord
+
+Const Enum MetafileFrameUnit
+	MetafileFrameUnitPixel      = 2
+	MetafileFrameUnitPoint      = 3
+	MetafileFrameUnitInch       = 4
+	MetafileFrameUnitDocument   = 5
+	MetafileFrameUnitMillimeter = 6
+	MetafileFrameUnitGdi
+End Enum
+
+Const Enum WrapMode
+	WrapModeTile         ' 0
+	WrapModeTileFlipX    ' 1
+	WrapModeTileFlipY    ' 2
+	WrapModeTileFlipXY   ' 3
+	WrapModeClamp        ' 4
+End Enum
+
+Const Enum HatchStyle
+	HatchStyleHorizontal                    ' 0
+	HatchStyleVertical                      ' 1
+	HatchStyleForwardDiagonal               ' 2
+	HatchStyleBackwardDiagonal              ' 3
+	HatchStyleCross                         ' 4
+	HatchStyleDiagonalCross                 ' 5
+	HatchStyle05Percent                     ' 6
+	HatchStyle10Percent                     ' 7
+	HatchStyle20Percent                     ' 8
+	HatchStyle25Percent                     ' 9
+	HatchStyle30Percent                     ' 10
+	HatchStyle40Percent                     ' 11
+	HatchStyle50Percent                     ' 12
+	HatchStyle60Percent                     ' 13
+	HatchStyle70Percent                     ' 14
+	HatchStyle75Percent                     ' 15
+	HatchStyle80Percent                     ' 16
+	HatchStyle90Percent                     ' 17
+	HatchStyleLightDownwardDiagonal         ' 18
+	HatchStyleLightUpwardDiagonal           ' 19
+	HatchStyleDarkDownwardDiagonal          ' 20
+	HatchStyleDarkUpwardDiagonal            ' 21
+	HatchStyleWideDownwardDiagonal          ' 22
+	HatchStyleWideUpwardDiagonal            ' 23
+	HatchStyleLightVertical                 ' 24
+	HatchStyleLightHorizontal               ' 25
+	HatchStyleNarrowVertical                ' 26
+	HatchStyleNarrowHorizontal              ' 27
+	HatchStyleDarkVertical                  ' 28
+	HatchStyleDarkHorizontal                ' 29
+	HatchStyleDashedDownwardDiagonal        ' 30
+	HatchStyleDashedUpwardDiagonal          ' 31
+	HatchStyleDashedHorizontal              ' 32
+	HatchStyleDashedVertical                ' 33
+	HatchStyleSmallConfetti                 ' 34
+	HatchStyleLargeConfetti                 ' 35
+	HatchStyleZigZag                        ' 36
+	HatchStyleWave                          ' 37
+	HatchStyleDiagonalBrick                 ' 38
+	HatchStyleHorizontalBrick               ' 39
+	HatchStyleWeave                         ' 40
+	HatchStylePlaid                         ' 41
+	HatchStyleDivot                         ' 42
+	HatchStyleDottedGrid                    ' 43
+	HatchStyleDottedDiamond                 ' 44
+	HatchStyleShingle                       ' 45
+	HatchStyleTrellis                       ' 46
+	HatchStyleSphere                        ' 47
+	HatchStyleSmallGrid                     ' 48
+	HatchStyleSmallCheckerBoard             ' 49
+	HatchStyleLargeCheckerBoard             ' 50
+	HatchStyleOutlinedDiamond               ' 51
+	HatchStyleSolidDiamond                  ' 52
+
+	HatchStyleTotal
+'	HatchStyleLargeGrid = HatchStyleCross   ' 4
+
+'	HatchStyleMin       = HatchStyleHorizontal
+'	HatchStyleMax       = HatchStyleTotal - 1
+End Enum
+
+Const Enum DashStyle
+	DashStyleSolid           ' 0
+	DashStyleDash            ' 1
+	DashStyleDot             ' 2
+	DashStyleDashDot         ' 3
+	DashStyleDashDotDot      ' 4
+	DashStyleCustom          ' 5
+End Enum
+
+Const Enum DashCap
+	DashCapFlat             = 0
+	DashCapRound            = 2
+	DashCapTriangle         = 3
+End Enum
+
+Const Enum LineCap
+	LineCapFlat             = 0
+	LineCapSquare           = 1
+	LineCapRound            = 2
+	LineCapTriangle         = 3
+
+	LineCapNoAnchor         = &h10
+	LineCapSquareAnchor     = &h11
+	LineCapRoundAnchor      = &h12
+	LineCapDiamondAnchor    = &h13
+	LineCapArrowAnchor      = &h14
+
+	LineCapCustom           = &hff
+
+	LineCapAnchorMask       = &hf0
+End Enum
+
+Const Enum CustomLineCapType
+	CustomLineCapTypeDefault         = 0
+	CustomLineCapTypeAdjustableArrow = 1
+End Enum
+
+Const Enum LineJoin
+	LineJoinMiter        = 0
+	LineJoinBevel        = 1
+	LineJoinRound        = 2
+	LineJoinMiterClipped = 3
+End Enum
+
+Const Enum PathPointType
+	PathPointTypeStart           = 0
+	PathPointTypeLine            = 1
+	PathPointTypeBezier          = 3
+	PathPointTypePathTypeMask    = &h07
+	PathPointTypeDashMode        = &h10
+	PathPointTypePathMarker      = &h20
+	PathPointTypeCloseSubpath    = &h80
+	PathPointTypeBezier3    = 3
+End Enum
+
+Const Enum WarpMode
+	WarpModePerspective     ' 0
+	WarpModeBilinear        ' 1
+End Enum
+
+Const Enum LinearGradientMode
+	LinearGradientModeHorizontal          ' 0
+	LinearGradientModeVertical            ' 1
+	LinearGradientModeForwardDiagonal     ' 2
+	LinearGradientModeBackwardDiagonal    ' 3
+End Enum
+
+Const Enum ImageType
+	ImageTypeUnknown    ' 0
+	ImageTypeBitmap     ' 1
+	ImageTypeMetafile   ' 2
+End Enum
+
+Const Enum PenAlignment
+	PenAlignmentCenter       = 0
+	PenAlignmentInset        = 1
+End Enum
+
+Const Enum BrushType
+	BrushTypeSolidColor       = 0
+	BrushTypeHatchFill        = 1
+	BrushTypeTextureFill      = 2
+	BrushTypePathGradient     = 3
+	BrushTypeLinearGradient   = 4
+End Enum
+
+Const Enum PenType
+	PenTypeSolidColor       = BrushTypeSolidColor
+	PenTypeHatchFill        = BrushTypeHatchFill
+	PenTypeTextureFill      = BrushTypeTextureFill
+	PenTypePathGradient     = BrushTypePathGradient
+	PenTypeLinearGradient   = BrushTypeLinearGradient
+	PenTypeUnknown          = -1
+End Enum
+
+Const Enum GenericFontFamily
+	GenericFontFamilySerif
+	GenericFontFamilySansSerif
+	GenericFontFamilyMonospace
+End Enum
+
+Const Enum FontStyle
+	FontStyleRegular    = 0
+	FontStyleBold       = 1
+	FontStyleItalic     = 2
+	FontStyleBoldItalic = 3
+	FontStyleUnderline  = 4
+	FontStyleStrikeout  = 8
+End Enum
+
+Const Enum MetafileType
+	MetafileTypeInvalid
+	MetafileTypeWmf
+	MetafileTypeWmfPlaceable
+	MetafileTypeEmf
+	MetafileTypeEmfPlusOnly
+	MetafileTypeEmfPlusDual
+End Enum
+
+Const Enum EmfType
+	EmfTypeEmfOnly     = MetafileTypeEmf
+	EmfTypeEmfPlusOnly = MetafileTypeEmfPlusOnly
+	EmfTypeEmfPlusDual = MetafileTypeEmfPlusDual
+End Enum
+
+Const Enum ObjectType
+	ObjectTypeInvalid
+	ObjectTypeBrush
+	ObjectTypePen
+	ObjectTypePath
+	ObjectTypeRegion
+	ObjectTypeImage
+	ObjectTypeFont
+	ObjectTypeStringFormat
+	ObjectTypeImageAttributes
+	ObjectTypeCustomLineCap
+
+'	ObjectTypeMax = ObjectTypeCustomLineCap
+'	ObjectTypeMin = ObjectTypeBrush
+End Enum
+
+Const ObjectTypeIsValid(type_) = (type_ >= ObjectTypeMin) And (type_ <= ObjectTypeMax)
+
+Const GDIP_EMFPLUS_RECORD_BASE        = &h00004000
+Const GDIP_WMF_RECORD_BASE            = &h00010000
+Const GDIP_WMF_RECORD_TO_EMFPLUS(n)   = ((n) Or GDIP_WMF_RECORD_BASE) ' As EmfPlusRecordType
+Const GDIP_EMFPLUS_RECORD_TO_WMF(n)   = ((n) And (Not GDIP_WMF_RECORD_BASE))
+'Const GDIP_IS_WMF_RECORDTYPE(n)       (((n) And GDIP_WMF_RECORD_BASE) <> 0)
+Function GDIP_IS_WMF_RECORDTYPE(n As DWord) As BOOL
+	If (n And GDIP_WMF_RECORD_BASE) <> 0 Then
+		GDIP_IS_WMF_RECORDTYPE = TRUE
+	Else
+		GDIP_IS_WMF_RECORDTYPE = FALSE
+	End If
+End Function
+
+Const Enum EmfPlusRecordType
+/*
+	WmfRecordTypeSetBkColor              = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETBKCOLOR)
+	WmfRecordTypeSetBkMode               = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETBKMODE)
+	WmfRecordTypeSetMapMode              = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETMAPMODE)
+	WmfRecordTypeSetROP2                 = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETROP2)
+	WmfRecordTypeSetRelAbs               = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETRELABS)
+	WmfRecordTypeSetPolyFillMode         = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPOLYFILLMODE)
+	WmfRecordTypeSetStretchBltMode       = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETSTRETCHBLTMODE)
+	WmfRecordTypeSetTextCharExtra        = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTCHAREXTRA)
+	WmfRecordTypeSetTextColor            = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTCOLOR)
+	WmfRecordTypeSetTextJustification    = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTJUSTIFICATION)
+	WmfRecordTypeSetWindowOrg            = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETWINDOWORG)
+	WmfRecordTypeSetWindowExt            = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETWINDOWEXT)
+	WmfRecordTypeSetViewportOrg          = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETVIEWPORTORG)
+	WmfRecordTypeSetViewportExt          = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETVIEWPORTEXT)
+	WmfRecordTypeOffsetWindowOrg         = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETWINDOWORG)
+	WmfRecordTypeScaleWindowExt          = GDIP_WMF_RECORD_TO_EMFPLUS(META_SCALEWINDOWEXT)
+	WmfRecordTypeOffsetViewportOrg       = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETVIEWPORTORG)
+	WmfRecordTypeScaleViewportExt        = GDIP_WMF_RECORD_TO_EMFPLUS(META_SCALEVIEWPORTEXT)
+	WmfRecordTypeLineTo                  = GDIP_WMF_RECORD_TO_EMFPLUS(META_LINETO)
+	WmfRecordTypeMoveTo                  = GDIP_WMF_RECORD_TO_EMFPLUS(META_MOVETO)
+	WmfRecordTypeExcludeClipRect         = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXCLUDECLIPRECT)
+	WmfRecordTypeIntersectClipRect       = GDIP_WMF_RECORD_TO_EMFPLUS(META_INTERSECTCLIPRECT)
+	WmfRecordTypeArc                     = GDIP_WMF_RECORD_TO_EMFPLUS(META_ARC)
+	WmfRecordTypeEllipse                 = GDIP_WMF_RECORD_TO_EMFPLUS(META_ELLIPSE)
+	WmfRecordTypeFloodFill               = GDIP_WMF_RECORD_TO_EMFPLUS(META_FLOODFILL)
+	WmfRecordTypePie                     = GDIP_WMF_RECORD_TO_EMFPLUS(META_PIE)
+	WmfRecordTypeRectangle               = GDIP_WMF_RECORD_TO_EMFPLUS(META_RECTANGLE)
+	WmfRecordTypeRoundRect               = GDIP_WMF_RECORD_TO_EMFPLUS(META_ROUNDRECT)
+	WmfRecordTypePatBlt                  = GDIP_WMF_RECORD_TO_EMFPLUS(META_PATBLT)
+	WmfRecordTypeSaveDC                  = GDIP_WMF_RECORD_TO_EMFPLUS(META_SAVEDC)
+	WmfRecordTypeSetPixel                = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPIXEL)
+	WmfRecordTypeOffsetClipRgn           = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETCLIPRGN)
+	WmfRecordTypeTextOut                 = GDIP_WMF_RECORD_TO_EMFPLUS(META_TEXTOUT)
+	WmfRecordTypeBitBlt                  = GDIP_WMF_RECORD_TO_EMFPLUS(META_BITBLT)
+	WmfRecordTypeStretchBlt              = GDIP_WMF_RECORD_TO_EMFPLUS(META_STRETCHBLT)
+	WmfRecordTypePolygon                 = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYGON)
+	WmfRecordTypePolyline                = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYLINE)
+	WmfRecordTypeEscape                  = GDIP_WMF_RECORD_TO_EMFPLUS(META_ESCAPE)
+	WmfRecordTypeRestoreDC               = GDIP_WMF_RECORD_TO_EMFPLUS(META_RESTOREDC)
+	WmfRecordTypeFillRegion              = GDIP_WMF_RECORD_TO_EMFPLUS(META_FILLREGION)
+	WmfRecordTypeFrameRegion             = GDIP_WMF_RECORD_TO_EMFPLUS(META_FRAMEREGION)
+	WmfRecordTypeInvertRegion            = GDIP_WMF_RECORD_TO_EMFPLUS(META_INVERTREGION)
+	WmfRecordTypePaintRegion             = GDIP_WMF_RECORD_TO_EMFPLUS(META_PAINTREGION)
+	WmfRecordTypeSelectClipRegion        = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTCLIPREGION)
+	WmfRecordTypeSelectObject            = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTOBJECT)
+	WmfRecordTypeSetTextAlign            = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTALIGN)
+	WmfRecordTypeDrawText                = GDIP_WMF_RECORD_TO_EMFPLUS(&h062F)   ' META_DRAWTEXT
+	WmfRecordTypeChord                   = GDIP_WMF_RECORD_TO_EMFPLUS(META_CHORD)
+	WmfRecordTypeSetMapperFlags          = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETMAPPERFLAGS)
+	WmfRecordTypeExtTextOut              = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXTTEXTOUT)
+	WmfRecordTypeSetDIBToDev             = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETDIBTODEV)
+	WmfRecordTypeSelectPalette           = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTPALETTE)
+	WmfRecordTypeRealizePalette          = GDIP_WMF_RECORD_TO_EMFPLUS(META_REALIZEPALETTE)
+	WmfRecordTypeAnimatePalette          = GDIP_WMF_RECORD_TO_EMFPLUS(META_ANIMATEPALETTE)
+	WmfRecordTypeSetPalEntries           = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPALENTRIES)
+	WmfRecordTypePolyPolygon             = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYPOLYGON)
+	WmfRecordTypeResizePalette           = GDIP_WMF_RECORD_TO_EMFPLUS(META_RESIZEPALETTE)
+	WmfRecordTypeDIBBitBlt               = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBBITBLT)
+	WmfRecordTypeDIBStretchBlt           = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBSTRETCHBLT)
+	WmfRecordTypeDIBCreatePatternBrush   = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBCREATEPATTERNBRUSH)
+	WmfRecordTypeStretchDIB              = GDIP_WMF_RECORD_TO_EMFPLUS(META_STRETCHDIB)
+	WmfRecordTypeExtFloodFill            = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXTFLOODFILL)
+	WmfRecordTypeSetLayout               = GDIP_WMF_RECORD_TO_EMFPLUS(&h0149)   ' META_SETLAYOUT
+	WmfRecordTypeResetDC                 = GDIP_WMF_RECORD_TO_EMFPLUS(&h014C)   ' META_RESETDC
+	WmfRecordTypeStartDoc                = GDIP_WMF_RECORD_TO_EMFPLUS(&h014D)   ' META_STARTDOC
+	WmfRecordTypeStartPage               = GDIP_WMF_RECORD_TO_EMFPLUS(&h004F)   ' META_STARTPAGE
+	WmfRecordTypeEndPage                 = GDIP_WMF_RECORD_TO_EMFPLUS(&h0050)   ' META_ENDPAGE
+	WmfRecordTypeAbortDoc                = GDIP_WMF_RECORD_TO_EMFPLUS(&h0052)   ' META_ABORTDOC
+	WmfRecordTypeEndDoc                  = GDIP_WMF_RECORD_TO_EMFPLUS(&h005E)   ' META_ENDDOC
+	WmfRecordTypeDeleteObject            = GDIP_WMF_RECORD_TO_EMFPLUS(META_DELETEOBJECT)
+	WmfRecordTypeCreatePalette           = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPALETTE)
+	WmfRecordTypeCreateBrush             = GDIP_WMF_RECORD_TO_EMFPLUS(&h00F8)   ' META_CREATEBRUSH
+	WmfRecordTypeCreatePatternBrush      = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPATTERNBRUSH)
+	WmfRecordTypeCreatePenIndirect       = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPENINDIRECT)
+	WmfRecordTypeCreateFontIndirect      = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEFONTINDIRECT)
+	WmfRecordTypeCreateBrushIndirect     = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEBRUSHINDIRECT)
+	WmfRecordTypeCreateBitmapIndirect    = GDIP_WMF_RECORD_TO_EMFPLUS(&h02FD)   ' META_CREATEBITMAPINDIRECT
+	WmfRecordTypeCreateBitmap            = GDIP_WMF_RECORD_TO_EMFPLUS(&h06FE)   ' META_CREATEBITMAP
+	WmfRecordTypeCreateRegion            = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEREGION)
+
+	EmfRecordTypeHeader                  = EMR_HEADER
+	EmfRecordTypePolyBezier              = EMR_POLYBEZIER
+	EmfRecordTypePolygon                 = EMR_POLYGON
+	EmfRecordTypePolyline                = EMR_POLYLINE
+	EmfRecordTypePolyBezierTo            = EMR_POLYBEZIERTO
+	EmfRecordTypePolyLineTo              = EMR_POLYLINETO
+	EmfRecordTypePolyPolyline            = EMR_POLYPOLYLINE
+	EmfRecordTypePolyPolygon             = EMR_POLYPOLYGON
+	EmfRecordTypeSetWindowExtEx          = EMR_SETWINDOWEXTEX
+	EmfRecordTypeSetWindowOrgEx          = EMR_SETWINDOWORGEX
+	EmfRecordTypeSetViewportExtEx        = EMR_SETVIEWPORTEXTEX
+	EmfRecordTypeSetViewportOrgEx        = EMR_SETVIEWPORTORGEX
+	EmfRecordTypeSetBrushOrgEx           = EMR_SETBRUSHORGEX
+	EmfRecordTypeEOF                     = EMR_EOF
+	EmfRecordTypeSetPixelV               = EMR_SETPIXELV
+	EmfRecordTypeSetMapperFlags          = EMR_SETMAPPERFLAGS
+	EmfRecordTypeSetMapMode              = EMR_SETMAPMODE
+	EmfRecordTypeSetBkMode               = EMR_SETBKMODE
+	EmfRecordTypeSetPolyFillMode         = EMR_SETPOLYFILLMODE
+	EmfRecordTypeSetROP2                 = EMR_SETROP2
+	EmfRecordTypeSetStretchBltMode       = EMR_SETSTRETCHBLTMODE
+	EmfRecordTypeSetTextAlign            = EMR_SETTEXTALIGN
+	EmfRecordTypeSetColorAdjustment      = EMR_SETCOLORADJUSTMENT
+	EmfRecordTypeSetTextColor            = EMR_SETTEXTCOLOR
+	EmfRecordTypeSetBkColor              = EMR_SETBKCOLOR
+	EmfRecordTypeOffsetClipRgn           = EMR_OFFSETCLIPRGN
+	EmfRecordTypeMoveToEx                = EMR_MOVETOEX
+	EmfRecordTypeSetMetaRgn              = EMR_SETMETARGN
+	EmfRecordTypeExcludeClipRect         = EMR_EXCLUDECLIPRECT
+	EmfRecordTypeIntersectClipRect       = EMR_INTERSECTCLIPRECT
+	EmfRecordTypeScaleViewportExtEx      = EMR_SCALEVIEWPORTEXTEX
+	EmfRecordTypeScaleWindowExtEx        = EMR_SCALEWINDOWEXTEX
+	EmfRecordTypeSaveDC                  = EMR_SAVEDC
+	EmfRecordTypeRestoreDC               = EMR_RESTOREDC
+	EmfRecordTypeSetWorldTransform       = EMR_SETWORLDTRANSFORM
+	EmfRecordTypeModifyWorldTransform    = EMR_MODIFYWORLDTRANSFORM
+	EmfRecordTypeSelectObject            = EMR_SELECTOBJECT
+	EmfRecordTypeCreatePen               = EMR_CREATEPEN
+	EmfRecordTypeCreateBrushIndirect     = EMR_CREATEBRUSHINDIRECT
+	EmfRecordTypeDeleteObject            = EMR_DELETEOBJECT
+	EmfRecordTypeAngleArc                = EMR_ANGLEARC
+	EmfRecordTypeEllipse                 = EMR_ELLIPSE
+	EmfRecordTypeRectangle               = EMR_RECTANGLE
+	EmfRecordTypeRoundRect               = EMR_ROUNDRECT
+	EmfRecordTypeArc                     = EMR_ARC
+	EmfRecordTypeChord                   = EMR_CHORD
+	EmfRecordTypePie                     = EMR_PIE
+	EmfRecordTypeSelectPalette           = EMR_SELECTPALETTE
+	EmfRecordTypeCreatePalette           = EMR_CREATEPALETTE
+	EmfRecordTypeSetPaletteEntries       = EMR_SETPALETTEENTRIES
+	EmfRecordTypeResizePalette           = EMR_RESIZEPALETTE
+	EmfRecordTypeRealizePalette          = EMR_REALIZEPALETTE
+	EmfRecordTypeExtFloodFill            = EMR_EXTFLOODFILL
+	EmfRecordTypeLineTo                  = EMR_LINETO
+	EmfRecordTypeArcTo                   = EMR_ARCTO
+	EmfRecordTypePolyDraw                = EMR_POLYDRAW
+	EmfRecordTypeSetArcDirection         = EMR_SETARCDIRECTION
+	EmfRecordTypeSetMiterLimit           = EMR_SETMITERLIMIT
+	EmfRecordTypeBeginPath               = EMR_BEGINPATH
+	EmfRecordTypeEndPath                 = EMR_ENDPATH
+	EmfRecordTypeCloseFigure             = EMR_CLOSEFIGURE
+	EmfRecordTypeFillPath                = EMR_FILLPATH
+	EmfRecordTypeStrokeAndFillPath       = EMR_STROKEANDFILLPATH
+	EmfRecordTypeStrokePath              = EMR_STROKEPATH
+	EmfRecordTypeFlattenPath             = EMR_FLATTENPATH
+	EmfRecordTypeWidenPath               = EMR_WIDENPATH
+	EmfRecordTypeSelectClipPath          = EMR_SELECTCLIPPATH
+	EmfRecordTypeAbortPath               = EMR_ABORTPATH
+	EmfRecordTypeReserved_069            = 69   ' Not Used
+	EmfRecordTypeGdiComment              = EMR_GDICOMMENT
+	EmfRecordTypeFillRgn                 = EMR_FILLRGN
+	EmfRecordTypeFrameRgn                = EMR_FRAMERGN
+	EmfRecordTypeInvertRgn               = EMR_INVERTRGN
+	EmfRecordTypePaintRgn                = EMR_PAINTRGN
+	EmfRecordTypeExtSelectClipRgn        = EMR_EXTSELECTCLIPRGN
+	EmfRecordTypeBitBlt                  = EMR_BITBLT
+	EmfRecordTypeStretchBlt              = EMR_STRETCHBLT
+	EmfRecordTypeMaskBlt                 = EMR_MASKBLT
+	EmfRecordTypePlgBlt                  = EMR_PLGBLT
+	EmfRecordTypeSetDIBitsToDevice       = EMR_SETDIBITSTODEVICE
+	EmfRecordTypeStretchDIBits           = EMR_STRETCHDIBITS
+	EmfRecordTypeExtCreateFontIndirect   = EMR_EXTCREATEFONTINDIRECTW
+	EmfRecordTypeExtTextOutA             = EMR_EXTTEXTOUTA
+	EmfRecordTypeExtTextOutW             = EMR_EXTTEXTOUTW
+	EmfRecordTypePolyBezier16            = EMR_POLYBEZIER16
+	EmfRecordTypePolygon16               = EMR_POLYGON16
+	EmfRecordTypePolyline16              = EMR_POLYLINE16
+	EmfRecordTypePolyBezierTo16          = EMR_POLYBEZIERTO16
+	EmfRecordTypePolylineTo16            = EMR_POLYLINETO16
+	EmfRecordTypePolyPolyline16          = EMR_POLYPOLYLINE16
+	EmfRecordTypePolyPolygon16           = EMR_POLYPOLYGON16
+	EmfRecordTypePolyDraw16              = EMR_POLYDRAW16
+	EmfRecordTypeCreateMonoBrush         = EMR_CREATEMONOBRUSH
+	EmfRecordTypeCreateDIBPatternBrushPt = EMR_CREATEDIBPATTERNBRUSHPT
+	EmfRecordTypeExtCreatePen            = EMR_EXTCREATEPEN
+	EmfRecordTypePolyTextOutA            = EMR_POLYTEXTOUTA
+	EmfRecordTypePolyTextOutW            = EMR_POLYTEXTOUTW
+	EmfRecordTypeSetICMMode              = 98   ' EMR_SETICMMODE
+	EmfRecordTypeCreateColorSpace        = 99   ' EMR_CREATECOLORSPACE
+	EmfRecordTypeSetColorSpace           = 100  ' EMR_SETCOLORSPACE
+	EmfRecordTypeDeleteColorSpace        = 101  ' EMR_DELETECOLORSPACE
+	EmfRecordTypeGLSRecord               = 102  ' EMR_GLSRECORD
+	EmfRecordTypeGLSBoundedRecord        = 103  ' EMR_GLSBOUNDEDRECORD
+	EmfRecordTypePixelFormat             = 104  ' EMR_PIXELFORMAT
+	EmfRecordTypeDrawEscape              = 105  ' EMR_RESERVED_105
+	EmfRecordTypeExtEscape               = 106  ' EMR_RESERVED_106
+	EmfRecordTypeStartDoc                = 107  ' EMR_RESERVED_107
+	EmfRecordTypeSmallTextOut            = 108  ' EMR_RESERVED_108
+	EmfRecordTypeForceUFIMapping         = 109  ' EMR_RESERVED_109
+	EmfRecordTypeNamedEscape             = 110  ' EMR_RESERVED_110
+	EmfRecordTypeColorCorrectPalette     = 111  ' EMR_COLORCORRECTPALETTE
+	EmfRecordTypeSetICMProfileA          = 112  ' EMR_SETICMPROFILEA
+	EmfRecordTypeSetICMProfileW          = 113  ' EMR_SETICMPROFILEW
+	EmfRecordTypeAlphaBlend              = 114  ' EMR_ALPHABLEND
+	EmfRecordTypeSetLayout               = 115  ' EMR_SETLAYOUT
+	EmfRecordTypeTransparentBlt          = 116  ' EMR_TRANSPARENTBLT
+	EmfRecordTypeReserved_117            = 117  ' Not Used
+	EmfRecordTypeGradientFill            = 118  ' EMR_GRADIENTFILL
+	EmfRecordTypeSetLinkedUFIs           = 119  ' EMR_RESERVED_119
+	EmfRecordTypeSetTextJustification    = 120  ' EMR_RESERVED_120
+	EmfRecordTypeColorMatchToTargetW     = 121  ' EMR_COLORMATCHTOTARGETW
+	EmfRecordTypeCreateColorSpaceW       = 122  ' EMR_CREATECOLORSPACEW
+	EmfRecordTypeMax                     = 122
+	EmfRecordTypeMin                     = 1
+
+	EmfPlusRecordTypeInvalid = GDIP_EMFPLUS_RECORD_BASE
+	EmfPlusRecordTypeHeader
+	EmfPlusRecordTypeEndOfFile
+
+	EmfPlusRecordTypeComment
+
+	EmfPlusRecordTypeGetDC
+
+	EmfPlusRecordTypeMultiFormatStart
+	EmfPlusRecordTypeMultiFormatSection
+	EmfPlusRecordTypeMultiFormatEnd
+
+	EmfPlusRecordTypeObject
+
+	EmfPlusRecordTypeClear
+	EmfPlusRecordTypeFillRects
+	EmfPlusRecordTypeDrawRects
+	EmfPlusRecordTypeFillPolygon
+	EmfPlusRecordTypeDrawLines
+	EmfPlusRecordTypeFillEllipse
+	EmfPlusRecordTypeDrawEllipse
+	EmfPlusRecordTypeFillPie
+	EmfPlusRecordTypeDrawPie
+	EmfPlusRecordTypeDrawArc
+	EmfPlusRecordTypeFillRegion
+	EmfPlusRecordTypeFillPath
+	EmfPlusRecordTypeDrawPath
+	EmfPlusRecordTypeFillClosedCurve
+	EmfPlusRecordTypeDrawClosedCurve
+	EmfPlusRecordTypeDrawCurve
+	EmfPlusRecordTypeDrawBeziers
+	EmfPlusRecordTypeDrawImage
+	EmfPlusRecordTypeDrawImagePoints
+	EmfPlusRecordTypeDrawString
+
+	EmfPlusRecordTypeSetRenderingOrigin
+	EmfPlusRecordTypeSetAntiAliasMode
+	EmfPlusRecordTypeSetTextRenderingHint
+	EmfPlusRecordTypeSetTextContrast
+	EmfPlusRecordTypeSetInterpolationMode
+	EmfPlusRecordTypeSetPixelOffsetMode
+	EmfPlusRecordTypeSetCompositingMode
+	EmfPlusRecordTypeSetCompositingQuality
+	EmfPlusRecordTypeSave
+	EmfPlusRecordTypeRestore
+	EmfPlusRecordTypeBeginContainer
+	EmfPlusRecordTypeBeginContainerNoParams
+	EmfPlusRecordTypeEndContainer
+	EmfPlusRecordTypeSetWorldTransform
+	EmfPlusRecordTypeResetWorldTransform
+	EmfPlusRecordTypeMultiplyWorldTransform
+	EmfPlusRecordTypeTranslateWorldTransform
+	EmfPlusRecordTypeScaleWorldTransform
+	EmfPlusRecordTypeRotateWorldTransform
+	EmfPlusRecordTypeSetPageTransform
+	EmfPlusRecordTypeResetClip
+	EmfPlusRecordTypeSetClipRect
+	EmfPlusRecordTypeSetClipPath
+	EmfPlusRecordTypeSetClipRegion
+	EmfPlusRecordTypeOffsetClip
+
+	EmfPlusRecordTypeDrawDriverString
+
+	EmfPlusRecordTotal
+
+	EmfPlusRecordTypeMax = EmfPlusRecordTotal-1
+	EmfPlusRecordTypeMin = EmfPlusRecordTypeHeader */
+End Enum
+
+Const Enum StringFormatFlags
+	StringFormatFlagsDirectionRightToLeft        = &h00000001
+	StringFormatFlagsDirectionVertical           = &h00000002
+	StringFormatFlagsNoFitBlackBox               = &h00000004
+	StringFormatFlagsDisplayFormatControl        = &h00000020
+	StringFormatFlagsNoFontFallback              = &h00000400
+	StringFormatFlagsMeasureTrailingSpaces       = &h00000800
+	StringFormatFlagsNoWrap                      = &h00001000
+	StringFormatFlagsLineLimit                   = &h00002000
+
+	StringFormatFlagsNoClip                      = &h00004000
+End Enum
+
+Const Enum StringTrimming
+	StringTrimmingNone              = 0
+	StringTrimmingCharacter         = 1
+	StringTrimmingWord              = 2
+	StringTrimmingEllipsisCharacter = 3
+	StringTrimmingEllipsisWord      = 4
+	StringTrimmingEllipsisPath      = 5
+End Enum
+
+Const Enum StringDigitSubstitute
+	StringDigitSubstituteUser        = 0   ' As NLS setting
+	StringDigitSubstituteNone        = 1
+	StringDigitSubstituteNational    = 2
+	StringDigitSubstituteTraditional = 3
+End Enum
+
+Const Enum HotkeyPrefix
+	HotkeyPrefixNone        = 0
+	HotkeyPrefixShow        = 1
+	HotkeyPrefixHide        = 2
+End Enum
+
+Const Enum StringAlignment
+	StringAlignmentNear   = 0
+	StringAlignmentCenter = 1
+	StringAlignmentFar    = 2
+End Enum
+
+Const Enum DriverStringOptions
+	DriverStringOptionsCmapLookup             = 1
+	DriverStringOptionsVertical               = 2
+	DriverStringOptionsRealizedAdvance        = 4
+	DriverStringOptionsLimitSubpixel          = 8
+End Enum
+
+Const Enum EncoderParameterValueType
+	EncoderParameterValueTypeByte           = 1
+	EncoderParameterValueTypeASCII          = 2
+	EncoderParameterValueTypeShort          = 3
+	EncoderParameterValueTypeLong           = 4
+	EncoderParameterValueTypeRational       = 5
+	EncoderParameterValueTypeLongRange      = 6
+	EncoderParameterValueTypeUndefined      = 7
+	EncoderParameterValueTypeRationalRange  = 8
+End Enum
+
+Const Enum EncoderValue
+	EncoderValueColorTypeCMYK
+	EncoderValueColorTypeYCCK
+	EncoderValueCompressionLZW
+	EncoderValueCompressionCCITT3
+	EncoderValueCompressionCCITT4
+	EncoderValueCompressionRle
+	EncoderValueCompressionNone
+	EncoderValueScanMethodInterlaced
+	EncoderValueScanMethodNonInterlaced
+	EncoderValueVersionGif87
+	EncoderValueVersionGif89
+	EncoderValueRenderProgressive
+	EncoderValueRenderNonProgressive
+	EncoderValueTransformRotate90
+	EncoderValueTransformRotate180
+	EncoderValueTransformRotate270
+	EncoderValueTransformFlipHorizontal
+	EncoderValueTransformFlipVertical
+	EncoderValueMultiFrame
+	EncoderValueLastFrame
+	EncoderValueFlush
+	EncoderValueFrameDimensionTime
+	EncoderValueFrameDimensionResolution
+	EncoderValueFrameDimensionPage
+End Enum
+
+Const Enum EmfToWmfBitsFlags
+	EmfToWmfBitsFlagsDefault          = &h00000000
+	EmfToWmfBitsFlagsEmbedEmf         = &h00000001
+	EmfToWmfBitsFlagsIncludePlaceable = &h00000002
+	EmfToWmfBitsFlagsNoXORClip        = &h00000004
+End Enum
+
+Const Enum GpTestControlEnum
+	TestControlForceBilinear = 0
+	TestControlNoICM = 1
+	TestControlGetBuildNumber = 2
+End Enum
Index: /trunk/ab5.0/ablib/src/GdiPlusFlat.ab
===================================================================
--- /trunk/ab5.0/ablib/src/GdiPlusFlat.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/GdiPlusFlat.ab	(revision 506)
@@ -0,0 +1,663 @@
+' GdiPlusFlat.ab
+
+#require <GdiPlusEnums.ab>
+#require <GdiPlusGpStubs.ab>
+#require <Classes/System/Drawing/misc.ab>
+#require <Classes/System/Drawing/Imaging/misc.ab>
+#require <Classes/System/Drawing/Text/misc.ab>
+#require <Classes/System/Drawing/Imaging/MetafileHeader.ab>
+
+TypeDef PDirectDrawSurface7 = VoidPtr '*IDirectDrawSurface7
+
+' GraphicsPath APIs
+Declare Function GdipCreatePath Lib "gdiplus.dll" (ByVal brushMode As GpFillMode, ByRef path As *GpPath) As GpStatus
+Declare Function GdipCreatePath2 Lib "gdiplus.dll" (ByVal points As *GpPointF, ByVal types As *Byte, ByVal count As Long, ByVal brushMode As GpFillMode, ByRef path As *GpPath) As GpStatus
+Declare Function GdipCreatePath2I Lib "gdiplus.dll" (ByVal points As *GpPointF, ByVal types As *Byte, ByVal count As Long, ByVal brushMode As GpFillMode, ByRef path As *GpPath) As GpStatus
+Declare Function GdipClonePath Lib "gdiplus.dll" (ByVal path As *GpPath, ByRef clonePath As *GpPath) As GpStatus
+Declare Function GdipDeletePath Lib "gdiplus.dll" (ByVal path As *GpPath) As GpStatus
+Declare Function GdipResetPath Lib "gdiplus.dll" (ByVal path As *GpPath) As GpStatus
+Declare Function GdipGetPointCount Lib "gdiplus.dll" (ByVal path As *GpPath, ByRef count As Long) As GpStatus
+Declare Function GdipGetPathTypes Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal types As *Byte, ByVal count As Long) As GpStatus
+Declare Function GdipGetPathPoints Lib "gdiplus.dll" (ByVal path As *GpPath, ByRef points As GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipGetPathPointsI Lib "gdiplus.dll" (ByVal path As *GpPath, ByRef points As GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipGetPathFillMode Lib "gdiplus.dll" (ByVal path As *GpPath, ByRef fillmode As GpFillMode) As GpStatus
+Declare Function GdipSetPathFillMode Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal fillmode As GpFillMode) As GpStatus
+Declare Function GdipGetPathData Lib "gdiplus.dll" (ByVal path As *GpPath, ByRef pathData As GpPathData) As GpStatus
+Declare Function GdipStartPathFigure Lib "gdiplus.dll" (ByVal path As *GpPath) As GpStatus
+Declare Function GdipClosePathFigure Lib "gdiplus.dll" (ByVal path As *GpPath) As GpStatus
+Declare Function GdipClosePathFigures Lib "gdiplus.dll" (ByVal path As *GpPath) As GpStatus
+Declare Function GdipSetPathMarker Lib "gdiplus.dll" (ByVal path As *GpPath) As GpStatus
+Declare Function GdipClearPathMarkers Lib "gdiplus.dll" (ByVal path As *GpPath) As GpStatus
+Declare Function GdipReversePath Lib "gdiplus.dll" (ByVal path As *GpPath) As GpStatus
+Declare Function GdipGetPathLastPoint Lib "gdiplus.dll" (ByVal path As *GpPath, ByRef lastPoint As GpPointF) As GpStatus
+Declare Function GdipAddPathLine Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single) As GpStatus
+Declare Function GdipAddPathLine2 Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathArc Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
+Declare Function GdipAddPathBezier Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single, ByVal x3 As Single, ByVal y3 As Single, ByVal x4 As Single, ByVal y4 As Single) As GpStatus
+Declare Function GdipAddPathBeziers Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathCurve Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathCurve2 Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPointF, ByVal count As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipAddPathCurve3 Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPointF, ByVal count As Long, ByVal offset As Long, ByVal numberOfSegments As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipAddPathClosedCurve Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathClosedCurve2 Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPointF, ByVal count As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipAddPathRectangle Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single) As GpStatus
+Declare Function GdipAddPathRectangles Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal rects As *GpRectF, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathEllipse Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single) As GpStatus
+Declare Function GdipAddPathPie Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
+Declare Function GdipAddPathPolygon Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathPath Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal addingPath As *GpPath, ByVal connect As BOOL) As GpStatus
+Declare Function GdipAddPathString Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal str As *WCHAR, ByVal length As Long, ByVal family As *GpFontFamily, ByVal style As Long, ByVal emSize As Single, ByRef layoutRect As GpRectF, ByVal format As *GpStringFormat) As GpStatus
+Declare Function GdipAddPathStringI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal str As *WCHAR, ByVal length As Long, ByVal family As *GpFontFamily, ByVal style As Long, ByVal emSize As Single, ByRef layoutRect As GpRect, ByVal format As *GpStringFormat) As GpStatus
+Declare Function GdipAddPathLineI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As GpStatus
+Declare Function GdipAddPathLine2I Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathArcI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
+Declare Function GdipAddPathBezierI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long, ByVal x3 As Long, ByVal y3 As Long, ByVal x4 As Long, ByVal y4 As Long) As GpStatus
+Declare Function GdipAddPathBeziersI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathCurveI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathCurve2I Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPoint, ByVal count As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipAddPathCurve3I Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPoint, ByVal count As Long, ByVal offset As Long, ByVal numberOfSegments As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipAddPathClosedCurveI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathClosedCurve2I Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPoint, ByVal count As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipAddPathRectangleI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long) As GpStatus
+Declare Function GdipAddPathRectanglesI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal rects As *GpRect, ByVal count As Long) As GpStatus
+Declare Function GdipAddPathEllipseI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long) As GpStatus
+Declare Function GdipAddPathPieI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
+Declare Function GdipAddPathPolygonI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipFlattenPath Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal matrix As *GpMatrix, ByVal flatness As Single) As GpStatus
+Declare Function GdipWindingModeOutline Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal matrix As *GpMatrix, ByVal flatness As Single) As GpStatus
+Declare Function GdipWidenPath Lib "gdiplus.dll" (ByVal nativePath As *GpPath, ByVal pen As *GpPen, ByVal matrix As *GpMatrix, ByVal flatness As Single) As GpStatus
+Declare Function GdipWarpPath Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal matrix As *GpMatrix, ByVal points As *GpPointF, ByVal count As Long, ByVal srcx As Single, ByVal srcy As Single, ByVal srcwidth As Single, ByVal srcheight As Single, ByVal warpMode As WarpMode, ByVal flatness As Single) As GpStatus
+Declare Function GdipTransformPath Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipGetPathWorldBounds Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal bounds As *GpRectF, ByVal matrix As *GpMatrix, ByVal pen As *GpPen) As GpStatus
+Declare Function GdipGetPathWorldBoundsI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal bounds As *GpRect, ByVal matrix As *GpMatrix, ByVal pen As *GpPen) As GpStatus
+Declare Function GdipIsVisiblePathPoint Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Single, ByVal y As Single, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsVisiblePathPointI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Long, ByVal y As Long, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsOutlineVisiblePathPoint Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Single, ByVal y As Single, ByVal pen As *GpPen, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsOutlineVisiblePathPointI Lib "gdiplus.dll" (ByVal path As *GpPath, ByVal x As Long, ByVal y As Long, ByVal pen As *GpPen, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+
+' PathIterator APIs
+Declare Function GdipCreatePathIter Lib "gdiplus.dll" (ByRef iterator As *GpPathIterator, ByVal path As *GpPath) As GpStatus
+Declare Function GdipDeletePathIter Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator) As GpStatus
+Declare Function GdipPathIterNextSubpath Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef resultCount As Long, ByRef startIndex As Long, ByRef endIndex As Long, ByRef isClosed As BOOL) As GpStatus
+Declare Function GdipPathIterNextSubpathPath Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef resultCount As Long, ByVal path As *GpPath, ByRef isClosed As BOOL) As GpStatus
+Declare Function GdipPathIterNextPathType Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef resultCount As Long, ByRef pathType As Byte, ByRef startIndex As Long, ByRef endIndex As Long) As GpStatus
+Declare Function GdipPathIterNextMarker Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef resultCount As Long, ByRef startIndex As Long, ByRef endIndex As Long) As GpStatus
+Declare Function GdipPathIterNextMarkerPath Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef resultCount As Long, ByVal path As *GpPath) As GpStatus
+Declare Function GdipPathIterGetCount Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef count As Long) As GpStatus
+Declare Function GdipPathIterGetSubpathCount Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef count As Long) As GpStatus
+Declare Function GdipPathIterIsValid Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef valid As BOOL) As GpStatus
+Declare Function GdipPathIterHasCurve Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef hasCurve As BOOL) As GpStatus
+Declare Function GdipPathIterRewind Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator) As GpStatus
+Declare Function GdipPathIterEnumerate Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef resultCount As Long, ByVal points As *PointF, ByVal types As *Byte, ByVal count As Long) As GpStatus
+Declare Function GdipPathIterCopyData Lib "gdiplus.dll" (ByVal iterator As *GpPathIterator, ByRef resultCount As Long, ByVal points As *PointF, ByVal types As *Byte, ByVal startIndex As Long, ByVal endIndex As Long) As GpStatus
+
+' Matrix APIs
+Declare Function GdipCreateMatrix Lib "gdiplus.dll" (ByRef matrix As *GpMatrix) As GpStatus
+Declare Function GdipCreateMatrix2 Lib "gdiplus.dll" (ByVal m11 As Single, ByVal m12 As Single, ByVal m21 As Single, ByVal m22 As Single, ByVal dx As Single, ByVal dy As Single, ByRef matrix As *GpMatrix) As GpStatus
+Declare Function GdipCreateMatrix3 Lib "gdiplus.dll" (ByRef rect As GpRectF, ByVal dstplg As *GpPointF, ByRef matrix As *GpMatrix) As GpStatus
+Declare Function GdipCreateMatrix3I Lib "gdiplus.dll" (ByRef rect As GpRect, ByVal dstplg As *GpPoint, ByRef matrix As *GpMatrix) As GpStatus
+Declare Function GdipCloneMatrix Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByRef cloneMatrix As *GpMatrix) As GpStatus
+Declare Function GdipDeleteMatrix Lib "gdiplus.dll" (ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipSetMatrixElements Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal m11 As Single, ByVal m12 As Single, ByVal m21 As Single, ByVal m22 As Single, ByVal dx As Single, ByVal dy As Single) As GpStatus
+Declare Function GdipMultiplyMatrix Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal matrix2 As *GpMatrix, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipTranslateMatrix Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal offsetX As Single, ByVal offsetY As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipScaleMatrix Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal scaleX As Single, ByVal scaleY As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipRotateMatrix Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal angle As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipShearMatrix Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal shearX As Single, ByVal shearY As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipInvertMatrix Lib "gdiplus.dll" (ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipTransformMatrixPoints Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal pts As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipTransformMatrixPointsI Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal pts As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipVectorTransformMatrixPoints Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal pts As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipVectorTransformMatrixPointsI Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal pts As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipGetMatrixElements Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal matrixOut As *Single) As GpStatus
+Declare Function GdipIsMatrixInvertible Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsMatrixIdentity Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsMatrixEqual Lib "gdiplus.dll" (ByVal matrix As *GpMatrix, ByVal matrix2 As *GpMatrix, ByRef result As BOOL) As GpStatus
+
+' Region APIs
+Declare Function GdipCreateRegion Lib "gdiplus.dll" (ByRef region As *GpRegion) As GpStatus
+Declare Function GdipCreateRegionRect Lib "gdiplus.dll" (ByRef rect As GpRectF, ByRef region As *GpRegion) As GpStatus
+Declare Function GdipCreateRegionRectI Lib "gdiplus.dll" (ByRef rect As GpRect, ByRef region As *GpRegion) As GpStatus
+Declare Function GdipCreateRegionPath Lib "gdiplus.dll" (ByVal path As *GpPath, ByRef region As *GpRegion) As GpStatus
+Declare Function GdipCreateRegionRgnData Lib "gdiplus.dll" (regionData As *Byte, ByVal size As Long, ByRef region As *GpRegion) As GpStatus
+Declare Function GdipCreateRegionHrgn Lib "gdiplus.dll" (ByVal hRgn As HRGN, ByRef region As *GpRegion) As GpStatus
+Declare Function GdipCloneRegion Lib "gdiplus.dll" (ByVal region As *GpRegion, ByRef cloneRegion As *GpRegion) As GpStatus
+Declare Function GdipDeleteRegion Lib "gdiplus.dll" (ByVal region As *GpRegion) As GpStatus
+Declare Function GdipSetInfinite Lib "gdiplus.dll" (ByVal region As *GpRegion) As GpStatus
+Declare Function GdipSetEmpty Lib "gdiplus.dll" (ByVal region As *GpRegion) As GpStatus
+Declare Function GdipCombineRegionRect Lib "gdiplus.dll" (ByVal region As *GpRegion, ByRef rect As GpRectF, ByVal combineMode As CombineMode) As GpStatus
+Declare Function GdipCombineRegionRectI Lib "gdiplus.dll" (ByVal region As *GpRegion, ByRef rect As GpRect, ByVal combineMode As CombineMode) As GpStatus
+Declare Function GdipCombineRegionPath Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal path As *GpPath, ByVal combineMode As CombineMode) As GpStatus
+Declare Function GdipCombineRegionRegion Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal region2 As *GpRegion, ByVal combineMode As CombineMode) As GpStatus
+Declare Function GdipTranslateRegion Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal dx As Single, ByVal dy As Single) As GpStatus
+Declare Function GdipTranslateRegionI Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal dx As Long, ByVal dy As Long) As GpStatus
+Declare Function GdipTransformRegion Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipGetRegionBounds Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal graphics As *GpGraphics, ByRef rect As GpRectF) As GpStatus
+Declare Function GdipGetRegionBoundsI Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal graphics As *GpGraphics, ByRef rect As GpRect) As GpStatus
+Declare Function GdipGetRegionHRgn Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal graphics As *GpGraphics, ByRef hRgn As HRGN) As GpStatus
+Declare Function GdipIsEmptyRegion Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsInfiniteRegion Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsEqualRegion Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal region2 As *GpRegion, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipGetRegionDataSize Lib "gdiplus.dll" (ByVal region As *GpRegion, ByRef bufferSize As DWord) As GpStatus
+Declare Function GdipGetRegionData Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal buffer As Byte, ByVal bufferSize As DWord, ByVal sizeFilled As *DWord) As GpStatus
+Declare Function GdipIsVisibleRegionPoint Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal x As Single, ByVal y As Single, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsVisibleRegionPointI Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal x As Long, ByVal y As Long, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsVisibleRegionRect Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsVisibleRegionRectI Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipGetRegionScansCount Lib "gdiplus.dll" (ByVal region As *GpRegion, ByRef count As DWord, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipGetRegionScans Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal rects As *GpRectF, ByRef count As Long, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipGetRegionScansI Lib "gdiplus.dll" (ByVal region As *GpRegion, ByVal rects As *GpRect, ByRef count As Long, ByVal matrix As *GpMatrix) As GpStatus
+
+' Brush APIs
+Declare Function GdipCloneBrush Lib "gdiplus.dll" (ByVal brush As *GpBrush, ByRef cloneBrush As *GpBrush) As GpStatus
+Declare Function GdipDeleteBrush Lib "gdiplus.dll" (ByVal brush As *GpBrush) As GpStatus
+Declare Function GdipGetBrushType Lib "gdiplus.dll" (ByVal brush As *GpBrush, ByRef brushType As *GpBrushType) As GpStatus
+
+' HatchBrush APIs
+Declare Function GdipCreateHatchBrush Lib "gdiplus.dll" (ByVal hatchstyle As GpHatchStyle, ByVal forecol As ARGB, ByVal backcol As ARGB, ByRef brush As *GpHatch) As GpStatus
+Declare Function GdipGetHatchStyle Lib "gdiplus.dll" (ByVal brush As *GpHatch, ByRef hatchstyle As GpHatchStyle) As GpStatus
+Declare Function GdipGetHatchForegroundColor Lib "gdiplus.dll" (ByVal brush As *GpHatch, ByRef forecol As ARGB) As GpStatus
+Declare Function GdipGetHatchBackgroundColor Lib "gdiplus.dll" (ByVal brush As *GpHatch, ByRef backcol As ARGB) As GpStatus
+
+' TextureBrush APIs
+Declare Function GdipCreateTexture Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal wrapmode As GpWrapMode, ByRef texture As *GpTexture) As GpStatus
+Declare Function GdipCreateTexture2 Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal wrapmode As GpWrapMode, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByRef texture As *GpTexture) As GpStatus
+Declare Function GdipCreateTextureIA Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal imageAttributes As *GpImageAttributes, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByRef texture As *GpTexture) As GpStatus
+Declare Function GdipCreateTexture2I Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal wrapmode As GpWrapMode, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByRef texture As *GpTexture) As GpStatus
+Declare Function GdipCreateTextureIAI Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal imageAttributes As *GpImageAttributes, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByRef texture As *GpTexture) As GpStatus
+Declare Function GdipGetTextureTransform Lib "gdiplus.dll" (ByVal brush As *GpTexture, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipSetTextureTransform Lib "gdiplus.dll" (ByVal brush As *GpTexture, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipResetTextureTransform Lib "gdiplus.dll" (ByVal brush As *GpTexture) As GpStatus
+Declare Function GdipMultiplyTextureTransform Lib "gdiplus.dll" (ByVal brush As *GpTexture, ByVal matrix As *GpMatrix, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipTranslateTextureTransform Lib "gdiplus.dll" (ByVal brush As *GpTexture, ByVal dx As Single, ByVal dy As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipScaleTextureTransform Lib "gdiplus.dll" (ByVal brush As *GpTexture, ByVal sx As Single, ByVal sy As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipRotateTextureTransform Lib "gdiplus.dll" (ByVal brush As *GpTexture, ByVal angle As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipSetTextureWrapMode Lib "gdiplus.dll" (ByVal brush As *GpTexture, ByVal wrapmode As GpWrapMode) As GpStatus
+Declare Function GdipGetTextureWrapMode Lib "gdiplus.dll" (ByVal brush As *GpTexture, ByRef wrapmode As GpWrapMode) As GpStatus
+Declare Function GdipGetTextureImage Lib "gdiplus.dll" (ByVal brush As *GpTexture, ByRef image As *GpImage) As GpStatus
+
+' SolidBrush APIs
+Declare Function GdipCreateSolidFill Lib "gdiplus.dll" (ByVal color As ARGB, ByRef brush As *GpSolidFill) As GpStatus
+Declare Function GdipSetSolidFillColor Lib "gdiplus.dll" (ByVal brush As *GpSolidFill, ByVal color As ARGB) As GpStatus
+Declare Function GdipGetSolidFillColor Lib "gdiplus.dll" (ByVal brush As *GpSolidFill, ByRef color As ARGB) As GpStatus
+
+' LineBrush APIs
+Declare Function GdipCreateLineBrush Lib "gdiplus.dll" (ByRef point1 As GpPointF, ByRef point2 As GpPointF, ByVal color1 As ARGB, ByVal color2 As ARGB, ByVal wrapMode As GpWrapMode, ByRef lineGradient As *GpLineGradient) As GpStatus
+Declare Function GdipCreateLineBrushI Lib "gdiplus.dll" (ByRef point1 As GpPoint, ByRef point2 As GpPoint, ByVal color1 As ARGB, ByVal color2 As ARGB, ByVal wrapMode As GpWrapMode, ByRef lineGradient As *GpLineGradient) As GpStatus
+Declare Function GdipCreateLineBrushFromRect Lib "gdiplus.dll" (ByRef rect As GpRectF, ByVal color1 As ARGB, ByVal color2 As ARGB, ByVal mode As LinearGradientMode, ByVal wrapMode As GpWrapMode, ByRef lineGradient As *GpLineGradient) As GpStatus
+Declare Function GdipCreateLineBrushFromRectI Lib "gdiplus.dll" (ByRef rect As GpRect, ByVal color1 As ARGB, ByVal color2 As ARGB, ByVal mode As LinearGradientMode, ByVal wrapMode As GpWrapMode, ByRef lineGradient As *GpLineGradient) As GpStatus
+Declare Function GdipCreateLineBrushFromRectWithAngle Lib "gdiplus.dll" (ByRef rect As GpRectF, ByVal color1 As ARGB, ByVal color2 As ARGB, ByVal angle As Single, ByVal isAngleScalable As BOOL, ByVal wrapMode As GpWrapMode, ByRef lineGradient As *GpLineGradient) As GpStatus
+Declare Function GdipCreateLineBrushFromRectWithAngleI Lib "gdiplus.dll" (ByRef rect As GpRect, ByVal color1 As ARGB, ByVal color2 As ARGB, ByVal angle As Single, ByVal isAngleScalable As BOOL, ByRef lineGradient As *GpLineGradient) As GpStatus
+Declare Function GdipSetLineColors Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal color1 As ARGB, ByVal color2 As ARGB) As GpStatus
+Declare Function GdipGetLineColors Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal colors As *ARGB) As GpStatus
+Declare Function GdipGetLineRect Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByRef rect As GpRectF) As GpStatus
+Declare Function GdipGetLineRectI Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByRef rect As GpRect) As GpStatus
+Declare Function GdipSetLineGammaCorrection Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal useGammaCorrection As BOOL) As GpStatus
+Declare Function GdipGetLineGammaCorrection Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByRef useGammaCorrection As BOOL) As GpStatus
+Declare Function GdipGetLineBlendCount Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByRef count As Long) As GpStatus
+Declare Function GdipGetLineBlend Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal blend As *Single, ByVal positions As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipSetLineBlend Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal blend As *Single, ByVal positions As *Single, ByVal positions As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipGetLinePresetBlendCount Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByRef count As Long) As GpStatus
+Declare Function GdipGetLinePresetBlend Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal blend As *ARGB, ByVal blend As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipSetLinePresetBlend Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal blend As *Single, ByVal positions As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipSetLineSigmaBlend Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal focus As Single, ByVal scale As Single) As GpStatus
+Declare Function GdipSetLineLinearBlend Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal focus As Single, ByVal scale As Single) As GpStatus
+Declare Function GdipSetLineWrapMode Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal wrapmode As GpWrapMode) As GpStatus
+Declare Function GdipGetLineWrapMode Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByRef wrapmode As GpWrapMode) As GpStatus
+Declare Function GdipGetLineTransform Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipSetLineTransform Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipResetLineTransform Lib "gdiplus.dll" (ByVal brush As *GpLineGradient) As GpStatus
+Declare Function GdipMultiplyLineTransform Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal matrix As *GpMatrix, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipTranslateLineTransform Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal dx As Single, ByVal dy As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipScaleLineTransform Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal sx As Single, ByVal sy As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipRotateLineTransform Lib "gdiplus.dll" (ByVal brush As *GpLineGradient, ByVal angle As Single, ByVal order As GpMatrixOrder) As GpStatus
+
+' PathGradientBrush APIs
+Declare Function GdipCreatePathGradient Lib "gdiplus.dll" (ByVal points As *GpPointF, ByVal count As Long, ByVal wrapMode As GpWrapMode, ByRef polyGradient As *GpPathGradient) As GpStatus
+Declare Function GdipCreatePathGradientI Lib "gdiplus.dll" (ByVal points As *GpPoint, ByVal count As Long, ByVal wrapMode As GpWrapMode, ByRef polyGradient As *GpPathGradient) As GpStatus
+Declare Function GdipCreatePathGradientFromPath Lib "gdiplus.dll" (ByVal path As *GpPath, ByRef polyGradient As *GpPathGradient) As GpStatus
+Declare Function GdipGetPathGradientCenterColor Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef colors As ARGB) As GpStatus
+Declare Function GdipSetPathGradientCenterColor Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal colors As ARGB) As GpStatus
+Declare Function GdipGetPathGradientSurroundColorsWithCount Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal color As *ARGB, ByRef count As Long) As GpStatus
+Declare Function GdipSetPathGradientSurroundColorsWithCount Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal color As *ARGB, ByRef count As Long) As GpStatus
+Declare Function GdipGetPathGradientPath Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal path As *GpPath) As GpStatus
+Declare Function GdipSetPathGradientPath Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal path As *GpPath) As GpStatus
+Declare Function GdipGetPathGradientCenterPoint Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal points As *GpPointF) As GpStatus
+Declare Function GdipGetPathGradientCenterPointI Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal points As *GpPoint) As GpStatus
+Declare Function GdipSetPathGradientCenterPoint Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal points As *GpPointF) As GpStatus
+Declare Function GdipSetPathGradientCenterPointI Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal points As *GpPoint) As GpStatus
+Declare Function GdipGetPathGradientRect Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef rect As GpRectF) As GpStatus
+Declare Function GdipGetPathGradientRectI Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef rect As GpRect) As GpStatus
+Declare Function GdipGetPathGradientPointCount Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef count As Long) As GpStatus
+Declare Function GdipGetPathGradientSurroundColorCount Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef count As Long) As GpStatus
+Declare Function GdipSetPathGradientGammaCorrection Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal useGammaCorrection As BOOL) As GpStatus
+Declare Function GdipGetPathGradientGammaCorrection Lib "gdiplus.dll" (ByVal brush As *GpPathGradient,ByRef useGammaCorrection As BOOL) As GpStatus
+Declare Function GdipGetPathGradientBlendCount Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef count As Long) As GpStatus
+Declare Function GdipGetPathGradientBlend Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal blend As *Single, ByVal positions As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipSetPathGradientBlend Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal blend As *Single, ByVal positions As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipGetPathGradientPresetBlendCount Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef count As Long) As GpStatus
+Declare Function GdipGetPathGradientPresetBlend Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal blend As *ARGB, ByVal positions As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipSetPathGradientPresetBlend Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal blend As *ARGB, ByVal positions As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipSetPathGradientSigmaBlend Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal focus As Single, ByVal scale As Single) As GpStatus
+Declare Function GdipSetPathGradientLinearBlend Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal focus As Single, ByVal scale As Single) As GpStatus
+Declare Function GdipGetPathGradientWrapMode Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef wrapmode As GpWrapMode) As GpStatus
+Declare Function GdipSetPathGradientWrapMode Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal wrapmode As GpWrapMode) As GpStatus
+Declare Function GdipGetPathGradientTransform Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipSetPathGradientTransform Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipResetPathGradientTransform Lib "gdiplus.dll" (ByVal brush As *GpPathGradient) As GpStatus
+Declare Function GdipMultiplyPathGradientTransform Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal matrix As *GpMatrix, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipTranslatePathGradientTransform Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal dx As Single, ByVal dy As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipScalePathGradientTransform Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal sx As Single, ByVal sy As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipRotatePathGradientTransform Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal angle As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipGetPathGradientFocusScales Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByRef xScale As Single, ByRef yScale As Single) As GpStatus
+Declare Function GdipSetPathGradientFocusScales Lib "gdiplus.dll" (ByVal brush As *GpPathGradient, ByVal xScale As Single, ByVal yScale As Single) As GpStatus
+
+' Pen APIs
+Declare Function GdipCreatePen1 Lib "gdiplus.dll" (ByVal color As ARGB, ByVal width As Single, ByVal unit As GpUnit, ByRef pen As *GpPen) As GpStatus
+Declare Function GdipCreatePen2 Lib "gdiplus.dll" (ByVal brush As *GpBrush, ByVal width As Single, ByVal unit As GpUnit, ByRef pen As *GpPen) As GpStatus
+Declare Function GdipClonePen Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef clonepen As *GpPen) As GpStatus
+Declare Function GdipDeletePen Lib "gdiplus.dll" (ByVal pen As *GpPen) As GpStatus
+Declare Function GdipSetPenWidth Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal width As Single) As GpStatus
+Declare Function GdipGetPenWidth Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef width As Single) As GpStatus
+Declare Function GdipSetPenUnit Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal unit As GpUnit) As GpStatus
+Declare Function GdipGetPenUnit Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef unit As GpUnit) As GpStatus
+Declare Function GdipSetPenLineCap197819 Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal startCap As GpLineCap, ByVal endCap As GpLineCap, ByVal dashCap As GpDashCap) As GpStatus
+Declare Function GdipSetPenStartCap Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal startCap As GpLineCap) As GpStatus
+Declare Function GdipSetPenEndCap Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal endCap As GpLineCap) As GpStatus
+Declare Function GdipSetPenDashCap197819 Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal dashCap As GpDashCap) As GpStatus
+Declare Function GdipGetPenStartCap Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef startCap As GpLineCap) As GpStatus
+Declare Function GdipGetPenEndCap Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef endCap As GpLineCap) As GpStatus
+Declare Function GdipGetPenDashCap197819 Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef dashCap As GpDashCap) As GpStatus
+Declare Function GdipSetPenLineJoin Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal lineJoin As GpLineJoin) As GpStatus
+Declare Function GdipGetPenLineJoin Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef lineJoin As GpLineJoin) As GpStatus
+Declare Function GdipSetPenCustomStartCap Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal customCap As *GpCustomLineCap) As GpStatus
+Declare Function GdipGetPenCustomStartCap Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef customCap As *GpCustomLineCap) As GpStatus
+Declare Function GdipSetPenCustomEndCap Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal customCap As *GpCustomLineCap) As GpStatus
+Declare Function GdipGetPenCustomEndCap Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef customCap As *GpCustomLineCap) As GpStatus
+Declare Function GdipSetPenMiterLimit Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal miterLimit As Single) As GpStatus
+Declare Function GdipGetPenMiterLimit Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef miterLimit As Single) As GpStatus
+Declare Function GdipSetPenMode Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal penMode As GpPenAlignment) As GpStatus
+Declare Function GdipGetPenMode Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef penMode As GpPenAlignment) As GpStatus
+Declare Function GdipSetPenTransform Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipGetPenTransform Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipResetPenTransform Lib "gdiplus.dll" (ByVal pen As *GpPen) As GpStatus
+Declare Function GdipMultiplyPenTransform Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal matrix As *GpMatrix, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipTranslatePenTransform Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal dx As Single, ByVal dy As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipScalePenTransform Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal sx As Single, ByVal sy As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipRotatePenTransform Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal angle As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipSetPenColor Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal argb As ARGB) As GpStatus
+Declare Function GdipGetPenColor Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef argb As ARGB) As GpStatus
+Declare Function GdipSetPenBrushFill Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal brush As *GpBrush) As GpStatus
+Declare Function GdipGetPenBrushFill Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef brush As *GpBrush) As GpStatus
+Declare Function GdipGetPenFillType Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef penType As GpPenType) As GpStatus
+Declare Function GdipGetPenDashStyle Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef dashstyle As GpDashStyle) As GpStatus
+Declare Function GdipSetPenDashStyle Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal dashstyle As GpDashStyle) As GpStatus
+Declare Function GdipGetPenDashOffset Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef offset As Single) As GpStatus
+Declare Function GdipSetPenDashOffset Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal offset As Single) As GpStatus
+Declare Function GdipGetPenDashCount Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef count As Long) As GpStatus
+Declare Function GdipSetPenDashArray Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal dash As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipGetPenDashArray Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal dash As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipGetPenCompoundCount Lib "gdiplus.dll" (ByVal pen As *GpPen, ByRef count As Long) As GpStatus
+Declare Function GdipSetPenCompoundArray Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal dash As *Single, ByVal count As Long) As GpStatus
+Declare Function GdipGetPenCompoundArray Lib "gdiplus.dll" (ByVal pen As *GpPen, ByVal dash As *Single, ByVal count As Long) As GpStatus
+
+' CustomLineCap APIs
+Declare Function GdipCreateCustomLineCap Lib "gdiplus.dll" (Byval fillPath As *GpPath, ByVal strokePath As *GpPath, ByVal baseCap As GpLineCap, ByVal baseInset As Single, ByRef customCap As *GpCustomLineCap) As GpStatus
+Declare Function GdipDeleteCustomLineCap Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap) As GpStatus
+Declare Function GdipCloneCustomLineCap Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByRef clonedCap As *GpCustomLineCap) As GpStatus
+Declare Function GdipGetCustomLineCapType Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByVal capType As *CustomLineCapType) As GpStatus
+Declare Function GdipSetCustomLineCapStrokeCaps Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByVal startCap As GpLineCap, ByVal endCap As GpLineCap) As GpStatus
+Declare Function GdipGetCustomLineCapStrokeCaps Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByVal startCap As *GpLineCap, ByVal endCap As *GpLineCap) As GpStatus
+Declare Function GdipSetCustomLineCapStrokeJoin Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByVal lineJoin As GpLineJoin) As GpStatus
+Declare Function GdipGetCustomLineCapStrokeJoin Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByVal lineJoin As *GpLineJoin) As GpStatus
+Declare Function GdipSetCustomLineCapBaseCap Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByVal baseCap As GpLineCap) As GpStatus
+Declare Function GdipGetCustomLineCapBaseCap Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByRef baseCap As GpLineCap) As GpStatus
+Declare Function GdipSetCustomLineCapBaseInset Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByVal inset As Single) As GpStatus
+Declare Function GdipGetCustomLineCapBaseInset Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByRef inset As Single) As GpStatus
+Declare Function GdipSetCustomLineCapWidthScale Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByVal widthScale As Single) As GpStatus
+Declare Function GdipGetCustomLineCapWidthScale Lib "gdiplus.dll" (ByVal customCap As *GpCustomLineCap, ByRef widthScale As Single) As GpStatus
+
+' AdjustableArrowCap APIs
+Declare Function GdipCreateAdjustableArrowCap Lib "gdiplus.dll" (ByVal height As Single, ByVal width As Single, ByVal isFilled As BOOL, ByRef cap As *GpAdjustableArrowCap) As GpStatus
+Declare Function GdipSetAdjustableArrowCapHeight Lib "gdiplus.dll" (ByVal cap As *GpAdjustableArrowCap, ByVal height As Single) As GpStatus
+Declare Function GdipGetAdjustableArrowCapHeight Lib "gdiplus.dll" (ByVal cap As *GpAdjustableArrowCap, ByRef height As Single) As GpStatus
+Declare Function GdipSetAdjustableArrowCapWidth Lib "gdiplus.dll" (ByVal cap As *GpAdjustableArrowCap, ByVal width As Single) As GpStatus
+Declare Function GdipGetAdjustableArrowCapWidth Lib "gdiplus.dll" (ByVal cap As *GpAdjustableArrowCap, ByRef width As Single) As GpStatus
+Declare Function GdipSetAdjustableArrowCapMiddleInset Lib "gdiplus.dll" (ByVal cap As *GpAdjustableArrowCap, ByVal middleInset As Single) As GpStatus
+Declare Function GdipGetAdjustableArrowCapMiddleInset Lib "gdiplus.dll" (ByVal cap As *GpAdjustableArrowCap, ByRef middleInset As Single) As GpStatus
+Declare Function GdipSetAdjustableArrowCapFillState Lib "gdiplus.dll" (ByVal cap As *GpAdjustableArrowCap, ByVal fillState As BOOL) As GpStatus
+Declare Function GdipGetAdjustableArrowCapFillState Lib "gdiplus.dll" (ByVal cap As *GpAdjustableArrowCap, ByRef fillState As BOOL) As GpStatus
+
+' Image APIs
+Declare Function GdipLoadImageFromStream Lib "gdiplus.dll" (ByVal stream As *IStream, ByRef image As *GpImage) As GpStatus
+Declare Function GdipLoadImageFromFile Lib "gdiplus.dll" (ByVal filename As PCWSTR, ByRef image As *GpImage) As GpStatus
+Declare Function GdipLoadImageFromStreamICM Lib "gdiplus.dll" (ByVal stream As *IStream, ByRef image As *GpImage) As GpStatus
+Declare Function GdipLoadImageFromFileICM Lib "gdiplus.dll" (ByVal filename As PCWSTR, ByRef image As *GpImage) As GpStatus
+Declare Function GdipCloneImage Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef cloneImage As *GpImage) As GpStatus
+Declare Function GdipDisposeImage Lib "gdiplus.dll" (ByVal image As *GpImage) As GpStatus
+Declare Function GdipSaveImageToFile Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal filename As PCWSTR, ByRef clsidEncoder As CLSID, ByRef encoderParams As EncoderParameters) As GpStatus
+Declare Function GdipSaveImageToStream Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal stream As *IStream, ByRef clsidEncoder As CLSID, ByRef encoderParams As EncoderParameters) As GpStatus
+Declare Function GdipSaveAdd Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef encoderParams As EncoderParameters) As GpStatus
+Declare Function GdipSaveAddImage Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal newImage As *GpImage, ByRef encoderParams As EncoderParameters) As GpStatus
+Declare Function GdipGetImageGraphicsContext Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef graphics As *GpGraphics) As GpStatus
+Declare Function GdipGetImageBounds Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef srcRect As GpRectF, ByRef srcUnit As GpUnit) As GpStatus
+Declare Function GdipGetImageDimension Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef width As Single, ByRef height As Single) As GpStatus
+Declare Function GdipGetImageType Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef imageType As ImageType) As GpStatus
+Declare Function GdipGetImageWidth Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef width As DWord) As GpStatus
+Declare Function GdipGetImageHeight Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef height As DWord) As GpStatus
+Declare Function GdipGetImageHorizontalResolution Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef resolution As Single) As GpStatus
+Declare Function GdipGetImageVerticalResolution Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef resolution As Single) As GpStatus
+Declare Function GdipGetImageFlags Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef flags As DWord) As GpStatus
+Declare Function GdipGetImageRawFormat Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef format As GUID) As GpStatus
+Declare Function GdipGetImagePixelFormat Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef format As PixelFormat) As GpStatus
+Declare Function GdipGetImageThumbnail Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal thumbWidth As DWord, ByVal thumbHeight As DWord, ByRef thumbImage As *GpImage, ByVal callback As GetThumbnailImageAbort, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipGetEncoderParameterListSize Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef clsidEncoder As CLSID, ByRef size As DWord) As GpStatus
+Declare Function GdipGetEncoderParameterList Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef clsidEncoder As CLSID, ByVal size As DWord, ByRef buffer As EncoderParameters) As GpStatus
+Declare Function GdipImageGetFrameDimensionsCount Lib "gdiplus.dll" (ByRef image As *GpImage, ByRef count As DWord) As GpStatus
+Declare Function GdipImageGetFrameDimensionsList Lib "gdiplus.dll" (ByRef image As *GpImage, ByVal dimensionIDs As GUID, ByVal count As DWord) As GpStatus
+Declare Function GdipImageGetFrameCount Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef dimensionID As GUID, ByRef count As DWord) As GpStatus
+Declare Function GdipImageSelectActiveFrame Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef dimensionID As GUID, ByVal frameIndex As DWord) As GpStatus
+Declare Function GdipImageRotateFlip Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal rfType As RotateFlipType) As GpStatus
+Declare Function GdipGetImagePalette Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef palette As ColorPalette, ByVal size As Long) As GpStatus
+Declare Function GdipSetImagePalette Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal palette As ColorPalette) As GpStatus
+Declare Function GdipGetImagePaletteSize Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef size As Long) As GpStatus
+Declare Function GdipGetPropertyCount Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef numOfProperty As DWord) As GpStatus
+Declare Function GdipGetPropertyIdList Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal numOfProperty As DWord, ByRef list As PROPID) As GpStatus
+Declare Function GdipGetPropertyItemSize Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal propId As PROPID, ByRef size As DWord) As GpStatus
+Declare Function GdipGetPropertyItem Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal propId As PROPID, ByVal propSize As DWord, buffer As *PropertyItem) As GpStatus
+Declare Function GdipGetPropertySize Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef totalBufferSize As DWord, ByRef numProperties As DWord) As GpStatus
+Declare Function GdipGetAllPropertyItems Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal totalBufferSize As DWord, ByVal numProperties As DWord, ByVal allItems As *PropertyItem) As GpStatus
+Declare Function GdipRemovePropertyItem Lib "gdiplus.dll" (ByVal image As *GpImage, ByVal propId As PROPID) As GpStatus
+Declare Function GdipSetPropertyItem Lib "gdiplus.dll" (ByVal image As *GpImage, ByRef item As PropertyItem) As GpStatus
+Declare Function GdipImageForceValidation Lib "gdiplus.dll" (ByVal image As *GpImage) As GpStatus
+
+' Bitmap APIs
+Declare Function GdipCreateBitmapFromStream Lib "gdiplus.dll" (ByVal stream As *IStream, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCreateBitmapFromFile Lib "gdiplus.dll" (ByVal filename As PCWSTR, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCreateBitmapFromStreamICM Lib "gdiplus.dll" (ByVal stream As *IStream, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCreateBitmapFromFileICM Lib "gdiplus.dll" (ByVal filename As PCWSTR, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCreateBitmapFromScan0 Lib "gdiplus.dll" (ByVal width As Long, ByVal height As Long, ByVal stride As Long, ByVal format As PixelFormat, ByVal scan0 As *Byte, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCreateBitmapFromGraphics Lib "gdiplus.dll" (ByVal width As Long,  ByVal height As Long, ByVal target As *GpGraphics, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCreateBitmapFromDirectDrawSurface Lib "gdiplus.dll" (ByVal surface As PDirectDrawSurface7, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCreateBitmapFromGdiDib Lib "gdiplus.dll" (ByRef gdiBitmapInfo As BITMAPINFO, gdiBitmapData As VoidPtr, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCreateBitmapFromHBITMAP Lib "gdiplus.dll" (ByVal hbm As HBITMAP, ByVal hpal As HPALETTE, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCreateHBITMAPFromBitmap Lib "gdiplus.dll" (ByVal bitmap As *GpBitmap, ByRef hbmReturn As HBITMAP, ByVal background As ARGB) As GpStatus
+Declare Function GdipCreateBitmapFromHICON Lib "gdiplus.dll" (ByVal hicon As HICON, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCreateHICONFromBitmap Lib "gdiplus.dll" (ByVal bitmap As *GpBitmap, ByRef hbmReturn As HICON) As GpStatus
+Declare Function GdipCreateBitmapFromResource Lib "gdiplus.dll" (ByVal hInstance As HINSTANCE, ByVal pBitmapName As PCWSTR, ByRef bitmap As *GpBitmap) As GpStatus
+Declare Function GdipCloneBitmapArea Lib "gdiplus.dll" (ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByVal format As PixelFormat, ByVal srcBitmap As *GpBitmap, ByRef dstBitmap As *GpBitmap) As GpStatus
+Declare Function GdipCloneBitmapAreaI Lib "gdiplus.dll" (ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByVal format As PixelFormat, ByVal srcBitmap As *GpBitmap, ByRef dstBitmap As *GpBitmap) As GpStatus
+Declare Function GdipBitmapLockBits Lib "gdiplus.dll" (ByVal bitmap As *GpBitmap, ByRef rect As GpRect, ByVal flags As DWord, ByVal format As PixelFormat, ByVal lockedBitmapData As *BitmapData) As GpStatus
+Declare Function GdipBitmapUnlockBits Lib "gdiplus.dll" (ByVal bitmap As *GpBitmap, ByRef lockedBitmapData As BitmapData) As GpStatus
+Declare Function GdipBitmapGetPixel Lib "gdiplus.dll" (ByVal bitmap As *GpBitmap, ByVal x As Long, ByVal y As Long, ByRef color As ARGB) As GpStatus
+Declare Function GdipBitmapSetPixel Lib "gdiplus.dll" (ByVal bitmap As *GpBitmap, ByVal x As Long, ByVal y As Long, ByVal color As ARGB) As GpStatus
+Declare Function GdipBitmapSetResolution Lib "gdiplus.dll" (ByVal bitmap As *GpBitmap, ByVal xdpi As Single, ByVal ydpi As Single) As GpStatus
+
+' ImageAttributes APIs
+Declare Function GdipCreateImageAttributes Lib "gdiplus.dll" (ByRef imageattr As *GpImageAttributes) As GpStatus
+Declare Function GdipCloneImageAttributes Lib "gdiplus.dll" (ByRef imageattr As GpImageAttributes, ByRef GpImageAttributes As *GpImageAttributes) As GpStatus
+Declare Function GdipDisposeImageAttributes Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes) As GpStatus
+Declare Function GdipSetImageAttributesToIdentity Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal colorAdjustType As ColorAdjustType) As GpStatus
+Declare Function GdipResetImageAttributes Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal colorAdjustType As ColorAdjustType) As GpStatus
+Declare Function GdipSetImageAttributesColorMatrix Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal colorAdjustType As ColorAdjustType, ByVal enableFlag As BOOL, ByRef colorMatrix As *ColorMatrix, ByRef grayMatrix As *ColorMatrix, ByVal flags As ColorMatrixFlag) As GpStatus
+Declare Function GdipSetImageAttributesThreshold Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal colorAdjustType As ColorAdjustType, ByVal enableFlag As BOOL, ByVal threshold As Single) As GpStatus
+Declare Function GdipSetImageAttributesGamma Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal colorAdjustType As ColorAdjustType, ByVal enableFlag As BOOL, ByVal gamma As Single) As GpStatus
+Declare Function GdipSetImageAttributesNoOp Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal colorAdjustType As ColorAdjustType, ByVal enableFlag As BOOL) As GpStatus
+Declare Function GdipSetImageAttributesColorKeys Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal colorAdjustType As ColorAdjustType, ByVal enableFlag As BOOL,  ByVal colorLow As ARGB, ByVal colorHigh As ARGB) As GpStatus
+Declare Function GdipSetImageAttributesOutputChannel Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal colorAdjustType As ColorAdjustType, ByVal enableFlag As BOOL, ByVal channelFlags As ColorChannelFlags) As GpStatus
+Declare Function GdipSetImageAttributesOutputChannelColorProfile Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal colorAdjustType As ColorAdjustType, ByVal enableFlag As BOOL, ByVal colorProfileFilename As PCWSTR) As GpStatus
+Declare Function GdipSetImageAttributesRemapTable Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal colorAdjustType As ColorAdjustType, ByVal enableFlag As BOOL, ByVal mapSize As DWord, ByRef map As ColorMap) As GpStatus
+Declare Function GdipSetImageAttributesWrapMode Lib "gdiplus.dll" (ByVal imageAttr As *GpImageAttributes, ByVal wrap As WrapMode, ByVal argb As ARGB, ByVal clamp As BOOL) As GpStatus
+Declare Function GdipSetImageAttributesICMMode Lib "gdiplus.dll" (ByVal imageAttr As *GpImageAttributes, ByRef on As BOOL) As GpStatus
+Declare Function GdipGetImageAttributesAdjustedPalette Lib "gdiplus.dll" (ByVal imageAttr As *GpImageAttributes, ByRef colorPalette As ColorPalette, ByVal colorAdjustType As ColorAdjustType) As GpStatus
+
+' Graphics APIs
+Declare Function GdipFlush Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal intention As GpFlushIntention) As GpStatus
+Declare Function GdipCreateFromHDC Lib "gdiplus.dll" (ByVal hdc As HDC, ByRef graphics As *GpGraphics) As GpStatus
+Declare Function GdipCreateFromHDC2 Lib "gdiplus.dll" (ByVal hdc As HDC, ByVal hDevice As HANDLE, ByRef graphics As *GpGraphics) As GpStatus
+Declare Function GdipCreateFromHWND Lib "gdiplus.dll" (ByVal hwnd As HWND, ByRef graphics As *GpGraphics) As GpStatus
+Declare Function GdipCreateFromHWNDICM Lib "gdiplus.dll" (ByVal hwnd As HWND, ByRef graphics As *GpGraphics) As GpStatus
+Declare Function GdipDeleteGraphics Lib "gdiplus.dll" (ByVal graphics As *GpGraphics) As GpStatus
+Declare Function GdipGetDC Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef hdc As HDC) As GpStatus
+Declare Function GdipReleaseDC Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal hdc As HDC) As GpStatus
+Declare Function GdipSetCompositingMode Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal compositingMode As CompositingMode) As GpStatus
+Declare Function GdipGetCompositingMode Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef compositingMode As CompositingMode) As GpStatus
+Declare Function GdipSetRenderingOrigin Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal x As Long, ByVal y As Long) As GpStatus
+Declare Function GdipGetRenderingOrigin Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef x As Long, ByRef y As Long) As GpStatus
+Declare Function GdipSetCompositingQuality Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal compositingQuality As CompositingQuality) As GpStatus
+Declare Function GdipGetCompositingQuality Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef compositingQuality As CompositingQuality) As GpStatus
+Declare Function GdipSetSmoothingMode Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal smoothingMode As SmoothingMode) As GpStatus
+Declare Function GdipGetSmoothingMode Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef smoothingMode As SmoothingMode) As GpStatus
+Declare Function GdipSetPixelOffsetMode Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pixelOffsetMode As PixelOffsetMode) As GpStatus
+Declare Function GdipGetPixelOffsetMode Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef pixelOffsetMode As PixelOffsetMode) As GpStatus
+Declare Function GdipSetTextRenderingHint Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal mode As TextRenderingHint) As GpStatus
+Declare Function GdipGetTextRenderingHint Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef mode As TextRenderingHint) As GpStatus
+Declare Function GdipSetTextContrast Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal contrast As DWord) As GpStatus
+Declare Function GdipGetTextContrast Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef contrast As DWord) As GpStatus
+Declare Function GdipSetInterpolationMode Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal interpolationMode As InterpolationMode) As GpStatus
+Declare Function GdipGetInterpolationMode Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef interpolationMode As InterpolationMode) As GpStatus
+Declare Function GdipSetWorldTransform Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipResetWorldTransform Lib "gdiplus.dll" (ByVal graphics As *GpGraphics) As GpStatus
+Declare Function GdipMultiplyWorldTransform Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal matrix As *GpMatrix, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipTranslateWorldTransform Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal dx As Single, ByVal dy As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipScaleWorldTransform Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal sx As Single, ByVal sy As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipRotateWorldTransform Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal angle As Single, ByVal order As GpMatrixOrder) As GpStatus
+Declare Function GdipGetWorldTransform Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipResetPageTransform Lib "gdiplus.dll" (ByVal graphics As *GpGraphics) As GpStatus
+Declare Function GdipGetPageUnit Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef unit As GpUnit) As GpStatus
+Declare Function GdipGetPageScale Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef scale As Single) As GpStatus
+Declare Function GdipSetPageUnit Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal unit As GpUnit) As GpStatus
+Declare Function GdipSetPageScale Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal scale As Single) As GpStatus
+Declare Function GdipGetDpiX Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef dpi As Single) As GpStatus
+Declare Function GdipGetDpiY Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef dpi As Single) As GpStatus
+Declare Function GdipTransformPoints Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal destSpace As GpCoordinateSpace, ByVal srcSpace As GpCoordinateSpace, ByVal points As *PointF, ByVal count As Long) As GpStatus
+Declare Function GdipTransformPointsI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal destSpace As GpCoordinateSpace, ByVal srcSpace As GpCoordinateSpace, ByVal points As *Point, ByVal count As Long) As GpStatus
+Declare Function GdipGetNearestColor Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef argb As ARGB) As GpStatus
+' Creates the Win9x Halftone Palette (even on NT) with correct Desktop colors
+Declare Function GdipCreateHalftonePalette Lib "gdiplus.dll" () As HPALETTE
+Declare Function GdipDrawLine Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single) As GpStatus
+Declare Function GdipDrawLineI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As GpStatus
+Declare Function GdipDrawLines Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipDrawLinesI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipDrawArc Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
+Declare Function GdipDrawArcI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
+Declare Function GdipDrawBezier Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single, ByVal x3 As Single, ByVal y3 As Single, ByVal x4 As Single, ByVal y4 As Single) As GpStatus
+Declare Function GdipDrawBezierI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long, ByVal x3 As Long, ByVal y3 As Long, ByVal x4 As Long, ByVal y4 As Long) As GpStatus
+Declare Function GdipDrawBeziers Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipDrawBeziersI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipDrawRectangle Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single) As GpStatus
+Declare Function GdipDrawRectangleI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long) As GpStatus
+Declare Function GdipDrawRectangles Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal rects As *GpRectF, ByVal count As Long) As GpStatus
+Declare Function GdipDrawRectanglesI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal rects As *GpRect, ByVal count As Long) As GpStatus
+Declare Function GdipDrawEllipse Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single) As GpStatus
+Declare Function GdipDrawEllipseI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long) As GpStatus
+Declare Function GdipDrawPie Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
+Declare Function GdipDrawPieI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
+Declare Function GdipDrawPolygon Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipDrawPolygonI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipDrawPath Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal path As *GpPath) As GpStatus
+Declare Function GdipDrawCurve Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipDrawCurveI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipDrawCurve2 Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPointF, ByVal count As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipDrawCurve2I Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPoint, ByVal count As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipDrawCurve3 Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPointF, ByVal count As Long, ByVal offset As Long, ByVal numberOfSegments As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipDrawCurve3I Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPoint, ByVal count As Long, ByVal offset As Long, ByVal numberOfSegments As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipDrawClosedCurve Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipDrawClosedCurveI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipDrawClosedCurve2 Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPointF, ByVal count As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipDrawClosedCurve2I Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal pen As *GpPen, ByVal points As *GpPoint, ByVal count As Long, ByVal tension As Single) As GpStatus
+Declare Function GdipGraphicsClear Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal color As ARGB) As GpStatus
+Declare Function GdipFillRectangle Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single) As GpStatus
+Declare Function GdipFillRectangleI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long) As GpStatus
+Declare Function GdipFillRectangles Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal rects As *GpRectF, ByVal count As Long) As GpStatus
+Declare Function GdipFillRectanglesI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal rects As *GpRect, ByVal count As Long) As GpStatus
+Declare Function GdipFillPolygon Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal points As *GpPointF, ByVal count As Long, ByVal fillMode As GpFillMode) As GpStatus
+Declare Function GdipFillPolygonI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal points As *GpPoint, ByVal count As Long, ByVal fillMode As GpFillMode) As GpStatus
+Declare Function GdipFillPolygon2 Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipFillPolygon2I Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipFillEllipse Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single) As GpStatus
+Declare Function GdipFillEllipseI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long) As GpStatus
+Declare Function GdipFillPie Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
+Declare Function GdipFillPieI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
+Declare Function GdipFillPath Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal path As *GpPath) As GpStatus
+Declare Function GdipFillClosedCurve Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal points As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipFillClosedCurveI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal points As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipFillClosedCurve2 Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal points As *GpPointF, ByVal count As Long, ByVal tension As Single, ByVal fillMode As GpFillMode) As GpStatus
+Declare Function GdipFillClosedCurve2I Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal points As *GpPoint, ByVal count As Long, ByVal tension As Single, ByVal fillMode As GpFillMode) As GpStatus
+Declare Function GdipFillRegion Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal brush As *GpBrush, ByVal region As *GpRegion) As GpStatus
+Declare Function GdipDrawImage Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal x As Single, ByVal y As Single) As GpStatus
+Declare Function GdipDrawImageI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal x As Long, ByVal y As Long) As GpStatus
+Declare Function GdipDrawImageRect Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single) As GpStatus
+Declare Function GdipDrawImageRectI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long) As GpStatus
+Declare Function GdipDrawImagePoints Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal dstpoints As *GpPointF, ByVal count As Long) As GpStatus
+Declare Function GdipDrawImagePointsI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal dstpoints As *GpPoint, ByVal count As Long) As GpStatus
+Declare Function GdipDrawImagePointRect Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal x As Single, ByVal y As Single, ByVal srcx As Single, ByVal srcy As Single, ByVal srcwidth As Single, ByVal srcheight As Single, ByVal srcUnit As GpUnit) As GpStatus
+Declare Function GdipDrawImagePointRectI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal x As Long, ByVal y As Long, ByVal srcx As Long, ByVal srcy As Long, ByVal srcwidth As Long, ByVal srcheight As Long, ByVal srcUnit As GpUnit) As GpStatus
+Declare Function GdipDrawImageRectRect Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal dstx As Single, ByVal dsty As Single, ByVal dstwidth As Single, ByVal dstheight As Single, ByVal srcx As Single, ByVal srcy As Single, ByVal srcwidth As Single, ByVal srcheight As Single, ByVal srcUnit As GpUnit, ByVal imageAttributes As GpImageAttributes, ByVal callback As DrawImageAbort, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipDrawImageRectRectI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal dstx As Long, ByVal dsty As Long, ByVal dstwidth As Long, ByVal dstheight As Long, ByVal srcx As Long, ByVal srcy As Long, ByVal srcwidth As Long, ByVal srcheight As Long, ByVal srcUnit As GpUnit, ByVal imageAttributes As GpImageAttributes, ByVal callback As DrawImageAbort, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipDrawImagePointsRect Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal points As *GpPointF, ByVal count As Long, ByVal srcx As Single, ByVal srcy As Single, ByVal srcwidth As Single, ByVal srcheight As Single, ByVal srcUnit As GpUnit, ByVal imageAttributes As GpImageAttributes, ByVal callback As DrawImageAbort, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipDrawImagePointsRectI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal image As *GpImage, ByVal points As *GpPoint, ByVal count As Long, ByVal srcx As Long, ByVal srcy As Long, ByVal srcwidth As Long, ByVal srcheight As Long, ByVal srcUnit As GpUnit, ByVal imageAttributes As GpImageAttributes, ByVal callback As DrawImageAbort, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileDestPoint Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByRef destPoint As PointF, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileDestPointI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByRef destPoint As Point, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileDestRect Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByRef destRect As GpRectF, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileDestRectI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByRef destRect As GpRect, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileDestPoints Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByVal destPoints As *PointF, ByVal count As Long, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileDestPointsI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByVal destPoints As *Point, ByVal count As Long, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileSrcRectDestPoint Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByRef destPoint As PointF, ByRef srcRect As GpRectF, ByVal srcUnit As GraphicsUnit, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileSrcRectDestPointI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByRef destPoint As Point, ByRef srcRect As GpRect, ByVal srcUnit As GraphicsUnit, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileSrcRectDestRect Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByRef destRect As GpRectF, ByRef srcRect As GpRectF, ByVal srcUnit As GraphicsUnit, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileSrcRectDestRectI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByRef destRect As GpRect, ByRef srcRect As GpRect, ByVal srcUnit As GraphicsUnit, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileSrcRectDestPoints Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByVal destPoints As *PointF, ByVal count As Long, ByRef srcRect As GpRectF, ByVal srcUnit As GraphicsUnit, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipEnumerateMetafileSrcRectDestPointsI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal metafile As GpMetafile, ByVal destPoints As *Point, ByVal count As Long, ByRef srcRect As GpRect, ByVal srcUnit As GraphicsUnit, ByVal callback As EnumerateMetafileProc, ByVal callbackData As VoidPtr, ByVal callbackData As VoidPtr) As GpStatus
+Declare Function GdipPlayMetafileRecord Lib "gdiplus.dll" (ByVal metafile As GpMetafile, ByVal recordType As EmfPlusRecordType, ByVal flags As DWord, dataSize As DWord, ByVal data As *Byte) As GpStatus
+Declare Function GdipSetClipGraphics Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal srcgraphics As *GpGraphics, ByVal combineMode As CombineMode) As GpStatus
+Declare Function GdipSetClipRect Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByVal combineMode As CombineMode) As GpStatus
+Declare Function GdipSetClipRectI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByVal combineMode As CombineMode) As GpStatus
+Declare Function GdipSetClipPath Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal path As *GpPath, ByVal combineMode As CombineMode) As GpStatus
+Declare Function GdipSetClipRegion Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal region As *GpRegion, ByVal combineMode As CombineMode) As GpStatus
+Declare Function GdipSetClipHrgn Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal hRgn As HRGN, ByVal combineMode As CombineMode) As GpStatus
+Declare Function GdipResetClip Lib "gdiplus.dll" (ByVal graphics As *GpGraphics) As GpStatus
+Declare Function GdipTranslateClip Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal dx As Single, ByVal dy As Single) As GpStatus
+Declare Function GdipTranslateClipI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal dx As Long, ByVal dy As Long) As GpStatus
+Declare Function GdipGetClip Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal region As *GpRegion) As GpStatus
+Declare Function GdipGetClipBounds Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef rect As GpRectF) As GpStatus
+Declare Function GdipGetClipBoundsI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef rect As GpRect) As GpStatus
+Declare Function GdipIsClipEmpty Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipGetVisibleClipBounds Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef rect As GpRectF) As GpStatus
+Declare Function GdipGetVisibleClipBoundsI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef rect As GpRect) As GpStatus
+Declare Function GdipIsVisibleClipEmpty Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsVisiblePoint Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal x As Single, ByVal y As Single, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsVisiblePointI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal x As Long, ByVal y As Long, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsVisibleRect Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single, ByRef result As BOOL) As GpStatus
+Declare Function GdipIsVisibleRectI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByRef result As BOOL) As GpStatus
+Declare Function GdipSaveGraphics Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal state As GraphicsState) As GpStatus
+Declare Function GdipRestoreGraphics Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal state As GraphicsState) As GpStatus
+Declare Function GdipBeginContainer Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal dstrect As *GpRectF, ByVal srcrect As *GpRectF, ByVal unit As GpUnit, ByVal state As *GraphicsContainer) As GpStatus
+Declare Function GdipBeginContainerI Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal dstrect As *GpRect, ByVal srcrect As *GpRect, ByVal unit As GpUnit, ByVal state As *GraphicsContainer) As GpStatus
+Declare Function GdipBeginContainer2 Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal state As *GraphicsContainer) As GpStatus
+Declare Function GdipEndContainer Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal state As *GraphicsContainer) As GpStatus
+Declare Function GdipGetMetafileHeaderFromWmf Lib "gdiplus.dll" (ByVal hWmf As HMETAFILE, ByRef wmfPlaceableFileHeader As WmfPlaceableFileHeader, ByRef header As MetafileHeader) As GpStatus
+Declare Function GdipGetMetafileHeaderFromEmf Lib "gdiplus.dll" (ByVal hEmf As HENHMETAFILE, ByRef header As MetafileHeader) As GpStatus
+Declare Function GdipGetMetafileHeaderFromFile Lib "gdiplus.dll" (ByVal filename As PCWSTR, ByRef header As MetafileHeader) As GpStatus
+Declare Function GdipGetMetafileHeaderFromStream Lib "gdiplus.dll" (ByVal stream As *IStream, ByRef header As MetafileHeader) As GpStatus
+Declare Function GdipGetMetafileHeaderFromMetafile Lib "gdiplus.dll" (ByVal metafile As *GpMetafile, ByRef header As MetafileHeader) As GpStatus
+Declare Function GdipGetHemfFromMetafile Lib "gdiplus.dll" (ByVal metafile As *GpMetafile, ByRef hEmf As HENHMETAFILE) As GpStatus
+Declare Function GdipCreateStreamOnFile Lib "gdiplus.dll" (ByVal filename As PCWSTR, ByVal access As DWord, ByRef stream As *IStream) As GpStatus
+Declare Function GdipCreateMetafileFromWmf Lib "gdiplus.dll" (ByVal hWmf As HMETAFILE, ByVal deleteWmf As BOOL, ByRef wmfPlaceableFileHeader As WmfPlaceableFileHeader, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipCreateMetafileFromEmf Lib "gdiplus.dll" (ByVal hEmf As HENHMETAFILE, ByVal deleteEmf As BOOL, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipCreateMetafileFromFile Lib "gdiplus.dll" (ByVal filename As PCWSTR, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipCreateMetafileFromWmfFile Lib "gdiplus.dll" (ByVal filename As PCWSTR, ByRef wmfPlaceableFileHeader As WmfPlaceableFileHeader, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipCreateMetafileFromStream Lib "gdiplus.dll" (ByVal stream As *IStream, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipRecordMetafile Lib "gdiplus.dll" (ByVal referenceHdc As HDC, ByVal emfType As EmfType, ByRef frameRect As GpRectF, ByVal frameUnit As MetafileFrameUnit, ByVal description As PCWSTR, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipRecordMetafileI Lib "gdiplus.dll" (ByVal referenceHdc As HDC, ByVal emfType As EmfType, ByRef frameRect As GpRectF, ByVal frameUnit As MetafileFrameUnit, ByVal description As PCWSTR, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipRecordMetafileFileName Lib "gdiplus.dll" (ByVal filename As PCWSTR, ByVal referenceHdc As HDC, ByVal emfType As EmfType, ByRef frameRect As GpRectF, ByVal frameUnit As MetafileFrameUnit, ByVal description As PCWSTR, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipRecordMetafileFileNameI Lib "gdiplus.dll" (ByVal filename As PCWSTR, ByVal referenceHdc As HDC, ByVal emfType As EmfType,ByRef frameRect As GpRectF, ByVal frameUnit As MetafileFrameUnit, ByVal description As PCWSTR, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipRecordMetafileStream Lib "gdiplus.dll" (ByVal stream As *IStream, ByVal referenceHdc As HDC, ByVal emfType As EmfType, ByRef frameRect As GpRectF, ByVal frameUnit As MetafileFrameUnit, ByVal description As PCWSTR, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipRecordMetafileStreamI Lib "gdiplus.dll" (ByVal stream As *IStream, ByVal referenceHdc As HDC, ByVal emfType As EmfType, ByRef frameRect As GpRectF, ByVal frameUnit As MetafileFrameUnit, ByVal description As PCWSTR, ByRef metafile As *GpMetafile) As GpStatus
+Declare Function GdipSetMetafileDownLevelRasterizationLimit Lib "gdiplus.dll" (ByVal metafile As *GpMetafile, ByVal metafileRasterizationLimitDpi As DWord) As GpStatus
+Declare Function GdipGetMetafileDownLevelRasterizationLimit Lib "gdiplus.dll" (ByVal metafile As *GpMetafile, ByRef metafileRasterizationLimitDpi As DWord) As GpStatus
+Declare Function GdipGetImageDecodersSize Lib "gdiplus.dll" (ByRef numDecoders As DWord, ByRef size As DWord) As GpStatus
+Declare Function GdipGetImageDecoders Lib "gdiplus.dll" (ByVal numDecoders As DWord, ByVal size As DWord, ByVal decoders As *ImageCodecInfo) As GpStatus
+Declare Function GdipGetImageEncodersSize Lib "gdiplus.dll" (ByRef numDecoders As DWord, ByRef size As DWord) As GpStatus
+Declare Function GdipGetImageEncoders Lib "gdiplus.dll" (ByVal numEncoders As DWord, ByVal size As DWord, ByVal encoderss As *ImageCodecInfo) As GpStatus
+Declare Function GdipComment Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal sizeData As DWord, ByVal data As *Byte) As GpStatus
+
+' FontFamily APIs
+Declare Function GdipCreateFontFamilyFromName Lib "gdiplus.dll" (ByVal name As *WCHAR, ByVal fontCollection As *GpFontCollection, ByRef FontFamily As *GpFontFamily) As GpStatus
+Declare Function GdipDeleteFontFamily Lib "gdiplus.dll" (ByVal FontFamily As *GpFontFamily) As GpStatus
+Declare Function GdipCloneFontFamily Lib "gdiplus.dll" (ByVal FontFamily As *GpFontFamily, ByRef clonedFontFamily As *GpFontFamily) As GpStatus
+Declare Function GdipGetGenericFontFamilySansSerif Lib "gdiplus.dll" (ByRef nativeFamily As *GpFontFamily) As GpStatus
+Declare Function GdipGetGenericFontFamilySerif Lib "gdiplus.dll" (ByRef nativeFamily As *GpFontFamily) As GpStatus
+Declare Function GdipGetGenericFontFamilyMonospace Lib "gdiplus.dll" (ByRef nativeFamily As *GpFontFamily) As GpStatus
+Declare Function GdipGetFamilyName Lib "gdiplus.dll" (ByVal family As *GpFontFamily, ByVal name As PWSTR, ByVal language As LANGID) As GpStatus ' ByRef name[LF_FACESIZE] As WCHAR
+Declare Function GdipIsStyleAvailable Lib "gdiplus.dll" (ByVal family As *GpFontFamily, ByVal style As Long, ByRef IsStyleAvailable As BOOL) As GpStatus
+Declare Function GdipFontCollectionEnumerable Lib "gdiplus.dll" (ByVal fontCollection As *GpFontCollection, ByVal graphics As *GpGraphics, ByRef numFound As Long) As GpStatus
+Declare Function GdipFontCollectionEnumerate Lib "gdiplus.dll" (ByVal fontCollection As *GpFontCollection, ByVal numSought As Long, ByVal gpfamilies As **GpFontFamily, ByRef numFound As Long, ByVal graphics As *GpGraphics) As GpStatus
+Declare Function GdipGetEmHeight Lib "gdiplus.dll" (ByVal family As *GpFontFamily, ByVal style As Long, ByRef EmHeight As Word) As GpStatus
+Declare Function GdipGetCellAscent Lib "gdiplus.dll" (ByVal family As *GpFontFamily, ByVal style As Long, ByRef CellAscent As Word) As GpStatus
+Declare Function GdipGetCellDescent Lib "gdiplus.dll" (ByVal family As *GpFontFamily, ByVal style As Long, ByRef CellDescent As Word) As GpStatus
+Declare Function GdipGetLineSpacing Lib "gdiplus.dll" (ByVal family As *GpFontFamily, ByVal style As Long, ByRef LineSpacing As Word) As GpStatus
+
+' Font APIs
+Declare Function GdipCreateFontFromDC Lib "gdiplus.dll" (ByVal hdc As HDC, ByRef font As *GpFont) As GpStatus
+Declare Function GdipCreateFontFromLogfontA Lib "gdiplus.dll" (ByVal hdc As HDC, ByRef logfont As LOGFONTA, ByRef font As *GpFont) As GpStatus
+Declare Function GdipCreateFontFromLogfontW Lib "gdiplus.dll" (ByVal hdc As HDC, ByRef logfont As LOGFONTW, ByRef font As *GpFont) As GpStatus
+Declare Function GdipCreateFont Lib "gdiplus.dll" (ByVal fontFamily As *GpFontFamily, ByVal emSize As Single, ByVal style As Long, ByVal unit As GraphicsUnit, ByRef font As *GpFont) As GpStatus
+Declare Function GdipCloneFont Lib "gdiplus.dll" (ByVal font As *GpFont, ByRef cloneFont As *GpFont) As GpStatus
+Declare Function GdipDeleteFont Lib "gdiplus.dll" (ByVal font As *GpFont) As GpStatus
+Declare Function GdipGetFamily Lib "gdiplus.dll" (ByVal font As *GpFont, ByRef family As *GpFontFamily) As GpStatus
+Declare Function GdipGetFontStyle Lib "gdiplus.dll" (ByVal font As *GpFont, ByRef style As Long) As GpStatus
+Declare Function GdipGetFontSize Lib "gdiplus.dll" (ByVal font As *GpFont, ByRef size As Single) As GpStatus
+Declare Function GdipGetFontUnit Lib "gdiplus.dll" (ByVal font As *GpFont, ByRef unit As GraphicsUnit) As GpStatus
+Declare Function GdipGetFontHeight Lib "gdiplus.dll" (ByVal font As *GpFont, ByVal graphics As *GpGraphics, ByRef height As Single) As GpStatus
+Declare Function GdipGetFontHeightGivenDPI Lib "gdiplus.dll" (ByVal font As *GpFont, ByVal dpi As Single, ByRef height As Single) As GpStatus
+Declare Function GdipGetLogFontA Lib "gdiplus.dll" (ByVal font As *GpFont, ByVal graphics As *GpGraphics, ByRef logfontA As LOGFONTA) As GpStatus
+Declare Function GdipGetLogFontW Lib "gdiplus.dll" (ByVal font As *GpFont, ByVal graphics As *GpGraphics, ByRef logfontW As LOGFONTW) As GpStatus
+Declare Function GdipNewInstalledFontCollection Lib "gdiplus.dll" (ByRef fontCollection As *GpFontCollection) As GpStatus
+Declare Function GdipNewPrivateFontCollection Lib "gdiplus.dll" (ByRef fontCollection As *GpFontCollection) As GpStatus
+Declare Function GdipDeletePrivateFontCollection Lib "gdiplus.dll" (ByRef fontCollection As *GpFontCollection) As GpStatus
+Declare Function GdipGetFontCollectionFamilyCount Lib "gdiplus.dll" (ByVal fontCollection As *GpFontCollection, ByRef numFound As Long) As GpStatus
+Declare Function GdipGetFontCollectionFamilyList Lib "gdiplus.dll" (ByVal fontCollection As *GpFontCollection, ByVal numSought As Long, ByVal gpfamilies As **GpFontFamily, ByRef numFound As Long) As GpStatus
+Declare Function GdipPrivateAddFontFile Lib "gdiplus.dll" (ByVal fontCollection As *GpFontCollection, ByVal filename As PCWSTR) As GpStatus
+Declare Function GdipPrivateAddMemoryFont Lib "gdiplus.dll" (ByVal fontCollection As *GpFontCollection, ByVal memory As VoidPtr, ByVal length As Long) As GpStatus
+
+' Text APIs
+Declare Function GdipDrawString Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal string As PCWSTR, ByVal length As Long, font As *GpFont, ByRef layoutRect As GpRectF, ByVal stringFormat As *GpStringFormat, ByVal brush As *GpBrush) As GpStatus
+Declare Function GdipMeasureString Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal string As PCWSTR, ByVal length As Long, ByVal font As *GpFont, ByRef layoutRect As GpRectF, ByVal stringFormat As *GpStringFormat, ByRef boundingBox As GpRectF, ByRef codepointsFitted As Long, ByRef linesFilled As Long) As GpStatus
+Declare Function GdipMeasureCharacterRanges Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal str As PCWSTR, ByVal length As Long, ByVal font As *GpFont, ByRef layoutRect As GpRectF, ByVal stringFormat As *GpStringFormat, ByVal regionCount As Long, ByRef regions As *GpRegion) As GpStatus
+Declare Function GdipDrawDriverString Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal text As *Word, ByVal length As Long, ByVal font As *GpFont, ByVal brush As *GpBrush, ByVal positions As *PointF, ByVal flags As Long, ByVal matrix As *GpMatrix) As GpStatus
+Declare Function GdipMeasureDriverString Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal text As *Word, ByVal length As Long, ByVal font As *GpFont, ByVal positions As *PointF, ByVal flags As Long, ByVal matrix As *GpMatrix, ByRef boundingBox As GpRectF) As GpStatus
+
+' String format APIs
+Declare Function GdipCreateStringFormat Lib "gdiplus.dll" (ByVal formatAttributes As Long, ByVal language As LANGID, ByRef format As *GpStringFormat) As GpStatus
+Declare Function GdipStringFormatGetGenericDefault Lib "gdiplus.dll" (ByRef format As *GpStringFormat) As GpStatus
+Declare Function GdipStringFormatGetGenericTypographic Lib "gdiplus.dll" (ByRef format As *GpStringFormat) As GpStatus
+Declare Function GdipDeleteStringFormat Lib "gdiplus.dll" (ByVal format As *GpStringFormat) As GpStatus
+Declare Function GdipCloneStringFormat Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByRef newFormat As *GpStringFormat) As GpStatus
+Declare Function GdipSetStringFormatFlags Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByVal flags As Long) As GpStatus
+Declare Function GdipGetStringFormatFlags Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByRef flags As Long) As GpStatus
+Declare Function GdipSetStringFormatAlign Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByVal align As StringAlignment) As GpStatus
+Declare Function GdipGetStringFormatAlign Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByRef align As StringAlignment) As GpStatus
+Declare Function GdipSetStringFormatLineAlign Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByVal align As StringAlignment) As GpStatus
+Declare Function GdipGetStringFormatLineAlign Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByRef align As StringAlignment) As GpStatus
+Declare Function GdipSetStringFormatTrimming Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByVal trimming As StringTrimming) As GpStatus
+Declare Function GdipGetStringFormatTrimming Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByRef trimming As StringTrimming) As GpStatus
+Declare Function GdipSetStringFormatHotkeyPrefix Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByVal hotkeyPrefix As Long) As GpStatus
+Declare Function GdipGetStringFormatHotkeyPrefix Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByRef hotkeyPrefix As Long) As GpStatus
+Declare Function GdipSetStringFormatTabStops Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByVal firstTabOffset As Single, ByVal count As Long, ByVal tabStops As *Single) As GpStatus
+Declare Function GdipGetStringFormatTabStops Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByVal count As Long, ByRef firstTabOffset As Single, ByVal tabStops As *Single) As GpStatus
+Declare Function GdipGetStringFormatTabStopCount Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByRef count As Long) As GpStatus
+Declare Function GdipSetStringFormatDigitSubstitution Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByVal language As LANGID, ByVal substitute As StringDigitSubstitute) As GpStatus
+Declare Function GdipGetStringFormatDigitSubstitution Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByRef language As LANGID, ByRef substitute As StringDigitSubstitute) As GpStatus
+Declare Function GdipGetStringFormatMeasurableCharacterRangeCount Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByRef count As Long) As GpStatus
+Declare Function GdipSetStringFormatMeasurableCharacterRanges Lib "gdiplus.dll" (ByVal format As *GpStringFormat, ByVal rangeCount As Long, ByVal ranges As *CharacterRange) As GpStatus
+
+' Cached Bitmap APIs
+Declare Function GdipCreateCachedBitmap Lib "gdiplus.dll" (ByVal bitmap As *GpBitmap, ByVal graphics As *GpGraphics, ByRef cachedBitmap As *GpCachedBitmap) As GpStatus
+Declare Function GdipDeleteCachedBitmap Lib "gdiplus.dll" (ByVal cachedBitmap As *GpCachedBitmap) As GpStatus
+Declare Function GdipDrawCachedBitmap Lib "gdiplus.dll" (ByVal graphics As *GpGraphics, ByVal cachedBitmap As *GpCachedBitmap, ByVal x As Long, ByVal y As Long) As GpStatus
+Declare Function GdipEmfToWmfBits Lib "gdiplus.dll" (ByVal hemf As HENHMETAFILE, ByVal cbData16 As DWord, ByVal pData16 As *Byte, ByVal iMapMode As Long, ByVal eFlags As Long) As DWord
+Declare Function GdipSetImageAttributesCachedBackground Lib "gdiplus.dll" (ByVal imageattr As *GpImageAttributes, ByVal enableFlag As BOOL) As GpStatus
+Declare Function GdipTestControl Lib "gdiplus.dll" (ByVal control As GpTestControlEnum, ByVal param As VoidPtr) As GpStatus
+Declare Function  GdiplusNotificationHook Lib "gdiplus.dll" (ByRef token As ULONG_PTR) As GpStatus
+Declare Sub GdiplusNotificationUnhook Lib "gdiplus.dll" (ByVal token As ULONG_PTR)
Index: /trunk/ab5.0/ablib/src/GdiPlusGpStubs.ab
===================================================================
--- /trunk/ab5.0/ablib/src/GdiPlusGpStubs.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/GdiPlusGpStubs.ab	(revision 506)
@@ -0,0 +1,97 @@
+' GdiplusGpStubs.ab
+
+#require <Classes/System/Drawing/Drawing2D/misc.ab>
+#require <Classes/System/Drawing/Drawing2D/Matrix.ab>
+
+Class GpGraphics
+End Class
+
+Class GpBrush
+End Class
+Class GpTexture
+	Inherits GpBrush
+End Class
+Class GpSolidFill
+	Inherits GpBrush
+End Class
+Class GpLineGradient
+	Inherits GpBrush
+End Class
+Class GpPathGradient
+	Inherits GpBrush
+End Class
+Class GpHatch
+	Inherits GpBrush
+End Class
+
+Class GpPen
+End Class
+Class GpCustomLineCap
+End Class
+Class GpAdjustableArrowCap
+	Inherits GpCustomLineCap
+End Class
+
+Class GpImage
+End Class
+Class GpBitmap
+	Inherits GpImage
+End Class
+Class GpMetafile
+	Inherits GpImage
+End Class
+Class GpImageAttributes
+End Class
+
+Class GpPath
+End Class
+Class GpRegion
+End Class
+Class GpPathIterator
+End Class
+
+Class GpFontFamily
+End Class
+Class GpFont
+End Class
+Class GpStringFormat
+End Class
+Class GpFontCollection
+End Class
+Class GpInstalledFontCollection
+	Inherits GpFontCollection
+End Class
+Class GpPrivateFontCollection
+	Inherits GpFontCollection
+End Class
+
+'Class GpCachedBitmap;
+Class GpCachedBitmap
+End Class
+
+TypeDef GpStatus = Status
+TypeDef GpFillMode = FillMode
+TypeDef GpWrapMode = WrapMode
+TypeDef GpUnit = GraphicsUnit
+TypeDef GpCoordinateSpace = CoordinateSpace
+TypeDef GpPointF = System.Drawing.PointF
+TypeDef GpPoint = System.Drawing.Point
+TypeDef GpRectF = System.Drawing.RectangleF
+TypeDef GpRect = System.Drawing.Rectangle
+TypeDef GpSizeF = System.Drawing.SizeF
+TypeDef GpHatchStyle = HatchStyle
+TypeDef GpDashStyle = DashStyle
+TypeDef GpLineCap = LineCap
+TypeDef GpDashCap = DashCap
+
+
+TypeDef GpPenAlignment = PenAlignment
+
+TypeDef GpLineJoin = LineJoin
+TypeDef GpPenType = PenType
+
+TypeDef GpMatrix = Matrix
+TypeDef GpBrushType = BrushType
+TypeDef GpMatrixOrder = MatrixOrder
+TypeDef GpFlushIntention = FlushIntention
+TypeDef GpPathData = PathData
Index: /trunk/ab5.0/ablib/src/GdiPlusInit.ab
===================================================================
--- /trunk/ab5.0/ablib/src/GdiPlusInit.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/GdiPlusInit.ab	(revision 506)
@@ -0,0 +1,40 @@
+' GdiPlusInit.ab
+
+Enum DebugEventLevel
+	DebugEventLevelFatal
+	DebugEventLevelWarning
+End Enum
+
+Typedef DebugEventProc = *Sub(level As DebugEventLevel, message As *CHAR)
+
+Typedef NotificationHookProc = *Function(/*OUT*/ ByRef token As ULONG_PTR) As Status
+TypeDef NotificationUnhookProc = *Sub(ByVal token As ULONG_PTR)
+
+Type GdiplusStartupInput
+'Class GdiplusStartupInput
+'Public
+	GdiplusVersion As DWord
+	DebugEventCallback As DebugEventProc
+	SuppressBackgroundThread As BOOL
+	SuppressExternalCodecs As BOOL
+
+'	Sub GdiplusStartupInput()(debugEventCallback As DebugEventProc, suppressBackgroundThread As BOOL, suppressExternalCodecs As BOOL)
+'		GdiplusVersion = 1
+'		DebugEventCallback = debugEventCallback
+'		SuppressBackgroundThread = suppressBackgroundThread
+'		SuppressExternalCodecs = suppressExternalCodecs
+'	End Sub
+'End Class
+End Type
+
+Type Align(8) GdiplusStartupOutput
+	NotificationHook As NotificationHookProc
+	NotificationUnhook As NotificationUnhookProc
+End Type
+
+Declare Function GdiplusStartup Lib "GdiPlus.dll" (
+	/*OUT*/ ByRef token As ULONG_PTR,
+	        ByRef input As GdiplusStartupInput,
+	/*OUT*/ ByVal output As *GdiplusStartupOutput) As Status
+
+Declare Sub GdiplusShutdown Lib "GdiPlus.dll" (ByVal token As ULONG_PTR)
Index: /trunk/ab5.0/ablib/src/GdiPlusTypes.ab
===================================================================
--- /trunk/ab5.0/ablib/src/GdiPlusTypes.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/GdiPlusTypes.ab	(revision 506)
@@ -0,0 +1,60 @@
+' GdiPlusTypes.sbp
+
+TypeDef ImageAbort = *Function(p As VoidPtr) As BOOL
+TypeDef DrawImageAbort = ImageAbort
+TypeDef GetThumbnailImageAbort = ImageAbort
+
+TypeDef EnumerateMetafileProc = *Function(recordType As EmfPlusRecordType, flags As DWord, dataSize As DWord, data As *Byte, callbackData As VoidPtr) As BOOL
+
+'Const REAL_MAX           = FLT_MAX
+'Const REAL_MIN           = FLT_MIN
+'Const REAL_TOLERANCE     = (FLT_MIN * 100)
+'Const REAL_EPSILON       = 1.192092896e-07 'FLT_EPSILON
+
+Const Enum Status
+	Ok = 0
+	GenericError = 1
+	InvalidParameter = 2
+	OutOfMemory = 3
+	ObjectBusy = 4
+	InsufficientBuffer = 5
+	NotImplemented = 6
+	Win32Error = 7
+	WrongState = 8
+	Aborted = 9
+	FileNotFound = 10
+	ValueOverflow = 11
+	AccessDenied = 12
+	UnknownImageFormat = 13
+	FontFamilyNotFound = 14
+	FontStyleNotFound = 15
+	NotTrueTypeFont = 16
+	UnsupportedGdiplusVersion = 17
+	GdiplusNotInitialized = 18
+	PropertyNotFound = 19
+	PropertyNotSupported = 20
+End Enum
+
+Class PathData
+/*
+Public
+	Sub PathData()
+		Count = 0
+		Points = NULL
+		Types = NULL
+	End Sub
+
+	Sub ~PathData()
+		If Points <> NULL Then
+			Delete Points
+		End If
+		If Types <> NULL Then
+			Delete Types
+	End Sub
+
+Public
+	Count As Long
+	Points As *PointF
+	Types As *BYTE
+*/
+End Class
Index: /trunk/ab5.0/ablib/src/OAIdl.ab
===================================================================
--- /trunk/ab5.0/ablib/src/OAIdl.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/OAIdl.ab	(revision 506)
@@ -0,0 +1,1520 @@
+' OAIdl.sbp
+' 本来はOAIdl.idlから生成するのが正当ですが、
+' これは手動で移植したものです。
+
+#require <objidl.sbp>
+
+/* interface IOleAutomationTypes */
+/* [auto_handle][unique][version] */
+
+TypeDef CURRENCY = CY
+
+Type SAFEARRAYBOUND
+	cElements As DWord
+	lLbound As Long
+End Type
+
+Typedef LPSAFEARRAYBOUND = *SAFEARRAYBOUND
+
+Typedef wireVARIANT = VoidPtr '/* [unique] */ *_wireVARIANT
+
+Typedef wireBRECORD = VoidPtr '/* [unique] */ *_wireBRECORD
+
+' Type SAFEARR_BSTR;
+' Type SAFEARR_UNKNOWN;
+' Type SAFEARR_DISPATCH;
+' Type SAFEARR_VARIANT;
+' Type SAFEARR_BRECORD;
+' Type SAFEARR_HAVEIID;
+
+/* [v1_enum] */
+/*
+Const Enum SF_TYPE
+	SF_ERROR = VT_ERROR
+	SF_I1 = VT_I1
+	SF_I2 = VT_I2
+	SF_I4 = VT_I4
+	SF_I8 = VT_I8
+	SF_BSTR = VT_BSTR
+	SF_UNKNOWN = VT_UNKNOWN
+	SF_DISPATCH = VT_DISPATCH
+	SF_VARIANT = VT_VARIANT
+	SF_RECORD = VT_RECORD
+	SF_HAVEIID = VT_UNKNOWN Or VT_RESERVED
+End Enum
+*/
+' Type SAFEARRAYUNION
+
+' Type /* [unique] */ wireSAFEARRAY
+
+TypeDef wirePSAFEARRAY = VoidPtr '/* [unique] */ *wireSAFEARRAY
+
+Type SAFEARRAY
+	cDims As Word
+	fFeatures As Word
+	cbElements As DWord
+	cLocks As DWord
+	pvData As VoidPtr
+	rgsabound[ELM(1)] As SAFEARRAYBOUND
+End Type
+
+TypeDef LPSAFEARRAY = /* [wire_marshal] */ *SAFEARRAY
+
+Const FADF_AUTO = &h1
+Const FADF_STATIC = &h2
+Const FADF_EMBEDDED = &h4
+Const FADF_FIXEDSIZE = &h10
+Const FADF_RECORD = &h20
+Const FADF_HAVEIID = &h40
+Const FADF_HAVEVARTYPE = &h80
+Const FADF_BSTR = &h100
+Const FADF_UNKNOWN = &h200
+Const FADF_DISPATCH = &h400
+Const FADF_VARIANT = &h800
+Const FADF_RESERVED = &hf008
+
+Type /*Class*/ VARIANT
+Public
+	vt As VARTYPE
+	wReserved1 As Word
+	wReserved2 As Word
+	wReserved3 As Word
+	val As QWord
+/*
+	Function llVal() As Int64
+		Return val As Int64
+	End Function
+
+	Sub llVal(v As Int64)
+		val = v As QWord
+	End Sub
+
+	Function lVal() As Long
+		Return val As DWord As Long
+	End Function
+
+	Sub lVal(v As Long)
+		val = v As DWord
+	End Sub
+
+	Function bVal() As Byte
+		Return val As Byte
+	End Function
+
+	Sub bVal(v As Byte)
+		val = v
+	End Sub
+
+	Function iVal() As Integer
+		Return val As Word As Integer
+	End Function
+
+	Sub iVal(v As Integer)
+		val = v As Word
+	End Sub
+
+	Function fltVal() As Single
+		Return GetSingle(VarPtr(val) As *Single)
+	End Function
+
+	Sub fltVal(v As Single)
+		SetSingle(VarPtr(val) As *Single, v)
+	End Sub
+
+	Function dblVal() As Double
+		Return GetDouble(VarPtr(val) As *Double)
+	End Function
+
+	Sub dblVal(v As Double)
+		SetDouble(VarPtr(val) As *Double, v)
+	End Sub
+
+	' SizeOf (VARIANT_BOOL) = 2
+	Function boolVal() As VARIANT_BOOL
+		Return val As Word As VARIANT_BOOL
+	End Function
+
+	Sub boolVal(v As VARIANT_BOOL)
+		val = v As Word
+	End Sub
+
+	' SizeOf (SCODE) = 4
+	Function scode() As SCODE
+		Return val As DWord As SCODE
+	End Function
+
+	Sub scode(v As SCODE)
+		val = v As DWord
+	End Sub
+
+	' SizeOf (CY) = 8
+	Function cyVal() As CY
+		SetQWord(VarPtr(cyVal), val)
+	End Function
+
+	Sub cyVal(v As CY)
+		SetQWord(VarPtr(val), GetQWord(VarPtr(v)))
+	End Sub
+
+	' SizeOf (DATE) = 8
+	Function date() As DATE
+		SetQWord(VarPtr(date), val)
+	End Function
+
+	Sub date(v As DATE)
+		SetQWord(VarPtr(val), GetQWord(VarPtr(v)))
+	End Sub
+
+	Function bstrVal() As BSTR
+		Return val As ULONG_PTR As BSTR
+	End Function
+
+	Sub bstrVal(v As BSTR)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function punkVal() As *IUnknown
+		Return val As ULONG_PTR As *IUnknown
+	End Function
+
+	Sub punkVal(v As *IUnknown)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pdispVal() As *IDispatch
+		Return val As ULONG_PTR As *IDispatch
+	End Function
+
+	Sub pdispVal(v As *IDispatch)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function parray() As *SAFEARRAY
+		Return val As ULONG_PTR As *SAFEARRAY
+	End Function
+
+	Sub parray(v As *SAFEARRAY)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pbVal() As *Byte
+		Return val As ULONG_PTR As *Byte
+	End Function
+
+	Sub pbVal(v As *Byte)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function piVal() As *Integer
+		Return val As ULONG_PTR As *Integer
+	End Function
+
+	Sub piVal(v As *Integer)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function plVal() As *Long
+		Return val As ULONG_PTR As *Long
+	End Function
+
+	Sub plVal(v As *Long)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pllVal() As *Int64
+		Return val As ULONG_PTR As *Int64
+	End Function
+
+	Sub pllVal(v As *Int64)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pfltVal() As *Single
+		Return val As ULONG_PTR As *Single
+	End Function
+
+	Sub pfltVal(v As *Single)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pdblVal() As *Double
+		Return val As ULONG_PTR As *Double
+	End Function
+
+	Sub pdblVal(v As *Double)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pboolVal() As *VARIANT_BOOL
+		Return val As ULONG_PTR As *VARIANT_BOOL
+	End Function
+
+	Sub pboolVal(v As *VARIANT_BOOL)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pscode() As *SCODE
+		Return val As ULONG_PTR As *SCODE
+	End Function
+
+	Sub pscode(v As *SCODE)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pcyVal() As *CY
+		Return val As ULONG_PTR As *CY
+	End Function
+
+	Sub pcyVal(v As *CY)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pdate() As *DATE
+		Return val As ULONG_PTR As *DATE
+	End Function
+
+	Sub pdate(v As *DATE)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pbstrVal() As *BSTR
+		Return val As ULONG_PTR As *BSTR
+	End Function
+
+	Sub pbstrVal(v As *BSTR)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function ppunkVal() As **IUnknown
+		Return val As ULONG_PTR As **IUnknown
+	End Function
+
+	Sub ppunkVal(v As **IUnknown)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function ppdispVal() As **IDispatch
+		Return val As ULONG_PTR As **IDispatch
+	End Function
+
+	Sub ppdispVal(v As **IDispatch)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pparray() As **SAFEARRAY
+		Return val As ULONG_PTR As **SAFEARRAY
+	End Function
+
+	Sub pparray(v As **SAFEARRAY)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pvarVal() As *VARIANT
+		Return val As ULONG_PTR As *VARIANT
+	End Function
+
+	Sub pvarVal(v As *VARIANT)
+		val = v As ULONG_PTR
+	End Sub
+
+'	Function byref() As VoidPtr
+'		Return val As ULONG_PTR As VoidPtr
+'	End Function
+
+'	Sub byref(v As VoidPtr)
+'		val = v As ULONG_PTR
+'	End Sub
+
+	Function cVal() As Char
+		Return val As Byte As Char
+	End Function
+
+	Sub cVal(v As Char)
+		val = v As Byte
+	End Sub
+
+	Function uiVal() As Word
+		Return val As Word
+	End Function
+
+	Sub uiVal(v As Word)
+		val = v
+	End Sub
+
+	Function ulVal() As DWord
+		Return val As DWord
+	End Function
+
+	Sub ulVal(v As DWord)
+		val = v
+	End Sub
+
+	Function ullVal() As QWord
+		Return val
+	End Function
+
+	Sub ullVal(v As QWord)
+		val = v
+	End Sub
+
+	Function intVal() As Long
+		Return val As DWord As Long
+	End Function
+
+	Sub intVal(v As Long)
+		val = v As DWord
+	End Sub
+
+	Function uintVal() As DWord
+		Return val As DWord
+	End Function
+
+	Sub uintVal(v As DWord)
+		val = v
+	End Sub
+
+	Function pdecVal() As *DECIMAL
+		Return val As ULONG_PTR As *DECIMAL
+	End Function
+
+	Sub pdecVal(v As *DECIMAL)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pcVal() As *Char
+		Return val As ULONG_PTR As *Char
+	End Function
+
+	Sub pcVal(v As *Char)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function puiVal() As *Word
+		Return val As ULONG_PTR As *Word
+	End Function
+
+	Sub puiVal(v As *Word)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pulVal() As *DWord
+		Return val As ULONG_PTR As *DWord
+	End Function
+
+	Sub pulVal(v As *DWord)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pullVal() As *QWord
+		Return val As ULONG_PTR As *QWord
+	End Function
+
+	Sub pullVal(v As *QWord)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pintVal() As *Long
+		Return val As ULONG_PTR As *Long
+	End Function
+
+	Sub pintVal(v As *Long)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function puintVal() As *DWord
+		Return val As ULONG_PTR As *DWord
+	End Function
+
+	Sub puintVal(v As *DWord)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pvRecord() As VoidPtr
+		Return val As ULONG_PTR As VoidPtr
+	End Function
+
+	Sub pvRecord(v As VoidPtr)
+		val = v As ULONG_PTR
+	End Sub
+
+	Function pRecInfo() As *IRecordInfo
+		Return (val As ULONG_PTR + SizeOf (VoidPtr)) As *IRecordInfo
+	End Function
+
+	Sub pRecInfo(v As *IRecordInfo)
+		Set_LONG_PTR((VarPtr(val) As ULONG_PTR + SizeOf (VoidPtr)) As VoidPtr, v As LONG_PTR)
+	End Sub
+
+	Function decVal() As DECIMAL
+		Dim p As *DECIMAL
+		p = VarPtr(This) As *DECIMAL
+		Return p[0]
+	End Function
+
+	Sub decVal(v As DECIMAL)
+		Dim p As *DECIMAL
+		p = VarPtr(This) As *DECIMAL
+		p[0] = v
+	End Sub
+*/
+End Type 'Class
+
+TypeDef LPVARIANT = *VARIANT
+TypeDef VARIANTARG = VARIANT
+TypeDef LPVARIANTARG =* VARIANT
+
+' Type _wireBRECORD
+' Type _wireVARIANT
+
+TypeDef DISPID = Long
+
+TypeDef MEMBERID = DISPID
+
+TypeDef HREFTYPE = DWord
+
+/* [v1_enum] */
+Const Enum TYPEKIND
+	TKIND_ENUM ' = 0
+	TKIND_RECORD ' = TKIND_ENUM + 1
+	TKIND_MODULE ' = TKIND_RECORD + 1
+	TKIND_INTERFACE ' = TKIND_MODULE + 1
+	TKIND_DISPATCH ' = TKIND_INTERFACE + 1
+	TKIND_COCLASS ' = TKIND_DISPATCH + 1
+	TKIND_ALIAS ' = TKIND_COCLASS + 1
+	TKIND_UNION ' = TKIND_ALIAS + 1
+	TKIND_MAX ' = TKIND_UNION + 1
+End Enum
+
+Type /*Class*/ TYPEDESC
+' Private
+	p As VoidPtr
+'	/* [switch_is][switch_type] */ Union
+'		/* [case()] */ lptdesc As *TYPEDESC
+'		/* [case()] */ lpadesc As *ARRAYDESC
+'		/* [case()] */ hreftype As HREFTYPE
+'		/* [default] */  /* Empty union arm */
+'	End Union
+'Public
+	vt As VARTYPE
+/*
+	Function lptdesc() As *TYPEDESC
+		Return p
+	End Function
+
+	Sub lptdesc(ptd As *TYPEDESC)
+		p = ptd
+	End Sub
+
+	Function lpadesc() As *ARRAYDESC
+		Return p
+	End Function
+
+	Sub lpadesc(pad As *ARRAYDESC)
+		p = pad
+	End Sub
+
+	Function hreftype() As *HREFTYPE
+		Return p
+	End Function
+
+	Sub hreftype(prd As *HREFTYPE)
+		p = prd
+	End Sub
+*/
+End Type 'Class
+
+Type ARRAYDESC
+	tdescElem As TYPEDESC
+	cDims As Word
+	/* [size_is] */ rgbounds[ELM(1)] As SAFEARRAYBOUND
+End Type
+
+Type PARAMDESCEX
+	cBytes As DWord
+	varDefaultValue As VARIANTARG
+End Type
+
+Typedef LPPARAMDESCEX = *PARAMDESCEX
+
+Type PARAMDESC
+	pparamdescex As LPPARAMDESCEX
+	USHORT wParamFlags As Word
+End Type
+
+TypeDef LPPARAMDESC = *PARAMDESC
+
+Const PARAMFLAG_NONE = 0
+Const PARAMFLAG_FIN = &h1
+Const PARAMFLAG_FOUT = &h2
+Const PARAMFLAG_FLCID = &h4
+Const PARAMFLAG_FRETVAL = &h8
+Const PARAMFLAG_FOPT = &h10
+Const PARAMFLAG_FHASDEFAULT = &h20
+Const PARAMFLAG_FHASCUSTDATA = &h40
+
+Type IDLDESC
+	dwReserved As ULONG_PTR
+	wIDLFlags As Word
+End Type
+
+TypeDef LPIDLDESC = *IDLDESC
+
+Const IDLFLAG_NONE = PARAMFLAG_NONE
+Const IDLFLAG_FIN = PARAMFLAG_FIN
+Const IDLFLAG_FOUT = PARAMFLAG_FOUT
+Const IDLFLAG_FLCID = PARAMFLAG_FLCID
+Const IDLFLAG_FRETVAL = PARAMFLAG_FRETVAL
+
+Type /*Class*/ ELEMDESC
+'Public
+	tdesc As TYPEDESC
+	idldesc As IDLDESC
+/*
+	Function paramdesc() As PARAMDESC
+		Dim p As *PARAMDESC
+		p = VarPtr(idldesc) As *PARAMDESC
+		Return p[0]
+	End Function
+
+	Sub paramdesc(pd As PARAMDESC)
+		Dim p As *PARAMDESC
+		p = VarPtr(idldesc) As *PARAMDESC
+		p[0] = pd
+	End Sub
+*/
+End Type 'Class
+
+Type TYPEATTR
+	guid As GUID
+	lcid As LCID
+	dwReserved As DWord
+	memidConstructor As MEMBERID
+	memidDestructor As MEMBERID
+	lpstrSchema As LPOLESTR
+	cbSizeInstance As DWord
+	typekind As TYPEKIND
+	cFuncs As Word
+	cVars As Word
+	cImplTypes As Word
+	cbSizeVft As Word
+	cbAlignment As Word
+	wTypeFlags As Word
+	wMajorVerNum As Word
+	wMinorVerNum As Word
+	tdescAlias As TYPEDESC
+	idldescType As IDLDESC
+End Type
+
+TypeDef LPTYPEATTR = *TYPEATTR
+
+Type DISPPARAMS
+	/* [size_is] */ rgvarg As *VARIANTARG
+	/* [size_is] */ rgdispidNamedArgs As *DISPID
+	cArgs As DWord
+	cNamedArgs As DWord
+End Type
+
+Type EXCEPINFO
+	wCode As Word
+	wReserved As Word
+	bstrSource As BSTR
+	bstrDescription As BSTR
+	bstrHelpFile As BSTR
+	dwHelpContext As DWord
+	pvReserved As VoidPtr
+	pfnDeferredFillIn As *Function(p As *EXCEPINFO) As HRESULT
+	scode As SCODE
+End Type
+
+TypeDef LPEXCEPINFO = *EXCEPINFO
+
+/* [v1_enum] */
+Const Enum CALLCONV
+	CC_FASTCALL	= 0
+	CC_CDECL	= 1
+	CC_MSCPASCAL	= CC_CDECL + 1
+	CC_PASCAL	= CC_MSCPASCAL
+	CC_MACPASCAL	= CC_PASCAL + 1
+	CC_STDCALL	= CC_MACPASCAL + 1
+	CC_FPFASTCALL	= CC_STDCALL + 1
+	CC_SYSCALL	= CC_FPFASTCALL + 1
+	CC_MPWCDECL	= CC_SYSCALL + 1
+	CC_MPWPASCAL	= CC_MPWCDECL + 1
+	CC_MAX	= CC_MPWPASCAL + 1
+End Enum
+
+/* [v1_enum] */
+Const Enum FUNCKIND
+	FUNC_VIRTUAL = 0
+	FUNC_PUREVIRTUAL = FUNC_VIRTUAL + 1
+	FUNC_NONVIRTUAL = FUNC_PUREVIRTUAL + 1
+	FUNC_STATIC = FUNC_NONVIRTUAL + 1
+	FUNC_DISPATCH = FUNC_STATIC + 1
+End Enum
+
+/* [v1_enum] */
+Const Enum INVOKEKIND
+	INVOKE_FUNC = 1
+	INVOKE_PROPERTYGET = 2
+	INVOKE_PROPERTYPUT = 4
+	INVOKE_PROPERTYPUTREF = 8
+End Enum
+
+Type FUNCDESC
+	memid As MEMBERID
+	/* [size_is] */ lprgscode As *SCODE
+	/* [size_is] */ lprgelemdescParam As *ELEMDESC
+	funckind As FUNCKIND
+	invkind As INVOKEKIND
+	callconv As CALLCONV
+	cParams As Integer
+	cParamsOpt As Integer
+	oVft As Integer
+	cScodes As Integer
+	elemdescFunc As ELEMDESC
+	wFuncFlags As Word
+End Type
+
+TypeDef LPFUNCDESC = *FUNCDESC
+
+/* [v1_enum] */
+Const Enum VARKIND
+	VAR_PERINSTANCE = 0
+	VAR_STATIC = 1
+	VAR_CONST = 2
+	VAR_DISPATCH = 3
+End Enum
+
+Const IMPLTYPEFLAG_FDEFAULT = &h1
+Const IMPLTYPEFLAG_FSOURCE = &h2
+Const IMPLTYPEFLAG_FRESTRICTED = &h4
+Const IMPLTYPEFLAG_FDEFAULTVTABLE = &h8
+
+Type /*Class*/ VARDESC
+'Public
+	memid As MEMBERID
+	lpstrSchema As LPOLESTR
+'	/* [switch_is][switch_type] */ Union
+'		/* [case()] */ oInst As DWord
+		/* [case()] */ lpvarValue As *VARIANT
+'	End Union
+	elemdescVar As ELEMDESC
+	wVarFlags As Word
+	varkind As VARKIND
+/*
+	Function oInst() As DWord
+		Return lpvarValue As ULONG_PTR As DWord
+	End Function
+
+	Sub oInst(o As DWord)
+		lpvarValue = o As ULONG_PTR As *VARIANT
+	End Sub
+*/
+End Type 'Class
+
+TypeDef LPVARDESC = VARDESC
+
+Const Enum TYPEFLAGS
+	TYPEFLAG_FAPPOBJECT = &h1
+	TYPEFLAG_FCANCREATE = &h2
+	TYPEFLAG_FLICENSED = &h4
+	TYPEFLAG_FPREDECLID = &h8
+	TYPEFLAG_FHIDDEN = &h10
+	TYPEFLAG_FCONTROL = &h20
+	TYPEFLAG_FDUAL = &h40
+	TYPEFLAG_FNONEXTENSIBLE = &h80
+	TYPEFLAG_FOLEAUTOMATION = &h100
+	TYPEFLAG_FRESTRICTED = &h200
+	TYPEFLAG_FAGGREGATABLE = &h400
+	TYPEFLAG_FREPLACEABLE = &h800
+	TYPEFLAG_FDISPATCHABLE = &h1000
+	TYPEFLAG_FREVERSEBIND = &h2000
+	TYPEFLAG_FPROXY = &h4000
+End Enum
+
+Enum FUNCFLAGS
+	FUNCFLAG_FRESTRICTED = &h1
+	FUNCFLAG_FSOURCE = &h2
+	FUNCFLAG_FBINDABLE = &h4
+	FUNCFLAG_FREQUESTEDIT = &h8
+	FUNCFLAG_FDISPLAYBIND = &h10
+	FUNCFLAG_FDEFAULTBIND = &h20
+	FUNCFLAG_FHIDDEN = &h40
+	FUNCFLAG_FUSESGETLASTERROR = &h80
+	FUNCFLAG_FDEFAULTCOLLELEM = &h100
+	FUNCFLAG_FUIDEFAULT = &h200
+	FUNCFLAG_FNONBROWSABLE = &h400
+	FUNCFLAG_FREPLACEABLE = &h800
+	FUNCFLAG_FIMMEDIATEBIND = &h1000
+End Enum
+
+Const Enum VARFLAGS
+	VARFLAG_FREADONLY = &h1
+	VARFLAG_FSOURCE = &h2
+	VARFLAG_FBINDABLE = &h4
+	VARFLAG_FREQUESTEDIT = &h8
+	VARFLAG_FDISPLAYBIND = &h10
+	VARFLAG_FDEFAULTBIND = &h20
+	VARFLAG_FHIDDEN = &h40
+	VARFLAG_FRESTRICTED = &h80
+	VARFLAG_FDEFAULTCOLLELEM = &h100
+	VARFLAG_FUIDEFAULT = &h200
+	VARFLAG_FNONBROWSABLE = &h400
+	VARFLAG_FREPLACEABLE = &h800
+	VARFLAG_FIMMEDIATEBIND = &h1000
+End Enum
+
+Type /* [wire_marshal] */ CLEANLOCALSTORAGE
+	pInterface As IUnknown
+	pStorage As VoidPtr
+	flags As DWord
+End Type
+
+Type CUSTDATAITEM
+	guid As GUID
+	varValue As VARIANTARG
+End Type
+
+TypeDef LPCUSTDATAITEM = *CUSTDATAITEM
+
+Type CUSTDATA
+	cCustData As DWord
+	/* [size_is] */ prgCustData As *CUSTDATAITEM
+End Type
+
+TypeDef LPCUSTDATA = *CUSTDATA
+
+/* interface ICreateTypeInfo */
+/* [local][unique][uuid][object] */
+
+Dim IID_ICreateTypeInfo = [&h00020405, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ICreateTypeInfo
+	Inherits IUnknown
+
+	Function SetGuid(
+		/* [in] */ ByRef guid As GUID) As HRESULT
+	Function SetTypeFlags(
+		/* [in] */ uTypeFlags As DWord) As HRESULT
+	Function SetDocString(
+		/* [in] */ pStrDoc As LPOLESTR) As HRESULT
+	Function SetHelpContext(
+		/* [in] */ dwHelpContext As DWord) As HRESULT
+	Function SetVersion(
+		/* [in] */ wMajorVerNum As Word,
+		/* [in] */ wMinorVerNum As Word) As HRESULT
+	Function AddRefTypeInfo(
+		/* [in] */ TInfo As ITypeInfo,
+		/* [in] */ByRef hRefType As HREFTYPE) As HRESULT
+	Function AddFuncDesc(
+		/* [in] */ index As DWord,
+		/* [in] */ ByRef FuncDesc As FUNCDESC) As HRESULT
+	Function AddImplType(
+		/* [in] */ index As DWord,
+		/* [in] */ hRefType As HREFTYPE) As HRESULT
+	Function SetImplTypeFlags(
+		/* [in] */ index As DWord,
+		/* [in] */ implTypeFlags As Long) As HRESULT
+	Function SetAlignment(
+		/* [in] */ cbAlignment As Long) As HRESULT
+	Function SetSchema(
+		/* [in] */ pStrSchema As LPOLESTR) As HRESULT
+	Function AddVarDesc(
+		/* [in] */ index As DWord,
+		/* [in] */ ByRef VarDesc As VARDESC) As HRESULT
+	Function SetFuncAndParamNames(
+		/* [in] */ index As DWord,
+		/* [in][size_is][in] */ rgszNames As *LPOLESTR,
+		/* [in] */ cNames As DWord) As HRESULT
+	Function SetVarName(
+		/* [in] */ index As DWord,
+		/* [in] */ szName As LPOLESTR) As HRESULT
+	Function SetTypeDescAlias(
+		/* [in] */ ByRef TDescAlias As TYPEDESC) As HRESULT
+	Function DefineFuncAsDllEntry(
+		/* [in] */ index As DWord,
+		/* [in] */ szDllName As LPOLESTR,
+		/* [in] */ zProcName As LPOLESTR) As HRESULT
+	Function SetFuncDocString(
+		/* [in] */ index As DWord,
+		/* [in] */ szDocString As LPOLESTR) As HRESULT
+	Function SetVarDocString(
+		/* [in] */ index As DWord,
+		/* [in] */ szDocString As LPOLESTR) As HRESULT
+	Function SetFuncHelpContext(
+		/* [in] */ index As DWord,
+		/* [in] */ dwHelpContext As DWord) As HRESULT
+	Function SetVarHelpContext(
+		/* [in] */ index As DWord,
+		/* [in] */ dwHelpContext As DWord) As HRESULT
+	Function SetMops(
+		/* [in] */ index As DWord,
+		/* [in] */ bstrMops As BSTR) As HRESULT
+	Function SetTypeIdldesc(
+		/* [in] */ ByRef IdlDesc As IDLDESC) As HRESULT
+	Function LayOut() As HRESULT
+End Interface
+
+/* interface ICreateTypeInfo2 */
+/* [local][unique][uuid][object] */
+
+Dim IID_ICreateTypeInfo2 = [&h0002040E, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ICreateTypeInfo2
+	Inherits ICreateTypeInfo
+
+	Function DeleteFuncDesc(
+		/* [in] */ index As DWord) As HRESULT
+	Function DeleteFuncDescByMemId(
+		/* [in] */ memid As *MEMBERID,
+		/* [in] */ invKind As *INVOKEKIND) As HRESULT
+	Function DeleteVarDesc(
+		/* [in] */ index As DWord) As HRESULT
+	Function DeleteVarDescByMemId(
+		/* [in] */ memid As *MEMBERID) As HRESULT
+	Function DeleteImplType(
+		/* [in] */ index As DWord) As HRESULT
+	Function SetCustData(
+		/* [in] */ ByRef guid As GUID,
+		/* [in] */ ByRef VarVal As VARIANT) As HRESULT
+	Function SetFuncCustData(
+		/* [in] */ index As DWord,
+		/* [in] */ ByRef guid As GUID,
+		/* [in] */ ByRef VarVal As VARIANT) As HRESULT
+	Function SetParamCustData(
+		/* [in] */ indexFunc As DWord,
+		/* [in] */ indexParam As DWord,
+		/* [in] */ ByRef guid As GUID,
+		/* [in] */ ByRef VarVal As VARIANT) As HRESULT
+	Function SetVarCustData(
+		/* [in] */ index As DWord,
+		/* [in] */ ByRef guid As GUID,
+		/* [in] */ ByRef VarVal As VARIANT) As HRESULT
+	Function SetImplTypeCustData(
+		/* [in] */ index As DWord,
+		/* [in] */ ByRef guid As GUID,
+		/* [in] */ ByRef VarVal As VARIANT) As HRESULT
+	Function SetHelpStringContext(
+		/* [in] */ dwHelpStringContext As DWord) As HRESULT
+	Function SetFuncHelpStringContext(
+		/* [in] */ index As DWord,
+		/* [in] */ dwHelpStringContext As DWord) As HRESULT
+	Function SetVarHelpStringContext(
+		/* [in] */ index As DWord,
+		/* [in] */ dwHelpStringContext As DWord) As HRESULT
+	Function Invalidate() As HRESULT
+	Function SetName(
+		/* [in] */ szName As LPOLESTR) As HRESULT
+End Interface
+
+/* interface ICreateTypeLib */
+/* [local][unique][uuid][object] */
+
+Dim IID_ICreateTypeLib = [&h00020406, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+Interface ICreateTypeLib
+	Inherits IUnknown
+
+	Function CreateTypeInfo(
+		/* [in] */ szName As LPOLESTR,
+		/* [in] */ tkind As *TYPEKIND,
+		/* [out] */ ByRef CTInfo As ICreateTypeInfo) As HRESULT
+	Function SetName(
+		/* [in] */ szName As LPOLESTR) As HRESULT
+	Function SetVersion(
+		/* [in] */ wMajorVerNum As Word,
+		/* [in] */ wMinorVerNum As Word) As HRESULT
+	Function SetGuid(
+		/* [in] */ ByRef guid As GUID) As HRESULT
+	Function SetDocString(
+		/* [in] */ szDoc As LPOLESTR) As HRESULT
+	Function SetHelpFileName(
+		/* [in] */ szHelpFileName As LPOLESTR) As HRESULT
+	Function SetHelpContext(
+		/* [in] */ dwHelpContext As DWord) As HRESULT
+	Function SetLcid(
+		/* [in] */ lcid As LCID) As HRESULT
+	Function SetLibFlags(
+		/* [in] */ uLibFlags As DWord) As HRESULT
+	Function SaveAllChanges() As HRESULT
+End Interface
+
+/* interface ICreateTypeLib2 */
+/* [local][unique][uuid][object] */
+
+Dim IID_ICreateTypeLib2 = [&h0002040F, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ICreateTypeLib2
+	Inherits ICreateTypeLib
+
+	Function DeleteTypeInfo(
+		/* [in] */ szName As LPOLESTR) As HRESULT
+	Function SetCustData(
+		/* [in] */ ByRef guid As GUID,
+		/* [in] */ ByRef VarVal As VARIANT) As HRESULT
+	Function SetHelpStringContext(
+		/* [in] */ dwHelpStringContext As DWord) As HRESULT
+	Function SetHelpStringDll(
+		/* [in] */ szFileName As LPOLESTR) As HRESULT
+End Interface
+
+/* interface IDispatch */
+/* [unique][uuid][object] */
+
+Const DISPID_UNKNOWN = -1
+Const DISPID_VALUE = 0
+Const DISPID_PROPERTYPUT = -3
+Const DISPID_NEWENUM = -4
+Const DISPID_EVALUATE = -5
+Const DISPID_CONSTRUCTOR = -6
+Const DISPID_DESTRUCTOR = -7
+Const DISPID_COLLECT = -8
+
+/* The range -500 through -999 is reserved for Controls */
+/* The range 0x80010000 through 0x8001FFFF is reserved for Controls */
+/* The range -5000 through -5499 is reserved for ActiveX Accessability */
+/* The range -2000 through -2499 is reserved for VB5 */
+/* The range -3900 through -3999 is reserved for Forms */
+/* The range -5500 through -5550 is reserved for Forms */
+/* The remainder of the negative DISPIDs are reserved for future use */
+
+Dim IID_IDispatch = [&h00020400, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface IDispatch
+	Inherits IUnknown
+
+	Function GetTypeInfoCount(
+		/* [out] */ ByRef pctinfo As DWord) As HRESULT
+	Function GetTypeInfo(
+		/* [in] */ iTInfo As DWord,
+		/* [in] */ lcid As LCID,
+		/* [out] */ ByRef TInfo As ITypeInfo) As HRESULT
+	Function GetIDsOfNames(
+		/* [in] */ ByRef riid As IID,
+		/* [size_is][in] */ rgszNames As *LPOLESTR,
+		/* [in] */ cNames As DWord,
+		/* [in] */ lcid As LCID,
+		/* [size_is][out] */ rgDispId As *DISPID) As HRESULT
+	Function /* [local] */ Invoke(
+		/* [in] */ dispIdMember As DISPID,
+		/* [in] */ ByRef riid As IID,
+		/* [in] */ lcid As LCID,
+		/* [in] */ wFlags As Word,
+		/* [out][in] */ ByRef pDispParams As DISPPARAMS,
+		/* [out] */ ByRef pVarResult As VARIANT,
+		/* [out] */ ByRef pExcepInfo As EXCEPINFO,
+		/* [out] */ ByRef puArgErr As DWord) As HRESULT
+End Interface
+
+/* interface IEnumVARIANT */
+/* [unique][uuid][object] */
+
+Dim IID_IEnumVARIANT = [&h00020404, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface IEnumVARIANT
+	Inherits IUnknown
+
+	/* [local] */ Function Next(
+		/* [in] */ celt As DWord,
+		/* [length_is][size_is][out] */ rgVar As *VARIANT,
+		/* [out] */ pCeltFetched As *DWord) As HRESULT
+	Function Skip(
+		/* [in] */ celt As DWord) As HRESULT
+	Function Reset() As HRESULT
+	Function Clone(
+		/* [out] */ ByRef enum_ As IEnumVARIANT) As HRESULT
+
+End Interface
+
+/* interface ITypeComp */
+/* [unique][uuid][object] */
+
+/* [v1_enum] */
+Const Enum DESCKIND
+	DESCKIND_NONE
+	DESCKIND_FUNCDESC = DESCKIND_NONE
+	DESCKIND_VARDESC = DESCKIND_FUNCDESC
+	DESCKIND_TYPECOMP = DESCKIND_VARDESC
+	DESCKIND_IMPLICITAPPOBJ = DESCKIND_TYPECOMP
+	DESCKIND_MAX = DESCKIND_IMPLICITAPPOBJ
+End Enum
+/*
+Union BINDPTR
+    lpfuncdesc As *FUNCDESC
+    lpvardesc As *VARDESC
+    lptcomp As ITypeComp
+End Union
+*/
+Type BINDPTR
+	p As VoidPtr '暫定
+End Type
+
+TypeDef LPBINDPTR = *BINDPTR
+
+Dim IID_ITypeComp = [&h00020403, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ITypeComp
+	Inherits IUnknown
+
+	Function /* [local] */ Bind(
+		/* [in] */ szName As LPOLESTR,
+		/* [in] */ HashVal As DWord,
+		/* [in] */ wFlags As Word,
+		/* [out] */ ByRef TInfo As ITypeInfo,
+		/* [out] */ ByRef DescKind As DESCKIND,
+		/* [out] */ ByRef BindPtr As BINDPTR) As HRESULT
+
+	Function /* [local] */ BindType(
+		/* [in] */ szName As LPOLESTR,
+		/* [in] */ HashVal As DWord,
+		/* [out] */ ByRef TInfo As ITypeInfo,
+		/* [out] */ ByRef TComp As ITypeComp) As HRESULT
+End Interface
+
+/* interface ITypeInfo */
+/* [unique][uuid][object] */
+
+Dim IID_ITypeInfo = [&h00020401, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ITypeInfo
+	Inherits IUnknown
+
+	Function /* [local] */ GetTypeAttr(
+		/* [out] */ ByRef pTypeAttr As *TYPEATTR) As HRESULT
+	Function GetTypeComp(
+		/* [out] */ ByRef TComp As ITypeComp) As HRESULT
+	Function /* [local] */ GetFuncDesc(
+		/* [in] */ index As DWord,
+		/* [out] */ ByRef pFuncDesc As *FUNCDESC) As HRESULT
+	Function /* [local] */ GetVarDesc(
+		/* [in] */ index As DWord,
+		/* [out] */ ByRef pVarDesc As *VARDESC) As HRESULT
+	Function /* [local] */ GetNames(
+		/* [in] */ memid As MEMBERID,
+		/* [length_is][size_is][out] */ rgBstrNames As *BSTR,
+		/* [in] */ cMaxNames As DWord,
+		/* [out] */ ByRef cNames As DWord) As HRESULT
+	Function GetRefTypeOfImplType(
+		/* [in] */ index As DWord,
+		/* [out] */ ByRef RefType As HREFTYPE) As HRESULT
+	Function GetImplTypeFlags(
+		/* [in] */ index As DWord,
+		/* [out] */ ByRef ImplTypeFlags As Long) As HRESULT
+	Function /* [local] */ GetIDsOfNames(
+		/* [size_is][in] */ rgszNames As *LPOLESTR,
+		/* [in] */ cNames As DWord,
+		/* [size_is][out] */ pMemId As *MEMBERID) As HRESULT
+	Function /* [local] */ Invoke(
+		/* [in] */ pvInstance As VoidPtr,
+		/* [in] */ memid As MEMBERID,
+		/* [in] */ wFlags As Word,
+		/* [out][in] */ ByRef DispParams As DISPPARAMS,
+		/* [out] */ ByRef VarResult As VARIANT,
+		/* [out] */ ByRef ExcepInfo As EXCEPINFO,
+		/* [out] */ ByRef uArgErr As DWord) As HRESULT
+	Function /* [local] */ GetDocumentation(
+		/* [in] */ memid As MEMBERID,
+		/* [out] */ ByRef BstrName As BSTR,
+		/* [out] */ ByRef BstrDocString As BSTR,
+		/* [out] */ ByRef dwHelpContext As DWord,
+		/* [out] */ ByRef BstrHelpFile As BSTR) As HRESULT
+	Function /* [local] */ GetDllEntry(
+		/* [in] */ memid As MEMBERID,
+		/* [in] */ invKind As INVOKEKIND,
+		/* [out] */ ByRef BstrDllName As BSTR,
+		/* [out] */ ByRef BstrName As BSTR,
+		/* [out] */ ByRef wOrdinal As Word) As HRESULT
+	Function GetRefTypeInfo(
+		/* [in] */ hRefType As HREFTYPE,
+		/* [out] */ ByRef TInfo As ITypeInfo) As HRESULT
+	Function /* [local] */ AddressOfMember(
+		/* [in] */ memid As MEMBERID,
+		/* [in] */ invKind As INVOKEKIND,
+		/* [out] */ ByRef pv As VoidPtr) As HRESULT
+	Function /* [local] */ CreateInstance(
+		/* [in] */ pUnkOuter As IUnknown,
+		/* [in] */ ByRef riid As IID,
+		/* [iid_is][out] */ ByRef pvObj As Any) As HRESULT
+	Function GetMops(
+		/* [in] */ memid As MEMBERID,
+		/* [out] */ ByRef BstrMops As BSTR) As HRESULT
+	Function /* [local] */ GetContainingTypeLib(
+		/* [out] */ ByRef TLib As ITypeLib,
+		/* [out] */ ByRef Index As DWord) As HRESULT
+	Sub /* [local] */ ReleaseTypeAttr(
+		/* [in] */ pTypeAttr As *TYPEATTR)
+	Sub /* [local] */ ReleaseFuncDesc(
+		/* [in] */ pFuncDesc As *FUNCDESC)
+	Sub /* [local] */ ReleaseVarDesc(
+		/* [in] */ pVarDesc As *VARDESC)
+End Interface
+
+/* interface ITypeInfo2 */
+/* [unique][uuid][object] */
+
+Dim IID_ITypeInfo2 = [&h00020412, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ITypeInfo2
+	Inherits ITypeInfo
+
+	Function GetTypeKind(
+		/* [out] */ ByRef TypeKind As TYPEKIND) As HRESULT
+	Function GetTypeFlags(
+		/* [out] */ ByRef TypeFlags As DWord) As HRESULT
+	Function GetFuncIndexOfMemId(
+		/* [in] */ memid As MEMBERID,
+		/* [in] */ invKind As INVOKEKIND,
+		/* [out] */ ByRef FuncIndex As DWord) As HRESULT
+	Function GetVarIndexOfMemId(
+		/* [in] */ memid As MEMBERID,
+		/* [out] */ ByRef pVarIndex As DWord) As HRESULT
+	Function GetCustData(
+		/* [in] */ ByRef guid As GUID,
+		/* [out] */ ByRef VarVal As VARIANT) As HRESULT
+	Function GetFuncCustData(
+		/* [in] */ index As DWord,
+		/* [in] */ ByRef guid As GUID,
+		/* [out] */ ByRef VarVal As VARIANT) As HRESULT
+	Function GetParamCustData(
+		/* [in] */ indexFunc As DWord,
+		/* [in] */ indexParam As DWord,
+		/* [in] */ ByRef guid As GUID,
+		/* [out] */ ByRef VarVal As VARIANT) As HRESULT
+	Function GetVarCustData(
+		/* [in] */ index As DWord,
+		/* [in] */ ByRef guid As GUID,
+		/* [out] */ ByRef VarVal As VARIANT) As HRESULT
+	Function GetImplTypeCustData(
+		/* [in] */ index As DWord,
+		/* [in] */ ByRef guid As GUID,
+		/* [out] */ ByRef VarVal As VARIANT) As HRESULT
+	Function /* [local] */ GetDocumentation2(
+		/* [in] */ memid As MEMBERID,
+		/* [in] */ lcid As LCID,
+		/* [out] */ ByRef bstrHelpString As BSTR,
+		/* [out] */ ByRef dwHelpStringContext As DWord,
+		/* [out] */ ByRef bstrHelpStringDll As BSTR) As HRESULT
+	Function GetAllCustData(
+		/* [out] */ ByRef CustData As CUSTDATA) As HRESULT
+	Function GetAllFuncCustData(
+		/* [in] */ index As DWord,
+		/* [out] */ ByRef CustData As CUSTDATA) As HRESULT
+	Function GetAllParamCustData(
+		/* [in] */ indexFunc As DWord,
+		/* [in] */ indexParam As DWord,
+		/* [out] */ ByRef CustData As CUSTDATA) As HRESULT
+	Function GetAllVarCustData(
+		/* [in] */ index As DWord,
+		/* [out] */ ByRef CustData As CUSTDATA) As HRESULT
+	Function GetAllImplTypeCustData(
+		/* [in] */ index As DWord,
+		/* [out] */ ByRef CustData As CUSTDATA) As HRESULT
+End Interface
+
+/* interface ITypeLib */
+/* [unique][uuid][object] */
+
+/* [v1_enum] */
+Const Enum SYSKIND
+	SYS_WIN16 = 0
+	SYS_WIN32 = 1
+	SYS_MAC = 2
+	SYS_WIN64 = 3
+End Enum
+
+/* [v1_enum] */
+Const Enum LIBFLAGS
+	LIBFLAG_FRESTRICTED = &h1
+	LIBFLAG_FCONTROL = &h2
+	LIBFLAG_FHIDDEN = &h4
+	LIBFLAG_FHASDISKIMAGE = &h8
+End Enum
+
+TypeDef LPTYPELIB = /* [unique] */ *ITypeLib
+
+Type TLIBATTR
+	guid As GUID
+	lcid As LCID
+	syskind As SYSKIND
+	wMajorVerNum As Word
+	wMinorVerNum As Word
+	wLibFlags As Word
+End Type
+
+TypeDef LPTLIBATTR = TLIBATTR
+
+Dim ITypeLib = [&h00020402, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ITypeLib
+	Inherits IUnknown
+
+	Function /* [local] */ GetTypeInfoCount() As DWord
+	Function GetTypeInfo(
+		/* [in] */ index As DWord,
+		/* [out] */ ByRef TInfo As ITypeInfo) As HRESULT
+	Function GetTypeInfoType(
+		/* [in] */ index As DWord,
+		/* [out] */ ByRef TKind As TYPEKIND) As HRESULT
+	Function GetTypeInfoOfGuid(
+		/* [in] */ ByRef guid As GUID,
+		/* [out] */ ByRef TInfo As ITypeInfo) As HRESULT
+	Function /* [local] */ GetLibAttr(
+		/* [out] */ ByRef TLibAttr As TLIBATTR) As HRESULT
+	Function GetTypeComp(
+		/* [out] */ ByRef TComp As ITypeComp) As HRESULT
+	Function /* [local] */ GetDocumentation(
+		/* [in] */ index As Long,
+		/* [out] */ ByRef BstrName As BSTR,
+		/* [out] */ ByRef BstrDocString As BSTR,
+		/* [out] */ ByRef dwHelpContext As DWord,
+		/* [out] */ ByRef BstrHelpFile As BSTR) As HRESULT
+	Function /* [local] */ IsName(
+		/* [out][in] */ szNameBuf As LPOLESTR,
+		/* [in] */ lHashVal As DWord,
+		/* [out] */ ByRef pfName As BOOL) As HRESULT
+	Function /* [local] */ FindName(
+		/* [out][in] */ szNameBuf As LPOLESTR,
+		/* [in] */ lHashVal As DWord,
+		/* [length_is][size_is][out] */ pTInfo As *ITypeInfo,
+		/* [length_is][size_is][out] */ rgMemId As *MEMBERID,
+		/* [out][in] */ ByRef cFound As Word) As HRESULT
+	Sub /* [local] */ ReleaseTLibAttr(
+		/* [in] */ ByRef TLibAttr As TLIBATTR)
+End Interface
+
+/* interface ITypeLib2 */
+/* [unique][uuid][object] */
+
+Dim IID_ITypeLib2 = [&h00020411, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ITypeLib2
+	Inherits ITypeLib
+
+	Function GetCustData(
+		/* [in] */ ByRef guid As GUID,
+		/* [out] */ ByRef VarVal As VARIANT) As HRESULT
+	/* [local] */ Function GetLibStatistics(
+		/* [out] */ ByRef cUniqueNames As DWord,
+		/* [out] */ ByRef chUniqueNames As DWord) As HRESULT
+	/* [local] */ Function GetDocumentation2(
+		/* [in] */ index As Long,
+		/* [in] */ lcid As LCID,
+		/* [out] */ ByRef bstrHelpString As BSTR,
+		/* [out] */ ByRef dwHelpStringContext As DWord,
+		/* [out] */ ByRef bstrHelpStringDll As BSTR) As HRESULT
+	Function GetAllCustData(
+		/* [out] */ ByRef CustData As CUSTDATA) As HRESULT
+End Interface
+
+/* interface ITypeChangeEvents */
+/* [local][unique][uuid][object] */
+
+Enum CHANGEKIND
+	CHANGEKIND_ADDMEMBER = 0
+	CHANGEKIND_DELETEMEMBER = 1
+	CHANGEKIND_SETNAMES = 2
+	CHANGEKIND_SETDOCUMENTATION = 3
+	CHANGEKIND_GENERAL = 4
+	CHANGEKIND_INVALIDATE = 5
+	CHANGEKIND_CHANGEFAILED = 6
+	CHANGEKIND_MAX = 7
+End Enum
+
+Dim IID_ITypeChangeEvents = [&h00020410, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ITypeChangeEvents
+	Inherits IUnknown
+
+	Function RequestTypeChange(
+		/* [in] */ changeKind As CHANGEKIND,
+		/* [in] */ TInfoBefore As ITypeInfo,
+		/* [in] */ pStrName As LPOLESTR,
+		/* [out] */ ByRef fCancel As Long) As HRESULT
+	Function AfterTypeChange(
+		/* [in] */ changeKind As CHANGEKIND,
+		/* [in] */ TInfoAfter As ITypeInfo,
+		/* [in] */ pStrName As LPOLESTR) As HRESULT
+End Interface
+
+/* interface IErrorInfo */
+/* [unique][uuid][object] */
+
+Dim IID_IErrorInfo = [&h1CF2B120, &h547D, &h101B, [&h8E, &h65, &h08, &h00, &h2B, &h2B, &hD1, &h19]] As IID
+
+Interface IErrorInfo
+	Inherits IUnknown
+
+	Function GetGUID(
+		/* [out] */ ByRef guid As GUID) As HRESULT
+	Function GetSource(
+		/* [out] */ ByRef BstrSource As BSTR) As HRESULT
+	Function GetDescription(
+		/* [out] */ ByRef BstrDescription As BSTR) As HRESULT
+	Function GetHelpFile(
+		/* [out] */ ByRef BstrHelpFile As BSTR) As HRESULT
+	Function GetHelpContext(
+		/* [out] */ ByRef dwHelpContext As DWord) As HRESULT
+End Interface
+
+/* interface ICreateErrorInfo */
+/* [unique][uuid][object] */
+
+TypeDef LPCREATEERRORINFO = /* [unique] */ *ICreateErrorInfo
+
+Dim IID_ICreateErrorInfo = [&h22F03340, &h547D, &h101B, [&h8E, &h65, &h08, &h00, &h2B, &h2B, &hD1, &h19]] As IID
+
+Interface ICreateErrorInfo
+	Inherits IUnknown
+
+	Function SetGUID(
+		/* [in] */ ByRef rguid As GUID) As HRESULT
+	Function SetSource(
+		/* [in] */ szSource As LPOLESTR) As HRESULT
+	Function SetDescription(
+		/* [in] */ szDescription As LPOLESTR) As HRESULT
+	Function SetHelpFile(
+		/* [in] */ szHelpFile As LPOLESTR) As HRESULT
+	Function SetHelpContext(
+		/* [in] */ dwHelpContext As DWord) As HRESULT
+End Interface
+
+/* interface ISupportErrorInfo */
+/* [unique][uuid][object] */
+
+Dim IID_ISupportErrorInfo = [&hDF0B3D60, &h548F, &h101B, [&h8E, &h65, &h08, &h00, &h2B, &h2B, &hD1, &h19]] As IID
+
+Interface ISupportErrorInfo
+	Inherits IUnknown
+
+	Function InterfaceSupportsErrorInfo(
+		/* [in] */ ByRef riid As IID) As HRESULT
+End Interface
+
+/* interface ITypeFactory */
+/* [uuid][object] */
+
+Dim IID_ITypeFactory = [&h0000002E, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ITypeFactory
+	Inherits IUnknown
+
+	Function CreateFromTypeInfo(
+		/* [in] */ TypeInfo As ITypeInfo,
+		/* [in] */ ByRef riid As IID,
+		/* [iid_is][out] */ ByRef pv As IUnknown) As HRESULT
+End Interface
+
+/* interface ITypeMarshal */
+/* [uuid][object][local] */
+
+Dim IID_ITypeMarshal = [&h0000002D, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface ITypeMarshal
+	Inherits IUnknown
+
+	Function Size(
+		/* [in] */ pvType As VoidPtr,
+		/* [in] */ dwDestContext As DWord,
+		/* [in] */ pvDestContext As VoidPtr,
+		/* [out] */ ByRef Size As DWord) As HRESULT
+	Function Marshal(
+		/* [in] */ pvType As VoidPtr,
+		/* [in] */ dwDestContext As DWord,
+		/* [in] */ pvDestContext As VoidPtr,
+		/* [in] */ cbBufferLength As DWord,
+		/* [out] */ pBuffer As *Byte,
+		/* [out] */ ByRef cbWritten As DWord) As HRESULT
+	Function Unmarshal(
+		/* [out] */ pvType As VoidPtr,
+		/* [in] */ dwFlags As DWord,
+		/* [in] */ cbBufferLength As DWord,
+		/* [in] */ pBuffer As *Byte,
+		/* [out] */ ByRef cbRead As DWord) As HRESULT
+	Function Free(
+		/* [in] */ pvType As VoidPtr) As HRESULT
+End Interface
+
+/* interface IRecordInfo */
+/* [uuid][object][local] */
+
+Dim IID_IRecordInfo = [&h0000002F, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+
+Interface IRecordInfo
+	Inherits IUnknown
+
+	Function RecordInit(
+		/* [out] */ pvNew As VoidPtr) As HRESULT
+	Function RecordClear(
+		/* [in] */ pvExisting As VoidPtr) As HRESULT
+	Function RecordCopy(
+		/* [in] */ pvExisting As VoidPtr,
+		/* [out] */ pvNew As VoidPtr) As HRESULT
+	Function GetGuid(
+		/* [out] */ ByRef guid As GUID) As HRESULT
+	Function GetName(
+		/* [out] */ ByRef bstrName As BSTR) As HRESULT
+	Function GetSize(
+		/* [out] */ ByRef cbSize As DWord) As HRESULT
+	Function GetTypeInfo(
+		/* [out] */ ByRef TypeInfo As ITypeInfo) As HRESULT
+	Function GetField(
+		/* [in] */ pvData As VoidPtr,
+		/* [in] */ szFieldName As LPCOLESTR,
+		/* [out] */ ByRef varField As VARIANT) As HRESULT
+	Function GetFieldNoCopy(
+		/* [in] */ pvData As VoidPtr,
+		/* [in] */ szFieldName As LPCOLESTR,
+		/* [out] */ ByRef varField As VARIANT,
+		/* [out] */ ByRef pvDataCArray As VoidPtr) As HRESULT
+	Function PutField(
+		/* [in] */ wFlags As DWord,
+		/* [out][in] */ pvData As VoidPtr,
+		/* [in] */ szFieldName As LPCOLESTR,
+		/* [in] */ ByRef varField As VARIANT) As HRESULT
+	Function PutFieldNoCopy(
+		/* [in] */ wFlags As DWord,
+		/* [out][in] */ pvData As VoidPtr,
+		/* [in] */ szFieldName As LPCOLESTR,
+		/* [in] */ ByRef varField As VARIANT) As HRESULT
+	Function GetFieldNames(
+		/* [out][in] */ ByRef cNames As DWord,
+		/* [length_is][size_is][out] */ rgBstrNames As *BSTR) As HRESULT
+	Function IsMatchingType(
+		/* [in] */ RecordInfo As IRecordInfo) As BOOL
+	Function RecordCreate() As VoidPtr
+	Function RecordCreateCopy(
+		/* [in] */ pvSource As VoidPtr,
+		/* [out] */ ByRef pvDest As VoidPtr) As HRESULT
+	Function RecordDestroy(
+		/* [in] */ pvRecord As VoidPtr) As HRESULT
+End Interface
+
+/* interface IErrorLog */
+/* [unique][uuid][object] */
+
+Dim IID_IErrorLog = [&h3127CA40, &h446E, &h11CE, [&h81, &h35, &h00, &hAA, &h00, &h4B, &hB8, &h51]] As IID
+
+Interface IErrorLog
+	Inherits IUnknown
+
+	Function AddError(
+		/* [in] */ pszPropName As LPCOLESTR,
+		/* [in] */ ByRef pExcepInfo As EXCEPINFO) As HRESULT
+End Interface
+
+/* interface IPropertyBag */
+/* [unique][uuid][object] */
+
+Dim IID_IPropertyBag = [&h55272A00, &h42CB, &h11CE, [&h81, &h35, &h00, &hAA, &h00, &h4B, &hB8, &h51]] As IID
+
+Interface IPropertyBag
+	Inherits IUnknown
+
+	/* [local] */ Function Read(
+		/* [in] */ pszPropName As LPCOLESTR,
+		/* [out][in] */ ByRef Var As VARIANT,
+		/* [in] */ ErrorLog As IErrorLog) As HRESULT
+
+	Function Write(
+		/* [in] */ pszPropName As LPCOLESTR,
+		/* [in] */ ByRef Var As VARIANT) As HRESULT
+End Interface
Index: /trunk/ab5.0/ablib/src/OleAuto.ab
===================================================================
--- /trunk/ab5.0/ablib/src/OleAuto.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/OleAuto.ab	(revision 506)
@@ -0,0 +1,669 @@
+' OleAuto.ab
+
+' EXTERN_C const IID IID_StdOle;
+
+Const STDOLE_MAJORVERNUM = &h1
+Const STDOLE_MINORVERNUM = &h0
+Const STDOLE_LCID = &h0000
+
+' Version # of stdole2.tlb
+Const STDOLE2_MAJORVERNUM = &h2
+Const STDOLE2_MINORVERNUM = &h0
+Const STDOLE2_LCID = &h0000
+
+#require <oaidl.ab>
+
+' BSTR API
+Declare Function SysAllocString Lib "oleaut32" (sz As /*Const*/ *OLECHAR) As BSTR
+Declare Function SysReAllocString Lib "oleaut32" (ByRef bstr As BSTR, psz As /*Const*/ *OLECHAR) As Long
+Declare Function SysAllocStringLen Lib "oleaut32" (pch As /*Const*/ *OLECHAR, cch As DWord) As BSTR
+Declare Function SysReAllocStringLen Lib "oleaut32" (ByRef bstr As BSTR, pch As /*Const*/ *OLECHAR, cch As DWord) As Long
+Declare Sub SysFreeString Lib "oleaut32" (bstr As BSTR)
+Declare Function SysStringLen Lib "oleaut32" (bstr As BSTR) As DWord
+
+'#if (defined (_WIN32) Or defined (_WIN64))
+Declare Function SysStringByteLen Lib "oleaut32" (bstr As BSTR) As DWord
+Declare Function SysAllocStringByteLen Lib "oleaut32" (pch As PCSTR, len As DWord) As BSTR
+'#endif
+
+' Time API
+Declare Function DosDateTimeToVariantTime Lib "oleaut32" (wDosDate As Word, wDosTime As Word, ByRef vtime As Double) As Long
+Declare Function VariantTimeToDosDateTime Lib "oleaut32" (vtime As Double, ByRef wDosDate As Word, ByRef wDosTime As Word) As Long
+
+'#if (defined (_WIN32) Or defined (_WIN64))
+Declare Function SystemTimeToVariantTime Lib "oleaut32" (ByRef SystemTime As SYSTEMTIME, ByRef vtime As Double) As Long
+Declare Function VariantTimeToSystemTime Lib "oleaut32" (vtime As Double, ByRef SystemTime As SYSTEMTIME) As Long
+'#endif
+
+' SafeArray API
+Declare Function SafeArrayAllocDescriptor Lib "oleaut32" (cDims As DWord, ByRef psaOut As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayAllocDescriptorEx Lib "oleaut32" (vt As VARTYPE, cDims As DWord, ByRef psaOut As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayAllocData Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayCreate Lib "oleaut32" (vt As VARTYPE, cDims As DWord, ByRef rgsabound As SAFEARRAYBOUND) As *SAFEARRAY
+Declare Function SafeArrayCreateEx Lib "oleaut32" (vt As VARTYPE, cDims As DWord, ByRef rgsabound As SAFEARRAYBOUND, pvExtra As VoidPtr) As *SAFEARRAY
+Declare Function SafeArrayCopyData Lib "oleaut32" (psaSource As *SAFEARRAY, psaTarget As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayDestroyDescriptor Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayDestroyData Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayDestroy Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayRedim Lib "oleaut32" (psa As *SAFEARRAY, ByRef psaboundNew As SAFEARRAYBOUND) As HRESULT
+Declare Function SafeArrayGetDim Lib "oleaut32" (psa As *SAFEARRAY) As DWord
+Declare Function SafeArrayGetElemsize Lib "oleaut32" (psa As *SAFEARRAY) As DWord
+Declare Function SafeArrayGetUBound Lib "oleaut32" (psa As *SAFEARRAY, ByRef lUbound As Long) As HRESULT
+Declare Function SafeArrayGetLBound Lib "oleaut32" (psa As *SAFEARRAY, ByRef lLbound As Long) As HRESULT
+Declare Function SafeArrayLock Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayUnlock Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayAccessData Lib "oleaut32" (psa As *SAFEARRAY, ByRef pvData As VoidPtr) As HRESULT
+Declare Function SafeArrayUnaccessData Lib "oleaut32" (psa As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayGetElement Lib "oleaut32" (psa As *SAFEARRAY, rgIndices As *Long, ByRef v As Any) As HRESULT
+Declare Function SafeArrayPutElement Lib "oleaut32" (psa As *SAFEARRAY, rgIndices As *Long, ByRef v As Any) As HRESULT
+Declare Function SafeArrayCopy Lib "oleaut32" (psa As *SAFEARRAY, ByRef ppsaOut As *SAFEARRAY) As HRESULT
+Declare Function SafeArrayPtrOfIndex Lib "oleaut32" (psa As *SAFEARRAY, rgIndices As *Long, ByRef pvData As VoidPtr) As HRESULT
+Declare Function SafeArraySetRecordInfo Lib "oleaut32" (psa As *SAFEARRAY, prinfo As *IRecordInfo) As HRESULT
+Declare Function SafeArrayGetRecordInfo Lib "oleaut32" (psa As *SAFEARRAY, ByRef prinfo As *IRecordInfo) As HRESULT
+Declare Function SafeArraySetIID Lib "oleaut32" (psa As *SAFEARRAY, ByRef guid As IID) As HRESULT
+Declare Function SafeArrayGetIID Lib "oleaut32" (psa As *SAFEARRAY, ByRef guid As IID) As HRESULT
+Declare Function SafeArrayGetVartype Lib "oleaut32" (psa As *SAFEARRAY, ByRef vt As VARTYPE) As HRESULT
+Declare Function SafeArrayCreateVector Lib "oleaut32" (psa As *SAFEARRAY, ByRef cElements As DWord) As *SAFEARRAY
+Declare Function SafeArrayCreateVectorEx Lib "oleaut32" (psa As *SAFEARRAY, ByRef cElements As DWord, pvExtra As VoidPtr) As *SAFEARRAY
+
+' VARIANT API
+Declare Sub VariantInit Lib "oleaut32" (ByRef varg As VARIANTARG)
+Declare Function VariantClear Lib "oleaut32" (ByRef varg As VARIANTARG) As HRESULT
+Declare Function VariantCopy Lib "oleaut32" (ByRef vargDest As VARIANTARG, ByRef vargSrc As VARIANTARG) As HRESULT
+Declare Function VariantCopyInd Lib "oleaut32" (ByRef varDest As VARIANT, ByRef vargSrc As VARIANTARG) As HRESULT
+Declare Function VariantChangeType Lib "oleaut32" (ByRef vargDest As VARIANT, ByRef varSrc As VARIANTARG, wFlags As Word, vt As VARTYPE) As HRESULT
+Declare Function VariantChangeTypeEx Lib "oleaut32" (ByRef vargDest As VARIANT, ByRef varSrc As VARIANTARG, lcid As LCID, wFlags As Word, vt As VARTYPE) As HRESULT
+
+' Flags for VariantChangeType/VariantChangeTypeEx
+Const VARIANT_NOVALUEPROP = &h01
+Const VARIANT_ALPHABOOL = &h02
+Const VARIANT_NOUSEROVERRIDE = &h04
+Const VARIANT_CALENDAR_HIJRI = &h08
+Const VARIANT_LOCALBOOL = &h10
+Const VARIANT_CALENDAR_THAI = &h20
+Const VARIANT_CALENDAR_GREGORIAN = &h40
+Const VARIANT_USE_NLS = &h80
+
+' Vector <-> Bstr conversion APIs
+Declare Function VectorFromBstr Lib "oleaut32" (bstr As BSTR, ByRef psa As *SAFEARRAY) As HRESULT
+Declare Function BstrFromVector Lib "oleaut32" (psa As *SAFEARRAY, ByRef bstr As BSTR) As HRESULT
+
+' Variant API Flags
+Const VAR_TIMEVALUEONLY = &h00000001 As DWord
+Const VAR_DATEVALUEONLY = &h00000002 As DWord
+Const VAR_VALIDDATE = &h00000004 As DWord
+Const VAR_CALENDAR_HIJRI = &h00000008 As DWord
+Const VAR_LOCALBOOL = &h00000010 As DWord
+Const VAR_FORMAT_NOSUBSTITUTE = &h00000020 As DWord
+Const VAR_FOURDIGITYEARS = &h00000040 As DWord
+Const LOCALE_USE_NLS = &h10000000 As DWord
+Const VAR_CALENDAR_THAI = &h00000080 As DWord
+Const VAR_CALENDAR_GREGORIAN = &h00000100 As DWord
+
+Const VTDATEGRE_MAX = 2958465
+Const VTDATEGRE_MIN = -657434
+
+' VARTYPE Coercion API
+Declare Function VarUI1FromI2 Lib "oleaut32" (sIn As Integer, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromI4 Lib "oleaut32" (lIn As Long, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromI8 Lib "oleaut32" (i64In As Int64, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromR4 Lib "oleaut32" (fltIn As Single, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromR8 Lib "oleaut32" (dblIn As Double, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromCy Lib "oleaut32" (cyIn As CY, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromDate Lib "oleaut32" (dateIn As DATE, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromI1 Lib "oleaut32" (cIn As SByte, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromUI2 Lib "oleaut32" (uiIn As Word, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef bOut As Byte) As HRESULT
+
+Declare Function VarI2FromUI1 Lib "oleaut32" (bIn As Byte, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromI4 Lib "oleaut32" (lIn As Long, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromI8 Lib "oleaut32" (i64In As Int64, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromR4 Lib "oleaut32" (fltIn As Single, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromR8 Lib "oleaut32" (dblIn As Double, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromCy Lib "oleaut32" (cyIn As CY, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromDate Lib "oleaut32" (dateIn As DATE, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromI1 Lib "oleaut32" (cIn As SByte, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromUI2 Lib "oleaut32" (uiIn As Word, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef sOut As Integer) As HRESULT
+
+Declare Function VarI4FromUI1 Lib "oleaut32" (bIn As Byte, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromI2 Lib "oleaut32" (sIn As Integer, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromI8 Lib "oleaut32" (i64In As Int64, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromR4 Lib "oleaut32" (fltIn As Single, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromR8 Lib "oleaut32" (dblIn As Double, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromCy Lib "oleaut32" (cyIn As CY, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromDate Lib "oleaut32" (dateIn As DATE, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromI1 Lib "oleaut32" (cIn As SByte, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromUI2 Lib "oleaut32" (uiIn As Word, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef lOut As Long) As HRESULT
+Declare Function VarI4FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef lOut As Long) As HRESULT
+
+Declare Function VarI8FromUI1 Lib "oleaut32" (bIn As Byte, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromI2 Lib "oleaut32" (sIn As Integer, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromI4 Lib "oleaut32" (lIn As Long, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromR4 Lib "oleaut32" (fltIn As Single, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromR8 Lib "oleaut32" (dblIn As Double, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromCy Lib "oleaut32" (cyIn As CY, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromDate Lib "oleaut32" (dateIn As DATE, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromI1 Lib "oleaut32" (cIn As SByte, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromUI2 Lib "oleaut32" (uiIn As Word, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef i64Out As Int64) As HRESULT
+
+Declare Function VarR4FromUI1 Lib "oleaut32" (bIn As Byte, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromI2 Lib "oleaut32" (sIn As Integer, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromI4 Lib "oleaut32" (lIn As Long, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromI8 Lib "oleaut32" (i64In As Int64, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromR8 Lib "oleaut32" (dblIn As Double, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromCy Lib "oleaut32" (cyIn As CY, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromDate Lib "oleaut32" (dateIn As DATE, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromI1 Lib "oleaut32" (cIn As SByte, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromUI2 Lib "oleaut32" (uiIn As Word, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef fltOut As Single) As HRESULT
+
+Declare Function VarR8FromUI1 Lib "oleaut32" (bIn As Byte, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromI2 Lib "oleaut32" (sIn As Integer, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromI4 Lib "oleaut32" (lIn As Long, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromI8 Lib "oleaut32" (i64In As Int64, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromR4 Lib "oleaut32" (fltIn As Single, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromCy Lib "oleaut32" (cyIn As CY, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromDate Lib "oleaut32" (dateIn As DATE, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromI1 Lib "oleaut32" (cIn As SByte, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromUI2 Lib "oleaut32" (uiIn As Word, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef dblOut As Double) As HRESULT
+
+Declare Function VarDateFromUI1 Lib "oleaut32" (bIn As Byte, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromI2 Lib "oleaut32" (sIn As Integer, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromI4 Lib "oleaut32" (lIn As Long, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromI8 Lib "oleaut32" (i64In As Int64, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromR4 Lib "oleaut32" (fltIn As Single, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromR8 Lib "oleaut32" (dblIn As Double, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromCy Lib "oleaut32" (cyIn As CY, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromI1 Lib "oleaut32" (cIn As SByte, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromUI2 Lib "oleaut32" (uiIn As Word, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromUI4 Lib "oleaut32" (ulIn As DWord, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromUI8 Lib "oleaut32" (ui64In As QWord, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef dateOut As DATE) As HRESULT
+
+Declare Function VarCyFromUI1 Lib "oleaut32" (bIn As Byte, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromI2 Lib "oleaut32" (sIn As Integer, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromI4 Lib "oleaut32" (lIn As Long, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromI8 Lib "oleaut32" (i64In As Int64, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromR4 Lib "oleaut32" (fltIn As Single, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromR8 Lib "oleaut32" (dblIn As Double, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromDate Lib "oleaut32" (dateIn As DATE, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromI1 Lib "oleaut32" (cIn As SByte, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromUI2 Lib "oleaut32" (uiIn As Word, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromUI4 Lib "oleaut32" (ulIn As DWord, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromUI8 Lib "oleaut32" (ui64In As QWord, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef cyOut As CY) As HRESULT
+
+Declare Function VarBstrFromUI1 Lib "oleaut32" (bIn As Byte, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromI2 Lib "oleaut32" (sIn As Integer, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromI4 Lib "oleaut32" (lIn As Long, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromI8 Lib "oleaut32" (i64In As Int64, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromR4 Lib "oleaut32" (fltIn As Single, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromR8 Lib "oleaut32" (dblIn As Double, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromCy Lib "oleaut32" (cyIn As CY, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromDate Lib "oleaut32" (dateIn As DATE, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromI1 Lib "oleaut32" (cIn As SByte, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromUI2 Lib "oleaut32" (uiIn As Word, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromUI4 Lib "oleaut32" (ulIn As DWord, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromUI8 Lib "oleaut32" (i64In As QWord, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromDec Lib "oleaut32" (ByRef decIn As DECIMAL, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+
+Declare Function VarBoolFromUI1 Lib "oleaut32" (bIn As Byte, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromI2 Lib "oleaut32" (sIn As Integer, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromI4 Lib "oleaut32" (lIn As Long, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromI8 Lib "oleaut32" (i64In As Int64, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromR4 Lib "oleaut32" (fltIn As Single, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromR8 Lib "oleaut32" (dblIn As Double, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromDate Lib "oleaut32" (dateIn As DATE, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromCy Lib "oleaut32" (cyIn As CY, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromI1 Lib "oleaut32" (cIn As SByte, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromUI2 Lib "oleaut32" (uiIn As Word, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromUI4 Lib "oleaut32" (ulIn As DWord, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromUI8 Lib "oleaut32" (i64In As QWord, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef boolOut As VARIANT_BOOL) As HRESULT
+
+Declare Function VarI1FromI2 Lib "oleaut32" (sIn As Integer, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromI4 Lib "oleaut32" (lIn As Long, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromI8 Lib "oleaut32" (i64In As Int64, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromR4 Lib "oleaut32" (fltIn As Single, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromR8 Lib "oleaut32" (dblIn As Double, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromCy Lib "oleaut32" (cyIn As CY, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromDate Lib "oleaut32" (dateIn As DATE, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromI1 Lib "oleaut32" (cIn As SByte, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromUI2 Lib "oleaut32" (uiIn As Word, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef cOut As Char) As HRESULT
+
+Declare Function VarUI2FromUI1 Lib "oleaut32" (bIn As Byte, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromI2 Lib "oleaut32" (uiIn As Integer, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromI4 Lib "oleaut32" (lIn As Long, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromI8 Lib "oleaut32" (i64In As Int64, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromR4 Lib "oleaut32" (fltIn As Single, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromR8 Lib "oleaut32" (dblIn As Double, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromDate Lib "oleaut32" (dateIn As DATE, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromCy Lib "oleaut32" (cyIn As CY, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromI1 Lib "oleaut32" (cIn As SByte, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromUI8 Lib "oleaut32" (i64In As QWord, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef uiOut As Word) As HRESULT
+
+Declare Function VarUI4FromUI1 Lib "oleaut32" (bIn As Byte, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromI2 Lib "oleaut32" (uiIn As Integer, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromI4 Lib "oleaut32" (lIn As Long, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromI8 Lib "oleaut32" (i64In As Int64, ByRef lOut As DWord) As HRESULT
+Declare Function VarUI4FromR4 Lib "oleaut32" (fltIn As Single, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromR8 Lib "oleaut32" (dblIn As Double, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromDate Lib "oleaut32" (dateIn As DATE, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromCy Lib "oleaut32" (cyIn As CY, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromI1 Lib "oleaut32" (cIn As SByte, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromUI2 Lib "oleaut32" (uiIn As Word, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI4FromUI8 Lib "oleaut32" (ui64In As QWord, ByRef lOut As DWord) As HRESULT
+Declare Function VarUI4FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef ulOut As DWord) As HRESULT
+
+Declare Function VarUI8FromUI1 Lib "oleaut32" (bIn As Byte, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromI2 Lib "oleaut32" (sIn As Integer, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromI4 Lib "oleaut32" (lIn As Long, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromI8 Lib "oleaut32" (ui64In As Int64, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromR4 Lib "oleaut32" (fltIn As Single, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromR8 Lib "oleaut32" (dblIn As Double, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromCy Lib "oleaut32" (cyIn As CY, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromDate Lib "oleaut32" (dateIn As DATE, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromI1 Lib "oleaut32" (cIn As SByte, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromUI2 Lib "oleaut32" (uiIn As Word, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromUI4 Lib "oleaut32" (ulIn As DWord, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromDec Lib "oleaut32" (ByRef decIn As DECIMAL, ByRef i64Out As QWord) As HRESULT
+
+Declare Function VarDecFromUI1 Lib "oleaut32" (bIn As Byte, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromI2 Lib "oleaut32" (uiIn As Integer, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromI4 Lib "oleaut32" (lIn As Long, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromI8 Lib "oleaut32" (i64In As Int64, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromR4 Lib "oleaut32" (fltIn As Single, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromR8 Lib "oleaut32" (dblIn As Double, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromDate Lib "oleaut32" (dateIn As DATE, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromCy Lib "oleaut32" (cyIn As CY, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromDisp Lib "oleaut32" (pdispIn As *IDispatch, lcid As LCID, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromBool Lib "oleaut32" (boolIn As VARIANT_BOOL, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromI1 Lib "oleaut32" (cIn As SByte, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromUI2 Lib "oleaut32" (uiIn As Word, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromUI4 Lib "oleaut32" (ulIn As DWord, ByRef decOut As DECIMAL) As HRESULT
+Declare Function VarDecFromUI8 Lib "oleaut32" (ui64In As QWord, ByRef decOut As DECIMAL) As HRESULT
+
+Declare Function VarUI1FromInt Lib "oleaut32" Alias "VarUI1FromI4" (lIn As Long, ByRef bOut As Byte) As HRESULT
+Declare Function VarUI1FromUint Lib "oleaut32" Alias "VarUI1FromUI4" (ulIn As DWord, ByRef bOut As Byte) As HRESULT
+Declare Function VarI2FromInt Lib "oleaut32" Alias "VarI2FromI4" (lIn As Long, ByRef sOut As Integer) As HRESULT
+Declare Function VarI2FromUint Lib "oleaut32" Alias "VarI2FromUI4" (ulIn As DWord, ByRef sOut As Integer) As HRESULT
+Declare Function VarI4FromUint Lib "oleaut32" Alias "VarI4FromUI4" (ulIn As DWord, ByRef lOut As Long) As HRESULT
+Declare Function VarI8FromInt Lib "oleaut32" Alias "VarI8FromI4" (lIn As Long, ByRef i64Out As Int64) As HRESULT
+Declare Function VarI8FromUint Lib "oleaut32" Alias "VarI8FromUI4" (ulIn As DWord, ByRef i64Out As Int64) As HRESULT
+Declare Function VarR4FromInt Lib "oleaut32" Alias "VarR4FromI4" (lIn As Long, ByRef fltOut As Single) As HRESULT
+Declare Function VarR4FromUint Lib "oleaut32" Alias "VarR4FromUI4" (ulIn As DWord, ByRef fltOut As Single) As HRESULT
+Declare Function VarR8FromInt Lib "oleaut32" Alias "VarR8FromI4" (lIn As Long, ByRef dblOut As Double) As HRESULT
+Declare Function VarR8FromUint Lib "oleaut32" Alias "VarR8FromUI4" (ulIn As DWord, ByRef dblOut As Double) As HRESULT
+Declare Function VarDateFromInt Lib "oleaut32" Alias "VarDateFromI4" (lIn As Long, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromUint Lib "oleaut32" Alias "VarDateFromUI4" (ulIn As DWord, ByRef dateOut As DATE) As HRESULT
+Declare Function VarCyFromInt Lib "oleaut32" Alias "VarCyFromI4" (lIn As Long, ByRef cyOut As CY) As HRESULT
+Declare Function VarCyFromUint Lib "oleaut32" Alias "VarCyFromUI4" (ulIn As DWord, ByRef cyOut As CY) As HRESULT
+Declare Function VarBstrFromInt Lib "oleaut32" Alias "VarBstrFromI4" (lIn As Long, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBstrFromUint Lib "oleaut32" Alias "VarBstrFromUI4" (ulIn As DWord, lcid As LCID, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarBoolFromInt Lib "oleaut32" Alias "VarBoolFromI4" (lIn As Long, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarBoolFromUint Lib "oleaut32" Alias "VarBoolFromUI4" (ulIn As DWord, ByRef boolOut As VARIANT_BOOL) As HRESULT
+Declare Function VarI1FromInt Lib "oleaut32" Alias "VarI1FromI4" (lIn As Long, ByRef cOut As Char) As HRESULT
+Declare Function VarI1FromUint Lib "oleaut32" Alias "VarI1FromUI4" (ulIn As DWord, ByRef cOut As Char) As HRESULT
+Declare Function VarUI2FromInt Lib "oleaut32" Alias "VarUI2FromI4" (lIn As Long, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI2FromUint Lib "oleaut32" Alias "VarUI2FromUI4" (ulIn As DWord, ByRef uiOut As Word) As HRESULT
+Declare Function VarUI4FromInt Lib "oleaut32" Alias "VarUI4FromI4" (lIn As Long, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUI8FromInt Lib "oleaut32" Alias "VarUI8FromI4" (lIn As Long, ByRef i64Out As QWord) As HRESULT
+Declare Function VarUI8FromUint Lib "oleaut32" Alias "VarUI8FromUI4" (ulIn As DWord, ByRef i64Out As QWord) As HRESULT
+Declare Function VarDecFromInt Lib "oleaut32" Alias "VarDecFromI4" (lIn As Long, ByRef decOut As DECIMAL) As HRESULT
+
+Declare Function VarIntFromUI1 Lib "oleaut32" Alias "VarI4FromUI1" (bIn As Byte, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromI2 Lib "oleaut32" Alias "VarI4FromI2" (sIn As Integer, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromI8 Lib "oleaut32" Alias "VarI4FromI8" (i64In As Int64, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromR4 Lib "oleaut32" Alias "VarI4FromR4" (fltIn As Single, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromR8 Lib "oleaut32" Alias "VarI4FromR8" (dblIn As Double, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromCy Lib "oleaut32" Alias "VarI4FromCy" (cyIn As CY, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromDate Lib "oleaut32" Alias "VarI4FromDate" (dateIn As DATE, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromStr Lib "oleaut32" Alias "VarI4FromStr" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromDisp Lib "oleaut32" Alias "VarI4FromDisp" (pdispIn As *IDispatch, lcid As LCID, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromBool Lib "oleaut32" Alias "VarI4FromBool" (boolIn As VARIANT_BOOL, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromI1 Lib "oleaut32" Alias "VarI4FromI1" (cIn As SByte, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromUI2 Lib "oleaut32" Alias "VarI4FromUI2" (uiIn As Word, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromUI4 Lib "oleaut32" Alias "VarI4FromUI4" (ulIn As DWord, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromUI8 Lib "oleaut32" Alias "VarI4FromUI8" (ui64In As QWord, ByRef lOut As Long) As HRESULT
+Declare Function VarIntFromDec Lib "oleaut32" Alias "VarI4FromDec" (ByRef decIn As DECIMAL, ByRef lOut As Long) As HRESULT
+Declare Function VarUintFromUI1 Lib "oleaut32" Alias "VarUI4FromUI1" (bIn As Byte, ByRef ulOut As DWord) As HRESULT
+Declare Function VarIntFromUint Lib "oleaut32" Alias "VarI4FromUI4" (ulIn As DWord, ByRef lOut As Long) As HRESULT
+Declare Function VarUintFromI2 Lib "oleaut32" Alias "VarUI4FromI2" (uiIn As Integer, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromI4 Lib "oleaut32" Alias "VarUI4FromI4" (lIn As Long, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromI8 Lib "oleaut32" Alias "VarUI4FromI8" (i64In As Int64, ByRef lOut As DWord) As HRESULT
+Declare Function VarUintFromR4 Lib "oleaut32" Alias "VarUI4FromR4" (fltIn As Single, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromR8 Lib "oleaut32" Alias "VarUI4FromR8" (dblIn As Double, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromDate Lib "oleaut32" Alias "VarUI4FromDate" (dateIn As DATE, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromCy Lib "oleaut32" Alias "VarUI4FromCy" (cyIn As CY, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromStr Lib "oleaut32" Alias "VarUI4FromStr" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromDisp Lib "oleaut32" Alias "VarUI4FromDisp" (pdispIn As *IDispatch, lcid As LCID, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromBool Lib "oleaut32" Alias "VarUI4FromBool" (boolIn As VARIANT_BOOL, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromI1 Lib "oleaut32" Alias "VarUI4FromI1" (cIn As SByte, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromUI2 Lib "oleaut32" Alias "VarUI4FromUI2" (uiIn As Word, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromUI8 Lib "oleaut32" Alias "VarUI4FromUI8" (ui64In As QWord, ByRef lOut As DWord) As HRESULT
+Declare Function VarUintFromDec Lib "oleaut32" Alias "VarUI4FromDec" (ByRef decIn As DECIMAL, ByRef ulOut As DWord) As HRESULT
+Declare Function VarUintFromInt Lib "oleaut32" Alias "VarUI4FromI4" (lIn As Long, ByRef ulOut As DWord) As HRESULT
+
+Sub VarI4FromInt(iIn As Long, ByRef lOut As Long)
+	lOut = iIn
+End Sub
+
+Sub VarUI4FromUint(uiIn As DWord, ByRef ulOut As DWord)
+	ulOut = uiIn
+End Sub
+
+Sub VarIntFromI4(lIn As Long, ByRef iOut As Long)
+	iOut = lIn
+End Sub
+
+Sub VarUintFromUI4(ulIn As DWord, ByRef uiOut As DWord)
+	uiOut = ulIn
+End Sub
+
+' New VARIANT <-> string parsing functions
+Type NUMPARSE
+	cDig As Long
+	dwInFlags As DWord
+	dwOutFlags As DWord
+	cchUsed As Long
+	nBaseShift As Long
+	nPwr10 As Long
+End Type
+
+Const NUMPRS_LEADING_WHITE  = &h0001
+Const NUMPRS_TRAILING_WHITE = &h0002
+Const NUMPRS_LEADING_PLUS = &h0004
+Const NUMPRS_TRAILING_PLUS = &h0008
+Const NUMPRS_LEADING_MINUS = &h0010
+Const NUMPRS_TRAILING_MINUS = &h0020
+Const NUMPRS_HEX_OCT = &h0040
+Const NUMPRS_PARENS = &h0080
+Const NUMPRS_DECIMAL = &h0100
+Const NUMPRS_THOUSANDS = &h0200
+Const NUMPRS_CURRENCY = &h0400
+Const NUMPRS_EXPONENT = &h0800
+Const NUMPRS_USE_ALL = &h1000
+Const NUMPRS_STD = &h1FFF
+
+Const NUMPRS_NEG = &h110000
+Const NUMPRS_INEXACT = &h20000
+
+Const VTBIT_I1 = (1 << VT_I1)
+Const VTBIT_UI1 = (1 << VT_UI1)
+Const VTBIT_I2 = (1 << VT_I2)
+Const VTBIT_UI2 = (1 << VT_UI2)
+Const VTBIT_I4 = (1 << VT_I4)
+Const VTBIT_UI4 = (1 << VT_UI4)
+Const VTBIT_I8 = (1 << VT_I8)
+Const VTBIT_UI8 = (1 << VT_UI8)
+Const VTBIT_R4 = (1 << VT_R4)
+Const VTBIT_R8 = (1 << VT_R8)
+Const VTBIT_CY = (1 << VT_CY)
+Const VTBIT_DECIMAL = (1 << VT_DECIMAL)
+
+Declare Function VarParseNumFromStr Lib "oleaut32" (strIn As *OLECHAR, lcid As LCID, dwFlags As DWord, ByRef numprs As NUMPARSE, rgbDig As *Byte) As HRESULT
+Declare Function VarNumFromParseNum Lib "oleaut32" (ByRef numprs As NUMPARSE, rgbDig As *Byte, dwVtBits As DWord, ByRef var As VARIANT) As HRESULT
+
+' VARTYPE Math API
+Declare Function VarAdd Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarAnd Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarCat Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarDiv Lib "oleaut32.dll" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarEqv Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarIdiv Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarImp Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarMod Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarMul Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarOr Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarPow Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarSub Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarXor Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, ByRef result As VARIANT) As HRESULT
+
+Declare Function VarAbs Lib "oleaut32" (ByRef in As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarFix Lib "oleaut32" (ByRef in As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarInt Lib "oleaut32" (ByRef in As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarNeg Lib "oleaut32" (ByRef in As VARIANT, ByRef result As VARIANT) As HRESULT
+Declare Function VarNot Lib "oleaut32" (ByRef in As VARIANT, ByRef result As VARIANT) As HRESULT
+
+Declare Function VarRound Lib "oleaut32" (ByRef in As VARIANT, cDecimals As Long, ByRef result As VARIANT) As HRESULT
+
+Declare Function VarCmp Lib "oleaut32" (ByRef lhs As VARIANT, ByRef rhs As VARIANT, lcid As LCID, dwFlags As DWord) As HRESULT
+
+Declare Function VarDecAdd Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As DECIMAL, ByRef result As DECIMAL) As HRESULT
+Declare Function VarDecDiv Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As DECIMAL, ByRef result As DECIMAL) As HRESULT
+Declare Function VarDecMul Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As DECIMAL, ByRef result As DECIMAL) As HRESULT
+Declare Function VarDecSub Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As DECIMAL, ByRef result As DECIMAL) As HRESULT
+
+Declare Function VarDecAbs Lib "oleaut32" (ByRef in As DECIMAL, ByRef result As DECIMAL) As HRESULT
+Declare Function VarDecFix Lib "oleaut32" (ByRef in As DECIMAL, ByRef result As DECIMAL) As HRESULT
+Declare Function VarDecInt Lib "oleaut32" (ByRef in As DECIMAL, ByRef result As DECIMAL) As HRESULT
+Declare Function VarDecNeg Lib "oleaut32" (ByRef in As DECIMAL, ByRef result As DECIMAL) As HRESULT
+
+Declare Function VarDecRound Lib "oleaut32" (ByRef in As DECIMAL, cDecimals As Long, ByRef result As DECIMAL) As HRESULT
+
+Declare Function VarDecCmp Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As DECIMAL) As HRESULT
+Declare Function VarDecCmpR8 Lib "oleaut32" (ByRef lhs As DECIMAL, ByRef rhs As Double) As HRESULT
+
+Declare Function VarCyAdd Lib "oleaut32" (lhs As CY, rhs As CY, ByRef result As CY) As HRESULT
+Declare Function VarCyMul Lib "oleaut32" (lhs As CY, rhs As CY, ByRef result As CY) As HRESULT
+Declare Function VarCyMulI4 Lib "oleaut32" (lhs As CY, rhs As Long, ByRef result As CY) As HRESULT
+Declare Function VarCyMulI8 Lib "oleaut32" (lhs As CY, rhs As Int64, ByRef result As CY) As HRESULT
+Declare Function VarCySub Lib "oleaut32" (lhs As CY, rhs As CY, ByRef result As CY) As HRESULT
+
+Declare Function VarCyAbs Lib "oleaut32" (in As CY, ByRef result As CY) As HRESULT
+Declare Function VarCyFix Lib "oleaut32" (in As CY, ByRef result As CY) As HRESULT
+Declare Function VarCyInt Lib "oleaut32" (in As CY, ByRef result As CY) As HRESULT
+Declare Function VarCyNeg Lib "oleaut32" (in As CY, ByRef result As CY) As HRESULT
+
+Declare Function VarCyRound Lib "oleaut32" (in As CY, cDecimals As Long, ByRef result As CY) As HRESULT
+
+Declare Function VarCyCmp Lib "oleaut32" (ByRef lhs As CY, ByRef rhs As CY) As HRESULT
+Declare Function VarCyCmpR8 Lib "oleaut32" (ByRef lhs As CY, ByRef rhs As Double) As HRESULT
+
+Declare Function VarBstrCat Lib "oleaut32" (lhs As BSTR, rhs As BSTR, ByRef result As BSTR) As HRESULT
+Declare Function VarBstrCmp Lib "oleaut32" (lhs As BSTR, rhs As BSTR, lcid As LCID, dwFlags As DWord) As HRESULT
+Declare Function VarR8Pow Lib "oleaut32" (lhs As Double, rhs As Double, ByRef result As Double) As HRESULT
+Declare Function VarR4CmpR8 Lib "oleaut32" (lhs As Single, rhs As Double) As HRESULT
+Declare Function VarR8Round Lib "oleaut32" (in As Double, cDecimals As Long, ByRef result As Double) As HRESULT
+
+Const VARCMP_LT = 0
+Const VARCMP_EQ = 1
+Const VARCMP_GT = 2
+Const VARCMP_NULL = 3
+
+Const VT_HARDTYPE = VT_RESERVED
+
+' New date functions
+Type UDATE
+	st As SYSTEMTIME
+	wDayOfYear As Word
+End Type
+
+Declare Function VarDateFromUdate Lib "oleaut32" (ByRef udateIn As UDATE, dwFlags As DWord, ByRef dateOut As DATE) As HRESULT
+Declare Function VarDateFromUdateEx Lib "oleaut32" (ByRef udateIn As UDATE, lcid As LCID, dwFlags As DWord, ByRef dateOut As DATE) As HRESULT
+Declare Function VarUdateFromDate Lib "oleaut32" (dateIn As DATE, dwFlags As DWord, ByRef udateOut As UDATE) As HRESULT
+
+Declare Function GetAltMonthNames Lib "oleaut32" (lcid As LCID, ByRef rgp As LPOLESTR) As HRESULT
+
+' Format
+Declare Function VarFormat Lib "oleaut32" (ByRef in As VARIANT, pstrFormat As LPOLESTR, iFirstDay As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarFormatDateTime Lib "oleaut32" (ByRef in As VARIANT, iNamedFormat As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarFormatNumber Lib "oleaut32" (ByRef in As VARIANT, iNumDig As Long, iIncLead As Long, iUseParens As Long, iGroup As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarFormatPercent Lib "oleaut32" (ByRef in As VARIANT, iNumDig As Long, iIncLead As Long, iUseParens As Long, iGroup As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarFormatCurrency Lib "oleaut32" (ByRef in As VARIANT, iNumDig As Long, iIncLead As Long, iUseParens As Long, iGroup As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+
+Declare Function VarWeekdayName Lib "oleaut32" (iWeekday As Long, fAbbrev As Long, iFirstDay As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+Declare Function VarMonthName Lib "oleaut32" (iMonth As Long, fAbbrev As Long, dwFlags As DWord, ByRef bstrOut As BSTR) As HRESULT
+
+Declare Function VarFormatFromTokens Lib "oleaut32" (ByRef in As VARIANT, pstrFormat As LPOLESTR, pbTokCur As *Byte, dwFlags As DWord, ByRef bstrOut As BSTR, lcid As LCID) As HRESULT
+Declare Function VarTokenizeFormatString Lib "oleaut32" (pstrFormat As LPOLESTR, rgbTok As *Byte, cbTok As Long, iFirstDay As Long, iFirstWeek As Long, lcid As LCID, ByRef cbActual As Long) As HRESULT
+
+' ITypeInfo
+TypeDef DISPID = Long
+typedef MEMBERID = DISPID
+
+'Const MEMBERID_NIL = DISPID_UNKNOWN
+Const ID_DEFAULTINST = -2
+
+
+Const DISPATCH_METHOD = &h1
+Const DISPATCH_PROPERTYGET = &h2
+Const DISPATCH_PROPERTYPUT = &h4
+Const DISPATCH_PROPERTYPUTREF = &h8
+
+Typedef LPTYPEINFO = VoidPtr '*ITypeInfo
+
+' ITypeComp
+TypeDef LPTYPECOMP = VoidPtr '*ITypeComp
+
+' ICreateTypeLib
+TypeDef LPCREATETYPELIB = VoidPtr '*ICreateTypeLib
+typedef LPCREATETYPEINFO = VoidPtr '*ICreateTypeInfo
+
+' TypeInfo API
+'#if (defined (_WIN32) || defined (_WIN64))
+Declare Function LHashValOfNameSysA Lib "oleaut32" (syskind As SYSKIND, lcid As LCID, szName As PCSTR) As DWord
+'#endif
+
+Declare Function LHashValOfNameSys Lib "oleaut32" (syskind As SYSKIND, lcid As LCID, szName As /*Const*/ *OLECHAR) As DWord
+
+Const LHashValOfName(lcid, szName) = LHashValOfNameSys(SYS_WIN32, (lcid), (szName))
+Const WHashValOfLHashVal(lhashval) = (((lhashval) And &h0000ffff) As Word)
+Const IsHashValCompatible(lhashval1, lhashval2) = (((&h00ff0000 And (lhashval1)) = (&h00ff0000 And (lhashval2))) As BOOL)
+
+'Declare Function LoadTypeLib Lib "oleaut32" (szFile As /*Const*/ *OLECHAR, ByRef ptlib As *ITypeLib) As DWord
+
+Const Enum REGKIND
+	REGKIND_DEFAULT,
+	REGKIND_REGISTER,
+	REGKIND_NONE
+End Enum
+
+Const LOAD_TLB_AS_32BIT = &h20
+Const LOAD_TLB_AS_64BIT = &h40
+Const MASK_TO_RESET_TLB_BITS = (Not (LOAD_TLB_AS_32BIT Or LOAD_TLB_AS_64BIT))
+
+Declare Function LoadTypeLibEx Lib "oleaut32" (szFile As /*Const*/ *OLECHAR, regkind As REGKIND, ByRef ptlib As *ITypeLib) As HRESULT
+Declare Function LoadRegTypeLib Lib "oleaut32" (ByRef rguid As GUID, wVerMajor As Word, wVerMinor As Word, lcid As LCID, ByRef ptlib As *ITypeLib) As HRESULT
+Declare Function QueryPathOfRegTypeLib Lib "oleaut32" (ByRef rguid As GUID, wVerMajor As Word, wVerMinor As Word, lcid As LCID, ByRef bstrPathName As BSTR) As HRESULT
+Declare Function RegisterTypeLib Lib "oleaut32" (ptlib As *ITypeLib, szFullPath As *OLECHAR, szHelpDir As *OLECHAR) As HRESULT
+Declare Function CreateTypeLib Lib "oleaut32" (syskind As SYSKIND, szFile As /*Const*/ *OLECHAR, ByRef pctlib As *ICreateTypeLib) As HRESULT
+Declare Function CreateTypeLib2 Lib "oleaut32" (syskind As SYSKIND, szFile As LPCOLESTR, ByRef pctlib As *ICreateTypeLib) As HRESULT
+
+' IDispatch implementation support
+
+Type PARAMDATA
+	szName As *OLECHAR
+	vt As *VARTYPE
+End Type
+
+TypeDef LPPARAMDATA = *PARAMDATA
+
+Type METHODDATA
+	szName As *OLECHAR
+	ppdata As *PARAMDATA
+	dispid As DISPID
+	iMeth As DWord
+	cc As CALLCONV
+	cArgs As DWord
+	wFlags As Word
+	vtReturn As VARTYPE
+End Type
+
+TypeDef LPMETHODDATA = *METHODDATA
+
+Type INTERFACEDATA
+	pmethdata As *METHODDATA
+	cMembers As DWord
+End Type
+
+TypeDef LPINTERFACEDATA = *INTERFACEDATA
+
+Declare Function DispGetParam Lib "oleaut32" (pdispparams As *DISPPARAMS, position As DWord, vtTarg As VARTYPE, ByRef varResult As VARIANT, ByRef uArgErr As DWord) As HRESULT
+Declare Function DispGetIDsOfNames Lib "oleaut32" (ptinfo As *ITypeInfo, position As DWord, vtTarg As VARTYPE, ByRef varResult As VARIANT, ByRef uArgErr As DWord) As HRESULT
+Declare Function DispInvoke Lib "oleaut32" (_this As VoidPtr, ptinfo As *ITypeInfo, dispidMember As DISPID, wFlags As Word, pparams As *DISPPARAMS, ByRef varResult As VARIANT, ByRef excepinfo As EXCEPINFO, ByRef uArgErr As DWord) As HRESULT
+Declare Function CreateDispTypeInfo Lib "oleaut32" (ByRef pidata As INTERFACEDATA, lcid As LCID, ByRef ptinfo As *ITypeInfo) As HRESULT
+Declare Function CreateStdDispatch Lib "oleaut32" (punkOuter As *IUnknown, pvThis As VoidPtr, ptinfo As *ITypeInfo, ByRef punkStdDisp As *IUnknown) As HRESULT
+Declare Function DispCallFunc Lib "oleaut32" (pvInstance As VoidPtr, oVft As ULONG_PTR, cc As CALLCONV, vtReturn As VARTYPE, cActuals As DWord, ByRef rgvt As VARTYPE, ByRef rgpvarg As *VARIANTARG, ByRef vargResult As VARIANT) As HRESULT
+
+' Active Object Registration API
+Const ACTIVEOBJECT_STRONG = &h0
+Const ACTIVEOBJECT_WEAK = &h1
+
+Declare Function RegisterActiveObject Lib "oleaut32" (punk As *IUnknown, ByRef rclsid As CLSID, dwFlags As DWord, ByRef dwRegister As DWord) As HRESULT
+Declare Function RevokeActiveObject Lib "oleaut32" (dwRegister As DWord, pvReserved As VoidPtr) As HRESULT
+Declare Function GetActiveObject Lib "oleaut32" (ByRef rclsid As CLSID, pvReserved As VoidPtr, ByRef punk As *IUnknown) As HRESULT
+
+' ErrorInfo API
+Declare Function SetErrorInfo Lib "oleaut32" (dwReserved As DWord, perrinfo As *IErrorInfo) As HRESULT
+Declare Function GetErrorInfo Lib "oleaut32" (dwReserved As DWord, ByRef perrinfo As *IErrorInfo) As HRESULT
+Declare Function CreateErrorInfo Lib "oleaut32" (ByRef perrinfo As *ICreateErrorInfo) As HRESULT
+
+' User Defined Data types support
+Declare Function GetRecordInfoFromTypeInfo Lib "oleaut32" (pTypeInfo As *ITypeInfo, ByRef pRecInfo As *IRecordInfo) As HRESULT
+Declare Function GetRecordInfoFromGuids Lib "oleaut32" (ByRef rGuidTypeLib As GUID, uVerMajor As DWord, uVerMinor As DWord, lcid As LCID, ByRef rGuidTypeInfo As GUID, ByRef pRecInfo As *IRecordInfo) As HRESULT
+
+' MISC API
+Declare Function OaBuildVersion Lib "oleaut32" () As DWord
+Declare Sub ClearCustData Lib "oleaut32" (ByRef CustData As CUSTDATA)
Index: /trunk/ab5.0/ablib/src/WinNT.ab
===================================================================
--- /trunk/ab5.0/ablib/src/WinNT.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/WinNT.ab	(revision 506)
@@ -0,0 +1,6368 @@
+' winnt.ab
+
+'#include <ctype.h>
+Const ANYSIZE_ARRAY = 1
+
+'#include <specstrings.h>
+
+'RESTRICTED_POINTER
+
+'UNALIGNED
+'UNALIGNED64
+
+#ifdef _WIN64
+Const MAX_NATURAL_ALIGNMENT = SizeOf (QWord)
+Const MEMORY_ALLOCATION_ALIGNMENT = 16
+#else
+Const MAX_NATURAL_ALIGNMENT = SizeOf (DWord)
+Const MEMORY_ALLOCATION_ALIGNMENT = 8
+#endif
+
+'TYPE_ALIGNMENT
+'PROBE_ALIGNMENT
+'PROBE_ALIGNMENT32
+
+'Const C_ASSERT(e) = 0
+
+'#require <basetsd.ab>
+#ifdef _WIN64
+TypeDef LONG_PTR =  Int64
+TypeDef ULONG_PTR = QWord
+TypeDef HALF_PTR = Long
+TypeDef UHALF_PTR = DWord
+#else
+TypeDef LONG_PTR = Long
+TypeDef ULONG_PTR = DWord
+TypeDef HALF_PTR = Integer
+TypeDef UHALF_PTR = Word
+#endif
+TypeDef DWORD_PTR = ULONG_PTR
+
+TypeDef SIZE_T = ULONG_PTR
+TypeDef SSIZE_T = LONG_PTR
+
+Const SYSTEM_CACHE_ALIGNMENT_SIZE = 64
+
+Const DECLSPEC_CACHEALIGN = 4
+/*
+#ifdef DEPRECATE_DDK_FUNCTIONS
+#ifdef _NTDDK_
+#define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED
+#ifdef DEPRECATE_SUPPORTED
+#define PRAGMA_DEPRECATED_DDK 1
+#endif
+#else
+#define DECLSPEC_DEPRECATED_DDK
+#define PRAGMA_DEPRECATED_DDK 1
+#endif
+#else
+#define DECLSPEC_DEPRECATED_DDK
+#define PRAGMA_DEPRECATED_DDK 0
+#endif
+*/
+
+TypeDef PVOID = VoidPtr
+#ifdef _WIN64
+TypeDef PVOID64 = VoidPtr
+#else
+TypeDef PVOID64 = QWord
+#endif
+
+TypeDef CHAR = SByte
+TypeDef SHORT = Integer
+TypeDef LONG = Long
+TypeDef INT = Long
+
+TypeDef WCHAR = Word
+
+TypeDef PWCHAR = *WCHAR
+TypeDef LPWCH = *WCHAR
+TypeDef PWCH = *WCHAR
+TypeDef LPCWCH = *WCHAR
+TypeDef NWPSTR = *WCHAR
+TypeDef LPWSTR = *WCHAR
+TypeDef PWSTR = *WCHAR
+TypeDef PZPWSTR = *PWSTR
+TypeDef PCZPWSTR = *PWSTR
+TypeDef LPUWSTR = *WCHAR
+TypeDef PUWSTR = *WCHAR
+TypeDef LPCWSTR = *WCHAR
+TypeDef PCWSTR = *WCHAR
+TypeDef PZPCWSTR = *PCWSTR
+TypeDef LPCUWSTR = *WCHAR
+TypeDef PCUWSTR = *WCHAR
+
+TypeDef LPCWCHAR = *WCHAR
+TypeDef PCWCHAR = *WCHAR
+TypeDef LPCUWCHAR = *WCHAR
+TypeDef PCUWCHAR = *WCHAR
+
+TypeDef UCSCHAR = DWord
+
+Const UCSCHAR_INVALID_CHARACTER = &hffffffff As UCSCHAR
+Const MIN_UCSCHAR = 0 As UCSCHAR
+Const MAX_UCSCHAR = &h0010ffff As UCSCHAR
+
+TypeDef PUCSCHAR = *UCSCHAR
+TypeDef PCUCSCHAR = *UCSCHAR
+
+TypeDef PUCSSTR = *UCSCHAR
+TypeDef PUUCSSTR = *UCSCHAR
+
+TypeDef PCUCSSTR = *UCSCHAR
+TypeDef PCUUCSSTR = *UCSCHAR
+
+TypeDef PUUCSCHAR = *UCSCHAR
+TypeDef PCUUCSCHAR = *UCSCHAR
+
+TypeDef PCHAR = *CHAR
+TypeDef LPCH = *CHAR
+TypeDef PCH = *CHAR
+TypeDef LPCCH = *CHAR
+TypeDef PCCH = *CHAR
+
+TypeDef NPSTR = *CHAR
+TypeDef LPSTR = *CHAR
+TypeDef PSTR = *CHAR
+TypeDef PZPSTR = *PSTR
+TypeDef PCZPSTR = *PSTR
+TypeDef PCSTR = *CHAR
+TypeDef LPCSTR = *CHAR
+TypeDef PZPCSTR = *PCSTR
+
+#ifdef UNICODE
+TypeDef TCHAR = WCHAR
+TypeDef PTCHAR = *WCHAR
+TypeDef TBYTE = WCHAR
+TypeDef PTBYTE = *WCHAR
+
+TypeDef PTCH = PWCH
+TypeDef LPTCH = LPWCH
+TypeDef PTSTR = PWSTR
+TypeDef LPTSTR = LPWSTR
+TypeDef PCTSTR = PCWSTR
+TypeDef LPCTSTR = LPCWSTR
+TypeDef PUTSTR = PUWSTR
+TypeDef LPUTSTR = LPUWSTR
+TypeDef PCUTSTR = PCUWSTR
+TypeDef LPCUTSTR = LPCUWSTR
+'TypeDef LP = LPWSTR
+#else
+TypeDef TCHAR = Char
+TypeDef PTCHAR = *Char
+TypeDef TBYTE = Byte
+TypeDef PTBYTE = *Byte
+
+TypeDef PTCH = PCH
+TypeDef LPTCH = LPCH
+TypeDef PTSTR = PSTR
+TypeDef LPTSTR = LPSTR
+TypeDef PUTSTR = PSTR
+TypeDef LPUTSTR = LPSTR
+TypeDef PCTSTR = PCSTR
+TypeDef LPCTSTR = LPCSTR
+TypeDef PCUTSTR = PCSTR
+TypeDef LPCUTSTR = LPCSTR
+#endif
+
+'TypeDef PSHORT = SHORT
+'TypeDef PLONG = *Long
+
+TypeDef HANDLE = VoidPtr
+TypeDef PHANDLE = *HANDLE
+
+TypeDef FCHAR = Byte
+TypeDef FSHORT = Word
+TypeDef FLONG = DWord
+
+TypeDef HRESULT = Long
+
+TypeDef CCHAR = CHAR
+TypeDef LCID = DWord
+TypeDef PLCID = *DWord
+TypeDef LANGID = Word
+Const APPLICATION_ERROR_MASK = &h20000000
+Const ERROR_SEVERITY_SUCCESS = &h00000000
+Const ERROR_SEVERITY_INFORMATIONAL = &h40000000
+Const ERROR_SEVERITY_WARNING = &h80000000
+Const ERROR_SEVERITY_ERROR = &hC0000000
+
+Type FLOAT128
+	LowPart As Int64
+	HighPart As Int64
+End Type
+TypeDef PFLOAT128 = FLOAT128
+
+TypeDef LONGLONG = Int64
+TypeDef ULONGLONG = QWord
+
+Const MAXLONGLONG = (&h7fffffffffffffff)
+
+TypeDef PLONGLONG = *LONGLONG
+TypeDef PULONGLONG = *ULONGLONG
+
+TypeDef USN = LONGLONG
+
+Type LARGE_INTEGER
+	LowPart As DWord
+	HighPart As Long
+End Type
+TypeDef PLARGE_INTEGER = *LARGE_INTEGER
+
+Type ULARGE_INTEGER
+	LowPart As DWord
+	HighPart As DWord
+End Type
+TypeDef PULARGE_INTEGER = *ULARGE_INTEGER
+
+Type LUID
+	LowPart As DWord
+	HighPart As Long
+End Type
+TypeDef PLUID = *LUID
+
+'TypeDef DWORDLONG = ULONGLONG
+'TypeDef PDWORDLONG = DWORDLONG
+
+Const Int32x32To64(a, b) = (((a) As Long) As Int64 * ((b) As Long) As Int64)
+Const UInt32x32To64(a, b) = (((a) As DWord) As QWord * ((b) As DWord) As QWord)
+Const Int64ShllMod32(a, b) = ((a) As QWord << (b))
+Const Int64ShraMod32(a, b) = ((a) As Int64 >> (b))
+Const Int64ShrlMod32(a, b) = ((a) As QWord >> (b))
+
+Const ANSI_NULL = (0 As CHAR)
+Const UNICODE_NULL = (0 As WCHAR)
+Const UNICODE_STRING_MAX_BYTES = (65534 As Word)
+Const UNICODE_STRING_MAX_CHARS = (32767)
+TypeDef BOOLEAN = BYTE
+TypeDef PBOOLEAN = *BOOLEAN
+
+Type LIST_ENTRY
+	Flink As *LIST_ENTRY
+	Blink As *LIST_ENTRY
+End Type
+TypeDef PLIST_ENTRY = *LIST_ENTRY
+TypeDef PRLIST_ENTRY = *LIST_ENTRY
+
+Type SINGLE_LIST_ENTRY
+	Next As *SINGLE_LIST_ENTRY
+End Type
+TypeDef PSINGLE_LIST_ENTRY = *SINGLE_LIST_ENTRY
+
+Type LIST_ENTRY32
+	Flink As DWord
+	Blink As DWord
+End Type
+TypeDef PLIST_ENTRY32 = *LIST_ENTRY32
+
+Type LIST_ENTRY64
+	Flink As QWord
+	Blink As QWord
+End Type
+TypeDef PLIST_ENTRY64 = *LIST_ENTRY64
+
+#require <guiddef.ab>
+
+Type OBJECTID
+	Lineage As GUID
+	Uniquifier As DWord
+End Type
+
+Const MINCHAR = &h80
+Const MAXCHAR = &h7f
+Const MINSHORT = &h8000
+Const MAXSHORT = &h7fff
+Const MINLONG = &h80000000
+Const MAXLONG = &h7fffffff
+Const MAXBYTE = &hff
+Const MAXWORD = &hffff
+Const MAXDWORD = &hffffffff
+
+'FIELD_OFFSET
+'RTL_FIELD_SIZE
+'RTL_SIZEOF_THROUGH_FIELD
+'RTL_CONTAINS_FIELD
+Const RTL_NUMBER_OF_V1(A) = (Len (A) \ Len(A[0]))
+'RtlpNumberOf
+Const RTL_NUMBER_OF(A) = RTL_NUMBER_OF_V1(A)
+Const ARRAYSIZE(A) = RTL_NUMBER_OF_V1(A) 'RTL_NUMBER_OF_V2(A)
+Const _ARRAYSIZE(A) = RTL_NUMBER_OF_V1(A)
+'RTL_FIELD_TYPE
+'RTL_NUMBER_OF_FIELD
+'RTL_PADDING_BETWEEN_FIELDS
+'RTL_CONST_CAST
+'RTL_BITS_OF
+'RTL_BITS_OF_FIELD
+'CONTAINING_RECORD
+
+Const VER_SERVER_NT = &h80000000
+Const VER_WORKSTATION_NT = &h40000000
+Const VER_SUITE_SMALLBUSINESS = &h00000001
+Const VER_SUITE_ENTERPRISE = &h00000002
+Const VER_SUITE_BACKOFFICE = &h00000004
+Const VER_SUITE_COMMUNICATIONS = &h00000008
+Const VER_SUITE_TERMINAL = &h00000010
+Const VER_SUITE_SMALLBUSINESS_RESTRICTED = &h00000020
+Const VER_SUITE_EMBEDDEDNT = &h00000040
+Const VER_SUITE_DATACENTER = &h00000080
+Const VER_SUITE_SINGLEUSERTS = &h00000100
+Const VER_SUITE_PERSONAL = &h00000200
+Const VER_SUITE_BLADE = &h00000400
+Const VER_SUITE_EMBEDDED_RESTRICTED = &h00000800
+Const VER_SUITE_SECURITY_APPLIANCE = &h00001000
+Const VER_SUITE_STORAGE_SERVER = &h00002000
+Const VER_SUITE_COMPUTE_SERVER = &h00004000
+
+Const PRODUCT_UNDEFINED = &h00000000
+
+Const PRODUCT_ULTIMATE = &h00000001
+Const PRODUCT_HOME_BASIC = &h00000002
+Const PRODUCT_HOME_PREMIUM = &h00000003
+Const PRODUCT_ENTERPRISE = &h00000004
+Const PRODUCT_HOME_BASIC_N = &h00000005
+Const PRODUCT_BUSINESS = &h00000006
+Const PRODUCT_STANDARD_SERVER = &h00000007
+Const PRODUCT_DATACENTER_SERVER = &h00000008
+Const PRODUCT_SMALLBUSINESS_SERVER = &h00000009
+Const PRODUCT_ENTERPRISE_SERVER = &h0000000A
+Const PRODUCT_STARTER = &h0000000B
+Const PRODUCT_DATACENTER_SERVER_CORE = &h0000000C
+Const PRODUCT_STANDARD_SERVER_CORE = &h0000000D
+Const PRODUCT_ENTERPRISE_SERVER_CORE = &h0000000E
+Const PRODUCT_ENTERPRISE_SERVER_IA64 = &h0000000F
+Const PRODUCT_BUSINESS_N = &h00000010
+Const PRODUCT_WEB_SERVER = &h00000011
+Const PRODUCT_CLUSTER_SERVER = &h00000012
+Const PRODUCT_HOME_SERVER = &h00000013
+Const PRODUCT_STORAGE_EXPRESS_SERVER = &h00000014
+Const PRODUCT_STORAGE_STANDARD_SERVER = &h00000015
+Const PRODUCT_STORAGE_WORKGROUP_SERVER = &h00000016
+Const PRODUCT_STORAGE_ENTERPRISE_SERVER = &h00000017
+Const PRODUCT_SERVER_FOR_SMALLBUSINESS = &h00000018
+Const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = &h00000019
+
+Const PRODUCT_UNLICENSED = &hABCDABCD
+
+'#require <sdkddkver.ab>
+
+'  Primary language IDs.
+Const LANG_NEUTRAL = &h00
+Const LANG_INVARIANT = &h7f
+
+Const LANG_AFRIKAANS = &h36
+Const LANG_ALBANIAN = &h1c
+Const LANG_ALSATIAN = &h84
+Const LANG_AMHARIC = &h5e
+Const LANG_ARABIC = &h01
+Const LANG_ARMENIAN = &h2b
+Const LANG_ASSAMESE = &h4d
+Const LANG_AZERI = &h2c
+Const LANG_BASHKIR = &h6d
+Const LANG_BASQUE = &h2d
+Const LANG_BELARUSIAN = &h23
+Const LANG_BENGALI = &h45
+Const LANG_BRETON = &h7e
+Const LANG_BOSNIAN = &h1a
+Const LANG_BOSNIAN_NEUTRAL = &h781a
+Const LANG_BULGARIAN = &h02
+Const LANG_CATALAN = &h03
+Const LANG_CHINESE = &h04
+Const LANG_CHINESE_SIMPLIFIED = &h04
+Const LANG_CHINESE_TRADITIONAL = &h7c04
+Const LANG_CORSICAN = &h83
+Const LANG_CROATIAN = &h1a
+Const LANG_CZECH = &h05
+Const LANG_DANISH = &h06
+Const LANG_DARI = &h8c
+Const LANG_DIVEHI = &h65
+Const LANG_DUTCH = &h13
+Const LANG_ENGLISH = &h09
+Const LANG_ESTONIAN = &h25
+Const LANG_FAEROESE = &h38
+Const LANG_FARSI = &h29
+Const LANG_FILIPINO = &h64
+Const LANG_FINNISH = &h0b
+Const LANG_FRENCH = &h0c
+Const LANG_FRISIAN = &h62
+Const LANG_GALICIAN = &h56
+Const LANG_GEORGIAN = &h37
+Const LANG_GERMAN = &h07
+Const LANG_GREEK = &h08
+Const LANG_GREENLANDIC = &h6f
+Const LANG_GUJARATI = &h47
+Const LANG_HAUSA = &h68
+Const LANG_HEBREW = &h0d
+Const LANG_HINDI = &h39
+Const LANG_HUNGARIAN = &h0e
+Const LANG_ICELANDIC = &h0f
+Const LANG_IGBO = &h70
+Const LANG_INDONESIAN = &h21
+Const LANG_INUKTITUT = &h5d
+Const LANG_IRISH = &h3c
+Const LANG_ITALIAN = &h10
+Const LANG_JAPANESE = &h11
+Const LANG_KANNADA = &h4b
+Const LANG_KASHMIRI = &h60
+Const LANG_KAZAK = &h3f
+Const LANG_KHMER = &h53
+Const LANG_KICHE = &h86
+Const LANG_KINYARWANDA = &h87
+Const LANG_KONKANI = &h57
+Const LANG_KOREAN = &h12
+Const LANG_KYRGYZ = &h40
+Const LANG_LAO = &h54
+Const LANG_LATVIAN = &h26
+Const LANG_LITHUANIAN = &h27
+Const LANG_LOWER_SORBIAN = &h2e
+Const LANG_LUXEMBOURGISH = &h6e
+Const LANG_MACEDONIAN = &h2f
+Const LANG_MALAY = &h3e
+Const LANG_MALAYALAM = &h4c
+Const LANG_MALTESE = &h3a
+Const LANG_MANIPURI = &h58
+Const LANG_MAORI = &h81
+Const LANG_MAPUDUNGUN = &h7a
+Const LANG_MARATHI = &h4e
+Const LANG_MOHAWK = &h7c
+Const LANG_MONGOLIAN = &h50
+Const LANG_NEPALI = &h61
+Const LANG_NORWEGIAN = &h14
+Const LANG_OCCITAN = &h82
+Const LANG_ORIYA = &h48
+Const LANG_PASHTO = &h63
+Const LANG_PERSIAN = &h29
+Const LANG_POLISH = &h15
+Const LANG_PORTUGUESE = &h16
+Const LANG_PUNJABI = &h46
+Const LANG_QUECHUA = &h6b
+Const LANG_ROMANIAN = &h18
+Const LANG_ROMANSH = &h17
+Const LANG_RUSSIAN = &h19
+Const LANG_SAMI = &h3b
+Const LANG_SANSKRIT = &h4f
+Const LANG_SERBIAN = &h1a
+Const LANG_SERBIAN_NEUTRAL = &h7c1a
+Const LANG_SINDHI = &h59
+Const LANG_SINHALESE = &h5b
+Const LANG_SLOVAK = &h1b
+Const LANG_SLOVENIAN = &h24
+Const LANG_SOTHO = &h6c
+Const LANG_SPANISH = &h0a
+Const LANG_SWAHILI = &h41
+Const LANG_SWEDISH = &h1d
+Const LANG_SYRIAC = &h5a
+Const LANG_TAJIK = &h28
+Const LANG_TAMAZIGHT = &h5f
+Const LANG_TAMIL = &h49
+Const LANG_TATAR = &h44
+Const LANG_TELUGU = &h4a
+Const LANG_THAI = &h1e
+Const LANG_TIBETAN = &h51
+Const LANG_TIGRIGNA = &h73
+Const LANG_TSWANA = &h32
+Const LANG_TURKISH = &h1f
+Const LANG_TURKMEN = &h42
+Const LANG_UIGHUR = &h80
+Const LANG_UKRAINIAN = &h22
+Const LANG_UPPER_SORBIAN = &h2e
+Const LANG_URDU = &h20
+Const LANG_UZBEK = &h43
+Const LANG_VIETNAMESE = &h2a
+Const LANG_WELSH = &h52
+Const LANG_WOLOF = &h88
+Const LANG_XHOSA = &h34
+Const LANG_YAKUT = &h85
+Const LANG_YI = &h78
+Const LANG_YORUBA = &h6a
+Const LANG_ZULU = &h35
+
+' Sublanguage IDs.
+Const SUBLANG_NEUTRAL = &h00
+Const SUBLANG_DEFAULT = &h01
+Const SUBLANG_SYS_DEFAULT = &h02
+Const SUBLANG_CUSTOM_DEFAULT = &h03
+Const SUBLANG_CUSTOM_UNSPECIFIED = &h04
+Const SUBLANG_UI_CUSTOM_DEFAULT = &h05
+
+Const SUBLANG_AFRIKAANS_SOUTH_AFRICA = &h01
+Const SUBLANG_ALBANIAN_ALBANIA = &h01
+Const SUBLANG_ALSATIAN_FRANCE = &h01
+Const SUBLANG_AMHARIC_ETHIOPIA = &h01
+Const SUBLANG_ARABIC_SAUDI_ARABIA = &h01
+Const SUBLANG_ARABIC_IRAQ = &h02
+Const SUBLANG_ARABIC_EGYPT = &h03
+Const SUBLANG_ARABIC_LIBYA = &h04
+Const SUBLANG_ARABIC_ALGERIA = &h05
+Const SUBLANG_ARABIC_MOROCCO = &h06
+Const SUBLANG_ARABIC_TUNISIA = &h07
+Const SUBLANG_ARABIC_OMAN = &h08
+Const SUBLANG_ARABIC_YEMEN = &h09
+Const SUBLANG_ARABIC_SYRIA = &h0a
+Const SUBLANG_ARABIC_JORDAN = &h0b
+Const SUBLANG_ARABIC_LEBANON = &h0c
+Const SUBLANG_ARABIC_KUWAIT = &h0d
+Const SUBLANG_ARABIC_UAE = &h0e
+Const SUBLANG_ARABIC_BAHRAIN = &h0f
+Const SUBLANG_ARABIC_QATAR = &h10
+Const SUBLANG_ARMENIAN_ARMENIA = &h01
+Const SUBLANG_ASSAMESE_INDIA = &h01
+Const SUBLANG_AZERI_LATIN = &h01
+Const SUBLANG_AZERI_CYRILLIC = &h02
+Const SUBLANG_BASHKIR_RUSSIA = &h01
+Const SUBLANG_BASQUE_BASQUE = &h01
+Const SUBLANG_BELARUSIAN_BELARUS = &h01
+Const SUBLANG_BENGALI_INDIA = &h01
+Const SUBLANG_BENGALI_BANGLADESH = &h02
+Const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN = &h05
+Const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC = &h08
+Const SUBLANG_BRETON_FRANCE = &h01
+Const SUBLANG_BULGARIAN_BULGARIA = &h01
+Const SUBLANG_CATALAN_CATALAN = &h01
+Const SUBLANG_CHINESE_TRADITIONAL = &h01
+Const SUBLANG_CHINESE_SIMPLIFIED = &h02
+Const SUBLANG_CHINESE_HONGKONG = &h03
+Const SUBLANG_CHINESE_SINGAPORE = &h04
+Const SUBLANG_CHINESE_MACAU = &h05
+Const SUBLANG_CORSICAN_FRANCE = &h01
+Const SUBLANG_CZECH_CZECH_REPUBLIC = &h01
+Const SUBLANG_CROATIAN_CROATIA = &h01
+Const SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN = &h04
+Const SUBLANG_DANISH_DENMARK = &h01
+Const SUBLANG_DARI_AFGHANISTAN = &h01
+Const SUBLANG_DIVEHI_MALDIVES = &h01
+Const SUBLANG_DUTCH = &h01
+Const SUBLANG_DUTCH_BELGIAN = &h02
+Const SUBLANG_ENGLISH_US = &h01
+Const SUBLANG_ENGLISH_UK = &h02
+Const SUBLANG_ENGLISH_AUS = &h03
+Const SUBLANG_ENGLISH_CAN = &h04
+Const SUBLANG_ENGLISH_NZ = &h05
+Const SUBLANG_ENGLISH_EIRE = &h06
+Const SUBLANG_ENGLISH_SOUTH_AFRICA = &h07
+Const SUBLANG_ENGLISH_JAMAICA = &h08
+Const SUBLANG_ENGLISH_CARIBBEAN = &h09
+Const SUBLANG_ENGLISH_BELIZE = &h0a
+Const SUBLANG_ENGLISH_TRINIDAD = &h0b
+Const SUBLANG_ENGLISH_ZIMBABWE = &h0c
+Const SUBLANG_ENGLISH_PHILIPPINES = &h0d
+Const SUBLANG_ENGLISH_INDIA = &h10
+Const SUBLANG_ENGLISH_MALAYSIA = &h11
+Const SUBLANG_ENGLISH_SINGAPORE = &h12
+Const SUBLANG_ESTONIAN_ESTONIA = &h01
+Const SUBLANG_FAEROESE_FAROE_ISLANDS = &h01
+Const SUBLANG_FILIPINO_PHILIPPINES = &h01
+Const SUBLANG_FINNISH_FINLAND = &h01
+Const SUBLANG_FRENCH = &h01
+Const SUBLANG_FRENCH_BELGIAN = &h02
+Const SUBLANG_FRENCH_CANADIAN = &h03
+Const SUBLANG_FRENCH_SWISS = &h04
+Const SUBLANG_FRENCH_LUXEMBOURG = &h05
+Const SUBLANG_FRENCH_MONACO = &h06
+Const SUBLANG_FRISIAN_NETHERLANDS = &h01
+Const SUBLANG_GALICIAN_GALICIAN = &h01
+Const SUBLANG_GEORGIAN_GEORGIA = &h01
+Const SUBLANG_GERMAN = &h01
+Const SUBLANG_GERMAN_SWISS = &h02
+Const SUBLANG_GERMAN_AUSTRIAN = &h03
+Const SUBLANG_GERMAN_LUXEMBOURG = &h04
+Const SUBLANG_GERMAN_LIECHTENSTEIN = &h05
+Const SUBLANG_GREEK_GREECE = &h01
+Const SUBLANG_GREENLANDIC_GREENLAND = &h01
+Const SUBLANG_GUJARATI_INDIA = &h01
+Const SUBLANG_HAUSA_NIGERIA_LATIN = &h01
+Const SUBLANG_HEBREW_ISRAEL = &h01
+Const SUBLANG_HINDI_INDIA = &h01
+Const SUBLANG_HUNGARIAN_HUNGARY = &h01
+Const SUBLANG_ICELANDIC_ICELAND = &h01
+Const SUBLANG_IGBO_NIGERIA = &h01
+Const SUBLANG_INDONESIAN_INDONESIA = &h01
+Const SUBLANG_INUKTITUT_CANADA = &h01
+Const SUBLANG_INUKTITUT_CANADA_LATIN = &h02
+Const SUBLANG_IRISH_IRELAND = &h02
+Const SUBLANG_ITALIAN = &h01
+Const SUBLANG_ITALIAN_SWISS = &h02
+Const SUBLANG_JAPANESE_JAPAN = &h01
+Const SUBLANG_KANNADA_INDIA = &h01
+Const SUBLANG_KASHMIRI_SASIA = &h02
+Const SUBLANG_KASHMIRI_INDIA = &h02
+Const SUBLANG_KAZAK_KAZAKHSTAN = &h01
+Const SUBLANG_KHMER_CAMBODIA = &h01
+Const SUBLANG_KICHE_GUATEMALA = &h01
+Const SUBLANG_KINYARWANDA_RWANDA = &h01
+Const SUBLANG_KONKANI_INDIA = &h01
+Const SUBLANG_KOREAN = &h01
+Const SUBLANG_KYRGYZ_KYRGYZSTAN = &h01
+Const SUBLANG_LAO_LAO = &h01
+Const SUBLANG_LATVIAN_LATVIA = &h01
+Const SUBLANG_LITHUANIAN = &h01
+Const SUBLANG_LOWER_SORBIAN_GERM = &h02
+Const SUBLANG_LUXEMBOURGISH_LUXEMBOURG = &h01
+Const SUBLANG_MACEDONIAN_MACEDONIA = &h01
+Const SUBLANG_MALAY_MALAYSIA = &h01
+Const SUBLANG_MALAY_BRUNEI_DARUSSALAM = &h02
+Const SUBLANG_MALAYALAM_INDIA = &h01
+Const SUBLANG_MALTESE_MALTA = &h01
+Const SUBLANG_MAORI_NEW_ZEALAND = &h01
+Const SUBLANG_MAPUDUNGUN_CHILE = &h01
+Const SUBLANG_MARATHI_INDIA = &h01
+Const SUBLANG_MOHAWK_MOHAWK = &h01
+Const SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA = &h01
+Const SUBLANG_MONGOLIAN_PRC = &h02
+Const SUBLANG_NEPALI_INDIA = &h02
+Const SUBLANG_NEPALI_NEPAL = &h01
+Const SUBLANG_NORWEGIAN_BOKMAL = &h01
+Const SUBLANG_NORWEGIAN_NYNORSK = &h02
+Const SUBLANG_OCCITAN_FRANCE = &h01
+Const SUBLANG_ORIYA_INDIA = &h01
+Const SUBLANG_PASHTO_AFGHANISTAN = &h01
+Const SUBLANG_PERSIAN_IRAN = &h01
+Const SUBLANG_POLISH_POLAND = &h01
+Const SUBLANG_PORTUGUESE = &h02
+Const SUBLANG_PORTUGUESE_BRAZILIAN = &h01
+Const SUBLANG_PUNJABI_INDIA = &h01
+Const SUBLANG_QUECHUA_BOLIVIA = &h01
+Const SUBLANG_QUECHUA_ECUADOR = &h02
+Const SUBLANG_QUECHUA_PERU = &h03
+Const SUBLANG_ROMANIAN_ROMANIA = &h01
+Const SUBLANG_ROMANSH_SWITZERLAND = &h01
+Const SUBLANG_RUSSIAN_RUSSIA = &h01
+Const SUBLANG_SAMI_NORTHERN_NORWAY = &h01
+Const SUBLANG_SAMI_NORTHERN_SWEDEN = &h02
+Const SUBLANG_SAMI_NORTHERN_FINLAND = &h03
+Const SUBLANG_SAMI_LULE_NORWAY = &h04
+Const SUBLANG_SAMI_LULE_SWEDEN = &h05
+Const SUBLANG_SAMI_SOUTHERN_NORWAY = &h06
+Const SUBLANG_SAMI_SOUTHERN_SWEDEN = &h07
+Const SUBLANG_SAMI_SKOLT_FINLAND = &h08
+Const SUBLANG_SAMI_INARI_FINLAND = &h09
+Const SUBLANG_SANSKRIT_INDIA = &h01
+Const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN = &h06
+Const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC = &h07
+Const SUBLANG_SERBIAN_CROATIA = &h01
+Const SUBLANG_SERBIAN_LATIN = &h02
+Const SUBLANG_SERBIAN_CYRILLIC = &h03
+Const SUBLANG_SINDHI_INDIA = &h01
+Const SUBLANG_SINDHI_PAKISTAN = &h02
+Const SUBLANG_SINDHI_AFGHANISTAN = &h02
+Const SUBLANG_SINHALESE_SRI_LANKA = &h01
+Const SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA = &h01
+Const SUBLANG_SLOVAK_SLOVAKIA = &h01
+Const SUBLANG_SLOVENIAN_SLOVENIA = &h01
+Const SUBLANG_SPANISH = &h01
+Const SUBLANG_SPANISH_MEXICAN = &h02
+Const SUBLANG_SPANISH_MODERN = &h03
+Const SUBLANG_SPANISH_GUATEMALA = &h04
+Const SUBLANG_SPANISH_COSTA_RICA = &h05
+Const SUBLANG_SPANISH_PANAMA = &h06
+Const SUBLANG_SPANISH_DOMINICAN_REPUBLIC = &h07
+Const SUBLANG_SPANISH_VENEZUELA = &h08
+Const SUBLANG_SPANISH_COLOMBIA = &h09
+Const SUBLANG_SPANISH_PERU = &h0a
+Const SUBLANG_SPANISH_ARGENTINA = &h0b
+Const SUBLANG_SPANISH_ECUADOR = &h0c
+Const SUBLANG_SPANISH_CHILE = &h0d
+Const SUBLANG_SPANISH_URUGUAY = &h0e
+Const SUBLANG_SPANISH_PARAGUAY = &h0f
+Const SUBLANG_SPANISH_BOLIVIA = &h10
+Const SUBLANG_SPANISH_EL_SALVADOR = &h11
+Const SUBLANG_SPANISH_HONDURAS = &h12
+Const SUBLANG_SPANISH_NICARAGUA = &h13
+Const SUBLANG_SPANISH_PUERTO_RICO = &h14
+Const SUBLANG_SPANISH_US = &h15
+Const SUBLANG_SWAHILI_KENYA = &h01
+Const SUBLANG_SWEDISH = &h01
+Const SUBLANG_SWEDISH_FINLAND = &h02
+Const SUBLANG_SYRIAC_SYRIA = &h01
+Const SUBLANG_TAJIK_TAJIKISTAN = &h01
+Const SUBLANG_TAMAZIGHT_ALGERIA_LATIN = &h02
+Const SUBLANG_TAMIL_INDIA = &h01
+Const SUBLANG_TATAR_RUSSIA = &h01
+Const SUBLANG_TELUGU_INDIA = &h01
+Const SUBLANG_THAI_THAILAND = &h01
+Const SUBLANG_TIBETAN_PRC = &h01
+Const SUBLANG_TIGRIGNA_ERITREA = &h02
+Const SUBLANG_TSWANA_SOUTH_AFRICA = &h01
+Const SUBLANG_TURKISH_TURKEY = &h01
+Const SUBLANG_TURKMEN_TURKMENISTAN = &h01
+Const SUBLANG_UIGHUR_PRC = &h01
+Const SUBLANG_UKRAINIAN_UKRAINE = &h01
+Const SUBLANG_UPPER_SORBIAN_GERMANY = &h01
+Const SUBLANG_URDU_PAKISTAN = &h01
+Const SUBLANG_URDU_INDIA = &h02
+Const SUBLANG_UZBEK_LATIN = &h01
+Const SUBLANG_UZBEK_CYRILLIC = &h02
+Const SUBLANG_VIETNAMESE_VIETNAM = &h01
+Const SUBLANG_WELSH_UNITED_KINGDOM = &h01
+Const SUBLANG_WOLOF_SENEGAL = &h01
+Const SUBLANG_XHOSA_SOUTH_AFRICA = &h01
+Const SUBLANG_YAKUT_RUSSIA = &h01
+Const SUBLANG_YI_PRC = &h01
+Const SUBLANG_YORUBA_NIGERIA = &h01
+Const SUBLANG_ZULU_SOUTH_AFRICA = &h01
+
+' Sorting IDs.
+Const SORT_DEFAULT = &h0
+
+Const SORT_INVARIANT_MATH = &h1
+
+Const SORT_JAPANESE_XJIS = &h0
+Const SORT_JAPANESE_UNICODE = &h1
+Const SORT_JAPANESE_RADICALSTROKE = &h4
+
+Const SORT_CHINESE_BIG5 = &h0
+Const SORT_CHINESE_PRCP = &h0
+Const SORT_CHINESE_UNICODE = &h1
+Const SORT_CHINESE_PRC = &h2
+Const SORT_CHINESE_BOPOMOFO = &h3
+
+Const SORT_KOREAN_KSC = &h0
+Const SORT_KOREAN_UNICODE = &h1
+
+Const SORT_GERMAN_PHONE_BOOK = &h1
+
+Const SORT_HUNGARIAN_DEFAULT = &h0
+Const SORT_HUNGARIAN_TECHNICAL = &h1
+
+Const SORT_GEORGIAN_TRADITIONAL = &h0
+Const SORT_GEORGIAN_MODERN = &h1
+
+Const MAKELANGID(p, s) = ((((s) As Word) << 10) Or (p) As Word)
+Const PRIMARYLANGID(lgid) = ((lgid) As Word And &h3ff)
+Const SUBLANGID(lgid) = ((lgid) As Word >> 10)
+
+Const NLS_VALID_LOCALE_MASK = &h000fffff
+
+Const MAKELCID(lgid, srtid) = ((((((srtid) As Word) As DWord) << 16) Or (((lgid) As Word) As DWord)) As DWord)
+Const MAKESORTLCID(lgid, srtid, ver) = (((MAKELCID(lgid, srtid)) Or ((((ver) As Word)) As DWord << 20)) As DWord)
+Const LANGIDFROMLCID(lcid) = ((lcid) As Word)
+Const SORTIDFROMLCID(lcid) = (((((lcid) As DWord) >> 16) And &hf) As Word)
+Const SORTVERSIONFROMLCID(lcid) = (((((lcid) As DWord) >> 20) And &hf) As Word)
+
+Const LOCALE_NAME_MAX_LENGTH = 85
+
+Const LANG_SYSTEM_DEFAULT = (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
+Const LANG_USER_DEFAULT = (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
+
+Const LOCALE_SYSTEM_DEFAULT = (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
+Const LOCALE_USER_DEFAULT = (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
+
+Const LOCALE_CUSTOM_DEFAULT = (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT))
+Const LOCALE_CUSTOM_UNSPECIFIED = (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT))
+Const LOCALE_CUSTOM_UI_DEFAULT = (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT))
+Const LOCALE_NEUTRAL = (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT))
+Const LOCALE_INVARIANT = (MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT))
+
+' DEFAULT_UNREACHABLE
+
+#ifndef WIN32_NO_STATUS
+Const STATUS_WAIT_0 = (&h00000000 As DWord)
+Const STATUS_ABANDONED_WAIT_0 = (&h00000080 As DWord)
+Const STATUS_USER_APC = (&h000000C0 As DWord)
+Const STATUS_TIMEOUT = (&h00000102 As DWord)
+Const STATUS_PENDING = (&h00000103 As DWord)
+Const DBG_EXCEPTION_HANDLED = (&h00010001 As DWord)
+Const DBG_CONTINUE = (&h00010002 As DWord)
+Const STATUS_SEGMENT_NOTIFICATION = (&h40000005 As DWord)
+Const DBG_TERMINATE_THREAD = (&h40010003 As DWord)
+Const DBG_TERMINATE_PROCESS = (&h40010004 As DWord)
+Const DBG_CONTROL_C = (&h40010005 As DWord)
+Const DBG_CONTROL_BREAK = (&h40010008 As DWord)
+Const DBG_COMMAND_EXCEPTION = (&h40010009 As DWord)
+Const STATUS_GUARD_PAGE_VIOLATION = (&h80000001 As DWord)
+Const STATUS_DATATYPE_MISALIGNMENT = (&h80000002 As DWord)
+Const STATUS_BREAKPOINT = (&h80000003 As DWord)
+Const STATUS_SINGLE_STEP = (&h80000004 As DWord)
+Const DBG_EXCEPTION_NOT_HANDLED = (&h80010001 As DWord)
+Const STATUS_ACCESS_VIOLATION = (&hC0000005 As DWord)
+Const STATUS_IN_PAGE_ERROR = (&hC0000006 As DWord)
+Const STATUS_INVALID_HANDLE = (&hC0000008 As DWord)
+Const STATUS_NO_MEMORY = (&hC0000017 As DWord)
+Const STATUS_ILLEGAL_INSTRUCTION = (&hC000001D As DWord)
+Const STATUS_NONCONTINUABLE_EXCEPTION = (&hC0000025 As DWord)
+Const STATUS_INVALID_DISPOSITION = (&hC0000026 As DWord)
+Const STATUS_ARRAY_BOUNDS_EXCEEDED = (&hC000008C As DWord)
+Const STATUS_FLOAT_DENORMAL_OPERAND = (&hC000008D As DWord)
+Const STATUS_FLOAT_DIVIDE_BY_ZERO = (&hC000008E As DWord)
+Const STATUS_FLOAT_INEXACT_RESULT = (&hC000008F As DWord)
+Const STATUS_FLOAT_INVALID_OPERATION = (&hC0000090 As DWord)
+Const STATUS_FLOAT_OVERFLOW = (&hC0000091 As DWord)
+Const STATUS_FLOAT_STACK_CHECK = (&hC0000092 As DWord)
+Const STATUS_FLOAT_UNDERFLOW = (&hC0000093 As DWord)
+Const STATUS_INTEGER_DIVIDE_BY_ZERO = (&hC0000094 As DWord)
+Const STATUS_INTEGER_OVERFLOW = (&hC0000095 As DWord)
+Const STATUS_PRIVILEGED_INSTRUCTION = (&hC0000096 As DWord)
+Const STATUS_STACK_OVERFLOW = (&hC00000FD As DWord)
+Const STATUS_CONTROL_C_EXIT = (&hC000013A As DWord)
+Const STATUS_FLOAT_MULTIPLE_FAULTS = (&hC00002B4 As DWord)
+Const STATUS_FLOAT_MULTIPLE_TRAPS = (&hC00002B5 As DWord)
+Const STATUS_REG_NAT_CONSUMPTION = (&hC00002C9 As DWord)
+'#if defined(STATUS_SUCCESS) || (_WIN32_WINNT > 0x0500) || (_WIN32_FUSION >= 0x0100)
+Const STATUS_SXS_EARLY_DEACTIVATION = (&hC015000F As DWord)
+Const STATUS_SXS_INVALID_DEACTIVATION = (&hC0150010 As DWord)
+'#endif
+#endif
+
+Const MAXIMUM_WAIT_OBJECTS = 64
+
+Const MAXIMUM_SUSPEND_COUNT = MAXCHAR
+
+TypeDef KSPIN_LOCK = ULONG_PTR
+TypeDef PKSPIN_LOCK = KSPIN_LOCK
+
+#ifdef _WIN64
+
+Const EXCEPTION_READ_FAULT = 0
+Const EXCEPTION_WRITE_FAULT = 1
+Const EXCEPTION_EXECUTE_FAULT = 8
+
+Const CONTEXT_AMD64 = &h100000
+
+Const CONTEXT_CONTROL = (CONTEXT_AMD64 Or &h1)
+Const CONTEXT_INTEGER = (CONTEXT_AMD64 Or &h2)
+Const CONTEXT_SEGMENTS = (CONTEXT_AMD64 Or &h4)
+Const CONTEXT_FLOATING_POINT  = (CONTEXT_AMD64 Or &h8)
+Const CONTEXT_DEBUG_REGISTERS = (CONTEXT_AMD64 Or &h10)
+
+Const CONTEXT_FULL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_FLOATING_POINT)
+
+Const CONTEXT_ALL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_SEGMENTS Or CONTEXT_FLOATING_POINT Or CONTEXT_DEBUG_REGISTERS)
+
+Const CONTEXT_EXCEPTION_ACTIVE = &h8000000
+Const CONTEXT_SERVICE_ACTIVE = &h10000000
+Const CONTEXT_EXCEPTION_REQUEST = &h40000000
+Const CONTEXT_EXCEPTION_REPORTING = &h80000000
+
+Const INITIAL_MXCSR = &h1f80
+Const INITIAL_FPCSR = &h027f
+
+Type Align(16) M128A
+	Low As QWord
+	High As Int64
+End Type
+TypeDef PM128A = *M128A
+
+Type XMM_SAVE_AREA32
+	ControlWord As Word
+	StatusWord As Word
+	TagWord As Byte
+	Reserved1 As Byte
+	ErrorOpcode As Word
+	ErrorOffset As DWord
+	ErrorSelector As Word
+	Reserved2 As Word
+	DataOffset As DWord
+	DataSelector As Word
+	Reserved3 As Word
+	MxCsr As DWord
+	MxCsr_Mask As DWord
+	FloatRegisters[ELM(8)] As M128A
+	XmmRegisters[ELM(16)] As M128A
+	Reserved4[ELM(96)] As Byte
+End Type
+TypeDef PXMM_SAVE_AREA32 = *XMM_SAVE_AREA32
+
+Const LEGACY_SAVE_AREA_LENGTH = SizeOf (XMM_SAVE_AREA32)
+
+Type Align(16) CONTEXT
+	'Register parameter home addresses.
+	P1Home As QWord
+	P2Home As QWord
+	P3Home As QWord
+	P4Home As QWord
+	P5Home As QWord
+	P6Home As QWord
+	'Control flags.
+	ContextFlags As DWord
+	MxCsr As DWord
+	'Segment Registers and processor flags.
+	SegCs As Word
+	SegDs As Word
+	SegEs As Word
+	SegFs As Word
+	SegGs As Word
+	SegSs As Word
+	EFlags As DWord
+	'Debug registers
+	Dr0 As QWord
+	Dr1 As QWord
+	Dr2 As QWord
+	Dr3 As QWord
+	Dr6 As QWord
+	Dr7 As QWord
+	'Integer registers.
+	Rax As QWord
+	Rcx As QWord
+	Rdx As QWord
+	Rbx As QWord
+	Rsp As QWord
+	Rbp As QWord
+	Rsi As QWord
+	Rdi As QWord
+	R8 As QWord
+	R9 As QWord
+	R10 As QWord
+	R11 As QWord
+	R12 As QWord
+	R13 As QWord
+	R14 As QWord
+	R15 As QWord
+	'Program counter.
+	Rip As QWord
+	'MMX/floating point state.
+	Header[ELM(2)] As M128A
+	Legacy[ELM(8)] As M128A
+	Xmm0 As M128A
+	Xmm1 As M128A
+	Xmm2 As M128A
+	Xmm3 As M128A
+	Xmm4 As M128A
+	Xmm5 As M128A
+	Xmm6 As M128A
+	Xmm7 As M128A
+	Xmm8 As M128A
+	Xmm9 As M128A
+	Xmm10 As M128A
+	Xmm11 As M128A
+	Xmm12 As M128A
+	Xmm13 As M128A
+	Xmm14 As M128A
+	Xmm15 As M128A
+	Reserve[ELM(96)] As Byte
+	'Vector registers
+	VectorRegisters[ELM(26)] As M128A
+	VectorControl As QWord
+	'Special debug control registers.
+	DebugControl As QWord
+	LastBranchToRip As QWord
+	LastBranchFromRip As QWord
+	LastExceptionToRip As QWord
+	LastExceptionFromRip As QWord
+End Type
+TypeDef PCONTEXT = *CONTEXT
+
+Const RUNTIME_FUNCTION_INDIRECT = &h1
+
+Type RUNTIME_FUNCTION
+	BeginAddress As DWord
+	EndAddress As DWord
+	UnwindData As DWord
+End Type
+TypeDef PRUNTIME_FUNCTION = *RUNTIME_FUNCTION
+
+TypeDef PGET_RUNTIME_FUNCTION_CALLBACK = *Function(ControlPc As QWord, Context As PVOID) As PRUNTIME_FUNCTION
+
+TypeDef POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK = *Function(Process As HANDLE, TableAddress As PVOID, Entries As *DWord, ByRef Functions As PRUNTIME_FUNCTION) As DWord
+
+Const OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME = "OutOfProcessFunctionTableCallback"
+
+Declare Sub RtlRestoreContext Lib "kernel32" (ByRef ContextRecord As CONTEXT, ExceptionRecord As *EXCEPTION_RECORD)
+Declare Function RtlAddFunctionTable Lib "kernel32" (FunctionTable As PRUNTIME_FUNCTION, EntryCount As DWord, BaseAddress As QWord) As BOOLEAN
+Declare Function RtlInstallFunctionTableCallback Lib "kernel32" (TableIdentifier As QWord, BaseAddress As QWord, Length As DWord, Callback As PGET_RUNTIME_FUNCTION_CALLBACK, Context As PVOID, OutOfProcessCallbackDll As PCWSTR) As BOOLEAN
+Declare Function RtlDeleteFunctionTable Lib "kernel32" (FunctionTable As PRUNTIME_FUNCTION) As BOOLEAN
+
+'#endif '_WIN64
+#else
+'#ifdef _WIN32
+'InterlockedBitTestAndSet
+'InterlockedBitTestAndReset
+'InterlockedBitTestAndComplement
+
+
+'MemoryBarrier
+'PreFetchCacheLine
+'ReadForWriteAccess
+
+'ReadPMC
+'ReadTimeStampCounter
+
+'DbgRaiseAssertionFailure
+
+'GetFiberData
+'GetCurrentFibe
+
+Const EXCEPTION_READ_FAULT = 0
+Const EXCEPTION_WRITE_FAULT = 1
+Const EXCEPTION_EXECUTE_FAULT = 8
+
+Const SIZE_OF_80387_REGISTERS = 80
+
+Const CONTEXT_i386 = &h00010000
+Const CONTEXT_i486 = &h00010000
+
+Const CONTEXT_CONTROL = (CONTEXT_i386 Or &h00000001) ' SS:SP, CS:IP, FLAGS, BP
+Const CONTEXT_INTEGER = (CONTEXT_i386 Or &h00000002) ' AX, BX, CX, DX, SI, DI
+Const CONTEXT_SEGMENTS = (CONTEXT_i386 Or &h00000004) ' DS, ES, FS, GS
+Const CONTEXT_FLOATING_POINT = (CONTEXT_i386 Or &h00000008) ' 387 state
+Const CONTEXT_DEBUG_REGISTERS = (CONTEXT_i386 Or &h00000010) ' DB 0-3,6,7
+Const CONTEXT_EXTENDED_REGISTERS = (CONTEXT_i386 Or &h00000020) ' cpu specific extensions
+Const CONTEXT_FULL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_SEGMENTS)
+Const CONTEXT_ALL = (CONTEXT_CONTROL Or CONTEXT_INTEGER Or CONTEXT_SEGMENTS Or  CONTEXT_FLOATING_POINT Or CONTEXT_DEBUG_REGISTERS Or  CONTEXT_EXTENDED_REGISTERS)
+
+Const MAXIMUM_SUPPORTED_EXTENSION = 512
+
+Type FLOATING_SAVE_AREA
+	ControlWord As DWord
+	StatusWord As DWord
+	TagWord As DWord
+	ErrorOffset As DWord
+	ErrorSelector As DWord
+	DataOffset As DWord
+	DataSelector As DWord
+	RegisterArea[ELM(SIZE_OF_80387_REGISTERS)] As Byte
+	Cr0NpxState As DWord
+End Type
+TypeDef PFLOATING_SAVE_AREA = FLOATING_SAVE_AREA
+
+Type CONTEXT
+	ContextFlags As DWord
+
+	Dr0 As DWord
+	Dr1 As DWord
+	Dr2 As DWord
+	Dr3 As DWord
+	Dr6 As DWord
+	Dr7 As DWord
+
+	FloatSave As FLOATING_SAVE_AREA
+
+	SegGs As DWord
+	SegFs As DWord
+	SegEs As DWord
+	SegDs As DWord
+
+	Edi As DWord
+	Esi As DWord
+	Ebx As DWord
+	Edx As DWord
+	Ecx As DWord
+	Eax As DWord
+
+	Ebp As DWord
+	Eip As DWord
+	SegCs As DWord
+	EFlags As DWord
+	Esp As DWord
+	SegSs As DWord
+
+	ExtendedRegisters[ELM(MAXIMUM_SUPPORTED_EXTENSION)] As Byte
+End Type
+
+TypeDef PCONTEXT = *CONTEXT
+
+#endif
+
+Type LDT_ENTRY
+	LimitLow As Word
+	BaseLow As Word
+	BaseMid As Byte
+	Flags1 As Byte
+	Flags2 As Byte
+	BaseHi As Byte
+End Type
+TypeDef PLDT_ENTRY = *LDT_ENTRY
+
+Const WOW64_CONTEXT_i386 = &h00010000
+Const WOW64_CONTEXT_i486 = &h00010000
+
+Const WOW64_CONTEXT_CONTROL = (WOW64_CONTEXT_i386 Or &h00000001) ' SS:SP, CS:IP, FLAGS, BP
+Const WOW64_CONTEXT_INTEGER = (WOW64_CONTEXT_i386 Or &h00000002) ' AX, BX, CX, DX, SI, DI
+Const WOW64_CONTEXT_SEGMENTS = (WOW64_CONTEXT_i386 Or &h00000004) ' DS, ES, FS, GS
+Const WOW64_CONTEXT_FLOATING_POINT = (WOW64_CONTEXT_i386 Or &h00000008) ' 387 state
+Const WOW64_CONTEXT_DEBUG_REGISTERS = (WOW64_CONTEXT_i386 Or &h00000010) ' DB 0-3,6,7
+Const WOW64_CONTEXT_EXTENDED_REGISTERS = (WOW64_CONTEXT_i386 Or &h00000020) ' cpu specific extensions
+Const WOW64_CONTEXT_FULL = (WOW64_CONTEXT_CONTROL Or WOW64_CONTEXT_INTEGER Or WOW64_CONTEXT_SEGMENTS)
+Const WOW64_CONTEXT_ALL = (WOW64_CONTEXT_CONTROL Or WOW64_CONTEXT_INTEGER Or WOW64_CONTEXT_SEGMENTS Or WOW64_CONTEXT_FLOATING_POINT Or WOW64_CONTEXT_DEBUG_REGISTERS Or WOW64_CONTEXT_EXTENDED_REGISTERS)
+
+Const WOW64_SIZE_OF_80387_REGISTERS = 80
+
+Const WOW64_MAXIMUM_SUPPORTED_EXTENSION = 512
+
+Type WOW64_FLOATING_SAVE_AREA
+	ControlWord As DWord
+	StatusWord As DWord
+	TagWord As DWord
+	ErrorOffset As DWord
+	ErrorSelector As DWord
+	DataOffset As DWord
+	DataSelector As DWord
+	RegisterArea[ELM(WOW64_SIZE_OF_80387_REGISTERS)] As Byte
+	Cr0NpxState As DWord
+End Type
+TypeDef PWOW64_FLOATING_SAVE_AREA = *WOW64_FLOATING_SAVE_AREA
+
+Type WOW64_CONTEXT
+	ContextFlags As DWord
+
+	Dr0 As DWord
+	Dr1 As DWord
+	Dr2 As DWord
+	Dr3 As DWord
+	Dr6 As DWord
+	Dr7 As DWord
+
+	FloatSave As WOW64_FLOATING_SAVE_AREA
+
+	SegGs As DWord
+	SegFs As DWord
+	SegEs As DWord
+	SegDs As DWord
+
+	Edi As DWord
+	Esi As DWord
+	Ebx As DWord
+	Edx As DWord
+	Ecx As DWord
+	Eax As DWord
+
+	Ebp As DWord
+	Eip As DWord
+	SegCs As DWord
+	EFlags As DWord
+	Esp As DWord
+	SegSs As DWord
+
+	ExtendedRegisters[ELM(WOW64_MAXIMUM_SUPPORTED_EXTENSION)] As Byte
+End Type
+
+TypeDef PWOW64_CONTEXT = *WOW64_CONTEXT
+
+Const EXCEPTION_NONCONTINUABLE = &h1
+Const EXCEPTION_MAXIMUM_PARAMETERS = 15
+
+Type EXCEPTION_RECORD
+	ExceptionCode As DWord
+	ExceptionFlags As DWord
+	ExceptionRecord As *EXCEPTION_RECORD
+	ExceptionAddress As PVOID
+	NumberParameters As DWord
+	ExceptionInformation[ELM(EXCEPTION_MAXIMUM_PARAMETERS)] As ULONG_PTR
+End Type
+TypeDef PEXCEPTION_RECORD = *EXCEPTION_RECORD
+
+Type EXCEPTION_RECORD32
+	ExceptionCode As DWord
+	ExceptionFlags As DWord
+	ExceptionRecord As DWord
+	ExceptionAddress As DWord
+	NumberParameters As DWord
+	ExceptionInformation[ELM(EXCEPTION_MAXIMUM_PARAMETERS)] As DWord
+End Type
+TypeDef PEXCEPTION_RECORD32 = *EXCEPTION_RECORD32
+
+Type EXCEPTION_RECORD64
+	ExceptionCode As DWord
+	ExceptionFlags As DWord
+	ExceptionRecord As QWord
+	ExceptionAddress As QWord
+	NumberParameters As DWord
+	__unusedAlignment As DWord
+	ExceptionInformation[ELM(EXCEPTION_MAXIMUM_PARAMETERS)] As QWord
+End Type
+TypeDef PEXCEPTION_RECORD64 = *EXCEPTION_RECORD64
+
+Type EXCEPTION_POINTERS
+	ExceptionRecord As PEXCEPTION_RECORD
+	ContextRecord As PCONTEXT
+End Type
+TypeDef PEXCEPTION_POINTERS = *EXCEPTION_POINTERS
+
+TypeDef PACCESS_TOKEN = PVOID
+'TypeDef PSECURITY_DESCRIPTOR = PVOID
+'TypeDef PSID = PVOID
+
+'ACCESS MASK
+TypeDef ACCESS_MASK = DWord
+TypeDef PACCESS_MASK = *ACCESS_MASK
+
+'ACCESS TYPES
+
+'Const DELETE = (&h00010000)
+Const READ_CONTROL = (&h00020000)
+Const WRITE_DAC = (&h00040000)
+Const WRITE_OWNER = (&h00080000)
+Const SYNCHRONIZE = (&h00100000)
+
+Const STANDARD_RIGHTS_REQUIRED = (&h000F0000)
+
+Const STANDARD_RIGHTS_READ = (READ_CONTROL)
+Const STANDARD_RIGHTS_WRITE = (READ_CONTROL)
+Const STANDARD_RIGHTS_EXECUTE = (READ_CONTROL)
+
+Const STANDARD_RIGHTS_ALL = (&h001F0000)
+
+Const SPECIFIC_RIGHTS_ALL = (&h0000FFFF)
+
+Const ACCESS_SYSTEM_SECURITY = (&h01000000)
+
+Const MAXIMUM_ALLOWED = (&h02000000)
+
+Const GENERIC_READ = (&h80000000)
+Const GENERIC_WRITE = (&h40000000)
+Const GENERIC_EXECUTE = (&h20000000)
+Const GENERIC_ALL = (&h10000000)
+
+Type GENERIC_MAPPING
+	GenericRead As ACCESS_MASK
+	GenericWrite As ACCESS_MASK
+	GenericExecute As ACCESS_MASK
+	GenericAll As ACCESS_MASK
+End Type
+TypeDef PGENERIC_MAPPING = *GENERIC_MAPPING
+
+' LUID_AND_ATTRIBUTES
+Type Align(4) LUID_AND_ATTRIBUTES
+	Luid As LUID
+	Attributes As DWord
+End Type
+'TypeDef LUID_AND_ATTRIBUTES_ARRAY = LUID_AND_ATTRIBUTES[ANYSIZE_ARRAY]
+'TypeDef PLUID_AND_ATTRIBUTES_ARRAY = *LUID_AND_ATTRIBUTES_ARRAY
+
+' Security Id (SID)
+
+Type SID_IDENTIFIER_AUTHORITY
+	Value[ELM(6)] As Byte
+End Type
+TypeDef PSID_IDENTIFIER_AUTHORITY = *SID_IDENTIFIER_AUTHORITY
+
+Type SID
+	Revision As Byte
+	SubAuthorityCount As Byte
+	IdentifierAuthority As SID_IDENTIFIER_AUTHORITY
+	SubAuthority[ELM(ANYSIZE_ARRAY)] As DWord
+End Type
+TypeDef PSID = *SID
+
+Const SID_REVISION = (1)
+Const SID_MAX_SUB_AUTHORITIES = (15)
+Const SID_RECOMMENDED_SUB_AUTHORITIES = (1)
+
+Const SECURITY_MAX_SID_SIZE = (SizeOf (SID) - SizeOf (DWord) + (SID_MAX_SUB_AUTHORITIES * SizeOf (DWord)))
+
+Enum SID_NAME_USE
+	SidTypeUser = 1
+	SidTypeGroup
+	SidTypeDomain
+	SidTypeAlias
+	SidTypeWellKnownGroup
+	SidTypeDeletedAccount
+	SidTypeInvalid
+	SidTypeUnknown
+	SidTypeComputer
+	SidTypeLabel
+End Enum
+TypeDef PSID_NAME_USE = *SID_NAME_USE
+
+Type SID_AND_ATTRIBUTES
+	Sid As PSID
+	Attributes As DWord
+End Type
+TypeDef PSID_AND_ATTRIBUTES = *SID_AND_ATTRIBUTES
+
+'TypeDef SID_AND_ATTRIBUTES_ARRAY = SID_AND_ATTRIBUTES[ANYSIZE_ARRAY]
+'TypeDef PSID_AND_ATTRIBUTES_ARRAY = *SID_AND_ATTRIBUTES_ARRAY
+
+Const SID_HASH_SIZE = 32
+TypeDef SID_HASH_ENTRY = ULONG_PTR
+TypeDef PSID_HASH_ENTRY = *SID_HASH_ENTRY
+
+Type SID_AND_ATTRIBUTES_HASH
+	SidCount As DWord
+	SidAttr As PSID_AND_ATTRIBUTES
+	Hash[ELM(SID_HASH_SIZE)] As SID_HASH_ENTRY
+End Type
+TypeDef PSID_AND_ATTRIBUTES_HASH = *SID_AND_ATTRIBUTES_HASH
+
+' Universal well-known SIDs
+'Const SECURITY_NULL_SID_AUTHORITY = [0, 0, 0, 0, 0, 0] As SID_IDENTIFIER_AUTHORITY
+'Const SECURITY_WORLD_SID_AUTHORITY = [0, 0, 0, 0, 0, 1] As SID_IDENTIFIER_AUTHORITY
+'Const SECURITY_LOCAL_SID_AUTHORITY = [0, 0, 0, 0, 0, 2] As SID_IDENTIFIER_AUTHORITY
+'Const SECURITY_CREATOR_SID_AUTHORITY = [0, 0, 0, 0, 0, 3] As SID_IDENTIFIER_AUTHORITY
+'Const SECURITY_NON_UNIQUE_AUTHORITY = [0, 0, 0, 0, 0, 4] As SID_IDENTIFIER_AUTHORITY
+'Const SECURITY_RESOURCE_MANAGER_AUTHORITY = [0, 0, 0, 0, 0, 9] As SID_IDENTIFIER_AUTHORITY
+
+Const SECURITY_NULL_RID = (&h00000000)
+Const SECURITY_WORLD_RID = (&h00000000)
+Const SECURITY_LOCAL_RID = (&h00000000)
+
+Const SECURITY_CREATOR_OWNER_RID = (&h00000000)
+Const SECURITY_CREATOR_GROUP_RID = (&h00000001)
+
+Const SECURITY_CREATOR_OWNER_SERVER_RID = (&h00000002)
+Const SECURITY_CREATOR_GROUP_SERVER_RID = (&h00000003)
+
+Const SECURITY_CREATOR_OWNER_RIGHTS_RID = (&h00000004)
+
+' NT well-known SIDs
+'Const SECURITY_NT_AUTHORITY = [0, 0, 0, 0, 0, 9] As SID_IDENTIFIER_AUTHORITY
+
+Const SECURITY_DIALUP_RID = (&h00000001)
+Const SECURITY_NETWORK_RID = (&h00000002)
+Const SECURITY_BATCH_RID = (&h00000003)
+Const SECURITY_INTERACTIVE_RID = (&h00000004)
+Const SECURITY_LOGON_IDS_RID = (&h00000005)
+Const SECURITY_LOGON_IDS_RID_COUNT = (3)
+Const SECURITY_SERVICE_RID = (&h00000006)
+Const SECURITY_ANONYMOUS_LOGON_RID = (&h00000007)
+Const SECURITY_PROXY_RID = (&h00000008)
+Const SECURITY_ENTERPRISE_CONTROLLERS_RID = (&h00000009)
+Const SECURITY_SERVER_LOGON_RID = SECURITY_ENTERPRISE_CONTROLLERS_RID
+Const SECURITY_PRINCIPAL_SELF_RID = (&h0000000A)
+Const SECURITY_AUTHENTICATED_USER_RID = (&h0000000B)
+Const SECURITY_RESTRICTED_CODE_RID = (&h0000000C)
+Const SECURITY_TERMINAL_SERVER_RID = (&h0000000D)
+Const SECURITY_REMOTE_LOGON_RID = (&h0000000E)
+Const SECURITY_THIS_ORGANIZATION_RID = (&h0000000F)
+Const SECURITY_IUSER_RID = (&h00000011)
+Const SECURITY_LOCAL_SYSTEM_RID = (&h00000012)
+Const SECURITY_LOCAL_SERVICE_RID = (&h00000013)
+Const SECURITY_NETWORK_SERVICE_RID = (&h00000014)
+
+Const SECURITY_NT_NON_UNIQUE = (&h00000015)
+Const SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT = (3)
+
+Const SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID = (&h00000016)
+
+Const SECURITY_BUILTIN_DOMAIN_RID = (&h00000020)
+Const SECURITY_WRITE_RESTRICTED_CODE_RID = (&h00000021)
+
+
+Const SECURITY_PACKAGE_BASE_RID = (&h00000040)
+Const SECURITY_PACKAGE_RID_COUNT = (2)
+Const SECURITY_PACKAGE_NTLM_RID = (&h0000000A)
+Const SECURITY_PACKAGE_SCHANNEL_RID = (&h0000000E)
+Const SECURITY_PACKAGE_DIGEST_RID = (&h00000015)
+
+Const SECURITY_SERVICE_ID_BASE_RID = (&h00000050)
+Const SECURITY_SERVICE_ID_RID_COUNT = (6)
+
+Const SECURITY_RESERVED_ID_BASE_RID = (&h00000051)
+
+Const SECURITY_MAX_ALWAYS_FILTERED = (&h000003E7)
+Const SECURITY_MIN_NEVER_FILTERED = (&h000003E8)
+
+Const SECURITY_OTHER_ORGANIZATION_RID = (&h000003E8)
+
+' well-known domain relative sub-authority values (RIDs)...
+' Well-known users ...
+Const FOREST_USER_RID_MAX = (&h000001F3)
+
+Const DOMAIN_USER_RID_ADMIN = (&h000001F4)
+Const DOMAIN_USER_RID_GUEST = (&h000001F5)
+Const DOMAIN_USER_RID_KRBTGT = (&h000001F6)
+
+Const DOMAIN_USER_RID_MAX = (&h000003E7)
+
+' well-known groups ...
+Const DOMAIN_GROUP_RID_ADMINS = (&h00000200)
+Const DOMAIN_GROUP_RID_USERS = (&h00000201)
+Const DOMAIN_GROUP_RID_GUESTS = (&h00000202)
+Const DOMAIN_GROUP_RID_COMPUTERS = (&h00000203)
+Const DOMAIN_GROUP_RID_CONTROLLERS = (&h00000204)
+Const DOMAIN_GROUP_RID_CERT_ADMINS = (&h00000205)
+Const DOMAIN_GROUP_RID_SCHEMA_ADMINS = (&h00000206)
+Const DOMAIN_GROUP_RID_ENTERPRISE_ADMINS = (&h00000207)
+Const DOMAIN_GROUP_RID_POLICY_ADMINS = (&h00000208)
+Const DOMAIN_GROUP_RID_READONLY_CONTROLLERS = (&h00000209)
+
+' well-known aliases ...
+Const DOMAIN_ALIAS_RID_ADMINS = (&h00000220)
+Const DOMAIN_ALIAS_RID_USERS = (&h00000221)
+Const DOMAIN_ALIAS_RID_GUESTS = (&h00000222)
+Const DOMAIN_ALIAS_RID_POWER_USERS = (&h00000223)
+
+Const DOMAIN_ALIAS_RID_ACCOUNT_OPS = (&h00000224)
+Const DOMAIN_ALIAS_RID_SYSTEM_OPS = (&h00000225)
+Const DOMAIN_ALIAS_RID_PRINT_OPS = (&h00000226)
+Const DOMAIN_ALIAS_RID_BACKUP_OPS = (&h00000227)
+
+Const DOMAIN_ALIAS_RID_REPLICATOR = (&h00000228)
+Const DOMAIN_ALIAS_RID_RAS_SERVERS = (&h00000229)
+Const DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = (&h0000022A)
+Const DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = (&h0000022B)
+Const DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = (&h0000022C)
+Const DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = (&h0000022D)
+
+Const DOMAIN_ALIAS_RID_MONITORING_USERS = (&h0000022E)
+Const DOMAIN_ALIAS_RID_LOGGING_USERS = (&h0000022F)
+Const DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = (&h00000230)
+Const DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = (&h00000231)
+Const DOMAIN_ALIAS_RID_DCOM_USERS = (&h00000232)
+Const DOMAIN_ALIAS_RID_IUSERS = (&h00000238)
+Const DOMAIN_ALIAS_RID_CRYPTO_OPERATORS = (&h00000239)
+Const DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP = (&h0000023B)
+Const DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP = (&h0000023C)
+Const DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP = (&h0000023D)
+
+'Const SECURITY_MANDATORY_LABEL_AUTHORITY = [0, 0, 0, 0 ,0, 16] As SID_IDENTIFIER_AUTHORITY
+Const SECURITY_MANDATORY_UNTRUSTED_RID = (&h00000000)
+Const SECURITY_MANDATORY_LOW_RID = (&h00001000)
+Const SECURITY_MANDATORY_MEDIUM_RID = (&h00002000)
+Const SECURITY_MANDATORY_HIGH_RID = (&h00003000)
+Const SECURITY_MANDATORY_SYSTEM_RID = (&h00004000)
+Const SECURITY_MANDATORY_PROTECTED_PROCESS_RID = (&h00005000)
+
+
+Const SECURITY_MANDATORY_MAXIMUM_USER_RID = SECURITY_MANDATORY_SYSTEM_RID
+
+Const MANDATORY_LEVEL_TO_MANDATORY_RID(I) = (I * &h1000)
+
+' Well known SID definitions for lookup.
+Const Enum WELL_KNOWN_SID_TYPE
+	WinNullSid = 0
+	WinWorldSid = 1
+	WinLocalSid = 2
+	WinCreatorOwnerSid = 3
+	WinCreatorGroupSid = 4
+	WinCreatorOwnerServerSid = 5
+	WinCreatorGroupServerSid = 6
+	WinNtAuthoritySid = 7
+	WinDialupSid = 8
+	WinNetworkSid = 9
+	WinBatchSid = 10
+	WinInteractiveSid = 11
+	WinServiceSid = 12
+	WinAnonymousSid = 13
+	WinProxySid = 14
+	WinEnterpriseControllersSid = 15
+	WinSelfSid = 16
+	WinAuthenticatedUserSid = 17
+	WinRestrictedCodeSid = 18
+	WinTerminalServerSid = 19
+	WinRemoteLogonIdSid = 20
+	WinLogonIdsSid = 21
+	WinLocalSystemSid = 22
+	WinLocalServiceSid = 23
+	WinNetworkServiceSid = 24
+	WinBuiltinDomainSid = 25
+	WinBuiltinAdministratorsSid = 26
+	WinBuiltinUsersSid = 27
+	WinBuiltinGuestsSid = 28
+	WinBuiltinPowerUsersSid = 29
+	WinBuiltinAccountOperatorsSid = 30
+	WinBuiltinSystemOperatorsSid = 31
+	WinBuiltinPrintOperatorsSid = 32
+	WinBuiltinBackupOperatorsSid = 33
+	WinBuiltinReplicatorSid = 34
+	WinBuiltinPreWindows2000CompatibleAccessSid = 35
+	WinBuiltinRemoteDesktopUsersSid = 36
+	WinBuiltinNetworkConfigurationOperatorsSid = 37
+	WinAccountAdministratorSid = 38
+	WinAccountGuestSid = 39
+	WinAccountKrbtgtSid = 40
+	WinAccountDomainAdminsSid = 41
+	WinAccountDomainUsersSid = 42
+	WinAccountDomainGuestsSid = 43
+	WinAccountComputersSid = 44
+	WinAccountControllersSid = 45
+	WinAccountCertAdminsSid = 46
+	WinAccountSchemaAdminsSid = 47
+	WinAccountEnterpriseAdminsSid = 48
+	WinAccountPolicyAdminsSid = 49
+	WinAccountRasAndIasServersSid = 50
+	WinNTLMAuthenticationSid = 51
+	WinDigestAuthenticationSid = 52
+	WinSChannelAuthenticationSid = 53
+	WinThisOrganizationSid = 54
+	WinOtherOrganizationSid = 55
+	WinBuiltinIncomingForestTrustBuildersSid = 56
+	WinBuiltinPerfMonitoringUsersSid = 57
+	WinBuiltinPerfLoggingUsersSid = 58
+	WinBuiltinAuthorizationAccessSid = 59
+	WinBuiltinTerminalServerLicenseServersSid = 60
+	WinBuiltinDCOMUsersSid = 61
+	WinBuiltinIUsersSid = 62
+	WinIUserSid = 63
+	WinBuiltinCryptoOperatorsSid = 64
+	WinUntrustedLabelSid = 65
+	WinLowLabelSid = 66
+	WinMediumLabelSid = 67
+	WinHighLabelSid = 68
+	WinSystemLabelSid = 69
+	WinWriteRestrictedCodeSid = 70
+	WinCreatorOwnerRightsSid = 71
+	WinCacheablePrincipalsGroupSid = 72
+	WinNonCacheablePrincipalsGroupSid = 73
+	WinEnterpriseReadonlyControllersSid = 74
+	WinAccountReadonlyControllersSid = 75
+	WinBuiltinEventLogReadersGroup = 76
+End Enum
+
+'Const SYSTEM_LUID = [&h3e7, &h0] As LUID
+'Const ANONYMOUS_LOGON_LUID = [&h3e6, &h0] As LUID
+'Const LOCALSERVICE_LUID = [&h3e5, &h0] As LUID
+'Const NETWORKSERVICE_LUID = [&h3e4, &h0] As LUID
+'Const IUSER_LUID = [&h3e3, &h0] As LUID
+
+' User and Group related SID attributes
+
+' Group attributes
+Const SE_GROUP_MANDATORY = (&h00000001)
+Const SE_GROUP_ENABLED_BY_DEFAULT = (&h00000002)
+Const SE_GROUP_ENABLED = (&h00000004)
+Const SE_GROUP_OWNER = (&h00000008)
+Const SE_GROUP_USE_FOR_DENY_ONLY = (&h00000010)
+Const SE_GROUP_INTEGRITY = (&h00000020)
+Const SE_GROUP_INTEGRITY_ENABLED = (&h00000040)
+Const SE_GROUP_LOGON_ID = (&hC0000000)
+Const SE_GROUP_RESOURCE = (&h20000000)
+
+Const SE_GROUP_VALID_ATTRIBUTES = (SE_GROUP_MANDATORY Or SE_GROUP_ENABLED_BY_DEFAULT Or SE_GROUP_ENABLED Or SE_GROUP_OWNER Or SE_GROUP_USE_FOR_DENY_ONLY Or SE_GROUP_LOGON_ID  Or SE_GROUP_RESOURCE Or SE_GROUP_INTEGRITY Or SE_GROUP_INTEGRITY_ENABLED)
+
+' ACL  and  ACE
+Const ACL_REVISION = (2)
+Const ACL_REVISION_DS = (4)
+
+Const ACL_REVISION1 = (1)
+Const MIN_ACL_REVISION = ACL_REVISION2
+Const ACL_REVISION2 = (2)
+Const ACL_REVISION3 = (3)
+Const ACL_REVISION4 = (4)
+Const MAX_ACL_REVISION = ACL_REVISION4
+
+Type ACL
+	AclRevision As Byte
+	Sbz1 As Byte
+	AclSize As Word
+	AceCount As Word
+	Sbz2 As Word
+End Type
+TypeDef PACL = ACL
+
+Type ACE_HEADER
+	AceType As Byte
+	AceFlags As Byte
+	AceSize As Word
+End Type
+TypeDef PACE_HEADER = *ACE_HEADER
+
+Const ACCESS_MIN_MS_ACE_TYPE = (&h0)
+Const ACCESS_ALLOWED_ACE_TYPE = (&h0)
+Const ACCESS_DENIED_ACE_TYPE = (&h1)
+Const SYSTEM_AUDIT_ACE_TYPE = (&h2)
+Const SYSTEM_ALARM_ACE_TYPE = (&h3)
+Const ACCESS_MAX_MS_V2_ACE_TYPE = (&h3)
+
+Const ACCESS_ALLOWED_COMPOUND_ACE_TYPE = (&h4)
+Const ACCESS_MAX_MS_V3_ACE_TYPE = (&h4)
+
+Const ACCESS_MIN_MS_OBJECT_ACE_TYPE = (&h5)
+Const ACCESS_ALLOWED_OBJECT_ACE_TYPE = (&h5)
+Const ACCESS_DENIED_OBJECT_ACE_TYPE = (&h6)
+Const SYSTEM_AUDIT_OBJECT_ACE_TYPE = (&h7)
+Const SYSTEM_ALARM_OBJECT_ACE_TYPE = (&h8)
+Const ACCESS_MAX_MS_OBJECT_ACE_TYPE = (&h8)
+
+Const ACCESS_MAX_MS_V4_ACE_TYPE = (&h8)
+Const ACCESS_MAX_MS_ACE_TYPE = (&h8)
+
+Const ACCESS_ALLOWED_CALLBACK_ACE_TYPE = (&h9)
+Const ACCESS_DENIED_CALLBACK_ACE_TYPE = (&hA)
+Const ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE = (&hB)
+Const ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE = (&hC)
+Const SYSTEM_AUDIT_CALLBACK_ACE_TYPE = (&hD)
+Const SYSTEM_ALARM_CALLBACK_ACE_TYPE = (&hE)
+Const SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE = (&hF)
+Const SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE = (&h10)
+
+Const SYSTEM_MANDATORY_LABEL_ACE_TYPE = (&h11)
+Const ACCESS_MAX_MS_V5_ACE_TYPE = (&h11)
+
+Const OBJECT_INHERIT_ACE = (&h1)
+Const CONTAINER_INHERIT_ACE = (&h2)
+Const NO_PROPAGATE_INHERIT_ACE = (&h4)
+Const INHERIT_ONLY_ACE = (&h8)
+Const INHERITED_ACE = (&h10)
+Const VALID_INHERIT_FLAGS = (&h1F)
+
+Const SUCCESSFUL_ACCESS_ACE_FLAG = (&h40)
+Const FAILED_ACCESS_ACE_FLAG = (&h80)
+
+Type ACCESS_ALLOWED_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	SidStart As DWord
+End Type
+TypeDef PACCESS_ALLOWED_ACE = *ACCESS_ALLOWED_ACE
+
+Type ACCESS_DENIED_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	SidStart As DWord
+End Type
+TypeDef PACCESS_DENIED_ACE = *ACCESS_DENIED_ACE
+
+Type SYSTEM_AUDIT_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	SidStart As DWord
+End Type
+TypeDef PSYSTEM_AUDIT_ACE = *SYSTEM_AUDIT_ACE
+
+Type SYSTEM_ALARM_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	SidStart As DWord
+End Type
+TypeDef PSYSTEM_ALARM_ACE = *SYSTEM_ALARM_ACE
+
+Type SYSTEM_MANDATORY_LABEL_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	SidStart As DWord
+End Type
+TypeDef PSYSTEM_MANDATORY_LABEL_ACE = *SYSTEM_MANDATORY_LABEL_ACE
+
+Const SYSTEM_MANDATORY_LABEL_NO_WRITE_UP = &h1
+Const SYSTEM_MANDATORY_LABEL_NO_READ_UP = &h2
+Const SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP = &h4
+
+Const SYSTEM_MANDATORY_LABEL_VALID_MASK = (SYSTEM_MANDATORY_LABEL_NO_WRITE_UP Or SYSTEM_MANDATORY_LABEL_NO_READ_UP Or SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP)
+
+Type ACCESS_ALLOWED_OBJECT_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	Flags As DWord
+	ObjectType As GUID
+	InheritedObjectType As GUID
+	SidStart As DWord
+End Type
+TypeDef PACCESS_ALLOWED_OBJECT_ACE = *ACCESS_ALLOWED_OBJECT_ACE
+
+Type ACCESS_DENIED_OBJECT_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	Flags As DWord
+	ObjectType As GUID
+	InheritedObjectType As GUID
+	SidStart As DWord
+End Type
+TypeDef PACCESS_DENIED_OBJECT_ACE = *ACCESS_DENIED_OBJECT_ACE
+
+Type SYSTEM_AUDIT_OBJECT_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	Flags As DWord
+	ObjectType As GUID
+	InheritedObjectType As GUID
+	SidStart As DWord
+End Type
+TypeDef PSYSTEM_AUDIT_OBJECT_ACE = *SYSTEM_AUDIT_OBJECT_ACE
+
+Type SYSTEM_ALARM_OBJECT_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	Flags As DWord
+	ObjectType As GUID
+	InheritedObjectType As GUID
+	SidStart As DWord
+End Type
+TypeDef PSYSTEM_ALARM_OBJECT_ACE = *SYSTEM_ALARM_OBJECT_ACE
+
+Type ACCESS_ALLOWED_CALLBACK_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	SidStart As DWord
+End Type
+TypeDef PACCESS_ALLOWED_CALLBACK_ACE = *ACCESS_ALLOWED_CALLBACK_ACE
+
+Type ACCESS_DENIED_CALLBACK_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	SidStart As DWord
+End Type
+TypeDef PACCESS_DENIED_CALLBACK_ACE = *ACCESS_DENIED_CALLBACK_ACE
+
+Type SYSTEM_AUDIT_CALLBACK_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	SidStart As DWord
+End Type
+TypeDef PSYSTEM_AUDIT_CALLBACK_ACE = *SYSTEM_AUDIT_CALLBACK_ACE
+
+Type SYSTEM_ALARM_CALLBACK_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	SidStart As DWord
+End Type
+TypeDef PSYSTEM_ALARM_CALLBACK_ACE = *SYSTEM_ALARM_CALLBACK_ACE
+
+Type ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	Flags As DWord
+	ObjectType As GUID
+	InheritedObjectType As GUID
+	SidStart As DWord
+End Type
+TypeDef PACCESS_ALLOWED_CALLBACK_OBJECT_ACE = *ACCESS_ALLOWED_CALLBACK_OBJECT_ACE
+
+Type ACCESS_DENIED_CALLBACK_OBJECT_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	Flags As DWord
+	ObjectType As GUID
+	InheritedObjectType As GUID
+	SidStart As DWord
+End Type
+TypeDef PACCESS_DENIED_CALLBACK_OBJECT_ACE = *ACCESS_DENIED_CALLBACK_OBJECT_ACE
+
+Type SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	Flags As DWord
+	ObjectType As GUID
+	InheritedObjectType As GUID
+	SidStart As DWord
+End Type
+TypeDef PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE = *SYSTEM_AUDIT_CALLBACK_OBJECT_ACE
+
+Type SYSTEM_ALARM_CALLBACK_OBJECT_ACE
+	Header As ACE_HEADER
+	Mask As ACCESS_MASK
+	Flags As DWord
+	ObjectType As GUID
+	InheritedObjectType As GUID
+	SidStart As DWord
+End Type
+TypeDef PSYSTEM_ALARM_CALLBACK_OBJECT_ACE = *SYSTEM_ALARM_CALLBACK_OBJECT_ACE
+
+Const ACE_OBJECT_TYPE_PRESENT = &h1
+Const ACE_INHERITED_OBJECT_TYPE_PRESENT = &h2
+
+Enum ACL_INFORMATION_CLASS
+	AclRevisionInformation = 1
+	AclSizeInformation
+End Enum
+
+Type ACL_REVISION_INFORMATION
+	AclRevision As DWord
+End Type
+TypeDef PACL_REVISION_INFORMATION = *ACL_REVISION_INFORMATION
+
+Type ACL_SIZE_INFORMATION
+AceCount As DWord
+AclBytesInUse As DWord
+AclBytesFree As DWord
+End Type
+TypeDef PACL_SIZE_INFORMATION = *ACL_SIZE_INFORMATION
+
+' SECURITY_DESCRIPTOR
+Const SECURITY_DESCRIPTOR_REVISION = (1)
+Const SECURITY_DESCRIPTOR_REVISION1 = (1)
+
+Const SECURITY_DESCRIPTOR_MIN_LENGTH = (SizeOf (SECURITY_DESCRIPTOR))
+
+TypeDef SECURITY_DESCRIPTOR_CONTROL = Word
+TypeDef PSECURITY_DESCRIPTOR_CONTROL = *SECURITY_DESCRIPTOR_CONTROL
+
+Const SE_OWNER_DEFAULTED = (&h0001)
+Const SE_GROUP_DEFAULTED = (&h0002)
+Const SE_DACL_PRESENT = (&h0004)
+Const SE_DACL_DEFAULTED = (&h0008)
+Const SE_SACL_PRESENT = (&h0010)
+Const SE_SACL_DEFAULTED = (&h0020)
+Const SE_DACL_AUTO_INHERIT_REQ = (&h0100)
+Const SE_SACL_AUTO_INHERIT_REQ = (&h0200)
+Const SE_DACL_AUTO_INHERITED = (&h0400)
+Const SE_SACL_AUTO_INHERITED = (&h0800)
+Const SE_DACL_PROTECTED = (&h1000)
+Const SE_SACL_PROTECTED = (&h2000)
+Const SE_RM_CONTROL_VALID = (&h4000)
+Const SE_SELF_RELATIVE = (&h8000)
+
+Type SECURITY_DESCRIPTOR_RELATIVE
+	Revision As Byte
+	Sbz1 As Byte
+	Control As SECURITY_DESCRIPTOR_CONTROL
+	Owner As DWord
+	Group As DWord
+	Sacl As DWord
+	Dacl As DWord
+End Type
+TypeDef PSECURITY_DESCRIPTOR_RELATIVE = *SECURITY_DESCRIPTOR_RELATIVE
+
+Type SECURITY_DESCRIPTOR
+	Revision As Byte
+	Sbz1 As Byte
+	Control As SECURITY_DESCRIPTOR_CONTROL
+	Owner As PSID
+	Group As PSID
+	Sacl As PACL
+	Dacl As PACL
+End Type
+TypeDef PSECURITY_DESCRIPTOR = *SECURITY_DESCRIPTOR
+
+Type OBJECT_TYPE_LIST
+	Level As Word
+	Sbz As Word
+	ObjectType As *GUID
+End Type
+TypeDef POBJECT_TYPE_LIST = *OBJECT_TYPE_LIST
+
+Const ACCESS_OBJECT_GUID = 0
+Const ACCESS_PROPERTY_SET_GUID = 1
+Const ACCESS_PROPERTY_GUID = 2
+
+Const ACCESS_MAX_LEVEL = 4
+
+Const Enum AUDIT_EVENT_TYPE
+	AuditEventObjectAccess,
+	AuditEventDirectoryServiceAccess
+End Enum
+TypeDef PAUDIT_EVENT_TYPE = *AUDIT_EVENT_TYPE
+
+Const AUDIT_ALLOW_NO_PRIVILEGE = &h1
+
+'Const ACCESS_DS_SOURCE_A = "DS"
+'Const ACCESS_DS_SOURCE_W = L"DS"
+'Const ACCESS_DS_OBJECT_TYPE_NAME_A = "Directory Service Object"
+'Const ACCESS_DS_OBJECT_TYPE_NAME_W = L"Directory Service Object"
+Const ACCESS_DS_SOURCE = "DS"
+Const ACCESS_DS_OBJECT_TYPE_NAME = "Directory Service Object"
+
+Const SE_PRIVILEGE_ENABLED_BY_DEFAULT = (&h00000001)
+Const SE_PRIVILEGE_ENABLED = (&h00000002)
+Const SE_PRIVILEGE_REMOVED = (&h00000004)
+Const SE_PRIVILEGE_USED_FOR_ACCESS = (&h80000000)
+
+Const SE_PRIVILEGE_VALID_ATTRIBUTES = (SE_PRIVILEGE_ENABLED_BY_DEFAULT Or SE_PRIVILEGE_ENABLED  Or SE_PRIVILEGE_REMOVED  Or SE_PRIVILEGE_USED_FOR_ACCESS)
+
+Const PRIVILEGE_SET_ALL_NECESSARY = (1)
+
+Type PRIVILEGE_SET
+	PrivilegeCount As DWord
+	Control As DWord
+	Privilege[ELM(ANYSIZE_ARRAY)] As LUID_AND_ATTRIBUTES
+End Type
+TypeDef PPRIVILEGE_SET = *PRIVILEGE_SET
+
+' NT Defined Privileges
+Const SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege"
+Const SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege"
+Const SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege"
+Const SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege"
+Const SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege"
+Const SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege"
+Const SE_TCB_NAME = "SeTcbPrivilege"
+Const SE_SECURITY_NAME = "SeSecurityPrivilege"
+Const SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege"
+Const SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege"
+Const SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege"
+Const SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege"
+Const SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege"
+Const SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege"
+Const SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege"
+Const SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege"
+Const SE_BACKUP_NAME = "SeBackupPrivilege"
+Const SE_RESTORE_NAME = "SeRestorePrivilege"
+Const SE_SHUTDOWN_NAME = "SeShutdownPrivilege"
+Const SE_DEBUG_NAME = "SeDebugPrivilege"
+Const SE_AUDIT_NAME = "SeAuditPrivilege"
+Const SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege"
+Const SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege"
+Const SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege"
+Const SE_UNDOCK_NAME = "SeUndockPrivilege"
+Const SE_SYNC_AGENT_NAME = "SeSyncAgentPrivilege"
+Const SE_ENABLE_DELEGATION_NAME = "SeEnableDelegationPrivilege"
+Const SE_MANAGE_VOLUME_NAME = "SeManageVolumePrivilege"
+Const SE_IMPERSONATE_NAME = "SeImpersonatePrivilege"
+Const SE_CREATE_GLOBAL_NAME = "SeCreateGlobalPrivilege"
+Const SE_TRUSTED_CREDMAN_ACCESS_NAME = "SeTrustedCredManAccessPrivilege"
+Const SE_RELABEL_NAME = "SeRelabelPrivilege"
+Const SE_INC_WORKING_SET_NAME = "SeIncreaseWorkingSetPrivilege"
+Const SE_TIME_ZONE_NAME = "SeTimeZonePrivilege"
+Const SE_CREATE_SYMBOLIC_LINK_NAME = "SeCreateSymbolicLinkPrivilege"
+
+' Security Quality Of Service
+Const Enum SECURITY_IMPERSONATION_LEVEL
+	SecurityAnonymous
+	SecurityIdentification
+	SecurityImpersonation
+	SecurityDelegation
+End Enum
+TypeDef PSECURITY_IMPERSONATION_LEVEL = *SECURITY_IMPERSONATION_LEVEL
+
+Const SECURITY_MAX_IMPERSONATION_LEVEL = SecurityDelegation
+Const SECURITY_MIN_IMPERSONATION_LEVEL = SecurityAnonymous
+Const DEFAULT_IMPERSONATION_LEVEL = SecurityImpersonation
+Const VALID_IMPERSONATION_LEVEL(L) = (((L) >= SECURITY_MIN_IMPERSONATION_LEVEL) And ((L) <= SECURITY_MAX_IMPERSONATION_LEVEL))
+
+' Token Object Definitions
+
+' Token Specific Access Rights.
+Const TOKEN_ASSIGN_PRIMARY = (&h0001)
+Const TOKEN_DUPLICATE = (&h0002)
+Const TOKEN_IMPERSONATE = (&h0004)
+Const TOKEN_QUERY = (&h0008)
+Const TOKEN_QUERY_SOURCE = (&h0010)
+Const TOKEN_ADJUST_PRIVILEGES = (&h0020)
+Const TOKEN_ADJUST_GROUPS = (&h0040)
+Const TOKEN_ADJUST_DEFAULT = (&h0080)
+Const TOKEN_ADJUST_SESSIONID = (&h0100)
+
+Const TOKEN_ALL_ACCESS_P = (STANDARD_RIGHTS_REQUIRED Or TOKEN_ASSIGN_PRIMARY Or TOKEN_DUPLICATE  Or TOKEN_IMPERSONATE Or TOKEN_QUERY  Or TOKEN_QUERY_SOURCE Or TOKEN_ADJUST_PRIVILEGES Or TOKEN_ADJUST_GROUPS Or TOKEN_ADJUST_DEFAULT)
+'#if ((defined(_WIN32_WINNT) And (_WIN32_WINNT > &h0400)) Or (!defined(_WIN32_WINNT)))
+Const TOKEN_ALL_ACCESS = (TOKEN_ALL_ACCESS_P Or TOKEN_ADJUST_SESSIONID)
+'#else
+'Const TOKEN_ALL_ACCESS = (TOKEN_ALL_ACCESS_P)
+'#endif
+Const TOKEN_READ = (STANDARD_RIGHTS_READ Or TOKEN_QUERY)
+Const TOKEN_WRITE = (STANDARD_RIGHTS_WRITE Or TOKEN_ADJUST_PRIVILEGES Or TOKEN_ADJUST_GROUPS Or TOKEN_ADJUST_DEFAULT)
+Const TOKEN_EXECUTE = (STANDARD_RIGHTS_EXECUTE)
+
+' Token Types
+Const Enum TOKEN_TYPE
+	TokenPrimary = 1
+	TokenImpersonation
+End Enum
+TypeDef PTOKEN_TYPE = *TOKEN_TYPE
+
+Const Enum TOKEN_ELEVATION_TYPE
+	TokenElevationTypeDefault = 1
+	TokenElevationTypeFull
+	TokenElevationTypeLimited
+End Enum
+TypeDef PTOKEN_ELEVATION_TYPE = TOKEN_ELEVATION_TYPE
+
+' Token Information Classes.
+Const Enum TOKEN_INFORMATION_CLASS
+	TokenUser = 1
+	TokenGroups
+	TokenPrivileges
+	TokenOwner
+	TokenPrimaryGroup
+	TokenDefaultDacl
+	TokenSource
+	TokenType
+	TokenImpersonationLevel
+	TokenStatistics
+	TokenRestrictedSids
+	TokenSessionId
+	TokenGroupsAndPrivileges
+	TokenSessionReference
+	TokenSandBoxInert
+	TokenAuditPolicy
+	TokenOrigin
+	TokenElevationType
+	TokenLinkedToken
+	TokenElevation
+	TokenHasRestrictions
+	TokenAccessInformation
+	TokenVirtualizationAllowed
+	TokenVirtualizationEnabled
+	TokenIntegrityLevel
+	TokenUIAccess
+	TokenMandatoryPolicy
+	TokenLogonSid
+	MaxTokenInfoClass
+End Enum
+TypeDef PTOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS
+
+Type TOKEN_USER
+	User As SID_AND_ATTRIBUTES
+End Type
+TypeDef PTOKEN_USER = *TOKEN_USER
+
+Type TOKEN_GROUPS
+	GroupCount As DWord
+	Groups[ELM(ANYSIZE_ARRAY)] As SID_AND_ATTRIBUTES
+End Type
+TypeDef PTOKEN_GROUPS = *TOKEN_GROUPS
+
+Type TOKEN_PRIVILEGES
+	PrivilegeCount As DWord
+	Privileges[ELM(ANYSIZE_ARRAY)] As LUID_AND_ATTRIBUTES
+End Type
+TypeDef PTOKEN_PRIVILEGES = *TOKEN_PRIVILEGES
+
+Type TOKEN_OWNER
+	Owner As PSID
+End Type
+TypeDef PTOKEN_OWNER = TOKEN_OWNER
+
+Type TOKEN_PRIMARY_GROUP
+	PrimaryGroup As PSID
+End Type
+TypeDef PTOKEN_PRIMARY_GROUP = TOKEN_PRIMARY_GROUP
+
+Type TOKEN_DEFAULT_DACL
+	DefaultDacl As PACL
+End Type
+TypeDef PTOKEN_DEFAULT_DACL = *TOKEN_DEFAULT_DACL
+
+Type TOKEN_GROUPS_AND_PRIVILEGES
+	SidCount As DWord
+	SidLength As DWord
+	Sids As PSID_AND_ATTRIBUTES
+	RestrictedSidCount As DWord
+	RestrictedSidLength As DWord
+	RestrictedSids As PSID_AND_ATTRIBUTES
+	PrivilegeCount As DWord
+	PrivilegeLength As DWord
+	Privileges As VoidPtr 'PLUID_AND_ATTRIBUTES
+	AuthenticationId As LUID
+End Type
+TypeDef PTOKEN_GROUPS_AND_PRIVILEGES = *TOKEN_GROUPS_AND_PRIVILEGES
+
+Type TOKEN_LINKED_TOKEN
+	LinkedToken As HANDLE
+End Type
+TypeDef PTOKEN_LINKED_TOKEN = *TOKEN_LINKED_TOKEN
+
+Type TOKEN_ELEVATION
+	TokenIsElevated As DWord
+End Type
+TypeDef PTOKEN_ELEVATION = *TOKEN_ELEVATION
+
+Type TOKEN_MANDATORY_LABEL
+	Label As SID_AND_ATTRIBUTES
+End Type
+TypeDef PTOKEN_MANDATORY_LABEL = *TOKEN_MANDATORY_LABEL
+
+Const TOKEN_MANDATORY_POLICY_OFF = &h0
+Const TOKEN_MANDATORY_POLICY_NO_WRITE_UP = &h1
+Const TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN = &h2
+
+Const TOKEN_MANDATORY_POLICY_VALID_MASK = (TOKEN_MANDATORY_POLICY_NO_WRITE_UP Or TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN)
+
+Type TOKEN_MANDATORY_POLICY
+	Policy As DWord
+End Type
+TypeDef PTOKEN_MANDATORY_POLICY = *TOKEN_MANDATORY_POLICY
+
+Type TOKEN_ACCESS_INFORMATION
+	SidHash As PSID_AND_ATTRIBUTES_HASH
+	RestrictedSidHash As PSID_AND_ATTRIBUTES_HASH
+	Privileges As PTOKEN_PRIVILEGES
+	AuthenticationId As LUID
+	TokenType As TOKEN_TYPE
+	ImpersonationLevel As SECURITY_IMPERSONATION_LEVEL
+	MandatoryPolicy As TOKEN_MANDATORY_POLICY
+	Flags As DWord
+End Type
+TypeDef PTOKEN_ACCESS_INFORMATION = *TOKEN_ACCESS_INFORMATION
+
+Const POLICY_AUDIT_SUBCATEGORY_COUNT = (50)
+
+Type TOKEN_AUDIT_POLICY
+	PerUserPolicy[ELM(((POLICY_AUDIT_SUBCATEGORY_COUNT) >> 1) + 1)] As Byte
+End Type
+TypeDef PTOKEN_AUDIT_POLICY = TOKEN_AUDIT_POLICY
+
+Const TOKEN_SOURCE_LENGTH = 8
+
+Type TOKEN_SOURCE
+	SourceName[ELM(TOKEN_SOURCE_LENGTH)] As CHAR
+	SourceIdentifier As LUID
+End Type
+TypeDef PTOKEN_SOURCE = *TOKEN_SOURCE
+
+Type TOKEN_STATISTICS
+	TokenId As LUID
+	AuthenticationId As LUID
+	ExpirationTime As LARGE_INTEGER
+	TokenType As TOKEN_TYPE
+	ImpersonationLevel As SECURITY_IMPERSONATION_LEVEL
+	DynamicCharged As DWord
+	DynamicAvailable As DWord
+	GroupCount As DWord
+	PrivilegeCount As DWord
+	ModifiedId As LUID
+End Type
+TypeDef PTOKEN_STATISTICS = *TOKEN_STATISTICS
+
+Type TOKEN_CONTROL
+	TokenId As LUID
+	AuthenticationId As LUID
+	ModifiedId As LUID
+	TokenSource As TOKEN_SOURCE
+End Type
+TypeDef PTOKEN_CONTROL = *TOKEN_CONTROL
+
+Type TOKEN_ORIGIN
+	OriginatingLogonSession As LUID
+End Type
+TypeDef PTOKEN_ORIGIN = *TOKEN_ORIGIN
+
+Const Enum MANDATORY_LEVEL
+	MandatoryLevelUntrusted = 0
+	MandatoryLevelLow
+	MandatoryLevelMedium
+	MandatoryLevelHigh
+	MandatoryLevelSystem
+	MandatoryLevelSecureProcess
+	MandatoryLevelCount
+End Enum
+TypeDef PMANDATORY_LEVEL = *MANDATORY_LEVEL
+
+Const SECURITY_DYNAMIC_TRACKING = (TRUE)
+Const SECURITY_STATIC_TRACKING = (FALSE)
+
+TypeDef SECURITY_CONTEXT_TRACKING_MODE = BOOLEAN
+TypeDef PSECURITY_CONTEXT_TRACKING_MODE = *BOOLEAN
+
+Type SECURITY_QUALITY_OF_SERVICE
+	Length As DWord
+	ImpersonationLevel As SECURITY_IMPERSONATION_LEVEL
+	ContextTrackingMode As SECURITY_CONTEXT_TRACKING_MODE
+	EffectiveOnly As BOOLEAN
+End Type
+TypeDef PSECURITY_QUALITY_OF_SERVICE = *SECURITY_QUALITY_OF_SERVICE
+
+Type SE_IMPERSONATION_STATE
+	Token As PACCESS_TOKEN
+	CopyOnOpen As BOOLEAN
+	EffectiveOnly As BOOLEAN
+	Level As SECURITY_IMPERSONATION_LEVEL
+End Type
+TypeDef PSE_IMPERSONATION_STATE = *SE_IMPERSONATION_STATE
+
+Const DISABLE_MAX_PRIVILEGE = &h1
+Const SANDBOX_INERT = &h2
+Const LUA_TOKEN = &h4
+Const WRITE_RESTRICTED = &h8
+
+TypeDef SECURITY_INFORMATION = DWord
+TypeDef PSECURITY_INFORMATION = *DWord
+
+Const OWNER_SECURITY_INFORMATION = (&h00000001)
+Const GROUP_SECURITY_INFORMATION = (&h00000002)
+Const DACL_SECURITY_INFORMATION = (&h00000004)
+Const SACL_SECURITY_INFORMATION = (&h00000008)
+Const LABEL_SECURITY_INFORMATION = (&h00000010)
+
+Const PROTECTED_DACL_SECURITY_INFORMATION = (&h80000000)
+Const PROTECTED_SACL_SECURITY_INFORMATION = (&h40000000)
+Const UNPROTECTED_DACL_SECURITY_INFORMATION = (&h20000000)
+Const UNPROTECTED_SACL_SECURITY_INFORMATION = (&h10000000)
+
+Const PROCESS_TERMINATE = (&h0001)
+Const PROCESS_CREATE_THREAD = (&h0002)
+Const PROCESS_SET_SESSIONID = (&h0004)
+Const PROCESS_VM_OPERATION = (&h0008)
+Const PROCESS_VM_READ = (&h0010)
+Const PROCESS_VM_WRITE = (&h0020)
+Const PROCESS_DUP_HANDLE = (&h0040)
+Const PROCESS_CREATE_PROCESS = (&h0080)
+Const PROCESS_SET_QUOTA = (&h0100)
+Const PROCESS_SET_INFORMATION = (&h0200)
+Const PROCESS_QUERY_INFORMATION = (&h0400)
+Const PROCESS_SUSPEND_RESUME = (&h0800)
+Const PROCESS_QUERY_LIMITED_INFORMATION = (&h1000)
+'#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+'Const PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &hFFFF)
+'#else
+Const PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &hFFF)
+'#endif
+
+#ifdef _WIN64
+Const MAXIMUM_PROCESSORS = 64
+#else
+Const MAXIMUM_PROCESSORS = 32
+#endif
+
+Const THREAD_TERMINATE = (&h0001)
+Const THREAD_SUSPEND_RESUME = (&h0002)
+Const THREAD_GET_CONTEXT = (&h0008)
+Const THREAD_SET_CONTEXT = (&h0010)
+Const THREAD_QUERY_INFORMATION = (&h0040)
+Const THREAD_SET_INFORMATION = (&h0020)
+Const THREAD_SET_THREAD_TOKEN = (&h0080)
+Const THREAD_IMPERSONATE = (&h0100)
+Const THREAD_DIRECT_IMPERSONATION = (&h0200)
+Const THREAD_SET_LIMITED_INFORMATION = (&h0400)
+Const THREAD_QUERY_LIMITED_INFORMATION = (&h0800)
+'#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+'Const THREAD_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &hFFFF)
+'#else
+Const THREAD_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h3FF)
+'#endif
+Const JOB_OBJECT_ASSIGN_PROCESS = (&h0001)
+Const JOB_OBJECT_SET_ATTRIBUTES = (&h0002)
+Const JOB_OBJECT_QUERY = (&h0004)
+Const JOB_OBJECT_TERMINATE = (&h0008)
+Const JOB_OBJECT_SET_SECURITY_ATTRIBUTES = (&h0010)
+Const JOB_OBJECT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h1F)
+
+Type JOB_SET_ARRAY
+	JobHandle As HANDLE
+	MemberLevel As DWord
+	Flags As DWord
+End Type
+TypeDef PJOB_SET_ARRAY = *JOB_SET_ARRAY
+
+Const FLS_MAXIMUM_AVAILABLE = 128
+Const TLS_MINIMUM_AVAILABLE = 64
+
+Type NT_TIB
+	ExceptionList As VoidPtr '*EXCEPTION_REGISTRATION_RECORD
+	StackBase As PVOID
+	StackLimit As PVOID
+	SubSystemTib As PVOID
+'	Union
+		FiberData As PVOID
+'		Version As DWord
+'	End Union
+	PVOID ArbitraryUserPointer As PVOID
+	Self As *NT_TIB
+End Type
+TypeDef PNT_TIB = *NT_TIB
+
+Type NT_TIB32
+	ExceptionList As DWord
+	StackBase As DWord
+	StackLimit As DWord
+	SubSystemTib As DWord
+'	Union
+		FiberData As DWord
+'		Version As DWord
+'	End Union
+	ArbitraryUserPointer As DWord
+	Self As DWord
+End Type
+TypeDef PNT_TIB32 = *NT_TIB32
+
+Type NT_TIB64
+	ExceptionList As QWord
+	StackBase As QWord
+	StackLimit As QWord
+	SubSystemTib As QWord
+'	Union
+		FiberData As QWord
+'		Version As QWord
+'	End Union
+	ArbitraryUserPointer As QWord
+	Self As QWord
+End Type
+TypeDef PNT_TIB64 = *NT_TIB64
+
+Const THREAD_BASE_PRIORITY_LOWRT = 15
+Const THREAD_BASE_PRIORITY_MAX = 2
+Const THREAD_BASE_PRIORITY_MIN = (-2)
+Const THREAD_BASE_PRIORITY_IDLE = (-15)
+
+Type QUOTA_LIMITS
+	PagedPoolLimit As SIZE_T
+	NonPagedPoolLimit As SIZE_T
+	MinimumWorkingSetSize As SIZE_T
+	MaximumWorkingSetSize As SIZE_T
+	PagefileLimit As SIZE_T
+	TimeLimit As LARGE_INTEGER
+End Type
+TypeDef PQUOTA_LIMITS = *QUOTA_LIMITS
+
+Const QUOTA_LIMITS_HARDWS_MIN_ENABLE = &h00000001
+Const QUOTA_LIMITS_HARDWS_MIN_DISABLE = &h00000002
+Const QUOTA_LIMITS_HARDWS_MAX_ENABLE = &h00000004
+Const QUOTA_LIMITS_HARDWS_MAX_DISABLE = &h00000008
+Const QUOTA_LIMITS_USE_DEFAULT_LIMITS = &h00000010
+
+Const PS_RATE_PHASE_BITS = 4
+Const PS_RATE_PHASE_MASK = ((1 As DWord << PS_RATE_PHASE_BITS) - 1)
+
+Const Enum PS_RATE_PHASE
+	PsRateOneSecond = 0
+	PsRateTwoSecond
+	PsRateThreeSecond
+	PsRateMaxPhase
+End Enum
+
+Type RATE_QUOTA_LIMIT
+	RateData As DWord
+	dummy As DWord
+'	Type
+'		DWORD RatePhase     : PS_RATE_PHASE_BITS;
+'		DWORD RatePercent   : 28;
+'	End Type
+End Type
+TypeDef PRATE_QUOTA_LIMIT = *RATE_QUOTA_LIMIT
+
+'#if !defined(SORTPP_PASS) && !defined(MIDL_PASS) && !defined(RC_INVOKED) && defined(_WIN64) && !defined(_X86AMD64_)
+'C_ASSERT (sizeof (DWORD) * 8 - PS_RATE_PHASE_BITS == 28);
+'#endif
+
+Type QUOTA_LIMITS_EX
+	PagedPoolLimit As SIZE_T
+	NonPagedPoolLimit As SIZE_T
+	MinimumWorkingSetSize As SIZE_T
+	MaximumWorkingSetSize As SIZE_T
+	PagefileLimit As SIZE_T
+	TimeLimit As LARGE_INTEGER
+	WorkingSetLimit As SIZE_T
+	Reserved2 As SIZE_T
+	Reserved3 As SIZE_T
+	Reserved4 As SIZE_T
+	Flags As DWord
+	CpuRateLimit As RATE_QUOTA_LIMIT
+End Type
+TypeDef PQUOTA_LIMITS_EX = *QUOTA_LIMITS_EX
+
+Type IO_COUNTERS
+	ReadOperationCount As QWord
+	WriteOperationCount As QWord
+	OtherOperationCount As QWord
+	ReadTransferCount As QWord
+	WriteTransferCount As QWord
+	OtherTransferCount As QWord
+End Type
+TypeDef PIO_COUNTERS = IO_COUNTERS
+
+Type JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
+	TotalUserTime As LARGE_INTEGER
+	TotalKernelTime As LARGE_INTEGER
+	ThisPeriodTotalUserTime As LARGE_INTEGER
+	ThisPeriodTotalKernelTime As LARGE_INTEGER
+	TotalPageFaultCount As DWord
+	TotalProcesses As DWord
+	ActiveProcesses As DWord
+	TotalTerminatedProcesses As DWord
+End Type
+TypeDef PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION = *JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
+
+Type JOBOBJECT_BASIC_LIMIT_INFORMATION
+	PerProcessUserTimeLimit As LARGE_INTEGER
+	PerJobUserTimeLimit As LARGE_INTEGER
+	LimitFlags As DWord
+	MinimumWorkingSetSize As SIZE_T
+	MaximumWorkingSetSize As SIZE_T
+	ActiveProcessLimit As DWord
+	Affinity As ULONG_PTR
+	PriorityClass As DWord
+	SchedulingClass As DWord
+End Type
+TypeDef PJOBOBJECT_BASIC_LIMIT_INFORMATION = *JOBOBJECT_BASIC_LIMIT_INFORMATION
+
+Type JOBOBJECT_EXTENDED_LIMIT_INFORMATION
+	BasicLimitInformation As JOBOBJECT_BASIC_LIMIT_INFORMATION
+	IoInfo As IO_COUNTERS
+	ProcessMemoryLimit As SIZE_T
+	JobMemoryLimitt As SIZE_T
+	PeakProcessMemoryUsedt As SIZE_T
+	PeakJobMemoryUsedt As SIZE_T
+End Type
+TypeDef PJOBOBJECT_EXTENDED_LIMIT_INFORMATION = *JOBOBJECT_EXTENDED_LIMIT_INFORMATION
+
+Type JOBOBJECT_BASIC_PROCESS_ID_LIST
+	NumberOfAssignedProcesses As DWord
+	NumberOfProcessIdsInList As DWord
+	ProcessIdList[1] As ULONG_PTR
+End Type
+TypeDef PJOBOBJECT_BASIC_PROCESS_ID_LIST = *JOBOBJECT_BASIC_PROCESS_ID_LIST
+
+Type JOBOBJECT_BASIC_UI_RESTRICTIONS
+	UIRestrictionsClass As DWord
+End Type
+TypeDef PJOBOBJECT_BASIC_UI_RESTRICTIONS = *JOBOBJECT_BASIC_UI_RESTRICTIONS
+
+Type JOBOBJECT_SECURITY_LIMIT_INFORMATION
+	SecurityLimitFlags As DWord
+	JobToken As HANDLE
+	SidsToDisable As PTOKEN_GROUPS
+	PrivilegesToDelete As PTOKEN_PRIVILEGES
+	RestrictedSids As PTOKEN_GROUPS
+End Type
+TypeDef PJOBOBJECT_SECURITY_LIMIT_INFORMATION = *JOBOBJECT_SECURITY_LIMIT_INFORMATION
+
+Type JOBOBJECT_END_OF_JOB_TIME_INFORMATION
+	EndOfJobTimeAction As DWord
+End Type
+TypeDef PJOBOBJECT_END_OF_JOB_TIME_INFORMATION = *JOBOBJECT_END_OF_JOB_TIME_INFORMATION
+
+Type JOBOBJECT_ASSOCIATE_COMPLETION_PORT
+	CompletionKey As PVOID
+	CompletionPort As HANDLE
+End Type
+TypeDef PJOBOBJECT_ASSOCIATE_COMPLETION_PORT = *JOBOBJECT_ASSOCIATE_COMPLETION_PORT
+
+Type JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
+	BasicInfo As JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
+	IoInfo As IO_COUNTERS
+End Type
+TypeDef PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION = *JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
+
+Type JOBOBJECT_JOBSET_INFORMATION
+	MemberLevel As DWord
+End Type
+TypeDef PJOBOBJECT_JOBSET_INFORMATION = *JOBOBJECT_JOBSET_INFORMATION
+
+Const JOB_OBJECT_TERMINATE_AT_END_OF_JOB = 0
+Const JOB_OBJECT_POST_AT_END_OF_JOB = 1
+
+' Completion Port Messages for job objects
+Const JOB_OBJECT_MSG_END_OF_JOB_TIME = 1
+Const JOB_OBJECT_MSG_END_OF_PROCESS_TIME = 2
+Const JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT = 3
+Const JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO = 4
+Const JOB_OBJECT_MSG_NEW_PROCESS = 6
+Const JOB_OBJECT_MSG_EXIT_PROCESS = 7
+Const JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS = 8
+Const JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT = 9
+Const JOB_OBJECT_MSG_JOB_MEMORY_LIMIT = 10
+
+' Basic Limits
+Const JOB_OBJECT_LIMIT_WORKINGSET = &h00000001
+Const JOB_OBJECT_LIMIT_PROCESS_TIME = &h00000002
+Const JOB_OBJECT_LIMIT_JOB_TIME = &h00000004
+Const JOB_OBJECT_LIMIT_ACTIVE_PROCESS = &h00000008
+Const JOB_OBJECT_LIMIT_AFFINITY = &h00000010
+Const JOB_OBJECT_LIMIT_PRIORITY_CLASS = &h00000020
+Const JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = &h00000040
+Const JOB_OBJECT_LIMIT_SCHEDULING_CLASS = &h00000080
+
+' Extended Limits
+Const JOB_OBJECT_LIMIT_PROCESS_MEMORY = &h00000100
+Const JOB_OBJECT_LIMIT_JOB_MEMORY = &h00000200
+Const JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = &h00000400
+Const JOB_OBJECT_LIMIT_BREAKAWAY_OK = &h00000800
+Const JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = &h00001000
+Const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = &h00002000
+
+Const JOB_OBJECT_LIMIT_RESERVED2 = &h00004000
+Const JOB_OBJECT_LIMIT_RESERVED3 = &h00008000
+Const JOB_OBJECT_LIMIT_RESERVED4 = &h00010000
+Const JOB_OBJECT_LIMIT_RESERVED5 = &h00020000
+Const JOB_OBJECT_LIMIT_RESERVED6 = &h00040000
+
+
+Const JOB_OBJECT_LIMIT_VALID_FLAGS = &h0007ffff
+
+Const JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS = &h000000ff
+Const JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS = &h00003fff
+Const JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS = &h0007ffff
+
+' UI restrictions for jobs
+Const JOB_OBJECT_UILIMIT_NONE = &h00000000
+
+Const JOB_OBJECT_UILIMIT_HANDLES = &h00000001
+Const JOB_OBJECT_UILIMIT_READCLIPBOARD = &h00000002
+Const JOB_OBJECT_UILIMIT_WRITECLIPBOARD = &h00000004
+Const JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = &h00000008
+Const JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = &h00000010
+Const JOB_OBJECT_UILIMIT_GLOBALATOMS = &h00000020
+Const JOB_OBJECT_UILIMIT_DESKTOP = &h00000040
+Const JOB_OBJECT_UILIMIT_EXITWINDOWS = &h00000080
+
+Const JOB_OBJECT_UILIMIT_ALL = &h000000FF
+
+Const JOB_OBJECT_UI_VALID_FLAGS = &h000000FF
+
+Const JOB_OBJECT_SECURITY_NO_ADMIN = &h00000001
+Const JOB_OBJECT_SECURITY_RESTRICTED_TOKEN = &h00000002
+Const JOB_OBJECT_SECURITY_ONLY_TOKEN = &h00000004
+Const JOB_OBJECT_SECURITY_FILTER_TOKENS = &h00000008
+
+Const JOB_OBJECT_SECURITY_VALID_FLAGS = &h0000000f
+
+Enum JOBOBJECTINFOCLASS
+	JobObjectBasicAccountingInformation = 1
+	JobObjectBasicLimitInformation
+	JobObjectBasicProcessIdList
+	JobObjectBasicUIRestrictions
+	JobObjectSecurityLimitInformation
+	JobObjectEndOfJobTimeInformation
+	JobObjectAssociateCompletionPortInformation
+	JobObjectBasicAndIoAccountingInformation
+	JobObjectExtendedLimitInformation
+	JobObjectJobSetInformation
+	MaxJobObjectInfoClass
+End Enum
+
+Const EVENT_MODIFY_STATE = &h0002
+Const EVENT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h3)
+Const MUTANT_QUERY_STATE = &h0001
+
+Const MUTANT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or MUTANT_QUERY_STATE)
+Const SEMAPHORE_MODIFY_STATE = &h0002
+Const SEMAPHORE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h3)
+
+' Timer Specific Access Rights.
+Const TIMER_QUERY_STATE = &h0001
+Const TIMER_MODIFY_STATE = &h0002
+
+Const TIMER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or TIMER_QUERY_STATE Or TIMER_MODIFY_STATE)
+
+Const TIME_ZONE_ID_UNKNOWN = 0
+Const TIME_ZONE_ID_STANDARD = 1
+Const TIME_ZONE_ID_DAYLIGHT = 2
+
+Enum LOGICAL_PROCESSOR_RELATIONSHIP
+	RelationProcessorCore
+	RelationNumaNode
+	RelationCache
+	RelationProcessorPackage
+End Enum
+
+Const LTP_PC_SMT = 1
+
+Enum PROCESSOR_CACHE_TYPE
+	CacheUnified
+	CacheInstruction
+	CacheData
+	CacheTrace
+End Enum
+
+Const CACHE_FULLY_ASSOCIATIVE = &hFF
+
+Type CACHE_DESCRIPTOR
+	Level As Byte
+	Associativity As Byte
+	LineSize As Word
+	Size As DWord
+	Type_ As PROCESSOR_CACHE_TYPE
+End Type
+TypeDef PCACHE_DESCRIPTOR = *CACHE_DESCRIPTOR
+
+Type SYSTEM_LOGICAL_PROCESSOR_INFORMATION
+	ProcessorMask As ULONG_PTR
+	Relationship As LOGICAL_PROCESSOR_RELATIONSHIP
+'	Union
+'		struct {
+'			Flags As Byte
+'		} ProcessorCore;
+'		struct {
+'			NodeNumber As DWord
+'		} NumaNode;
+		Cache As CACHE_DESCRIPTOR
+'		Reserved[ELM(2)] As ULONGLONG
+'	End Union
+End Type
+TypeDef PSYSTEM_LOGICAL_PROCESSOR_INFORMATION = *SYSTEM_LOGICAL_PROCESSOR_INFORMATION
+
+Const PROCESSOR_INTEL_386 = 386
+Const PROCESSOR_INTEL_486 = 486
+Const PROCESSOR_INTEL_PENTIUM = 586
+Const PROCESSOR_INTEL_IA64 = 2200
+Const PROCESSOR_AMD_X8664 = 8664
+Const PROCESSOR_MIPS_R4000 = 4000    ' incl R4101 & R3910 for Windows CE
+Const PROCESSOR_ALPHA_21064 = 21064
+Const PROCESSOR_PPC_601 = 601
+Const PROCESSOR_PPC_603 = 603
+Const PROCESSOR_PPC_604 = 604
+Const PROCESSOR_PPC_620 = 620
+Const PROCESSOR_HITACHI_SH3 = 10003   ' Windows CE
+Const PROCESSOR_HITACHI_SH3E = 10004  ' Windows CE
+Const PROCESSOR_HITACHI_SH4 = 10005   ' Windows CE
+Const PROCESSOR_MOTOROLA_821 = 821    ' Windows CE
+Const PROCESSOR_SHx_SH3 = 103         ' Windows CE
+Const PROCESSOR_SHx_SH4 = 104         ' Windows CE
+Const PROCESSOR_STRONGARM = 2577      ' Windows CE - 0xA11
+Const PROCESSOR_ARM720 = 1824         ' Windows CE - 0x720
+Const PROCESSOR_ARM820 = 2080         ' Windows CE - 0x820
+Const PROCESSOR_ARM920 = 2336         ' Windows CE - 0x920
+Const PROCESSOR_ARM_7TDMI = 70001     ' Windows CE
+Const PROCESSOR_OPTIL = &h494f        ' MSIL
+
+Const PROCESSOR_ARCHITECTURE_INTEL = 0
+Const PROCESSOR_ARCHITECTURE_MIPS = 1
+Const PROCESSOR_ARCHITECTURE_ALPHA = 2
+Const PROCESSOR_ARCHITECTURE_PPC = 3
+Const PROCESSOR_ARCHITECTURE_SHX = 4
+Const PROCESSOR_ARCHITECTURE_ARM = 5
+Const PROCESSOR_ARCHITECTURE_IA64 = 6
+Const PROCESSOR_ARCHITECTURE_ALPHA64 = 7
+Const PROCESSOR_ARCHITECTURE_MSIL = 8
+Const PROCESSOR_ARCHITECTURE_AMD64 = 9
+Const PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 = 10
+
+Const PROCESSOR_ARCHITECTURE_UNKNOWN = &hFFFF
+
+Const PF_FLOATING_POINT_PRECISION_ERRATA = 0
+Const PF_FLOATING_POINT_EMULATED = 1
+Const PF_COMPARE_EXCHANGE_DOUBLE = 2
+Const PF_MMX_INSTRUCTIONS_AVAILABLE = 3
+Const PF_PPC_MOVEMEM_64BIT_OK = 4
+Const PF_ALPHA_BYTE_INSTRUCTIONS = 5
+Const PF_XMMI_INSTRUCTIONS_AVAILABLE = 6
+Const PF_3DNOW_INSTRUCTIONS_AVAILABLE = 7
+Const PF_RDTSC_INSTRUCTION_AVAILABLE = 8
+Const PF_PAE_ENABLED = 9
+Const PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10
+Const PF_SSE_DAZ_MODE_AVAILABLE = 11
+Const PF_NX_ENABLED = 12
+Const PF_SSE3_INSTRUCTIONS_AVAILABLE = 13
+Const PF_COMPARE_EXCHANGE128 = 14
+Const PF_COMPARE64_EXCHANGE128 = 15
+Const PF_CHANNELS_ENABLED = 16
+
+Type MEMORY_BASIC_INFORMATION
+	BaseAddress As VoidPtr
+	AllocationBase As VoidPtr
+	AllocationProtect As DWord
+	RegionSize As SIZE_T
+	State As DWord
+	Protect As DWord
+	MBIType As DWord
+End Type
+TypeDef PMEMORY_BASIC_INFORMATION = *MEMORY_BASIC_INFORMATION
+
+Type MEMORY_BASIC_INFORMATION32
+	BaseAddress As DWord
+	AllocationBase As DWord
+	AllocationProtect As DWord
+	RegionSize As DWord
+	State As DWord
+	Protect As DWord
+	Type_ As DWord
+End Type
+TypeDef PMEMORY_BASIC_INFORMATION32 = *MEMORY_BASIC_INFORMATION32
+
+Type Align(16) MEMORY_BASIC_INFORMATION64
+	BaseAddress As QWord
+	AllocationBase As QWord
+	AllocationProtect As DWord
+	__alignment1 As DWord
+	RegionSize As QWord
+	State As DWord
+	Protect As DWord
+	Type_ As DWord
+	__alignment2 As DWord
+End Type
+TypeDef PMEMORY_BASIC_INFORMATION64 = *MEMORY_BASIC_INFORMATION64
+
+Const SECTION_QUERY = &h0001
+Const SECTION_MAP_WRITE = &h0002
+Const SECTION_MAP_READ = &h0004
+Const SECTION_MAP_EXECUTE = &h0008
+Const SECTION_EXTEND_SIZE = &h0010
+Const SECTION_MAP_EXECUTE_EXPLICIT = &h0020
+
+Const SECTION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SECTION_QUERY Or SECTION_MAP_WRITE Or SECTION_MAP_READ Or SECTION_MAP_EXECUTE Or SECTION_EXTEND_SIZE)
+
+Const SESSION_QUERY_ACCESS = &h0001
+Const SESSION_MODIFY_ACCESS = &h0002
+
+Const SESSION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SESSION_QUERY_ACCESS Or SESSION_MODIFY_ACCESS)
+
+Const PAGE_NOACCESS = &h01
+Const PAGE_READONLY = &h02
+Const PAGE_READWRITE = &h04
+Const PAGE_WRITECOPY = &h08
+Const PAGE_EXECUTE = &h10
+Const PAGE_EXECUTE_READ = &h20
+Const PAGE_EXECUTE_READWRITE = &h40
+Const PAGE_EXECUTE_WRITECOPY = &h80
+Const PAGE_GUARD = &h100
+Const PAGE_NOCACHE = &h200
+Const PAGE_WRITECOMBINE = &h400
+Const MEM_COMMIT = &h1000
+Const MEM_RESERVE = &h2000
+Const MEM_DECOMMIT = &h4000
+Const MEM_RELEASE = &h8000
+Const MEM_FREE = &h10000
+Const MEM_PRIVATE = &h20000
+Const MEM_MAPPED = &h40000
+Const MEM_RESET = &h80000
+Const MEM_TOP_DOWN = &h100000
+Const MEM_WRITE_WATCH = &h200000
+Const MEM_PHYSICAL = &h400000
+Const MEM_ROTATE = &h800000
+Const MEM_LARGE_PAGES = &h20000000
+Const MEM_4MB_PAGES = &h80000000
+Const SEC_FILE = &h800000
+Const SEC_IMAGE = &h1000000
+Const SEC_PROTECTED_IMAGE = &h2000000
+Const SEC_RESERVE = &h4000000
+Const SEC_COMMIT = &h8000000
+Const SEC_NOCACHE = &h10000000
+Const SEC_WRITECOMBINE = &h40000000
+Const SEC_LARGE_PAGES = &h80000000
+Const MEM_IMAGE = SEC_IMAGE
+Const WRITE_WATCH_FLAG_RESET = &h01
+
+' Define access rights to files and directories
+Const FILE_READ_DATA = &h0001                 ' file & pipe
+Const FILE_LIST_DIRECTORY = &h0001            ' directory
+
+Const FILE_WRITE_DATA = &h0002                ' file & pipe
+Const FILE_ADD_FILE = &h0002                  ' directory
+
+Const FILE_APPEND_DATA = &h0004               ' file
+Const FILE_ADD_SUBDIRECTORY = &h0004          ' directory
+Const FILE_CREATE_PIPE_INSTANCE = &h0004      ' named pipe
+
+
+Const FILE_READ_EA = &h0008                   ' file & directory
+
+Const FILE_WRITE_EA = &h0010                  ' file & directory
+
+Const FILE_EXECUTE = &h0020                   ' file
+Const FILE_TRAVERSE = &h0020                  ' directory
+
+Const FILE_DELETE_CHILD = &h0040              ' directory
+
+Const FILE_READ_ATTRIBUTES = &h0080           ' all
+
+Const FILE_WRITE_ATTRIBUTES = &h0100          ' all
+
+Const FILE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h1FF)
+Const FILE_GENERIC_READ = (STANDARD_RIGHTS_READ Or FILE_READ_DATA Or FILE_READ_ATTRIBUTES Or FILE_READ_EA Or SYNCHRONIZE)
+Const FILE_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or FILE_WRITE_DATA Or FILE_WRITE_ATTRIBUTES Or FILE_WRITE_EA Or FILE_APPEND_DATA Or SYNCHRONIZE)
+Const FILE_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or FILE_READ_ATTRIBUTES Or FILE_EXECUTE Or SYNCHRONIZE)
+
+Const FILE_SHARE_READ = &h00000001
+Const FILE_SHARE_WRITE = &h00000002
+Const FILE_SHARE_DELETE = &h00000004
+Const FILE_ATTRIBUTE_READONLY = &h00000001
+Const FILE_ATTRIBUTE_HIDDEN = &h00000002
+Const FILE_ATTRIBUTE_SYSTEM = &h00000004
+Const FILE_ATTRIBUTE_DIRECTORY = &h00000010
+Const FILE_ATTRIBUTE_ARCHIVE = &h00000020
+Const FILE_ATTRIBUTE_DEVICE = &h00000040
+Const FILE_ATTRIBUTE_NORMAL = &h00000080
+Const FILE_ATTRIBUTE_TEMPORARY = &h00000100
+Const FILE_ATTRIBUTE_SPARSE_FILE = &h00000200
+Const FILE_ATTRIBUTE_REPARSE_POINT = &h00000400
+Const FILE_ATTRIBUTE_COMPRESSED = &h00000800
+Const FILE_ATTRIBUTE_OFFLINE = &h00001000
+Const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = &h00002000
+Const FILE_ATTRIBUTE_ENCRYPTED = &h00004000
+Const FILE_ATTRIBUTE_VIRTUAL = &h00010000
+Const FILE_NOTIFY_CHANGE_FILE_NAME = &h00000001
+Const FILE_NOTIFY_CHANGE_DIR_NAME = &h00000002
+Const FILE_NOTIFY_CHANGE_ATTRIBUTES = &h00000004
+Const FILE_NOTIFY_CHANGE_SIZE = &h00000008
+Const FILE_NOTIFY_CHANGE_LAST_WRITE = &h00000010
+Const FILE_NOTIFY_CHANGE_LAST_ACCESS = &h00000020
+Const FILE_NOTIFY_CHANGE_CREATION = &h00000040
+Const FILE_NOTIFY_CHANGE_SECURITY = &h00000100
+Const FILE_ACTION_ADDED = &h00000001
+Const FILE_ACTION_REMOVED = &h00000002
+Const FILE_ACTION_MODIFIED = &h00000003
+Const FILE_ACTION_RENAMED_OLD_NAME = &h00000004
+Const FILE_ACTION_RENAMED_NEW_NAME = &h00000005
+Const MAILSLOT_NO_MESSAGE = (-1 As DWord)
+Const MAILSLOT_WAIT_FOREVER = (-1 As DWord)
+Const FILE_CASE_SENSITIVE_SEARCH = &h00000001
+Const FILE_CASE_PRESERVED_NAMES = &h00000002
+Const FILE_UNICODE_ON_DISK = &h00000004
+Const FILE_PERSISTENT_ACLS = &h00000008
+Const FILE_FILE_COMPRESSION = &h00000010
+Const FILE_VOLUME_QUOTAS = &h00000020
+Const FILE_SUPPORTS_SPARSE_FILES = &h00000040
+Const FILE_SUPPORTS_REPARSE_POINTS = &h00000080
+Const FILE_SUPPORTS_REMOTE_STORAGE = &h00000100
+Const FILE_VOLUME_IS_COMPRESSED = &h00008000
+Const FILE_SUPPORTS_OBJECT_IDS = &h00010000
+Const FILE_SUPPORTS_ENCRYPTION = &h00020000
+Const FILE_NAMED_STREAMS = &h00040000
+Const FILE_READ_ONLY_VOLUME = &h00080000
+Const FILE_SEQUENTIAL_WRITE_ONCE = &h00100000
+Const FILE_SUPPORTS_TRANSACTIONS = &h00200000
+
+Type FILE_NOTIFY_INFORMATION
+	NextEntryOffset As DWord
+	Action As DWord
+	FileNameLength As DWord
+	FileName[ELM(1)] As WCHAR
+End Type
+TypeDef PFILE_NOTIFY_INFORMATION = *FILE_NOTIFY_INFORMATION
+
+Type /*Union*/ FILE_SEGMENT_ELEMENT
+	Buffer As PVOID64
+'	Alignment As QWord
+End Type 'Union
+TypeDef PFILE_SEGMENT_ELEMENT = *FILE_SEGMENT_ELEMENT
+
+Type REPARSE_GUID_DATA_BUFFER
+	ReparseTag As DWord
+	ReparseDataLength As Word
+	Reserved As Word
+	ReparseGuid As GUID
+'	struct {
+		DataBuffer[ELM(1)] As Byte
+'	} GenericReparseBuffer;
+End Type
+TypeDef PREPARSE_GUID_DATA_BUFFER = *REPARSE_GUID_DATA_BUFFER
+
+'Const REPARSE_GUID_DATA_BUFFER_HEADER_SIZE = FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
+
+' Maximum allowed size of the reparse data.
+Const MAXIMUM_REPARSE_DATA_BUFFER_SIZE = (16 * 1024)
+
+' Predefined reparse tags.
+Const IO_REPARSE_TAG_RESERVED_ZERO = 0
+Const IO_REPARSE_TAG_RESERVED_ONE = 1
+
+Const IO_REPARSE_TAG_RESERVED_RANGE = IO_REPARSE_TAG_RESERVED_ONE
+
+
+Const IsReparseTagMicrosoft(_tag) = ((_tag) And &h80000000)
+Const IsReparseTagNameSurrogate(_tag) = ((_tag) And &h0000000)
+
+Const IO_REPARSE_TAG_MOUNT_POINT = &hA0000003
+Const IO_REPARSE_TAG_HSM = &hC0000004
+Const IO_REPARSE_TAG_SIS = &h80000007
+Const IO_REPARSE_TAG_DFS = &h8000000A
+Const IO_REPARSE_TAG_SYMLINK = &hA000000C
+Const IO_REPARSE_TAG_DFSR = &h80000012
+
+Const IO_COMPLETION_MODIFY_STATE = &h0002
+Const IO_COMPLETION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &h3)
+
+Const DUPLICATE_CLOSE_SOURCE = &h00000001
+Const DUPLICATE_SAME_ACCESS = &h00000002
+/*
+' Define GUIDs which represent well-known power schemes
+
+DEFINE_GUID( GUID_MAX_POWER_SAVINGS, 0xA1841308, 0x3541, 0x4FAB, 0xBC, 0x81, 0xF7, 0x15, 0x56, 0xF2, 0x0B, 0x4A );
+DEFINE_GUID( GUID_MIN_POWER_SAVINGS, 0x8C5E7FDA, 0xE8BF, 0x4A96, 0x9A, 0x85, 0xA6, 0xE2, 0x3A, 0x8C, 0x63, 0x5C );
+DEFINE_GUID( GUID_TYPICAL_POWER_SAVINGS, 0x381B4222, 0xF694, 0x41F0, 0x96, 0x85, 0xFF, 0x5B, 0xB2, 0x60, 0xDF, 0x2E );
+DEFINE_GUID( NO_SUBGROUP_GUID, 0xFEA3413E, 0x7E05, 0x4911, 0x9A, 0x71, 0x70, 0x03, 0x31, 0xF1, 0xC2, 0x94 );
+DEFINE_GUID( ALL_POWERSCHEMES_GUID, 0x68A1E95E, 0x13EA, 0x41E1, 0x80, 0x11, 0x0C, 0x49, 0x6C, 0xA4, 0x90, 0xB0 );
+DEFINE_GUID( GUID_POWERSCHEME_PERSONALITY, 0x245D8541, 0x3943, 0x4422, 0xB0, 0x25, 0x13, 0xA7, 0x84, 0xF6, 0x79, 0xB7 );
+DEFINE_GUID( GUID_ACTIVE_POWERSCHEME, 0x31F9F286, 0x5084, 0x42FE, 0xB7, 0x20, 0x2B, 0x02, 0x64, 0x99, 0x37, 0x63 );
+
+' Define GUIDs which represent well-known power settings
+
+' Video settings
+
+DEFINE_GUID( GUID_VIDEO_SUBGROUP, 0x7516B95F, 0xF776, 0x4464, 0x8C, 0x53, 0x06, 0x16, 0x7F, 0x40, 0xCC, 0x99 );
+DEFINE_GUID( GUID_VIDEO_POWERDOWN_TIMEOUT, 0x3C0BC021, 0xC8A8, 0x4E07, 0xA9, 0x73, 0x6B, 0x14, 0xCB, 0xCB, 0x2B, 0x7E );
+DEFINE_GUID( GUID_VIDEO_ADAPTIVE_POWERDOWN, 0x90959D22, 0xD6A1, 0x49B9, 0xAF, 0x93, 0xBC, 0xE8, 0x85, 0xAD, 0x33, 0x5B );
+DEFINE_GUID( GUID_MONITOR_POWER_ON, 0x02731015, 0x4510, 0x4526, 0x99, 0xE6, 0xE5, 0xA1, 0x7E, 0xBD, 0x1A, 0xEA );
+
+' Harddisk settings
+DEFINE_GUID( GUID_DISK_SUBGROUP, 0x0012EE47, 0x9041, 0x4B5D, 0x9B, 0x77, 0x53, 0x5F, 0xBA, 0x8B, 0x14, 0x42 );
+DEFINE_GUID( GUID_DISK_POWERDOWN_TIMEOUT, 0x6738E2C4, 0xE8A5, 0x4A42, 0xB1, 0x6A, 0xE0, 0x40, 0xE7, 0x69, 0x75, 0x6E );
+DEFINE_GUID( GUID_DISK_ADAPTIVE_POWERDOWN, 0x396A32E1, 0x499A, 0x40B2, 0x91, 0x24, 0xA9, 0x6A, 0xFE, 0x70, 0x76, 0x67 );
+
+' System sleep settings
+DEFINE_GUID( GUID_SLEEP_SUBGROUP, 0x238C9FA8, 0x0AAD, 0x41ED, 0x83, 0xF4, 0x97, 0xBE, 0x24, 0x2C, 0x8F, 0x20 );
+DEFINE_GUID( GUID_SLEEP_IDLE_THRESHOLD, 0x81cd32e0, 0x7833, 0x44f3, 0x87, 0x37, 0x70, 0x81, 0xf3, 0x8d, 0x1f, 0x70 );
+DEFINE_GUID( GUID_STANDBY_TIMEOUT, 0x29F6C1DB, 0x86DA, 0x48C5, 0x9F, 0xDB, 0xF2, 0xB6, 0x7B, 0x1F, 0x44, 0xDA );
+DEFINE_GUID( GUID_HIBERNATE_TIMEOUT, 0x9D7815A6, 0x7EE4, 0x497E, 0x88, 0x88, 0x51, 0x5A, 0x05, 0xF0, 0x23, 0x64 );
+DEFINE_GUID( GUID_HIBERNATE_FASTS4_POLICY, 0x94AC6D29, 0x73CE, 0x41A6, 0x80, 0x9F, 0x63, 0x63, 0xBA, 0x21, 0xB4, 0x7E );
+DEFINE_GUID( GUID_CRITICAL_POWER_TRANSITION,  0xB7A27025, 0xE569, 0x46c2, 0xA5, 0x04, 0x2B, 0x96, 0xCA, 0xD2, 0x25, 0xA1);
+DEFINE_GUID( GUID_SYSTEM_AWAYMODE, 0x98A7F580, 0x01F7, 0x48AA, 0x9C, 0x0F, 0x44, 0x35, 0x2C, 0x29, 0xE5, 0xC0 );
+DEFINE_GUID( GUID_ALLOW_AWAYMODE, 0x25dfa149, 0x5dd1, 0x4736, 0xb5, 0xab, 0xe8, 0xa3, 0x7b, 0x5b, 0x81, 0x87 );
+DEFINE_GUID( GUID_ALLOW_STANDBY_STATES, 0xabfc2519, 0x3608, 0x4c2a, 0x94, 0xea, 0x17, 0x1b, 0x0e, 0xd5, 0x46, 0xab );
+DEFINE_GUID( GUID_ALLOW_RTC_WAKE, 0xBD3B718A, 0x0680, 0x4D9D, 0x8A, 0xB2, 0xE1, 0xD2, 0xB4, 0xAC, 0x80, 0x6D );
+
+' System button actions
+DEFINE_GUID( GUID_SYSTEM_BUTTON_SUBGROUP, 0x4F971E89, 0xEEBD, 0x4455, 0xA8, 0xDE, 0x9E, 0x59, 0x04, 0x0E, 0x73, 0x47 );
+DEFINE_GUID( GUID_POWERBUTTON_ACTION, 0x7648EFA3, 0xDD9C, 0x4E3E, 0xB5, 0x66, 0x50, 0xF9, 0x29, 0x38, 0x62, 0x80 );
+DEFINE_GUID( GUID_POWERBUTTON_ACTION_FLAGS, 0x857E7FAC, 0x034B, 0x4704, 0xAB, 0xB1, 0xBC, 0xA5, 0x4A, 0xA3, 0x14, 0x78 );
+DEFINE_GUID( GUID_SLEEPBUTTON_ACTION, 0x96996BC0, 0xAD50, 0x47EC, 0x92, 0x3B, 0x6F, 0x41, 0x87, 0x4D, 0xD9, 0xEB );
+DEFINE_GUID( GUID_SLEEPBUTTON_ACTION_FLAGS, 0x2A160AB1, 0xB69D, 0x4743, 0xB7, 0x18, 0xBF, 0x14, 0x41, 0xD5, 0xE4, 0x93 );
+DEFINE_GUID( GUID_USERINTERFACEBUTTON_ACTION, 0xA7066653, 0x8D6C, 0x40A8, 0x91, 0x0E, 0xA1, 0xF5, 0x4B, 0x84, 0xC7, 0xE5 );
+DEFINE_GUID( GUID_LIDCLOSE_ACTION, 0x5CA83367, 0x6E45, 0x459F, 0xA2, 0x7B, 0x47, 0x6B, 0x1D, 0x01, 0xC9, 0x36 );
+DEFINE_GUID( GUID_LIDCLOSE_ACTION_FLAGS, 0x97E969AC, 0x0D6C, 0x4D08, 0x92, 0x7C, 0xD7, 0xBD, 0x7A, 0xD7, 0x85, 0x7B );
+DEFINE_GUID( GUID_LIDOPEN_POWERSTATE, 0x99FF10E7, 0x23B1, 0x4C07, 0xA9, 0xD1, 0x5C, 0x32, 0x06, 0xD7, 0x41, 0xB4 );
+
+' Battery Discharge Settings
+DEFINE_GUID( GUID_BATTERY_SUBGROUP, 0xE73A048D, 0xBF27, 0x4F12, 0x97, 0x31, 0x8B, 0x20, 0x76, 0xE8, 0x89, 0x1F );
+' 4 battery discharge alarm settings.
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_0, 0x637EA02F, 0xBBCB, 0x4015, 0x8E, 0x2C, 0xA1, 0xC7, 0xB9, 0xC0, 0xB5, 0x46 );
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_0, 0x9A66D8D7, 0x4FF7, 0x4EF9, 0xB5, 0xA2, 0x5A, 0x32, 0x6C, 0xA2, 0xA4, 0x69 );
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_0, 0x5dbb7c9f, 0x38e9, 0x40d2, 0x97, 0x49, 0x4f, 0x8a, 0x0e, 0x9f, 0x64, 0x0f );
+
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_1, 0xD8742DCB, 0x3E6A, 0x4B3C, 0xB3, 0xFE, 0x37, 0x46, 0x23, 0xCD, 0xCF, 0x06 );
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_1, 0x8183BA9A, 0xE910, 0x48DA, 0x87, 0x69, 0x14, 0xAE, 0x6D, 0xC1, 0x17, 0x0A );
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_1, 0xbcded951, 0x187b, 0x4d05, 0xbc, 0xcc, 0xf7, 0xe5, 0x19, 0x60, 0xc2, 0x58 );
+
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_2, 0x421CBA38, 0x1A8E, 0x4881, 0xAC, 0x89, 0xE3, 0x3A, 0x8B, 0x04, 0xEC, 0xE4 );
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_2, 0x07A07CA2, 0xADAF, 0x40D7, 0xB0, 0x77, 0x53, 0x3A, 0xAD, 0xED, 0x1B, 0xFA );
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_2, 0x7fd2f0c4, 0xfeb7, 0x4da3, 0x81, 0x17, 0xe3, 0xfb, 0xed, 0xc4, 0x65, 0x82 );
+
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_ACTION_3, 0x80472613, 0x9780, 0x455E, 0xB3, 0x08, 0x72, 0xD3, 0x00, 0x3C, 0xF2, 0xF8 );
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_LEVEL_3, 0x58AFD5A6, 0xC2DD, 0x47D2, 0x9F, 0xBF, 0xEF, 0x70, 0xCC, 0x5C, 0x59, 0x65 );
+DEFINE_GUID( GUID_BATTERY_DISCHARGE_FLAGS_3, 0x73613ccf, 0xdbfa, 0x4279, 0x83, 0x56, 0x49, 0x35, 0xf6, 0xbf, 0x62, 0xf3 );
+
+' Processor power settings
+DEFINE_GUID( GUID_PROCESSOR_SETTINGS_SUBGROUP, 0x54533251, 0x82BE, 0x4824, 0x96, 0xC1, 0x47, 0xB6, 0x0B, 0x74, 0x0D, 0x00 );
+DEFINE_GUID( GUID_PROCESSOR_THROTTLE_POLICY, 0x57027304, 0x4AF6, 0x4104, 0x92, 0x60, 0xE3, 0xD9, 0x52, 0x48, 0xFC, 0x36 );
+DEFINE_GUID( GUID_PROCESSOR_THROTTLE_MAXIMUM, 0xBC5038F7, 0x23E0, 0x4960, 0x96, 0xDA, 0x33, 0xAB, 0xAF, 0x59, 0x35, 0xEC );
+DEFINE_GUID( GUID_PROCESSOR_THROTTLE_MINIMUM, 0x893DEE8E, 0x2BEF, 0x41E0, 0x89, 0xC6, 0xB5, 0x5D, 0x09, 0x29, 0x96, 0x4C );
+DEFINE_GUID( GUID_PROCESSOR_IDLESTATE_POLICY, 0x68f262a7, 0xf621, 0x4069, 0xb9, 0xa5, 0x48, 0x74, 0x16, 0x9b, 0xe2, 0x3c);
+DEFINE_GUID( GUID_PROCESSOR_PERFSTATE_POLICY, 0xBBDC3814, 0x18E9, 0x4463, 0x8A, 0x55, 0xD1, 0x97, 0x32, 0x7C, 0x45, 0xC0);
+DEFINE_GUID( GUID_SYSTEM_COOLING_POLICY, 0x94D3A615, 0xA899, 0x4AC5, 0xAE, 0x2B, 0xE4, 0xD8, 0xF6, 0x34, 0x36, 0x7F);
+
+' Lock Console on Wake
+DEFINE_GUID( GUID_LOCK_CONSOLE_ON_WAKE, 0x0E796BDB, 0x100D, 0x47D6, 0xA2, 0xD5, 0xF7, 0xD2, 0xDA, 0xA5, 0x1F, 0x51 );
+
+' AC/DC power source
+DEFINE_GUID( GUID_ACDC_POWER_SOURCE, 0x5D3E9A59, 0xE9D5, 0x4B00, 0xA6, 0xBD, 0xFF, 0x34, 0xFF, 0x51, 0x65, 0x48 );
+
+' Lid state changes
+DEFINE_GUID( GUID_LIDSWITCH_STATE_CHANGE,  0xBA3E0F4D, 0xB817, 0x4094, 0xA2, 0xD1, 0xD5, 0x63, 0x79, 0xE6, 0xA0, 0xF3 );
+
+' Battery life remaining
+DEFINE_GUID( GUID_BATTERY_PERCENTAGE_REMAINING, 0xA7AD8041, 0xB45A, 0x4CAE, 0x87, 0xA3, 0xEE, 0xCB, 0xB4, 0x68, 0xA9, 0xE1 );
+DEFINE_GUID( GUID_IDLE_BACKGROUND_TASK, 0x515C31D8, 0xF734, 0x163D, 0xA0, 0xFD, 0x11, 0xA0, 0x8C, 0x91, 0xE8, 0xF1 );
+DEFINE_GUID( GUID_BACKGROUND_TASK_NOTIFICATION, 0xCF23F240, 0x2A54, 0x48D8, 0xB1, 0x14, 0xDE, 0x15, 0x18, 0xFF, 0x05, 0x2E );
+DEFINE_GUID( GUID_APPLAUNCH_BUTTON, 0x1A689231, 0x7399, 0x4E9A, 0x8F, 0x99, 0xB7, 0x1F, 0x99, 0x9D, 0xB3, 0xFA );
+DEFINE_GUID( GUID_PCIEXPRESS_SETTINGS_SUBGROUP, 0x501a4d13, 0x42af,0x4429, 0x9f, 0xd1, 0xa8, 0x21, 0x8c, 0x26, 0x8e, 0x20 );
+DEFINE_GUID( GUID_PCIEXPRESS_ASPM_POLICY, 0xee12f906, 0xd277, 0x404b, 0xb6, 0xda, 0xe5, 0xfa, 0x1a, 0x57, 0x6d, 0xf5 );
+*/
+Enum SYSTEM_POWER_STATE
+	PowerSystemUnspecified = 0
+	PowerSystemWorking = 1
+	PowerSystemSleeping1 = 2
+	PowerSystemSleeping2 = 3
+	PowerSystemSleeping3 = 4
+	PowerSystemHibernate = 5
+	PowerSystemShutdown = 6
+	PowerSystemMaximum = 7
+End Enum
+TypeDef PSYSTEM_POWER_STATE = *SYSTEM_POWER_STATE
+
+Const POWER_SYSTEM_MAXIMUM = 7
+
+Enum POWER_ACTION
+	PowerActionNone = 0
+	PowerActionReserved
+	PowerActionSleep
+	PowerActionHibernate
+	PowerActionShutdown
+	PowerActionShutdownReset
+	PowerActionShutdownOff
+	PowerActionWarmEject
+End Enum
+TypeDef PPOWER_ACTION = *POWER_ACTION
+
+Enum DEVICE_POWER_STATE
+	PowerDeviceUnspecified = 0
+	PowerDeviceD0
+	PowerDeviceD1
+	PowerDeviceD2
+	PowerDeviceD3
+	PowerDeviceMaximum
+End Enum
+TypeDef PDEVICE_POWER_STATE = *DEVICE_POWER_STATE
+
+Const ES_SYSTEM_REQUIRED = (&h00000001 As DWord)
+Const ES_DISPLAY_REQUIRED = (&h00000002 As DWord)
+Const ES_USER_PRESENT = (&h00000004 As DWord)
+Const ES_AWAYMODE_REQUIRED = (&h00000040 As DWord)
+Const ES_CONTINUOUS = (&h80000000 As DWord)
+
+TypeDef EXECUTION_STATE = DWord
+
+Enum LATENCY_TIME
+	LT_DONT_CARE
+	LT_LOWEST_LATENCY
+End Enum
+
+'#if (NTDDI_VERSION >= NTDDI_WINXP)
+
+' Device Power Information
+Const PDCAP_D0_SUPPORTED = &h00000001
+Const PDCAP_D1_SUPPORTED = &h00000002
+Const PDCAP_D2_SUPPORTED = &h00000004
+Const PDCAP_D3_SUPPORTED = &h00000008
+Const PDCAP_WAKE_FROM_D0_SUPPORTED = &h00000010
+Const PDCAP_WAKE_FROM_D1_SUPPORTED = &h00000020
+Const PDCAP_WAKE_FROM_D2_SUPPORTED = &h00000040
+Const PDCAP_WAKE_FROM_D3_SUPPORTED = &h00000080
+Const PDCAP_WARM_EJECT_SUPPORTED = &h00000100
+
+Type CM_POWER_DATA
+	PD_Size As DWord
+	PD_MostRecentPowerState As DEVICE_POWER_STATE
+	PD_Capabilities As DWord
+	PD_D1Latency As DWord
+	PD_D2Latency As DWord
+	PD_D3Latency As DWord
+	PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM] As DEVICE_POWER_STATE
+	PD_DeepestSystemWake As SYSTEM_POWER_STATE
+End Type
+TypeDef PCM_POWER_DATA = *CM_POWER_DATA
+
+'#endif // (NTDDI_VERSION >= NTDDI_WINXP)
+
+Enum POWER_INFORMATION_LEVEL
+	SystemPowerPolicyAc
+	SystemPowerPolicyDc
+	VerifySystemPolicyAc
+	VerifySystemPolicyDc
+	SystemPowerCapabilities
+	SystemBatteryState
+	SystemPowerStateHandler
+	ProcessorStateHandler
+	SystemPowerPolicyCurrent
+	AdministratorPowerPolicy
+	SystemReserveHiberFile
+	ProcessorInformation
+	SystemPowerInformation
+	ProcessorStateHandler2
+	LastWakeTime                        ' Compare with KeQueryInterruptTime()
+	LastSleepTime                       ' Compare with KeQueryInterruptTime()
+	SystemExecutionState
+	SystemPowerStateNotifyHandler
+	ProcessorPowerPolicyAc
+	ProcessorPowerPolicyDc
+	VerifyProcessorPowerPolicyAc
+	VerifyProcessorPowerPolicyDc
+	ProcessorPowerPolicyCurrent
+	SystemPowerStateLogging
+	SystemPowerLoggingEntry
+	SetPowerSettingValue
+	NotifyUserPowerSetting
+	GetPowerTransitionVetoes
+	SetPowerTransitionVeto
+	SystemVideoState
+	TraceApplicationPowerMessage
+	TraceApplicationPowerMessageEnd
+	ProcessorPerfStates
+	ProcessorIdleStates
+	ProcessorThrottleStates
+	SystemWakeSource
+	SystemHiberFileInformation
+	TraceServicePowerMessage
+	ProcessorLoad
+	PowerShutdownNotification
+End Enum
+
+' Power Transition Vetos
+Const PO_TRANSITION_VETO_TYPE_WINDOW = &h00000001
+Const PO_TRANSITION_VETO_TYPE_SERVICE = &h00000002
+'Const PO_TRANSITION_VETO_TYPE_DRIVER = &h00000004
+
+Const PO_TRANSITION_VETO_TYPE_ALL = (PO_TRANSITION_VETO_TYPE_WINDOW Or PO_TRANSITION_VETO_TYPE_SERVICE)
+
+Type PO_TRANSITION_VETO_REASON
+	ResourceId As DWord
+	ModuleNameOffset As DWord
+End Type
+TypeDef PPO_TRANSITION_VETO_REASON = *PO_TRANSITION_VETO_REASON
+
+Type PO_TRANSITION_VETO_WINDOW
+	Handle As HANDLE
+End Type
+TypeDef PPO_TRANSITION_VETO_WINDOW = *PO_TRANSITION_VETO_WINDOW
+
+Type PO_TRANSITION_VETO_SERVICE
+	ServiceNameOffset As DWord
+End Type
+TypeDef PPO_TRANSITION_VETO_SERVICE = *PO_TRANSITION_VETO_SERVICE
+
+/*
+Type PO_TRANSITION_VETO_DRIVER
+	InstancePathOffset As DWord
+	DriverNameOffset As DWord
+End Type
+TypeDef PPO_TRANSITION_VETO_DRIVER = *PO_TRANSITION_VETO_DRIVER
+*/
+
+Type PO_TRANSITION_VETO
+	Type_ As DWord
+	Reason As PO_TRANSITION_VETO_REASON
+	ProcessId As DWord
+'	Union
+		Window_ As PO_TRANSITION_VETO_WINDOW
+'		Service As PO_TRANSITION_VETO_SERVICE
+'		' Driver As PO_TRANSITION_VETO_DRIVER
+'	End Union
+End Type
+TypeDef PPO_TRANSITION_VETO = *PO_TRANSITION_VETO
+
+Type PO_TRANSITION_VETOES
+	Count As DWord
+	Vetoes[ELM(ANYSIZE_ARRAY)] As PO_TRANSITION_VETO
+End Type
+TypeDef PPO_TRANSITION_VETOES = *PO_TRANSITION_VETOES
+
+Enum SYSTEM_POWER_CONDITION
+	PoAc
+	PoDc
+	PoHot
+	PoConditionMaximum
+End Enum
+
+Type SET_POWER_SETTING_VALUE
+	Version As DWord
+	Guid As GUID
+	PowerCondition As SYSTEM_POWER_CONDITION
+	DataLength As DWord
+	Data[ELM(ANYSIZE_ARRAY)] As Byte
+End Type
+TypeDef PSET_POWER_SETTING_VALUE = *SET_POWER_SETTING_VALUE
+
+Const POWER_SETTING_VALUE_VERSION = &h1
+
+Type NOTIFY_USER_POWER_SETTING
+	Guid As GUID
+End Type
+TypeDef PNOTIFY_USER_POWER_SETTING = *NOTIFY_USER_POWER_SETTING
+
+Type APPLICATIONLAUNCH_SETTING_VALUE
+	ActivationTime As LARGE_INTEGER
+	Flags As DWord
+	ButtonInstanceID As DWord
+End Type
+TypeDef PAPPLICATIONLAUNCH_SETTING_VALUE = *APPLICATIONLAUNCH_SETTING_VALUE
+
+Enum POWER_PLATFORM_ROLE
+	PlatformRoleUnspecified = 0
+	PlatformRoleDesktop
+	PlatformRoleMobile
+	PlatformRoleWorkstation
+	PlatformRoleEnterpriseServer
+	PlatformRoleSOHOServer
+	PlatformRoleAppliancePC
+	PlatformRolePerformanceServer
+	PlatformRoleMaximum
+End Enum
+
+Enum PO_WAKE_SOURCE_TYPE
+	DeviceWakeSourceType
+	FixedWakeSourceType
+End Enum
+TypeDef PPO_WAKE_SOURCE_TYPE = *PO_WAKE_SOURCE_TYPE
+
+Enum PO_FIXED_WAKE_SOURCE_TYPE
+	FixedWakeSourcePowerButton
+	FixedWakeSourceSleepButton
+	FixedWakeSourceRtc
+End Enum
+TypeDef PPO_FIXED_WAKE_SOURCE_TYPE = *PO_FIXED_WAKE_SOURCE_TYPE
+
+Type PO_WAKE_SOURCE_HEADER
+	Type_ As PO_WAKE_SOURCE_TYPE
+	Size As DWord
+End Type
+TypeDef PPO_WAKE_SOURCE_HEADER = *PO_WAKE_SOURCE_HEADER
+
+Type PO_WAKE_SOURCE_DEVICE
+	Header As PO_WAKE_SOURCE_HEADER
+	InstancePath[ELM(ANYSIZE_ARRAY)] As WCHAR
+End Type
+TypeDef PPO_WAKE_SOURCE_DEVICE = *PO_WAKE_SOURCE_DEVICE
+
+Type PO_WAKE_SOURCE_FIXED
+	Header As PO_WAKE_SOURCE_HEADER
+	FixedWakeSourceType As PO_FIXED_WAKE_SOURCE_TYPE
+End Type
+TypeDef PPO_WAKE_SOURCE_FIXED = *PO_WAKE_SOURCE_FIXED
+
+Type PO_WAKE_SOURCE_INFO
+	Count As DWord
+	Offsets[ELM(ANYSIZE_ARRAY)] As DWord
+End Type
+TypeDef PPO_WAKE_SOURCE_INFO = *PO_WAKE_SOURCE_INFO
+
+Type PO_WAKE_SOURCE_HISTORY
+	Count As DWord
+	Offsets[ELM(ANYSIZE_ARRAY)] As DWord
+End Type
+TypeDef PPO_WAKE_SOURCE_HISTORY = *PO_WAKE_SOURCE_HISTORY
+
+'#if (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_)
+Type BATTERY_REPORTING_SCALE
+	Granularity As DWord
+	Capacity As DWord
+End Type
+TypeDef PBATTERY_REPORTING_SCALE = *BATTERY_REPORTING_SCALE
+'#endif
+
+Type PPM_SIMULATED_PROCESSOR_LOAD
+	Enabled As BOOLEAN
+	PercentBusy[ELM(MAXIMUM_PROCESSORS)] As Byte
+End Type
+TypeDef PPPM_SIMULATED_PROCESSOR_LOAD = *PPM_SIMULATED_PROCESSOR_LOAD
+
+Type PPM_WMI_LEGACY_PERFSTATE
+	Frequency As DWord
+	Flags As DWord
+	PercentFrequency As DWord
+End Type
+TypeDef PPPM_WMI_LEGACY_PERFSTATE = *PPM_WMI_LEGACY_PERFSTATE
+
+Type PPM_WMI_IDLE_STATE
+	Latency As DWord
+	Power As DWord
+	TimeCheck As DWord
+	PromotePercent As Byte
+	DemotePercent As Byte
+	StateType As Byte
+	Reserved As Byte
+	StateFlags As DWord
+	Context As DWord
+	IdleHandler As DWord
+	Reserved1 As DWord
+End Type
+TypeDef PPPM_WMI_IDLE_STATE = *PPM_WMI_IDLE_STATE
+
+Type PPM_WMI_IDLE_STATES
+	Type_ As DWord
+	Count As DWord
+	TargetState As DWord
+	OldState As DWord
+	TargetProcessors As QWord
+	State[ELM(ANYSIZE_ARRAY)] As PPM_WMI_IDLE_STATE
+End Type
+TypeDef PPPM_WMI_IDLE_STATES = *PPM_WMI_IDLE_STATES
+
+Type PPM_WMI_PERF_STATE
+	Frequency As DWord
+	Power As DWord
+	PercentFrequency As Byte
+	IncreaseLevel As Byte
+	DecreaseLevel As Byte
+	Type_  As Byte
+	IncreaseTime As DWord
+	DecreaseTime As DWord
+	Control As QWord
+	Status As QWord
+	HitCount As DWord
+	Reserved1 As DWord
+	Reserved2 As QWord
+	Reserved3 As QWord
+End Type
+TypeDef PPPM_WMI_PERF_STATE = *PPM_WMI_PERF_STATE
+
+Type PPM_WMI_PERF_STATES
+	Count As DWord
+	MaxFrequency As DWord
+	CurrentState As DWord
+	MaxPerfState As DWord
+	MinPerfState As DWord
+	LowestPerfState As DWord
+	ThermalConstraint As DWord
+	BusyAdjThreshold As Byte
+	PolicyType As Byte
+	Type_ As Byte
+	Reserved As Byte
+	TimerInterval As DWord
+	TargetProcessors As QWord
+	PStateHandler As DWord
+	PStateContext As DWord
+	TStateHandler As DWord
+	TStateContext As DWord
+	FeedbackHandler As DWord
+	Reserved1 As DWord
+	Reserved2 As QWord
+	State[ELM(ANYSIZE_ARRAY)] As PPM_WMI_PERF_STATE
+End Type
+TypeDef PPPM_WMI_PERF_STATES = *PPM_WMI_PERF_STATES
+
+Const PROC_IDLE_BUCKET_COUNT = 6
+
+Type PPM_IDLE_STATE_ACCOUNTING
+	IdleTransitions As DWord
+	FailedTransitions As DWord
+	InvalidBucketIndex As DWord
+	TotalTime As QWord
+	IdleTimeBuckets[ELM(PROC_IDLE_BUCKET_COUNT)] As DWord
+End Type
+TypeDef PPPM_IDLE_STATE_ACCOUNTING = *PPM_IDLE_STATE_ACCOUNTING
+
+Type PPM_IDLE_ACCOUNTING
+	StateCount As DWord
+	TotalTransitions As DWord
+	ResetCount As DWord
+	StartTime As QWord
+	State[ELM(ANYSIZE_ARRAY)] As PPM_IDLE_STATE_ACCOUNTING
+End Type
+TypeDef PPPM_IDLE_ACCOUNTING = *PPM_IDLE_ACCOUNTING
+
+Const ACPI_PPM_SOFTWARE_ALL = &hFC
+Const ACPI_PPM_SOFTWARE_ANY = &hFD
+Const ACPI_PPM_HARDWARE_ALL = &hFE
+
+Const MS_PPM_SOFTWARE_ALL = &h1
+
+' Processor Power Management WMI interface.
+/*
+// {A5B32DDD-7F39-4abc-B892-900E43B59EBB}
+DEFINE_GUID(PPM_PERFSTATE_CHANGE_GUID,
+0xa5b32ddd, 0x7f39, 0x4abc, 0xb8, 0x92, 0x90, 0xe, 0x43, 0xb5, 0x9e, 0xbb);
+
+// {995e6b7f-d653-497a-b978-36a30c29bf01}
+DEFINE_GUID(PPM_PERFSTATE_DOMAIN_CHANGE_GUID,
+0x995e6b7f, 0xd653, 0x497a, 0xb9, 0x78, 0x36, 0xa3, 0xc, 0x29, 0xbf, 0x1);
+
+// {4838fe4f-f71c-4e51-9ecc-8430a7ac4c6c}
+DEFINE_GUID(PPM_IDLESTATE_CHANGE_GUID,
+0x4838fe4f, 0xf71c, 0x4e51, 0x9e, 0xcc, 0x84, 0x30, 0xa7, 0xac, 0x4c, 0x6c);
+
+// {5708cc20-7d40-4bf4-b4aa-2b01338d0126}
+DEFINE_GUID(PPM_PERFSTATES_DATA_GUID,
+0x5708cc20, 0x7d40, 0x4bf4, 0xb4, 0xaa, 0x2b, 0x01, 0x33, 0x8d, 0x01, 0x26);
+
+// {ba138e10-e250-4ad7-8616-cf1a7ad410e7}
+DEFINE_GUID(PPM_IDLESTATES_DATA_GUID,
+0xba138e10, 0xe250, 0x4ad7, 0x86, 0x16, 0xcf, 0x1a, 0x7a, 0xd4, 0x10, 0xe7);
+
+// {e2a26f78-ae07-4ee0-a30f-ce354f5a94cd}
+DEFINE_GUID(PPM_IDLE_ACCOUNTING_GUID,
+0xe2a26f78, 0xae07, 0x4ee0, 0xa3, 0x0f, 0xce, 0x54, 0xf5, 0x5a, 0x94, 0xcd);
+
+// {a852c2c8-1a4c-423b-8c2c-f30d82931a88}
+DEFINE_GUID(PPM_THERMALCONSTRAINT_GUID,
+0xa852c2c8, 0x1a4c, 0x423b, 0x8c, 0x2c, 0xf3, 0x0d, 0x82, 0x93, 0x1a, 0x88);
+
+// {7fd18652-0cfe-40d2-b0a1-0b066a87759e}
+DEFINE_GUID(PPM_PERFMON_PERFSTATE_GUID,
+0x7fd18652, 0xcfe, 0x40d2, 0xb0, 0xa1, 0xb, 0x6, 0x6a, 0x87, 0x75, 0x9e);
+
+// {48f377b8-6880-4c7b-8bdc-380176c6654d}
+DEFINE_GUID(PPM_THERMAL_POLICY_CHANGE_GUID,
+0x48f377b8, 0x6880, 0x4c7b, 0x8b, 0xdc, 0x38, 0x1, 0x76, 0xc6, 0x65, 0x4d);
+*/
+Type PPM_PERFSTATE_EVENT
+	State As DWord
+	Status As DWord
+	Latency As DWord
+	Speed As DWord
+	Processor As DWord
+End Type
+TypeDef PPPM_PERFSTATE_EVENT = *PPM_PERFSTATE_EVENT
+
+Type PPM_PERFSTATE_DOMAIN_EVENT
+	State As DWord
+	Latency As DWord
+	Speed As DWord
+	Processors As QWord
+End Type
+TypeDef PPPM_PERFSTATE_DOMAIN_EVENT = *PPM_PERFSTATE_DOMAIN_EVENT
+
+Type PPM_IDLESTATE_EVENT
+	NewState As DWord
+	OldState As DWord
+	Processors As QWord
+End Type
+TypeDef PPPM_IDLESTATE_EVENT = *PPM_IDLESTATE_EVENT
+
+Type PPM_THERMALCHANGE_EVENT
+	ThermalConstraint As DWord
+	Processors As QWord
+End Type
+TypeDef PPPM_THERMALCHANGE_EVENT = *PPM_THERMALCHANGE_EVENT
+
+Type PPM_THERMAL_POLICY_EVENT
+	Mode As Byte
+	Processors As QWord
+End Type
+TypeDef PPPM_THERMAL_POLICY_EVENT = *PPM_THERMAL_POLICY_EVENT
+
+Type POWER_ACTION_POLICY
+	Action As POWER_ACTION
+	Flags As DWord
+	EventCode As DWord
+End Type
+TypeDef PPOWER_ACTION_POLICY = *POWER_ACTION_POLICY
+
+' POWER_ACTION_POLICY->Flags:
+Const POWER_ACTION_QUERY_ALLOWED = &h00000001
+Const POWER_ACTION_UI_ALLOWED = &h00000002
+Const POWER_ACTION_OVERRIDE_APPS = &h00000004
+Const POWER_ACTION_LIGHTEST_FIRST = &h10000000
+Const POWER_ACTION_LOCK_CONSOLE = &h20000000
+Const POWER_ACTION_DISABLE_WAKES = &h40000000
+Const POWER_ACTION_CRITICAL = &h80000000
+
+' POWER_ACTION_POLICY->EventCode flags
+Const POWER_LEVEL_USER_NOTIFY_TEXT = &h00000001
+Const POWER_LEVEL_USER_NOTIFY_SOUND = &h00000002
+Const POWER_LEVEL_USER_NOTIFY_EXEC = &h00000004
+Const POWER_USER_NOTIFY_BUTTON = &h00000008
+Const POWER_USER_NOTIFY_SHUTDOWN = &h00000010
+Const POWER_FORCE_TRIGGER_RESET = &h80000000
+
+Const BATTERY_DISCHARGE_FLAGS_EVENTCODE_MASK = &h00000007
+Const BATTERY_DISCHARGE_FLAGS_ENABLE = &h80000000
+
+Type SYSTEM_POWER_LEVEL
+	Enable As BOOLEAN
+	Spare[ELM(3)] As Byte
+	BatteryLevel As DWord
+	PowerPolicy As POWER_ACTION_POLICY
+	MinSystemState As POWER_ACTION_POLICY
+End Type
+TypeDef PSYSTEM_POWER_LEVEL = *SYSTEM_POWER_LEVEL
+
+Const NUM_DISCHARGE_POLICIES = 4
+Const DISCHARGE_POLICY_CRITICAL= 0
+Const DISCHARGE_POLICY_LOW = 1
+
+Type SYSTEM_POWER_POLICY
+	Revision As DWord
+
+	PowerButton As POWER_ACTION_POLICY
+	SleepButton As POWER_ACTION_POLICY
+	LidClose As POWER_ACTION_POLICY
+	LidOpenWake As SYSTEM_POWER_STATE
+	Reserved As DWord
+
+	Idle As POWER_ACTION_POLICY
+	IdleTimeout As DWord
+	IdleSensitivity As Byte
+
+	DynamicThrottle As Byte
+	Spare2[ELM(2)] As Byte
+
+	MinSleep As SYSTEM_POWER_STATE
+	MaxSleep As SYSTEM_POWER_STATE
+	ReducedLatencySleep As SYSTEM_POWER_STATE
+	WinLogonFlags As DWord
+
+	Spare3 As DWord
+
+	DozeS4Timeout As DWord
+
+	BroadcastCapacityResolution; As DWord
+	DischargePolicy[ELM(NUM_DISCHARGE_POLICIES)] As SYSTEM_POWER_LEVEL
+
+	VideoTimeout As DWord
+	VideoDimDisplay As BOOLEAN
+	VideoReserved[ELM(3)] As DWord
+
+	SpindownTimeout As DWord
+
+	OptimizeForPower As BOOLEAN
+	FanThrottleTolerance As Byte
+	ForcedThrottle As Byte
+	MinThrottle As Byte
+	OverThrottled As POWER_ACTION_POLICY
+End Type
+TypeDef PSYSTEM_POWER_POLICY = *SYSTEM_POWER_POLICY
+
+' processor power policy state
+
+Const PROCESSOR_IDLESTATE_POLICY_COUNT = &h3
+
+Type PROCESSOR_IDLESTATE_INFO
+	TimeCheck As DWord
+	DemotePercent As Byte
+	PromotePercent As Byte
+	Spare[ELM(2)] As Byte
+End Type
+TypeDef PPROCESSOR_IDLESTATE_INFO = *PROCESSOR_IDLESTATE_INFO
+
+Type PROCESSOR_IDLESTATE_POLICY
+	Revision As Word
+	FlagsAsWRORD As Word
+'	Union
+'		AsWORD As Word
+'		struct {
+'			WORD   AllowScaling : 1;
+'			WORD   Disabled : 1;
+'			WORD   Reserved : 14;
+'		};
+'	} Flags;
+
+	PolicyCount As DWord
+	Policy[ELM(PROCESSOR_IDLESTATE_POLICY_COUNT)] As PROCESSOR_IDLESTATE_INFO
+End Type
+TypeDef PPROCESSOR_IDLESTATE_POLICY = *PROCESSOR_IDLESTATE_POLICY
+
+Const PO_THROTTLE_NONE = 0
+Const PO_THROTTLE_CONSTANT = 1
+Const PO_THROTTLE_DEGRADE = 2
+Const PO_THROTTLE_ADAPTIVE = 3
+Const PO_THROTTLE_MAXIMUM = 4
+
+Type PROCESSOR_POWER_POLICY_INFO
+	TimeCheck As DWord
+	DemoteLimit As DWord
+	PromoteLimit As DWord
+
+	DemotePercent As Byte
+	PromotePercent As Byte
+	Spare[ELM(2)] As Byte
+	Allow As DWord
+'	AllowDemotion:1 As DWord
+'	AllowPromotion:1 As DWord
+'	Reserved:30 As DWord
+End Type
+TypeDef PPROCESSOR_POWER_POLICY_INFO = *PROCESSOR_POWER_POLICY_INFO
+
+Type PROCESSOR_POWER_POLICY
+	Revision As DWord
+
+	DynamicThrottle As Byte
+	Spare[ELM(3)] As Byte
+
+	DisableCStates/*:1*/ As DWord
+'	Reserved:31 As DWord
+
+	PolicyCount As DWord
+	Policy[ELM(3)] As PROCESSOR_POWER_POLICY_INFO
+End Type
+TypeDef PPROCESSOR_POWER_POLICY = *PROCESSOR_POWER_POLICY
+
+' Processor Perf State Policy.
+Const PERFSTATE_POLICY_CHANGE_IDEAL = &h00
+Const PERFSTATE_POLICY_CHANGE_SINGLE = &h01
+Const PERFSTATE_POLICY_CHANGE_ROCKET = &h02
+Const PERFSTATE_POLICY_CHANGE_MAX = PERFSTATE_POLICY_CHANGE_ROCKET
+
+Type PROCESSOR_PERFSTATE_POLICY 'アラインメント平気か？
+	Revision As DWord
+	MaxThrottle As Byte
+	MinThrottle As Byte
+	BusyAdjThreshold As Byte
+	FlagsAsBYTE As Byte '下の共用体メンバの部分
+'	Union
+'		Spare As Byte
+'		Union
+'			AsBYTE As Byte
+'			Type
+'				NoDomainAccounting : 1 As Byte
+'				IncreasePolicy: 2 As Byte
+'				DecreasePolicy: 2 As Byte
+'				Reserved : 3 As Byte
+'			End Type
+'		} Flags;
+'	};
+	TimeCheck As DWord
+	IncreaseTime As DWord
+	DecreaseTime As DWord
+	IncreasePercent As DWord
+	DecreasePercent As DWord
+End Type
+TypeDef PPROCESSOR_PERFSTATE_POLICY = *PROCESSOR_PERFSTATE_POLICY
+
+Type ADMINISTRATOR_POWER_POLICY
+	MinSleep As SYSTEM_POWER_STATE
+	MaxSleep As SYSTEM_POWER_STATE
+
+	MinVideoTimeout As DWord
+	MaxVideoTimeout As DWord
+
+	MinSpindownTimeout As DWord
+	MaxSpindownTimeout As DWord
+End Type
+TypeDef PADMINISTRATOR_POWER_POLICY = *ADMINISTRATOR_POWER_POLICY
+
+Type SYSTEM_POWER_CAPABILITIES
+	PowerButtonPresent As BOOLEAN
+	SleepButtonPresent As BOOLEAN
+	LidPresent As BOOLEAN
+	SystemS1 As BOOLEAN
+	SystemS2 As BOOLEAN
+	SystemS3 As BOOLEAN
+	SystemS4 As BOOLEAN
+	SystemS5 As BOOLEAN
+	HiberFilePresent As BOOLEAN
+	FullWake As BOOLEAN
+	VideoDimPresent As BOOLEAN
+	ApmPresent As BOOLEAN
+	UpsPresent As BOOLEAN
+
+	ThermalControl As BOOLEAN
+	ProcessorThrottle As BOOLEAN
+	ProcessorMinThrottle As Byte
+
+'#if (NTDDI_VERSION < NTDDI_WINXP)
+'	ProcessorThrottleScale As Byte
+'	spare2[ELM(4)] As Byte
+'#else
+	ProcessorMaxThrottle As Byte
+	FastSystemS4 As BOOLEAN
+	spare2[(3)] As Byte
+'#endif // (NTDDI_VERSION < NTDDI_WINXP)
+
+	DiskSpinDown As BOOLEAN
+	spare3[ELM(8)] As Byte
+
+	SystemBatteriesPresent As BOOLEAN
+	BatteriesAreShortTerm As BOOLEAN
+	BatteryScale[ELM(3)] As BATTERY_REPORTING_SCALE
+
+	AcOnLineWake As SYSTEM_POWER_STATE
+	SoftLidWake As SYSTEM_POWER_STATE
+	RtcWake As SYSTEM_POWER_STATE
+	MinDeviceWakeState As SYSTEM_POWER_STATE
+	DefaultLowLatencyWake As SYSTEM_POWER_STATE
+End Type
+TypeDef PSYSTEM_POWER_CAPABILITIES = *SYSTEM_POWER_CAPABILITIES
+
+Type SYSTEM_BATTERY_STATE
+	AcOnLine As BOOLEAN
+	BatteryPresent As BOOLEAN
+	Charging As BOOLEAN
+	Discharging As BOOLEAN
+	Spare1[ELM(4)] As BOOLEAN
+
+	MaxCapacity As DWord
+	RemainingCapacity As DWord
+	Rate As DWord
+	EstimatedTime As DWord
+
+	DefaultAlert1 As DWord
+	DefaultAlert2 As DWord
+End Type
+TypeDef PSYSTEM_BATTERY_STATE = *SYSTEM_BATTERY_STATE
+
+Const IMAGE_DOS_SIGNATURE = &h5A4D    ' MZ
+Const IMAGE_OS2_SIGNATURE = &h454E    ' NE
+Const IMAGE_OS2_SIGNATURE_LE = &h454C ' LE
+Const IMAGE_VXD_SIGNATURE = &h454C    ' LE
+Const IMAGE_NT_SIGNATURE = &h00004550 ' PE00
+
+Type Align(2) IMAGE_DOS_HEADER          ' DOS .EXE header
+	e_magic As Word                     ' Magic number
+	e_cblp As Word                      ' Bytes on last page of file
+	e_cp As Word                        ' Pages in file
+	e_crlc As Word                      ' Relocations
+	e_cparhdr As Word                   ' Size of header in paragraphs
+	e_minalloc As Word                  ' Minimum extra paragraphs needed
+	e_maxalloc As Word                  ' Maximum extra paragraphs needed
+	e_ss As Word                        ' Initial (relative) SS value
+	e_sp As Word                        ' Initial SP value
+	e_csum As Word                      ' Checksum
+	e_ip As Word                        ' Initial IP value
+	e_cs As Word                        ' Initial (relative) CS value
+	e_lfarlc As Word                    ' File address of relocation table
+	e_ovno As Word                      ' Overlay number
+	e_res[ELM(4)] As Word               ' Reserved words
+	e_oemid As Word                     ' OEM identifier (for e_oeminfo)
+	e_oeminfo As Word                   ' OEM information; e_oemid specific
+	e_res2[ELM(10)] As Word             ' Reserved words
+	e_lfanew As Long                    ' File address of new exe header
+End Type
+TypeDef PIMAGE_DOS_HEADER = *IMAGE_DOS_HEADER
+
+Type Align(2) IMAGE_OS2_HEADER          ' OS/2 .EXE header
+	ne_magic As Word                    ' Magic number
+	ne_ver As CHAR                      ' Version number
+	ne_rev As CHAR                      ' Revision number
+	ne_enttab As Word                   ' Offset of Entry Table
+	ne_cbenttab As Word                 ' Number of bytes in Entry Table
+	ne_crc As Long                      ' Checksum of whole file
+	ne_flags As Word                    ' Flag word
+	ne_autodata As Word                 ' Automatic data segment number
+	ne_heap As Word                     ' Initial heap allocation
+	ne_stack As Word                    ' Initial stack allocation
+	ne_csip As Long                     ' Initial CS:IP setting
+	ne_sssp As Long                     ' Initial SS:SP setting
+	ne_cseg As Word                     ' Count of file segments
+	ne_cmod As Word                     ' Entries in Module Reference Table
+	ne_cbnrestab As Word                ' Size of non-resident name table
+	ne_segtab As Word                   ' Offset of Segment Table
+	ne_rsrctab As Word                  ' Offset of Resource Table
+	ne_restab As Word                   ' Offset of resident name table
+	ne_modtab As Word                   ' Offset of Module Reference Table
+	ne_imptab As Word                   ' Offset of Imported Names Table
+	ne_nrestab As Long                  ' Offset of Non-resident Names Table
+	ne_cmovent As Word                  ' Count of movable entries
+	ne_align As Word                    ' Segment alignment shift count
+	ne_cres As Word                     ' Count of resource segments
+	ne_exetyp As Byte                   ' Target Operating system
+	ne_flagsothers As Byte              ' Other .EXE flags
+	ne_pretthunks As Word               ' offset to return thunks
+	ne_psegrefbytes As Word             ' offset to segment ref. bytes
+	ne_swaparea As Word                 ' Minimum code swap area size
+	ne_expver As Word                   ' Expected Windows version number
+End Type
+TypeDef PIMAGE_OS2_HEADER = *IMAGE_OS2_HEADER
+
+Type Align(2) IMAGE_VXD_HEADER          ' Windows VXD header
+	e32_magic As Word                   ' Magic number
+	e32_border As Byte                  ' The byte ordering for the VXD
+	e32_worder As Byte                  ' The word ordering for the VXD
+	e32_level As DWord                  ' The EXE format level for now = 0
+	e32_cpu As Word                     ' The CPU type
+	e32_os As Word                      ' The OS type
+	e32_ver As DWord                    ' Module version
+	e32_mflags As DWord                 ' Module flags
+	e32_mpages As DWord                 ' Module # pages
+	e32_startobj As DWord               ' Object # for instruction pointer
+	e32_eip As DWord                    ' Extended instruction pointer
+	e32_stackobj As DWord               ' Object # for stack pointer
+	e32_esp As DWord                    ' Extended stack pointer
+	e32_pagesize As DWord               ' VXD page size
+	e32_lastpagesize As DWord           ' Last page size in VXD
+	e32_fixupsize As DWord              ' Fixup section size
+	e32_fixupsum As DWord               ' Fixup section checksum
+	e32_ldrsize As DWord                ' Loader section size
+	e32_ldrsum As DWord                 ' Loader section checksum
+	e32_objtab As DWord                 ' Object table offset
+	e32_objcnt As DWord                 ' Number of objects in module
+	e32_objmap As DWord                 ' Object page map offset
+	e32_itermap As DWord                ' Object iterated data map offset
+	e32_rsrctab As DWord                ' Offset of Resource Table
+	e32_rsrccnt As DWord                ' Number of resource entries
+	e32_restab As DWord                 ' Offset of resident name table
+	e32_enttab As DWord                 ' Offset of Entry Table
+	e32_dirtab As DWord                 ' Offset of Module Directive Table
+	e32_dircnt As DWord                 ' Number of module directives
+	e32_fpagetab As DWord               ' Offset of Fixup Page Table
+	e32_frectab As DWord                ' Offset of Fixup Record Table
+	e32_impmod As DWord                 ' Offset of Import Module Name Table
+	e32_impmodcnt As DWord              ' Number of entries in Import Module Name Table
+	e32_impproc As DWord                ' Offset of Import Procedure Name Table
+	e32_pagesum As DWord                ' Offset of Per-Page Checksum Table
+	e32_datapage As DWord               ' Offset of Enumerated Data Pages
+	e32_preload As DWord                ' Number of preload pages
+	e32_nrestab As DWord                ' Offset of Non-resident Names Table
+	e32_cbnrestab As DWord              ' Size of Non-resident Name Table
+	e32_nressum As DWord                ' Non-resident Name Table Checksum
+	e32_autodata As DWord               ' Object # for automatic data object
+	e32_debuginfo As DWord              ' Offset of the debugging information
+	e32_debuglen As DWord               ' The length of the debugging info. in bytes
+	e32_instpreload As DWord            ' Number of instance pages in preload section of VXD file
+	e32_instdemand As DWord             ' Number of instance pages in demand load section of VXD file
+	e32_heapsize As DWord               ' Size of heap - for 16-bit apps
+	e32_res3[ELM(12)] As Byte           ' Reserved words
+	e32_winresoff As DWord
+	e32_winreslen As DWord
+	e32_devid As Word                   ' Device ID for VxD
+	e32_ddkver As Word                  ' DDK version for VxD
+End Type
+TypeDef PIMAGE_VXD_HEADER = *IMAGE_VXD_HEADER
+
+' File header format.
+Type Align(4) IMAGE_FILE_HEADER
+	Machine As Word
+	NumberOfSections As Word
+	TimeDateStamp As DWord
+	PointerToSymbolTable As DWord
+	NumberOfSymbols As DWord
+	SizeOfOptionalHeader As Word
+	Characteristics As Word
+End Type
+TypeDef PIMAGE_FILE_HEADER = *IMAGE_FILE_HEADER
+
+Const IMAGE_SIZEOF_FILE_HEADER = 20
+
+Const IMAGE_FILE_RELOCS_STRIPPED         = &h0001  ' Relocation info stripped from file.
+Const IMAGE_FILE_EXECUTABLE_IMAGE        = &h0002  ' File is executable  (i.e. no unresolved externel references).
+Const IMAGE_FILE_LINE_NUMS_STRIPPED      = &h0004  ' Line nunbers stripped from file.
+Const IMAGE_FILE_LOCAL_SYMS_STRIPPED     = &h0008  ' Local symbols stripped from file.
+Const IMAGE_FILE_AGGRESIVE_WS_TRIM       = &h0010  ' Agressively trim working set
+Const IMAGE_FILE_LARGE_ADDRESS_AWARE     = &h0020  ' App can handle >2gb addresses
+Const IMAGE_FILE_BYTES_REVERSED_LO       = &h0080  ' Bytes of machine word are reversed.
+Const IMAGE_FILE_32BIT_MACHINE           = &h0100  ' 32 bit word machine.
+Const IMAGE_FILE_DEBUG_STRIPPED          = &h0200  ' Debugging info stripped from file in .DBG file
+Const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = &h0400  ' If Image is on removable media, copy and run from the swap file.
+Const IMAGE_FILE_NET_RUN_FROM_SWAP       = &h0800  ' If Image is on Net, copy and run from the swap file.
+Const IMAGE_FILE_SYSTEM                  = &h1000  ' System File.
+Const IMAGE_FILE_DLL                     = &h2000  ' File is a DLL.
+Const IMAGE_FILE_UP_SYSTEM_ONLY          = &h4000  ' File should only be run on a UP machine
+Const IMAGE_FILE_BYTES_REVERSED_HI       = &h8000  ' Bytes of machine word are reversed.
+
+Const IMAGE_FILE_MACHINE_UNKNOWN         = 0
+Const IMAGE_FILE_MACHINE_I386            = &h014c  ' Intel 386.
+Const IMAGE_FILE_MACHINE_R3000           = &h0162  ' MIPS little-endian, 0x160 big-endian
+Const IMAGE_FILE_MACHINE_R4000           = &h0166  ' MIPS little-endian
+Const IMAGE_FILE_MACHINE_R10000          = &h0168  ' MIPS little-endian
+Const IMAGE_FILE_MACHINE_WCEMIPSV2       = &h0169  ' MIPS little-endian WCE v2
+Const IMAGE_FILE_MACHINE_ALPHA           = &h0184  ' Alpha_AXP
+Const IMAGE_FILE_MACHINE_SH3             = &h01a2  ' SH3 little-endian
+Const IMAGE_FILE_MACHINE_SH3DSP          = &h01a3
+Const IMAGE_FILE_MACHINE_SH3E            = &h01a4  ' SH3E little-endian
+Const IMAGE_FILE_MACHINE_SH4             = &h01a6  ' SH4 little-endian
+Const IMAGE_FILE_MACHINE_SH5             = &h01a8  ' SH5
+Const IMAGE_FILE_MACHINE_ARM             = &h01c0  ' ARM Little-Endian
+Const IMAGE_FILE_MACHINE_THUMB           = &h01c2
+Const IMAGE_FILE_MACHINE_AM33            = &h01d3
+Const IMAGE_FILE_MACHINE_POWERPC         = &h01F0  ' IBM PowerPC Little-Endian
+Const IMAGE_FILE_MACHINE_POWERPCFP       = &h01f1
+Const IMAGE_FILE_MACHINE_IA64            = &h0200  ' Intel 64
+Const IMAGE_FILE_MACHINE_MIPS16          = &h0266  ' MIPS
+Const IMAGE_FILE_MACHINE_ALPHA64         = &h0284  ' ALPHA64
+Const IMAGE_FILE_MACHINE_MIPSFPU         = &h0366  ' MIPS
+Const IMAGE_FILE_MACHINE_MIPSFPU16       = &h0466  ' MIPS
+Const IMAGE_FILE_MACHINE_AXP64           = IMAGE_FILE_MACHINE_ALPHA64
+Const IMAGE_FILE_MACHINE_TRICORE         = &h0520  ' Infineon
+Const IMAGE_FILE_MACHINE_CEF             = &h0CEF
+Const IMAGE_FILE_MACHINE_EBC             = &h0EBC  ' EFI Byte Code
+Const IMAGE_FILE_MACHINE_AMD64           = &h8664  ' AMD64 (K8)
+Const IMAGE_FILE_MACHINE_M32R            = &h9041  ' M32R little-endian
+Const IMAGE_FILE_MACHINE_CEE             = &hC0EE
+
+' Directory format.
+Type IMAGE_DATA_DIRECTORY
+	VirtualAddress As DWord
+	Size As DWord
+End Type
+TypeDef PIMAGE_DATA_DIRECTORY = *IMAGE_DATA_DIRECTORY
+
+Const IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16
+
+' Optional header format.
+Type IMAGE_OPTIONAL_HEADER32
+	Magic As Word
+	MajorLinkerVersion As Byte
+	MinorLinkerVersion As Byte
+	SizeOfCode As DWord
+	SizeOfInitializedData As DWord
+	SizeOfUninitializedData As DWord
+	AddressOfEntryPoint As DWord
+	BaseOfCode As DWord
+	BaseOfData As DWord
+
+	ImageBase As DWord
+	SectionAlignment As DWord
+	FileAlignment As DWord
+	MajorOperatingSystemVersion As Word
+	MinorOperatingSystemVersion As Word
+	MajorImageVersion As Word
+	MinorImageVersion As Word
+	MajorSubsystemVersion As Word
+	MinorSubsystemVersion As Word
+	Win32VersionValue As Word
+	SizeOfImage As DWord
+	SizeOfHeaders As DWord
+	CheckSum As DWord
+	Subsystem As Word
+	DllCharacteristics As Word
+	SizeOfStackReserve As DWord
+	SizeOfStackCommit As DWord
+	SizeOfHeapReserve As DWord
+	SizeOfHeapCommit As DWord
+	LoaderFlags As DWord
+	NumberOfRvaAndSizes As DWord
+	DataDirectory[ELM(IMAGE_NUMBEROF_DIRECTORY_ENTRIES)] As IMAGE_DATA_DIRECTORY
+End Type
+TypeDef PIMAGE_OPTIONAL_HEADER32 = *IMAGE_OPTIONAL_HEADER32
+
+Type IMAGE_ROM_OPTIONAL_HEADER
+	Magic As Word
+	MajorLinkerVersion As Byte
+	MinorLinkerVersion As Byte
+	SizeOfCode As DWord
+	SizeOfInitializedData As DWord
+	SizeOfUninitializedData As DWord
+	AddressOfEntryPoint As DWord
+	BaseOfCode As DWord
+	BaseOfData As DWord
+	BaseOfBss As DWord
+	GprMask As DWord
+	CprMask[ELM(4)] As DWord
+	GpValue As DWord
+End Type
+TypeDef PIMAGE_ROM_OPTIONAL_HEADER = *IMAGE_ROM_OPTIONAL_HEADER
+
+Type IMAGE_OPTIONAL_HEADER64
+	Magic As Word
+	MajorLinkerVersion As Byte
+	MinorLinkerVersion As Byte
+	SizeOfCode As DWord
+	SizeOfInitializedData As DWord
+	SizeOfUninitializedData As DWord
+	AddressOfEntryPoint As DWord
+	BaseOfCode As DWord
+	ImageBase As QWord
+	SectionAlignment As DWord
+	FileAlignment As DWord
+	MajorOperatingSystemVersion As Word
+	MinorOperatingSystemVersion As Word
+	MajorImageVersion As Word
+	MinorImageVersion As Word
+	MajorSubsystemVersion As Word
+	MinorSubsystemVersion As Word
+	Win32VersionValue As DWord
+	SizeOfImage As DWord
+	SizeOfHeaders As DWord
+	CheckSum As DWord
+	Subsystem As Word
+	DllCharacteristics As Word
+	SizeOfStackReserve As QWord
+	SizeOfStackCommit As QWord
+	SizeOfHeapReserve As QWord
+	SizeOfHeapCommit As QWord
+	LoaderFlags As DWord
+	NumberOfRvaAndSizes As DWord
+	DataDirectory[ELM(IMAGE_NUMBEROF_DIRECTORY_ENTRIES)] As IMAGE_DATA_DIRECTORY
+End Type
+TypeDef PIMAGE_OPTIONAL_HEADER64 = *IMAGE_OPTIONAL_HEADER64
+
+Const IMAGE_NT_OPTIONAL_HDR32_MAGIC = &h10b
+Const IMAGE_NT_OPTIONAL_HDR64_MAGIC = &h20b
+Const IMAGE_ROM_OPTIONAL_HDR_MAGIC = &h107
+
+#ifdef _WIN64
+TypeDef IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER64
+TypeDef PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER64
+Const IMAGE_NT_OPTIONAL_HDR_MAGIC = IMAGE_NT_OPTIONAL_HDR64_MAGIC
+#else
+TypeDef IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER32
+TypeDef PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER32
+Const IMAGE_NT_OPTIONAL_HDR_MAGIC = IMAGE_NT_OPTIONAL_HDR32_MAGIC
+#endif
+
+Type IMAGE_NT_HEADERS64
+	Signature As DWord
+	FileHeader As IMAGE_FILE_HEADER
+	OptionalHeader As IMAGE_OPTIONAL_HEADER64
+End Type
+TypeDef PIMAGE_NT_HEADERS64 = *IMAGE_NT_HEADERS64
+
+Type IMAGE_NT_HEADERS32
+	Signature As DWord
+	FileHeader As IMAGE_FILE_HEADER
+	OptionalHeader As IMAGE_OPTIONAL_HEADER32
+End Type
+TypeDef PIMAGE_NT_HEADERS32 = *IMAGE_NT_HEADERS32
+
+Type IMAGE_ROM_HEADERS
+	FileHeader As IMAGE_FILE_HEADER
+	OptionalHeader As IMAGE_ROM_OPTIONAL_HEADER
+End Type
+TypeDef PIMAGE_ROM_HEADERS = *IMAGE_ROM_HEADERS
+
+#ifdef _WIN64
+TypeDef IMAGE_NT_HEADERS = IMAGE_NT_HEADERS64
+TypeDef PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS64
+#else
+TypeDef IMAGE_NT_HEADERS = IMAGE_NT_HEADERS32
+TypeDef PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS32
+#endif
+/*
+Const IMAGE_FIRST_SECTION( ntheader ) (        \_
+    ((ntheader) As ULONG_PTR +                                              _
+     FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) +                 _
+     ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader   _
+    ) As PIMAGE_SECTION_HEADER)
+*/
+Const IMAGE_SUBSYSTEM_UNKNOWN             = 0   ' Unknown subsystem.
+Const IMAGE_SUBSYSTEM_NATIVE              = 1   ' Image doesn't require a subsystem.
+Const IMAGE_SUBSYSTEM_WINDOWS_GUI         = 2   ' Image runs in the Windows GUI subsystem.
+Const IMAGE_SUBSYSTEM_WINDOWS_CUI         = 3   ' Image runs in the Windows character subsystem.
+Const IMAGE_SUBSYSTEM_OS2_CUI             = 5   ' image runs in the OS/2 character subsystem.
+Const IMAGE_SUBSYSTEM_POSIX_CUI           = 7   ' image runs in the Posix character subsystem.
+Const IMAGE_SUBSYSTEM_NATIVE_WINDOWS      = 8   ' image is a native Win9x driver.
+Const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI      = 9   ' Image runs in the Windows CE subsystem.
+Const IMAGE_SUBSYSTEM_EFI_APPLICATION     = 10  '
+Const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11   '
+Const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER  = 12  '
+Const IMAGE_SUBSYSTEM_EFI_ROM             = 13
+Const IMAGE_SUBSYSTEM_XBOX                = 14
+Const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16
+
+'      IMAGE_LIBRARY_PROCESS_INIT           = &h0001    ' Reserved.
+'      IMAGE_LIBRARY_PROCESS_TERM           = &h0002    ' Reserved.
+'      IMAGE_LIBRARY_THREAD_INIT            = &h0004    ' Reserved.
+'      IMAGE_LIBRARY_THREAD_TERM            = &h0008    ' Reserved.
+Const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = &h0040     ' DLL can move.
+Const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY   = &h0080     ' Code Integrity Image
+Const IMAGE_DLLCHARACTERISTICS_NX_COMPAT    = &h0100     ' Image is NX compatible
+Const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = &h0200     ' Image understands isolation and doesn't want it
+Const IMAGE_DLLCHARACTERISTICS_NO_SEH       = &h0400     ' Image does not use SEH.  No SE handler may reside in this image
+Const IMAGE_DLLCHARACTERISTICS_NO_BIND      = &h0800     ' Do not bind this image.
+'                                            = &h1000    ' Reserved.
+Const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER   = &h2000     ' Driver uses WDM model
+'                                           = &h4000    ' Reserved.
+Const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE    = &h8000
+
+Const IMAGE_DIRECTORY_ENTRY_EXPORT         = 0   ' Export Directory
+Const IMAGE_DIRECTORY_ENTRY_IMPORT         = 1   ' Import Directory
+Const IMAGE_DIRECTORY_ENTRY_RESOURCE       = 2   ' Resource Directory
+Const IMAGE_DIRECTORY_ENTRY_EXCEPTION      = 3   ' Exception Directory
+Const IMAGE_DIRECTORY_ENTRY_SECURITY       = 4   ' Security Directory
+Const IMAGE_DIRECTORY_ENTRY_BASERELOC      = 5   ' Base Relocation Table
+Const IMAGE_DIRECTORY_ENTRY_DEBUG          = 6   ' Debug Directory
+'      IMAGE_DIRECTORY_ENTRY_COPYRIGHT      = 7  ' (X86 usage)
+Const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE   = 7   ' Architecture Specific Data
+Const IMAGE_DIRECTORY_ENTRY_GLOBALPTR      = 8   ' RVA of GP
+Const IMAGE_DIRECTORY_ENTRY_TLS            = 9   ' TLS Directory
+Const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG   = 10   ' Load Configuration Directory
+Const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT  = 11   ' Bound Import Directory in headers
+Const IMAGE_DIRECTORY_ENTRY_IAT           = 12   ' Import Address Table
+Const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT  = 13   ' Delay Load Import Descriptors
+Const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14  ' COM Runtime descriptor
+
+' Non-COFF Object file header
+Type ANON_OBJECT_HEADER
+	Sig1 As Word             ' Must be IMAGE_FILE_MACHINE_UNKNOWN
+	Sig2 As Word             ' Must be 0xffff
+	Version As Word  ' >= 1 (implies the CLSID field is present)
+	Machine As Word
+	TimeDateStamp As DWord
+	ClassID As CLSID       ' Used to invoke CoCreateInstance
+	SizeOfData As DWord    ' Size of data that follows the header
+End Type
+
+Type ANON_OBJECT_HEADER_V2
+	Sig1 As Word            ' Must be IMAGE_FILE_MACHINE_UNKNOWN
+	Sig2 As Word            ' Must be 0xffff
+	Version As Word         ' >= 2 (implies the Flags field is present - otherwise V1)
+	Machine As Word
+	TimeDateStamp As DWord
+	ClassID As CLSID         ' Used to invoke CoCreateInstance
+	SizeOfData As DWord      ' Size of data that follows the header
+	Flags As DWord           ' 0x1 -> contains metadata
+	MetaDataSize As DWord    ' Size of CLR metadata
+	MetaDataOffset As DWord  ' Offset of CLR metadata
+End Type
+
+Const IMAGE_SIZEOF_SHORT_NAME = 8
+
+Type IMAGE_SECTION_HEADER
+	Name[ELM(IMAGE_SIZEOF_SHORT_NAME)] As Byte
+	'Union
+		PhysicalAddress As DWord
+'		VirtualSize As DWord
+'	} Misc
+	VirtualAddress As DWord
+	SizeOfRawData As DWord
+	PointerToRawData As DWord
+	PointerToRelocations As DWord
+	PointerToLinenumbers As DWord
+	NumberOfRelocations As Word
+	NumberOfLinenumbers As Word
+	Characteristics As DWord
+End Type
+TypeDef PIMAGE_SECTION_HEADER = *IMAGE_SECTION_HEADER
+
+Const IMAGE_SIZEOF_SECTION_HEADER = 40
+
+' Section characteristics.
+'      IMAGE_SCN_TYPE_REG                 = &h00000000 ' Reserved.
+'      IMAGE_SCN_TYPE_DSECT               = &h00000001 ' Reserved.
+'      IMAGE_SCN_TYPE_NOLOAD              = &h00000002 ' Reserved.
+'      IMAGE_SCN_TYPE_GROUP               = &h00000004 ' Reserved.
+Const IMAGE_SCN_TYPE_NO_PAD              = &h00000008  ' Reserved.
+'      IMAGE_SCN_TYPE_COPY                = &h00000010 ' Reserved.
+
+Const IMAGE_SCN_CNT_CODE                 = &h00000020  ' Section contains code.
+Const IMAGE_SCN_CNT_INITIALIZED_DATA     = &h00000040  ' Section contains initialized data.
+Const IMAGE_SCN_CNT_UNINITIALIZED_DATA   = &h00000080  ' Section contains uninitialized data.
+
+Const IMAGE_SCN_LNK_OTHER                = &h00000100  ' Reserved.
+Const IMAGE_SCN_LNK_INFO                 = &h00000200  ' Section contains comments or some other type of information.
+'      IMAGE_SCN_TYPE_OVER                = &h00000400 ' Reserved.
+Const IMAGE_SCN_LNK_REMOVE               = &h00000800  ' Section contents will not become part of image.
+Const IMAGE_SCN_LNK_COMDAT               = &h00001000  ' Section contents comdat.
+'                                         = &h00002000 ' Reserved.
+'      IMAGE_SCN_MEM_PROTECTED - Obsolete = &h00004000
+Const IMAGE_SCN_NO_DEFER_SPEC_EXC        = &h00004000  ' Reset speculative exceptions handling bits in the TLB entries for this section.
+Const IMAGE_SCN_GPREL                    = &h00008000  ' Section content can be accessed relative to GP
+Const IMAGE_SCN_MEM_FARDATA              = &h00008000
+'      IMAGE_SCN_MEM_SYSHEAP  - Obsolete  = &h00010000
+Const IMAGE_SCN_MEM_PURGEABLE            = &h00020000
+Const IMAGE_SCN_MEM_16BIT                = &h00020000
+Const IMAGE_SCN_MEM_LOCKED               = &h00040000
+Const IMAGE_SCN_MEM_PRELOAD              = &h00080000
+
+Const IMAGE_SCN_ALIGN_1BYTES             = &h00100000  '
+Const IMAGE_SCN_ALIGN_2BYTES             = &h00200000  '
+Const IMAGE_SCN_ALIGN_4BYTES             = &h00300000  '
+Const IMAGE_SCN_ALIGN_8BYTES             = &h00400000  '
+Const IMAGE_SCN_ALIGN_16BYTES            = &h00500000  ' Default alignment if no others are specified.
+Const IMAGE_SCN_ALIGN_32BYTES            = &h00600000  '
+Const IMAGE_SCN_ALIGN_64BYTES            = &h00700000  '
+Const IMAGE_SCN_ALIGN_128BYTES           = &h00800000  '
+Const IMAGE_SCN_ALIGN_256BYTES           = &h00900000  '
+Const IMAGE_SCN_ALIGN_512BYTES           = &h00A00000  '
+Const IMAGE_SCN_ALIGN_1024BYTES          = &h00B00000  '
+Const IMAGE_SCN_ALIGN_2048BYTES          = &h00C00000  '
+Const IMAGE_SCN_ALIGN_4096BYTES          = &h00D00000  '
+Const IMAGE_SCN_ALIGN_8192BYTES          = &h00E00000  '
+' Unused                                  = &h00F00000
+Const IMAGE_SCN_ALIGN_MASK               = &h00F00000
+
+Const IMAGE_SCN_LNK_NRELOC_OVFL          = &h01000000  ' Section contains extended relocations.
+Const IMAGE_SCN_MEM_DISCARDABLE          = &h02000000  ' Section can be discarded.
+Const IMAGE_SCN_MEM_NOT_CACHED           = &h04000000  ' Section is not cachable.
+Const IMAGE_SCN_MEM_NOT_PAGED            = &h08000000  ' Section is not pageable.
+Const IMAGE_SCN_MEM_SHARED               = &h10000000  ' Section is shareable.
+Const IMAGE_SCN_MEM_EXECUTE              = &h20000000  ' Section is executable.
+Const IMAGE_SCN_MEM_READ                 = &h40000000  ' Section is readable.
+Const IMAGE_SCN_MEM_WRITE                = &h80000000  ' Section is writeable.
+
+' TLS Chaacteristic Flags
+Const IMAGE_SCN_SCALE_INDEX              = &h00000001  ' Tls index is scaled
+
+' Symbol format.
+Type Align(2) IMAGE_SYMBOL
+'	Union
+		ShortName[ELM(8)] As Byte
+'		Type
+'			Short As DWord
+'			Long As DWord
+'		} Name
+'		LongName[ELM(2)] As DWord ' PBYTE [ELM(2)]
+'	} N
+	Value AS DWord
+	SectionNumber As Integer
+	Type_ As Word
+	StorageClass As Byte
+	NumberOfAuxSymbols As Byte
+End Type
+TypeDef PIMAGE_SYMBOL = * /*UNALIGNED*/ IMAGE_SYMBOL
+
+Const IMAGE_SIZEOF_SYMBOL  = 18
+
+' Section values.
+Const IMAGE_SYM_UNDEFINED   = 0 As Integer         ' Symbol is undefined or is common.
+Const IMAGE_SYM_ABSOLUTE    = -1 As Integer        ' Symbol is an absolute value.
+Const IMAGE_SYM_DEBUG       = -2 As Integer        ' Symbol is a special debug item.
+Const IMAGE_SYM_SECTION_MAX = &hFEFF               ' Values 0xFF00-0xFFFF are special
+
+' Type (fundamental) values.
+
+Const IMAGE_SYM_TYPE_NULL               = &h0000  ' no type.
+Const IMAGE_SYM_TYPE_VOID               = &h0001  '
+Const IMAGE_SYM_TYPE_CHAR               = &h0002  ' type character.
+Const IMAGE_SYM_TYPE_SHORT              = &h0003  ' type short integer.
+Const IMAGE_SYM_TYPE_INT                = &h0004  '
+Const IMAGE_SYM_TYPE_LONG               = &h0005  '
+Const IMAGE_SYM_TYPE_FLOAT              = &h0006  '
+Const IMAGE_SYM_TYPE_DOUBLE             = &h0007  '
+Const IMAGE_SYM_TYPE_STRUCT             = &h0008  '
+Const IMAGE_SYM_TYPE_UNION              = &h0009  '
+Const IMAGE_SYM_TYPE_ENUM               = &h000A  ' enumeration.
+Const IMAGE_SYM_TYPE_MOE                = &h000B  ' member of enumeration.
+Const IMAGE_SYM_TYPE_BYTE               = &h000C  '
+Const IMAGE_SYM_TYPE_WORD               = &h000D  '
+Const IMAGE_SYM_TYPE_UINT               = &h000E  '
+Const IMAGE_SYM_TYPE_DWORD              = &h000F  '
+Const IMAGE_SYM_TYPE_PCODE              = &h8000  '
+
+'Type (derived) values.
+
+Const IMAGE_SYM_DTYPE_NULL              = 0       ' no derived type.
+Const IMAGE_SYM_DTYPE_POINTER           = 1       ' pointer.
+Const IMAGE_SYM_DTYPE_FUNCTION          = 2       ' function.
+Const IMAGE_SYM_DTYPE_ARRAY             = 3       ' array.
+
+' Storage classes.
+Const IMAGE_SYM_CLASS_END_OF_FUNCTION = -1 As Byte
+Const IMAGE_SYM_CLASS_NULL = &h0000
+Const IMAGE_SYM_CLASS_AUTOMATIC = &h0001
+Const IMAGE_SYM_CLASS_EXTERNAL = &h0002
+Const IMAGE_SYM_CLASS_STATIC = &h0003
+Const IMAGE_SYM_CLASS_REGISTER = &h0004
+Const IMAGE_SYM_CLASS_EXTERNAL_DEF = &h0005
+Const IMAGE_SYM_CLASS_LABEL = &h0006
+Const IMAGE_SYM_CLASS_UNDEFINED_LABEL = &h0007
+Const IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = &h0008
+Const IMAGE_SYM_CLASS_ARGUMENT = &h0009
+Const IMAGE_SYM_CLASS_STRUCT_TAG = &h000A
+Const IMAGE_SYM_CLASS_MEMBER_OF_UNION = &h000B
+Const IMAGE_SYM_CLASS_UNION_TAG = &h000C
+Const IMAGE_SYM_CLASS_TYPE_DEFINITION = &h000D
+Const IMAGE_SYM_CLASS_UNDEFINED_STATIC = &h000E
+Const IMAGE_SYM_CLASS_ENUM_TAG = &h000F
+Const IMAGE_SYM_CLASS_MEMBER_OF_ENUM = &h0010
+Const IMAGE_SYM_CLASS_REGISTER_PARAM = &h0011
+Const IMAGE_SYM_CLASS_BIT_FIELD = &h0012
+
+Const IMAGE_SYM_CLASS_FAR_EXTERNAL = &h0044
+
+Const IMAGE_SYM_CLASS_BLOCK = &h0064
+Const IMAGE_SYM_CLASS_FUNCTION = &h0065
+Const IMAGE_SYM_CLASS_END_OF_STRUCT = &h0066
+Const IMAGE_SYM_CLASS_FILE = &h0067
+' new
+Const IMAGE_SYM_CLASS_SECTION = &h0068
+Const IMAGE_SYM_CLASS_WEAK_EXTERNAL = &h0069
+
+Const IMAGE_SYM_CLASS_CLR_TOKEN = &h006B
+
+' type packing constants
+Const N_BTMASK = &h000F
+Const N_TMASK = &h0030
+Const N_TMASK1 = &h00C0
+Const N_TMASK2 = &h00F0
+Const N_BTSHFT = 4
+Const N_TSHIFT = 2
+
+Const BTYPE(x) = ((x) And N_BTMASK)
+Const ISPTR(x) = (((x) And N_TMASK) = (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
+Const ISFCN(x) = (((x) And N_TMASK) = (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
+Const ISARY(x) = (((x) And N_TMASK) = (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
+Const ISTAG(x) = ((x) = IMAGE_SYM_CLASS_STRUCT_TAG Or (x) = IMAGE_SYM_CLASS_UNION_TAG Or (x) = IMAGE_SYM_CLASS_ENUM_TAG)
+Const INCREF(x) = ((((x) And (Not N_BTMASK)) << N_TSHIFT) Or (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT) Or ((x) And N_BTMASK))
+Const DECREF(x) = ((((x) >> N_TSHIFT) And (Not N_BTMASK)) Or ((x) And N_BTMASK))
+
+' Auxiliary entry format.
+Type /*Union*/ Align(2) IMAGE_AUX_SYMBOL
+'	Type
+'		TagIndex As DWord                     ' struct, union, or enum tag index
+'		Union
+'			Type
+'				Linenumber As Word            ' declaration line number
+'				Size As Word                  ' size of struct, union, or enum
+'			} LnSz
+'			TotalSize As DWord
+'		} Misc
+'		Union
+'			Type                              ' if ISFCN, tag, or .bb
+'			PointerToLinenumber As DWord
+'				PointerToNextFunction As DWord
+'			} Function
+'			Type                              ' if ISARY, up to 4 dimen.
+'				Dimension[ELM(4)] As Word
+'			} Array
+'		} FcnAry
+'		TvIndex As Word                       ' tv index
+'	} Sym
+'	Type
+'		Name[ELM(IMAGE_SIZEOF_SYMBOL)] As Byte
+'	} File
+'	Type
+		Length As DWord                 ' section length
+		NumberOfRelocations As Word     ' number of relocation entries
+		NumberOfLinenumbers As Word     ' number of line numbers
+		CheckSum As DWord               ' checksum for communal
+		Number As Integer               ' section number to associate with
+		Selection As Byte               ' communal selection type
+'	} Section
+End Type 'Union
+TypeDef PIMAGE_AUX_SYMBOL = * /*UNALIGNED*/ IMAGE_AUX_SYMBOL
+
+Enum IMAGE_AUX_SYMBOL_TYPE
+	IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1
+End Enum
+
+Type Align(2) IMAGE_AUX_SYMBOL_TOKEN_DEF
+	bAuxType As Byte
+	bReserved As Byte
+	SymbolTableIndex As DWord
+	rgbReserved[ELM(12)] As Byte
+End Type
+TypeDef PIMAGE_AUX_SYMBOL_TOKEN_DEF = * /*UNALIGNED*/ IMAGE_AUX_SYMBOL_TOKEN_DEF
+
+' Communal selection types.
+Const IMAGE_COMDAT_SELECT_NODUPLICATES = 1
+Const IMAGE_COMDAT_SELECT_ANY = 2
+Const IMAGE_COMDAT_SELECT_SAME_SIZE = 3
+Const IMAGE_COMDAT_SELECT_EXACT_MATCH = 4
+Const IMAGE_COMDAT_SELECT_ASSOCIATIVE = 5
+Const IMAGE_COMDAT_SELECT_LARGEST = 6
+Const IMAGE_COMDAT_SELECT_NEWEST = 7
+
+Const IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1
+Const IMAGE_WEAK_EXTERN_SEARCH_LIBRARY = 2
+Const IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
+
+' Relocation format.
+Type Align(2) IMAGE_RELOCATION
+'	Union
+'		VirtualAddress As DWord
+		RelocCount As DWord
+'	End Union
+	SymbolTableIndex As DWord
+	Type_ As Word
+End Type
+TypeDef PIMAGE_RELOCATION = * /*UNALIGNED*/ IMAGE_RELOCATION
+
+' I386 relocation types.
+Const IMAGE_REL_I386_ABSOLUTE       = &h0000  ' Reference is absolute, no relocation is necessary
+Const IMAGE_REL_I386_DIR16          = &h0001  ' Direct 16-bit reference to the symbols virtual address
+Const IMAGE_REL_I386_REL16          = &h0002  ' PC-relative 16-bit reference to the symbols virtual address
+Const IMAGE_REL_I386_DIR32          = &h0006  ' Direct 32-bit reference to the symbols virtual address
+Const IMAGE_REL_I386_DIR32NB        = &h0007  ' Direct 32-bit reference to the symbols virtual address, base not included
+Const IMAGE_REL_I386_SEG12          = &h0009  ' Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
+Const IMAGE_REL_I386_SECTION        = &h000A
+Const IMAGE_REL_I386_SECREL         = &h000B
+Const IMAGE_REL_I386_TOKEN          = &h000C  ' clr token
+Const IMAGE_REL_I386_SECREL7        = &h000D  ' 7 bit offset from base of section containing target
+Const IMAGE_REL_I386_REL32          = &h0014  ' PC-relative 32-bit reference to the symbols virtual address
+
+' MIPS relocation types.
+Const IMAGE_REL_MIPS_ABSOLUTE       = &h0000  ' Reference is absolute, no relocation is necessary
+Const IMAGE_REL_MIPS_REFHALF        = &h0001
+Const IMAGE_REL_MIPS_REFWORD        = &h0002
+Const IMAGE_REL_MIPS_JMPADDR        = &h0003
+Const IMAGE_REL_MIPS_REFHI          = &h0004
+Const IMAGE_REL_MIPS_REFLO          = &h0005
+Const IMAGE_REL_MIPS_GPREL          = &h0006
+Const IMAGE_REL_MIPS_LITERAL        = &h0007
+Const IMAGE_REL_MIPS_SECTION        = &h000A
+Const IMAGE_REL_MIPS_SECREL         = &h000B
+Const IMAGE_REL_MIPS_SECRELLO       = &h000C  ' Low 16-bit section relative referemce (used for >32k TLS)
+Const IMAGE_REL_MIPS_SECRELHI       = &h000D  ' High 16-bit section relative reference (used for >32k TLS)
+Const IMAGE_REL_MIPS_TOKEN          = &h000E  ' clr token
+Const IMAGE_REL_MIPS_JMPADDR16      = &h0010
+Const IMAGE_REL_MIPS_REFWORDNB      = &h0022
+Const IMAGE_REL_MIPS_PAIR           = &h0025
+
+' Alpha Relocation types.
+Const IMAGE_REL_ALPHA_ABSOLUTE      = &h0000
+Const IMAGE_REL_ALPHA_REFLONG       = &h0001
+Const IMAGE_REL_ALPHA_REFQUAD       = &h0002
+Const IMAGE_REL_ALPHA_GPREL32       = &h0003
+Const IMAGE_REL_ALPHA_LITERAL       = &h0004
+Const IMAGE_REL_ALPHA_LITUSE        = &h0005
+Const IMAGE_REL_ALPHA_GPDISP        = &h0006
+Const IMAGE_REL_ALPHA_BRADDR        = &h0007
+Const IMAGE_REL_ALPHA_HINT          = &h0008
+Const IMAGE_REL_ALPHA_INLINE_REFLONG= &h0009
+Const IMAGE_REL_ALPHA_REFHI         = &h000A
+Const IMAGE_REL_ALPHA_REFLO         = &h000B
+Const IMAGE_REL_ALPHA_PAIR          = &h000C
+Const IMAGE_REL_ALPHA_MATCH         = &h000D
+Const IMAGE_REL_ALPHA_SECTION       = &h000E
+Const IMAGE_REL_ALPHA_SECREL        = &h000F
+Const IMAGE_REL_ALPHA_REFLONGNB     = &h0010
+Const IMAGE_REL_ALPHA_SECRELLO      = &h0011  ' Low 16-bit section relative reference
+Const IMAGE_REL_ALPHA_SECRELHI      = &h0012  ' High 16-bit section relative reference
+Const IMAGE_REL_ALPHA_REFQ3         = &h0013  ' High 16 bits of 48 bit reference
+Const IMAGE_REL_ALPHA_REFQ2         = &h0014  ' Middle 16 bits of 48 bit reference
+Const IMAGE_REL_ALPHA_REFQ1         = &h0015  ' Low 16 bits of 48 bit reference
+Const IMAGE_REL_ALPHA_GPRELLO       = &h0016  ' Low 16-bit GP relative reference
+Const IMAGE_REL_ALPHA_GPRELHI       = &h0017  ' High 16-bit GP relative reference
+
+' IBM PowerPC relocation types.
+Const IMAGE_REL_PPC_ABSOLUTE        = &h0000  ' NOP
+Const IMAGE_REL_PPC_ADDR64          = &h0001  ' 64-bit address
+Const IMAGE_REL_PPC_ADDR32          = &h0002  ' 32-bit address
+Const IMAGE_REL_PPC_ADDR24          = &h0003  ' 26-bit address, shifted left 2 (branch absolute)
+Const IMAGE_REL_PPC_ADDR16          = &h0004  ' 16-bit address
+Const IMAGE_REL_PPC_ADDR14          = &h0005  ' 16-bit address, shifted left 2 (load doubleword)
+Const IMAGE_REL_PPC_REL24           = &h0006  ' 26-bit PC-relative offset, shifted left 2 (branch relative)
+Const IMAGE_REL_PPC_REL14           = &h0007  ' 16-bit PC-relative offset, shifted left 2 (br cond relative)
+Const IMAGE_REL_PPC_TOCREL16        = &h0008  ' 16-bit offset from TOC base
+Const IMAGE_REL_PPC_TOCREL14        = &h0009  ' 16-bit offset from TOC base, shifted left 2 (load doubleword)
+
+Const IMAGE_REL_PPC_ADDR32NB        = &h000A  ' 32-bit addr w/o image base
+Const IMAGE_REL_PPC_SECREL          = &h000B  ' va of containing section (as in an image sectionhdr)
+Const IMAGE_REL_PPC_SECTION         = &h000C  ' sectionheader number
+Const IMAGE_REL_PPC_IFGLUE          = &h000D  ' substitute TOC restore instruction iff symbol is glue code
+Const IMAGE_REL_PPC_IMGLUE          = &h000E  ' symbol is glue code; virtual address is TOC restore instruction
+Const IMAGE_REL_PPC_SECREL16        = &h000F  ' va of containing section (limited to 16 bits)
+Const IMAGE_REL_PPC_REFHI           = &h0010
+Const IMAGE_REL_PPC_REFLO           = &h0011
+Const IMAGE_REL_PPC_PAIR            = &h0012
+Const IMAGE_REL_PPC_SECRELLO        = &h0013  ' Low 16-bit section relative reference (used for >32k TLS)
+Const IMAGE_REL_PPC_SECRELHI        = &h0014  ' High 16-bit section relative reference (used for >32k TLS)
+Const IMAGE_REL_PPC_GPREL           = &h0015
+Const IMAGE_REL_PPC_TOKEN           = &h0016  ' clr token
+
+Const IMAGE_REL_PPC_TYPEMASK        = &h00FF  ' mask to isolate above values in IMAGE_RELOCATION.Type
+
+' Flag bits in IMAGE_RELOCATION.TYPE
+
+Const IMAGE_REL_PPC_NEG             = &h0100  ' subtract reloc value rather than adding it
+Const IMAGE_REL_PPC_BRTAKEN         = &h0200  ' fix branch prediction bit to predict branch taken
+Const IMAGE_REL_PPC_BRNTAKEN        = &h0400  ' fix branch prediction bit to predict branch not taken
+Const IMAGE_REL_PPC_TOCDEFN         = &h0800  ' toc slot defined in file (or, data in toc)
+
+' Hitachi SH3 relocation types.
+Const IMAGE_REL_SH3_ABSOLUTE        = &h0000  ' No relocation
+Const IMAGE_REL_SH3_DIRECT16        = &h0001  ' 16 bit direct
+Const IMAGE_REL_SH3_DIRECT32        = &h0002  ' 32 bit direct
+Const IMAGE_REL_SH3_DIRECT8         = &h0003  ' 8 bit direct, -128..255
+Const IMAGE_REL_SH3_DIRECT8_WORD    = &h0004  ' 8 bit direct .W (0 ext.)
+Const IMAGE_REL_SH3_DIRECT8_LONG    = &h0005  ' 8 bit direct .L (0 ext.)
+Const IMAGE_REL_SH3_DIRECT4         = &h0006  ' 4 bit direct (0 ext.)
+Const IMAGE_REL_SH3_DIRECT4_WORD    = &h0007  ' 4 bit direct .W (0 ext.)
+Const IMAGE_REL_SH3_DIRECT4_LONG    = &h0008  ' 4 bit direct .L (0 ext.)
+Const IMAGE_REL_SH3_PCREL8_WORD     = &h0009  ' 8 bit PC relative .W
+Const IMAGE_REL_SH3_PCREL8_LONG     = &h000A  ' 8 bit PC relative .L
+Const IMAGE_REL_SH3_PCREL12_WORD    = &h000B  ' 12 LSB PC relative .W
+Const IMAGE_REL_SH3_STARTOF_SECTION = &h000C  ' Start of EXE section
+Const IMAGE_REL_SH3_SIZEOF_SECTION  = &h000D  ' Size of EXE section
+Const IMAGE_REL_SH3_SECTION         = &h000E  ' Section table index
+Const IMAGE_REL_SH3_SECREL          = &h000F  ' Offset within section
+Const IMAGE_REL_SH3_DIRECT32_NB     = &h0010  ' 32 bit direct not based
+Const IMAGE_REL_SH3_GPREL4_LONG     = &h0011  ' GP-relative addressing
+Const IMAGE_REL_SH3_TOKEN           = &h0012  ' clr token
+Const IMAGE_REL_SHM_PCRELPT         = &h0013  ' Offset from current
+                                                '  instruction in longwords
+                                                '  if not NOMODE, insert the
+                                                '  inverse of the low bit at
+                                                '  bit 32 to select PTA/PTB
+Const IMAGE_REL_SHM_REFLO           = &h0014  ' Low bits of 32-bit address
+Const IMAGE_REL_SHM_REFHALF         = &h0015  ' High bits of 32-bit address
+Const IMAGE_REL_SHM_RELLO           = &h0016  ' Low bits of relative reference
+Const IMAGE_REL_SHM_RELHALF         = &h0017  ' High bits of relative reference
+Const IMAGE_REL_SHM_PAIR            = &h0018  ' offset operand for relocation
+
+Const IMAGE_REL_SH_NOMODE           = &h8000  ' relocation ignores section mode
+
+
+Const IMAGE_REL_ARM_ABSOLUTE        = &h0000  ' No relocation required
+Const IMAGE_REL_ARM_ADDR32          = &h0001  ' 32 bit address
+Const IMAGE_REL_ARM_ADDR32NB        = &h0002  ' 32 bit address w/o image base
+Const IMAGE_REL_ARM_BRANCH24        = &h0003  ' 24 bit offset << 2 & sign ext.
+Const IMAGE_REL_ARM_BRANCH11        = &h0004  ' Thumb: 2 11 bit offsets
+Const IMAGE_REL_ARM_TOKEN           = &h0005  ' clr token
+Const IMAGE_REL_ARM_GPREL12         = &h0006  ' GP-relative addressing (ARM)
+Const IMAGE_REL_ARM_GPREL7          = &h0007  ' GP-relative addressing (Thumb)
+Const IMAGE_REL_ARM_BLX24           = &h0008
+Const IMAGE_REL_ARM_BLX11           = &h0009
+Const IMAGE_REL_ARM_SECTION         = &h000E  ' Section table index
+Const IMAGE_REL_ARM_SECREL          = &h000F  ' Offset within section
+
+Const IMAGE_REL_AM_ABSOLUTE         = &h0000
+Const IMAGE_REL_AM_ADDR32           = &h0001
+Const IMAGE_REL_AM_ADDR32NB         = &h0002
+Const IMAGE_REL_AM_CALL32           = &h0003
+Const IMAGE_REL_AM_FUNCINFO         = &h0004
+Const IMAGE_REL_AM_REL32_1          = &h0005
+Const IMAGE_REL_AM_REL32_2          = &h0006
+Const IMAGE_REL_AM_SECREL           = &h0007
+Const IMAGE_REL_AM_SECTION          = &h0008
+Const IMAGE_REL_AM_TOKEN            = &h0009
+
+' x64 relocations
+Const IMAGE_REL_AMD64_ABSOLUTE      = &h0000  ' Reference is absolute, no relocation is necessary
+Const IMAGE_REL_AMD64_ADDR64        = &h0001  ' 64-bit address (VA).
+Const IMAGE_REL_AMD64_ADDR32        = &h0002  ' 32-bit address (VA).
+Const IMAGE_REL_AMD64_ADDR32NB      = &h0003  ' 32-bit address w/o image base (RVA).
+Const IMAGE_REL_AMD64_REL32         = &h0004  ' 32-bit relative address from byte following reloc
+Const IMAGE_REL_AMD64_REL32_1       = &h0005  ' 32-bit relative address from byte distance 1 from reloc
+Const IMAGE_REL_AMD64_REL32_2       = &h0006  ' 32-bit relative address from byte distance 2 from reloc
+Const IMAGE_REL_AMD64_REL32_3       = &h0007  ' 32-bit relative address from byte distance 3 from reloc
+Const IMAGE_REL_AMD64_REL32_4       = &h0008  ' 32-bit relative address from byte distance 4 from reloc
+Const IMAGE_REL_AMD64_REL32_5       = &h0009  ' 32-bit relative address from byte distance 5 from reloc
+Const IMAGE_REL_AMD64_SECTION       = &h000A  ' Section index
+Const IMAGE_REL_AMD64_SECREL        = &h000B  ' 32 bit offset from base of section containing target
+Const IMAGE_REL_AMD64_SECREL7       = &h000C  ' 7 bit unsigned offset from base of section containing target
+Const IMAGE_REL_AMD64_TOKEN         = &h000D  ' 32 bit metadata token
+Const IMAGE_REL_AMD64_SREL32        = &h000E  ' 32 bit signed span-dependent value emitted into object
+Const IMAGE_REL_AMD64_PAIR          = &h000F
+Const IMAGE_REL_AMD64_SSPAN32       = &h0010  ' 32 bit signed span-dependent value applied at link time
+
+' IA64 relocation types.
+
+Const IMAGE_REL_IA64_ABSOLUTE       = &h0000
+Const IMAGE_REL_IA64_IMM14          = &h0001
+Const IMAGE_REL_IA64_IMM22          = &h0002
+Const IMAGE_REL_IA64_IMM64          = &h0003
+Const IMAGE_REL_IA64_DIR32          = &h0004
+Const IMAGE_REL_IA64_DIR64          = &h0005
+Const IMAGE_REL_IA64_PCREL21B       = &h0006
+Const IMAGE_REL_IA64_PCREL21M       = &h0007
+Const IMAGE_REL_IA64_PCREL21F       = &h0008
+Const IMAGE_REL_IA64_GPREL22        = &h0009
+Const IMAGE_REL_IA64_LTOFF22        = &h000A
+Const IMAGE_REL_IA64_SECTION        = &h000B
+Const IMAGE_REL_IA64_SECREL22       = &h000C
+Const IMAGE_REL_IA64_SECREL64I      = &h000D
+Const IMAGE_REL_IA64_SECREL32       = &h000E
+'
+Const IMAGE_REL_IA64_DIR32NB        = &h0010
+Const IMAGE_REL_IA64_SREL14         = &h0011
+Const IMAGE_REL_IA64_SREL22         = &h0012
+Const IMAGE_REL_IA64_SREL32         = &h0013
+Const IMAGE_REL_IA64_UREL32         = &h0014
+Const IMAGE_REL_IA64_PCREL60X       = &h0015  ' This is always a BRL and never converted
+Const IMAGE_REL_IA64_PCREL60B       = &h0016  ' If possible, convert to MBB bundle with NOP.B in slot 1
+Const IMAGE_REL_IA64_PCREL60F       = &h0017  ' If possible, convert to MFB bundle with NOP.F in slot 1
+Const IMAGE_REL_IA64_PCREL60I       = &h0018  ' If possible, convert to MIB bundle with NOP.I in slot 1
+Const IMAGE_REL_IA64_PCREL60M       = &h0019  ' If possible, convert to MMB bundle with NOP.M in slot 1
+Const IMAGE_REL_IA64_IMMGPREL64     = &h001A
+Const IMAGE_REL_IA64_TOKEN          = &h001B  ' clr token
+Const IMAGE_REL_IA64_GPREL32        = &h001C
+Const IMAGE_REL_IA64_ADDEND         = &h001F
+
+' CEF relocation types.
+Const IMAGE_REL_CEF_ABSOLUTE        = &h0000  ' Reference is absolute, no relocation is necessary
+Const IMAGE_REL_CEF_ADDR32          = &h0001  ' 32-bit address (VA).
+Const IMAGE_REL_CEF_ADDR64          = &h0002  ' 64-bit address (VA).
+Const IMAGE_REL_CEF_ADDR32NB        = &h0003  ' 32-bit address w/o image base (RVA).
+Const IMAGE_REL_CEF_SECTION         = &h0004  ' Section index
+Const IMAGE_REL_CEF_SECREL          = &h0005  ' 32 bit offset from base of section containing target
+Const IMAGE_REL_CEF_TOKEN           = &h0006  ' 32 bit metadata token
+
+' clr relocation types.
+Const IMAGE_REL_CEE_ABSOLUTE        = &h0000  ' Reference is absolute, no relocation is necessary
+Const IMAGE_REL_CEE_ADDR32          = &h0001  ' 32-bit address (VA).
+Const IMAGE_REL_CEE_ADDR64          = &h0002  ' 64-bit address (VA).
+Const IMAGE_REL_CEE_ADDR32NB        = &h0003  ' 32-bit address w/o image base (RVA).
+Const IMAGE_REL_CEE_SECTION         = &h0004  ' Section index
+Const IMAGE_REL_CEE_SECREL          = &h0005  ' 32 bit offset from base of section containing target
+Const IMAGE_REL_CEE_TOKEN           = &h0006  ' 32 bit metadata token
+
+
+Const IMAGE_REL_M32R_ABSOLUTE       = &h0000  ' No relocation required
+Const IMAGE_REL_M32R_ADDR32         = &h0001  ' 32 bit address
+Const IMAGE_REL_M32R_ADDR32NB       = &h0002  ' 32 bit address w/o image base
+Const IMAGE_REL_M32R_ADDR24         = &h0003  ' 24 bit address
+Const IMAGE_REL_M32R_GPREL16        = &h0004  ' GP relative addressing
+Const IMAGE_REL_M32R_PCREL24        = &h0005  ' 24 bit offset << 2 & sign ext.
+Const IMAGE_REL_M32R_PCREL16        = &h0006  ' 16 bit offset << 2 & sign ext.
+Const IMAGE_REL_M32R_PCREL8         = &h0007  ' 8 bit offset << 2 & sign ext.
+Const IMAGE_REL_M32R_REFHALF        = &h0008  ' 16 MSBs
+Const IMAGE_REL_M32R_REFHI          = &h0009  ' 16 MSBs; adj for LSB sign ext.
+Const IMAGE_REL_M32R_REFLO          = &h000A  ' 16 LSBs
+Const IMAGE_REL_M32R_PAIR           = &h000B  ' Link HI and LO
+Const IMAGE_REL_M32R_SECTION        = &h000C  ' Section table index
+Const IMAGE_REL_M32R_SECREL32       = &h000D  ' 32 bit section relative reference
+Const IMAGE_REL_M32R_TOKEN          = &h000E  ' clr token
+
+Const IMAGE_REL_EBC_ABSOLUTE        = &h0000  ' No relocation required
+Const IMAGE_REL_EBC_ADDR32NB        = &h0001  ' 32 bit address w/o image base
+Const IMAGE_REL_EBC_REL32           = &h0002  ' 32-bit relative address from byte following reloc
+Const IMAGE_REL_EBC_SECTION         = &h0003  ' Section table index
+Const IMAGE_REL_EBC_SECREL          = &h0004  ' Offset within section
+
+'Const EXT_IMM64(Value, Address, Size, InstPos, ValPos)  /* Intel-IA64-Filler * /           \
+'    Value |= (((ULONGLONG)((*(Address) >> InstPos) & (((ULONGLONG)1 << Size) - 1))) << ValPos)  // Intel-IA64-Filler
+
+'Const INS_IMM64(Value, Address, Size, InstPos, ValPos)  /* Intel-IA64-Filler * /\
+'    *(PDWORD)Address = (*(PDWORD)Address & ~(((1 << Size) - 1) << InstPos)) | /* Intel-IA64-Filler * /\
+'          ((DWORD)((((ULONGLONG)Value >> ValPos) & (((ULONGLONG)1 << Size) - 1))) << InstPos)  // Intel-IA64-Filler
+
+Const EMARCH_ENC_I17_IMM7B_INST_WORD_X       = 3  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM7B_SIZE_X            = 7  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X   = 4  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM7B_VAL_POS_X         = 0  ' Intel-IA64-Filler
+
+Const EMARCH_ENC_I17_IMM9D_INST_WORD_X       = 3  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM9D_SIZE_X            = 9  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X   = 18 ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM9D_VAL_POS_X         = 7  ' Intel-IA64-Filler
+
+Const EMARCH_ENC_I17_IMM5C_INST_WORD_X       = 3  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM5C_SIZE_X            = 5  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X   = 13 ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM5C_VAL_POS_X         = 16 ' Intel-IA64-Filler
+
+Const EMARCH_ENC_I17_IC_INST_WORD_X          = 3  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IC_SIZE_X               = 1  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IC_INST_WORD_POS_X      = 12 ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IC_VAL_POS_X            = 21 ' Intel-IA64-Filler
+
+Const EMARCH_ENC_I17_IMM41a_INST_WORD_X      = 1  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM41a_SIZE_X           = 10 ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM41a_INST_WORD_POS_X  = 14 ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM41a_VAL_POS_X        = 22 ' Intel-IA64-Filler
+
+Const EMARCH_ENC_I17_IMM41b_INST_WORD_X      = 1  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM41b_SIZE_X           = 8  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM41b_INST_WORD_POS_X  = 24 ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM41b_VAL_POS_X        = 32 ' Intel-IA64-Filler
+
+Const EMARCH_ENC_I17_IMM41c_INST_WORD_X      = 2  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM41c_SIZE_X           = 23 ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM41c_INST_WORD_POS_X  = 0  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_IMM41c_VAL_POS_X        = 40 ' Intel-IA64-Filler
+
+Const EMARCH_ENC_I17_SIGN_INST_WORD_X        = 3  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_SIGN_SIZE_X             = 1  ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_SIGN_INST_WORD_POS_X    = 27 ' Intel-IA64-Filler
+Const EMARCH_ENC_I17_SIGN_VAL_POS_X          = 63 ' Intel-IA64-Filler
+
+Const X3_OPCODE_INST_WORD_X                  = 3  ' Intel-IA64-Filler
+Const X3_OPCODE_SIZE_X                       = 4  ' Intel-IA64-Filler
+Const X3_OPCODE_INST_WORD_POS_X              = 28 ' Intel-IA64-Filler
+Const X3_OPCODE_SIGN_VAL_POS_X               = 0  ' Intel-IA64-Filler
+
+Const X3_I_INST_WORD_X                       = 3  ' Intel-IA64-Filler
+Const X3_I_SIZE_X                            = 1  ' Intel-IA64-Filler
+Const X3_I_INST_WORD_POS_X                   = 27 ' Intel-IA64-Filler
+Const X3_I_SIGN_VAL_POS_X                    = 59 ' Intel-IA64-Filler
+
+Const X3_D_WH_INST_WORD_X                    = 3  ' Intel-IA64-Filler
+Const X3_D_WH_SIZE_X                         = 3  ' Intel-IA64-Filler
+Const X3_D_WH_INST_WORD_POS_X                = 24 ' Intel-IA64-Filler
+Const X3_D_WH_SIGN_VAL_POS_X                 = 0  ' Intel-IA64-Filler
+
+Const X3_IMM20_INST_WORD_X                   = 3  ' Intel-IA64-Filler
+Const X3_IMM20_SIZE_X                        = 20 ' Intel-IA64-Filler
+Const X3_IMM20_INST_WORD_POS_X               = 4  ' Intel-IA64-Filler
+Const X3_IMM20_SIGN_VAL_POS_X                = 0  ' Intel-IA64-Filler
+
+Const X3_IMM39_1_INST_WORD_X                 = 2  ' Intel-IA64-Filler
+Const X3_IMM39_1_SIZE_X                      = 23 ' Intel-IA64-Filler
+Const X3_IMM39_1_INST_WORD_POS_X             = 0  ' Intel-IA64-Filler
+Const X3_IMM39_1_SIGN_VAL_POS_X              = 36 ' Intel-IA64-Filler
+
+Const X3_IMM39_2_INST_WORD_X                 = 1  ' Intel-IA64-Filler
+Const X3_IMM39_2_SIZE_X                      = 16 ' Intel-IA64-Filler
+Const X3_IMM39_2_INST_WORD_POS_X             = 16 ' Intel-IA64-Filler
+Const X3_IMM39_2_SIGN_VAL_POS_X              = 20 ' Intel-IA64-Filler
+
+Const X3_P_INST_WORD_X                       = 3  ' Intel-IA64-Filler
+Const X3_P_SIZE_X                            = 4  ' Intel-IA64-Filler
+Const X3_P_INST_WORD_POS_X                   = 0  ' Intel-IA64-Filler
+Const X3_P_SIGN_VAL_POS_X                    = 0  ' Intel-IA64-Filler
+
+Const X3_TMPLT_INST_WORD_X                   = 0  ' Intel-IA64-Filler
+Const X3_TMPLT_SIZE_X                        = 4  ' Intel-IA64-Filler
+Const X3_TMPLT_INST_WORD_POS_X               = 0  ' Intel-IA64-Filler
+Const X3_TMPLT_SIGN_VAL_POS_X                = 0  ' Intel-IA64-Filler
+
+Const X3_BTYPE_QP_INST_WORD_X                = 2  ' Intel-IA64-Filler
+Const X3_BTYPE_QP_SIZE_X                     = 9  ' Intel-IA64-Filler
+Const X3_BTYPE_QP_INST_WORD_POS_X            = 23 ' Intel-IA64-Filler
+Const X3_BTYPE_QP_INST_VAL_POS_X             = 0  ' Intel-IA64-Filler
+
+Const X3_EMPTY_INST_WORD_X                   = 1  ' Intel-IA64-Filler
+Const X3_EMPTY_SIZE_X                        = 2  ' Intel-IA64-Filler
+Const X3_EMPTY_INST_WORD_POS_X               = 14 ' Intel-IA64-Filler
+Const X3_EMPTY_INST_VAL_POS_X                = 0  ' Intel-IA64-Filler
+
+' Line number format.
+Type Align(2) IMAGE_LINENUMBER
+'	Union
+		SymbolTableIndex As DWord
+'		VirtualAddress As DWord
+'	End Union
+	Linenumber As Word
+End Type
+TypeDef PIMAGE_LINENUMBER = * /*UNALIGNED*/ IMAGE_LINENUMBER
+
+' Based relocation format.
+Type IMAGE_BASE_RELOCATION
+	VirtualAddress As DWord
+	SizeOfBlock As DWord
+'	TypeOffset[ELM(1)] As Word
+End Type
+TypeDef PIMAGE_BASE_RELOCATION = * /*UNALIGNED*/ IMAGE_BASE_RELOCATION
+
+' Based relocation types.
+Const IMAGE_REL_BASED_ABSOLUTE = 0
+Const IMAGE_REL_BASED_HIGH = 1
+Const IMAGE_REL_BASED_LOW = 2
+Const IMAGE_REL_BASED_HIGHLOW = 3
+Const IMAGE_REL_BASED_HIGHADJ = 4
+Const IMAGE_REL_BASED_MIPS_JMPADDR = 5
+Const IMAGE_REL_BASED_MIPS_JMPADDR16 = 9
+Const IMAGE_REL_BASED_IA64_IMM64 = 9
+Const IMAGE_REL_BASED_DIR64 = 10
+
+' Archive format.
+Const IMAGE_ARCHIVE_START_SIZE = 8
+Const IMAGE_ARCHIVE_START = Ex"!<arch>\n"
+Const IMAGE_ARCHIVE_END = Ex"`\n"
+Const IMAGE_ARCHIVE_PAD = Ex"\n"
+Const IMAGE_ARCHIVE_LINKER_MEMBER = Ex"/               "
+Const IMAGE_ARCHIVE_LONGNAMES_MEMBER = Ex"//              "
+
+Type IMAGE_ARCHIVE_MEMBER_HEADER
+	Name[ELM(16)] As Byte
+	Date[ELM(12)] As Byte
+	UserID[ELM(6)] As Byte
+	GroupID[ELM(6)] As Byte
+	Mode[ELM(8)] As Byte
+	Size[ELM(10)] As Byte
+	EndHeader[ELM(2)] As Byte
+End Type
+TypeDef PIMAGE_ARCHIVE_MEMBER_HEADER = *IMAGE_ARCHIVE_MEMBER_HEADER
+
+Const IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR = 60
+
+' DLL support.
+
+' Export Format
+Type IMAGE_EXPORT_DIRECTORY
+	Characteristics As DWord
+	TimeDateStamp As DWord
+	MajorVersion As DWord
+	MinorVersion As DWord
+	Name As Word
+	Base As Word
+	NumberOfFunctions As DWord
+	NumberOfNames As DWord
+	AddressOfFunctions As DWord
+	AddressOfNames As DWord
+	AddressOfNameOrdinals As DWord
+End Type
+TypeDef PIMAGE_EXPORT_DIRECTORY = *IMAGE_EXPORT_DIRECTORY
+
+' Import Format
+Type IMAGE_IMPORT_BY_NAME
+	Hint As Word
+	Name[ELM(1)] As Byte
+End Type
+TypeDef PIMAGE_IMPORT_BY_NAME = *IMAGE_IMPORT_BY_NAME
+
+Type Align(8) IMAGE_THUNK_DATA64
+'	Union
+		ForwarderString As QWord 'PBYTE
+'		Function_ As QWord 'PDWORD
+'		Ordinal As QWord
+'		AddressOfData As QWord 'PIMAGE_IMPORT_BY_NAME
+'	} u1
+End Type
+TypeDef PIMAGE_THUNK_DATA64 = *IMAGE_THUNK_DATA64
+
+Type IMAGE_THUNK_DATA32
+'	Union
+		ForwarderString As DWORD 'PBYTE
+'		Function_ As DWORD 'PDWORD
+'		Ordinal As DWORD
+'		AddressOfData As DWORD 'PIMAGE_IMPORT_BY_NAME
+'	} u1
+End Type
+TypeDef PIMAGE_THUNK_DATA32 = *IMAGE_THUNK_DATA32
+
+Const IMAGE_ORDINAL_FLAG64 = &h8000000000000000
+Const IMAGE_ORDINAL_FLAG32 = &h80000000
+Const IMAGE_ORDINAL64(Ordinal) = (Ordinal And &hffff)
+Const IMAGE_ORDINAL32(Ordinal) = (Ordinal And &hffff)
+Const IMAGE_SNAP_BY_ORDINAL64(Ordinal) = ((Ordinal And IMAGE_ORDINAL_FLAG64) <> 0)
+Const IMAGE_SNAP_BY_ORDINAL32(Ordinal) = ((Ordinal And IMAGE_ORDINAL_FLAG32) <> 0)
+
+' Thread Local Storage
+TypeDef PIMAGE_TLS_CALLBACK = *Sub(DllHandle As PVOID, Reason As DWord, Reserved As PVOID)
+
+Type IMAGE_TLS_DIRECTORY64
+	StartAddressOfRawData As QWord
+	EndAddressOfRawData As QWord
+	AddressOfIndex As QWord 'PDWORD
+	AddressOfCallBacks As QWord 'PIMAGE_TLS_CALLBACK *
+	SizeOfZeroFill As DWord
+	Characteristics As DWord
+End Type
+TypeDef PIMAGE_TLS_DIRECTORY64 = *IMAGE_TLS_DIRECTORY64
+
+Type IMAGE_TLS_DIRECTORY32
+	StartAddressOfRawData As DWord
+	EndAddressOfRawData As DWord
+	AddressOfIndex As DWord 'PDWORD
+	AddressOfCallBacks As DWord 'PIMAGE_TLS_CALLBACK *
+	SizeOfZeroFill As DWord
+	Characteristics As DWord
+End Type
+TypeDef PIMAGE_TLS_DIRECTORY32 = *IMAGE_TLS_DIRECTORY32
+
+#ifdef _WIN64
+Const IMAGE_ORDINAL_FLAG = IMAGE_ORDINAL_FLAG64
+Const IMAGE_ORDINAL(Ordinal) = IMAGE_ORDINAL64(Ordinal)
+TypeDef IMAGE_THUNK_DATA = IMAGE_THUNK_DATA64
+TypeDef PIMAGE_THUNK_DATA = PIMAGE_THUNK_DATA64
+Const IMAGE_SNAP_BY_ORDINAL(Ordinal) = IMAGE_SNAP_BY_ORDINAL64(Ordinal)
+TypeDef IMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY64
+TypeDef PIMAGE_TLS_DIRECTORY = PIMAGE_TLS_DIRECTORY64
+#else
+Const IMAGE_ORDINAL_FLAG = IMAGE_ORDINAL_FLAG32
+Const IMAGE_ORDINAL(Ordinal) = IMAGE_ORDINAL32(Ordinal)
+TypeDef IMAGE_THUNK_DATA = IMAGE_THUNK_DATA32
+TypeDef PIMAGE_THUNK_DATA = PIMAGE_THUNK_DATA32
+Const IMAGE_SNAP_BY_ORDINAL(Ordinal) = IMAGE_SNAP_BY_ORDINAL32(Ordinal)
+TypeDef IMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY32
+TypeDef PIMAGE_TLS_DIRECTORY = PIMAGE_TLS_DIRECTORY32
+#endif
+
+Type IMAGE_IMPORT_DESCRIPTOR
+'	Union
+		Characteristics As DWord
+'		OriginalFirstThunk As DWord
+'	End Union
+	TimeDateStamp As DWord
+	ForwarderChain As DWord
+	Name As DWord
+	FirstThunk As DWord
+End Type
+TypeDef PIMAGE_IMPORT_DESCRIPTOR = * /*UNALIGNED*/ IMAGE_IMPORT_DESCRIPTOR
+
+' New format import descriptors pointed to by DataDirectory[ IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT ]
+Type IMAGE_BOUND_IMPORT_DESCRIPTOR
+	TimeDateStamp As DWord
+	OffsetModuleName As Word
+	NumberOfModuleForwarderRefs As Word
+End Type
+TypeDef PIMAGE_BOUND_IMPORT_DESCRIPTOR = IMAGE_BOUND_IMPORT_DESCRIPTOR
+
+Type IMAGE_BOUND_FORWARDER_REF
+	TimeDateStamp As DWord
+	OffsetModuleName As Word
+	Reserved As Word
+End Type
+TypeDef PIMAGE_BOUND_FORWARDER_REF = *IMAGE_BOUND_FORWARDER_REF
+
+' Resource Format.
+Type IMAGE_RESOURCE_DIRECTORY
+	Characteristics As DWord
+	TimeDateStamp As DWord
+	MajorVersion As Word
+	MinorVersion As Word
+	NumberOfNamedEntries As Word
+	NumberOfIdEntries As Word
+End Type
+TypeDef PIMAGE_RESOURCE_DIRECTORY = *IMAGE_RESOURCE_DIRECTORY
+
+Const IMAGE_RESOURCE_NAME_IS_STRING = &h80000000
+Const IMAGE_RESOURCE_DATA_IS_DIRECTORY = &h80000000
+
+Type IMAGE_RESOURCE_DIRECTORY_ENTRY
+'	Union
+'		Type
+'			NameOffset : 31 As DWord
+'			NameIsString :  As DWord
+'		End Type
+		Name As DWord
+'		Id As DWord
+'	End Union
+'	Union
+		OffsetToData As DWord
+'		Type
+'			OffsetToDirectory : 31 As DWord
+'			DataIsDirectory : 1 As DWord
+'		End Type
+'	End Union
+End Type
+TypeDef PIMAGE_RESOURCE_DIRECTORY_ENTRY = *IMAGE_RESOURCE_DIRECTORY_ENTRY
+
+Type IMAGE_RESOURCE_DIRECTORY_STRING
+	Length As Word
+	NameString[ELM(1)] As CHAR
+End Type
+TypeDef PIMAGE_RESOURCE_DIRECTORY_STRING = *IMAGE_RESOURCE_DIRECTORY_STRING
+
+Type IMAGE_RESOURCE_DIR_STRING_U
+	Length As Word
+	NameString[ELM(1)] As WCHAR
+End Type
+TypeDef PIMAGE_RESOURCE_DIR_STRING_U = *IMAGE_RESOURCE_DIR_STRING_U
+
+Type IMAGE_RESOURCE_DATA_ENTRY
+	OffsetToData As DWord
+	Size As DWord
+	CodePage As DWord
+	Reserved As DWord
+End Type
+TypeDef PIMAGE_RESOURCE_DATA_ENTRY = *IMAGE_RESOURCE_DATA_ENTRY
+
+' Load Configuration Directory Entry
+
+Type IMAGE_LOAD_CONFIG_DIRECTORY32
+	Size As DWord
+	TimeDateStamp As DWord
+	MajorVersion As Word
+	MinorVersion As Word
+	GlobalFlagsClear As DWord
+	GlobalFlagsSet As DWord
+	CriticalSectionDefaultTimeout As DWord
+	DeCommitFreeBlockThreshold As DWord
+	DeCommitTotalFreeThreshold As DWord
+	LockPrefixTable As DWord
+	MaximumAllocationSize As DWord
+	VirtualMemoryThreshold As DWord
+	ProcessHeapFlags As DWord
+	ProcessAffinityMask As DWord
+	CSDVersion As Word
+	Reserved1 As Word
+	EditList As DWord
+	SecurityCookie As DWord
+	SEHandlerTable As DWord
+	SEHandlerCount As DWord
+End Type
+TypeDef PIMAGE_LOAD_CONFIG_DIRECTORY32 = *IMAGE_LOAD_CONFIG_DIRECTORY32
+
+Type IMAGE_LOAD_CONFIG_DIRECTORY64
+	Size As DWord
+	TimeDateStamp As DWord
+	MajorVersion As Word
+	MinorVersion As Word
+	GlobalFlagsClear As DWord
+	GlobalFlagsSet As DWord
+	CriticalSectionDefaultTimeout As DWord
+	DeCommitFreeBlockThreshold As QWord
+	DeCommitTotalFreeThreshold As QWord
+	LockPrefixTable As QWord
+	MaximumAllocationSize As QWord
+	VirtualMemoryThreshold As QWord
+	ProcessAffinityMask As QWord
+	ProcessHeapFlags As DWord
+	CSDVersion As Word
+	Reserved1 As Word
+	EditList As QWord
+	SecurityCookie As QWord
+	SEHandlerTable As QWord
+	SEHandlerCount As QWord
+End Type
+TypeDef PIMAGE_LOAD_CONFIG_DIRECTORY64 = *IMAGE_LOAD_CONFIG_DIRECTORY64
+
+#ifdef _WIN64
+TypeDef IMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY64
+TypeDef PIMAGE_LOAD_CONFIG_DIRECTORY = PIMAGE_LOAD_CONFIG_DIRECTORY64
+#else
+TypeDef IMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY32
+TypeDef PIMAGE_LOAD_CONFIG_DIRECTORY = PIMAGE_LOAD_CONFIG_DIRECTORY32
+#endif
+
+' WIN CE Exception table format
+
+' Function table entry format
+
+Type IMAGE_CE_RUNTIME_FUNCTION_ENTRY
+	FuncStart As DWord
+	dummy As DWord
+'	PrologLen : 8 As DWord
+'	FuncLen : 22 As DWord
+'	ThirtyTwoBit : 1 As DWord
+'	ExceptionFlag : 1 As DWord
+End Type
+TypeDef PIMAGE_CE_RUNTIME_FUNCTION_ENTRY = *IMAGE_CE_RUNTIME_FUNCTION_ENTRY
+
+Type IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY
+	BeginAddress As QWord
+	EndAddress As QWord
+	ExceptionHandler As QWord
+	HandlerData As QWord
+	PrologEndAddress As QWord
+End Type
+TypeDef PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY = *IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY
+
+Type IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY
+	BeginAddress As DWord
+	EndAddress As DWord
+	ExceptionHandler As DWord
+	HandlerData As DWord
+	PrologEndAddress As DWord
+End Type
+TypeDef PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY = *IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY
+
+Type _IMAGE_RUNTIME_FUNCTION_ENTRY
+	BeginAddress As DWord
+	EndAddress As DWord
+	UnwindInfoAddress As DWord
+End Type
+TypeDef _PIMAGE_RUNTIME_FUNCTION_ENTRY = *_IMAGE_RUNTIME_FUNCTION_ENTRY
+
+TypeDef IMAGE_IA64_RUNTIME_FUNCTION_ENTRY = _IMAGE_RUNTIME_FUNCTION_ENTRY
+TypeDef PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY = _PIMAGE_RUNTIME_FUNCTION_ENTRY
+
+TypeDef IMAGE_RUNTIME_FUNCTION_ENTRY = _IMAGE_RUNTIME_FUNCTION_ENTRY
+TypeDef PIMAGE_RUNTIME_FUNCTION_ENTRY = _PIMAGE_RUNTIME_FUNCTION_ENTRY
+
+' Debug Format
+Type IMAGE_DEBUG_DIRECTORY
+	Characteristics As DWord
+	TimeDateStamp As DWord
+	MajorVersion As Word
+	MinorVersion As Word
+	Type_ As DWord
+	SizeOfData As DWord
+	AddressOfRawData As DWord
+	PointerToRawData As DWord
+End Type
+TypeDef PIMAGE_DEBUG_DIRECTORY = *IMAGE_DEBUG_DIRECTORY
+
+Const IMAGE_DEBUG_TYPE_UNKNOWN = 0
+Const IMAGE_DEBUG_TYPE_COFF = 1
+Const IMAGE_DEBUG_TYPE_CODEVIEW = 2
+Const IMAGE_DEBUG_TYPE_FPO = 3
+Const IMAGE_DEBUG_TYPE_MISC = 4
+Const IMAGE_DEBUG_TYPE_EXCEPTION = 5
+Const IMAGE_DEBUG_TYPE_FIXUP = 6
+Const IMAGE_DEBUG_TYPE_OMAP_TO_SRC = 7
+Const IMAGE_DEBUG_TYPE_OMAP_FROM_SRC = 8
+Const IMAGE_DEBUG_TYPE_BORLAND = 9
+Const IMAGE_DEBUG_TYPE_RESERVED10 = 10
+Const IMAGE_DEBUG_TYPE_CLSID = 11
+
+Type IMAGE_COFF_SYMBOLS_HEADER
+	NumberOfSymbols As DWord
+	LvaToFirstSymbol As DWord
+	NumberOfLinenumbers As DWord
+	LvaToFirstLinenumber As DWord
+	RvaToFirstByteOfCode As DWord
+	RvaToLastByteOfCode As DWord
+	RvaToFirstByteOfData As DWord
+	RvaToLastByteOfData As DWord
+End Type
+TypeDef PIMAGE_COFF_SYMBOLS_HEADER = *IMAGE_COFF_SYMBOLS_HEADER
+
+Const FRAME_FPO = 0
+Const FRAME_TRAP = 1
+Const FRAME_TSS = 2
+Const FRAME_NONFPO = 3
+
+Type FPO_DATA
+	ulOffStart As DWord
+	cbProcSize As DWord
+	cdwLocals As DWord
+	cdwParams As Word
+	dummy As Word
+'	cbProlog : 8 As Word
+'	cbRegs   : 3 As Word
+'	fHasSEH  : 1 As Word
+'	fUseBP   : 1 As Word
+'	reserved : 1 As Word
+'	cbFrame  : 2 As Word
+End Type
+TypeDef PFPO_DATA = *FPO_DATA
+Const SIZEOF_RFPO_DATA = 16
+
+Const IMAGE_DEBUG_MISC_EXENAME = 1
+
+Type IMAGE_DEBUG_MISC
+	DataType As DWord
+	Length As DWord
+	Unicode As BOOLEAN
+	Reserved[ELM(3)] As Byte
+	Data[ELM(1)] As Byte
+End Type
+TypeDef PIMAGE_DEBUG_MISC = *IMAGE_DEBUG_MISC
+
+Type IMAGE_FUNCTION_ENTRY
+	StartingAddress As DWord
+	EndingAddress As DWord
+	EndOfPrologue As DWord
+End Type
+TypeDef PIMAGE_FUNCTION_ENTRY = *IMAGE_FUNCTION_ENTRY
+
+Type IMAGE_FUNCTION_ENTRY64
+	StartingAddress As QWord
+	EndingAddress As QWord
+'	Union
+		EndOfPrologue As QWord
+'		UnwindInfoAddress As QWord
+'End Union
+End Type
+TypeDef PIMAGE_FUNCTION_ENTRY64 = *IMAGE_FUNCTION_ENTRY64
+
+Type IMAGE_SEPARATE_DEBUG_HEADER
+	Signature As Word
+	Flags As Word
+	Machine As Word
+	Characteristics As Word
+	TimeDateStamp As DWord
+	CheckSum As DWord
+	ImageBase As DWord
+	SizeOfImage As DWord
+	NumberOfSections As DWord
+	ExportedNamesSize As DWord
+	DebugDirectorySize As DWord
+	SectionAlignment As DWord
+	Reserved[ELM(2)] As DWord
+End Type
+TypeDef PIMAGE_SEPARATE_DEBUG_HEADER = *IMAGE_SEPARATE_DEBUG_HEADER
+
+Type NON_PAGED_DEBUG_INFO
+	Signature As Word
+	Flags As Word
+	Size As DWord
+	Machine As Word
+	Characteristics As Word
+	TimeDateStamp As DWord
+	CheckSum As DWord
+	SizeOfImage As DWord
+	ImageBase As QWord
+End Type
+TypeDef PNON_PAGED_DEBUG_INFO = *NON_PAGED_DEBUG_INFO
+
+Const IMAGE_SEPARATE_DEBUG_SIGNATURE = &h4449 'DI
+Const NON_PAGED_DEBUG_SIGNATURE = &h4E49 ' NI
+
+Const IMAGE_SEPARATE_DEBUG_FLAGS_MASK = &h8000
+Const IMAGE_SEPARATE_DEBUG_MISMATCH = &h8000
+
+Type IMAGE_ARCHITECTURE_HEADER
+	AmaskValue As Byte
+'	AmaskValue: 1 As DWord
+'	: 7 As Long
+	AmaskShift As Byte
+'	AmaskShift: 8 As DWord
+	dummy As Word
+'	: 16 As Long
+	FirstEntryRVA As DWord
+End Type
+TypeDef PIMAGE_ARCHITECTURE_HEADER = *IMAGE_ARCHITECTURE_HEADER
+
+Type IMAGE_ARCHITECTURE_ENTRY
+	FixupInstRVA As DWord
+	NewInst As DWord
+End Type
+TypeDef PIMAGE_ARCHITECTURE_ENTRY = *IMAGE_ARCHITECTURE_ENTRY
+
+Const IMPORT_OBJECT_HDR_SIG2 = &hffff
+
+Type IMPORT_OBJECT_HEADER
+	Sig1 As Word
+	Sig2 As Word
+	Version As Word
+	Machine As Word
+	TimeDateStamp As DWord
+	SizeOfData As DWord
+
+'	Union
+		Ordinal As Word
+'		Hint As Word
+'	End Union
+
+	Reserved As Word
+'	Type : 2 As Word
+'	NameType : 3 As Word
+'	Reserved : 11 As Word
+End Type
+
+Enum IMPORT_OBJECT_TYPE
+	IMPORT_OBJECT_CODE = 0
+	IMPORT_OBJECT_DATA = 1
+	IMPORT_OBJECT_CONST = 2
+End Enum
+
+Enum IMPORT_OBJECT_NAME_TYPE
+	IMPORT_OBJECT_ORDINAL = 0
+	IMPORT_OBJECT_NAME = 1
+	IMPORT_OBJECT_NAME_NO_PREFIX = 2
+	IMPORT_OBJECT_NAME_UNDECORATE = 3
+End Enum
+
+#ifndef __IMAGE_COR20_HEADER_DEFINED__
+#define __IMAGE_COR20_HEADER_DEFINED__
+
+Enum ReplacesCorHdrNumericDefines
+' COM+ Header entry point flags.
+	COMIMAGE_FLAGS_ILONLY               = &h00000001
+	COMIMAGE_FLAGS_32BITREQUIRED        = &h00000002
+	COMIMAGE_FLAGS_IL_LIBRARY           = &h00000004
+	COMIMAGE_FLAGS_STRONGNAMESIGNED     = &h00000008
+	COMIMAGE_FLAGS_TRACKDEBUGDATA       = &h00010000
+' Version flags for image.
+	COR_VERSION_MAJOR_V2                = 2
+	COR_VERSION_MAJOR                   = COR_VERSION_MAJOR_V2
+	COR_VERSION_MINOR                   = 0
+	COR_DELETED_NAME_LENGTH             = 8
+	COR_VTABLEGAP_NAME_LENGTH           = 8
+' Maximum size of a NativeType descriptor.
+	NATIVE_TYPE_MAX_CB                  = 1
+	COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE= &hFF
+' Consts for the MIH FLAGS
+	IMAGE_COR_MIH_METHODRVA             = &h01
+	IMAGE_COR_MIH_EHRVA                 = &h02
+	IMAGE_COR_MIH_BASICBLOCK            = &h08
+' V-table constants
+	COR_VTABLE_32BIT                    = &h01          ' V-table slots are 32-bits in size.
+	COR_VTABLE_64BIT                    = &h02          ' V-table slots are 64-bits in size.
+	COR_VTABLE_FROM_UNMANAGED           = &h04          ' If set, transition from unmanaged.
+	COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN  = &h08  ' If set, transition from unmanaged with keeping the current appdomain.
+	COR_VTABLE_CALL_MOST_DERIVED        = &h10          ' Call most derived method described by
+' EATJ constants
+	IMAGE_COR_EATJ_THUNK_SIZE           = 32            ' Size of a jump thunk reserved range.
+' Max name lengths
+	'@todo: Change to unlimited name lengths.
+	MAX_CLASS_NAME                      = 1024
+	MAX_PACKAGE_NAME                    = 1024
+End Enum
+
+' CLR 2.0 header structure.
+Type IMAGE_COR20_HEADER
+	' Header versioning
+	cb As DWord
+	MajorRuntimeVersion As Word
+	MinorRuntimeVersion As Word
+	' Symbol table and startup information
+	MetaData As IMAGE_DATA_DIRECTORY
+	Flags As DWord
+	EntryPointToken As DWord
+	' Binding information
+	Resources As IMAGE_DATA_DIRECTORY
+	StrongNameSignature As IMAGE_DATA_DIRECTORY
+	' Regular fixup and binding information
+	CodeManagerTable As IMAGE_DATA_DIRECTORY
+	VTableFixups As IMAGE_DATA_DIRECTORY
+	ExportAddressTableJumps As IMAGE_DATA_DIRECTORY
+	' Precompiled image info (internal use only - set to zero)
+	ManagedNativeHeader As IMAGE_DATA_DIRECTORY
+End Type
+TypeDef PIMAGE_COR20_HEADER = *IMAGE_COR20_HEADER
+
+#endif
+
+#ifdef _WIN64
+Type Align(16) SLIST_ENTRY
+	Next_ As *SLIST_ENTRY
+End Type
+TypeDef PSLIST_ENTRY = *SLIST_ENTRY
+#else
+TypeDef SLIST_ENTRY = SINGLE_LIST_ENTRY
+'TypeDef _SLIST_ENTRY = _SINGLE_LIST_ENTRY
+TypeDef PSLIST_ENTRY = PSINGLE_LIST_ENTRY
+#endif
+
+#ifdef _WIN64
+
+Type /*Union*/ Align(16) SLIST_HEADER
+'	Type ' original struct
+		Alignment As QWord
+		Region As QWord
+'	End Type
+'	Type ' 8-byte header
+'		Depth:16 As QWord
+'		Sequence:9 As QWord
+'		NextEntry:39 As QWord
+'		HeaderType:1 As QWord ' 0: 8-byte As QWord 1: 16-byte
+'		Init:1 As QWord       ' 0: uninitialized As QWord 1: initialized
+'		Reserved:59 As QWord
+'		Region:3 As QWord
+'	} Header8
+'	Type ' 16-byte header
+'		Depth:16 As QWord
+'		Sequence:48 As QWord
+'		HeaderType:1 As QWord ' 0: 8-byte As QWord 1: 16-byte
+'		Init:1 As QWord       ' 0: uninitialized As QWord 1: initialized
+'		Reserved:2 As QWord
+'		NextEntry:60 As QWord ' last 4 bits are always 0's
+'	} Header16
+End Type 'Union
+TypeDef PSLIST_HEADER = *SLIST_HEADER
+
+#else
+
+Type /*Union*/ SLIST_HEADER
+'	Alignment As QWord
+'	Type
+		Next_ As SLIST_ENTRY
+		Depth As Word
+		Sequence As Word
+'	End Type
+End Type 'Union
+TypeDef PSLIST_HEADER = *SLIST_HEADER
+
+#endif
+
+
+Declare Sub RtlInitializeSListHead Lib "kernel32" (/*IN*/ ByRef ListHead As SLIST_HEADER)
+Declare Function RtlFirstEntrySList Lib "kernel32" (/*IN*/ ByRef ListHead As /*Const*/ SLIST_HEADER) As PSLIST_ENTRY
+Declare Function RtlInterlockedPopEntrySList Lib "kernel32" (/*IN*/ ByRef ListHead As SLIST_HEADER) As PSLIST_ENTRY
+Declare Function RtlInterlockedPushEntrySList Lib "kernel32" (/*IN*/ ByRef ListHead As SLIST_HEADER, /*IN*/ ListEntry As PSLIST_ENTRY) As PSLIST_ENTRY
+Declare Function RtlInterlockedFlushSList Lib "kernel32" (/*IN*/ ByRef ListHead As SLIST_HEADER) As PSLIST_ENTRY
+Declare Function RtlQueryDepthSList Lib "kernel32" (/*IN*/ ByRef ListHead As SLIST_HEADER) As Word
+
+'Const RTL_RUN_ONCE_INIT {0} 'Static initializer
+
+Const RTL_RUN_ONCE_CHECK_ONLY = &h00000001
+Const RTL_RUN_ONCE_ASYNC = &h00000002
+Const RTL_RUN_ONCE_INIT_FAILED = &h00000004
+
+Const RTL_RUN_ONCE_CTX_RESERVED_BITS = 2
+
+Type /*Union*/ RTL_RUN_ONCE
+	Ptr As VoidPtr
+End Type 'Union
+TypeDef PRTL_RUN_ONCE = *RTL_RUN_ONCE
+
+TypeDef PRTL_RUN_ONCE_INIT_FN = *Function(ByRef RunOnce As RTL_RUN_ONCE, Parameter As VoidPtr, ByRef Context As VoidPtr) As DWord'LOGICAL
+
+Declare Sub RtlRunOnceInitialize Lib "kernel32" (ByRef RunOnce As RTL_RUN_ONCE)
+Declare Function RtlRunOnceExecuteOnce Lib "kernel32" (ByRef RunOnce As RTL_RUN_ONCE, InitFn As PRTL_RUN_ONCE_INIT_FN, Parameter As PVOID, ByRef Context As PVOID) As DWord
+Declare Function RtlRunOnceBeginInitialize Lib "kernel32" (ByRef RunOnce As RTL_RUN_ONCE, Flags As DWord, ByRef Context As PVOID) As DWord
+Declare Function RtlRunOnceComplete Lib "kernel32" (ByRef RunOnce As RTL_RUN_ONCE, Flags As DWord, Context As PVOID) As DWord
+
+Const HEAP_NO_SERIALIZE = &h00000001
+Const HEAP_GROWABLE = &h00000002
+Const HEAP_GENERATE_EXCEPTIONS = &h00000004
+Const HEAP_ZERO_MEMORY = &h00000008
+Const HEAP_REALLOC_IN_PLACE_ONLY = &h00000010
+Const HEAP_TAIL_CHECKING_ENABLED = &h00000020
+Const HEAP_FREE_CHECKING_ENABLED = &h00000040
+Const HEAP_DISABLE_COALESCE_ON_FREE = &h00000080
+Const HEAP_CREATE_ALIGN_16 = &h00010000
+Const HEAP_CREATE_ENABLE_TRACING = &h00020000
+Const HEAP_CREATE_ENABLE_EXECUTE = &h00040000
+Const HEAP_MAXIMUM_TAG = &h0FFF
+Const HEAP_PSEUDO_TAG_FLAG = &h8000
+Const HEAP_TAG_SHIFT = 18
+
+Const HEAP_MAKE_TAG_FLAGS (TagBase /*As DWord*/, Tag /*As DWord*/) /*As DWord*/ = (((TagBase) + ((Tag) << HEAP_TAG_SHIFT)) As DWord)
+
+'#if (NTDDI_VERSION > NTDDI_WINXP)
+'Declare Function RtlCaptureStackBackTrace Lib "kernel32" (FramesToSkip As DWord, FramesToCapture A sDWord, ByRef BackTrace As PVOID, BackTraceHash As *DWord) As Word
+'#endif
+
+'#if (NTDDI_VERSION > NTDDI_WIN2K)
+'Declare Sub RtlCaptureContext Lib "kernel32" (ByRef ContextRecord As CONTEXT)
+'#endif
+
+Const IS_TEXT_UNICODE_ASCII16 = &h0001
+Const IS_TEXT_UNICODE_REVERSE_ASCII16 = &h0010
+
+Const IS_TEXT_UNICODE_STATISTICS = &h0002
+Const IS_TEXT_UNICODE_REVERSE_STATISTICS = &h0020
+
+Const IS_TEXT_UNICODE_CONTROLS = &h0004
+Const IS_TEXT_UNICODE_REVERSE_CONTROLS = &h0040
+
+Const IS_TEXT_UNICODE_SIGNATURE = &h0008
+Const IS_TEXT_UNICODE_REVERSE_SIGNATURE = &h0080
+
+Const IS_TEXT_UNICODE_ILLEGAL_CHARS = &h0100
+Const IS_TEXT_UNICODE_ODD_LENGTH = &h0200
+Const IS_TEXT_UNICODE_DBCS_LEADBYTE = &h0400
+Const IS_TEXT_UNICODE_NULL_BYTES = &h1000
+
+Const IS_TEXT_UNICODE_UNICODE_MASK = &h000F
+Const IS_TEXT_UNICODE_REVERSE_MASK = &h00F0
+Const IS_TEXT_UNICODE_NOT_UNICODE_MASK = &h0F00
+Const IS_TEXT_UNICODE_NOT_ASCII_MASK = &hF000
+
+Const COMPRESSION_FORMAT_NONE = &h0000
+Const COMPRESSION_FORMAT_DEFAULT = &h0001
+Const COMPRESSION_FORMAT_LZNT1 = &h0002
+Const COMPRESSION_ENGINE_STANDARD = &h0000
+Const COMPRESSION_ENGINE_MAXIMUM = &h0100
+Const COMPRESSION_ENGINE_HIBER = &h0200
+
+'#if _DBG_MEMCPY_INLINE_ && !defined(MIDL_PASS) && !defined(_MEMCPY_INLINE_) && !defined(_CRTBLD)
+'#define _MEMCPY_INLINE_
+/*
+FORCEINLINE
+PVOID
+__cdecl
+memcpy_inline (
+    void *dst,
+    const void *src,
+    size_t size
+    )
+{
+    if (((char *)dst > (char *)src) &&
+        ((char *)dst < ((char *)src + size))) {
+        __debugbreak();
+    }
+    return memcpy(dst, src, size);
+}
+Const memcpy memcpy_inline
+*/
+'#endif
+
+'#if (NTDDI_VERSION >= NTDDI_WIN2K)
+'Declare Function RtlCompareMemory Lib "kernel32" (Source1 As VoidPtr, Source2 As VoidPtr, Length As SIZE_T) As SIZE_T
+'#endif
+/*
+Const RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length)))
+Const RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
+Const RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length))
+Const RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
+Const RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
+*/
+Function RtlSecureZeroMemory(ptr As VoidPtr, cnt As SIZE_T) As VoidPtr
+	Dim vptr = ptr As * /*Volatile*/ Byte
+#ifdef _WIN64
+	FillMemory(vptr, cnt, 0)
+#else
+
+	While (cnt > 0)
+		vptr = 0
+		vptr++
+		cnt--
+	Wend
+#endif
+	RtlSecureZeroMemory = ptr
+End Function
+
+Const SEF_DACL_AUTO_INHERIT = &h01
+Const SEF_SACL_AUTO_INHERIT = &h02
+Const SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT = &h04
+Const SEF_AVOID_PRIVILEGE_CHECK = &h08
+Const SEF_AVOID_OWNER_CHECK = &h10
+Const SEF_DEFAULT_OWNER_FROM_PARENT = &h20
+Const SEF_DEFAULT_GROUP_FROM_PARENT = &h40
+Const SEF_MACL_NO_WRITE_UP = &h100
+Const SEF_MACL_NO_READ_UP = &h200
+Const SEF_MACL_NO_EXECUTE_UP = &h400
+Const SEF_AVOID_OWNER_RESTRICTION = &h1000
+
+Const SEF_MACL_VALID_FLAGS = (SEF_MACL_NO_WRITE_UP OR SEF_MACL_NO_READ_UP Or SEF_MACL_NO_EXECUTE_UP)
+
+Type MESSAGE_RESOURCE_ENTRY
+	Length As Word
+	Flags As Word
+	Text[ELM(1)] As Byte
+End Type
+TypeDef PMESSAGE_RESOURCE_ENTRY = *MESSAGE_RESOURCE_ENTRY
+
+Const MESSAGE_RESOURCE_UNICODE = &h0001
+
+Type MESSAGE_RESOURCE_BLOCK
+	LowId As DWord
+	HighId As DWord
+	OffsetToEntries As DWord
+End Type
+TypeDef PMESSAGE_RESOURCE_BLOCK = *MESSAGE_RESOURCE_BLOCK
+
+Type MESSAGE_RESOURCE_DATA
+	NumberOfBlocks As DWord
+	Blocks[ELM(1)] As MESSAGE_RESOURCE_BLOCK
+End Type
+TypeDef PMESSAGE_RESOURCE_DATA = *MESSAGE_RESOURCE_DATA
+
+Type OSVERSIONINFOA
+	dwOSVersionInfoSize As DWord
+	dwMajorVersion As DWord
+	dwMinorVersion As DWord
+	dwBuildNumber As DWord
+	dwPlatformId As DWord
+	szCSDVersion[ELM(128)] As CHAR
+End Type
+TypeDef POSVERSIONINFOA = *OSVERSIONINFOA
+TypeDef LPOSVERSIONINFOA = *OSVERSIONINFOA
+Type OSVERSIONINFOW
+	dwOSVersionInfoSize As DWord
+	dwMajorVersion As DWord
+	dwMinorVersion As DWord
+	dwBuildNumber As DWord
+	dwPlatformId As DWord
+	szCSDVersion[ELM(128)] As WCHAR
+End Type
+TypeDef POSVERSIONINFOW = *OSVERSIONINFOW
+TypeDef LPOSVERSIONINFOW = *OSVERSIONINFOW
+TypeDef RTL_OSVERSIONINFOW = OSVERSIONINFOW
+TypeDef PRTL_OSVERSIONINFOW = *OSVERSIONINFOW
+#ifdef UNICODE
+TypeDef OSVERSIONINFO = OSVERSIONINFOW
+TypeDef POSVERSIONINFO = POSVERSIONINFOW
+TypeDef LPOSVERSIONINFO = LPOSVERSIONINFOW
+#else
+TypeDef OSVERSIONINFO = OSVERSIONINFOA
+TypeDef POSVERSIONINFO = POSVERSIONINFOA
+TypeDef LPOSVERSIONINFO = LPOSVERSIONINFOA
+#endif
+Type OSVERSIONINFOEXA
+	dwOSVersionInfoSize As DWord
+	dwMajorVersion As DWord
+	dwMinorVersion As DWord
+	dwBuildNumber As DWord
+	dwPlatformId As DWord
+	szCSDVersion[ELM(128)] As CHAR
+	wServicePackMajor As Word
+	wServicePackMinor As Word
+	wSuiteMask As Word
+	wProductType As Byte
+	wReserved As Byte
+End Type
+TypeDef POSVERSIONINFOEXA = *OSVERSIONINFOEXA
+TypeDef LPOSVERSIONINFOEXA = *OSVERSIONINFOEXA
+Type OSVERSIONINFOEXW
+	dwOSVersionInfoSize As DWord
+	dwMajorVersion As DWord
+	dwMinorVersion As DWord
+	dwBuildNumber As DWord
+	dwPlatformId As DWord
+	szCSDVersion[ELM(128)] As WCHAR
+	wServicePackMajor As Word
+	wServicePackMinor As Word
+	wSuiteMask As Word
+	wProductType As Byte
+	wReserved As Byte
+End Type
+TypeDef POSVERSIONINFOEXW = *OSVERSIONINFOEXW
+TypeDef LPOSVERSIONINFOEXW = *OSVERSIONINFOEXW
+TypeDef RTL_OSVERSIONINFOEXW = OSVERSIONINFOEXW
+TypeDef PRTL_OSVERSIONINFOEXW = *OSVERSIONINFOEXW
+#ifdef UNICODE
+TypeDef OSVERSIONINFOEX = OSVERSIONINFOEXW
+TypeDef POSVERSIONINFOEX = POSVERSIONINFOEXW
+TypeDef LPOSVERSIONINFOEX = LPOSVERSIONINFOEXW
+#else
+TypeDef OSVERSIONINFOEX = OSVERSIONINFOEXA
+TypeDef POSVERSIONINFOEX = POSVERSIONINFOEXA
+TypeDef LPOSVERSIONINFOEX = LPOSVERSIONINFOEXA
+#endif
+
+' RtlVerifyVersionInfo() conditions
+Const VER_EQUAL = 1
+Const VER_GREATER = 2
+Const VER_GREATER_EQUAL = 3
+Const VER_LESS = 4
+Const VER_LESS_EQUAL = 5
+Const VER_AND = 6
+Const VER_OR = 7
+
+Const VER_CONDITION_MASK = 7
+Const VER_NUM_BITS_PER_CONDITION_MASK = 3
+
+' RtlVerifyVersionInfo() type mask bits
+Const VER_MINORVERSION = 0000001
+Const VER_MAJORVERSION = 0000002
+Const VER_BUILDNUMBER = 0000004
+Const VER_PLATFORMID = 0000008
+Const VER_SERVICEPACKMINOR = 0000010
+Const VER_SERVICEPACKMAJOR = 0000020
+Const VER_SUITENAME = 0000040
+Const VER_PRODUCT_TYPE = 0000080
+
+' RtlVerifyVersionInfo() os product type values
+Const VER_NT_WORKSTATION = 0000001
+Const VER_NT_DOMAIN_CONTROLLER = 0000002
+Const VER_NT_SERVER = 0000003
+
+' dwPlatformId defines:
+Const VER_PLATFORM_WIN32s        = 0
+Const VER_PLATFORM_WIN32_WINDOWS = 1
+Const VER_PLATFORM_WIN32_NT      = 2
+Const VER_PLATFORM_WIN32_CE      = 3
+
+' VerifyVersionInfo() macro to set the condition mask
+' VER_SET_CONDITION
+
+'#if (NTDDI_VERSION >= NTDDI_WIN2K)
+'Declare Function VerSetConditionMask Lib "kernel32" (ConditionMask As QWord, TypeMask As DWord, Condition As Byte) As QWord
+'#endif
+
+'#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+'Declare Function RtlGetProductInfo Lib "kernel32" (OSMajorVersion As DWord, OSMinorVersion As DWord, SpMajorVersion As DWord, SpMinorVersion As DWord, ByRef ReturnedProductType As DWord) As BOOLEAN
+'#endif
+
+Type RTL_CRITICAL_SECTION_DEBUG
+	Type_ As Word
+	CreatorBackTraceIndex As Word
+	CriticalSection As VoidPtr '!*RTL_CRITICAL_SECTION
+	ProcessLocksList As LIST_ENTRY
+	EntryCount As DWord
+	ContentionCount As DWord
+	Flags As DWord
+	CreatorBackTraceIndexHigh As Word
+	SpareWORD As Word
+End Type
+TypeDef PRTL_CRITICAL_SECTION_DEBUG = *RTL_CRITICAL_SECTION_DEBUG
+TypeDef RTL_RESOURCE_DEBUG = RTL_CRITICAL_SECTION_DEBUG
+TypeDef PRTL_RESOURCE_DEBUG = *RTL_RESOURCE_DEBUG
+
+Const RTL_CRITSECT_TYPE = 0
+Const RTL_RESOURCE_TYPE = 1
+
+Const RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO = &h01000000
+Const RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN = &h02000000
+Const RTL_CRITICAL_SECTION_FLAG_STATIC_INIT = &h04000000
+Const RTL_CRITICAL_SECTION_ALL_FLAG_BITS = &hFF000000
+Const RTL_CRITICAL_SECTION_FLAG_RESERVED = (RTL_CRITICAL_SECTION_ALL_FLAG_BITS And (Not (RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO Or RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN Or RTL_CRITICAL_SECTION_FLAG_STATIC_INIT)))
+
+Const RTL_CRITICAL_SECTION_DEBUG_FLAG_STATIC_INIT = &h00000001
+
+Type Align(8) RTL_CRITICAL_SECTION
+	 DebugInfo As PRTL_CRITICAL_SECTION_DEBUG
+	LockCount As Long
+	RecursionCount As Long
+	OwningThread As HANDLE
+	LockSemaphore As HANDLE
+	SpinCount As ULONG_PTR
+End Type
+TypeDef PRTL_CRITICAL_SECTION = *RTL_CRITICAL_SECTION
+
+Type RTL_SRWLOCK
+	Ptr As VoidPtr
+End Type
+TypeDef PRTL_SRWLOCK = *RTL_SRWLOCK
+'Const RTL_SRWLOCK_INIT {0}
+Type RTL_CONDITION_VARIABLE
+	Ptr As VoidPtr
+End Type
+TypeDef PRTL_CONDITION_VARIABLE = *RTL_CONDITION_VARIABLE
+'Const RTL_CONDITION_VARIABLE_INIT {0}
+Const RTL_CONDITION_VARIABLE_LOCKMODE_SHARED = &h1
+TypeDef PVECTORED_EXCEPTION_HANDLER = *Function(ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
+
+Enum HEAP_INFORMATION_CLASS
+	HeapCompatibilityInformation
+	HeapEnableTerminationOnCorruption
+End Enum
+
+Const WT_EXECUTEDEFAULT = &h00000000
+Const WT_EXECUTEINIOTHREAD = &h00000001
+Const WT_EXECUTEINUITHREAD = &h00000002
+Const WT_EXECUTEINWAITTHREAD = &h00000004
+Const WT_EXECUTEONLYONCE = &h00000008
+Const WT_EXECUTEINTIMERTHREAD = &h00000020
+Const WT_EXECUTELONGFUNCTION = &h00000010
+Const WT_EXECUTEINPERSISTENTIOTHREAD = &h00000040
+Const WT_EXECUTEINPERSISTENTTHREAD = &h00000080
+Const WT_TRANSFER_IMPERSONATION = &h00000100
+'Const WT_SET_MAX_THREADPOOL_THREADS(Flags, Limit)  ((Flags) Or= (Limit)<<16)
+TypeDef WAITORTIMERCALLBACKFUNC = *Sub(p As VoidPtr, b As Boolean)
+TypeDef WORKERCALLBACKFUNC = *Sub(p As VoidPtr)
+TypeDef APC_CALLBACK_FUNCTION = *Sub(dw AS DWord, p1 As VoidPtr, p2 As VoidPtr)
+TypeDef PFLS_CALLBACK_FUNCTION = *Sub(lpFlsData As VoidPtr)
+Const WT_EXECUTEINLONGTHREAD = &h00000010
+Const WT_EXECUTEDELETEWAIT = &h00000008
+
+Enum ACTIVATION_CONTEXT_INFO_CLASS
+	ActivationContextBasicInformation = 1
+	ActivationContextDetailedInformation = 2
+	AssemblyDetailedInformationInActivationContext = 3
+	FileInformationInAssemblyOfAssemblyInActivationContext = 4
+	RunlevelInformationInActivationContext = 5
+	MaxActivationContextInfoClass
+	' compatibility with old names
+	AssemblyDetailedInformationInActivationContxt = 3
+	FileInformationInAssemblyOfAssemblyInActivationContxt = 4
+End Enum
+
+TypeDef ACTIVATIONCONTEXTINFOCLASS = ACTIVATION_CONTEXT_INFO_CLASS
+
+Type ACTIVATION_CONTEXT_QUERY_INDEX
+	ulAssemblyIndex As DWord
+	ulFileIndexInAssembly; As DWord
+End Type
+TypeDef PACTIVATION_CONTEXT_QUERY_INDEX = *ACTIVATION_CONTEXT_QUERY_INDEX
+
+TypeDef PCACTIVATION_CONTEXT_QUERY_INDEX = * /*Const*/ ACTIVATION_CONTEXT_QUERY_INDEX
+
+Const ACTIVATION_CONTEXT_PATH_TYPE_NONE = 1
+Const ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE = 2
+Const ACTIVATION_CONTEXT_PATH_TYPE_URL = 3
+Const ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF = 4
+
+Type ASSEMBLY_FILE_DETAILED_INFORMATION
+	ulFlags As DWord
+	ulFilenameLength As PCWSTR
+	ulPathLength As PCWSTR
+	lpFileName As PCWSTR
+	lpFilePath As PCWSTR
+End Type
+TypeDef PASSEMBLY_FILE_DETAILED_INFORMATION = *ASSEMBLY_FILE_DETAILED_INFORMATION
+TypeDef PCASSEMBLY_FILE_DETAILED_INFORMATION = * /*Const*/ ASSEMBLY_FILE_DETAILED_INFORMATION
+
+' compatibility with old names
+TypeDef  _ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION =  ASSEMBLY_FILE_DETAILED_INFORMATION
+TypeDef   ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION =  ASSEMBLY_FILE_DETAILED_INFORMATION
+TypeDef  PASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION =  PASSEMBLY_FILE_DETAILED_INFORMATION
+TypeDef PCASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = PCASSEMBLY_FILE_DETAILED_INFORMATION
+
+Type ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
+	ulFlags As DWord
+	ulEncodedAssemblyIdentityLength As DWord
+	ulManifestPathType As DWord
+	liManifestLastWriteTime As LARGE_INTEGER
+	ulPolicyPathType As DWord
+	ulPolicyPathLength As DWord
+	liPolicyLastWriteTime As LARGE_INTEGER
+	ulMetadataSatelliteRosterIndex As DWord
+	ulManifestVersionMajor As DWord
+	ulManifestVersionMinor As DWord
+	ulPolicyVersionMajor As DWord
+	ulPolicyVersionMinor As DWord
+	ulAssemblyDirectoryNameLength As DWord
+	lpAssemblyEncodedAssemblyIdentity As PCWSTR
+	lpAssemblyManifestPath As PCWSTR
+	lpAssemblyPolicyPath As PCWSTR
+	lpAssemblyDirectoryName As PCWSTR
+	ulFileCount As DWord
+End Type
+TypeDef PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION = *ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
+TypeDef PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION = * /*Const*/ ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
+
+Enum ACTCTX_REQUESTED_RUN_LEVEL
+	ACTCTX_RUN_LEVEL_UNSPECIFIED = 0
+	ACTCTX_RUN_LEVEL_AS_INVOKER
+	ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE
+	ACTCTX_RUN_LEVEL_REQUIRE_ADMIN
+	ACTCTX_RUN_LEVEL_NUMBERS
+End Enum
+
+Type ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
+	ulFlags As DWord
+	RunLevel As ACTCTX_REQUESTED_RUN_LEVEL
+	UiAccess As DWord
+End Type
+TypeDef PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION = ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
+TypeDef PCACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION = * /*Const*/ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
+
+Type ACTIVATION_CONTEXT_DETAILED_INFORMATION
+	dwFlags As DWord
+	ulFormatVersion As DWord
+	ulAssemblyCount As DWord
+	ulRootManifestPathType As DWord
+	ulRootManifestPathChars As DWord
+	ulRootConfigurationPathType As DWord
+	ulRootConfigurationPathChars As DWord
+	ulAppDirPathType As DWord
+	ulAppDirPathChars As DWord
+	lpRootManifestPath As PCWSTR
+	lpRootConfigurationPath As PCWSTR
+	lpAppDirPath As PCWSTR
+End Type
+TypeDef PACTIVATION_CONTEXT_DETAILED_INFORMATION = *ACTIVATION_CONTEXT_DETAILED_INFORMATION
+TypeDef PCACTIVATION_CONTEXT_DETAILED_INFORMATION = * /*Const*/ ACTIVATION_CONTEXT_DETAILED_INFORMATION
+
+Const DLL_PROCESS_ATTACH = 1
+Const DLL_THREAD_ATTACH = 2
+Const DLL_THREAD_DETACH = 3
+Const DLL_PROCESS_DETACH = 0
+
+Const EVENTLOG_SEQUENTIAL_READ = &h0001
+Const EVENTLOG_SEEK_READ = &h0002
+Const EVENTLOG_FORWARDS_READ = &h0004
+Const EVENTLOG_BACKWARDS_READ = &h0008
+
+Const EVENTLOG_SUCCESS = &h0000
+Const EVENTLOG_ERROR_TYPE = &h0001
+Const EVENTLOG_WARNING_TYPE = &h0002
+Const EVENTLOG_INFORMATION_TYPE = &h0004
+Const EVENTLOG_AUDIT_SUCCESS = &h0008
+Const EVENTLOG_AUDIT_FAILURE = &h0010
+
+Const EVENTLOG_START_PAIRED_EVENT = &h0001
+Const EVENTLOG_END_PAIRED_EVENT = &h0002
+Const EVENTLOG_END_ALL_PAIRED_EVENTS = &h0004
+Const EVENTLOG_PAIRED_EVENT_ACTIVE = &h0008
+Const EVENTLOG_PAIRED_EVENT_INACTIVE = &h0010
+
+Type EVENTLOGRECORD
+	Length As DWord
+	Reserved As DWord
+	RecordNumber As DWord
+	TimeGenerated As DWord
+	TimeWritten As DWord
+	EventID As DWord
+	EventType As Word
+	NumStrings As Word
+	EventCategory As Word
+	ReservedFlags As Word
+	ClosingRecordNumber As DWord
+	StringOffset As DWord
+	UserSidLength As DWord
+	UserSidOffset As DWord
+	DataLength As DWord
+	DataOffset As DWord
+	' Then follow:
+	' WCHAR SourceName[]
+	' WCHAR Computername[]
+	' SID   UserSid
+	' WCHAR Strings[]
+	' BYTE  Data[]
+	' CHAR  Pad[]
+	' DWORD Length;
+End Type
+TypeDef PEVENTLOGRECORD = *EVENTLOGRECORD
+
+Const MAXLOGICALLOGNAMESIZE = 256
+
+Type EVENTSFORLOGFILE
+	ulSize As DWord
+	szLogicalLogFile[ELM(MAXLOGICALLOGNAMESIZE)] As WCHAR
+	ulNumRecords As DWord
+	pEventLogRecords[ELM(ANYSIZE_ARRAY)] As EVENTLOGRECORD 'pEventLogRecords[] As EVENTLOGRECORD
+End Type
+TypeDef PEVENTSFORLOGFILE = *EVENTSFORLOGFILE
+
+Type PACKEDEVENTINFO
+	ulSize As DWord
+	ulNumEventsForLogFile As DWord
+	ulOffsets[ELM(ANYSIZE_ARRAY)] As DWord 'ulOffsets[] As DWord
+End Type
+TypeDef PPACKEDEVENTINFO = *PACKEDEVENTINFO
+
+Const KEY_QUERY_VALUE = &h0001
+Const KEY_SET_VALUE = &h0002
+Const KEY_CREATE_SUB_KEY = &h0004
+Const KEY_ENUMERATE_SUB_KEYS = &h0008
+Const KEY_NOTIFY = &h0010
+Const KEY_CREATE_LINK = &h0020
+Const KEY_WOW64_32KEY = &h0200
+Const KEY_WOW64_64KEY = &h0100
+Const KEY_WOW64_RES = &h0300
+Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
+Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
+Const KEY_EXECUTE = ((KEY_READ) And (Not SYNCHRONIZE))
+Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))
+Const REG_OPTION_RESERVED = &h00000000
+Const REG_OPTION_NON_VOLATILE = &h00000000
+Const REG_OPTION_VOLATILE = &h00000001
+Const REG_OPTION_CREATE_LINK = &h00000002
+Const REG_OPTION_BACKUP_RESTORE = &h00000004
+Const REG_OPTION_OPEN_LINK = &h00000008
+Const REG_LEGAL_OPTION = (REG_OPTION_RESERVED Or REG_OPTION_NON_VOLATILE Or REG_OPTION_VOLATILE Or REG_OPTION_CREATE_LINK Or REG_OPTION_BACKUP_RESTORE Or REG_OPTION_OPEN_LINK)
+Const REG_CREATED_NEW_KEY = &h00000001
+Const REG_OPENED_EXISTING_KEY = &h00000002
+
+Const REG_STANDARD_FORMAT = 1
+Const REG_LATEST_FORMAT = 2
+Const REG_NO_COMPRESSION = 4
+
+Const REG_WHOLE_HIVE_VOLATILE = &h00000001
+Const REG_REFRESH_HIVE = &h00000002
+Const REG_NO_LAZY_FLUSH = &h00000004
+Const REG_FORCE_RESTORE = &h00000008
+Const REG_APP_HIVE = &h00000010
+Const REG_PROCESS_PRIVATE = &h00000020
+Const REG_START_JOURNAL = &h00000040
+Const REG_HIVE_EXACT_FILE_GROWTH = &h00000080
+Const REG_HIVE_NO_RM = &h00000100
+Const REG_HIVE_SINGLE_LOG = &h00000200
+
+Const REG_FORCE_UNLOAD = 1
+
+Const REG_NOTIFY_CHANGE_NAME = &h00000001
+Const REG_NOTIFY_CHANGE_ATTRIBUTES = &h00000002
+Const REG_NOTIFY_CHANGE_LAST_SET = &h00000004
+Const REG_NOTIFY_CHANGE_SECURITY = &h00000008
+
+Const REG_LEGAL_CHANGE_FILTER = (REG_NOTIFY_CHANGE_NAME Or REG_NOTIFY_CHANGE_ATTRIBUTES Or REG_NOTIFY_CHANGE_LAST_SET Or REG_NOTIFY_CHANGE_SECURITY)
+
+Const REG_NONE = 0
+Const REG_SZ = 1
+Const REG_EXPAND_SZ = 2
+
+Const REG_BINARY = 3
+Const REG_DWORD = 4
+Const REG_DWORD_LITTLE_ENDIAN = 4
+Const REG_DWORD_BIG_ENDIAN = 5
+Const REG_LINK = 6
+Const REG_MULTI_SZ = 7
+Const REG_RESOURCE_LIST = 8
+Const REG_FULL_RESOURCE_DESCRIPTOR = 9
+Const REG_RESOURCE_REQUIREMENTS_LIST = 10
+Const REG_QWORD = 11
+Const REG_QWORD_LITTLE_ENDIAN = 11
+
+Const SERVICE_KERNEL_DRIVER = &h00000001
+Const SERVICE_FILE_SYSTEM_DRIVER = &h00000002
+Const SERVICE_ADAPTER = &h00000004
+Const SERVICE_RECOGNIZER_DRIVER = &h00000008
+
+Const SERVICE_DRIVER = (SERVICE_KERNEL_DRIVER Or SERVICE_FILE_SYSTEM_DRIVER Or SERVICE_RECOGNIZER_DRIVER)
+
+Const SERVICE_WIN32_OWN_PROCESS = &h00000010
+Const SERVICE_WIN32_SHARE_PROCESS = &h00000020
+Const SERVICE_WIN32 = (SERVICE_WIN32_OWN_PROCESS Or SERVICE_WIN32_SHARE_PROCESS)
+
+Const SERVICE_INTERACTIVE_PROCESS = &h00000100
+
+Const SERVICE_TYPE_ALL = (SERVICE_WIN32 Or SERVICE_ADAPTER Or SERVICE_DRIVER Or SERVICE_INTERACTIVE_PROCESS)
+
+Const SERVICE_BOOT_START = &h00000000
+Const SERVICE_SYSTEM_START = &h00000001
+Const SERVICE_AUTO_START = &h00000002
+Const SERVICE_DEMAND_START = &h00000003
+Const SERVICE_DISABLED = &h00000004
+
+Const SERVICE_ERROR_IGNORE = &h00000000
+Const SERVICE_ERROR_NORMAL = &h00000001
+Const SERVICE_ERROR_SEVERE = &h00000002
+Const SERVICE_ERROR_CRITICAL = &h00000003
+
+Enum _SERVICE_NODE_TYPE
+	DriverType = SERVICE_KERNEL_DRIVER
+	FileSystemType = SERVICE_FILE_SYSTEM_DRIVER
+	Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS
+	Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS
+	AdapterType = SERVICE_ADAPTER
+	RecognizerType = SERVICE_RECOGNIZER_DRIVER
+End Enum
+
+Enum SERVICE_LOAD_TYPE
+	BootLoad = SERVICE_BOOT_START
+	SystemLoad = SERVICE_SYSTEM_START
+	AutoLoad = SERVICE_AUTO_START
+	DemandLoad = SERVICE_DEMAND_START
+	DisableLoad = SERVICE_DISABLED
+End Enum
+
+Enum SERVICE_ERROR_TYPE
+	IgnoreError = SERVICE_ERROR_IGNORE
+	NormalError = SERVICE_ERROR_NORMAL
+	SevereError = SERVICE_ERROR_SEVERE
+	CriticalError = SERVICE_ERROR_CRITICAL
+End Enum
+
+Const TAPE_ERASE_SHORT = 0
+Const TAPE_ERASE_LONG = 1
+
+Type TAPE_ERASE
+	Type_ As DWord
+	Immediate As BOOLEAN
+End Type
+TypeDef PTAPE_ERASE = *TAPE_ERASE
+
+Const TAPE_LOAD = 0
+Const TAPE_UNLOAD = 1
+Const TAPE_TENSION = 2
+Const TAPE_LOCK = 3
+Const TAPE_UNLOCK = 4
+Const TAPE_FORMAT = 5
+
+Type TAPE_PREPARE
+	Operation As DWord
+	Immediate As BOOLEAN
+End Type
+TypeDef PTAPE_PREPARE = *TAPE_PREPARE
+
+Const TAPE_SETMARKS = 0
+Const TAPE_FILEMARKS = 1
+Const TAPE_SHORT_FILEMARKS = 2
+Const TAPE_LONG_FILEMARKS = 3
+
+Type TAPE_WRITE_MARKS
+	Type_ As DWord
+	Count As DWord
+	Immediate As BOOLEAN
+End Type
+TypeDef PTAPE_WRITE_MARKS = *TAPE_WRITE_MARKS
+
+Const TAPE_ABSOLUTE_POSITION = 0
+Const TAPE_LOGICAL_POSITION = 1
+Const TAPE_PSEUDO_LOGICAL_POSITION = 2
+
+Type TAPE_GET_POSITION
+	Type_ As DWord
+	Partition As DWord
+	Offset As LARGE_INTEGER
+End Type
+TypeDef PTAPE_GET_POSITION = *TAPE_GET_POSITION
+
+Const TAPE_REWIND = 0
+Const TAPE_ABSOLUTE_BLOCK = 1
+Const TAPE_LOGICAL_BLOCK = 2
+Const TAPE_PSEUDO_LOGICAL_BLOCK = 3
+Const TAPE_SPACE_END_OF_DATA = 4
+Const TAPE_SPACE_RELATIVE_BLOCKS = 5
+Const TAPE_SPACE_FILEMARKS = 6
+Const TAPE_SPACE_SEQUENTIAL_FMKS = 7
+Const TAPE_SPACE_SETMARKS = 8
+Const TAPE_SPACE_SEQUENTIAL_SMKS = 9
+
+Type TAPE_SET_POSITION
+	Method As DWord
+	Partition As DWord
+	Offset As LARGE_INTEGER
+	Immediate As BOOLEAN
+End Type
+TypeDef PTAPE_SET_POSITION = *TAPE_SET_POSITION
+
+Const TAPE_DRIVE_FIXED = &h00000001
+Const TAPE_DRIVE_SELECT = &h00000002
+Const TAPE_DRIVE_INITIATOR = &h00000004
+
+Const TAPE_DRIVE_ERASE_SHORT = &h00000010
+Const TAPE_DRIVE_ERASE_LONG = &h00000020
+Const TAPE_DRIVE_ERASE_BOP_ONLY = &h00000040
+Const TAPE_DRIVE_ERASE_IMMEDIATE = &h00000080
+
+Const TAPE_DRIVE_TAPE_CAPACITY = &h00000100
+Const TAPE_DRIVE_TAPE_REMAINING = &h00000200
+Const TAPE_DRIVE_FIXED_BLOCK = &h00000400
+Const TAPE_DRIVE_VARIABLE_BLOCK = &h00000800
+
+Const TAPE_DRIVE_WRITE_PROTECT = &h00001000
+Const TAPE_DRIVE_EOT_WZ_SIZE = &h00002000
+
+Const TAPE_DRIVE_ECC = &h00010000
+Const TAPE_DRIVE_COMPRESSION = &h00020000
+Const TAPE_DRIVE_PADDING = &h00040000
+Const TAPE_DRIVE_REPORT_SMKS = &h00080000
+
+Const TAPE_DRIVE_GET_ABSOLUTE_BLK = &h00100000
+Const TAPE_DRIVE_GET_LOGICAL_BLK = &h00200000
+Const TAPE_DRIVE_SET_EOT_WZ_SIZE = &h00400000
+
+Const TAPE_DRIVE_EJECT_MEDIA = &h01000000
+Const TAPE_DRIVE_CLEAN_REQUESTS = &h02000000
+Const TAPE_DRIVE_SET_CMP_BOP_ONLY = &h04000000
+
+Const TAPE_DRIVE_RESERVED_BIT = &h80000000
+
+Const TAPE_DRIVE_LOAD_UNLOAD = &h80000001
+Const TAPE_DRIVE_TENSION = &h80000002
+Const TAPE_DRIVE_LOCK_UNLOCK = &h80000004
+Const TAPE_DRIVE_REWIND_IMMEDIATE = &h80000008
+
+Const TAPE_DRIVE_SET_BLOCK_SIZE = &h80000010
+Const TAPE_DRIVE_LOAD_UNLD_IMMED = &h80000020
+Const TAPE_DRIVE_TENSION_IMMED = &h80000040
+Const TAPE_DRIVE_LOCK_UNLK_IMMED = &h80000080
+
+Const TAPE_DRIVE_SET_ECC = &h80000100
+Const TAPE_DRIVE_SET_COMPRESSION = &h80000200
+Const TAPE_DRIVE_SET_PADDING = &h80000400
+Const TAPE_DRIVE_SET_REPORT_SMKS = &h80000800
+
+Const TAPE_DRIVE_ABSOLUTE_BLK = &h80001000
+Const TAPE_DRIVE_ABS_BLK_IMMED = &h80002000
+Const TAPE_DRIVE_LOGICAL_BLK = &h80004000
+Const TAPE_DRIVE_LOG_BLK_IMMED = &h80008000
+
+Const TAPE_DRIVE_END_OF_DATA = &h80010000
+Const TAPE_DRIVE_RELATIVE_BLKS = &h80020000
+Const TAPE_DRIVE_FILEMARKS = &h80040000
+Const TAPE_DRIVE_SEQUENTIAL_FMKS = &h80080000
+
+Const TAPE_DRIVE_SETMARKS = &h80100000
+Const TAPE_DRIVE_SEQUENTIAL_SMKS = &h80200000
+Const TAPE_DRIVE_REVERSE_POSITION = &h80400000
+Const TAPE_DRIVE_SPACE_IMMEDIATE = &h80800000
+
+Const TAPE_DRIVE_WRITE_SETMARKS = &h81000000
+Const TAPE_DRIVE_WRITE_FILEMARKS = &h82000000
+Const TAPE_DRIVE_WRITE_SHORT_FMKS = &h84000000
+Const TAPE_DRIVE_WRITE_LONG_FMKS = &h88000000
+
+Const TAPE_DRIVE_WRITE_MARK_IMMED = &h90000000
+Const TAPE_DRIVE_FORMAT = &hA0000000
+Const TAPE_DRIVE_FORMAT_IMMEDIATE = &hC0000000
+Const TAPE_DRIVE_HIGH_FEATURES = &h80000000
+
+Type TAPE_GET_DRIVE_PARAMETERS
+	ECC As BOOLEAN
+	Compression As BOOLEAN
+	DataPadding As BOOLEAN
+	ReportSetmarks As BOOLEAN
+	DefaultBlockSize As DWord
+	MaximumBlockSize As DWord
+	MinimumBlockSize As DWord
+	MaximumPartitionCount As DWord
+	FeaturesLow As DWord
+	FeaturesHigh As DWord
+	EOTWarningZoneSize As DWord
+End Type
+TypeDef PTAPE_GET_DRIVE_PARAMETERS = *TAPE_GET_DRIVE_PARAMETERS
+
+Type TAPE_SET_DRIVE_PARAMETERS
+	ECC As BOOLEAN
+	Compression As BOOLEAN
+	DataPadding As BOOLEAN
+	ReportSetmarks As BOOLEAN
+	EOTWarningZoneSize As DWord
+End Type
+TypeDef PTAPE_SET_DRIVE_PARAMETERS = *TAPE_SET_DRIVE_PARAMETERS
+
+Type TAPE_GET_MEDIA_PARAMETERS
+	Capacity As LARGE_INTEGER
+	Remaining As LARGE_INTEGER
+	BlockSize As DWord
+	PartitionCount As DWord
+	WriteProtected As BOOLEAN
+End Type
+TypeDef PTAPE_GET_MEDIA_PARAMETERS = *TAPE_GET_MEDIA_PARAMETERS
+
+Type TAPE_SET_MEDIA_PARAMETERS
+	BlockSize As DWord
+End Type
+TypeDef PTAPE_SET_MEDIA_PARAMETERS = *TAPE_SET_MEDIA_PARAMETERS
+
+Const TAPE_FIXED_PARTITIONS = 0
+Const TAPE_SELECT_PARTITIONS = 1
+Const TAPE_INITIATOR_PARTITIONS = 2
+
+Type TAPE_CREATE_PARTITION
+	Method As DWord
+	Count As DWord
+	Size As DWord
+End Type
+TypeDef PTAPE_CREATE_PARTITION = *TAPE_CREATE_PARTITION
+
+Const TAPE_QUERY_DRIVE_PARAMETERS = 0
+Const TAPE_QUERY_MEDIA_CAPACITY = 1
+Const TAPE_CHECK_FOR_DRIVE_PROBLEM = 2
+Const TAPE_QUERY_IO_ERROR_DATA = 3
+Const TAPE_QUERY_DEVICE_ERROR_DATA = 4
+
+Type TAPE_WMI_OPERATIONS
+	Method As DWord
+	DataBufferSize As DWord
+	DataBuffer As VoidPtr
+End Type
+TypeDef PTAPE_WMI_OPERATIONS = *TAPE_WMI_OPERATIONS
+
+Enum TAPE_DRIVE_PROBLEM_TYPE
+	TapeDriveProblemNone
+	TapeDriveReadWriteWarning
+	TapeDriveReadWriteError
+	TapeDriveReadWarning
+	TapeDriveWriteWarning
+	TapeDriveReadError
+	TapeDriveWriteError
+	TapeDriveHardwareError
+	TapeDriveUnsupportedMedia
+	TapeDriveScsiConnectionError
+	TapeDriveTimetoClean
+	TapeDriveCleanDriveNow
+	TapeDriveMediaLifeExpired
+	TapeDriveSnappedTape
+End Enum
+
+'#ifndef _NTTMAPI_
+'#define _NTTMAPI_
+
+'#include <ktmtypes.ab>
+
+' Types for Nt level TM calls
+Const TRANSACTIONMANAGER_QUERY_INFORMATION = &h0001
+Const TRANSACTIONMANAGER_SET_INFORMATION = &h0002
+Const TRANSACTIONMANAGER_RECOVER = &h0004
+Const TRANSACTIONMANAGER_RENAME = &h0008
+Const TRANSACTIONMANAGER_CREATE_RM = &h0010
+Const TRANSACTIONMANAGER_BIND_TRANSACTION = &h0020
+Const TRANSACTIONMANAGER_GENERIC_READ = (STANDARD_RIGHTS_READ Or TRANSACTIONMANAGER_QUERY_INFORMATION)
+Const TRANSACTIONMANAGER_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or TRANSACTIONMANAGER_SET_INFORMATION Or TRANSACTIONMANAGER_RECOVER Or TRANSACTIONMANAGER_RENAME Or TRANSACTIONMANAGER_CREATE_RM)
+Const TRANSACTIONMANAGER_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE)
+Const TRANSACTIONMANAGER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or TRANSACTIONMANAGER_GENERIC_READ Or TRANSACTIONMANAGER_GENERIC_WRITE Or TRANSACTIONMANAGER_GENERIC_EXECUTE Or TRANSACTIONMANAGER_BIND_TRANSACTION)
+
+Const TRANSACTION_QUERY_INFORMATION = &h0001
+Const TRANSACTION_SET_INFORMATION = &h0002
+Const TRANSACTION_ENLIST = &h0004
+Const TRANSACTION_COMMIT = &h0008
+Const TRANSACTION_ROLLBACK = &h0010
+Const TRANSACTION_PROPAGATE = &h0020
+Const TRANSACTION_SAVEPOINT = &h0040
+Const TRANSACTION_MARSHALL = ( TRANSACTION_QUERY_INFORMATION )
+Const TRANSACTION_GENERIC_READ = (STANDARD_RIGHTS_READ Or TRANSACTION_QUERY_INFORMATION Or SYNCHRONIZE)
+Const TRANSACTION_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or TRANSACTION_SET_INFORMATION Or TRANSACTION_COMMIT Or TRANSACTION_ENLIST Or TRANSACTION_ROLLBACK Or TRANSACTION_PROPAGATE Or TRANSACTION_SAVEPOINT Or SYNCHRONIZE)
+Const TRANSACTION_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or TRANSACTION_COMMIT Or TRANSACTION_ROLLBACK Or SYNCHRONIZE)
+Const TRANSACTION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or TRANSACTION_GENERIC_READ Or TRANSACTION_GENERIC_WRITE Or TRANSACTION_GENERIC_EXECUTE)
+Const TRANSACTION_RESOURCE_MANAGER_RIGHTS = (TRANSACTION_GENERIC_READ Or STANDARD_RIGHTS_WRITE Or TRANSACTION_SET_INFORMATION Or TRANSACTION_ENLIST Or TRANSACTION_ROLLBACK Or TRANSACTION_PROPAGATE Or SYNCHRONIZE)
+
+Const RESOURCEMANAGER_QUERY_INFORMATION = &h0001
+Const RESOURCEMANAGER_SET_INFORMATION = &h0002
+Const RESOURCEMANAGER_RECOVER = &h0004
+Const RESOURCEMANAGER_ENLIST = &h0008
+Const RESOURCEMANAGER_GET_NOTIFICATION = &h0010
+Const RESOURCEMANAGER_REGISTER_PROTOCOL = &h0020
+Const RESOURCEMANAGER_COMPLETE_PROPAGATION = &h0040
+Const RESOURCEMANAGER_GENERIC_READ = (STANDARD_RIGHTS_READ Or RESOURCEMANAGER_QUERY_INFORMATION Or SYNCHRONIZE)
+Const RESOURCEMANAGER_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or RESOURCEMANAGER_SET_INFORMATION Or RESOURCEMANAGER_RECOVER Or RESOURCEMANAGER_ENLIST Or RESOURCEMANAGER_GET_NOTIFICATION Or RESOURCEMANAGER_REGISTER_PROTOCOL Or RESOURCEMANAGER_COMPLETE_PROPAGATION Or SYNCHRONIZE)
+Const RESOURCEMANAGER_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or RESOURCEMANAGER_RECOVER Or RESOURCEMANAGER_ENLIST Or RESOURCEMANAGER_GET_NOTIFICATION Or RESOURCEMANAGER_COMPLETE_PROPAGATION Or SYNCHRONIZE)
+Const RESOURCEMANAGER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or RESOURCEMANAGER_GENERIC_READ Or RESOURCEMANAGER_GENERIC_WRITE Or RESOURCEMANAGER_GENERIC_EXECUTE)
+
+
+Const ENLISTMENT_QUERY_INFORMATION = &h0001
+Const ENLISTMENT_SET_INFORMATION = &h0002
+Const ENLISTMENT_RECOVER = &h0004
+Const ENLISTMENT_SUBORDINATE_RIGHTS = &h0008
+Const ENLISTMENT_SUPERIOR_RIGHTS = &h0010
+Const ENLISTMENT_GENERIC_READ = (STANDARD_RIGHTS_READ Or ENLISTMENT_QUERY_INFORMATION)
+Const ENLISTMENT_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE Or ENLISTMENT_SET_INFORMATION Or ENLISTMENT_RECOVER Or ENLISTMENT_SUBORDINATE_RIGHTS Or ENLISTMENT_SUPERIOR_RIGHTS)
+Const ENLISTMENT_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE Or ENLISTMENT_RECOVER Or ENLISTMENT_SUBORDINATE_RIGHTS Or ENLISTMENT_SUPERIOR_RIGHTS)
+Const ENLISTMENT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or ENLISTMENT_GENERIC_READ Or ENLISTMENT_GENERIC_WRITE Or ENLISTMENT_GENERIC_EXECUTE)
+
+' Transaction outcomes.
+
+Enum TRANSACTION_OUTCOME
+	TransactionOutcomeUndetermined = 1
+	TransactionOutcomeCommitted
+	TransactionOutcomeAborted
+End Enum
+
+Enum TRANSACTION_STATE
+	TransactionStateNormal = 1
+	TransactionStateIndoubt
+	TransactionStateCommittedNotify
+End Enum
+
+Type TRANSACTION_BASIC_INFORMATION
+	TransactionId As GUID
+	State As DWord
+	Outcome As DWord
+End Type
+TypeDef PTRANSACTION_BASIC_INFORMATION = *TRANSACTION_BASIC_INFORMATION
+
+Type TRANSACTIONMANAGER_BASIC_INFORMATION
+	TmIdentity As GUID
+	VirtualClock As LARGE_INTEGER
+End Type
+TypeDef PTRANSACTIONMANAGER_BASIC_INFORMATION = *TRANSACTIONMANAGER_BASIC_INFORMATION
+
+Type TRANSACTIONMANAGER_LOG_INFORMATION
+	LogIdentity As GUID
+End Type
+TypeDef PTRANSACTIONMANAGER_LOG_INFORMATION = *TRANSACTIONMANAGER_LOG_INFORMATION
+
+Type TRANSACTIONMANAGER_LOGPATH_INFORMATION
+	LogPathLength As DWord
+	/*__field_ecount(LogPathLength)*/ LogPath[ELM(1)] As WCHAR 'Variable size
+'	Data[ELM(1)] 'Variable size data not declared
+End Type
+TypeDef PTRANSACTIONMANAGER_LOGPATH_INFORMATION = *TRANSACTIONMANAGER_LOGPATH_INFORMATION
+
+Type TRANSACTION_PROPERTIES_INFORMATION
+	IsolationLevel As DWord
+	IsolationFlags As DWord
+	Timeout As LARGE_INTEGER
+	Outcome As DWord
+	DescriptionLength As DWord
+	Description[ELM(1)] As WCHAR 'Variable size
+'	Data[ELM(1)] 'Variable size data not declared
+End Type
+TypeDef PTRANSACTION_PROPERTIES_INFORMATION = *TRANSACTION_PROPERTIES_INFORMATION
+
+Type TRANSACTION_BIND_INFORMATION
+	TmHandle As HANDLE
+End Type
+TypeDef PTRANSACTION_BIND_INFORMATION = *TRANSACTION_BIND_INFORMATION
+
+Type TRANSACTION_ENLISTMENT_PAIR
+	EnlistmentId As GUID
+	ResourceManagerId As GUID
+End Type
+TypeDef PTRANSACTION_ENLISTMENT_PAIR = *TRANSACTION_ENLISTMENT_PAIR
+
+Type TRANSACTION_ENLISTMENTS_INFORMATION
+	NumberOfEnlistments As DWord
+	EnlistmentPair[ELM(1)] As TRANSACTION_ENLISTMENT_PAIR 'Variable size
+End Type
+TypeDef PTRANSACTION_ENLISTMENTS_INFORMATION = *TRANSACTION_ENLISTMENTS_INFORMATION
+
+Type TRANSACTION_FULL_INFORMATION
+	NameLength As DWord
+End Type
+TypeDef PTRANSACTION_FULL_INFORMATION = *TRANSACTION_FULL_INFORMATION
+
+Type RESOURCEMANAGER_BASIC_INFORMATION
+	ResourceManagerId As GUID
+	DescriptionLength As DWord
+	Description[ELM(1)] As WCHAR 'Variable size
+End Type
+TypeDef PRESOURCEMANAGER_BASIC_INFORMATION = *RESOURCEMANAGER_BASIC_INFORMATION
+
+Type RESOURCEMANAGER_COMPLETION_INFORMATION
+	IoCompletionPortHandle As HANDLE
+	CompletionKey As ULONG_PTR
+End Type
+TypeDef PRESOURCEMANAGER_COMPLETION_INFORMATION = *RESOURCEMANAGER_COMPLETION_INFORMATION
+
+Type TRANSACTION_NAME_INFORMATION
+	NameLength As DWord
+	Name[ELM(1)] As WCHAR 'Variable length string
+End Type
+TypeDef PTRANSACTION_NAME_INFORMATION = *TRANSACTION_NAME_INFORMATION
+
+Enum TRANSACTION_INFORMATION_CLASS
+	TransactionBasicInformation
+	TransactionPropertiesInformation
+	TransactionEnlistmentInformation
+	TransactionFullInformation
+	TransactionBindInformation
+'	TransactionNameInformation
+End Enum
+
+Enum TRANSACTIONMANAGER_INFORMATION_CLASS
+	TransactionManagerBasicInformation
+	TransactionManagerLogInformation
+	TransactionManagerLogPathInformation
+	TransactionManagerOnlineProbeInformation
+End Enum
+
+Enum RESOURCEMANAGER_INFORMATION_CLASS
+	ResourceManagerBasicInformation
+	ResourceManagerCompletionInformation
+	ResourceManagerFullInformation
+	ResourceManagerNameInformation
+End Enum
+
+Type ENLISTMENT_BASIC_INFORMATION
+	EnlistmentId As GUID
+	TransactionId As GUID
+	ResourceManagerId As GUID
+End Type
+TypeDef PENLISTMENT_BASIC_INFORMATION = *ENLISTMENT_BASIC_INFORMATION
+
+Enum ENLISTMENT_INFORMATION_CLASS
+	EnlistmentBasicInformation
+	EnlistmentRecoveryInformation
+	EnlistmentFullInformation
+	EnlistmentNameInformation
+End Enum
+
+Type TRANSACTION_LIST_ENTRY
+'	UOW As UOW
+End Type
+
+TypeDef PTRANSACTION_LIST_ENTRY = *TRANSACTION_LIST_ENTRY
+
+Type TRANSACTION_LIST_INFORMATION
+	NumberOfTransactions As DWord
+	TransactionInformation[ELM(1)] As TRANSACTION_LIST_ENTRY
+End Type
+TypeDef PTRANSACTION_LIST_INFORMATION = *TRANSACTION_LIST_INFORMATION
+
+' Types of objects known to the kernel transaction manager.
+Enum KTMOBJECT_TYPE
+	KTMOBJECT_TRANSACTION
+	KTMOBJECT_TRANSACTION_MANAGER
+	KTMOBJECT_RESOURCE_MANAGER
+	KTMOBJECT_ENLISTMENT
+	KTMOBJECT_INVALID
+End Enum
+TypeDef PKTMOBJECT_TYPE = *KTMOBJECT_TYPE
+
+' KTMOBJECT_CURSOR
+Type KTMOBJECT_CURSOR
+	LastQuery As GUID
+	ObjectIdCount As DWord
+	ObjectIds[ELM(1)] As GUID
+End Type
+TypeDef PKTMOBJECT_CURSOR = *KTMOBJECT_CURSOR
+
+'#endif
+
+TypeDef TP_VERSION = DWord
+TypeDef PTP_VERSION = *TP_VERSION
+
+TypeDef PTP_CALLBACK_INSTANCE = VoidPtr
+'typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE, *PTP_CALLBACK_INSTANCE;
+
+TypeDef PTP_SIMPLE_CALLBACK = *Sub(Instance As PTP_CALLBACK_INSTANCE, Context As VoidPtr)
+TypeDef PTP_POOL = VoidPtr
+'typedef struct _TP_POOL TP_POOL, *PTP_POOL;
+TypeDef PTP_CLEANUP_GROUP = VoidPtr
+'typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP, *PTP_CLEANUP_GROUP;
+TypeDef PTP_CLEANUP_GROUP_CANCEL_CALLBACK = *Sub(ObjectContext As VoidPtr, CleanupContext As VoidPtr)
+
+TypeDef PACTIVATION_CONTEXT = VoidPtr
+
+Type TP_CALLBACK_ENVIRON
+	Version As TP_VERSION
+	Pool As PTP_POOL
+	CleanupGroup As PTP_CLEANUP_GROUP
+	CleanupGroupCancelCallback As PTP_CLEANUP_GROUP_CANCEL_CALLBACK
+	RaceDll As VoidPtr
+	ActivationContext As PACTIVATION_CONTEXT
+	FinalizationCallback As PTP_SIMPLE_CALLBACK
+'	Union
+		Flags As DWord
+'		Type
+'			LongFunction :  1 As DWord
+'			Private_     : 31 As DWord
+'		} s;
+'	End Union
+End Type
+TypeDef PTP_CALLBACK_ENVIRON = *TP_CALLBACK_ENVIRON
+
+Sub /*FORCEINLINE*/ TpInitializeCallbackEnviron(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON)
+	With CallbackEnviron
+		.Version = 1
+		.Pool = NULL
+		.CleanupGroup = NULL
+		.CleanupGroupCancelCallback = NULL
+		.RaceDll = NULL
+		.ActivationContext = NULL
+		.FinalizationCallback = NULL
+		.Flags = 0
+	End With
+End Sub
+
+Sub /*FORCEINLINE*/ TpSetCallbackThreadpool(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON, Pool As PTP_POOL)
+	CallbackEnviron.Pool = Pool
+End Sub
+
+Sub /*FORCEINLINE*/ TpSetCallbackCleanupGroup(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON, CleanupGroup As PTP_CLEANUP_GROUP, CleanupGroupCancelCallback As PTP_CLEANUP_GROUP_CANCEL_CALLBACK)
+	CallbackEnviron.CleanupGroup = CleanupGroup
+	CallbackEnviron.CleanupGroupCancelCallback = CleanupGroupCancelCallback
+End Sub
+
+Sub /*FORCEINLINE*/ TpSetCallbackActivationContext(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON, ActivationContext As PACTIVATION_CONTEXT)
+	CallbackEnviron.ActivationContext = ActivationContext
+End Sub
+
+Sub /*FORCEINLINE*/ TpSetCallbackNoActivationContext(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON)
+	CallbackEnviron.ActivationContext = (-1 As LONG_PTR) As PACTIVATION_CONTEXT
+End Sub
+
+Sub /*FORCEINLINE*/ TpSetCallbackLongFunction(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON)
+	CallbackEnviron.Flags = 1 'u.s.LongFunction = 1
+End Sub
+
+Sub /*FORCEINLINE*/ TpSetCallbackRaceWithDll(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON, DllHandle As VoidPtr)
+	CallbackEnviron.RaceDll = DllHandle
+End Sub
+
+Sub /*FORCEINLINE*/ TpSetCallbackFinalizationCallback(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON, FinalizationCallback As PTP_SIMPLE_CALLBACK)
+	CallbackEnviron.FinalizationCallback = FinalizationCallback
+End Sub
+
+Sub /*FORCEINLINE*/ TpDestroyCallbackEnviron(ByRef CallbackEnviron As TP_CALLBACK_ENVIRON)
+'	UNREFERENCED_PARAMETER(CallbackEnviron)
+End Sub
+
+TypeDef PTP_WORK = VoidPtr
+'typedef struct _TP_WORK TP_WORK, *PTP_WORK;
+
+TypeDef PTP_WORK_CALLBACK = *Sub(Instance As PTP_CALLBACK_INSTANCE, Context As VoidPtr, Work As PTP_WORK)
+
+TypeDef PTP_TIMER = *VoidPtr
+'typedef struct _TP_TIMER TP_TIMER, *PTP_TIMER;
+
+TypeDef PTP_TIMER_CALLBACK = *Sub(Instance As PTP_CALLBACK_INSTANCE, Context As VoidPtr, Timer As PTP_TIMER)
+
+TypeDef TP_WAIT_RESULT = DWord
+
+TypeDef PTP_WAIT = VoidPtr
+'typedef struct _TP_WAIT TP_WAIT, *PTP_WAIT;
+
+TypeDef PTP_WAIT_CALLBACK = *Sub(Instance As PTP_CALLBACK_INSTANCE, Context As VoidPtr, Wait As PTP_WAIT, WaitResult As TP_WAIT_RESULT)
+
+TypeDef PTP_IO = VoidPtr
+'typedef struct _TP_IO TP_IO, *PTP_IO;
+
+'NtCurrentTeb()
+'GetCurrentFiber()
+'GetFiberData ()
+
+'#if (_WIN32_WINNT > 0x0500) Or (_WIN32_FUSION >= 0x0100) Or ISOLATION_AWARE_ENABLED
+Const ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION = 1
+Const ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION = 2
+Const ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION = 3
+Const ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION = 4
+Const ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION = 5
+Const ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION = 6
+Const ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION = 7
+Const ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE = 8
+Const ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES = 9
+Const ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS = 10
+'#endif // winnt_only
+
Index: /trunk/ab5.0/ablib/src/abgl.ab
===================================================================
--- /trunk/ab5.0/ablib/src/abgl.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/abgl.ab	(revision 506)
@@ -0,0 +1,2162 @@
+#ifndef _INC_ABGL
+#define _INC_ABGL
+
+#require <GL/gl.sbp>
+#require <GL/glu.sbp>
+
+Enum VertexFormatsf
+	PositionOnly
+	PositionColoered
+End Enum
+
+Enum VertexFormatsd
+	PositionOnly
+	PositionColoered
+End Enum
+
+NameSpace CustomVertexf
+	Type PositionOnly
+		x As GLfloat
+		y As GLfloat
+		z As GLfloat
+	Public
+	End Type
+
+	Type PositionColoered
+	Public
+		x As GLfloat
+		y As GLfloat
+		z As GLfloat
+		r As GLfloat
+		g As GLfloat
+		b As GLfloat
+		a As GLfloat
+	End Type
+End NameSpace
+
+NameSpace CustomVertexd
+	Type PositionOnly
+	Public
+		x As GLdouble
+		y As GLdouble
+		z As GLdouble
+	End Type
+
+	Type PositionColoered
+	Public
+		x As GLdouble
+		y As GLdouble
+		z As GLdouble
+		r As GLdouble
+		g As GLdouble
+		b As GLdouble
+		a As GLdouble
+	End Type
+End NameSpace
+
+Class VertexBuffer
+Public
+	Sub VertexBuffer()
+	End Sub
+	Sub ~VertexBuffer()
+	End Sub
+
+Public
+	Function Size() As GLuint
+		Return 0
+	End Function
+	Function Lock() As VoidPtr
+		Return NULL
+	End Function
+	Sub Unlock()
+	End Sub
+End Class
+
+Type XY_FLOAT
+	x As GLfloat
+	y As GLfloat
+End Type
+
+Type XY_DOUBLE
+	x As GLdouble
+	y As GLdouble
+End Type
+
+Class Vector2f
+Public /* constructor */
+	Sub Vector2f()
+		This.X=0.0 As GLfloat
+		This.Y=0.0 As GLfloat
+	End Sub
+	Sub Vector2f(x As GLfloat, y As GLfloat)
+		This.X=x
+		This.Y=y
+	End Sub
+	Sub Vector2f(Vec As Vector2d)
+		This.X=Vec.X As GLfloat
+		This.Y=Vec.Y As GLfloat
+	End Sub
+
+Public /* destructor */
+	Sub ~Vector2f()
+	End Sub
+
+Public /* property */
+	Function X() As GLfloat
+		Return xy.x
+	End Function
+	Function Y() As GLfloat
+		Return xy.y
+	End Function
+	Sub X(x As GLfloat)
+		xy.x=x
+	End Sub
+	Sub Y(y As GLfloat)
+		xy.y=y
+	End Sub
+
+Public /* operator */
+	Sub Operator = (ByRef SrcVec As Vector2f)
+		This.X=SrcVec.X
+		This.Y=SrcVec.Y
+	End Sub
+	Function Operator + (SrcVec As Vector2f) As Vector2f
+		Return Add(This,SrcVec)
+	End Function
+	Function Operator - (SrcVec As Vector2f) As Vector2f
+		Return Substract(This,SrcVec)
+	End Function
+/*	Function Operator * (SrcVec As Vector2f) As GLfloat
+		Return Dot(This,SrcVec)
+	End Function*/
+	Function Operator * (Src As GLint) As Vector2f
+		Dim ret As Vector2f(This.X*Src,This.Y*Src)
+		Return ret
+	End Function
+	Function Operator * (Src As GLfloat) As Vector2f
+		Dim ret As Vector2f(This.X*Src,This.Y*Src)
+		Return ret
+	End Function
+	Function Operator * (Src As GLdouble) As Vector2f
+		Dim ret As Vector2f(This.X*Src As GLfloat,This.Y*Src As GLfloat)
+		Return ret
+	End Function
+	Function Operator / (Src As GLint) As Vector2f
+		Dim ret As Vector2f(This.X/Src,This.Y/Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLfloat) As Vector2f
+		Dim ret As Vector2f(This.X/Src,This.Y/Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLdouble) As Vector2f
+		Dim ret As Vector2f(This.X/Src,This.Y/Src)
+		Return ret
+	End Function
+
+	Function Operator == (Vec As Vector2f) As Boolean
+		If This.X=Vec.X and This.Y=Vec.Y Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+Public /* method */
+	Function Add(SrcVec1 As Vector2f, SrcVec2 As Vector2f) As Vector2f
+		Dim ret As Vector2f(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y)
+		Return ret
+	End Function
+	Function Distance(SrcVec1 As Vector2f, SrcVec2 As Vector2f) As GLfloat
+		Dim ret As Vector2f
+		ret=SrcVec1-SrcVec2
+		Return ret.Magnitude
+	End Function
+	Function Dot(SrcVec1 As Vector2f, SrcVec2 As Vector2f) As GLfloat
+		Return (SrcVec1.X*SrcVec2.X)+(SrcVec1.Y*SrcVec2.Y)
+	End Function
+	Function Empty() As Vector2f
+		Return New Vector2f()
+	End Function
+	Function Magnitude() As GLfloat
+		Return Math.Sqrt(This.X^2+This.Y^2) As GLfloat
+	End Function
+	Sub Normalize()
+		Dim ret As Vector2f(This.X/This.Magnitude,This.Y/This.Magnitude)
+		This = ret
+	End Sub
+	Function NormalizedVector() As Vector2f
+		Dim ret As Vector2f(This.X/This.Magnitude,This.Y/This.Magnitude)
+		Return ret
+	End Function
+	Function Substract(SrcVec1 As Vector2f, SrcVec2 As Vector2f) As Vector2f
+		Dim ret As Vector2f(SrcVec1.X-SrcVec2.X,SrcVec1.Y-SrcVec2.Y)
+		Return ret
+	End Function
+	Sub Reverse()
+		Dim ret As Vector2f(-This.X,-This.Y)
+		This = ret
+	End Sub
+	Function ReversedVector() As Vector2f
+		Dim ret As Vector2f(-This.X,-This.Y)
+		Return ret
+	End Function
+
+Public /* Object Class Override */
+	Override Function Equals( object As Object ) As Boolean
+		If This.GetHashCode() = object.GetHashCode() Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	Override Function ToString() As String
+		Return GetType().Name
+	End Function
+
+Protected /* Data */
+	xy As XY_FLOAT
+End Class
+
+Class Vector2d
+Public /* constructor */
+	Sub Vector2d()
+		This.X=0.0 As GLdouble
+		This.Y=0.0 As GLdouble
+	End Sub
+	Sub Vector2d(x As GLdouble, y As GLdouble)
+		xy.x=x
+		xy.y=y
+	End Sub
+	Sub Vector2d(Vec As Vector2f)
+		This.X=Vec.X As GLdouble
+		This.Y=Vec.Y As GLdouble
+	End Sub
+
+Public /* destructor */
+	Sub ~Vector2d()
+	End Sub
+
+Public /* property */
+	Function X() As GLdouble
+		Return xy.x
+	End Function
+	Function Y() As GLdouble
+		Return xy.y
+	End Function
+	Sub X(x As GLdouble)
+		xy.x=x
+	End Sub
+	Sub Y(y As GLdouble)
+		xy.y=y
+	End Sub
+
+Public /* operator */
+	Sub Operator = (ByRef SrcVec As Vector2d)
+		This.X=SrcVec.X
+		This.Y=SrcVec.Y
+	End Sub
+	Function Operator + (SrcVec As Vector2d) As Vector2d
+		Return Add(This,SrcVec)
+	End Function
+	Function Operator - (SrcVec As Vector2d) As Vector2d
+		Return Substract(This,SrcVec)
+	End Function
+/*	Function Operator * (SrcVec As Vector2d) As GLdouble
+		Return Dot(This,SrcVec)
+	End Function*/
+	Function Operator * (Src As GLint) As Vector2d
+		Dim ret As Vector2d(This.X*Src,SrcVec.Y*Src)
+		Return ret
+	End Function
+	Function Operator * (Src As GLfloat) As Vector2d
+		Dim ret As Vector2d(This.X*Src,SrcVec.Y*Src)
+		Return ret
+	End Function
+	Function Operator * (Src As GLdouble) As Vector2d
+		Dim ret As Vector2d(This.X*Src,SrcVec.Y*Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLint) As Vector2d
+		Dim ret As Vector2d(This.X/Src,SrcVec.Y/Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLfloat) As Vector2d
+		Dim ret As Vector2d(This.X/Src,SrcVec.Y/Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLdouble) As Vector2d
+		Dim ret As Vector2d(This.X/Src,SrcVec.Y/Src)
+		Return ret
+	End Function
+
+	Function Operator == (Vec As Vector2d) As Boolean
+		If This.X=Vec.X and This.Y=Vec.Y Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+
+Public /* method */
+	Function Add(SrcVec1 As Vector2d, SrcVec2 As Vector2d) As Vector2d
+		Dim ret As Vector2d(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y)
+		Return ret
+	End Function
+	Function Distance(SrcVec1 As Vector2d, SrcVec2 As Vector2d) As GLdouble
+		Dim ret As Vector2d
+		ret=SrcVec1-SrcVec2
+		Return ret.Magnitude
+	End Function
+	Function Dot(SrcVec1 As Vector2d, SrcVec2 As Vector2d) As GLdouble
+		Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y
+	End Function
+	Function Empty() As Vector2d
+		Return New Vector2d()
+	End Function
+	Function Magnitude() As GLdouble
+		Return Math.Sqrt(This.X^2+This.Y^2) As GLdouble
+	End Function
+	Sub Normalize()
+		Dim ret As Vector2d(This.X/This.Magnitude,This.Y/This.Magnitude)
+		This = ret
+	End Sub
+	Function NormalizedVector() As Vector2d
+		Dim ret As Vector2d(This.X/This.Magnitude,This.Y/This.Magnitude)
+		Return ret
+	End Function
+	Function Substract(SrcVec1 As Vector2d, SrcVec2 As Vector2d) As Vector2d
+		Dim ret As Vector2d(SrcVec1.X-SrcVec2.X,SrcVec1.Y-SrcVec2.Y)
+		Return ret
+	End Function
+	Sub Reverse()
+		Dim ret As Vector2d(-This.X,-This.Y)
+		This = ret
+	End Sub
+	Function ReversedVector() As Vector2d
+		Dim ret As Vector2d(-This.X,-This.Y)
+		Return ret
+	End Function
+
+Public /* Object Class Override */
+	Override Function Equals( object As Object ) As Boolean
+		If This.GetHashCode() = object.GetHashCode() Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	Override Function ToString() As String
+		Return GetType().Name
+	End Function
+
+Public /* Data */
+	xz As XY_DOUBLE
+End Class
+
+
+Type XYZ_FLOAT
+	x As GLfloat
+	y As GLfloat
+	z As GLfloat
+End Type
+
+Type XYZ_DOUBLE
+	x As GLdouble
+	y As GLdouble
+	z As GLdouble
+End Type
+
+Class Vector3f
+Public /* constructor */
+	Sub Vector3f()
+		This.X=0.0 As GLfloat
+		This.Y=0.0 As GLfloat
+		This.Z=0.0 As GLfloat
+	End Sub
+	Sub Vector3f(x As GLfloat, y As GLfloat, z As GLfloat)
+		xyz.x=x
+		xyz.y=y
+		xyz.z=z
+	End Sub
+	Sub Vector3f(Vec As Vector3d)
+		This.X=Vec.X As GLfloat
+		This.Y=Vec.Y As GLfloat
+		This.Z=Vec.Z As GLfloat
+	End Sub
+
+Public /* destructor */
+	Sub ~Vector3f()
+	End Sub
+
+Public /* property */
+	Function X() As GLfloat
+		Return xyz.x
+	End Function
+	Function Y() As GLfloat
+		Return xyz.y
+	End Function
+	Function Z() As GLfloat
+		Return xyz.z
+	End Function
+	Sub X(x As GLfloat)
+		xyz.x=x
+	End Sub
+	Sub Y(y As GLfloat)
+		xyz.y=y
+	End Sub
+	Sub Z(z As GLfloat)
+		xyz.z=z
+	End Sub
+
+Public /* operator */
+	Sub Operator = (ByRef SrcVec As Vector3f)
+		This.X=SrcVec.X
+		This.Y=SrcVec.Y
+	End Sub
+	Function Operator + (SrcVec As Vector3f) As Vector3f
+		Return Add(This,SrcVec)
+	End Function
+	Function Operator - (SrcVec As Vector3f) As Vector3f
+		Return Substract(This,SrcVec)
+	End Function
+/*	Function Operator * (SrcVec As Vector3f) As GLfloat
+		Return Dot(This,SrcVec)
+	End Function*/
+	Function Operator ^ (SrcVec As Vector3f) As Vector3f
+		Return Cross(This,SrcVec)
+	End Function
+
+	Function Operator * (Src As GLint) As Vector3f
+		Dim ret As Vector3f(This.X*Src,This.Y*Src,This.Z*Src)
+		Return ret
+	End Function
+	Function Operator * (Src As GLfloat) As Vector3f
+		Dim ret As Vector3f(This.X*Src,This.Y*Src,This.Z*Src)
+		Return ret
+	End Function
+	Function Operator * (Src As GLdouble) As Vector3f
+		Dim ret As Vector3f(This.X*Src,This.Y*Src,This.Z*Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLint) As Vector3f
+		Dim ret As Vector3f(This.X/Src,This.Y/Src,This.Z/Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLfloat) As Vector3f
+		Dim ret As Vector3f(This.X/Src,This.Y/Src,This.Z/Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLdouble) As Vector3f
+		Dim ret As Vector3f(This.X/Src,This.Y/Src,This.Z/Src)
+		Return ret
+	End Function
+
+	Function Operator == (Vec As Vector3f) As Boolean
+		If This.X=Vec.X and This.Y=Vec.Y and This.Z=Vec.Z Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+Public /* method */
+	Function Add(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As Vector3f
+		Dim ret As Vector3f(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z+SrcVec2.Z)
+		Return ret
+	End Function
+	Function Cross(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As Vector3f
+		Dim ret As Vector3f(SrcVec1.Y*SrcVec2.Z-SrcVec1.Z*SrcVec2.Y,SrcVec1.Z*SrcVec2.X-SrcVec1.X*SrcVec2.Z,SrcVec1.X*SrcVec2.Y-SrcVec1.Y*SrcVec2.X)
+		Return ret
+	End Function
+	Function Distance(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As GLfloat
+		Dim ret As Vector3f
+		ret=SrcVec1-SrcVec2
+		Return ret.Magnitude
+	End Function
+	Function Dot(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As GLfloat
+		Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y+SrcVec1.Z*SrcVec2.Z
+	End Function
+	Function Empty() As Vector3f
+		Return New Vector3f()
+	End Function
+	Function Magnitude() As GLfloat
+		Return Math.Sqrt(This.X^2+This.Y^2+This.Z^2) As GLfloat
+	End Function
+	Sub Normalize()
+		Dim ret As Vector3f(This.X/This.Magnitude,This.Y/This.Magnitude,This.Z/This.Magnitude)
+		This = ret
+	End Sub
+	Function NormalizedVector() As Vector3f
+		Dim ret As Vector3f(This.X/This.Magnitude,This.Y/This.Magnitude,This.Z/This.Magnitude)
+		Return ret
+	End Function
+	Function Substract(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As Vector3f
+		Dim ret As Vector3f(SrcVec1.X-SrcVec2.X,SrcVec1.Y-SrcVec2.Y,SrcVec1.Z-SrcVec2.Z)
+		Return ret
+	End Function
+	Sub Reverse()
+		Dim ret As Vector3f(-This.X,-This.Y,-This.Z)
+		This = ret
+	End Sub
+	Function ReversedVector() As Vector3f
+		Dim ret As Vector3f(-This.X,-This.Y,-This.Z)
+		Return ret
+	End Function
+
+Public /* Object Class Override */
+	Override Function Equals( object As Object ) As Boolean
+		If This.GetHashCode() = object.GetHashCode() Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	Override Function ToString() As String
+		Return GetType().Name
+	End Function
+
+Public /* Data */
+	xyz As XYZ_FLOAT
+End Class
+
+Class Vector3d
+Public /* constructor */
+	Sub Vector3d()
+		This.X=0.0 As GLdouble
+		This.Y=0.0 As GLdouble
+		This.Z=0.0 As GLdouble
+	End Sub
+	Sub Vector3d(x As GLdouble, y As GLdouble, z As GLdouble)
+		xyz.x=x
+		xyz.y=y
+		xyz.z=z
+	End Sub
+	Sub Vector3d(Vec As Vector3f)
+		This.X=Vec.X As GLdouble
+		This.Y=Vec.Y As GLdouble
+		This.Z=Vec.Z As GLdouble
+	End Sub
+
+Public /* destructor */
+	Sub ~Vector3d()
+	End Sub
+
+
+Public /* property */
+	Function X() As GLdouble
+		Return xyz.x
+	End Function
+	Function Y() As GLdouble
+		Return xyz.y
+	End Function
+	Function Z() As GLdouble
+		Return xyz.z
+	End Function
+	Sub X(x As GLdouble)
+		xyz.x=x
+	End Sub
+	Sub Y(y As GLdouble)
+		xyz.y=y
+	End Sub
+	Sub Z(z As GLdouble)
+		xyz.z=z
+	End Sub
+
+
+Public /* operator */
+	Sub Operator = (ByRef SrcVec As Vector3d)
+		This.X=SrcVec.X
+		This.Y=SrcVec.Y
+	End Sub
+	Function Operator + (SrcVec As Vector3d) As Vector3d
+		Return Add(This,SrcVec)
+	End Function
+	Function Operator - (SrcVec As Vector3d) As Vector3d
+		Return Substract(This,SrcVec)
+	End Function
+/*	Function Operator * (SrcVec As Vector3d) As GLdouble
+		Return Dot(This,SrcVec)
+	End Function*/
+	Function Operator ^ (SrcVec As Vector3d) As Vector3d
+		Return Cross(This,SrcVec)
+	End Function
+
+	Function Operator * (Src As GLint) As Vector3d
+		Dim ret As Vector3d(This.X*Src,This.Y*Src,This.Z*Src)
+		Return ret
+	End Function
+	Function Operator * (Src As GLfloat) As Vector3d
+		Dim ret As Vector3d(This.X*Src,This.Y*Src,This.Z*Src)
+		Return ret
+	End Function
+	Function Operator * (Src As GLdouble) As Vector3d
+		Dim ret As Vector3d(This.X*Src,This.Y*Src,This.Z*Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLint) As Vector3d
+		Dim ret As Vector3d(This.X/Src,This.Y/Src,This.Z/Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLfloat) As Vector3d
+		Dim ret As Vector3d(This.X/Src,This.Y/Src,This.Z/Src)
+		Return ret
+	End Function
+	Function Operator / (Src As GLdouble) As Vector3d
+		Dim ret As Vector3d(This.X/Src,This.Y/Src,This.Z/Src)
+		Return ret
+	End Function
+
+	Function Operator == (Vec As Vector3d) As Boolean
+		If This.X=Vec.X and This.Y=Vec.Y and This.Z=Vec.Z Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+
+
+Public /* method */
+	Function Add(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As Vector3d
+		Dim ret As Vector3d(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z+SrcVec2.Z)
+		Return ret
+	End Function
+	Function Cross(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As Vector3d
+		Dim ret As Vector3d(SrcVec1.Y*SrcVec2.Z-SrcVec1.Z*SrcVec2.Y,SrcVec1.Z*SrcVec2.X-SrcVec1.X*SrcVec2.Z,SrcVec1.X*SrcVec2.Y-SrcVec1.Y*SrcVec2.X)
+		Return ret
+	End Function
+	Function Distance(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As GLdouble
+		Dim ret As Vector3d
+		ret=SrcVec1-SrcVec2
+		Return ret.Magnitude
+	End Function
+	Function Dot(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As GLdouble
+		Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y+SrcVec1.Z*SrcVec2.Z
+	End Function
+	Function Empty() As Vector3d
+		Dim ret As Vector3d()
+		Return ret
+	End Function
+	Function Magnitude() As GLdouble
+		Return Math.Sqrt(This.X^2+This.Y^2+This.Z^2) As GLdouble
+	End Function
+	Sub Normalize()
+		Dim ret As Vector3d(This.X/This.Magnitude,This.Y/This.Magnitude,This.Z/This.Magnitude)
+		This = ret
+	End Sub
+	Function NormalizedVector() As Vector3d
+		Dim ret As Vector3d(This.X/This.Magnitude,This.Y/This.Magnitude,This.Z/This.Magnitude)
+		Return ret
+	End Function
+	Function Substract(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As Vector3d
+		Dim ret As Vector3d(SrcVec1.X-SrcVec2.X,SrcVec1.Y-SrcVec2.Y,SrcVec1.Z-SrcVec2.Z)
+		Return ret
+	End Function
+	Sub Reverse()
+		Dim ret As Vector3d(-This.X,-This.Y,-This.Z)
+		This = ret
+	End Sub
+	Function ReversedVector() As Vector3d
+		Dim ret As Vector3d(-This.X,-This.Y,-This.Z)
+		Return ret
+	End Function
+
+Public /* Object Class Override */
+	Override Function Equals( object As Object ) As Boolean
+		If This.GetHashCode() = object.GetHashCode() Then
+			Return True
+		Else
+			Return False
+		End If
+	End Function
+	Override Function ToString() As String
+		Return GetType().Name
+	End Function
+
+Public /* Data */
+	xyz As XYZ_DOUBLE
+End Class
+
+NameSpace Matrix
+	Class Matrix3x3f
+	End Class
+
+	Class Matrix3x3d
+	End Class
+
+	Class Matrix4x4f
+	End Class
+
+	Class Matrix4x4d
+	End Class
+End NameSpace
+
+Type RGB_FLOAT
+	r As GLfloat
+	g As GLfloat
+	b As GLfloat
+End Type
+
+Type RGB_DOUBLE
+	r As GLdouble
+	g As GLdouble
+	b As GLdouble
+End Type
+
+Class Color3f
+Public /* constructor */
+	Sub Color3f(r As GLfloat, g As GLfloat, b As GLfloat)
+		rgb.r = r
+		rgb.g = g
+		rgb.b = b
+	End Sub
+	Sub Color3f(color As Color3d)
+		rgba.r = color.R As GLfloat
+		rgba.g = color.G As GLfloat
+		rgba.b = color.B As GLfloat
+	End Sub
+
+Public /* destructor */
+	Sub ~Color3f()
+	End Sub
+
+Public /* property */
+	Function R() As GLfloat
+		Return rgb.r
+	End Function
+	Function G() As GLfloat
+		Return rgb.g
+	End Function
+	Function B() As GLfloat
+		Return rgb.b
+	End Function
+	Sub R(r As GLfloat)
+		rgb.r = r
+	End Sub
+	Sub G(g As GLfloat)
+		rgb.g = g
+	End Sub
+	Sub B(b As GLfloat)
+		rgb.b = b
+	End Sub
+
+Public /* operator */
+	Sub operator = (c As Color3f)
+		This.R=c.R
+		This.G=c.G
+		This.B=c.B
+	End Sub
+
+Public /* method */
+	' HSBを求める式はhttp://ofo.jp/osakana/cgtips/hsb.phtmlを参考にした
+	' Drawwing\Color.abをさらに参考にしました。
+	Function GetHue() As GLfloat
+		Dim max As GLfloat, min As GLfloat, d As GLfloat
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
+		d = max - min
+		If rgb.g = max Then
+			Return ((rgb.b - rgb.r) As Double / d * 60.0 + 120.0) As GLfloat
+		ElseIf rgb.b = max Then
+			Return ((rgb.r - rgb.g) As Double / d * 60.0 + 240.0) As GLfloat
+		ElseIf rgb.g < rgb.b Then
+			Return ((rgb.g - rgb.b) As Double / d * 60.0 + 360.0) As GLfloat
+		Else
+			Return ((rgb.g - rgb.b) As Double / d * 60.0) As GLfloat
+		EndIf
+	End Function
+
+	Function GetSaturation() As GLfloat
+		Dim max As GLfloat, min As GLfloat
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
+		Return (max - min) / max
+	End Function
+
+	Function GetVolue() As GLfloat
+		Dim max As GLfloat
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		Return max
+	End Function
+
+Public /* static method */
+	Static Function FromRGB(r As GLubyte, g As GLubyte, b As GLubyte) As Color3f
+		Dim ret As Color3f((r As GLfloat)/255.0 As GLfloat,(g As GLfloat)/255.0 As GLfloat,(b As GLfloat)/255.0 As GLfloat)
+		Return ret
+	End Function
+	Static Function FromCOLORREF(c As COLORREF) As Color3f
+		Dim ret As Color3f((c and &hff) As GLfloat/255,(c>>8 and &hff) As GLfloat/255,(c>>16 and &hff) As GLfloat/255)
+		Return ret
+	End Function
+	Static Function FromHSV(h As GLfloat, s As GLfloat, v As GLfloat) As Color3f
+		Dim r As GLfloat
+		Dim g As GLfloat
+		Dim b As GLfloat
+		If h<0 Then h+=360.0
+		If h>360.0 Then h-=360.0
+		Select Case (h/60) As Long
+			Case 0
+				r=v
+				g=v*(1-s*(1-(h/60-(h/60) As Long)))
+				b=v*(1-s)
+			Case 1
+				r=v*(1-s*(h/60-(h/60) As Long))
+				g=v
+				b=v*(1-s)
+			Case 2
+				r=v*(1-s)
+				g=v
+				b=v*(1-s*(1-(h/60-(h/60) As Long)))
+			Case 3
+				r=v*(1-s)
+				g=v*(1-s*(h/60-(h/60) As Long))
+				b=v
+			Case 4
+				r=v*(1-s*(1-(h/60-(h/60) As Long)))
+				g=v*(1-s)
+				b=v
+			Case 5
+				r=v
+				g=v*(1-s)
+				b=v*(1-s*(h/60-(h/60) As Long))
+			Case 6
+				r=v
+				g=v*(1-s*(1-(h/60-(h/60) As Long)))
+				b=v*(1-s)
+		End Select
+
+		Dim ret As Color3f(r,g,b)
+		Return ret
+	End Function
+
+Public
+	rgb As RGB_FLOAT
+End Class
+
+Class Color3d
+Public /* constructor */
+	Sub Color3d(r As GLdouble, g As GLdouble, b As GLdouble)
+		rgb.r = r
+		rgb.g = g
+		rgb.b = b
+	End Sub
+	Sub Color3d(color As Color3f)
+		rgba.r = color.R As GLdouble
+		rgba.g = color.G As GLdouble
+		rgba.b = color.B As GLdouble
+	End Sub
+
+Public /* destructor */
+	Sub ~Color3d()
+	End Sub
+
+Public /* property */
+	Function R() As GLdouble
+		Return rgb.r
+	End Function
+	Function G() As GLdouble
+		Return rgb.g
+	End Function
+	Function B() As GLdouble
+		Return rgb.b
+	End Function
+	Sub R(r As GLdouble)
+		rgb.r = r
+	End Sub
+	Sub G(g As GLdouble)
+		rgb.g = g
+	End Sub
+	Sub B(b As GLdouble)
+		rgb.b = b
+	End Sub
+
+Public /* method */
+	' HSBを求める式はhttp://ofo.jp/osakana/cgtips/hsb.phtmlを参考にした
+	' Drawwing\Color.abをさらに参考にしました。
+	Function GetHue() As GLdouble
+		Dim max As GLdouble, min As GLdouble, d As GLdouble
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
+		d = max - min
+		If rgb.g = max Then
+			Return ((rgb.b - rgb.r) As Double / d * 60.0 + 120.0) As GLfloat
+		ElseIf rgb.b = max Then
+			Return ((rgb.r - rgb.g) As Double / d * 60.0 + 240.0) As GLfloat
+		ElseIf rgb.g < rgb.b Then
+			Return ((rgb.g - rgb.b) As Double / d * 60.0 + 360.0) As GLfloat
+		Else
+			Return ((rgb.g - rgb.b) As Double / d * 60.0) As GLfloat
+		EndIf
+	End Function
+
+	Function GetSaturation() As GLdouble
+		Dim max As GLdouble, min As GLdouble
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
+		Return (max - min) / max
+	End Function
+
+	Function GetVolue() As GLdouble
+		Dim max As GLdouble
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		Return max
+	End Function
+
+Public /* static method */
+	Static Function FromRGB(r As GLubyte, g As GLubyte, b As GLubyte) As Color3d
+		Dim ret As Color3d(r/255,g/255,b/255)
+		Return ret
+	End Function
+	Static Function FromCOLORREF(c As COLORREF) As Color3d
+		Dim ret As Color3d((c and &hff)/255,(c>>8 and &hff)/255,(c>>16 and &hff)/255)
+		Return ret
+	End Function
+	Static Function FromHSV(h As GLdouble, s As GLdouble, v As GLdouble) As Color3d
+		Dim r As GLdouble
+		Dim g As GLdouble
+		Dim b As GLfloat
+		If h<0 Then h+=360.0
+		If h>360.0 Then h-=360.0
+		Select Case (h/60) As Long
+			Case 0
+				r=v
+				g=v*(1-s*(1-(h/60-(h/60) As Long)))
+				b=v*(1-s)
+			Case 1
+				r=v*(1-s*(h/60-(h/60) As Long))
+				g=v
+				b=v*(1-s)
+			Case 2
+				r=v*(1-s)
+				g=v
+				b=v*(1-s*(1-(h/60-(h/60) As Long)))
+			Case 3
+				r=v*(1-s)
+				g=v*(1-s*(h/60-(h/60) As Long))
+				b=v
+			Case 4
+				r=v*(1-s*(1-(h/60-(h/60) As Long)))
+				g=v*(1-s)
+				b=v
+			Case 5
+				r=v
+				g=v*(1-s)
+				b=v*(1-s*(h/60-(h/60) As Long))
+			Case 6
+				r=v
+				g=v*(1-s*(1-(h/60-(h/60) As Long)))
+				b=v*(1-s)
+		End Select
+
+		Dim ret As Color3d(r,g,b)
+		Return ret
+	End Function
+Public
+	rgb As RGB_DOUBLE
+End Class
+
+Type RGBA_FLOAT
+	r As GLfloat
+	g As GLfloat
+	b As GLfloat
+	a As GLfloat
+End Type
+
+Type RGBA_DOUBLE
+	r As GLdouble
+	g As GLdouble
+	b As GLdouble
+	a As GLdouble
+End Type
+
+Class Color4f
+Public /* constructor */
+	Sub Color4f(r As GLfloat, g As GLfloat, b As GLfloat, a As GLfloat)
+		rgba.r = r
+		rgba.g = g
+		rgba.b = b
+		rgba.a = a
+	End Sub
+	Sub Color4f(color As Color4d)
+		rgba.r = color.R As GLfloat
+		rgba.g = color.G As GLfloat
+		rgba.b = color.B As GLfloat
+		rgba.a = color.A As GLfloat
+	End Sub
+
+Public /* destructor */
+	Sub ~Color4f()
+	End Sub
+
+Public /* property */
+	Function R() As GLfloat
+		Return rgba.r
+	End Function
+	Function G() As GLfloat
+		Return rgba.g
+	End Function
+	Function B() As GLfloat
+		Return rgba.b
+	End Function
+	Function A() As GLfloat
+		Return rgba.a
+	End Function
+	Sub R(r As GLfloat)
+		rgba.r = r
+	End Sub
+	Sub G(g As GLfloat)
+		rgba.g = g
+	End Sub
+	Sub B(b As GLfloat)
+		rgba.b = b
+	End Sub
+	Sub A(a As GLfloat)
+		rgba.a = a
+	End Sub
+
+Public /* operator */
+	Sub operator = (ByRef c As Color4f)
+		This.R=c.R
+		This.G=c.G
+		This.B=c.B
+		This.A=c.A
+	End Sub
+
+Public /* method */
+	' HSBを求める式はhttp://ofo.jp/osakana/cgtips/hsb.phtmlを参考にした
+	' Drawwing\Color.abをさらに参考にしました。
+	Function GetHue() As GLfloat
+		Dim max As GLfloat, min As GLfloat, d As GLfloat
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
+		d = max - min
+		If rgb.g = max Then
+			Return ((rgb.b - rgb.r) As Double / d * 60.0 + 120.0) As GLfloat
+		ElseIf rgb.b = max Then
+			Return ((rgb.r - rgb.g) As Double / d * 60.0 + 240.0) As GLfloat
+		ElseIf rgb.g < rgb.b Then
+			Return ((rgb.g - rgb.b) As Double / d * 60.0 + 360.0) As GLfloat
+		Else
+			Return ((rgb.g - rgb.b) As Double / d * 60.0) As GLfloat
+		EndIf
+	End Function
+
+	Function GetSaturation() As GLfloat
+		Dim max As GLfloat, min As GLfloat
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
+		Return (max - min) / max
+	End Function
+
+	Function GetVolue() As GLfloat
+		Dim max As GLfloat
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		Return max
+	End Function
+
+Public /* static method */
+	Static Function FromRGB(r As GLubyte, g As GLubyte, b As GLubyte) As Color4f
+		Dim ret As Color4f(r/255,g/255,b/255,1.0)
+		Return ret
+	End Function
+	Static Function FromArgb(a As GLubyte, r As GLubyte, g As GLubyte, b As GLubyte) As Color4f
+		Dim ret As Color4f(r/255,g/255,b/255,a/255)
+		Return ret
+	End Function
+	Static Function FromCOLORREF(c As COLORREF) As Color4f
+		Dim ret As Color4f((c and &hff)/255,(c>>8 and &hff)/255,(c>>16 and &hff)/255,1.0)
+		Return ret
+	End Function
+	Static Function FromHSV(h As GLfloat, s As GLfloat, v As GLfloat, a As GLfloat) As Color4f
+		Dim r As GLfloat
+		Dim g As GLfloat
+		Dim b As GLfloat
+		If h<0 Then h+=360.0
+		If h>360.0 Then h-=360.0
+		Select Case (h/60) As Long
+			Case 0
+				r=v
+				g=v*(1-s*(1-(h/60-(h/60) As Long)))
+				b=v*(1-s)
+			Case 1
+				r=v*(1-s*(h/60-(h/60) As Long))
+				g=v
+				b=v*(1-s)
+			Case 2
+				r=v*(1-s)
+				g=v
+				b=v*(1-s*(1-(h/60-(h/60) As Long)))
+			Case 3
+				r=v*(1-s)
+				g=v*(1-s*(h/60-(h/60) As Long))
+				b=v
+			Case 4
+				r=v*(1-s*(1-(h/60-(h/60) As Long)))
+				g=v*(1-s)
+				b=v
+			Case 5
+				r=v
+				g=v*(1-s)
+				b=v*(1-s*(h/60-(h/60) As Long))
+			Case 6
+				r=v
+				g=v*(1-s*(1-(h/60-(h/60) As Long)))
+				b=v*(1-s)
+		End Select
+
+		Dim ret As Color4f(r,g,b,a)
+		Return ret
+	End Function
+
+Public
+	rgba As RGBA_FLOAT
+End Class
+
+Class Color4d
+
+Public /* constructor */
+	Sub Color4d(r As GLdouble, g As GLdouble, b As GLdouble, a As GLdouble)
+		rgba.r = r
+		rgba.g = g
+		rgba.b = b
+		rgba.a = a
+	End Sub
+	Sub Color4d(color As Color4f)
+		rgba.r = color.R As GLdouble
+		rgba.g = color.G As GLdouble
+		rgba.b = color.B As GLdouble
+		rgba.a = color.A As GLdouble
+	End Sub
+
+Public /* destructor */
+	Sub ~Color4d()
+	End Sub
+
+Public /* property */
+	Function R() As GLdouble
+		Return rgba.r
+	End Function
+	Function G() As GLdouble
+		Return rgba.g
+	End Function
+	Function B() As GLdouble
+		Return rgba.b
+	End Function
+	Function A() As GLdouble
+		Return rgba.a
+	End Function
+	Sub R(r As GLdouble)
+		rgba.r = r
+	End Sub
+	Sub G(g As GLdouble)
+		rgba.g = g
+	End Sub
+	Sub B(b As GLdouble)
+		rgba.b = b
+	End Sub
+	Sub A(a As GLdouble)
+		rgba.a = a
+	End Sub
+
+Public /* operator */
+	Sub operator = (ByRef c As Color4d)
+		This.R=c.R
+		This.G=c.G
+		This.B=c.B
+		This.A=c.A
+	End Sub
+
+Public /* method */
+	' HSBを求める式はhttp://ofo.jp/osakana/cgtips/hsb.phtmlを参考にした
+	' Drawwing\Color.abをさらに参考にしました。
+	Function GetHue() As GLfloat
+		Dim max As GLfloat, min As GLfloat, d As GLfloat
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
+		d = max - min
+		If rgb.g = max Then
+			Return ((rgb.b - rgb.r) As Double / d * 60.0 + 120.0) As GLdouble
+		ElseIf rgb.b = max Then
+			Return ((rgb.r - rgb.g) As Double / d * 60.0 + 240.0) As GLdouble
+		ElseIf rgb.g < rgb.b Then
+			Return ((rgb.g - rgb.b) As Double / d * 60.0 + 360.0) As GLdouble
+		Else
+			Return ((rgb.g - rgb.b) As Double / d * 60.0) As GLdouble
+		EndIf
+	End Function
+
+	Function GetSaturation() As GLdouble
+		Dim max As GLdouble, min As GLdouble
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		min = Math.Min(Math.Min(rgb.r, rgb.g), rgb.b)
+		Return (max - min) / max
+	End Function
+
+	Function GetVolue() As GLdouble
+		Dim max As GLdouble
+		max = Math.Max(Math.Max(rgb.r, rgb.g), rgb.b)
+		Return max
+	End Function
+
+Public /* static method */
+	Static Function FromRGB(r As GLubyte, g As GLubyte, b As GLubyte) As Color4d
+		Dim ret As Color4d(r/255,g/255,b/255,1.0)
+		Return ret
+	End Function
+	Static Function FromArgb(a As GLubyte, r As GLubyte, g As GLubyte, b As GLubyte) As Color4d
+		Dim ret As Color4d(r/255,g/255,b/255,a/255)
+		Return ret
+	End Function
+	Static Function FromCOLORREF(c As COLORREF) As Color4d
+		Dim ret As Color4d((c and &hff)/255,(c>>8 and &hff)/255,(c>>16 and &hff)/255,1.0)
+		Return ret
+	End Function
+	Static Function FromHSV(h As GLdouble, s As GLdouble, v As GLdouble, a As GLdouble) As Color4d
+		Dim r As GLdouble
+		Dim g As GLdouble
+		Dim b As GLdouble
+		Dim a As GLdouble
+		If h<0 Then h+=360.0
+		If h>360.0 Then h-=360.0
+		Select Case (h/60) As Long
+			Case 0
+				r=v
+				g=v*(1-s*(1-(h/60-(h/60) As Long)))
+				b=v*(1-s)
+			Case 1
+				r=v*(1-s*(h/60-(h/60) As Long))
+				g=v
+				b=v*(1-s)
+			Case 2
+				r=v*(1-s)
+				g=v
+				b=v*(1-s*(1-(h/60-(h/60) As Long)))
+			Case 3
+				r=v*(1-s)
+				g=v*(1-s*(h/60-(h/60) As Long))
+				b=v
+			Case 4
+				r=v*(1-s*(1-(h/60-(h/60) As Long)))
+				g=v*(1-s)
+				b=v
+			Case 5
+				r=v
+				g=v*(1-s)
+				b=v*(1-s*(h/60-(h/60) As Long))
+			Case 6
+				r=v
+				g=v*(1-s*(1-(h/60-(h/60) As Long)))
+				b=v*(1-s)
+		End Select
+
+		Dim ret As Color4f(r,g,b,a)
+		Return ret
+	End Function
+
+Public
+	rgba As RGBA_DOUBLE
+End Class
+
+
+Class Light
+Private
+	Const Number As GLenum
+
+Public
+	Sub Enabled(enabled As GLboolean)
+		If enabled Then
+			glEnable(Number)
+		Else
+			glDisable(Number)
+		End If
+	End Sub
+	Function Enabled() As GLboolean
+		Dim lighting As GLboolean
+		glGetBooleanv(Number,VarPtr(lighting))
+		Return lighting
+	End Function
+
+Public /* constructor */
+	Sub Light(num As GLenum)
+		Number=num
+	End Sub
+
+Public
+	Sub SetAmbient(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+		Dim amb[3] As GLfloat
+		amb[0]=red
+		amb[1]=green
+		amb[2]=blue
+		amb[3]=alpha
+		glLightfv(Number,GL_AMBIENT,amb)
+	End Sub
+	Sub SetAmbient(ByRef color As Color4f)
+		Dim amb[3] As GLfloat
+		amb[0]=color.R
+		amb[1]=color.G
+		amb[2]=color.B
+		amb[3]=color.A
+		glLightfv(Number,GL_AMBIENT,amb)
+	End Sub
+	Sub SetAmbient(amb As *GLfloat)
+		glLightfv(Number,GL_AMBIENT,amb)
+	End Sub
+
+	Sub SetDiffuse(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+		Dim dif[3] As GLfloat
+		dif[0]=red
+		dif[1]=green
+		dif[2]=blue
+		dif[3]=alpha
+		glLightfv(Number,GL_DIFFUSE,dif)
+	End Sub
+	Sub SetDiffuse(ByRef color As Color4f)
+		Dim dif[3] As GLfloat
+		amb[0]=color.R
+		amb[1]=color.G
+		amb[2]=color.B
+		amb[3]=color.A
+		glLightfv(Number,GL_DIFFUSE,dif)
+	End Sub
+	Sub SetDiffuse(dif As *GLfloat)
+		glLightfv(Number,GL_DIFFUSE,dif)
+	End Sub
+
+	Sub SetSpecular(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+		Dim spc[3] As GLfloat
+		spc[0]=red
+		spc[1]=green
+		spc[2]=blue
+		spc[3]=alpha
+		glLightfv(Number,GL_SPECULAR,spc)
+	End Sub
+	Sub SetSpecular(ByRef color As Color4f)
+		Dim spc[3] As GLfloat
+		amb[0]=color.R
+		amb[1]=color.G
+		amb[2]=color.B
+		amb[3]=color.A
+		glLightfv(Number,GL_SPECULAR,spc)
+	End Sub
+	Sub SetSpecular(spc As *GLfloat)
+		glLightfv(Number,GL_SPECULAR,spc)
+	End Sub
+
+	Sub SetPosition(pos As *GLfloat)
+		glLightfv(Number,GL_POSITION,pos)
+	End Sub
+End Class
+
+Class LightsCollection
+Public
+	Function Item() As Light
+		Return 
+	End Function
+End Class
+
+Class MaterialManager
+Public
+	Sub Ambient(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+		Dim face As GLenum
+		glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
+		Dim amb[3] As GLfloat
+		amb[0]=red
+		amb[1]=green
+		amb[2]=blue
+		amb[3]=alpha
+		glMaterialfv(face,GL_AMBIENT,amb)
+	End Sub
+	Sub Ambient(ByRef color As Color4f)
+		Dim face As GLenum
+		glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
+		Dim amb[3] As GLfloat
+		amb[0]=color.R
+		amb[1]=color.G
+		amb[2]=color.B
+		amb[3]=color.A
+		glMaterialfv(face,GL_AMBIENT,amb)
+	End Sub
+	Sub Ambient(amb As *GLfloat)
+		glMaterialfv(face,GL_AMBIENT,amb)
+	End Sub
+
+	Sub Diffuse(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+		Dim face As GLenum
+		glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
+		Dim dif[3] As GLfloat
+		dif[0]=red
+		dif[1]=green
+		dif[2]=blue
+		dif[3]=alpha
+		glMaterialfv(face,GL_DIFFUSE,dif)
+	End Sub
+	Sub Diffuse(ByRef color As Color4f)
+		Dim face As GLenum
+		glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
+		Dim dif[3] As GLfloat
+		dif[0]=color.R
+		dif[1]=color.G
+		dif[2]=color.B
+		dif[3]=color.A
+		glMaterialfv(face,GL_DIFFUSE,dif)
+	End Sub
+	Sub Diffuse(dif As *GLfloat)
+		glMaterialfv(face,GL_DIFFUSE,dif)
+	End Sub
+
+	Sub Specular(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+		Dim face As GLenum
+		glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
+		Dim spc[3] As GLfloat
+		spc[0]=red
+		spc[1]=green
+		spc[2]=blue
+		spc[3]=alpha
+		glMaterialfv(face,GL_SPECULAR,spc)
+	End Sub
+	Sub Specular(ByRef color As Color4f)
+		Dim face As GLenum
+		glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
+		Dim spc[3] As GLfloat
+		spc[0]=color.R
+		spc[1]=color.G
+		spc[2]=color.B
+		spc[3]=color.A
+		glMaterialfv(face,GL_SPECULAR,spc)
+	End Sub
+	Sub Specular(spc As *GLfloat)
+		glMaterialfv(face,GL_SPECULAR,spc)
+	End Sub
+
+	Sub Shininess(shin As GLfloat)
+		Dim face As GLenum
+		glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
+		glMaterialf(face,GL_SHININESS,shin)
+	End Sub
+
+	Sub Emission(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+		Dim face As GLenum
+		glGetIntegerv(GL_COLOR_MATERIAL_FACE,VarPtr(face))
+		Dim ems[3] As GLfloat
+		ems[0]=red
+		ems[1]=green
+		ems[2]=blue
+		ems[3]=alpha
+		glMaterialfv(face,GL_EMISSION,ems)
+	End Sub
+End Class
+
+Class ModelViewMatrix
+Public
+	Sub LoadIdentity()
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glLoadIdentity()
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub LookAt(eyex As GLdouble, eyey As GLdouble, eyez As GLdouble, centerx As GLdouble, centery As GLdouble, centerz As GLdouble, upx As GLdouble, upy As GLdouble, upz As GLdouble)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub RotateX(angle As GLdouble)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glRotated(angle, 1.0 As GLdouble, 0.0 As GLdouble, 0.0 As GLdouble)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub RotateX(angle As GLfloat)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glRotatef(angle, 1.0 As GLfloat, 0.0 As GLfloat, 0.0 As GLfloat)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub RotateY(angle As GLdouble)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glRotated(angle, 0.0 As GLdouble, 1.0 As GLdouble, 0.0 As GLdouble)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub RotateY(angle As GLfloat)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glRotatef(angle, 0.0 As GLfloat, 1.0 As GLfloat, 0.0 As GLfloat)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub RotateZ(angle As GLdouble)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glRotated(angle, 0.0 As GLdouble, 0.0 As GLdouble, 1.0 As GLdouble)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub RotateZ(angle As GLfloat)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glRotatef(angle, 0.0 As GLfloat, 0.0 As GLfloat, 1.0 As GLfloat)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub Scale(x As GLdouble, y As GLdouble, z As GLdouble)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glScaled(x, y, z)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub Scale(x As GLfloat, y As GLfloat, z As GLfloat)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glScalef(x, y, z)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub Translate(x As GLdouble, y As GLdouble, z As GLdouble)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *GLint)
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glTranslated(x, y, z)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+	Sub Translate(x As GLfloat, y As GLfloat, z As GLfloat)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
+		If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
+		glTranslatef(x, y, z)
+		If mode<>GL_MODELVIEW Then glMatrixMode(mode)
+	End Sub
+End Class
+
+Class ProjectionMatrix
+Public
+	Sub LoadIdentity()
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
+		If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
+		glLoadIdentity()
+		If mode<>GL_PROJECTION Then glMatrixMode(mode)
+	End Sub
+	Sub Ortho2D(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
+		If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
+		gluOrtho2D(left, right, bottom, top)
+		If mode<>GL_PROJECTION Then glMatrixMode(mode)
+	End Sub
+	Sub Ortho3D(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble, zNear As GLdouble, zFar As GLdouble)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
+		glOrtho(left, right, bottom, top, zNear, zFar)
+		If mode<>GL_PROJECTION Then glMatrixMode(mode)
+	End Sub
+	Sub Frustum(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble, zNear As GLdouble, zFar As GLdouble)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
+		If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
+		glFrustum(left, right, bottom, top, zNear, zFar)
+		If mode<>GL_PROJECTION Then glMatrixMode(mode)
+	End Sub
+	Sub Perspective(fovy As GLdouble, aspect As GLdouble, zNear As GLdouble, zFar As GLdouble)
+		Dim mode As GLenum
+		glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
+		If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
+		gluPerspective(fovy, aspect, zNear, zFar)
+		If mode<>GL_PROJECTION Then glMatrixMode(mode)
+	End Sub
+End Class
+
+Class TransformMatrix
+Public
+	Projection As ProjectionMatrix
+	ModelView As ModelViewMatrix
+
+Public
+	Sub Transform()
+		Projection=New ProjectionMatrix
+		ModelView=New ModelViewMatrix
+	End Sub
+End Class
+
+Class LightModelManager
+Public
+	Function Ambient () As Color4f
+		Dim amb As Color4f
+		glGetFloatv(GL_LIGHT_MODEL_AMBIENT,VarPtr(amb.rgba))
+		Return amb
+	End Function
+	Sub Ambient(amb As Color4f)
+		glLightModelfv(GL_LIGHT_MODEL_AMBIENT,VarPtr(amb.rgba))
+	End Sub
+
+	Function LocalView() As GLboolean
+		Dim local As GLboolean
+		glGetBooleanv(GL_LIGHT_MODEL_LOCAL_VIEW,VarPtr(local))
+		Return local
+	End Function
+	Sub LocalView(enable As GLboolean)
+		If enable Then
+			glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEW,GL_TRUE)
+		Else
+			glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEW,GL_FALSE)
+		End If
+	End Sub
+
+	Function TwoSide() As GLboolean
+		Dim local As GLboolean
+		glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE,VarPtr(local))
+		Return local
+	End Function
+	Sub TwoSide(enable As GLboolean)
+		If enable Then
+			glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE)
+		Else
+			glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,GL_FALSE)
+		End If
+	End Sub
+End Class
+
+Class RenderStateManager
+Public /* Composiotion */
+	LightModel As LightModelManager
+
+Public
+	Sub RenderStateManager()
+		LightModel = New LightModelManager()
+	End Sub
+	Function AlphaTestEnable() As GLboolean
+		Dim alpha As GLboolean
+		glGetBooleanv(GL_ALPHA_TEST,VarPtr(alpha))
+		Return alpha
+	End Function
+	Sub AlphaTestEnable(enable As GLboolean)
+		If enable Then
+			glEnable(GL_ALPHA_TEST)
+		Else
+			glDisable(GL_ALPHA_TEST)
+		End If
+	End Sub
+
+	Function AlphaFunction() As GLenum
+		Dim func As GLenum
+		glGetIntegerv(GL_ALPHA_TEST_FUNC,VarPtr(func))
+		Return func
+	End Function
+	Sub AlphaFunction(func As GLenum)
+		Dim ref As GLclampf
+		glGetFloatv(GL_ALPHA_TEST_REF,VarPtr(ref))
+		glAlphaFunc(func,ref)
+	End Sub
+
+	Function BlendEnable() As GLboolean
+		Dim blend As GLboolean
+		glGetBooleanv(GL_BLEND,VarPtr(blend))
+		Return blend
+	End Function
+	Sub BlendEnable(enable As GLboolean)
+		If enable Then
+			glEnable(GL_BLEND)
+		Else
+			glDisable(GL_BLEND)
+		End If
+	End Sub
+
+	Function BlendDestinationFactor() As GLenum
+		Dim dfactor As GLenum
+		glGetIntegerv(GL_BLEND_DST,VarPtr(dfactor))
+		Return dfactor
+	End Function
+	Sub BlendDestinationFactor(dfactor As GLenum)
+		Dim sfactor As GLenum
+		glGetIntegerv(GL_BLEND_SRC,VarPtr(sfactor))
+		glBlendFunc(sfactor,dfactor)
+	End Sub
+
+	Function BlendSourceFactor() As GLenum
+		Dim sfactor As GLenum
+		glGetIntegerv(GL_BLEND_SRC,VarPtr(sfactor))
+		Return sfactor
+	End Function
+	Sub BlendSourceFactor(sfactor As GLenum)
+		Dim dfactor As GLenum
+		glGetIntegerv(GL_BLEND_DST,VarPtr(dfactor))
+		glBlendFunc(sfactor,dfactor)
+	End Sub
+
+	Function CullFaceEnable() As GLboolean
+		Dim cull As GLboolean
+		glGetBooleanv(GL_CULL_FACE,VarPtr(cull))
+		Return cull
+	End Function
+	Sub CullFaceEnable(enable As GLboolean)
+		If enable Then
+			glEnable(GL_CULL_FACE)
+		Else
+			glDisable(GL_CULL_FACE)
+		End If
+	End Sub
+
+	Function CullFaceMode () As GLenum
+		Dim mode As GLenum
+		glGetIntegerv(GL_CULL_FACE_MODE,VarPtr(mode))
+		Return mode
+	End Function
+	Sub CullFaceMode(mode As GLenum)
+		glCullFace(mode)
+	End Sub
+
+	Function DepthTestEnable () As GLboolean
+		Dim depth As GLboolean
+		glGetBooleanv(GL_DEPTH_TEST,VarPtr(depth))
+		Return depth
+	End Function
+	Sub DepthTestEnable(enable As GLboolean)
+		If enable Then
+			glEnable(GL_DEPTH_TEST)
+		Else
+			glDisable(GL_DEPTH_TEST)
+		End If
+	End Sub
+
+	Function DepthFunction () As GLenum
+		Dim func As GLenum
+		glGetIntegerv(GL_DEPTH_FUNC,VarPtr(func))
+		Return func
+	End Function
+	Sub DepthFunction(func As GLenum)
+		glDepthFunc(func)
+	End Sub
+
+	Function DepthBufferWritable() As GLboolean
+		Dim writable As GLboolean
+		glGetBooleanv(GL_DEPTH_WRITEMASK,VarPtr(writable))
+		Return writable
+	End Function
+	Sub DepthBufferWritable(enable As GLboolean)
+		If enable Then
+			glDepthMask(GL_DEPTH_WRITEMASK)
+		Else
+			glDepthMask(GL_DEPTH_WRITEMASK)
+		End If
+	End Sub
+
+	Function DitherEnable() As GLboolean
+		Dim dither As GLboolean
+		glGetBooleanv(GL_DITHER,VarPtr(dither))
+		Return dither
+	End Function
+	Sub DitherEnable(enable As GLboolean)
+		If enable Then
+			glEnable(GL_DITHER)
+		Else
+			glDisable(GL_DITHER)
+		End If
+	End Sub
+
+	Function FogEnable () As GLboolean
+		Dim fog As GLboolean
+		glGetBooleanv(GL_FOG,VarPtr(fog))
+		Return fog
+	End Function
+	Sub FogEnable(enable As GLboolean)
+		If enable Then
+			glEnable(GL_FOG)
+		Else
+			glDisable(GL_FOG)
+		End If
+	End Sub
+
+	Function FogMode() As GLenum
+		Dim mode As GLenum
+		glGetIntegerv(GL_FOG_MODE,VarPtr(mode))
+		Return mode
+	End Function
+	Sub FogMode(mode As GLenum)
+		glFogi(GL_FOG_MODE,mode)
+	End Sub
+
+	Function FogColor() As Color4f
+		Dim ret As Color4f
+		glGetFloatv(GL_FOG_COLOR,VarPtr(ret.rgba))
+		Return ret
+	End Function
+	Sub FogColor(fcolor As Color4f)
+		glFogfv(GL_FOG_COLOR,VarPtr(fcolor.rgba))
+	End Sub
+
+	Function FogDensity() As GLfloat
+		Dim density As GLfloat
+		glGetFloatv(GL_FOG_DENSITY,density)
+		Return density
+	End Function
+	Sub FogDensity(density As GLfloat)
+		glFogf(GL_FOG_DENSITY,density)
+	End Sub
+
+	Function FogStart() As GLfloat
+		Dim fstrat As GLfloat
+		glGetFloatv(GL_FOG_START,fstrat)
+		Return fstrat
+	End Function
+	Sub FogStart(fstrat As GLfloat)
+		glFogf(GL_FOG_START,fstrat)
+	End Sub
+
+	Function FogEnd() As GLfloat
+		Dim fend As GLfloat
+		glGetFloatv(GL_FOG_END,fend)
+		Return fend
+	End Function
+	Sub FogEnd(fend As GLfloat)
+		glFogf(GL_FOG_END,fend)
+	End Sub
+
+	Function Lighting() As GLboolean
+		Dim lighting As GLboolean
+		glGetBooleanv(GL_LIGHTING,VarPtr(lighting))
+		Return lighting
+	End Function
+	Sub Lighting(enable As GLboolean)
+		If enable Then
+			glEnable(GL_LIGHTING)
+		Else
+			glDisable(GL_LIGHTING)
+		End If
+	End Sub
+
+	Function LineSmoothEnable() As GLboolean
+		Dim smooth As GLboolean
+		glGetBooleanv(GL_LINE_SMOOTH,VarPtr(smooth))
+		Return smooth
+	End Function
+	Sub LineSmoothEnable(enable As GLboolean)
+		If enable Then
+			glEnable(GL_LINE_SMOOTH)
+		Else
+			glDisable(GL_LINE_SMOOTH)
+		End If
+	End Sub
+
+	Function LogicOpEnable() As GLboolean
+		Dim logic As GLboolean
+		glGetBooleanv(GL_COLOR_LOGIC_OP,VarPtr(logic))
+		Return logic
+	End Function
+	Sub LogicOpEnable(enable As GLboolean)
+		If enable Then
+			glEnable(GL_COLOR_LOGIC_OP)
+		Else
+			glDisable(GL_COLOR_LOGIC_OP)
+		End If
+	End Sub
+
+	Function LogicOpCode() As GLenum
+		Dim code As GLenum
+		glGetFloatv(GL_COLOR_LOGIC_OP_MODE,code)
+		Return code
+	End Function
+	Sub LogicOpCode(code As GLenum)
+		glLogicOp(code)
+	End Sub
+
+	Function PointSmoothEnable() As GLboolean
+		Dim smooth As GLboolean
+		glGetBooleanv(GL_POINT_SMOOTH,VarPtr(smooth))
+		Return smooth
+	End Function
+	Sub PointSmoothEnable(enable As GLboolean)
+		If enable Then
+			glEnable(GL_POINT_SMOOTH)
+		Else
+			glDisable(GL_POINT_SMOOTH)
+		End If
+	End Sub
+
+	Function PolygonSmoothEnable() As GLboolean
+		Dim smooth As GLboolean
+		glGetBooleanv(GL_POLYGON_SMOOTH,VarPtr(smooth))
+		Return smooth
+	End Function
+	Sub PolygonSmoothEnable(enable As GLboolean)
+		If enable Then
+			glEnable(GL_POLYGON_SMOOTH)
+		Else
+			glDisable(GL_POLYGON_SMOOTH)
+		End If
+	End Sub
+
+	Function ReferenceAlpha() As GLclampf
+		Dim ref As GLclampf
+		glGetFloatv(GL_ALPHA_TEST_REF,VarPtr(ref))
+		Return ref
+	End Function
+	Sub ReferenceAlpha(ref As GLclampf)
+		Dim func As GLenum
+		glGetIntegerv(GL_ALPHA_TEST_FUNC,VarPtr(func))
+		glAlphaFunc(func,ref)
+	End Sub
+
+	Function ShadeModel() As GLenum
+		Dim mode As GLenum
+		glGetIntegerv(GL_SHADE_MODEL,VarPtr(mode))
+		Return mode
+	End Function
+	Sub ShadeModel(mode As GLenum)
+		glShadeModel(mode)
+	End Sub
+End Class
+
+
+Enum ColorType
+	RgbColor=0
+	RgbaColor=0
+	IndexColor
+End Enum
+
+Enum BufferType
+	SingleBuffer=0
+	DoubleBuffer
+End Enum
+
+Enum ClearBuffer
+	DepthBufferBit = &H00000100
+	AccumBufferBit = &H00000200
+	StencilBufferBit = &H00000400
+	ColorBufferBit = &H00004000
+End Enum
+
+Enum PrimitiveMode
+	Points = &H0000
+	Lines = &H0001
+	LineLoop = &H0002
+	LineStrip = &H0003
+	Triangles = &H0004
+	TriangleStrip = &H0005
+	TriangleFan = &H0006
+	Quads = &H0007
+	QuadStrip = &H0008
+	Polygon = &H0009
+End Enum
+
+Class RenderingContext
+Public /* Composiotion */
+	Material As MaterialManager
+	RenderState As RenderStateManager
+	Transform As TransformMatrix
+	Lights As LightsCollection
+
+Public /* Constructor */
+	Sub RenderingContext()
+		Dim hrc As HGLRC
+		hrc=wglGetCurrentContext()
+		If hrc Then
+			wglMakeCurrent(NULL,NULL)
+			wglDeleteContext(hrc)
+		End If
+
+		Material = New MaterialManager()
+		RenderState = New RenderStateManager()
+		Transform = New TransformMatrix()
+		Lights = New LightsCollection()
+	End Sub
+	Sub RenderingContext(hdc As HDC, ByRef pfd As PIXELFORMATDESCRIPTOR)
+		RenderingContext()
+
+		Dim pf As Long
+		pf=ChoosePixelFormat(hdc,pfd)
+		If pf=0 Then
+			MessageBox(NULL,"Choose Pixel Format failed","error",MB_OK)
+			Exit Sub
+		End If
+		If SetPixelFormat(hdc,pf,pfd)=FALSE Then
+			MessageBox(NULL,"Set Pixel Format failed","error",MB_OK)
+			Exit Sub
+		End If
+
+		Dim hrc As HGLRC
+		hrc=wglCreateContext(hdc)
+		wglMakeCurrent(hdc,hrc)
+	End Sub
+	Sub RenderingContext(hdc As HDC, ctype As ColorType, btype As BufferType)
+		RenderingContext()
+
+		Dim pfd As PIXELFORMATDESCRIPTOR
+		pfd.nSize=SizeOf(PIXELFORMATDESCRIPTOR) As Word
+		pfd.nVersion=GL_VERSION_1_1
+		If btype=BufferType.DoubleBuffer Then
+			pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER
+		Else
+			pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL
+		End If
+		If ctype=ColorType.RgbColor Then
+			pfd.iPixelType=PFD_TYPE_RGBA
+		Else
+			pfd.iPixelType=PFD_TYPE_COLORINDEX
+		End If
+		pfd.cColorBits=24
+		pfd.cRedBits=0
+		pfd.cRedShift=0
+		pfd.cGreenBits=0
+		pfd.cGreenShift=0
+		pfd.cBlueBits=0
+		pfd.cBlueShift=0
+		pfd.cAlphaBits=0
+		pfd.cAlphaShift=0
+		pfd.cAccumBits=0
+		pfd.cAccumRedBits=0
+		pfd.cAccumGreenBits=0
+		pfd.cAccumBlueBits=0
+		pfd.cAccumAlphaBits=0
+		pfd.cDepthBits=32
+		pfd.cStencilBits=0
+		pfd.cAuxBuffers=0
+		pfd.iLayerType=PFD_MAIN_PLANE
+		pfd.bReserved=0
+		pfd.dwLayerMask=0
+		pfd.dwVisibleMask=0
+		pfd.dwDamageMask=0
+		RenderingContext(hdc,pfd)
+	End Sub
+	Sub RenderingContext(hdc As HDC)
+		RenderingContext(hdc As HDC, ColorType.RgbColor, BufferType.DoubleBuffer)
+	End Sub
+
+Public /* Destructor */
+	Sub ~RenderingContext()
+		Dim hrc As HGLRC
+		hrc=wglGetCurrentContext()
+		wglMakeCurrent(NULL,NULL)
+		wglDeleteContext(hrc)
+	End Sub
+
+Public /* Method */
+	Sub Begin(mode As GLenum)
+		glBegin(mode)
+	End Sub
+	Sub Begin(mode As PrimitiveMode)
+		glBegin(mode)
+	End Sub
+	Sub Clear(mask As GLbitfield)
+		glClear(mask)
+	End Sub
+	Sub Clear(mask As ClearBuffer)
+		glClear(mask)
+	End Sub
+
+	Sub ClearAccum(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+		glClearAccum(red, green, blue, alpha)
+	End Sub
+	Sub ClearAccum(color As Color4f)
+		glClearAccum(color.R, color.G, color.B, color.A)
+	End Sub
+	Sub ClearColor(red As GLclampf, green As GLclampf, blue As GLclampf, alpha As GLclampf)
+		glClearColor(red, green, blue, alpha)
+	End Sub
+	Sub ClearColor(color As Color4f)
+		glClearColor(color.R, color.G, color.B, color.A)
+	End Sub
+	Sub ClearDepth(depth As GLclampd)
+		glClearDepth(depth)
+	End Sub
+	Sub ClearIndex(c As GLfloat)
+		glClearIndex(c)
+	End Sub
+	Sub ClearStencil(s As GLint)
+		glClearStencil(s)
+	End Sub
+
+	Sub Color(red As GLdouble, green As GLdouble, blue As GLdouble)
+		glColor3d(red,green,blue)
+	End Sub
+	Sub Color(red As GLdouble, green As GLdouble, blue As GLdouble, alpha As GLdouble)
+		glColor4d(red,green,blue,alpha)
+	End Sub
+	Sub Color(red As GLfloat, green As GLfloat, blue As GLfloat)
+		glColor3f(red,green,blue)
+	End Sub
+	Sub Color(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+		glColor4f(red,green,blue,alpha)
+	End Sub
+	Sub Color(c As Color3f)
+		glColor3fv(VarPtr(c.rgb) As *Single)
+	End Sub
+	Sub Color(c As Color4f)
+		glColor4fv(VarPtr(c.rgba) As *Single)
+	End Sub
+	Sub Color(c As Color3d)
+		glColor3dv(VarPtr(c.rgb) As *Double)
+	End Sub
+	Sub Color(c As Color4d)
+		glColor4dv(VarPtr(c.rgba) As *Double)
+	End Sub
+
+	Sub DrawPrimiteve()
+	End Sub
+
+	Sub End()
+		glEnd()
+	End Sub
+
+	Sub Finish()
+		glFinish()
+	End Sub
+	Sub Flush()
+		glFlush()
+	End Sub
+
+	Function GenerateTexures() As GLint
+		glGenTextures()
+	End Function
+
+	Sub MatrixMode(mode As GLenum)
+		glMatrixMode(mode)
+	End Sub
+
+	Sub Present()
+		SwapBuffers(wglGetCurrentDC())
+	End Sub
+	Sub Present(hdc As HDC)
+		SwapBuffers(hdc)
+	End Sub
+
+	Sub PopMatrix()
+		glPopMatrix()
+	End Sub
+
+	Sub PushMatrix()
+		glPushMatrix()
+	End Sub
+
+	Sub Vertex(x As GLdouble, y As GLdouble)
+		glVertex2d(x,y)
+	End Sub
+	Sub Vertex(x As GLdouble, y As GLdouble, z As GLdouble)
+		glVertex3d(x,y,z)
+	End Sub
+	Sub Vertex(x As GLdouble, y As GLdouble, z As GLdouble, w As GLdouble)
+		glVertex4d(x,y,z,w)
+	End Sub
+	Sub Vertex(x As GLfloat, y As GLfloat)
+		glVertex2f(x,y)
+	End Sub
+	Sub Vertex(x As GLfloat, y As GLfloat, z As GLfloat)
+		glVertex3f(x,y,z)
+	End Sub
+	Sub Vertex(x As GLfloat, y As GLfloat, z As GLfloat, w As GLfloat)
+		glVertex4f(x,y,z,w)
+	End Sub
+
+	Sub Viewport(x As GLint, y As GLint, width As GLsizei, height As GLsizei)
+		glViewport(x, y, width, height)
+	End Sub
+End Class
+
+#endif
Index: /trunk/ab5.0/ablib/src/api_commctrl.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_commctrl.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_commctrl.sbp	(revision 506)
@@ -0,0 +1,1001 @@
+' api_commctrl.sbp
+#ifndef _INC_COMMCTRL
+#define _INC_COMMCTRL
+
+#ifdef UNICODE
+Const _FuncName_CreateStatusWindow = "CreateStatusWindowW"
+#else
+Const _FuncName_CreateStatusWindow = "CreateStatusWindowA"
+#endif
+
+
+
+'---------------------
+' Initialize commands
+'---------------------
+
+Const ICC_LISTVIEW_CLASSES =   &H00000001
+Const ICC_TREEVIEW_CLASSES =   &H00000002
+Const ICC_BAR_CLASSES =        &H00000004
+Const ICC_TAB_CLASSES =        &H00000008
+Const ICC_UPDOWN_CLASS =       &H00000010
+Const ICC_PROGRESS_CLASS =     &H00000020
+Const ICC_HOTKEY_CLASS =       &H00000040
+Const ICC_ANIMATE_CLASS =      &H00000080
+Const ICC_WIN95_CLASSES =      &H000000FF
+Const ICC_DATE_CLASSES =       &H00000100
+Const ICC_USEREX_CLASSES =     &H00000200
+Const ICC_COOL_CLASSES =       &H00000400
+Const ICC_INTERNET_CLASSES =   &H00000800
+Const ICC_PAGESCROLLER_CLASS = &H00001000
+Const ICC_NATIVEFNTCTL_CLASS = &H00002000
+Type INITCOMMONCONTROLSEX
+	dwSize As DWord
+	dwICC As DWord
+End Type
+Declare Function InitCommonControlsEx Lib "comctl32" (ByRef InitCtrls As INITCOMMONCONTROLSEX) As BOOL
+
+Declare Sub InitCommonControls Lib "comctl32" ()
+
+
+'----------------------------
+' Common control shared item
+'----------------------------
+
+Const CCS_TOP =           &H00000001
+Const CCS_NOMOVEY =       &H00000002
+Const CCS_BOTTOM =        &H00000003
+Const CCS_NORESIZE =      &H00000004
+Const CCS_NOPARENTALIGN = &H00000008
+Const CCS_ADJUSTABLE =    &H00000020
+Const CCS_NODIVIDER =     &H00000040
+Const CCS_VERT =          &H00000080
+Const CCS_LEFT =          CCS_VERT or CCS_TOP
+Const CCS_RIGHT =         CCS_VERT or CCS_BOTTOM
+Const CCS_NOMOVEX =       CCS_VERT or CCS_NOMOVEY
+
+Const CCM_FIRST =             &H2000
+Const CCM_SETBKCOLOR =        CCM_FIRST+1
+Const CCM_SETCOLORSCHEME =    CCM_FIRST+2
+Const CCM_GETCOLORSCHEME =    CCM_FIRST+3
+Const CCM_GETDROPTARGET =     CCM_FIRST+4
+Const CCM_SETUNICODEFORMAT =  CCM_FIRST+5
+Const CCM_GETUNICODEFORMAT =  CCM_FIRST+6
+
+Type NMHDR
+	hwndFrom As HWND
+	idFrom As ULONG_PTR
+	code As DWord
+End Type
+
+Const NM_FIRST =              0
+Const NM_OUTOFMEMORY =        NM_FIRST-1
+Const NM_CLICK =              NM_FIRST-2
+Const NM_DBLCLK =             NM_FIRST-3
+Const NM_RETURN =             NM_FIRST-4
+Const NM_RCLICK =             NM_FIRST-5
+Const NM_RDBLCLK =            NM_FIRST-6
+Const NM_SETFOCUS =           NM_FIRST-7
+Const NM_KILLFOCUS =          NM_FIRST-8
+Const NM_CUSTOMDRAW =         NM_FIRST-12
+Const NM_HOVER =              NM_FIRST-13
+Const NM_NCHITTEST =          NM_FIRST-14
+Const NM_KEYDOWN =            NM_FIRST-15
+Const NM_RELEASEDCAPTURE =    NM_FIRST-16
+Const NM_SETCURSOR =          NM_FIRST-17
+Const NM_CHAR =               NM_FIRST-18
+
+
+'-----------
+' ImageList
+'-----------
+
+Type _System_DeclareHandle_HIMAGELIST:unused As DWord:End Type
+TypeDef HIMAGELIST   = *_System_DeclareHandle_HIMAGELIST
+
+Declare Function ImageList_AddIcon Lib "comctl32" (himl As HIMAGELIST, hIcon As HICON) As Long
+
+Const ILC_MASK =     &H0001
+Const ILC_COLOR =    &H0000
+Const ILC_COLORDDB = &H00FE
+Const ILC_COLOR4 =   &H0004
+Const ILC_COLOR8 =   &H0008
+Const ILC_COLOR16 =  &H0010
+Const ILC_COLOR24 =  &H0018
+Const ILC_COLOR32 =  &H0020
+Declare Function ImageList_Create Lib "comctl32" (cx As Long, cy As Long, flags As DWord, cInitial As Long, cGrow As Long) As HIMAGELIST
+
+Declare Function ImageList_Destroy Lib "comctl32" (himl As HIMAGELIST) As BOOL
+Declare Function ImageList_GetIcon Lib "comctl32" (himl As HIMAGELIST, index As Long, flags As DWord) As HICON
+Declare Function ImageList_GetImageCount Lib "comctl32" (himl As HIMAGELIST) As Long
+Declare Function ImageList_LoadImage Lib "comctl32" (hi As HINSTANCE, lpbmp As BytePtr, cx As Long, cGrow As Long, crMask As DWord, uType As DWord, uFlags As DWord) As HIMAGELIST
+
+
+'-----------
+' ListView
+'-----------
+
+'Column
+Const LVCF_FMT =              &H0001
+Const LVCF_WIDTH =            &H0002
+Const LVCF_TEXT =             &H0004
+Const LVCF_SUBITEM =          &H0008
+Const LVCF_IMAGE =            &H0010
+Const LVCF_ORDER =            &H0020
+Const LVCFMT_LEFT =            &H0000
+Const LVCFMT_RIGHT =           &H0001
+Const LVCFMT_CENTER =          &H0002
+Const LVCFMT_JUSTIFYMASK =     &H0003
+Const LVCFMT_IMAGE =           &H0800
+Const LVCFMT_BITMAP_ON_RIGHT = &H1000
+Const LVCFMT_COL_HAS_IMAGES =  &H8000
+Type LVCOLUMN
+	mask As DWord
+	fmt As Long
+	cx As Long
+	pszText As LPSTR
+	cchTextMax As Long
+	iSubItem As Long
+	iImage As Long
+	iOrder As Long
+End Type
+TypeDef LPLVCOLUMN = *LVCOLUMN
+
+'Find item
+Const LVFI_PARAM =     &H0001
+Const LVFI_STRING =    &H0002
+Const LVFI_PARTIAL =   &H0008
+Const LVFI_WRAP =      &H0020
+Const LVFI_NEARESTXY = &H0040
+Type LVFINDINFO
+	flags As DWord
+	psz As LPSTR
+	lParam As LPARAM
+	pt As POINTAPI
+	vkDirection As DWord
+End Type
+TypeDef LPLVFINDINFO = *LVFINDINFO
+
+'Item
+Const LVIF_TEXT =        &H0001
+Const LVIF_IMAGE =       &H0002
+Const LVIF_PARAM =       &H0004
+Const LVIF_STATE =       &H0008
+Const LVIF_INDENT =      &H0010
+Const LVIF_NORECOMPUTE = &H0800
+Const LVIF_DI_SETITEM =  &H1000
+Type LVITEM
+	mask As DWord
+	iItem As Long
+	iSubItem As Long
+	state As DWord
+	stateMask As DWord
+	pszText As LPSTR
+	cchTextMax As Long
+	iImage As Long
+	lParam As LPARAM
+	iIndent As Long
+End Type
+TypeDef LPLVITEM = *LVITEM
+
+
+Const LVM_FIRST =             &H1000      'ListView messages
+Const LVM_GETBKCOLOR =        LVM_FIRST+0
+Const LVM_SETBKCOLOR =        LVM_FIRST+1
+
+Const LVSIL_NORMAL = 0
+Const LVSIL_SMALL =  1
+Const LVSIL_STATE =  2
+Const LVM_GETIMAGELIST =      LVM_FIRST+2
+Const LVM_SETIMAGELIST =      LVM_FIRST+3
+
+Const LVM_GETITEMCOUNT =      LVM_FIRST+4
+Function ListView_GetItemCount(hwnd As HWND) As Long
+	ListView_GetItemCount=SendMessage(hwnd,LVM_GETITEMCOUNT,0,0) As Long
+End Function
+Const LVM_GETITEM =           LVM_FIRST+5
+Const LVM_SETITEM =           LVM_FIRST+6
+Function ListView_SetItem(hwnd As HWND, ByRef ref_lvItem As LVITEM) As Long
+	ListView_SetItem=SendMessage(hwnd,LVM_SETITEM,0,VarPtr(ref_lvItem) As LPARAM) As Long
+End Function
+Const LVM_INSERTITEM =        LVM_FIRST+7
+Function ListView_InsertItem(hwnd As HWND, ByRef ref_lvItem As LVITEM) As Long
+	ListView_InsertItem=SendMessage(hwnd,LVM_INSERTITEM,0,VarPtr(ref_lvItem) As LPARAM) As Long
+End Function
+Const LVM_DELETEITEM =        LVM_FIRST+8
+Function ListView_DeleteItem(hwnd As HWND, iItem As Long) As BOOL
+	ListView_DeleteItem=SendMessage(hwnd,LVM_DELETEITEM,iItem,0) As BOOL
+End Function
+Const LVM_DELETEALLITEMS =    LVM_FIRST+9
+Function ListView_DeleteAllItems(hwndLV As HWND) As BOOL
+	ListView_DeleteAllItems=SendMessage(hwndLV,LVM_DELETEALLITEMS,0,0) As BOOL
+End Function
+Const LVM_GETCALLBACKMASK =   LVM_FIRST+10
+Const LVM_SETCALLBACKMASK =   LVM_FIRST+11
+
+Const LVNI_ALL =         &H0000
+Const LVNI_FOCUSED =     &H0001
+Const LVNI_SELECTED =    &H0002
+Const LVNI_CUT =         &H0004
+Const LVNI_DROPHILITED = &H0008
+Const LVNI_ABOVE =       &H0100
+Const LVNI_BELOW =       &H0200
+Const LVNI_TOLEFT =      &H0400
+Const LVNI_TORIGHT =     &H0800
+Const LVM_GETNEXTITEM =       LVM_FIRST+12
+
+Const LVM_FINDITEM =          LVM_FIRST+13
+Function ListView_FindItem(hwnd As HWND, iStart As Long, ByRef ref_lvfi As LVFINDINFO) As Long
+	ListView_FindItem=SendMessage(hwnd,LVM_FINDITEM,iStart As WPARAM,VarPtr(ref_lvfi) As LPARAM) As Long
+End Function
+
+Const LVM_GETITEMRECT =       LVM_FIRST+14
+Const LVM_SETITEMPOSITION =   LVM_FIRST+15
+Const LVM_GETITEMPOSITION =   LVM_FIRST+16
+Const LVM_GETSTRINGWIDTH =    LVM_FIRST+17
+Const LVM_HITTEST =           LVM_FIRST+18
+Const LVM_ENSUREVISIBLE =     LVM_FIRST+19
+Const LVM_SCROLL =            LVM_FIRST+20
+Function ListView_Scroll(hwnd As HWND, dx As Long, dy As Long) As BOOL
+	ListView_Scroll=SendMessage(hwnd,LVM_SCROLL,dx,dy) As BOOL
+End Function
+Const LVM_REDRAWITEMS =       LVM_FIRST+21
+Const LVM_ARRANGE =           LVM_FIRST+22
+Const LVM_EDITLABEL =         LVM_FIRST+23
+Const LVM_GETEDITCONTROL =    LVM_FIRST+24
+Const LVM_GETCOLUMN =         LVM_FIRST+25
+Function ListView_GetColumn(hwnd As HWND, iCol As Long, ByRef ref_col As LVCOLUMN) As BOOL
+	ListView_GetColumn=SendMessage(hwnd,LVM_GETCOLUMN,iCol,VarPtr(ref_col) As LPARAM) As BOOL
+End Function
+Const LVM_SETCOLUMN =         LVM_FIRST+26
+Function ListView_SetColumn(hwnd As HWND, iCol As Long, ByRef ref_col As LVCOLUMN) As BOOL
+	ListView_SetColumn=SendMessage(hwnd,LVM_SETCOLUMN,iCol,VarPtr(ref_col) As LPARAM) As BOOL
+End Function
+Const LVM_INSERTCOLUMN =      LVM_FIRST+27
+Function ListView_InsertColumn(hWnd As HWND, iCol As Long, ByRef ref_lvColumn As LVCOLUMN) As Long
+	ListView_InsertColumn=SendMessage(hWnd,LVM_INSERTCOLUMN ,iCol As WPARAM,VarPtr(ref_lvColumn) As LPARAM) As Long
+End Function
+Const LVM_DELETECOLUMN =      LVM_FIRST+28
+Function ListView_DeleteColumn(hwnd As HWND, iCol As Long) As BOOL
+	ListView_DeleteColumn=SendMessage(hwnd,LVM_DELETECOLUMN,iCol,0) As BOOL
+End Function
+Const LVM_GETCOLUMNWIDTH =    LVM_FIRST+29
+Const LVM_SETCOLUMNWIDTH =    LVM_FIRST+30
+Function ListView_SetColumnWidth(hwnd As HWND, iCol As Long, cx As Long) As BOOL
+	ListView_SetColumnWidth=SendMessage(hwnd,LVM_SETCOLUMNWIDTH,iCol,MAKELONG(cx,0) As LPARAM) As BOOL
+End Function
+Const LVM_GETHEADER =         LVM_FIRST+31
+Const LVM_CREATEDRAGIMAGE =   LVM_FIRST+33
+Const LVM_GETVIEWRECT =       LVM_FIRST+34
+Const LVM_GETTEXTCOLOR =      LVM_FIRST+35
+Const LVM_SETTEXTCOLOR =      LVM_FIRST+36
+Const LVM_GETTEXTBKCOLOR =    LVM_FIRST+37
+Const LVM_SETTEXTBKCOLOR =    LVM_FIRST+38
+Const LVM_GETTOPINDEX =       LVM_FIRST+39
+Const LVM_GETCOUNTPERPAGE =   LVM_FIRST+40
+Const LVM_GETORIGIN =         LVM_FIRST+41
+Const LVM_UPDATE =            LVM_FIRST+42
+
+Const LVIS_FOCUSED        = &H0001
+Const LVIS_SELECTED       = &H0002
+Const LVIS_CUT            = &H0004
+Const LVIS_DROPHILITED    = &H0008
+Const LVIS_GLOW           = &H0010
+Const LVIS_ACTIVATING     = &H0020
+Const LVIS_OVERLAYMASK    = &H0F00
+Const LVIS_STATEIMAGEMASK = &HF000
+Const LVM_SETITEMSTATE =      LVM_FIRST+43
+Function ListView_SetItemState(hwnd As HWND, i As Long, state As DWord, mask As DWord) As BOOL
+	Dim lvItem As LVITEM
+	lvItem.stateMask=mask
+	lvItem.state=state
+	ListView_SetItemState=SendMessage(hwnd,LVM_SETITEMSTATE,i,VarPtr(lvItem) As LPARAM) As DWord
+End Function
+Const LVM_GETITEMSTATE =      LVM_FIRST+44
+Function ListView_GetItemState(hwnd As HWND, i As Long, mask As DWord) As DWord
+	ListView_GetItemState=SendMessage(hwnd,LVM_GETITEMSTATE,i,mask As LPARAM) As DWord
+End Function
+Function ListView_GetCheckState(hwnd As HWND, iIndex As Long) As BOOL
+	ListView_GetCheckState=((SendMessage(hwnd,LVM_GETITEMSTATE,iIndex,LVIS_STATEIMAGEMASK) As DWord)>>12)-1
+End Function
+
+Const LVM_GETITEMTEXT =       LVM_FIRST+45
+Sub ListView_GetItemText(hwnd As HWND, iItem As Long, iSubItem As Long, pszText As LPSTR, cchTextMax As Long)
+	Dim lvi As LVITEM
+	lvi.iSubItem=iSubItem
+	lvi.cchTextMax=cchTextMax
+	lvi.pszText=pszText
+	SendMessage(hwnd,LVM_GETITEMTEXT,iItem,VarPtr(lvi) As LPARAM)
+End Sub
+Const LVM_SETITEMTEXT =       LVM_FIRST+46
+Sub ListView_SetItemText(hwnd As HWND, iItem As Long, iSubItem As Long, pszText As LPCSTR)
+	Dim lvi As LVITEM
+	lvi.iSubItem=iSubItem
+	lvi.pszText=pszText
+	SendMessage(hwnd,LVM_SETITEMTEXT,iItem,VarPtr(lvi) As LPARAM)
+End Sub
+Const LVM_SETITEMCOUNT =      LVM_FIRST+47
+Const LVM_SORTITEMS =         LVM_FIRST+48
+Function ListView_SortItems(hwnd As HWND, pfnCompare As VoidPtr, lParamSort As LPARAM) As BOOL
+	ListView_SortItems=SendMessage(hwnd,LVM_SORTITEMS,lParamSort As WPARAM,pfnCompare As LPARAM) As BOOL
+End Function
+Const LVM_SETITEMPOSITION32 = LVM_FIRST+49
+Const LVM_GETSELECTEDCOUNT =  LVM_FIRST+50
+Const LVM_GETITEMSPACING =    LVM_FIRST+51
+Const LVM_GETISEARCHSTRING =  LVM_FIRST+52
+Const LVM_SETICONSPACING =    LVM_FIRST+53
+Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST+54
+Function ListView_SetExtendedListViewStyle(hwndLV As HWND, dwExStyle As DWord) As DWord
+	ListView_SetExtendedListViewStyle=SendMessage(hwndLV,LVM_SETEXTENDEDLISTVIEWSTYLE,dwExStyle,dwExStyle) As DWord
+End Function
+Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST+55
+Function ListView_GetExtendedListViewStyle(hwndLV As HWND) As DWord
+	ListView_GetExtendedListViewStyle=SendMessage(hwndLV,LVM_GETEXTENDEDLISTVIEWSTYLE,0,0) As DWord
+End Function
+Const LVM_GETSUBITEMRECT =    LVM_FIRST+56
+Const LVM_SUBITEMHITTEST =    LVM_FIRST+57
+Const LVM_SETCOLUMNORDERARRAY = LVM_FIRST+58
+Const LVM_GETCOLUMNORDERARRAY = LVM_FIRST+59
+Const LVM_SETHOTITEM =        LVM_FIRST+60
+Const LVM_GETHOTITEM =        LVM_FIRST+61
+Const LVM_SETHOTCURSOR =      LVM_FIRST+62
+Const LVM_GETHOTCURSOR =      LVM_FIRST+63
+Const LVM_APPROXIMATEVIEWRECT = LVM_FIRST+64
+Const LVM_SETWORKAREAS =      LVM_FIRST+65
+Const LVM_GETSELECTIONMARK =  LVM_FIRST+66
+Const LVM_SETSELECTIONMARK =  LVM_FIRST+67
+Const LVM_SETBKIMAGE =        LVM_FIRST+68
+Const LVM_GETBKIMAGE =        LVM_FIRST+69
+Const LVM_GETWORKAREAS =      LVM_FIRST+70
+Const LVM_SETHOVERTIME =      LVM_FIRST+71
+Const LVM_GETHOVERTIME =      LVM_FIRST+72
+Const LVM_GETNUMBEROFWORKAREAS = LVM_FIRST+73
+Const LVM_SETTOOLTIPS =       LVM_FIRST+74
+Const LVM_GETTOOLTIPS =       LVM_FIRST+78
+
+Type NMLISTVIEW
+	hdr As NMHDR
+	iItem As Long
+	iSubItem As Long
+	uNewState As DWord
+	uOldState As DWord
+	uChanged As DWord
+	ptAction As POINTAPI
+	lParam As LPARAM
+End Type
+
+Type NMLVDISPINFO
+	hdr As NMHDR
+	item As LVITEM
+End Type
+
+Type NMLVKEYDOWN
+	hdr As NMHDR
+	wVKey As Word
+	flags As DWord
+End Type
+
+Const LVN_FIRST =             -100
+Const LVN_ITEMCHANGING =      LVN_FIRST-0
+Const LVN_ITEMCHANGED =       LVN_FIRST-1
+Const LVN_INSERTITEM =        LVN_FIRST-2
+Const LVN_DELETEITEM =        LVN_FIRST-3
+Const LVN_DELETEALLITEMS =    LVN_FIRST-4
+Const LVN_BEGINLABELEDIT =    LVN_FIRST-5
+Const LVN_ENDLABELEDIT =      LVN_FIRST-6
+Const LVN_COLUMNCLICK =       LVN_FIRST-8
+Const LVN_BEGINDRAG =         LVN_FIRST-9
+Const LVN_BEGINRDRAG =        LVN_FIRST-11
+Const LVN_ODCACHEHINT =       LVN_FIRST-13
+Const LVN_ODFINDITEM =        LVN_FIRST-52
+Const LVN_ITEMACTIVATE =      LVN_FIRST-14
+Const LVN_ODSTATECHANGED =    LVN_FIRST-15
+Const LVN_HOTTRACK =          LVN_FIRST-21
+Const LVN_GETDISPINFO =       LVN_FIRST-50
+Const LVN_SETDISPINFO =       LVN_FIRST-51
+Const LVN_KEYDOWN =           LVN_FIRST-55
+
+Const LVS_ICON =              &H0000
+Const LVS_REPORT =            &H0001
+Const LVS_SMALLICON =         &H0002
+Const LVS_LIST =              &H0003
+Const LVS_SINGLESEL =         &H0004
+Const LVS_SHOWSELALWAYS =     &H0008
+Const LVS_SORTASCENDING =     &H0010
+Const LVS_SORTDESCENDING =    &H0020
+Const LVS_SHAREIMAGELISTS =   &H0040
+Const LVS_NOLABELWRAP =       &H0080
+Const LVS_AUTOARRANGE =       &H0100
+Const LVS_EDITLABELS =        &H0200
+Const LVS_OWNERDATA =         &H1000
+Const LVS_NOSCROLL =          &H2000
+Const LVS_ALIGNTOP =          &H0000
+Const LVS_ALIGNLEFT =         &H0800
+Const LVS_OWNERDRAWFIXED =    &H0400
+Const LVS_NOCOLUMNHEADER =    &H4000
+Const LVS_NOSORTHEADER =      &H8000
+
+Const LVS_EX_GRIDLINES =        &H00000001
+Const LVS_EX_SUBITEMIMAGES =    &H00000002
+Const LVS_EX_CHECKBOXES =       &H00000004
+Const LVS_EX_TRACKSELECT =      &H00000008
+Const LVS_EX_HEADERDRAGDROP =   &H00000010
+Const LVS_EX_FULLROWSELECT =    &H00000020
+Const LVS_EX_ONECLICKACTIVATE = &H00000040
+Const LVS_EX_TWOCLICKACTIVATE = &H00000080
+Const LVS_EX_FLATSB =           &H00000100
+Const LVS_EX_REGIONAL =         &H00000200
+Const LVS_EX_INFOTIP =          &H00000400
+Const LVS_EX_UNDERLINEHOT =     &H00000800
+Const LVS_EX_UNDERLINECOLD =    &H00001000
+Const LVS_EX_MULTIWORKAREAS =   &H00002000
+
+
+'----------------------
+' ProgressBar Control
+'----------------------
+
+Const PBS_SMOOTH =            &H01
+Const PBS_VERTICAL =          &H04
+
+Const PBM_SETRANGE =          WM_USER+1
+Const PBM_SETPOS =            WM_USER+2
+Const PBM_DELTAPOS =          WM_USER+3
+Const PBM_SETSTEP =           WM_USER+4
+Const PBM_STEPIT =            WM_USER+5
+Const PBM_SETRANGE32 =        WM_USER+6
+Type PBRANGE
+	iLow As Long
+	iHigh As Long
+End Type
+Const PBM_GETRANGE =          WM_USER+7
+Const PBM_GETPOS =            WM_USER+8
+Const PBM_SETBARCOLOR =       WM_USER+9
+Const PBM_SETBKCOLOR =        CCM_SETBKCOLOR
+
+
+'-------------------
+' Statusbar Control
+'-------------------
+
+Const SBARS_SIZEGRIP = &H0100
+
+Const SB_SETTEXT =          WM_USER+1
+Const SB_GETTEXT =          WM_USER+2
+Const SB_GETTEXTLENGTH =    WM_USER+3
+Const SB_SETPARTS =         WM_USER+4
+Const SB_GETPARTS =         WM_USER+6
+Const SB_GETBORDERS =       WM_USER+7
+Const SB_SETMINHEIGHT =     WM_USER+8
+Const SB_SIMPLE =           WM_USER+9
+Const SB_GETRECT =          WM_USER+10
+Const SB_ISSIMPLE =         WM_USER+14
+Const SB_SETICON =          WM_USER+15
+Const SB_SETTIPTEXT =       WM_USER+16
+Const SB_GETTIPTEXT =       WM_USER+18
+Const SB_GETICON =          WM_USER+20
+Const SB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT
+Const SB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT
+Const SB_SETBKCOLOR =       CCM_SETBKCOLOR
+
+Const SBT_OWNERDRAW =  &H1000
+Const SBT_NOBORDERS =  &H0100
+Const SBT_POPOUT =     &H0200
+Const SBT_RTLREADING = &H0400
+Const SBT_TOOLTIPS =   &H0800
+
+Const SBN_SIMPLEMODECHANGE = 880
+
+Declare Function CreateStatusWindow Lib "comctl32" Alias _FuncName_CreateStatusWindow (style As Long, lpszText As LPCTSTR, hwndParent As HWND, wID As DWord) As HWND
+
+
+'-----------------
+' Toolbar Control
+'-----------------
+
+Const TBSTATE_CHECKED =       &H01
+Const TBSTATE_PRESSED =       &H02
+Const TBSTATE_ENABLED =       &H04
+Const TBSTATE_HIDDEN =        &H08
+Const TBSTATE_INDETERMINATE = &H10
+Const TBSTATE_WRAP =          &H20
+Const TBSTATE_ELLIPSES =      &H40
+Const TBSTATE_MARKED =        &H80
+
+Const TBSTYLE_BUTTON =          &H0000
+Const TBSTYLE_SEP =             &H0001
+Const TBSTYLE_CHECK =           &H0002
+Const TBSTYLE_GROUP =           &H0004
+Const TBSTYLE_CHECKGROUP =      TBSTYLE_GROUP or TBSTYLE_CHECK
+Const TBSTYLE_DROPDOWN =        &H0008
+Const TBSTYLE_AUTOSIZE =        &H0010
+Const TBSTYLE_NOPREFIX =        &H0020
+Const TBSTYLE_TOOLTIPS =        &H0100
+Const TBSTYLE_WRAPABLE =        &H0200
+Const TBSTYLE_ALTDRAG =         &H0400
+Const TBSTYLE_FLAT =            &H0800
+Const TBSTYLE_LIST =            &H1000
+Const TBSTYLE_CUSTOMERASE =     &H2000
+Const TBSTYLE_REGISTERDROP =    &H4000
+Const TBSTYLE_TRANSPARENT =     &H8000
+Const TBSTYLE_EX_DRAWDDARROWS = &H00000001
+
+Type TBBUTTON
+	iBitmap As Long
+	idCommand As Long
+	fsState As Byte
+	fsStyle As Byte
+#ifdef _WIN64
+	bReserved[ELM(6)] As Byte
+#else
+	bReserved[ELM(2)] As Byte
+#endif
+	dwData As DWord
+	iString As Long
+End Type
+
+Const TB_ENABLEBUTTON =          WM_USER+1
+Const TB_CHECKBUTTON =           WM_USER+2
+Const TB_PRESSBUTTON =           WM_USER+3
+Const TB_HIDEBUTTON =            WM_USER+4
+Const TB_INDETERMINATE =         WM_USER+5
+Const TB_MARKBUTTON =            WM_USER+6
+Const TB_ISBUTTONENABLED =       WM_USER+9
+Const TB_ISBUTTONCHECKED =       WM_USER+10
+Const TB_ISBUTTONPRESSED =       WM_USER+11
+Const TB_ISBUTTONHIDDEN =        WM_USER+12
+Const TB_ISBUTTONINDETERMINATE = WM_USER+13
+Const TB_ISBUTTONHIGHLIGHTED =   WM_USER+14
+Const TB_SETSTATE =              WM_USER+17
+Const TB_GETSTATE =              WM_USER+18
+Const TB_ADDBITMAP =             WM_USER+19
+Const TB_ADDBUTTONS =            WM_USER+20
+Const TB_INSERTBUTTON =          WM_USER+21
+Const TB_DELETEBUTTON =          WM_USER+22
+Const TB_GETBUTTON =             WM_USER+23
+Const TB_BUTTONCOUNT =           WM_USER+24
+Const TB_COMMANDTOINDEX =        WM_USER+25
+Const TB_SAVERESTORE =           WM_USER+26
+Const TB_CUSTOMIZE =             WM_USER+27
+Const TB_ADDSTRING =             WM_USER+28
+Const TB_GETITEMRECT =           WM_USER+29
+Const TB_BUTTONSTRUCTSIZE =      WM_USER+30
+Const TB_SETBUTTONSIZE =         WM_USER+31
+Const TB_SETBITMAPSIZE =         WM_USER+32
+Const TB_AUTOSIZE =              WM_USER+33
+Const TB_GETTOOLTIPS =           WM_USER+35
+Const TB_SETTOOLTIPS =           WM_USER+36
+Const TB_SETPARENT =             WM_USER+37
+Const TB_SETROWS =               WM_USER+39
+Const TB_GETROWS =               WM_USER+40
+Const TB_SETCMDID =              WM_USER+42
+Const TB_CHANGEBITMAP =          WM_USER+43
+Const TB_GETBITMAP =             WM_USER+44
+Const TB_GETBUTTONTEXT =         WM_USER+45
+Const TB_REPLACEBITMAP =         WM_USER+46
+Const TB_SETINDENT =             WM_USER+47
+Const TB_SETIMAGELIST =          WM_USER+48
+Const TB_GETIMAGELIST =          WM_USER+49
+Const TB_LOADIMAGES =            WM_USER+50
+Const TB_GETRECT =               WM_USER+51
+Const TB_SETHOTIMAGELIST =       WM_USER+52
+Const TB_GETHOTIMAGELIST =       WM_USER+53
+Const TB_SETDISABLEDIMAGELIST =  WM_USER+54
+Const TB_GETDISABLEDIMAGELIST =  WM_USER+55
+Const TB_SETSTYLE =              WM_USER+56
+Const TB_GETSTYLE =              WM_USER+57
+Const TB_GETBUTTONSIZE =         WM_USER+58
+Const TB_SETBUTTONWIDTH =        WM_USER+59
+Const TB_SETMAXTEXTROWS =        WM_USER+60
+Const TB_GETTEXTROWS =           WM_USER+61
+Const TB_GETOBJECT =             WM_USER+62
+Const TB_GETBUTTONINFO =         WM_USER+65
+Const TB_SETBUTTONINFO =         WM_USER+66
+Const TB_GETHOTITEM =            WM_USER+71
+Const TB_SETHOTITEM =            WM_USER+72
+Const TB_SETANCHORHIGHLIGHT =    WM_USER+73
+Const TB_GETANCHORHIGHLIGHT =    WM_USER+74
+Const TB_MAPACCELERATOR =        WM_USER+78
+Const TB_GETINSERTMARK =         WM_USER+79
+Const TB_SETINSERTMARK =         WM_USER+80
+Const TB_INSERTMARKHITTEST =     WM_USER+81
+Const TB_MOVEBUTTON =            WM_USER+82
+Const TB_GETMAXSIZE =            WM_USER+83
+Const TB_SETEXTENDEDSTYLE =      WM_USER+84
+Const TB_GETEXTENDEDSTYLE =      WM_USER+85
+Const TB_GETPADDING =            WM_USER+86
+Const TB_SETPADDING =            WM_USER+87
+Const TB_SETINSERTMARKCOLOR =    WM_USER+88
+Const TB_GETINSERTMARKCOLOR =    WM_USER+89
+Const TB_SETCOLORSCHEME =        CCM_SETCOLORSCHEME
+Const TB_GETCOLORSCHEME =        CCM_GETCOLORSCHEME
+Const TB_SETUNICODEFORMAT =      CCM_SETUNICODEFORMAT
+Const TB_GETUNICODEFORMAT =      CCM_GETUNICODEFORMAT
+Const TB_HITTEST =               WM_USER+69
+
+Type TOOLTIPTEXT
+	hdr As NMHDR
+	lpszText As LPSTR
+	szText[79] As Byte
+	hinst As HINSTANCE
+	uFlags As DWord
+	lParam As LPARAM
+End Type
+
+Const TTN_NEEDTEXT = -520
+
+Declare Function CreateToolbarEx Lib "comctl32" (hWnd As HWND, ws As DWord, wID As DWord, nBitmaps As Long, hBMInst As HINSTANCE, wBMID As DWord, lpButtons As VoidPtr, iNumButtons As Long, dxButton As Long, dyButton As Long, dxBitmap As Long, dyBitmap As Long, uStructSize As DWord) As HWND
+
+
+'-----------------------
+' ToolTip Control
+'-----------------------
+
+Const TOOLTIPS_CLASS = "tooltips_class32"
+
+Const TTS_ALWAYSTIP = &H01
+Const TTS_NOPREFIX  = &H02
+Const TTS_NOANIMATE = &H10
+Const TTS_NOFADE    = &H20
+Const TTS_BALLOON   = &H40
+Const TTS_CLOSE     = &H80
+
+Const TTF_IDISHWND    = &H0001
+Const TTF_CENTERTIP   = &H0002
+Const TTF_RTLREADING  = &H0004
+Const TTF_SUBCLASS    = &H0010
+Const TTF_TRACK       = &H0020
+Const TTF_ABSOLUTE    = &H0080
+Const TTF_TRANSPARENT = &H0100
+Const TTF_PARSELINKS  = &H1000
+Const TTF_DI_SETITEM  = &H8000       ' valid only on the TTN_NEEDTEXT callback
+
+Type TOOLINFO
+	cbSize As DWord
+	uFlags As DWord
+	hwnd As HWND
+	uId As ULONG_PTR
+	rect As RECT
+	hinst As HINSTANCE
+	lpszText as LPSTR
+	lParam As LPARAM
+	lpReserved As VoidPtr
+End Type
+
+Const TTM_ACTIVATE           = (WM_USER + 1)
+Const TTM_SETDELAYTIME       = (WM_USER + 3)
+Const TTM_ADDTOOL            = (WM_USER + 4)
+Const TTM_DELTOOL            = (WM_USER + 5)
+Const TTM_NEWTOOLRECT        = (WM_USER + 6)
+Const TTM_RELAYEVENT         = (WM_USER + 7)
+Const TTM_GETTOOLINFO        = (WM_USER + 8)
+Const TTM_SETTOOLINFO        = (WM_USER + 9)
+Const TTM_HITTEST            = (WM_USER +10)
+Const TTM_GETTEXT            = (WM_USER +11)
+Const TTM_UPDATETIPTEXT      = (WM_USER +12)
+Const TTM_GETTOOLCOUNT       = (WM_USER +13)
+Const TTM_ENUMTOOLS          = (WM_USER +14)
+Const TTM_GETCURRENTTOOL     = (WM_USER + 15)
+Const TTM_WINDOWFROMPOINT    = (WM_USER + 16)
+Const TTM_TRACKACTIVATE      = (WM_USER + 17)  ' wParam = TRUE/FALSE start end  lparam = LPTOOLINFO
+Const TTM_TRACKPOSITION      = (WM_USER + 18)  ' lParam = dwPos
+Const TTM_SETTIPBKCOLOR      = (WM_USER + 19)
+Const TTM_SETTIPTEXTCOLOR    = (WM_USER + 20)
+Const TTM_GETDELAYTIME       = (WM_USER + 21)
+Const TTM_GETTIPBKCOLOR      = (WM_USER + 22)
+Const TTM_GETTIPTEXTCOLOR    = (WM_USER + 23)
+Const TTM_SETMAXTIPWIDTH     = (WM_USER + 24)
+Const TTM_GETMAXTIPWIDTH     = (WM_USER + 25)
+Const TTM_SETMARGIN          = (WM_USER + 26)  ' lParam = lprc
+Const TTM_GETMARGIN          = (WM_USER + 27)  ' lParam = lprc
+Const TTM_POP                = (WM_USER + 28)
+Const TTM_UPDATE             = (WM_USER + 29)
+Const TTM_GETBUBBLESIZE      = (WM_USER + 30)
+Const TTM_ADJUSTRECT         = (WM_USER + 31)
+Const TTM_SETTITLE           = (WM_USER + 32)  ' wParam = TTI_*, lParam = char* szTitle
+
+
+'-------------------
+' TrackBar Control
+'-------------------
+
+Const TBS_AUTOTICKS =         &H0001
+Const TBS_VERT =              &H0002
+Const TBS_HORZ =              &H0000
+Const TBS_TOP =               &H0004
+Const TBS_BOTTOM =            &H0000
+Const TBS_LEFT =              &H0004
+Const TBS_RIGHT =             &H0000
+Const TBS_BOTH =              &H0008
+Const TBS_NOTICKS =           &H0010
+Const TBS_ENABLESELRANGE =    &H0020
+Const TBS_FIXEDLENGTH =       &H0040
+Const TBS_NOTHUMB =           &H0080
+Const TBS_TOOLTIPS =          &H0100
+
+Const TBM_GETPOS =            WM_USER
+Const TBM_GETRANGEMIN =       WM_USER+1
+Const TBM_GETRANGEMAX =       WM_USER+2
+Const TBM_GETTIC =            WM_USER+3
+Const TBM_SETTIC =            WM_USER+4
+Const TBM_SETPOS =            WM_USER+5
+Const TBM_SETRANGE =          WM_USER+6
+Const TBM_SETRANGEMIN =       WM_USER+7
+Const TBM_SETRANGEMAX =       WM_USER+8
+Const TBM_CLEARTICS =         WM_USER+9
+Const TBM_SETSEL =            WM_USER+10
+Const TBM_SETSELSTART =       WM_USER+11
+Const TBM_SETSELEND =         WM_USER+12
+Const TBM_GETPTICS =          WM_USER+14
+Const TBM_GETTICPOS =         WM_USER+15
+Const TBM_GETNUMTICS =        WM_USER+16
+Const TBM_GETSELSTART =       WM_USER+17
+Const TBM_GETSELEND =         WM_USER+18
+Const TBM_CLEARSEL =          WM_USER+19
+Const TBM_SETTICFREQ =        WM_USER+20
+Const TBM_SETPAGESIZE =       WM_USER+21
+Const TBM_GETPAGESIZE =       WM_USER+22
+Const TBM_SETLINESIZE =       WM_USER+23
+Const TBM_GETLINESIZE =       WM_USER+24
+Const TBM_GETTHUMBRECT =      WM_USER+25
+Const TBM_GETCHANNELRECT =    WM_USER+26
+Const TBM_SETTHUMBLENGTH =    WM_USER+27
+Const TBM_GETTHUMBLENGTH =    WM_USER+28
+Const TBM_SETTOOLTIPS =       WM_USER+29
+Const TBM_GETTOOLTIPS =       WM_USER+30
+Const TBM_SETTIPSIDE =        WM_USER+31
+Const TBTS_TOP =              0
+Const TBTS_LEFT =             1
+Const TBTS_BOTTOM =           2
+Const TBTS_RIGHT =            3
+
+Const TBM_SETBUDDY =          WM_USER+32
+Const TBM_GETBUDDY =          WM_USER+33
+Const TBM_SETUNICODEFORMAT =  CCM_SETUNICODEFORMAT
+Const TBM_GETUNICODEFORMAT =  CCM_GETUNICODEFORMAT
+
+
+'-------------------
+' TreeView Control
+'-------------------
+
+Type _System_DeclareHandle_HTREEITEM:unused As DWord:End Type
+TypeDef HTREEITEM   = *_System_DeclareHandle_HTREEITEM
+
+Const TV_FIRST = &H1100             'TreeView messages
+
+Const TVM_INSERTITEM  = TV_FIRST + 0
+Function TreeView_InsertItem(hWnd As HWND, ByRef ref_is As TV_INSERTSTRUCT) As HTREEITEM
+	Return SendMessage(hWnd,TVM_INSERTITEM,0,VarPtr(ref_is) As LPARAM) As HTREEITEM
+End Function
+
+Const TVM_DELETEITEM  = TV_FIRST + 1
+Function TreeView_DeleteItem(hWnd As HWND, hitem As HTREEITEM) As BOOL
+	Return SendMessage(hWnd,TVM_DELETEITEM,0,hitem As LPARAM) As BOOL
+End Function
+Function TreeView_DeleteAllItems(hWnd As HWND) As BOOL
+	Return SendMessage(hWnd,TVM_DELETEITEM,0,TVI_ROOT As LPARAM) As BOOL
+End Function
+
+Const TVM_EXPAND = TV_FIRST + 2
+Function TreeView_Expand(hWnd As HWND, hitem As HTREEITEM, code As DWord) As BOOL
+	TreeView_Expand=SendMessage(hWnd,TVM_EXPAND,code As WPARAM,hitem As LPARAM) As BOOL
+End Function
+
+Const TVE_COLLAPSE      = &H0001
+Const TVE_EXPAND        = &H0002
+Const TVE_TOGGLE        = &H0003
+Const TVE_EXPANDPARTIAL = &H4000
+Const TVE_COLLAPSERESET = &H8000
+
+Const TVM_GETITEMRECT = TV_FIRST + 4
+Function TreeView_GetItemRect(hWnd As HWND, hitem As HTREEITEM, ByRef refRect As RECT, code As DWord) As BOOL
+	memcpy(VarPtr(refRect),VarPtr(hitem),SizeOf(HTREEITEM))
+	TreeView_GetItemRect=SendMessage(hWnd,TVM_GETITEMRECT,code As WPARAM,VarPtr(refRect) As LPARAM) As BOOL
+End Function
+
+Const TVM_GETCOUNT = TV_FIRST + 5
+Function TreeView_GetCount(hWnd As HWND) As DWord
+	TreeView_GetCount=SendMessage(hWnd,TVM_GETCOUNT,0,0) As DWord
+End Function
+
+Const TVM_GETINDENT = TV_FIRST + 6
+Function TreeView_GetIndent(hWnd As HWND) As DWord
+	TreeView_GetIndent=SendMessage(hWnd,TVM_GETINDENT,0,0) As DWord
+End Function
+
+Const TVM_SETINDENT = TV_FIRST + 7
+Function TreeView_SetIndent(hWnd As HWND, indent As DWord) As DWord
+	TreeView_SetIndent=SendMessage(hWnd,TVM_SETINDENT,indent As WPARAM,0) As DWord
+End Function
+
+Const TVM_GETIMAGELIST = TV_FIRST + 8
+Function TreeView_GetImageList(hWnd As HWND, iImage As DWord) As HIMAGELIST
+	TreeView_GetImageList=SendMessage(hWnd,TVM_GETIMAGELIST,iImage As WPARAM,0) As HIMAGELIST
+End Function
+
+Const TVSIL_NORMAL = 0
+Const TVSIL_STATE  = 2
+
+Const TVM_SETIMAGELIST = TV_FIRST + 9
+Function TreeView_SetImageList(hWnd As HWND, himl As HIMAGELIST, iImage As DWord) As HIMAGELIST
+	TreeView_SetImageList=SendMessage(hWnd,TVM_SETIMAGELIST,iImage As WPARAM,himl As LPARAM) As HIMAGELIST
+End Function
+
+Const TVM_GETNEXTITEM = TV_FIRST + 10
+Function TreeView_GetNextItem(hWnd As HWND, hitem As HTREEITEM, code As DWord) As HTREEITEM
+	TreeView_GetNextItem=SendMessage(hWnd,TVM_GETNEXTITEM,code As WPARAM,hitem As LPARAM) As HTREEITEM
+End Function
+
+Const TVM_SELECTITEM =			&H110B
+Const TVM_GETITEM =				&H110C
+Const TVM_SETITEM =				&H110D
+Const TVM_GETVISIBLECOUNT =		&H1110
+Const TVM_HITTEST =				&H1111
+Const TVM_SORTCHILDREN =		&H1113
+Const TVM_SETBKCOLOR =			&H111D
+Const TVM_SETTEXTCOLOR =		&H111E
+Const TVM_GETBKCOLOR =			&H111F
+Const TVM_GETTEXTCOLOR =		&H1120
+
+Const TVI_ROOT   = ((-&H10000) As HTREEITEM)
+Const TVI_FIRST  = ((-&H0FFFF) As HTREEITEM)
+Const TVI_LAST   = ((-&H0FFFE) As HTREEITEM)
+Const TVI_SORT   = ((-&H0FFFD) As HTREEITEM)
+
+Type TVITEM
+	mask As DWord
+	hItem As HTREEITEM
+	state As DWord
+	stateMask As DWord
+	pszText As LPSTR
+	cchTextMax As Long
+	iImage As Long
+	iSelectedImage As Long
+	cChildren As Long
+	lParam As LPARAM
+End Type
+
+Type TVINSERTSTRUCT
+	hParent As HTREEITEM
+	hInsertAfter As HTREEITEM
+	item As TVITEM
+End Type
+TypeDef TV_INSERTSTRUCT = TVINSERTSTRUCT
+
+Const TVIF_TEXT =             	&H0001
+Const TVIF_IMAGE =            	&H0002
+Const TVIF_PARAM =            	&H0004
+Const TVIF_STATE =            	&H0008
+Const TVIF_HANDLE =           	&H0010
+Const TVIF_SELECTEDIMAGE =    	&H0020
+Const TVIF_CHILDREN =         	&H0040
+Const TVIF_INTEGRAL =         	&H0080
+Const TVIS_SELECTED =         	&H0002
+Const TVIS_CUT =              	&H0004
+Const TVIS_DROPHILITED =      	&H0008
+Const TVIS_BOLD =             	&H0010
+Const TVIS_EXPANDED =         	&H0020
+Const TVIS_EXPANDEDONCE =     	&H0040
+Const TVIS_EXPANDPARTIAL =    	&H0080
+Const TVIS_OVERLAYMASK =      	&H0F00
+Const TVIS_STATEIMAGEMASK =   	&HF000
+Const TVIS_USERMASK =         	&HF000
+
+Type NMTREEVIEW
+	hdr As NMHDR
+	action As DWord
+	itemOld As TVITEM
+	itemNew As TVITEM
+	ptDrag As POINTAPI
+End Type
+
+Const TVN_FIRST =             	-400
+Const TVN_SELCHANGING =       	TVN_FIRST-1
+Const TVN_SELCHANGED =        	TVN_FIRST-2
+Const TVN_GETDISPINFO =       	TVN_FIRST-3
+Const TVN_SETDISPINFO =       	TVN_FIRST-4
+Const TVN_ITEMEXPANDING =     	TVN_FIRST-5
+Const TVN_ITEMEXPANDED =      	TVN_FIRST-6
+Const TVN_BEGINDRAG =         	TVN_FIRST-7
+Const TVN_BEGINRDRAG =        	TVN_FIRST-8
+Const TVN_DELETEITEM =        	TVN_FIRST-9
+Const TVN_BEGINLABELEDIT =    	TVN_FIRST-10
+Const TVN_ENDLABELEDIT =      	TVN_FIRST-11
+Const TVN_KEYDOWN =           	TVN_FIRST-12
+Const TVN_GETINFOTIP =        	TVN_FIRST-13
+Const TVN_SINGLEEXPAND =      	TVN_FIRST-15
+
+Const TVGN_ROOT =				&H0000
+Const TVGN_NEXT =				&H0001
+Const TVGN_PREVIOUS	=			&H0002
+Const TVGN_PARENT =				&H0003
+Const TVGN_CHILD =				&H0004
+Const TVGN_FIRSTVISIBLE =		&H0005
+Const TVGN_NEXTVISIBLE =		&H0006
+Const TVGN_PREVIOUSVISIBLE =	&H0007
+Const TVGN_DROPHILITE =			&H0008
+Const TVGN_CARET =				&H0009
+Const TVGN_LASTVISIBLE =		&H000A
+
+'-----------------
+' UpDown Control
+'-----------------
+
+Declare Function CreateUpDownControl Lib "comctl32" (dwStyle As DWord, x As Long, y As Long, cx As Long, cy As Long, hParent As HWND, nID As Long, hInst As HINSTANCE, hBuddy As HWND, nUpper As Long, nLower As Long, nPos As Long) As HWND
+
+Const UDS_WRAP =              &H0001
+Const UDS_SETBUDDYINT =       &H0002
+Const UDS_ALIGNRIGHT =        &H0004
+Const UDS_ALIGNLEFT =         &H0008
+Const UDS_AUTOBUDDY =         &H0010
+Const UDS_ARROWKEYS =         &H0020
+Const UDS_HORZ =              &H0040
+Const UDS_NOTHOUSANDS =       &H0080
+Const UDS_HOTTRACK =          &H0100
+
+Const UDM_SETRANGE =          WM_USER+101
+Const UDM_GETRANGE =          WM_USER+102
+Const UDM_SETPOS =            WM_USER+103
+Const UDM_GETPOS =            WM_USER+104
+Const UDM_SETBUDDY =          WM_USER+105
+Const UDM_GETBUDDY =          WM_USER+106
+Const UDM_SETACCEL =          WM_USER+107
+Const UDM_GETACCEL =          WM_USER+108
+Const UDM_SETBASE =           WM_USER+109
+Const UDM_GETBASE =           WM_USER+110
+Const UDM_SETRANGE32 =        WM_USER+111
+Const UDM_GETRANGE32 =        WM_USER+112
+
+Type NMUPDOWN
+	hdr As NMHDR
+	iPos As Long
+	iDelta As Long
+End Type
+
+Const UDN_FIRST =             -721
+Const UDN_DELTAPOS =          UDN_FIRST-1
+
+
+
+'--------------------
+' Calender Contorl
+'--------------------
+
+Const MONTHCAL_CLASS = "SysMonthCal32"
+
+Const MCS_DAYSTATE       = &H0001
+Const MCS_MULTISELECT    = &H0002
+Const MCS_WEEKNUMBERS    = &H0004
+Const MCS_NOTODAYCIRCLE  = &H0008
+Const MCS_NOTODAY        = &H0010
+
+Const MCM_FIRST          = &H1000
+Const MCM_GETCURSEL      = (MCM_FIRST + 1)
+Const MCM_SETCURSEL      = (MCM_FIRST + 2)
+Const MCM_GETMAXSELCOUNT = (MCM_FIRST + 3)
+Const MCM_SETMAXSELCOUNT = (MCM_FIRST + 4)
+Const MCM_GETSELRANGE    = (MCM_FIRST + 5)
+Const MCM_SETSELRANGE    = (MCM_FIRST + 6)
+Const MCM_GETMONTHRANGE  = (MCM_FIRST + 7)
+Const MCM_SETDAYSTATE    = (MCM_FIRST + 8)
+Const MCM_GETMINREQRECT  = (MCM_FIRST + 9)
+Const MCM_SETCOLOR       = (MCM_FIRST + 10)
+Const MCM_GETCOLOR       = (MCM_FIRST + 11)
+Const MCM_SETTODAY       = (MCM_FIRST + 12)
+Const MCM_GETTODAY       = (MCM_FIRST + 13)
+Const MCM_HITTEST        = (MCM_FIRST + 14)
+
+Const MCN_FIRST = &HFFFFFD12
+
+Type NMSELCHANGE
+	nmhdr As NMHDR
+	stSelStart As SYSTEMTIME
+	stSelEnd As SYSTEMTIME
+End Type
+
+Const MCN_SELCHANGE = MCN_FIRST + &H1
+
+Declare Function _TrackMouseEvent Lib "comctl32" (ByRef EventTrack As TRACKMOUSEEVENT) As BOOL
+
+#endif '_INC_COMMCTRL
Index: /trunk/ab5.0/ablib/src/api_commdlg.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_commdlg.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_commdlg.sbp	(revision 506)
@@ -0,0 +1,483 @@
+' api_commdlg.sbp
+
+#ifdef UNICODE
+Const _FuncName_ChooseColor = "ChooseColorW"
+Const _FuncName_ChooseFont = "ChooseFontW"
+Const _FuncName_FindText = "FindTextW"
+Const _FuncName_GetOpenFileName = "GetOpenFileNameW"
+Const _FuncName_GetSaveFileName = "GetSaveFileNameW"
+Const _FuncName_GetFileTitle = "GetFileTitleW"
+Const _FuncName_PageSetupDlg = "PageSetupDlgW"
+Const _FuncName_PrintDlg = "PrintDlgW"
+#else
+Const _FuncName_ChooseColor = "ChooseColorA"
+Const _FuncName_ChooseFont = "ChooseFontA"
+Const _FuncName_FindText = "FindTextA"
+Const _FuncName_GetOpenFileName = "GetOpenFileNameA"
+Const _FuncName_GetSaveFileName = "GetSaveFileNameA"
+Const _FuncName_GetFileTitle = "GetFileTitleA"
+Const _FuncName_PageSetupDlg = "PageSetupDlgA"
+Const _FuncName_PrintDlg = "PrintDlgA"
+#endif
+
+TypeDef LPCOMMDLGHOOKPROC = *Function(hdlg As HWND, uiMsg As DWord, wp As WPARAM, lp As LPARAM) As ULONG_PTR
+
+' Common dialog error
+Const CDERR_DIALOGFAILURE =    &HFFFF
+
+Const CDERR_GENERALCODES =     &H0000
+Const CDERR_STRUCTSIZE =       &H0001
+Const CDERR_INITIALIZATION =   &H0002
+Const CDERR_NOTEMPLATE =       &H0003
+Const CDERR_NOHINSTANCE =      &H0004
+Const CDERR_LOADSTRFAILURE =   &H0005
+Const CDERR_FINDRESFAILURE =   &H0006
+Const CDERR_LOADRESFAILURE =   &H0007
+Const CDERR_LOCKRESFAILURE =   &H0008
+Const CDERR_MEMALLOCFAILURE =  &H0009
+Const CDERR_MEMLOCKFAILURE =   &H000A
+Const CDERR_NOHOOK =           &H000B
+Const CDERR_REGISTERMSGFAIL =  &H000C
+
+Const PDERR_PRINTERCODES =     &H1000
+Const PDERR_SETUPFAILURE =     &H1001
+Const PDERR_PARSEFAILURE =     &H1002
+Const PDERR_RETDEFFAILURE =    &H1003
+Const PDERR_LOADDRVFAILURE =   &H1004
+Const PDERR_GETDEVMODEFAIL =   &H1005
+Const PDERR_INITFAILURE =      &H1006
+Const PDERR_NODEVICES =        &H1007
+Const PDERR_NODEFAULTPRN =     &H1008
+Const PDERR_DNDMMISMATCH =     &H1009
+Const PDERR_CREATEICFAILURE =  &H100A
+Const PDERR_PRINTERNOTFOUND =  &H100B
+Const PDERR_DEFAULTDIFFERENT = &H100C
+
+Const CFERR_CHOOSEFONTCODES =  &H2000
+Const CFERR_NOFONTS =          &H2001
+Const CFERR_MAXLESSTHANMIN =   &H2002
+
+Const FNERR_FILENAMECODES =    &H3000
+Const FNERR_SUBCLASSFAILURE =  &H3001
+Const FNERR_INVALIDFILENAME =  &H3002
+Const FNERR_BUFFERTOOSMALL =   &H3003
+
+Const FRERR_FINDREPLACECODES = &H4000
+Const FRERR_BUFFERLENGTHZERO = &H4001
+
+Const CCERR_CHOOSECOLORCODES = &H5000
+Declare Function CommDlgExtendedError Lib "comdlg32" () As DWord
+
+
+'-------------
+' ChooseColor
+'-------------
+Const CC_RGBINIT =              &H00000001
+Const CC_FULLOPEN =             &H00000002
+Const CC_PREVENTFULLOPEN =      &H00000004
+Const CC_SHOWHELP =             &H00000008
+Const CC_ENABLEHOOK =           &H00000010
+Const CC_ENABLETEMPLATE =       &H00000020
+Const CC_ENABLETEMPLATEHANDLE = &H00000040
+Const CC_SOLIDCOLOR =           &H00000080
+Const CC_ANYCOLOR =             &H00000100
+TypeDef LPCCHOOKPROC = LPCOMMDLGHOOKPROC
+Type CHOOSECOLORW
+	lStructSize    As DWord
+	hwndOwner      As HWND
+	hInstance      As HINSTANCE
+	rgbResult      As DWord
+	lpCustColors   As *DWord
+	Flags          As DWord
+	lCustData      As DWord
+	lpfnHook       As LPCCHOOKPROC
+	lpTemplateName As LPCWSTR
+End Type
+Type CHOOSECOLORA
+	lStructSize    As DWord
+	hwndOwner      As HWND
+	hInstance      As HINSTANCE
+	rgbResult      As DWord
+	lpCustColors   As *DWord
+	Flags          As DWord
+	lCustData      As DWord
+	lpfnHook       As LPCCHOOKPROC
+	lpTemplateName As LPCSTR
+End Type
+#ifdef UNICODE
+TypeDef CHOOSECOLOR = CHOOSECOLORW
+#else
+TypeDef CHOOSECOLOR = CHOOSECOLORA
+#endif
+Declare Function ChooseColor Lib "comdlg32" Alias _FuncName_ChooseColor (ByRef cc As CHOOSECOLOR) As BOOL
+
+
+'------------
+' ChooseFont
+'------------
+Const CF_SCREENFONTS =           &H00000001
+Const CF_PRINTERFONTS =          &H00000002
+Const CF_BOTH =                  CF_SCREENFONTS or CF_PRINTERFONTS
+Const CF_SHOWHELP =              &H00000004
+Const CF_ENABLEHOOK =            &H00000008
+Const CF_ENABLETEMPLATE =        &H00000010
+Const CF_ENABLETEMPLATEHANDLE =  &H00000020
+Const CF_INITTOLOGFONTSTRUCT =   &H00000040
+Const CF_USESTYLE =              &H00000080
+Const CF_EFFECTS =               &H00000100
+Const CF_APPLY =                 &H00000200
+Const CF_ANSIONLY =              &H00000400
+Const CF_SCRIPTSONLY =           CF_ANSIONLY
+Const CF_NOVECTORFONTS =         &H00000800
+Const CF_NOOEMFONTS =            CF_NOVECTORFONTS
+Const CF_NOSIMULATIONS =         &H00001000
+Const CF_LIMITSIZE =             &H00002000
+Const CF_FIXEDPITCHONLY =        &H00004000
+Const CF_WYSIWYG =               &H00008000
+Const CF_FORCEFONTEXIST =        &H00010000
+Const CF_SCALABLEONLY =          &H00020000
+Const CF_TTONLY =                &H00040000
+Const CF_NOFACESEL =             &H00080000
+Const CF_NOSTYLESEL =            &H00100000
+Const CF_NOSIZESEL =             &H00200000
+Const CF_SELECTSCRIPT =          &H00400000
+Const CF_NOSCRIPTSEL =           &H00800000
+Const CF_NOVERTFONTS =           &H01000000
+Const SIMULATED_FONTTYPE =  &H8000
+Const PRINTER_FONTTYPE =    &H4000
+Const SCREEN_FONTTYPE =     &H2000
+Const BOLD_FONTTYPE =       &H0100
+Const ITALIC_FONTTYPE =     &H0200
+Const REGULAR_FONTTYPE =    &H0400
+TypeDef LPCFHOOKPROC = LPCOMMDLGHOOKPROC
+Type CHOOSEFONTW
+	lStructSize            As DWord
+	hwndOwner              As HWND
+	hDC                    As HDC
+	lpLogFont              As *LOGFONTW
+	iPointSize             As Long
+	Flags                  As DWord
+	rgbColors              As DWord
+	lCustData              As LPARAM
+	lpfnHook               As LPCFHOOKPROC
+	lpTemplateName         As LPCWSTR
+	hInstance              As HINSTANCE
+	lpszStyle              As LPWSTR
+	nFontType              As Word
+	___MISSING_ALIGNMENT__ As Word
+	nSizeMin               As Long
+	nSizeMax               As Long
+End Type
+Type CHOOSEFONTA
+	lStructSize            As DWord
+	hwndOwner              As HWND
+	hDC                    As HDC
+	lpLogFont              As *LOGFONTA
+	iPointSize             As Long
+	Flags                  As DWord
+	rgbColors              As DWord
+	lCustData              As LPARAM
+	lpfnHook               As LPCFHOOKPROC
+	lpTemplateName         As LPCSTR
+	hInstance              As HINSTANCE
+	lpszStyle              As LPSTR
+	nFontType              As Word
+	___MISSING_ALIGNMENT__ As Word
+	nSizeMin               As Long
+	nSizeMax               As Long
+End Type
+#ifdef UNICODE
+TypeDef CHOOSEFONT = CHOOSEFONTW
+#else
+TypeDef CHOOSEFONT = CHOOSEFONTA
+#endif
+Declare Function ChooseFont Lib "comdlg32" Alias _FuncName_ChooseFont (ByRef cf As CHOOSEFONT) As BOOL
+
+
+'----------
+' FindText
+'----------
+Const FR_DOWN =                       &H00000001
+Const FR_WHOLEWORD =                  &H00000002
+Const FR_MATCHCASE =                  &H00000004
+Const FR_FINDNEXT =                   &H00000008
+Const FR_REPLACE =                    &H00000010
+Const FR_REPLACEALL =                 &H00000020
+Const FR_DIALOGTERM =                 &H00000040
+Const FR_SHOWHELP =                   &H00000080
+Const FR_ENABLEHOOK =                 &H00000100
+Const FR_ENABLETEMPLATE =             &H00000200
+Const FR_NOUPDOWN =                   &H00000400
+Const FR_NOMATCHCASE =                &H00000800
+Const FR_NOWHOLEWORD =                &H00001000
+Const FR_ENABLETEMPLATEHANDLE =       &H00002000
+Const FR_HIDEUPDOWN =                 &H00004000
+Const FR_HIDEMATCHCASE =              &H00008000
+Const FR_HIDEWHOLEWORD =              &H00010000
+TypeDef LPFRHOOKPROC = LPCOMMDLGHOOKPROC
+Type FINDREPLACEW
+	lStructSize      As DWord
+	hwndOwner        As HWND
+	hInstance        As HINSTANCE
+	Flags            As DWord
+	lpstrFindWhat    As LPWSTR
+	lpstrReplaceWith As LPWSTR
+	wFindWhatLen     As Word
+	wReplaceWithLen  As Word
+	lCustData        As LPARAM
+	lpfnHook         As LPFRHOOKPROC
+	lpTemplateName   As LPCWSTR
+End Type
+Type FINDREPLACEA
+	lStructSize      As DWord
+	hwndOwner        As HWND
+	hInstance        As HINSTANCE
+	Flags            As DWord
+	lpstrFindWhat    As LPSTR
+	lpstrReplaceWith As LPSTR
+	wFindWhatLen     As Word
+	wReplaceWithLen  As Word
+	lCustData        As LPARAM
+	lpfnHook         As LPFRHOOKPROC
+	lpTemplateName   As LPCSTR
+End Type
+#ifdef UNICODE
+TypeDef FINDREPLACE = FINDREPLACEW
+#else
+TypeDef FINDREPLACE = FINDREPLACEA
+#endif
+Declare Function FindText Lib "comdlg32" Alias _FuncName_FindText (ByRef fr As FINDREPLACE) As BOOL
+
+
+'------------------------
+' Get Open/Save FileName
+'------------------------
+Const OFN_READONLY =               &H00000001
+Const OFN_OVERWRITEPROMPT =        &H00000002
+Const OFN_HIDEREADONLY =           &H00000004
+Const OFN_NOCHANGEDIR =            &H00000008
+Const OFN_SHOWHELP =               &H00000010
+Const OFN_ENABLEHOOK =             &H00000020
+Const OFN_ENABLETEMPLATE =         &H00000040
+Const OFN_ENABLETEMPLATEHANDLE =   &H00000080
+Const OFN_NOVALIDATE =             &H00000100
+Const OFN_ALLOWMULTISELECT =       &H00000200
+Const OFN_EXTENSIONDIFFERENT =     &H00000400
+Const OFN_PATHMUSTEXIST =          &H00000800
+Const OFN_FILEMUSTEXIST =          &H00001000
+Const OFN_CREATEPROMPT =           &H00002000
+Const OFN_SHAREAWARE =             &H00004000
+Const OFN_NOREADONLYRETURN =       &H00008000
+Const OFN_NOTESTFILECREATE =       &H00010000
+Const OFN_NONETWORKBUTTON =        &H00020000
+Const OFN_NOLONGNAMES =            &H00040000
+Const OFN_EXPLORER =               &H00080000
+Const OFN_NODEREFERENCELINKS =     &H00100000
+Const OFN_LONGNAMES =              &H00200000
+Const OFN_ENABLEINCLUDENOTIFY =    &H00400000
+Const OFN_ENABLESIZING =           &H00800000
+TypeDef LPOFNHOOKPROC = LPCOMMDLGHOOKPROC
+Type OPENFILENAMEW
+	lStructSize       As DWord
+	hwndOwner         As HWND
+	hInstance         As HINSTANCE
+	lpstrFilter       As LPCWSTR
+	lpstrCustomFilter As LPWSTR
+	nMaxCustFilter    As DWord
+	nFilterIndex      As DWord
+	lpstrFile         As LPWSTR
+	nMaxFile          As DWord
+	lpstrFileTitle    As LPWSTR
+	nMaxFileTitle     As DWord
+	lpstrInitialDir   As LPCWSTR
+	lpstrTitle        As LPCWSTR
+	Flags             As DWord
+	nFileOffset       As Word
+	nFileExtension    As Word
+	lpstrDefExt       As LPCWSTR
+	lCustData         As LPARAM
+	lpfnHook          As LPOFNHOOKPROC
+	lpTemplateName    As LPCWSTR
+End Type
+Type OPENFILENAMEA
+	lStructSize       As DWord
+	hwndOwner         As HWND
+	hInstance         As HINSTANCE
+	lpstrFilter       As LPCSTR
+	lpstrCustomFilter As LPSTR
+	nMaxCustFilter    As DWord
+	nFilterIndex      As DWord
+	lpstrFile         As LPSTR
+	nMaxFile          As DWord
+	lpstrFileTitle    As LPSTR
+	nMaxFileTitle     As DWord
+	lpstrInitialDir   As LPCSTR
+	lpstrTitle        As LPCSTR
+	Flags             As DWord
+	nFileOffset       As Word
+	nFileExtension    As Word
+	lpstrDefExt       As LPCSTR
+	lCustData         As LPARAM
+	lpfnHook          As LPOFNHOOKPROC
+	lpTemplateName    As LPCSTR
+End Type
+#ifdef UNICODE
+TypeDef OPENFILENAME = OPENFILENAMEW
+#else
+TypeDef OPENFILENAME = OPENFILENAMEA
+#endif
+Declare Function GetOpenFileName Lib "comdlg32" Alias _FuncName_GetOpenFileName (ByRef ofn As OPENFILENAME) As BOOL
+Declare Function GetSaveFileName Lib "comdlg32" Alias _FuncName_GetSaveFileName (ByRef ofn As OPENFILENAME) As BOOL
+Declare Function GetFileTitle Lib "comdlg32" Alias _FuncName_GetFileTitle (lpszFile As LPCTSTR, lpszTitle As LPTSTR, cbBuf As Word) As Integer
+
+
+'--------------
+' PageSetupDlg
+'--------------
+Const PSD_DEFAULTMINMARGINS =             &H00000000
+Const PSD_INWININIINTLMEASURE =           &H00000000
+Const PSD_MINMARGINS =                    &H00000001
+Const PSD_MARGINS =                       &H00000002
+Const PSD_INTHOUSANDTHSOFINCHES =         &H00000004
+Const PSD_INHUNDREDTHSOFMILLIMETERS =     &H00000008
+Const PSD_DISABLEMARGINS =                &H00000010
+Const PSD_DISABLEPRINTER =                &H00000020
+Const PSD_NOWARNING =                     &H00000080
+Const PSD_DISABLEORIENTATION =            &H00000100
+Const PSD_RETURNDEFAULT =                 &H00000400
+Const PSD_DISABLEPAPER =                  &H00000200
+Const PSD_SHOWHELP =                      &H00000800
+Const PSD_ENABLEPAGESETUPHOOK =           &H00002000
+Const PSD_ENABLEPAGESETUPTEMPLATE =       &H00008000
+Const PSD_ENABLEPAGESETUPTEMPLATEHANDLE = &H00020000
+Const PSD_ENABLEPAGEPAINTHOOK =           &H00040000
+Const PSD_DISABLEPAGEPAINTING =           &H00080000
+Const PSD_NONETWORKBUTTON =               &H00200000
+TypeDef LPPAGESETUPHOOK = LPCOMMDLGHOOKPROC
+TypeDef LPPAGEPAINTHOOK = LPCOMMDLGHOOKPROC
+Type PAGESETUPDLGW
+	lStructSize             As DWord
+	hwndOwner               As HWND
+	hDevMode                As HGLOBAL
+	hDevNames               As HGLOBAL
+	Flags                   As DWord
+	ptPaperSize             As POINTAPI
+	rtMinMargin             As RECT
+	rtMargin                As RECT
+	hInstance               As HINSTANCE
+	lCustData               As LPARAM
+	lpfnPageSetupHook       As LPPAGESETUPHOOK
+	lpfnPagePaintHook       As LPPAGEPAINTHOOK
+	lpPageSetupTemplateName As LPCWSTR
+	hPageSetupTemplate      As HGLOBAL
+End Type
+Type PAGESETUPDLGA
+	lStructSize             As DWord
+	hwndOwner               As HWND
+	hDevMode                As HGLOBAL
+	hDevNames               As HGLOBAL
+	Flags                   As DWord
+	ptPaperSize             As POINTAPI
+	rtMinMargin             As RECT
+	rtMargin                As RECT
+	hInstance               As HINSTANCE
+	lCustData               As LPARAM
+	lpfnPageSetupHook       As LPPAGESETUPHOOK
+	lpfnPagePaintHook       As LPPAGEPAINTHOOK
+	lpPageSetupTemplateName As LPCSTR
+	hPageSetupTemplate      As HGLOBAL
+End Type
+#ifdef UNICODE
+TypeDef PAGESETUPDLG = PAGESETUPDLGW
+#else
+TypeDef PAGESETUPDLG = PAGESETUPDLGA
+#endif
+
+Declare Function PageSetupDlg Lib "comdlg32" Alias _FuncName_PageSetupDlg (ByRef psd As PAGESETUPDLG) As BOOL
+
+
+'----------
+' PrintDlg
+'----------
+Const PD_ALLPAGES =                   &H00000000
+Const PD_SELECTION =                  &H00000001
+Const PD_PAGENUMS =                   &H00000002
+Const PD_NOSELECTION =                &H00000004
+Const PD_NOPAGENUMS =                 &H00000008
+Const PD_COLLATE =                    &H00000010
+Const PD_PRINTTOFILE =                &H00000020
+Const PD_PRINTSETUP =                 &H00000040
+Const PD_NOWARNING =                  &H00000080
+Const PD_RETURNDC =                   &H00000100
+Const PD_RETURNIC =                   &H00000200
+Const PD_RETURNDEFAULT =              &H00000400
+Const PD_SHOWHELP =                   &H00000800
+Const PD_ENABLEPRINTHOOK =            &H00001000
+Const PD_ENABLESETUPHOOK =            &H00002000
+Const PD_ENABLEPRINTTEMPLATE =        &H00004000
+Const PD_ENABLESETUPTEMPLATE =        &H00008000
+Const PD_ENABLEPRINTTEMPLATEHANDLE =  &H00010000
+Const PD_ENABLESETUPTEMPLATEHANDLE =  &H00020000
+Const PD_USEDEVMODECOPIES =           &H00040000
+Const PD_USEDEVMODECOPIESANDCOLLATE = &H00040000
+Const PD_DISABLEPRINTTOFILE =         &H00080000
+Const PD_HIDEPRINTTOFILE =            &H00100000
+Const PD_NONETWORKBUTTON =            &H00200000
+TypeDef LPPAGEPAINTHOOK = LPCOMMDLGHOOKPROC
+TypeDef LPSETUPHOOKPROC = LPCOMMDLGHOOKPROC
+#ifdef _WIN64
+Type PRINTDLGW
+#else
+Type Align(1) PRINTDLGW
+#endif
+	lStructSize         As DWord
+	hwndOwner           As HWND
+	hDevMode            As HGLOBAL
+	hDevNames           As HGLOBAL
+	hDC                 As HDC
+	Flags               As DWord
+	nFromPage           As Word
+	nToPage             As Word
+	nMinPage            As Word
+	nMaxPage            As Word
+	nCopies             As Word
+	hInstance           As HINSTANCE
+	lCustData           As LPARAM
+	lpfnPrintHook       As LPPAGEPAINTHOOK
+	lpfnSetupHook       As LPSETUPHOOKPROC
+	lpPrintTemplateName As LPCWSTR
+	lpSetupTemplateName As LPCWSTR
+	hPrintTemplate      As HGLOBAL
+	hSetupTemplate      As HGLOBAL
+End Type
+#ifdef _WIN64
+Type PRINTDLGA
+#else
+Type Align(1) PRINTDLGA
+#endif
+	lStructSize         As DWord
+	hwndOwner           As HWND
+	hDevMode            As HGLOBAL
+	hDevNames           As HGLOBAL
+	hDC                 As HDC
+	Flags               As DWord
+	nFromPage           As Word
+	nToPage             As Word
+	nMinPage            As Word
+	nMaxPage            As Word
+	nCopies             As Word
+	hInstance           As HINSTANCE
+	lCustData           As LPARAM
+	lpfnPrintHook       As LPPAGEPAINTHOOK
+	lpfnSetupHook       As LPSETUPHOOKPROC
+	lpPrintTemplateName As LPCSTR
+	lpSetupTemplateName As LPCSTR
+	hPrintTemplate      As HGLOBAL
+	hSetupTemplate      As HGLOBAL
+End Type
+#ifdef UNICODE
+TypeDef PRINTDLG = PRINTDLGW
+#else
+TypeDef PRINTDLG = PRINTDLGA
+#endif
+Declare Function PrintDlg Lib "comdlg32" Alias _FuncName_PrintDlg (ByRef pd As PRINTDLG) As BOOL
Index: /trunk/ab5.0/ablib/src/api_console.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_console.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_console.sbp	(revision 506)
@@ -0,0 +1,223 @@
+'api_console.sbp
+
+#ifdef UNICODE
+Const _FuncName_PeekConsoleInput = "PeekConsoleInputW"
+Const _FuncName_ReadConsoleInput = "ReadConsoleInputW"
+Const _FuncName_WriteConsoleInput = "WriteConsoleInputW"
+Const _FuncName_ReadConsoleOutput = "ReadConsoleOutputW"
+Const _FuncName_WriteConsoleOutput = "WriteConsoleOutputW"
+Const _FuncName_ReadConsoleOutputCharacter = "ReadConsoleOutputCharacterW"
+Const _FuncName_WriteConsoleOutputCharacter = "WriteConsoleOutputCharacterW"
+Const _FuncName_FillConsoleOutputCharacter = "FillConsoleOutputCharacterW"
+Const _FuncName_ScrollConsoleScreenBuffer = "ScrollConsoleScreenBufferW"
+Const _FuncName_GetConsoleTitle = "GetConsoleTitleW"
+Const _FuncName_SetConsoleTitle = "SetConsoleTitleW"
+Const _FuncName_ReadConsole = "ReadConsoleW"
+Const _FuncName_WriteConsole = "WriteConsoleW"
+#else
+Const _FuncName_PeekConsoleInput = "PeekConsoleInputA"
+Const _FuncName_ReadConsoleInput = "ReadConsoleInputA"
+Const _FuncName_WriteConsoleInput = "WriteConsoleInputA"
+Const _FuncName_ReadConsoleOutput = "ReadConsoleOutputA"
+Const _FuncName_WriteConsoleOutput = "WriteConsoleOutputA"
+Const _FuncName_ReadConsoleOutputCharacter = "ReadConsoleOutputCharacterA"
+Const _FuncName_WriteConsoleOutputCharacter = "WriteConsoleOutputCharacterA"
+Const _FuncName_FillConsoleOutputCharacter = "FillConsoleOutputCharacterA"
+Const _FuncName_ScrollConsoleScreenBuffer = "ScrollConsoleScreenBufferA"
+Const _FuncName_GetConsoleTitle = "GetConsoleTitleA"
+Const _FuncName_SetConsoleTitle = "SetConsoleTitleA"
+Const _FuncName_ReadConsole = "ReadConsoleA"
+Const _FuncName_WriteConsole = "WriteConsoleA"
+#endif
+
+Type COORD
+	X As Integer
+	Y As Integer
+End Type
+TypeDef PCOORD = *COORD
+
+Type SMALL_RECT
+	Left As Integer
+	Top As Integer
+	Right As Integer
+	Bottom As Integer
+End Type
+TypeDef PSMALL_RECT = *SMALL_RECT
+
+Type KEY_EVENT_RECORD
+	bKeyDown As BOOL
+	wRepeatCount As Word
+	wVirtualKeyCode As Word
+	wVirtualScanCode As Word
+	uChar As WCHAR
+	dwControlKeyState As DWord
+End Type
+TypeDef PKEY_EVENT_RECORD = *KEY_EVENT_RECORD
+
+Const RIGHT_ALT_PRESSED = &H0001
+Const LEFT_ALT_PRESSED = &H0002
+Const RIGHT_CTRL_PRESSED = &H0004
+Const LEFT_CTRL_PRESSED = &H0008
+Const SHIFT_PRESSED = &H0010
+Const NUMLOCK_ON = &H0020
+Const SCROLLLOCK_ON = &H0040
+Const CAPSLOCK_ON = &H0080
+Const ENHANCED_KEY = &H0100
+Const NLS_DBCSCHAR = &H00010000
+Const NLS_ALPHANUMERIC = &H00000000
+Const NLS_KATAKANA = &H00020000
+Const NLS_HIRAGANA = &H00040000
+Const NLS_ROMAN = &H00400000
+Const NLS_IME_CONVERSION = &H00800000
+Const NLS_IME_DISABLE = &H20000000
+
+Type MOUSE_EVENT_RECORD
+	dwMousePosition As COORD
+	dwButtonState As DWord
+	dwControlKeyState As DWord
+	dwEventFlags As DWord
+End Type
+TypeDef PMOUSE_EVENT_RECORD = *MOUSE_EVENT_RECORD
+
+Const FROM_LEFT_1ST_BUTTON_PRESSED = &H0001
+Const RIGHTMOST_BUTTON_PRESSED = &H0002
+Const FROM_LEFT_2ND_BUTTON_PRESSED = &H0004
+Const FROM_LEFT_3RD_BUTTON_PRESSED = &H0008
+Const FROM_LEFT_4TH_BUTTON_PRESSED = &H0010
+
+Const MOUSE_MOVED = &H0001
+Const DOUBLE_CLICK = &H0002
+Const MOUSE_WHEELED = &H0004
+
+Type WINDOW_BUFFER_SIZE_RECORD
+	dwSize As COORD
+End Type
+TypeDef PWINDOW_BUFFER_SIZE_RECORD = *WINDOW_BUFFER_SIZE_RECORD
+
+Type MENU_EVENT_RECORD
+	dwCommandId As DWord
+End Type
+TypeDef PMENU_EVENT_RECORD = *MENU_EVENT_RECORD
+
+Type FOCUS_EVENT_RECORD
+	bSetFocus As BOOL
+End Type
+TypeDef PFOCUS_EVENT_RECORD = *FOCUS_EVENT_RECORD
+
+Type INPUT_RECORD
+	EventType As Word
+'	Union Event
+		KeyEvent As KEY_EVENT_RECORD
+'		MouseEvent As MOUSE_EVENT_RECORD
+'		WindowBufferSizeEvent As WINDOW_BUFFER_SIZE_RECORD
+'		MenuEvent As MENU_EVENT_RECORD
+'		FocusEvent As FOCUS_EVENT_RECORD
+'	End Union
+End Type
+TypeDef PINPUT_RECORD = *INPUT_RECORD
+
+Const KEY_EVENT                = &H0001
+Const MOUSE_EVENT              = &H0002
+Const WINDOW_BUFFER_SIZE_EVENT = &H0004
+Const MENU_EVENT               = &H0008
+Const FOCUS_EVENT              = &H0010
+
+Type CHAR_INFO
+'	Union Char
+'		UnicodeChar As WCHAR
+		AsciiChar[1] As SByte
+'	End Union
+	Attributes As Word
+End Type
+TypeDef PCHAR_INFO = *CHAR_INFO
+
+Const FOREGROUND_BLUE            = &H0001
+Const FOREGROUND_GREEN           = &H0002
+Const FOREGROUND_RED             = &H0004
+Const FOREGROUND_INTENSITY       = &H0008
+Const BACKGROUND_BLUE            = &H0010
+Const BACKGROUND_GREEN           = &H0020
+Const BACKGROUND_RED             = &H0040
+Const BACKGROUND_INTENSITY       = &H0080
+Const COMMON_LVB_LEADING_BYTE    = &H0100
+Const COMMON_LVB_TRAILING_BYTE   = &H0200
+Const COMMON_LVB_GRID_HORIZONTAL = &H0400
+Const COMMON_LVB_GRID_LVERTICAL  = &H0800
+Const COMMON_LVB_GRID_RVERTICAL  = &H1000
+Const COMMON_LVB_REVERSE_VIDEO   = &H4000
+Const COMMON_LVB_UNDERSCORE      = &H8000
+Const COMMON_LVB_SBCSDBCS        = &H0300
+
+Type CONSOLE_SCREEN_BUFFER_INFO
+	dwSize As COORD
+	dwCursorPosition As COORD
+	wAttributes As Word
+	srWindow As SMALL_RECT
+	dwMaximumWindowSize As COORD
+End Type
+TypeDef PCONSOLE_SCREEN_BUFFER_INFO = *CONSOLE_SCREEN_BUFFER_INFO
+
+Type CONSOLE_CURSOR_INFO
+	dwSize As DWord
+	bVisible As BOOL
+End Type
+TypeDef PCONSOLE_CURSOR_INFO = *CONSOLE_CURSOR_INFO
+
+TypeDef PHANDLER_ROUTINE = *Function(CtrlType As DWord) As BOOL
+
+Const CTRL_C_EVENT        = 0
+Const CTRL_BREAK_EVENT    = 1
+Const CTRL_CLOSE_EVENT    = 2
+Const CTRL_LOGOFF_EVENT   = 5
+Const CTRL_SHUTDOWN_EVENT = 6
+
+Const ENABLE_PROCESSED_INPUT    = &H0001
+Const ENABLE_LINE_INPUT         = &H0002
+Const ENABLE_ECHO_INPUT         = &H0004
+Const ENABLE_WINDOW_INPUT       = &H0008
+Const ENABLE_MOUSE_INPUT        = &H0010
+Const ENABLE_PROCESSED_OUTPUT   = &H0001
+Const ENABLE_WRAP_AT_EOL_OUTPUT = &H0002
+
+Declare Function PeekConsoleInput Lib "kernel32" Alias _FuncName_PeekConsoleInput (hConsoleInput As HANDLE, ByRef lpBuffer As INPUT_RECORD, nLength As DWord, ByRef lpNumberOfEventsRead As DWord) As BOOL
+Declare Function ReadConsoleInput Lib "kernel32" Alias _FuncName_ReadConsoleInput (hConsoleInput As HANDLE, ByRef lpBuffer As INPUT_RECORD, nLength As DWord, ByRef lpNumberOfEventsRead As DWord) As BOOL
+Declare Function WriteConsoleInput Lib "kernel32" Alias _FuncName_WriteConsoleInput (hConsoleInput As HANDLE, ByRef lpBuffer As INPUT_RECORD, nLength As DWord, ByRef lpNumberOfEventsWritten As DWord) As BOOL
+Declare Function ReadConsoleOutput Lib "kernel32" Alias _FuncName_ReadConsoleOutput (hConsoleOutput As HANDLE, lpBuffer As *CHAR_INFO, ByRef dwBufferSize As COORD, ByRef dwBufferCoord As COORD, ByRef lpReadRegion As SMALL_RECT) As BOOL
+Declare Function WriteConsoleOutput Lib "kernel32" Alias _FuncName_WriteConsoleOutput (hConsoleOutput As HANDLE, lpBuffer As *CHAR_INFO, ByRef dwBufferSize As COORD, ByRef dwBufferCoord As COORD, ByRef lpWriteRegion As SMALL_RECT) As BOOL
+Declare Function ReadConsoleOutputCharacter Lib "kernel32" Alias _FuncName_ReadConsoleOutputCharacter (hConsoleOutput As HANDLE, lpCharacter As LPSTR, nLength As DWord, ByRef dwReadCoord As COORD, ByRef lpNumberOfCharsRead As DWord) As BOOL
+Declare Function ReadConsoleOutputAttribute Lib "kernel32" (hConsoleOutput As HANDLE, lpAttribute As *Word, nLength As DWord, ByRef dwReadCoord As COORD, ByRef lpNumberOfAttrsRead As DWord) As BOOL
+Declare Function WriteConsoleOutputCharacter Lib "kernel32" Alias _FuncName_WriteConsoleOutputCharacter (hConsoleOutput As HANDLE, lpCharacter As LPSTR, nLength As DWord, ByRef dwWriteCoord As COORD, ByRef lpNumberOfCharsWritten As DWord) As BOOL
+Declare Function WriteConsoleOutputAttribute Lib "kernel32" (hConsoleOutput As HANDLE, lpAttribute As *Word, nLength As DWord, ByRef dwWriteCoord As COORD, ByRef lpNumberOfAttrsWritten As DWord) As BOOL
+Declare Function FillConsoleOutputCharacter Lib "kernel32" Alias _FuncName_FillConsoleOutputCharacter (hConsoleOutput As HANDLE, cCharacter As Char, nLength As DWord, ByRef dwWriteCoord As COORD, ByRef lpNumberOfCharsWritten As DWord) As BOOL
+Declare Function FillConsoleOutputAttribute Lib "kernel32" (hConsoleOutput As HANDLE, wAttribute As Word, nLength As DWord, ByRef dwWriteCoord As COORD, ByRef lpNumberOfAttrsWritten As DWord) As BOOL
+Declare Function GetConsoleMode Lib "kernel32" (hConsoleHandle As HANDLE, ByRef lpMode As DWord) As BOOL
+Declare Function GetNumberOfConsoleInputEvents Lib "kernel32" (hConsoleInput As HANDLE, ByRef lpNumberOfEvents As DWord) As BOOL
+Declare Function GetConsoleScreenBufferInfo Lib "kernel32" (hConsoleOutput As HANDLE, ByRef lpConsoleScreenBufferInfo As CONSOLE_SCREEN_BUFFER_INFO) As BOOL
+Declare Function GetLargestConsoleWindowSize Lib "kernel32" (hConsoleOutput As HANDLE) As DWord
+Declare Function GetConsoleCursorInfo Lib "kernel32" (hConsoleOutput As HANDLE, ByRef lpConsoleCursorInfo As CONSOLE_CURSOR_INFO) As BOOL
+Declare Function GetNumberOfConsoleMouseButtons Lib "kernel32" (ByRef lpNumberOfMouseButtons As DWord) As BOOL
+Declare Function SetConsoleMode Lib "kernel32" (hConsoleHandle As HANDLE, dwMode As DWord) As BOOL
+Declare Function SetConsoleActiveScreenBuffer Lib "kernel32" (hConsoleOutput As HANDLE) As BOOL
+Declare Function FlushConsoleInputBuffer Lib "kernel32" (hConsoleInput As HANDLE) As BOOL
+Declare Function SetConsoleScreenBufferSize Lib "kernel32" (hConsoleOutput As HANDLE, dwSize As DWord) As BOOL
+Declare Function SetConsoleCursorPosition Lib "kernel32" (hConsoleOutput As HANDLE, dwCursorPosition As DWord) As BOOL
+Declare Function SetConsoleCursorInfo Lib "kernel32" (hConsoleOutput As HANDLE, ByRef lpConsoleCursorInfo As CONSOLE_CURSOR_INFO) As BOOL
+Declare Function ScrollConsoleScreenBuffer Lib "kernel32" Alias _FuncName_ScrollConsoleScreenBuffer (hConsoleOutput As HANDLE, ByRef lpScrollRectangle As SMALL_RECT, lpClipRectangle As *SMALL_RECT, ByRef dwDestinationOrigin As COORD, lpFill As *CHAR_INFO) As BOOL
+Declare Function SetConsoleWindowInfo Lib "kernel32" (hConsoleOutput As HANDLE, bAbsolute As BOOL, ByRef lpConsoleWindow As SMALL_RECT) As BOOL
+Declare Function SetConsoleTextAttribute Lib "kernel32" (hConsoleOutput As HANDLE, wAttributes As Word) As BOOL
+Declare Function SetConsoleCtrlHandler Lib "kernel32" (HandlerRoutine As PHANDLER_ROUTINE, Add As BOOL) As BOOL
+Declare Function GenerateConsoleCtrlEvent Lib "kernel32" (dwCtrlEvent As DWord, dwProcessGroupId As DWord) As BOOL
+Declare Function AllocConsole Lib "kernel32" () As BOOL
+Declare Function FreeConsole Lib "kernel32" () As BOOL
+Declare Function GetConsoleTitle Lib "kernel32" Alias _FuncName_GetConsoleTitle (lpConsoleTitle As LPSTR, nSize As DWord) As DWord
+Declare Function SetConsoleTitle Lib "kernel32" Alias _FuncName_SetConsoleTitle (lpConsoleTitle As LPSTR) As BOOL
+Declare Function ReadConsole Lib "kernel32" Alias _FuncName_ReadConsole (hConsoleInput As HANDLE, lpBuffer As VoidPtr, nNumberOfCharsToRead As DWord, ByRef lpNumberOfCharsRead As DWord, lpReserved As VoidPtr) As BOOL
+Declare Function WriteConsole Lib "kernel32" Alias _FuncName_WriteConsole (hConsoleOutput As HANDLE, lpBuffer As VoidPtr, nNumberOfCharsToWrite As DWord, ByRef lpNumberOfCharsWritten As DWord, lpReserved As VoidPtr) As BOOL
+
+Const CONSOLE_TEXTMODE_BUFFER = 1
+
+Declare Function CreateConsoleScreenBuffer Lib "kernel32" (dwDesiredAccess As DWord, dwShareMode As DWord, lpSecurityAttributes As *SECURITY_ATTRIBUTES, dwFlags As DWord, lpScreenBufferData As VoidPtr) As HANDLE
+Declare Function GetConsoleCP Lib "kernel32" () As DWord
+Declare Function SetConsoleCP Lib "kernel32" (wCodePageID As DWord) As BOOL
+Declare Function GetConsoleOutputCP Lib "kernel32" () As DWord
+Declare Function SetConsoleOutputCP Lib "kernel32" (wCodePageID As DWord) As BOOL
Index: /trunk/ab5.0/ablib/src/api_gdi.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_gdi.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_gdi.sbp	(revision 506)
@@ -0,0 +1,1341 @@
+' api_gdi.sbp - Graphics Device Integerface API
+
+#ifdef UNICODE
+Const _FuncName_CopyEnhMetaFile = "CopyEnhMetaFileW"
+Const _FuncName_CopyMetaFile = "CopyMetaFileW"
+Const _FuncName_CreateDC = "CreateDCW"
+Const _FuncName_CreateEnhMetaFile = "CreateEnhMetaFileW"
+Const _FuncName_CreateMetaFile = "CreateMetaFileW"
+Const _FuncName_CreateFont = "CreateFontW"
+Const _FuncName_CreateFontIndirect = "CreateFontIndirectW"
+Const _FuncName_GetEnhMetaFile = "GetEnhMetaFileW"
+Const _FuncName_GetEnhMetaFileDescription = "GetEnhMetaFileDescriptionW"
+Const _FuncName_GetObject = "GetObjectW"
+Const _FuncName_GetTextFace = "GetTextFaceW"
+Const _FuncName_GetTextMetrics = "GetTextMetricsW"
+Const _FuncName_ResetDC = "ResetDCW"
+Const _FuncName_StartDoc = "StartDocW"
+Const _FuncName_wglUseFontBitmaps = "wglUseFontBitmapsW"
+Const _FuncName_wglUseFontOutlines = "wglUseFontOutlinesW"
+#else
+Const _FuncName_CopyEnhMetaFile = "CopyEnhMetaFileA"
+Const _FuncName_CopyMetaFile = "CopyMetaFileA"
+Const _FuncName_CreateDC = "CreateDCA"
+Const _FuncName_CreateEnhMetaFile = "CreateEnhMetaFileA"
+Const _FuncName_CreateMetaFile = "CreateMetaFileA"
+Const _FuncName_CreateFont = "CreateFontA"
+Const _FuncName_CreateFontIndirect = "CreateFontIndirectA"
+Const _FuncName_GetEnhMetaFile = "GetEnhMetaFileA"
+Const _FuncName_GetEnhMetaFileDescription = "GetEnhMetaFileDescriptionA"
+Const _FuncName_GetObject = "GetObjectA"
+Const _FuncName_GetTextFace = "GetTextFaceA"
+Const _FuncName_GetTextMetrics = "GetTextMetricsA"
+Const _FuncName_ResetDC = "ResetDCA"
+Const _FuncName_StartDoc = "StartDocA"
+Const _FuncName_wglUseFontBitmaps = "wglUseFontBitmapsA"
+Const _FuncName_wglUseFontOutlines = "wglUseFontOutlinesA"
+#endif
+
+Const CLR_INVALID =   &HFFFFFFFF
+Const GDI_ERROR =     &HFFFFFFFF
+
+TypeDef BCHAR = TBYTE
+
+' Metafile and EnhancedMetafile
+Type EMR
+	iType As DWord
+	nSize As DWord
+End Type
+
+Type Align(2) METAHEADER
+	mtType As Word
+	mtHeaderSize As Word
+	mtVersion As Word
+	mtSize As DWord
+	mtNoObjects As Word
+	mtMaxRecord As DWord
+	mtNoParameters As Word
+End Type
+TypeDef PMETAHEADER = *METAHEADER
+
+Type ENHMETAHEADER
+    iType As DWord
+    nSize As DWord
+    rclBounds As RECT
+    rclFrame As RECT
+    dSignature As DWord
+    nVersion As DWord
+    nBytes As DWord
+    nRecords As DWord
+    nHandles As Word
+    sReserved As Word
+    nDescription As DWord
+    offDescription As DWord
+    nPalEntries As DWord
+    szlDevice As SIZE
+    szlMillimeters As SIZE
+    cbPixelFormat As DWord
+    offPixelFormat As DWord
+    bOpenGL As DWord
+'#if WINVER >= 0x0500
+    'szlMicrometers As SIZE
+'#endif
+End Type
+TypeDef PENHMETAHEADER = *ENHMETAHEADER
+
+Type HANDLETABLE
+	objectHandle[ELM(1)] As HGDIOBJ
+End Type
+
+Type METARECORD
+	rdSize As DWord
+	rdFunction As Word
+	rdParm[ELM(1)] As Word
+End Type
+
+Type ENHMETARECORD
+	iType As DWord
+	nSize As DWord
+	dParm[ELM(1)] As DWord
+End Type
+
+Type METAFILEPICT
+	mm As Long
+	xExt As Long
+	yExt As Long
+	hMF As HMETAFILE
+End Type
+
+TypeDef ENHMFENUMPROC = *Function(hdc As HDC, ByRef HTable As HANDLETABLE, ByRef EMFR As ENHMETARECORD, nObj As Long, lpData As LPARAM) As Long
+TypeDef MFENUMPROC = *Function(hdc As HDC, ByRef HTable As HANDLETABLE, ByRef MFR As METARECORD, nObj As Long, lpClientData As LPARAM) As Long
+
+
+' RGB Color
+Const RGB(r, g, b) = ((r) As Long) Or (((g) As Long) <<8) Or (((b) As Long) <<16)
+Const PALETTERGB(r, g, b) = (&h02000000 Or RGB(r,g,b))
+Const PALETTEINDEX(i) = ((&h01000000 Or (i) As Word As DWord) As COLORREF)
+
+Const GetRValue(rgb) = (rgb And &hff)
+Const GetGValue(rgb) = ((rgb >> 8) And &hff)
+Const GetBValue(rgb) = ((rgb >> 16) And &hff)
+
+Type RGBQUAD
+	rgbBlue As Byte
+	rgbGreen As Byte
+	rgbRed As Byte
+	rgbReserved As Byte
+End Type
+
+Type Align(1) RGBTRIPLE
+	rgbtBlue As Byte
+	rgbtGreen As Byte
+	rgbtRed As Byte
+End Type
+
+' CMYK Color
+Const GetKValue(cmyk) = ((cmyk) As Byte)
+Const GetYValue(cmyk) = (((cmyk) >> 8) As Byte)
+Const GetMValue(cmyk) = (((cmyk) >> 16) As Byte)
+Const GetCValue(cmyk) = (((cmyk) >> 24) As Byte)
+
+Const CMYK(c, m, y, k) = (( _
+	((k) As Byte) Or _
+	((y) As Byte As Word << 8) Or _
+	((m) As Byte As DWord << 16) Or _
+	((c) As Byte As DWord << 24)) As COLORREF)
+
+' ICM Color
+TypeDef FXPT16DOT16 = Long
+TypeDef FXPT2DOT30 = Long
+
+TypeDef LCSCSTYPE = Long
+TypeDef LCSGAMUTMATCH = Long
+
+Type LOGCOLORSPACEA
+	lcsSignature As DWord
+	lcsVersion As DWord
+	lcsSize As DWord
+	lcsCSType As LCSCSTYPE
+	lcsIntent As LCSGAMUTMATCH
+	lcsEndpoints As CIEXYZTRIPLE
+	lcsGammaRed As DWord
+	lcsGammaGreen As DWord
+	lcsGammaBlue As DWord
+	lcsFilename[MAX_PATH] As SByte
+End Type
+Type LOGCOLORSPACEW
+	lcsSignature As DWord
+	lcsVersion As DWord
+	lcsSize As DWord
+	lcsCSType As LCSCSTYPE
+	lcsIntent As LCSGAMUTMATCH
+	lcsEndpoints As CIEXYZTRIPLE
+	lcsGammaRed As DWord
+	lcsGammaGreen As DWord
+	lcsGammaBlue As DWord
+	lcsFilename[ELM(MAX_PATH)] As WCHAR
+End Type
+#ifdef UNICODE
+TypeDef LOGCOLORSPACE = LOGCOLORSPACEW
+#else
+TypeDef LOGCOLORSPACE = LOGCOLORSPACEA
+#endif
+
+Type CIEXYZ
+	ciexyzX As FXPT2DOT30
+	ciexyzY As FXPT2DOT30
+	ciexyzZ As FXPT2DOT30
+End Type
+
+Type CIEXYZTRIPLE
+	ciexyzRed As CIEXYZ
+	ciexyzGreen As CIEXYZ
+	ciexyzBlue As CIEXYZ
+End Type
+
+Type LOGPALETTE
+	palVersion As Word
+	palNumEntries As Word
+	palPalEntry[ELM(1)] As PALETTEENTRY
+End Type
+
+' raster operations
+Const SRCCOPY =           &H00CC0020
+Const SRCPAINT =          &H00EE0086
+Const SRCAND =            &H008800C6
+Const SRCINVERT =         &H00660046
+Const SRCERASE =          &H00440328
+Const NOTSRCCOPY =        &H00330008
+Const NOTSRCERASE =       &H001100A6
+Const MERGECOPY =         &H00C000CA
+Const MERGEPAINT =        &H00BB0226
+Const PATCOPY =           &H00F00021
+Const PATPAINT =          &H00FB0A09
+Const PATINVERT =         &H005A0049
+Const DSTINVERT =         &H00550009
+Const BLACKNESS =         &H00000042
+Const WHITENESS =         &H00FF0062
+
+
+' Object types
+Const OBJ_PEN =           1
+Const OBJ_BRUSH =         2
+Const OBJ_DC =            3
+Const OBJ_METADC =        4
+Const OBJ_PAL =           5
+Const OBJ_FONT =          6
+Const OBJ_BITMAP =        7
+Const OBJ_REGION =        8
+Const OBJ_METAFILE =      9
+Const OBJ_MEMDC =         10
+Const OBJ_EXTPEN =        11
+Const OBJ_ENHMETADC =     12
+Const OBJ_ENHMETAFILE =   13
+
+
+' Bitmap Header Definition
+Type BITMAP
+	bmType As Long
+	bmWidth As Long
+	bmHeight As Long
+	bmWidthBytes As Long
+	bmPlanes As Word
+	bmBitsPixel As Word
+	bmBits As VoidPtr
+End Type
+
+Type BITMAPCOREHEADER
+	bcSize As DWord
+	bcWidth As Word
+	bcHeight As Word
+	bcPlanes As Word
+	bcBitCount As Word
+End Type
+
+Type BITMAPCOREINFO
+	bmciHeader As BITMAPCOREHEADER
+	bmciColors[ELM(1)] As RGBTRIPLE
+End Type
+
+' structures for defining DIBs
+Const BI_RGB =       0
+Const BI_RLE8 =      1
+Const BI_RLE4 =      2
+Const BI_BITFIELDS = 3
+Const BI_JPEG =      4
+Const BI_PNG =       5
+
+Type BITMAPINFOHEADER
+	biSize As DWord
+	biWidth As Long
+	biHeight As Long
+	biPlanes As Word
+	biBitCount As Word
+	biCompression As DWord
+	biSizeImage As DWord
+	biXPelsPerMeter As Long
+	biYPelsPerMeter As Long
+	biClrUsed As DWord
+	biClrImportant As DWord
+End Type
+
+Type BITMAPINFO
+	bmiHeader As BITMAPINFOHEADER
+	bmiColors[ELM(1)] As RGBQUAD '以前はbmpColors[255] As RGBQUADだったことに注意
+End Type
+
+
+' Bitmap file header struct
+Type Align(2) BITMAPFILEHEADER
+	bfType As Word
+	bfSize As DWord
+	bfReserved1 As Word
+	bfReserved2 As Word
+	bfOffBits As DWord
+End Type
+
+Type BITMAPV4HEADER
+	bV4Size As DWord
+	bV4Width As Long
+	bV4Height As Long
+	bV4Planes As Word
+	bV4BitCount As Word
+	bV4V4Compression As DWord
+	bV4SizeImage As DWord
+	bV4XPelsPerMeter As Long
+	bV4YPelsPerMeter As Long
+	bV4ClrUsed As DWord
+	bV4ClrImportant As DWord
+	bV4RedMask As DWord
+	bV4GreenMask As DWord
+	bV4BlueMask As DWord
+	bV4AlphaMask As DWord
+	bV4CSType As DWord
+	bV4Endpoints As CIEXYZTRIPLE
+	bV4GammaRed As DWord
+	bV4GammaGreen As DWord
+	bV4GammaBlue As DWord
+End Type
+
+' Region flags
+Const NULLREGION =    1
+Const SIMPLEREGION =  2
+Const COMPLEXREGION = 3
+
+
+' Poly fill mode
+Const ALTERNATE = 1
+Const WINDING   = 2
+
+
+' Device mode
+Const DM_ORIENTATION =      &H00000001
+Const DM_PAPERSIZE =        &H00000002
+Const DM_PAPERLENGTH =      &H00000004
+Const DM_PAPERWIDTH =       &H00000008
+Const DM_SCALE =            &H00000010
+Const DM_POSITION =         &H00000020
+Const DM_COPIES =           &H00000100
+Const DM_DEFAULTSOURCE =    &H00000200
+Const DM_PRINTQUALITY =     &H00000400
+Const DM_COLOR =            &H00000800
+Const DM_DUPLEX =           &H00001000
+Const DM_YRESOLUTION =      &H00002000
+Const DM_TTOPTION =         &H00004000
+Const DM_COLLATE =          &H00008000
+Const DM_FORMNAME =         &H00010000
+Const DM_LOGPIXELS =        &H00020000
+Const DM_BITSPERPEL =       &H00040000
+Const DM_PELSWIDTH =        &H00080000
+Const DM_PELSHEIGHT =       &H00100000
+Const DM_DISPLAYFLAGS =     &H00200000
+Const DM_DISPLAYFREQUENCY = &H00400000
+Const DMORIENT_PORTRAIT =   1
+Const DMORIENT_LANDSCAPE =  2
+Const DMPAPER_LETTER =              1
+Const DMPAPER_LETTERSMALL =         2
+Const DMPAPER_TABLOID =             3
+Const DMPAPER_LEDGER =              4
+Const DMPAPER_LEGAL =               5
+Const DMPAPER_STATEMENT =           6
+Const DMPAPER_EXECUTIVE =           7
+Const DMPAPER_A3 =                  8
+Const DMPAPER_A4 =                  9
+Const DMPAPER_A4SMALL =            10
+Const DMPAPER_A5 =                 11
+Const DMPAPER_B4 =                 12
+Const DMPAPER_B5 =                 13
+Const DMPAPER_FOLIO =              14
+Const DMPAPER_QUARTO =             15
+Const DMPAPER_10X14 =              16
+Const DMPAPER_11X17 =              17
+Const DMPAPER_NOTE =               18
+Const DMPAPER_ENV_9 =              19
+Const DMPAPER_ENV_10 =             20
+Const DMPAPER_ENV_11 =             21
+Const DMPAPER_ENV_12 =             22
+Const DMPAPER_ENV_14 =             23
+Const DMPAPER_CSHEET =             24
+Const DMPAPER_DSHEET =             25
+Const DMPAPER_ESHEET =             26
+Const DMPAPER_ENV_DL =             27
+Const DMPAPER_ENV_C5 =             28
+Const DMPAPER_ENV_C3 =             29
+Const DMPAPER_ENV_C4 =             30
+Const DMPAPER_ENV_C6 =             31
+Const DMPAPER_ENV_C65 =            32
+Const DMPAPER_ENV_B4 =             33
+Const DMPAPER_ENV_B5 =             34
+Const DMPAPER_ENV_B6 =             35
+Const DMPAPER_ENV_ITALY =          36
+Const DMPAPER_ENV_MONARCH =        37
+Const DMPAPER_ENV_PERSONAL =       38
+Const DMPAPER_FANFOLD_US =         39
+Const DMPAPER_FANFOLD_STD_GERMAN = 40
+Const DMPAPER_FANFOLD_LGL_GERMAN = 41
+Const DMRES_DRAFT =  -1
+Const DMRES_LOW =    -2
+Const DMRES_MEDIUM = -3
+Const DMRES_HIGH =   -4
+Const DMCOLOR_MONOCHROME = 1
+Const DMCOLOR_COLOR =      2
+Const DMDUP_SIMPLEX =    1
+Const DMDUP_VERTICAL =   2
+Const DMDUP_HORIZONTAL = 3
+Const DMTT_BITMAP =   1
+Const DMTT_DOWNLOAD = 2
+Const DMTT_SUBDEV =   3
+Const DMCOLLATE_FALSE = 0
+Const DMCOLLATE_TRUE =  1
+
+Const CCHFORMNAME = 32
+Type DEVMODEW
+	dmDeviceName[ELM(CCHDEVICENAME)] As WCHAR
+	dmSpecVersion As Word
+	dmDriverVersion As Word
+	dmSize As Word
+	dmDriverExtra As Word
+	dmFields As DWord
+	dmOrientation As Integer
+	dmPaperSize As Integer
+	dmPaperLength As Integer
+	dmPaperWidth As Integer
+	dmScale As Integer
+	dmCopies As Integer
+	dmDefaultSource As Integer
+	dmPrintQuality As Integer
+	dmColor As Integer
+	dmDuplex As Integer
+	dmYResolution As Integer
+	dmTTOption As Integer
+	dmCollate As Integer
+	dmFormName[ELM(CCHFORMNAME)] As WCHAR
+	dmLogPixels As Word
+	dmBitsPerPel As DWord
+	dmPelsWidth As DWord
+	dmPelsHeight As DWord
+	dmDisplayFlags As DWord
+	dmDisplayFrequency As DWord
+	dmICMMethod As DWord
+	dmICMIntent As DWord
+	dmMediaType As DWord
+	dmDitherType As DWord
+	dmReserved1 As DWord
+	dmReserved2 As DWord
+	dmPanningWidth As DWord
+	dmPanningHeight As DWord
+End Type
+Type DEVMODEA
+	dmDeviceName[ELM(CCHDEVICENAME)] As SByte
+	dmSpecVersion As Word
+	dmDriverVersion As Word
+	dmSize As Word
+	dmDriverExtra As Word
+	dmFields As DWord
+	dmOrientation As Integer
+	dmPaperSize As Integer
+	dmPaperLength As Integer
+	dmPaperWidth As Integer
+	dmScale As Integer
+	dmCopies As Integer
+	dmDefaultSource As Integer
+	dmPrintQuality As Integer
+	dmColor As Integer
+	dmDuplex As Integer
+	dmYResolution As Integer
+	dmTTOption As Integer
+	dmCollate As Integer
+	dmFormName[ELM(CCHFORMNAME)] As SByte
+	dmLogPixels As Word
+	dmBitsPerPel As DWord
+	dmPelsWidth As DWord
+	dmPelsHeight As DWord
+	dmDisplayFlags As DWord
+	dmDisplayFrequency As DWord
+	dmICMMethod As DWord
+	dmICMIntent As DWord
+	dmMediaType As DWord
+	dmDitherType As DWord
+	dmReserved1 As DWord
+	dmReserved2 As DWord
+	dmPanningWidth As DWord
+	dmPanningHeight As DWord
+End Type
+#ifdef UNICODE
+TypeDef DEVMODE = DEVMODEW
+#else
+TypeDef DEVMODE = DEVMODEA
+#endif
+
+' Binary raster ops
+Const R2_BLACK =       1
+Const R2_NOTMERGEPEN = 2
+Const R2_MASKNOTPEN =  3
+Const R2_NOTCOPYPEN =  4
+Const R2_MASKPENNOT =  5
+Const R2_NOT =         6
+Const R2_XORPEN =      7
+Const R2_NOTMASKPEN =  8
+Const R2_MASKPEN =     9
+Const R2_NOTXORPEN =   10
+Const R2_NOP =         11
+Const R2_MERGENOTPEN = 12
+Const R2_COPYPEN =     13
+Const R2_MERGEPENNOT = 14
+Const R2_MERGEPEN =    15
+Const R2_WHITE =       16
+
+
+Type RGNDATAHEADER
+	dwSize As DWord
+	iType As DWord
+	nCount As DWord
+	nRgnSize As DWord
+	rcBound As RECT
+End Type
+Type RGNDATA
+	rdh As RGNDATAHEADER
+	Buffer As Byte
+End Type
+
+Type PALETTEENTRY
+	peRed As Byte
+	peGreen As Byte
+	peBlue As Byte
+	peFlags As Byte
+End Type
+
+Type DOCINFOW
+	cbSize As Long
+	lpszDocName As LPCWSTR
+	lpszOutput As LPCWSTR
+	lpszDatatype As LPCWSTR
+	fwType As DWord
+End Type
+Type DOCINFOA
+	cbSize As Long
+	lpszDocName As LPCSTR
+	lpszOutput As LPCSTR
+	lpszDatatype As LPCSTR
+	fwType As DWord
+End Type
+#ifdef UNICODE
+TypeDef DOCINFO = DOCINFOW
+#else
+TypeDef DOCINFO = DOCINFOA
+#endif
+
+'-------------------
+' GDI API Functions
+'-------------------
+
+Declare Function AbortPath Lib "gdi32" (hdc As HDC) As BOOL
+Type BLENDFUNCTION
+	BlendOp As Byte
+	BlendFlags As Byte
+	SourceConstantAlpha As Byte
+	AlphaFormat As Byte
+End Type
+Declare Function AlphaBlend Lib "msimg32" (hdcDest As HDC, nXDest As Long, nYDest As Long, nDestWidth As Long, nDestHeight As Long, hdcSrc As HDC, XSrc As Long, YSrc As Long, nSrcWidth As Long, nSrcHeight As Long, ByRef blendfunc As BLENDFUNCTION) As Long
+Declare Function Arc Lib "gdi32" (hdc As HDC, nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long, nXStartArc As Long, nYStartArc As Long, nXEndArc As Long, nYEndArc As Long) As BOOL
+Declare Function BeginPath Lib "gdi32" (hdc As HDC) As BOOL
+Declare Function BitBlt Lib "gdi32" (hdcDest As HDC, nXDest As Long, nYDest As Long, nWidth As Long, nHeight As Long, hdcSrc As HDC, nXSrc As Long, nYSrc As Long, dwRop As DWord) As BOOL
+Declare Function CancelDC Lib "gdi32" (hdc As HDC) As BOOL
+Declare Function Chord Lib "gdi32" (hdc As HDC, nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long, nXRadial1 As Long, nYRadial1 As Long, nXRadial2 As Long, nYRadial2 As Long) As BOOL
+Declare Function CloseEnhMetaFile Lib "gdi32" (hdc As HDC) As HENHMETAFILE
+Declare Function CloseFigure Lib "gdi32" (hdc As HDC) As BOOL
+Declare Function CloseMetaFile Lib "gdi32" (hdc As HDC) As HMETAFILE
+
+Const RGN_AND =  1
+Const RGN_OR =   2
+Const RGN_XOR =  3
+Const RGN_DIFF = 4
+Const RGN_COPY = 5
+Declare Function CombineRgn Lib "gdi32" (hrgnDest As HRGN, hrgnSrc1 As HRGN, hrgnSrc2 As HRGN, fnCombineMode As Long) As Long
+Declare Function CopyEnhMetaFile Lib "gdi32" Alias _FuncName_CopyEnhMetaFile (hemfSrc As HENHMETAFILE, pszFile As PCTSTR) As HENHMETAFILE
+Declare Function CopyMetaFile Lib "gdi32" Alias _FuncName_CopyMetaFile (hmfSrc As HMETAFILE, pszFile As PCTSTR) As HMETAFILE
+Declare Function CreateBitmap Lib "gdi32" (nWidth As Long, nHeight As Long, cPlanes As Long, cBitsPerPel As Long, lpvBits As VoidPtr) As HBITMAP
+Declare Function CreateBitmapIndirect Lib "gdi32" (ByRef bm As BITMAP) As HBITMAP
+
+Const BS_SOLID =          0
+Const BS_NULL =           1
+Const BS_HOLLOW =         BS_NULL
+Const BS_HATCHED =        2
+Const BS_PATTERN =        3
+Const BS_INDEXED =        4
+Const BS_DIBPATTERN =     5
+Const BS_DIBPATTERNPT =   6
+Const BS_PATTERN8X8 =     7
+Const BS_DIBPATTERN8X8 =  8
+Const BS_MONOPATTERN =    9
+Const DIB_RGB_COLORS =    0
+Const DIB_PAL_COLORS =    1
+Const HS_HORIZONTAL =     0
+Const HS_VERTICAL =       1
+Const HS_FDIAGONAL =      2
+Const HS_BDIAGONAL =      3
+Const HS_CROSS =          4
+Const HS_DIAGCROSS =      5
+Type LOGBRUSH
+	lbStyle As Long
+	lbColor As Long
+	lbHatch As Long
+End Type
+Declare Function CreateBrushIndirect Lib "gdi32" (ByRef lplb As LOGBRUSH) As HBRUSH
+
+Declare Function CreateCompatibleBitmap Lib "gdi32" (hdc As HDC, nWidth As Long, nHeight As Long) As HBITMAP
+Declare Function CreateCompatibleDC Lib "gdi32" (hdc As HDC) As HDC
+Declare Function CreateDC Lib "gdi32" Alias _FuncName_CreateDC (pszDriver As PCTSTR, pszDevice As PCTSTR, pszOutput As PCTSTR, ByRef InitData As DEVMODE) As HDC
+
+Const CBM_INIT = &H04
+Declare Function CreateDIBitmap Lib "gdi32" (hdc As HDC, ByRef bmih As BITMAPINFOHEADER, fdwInit As Long, lpbInit As VoidPtr, ByRef bmi As BITMAPINFO, fuUsage As Long) As HBITMAP
+
+Declare Function CreateDIBPatternBrushPt Lib "gdi32" (lpPackedDIB As VoidPtr, iUsage As Long) As HBRUSH
+Declare Function CreateDIBSection Lib "gdi32" (hdc As HDC, ByRef BmpInfo As BITMAPINFO, iUsage As DWord, ppvBits As *VoidPtr, hSection As HANDLE, dwOffset As DWord) As HBITMAP
+Declare Function CreateEllipticRgn Lib "gdi32" (nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long) As HRGN
+Declare Function CreateEllipticRgnIndirect Lib "gdi32" (ByRef lpRect As RECT) As HRGN
+Declare Function CreateEnhMetaFile Lib "gdi32" Alias _FuncName_CreateEnhMetaFile (hdcRef As HDC, pFileName As PCTSTR, ByRef Rect As RECT, pDescription As PCTSTR) As HDC
+Declare Function CreateMetaFile Lib "gdi32" Alias _FuncName_CreateMetaFile (pFileName As PCTSTR) As HDC
+
+Const FW_DONTCARE =       0
+Const FW_THIN =           100
+Const FW_EXTRALIGHT =     200
+Const FW_LIGHT =          300
+Const FW_NORMAL =         400
+Const FW_MEDIUM =         500
+Const FW_SEMIBOLD =       600
+Const FW_BOLD =           700
+Const FW_EXTRABOLD =      800
+Const FW_HEAVY =          900
+Const FW_ULTRALIGHT =     FW_EXTRALIGHT
+Const FW_REGULAR =        FW_NORMAL
+Const FW_DEMIBOLD =       FW_SEMIBOLD
+Const FW_ULTRABOLD =      FW_EXTRABOLD
+Const FW_BLACK =          FW_HEAVY
+
+Const ANSI_CHARSET =          0
+Const DEFAULT_CHARSET =       1
+Const SYMBOL_CHARSET =        2
+Const SHIFTJIS_CHARSET =      128
+Const HANGEUL_CHARSET =       129
+Const HANGUL_CHARSET =        129
+Const GB2312_CHARSET =        134
+Const CHINESEBIG5_CHARSET =   136
+Const OEM_CHARSET =           255
+Const JOHAB_CHARSET =         130
+Const HEBREW_CHARSET =        177
+Const ARABIC_CHARSET =        178
+Const GREEK_CHARSET =         161
+Const TURKISH_CHARSET =       162
+Const VIETNAMESE_CHARSET =    163
+Const THAI_CHARSET =          222
+Const EASTEUROPE_CHARSET =    238
+Const RUSSIAN_CHARSET =       204
+Const MAC_CHARSET =           77
+Const BALTIC_CHARSET =        186
+
+Const OUT_DEFAULT_PRECIS =        0
+Const OUT_STRING_PRECIS =         1
+Const OUT_CHARACTER_PRECIS =      2
+Const OUT_STROKE_PRECIS =         3
+Const OUT_TT_PRECIS =             4
+Const OUT_DEVICE_PRECIS =         5
+Const OUT_RASTER_PRECIS =         6
+Const OUT_TT_ONLY_PRECIS =        7
+Const OUT_OUTLINE_PRECIS =        8
+Const OUT_SCREEN_OUTLINE_PRECIS = 9
+
+Const CLIP_DEFAULT_PRECIS =   0
+Const CLIP_CHARACTER_PRECIS = 1
+Const CLIP_STROKE_PRECIS =    2
+Const CLIP_MASK =             &Hf
+Const CLIP_LH_ANGLES =        &H00010000
+Const CLIP_TT_ALWAYS =        &H00020000
+Const CLIP_EMBEDDED =         &H00080000
+
+Const DEFAULT_QUALITY =       0
+Const DRAFT_QUALITY =         1
+Const PROOF_QUALITY =         2
+Const NONANTIALIASED_QUALITY =3
+Const ANTIALIASED_QUALITY =   4
+
+Const DEFAULT_PITCH =         0
+Const FIXED_PITCH =           1
+Const VARIABLE_PITCH =        2
+
+Const FF_DONTCARE =       0
+Const FF_ROMAN =          &H00010000
+Const FF_SWISS =          &H00020000
+Const FF_MODERN =         &H00030000
+Const FF_SCRIPT =         &H00040000
+Const FF_DECORATIVE =     &H00050000
+Declare Function CreateFont Lib "gdi32" Alias _FuncName_CreateFont (nHeight As Long, nWidth As Long, nEscapement As Long, nOrientation As Long, fnWeight As Long, fdwItalic As DWord, fdwUnderline As DWord, fdwStrikeOut As DWord, fdwCharSet As DWord, fdwOutputPrecision As DWord, fdwClipPrecision As DWord, fdwQuality As DWord, fdwPitchAndFamily As DWord, lpszFace As PCTSTR) As HFONT
+
+Const LF_FACESIZE = 32
+Type LOGFONTA
+	lfHeight As Long
+	lfWidth As Long
+	lfEscapement As Long
+	lfOrientation As Long
+	lfWeight As Long
+	lfItalic As Byte
+	lfUnderline As Byte
+	lfStrikeOut As Byte
+	lfCharSet As Byte
+	lfOutPrecision As Byte
+	lfClipPrecision As Byte
+	lfQuality As Byte
+	lfPitchAndFamily As Byte
+	lfFaceName[ELM(LF_FACESIZE)] As SByte
+End Type
+Type LOGFONTW
+	lfHeight As Long
+	lfWidth As Long
+	lfEscapement As Long
+	lfOrientation As Long
+	lfWeight As Long
+	lfItalic As Byte
+	lfUnderline As Byte
+	lfStrikeOut As Byte
+	lfCharSet As Byte
+	lfOutPrecision As Byte
+	lfClipPrecision As Byte
+	lfQuality As Byte
+	lfPitchAndFamily As Byte
+	lfFaceName[ELM(LF_FACESIZE)] As WCHAR
+End Type
+#ifdef UNICODE
+TypeDef LOGFONT = LOGFONTW
+#else
+TypeDef LOGFONT = LOGFONTA
+#endif
+Declare Function CreateFontIndirectA Lib "gdi32" (ByRef lf As LOGFONTA) As HFONT
+Declare Function CreateFontIndirect Lib "gdi32" Alias _FuncName_CreateFontIndirect (ByRef lf As LOGFONT) As HFONT
+
+Declare Function CreateHatchBrush Lib "gdi32" (fnStyle As Long, clrref As COLORREF) As HBRUSH
+Declare Function CreatePatternBrush Lib "gdi32" (hbmp As HBITMAP) As HBRUSH
+
+Const PS_SOLID =       0
+Const PS_DASH =        1
+Const PS_DOT =         2
+Const PS_DASHDOT =     3
+Const PS_DASHDOTDOT =  4
+Const PS_NULL =        5
+Const PS_INSIDEFRAME = 6
+Const PS_USERSTYLE =   7
+Const PS_ALTERNATE =   8
+Declare Function CreatePen Lib "gdi32" (nPenStyle As Long, nWidth As Long, crColor As COLORREF) As HPEN
+
+Type LOGPEN
+	lopnStyle As DWord
+	lopnWidth As POINTAPI
+	lopnColor As COLORREF
+End Type
+Declare Function CreatePenIndirect Lib "gdi32" (ByRef lplgpn As LOGPEN) As HPEN
+
+Declare Function CreatePolygonRgn Lib "gdi32" (ByRef lpPoints As POINTAPI, cPoints As Long, fnPolyFillMode As Long) As HRGN
+Declare Function CreateRectRgn Lib "gdi32" (nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long) As HRGN
+Declare Function CreateRectRgnIndirect Lib "gdi32" (ByRef lpRect As RECT) As HRGN
+Declare Function CreateRoundRectRgn Lib "gdi32" (nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long, nWidthEllipse As Long, nHeightEllipse As Long) As HRGN
+Declare Function CreateSolidBrush Lib "gdi32" (crColor As COLORREF) As HBRUSH
+Declare Function DeleteDC Lib "gdi32" (hdc As HDC) As BOOL
+Declare Function DeleteEnhMetaFile Lib "gdi32" (hemf As HENHMETAFILE) As BOOL
+Declare Function DeleteMetaFile Lib "gdi32" (hmf As HMETAFILE) As BOOL
+Declare Function DeleteObject Lib "gdi32" (hObject As HANDLE) As BOOL
+Declare Function DPtoLP Lib "gdi32" (hdc As HDC, ByRef lpPoints As POINTAPI, nCount As Long) As BOOL
+Declare Function Ellipse Lib "gdi32" (hdc As HDC, nLeftRect As Long, nTopRect As Long, RightRect As Long, nBottomRect As Long) As BOOL
+Declare Function EndDoc Lib "gdi32" (hdc As HDC) As Long
+Declare Function EndPage Lib "gdi32" (hdc As HDC) As Long
+Declare Function EndPath Lib "gdi32" (hdc As HDC) As BOOL
+Declare Function EnumEnhMetaFile Lib "gdi32" (hdc As HDC, hemf As HENHMETAFILE, pEnhMetaFunc As ENHMFENUMPROC, pData As VoidPtr, ByRef Rect As RECT) As BOOL
+Declare Function EnumMetaFile Lib "gdi32" (hdc As HDC, hmf As HMETAFILE, pMetaFunc As MFENUMPROC, lParam As LPARAM) As BOOL
+Declare Function EqualRgn Lib "gdi32" (hSrcRgn1 As HRGN, hSrcRgn2 As HRGN) As BOOL
+Declare Function ExcludeClipRect Lib "gdi32" (hdc As HDC, nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long) As Long
+
+Const  FLOODFILLBORDER =  0
+Const  FLOODFILLSURFACE = 1
+Declare Function ExtFloodFill Lib "gdi32" (hdc As HDC, nXStart As Long, nYStart As Long, crColor As COLORREF, fuFillType As DWord) As BOOL
+
+Const PS_COSMETIC  =     &H00000000
+Const PS_GEOMETRIC =     &H00010000
+Const PS_ENDCAP_ROUND =  &H00000000
+Const PS_ENDCAP_SQUARE = &H00000100
+Const PS_ENDCAP_FLAT =   &H00000200
+Const PS_JOIN_ROUND =    &H00000000
+Const PS_JOIN_BEVEL =    &H00001000
+Const PS_JOIN_MITER =    &H00002000
+Declare Function ExtCreatePen Lib "gdi32" (dwPenStyle As DWord, dwWidth As DWord, ByRef lplb As LOGBRUSH, dwStyleCount As DWord, lpStyle As *DWord) As HPEN
+
+Declare Function ExtSelectClipRgn Lib "gdi32" (hdc As HDC, hRgn As HRGN, fnMode As Long) As Long
+Declare Function ExtTextOutA Lib "gdi32" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, lpString As PCSTR, cbCount As Long, pDx As *Long) As Long
+Declare Function ExtTextOutW Lib "gdi32" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, lpString As PCWSTR, cbCount As Long, pDx As *Long) As Long
+#ifdef UNICODE
+Declare Function ExtTextOut Lib "gdi32" Alias "ExtTextOutW" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, pString As PCWSTR, cbCount As Long, pDx As *Long) As Long
+#else
+Declare Function ExtTextOut Lib "gdi32" Alias "ExtTextOutA" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, pString As PCSTR, cbCount As Long, pDx As *Long) As Long
+#endif
+Declare Function FillPath Lib "gdi32" (hdc As HDC) As Long
+Declare Function FillRgn Lib "gdi32" (hdc As HDC, hRgn As HRGN, hBrush As HBRUSH) As Long
+Declare Function FrameRgn Lib "gdi32" (hdc As HDC, hRgn As HRGN, hBrush As HBRUSH, nWidth As Long, nHeight As Long) As Long
+Declare Function GdiComment Lib "gdi32" (hdc As HDC, cbSize As DWord, lpData As *Byte) As BOOL
+Declare Function GetBitmapBits Lib "gdi32" (hbmp As HBITMAP, cbBuffer As Long, lpvBits As VoidPtr) As Long
+Declare Function GetBkColor Lib "gdi32" (hdc As HDC) As DWord
+Declare Function GetBkMode Lib "gdi32" (hdc As HDC) As Long
+Declare Function GetBrushOrgEx Lib "gdi32" (hdc As HDC, ByRef lppt As POINTAPI) As Long
+' only WinNT
+'Declare Function GetCharWidth32 Lib "gdi32" Alias "GetCharWidth32A" (hdc As HDC, iFirstChar As DWord, iLastChar As DWord, pBuffer As *DWord) As Long
+Declare Function GetClipBox Lib "gdi32" (hdc As HDC, ByRef lpRect As RECT) As Long
+Declare Function GetClipRgn Lib "gdi32" (hdc As HDC, hRgn As HRGN) As Long
+Declare Function GetCurrentObject Lib "gdi32" (hdc As HDC, dwObjectType As DWord) As HANDLE
+Declare Function GetCurrentPositionEx Lib "gdi32" (hdc As HDC, ByRef Point As POINTAPI) As Long
+
+Const DRIVERVERSION =   0
+Const TECHNOLOGY =      2
+Const HORZSIZE =        4
+Const VERTSIZE =        6
+Const HORZRES =         8
+Const VERTRES =         10
+Const BITSPIXEL =       12
+Const PLANES =          14
+Const NUMBRUSHES =      16
+Const NUMPENS =         18
+Const NUMMARKERS =      20
+Const NUMFONTS =        22
+Const NUMCOLORS =       24
+Const PDEVICESIZE =     26
+Const CURVECAPS =       28
+Const LINECAPS =        30
+Const POLYGONALCAPS =   32
+Const TEXTCAPS =        34
+Const CLIPCAPS =        36
+Const RASTERCAPS =      38
+Const ASPECTX =         40
+Const ASPECTY =         42
+Const ASPECTXY =        44
+Const SHADEBLENDCAPS =  45
+Const LOGPIXELSX =      88
+Const LOGPIXELSY =      90
+Const SIZEPALETTE =     104
+Const NUMRESERVED =     106
+Const COLORRES =        108
+Const PHYSICALWIDTH =   110
+Const PHYSICALHEIGHT =  111
+Const PHYSICALOFFSETX = 112
+Const PHYSICALOFFSETY = 113
+Const SCALINGFACTORX =  114
+Const SCALINGFACTORY =  115
+Const VREFRESH =        116
+Const DESKTOPVERTRES =  117
+Const DESKTOPHORZRES =  118
+Const BLTALIGNMENT =    119
+Const DT_PLOTTER =        0            ' Device Technologies
+Const DT_RASDISPLAY =     1
+Const DT_RASPRINTER =     2
+Const DT_RASCAMERA =      3
+Const DT_CHARSTREAM =     4
+Const DT_METAFILE =       5
+Const DT_DISPFILE =       6
+Const CC_NONE =           0            ' Curve Capabilities
+Const CC_CIRCLES =        1
+Const CC_PIE =            2
+Const CC_CHORD =          4
+Const CC_ELLIPSES =       8
+Const CC_WIDE =           16
+Const CC_STYLED =         32
+Const CC_WIDESTYLED =     64
+Const CC_INTERIORS =      128
+Const CC_ROUNDRECT =      256
+Const LC_NONE =           0            ' Line Capabilities
+Const LC_POLYLINE =       2
+Const LC_MARKER =         4
+Const LC_POLYMARKER =     8
+Const LC_WIDE =           16
+Const LC_STYLED =         32
+Const LC_WIDESTYLED =     64
+Const LC_INTERIORS =      128
+Const PC_NONE =           0            ' Polygonal Capabilities
+Const PC_POLYGON =        1
+Const PC_RECTANGLE =      2
+Const PC_WINDPOLYGON =    4
+Const PC_TRAPEZOID =      4
+Const PC_SCANLINE =       8
+Const PC_WIDE =           16
+Const PC_STYLED =         32
+Const PC_WIDESTYLED =     64
+Const PC_INTERIORS =      128
+Const PC_POLYPOLYGON =    256
+Const PC_PATHS =          512
+Const CP_NONE =           0            ' Clipping Capabilities
+Const CP_RECTANGLE =      1
+Const CP_REGION =         2
+Const TC_OP_CHARACTER =   &H00000001   ' Text Capabilities
+Const TC_OP_STROKE =      &H00000002
+Const TC_CP_STROKE =      &H00000004
+Const TC_CR_90 =          &H00000008
+Const TC_CR_ANY =         &H00000010
+Const TC_SF_X_YINDEP =    &H00000020
+Const TC_SA_DOUBLE =      &H00000040
+Const TC_SA_INTEGER =     &H00000080
+Const TC_SA_CONTIN =      &H00000100
+Const TC_EA_DOUBLE =      &H00000200
+Const TC_IA_ABLE =        &H00000400
+Const TC_UA_ABLE =        &H00000800
+Const TC_SO_ABLE =        &H00001000
+Const TC_RA_ABLE =        &H00002000
+Const TC_VA_ABLE =        &H00004000
+Const TC_RESERVED =       &H00008000
+Const TC_SCROLLBLT =      &H00010000
+Const RC_BITBLT =         1            ' Raster Capabilities
+Const RC_BANDING =        2
+Const RC_SCALING =        4
+Const RC_BITMAP64 =       8
+Const RC_GDI20_OUTPUT =   &H0010
+Const RC_GDI20_STATE =    &H0020
+Const RC_SAVEBITMAP =     &H0040
+Const RC_DI_BITMAP =      &H0080
+Const RC_PALETTE =        &H0100
+Const RC_DIBTODEV =       &H0200
+Const RC_BIGFONT =        &H0400
+Const RC_STRETCHBLT =     &H0800
+Const RC_FLOODFILL =      &H1000
+Const RC_STRETCHDIB =     &H2000
+Const RC_OP_DX_OUTPUT =   &H4000
+Const RC_DEVBITS =        &H8000
+Const SB_NONE =           &H00000000   ' Shading and blending caps
+Const SB_CONST_ALPHA =    &H00000001
+Const SB_PIXEL_ALPHA =    &H00000002
+Const SB_PREMULT_ALPHA =  &H00000004
+Const SB_GRAD_RECT =      &H00000010
+Declare Function GetDeviceCaps Lib "gdi32" (hdc As HDC, nIndex As Long) As Long
+
+Declare Function GetDIBits Lib "gdi32" (hdc As HDC, hbmp As HBITMAP, uStartScan As DWord, cScanLines As DWord, lpvBits As VoidPtr, ByRef lpbi As BITMAPINFO, uUsage As DWord) As Long
+Declare Function GetEnhMetaFile Lib "gdi32" Alias _FuncName_GetEnhMetaFile (pszMetaFile As PCTSTR) As HENHMETAFILE
+Declare Function GetEnhMetaFileBits Lib "gdi32" (hemf As HENHMETAFILE, cbBuffer As DWord, pbBuffer As *Byte) As DWord
+Declare Function GetEnhMetaFileDescription Lib "gdi32" Alias _FuncName_GetEnhMetaFileDescription (hemf As HENHMETAFILE, cbBuffer As DWord, pszDescription As PTSTR) As DWord
+Declare Function GetEnhMetaFileHeader Lib "gdi32" (hemf As HENHMETAFILE, cbBuffer As DWord, ByRef emh As ENHMETAHEADER) As DWord
+Declare Function GetEnhMetaFilePaletteEntries Lib "gdi32" (hemf As HENHMETAFILE, cEntries As DWord, ByRef pe As PALETTEENTRY) As DWord
+
+Const MM_TEXT =           1
+Const MM_LOMETRIC =       2
+Const MM_HIMETRIC =       3
+Const MM_LOENGLISH =      4
+Const MM_HIENGLISH =      5
+Const MM_TWIPS =          6
+Const MM_ISOTROPIC =      7
+Const MM_ANISOTROPIC =    8
+Declare Function GetMapMode Lib "gdi32" (hdc As HDC) As Long
+Declare Function GetMetaFileBitsEx Lib "gdi32" (hmf As HMETAFILE, nSize As DWord, pvData As VoidPtr) As DWord
+Declare Function GetMiterLimit Lib "gdi32" (hdc As HDC, peLimit As SinglePtr) As Long
+Declare Function GetObject Lib "gdi32" Alias _FuncName_GetObject (hgdiobj As HANDLE, cbBuffer As Long, ByRef pvObject As Any) As Long
+Declare Function GetObjectType Lib "gdi32" (hObject As HANDLE) As Long
+
+Const PT_CLOSEFIGURE = &H01
+Const PT_LINETO =      &H02
+Const PT_BEZIERTO =    &H04
+Const PT_MOVETO =      &H06
+Declare Function GetPath Lib "gdi32" (hdc As HDC, ByRef lpPoints As POINTAPI, lpTypes As BytePtr, nSize As Long) As Long
+
+Declare Function GetPixel Lib "gdi32" (hdc As HDC, x As Long, y As Long) As DWord
+Declare Function GetPolyFillMode Lib "gdi32" (hdc As HDC) As Long
+Declare Function GetRgnBox Lib "gdi32" (hRgn As HRGN, ByRef lpRect As RECT) As Long
+Declare Function GetROP2 Lib "gdi32" (hdc As HDC) As Long
+
+Const WHITE_BRUSH =         0
+Const LTGRAY_BRUSH =        1
+Const GRAY_BRUSH =          2
+Const DKGRAY_BRUSH =        3
+Const BLACK_BRUSH =         4
+Const NULL_BRUSH =          5
+Const HOLLOW_BRUSH =        NULL_BRUSH
+Const WHITE_PEN =           6
+Const BLACK_PEN =           7
+Const NULL_PEN =            8
+Const OEM_FIXED_FONT =      10
+Const ANSI_FIXED_FONT =     11
+Const ANSI_VAR_FONT =       12
+Const SYSTEM_FONT =         13
+Const DEVICE_DEFAULT_FONT = 14
+Const DEFAULT_PALETTE =     15
+Const SYSTEM_FIXED_FONT =   16
+Declare Function GetStockObject Lib "gdi32" (fnObject As Long) As HANDLE
+
+Declare Function GetStretchBltMode Lib "gdi32" (hdc As HDC) As Long
+
+Const TA_NOUPDATECP = 0
+Const TA_UPDATECP =   1
+Const TA_LEFT =       0
+Const TA_RIGHT =      2
+Const TA_CENTER =     6
+Const TA_TOP =        0
+Const TA_BOTTOM =     8
+Const TA_BASELINE =   24
+Const TA_RTLREADING = 256
+Declare Function GetTextAlign Lib "gdi32" (hdc As HDC) As DWord
+
+Declare Function GetTextColor Lib "gdi32" (hdc As HDC) As DWord
+Declare Function GetTextExtentPoint32A Lib "gdi32" (hdc As HDC, pString As PCSTR, cbString As Long, ByRef Size As SIZE) As Long
+Declare Function GetTextExtentPoint32W Lib "gdi32" (hdc As HDC, pString As PCWSTR, cbString As Long, ByRef Size As SIZE) As Long
+#ifdef UNICODE
+Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32W" (hdc As HDC, pString As PCWSTR, cbString As Long, ByRef Size As SIZE) As Long
+#else
+Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (hdc As HDC, pString As PCSTR, cbString As Long, ByRef Size As SIZE) As Long
+#endif
+Declare Function GetTextFace Lib "gdi32" Alias _FuncName_GetTextFace (hdc As HDC, nCount As Long, lpFacename As LPTSTR)As Long
+
+Const TMPF_FIXED_PITCH = &H01
+Const TMPF_VECTOR =      &H02
+Const TMPF_DEVICE =      &H08
+Const TMPF_TRUETYPE =    &H04
+Type TEXTMETRICW
+	tmHeight As Long
+	tmAscent As Long
+	tmDescent As Long
+	tmInternalLeading As Long
+	tmExternalLeading As Long
+	tmAveCharWidth As Long
+	tmMaxCharWidth As Long
+	tmWeight As Long
+	tmOverhang As Long
+	tmDigitizedAspectX As Long
+	tmDigitizedAspectY As Long
+	tmFirstChar As WCHAR
+	tmLastChar As WCHAR
+	tmDefaultChar As WCHAR
+	tmBreakChar As WCHAR
+	tmItalic As Byte
+	tmUnderlined As Byte
+	tmStruckOut As Byte
+	tmPitchAndFamily As Byte
+	tmCharSet As Byte
+End Type
+Type TEXTMETRICA
+	tmHeight As Long
+	tmAscent As Long
+	tmDescent As Long
+	tmInternalLeading As Long
+	tmExternalLeading As Long
+	tmAveCharWidth As Long
+	tmMaxCharWidth As Long
+	tmWeight As Long
+	tmOverhang As Long
+	tmDigitizedAspectX As Long
+	tmDigitizedAspectY As Long
+	tmFirstChar As SByte
+	tmLastChar As SByte
+	tmDefaultChar As SByte
+	tmBreakChar As SByte
+	tmItalic As Byte
+	tmUnderlined As Byte
+	tmStruckOut As Byte
+	tmPitchAndFamily As Byte
+	tmCharSet As Byte
+End Type
+#ifdef UNICODE
+TypeDef TEXTMETRIC = TEXTMETRICW
+#else
+TypeDef TEXTMETRIC = TEXTMETRICA
+#endif
+Declare Function GetTextMetrics Lib "gdi32" Alias _FuncName_GetTextMetrics (hdc As HDC, ByRef tm As TEXTMETRIC) As Long
+
+Declare Function GetViewportExtEx Lib "gdi32" (hdc As HDC, ByRef lpSize As SIZE) As Long
+Declare Function GetViewportOrgEx Lib "gdi32" (hdc As HDC, ByRef lpPoint As POINTAPI) As Long
+Declare Function GetWindowExtEx Lib "gdi32" (hdc As HDC, ByRef lpSize As SIZE) As Long
+Declare Function GetWindowOrgEx Lib "gdi32" (hdc As HDC, ByRef lpPoint As POINTAPI) As Long
+Declare Function GetWinMetaFileBits Lib "gdi32" (hemf As HENHMETAFILE, cbBuffer As DWord, pbBuffer As *Byte, fnMapMode As Long, hdcRef As HDC) As DWord
+Declare Function IntersectClipRect Lib "gdi32" (hdc As HDC, nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long) As Long
+Declare Function InvertRgn Lib "gdi32" (hdc As HDC, hRgn As HRGN) As Long
+Declare Function LineTo Lib "gdi32" (hdc As HDC, nXEnd As Long, nYEnd As Long) As Long
+Declare Function LPtoDP Lib "gdi32" (hdc As HDC, ByRef lpPoints As POINTAPI, nCount As Long) As Long
+Declare Function MoveToEx Lib "gdi32" (hdc As HDC, x As Long, y As Long, ByRef lpPoint As POINTAPI) As Long
+Declare Function OffsetRgn Lib "gdi32" (hRgn As HRGN, nXOffset As Long, nYOffset As Long) As Long
+Declare Function OffsetClipRgn Lib "gdi32" (hdc As HDC, nXOffset As Long, nYOffset As Long) As Long
+Declare Function OffsetViewportOrgEx Lib "gdi32" (hdc As HDC, nXOffset As Long, nYOffset As Long, ByRef lpPoint As POINTAPI) As Long
+Declare Function OffsetWindowOrgEx Lib "gdi32" (hdc As HDC, nXOffset As Long, nYOffset As Long, ByRef lpPoint As POINTAPI) As Long
+Declare Function PaintRgn Lib "gdi32" (hdc As HDC, hRgn As HRGN) As Long
+Declare Function PatBlt Lib "gdi32" (hdc As HDC, nXLeft As Long, nYLeft As Long, nWidth As Long, nHeight As Long, dwRop As DWord) As Long
+Declare Function PathToRegion Lib "gdi32" (hdc As HDC) As HRGN
+Declare Function Pie Lib "gdi32" (hdc As HDC, nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long, nXRadial1 As Long, nYRadial1 As Long, nXRadial2 As Long, nYRadial2 As Long) As Long
+Declare Function PlayEnhMetaFile Lib "gdi32" (hdc As HDC, hemf As HENHMETAFILE, ByRef Rect As RECT) As Long
+Declare Function PlayEnhMetaFileRecord Lib "gdi32" (hdc As HDC, ByRef Handletable As HANDLETABLE, ByRef EnhMetaRecord As ENHMETARECORD, nHandles As DWord) As BOOL
+Declare Function PlayMetaFile Lib "gdi32" (hdc As HDC, hmf As HMETAFILE) As BOOL
+Declare Function PlayMetaFileRecord Lib "gdi32" (hdc As HDC, ByRef Handletable As HANDLETABLE, ByRef MetaRecord As METARECORD, nHandles As DWord) As BOOL
+Declare Function PlgBlt Lib "gdi32" (hdcDest As HDC, ByRef lpPoint As POINTAPI, hdcSrc As HDC, nXSrc As Long, nYSrc As Long, nWidth As Long, nHeight As Long, hbmMask As HBITMAP, xMask As Long, yMask As Long) As Long
+Declare Function PolyBezier Lib "gdi32" (hdc As HDC, ByRef lppt As POINTAPI, cPoints As Long) As Long
+Declare Function PolyBezierTo Lib "gdi32" (hdc As HDC, ByRef lppt As POINTAPI, cPoints As Long) As Long
+Declare Function Polygon Lib "gdi32" (hdc As HDC, ByRef lpPoints As POINTAPI, cPoints As Long) As Long
+Declare Function Polyline Lib "gdi32" (hdc As HDC, ByRef lppt As POINTAPI, cPoints As Long) As Long
+Declare Function PolylineTo Lib "gdi32" (hdc As HDC, ByRef lppt As POINTAPI, cPoints As Long) As Long
+Declare Function PtInRegion Lib "gdi32" (hRgn As HRGN, x As Long, y As Long) As Long
+Declare Function PtVisible Lib "gdi32" (hdc As HDC, x As Long, y As Long) As Long
+Declare Function RealizePalette Lib "gdi32" (hdc As HDC) As Long
+Declare Function Rectangle Lib "gdi32" (hdc As HDC, nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long) As Long
+Declare Function RectInRegion Lib "gdi32" (hRgn As HRGN, ByRef lpRect As RECT) As Long
+Declare Function RectVisible Lib "gdi32" (hdc As HDC, ByRef lpRect As RECT) As Long
+Declare Function ResetDC Lib "gdi32" Alias _FuncName_ResetDC (hdc As HDC, ByRef InitData As DEVMODE) As HDC
+Declare Function RestoreDC Lib "gdi32" (hdc As HDC, nSavedDC As Long) As Long
+Declare Function RoundRect Lib "gdi32" (hdc As HDC, nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long, nWidth As Long, nHeight As Long) As Long
+Declare Function SaveDC Lib "gdi32" (hdc As HDC) As Long
+Declare Function ScaleViewportExtEx Lib "gdi32" (hdc As HDC, Xnum As Long, Xdenom As Long, Ynum As Long, Ydenom As Long, ByRef lpSize As SIZE) As Long
+Declare Function ScaleWindowExtEx Lib "gdi32" (hdc As HDC, Xnum As Long, Xdenom As Long, Ynum As Long, Ydenom As Long, ByRef lpSize As SIZE) As Long
+Declare Function SelectClipPath Lib "gdi32" (hdc As HDC, iMode As Long) As Long
+Declare Function SelectClipRgn Lib "gdi32" (hdc As HDC, hRgn As HRGN) As Long
+Declare Function SelectObject Lib "gdi32" (hdc As HDC, hObject As HANDLE) As HANDLE
+Declare Function SelectPalette  Lib "gdi32" (hdc As HDC, hpal As HPALETTE, bForceBackground As BOOL) As HPALETTE
+Declare Function SetBkColor Lib "gdi32" (hdc As HDC, crColor As DWord) As DWord
+
+Const TRANSPARENT = 1
+Const OPAQUE =      2
+Declare Function SetBkMode Lib "gdi32" (hdc As HDC, iBkMode As Long) As Long
+
+Declare Function SetBrushOrgEx Lib "gdi32" (hdc As HDC, nXOrg As Long, nYOrg As Long, ByRef lppt As POINTAPI) As Long
+Declare Function SetDIBits Lib "gdi32" (hdc As HDC, hbmp As HBITMAP, uStartScan As DWord, cScanLines As DWord, lpvBits As VoidPtr, ByRef lpbmi As BITMAPINFO, fuColorUse As DWord) As Long
+Declare Function SetEnhMetaFileBits Lib "gdi32" (cbBuffer As DWord, pData As *Byte) As HENHMETAFILE
+Declare Function SetMapMode Lib "gdi32" (hdc As HDC, fnMapMode As Long) As Long
+Declare Function SetMetaFileBitsEx Lib "gdi32" (nSize As DWord, pData As *Byte) As HMETAFILE
+Declare Function SetMiterLimit Lib "gdi32" (hdc As HDC, eNewLimit As Single, peOldLimit As SinglePtr) As Long
+Declare Function SetPixel Lib "gdi32" (hdc As HDC, x As Long, y As Long, crColor As DWord) As DWord
+Declare Function SetPolyFillMode Lib "gdi32" (hdc As HDC, iPolyFillMode As Long) As Long
+Declare Function SetRectRgn Lib "gdi32" (hRgn As HRGN, nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long) As Long
+Declare Function SetROP2 Lib "gdi32" (hdc As HDC, fnDrawMode As Long) As Long
+
+Const BLACKONWHITE =        1
+Const WHITEONBLACK =        2
+Const COLORONCOLOR =        3
+Const HALFTONE =            4
+Const STRETCH_ANDSCANS =    BLACKONWHITE
+Const STRETCH_ORSCANS =     WHITEONBLACK
+Const STRETCH_DELETESCANS = COLORONCOLOR
+Const STRETCH_HALFTONE =    HALFTONE
+Declare Function SetStretchBltMode Lib "gdi32" (hdc As HDC, iStretchMode As Long) As Long
+
+Declare Function SetTextAlign Lib "gdi32" (hdc As HDC, fMode As DWord) As DWord
+Declare Function SetTextColor Lib "gdi32" (hdc As HDC, crColor As DWord) As DWord
+Declare Function SetViewportExtEx Lib "gdi32" (hdc As HDC, nXExtent As Long, nYExtent As Long, ByRef lpSize As SIZE) As Long
+Declare Function SetViewportOrgEx Lib "gdi32" (hdc As HDC, x As Long, y As Long, ByRef lpPoint As POINTAPI) As Long
+Declare Function SetWindowExtEx Lib "gdi32" (hdc As HDC, nXExtent As Long, nYExtent As Long, ByRef lpSize As SIZE) As Long
+Declare Function SetWindowOrgEx Lib "gdi32" (hdc As HDC, x As Long, y As Long, ByRef lpPoint As POINTAPI) As Long
+Declare Function SetWinMetaFileBits Lib "gdi32" (cbBuffer As DWord, pbBuffer As *Byte, hdcRef As HDC, ByRef mfp As METAFILEPICT) As HENHMETAFILE
+Declare Function StartDoc Lib "gdi32" Alias _FuncName_StartDoc (hdc As HDC, ByRef di As DOCINFO) As Long
+Declare Function StartPage Lib "gdi32" (hdc As HDC) As Long
+Declare Function StretchBlt Lib "gdi32" (hdcDest As HDC, nXOriginDest As Long, nYOriginDest As Long, nWidthDest As Long, nHeightDest As Long, hdcSrc As HDC, nXOriginSrc As Long, nYOriginSrc As Long, nWidthSrc As Long, nHeightSrc As Long, dwRop As DWord) As Long
+Declare Function StretchDIBits Lib "gdi32" (hdc As HDC, XDest As Long, YDest As Long, nDestWidth As Long, nDestHeight As Long, XSrc As Long, YSrc As Long, nSrcWidth As Long, nSrcHeight As Long, lpBits As VoidPtr, ByRef lpBitsInfo As BITMAPINFO, iUsage As Long, dwRop As DWord) As Long
+Declare Function StrokeAndFillPath Lib "gdi32" (hdc As HDC) As Long
+Declare Function StrokePath Lib "gdi32" (DC As DWord) As Long
+Declare Function TextOutA Lib "gdi32" (hdc As HDC, nXStart As Long, nYStart As Long, pString As PCSTR, cbString As Long) As Long
+Declare Function TextOutW Lib "gdi32" (hdc As HDC, nXStart As Long, nYStart As Long, pString As PCWSTR, cbString As Long) As Long
+#ifdef UNICODE
+Declare Function TextOut Lib "gdi32" Alias "TextOutW" (hdc As HDC, nXStart As Long, nYStart As Long, pString As PCWSTR, cbString As Long) As Long
+#else
+Declare Function TextOut Lib "gdi32" Alias "TextOutA" (hdc As HDC, nXStart As Long, nYStart As Long, pString As PCSTR, cbString As Long) As Long
+#endif
+ Declare Function TransparentBlt Lib "msimg32" (hdcDest As HDC, nXDest As Long, nYDest As Long, nDestWidth As Long, nDestHeight As Long, hdcSrc As HDC, XSrc As Long, YSrc As Long, nSrcWidth As Long, nSrcHeight As Long, dwRop As DWord) As Long
+
+/* Pixel Format */
+Type PIXELFORMATDESCRIPTOR
+	nSize As Word
+	nVersion As Word
+	dwFlags As DWord
+	iPixelType As Byte
+	cColorBits As Byte
+	cRedBits As Byte
+	cRedShift As Byte
+	cGreenBits As Byte
+	cGreenShift As Byte
+	cBlueBits As Byte
+	cBlueShift As Byte
+	cAlphaBits As Byte
+	cAlphaShift As Byte
+	cAccumBits As Byte
+	cAccumRedBits As Byte
+	cAccumGreenBits As Byte
+	cAccumBlueBits As Byte
+	cAccumAlphaBits As Byte
+	cDepthBits As Byte
+	cStencilBits As Byte
+	cAuxBuffers As Byte
+	iLayerType As Byte
+	bReserved As Byte
+	dwLayerMask As DWord
+	dwVisibleMask As DWord
+	dwDamageMask As DWord
+End Type
+TypeDef PPIXELFORMATDESCRIPTOR = *PIXELFORMATDESCRIPTOR
+TypeDef LPPIXELFORMATDESCRIPTOR = *PIXELFORMATDESCRIPTOR
+
+Const PFD_TYPE_RGBA = 0
+Const PFD_TYPE_COLORINDEX = 1
+
+Const PFD_MAIN_PLANE = 0
+Const PFD_OVERLAY_PLANE = 1
+Const PFD_UNDERLAY_PLANE = (-1)
+
+Const PFD_DOUBLEBUFFER = &H00000001
+Const PFD_STEREO = &H00000002
+Const PFD_DRAW_TO_WINDOW = &H00000004
+Const PFD_DRAW_TO_BITMAP = &H00000008
+Const PFD_SUPPORT_GDI = &H00000010
+Const PFD_SUPPORT_OPENGL = &H00000020
+Const PFD_GENERIC_FORMAT = &H00000040
+Const PFD_NEED_PALETTE = &H00000080
+Const PFD_NEED_SYSTEM_PALETTE = &H00000100
+Const PFD_SWAP_EXCHANGE = &H00000200
+Const PFD_SWAP_COPY = &H00000400
+Const PFD_SWAP_LAYER_BUFFERS = &H00000800
+Const PFD_GENERIC_ACCELERATED = &H00001000
+Const PFD_SUPPORT_DIRECTDRAW = &H00002000
+
+Const PFD_DEPTH_DONTCARE = &H20000000
+Const PFD_DOUBLEBUFFER_DONTCARE = &H40000000
+Const PFD_STEREO_DONTCARE = &H80000000
+
+Declare Function ChoosePixelFormat Lib "gdi32" (hdc As HDC, ByRef lppfd As PIXELFORMATDESCRIPTOR) As Long
+Declare Function DescribePixelFormat Lib "gdi32" (hdc As HDC, n As Long, u As DWord, ByRef lppfd As PIXELFORMATDESCRIPTOR) As Long
+Declare Function GetPixelFormat Lib "gdi32" (hdc As HDC) As Long
+Declare Function SetPixelFormat Lib "gdi32" (hdc As HDC, i As Long, ByRef lppfd As PIXELFORMATDESCRIPTOR) As BOOL
+
+
+/* OpenGL Support */
+
+Declare Function wglCopyContext Lib "opengl32" (hglrcSource As HGLRC, hglrcDest As HGLRC, mask As DWord) As BOOL
+Declare Function wglCreateContext Lib "opengl32" (hdc As HDC) As HGLRC
+Declare Function wglCreateLayerContext Lib "opengl32" (hdc As HDC, iLayerPlane As Long) As HGLRC
+Declare Function wglDeleteContext Lib "opengl32" (hglrc As HGLRC) As BOOL
+Declare Function wglGetCurrentContext Lib "opengl32" () As HGLRC
+Declare Function wglGetCurrentDC Lib "opengl32" () As HDC
+Declare Function wglGetProcAddress Lib "opengl32" (lpstr As LPSTR) As PROC
+Declare Function wglMakeCurrent Lib "opengl32" (hdc As HDC, hglrc As HGLRC) As BOOL
+Declare Function wglShareLists Lib "opengl32" (hglrc1 As HGLRC, hglrc2 As HGLRC) As BOOL
+Declare Function wglUseFontBitmaps Lib "opengl32" Alias _FuncName_wglUseFontBitmaps (hdc As HDC, first As DWord, count As DWord, listbase As DWord) As BOOL
+Declare Function SwapBuffers Lib "gdi32" (hdc As HDC) As BOOL
+
+Type POINTFLOAT
+	x As Single
+	y As Single
+End Type
+TypeDef PPOINTFLOAT = *POINTFLOAT
+
+Type GLYPHMETRICSFLOAT
+	gmfBlackBoxX As Single
+	gmfBlackBoxY As Single
+	gmfptGlyphOrigin As POINTFLOAT
+	gmfCellIncX As Single
+	gmfCellIncY As Single
+End Type
+TypeDef PGLYPHMETRICSFLOAT = *GLYPHMETRICSFLOAT
+TypeDef LPGLYPHMETRICSFLOAT = *GLYPHMETRICSFLOAT
+
+Const WGL_FONT_LINES = 0
+Const WGL_FONT_POLYGONS = 1
+
+Declare Function wglUseFontOutlines Lib "opengl32" Alias _FuncName_wglUseFontOutlines (hdc As HDC, first As DWord, count As DWord, listbase As DWord, deviation As Single, extrusion As Single, format As Long, ByRef lpgmf As GLYPHMETRICSFLOAT) As BOOL
+
+Type LAYERPLANEDESCRIPTOR
+	nSize As Word
+	nVersion As Word
+	dwFlags As DWord
+	iPixelType As Byte
+	cColorBits As Byte
+	cRedBits As Byte
+	cRedShift As Byte
+	cGreenBits As Byte
+	cGreenShift As Byte
+	cBlueBits As Byte
+	cBlueShift As Byte
+	cAlphaBits As Byte
+	cAlphaShift As Byte
+	cAccumBits As Byte
+	cAccumRedBits As Byte
+	cAccumGreenBits As Byte
+	cAccumBlueBits As Byte
+	cAccumAlphaBits As Byte
+	cDepthBits As Byte
+	cStencilBits As Byte
+	cAuxBuffers As Byte
+	iLayerPlane As Byte
+	bReserved As Byte
+	crTransparent As COLORREF
+End Type
+TypeDef PLAYERPLANEDESCRIPTOR = *LAYERPLANEDESCRIPTOR
+TypeDef LPLAYERPLANEDESCRIPTOR = *LAYERPLANEDESCRIPTOR
+
+Const LPD_DOUBLEBUFFER = &H00000001
+Const LPD_STEREO = &H00000002
+Const LPD_SUPPORT_GDI = &H00000010
+Const LPD_SUPPORT_OPENGL = &H00000020
+Const LPD_SHARE_DEPTH = &H00000040
+Const LPD_SHARE_STENCIL = &H00000080
+Const LPD_SHARE_ACCUM = &H00000100
+Const LPD_SWAP_EXCHANGE = &H00000200
+Const LPD_SWAP_COPY = &H00000400
+Const LPD_TRANSPARENT = &H00001000
+Const LPD_TYPE_RGBA = 0
+Const LPD_TYPE_COLORINDEX = 1
+
+Const WGL_SWAP_MAIN_PLANE = &H00000001
+Const WGL_SWAP_OVERLAY1 = &H00000002
+Const WGL_SWAP_OVERLAY2 = &H00000004
+Const WGL_SWAP_OVERLAY3 = &H00000008
+Const WGL_SWAP_OVERLAY4 = &H00000010
+Const WGL_SWAP_OVERLAY5 = &H00000020
+Const WGL_SWAP_OVERLAY6 = &H00000040
+Const WGL_SWAP_OVERLAY7 = &H00000080
+Const WGL_SWAP_OVERLAY8 = &H00000100
+Const WGL_SWAP_OVERLAY9 = &H00000200
+Const WGL_SWAP_OVERLAY10 = &H00000400
+Const WGL_SWAP_OVERLAY11 = &H00000800
+Const WGL_SWAP_OVERLAY12 = &H00001000
+Const WGL_SWAP_OVERLAY13 = &H00002000
+Const WGL_SWAP_OVERLAY14 = &H00004000
+Const WGL_SWAP_OVERLAY15 = &H00008000
+Const WGL_SWAP_UNDERLAY1 = &H00010000
+Const WGL_SWAP_UNDERLAY2 = &H00020000
+Const WGL_SWAP_UNDERLAY3 = &H00040000
+Const WGL_SWAP_UNDERLAY4 = &H00080000
+Const WGL_SWAP_UNDERLAY5 = &H00100000
+Const WGL_SWAP_UNDERLAY6 = &H00200000
+Const WGL_SWAP_UNDERLAY7 = &H00400000
+Const WGL_SWAP_UNDERLAY8 = &H00800000
+Const WGL_SWAP_UNDERLAY9 = &H01000000
+Const WGL_SWAP_UNDERLAY10 = &H02000000
+Const WGL_SWAP_UNDERLAY11 = &H04000000
+Const WGL_SWAP_UNDERLAY12 = &H08000000
+Const WGL_SWAP_UNDERLAY13 = &H10000000
+Const WGL_SWAP_UNDERLAY14 = &H20000000
+Const WGL_SWAP_UNDERLAY15 = &H40000000
+
+Declare Function wglDescribeLayerPlane Lib "opengl32" (hdc As HDC, iPixelFormat As Long, iLayerPlane As Long, nByte As DWord, ByRef lplpd As LAYERPLANEDESCRIPTOR) As BOOL
+Declare Function wglSetLayerPaletteEntries Lib "opengl32" (hdc As HDC, iLayerPlane As Long, iStart As Long, cEntries As Long, lpcr As *COLORREF) As Long
+Declare Function wglGetLayerPaletteEntries Lib "opengl32" (hdc As HDC, iLayerPlane As Long, iStart As Long, cEntries As Long, lpcr As *COLORREF) As Long
+Declare Function wglRealizeLayerPalette Lib "opengl32" (hdc As HDC, iLayerPlane As Long, bRealize As BOOL) As BOOL
+Declare Function wglSwapLayerBuffers Lib "opengl32" (hdc As HDC, fuPlanes As DWord) As BOOL
+
+Type WGLSWAP
+	hdc As HDC
+	uiFlags As DWord
+End Type
+TypeDef PWGLSWAP = *WGLSWAP
+TypeDef LPWGLSWAP = *WGLSWAP
+
+Const WGL_SWAPMULTIPLE_MAX = 16
+
+'Declare Function wglSwapMultipleBuffers Lib "opengl32" (u As DWord, lpwglswap As *WGLSWAP) As DWord
Index: /trunk/ab5.0/ablib/src/api_imm.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_imm.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_imm.sbp	(revision 506)
@@ -0,0 +1,695 @@
+' api_imm.sbp
+
+Type _System_DeclareHandle_HIMC:unused As DWord:End Type
+TypeDef HIMC = *_System_DeclareHandle_HIMC
+Type _System_DeclareHandle_HIMCC:unused As DWord:End Type
+TypeDef HIMCC = *_System_DeclareHandle_HIMCC
+
+Type COMPOSITIONFORM
+	dwStyle As DWord
+	ptCurrentPos As POINTAPI
+	rcArea As RECT
+End Type
+TypeDef PCOMPOSITIONFORM = *COMPOSITIONFORM
+TypeDef NPCOMPOSITIONFORM = *COMPOSITIONFORM
+TypeDef LPCOMPOSITIONFORM = *COMPOSITIONFORM
+
+Type CANDIDATEFORM
+	dwIndex As DWord
+	dwStyle As DWord
+	ptCurrentPos As POINTAPI
+	rcArea As RECT
+End Type
+TypeDef PCANDIDATEFORM = *CANDIDATEFORM
+TypeDef NPCANDIDATEFORM = *CANDIDATEFORM
+TypeDef LPCANDIDATEFORM = *CANDIDATEFORM
+
+Type CANDIDATELIST
+dwSize As DWord
+dwStyle As DWord
+dwCount As DWord
+dwSelection As DWord
+dwPageStart As DWord
+dwPageSize As DWord
+dwOffset[ELM(1)] As DWord
+End Type
+TypeDef PCANDIDATELIST = *CANDIDATELIST
+TypeDef NPCANDIDATELIST = *CANDIDATELIST
+TypeDef LPCANDIDATELIST = *CANDIDATELIST
+
+Type REGISTERWORDA
+	lpReading As LPSTR
+	lpWord As LPSTR
+End Type
+TypeDef PREGISTERWORDA = *REGISTERWORDA
+TypeDef NPREGISTERWORDA = *REGISTERWORDA
+TypeDef LPREGISTERWORDA = *REGISTERWORDA
+
+Type REGISTERWORDW
+	lpReading As LPWSTR
+	lpWord As LPWSTR
+End Type
+TypeDef PREGISTERWORDW = *REGISTERWORDW
+TypeDef NPREGISTERWORDW = *REGISTERWORDW
+TypeDef LPREGISTERWORDW = *REGISTERWORDW
+
+#ifdef UNICODE
+TypeDef REGISTERWORD = REGISTERWORDW
+TypeDef PREGISTERWORD = PREGISTERWORDW
+TypeDef NPREGISTERWORD = NPREGISTERWORDW
+TypeDef LPREGISTERWORD = LPREGISTERWORDW
+#else
+TypeDef REGISTERWORD = REGISTERWORDA
+TypeDef PREGISTERWORD = PREGISTERWORDA
+TypeDef NPREGISTERWORD = NPREGISTERWORDA
+TypeDef LPREGISTERWORD = LPREGISTERWORDA
+#endif
+
+Type RECONVERTSTRING
+	dwSize As DWord
+	dwVersion As DWord
+	dwStrLen As DWord
+	dwStrOffset As DWord
+	dwCompStrLen As DWord
+	dwCompStrOffset As DWord
+	dwTargetStrLen As DWord
+	dwTargetStrOffset As DWord
+End Type
+TypeDef PRECONVERTSTRING = *RECONVERTSTRING
+TypeDef NPRECONVERTSTRING = *RECONVERTSTRING
+TypeDef LPRECONVERTSTRING = *RECONVERTSTRING
+
+Const STYLE_DESCRIPTION_SIZE = 32
+
+Type STYLEBUFA
+	dwStyle As DWord
+	szDescription[ELM(STYLE_DESCRIPTION_SIZE)] As CHAR
+End Type
+TypeDef PSTYLEBUFA = *STYLEBUFA
+TypeDef NPSTYLEBUFA = *STYLEBUFA
+TypeDef LPSTYLEBUFA = *STYLEBUFA
+
+Type STYLEBUFW
+	dwStyle As DWord
+	szDescription[ELM(STYLE_DESCRIPTION_SIZE)] As WCHAR
+End Type
+TypeDef PSTYLEBUFW = *STYLEBUFW
+TypeDef NPSTYLEBUFW = *STYLEBUFW
+TypeDef LPSTYLEBUFW = *STYLEBUFW
+
+#ifdef UNICODE
+TypeDef STYLEBUF = STYLEBUFW
+TypeDef PSTYLEBUF = PSTYLEBUFW
+TypeDef NPSTYLEBUF = NPSTYLEBUFW
+TypeDef LPSTYLEBUF = LPSTYLEBUFW
+#else
+TypeDef STYLEBUF = STYLEBUFA
+TypeDef PSTYLEBUF = PSTYLEBUFA
+TypeDef NPSTYLEBUF = NPSTYLEBUFA
+TypeDef LPSTYLEBUF = LPSTYLEBUFA
+#endif
+
+Const IMEMENUITEM_STRING_SIZE = 80
+
+Type IMEMENUITEMINFOA
+	cbSize As DWord
+	fType As DWord
+	fState As DWord
+	wID As DWord
+	hbmpChecked As HBITMAP
+	hbmpUnchecked As HBITMAP
+	dwItemData As DWord
+	szString[ELM(IMEMENUITEM_STRING_SIZE)] As CHAR
+	hbmpItem As HBITMAP
+End Type
+TypeDef PIMEMENUITEMINFOA = *IMEMENUITEMINFOA
+TypeDef NPIMEMENUITEMINFOA = *IMEMENUITEMINFOA
+TypeDef LPIMEMENUITEMINFOA = *IMEMENUITEMINFOA
+
+Type IMEMENUITEMINFOW
+	cbSize As DWord
+	fType As DWord
+	fState As DWord
+	wID As DWord
+	hbmpChecked As HBITMAP
+	hbmpUnchecked As HBITMAP
+	dwItemData As DWord
+	szString[ELM(IMEMENUITEM_STRING_SIZE)] As WCHAR
+	hbmpItem As HBITMAP
+End Type
+TypeDef PIMEMENUITEMINFOW = *IMEMENUITEMINFOW
+TypeDef NPIMEMENUITEMINFOW = *IMEMENUITEMINFOW
+TypeDef LPIMEMENUITEMINFOW = *IMEMENUITEMINFOW
+
+#ifdef UNICODE
+TypeDef IMEMENUITEMINFO = IMEMENUITEMINFOW
+TypeDef PIMEMENUITEMINFO = PIMEMENUITEMINFOW
+TypeDef NPIMEMENUITEMINFO = NPIMEMENUITEMINFOW
+TypeDef LPIMEMENUITEMINFO = LPIMEMENUITEMINFOW
+#else
+TypeDef IMEMENUITEMINFO = IMEMENUITEMINFOA
+TypeDef PIMEMENUITEMINFO = PIMEMENUITEMINFOA
+TypeDef NPIMEMENUITEMINFO = NPIMEMENUITEMINFOA
+TypeDef LPIMEMENUITEMINFO = LPIMEMENUITEMINFOA
+#endif
+
+Type IMECHARPOSITION
+	dwSize As DWord
+	dwCharPos As DWord
+	pt As POINTAPI
+	cLineHeight As DWord
+	rcDocument As RECT
+End Type
+TypeDef PIMECHARPOSITION = *IMECHARPOSITION
+TypeDef NPIMECHARPOSITION = *IMECHARPOSITION
+TypeDef LPIMECHARPOSITION = *IMECHARPOSITION
+
+TypeDef IMCENUMPROC = *Function(himc As HIMC, lp As LPARAM) As BOOL
+
+'prototype of IMM API
+
+Declare Function ImmInstallIMEA Lib "imm32" (lpszIMEFileName As LPCSTR, lpszLayoutText As LPCSTR) As HKL
+Declare Function ImmInstallIMEW Lib "imm32" (lpszIMEFileName As LPCWSTR, lpszLayoutText As LPCWSTR) As HKL
+#ifdef UNICODE
+Declare Function ImmInstallIME Lib "imm32" Alias "ImmInstallIMEW" (lpszIMEFileName As LPCWSTR, lpszLayoutText As LPCWSTR) As HKL
+#else
+Declare Function ImmInstallIME Lib "imm32" Alias "ImmInstallIMEA" (lpszIMEFileName As LPCSTR, lpszLayoutText As LPCSTR) As HKL
+#endif
+
+Declare Function ImmGetDefaultIMEWnd Lib "imm32" (hwnd As HWND) As HWND
+
+Declare Function ImmGetDescriptionA Lib "imm32" (hkl As HKL, lpszDescription As LPSTR, uBufLen As DWord) As DWord
+Declare Function ImmGetDescriptionW Lib "imm32" (hkl As HKL, lpszDescription As LPWSTR, uBufLen As DWord) As DWord
+#ifdef UNICODE
+Declare Function ImmGetDescription Lib "imm32" Alias "ImmGetDescriptionW" (hkl As HKL, lpszDescription As LPWSTR, uBufLen As DWord) As DWord
+#else
+Declare Function ImmGetDescription Lib "imm32" Alias "ImmGetDescriptionA" (hkl As HKL, lpszDescription As LPSTR, uBufLen As DWord) As DWord
+#endif
+
+Declare Function ImmGetIMEFileNameA Lib "imm32" (lpszFileName As LPSTR, uBufLen As DWord) As DWord
+Declare Function ImmGetIMEFileNameW Lib "imm32" (lpszFileName As LPWSTR, uBufLen As DWord) As DWord
+#ifdef UNICODE
+Declare Function ImmGetIMEFileName Lib "imm32" Alias "ImmGetIMEFileNameW" (lpszFileName As LPWSTR, uBufLen As DWord) As DWord
+#else
+Declare Function ImmGetIMEFileName Lib "imm32" Alias "ImmGetIMEFileNameA" (lpszFileName As LPSTR, uBufLen As DWord) As DWord
+#endif
+
+Declare Function ImmGetProperty Lib "imm32" (hkl As HKL, fdwIndex As DWord) As DWord
+Declare Function ImmIsIME Lib "imm32" (hkl As HKL) As BOOL
+Declare Function ImmSimulateHotKey Lib "imm32" (hwnd As HWND, dwHotKeyID As DWord) As BOOL
+Declare Function ImmCreateContext Lib "imm32" () As HIMC
+Declare Function ImmDestroyContext Lib "imm32" (himc As HIMC) As BOOL
+Declare Function ImmGetContext Lib "imm32" (hwnd As HWND) As HIMC
+Declare Function ImmReleaseContext Lib "imm32" (hwnd As HWND, himc As HIMC) As BOOL
+Declare Function ImmAssociateContext Lib "imm32" (hwnd As HWND, himc As HIMC) As HIMC
+Declare Function ImmAssociateContextEx Lib "imm32" (hwnd As HWND, himc As HIMC, dwFlags As DWord) As HIMC
+
+Declare Function ImmGetCompositionStringA Lib "imm32" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
+Declare Function ImmGetCompositionStringW Lib "imm32" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
+#ifdef UNICODE
+Declare Function ImmGetCompositionString Lib "imm32" Alias "ImmGetCompositionStringW" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
+#else
+Declare Function ImmGetCompositionString Lib "imm32" Alias "ImmGetCompositionStringA" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
+#endif
+
+Declare Function ImmSetCompositionStringA Lib "imm32" (himc As HIMC, dwIndex As DWord, lpComp As VoidPtr, dwCompLen As DWord, lpRead As VoidPtr, dwReadLen As DWord) As BOOL
+Declare Function ImmSetCompositionStringW Lib "imm32" (himc As HIMC, dwIndex As DWord, lpComp As VoidPtr, dwCompLen As DWord, lpRead As VoidPtr, dwReadLen As DWord) As BOOL
+#ifdef UNICODE
+Declare Function ImmSetCompositionString Lib "imm32" Alias "ImmSetCompositionStringW" (himc As HIMC, dwIndex As DWord, lpComp As VoidPtr, dwCompLen As DWord, lpRead As VoidPtr, dwReadLen As DWord) As BOOL
+#else
+Declare Function ImmSetCompositionString Lib "imm32" Alias "ImmSetCompositionStringA" (himc As HIMC, dwIndex As DWord, lpComp As VoidPtr, dwCompLen As DWord, lpRead As VoidPtr, dwReadLen As DWord) As BOOL
+#endif
+
+Declare Function ImmGetCandidateListCountA Lib "imm32" (himc As HIMC, ByRef dwListCount As DWord) As DWord
+Declare Function ImmGetCandidateListCountW Lib "imm32" (himc As HIMC, ByRef dwListCount As DWord) As DWord
+#ifdef UNICODE
+Declare Function ImmGetCandidateListCount Lib "imm32" Alias "ImmGetCandidateListCountW" (himc As HIMC, ByRef dwListCount As DWord) As DWord
+#else
+Declare Function ImmGetCandidateListCount Lib "imm32" Alias "ImmGetCandidateListCountA" (himc As HIMC, ByRef dwListCount As DWord) As DWord
+#endif
+
+Declare Function ImmGetCandidateListA Lib "imm32" (himc As HIMC, dwIndex As DWord, lpCandList As LPCANDIDATELIST, dwBufLen As DWord) As DWord
+Declare Function ImmGetCandidateListW Lib "imm32" (himc As HIMC, dwIndex As DWord, lpCandList As LPCANDIDATELIST, dwBufLen As DWord) As DWord
+#ifdef UNICODE
+Declare Function ImmGetCandidateList Lib "imm32" Alias "ImmGetCandidateListW" (himc As HIMC, dwIndex As DWord, lpCandList As LPCANDIDATELIST, dwBufLen As DWord) As DWord
+#else
+Declare Function ImmGetCandidateList Lib "imm32" Alias "ImmGetCandidateListA" (himc As HIMC, dwIndex As DWord, lpCandList As LPCANDIDATELIST, dwBufLen As DWord) As DWord
+#endif
+
+Declare Function ImmGetGuideLineA Lib "imm32" (himc As HIMC, dwIndex As DWord, lpBuf As LPSTR, dwBufLen As DWord) As DWord
+Declare Function ImmGetGuideLineW Lib "imm32" (himc As HIMC, dwIndex As DWord, lpBuf As LPWSTR, dwBufLen As DWord) As DWord
+#ifdef UNICODE
+Declare Function ImmGetGuideLine Lib "imm32"  Alias "ImmGetGuideLineW" (himc As HIMC, dwIndex As DWord, lpBuf As LPWSTR, dwBufLen As DWord) As DWord
+#else
+Declare Function ImmGetGuideLine Lib "imm32"  Alias "ImmGetGuideLineA" (himc As HIMC, dwIndex As DWord, lpBuf As LPSTR, dwBufLen As DWord) As DWord
+#endif
+
+Declare Function ImmGetConversionStatus Lib "imm32" (himc As HIMC, ByRef fdwConversion As DWord, ByRef fdwSentence As DWord) As BOOL
+Declare Function ImmSetConversionStatus Lib "imm32" (himc As HIMC, fdwConversion As DWord, fdwSentence As DWord) As BOOL
+Declare Function ImmGetOpenStatus Lib "imm32" (himc As HIMC) As BOOL
+Declare Function ImmSetOpenStatus Lib "imm32" (himc As HIMC, fOpen As BOOL) As BOOL
+
+#ifndef NOGDI
+Declare Function ImmGetCompositionFontA Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONTA) As BOOL
+Declare Function ImmGetCompositionFontW Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONTW) As BOOL
+#ifdef UNICODE
+Declare Function ImmGetCompositionFont Lib "imm32" Alias "ImmGetCompositionFontW" (hIMC As HIMC, ByRef lf As LOGFONT) As BOOL
+#else
+Declare Function ImmGetCompositionFont Lib "imm32" Alias "ImmGetCompositionFontA" (hIMC As HIMC, ByRef lf As LOGFONT) As BOOL
+#endif
+
+Declare Function ImmSetCompositionFontA Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONTA) As Long
+Declare Function ImmSetCompositionFontW Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONTW) As Long
+#ifdef UNICODE
+Declare Function ImmSetCompositionFont Lib "imm32" Alias "ImmSetCompositionFontW" (hIMC As HIMC, ByRef lf As LOGFONT) As Long
+#else
+Declare Function ImmSetCompositionFont Lib "imm32" Alias "ImmSetCompositionFontA" (hIMC As HIMC, ByRef lf As LOGFONT) As Long
+#endif
+#endif 'NOGDI
+
+Declare Function ImmConfigureIMEA Lib "imm32" (hkl As HKL, hwnd As HWND, dwMode As DWord, lpData As VoidPtr) As BOOL
+Declare Function ImmConfigureIMEW Lib "imm32" (hkl As HKL, hwnd As HWND, dwMode As DWord, lpData As VoidPtr) As BOOL
+#ifdef UNICODE
+Declare Function ImmConfigureIME Lib "imm32" Alias "ImmConfigureIMEW" (hkl As HKL, hwnd As HWND, dwMode As DWord, lpData As VoidPtr) As BOOL
+#else
+Declare Function ImmConfigureIME Lib "imm32" Alias "ImmConfigureIMEA" (hkl As HKL, hwnd As HWND, dwMode As DWord, lpData As VoidPtr) As BOOL
+#endif
+
+Declare Function ImmEscapeA Lib "imm32" (hkl As HKL, himc As HIMC, uEscape As DWord, lpData As VoidPtr) As BOOL
+Declare Function ImmEscapeW Lib "imm32" (hkl As HKL, himc As HIMC, uEscape As DWord, lpData As VoidPtr) As BOOL
+#ifdef UNICODE
+Declare Function ImmEscape Lib "imm32" Alias "ImmEscapeW" (hkl As HKL, himc As HIMC, uEscape As DWord, lpData As VoidPtr) As BOOL
+#else
+Declare Function ImmEscape Lib "imm32" Alias "ImmEscapeA" (hkl As HKL, himc As HIMC, uEscape As DWord, lpData As VoidPtr) As BOOL
+#endif
+
+Declare Function ImmGetConversionListA Lib "imm32" (hkl As HKL, lpSrc As LPCSTR, lpDst As LPCANDIDATELIST, dwBufLen As DWord, uFlag As DWord) As DWord
+Declare Function ImmGetConversionListW Lib "imm32" (hkl As HKL, lpSrc As LPCWSTR, lpDst As LPCANDIDATELIST, dwBufLen As DWord, uFlag As DWord) As DWord
+#ifdef UNICODE
+Declare Function ImmGetConversionList Lib "imm32" Alias "ImmGetConversionListW" (hkl As HKL, lpSrc As LPCWSTR, lpDst As LPCANDIDATELIST, dwBufLen As DWord, uFlag As DWord) As DWord
+#else
+Declare Function ImmGetConversionList Lib "imm32" Alias "ImmGetConversionListA" (hkl As HKL, lpSrc As LPCSTR, lpDst As LPCANDIDATELIST, dwBufLen As DWord, uFlag As DWord) As DWord
+#endif
+
+Declare Function ImmNotifyIME Lib "imm32" (himc As HIMC, dwAction As DWord, dwIndex As DWord, dwValue As DWord) As BOOL
+
+Declare Function ImmGetStatusWindowPos Lib "imm32" (himc As HIMC, ByRef ptPos As POINTAPI) As BOOL
+Declare Function ImmSetStatusWindowPos Lib "imm32" (himc As HIMC, ByRef ptPos As POINTAPI) As BOOL
+Declare Function ImmGetCompositionWindow Lib "imm32" (himc As HIMC, ByRef CompForm As COMPOSITIONFORM) As BOOL
+Declare Function ImmSetCompositionWindow Lib "imm32" (himc As HIMC, ByRef CompForm As COMPOSITIONFORM) As BOOL
+Declare Function ImmGetCandidateWindow Lib "imm32" (himc As HIMC, ByRef Candidate As CANDIDATEFORM) As BOOL
+Declare Function ImmSetCandidateWindow Lib "imm32" (himc As HIMC, ByRef Candidate As CANDIDATEFORM) As BOOL
+
+Declare Function ImmIsUIMessageA Lib "imm32" (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As BOOL
+Declare Function ImmIsUIMessageW Lib "imm32" (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As BOOL
+#ifdef UNICODE
+Declare Function ImmIsUIMessage Lib "imm32" Alias "ImmIsUIMessageW" (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As BOOL
+#else
+Declare Function ImmIsUIMessage Lib "imm32" Alias "ImmIsUIMessageA" (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As BOOL
+#endif
+
+TypeDef REGISTERWORDENUMPROCA = *Function(lpszReading As LPCSTR, dwStyle As DWord, lpszString As LPCSTR, lpData As VoidPtr) As Long
+TypeDef REGISTERWORDENUMPROCW = *Function(lpszReading As LPCWSTR, dwStyle As DWord, lpszString As LPCWSTR, lpData As VoidPtr) As Long
+#ifdef UNICODE
+TypeDef REGISTERWORDENUMPROC = REGISTERWORDENUMPROCW
+#else
+TypeDef REGISTERWORDENUMPROC = REGISTERWORDENUMPROCA
+#endif
+
+Declare Function ImmRegisterWordA Lib "imm32" (hkl As HKL, lpszReading As LPCSTR, dwStyle As DWord, lpszRegister As LPCSTR) As BOOL
+Declare Function ImmRegisterWordW Lib "imm32" (hkl As HKL, lpszReading As LPCWSTR, dwStyle As DWord, lpszRegister As LPCWSTR) As BOOL
+#ifdef UNICODE
+Declare Function ImmRegisterWord Lib "imm32" Alias "ImmRegisterWordW" (hkl As HKL, lpszReading As LPCWSTR, dwStyle As DWord, lpszRegister As LPCWSTR) As BOOL
+#else
+Declare Function ImmRegisterWord Lib "imm32" Alias "ImmRegisterWordA" (hkl As HKL, lpszReading As LPCSTR, dwStyle As DWord, lpszRegister As LPCSTR) As BOOL
+#endif
+
+Declare Function ImmUnregisterWordA Lib "imm32" (hkl As HKL, lpszReading As LPCSTR, dwStyle As DWord, lpszUnregister As LPCSTR) As BOOL
+Declare Function ImmUnregisterWordW Lib "imm32" (hkl As HKL, lpszReading As LPCWSTR, dwStyle As DWord, lpszUnregister As LPCWSTR) As BOOL
+#ifdef UNICODE
+Declare Function ImmUnregisterWord Lib "imm32" Alias "ImmUnregisterWordW" (hkl As HKL, lpszReading As LPCWSTR, dwStyle As DWord, lpszUnregister As LPCWSTR) As BOOL
+#else
+Declare Function ImmUnregisterWord Lib "imm32" Alias "ImmUnregisterWordA" (hkl As HKL, lpszReading As LPCSTR, dwStyle As DWord, lpszUnregister As LPCSTR) As BOOL
+#endif
+
+Declare Function ImmGetRegisterWordStyleA Lib "imm32" (hkl As HKL, nItem As DWord, lpStyleBuf As LPSTYLEBUFA) As DWord
+Declare Function ImmGetRegisterWordStyleW Lib "imm32" (hkl As HKL, nItem As DWord, lpStyleBuf As LPSTYLEBUFW) As DWord
+#ifdef UNICODE
+Declare Function ImmGetRegisterWordStyle Lib "imm32" Alias "ImmGetRegisterWordStyleW" (hkl As HKL, nItem As DWord, lpStyleBuf As LPSTYLEBUFW) As DWord
+#else
+Declare Function ImmGetRegisterWordStyle Lib "imm32" Alias "ImmGetRegisterWordStyleA" (hkl As HKL, nItem As DWord, lpStyleBuf As LPSTYLEBUFA) As DWord
+#endif
+
+Declare Function ImmEnumRegisterWordA Lib "imm32" (hkl As HKL, lpfnEnumProc As REGISTERWORDENUMPROCA, lpszReading As LPCSTR, dwStyle As DWord, lpszRegister As LPCSTR, lpData As VoidPtr) As DWord
+Declare Function ImmEnumRegisterWordW Lib "imm32" (hkl As HKL, lpfnEnumProc As REGISTERWORDENUMPROCW, lpszReading As LPCWSTR, dwStyle As DWord, lpszRegister As LPCWSTR, lpData As VoidPtr) As DWord
+#ifdef UNICODE
+Declare Function ImmEnumRegisterWord Lib "imm32" Alias "ImmEnumRegisterWordW" (hkl As HKL, lpfnEnumProc As REGISTERWORDENUMPROCW, lpszReading As LPCWSTR, dwStyle As DWord, lpszRegister As LPCWSTR, lpData As VoidPtr) As DWord
+#else
+Declare Function ImmEnumRegisterWord Lib "imm32" Alias "ImmEnumRegisterWordA" (hkl As HKL, lpfnEnumProc As REGISTERWORDENUMPROCA, lpszReading As LPCSTR, dwStyle As DWord, lpszRegister As LPCSTR, lpData As VoidPtr) As DWord
+#endif
+
+Declare Function ImmDisableIME Lib "imm32" (idThread As DWord) As BOOL
+Declare Function ImmEnumInputContext Lib "imm32" (idThread As DWord, lpfn As IMCENUMPROC, lParam As LPARAM) As BOOL
+Declare Function ImmGetImeMenuItemsA Lib "imm32" (himc As HIMC, dwFlags As DWord, dwType As DWord, ByRef ImeParentMenu As IMEMENUITEMINFOA, lpImeMenu As LPIMEMENUITEMINFOA, dwSoze As DWord) As DWord
+Declare Function ImmGetImeMenuItemsW Lib "imm32" (himc As HIMC, dwFlags As DWord, dwType As DWord, ByRef ImeParentMenu As IMEMENUITEMINFOW, lpImeMenu As LPIMEMENUITEMINFOW, dwSoze As DWord) As DWord
+#ifdef UNICODE
+Declare Function ImmGetImeMenuItems Lib "imm32" Alias "ImmGetImeMenuItemsW" (himc As HIMC, dwFlags As DWord, dwType As DWord, ByRef ImeParentMenu As IMEMENUITEMINFOW, lpImeMenu As LPIMEMENUITEMINFOW, dwSoze As DWord) As DWord
+#else
+Declare Function ImmGetImeMenuItems Lib "imm32" Alias "ImmGetImeMenuItemsA" (himc As HIMC, dwFlags As DWord, dwType As DWord, ByRef ImeParentMenu As IMEMENUITEMINFOA, lpImeMenu As LPIMEMENUITEMINFOA, dwSoze As DWord) As DWord
+#endif
+Declare Function ImmDisableTextFrameService Lib "imm32"(idThread As DWord) As BOOL
+
+' wParam for WM_IME_CONTROL
+Const IMC_GETCANDIDATEPOS = &h0007
+Const IMC_SETCANDIDATEPOS = &h0008
+Const IMC_GETCOMPOSITIONFONT = &h0009
+Const IMC_SETCOMPOSITIONFONT = &h000A
+Const IMC_GETCOMPOSITIONWINDOW = &h000B
+Const IMC_SETCOMPOSITIONWINDOW = &h000C
+Const IMC_GETSTATUSWINDOWPOS = &h000F
+Const IMC_SETSTATUSWINDOWPOS = &h0010
+Const IMC_CLOSESTATUSWINDOW = &h0021
+Const IMC_OPENSTATUSWINDOW = &h0022
+
+
+' dwAction for ImmNotifyIME
+Const NI_OPENCANDIDATE = &h0010
+Const NI_CLOSECANDIDATE = &h0011
+Const NI_SELECTCANDIDATESTR = &h0012
+Const NI_CHANGECANDIDATELIST = &h0013
+Const NI_FINALIZECONVERSIONRESULT = &h0014
+Const NI_COMPOSITIONSTR = &h0015
+Const NI_SETCANDIDATE_PAGESTART = &h0016
+Const NI_SETCANDIDATE_PAGESIZE = &h0017
+Const NI_IMEMENUSELECTED = &h0018
+
+' lParam for WM_IME_SETCONTEXT
+Const ISC_SHOWUICANDIDATEWINDOW = &h00000001
+Const ISC_SHOWUICOMPOSITIONWINDOW = &h80000000
+Const ISC_SHOWUIGUIDELINE = &h40000000
+Const ISC_SHOWUIALLCANDIDATEWINDOW = &h0000000F
+Const ISC_SHOWUIALL = &hC000000F
+
+
+' dwIndex for ImmNotifyIME/NI_COMPOSITIONSTR
+Const CPS_COMPLETE = &h0001
+Const CPS_CONVERT = &h0002
+Const CPS_REVERT = &h0003
+Const CPS_CANCEL = &h0004
+
+' the modifiers of hot key
+Const MOD_ALT = &h0001
+Const MOD_CONTROL = &h0002
+Const MOD_SHIFT = &h0004
+
+Const MOD_LEFT = &h8000
+Const MOD_RIGHT = &h4000
+
+Const MOD_ON_KEYUP = &h0800
+Const MOD_IGNORE_ALL_MODIFIER = &h0400
+
+
+' Windows for Simplified Chinese Edition hot key ID from = &h10 - = &h2F
+Const IME_CHOTKEY_IME_NONIME_TOGGLE = &h10
+Const IME_CHOTKEY_SHAPE_TOGGLE = &h11
+Const IME_CHOTKEY_SYMBOL_TOGGLE = &h12
+
+' Windows for Japanese Edition hot key ID from = &h30 - = &h4F
+Const IME_JHOTKEY_CLOSE_OPEN = &h30
+
+' Windows for Korean Edition hot key ID from = &h50 - = &h6F
+Const IME_KHOTKEY_SHAPE_TOGGLE = &h50
+Const IME_KHOTKEY_HANJACONVERT = &h51
+Const IME_KHOTKEY_ENGLISH = &h52
+
+' Windows for Traditional Chinese Edition hot key ID from = &h70 - = &h8F
+Const IME_THOTKEY_IME_NONIME_TOGGLE = &h70
+Const IME_THOTKEY_SHAPE_TOGGLE = &h71
+Const IME_THOTKEY_SYMBOL_TOGGLE = &h72
+
+' direct switch hot key ID from = &h100 - = &h11F
+Const IME_HOTKEY_DSWITCH_FIRST = &h100
+Const IME_HOTKEY_DSWITCH_LAST = &h11F
+
+' IME private hot key from = &h200 - = &h21F
+Const IME_HOTKEY_PRIVATE_FIRST = &h200
+Const IME_ITHOTKEY_RESEND_RESULTSTR = &h200
+Const IME_ITHOTKEY_PREVIOUS_COMPOSITION = &h201
+Const IME_ITHOTKEY_UISTYLE_TOGGLE = &h202
+Const IME_ITHOTKEY_RECONVERTSTRING = &h203
+Const IME_HOTKEY_PRIVATE_LAST = &h21F
+
+
+' parameter of ImmGetCompositionString
+Const GCS_COMPREADSTR = &h0001
+Const GCS_COMPREADATTR = &h0002
+Const GCS_COMPREADCLAUSE = &h0004
+Const GCS_COMPSTR = &h0008
+Const GCS_COMPATTR = &h0010
+Const GCS_COMPCLAUSE = &h0020
+Const GCS_CURSORPOS = &h0080
+Const GCS_DELTASTART = &h0100
+Const GCS_RESULTREADSTR = &h0200
+Const GCS_RESULTREADCLAUSE = &h0400
+Const GCS_RESULTSTR = &h0800
+Const GCS_RESULTCLAUSE = &h1000
+
+' style bit flags for WM_IME_COMPOSITION
+Const CS_INSERTCHAR = &h2000
+Const CS_NOMOVECARET = &h4000
+
+' IME version constants
+Const IMEVER_0310 = &h0003000A
+Const IMEVER_0400 = &h00040000
+
+
+' IME property bits
+Const IME_PROP_AT_CARET = &h00010000
+Const IME_PROP_SPECIAL_UI = &h00020000
+Const IME_PROP_CANDLIST_START_FROM_1 = &h00040000
+Const IME_PROP_UNICODE = &h00080000
+Const IME_PROP_COMPLETE_ON_UNSELECT = &h00100000
+
+
+' IME UICapability bits
+Const UI_CAP_2700 = &h00000001
+Const UI_CAP_ROT90 = &h00000002
+Const UI_CAP_ROTANY = &h00000004
+
+' ImmSetCompositionString Capability bits
+Const SCS_CAP_COMPSTR = &h00000001
+Const SCS_CAP_MAKEREAD = &h00000002
+Const SCS_CAP_SETRECONVERTSTRING = &h00000004
+
+
+' IME WM_IME_SELECT inheritance Capability bits
+Const SELECT_CAP_CONVERSION = &h00000001
+Const SELECT_CAP_SENTENCE = &h00000002
+
+
+' ID for deIndex of ImmGetGuideLine
+Const GGL_LEVEL = &h00000001
+Const GGL_INDEX = &h00000002
+Const GGL_STRING = &h00000003
+Const GGL_PRIVATE = &h00000004
+
+
+' ID for dwLevel of GUIDELINE Structure
+Const GL_LEVEL_NOGUIDELINE = &h00000000
+Const GL_LEVEL_FATAL = &h00000001
+Const GL_LEVEL_ERROR = &h00000002
+Const GL_LEVEL_WARNING = &h00000003
+Const GL_LEVEL_INFORMATION = &h00000004
+
+
+' ID for dwIndex of GUIDELINE Structure
+Const GL_ID_UNKNOWN = &h00000000
+Const GL_ID_NOMODULE = &h00000001
+Const GL_ID_NODICTIONARY = &h00000010
+Const GL_ID_CANNOTSAVE = &h00000011
+Const GL_ID_NOCONVERT = &h00000020
+Const GL_ID_TYPINGERROR = &h00000021
+Const GL_ID_TOOMANYSTROKE = &h00000022
+Const GL_ID_READINGCONFLICT = &h00000023
+Const GL_ID_INPUTREADING = &h00000024
+Const GL_ID_INPUTRADICAL = &h00000025
+Const GL_ID_INPUTCODE = &h00000026
+Const GL_ID_INPUTSYMBOL = &h00000027
+Const GL_ID_CHOOSECANDIDATE = &h00000028
+Const GL_ID_REVERSECONVERSION = &h00000029
+Const GL_ID_PRIVATE_FIRST = &h00008000
+Const GL_ID_PRIVATE_LAST = &h0000FFFF
+
+
+' ID for dwIndex of ImmGetProperty
+Const IGP_GETIMEVERSION = (-4 As DWord)
+Const IGP_PROPERTY = &h00000004
+Const IGP_CONVERSION = &h00000008
+Const IGP_SENTENCE = &h0000000c
+Const IGP_UI = &h00000010
+Const IGP_SETCOMPSTR = &h00000014
+Const IGP_SELECT = &h00000018
+
+' dwIndex for ImmSetCompositionString API
+Const SCS_SETSTR = (GCS_COMPREADSTR Or GCS_COMPSTR)
+Const SCS_CHANGEATTR = (GCS_COMPREADATTR Or GCS_COMPATTR)
+Const SCS_CHANGECLAUSE = (GCS_COMPREADCLAUSE Or GCS_COMPCLAUSE)
+Const SCS_SETRECONVERTSTRING = &h00010000
+Const SCS_QUERYRECONVERTSTRING = &h00020000
+
+' attribute for COMPOSITIONSTRING Structure
+Const ATTR_INPUT = &h00
+Const ATTR_TARGET_CONVERTED = &h01
+Const ATTR_CONVERTED = &h02
+Const ATTR_TARGET_NOTCONVERTED = &h03
+Const ATTR_INPUT_ERROR = &h04
+Const ATTR_FIXEDCONVERTED = &h05
+
+' bit field for IMC_SETCOMPOSITIONWINDOW, IMC_SETCANDIDATEWINDOW
+Const CFS_DEFAULT = &h0000
+Const CFS_RECT = &h0001
+Const CFS_POINT = &h0002
+Const CFS_FORCE_POSITION = &h0020
+Const CFS_CANDIDATEPOS = &h0040
+Const CFS_EXCLUDE = &h0080
+
+' conversion direction for ImmGetConversionList
+Const GCL_CONVERSION = &h0001
+Const GCL_REVERSECONVERSION = &h0002
+Const GCL_REVERSE_LENGTH = &h0003
+
+' bit field for conversion mode
+Const IME_CMODE_ALPHANUMERIC = &h0000
+Const IME_CMODE_NATIVE = &h0001
+Const IME_CMODE_CHINESE = IME_CMODE_NATIVE
+' IME_CMODE_HANGEUL is old name of IME_CMODE_HANGUL. It will be gone eventually.
+Const IME_CMODE_HANGEUL = IME_CMODE_NATIVE
+Const IME_CMODE_HANGUL = IME_CMODE_NATIVE
+Const IME_CMODE_JAPANESE = IME_CMODE_NATIVE
+Const IME_CMODE_KATAKANA = &h0002 'only effect under IME_CMODE_NATIVE
+Const IME_CMODE_LANGUAGE = &h0003
+Const IME_CMODE_FULLSHAPE = &h0008
+Const IME_CMODE_ROMAN = &h0010
+Const IME_CMODE_CHARCODE = &h0020
+Const IME_CMODE_HANJACONVERT = &h0040
+Const IME_CMODE_SOFTKBD = &h0080
+Const IME_CMODE_NOCONVERSION = &h0100
+Const IME_CMODE_EUDC = &h0200
+Const IME_CMODE_SYMBOL = &h0400
+Const IME_CMODE_FIXED = &h0800
+Const IME_CMODE_RESERVED = &hF0000000
+
+' bit field for sentence mode
+Const IME_SMODE_NONE = &h0000
+Const IME_SMODE_PLAURALCLAUSE = &h0001
+Const IME_SMODE_SINGLECONVERT = &h0002
+Const IME_SMODE_AUTOMATIC = &h0004
+Const IME_SMODE_PHRASEPREDICT = &h0008
+Const IME_SMODE_CONVERSATION = &h0010
+Const IME_SMODE_RESERVED = &h0000F000
+
+
+' style of candidate
+Const IME_CAND_UNKNOWN = &h0000
+Const IME_CAND_READ = &h0001
+Const IME_CAND_CODE = &h0002
+Const IME_CAND_MEANING = &h0003
+Const IME_CAND_RADICAL = &h0004
+Const IME_CAND_STROKE = &h0005
+
+' wParam of report message WM_IME_NOTIFY
+Const IMN_CLOSESTATUSWINDOW = &h0001
+Const IMN_OPENSTATUSWINDOW = &h0002
+Const IMN_CHANGECANDIDATE = &h0003
+Const IMN_CLOSECANDIDATE = &h0004
+Const IMN_OPENCANDIDATE = &h0005
+Const IMN_SETCONVERSIONMODE = &h0006
+Const IMN_SETSENTENCEMODE = &h0007
+Const IMN_SETOPENSTATUS = &h0008
+Const IMN_SETCANDIDATEPOS = &h0009
+Const IMN_SETCOMPOSITIONFONT = &h000A
+Const IMN_SETCOMPOSITIONWINDOW = &h000B
+Const IMN_SETSTATUSWINDOWPOS = &h000C
+Const IMN_GUIDELINE = &h000D
+Const IMN_PRIVATE = &h000E
+
+' wParam of report message WM_IME_REQUEST
+Const IMR_COMPOSITIONWINDOW = &h0001
+Const IMR_CANDIDATEWINDOW = &h0002
+Const IMR_COMPOSITIONFONT = &h0003
+Const IMR_RECONVERTSTRING = &h0004
+Const IMR_CONFIRMRECONVERTSTRING = &h0005
+Const IMR_QUERYCHARPOSITION = &h0006
+Const IMR_DOCUMENTFEED = &h0007
+
+' error code of ImmGetCompositionString
+Const IMM_ERROR_NODATA = (-1)
+Const IMM_ERROR_GENERAL = (-2)
+
+
+' dialog mode of ImmConfigureIME
+Const IME_CONFIG_GENERAL = 1
+Const IME_CONFIG_REGISTERWORD = 2
+Const IME_CONFIG_SELECTDICTIONARY = 3
+
+
+' flags for ImmEscape
+Const IME_ESC_QUERY_SUPPORT = &h0003
+Const IME_ESC_RESERVED_FIRST = &h0004
+Const IME_ESC_RESERVED_LAST = &h07FF
+Const IME_ESC_PRIVATE_FIRST = &h0800
+Const IME_ESC_PRIVATE_LAST = &h0FFF
+
+Const IME_ESC_SEQUENCE_TO_INTERNAL = &h1001
+Const IME_ESC_GET_EUDC_DICTIONARY = &h1003
+Const IME_ESC_SET_EUDC_DICTIONARY = &h1004
+Const IME_ESC_MAX_KEY = &h1005
+Const IME_ESC_IME_NAME = &h1006
+Const IME_ESC_SYNC_HOTKEY = &h1007
+Const IME_ESC_HANJA_MODE = &h1008
+Const IME_ESC_AUTOMATA = &h1009
+Const IME_ESC_PRIVATE_HOTKEY = &h100a
+Const IME_ESC_GETHELPFILENAME = &h100b
+
+' style of word registration
+Const IME_REGWORD_STYLE_EUDC = &h00000001
+Const IME_REGWORD_STYLE_USER_FIRST = &h80000000
+Const IME_REGWORD_STYLE_USER_LAST = &hFFFFFFFF
+
+' dwFlags for ImmAssociateContextEx
+Const IACE_CHILDREN = &h0001
+Const IACE_DEFAULT = &h0010
+Const IACE_IGNORENOCONTEXT = &h0020
+
+' dwFlags for ImmGetImeMenuItems
+Const IGIMIF_RIGHTMENU = &h0001
+
+' dwType for ImmGetImeMenuItems
+Const IGIMII_CMODE = &h0001
+Const IGIMII_SMODE = &h0002
+Const IGIMII_CONFIGURE = &h0004
+Const IGIMII_TOOLS = &h0008
+Const IGIMII_HELP = &h0010
+Const IGIMII_OTHER = &h0020
+Const IGIMII_INPUTTOOLS = &h0040
+
+' fType of IMEMENUITEMINFO structure
+Const IMFT_RADIOCHECK = &h00001
+Const IMFT_SEPARATOR = &h00002
+Const IMFT_SUBMENU = &h00004
+
+' fState of IMEMENUITEMINFO structure
+Const IMFS_GRAYED = MFS_GRAYED
+Const IMFS_DISABLED = MFS_DISABLED
+Const IMFS_CHECKED = MFS_CHECKED
+Const IMFS_HILITE = MFS_HILITE
+Const IMFS_ENABLED = MFS_ENABLED
+Const IMFS_UNCHECKED = MFS_UNCHECKED
+Const IMFS_UNHILITE = MFS_UNHILITE
+Const IMFS_DEFAULT = MFS_DEFAULT
+
+' type of soft keyboard
+' for Windows Tranditional Chinese Edition
+Const SOFTKEYBOARD_TYPE_T1 = &h0001
+' for Windows Simplified Chinese Edition
+Const SOFTKEYBOARD_TYPE_C1 = &h0002
Index: /trunk/ab5.0/ablib/src/api_mmsys.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_mmsys.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_mmsys.sbp	(revision 506)
@@ -0,0 +1,2641 @@
+' api_mmsys.sbp
+' Include file for Multimedia API's
+
+
+#ifndef _INC_MMSYS
+#define _INC_MMSYS
+
+
+' general constants
+Const MAXPNAMELEN            = 32
+Const MAXERRORLENGTH         = 256
+Const MAX_JOYSTICKOEMVXDNAME = 260
+
+Const MM_MIDI_MAPPER        =  1
+Const MM_WAVE_MAPPER        =  2
+Const MM_SNDBLST_MIDIOUT    =  3
+Const MM_SNDBLST_MIDIIN     =  4
+Const MM_SNDBLST_SYNTH      =  5
+Const MM_SNDBLST_WAVEOUT    =  6
+Const MM_SNDBLST_WAVEIN     =  7
+Const MM_ADLIB              =  9
+Const MM_MPU401_MIDIOUT     = 10
+Const MM_MPU401_MIDIIN      = 11
+Const MM_PC_JOYSTICK        = 12
+
+' general data types
+TypeDef MMVERSION = DWord
+TypeDef VERSION = DWord
+TypeDef MMRESULT = DWord
+
+' MMTIME data structure
+
+Type Smpte
+	hour As Byte
+	min As Byte
+	sec As Byte
+	frame As Byte
+	fps As Byte
+	dummy As Byte
+	pad[ELM(2)] As Byte
+End Type
+
+Type Midi
+	songptrpos As DWord
+End Type
+
+Type MMTIME
+Public
+	wType As DWord
+	u As DWord
+/* union
+	ms As DWord
+	sample As DWord
+	cb As DWord
+	ticks As DWord
+	smpte As Smpte
+	midi As Midi
+*/
+End Type
+TypeDef PMMTIME = *MMTIME
+TypeDef LPMMTIME = *MMTIME
+
+Const MAKEFOURCC(ch0, ch1, ch2, ch3) = (((ch0 As Byte) or ((ch1 As Byte)<<8) or ((ch2 As Byte)<<16) or ((ch3 As Byte)<<24)) As DWord)
+
+' types for wType field in MMTIME struct
+Const TIME_MS        = &H0001
+Const TIME_SAMPLES   = &H0002
+Const TIME_BYTES     = &H0004
+Const TIME_SMPTE     = &H0008
+Const TIME_MIDI      = &H0010
+Const TIME_TICKS     = &H0020
+
+'----------------------------------------
+' Multimedia Extensions Window Messages
+
+Const MM_JOY1MOVE =       &H3A0			'joystick
+Const MM_JOY2MOVE =       &H3A1
+Const MM_JOY1ZMOVE =      &H3A2
+Const MM_JOY2ZMOVE =      &H3A3
+Const MM_JOY1BUTTONDOWN = &H3B5
+Const MM_JOY2BUTTONDOWN = &H3B6
+Const MM_JOY1BUTTONUP =   &H3B7
+Const MM_JOY2BUTTONUP =   &H3B8
+
+Const MM_MCINOTIFY =      &H3B9			'MCI
+
+Const MM_WOM_OPEN =       &H3BB			'waveform output
+Const MM_WOM_CLOSE =      &H3BC
+Const MM_WOM_DONE =       &H3BD
+
+Const MM_WIM_OPEN =       &H3BE			'waveform input
+Const MM_WIM_CLOSE =      &H3BF
+Const MM_WIM_DATA =       &H3C0
+
+Const MM_MIM_OPEN =       &H3C1			'MIDI input
+Const MM_MIM_CLOSE =      &H3C2
+Const MM_MIM_DATA =       &H3C3
+Const MM_MIM_LONGDATA =   &H3C4
+Const MM_MIM_ERROR =      &H3C5
+Const MM_MIM_LONGERROR =  &H3C6
+
+Const MM_MOM_OPEN =       &H3C7			'MIDI output
+Const MM_MOM_CLOSE =      &H3C8
+Const MM_MOM_DONE =       &H3C9
+
+Const MM_DRVM_OPEN =      &H3D0			'installable drivers
+Const MM_DRVM_CLOSE =     &H3D1
+Const MM_DRVM_DATA =      &H3D2
+Const MM_DRVM_ERROR =     &H3D3
+
+Const MM_STREAM_OPEN	 =  &H3D4
+Const MM_STREAM_CLOSE	 =  &H3D5
+Const MM_STREAM_DONE	 =  &H3D6
+Const MM_STREAM_ERROR	 =  &H3D7
+
+Const MM_MOM_POSITIONCB = &H3CA
+
+Const MM_MCISIGNAL =      &H3CB
+
+Const MM_MIM_MOREDATA =   &H3CC			'MIM_DONE w/ pending events
+
+Const MM_MIXM_LINE_CHANGE =   &H3D0		'mixer line change notify
+Const MM_MIXM_CONTROL_CHANGE =&H3D1		'mixer control change notify
+
+
+'----------------------------------------------
+' String resource number bases (internal use)
+
+Const MMSYSERR_BASE =        0
+Const WAVERR_BASE =          32
+Const MIDIERR_BASE =         64
+Const TIMERR_BASE =          96
+Const JOYERR_BASE =          160
+Const MCIERR_BASE =          256
+Const MIXERR_BASE =          1024
+
+Const MCI_STRING_OFFSET =    512
+Const MCI_VD_OFFSET =        1024
+Const MCI_CD_OFFSET =        1088
+Const MCI_WAVE_OFFSET =      1152
+Const MCI_SEQ_OFFSET =       1216
+
+
+'----------------------------------------------
+' General error return values
+
+Const MMSYSERR_NOERROR     = 0                    'no error
+Const MMSYSERR_ERROR       = (MMSYSERR_BASE + 1)  'unspecified error
+Const MMSYSERR_BADDEVICEID = (MMSYSERR_BASE + 2)  'device ID out of range
+Const MMSYSERR_NOTENABLED  = (MMSYSERR_BASE + 3)  'driver failed enable
+Const MMSYSERR_ALLOCATED   = (MMSYSERR_BASE + 4)  'device already allocated
+Const MMSYSERR_INVALHANDLE = (MMSYSERR_BASE + 5)  'device handle is invalid
+Const MMSYSERR_NODRIVER    = (MMSYSERR_BASE + 6)  'no device driver present
+Const MMSYSERR_NOMEM       = (MMSYSERR_BASE + 7)  'memory allocation error
+Const MMSYSERR_NOTSUPPORTED= (MMSYSERR_BASE + 8)  'function isn't supported
+Const MMSYSERR_BADERRNUM   = (MMSYSERR_BASE + 9)  'error value out of range
+Const MMSYSERR_INVALFLAG   = (MMSYSERR_BASE + 10) 'invalid flag passed
+Const MMSYSERR_INVALPARAM  = (MMSYSERR_BASE + 11) 'invalid parameter passed
+Const MMSYSERR_HANDLEBUSY  = (MMSYSERR_BASE + 12) 'handle being used
+Const MMSYSERR_INVALIDALIAS= (MMSYSERR_BASE + 13) 'specified alias not found
+Const MMSYSERR_BADDB       = (MMSYSERR_BASE + 14) 'bad registry database
+Const MMSYSERR_KEYNOTFOUND = (MMSYSERR_BASE + 15) 'registry key not found
+Const MMSYSERR_READERROR   = (MMSYSERR_BASE + 16) 'registry read error
+Const MMSYSERR_WRITEERROR  = (MMSYSERR_BASE + 17) 'registry write error
+Const MMSYSERR_DELETEERROR = (MMSYSERR_BASE + 18) 'registry delete error
+Const MMSYSERR_VALNOTFOUND = (MMSYSERR_BASE + 19) 'registry value not found
+Const MMSYSERR_NODRIVERCB  = (MMSYSERR_BASE + 20) 'driver does not call DriverCallback
+Const MMSYSERR_LASTERROR   = (MMSYSERR_BASE + 20) 'last error in range
+
+
+'--------------------------------------------------------
+' Installable driver support
+
+Type _System_DeclareHandle_HDRVR:unused As DWord:End Type
+TypeDef HDRVR = *_System_DeclareHandle_HDRVR
+
+Type DRVCONFIGINFOEX
+	dwDCISize As DWord
+	lpszDCISectionName As LPCWSTR
+	lpszDCIAliasName As LPCWSTR
+	dnDevNode As DWORD
+End Type
+TypeDef PDRVCONFIGINFOEX = *DRVCONFIGINFOEX
+TypeDef LPDRVCONFIGINFOEX = *DRVCONFIGINFOEX
+
+' Driver messages
+Const DRV_LOAD                = &H0001
+Const DRV_ENABLE              = &H0002
+Const DRV_OPEN                = &H0003
+Const DRV_CLOSE               = &H0004
+Const DRV_DISABLE             = &H0005
+Const DRV_FREE                = &H0006
+Const DRV_CONFIGURE           = &H0007
+Const DRV_QUERYCONFIGURE      = &H0008
+Const DRV_INSTALL             = &H0009
+Const DRV_REMOVE              = &H000A
+Const DRV_EXITSESSION         = &H000B
+Const DRV_POWER               = &H000F
+Const DRV_RESERVED            = &H0800
+Const DRV_USER                = &H4000
+
+Type DRVCONFIGINFO
+	dwDCISize As DWord
+	lpszDCISectionName As LPCWSTR
+	lpszDCIAliasName As LPCWSTR
+End Type
+TypeDef PDRVCONFIGINFO = *DRVCONFIGINFO
+TypeDef LPDRVCONFIGINFO = *DRVCONFIGINFO
+
+' Supported return values for DRV_CONFIGURE message
+Const DRVCNF_CANCEL           = &H0000
+Const DRVCNF_OK               = &H0001
+Const DRVCNF_RESTART          = &H0002
+
+TypeDef DRIVERPROC = *Function(dwDriverId As DWord, hdrvr As HDRVR, msg As DWord, lParam1 As LPARAM, lParam2 As LPARAM) As LRESULT
+
+Declare Function CloseDriver Lib "winmm" (hDriver As HDRVR, lParam1 As Long, lParam2 As Long) As LRESULT
+Declare Function OpenDriver Lib "winmm" (szDriverName As LPCWSTR, szSectionName As LPCWSTR, lParam2 As Long) As HDRVR
+Declare Function SendDriverMessage Lib "winmm" (hDriver As HDRVR, message As DWord, lParam1 As Long, lParam2 As Long) As LRESULT
+Declare Function GetDriverModuleHandle Lib "winmm" (hDriver As HDRVR) As HMODULE
+Declare Function DefDriverProc Lib "winmm" (dwDriverIdentifier As DWord, hdrvr As HDRVR, uMsg As DWord, lParam1 As LPARAM, lParam2 As LPARAM) As LRESULT
+
+Declare Function DrvClose Lib "winmm" Alias "CloseDriver" (hDriver As HDRVR, lParam1 As Long, lParam2 As Long) As LRESULT
+Declare Function DrvOpen Lib "winmm" Alias "OpenDriver" (szDriverName As LPCWSTR, szSectionName As LPCWSTR, lParam2 As Long) As HDRVR
+Declare Function DrvSendMessage Lib "winmm" Alias "SendDriverMessage" (hDriver As HDRVR, message As DWord, lParam1 As Long, lParam2 As Long) As LRESULT
+Declare Function DrvGetModuleHandle Lib "winmm" Alias "GetDriverModuleHandle" (hDriver As HDRVR) As HMODULE
+Declare Function DrvDefDriverProc Lib "winmm" Alias "DefDriverProc" (dwDriverIdentifier As DWord, hdrvr As HDRVR, uMsg As DWord, lParam1 As LPARAM, lParam2 As LPARAM) As LRESULT
+
+' return values from DriverProc() function
+Const DRV_CANCEL            = DRVCNF_CANCEL
+Const DRV_OK                = DRVCNF_OK
+Const DRV_RESTART           = DRVCNF_RESTART
+
+Const DRV_MCI_FIRST         = DRV_RESERVED
+Const DRV_MCI_LAST          = (DRV_RESERVED + &HFFF)
+
+
+'--------------------------------------------------------
+' Driver callback support
+Const CALLBACK_TYPEMASK  = &H00070000     'callback type mask
+Const CALLBACK_NULL      = &H00000000     'no callback
+Const CALLBACK_WINDOW    = &H00010000     'dwCallback is a HWND
+Const CALLBACK_TASK      = &H00020000     'dwCallback is a HTASK
+Const CALLBACK_FUNCTION  = &H00030000     'dwCallback is a FARPROC
+Const CALLBACK_THREAD    = (CALLBACK_TASK)'thread ID replaces 16 bit task
+Const CALLBACK_EVENT     = &H00050000     'dwCallback is an EVENT Handle
+
+TypeDef DRVCALLBACK = *Sub(hdrvr As HDRVR, uMsg As DWord, dwUser As DWord, dw1 As DWord, dw2 As DWord)
+TypeDef PDRVCALLBACK = *DRVCALLBACK
+TypeDef LPDRVCALLBACK = *DRVCALLBACK
+
+
+'--------------------------------------------------------
+' General MMSYSTEM support
+
+Declare Function mmsystemGetVersion Lib "winmm" () As DWord
+
+
+
+'--------------------------------------------------------
+' Sound support
+
+#ifdef UNICODE
+Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundW" (pszSound As PCWSTR, fuSound As DWord) As BOOL
+#else
+Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (pszSound As PCSTR, fuSound As DWord) As BOOL
+#endif
+
+Const SND_SYNC = &H0000
+Const SND_ASYNC = &H0001
+Const SND_NODEFAULT = &H0002
+Const SND_MEMORY = &H0004
+Const SND_LOOP = &H0008
+Const SND_NOSTOP = &H0010
+Const SND_NOWAIT = &H00002000
+Const SND_ALIAS = &H00010000
+Const SND_ALIAS_ID = &H00110000
+Const SND_FILENAME = &H00020000
+Const SND_RESOURCE = &H00040004
+Const SND_PURGE = &H0040
+Const SND_APPLICATION = &H0080
+Const SND_ALIAS_START = 0
+
+Const sndAlias(ch0, ch1) = (SND_ALIAS_START + ((&HFF AND ch0) OR (&HFF AND ch1)<<8))
+
+Const SND_ALIAS_SYSTEMASTERISK = sndAlias(&H53, &H2A)
+Const SND_ALIAS_SYSTEMQUESTION = sndAlias(&H53, &H3F)
+Const SND_ALIAS_SYSTEMHAND = sndAlias(&H53, &H48)
+Const SND_ALIAS_SYSTEMEXIT = sndAlias(&H53, &H45)
+Const SND_ALIAS_SYSTEMSTART = sndAlias(&H53, &H53)
+Const SND_ALIAS_SYSTEMWELCOME = sndAlias(&H53, &H57)
+Const SND_ALIAS_SYSTEMEXCLAMATION = sndAlias(&H53, &H21)
+Const SND_ALIAS_SYSTEMDEFAULT = sndAlias(&H53, &H44)
+
+#ifdef UNICODE
+Declare Function PlaySound Lib "winmm" Alias "PlaySoundW" (pszSound As PCWSTR, hmod As HMODULE, fdwSound As DWord) As BOOL
+#else
+Declare Function PlaySound Lib "winmm" Alias "PlaySoundA" (pszSound As PCSTR, hmod As HMODULE, fdwSound As DWord) As BOOL
+#endif
+
+
+'--------------------------------------------------------
+' Waveform audio support
+
+' waveform audio error return values
+Const WAVERR_BADFORMAT    = (WAVERR_BASE + 0)
+Const WAVERR_STILLPLAYING = (WAVERR_BASE + 1)
+Const WAVERR_UNPREPARED   = (WAVERR_BASE + 2)
+Const WAVERR_SYNC         = (WAVERR_BASE + 3)
+Const WAVERR_LASTERROR    = (WAVERR_BASE + 3)
+
+' waveform audio data types
+Type _System_DeclareHandle_HWAVE:unused As DWord:End Type
+TypeDef HWAVE = *_System_DeclareHandle_HWAVE
+Type _System_DeclareHandle_HWAVEIN:unused As DWord:End Type
+TypeDef HWAVEIN = *_System_DeclareHandle_HWAVEIN
+Type _System_DeclareHandle_HWAVEOUT:unused As DWord:End Type
+TypeDef HWAVEOUT = *_System_DeclareHandle_HWAVEOUT
+
+TypeDef WAVECALLBACK = DRVCALLBACK
+TypeDef LPWAVECALLBACK = *WAVECALLBACK
+
+' wave callback messages
+Const WOM_OPEN = MM_WOM_OPEN
+Const WOM_CLOSE = MM_WOM_CLOSE
+Const WOM_DONE = MM_WOM_DONE
+Const WIM_OPEN = MM_WIM_OPEN
+Const WIM_CLOSE = MM_WIM_CLOSE
+Const WIM_DATA = MM_WIM_DATA
+
+' device ID for wave device mapper
+Const WAVE_MAPPER = (-1)
+
+' flags for dwFlags parameter in waveOutOpen() and waveInOpen()
+Const WAVE_FORMAT_QUERY = &H0001
+Const WAVE_ALLOWSYNC = &H0002
+Const WAVE_MAPPED = &H0004
+Const WAVE_FORMAT_DIRECT = &H0008
+Const WAVE_FORMAT_DIRECT_QUERY = (WAVE_FORMAT_QUERY OR WAVE_FORMAT_DIRECT)
+
+' wave data block header
+Type WAVEHDR
+	lpData As LPSTR
+	dwBufferLength As DWord
+	dwBytesRecorded As DWord
+	dwUser As DWord
+	dwFlags As DWord
+	dwLoops As DWord
+	lpNext As *WAVEHDR
+	reserved As DWord
+End Type
+TypeDef PWAVEHDR = *WAVEHDR
+TypeDef LPWAVEHDR = *WAVEHDR
+
+' flags for dwFlags field of WAVEHDR
+Const WHDR_DONE = &H00000001
+Const WHDR_PREPARED = &H00000002
+Const WHDR_BEGINLOOP = &H00000004
+Const WHDR_ENDLOOP = &H00000008
+Const WHDR_INQUEUE = &H00000010
+
+' waveform output device capabilities structure
+Type WAVEOUTCAPSW
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As WCHAR
+	dwFormats As DWord
+	wChannels As Word
+	wReserved1 As Word
+	dwSupport As DWord
+End Type
+TypeDef PWAVEOUTCAPSW = *WAVEOUTCAPSW
+TypeDef LPWAVEOUTCAPSW = *WAVEOUTCAPSW
+
+Type WAVEOUTCAPSA
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As SByte
+	dwFormats As DWord
+	wChannels As Word
+	wReserved1 As Word
+	dwSupport As DWord
+End Type
+TypeDef PWAVEOUTCAPSA = *WAVEOUTCAPSA
+TypeDef LPWAVEOUTCAPSA = *WAVEOUTCAPSA
+
+#ifdef UNICODE
+TypeDef WAVEOUTCAPS = WAVEOUTCAPSW
+TypeDef PWAVEOUTCAPS = PWAVEOUTCAPSW
+TypeDef LPWAVEOUTCAPS = LPWAVEOUTCAPSW
+#else
+TypeDef WAVEOUTCAPS = WAVEOUTCAPSA
+TypeDef PWAVEOUTCAPS = PWAVEOUTCAPSA
+TypeDef LPWAVEOUTCAPS = LPWAVEOUTCAPSA
+#endif
+
+' flags for dwSupport field of WAVEOUTCAPS
+Const WAVECAPS_PITCH = &H0001
+Const WAVECAPS_PLAYBACKRATE = &H0002
+Const WAVECAPS_VOLUME = &H0004
+Const WAVECAPS_LRVOLUME = &H0008
+Const WAVECAPS_SYNC = &H0010
+Const WAVECAPS_SAMPLEACCURATE = &H0020
+Const WAVECAPS_DIRECTSOUND = &H0040
+
+' waveform input device capabilities structure
+Type WAVEINCAPSW
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As WCHAR
+	dwFormats As DWord
+	wChannels As Word
+	wReserved1 As Word
+End Type
+TypeDef PWAVEINCAPSW = *WAVEINCAPSW
+TypeDef LPWAVEINCAPSW = *WAVEINCAPSW
+
+Type WAVEINCAPSA
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As SByte
+	dwFormats As DWord
+	wChannels As Word
+	wReserved1 As Word
+End Type
+TypeDef PWAVEINCAPSA = *WAVEINCAPSA
+TypeDef LPWAVEINCAPSA = *WAVEINCAPSA
+
+#ifdef UNICODE
+TypeDef WAVEINCAPS = WAVEINCAPSW
+TypeDef PWAVEINCAPS = PWAVEINCAPSW
+TypeDef LPWAVEINCAPS = LPWAVEINCAPSW
+#else
+TypeDef WAVEINCAPS = WAVEINCAPSA
+TypeDef PWAVEINCAPS = PWAVEINCAPSA
+TypeDef LPWAVEINCAPS = LPWAVEINCAPSA
+#endif
+
+' defines for dwFormat field of WAVEINCAPS and WAVEOUTCAPS
+Const WAVE_INVALIDFORMAT     = &H00000000       ' invalid format
+Const WAVE_FORMAT_1M08       = &H00000001       ' 11.025 kHz, Mono,   8-bit 
+Const WAVE_FORMAT_1S08       = &H00000002       ' 11.025 kHz, Stereo, 8-bit 
+Const WAVE_FORMAT_1M16       = &H00000004       ' 11.025 kHz, Mono,   16-bit
+Const WAVE_FORMAT_1S16       = &H00000008       ' 11.025 kHz, Stereo, 16-bit
+Const WAVE_FORMAT_2M08       = &H00000010       ' 22.05  kHz, Mono,   8-bit 
+Const WAVE_FORMAT_2S08       = &H00000020       ' 22.05  kHz, Stereo, 8-bit 
+Const WAVE_FORMAT_2M16       = &H00000040       ' 22.05  kHz, Mono,   16-bit
+Const WAVE_FORMAT_2S16       = &H00000080       ' 22.05  kHz, Stereo, 16-bit
+Const WAVE_FORMAT_4M08       = &H00000100       ' 44.1   kHz, Mono,   8-bit 
+Const WAVE_FORMAT_4S08       = &H00000200       ' 44.1   kHz, Stereo, 8-bit 
+Const WAVE_FORMAT_4M16       = &H00000400       ' 44.1   kHz, Mono,   16-bit
+Const WAVE_FORMAT_4S16       = &H00000800       ' 44.1   kHz, Stereo, 16-bit
+
+' OLD general waveform format structure (information common to all formats)
+Type Align(1) WAVEFORMAT
+	wFormatTag As Word
+	nChannels As Word
+	nSamplesPerSec As DWord
+	nAvgBytesPerSec As DWord
+	nBlockAlign As Word
+End Type
+TypeDef PWAVEFORMAT = *WAVEFORMAT
+TypeDef LPWAVEFORMAT = *WAVEFORMAT
+
+' flags for wFormatTag field of WAVEFORMAT
+Const WAVE_FORMAT_PCM = 1
+
+' specific waveform format structure for PCM data
+Type Align(1) PCMWAVEFORMAT
+	wf As WAVEFORMAT
+	wBitsPerSample As Word
+End Type
+TypeDef PPCMWAVEFORMAT = *PCMWAVEFORMAT
+TypeDef LPPCMWAVEFORMAT = *PCMWAVEFORMAT
+
+Type Align(1) WAVEFORMATEX
+	wFormatTag As Word
+	nChannels As Word
+	nSamplesPerSec As DWord
+	nAvgBytesPerSec As DWord
+	nBlockAlign As Word
+	wBitsPerSample As Word
+	cbSize As Word
+End Type
+TypeDef PWAVEFORMATEX = *WAVEFORMATEX
+TypeDef LPWAVEFORMATEX = *WAVEFORMATEX
+TypeDef LPCWAVEFORMATEX = *WAVEFORMATEX
+
+' waveform audio function prototypes
+Declare Function waveOutGetNumDevs Lib "winmm" () As DWord
+#ifdef UNICODE
+Declare Function waveOutGetDevCaps Lib "winmm" Alias "waveOutGetDevCapsW" (uDeviceID As DWord, ByRef pwoc As WAVEOUTCAPSW, cbwoc As DWord) As MMRESULT
+#else
+Declare Function waveOutGetDevCaps Lib "winmm" Alias "waveOutGetDevCapsA" (uDeviceID As DWord, ByRef pwoc As WAVEOUTCAPS, cbwoc As DWord) As MMRESULT
+#endif
+Declare Function waveOutGetVolume Lib "winmm" (hwo As HWAVEOUT, ByRef pdwVolume As DWord) As MMRESULT
+Declare Function waveOutSetVolume Lib "winmm" (hwo As HWAVEOUT, dwVolume As DWord) As MMRESULT
+#ifdef UNICODE
+Declare Function waveOutGetErrorText Lib "winmm" Alias "waveOutGetErrorTextW" (mmrError As MMRESULT, pszText As LPWSTR, cchText As DWord) As MMRESULT
+#else
+Declare Function waveOutGetErrorText Lib "winmm" Alias "waveOutGetErrorTextA" (mmrError As MMRESULT, pszText As LPSTR, cchText As DWord) As MMRESULT
+#endif
+Declare Function waveOutOpen Lib "winmm" (ByRef phwo As HWAVEOUT, uDeviceID As DWord, ByRef pwfx As WAVEFORMATEX, dwCallback As DWord, dwInstance As DWord, fdwOpen As DWord) As MMRESULT
+Declare Function waveOutClose Lib "winmm" (hwo As HWAVEOUT) As MMRESULT
+Declare Function waveOutPrepareHeader Lib "winmm" (hwo As HWAVEOUT, ByRef pwh As WAVEHDR, cbwh As DWord) As MMRESULT
+Declare Function waveOutUnprepareHeader Lib "winmm" (hwo As HWAVEOUT, ByRef pwh As WAVEHDR, cbwh As DWord) As MMRESULT
+Declare Function waveOutWrite Lib "winmm" (hwo As HWAVEOUT, ByRef pwh As WAVEHDR, cbwh As DWord) As MMRESULT
+Declare Function waveOutPause Lib "winmm" (hwo As HWAVEOUT) As MMRESULT
+Declare Function waveOutRestart Lib "winmm" (hwo As HWAVEOUT) As MMRESULT
+Declare Function waveOutReset Lib "winmm" (hwo As HWAVEOUT) As MMRESULT
+Declare Function waveOutBreakLoop Lib "winmm" (hwo As HWAVEOUT) As MMRESULT
+Declare Function waveOutGetPosition Lib "winmm" (hwo As HWAVEOUT, ByRef pmmt As MMTIME, cbmmt As DWord) As MMRESULT
+Declare Function waveOutGetPitch Lib "winmm" (hwo As HWAVEOUT, ByRef pdwPitch As DWord) As MMRESULT
+Declare Function waveOutSetPitch Lib "winmm" (hwo As HWAVEOUT, dwPitch As DWord) As MMRESULT
+Declare Function waveOutGetPlaybackRate Lib "winmm" (hwo As HWAVEOUT, ByRef pdwRate As DWord) As MMRESULT
+Declare Function waveOutSetPlaybackRate Lib "winmm" (hwo As HWAVEOUT, dwRate As DWord) As MMRESULT
+Declare Function waveOutGetID Lib "winmm" (hwo As HWAVEOUT, ByRef puDeviceID As DWord) As MMRESULT
+Declare Function waveOutMessage Lib "winmm" (hwo As HWAVEOUT, uMsg As DWord, dw1 As DWord, dw2 As DWord) As MMRESULT
+
+Declare Function waveInGetNumDevs Lib "winmm" () As DWord
+#ifdef UNICODE
+Declare Function waveInGetDevCaps Lib "winmm" Alias "waveInGetDevCapsW" (uDeviceID As DWord, ByRef pwic As WAVEINCAPSW, cbwic As DWord) As MMRESULT
+Declare Function waveInGetErrorText Lib "winmm" Alias "waveInGetErrorTextW" (mmrError As MMRESULT, pszText As LPWSTR, cchText As DWord) As MMRESULT
+#else
+Declare Function waveInGetDevCaps Lib "winmm" Alias "waveInGetDevCapsA" (uDeviceID As DWord, ByRef pwic As WAVEINCAPS, cbwic As DWord) As MMRESULT
+Declare Function waveInGetErrorText Lib "winmm" Alias "waveInGetErrorTextA" (mmrError As MMRESULT, pszText As LPSTR, cchText As DWord) As MMRESULT
+#endif
+Declare Function waveInOpen Lib "winmm" (ByRef phwi As HWAVEIN, uDeviceID As DWord, ByRef pwfx As WAVEFORMATEX, dwCallback As DWord, dwInstance As DWord, fdwOpen As DWord) As MMRESULT
+Declare Function waveInClose Lib "winmm" (hwi As HWAVEIN) As MMRESULT
+Declare Function waveInPrepareHeader Lib "winmm" (hwi As HWAVEIN, ByRef pwh As WAVEHDR, cbwh As DWord) As MMRESULT
+Declare Function waveInUnprepareHeader Lib "winmm" (hwi As HWAVEIN, ByRef pwh As WAVEHDR, cbwh As DWord) As MMRESULT
+Declare Function waveInAddBuffer Lib "winmm" (hwi As HWAVEIN, ByRef pwh As WAVEHDR, cbwh As DWord) As MMRESULT
+Declare Function waveInStart Lib "winmm" (hwi As HWAVEIN) As MMRESULT
+Declare Function waveInStop Lib "winmm" (hwi As HWAVEIN) As MMRESULT
+Declare Function waveInReset Lib "winmm" (hwi As HWAVEIN) As MMRESULT
+Declare Function waveInGetPosition Lib "winmm" (hwi As HWAVEIN, ByRef pmmt As MMTIME, cbmmt As DWord) As MMRESULT
+Declare Function waveInGetID Lib "winmm" (hwi As HWAVEIN, ByRef puDeviceID As DWord) As MMRESULT
+Declare Function waveInMessage Lib "winmm" (hwi As HWAVEIN, uMsg As DWord, dw1 As DWord, dw2 As DWord) As MMRESULT
+
+
+
+'--------------------------------------------------------
+' MIDI audio support
+
+' MIDI error return values
+Const MIDIERR_UNPREPARED = (MIDIERR_BASE + 0)
+Const MIDIERR_STILLPLAYING = (MIDIERR_BASE + 1)
+Const MIDIERR_NOMAP = (MIDIERR_BASE + 2)
+Const MIDIERR_NOTREADY = (MIDIERR_BASE + 3)
+Const MIDIERR_NODEVICE = (MIDIERR_BASE + 4)
+Const MIDIERR_INVALIDSETUP = (MIDIERR_BASE + 5)
+Const MIDIERR_BADOPENMODE = (MIDIERR_BASE + 6)
+Const MIDIERR_DONT_CONTINUE = (MIDIERR_BASE + 7)
+Const MIDIERR_LASTERROR = (MIDIERR_BASE + 7)
+
+' MIDI audio data types
+Type _System_DeclareHandle_HMIDI:unused As DWord:End Type
+TypeDef HMIDI = *_System_DeclareHandle_HMIDI
+Type _System_DeclareHandle_HMIDIIN:unused As DWord:End Type
+TypeDef HMIDIIN = *_System_DeclareHandle_HMIDIIN
+Type _System_DeclareHandle_HMIDIOUT:unused As DWord:End Type
+TypeDef HMIDIOUT = *_System_DeclareHandle_HMIDIOUT
+Type _System_DeclareHandle_HMIDISTRM:unused As DWord:End Type
+TypeDef HMIDISTRM = *_System_DeclareHandle_HMIDISTRM
+
+TypeDef MIDICALLBACK = DRVCALLBACK
+TypeDef LPMIDICALLBACK = *MIDICALLBACK
+
+Const MIDIPATCHSIZE  = 128
+
+TypeDef LPPATCHARRAY = *Word
+TypeDef LPKEYARRAY = *Word
+
+' MIDI callback messages
+Const MIM_OPEN = MM_MIM_OPEN
+Const MIM_CLOSE = MM_MIM_CLOSE
+Const MIM_DATA = MM_MIM_DATA
+Const MIM_LONGDATA = MM_MIM_LONGDATA
+Const MIM_ERROR = MM_MIM_ERROR
+Const MIM_LONGERROR = MM_MIM_LONGERROR
+Const MOM_OPEN = MM_MOM_OPEN
+Const MOM_CLOSE = MM_MOM_CLOSE
+Const MOM_DONE = MM_MOM_DONE
+Const MIM_MOREDATA = MM_MIM_MOREDATA
+Const MOM_POSITIONCB = MM_MOM_POSITIONCB
+
+' device ID for MIDI mapper
+Const MIDIMAPPER = (-1)
+Const MIDI_MAPPER = (-1)
+
+Const MIDI_IO_STATUS = &H00000020
+
+' flags for wFlags parm of midiOutCachePatches(), midiOutCacheDrumPatches()
+Const MIDI_CACHE_ALL = 1
+Const MIDI_CACHE_BESTFIT = 2
+Const MIDI_CACHE_QUERY = 3
+Const MIDI_UNCACHE = 4
+
+' MIDI output device capabilities structure
+Type MIDIOUTCAPSW
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As WCHAR
+	wTechnology As Word
+	wVoices As Word
+	wNotes As Word
+	wChannelMask As Word
+	dwSupport As DWord
+End Type
+TypeDef PMIDIOUTCAPSW = *MIDIOUTCAPSW
+TypeDef LPMIDIOUTCAPSW = *MIDIOUTCAPSW
+
+Type MIDIOUTCAPSA
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As SByte
+	wTechnology As Word
+	wVoices As Word
+	wNotes As Word
+	wChannelMask As Word
+	dwSupport As DWord
+End Type
+TypeDef PMIDIOUTCAPSA = *MIDIOUTCAPSA
+TypeDef LPMIDIOUTCAPSA = *MIDIOUTCAPSA
+
+#ifdef UNICODE
+TypeDef MIDIOUTCAPS = MIDIOUTCAPSW
+TypeDef PMIDIOUTCAPS = PMIDIOUTCAPSW
+TypeDef LPMIDIOUTCAPS = LPMIDIOUTCAPSW
+#else
+TypeDef MIDIOUTCAPS = MIDIOUTCAPSA
+TypeDef PMIDIOUTCAPS = PMIDIOUTCAPSA
+TypeDef LPMIDIOUTCAPS = LPMIDIOUTCAPSA
+#endif
+
+' flags for wTechnology field of MIDIOUTCAPS structure
+Const MOD_MIDIPORT = 1
+Const MOD_SYNTH = 2
+Const MOD_SQSYNTH = 3
+Const MOD_FMSYNTH = 4
+Const MOD_MAPPER = 5
+
+' flags for dwSupport field of MIDIOUTCAPS structure
+Const MIDICAPS_VOLUME = &H0001
+Const MIDICAPS_LRVOLUME = &H0002
+Const MIDICAPS_CACHE = &H0004
+Const MIDICAPS_STREAM = &H0008
+
+' MIDI input device capabilities structure
+Type MIDIINCAPSW
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As Char
+	dwSupport As DWord
+End Type
+TypeDef PMIDIINCAPSW = *MIDIINCAPSW
+TypeDef LPMIDIINCAPSW = *MIDIINCAPSW
+
+Type MIDIINCAPSA
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As Char
+	dwSupport As DWord
+End Type
+TypeDef PMIDIINCAPSA = *MIDIINCAPSA
+TypeDef LPMIDIINCAPSA = *MIDIINCAPSA
+
+#ifdef UNICODE
+TypeDef MIDIINCAPS = MIDIINCAPSW
+TypeDef PMIDIINCAPS = PMIDIINCAPSW
+TypeDef LPMIDIINCAPS = LPMIDIINCAPSW
+#else
+TypeDef MIDIINCAPS = MIDIINCAPSA
+TypeDef PMIDIINCAPS = PMIDIINCAPSA
+TypeDef LPMIDIINCAPS = LPMIDIINCAPSA
+#endif
+
+' MIDI data block header
+Type MIDIHDR
+	lpData As LPSTR
+	dwBufferLength As DWord
+	dwBytesRecorded As DWord
+	dwUser As DWord
+	dwFlags As DWord
+	lpNext As *MIDIHDR
+	reserved As DWord
+	dwOffset As DWord
+	dwReserved[ELM(8)] As DWord
+End Type
+TypeDef PMIDIHDR = *MIDIHDR
+TypeDef LPMIDIHDR = *MIDIHDR
+
+Type MIDIEVENT
+	dwDeltaTime As DWord
+	dwStreamID As DWord
+	dwEvent As DWord
+	dwParms[ELM(1)] As DWord
+End Type
+
+Type MIDISTRMBUFFVER
+	dwVersion As DWord
+	dwMid As DWord
+	dwOEMVersion As DWord
+End Type
+
+' flags for dwFlags field of MIDIHDR structure
+Const MHDR_DONE = &H00000001
+Const MHDR_PREPARED = &H00000002
+Const MHDR_INQUEUE = &H00000004
+Const MHDR_ISSTRM = &H00000008
+
+Const MEVT_F_SHORT = &H00000000
+Const MEVT_F_LONG = &H80000000
+Const MEVT_F_CALLBACK = &H40000000
+Const MEVT_EVENTTYPE(x) = ((x>>24) AND &HFF)
+Const MEVT_EVENTPARM(x) = (x AND &H00FFFFFF)
+Const MEVT_SHORTMSG = (&H00)
+Const MEVT_TEMPO = (&H01)
+Const MEVT_NOP = (&H02)
+Const MEVT_LONGMSG = (&H80)
+Const MEVT_COMMENT = (&H82)
+Const MEVT_VERSION = (&H84)
+
+Const MIDISTRM_ERROR = (-2)
+
+' Structures and defines for midiStreamProperty
+Const MIDIPROP_SET = &H80000000
+Const MIDIPROP_GET = &H40000000
+Const MIDIPROP_TIMEDIV = &H00000001
+Const MIDIPROP_TEMPO = &H00000002
+
+Type MIDIPROPTIMEDIV
+	cbStruct As DWord
+	dwTimeDiv As DWord
+End Type
+TypeDef LPMIDIPROPTIMEDIV = *MIDIPROPTIMEDIV
+
+Type MIDIPROPTEMPO
+	cbStruct As DWord
+	dwTempo As DWord
+End Type
+TypeDef LPMIDIPROPTEMPO = *MIDIPROPTEMPO
+
+
+' MIDI function prototypes
+Declare Function midiOutGetNumDevs Lib "winmm" () As DWord
+Declare Function midiStreamOpen Lib "winmm" (ByRef phms As HMIDISTRM, ByRef puDeviceID As DWord, cMidi As DWord, dwCallback As DWord, dwInstance As DWord, fdwOpen As DWord) As MMRESULT
+Declare Function midiStreamClose Lib "winmm" (hms As HMIDISTRM) As MMRESULT
+Declare Function midiStreamProperty Lib "winmm" (hms As HMIDISTRM, lppropdata As *Byte, dwProperty As DWord) As MMRESULT
+Declare Function midiStreamPosition Lib "winmm" (hms As HMIDISTRM, ByRef lpmmt As MMTIME, cbmmt As DWord) As MMRESULT
+Declare Function midiStreamOut Lib "winmm" (hms As HMIDISTRM, ByRef pmh As MIDIHDR, cbmh As DWord) As MMRESULT
+Declare Function midiStreamPause Lib "winmm" (hms As HMIDISTRM) As MMRESULT
+Declare Function midiStreamRestart Lib "winmm" (hms As HMIDISTRM) As MMRESULT
+Declare Function midiStreamStop Lib "winmm" (hms As HMIDISTRM) As MMRESULT
+
+Declare Function midiConnect Lib "winmm" (hmi As HMIDI, hmo As HMIDIOUT, pReserved As VoidPtr) As MMRESULT
+Declare Function midiDisconnect Lib "winmm" (hmi As HMIDI, hmo As HMIDIOUT, pReserved As VoidPtr) As MMRESULT
+#ifdef UNICODE
+Declare Function midiOutGetDevCaps Lib "winmm" Alias "midiOutGetDevCapsW" (uDeviceID As DWord, ByRef pmoc  As MIDIOUTCAPSW, cbmoc As DWord) As MMRESULT
+#else
+Declare Function midiOutGetDevCaps Lib "winmm" Alias "midiOutGetDevCapsA" (uDeviceID As DWord, ByRef pmoc  As MIDIOUTCAPS, cbmoc As DWord) As MMRESULT
+#endif
+Declare Function midiOutGetVolume Lib "winmm" (hmo As HMIDIOUT, ByRef pdwVolume As DWord) As MMRESULT
+Declare Function midiOutSetVolume Lib "winmm" (hmo As HMIDIOUT, dwVolume As DWord) As MMRESULT
+#ifdef UNICODE
+Declare Function midiOutGetErrorText Lib "winmm" Alias "midiOutGetErrorTextW" (mmrError As MMRESULT, pszText As LPWSTR, cchText As DWord) As MMRESULT
+#else
+Declare Function midiOutGetErrorText Lib "winmm" Alias "midiOutGetErrorTextA" (mmrError As MMRESULT, pszText As LPSTR, cchText As DWord) As MMRESULT
+#endif
+Declare Function midiOutOpen Lib "winmm" (ByRef phmo As HMIDIOUT, uDeviceID As DWord, dwCallback As DWord, dwInstance As DWord, fdwOpen As DWord) As MMRESULT
+Declare Function midiOutClose Lib "winmm" (hmo As HMIDIOUT) As MMRESULT
+Declare Function midiOutPrepareHeader Lib "winmm" (hmo As HMIDIOUT, ByRef pmh As MIDIHDR, cbmh As DWord) As MMRESULT
+Declare Function midiOutUnprepareHeader Lib "winmm" (hmo As HMIDIOUT, ByRef pmh As MIDIHDR, cbmh As DWord) As MMRESULT
+Declare Function midiOutShortMsg Lib "winmm" (hmo As HMIDIOUT, dwMsg As DWord) As MMRESULT
+Declare Function midiOutLongMsg Lib "winmm" (hmo As HMIDIOUT, ByRef pmh As MIDIHDR, cbmh As DWord) As MMRESULT
+Declare Function midiOutReset Lib "winmm" (hmo As HMIDIOUT) As MMRESULT
+Declare Function midiOutCachePatches Lib "winmm" (hmo As HMIDIOUT, uBank As DWord, ByRef pwpa As Word, fuCache As DWord) As MMRESULT
+Declare Function midiOutCacheDrumPatches Lib "winmm" (hmo As HMIDIOUT, uPatch As DWord, ByRef pwkya As Word, fuCache As DWord) As MMRESULT
+Declare Function midiOutGetID Lib "winmm" (hmo As HMIDIOUT, ByRef puDeviceID As DWord) As MMRESULT
+Declare Function midiOutMessage Lib "winmm" (hmo As HMIDIOUT, uMsg As DWord, dw1 As DWord, dw2 As DWord) As MMRESULT
+
+Declare Function midiInGetNumDevs Lib "winmm" () As DWord
+#ifdef UNICODE
+Declare Function midiInGetDevCaps Lib "winmm" Alias "midiInGetDevCapsW" (uDeviceID As DWord, ByRef pmic As MIDIINCAPSW, cbmic As DWord) As MMRESULT
+Declare Function midiInGetErrorText Lib "winmm" Alias "midiInGetErrorTextW" (mmrError As MMRESULT, pszText As LPWSTR, cchText As DWord) As MMRESULT
+#else
+Declare Function midiInGetDevCaps Lib "winmm" Alias "midiInGetDevCapsA" (uDeviceID As DWord, ByRef pmic As MIDIINCAPS, cbmic As DWord) As MMRESULT
+Declare Function midiInGetErrorText Lib "winmm" Alias "midiInGetErrorTextA" (mmrError As MMRESULT, pszText As LPSTR, cchText As DWord) As MMRESULT
+#endif
+Declare Function midiInOpen Lib "winmm" (ByRef phmi As HMIDIIN, uDeviceID As DWord, dwCallback As DWord, dwInstance As DWord, fdwOpen As DWord) As MMRESULT
+Declare Function midiInClose Lib "winmm" (hmi As HMIDIIN) As MMRESULT
+Declare Function midiInPrepareHeader Lib "winmm" (hmi As HMIDIIN, ByRef pmh As MIDIHDR, cbmh As DWord) As MMRESULT
+Declare Function midiInUnprepareHeader Lib "winmm" (hmi As HMIDIIN, ByRef pmh As MIDIHDR, cbmh As DWord) As MMRESULT
+Declare Function midiInAddBuffer Lib "winmm" (hmi As HMIDIIN, ByRef pmh As MIDIHDR, cbmh As DWord) As MMRESULT
+Declare Function midiInStart Lib "winmm" (hmi As HMIDIIN) As MMRESULT
+Declare Function midiInStop Lib "winmm" (hmi As HMIDIIN) As MMRESULT
+Declare Function midiInReset Lib "winmm" (hmi As HMIDIIN) As MMRESULT
+Declare Function midiInGetID Lib "winmm" (hmi As HMIDIIN, ByRef puDeviceID As DWord) As MMRESULT
+Declare Function midiInMessage Lib "winmm" (hmi As HMIDIIN, uMsg As DWord, dw1 As DWord, dw2 As DWord) As MMRESULT
+
+
+'--------------------------------------------------------
+' Auxiliary audio support
+
+' device ID for aux device mapper
+Const AUX_MAPPER = (-1)
+
+' Auxiliary audio device capabilities structure
+Type AUXCAPSW
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As WCHAR
+	wTechnology As Word
+	wReserved1 As Word
+	dwSupport As DWord
+End Type
+TypeDef PAUXCAPSW = *AUXCAPSW
+TypeDef NPAUXCAPSW = *AUXCAPSW
+TypeDef LPAUXCAPSW = *AUXCAPSW
+
+Type AUXCAPSA
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As SByte
+	wTechnology As Word
+	wReserved1 As Word
+	dwSupport As DWord
+End Type
+TypeDef PAUXCAPSA = *AUXCAPSA
+TypeDef NPAUXCAPSA = *AUXCAPSA
+TypeDef LPAUXCAPSA = *AUXCAPSA
+
+#ifdef UNICODE
+TypeDef AUXCAPS = AUXCAPSW
+TypeDef PAUXCAPS = PAUXCAPSW
+TypeDef NPAUXCAPS = NPAUXCAPSW
+TypeDef LPAUXCAPS = LPAUXCAPSW
+#else
+TypeDef AUXCAPS = AUXCAPSA
+TypeDef PAUXCAPS = PAUXCAPSA
+TypeDef NPAUXCAPS = NPAUXCAPSA
+TypeDef LPAUXCAPS = LPAUXCAPSA
+#endif
+
+Const AUXCAPS_CDAUDIO = 1
+Const AUXCAPS_AUXIN = 2
+
+Const AUXCAPS_VOLUME = &H0001
+Const AUXCAPS_LRVOLUME = &H0002
+
+' auxiliary audio function prototypes
+Declare Function auxGetNumDevs Lib "winmm" () As DWord
+#ifdef UNICODE
+Declare Function auxGetDevCaps Lib "winmm" Alias "auxGetDevCapsW" (uDeviceID As DWord, pac As *AUXCAPSW, cbac As DWord) As MMRESULT
+#else
+Declare Function auxGetDevCaps Lib "winmm" Alias "auxGetDevCapsA" (uDeviceID As DWord, pac As *AUXCAPS, cbac As DWord) As MMRESULT
+#endif
+Declare Function auxSetVolume Lib "winmm" (uDeviceID As DWord, dwVolume As DWord) As MMRESULT
+Declare Function auxGetVolume Lib "winmm" (uDeviceID As DWord, pdwVolume As *DWord) As MMRESULT
+Declare Function auxOutMessage Lib "winmm" (uDeviceID As DWord, uMsg As DWord, dw1 As DWord, dw2 As DWord) As MMRESULT
+
+
+'--------------------------------------------------------
+' Mixer Support
+
+TypeDef HMIXEROBJ = VoidPtr
+TypeDef LPHMIXEROBJ = HMIXEROBJ
+TypeDef HMIXER = VoidPtr
+TypeDef LPHMIXER = *HMIXER
+
+Const MIXER_SHORT_NAME_CHARS = 16
+Const MIXER_LONG_NAME_CHARS = 64
+
+Const MIXERR_INVALLINE = (MIXERR_BASE + 0)
+Const MIXERR_INVALCONTROL = (MIXERR_BASE + 1)
+Const MIXERR_INVALVALUE = (MIXERR_BASE + 2)
+Const MIXERR_LASTERROR = (MIXERR_BASE + 2)
+
+Const MIXER_OBJECTF_HANDLE = &H80000000
+Const MIXER_OBJECTF_MIXER = &H00000000
+Const MIXER_OBJECTF_HMIXER = (MIXER_OBJECTF_HANDLE OR MIXER_OBJECTF_MIXER)
+Const MIXER_OBJECTF_WAVEOUT = &H10000000
+Const MIXER_OBJECTF_HWAVEOUT = (MIXER_OBJECTF_HANDLE OR MIXER_OBJECTF_WAVEOUT)
+Const MIXER_OBJECTF_WAVEIN = &H20000000
+Const MIXER_OBJECTF_HWAVEIN = (MIXER_OBJECTF_HANDLE OR MIXER_OBJECTF_WAVEIN)
+Const MIXER_OBJECTF_MIDIOUT = &H30000000
+Const MIXER_OBJECTF_HMIDIOUT = (MIXER_OBJECTF_HANDLE OR MIXER_OBJECTF_MIDIOUT)
+Const MIXER_OBJECTF_MIDIIN = &H40000000
+Const MIXER_OBJECTF_HMIDIIN = (MIXER_OBJECTF_HANDLE OR MIXER_OBJECTF_MIDIIN)
+Const MIXER_OBJECTF_AUX = &H50000000
+
+Declare Function mixerGetNumDevs Lib "winmm" () As DWord
+
+Type MIXERCAPSW
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As WCHAR
+	fdwSupport As DWord
+	cDestinations As DWord
+End Type
+TypeDef PMIXERCAPSW = *MIXERCAPSW
+TypeDef LPMIXERCAPSW = *MIXERCAPSW
+
+Type MIXERCAPSA
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As SByte
+	fdwSupport As DWord
+	cDestinations As DWord
+End Type
+TypeDef PMIXERCAPSA = *MIXERCAPSA
+TypeDef LPMIXERCAPSA = *MIXERCAPSA
+
+#ifdef UNICODE
+TypeDef MIXERCAPS = MIXERCAPSW
+TypeDef PMIXERCAPS = PMIXERCAPSW
+TypeDef LPMIXERCAPS = LPMIXERCAPSW
+Declare Function mixerGetDevCaps Lib "winmm" Alias "mixerGetDevCapsW" (uMxId As DWord, pmxcaps As *MIXERCAPSW, cbmxcaps As DWord) As MMRESULT
+#else
+TypeDef MIXERCAPS = MIXERCAPSA
+TypeDef PMIXERCAPS = PMIXERCAPSA
+TypeDef LPMIXERCAPS = LPMIXERCAPSA
+Declare Function mixerGetDevCaps Lib "winmm" Alias "mixerGetDevCapsA" (uMxId As DWord, pmxcaps As *MIXERCAPS, cbmxcaps As DWord) As MMRESULT
+#endif
+
+Declare Function mixerOpen Lib "winmm" (phmx As *HMIXER, uMxId As DWord, dwCallback As DWord, dwInstance As DWord, fdwOpen As DWord) As MMRESULT
+Declare Function mixerClose Lib "winmm" (hmx As HMIXER) As MMRESULT
+Declare Function mixerMessage Lib "winmm" (hmx As HMIXER, uMsg As DWord, dwParam1 As DWord, dwParam2 As DWord) As DWord
+
+#ifdef UNICODE
+Type TARGET
+	dwType As DWord
+	dwDeviceID As DWord
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As WCHAR
+End Type
+#else
+Type TARGET
+	dwType As DWord
+	dwDeviceID As DWord
+	wMid As Word
+	wPid As Word
+	vDriverVersion As MMVERSION
+	szPname[ELM(MAXPNAMELEN)] As SByte
+End Type
+#endif
+
+Type MIXERLINEW
+	cbStruct As DWord
+	dwDestination As DWord
+	dwSource As DWord
+	dwLineID As DWord
+	fdwLine As DWord
+	dwUser As DWord
+	dwComponentType As DWord
+	cChannels As DWord
+	cConnections As DWord
+	cControls As DWord
+	szShortName[ELM(MIXER_SHORT_NAME_CHARS)] As WCHAR
+	szName[ELM(MIXER_LONG_NAME_CHARS)] As WCHAR
+	Target As TARGET
+End Type
+TypeDef PMIXERLINEW = *MIXERLINEW
+TypeDef LPMIXERLINEW = *MIXERLINEW
+
+Type MIXERLINEA
+	cbStruct As DWord
+	dwDestination As DWord
+	dwSource As DWord
+	dwLineID As DWord
+	fdwLine As DWord
+	dwUser As DWord
+	dwComponentType As DWord
+	cChannels As DWord
+	cConnections As DWord
+	cControls As DWord
+	szShortName[ELM(MIXER_SHORT_NAME_CHARS)] As SByte
+	szName[ELM(MIXER_LONG_NAME_CHARS)] As SByte
+	Target As TARGET
+End Type
+TypeDef PMIXERLINEA = *MIXERLINEA
+TypeDef LPMIXERLINEA = *MIXERLINEA
+
+#ifdef UNICODE
+TypeDef MIXERLINE = MIXERLINEA
+TypeDef PMIXERLINE = PMIXERLINEA
+TypeDef LPMIXERLINE = LPMIXERLINEA
+#else
+TypeDef MIXERLINE = MIXERLINEW
+TypeDef PMIXERLINE = PMIXERLINEW
+TypeDef LPMIXERLINE = LPMIXERLINEW
+#endif
+
+' MIXERLINE.fdwLine
+Const MIXERLINE_LINEF_ACTIVE = &H00000001
+Const MIXERLINE_LINEF_DISCONNECTED = &H00008000
+Const MIXERLINE_LINEF_SOURCE = &H80000000
+
+' MIXERLINE.dwComponentType
+Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H00000000
+Const MIXERLINE_COMPONENTTYPE_DST_UNDEFINED = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 0)
+Const MIXERLINE_COMPONENTTYPE_DST_DIGITAL = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 1)
+Const MIXERLINE_COMPONENTTYPE_DST_LINE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 2)
+Const MIXERLINE_COMPONENTTYPE_DST_MONITOR = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 3)
+Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4)
+Const MIXERLINE_COMPONENTTYPE_DST_HEADPHONES = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 5)
+Const MIXERLINE_COMPONENTTYPE_DST_TELEPHONE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 6)
+Const MIXERLINE_COMPONENTTYPE_DST_WAVEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7)
+Const MIXERLINE_COMPONENTTYPE_DST_VOICEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8)
+Const MIXERLINE_COMPONENTTYPE_DST_LAST = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8)
+
+Const MIXERLINE_COMPONENTTYPE_SRC_FIRST = &H00001000
+Const MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0)
+Const MIXERLINE_COMPONENTTYPE_SRC_DIGITAL = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1)
+Const MIXERLINE_COMPONENTTYPE_SRC_LINE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2)
+Const MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3)
+Const MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4)
+Const MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5)
+Const MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6)
+Const MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7)
+Const MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8)
+Const MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9)
+Const MIXERLINE_COMPONENTTYPE_SRC_ANALOG = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10)
+Const MIXERLINE_COMPONENTTYPE_SRC_LAST = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10)
+
+' MIXERLINE.Target.dwType
+Const MIXERLINE_TARGETTYPE_UNDEFINED = 0
+Const MIXERLINE_TARGETTYPE_WAVEOUT = 1
+Const MIXERLINE_TARGETTYPE_WAVEIN = 2
+Const MIXERLINE_TARGETTYPE_MIDIOUT = 3
+Const MIXERLINE_TARGETTYPE_MIDIIN = 4
+Const MIXERLINE_TARGETTYPE_AUX = 5
+
+#ifdef UNICODE
+Declare Function mixerGetLineInfo Lib "winmm" Alias "mixerGetLineInfoW" (hmxobj As HMIXEROBJ, pmxl As *MIXERLINEW, fdwInfo As DWord) As MMRESULT
+#else
+Declare Function mixerGetLineInfo Lib "winmm" Alias "mixerGetLineInfoA" (hmxobj As HMIXEROBJ, pmxl As *MIXERLINE, fdwInfo As DWord) As MMRESULT
+#endif
+
+Const MIXER_GETLINEINFOF_DESTINATION = &H00000000
+Const MIXER_GETLINEINFOF_SOURCE = &H00000001
+Const MIXER_GETLINEINFOF_LINEID = &H00000002
+Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H00000003
+Const MIXER_GETLINEINFOF_TARGETTYPE = &H00000004
+Const MIXER_GETLINEINFOF_QUERYMASK = &H0000000F
+
+Declare Function mixerGetID Lib "winmm" (hmxobj As HMIXEROBJ, puMxId As *DWord, fdwId As DWord) As MMRESULT
+
+Type MIXERCONTROLW
+	cbStruct As DWord
+	dwControlID As DWord
+	dwControlType As DWord
+	fdwControl As DWord
+	cMultipleItems As DWord
+	szShortName[ELM(MIXER_SHORT_NAME_CHARS)] As WCHAR
+	szName[ELM(MIXER_LONG_NAME_CHARS)] As WCHAR
+	Bounds[ELM(6)] As DWord
+	Metrics[ELM(6)] As DWord
+End Type
+TypeDef PMIXERCONTROLW = *MIXERCONTROLW
+TypeDef LPMIXERCONTROLW = *MIXERCONTROLW
+
+Type MIXERCONTROLA
+	cbStruct As DWord
+	dwControlID As DWord
+	dwControlType As DWord
+	fdwControl As DWord
+	cMultipleItems As DWord
+	szShortName[ELM(MIXER_SHORT_NAME_CHARS)] As SByte
+	szName[ELM(MIXER_LONG_NAME_CHARS)] As SByte
+	Bounds[ELM(6)] As DWord
+	Metrics[ELM(6)] As DWord
+End Type
+TypeDef PMIXERCONTROLA = *MIXERCONTROLA
+TypeDef LPMIXERCONTROLA = *MIXERCONTROLA
+
+#ifdef UNICODE
+TypeDef MIXERCONTROL = MIXERCONTROLW
+TypeDef PMIXERCONTROL = PMIXERCONTROLW
+TypeDef LPMIXERCONTROL = LPMIXERCONTROLW
+#else
+TypeDef MIXERCONTROL = MIXERCONTROLA
+TypeDef PMIXERCONTROL = PMIXERCONTROLA
+TypeDef LPMIXERCONTROL = LPMIXERCONTROLA
+#endif
+
+' MIXERCONTROL.fdwControl
+Const MIXERCONTROL_CONTROLF_UNIFORM = &H00000001
+Const MIXERCONTROL_CONTROLF_MULTIPLE = &H00000002
+Const MIXERCONTROL_CONTROLF_DISABLED = &H80000000
+
+' MIXERCONTROL_CONTROLTYPE_xxx
+Const MIXERCONTROL_CT_CLASS_MASK = &HF0000000
+Const MIXERCONTROL_CT_CLASS_CUSTOM = &H00000000
+Const MIXERCONTROL_CT_CLASS_METER = &H10000000
+Const MIXERCONTROL_CT_CLASS_SWITCH = &H20000000
+Const MIXERCONTROL_CT_CLASS_NUMBER = &H30000000
+Const MIXERCONTROL_CT_CLASS_SLIDER = &H40000000
+Const MIXERCONTROL_CT_CLASS_FADER = &H50000000
+Const MIXERCONTROL_CT_CLASS_TIME = &H60000000
+Const MIXERCONTROL_CT_CLASS_LIST = &H70000000
+Const MIXERCONTROL_CT_SUBCLASS_MASK = &H0F000000
+Const MIXERCONTROL_CT_SC_SWITCH_BOOLEAN = &H00000000
+Const MIXERCONTROL_CT_SC_SWITCH_BUTTON = &H01000000
+Const MIXERCONTROL_CT_SC_METER_POLLED = &H00000000
+Const MIXERCONTROL_CT_SC_TIME_MICROSECS = &H00000000
+Const MIXERCONTROL_CT_SC_TIME_MILLISECS = &H01000000
+Const MIXERCONTROL_CT_SC_LIST_SINGLE = &H00000000
+Const MIXERCONTROL_CT_SC_LIST_MULTIPLE = &H01000000
+Const MIXERCONTROL_CT_UNITS_MASK = &H00FF0000
+Const MIXERCONTROL_CT_UNITS_CUSTOM = &H00000000
+Const MIXERCONTROL_CT_UNITS_BOOLEAN = &H00010000
+Const MIXERCONTROL_CT_UNITS_SIGNED = &H00020000
+Const MIXERCONTROL_CT_UNITS_UNSIGNED = &H00030000
+Const MIXERCONTROL_CT_UNITS_DECIBELS = &H00040000
+Const MIXERCONTROL_CT_UNITS_PERCENT = &H00050000
+
+' MIXERCONTROL.dwControlType
+Const MIXERCONTROL_CONTROLTYPE_CUSTOM = (MIXERCONTROL_CT_CLASS_CUSTOM OR MIXERCONTROL_CT_UNITS_CUSTOM)
+Const MIXERCONTROL_CONTROLTYPE_BOOLEANMETER = (MIXERCONTROL_CT_CLASS_METER OR MIXERCONTROL_CT_SC_METER_POLLED OR MIXERCONTROL_CT_UNITS_BOOLEAN)
+Const MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER OR MIXERCONTROL_CT_SC_METER_POLLED OR MIXERCONTROL_CT_UNITS_SIGNED)
+Const MIXERCONTROL_CONTROLTYPE_PEAKMETER = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1)
+Const MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER OR MIXERCONTROL_CT_SC_METER_POLLED OR MIXERCONTROL_CT_UNITS_UNSIGNED)
+Const MIXERCONTROL_CONTROLTYPE_BOOLEAN = (MIXERCONTROL_CT_CLASS_SWITCH OR MIXERCONTROL_CT_SC_SWITCH_BOOLEAN OR MIXERCONTROL_CT_UNITS_BOOLEAN)
+Const MIXERCONTROL_CONTROLTYPE_ONOFF = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1)
+Const MIXERCONTROL_CONTROLTYPE_MUTE = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2)
+Const MIXERCONTROL_CONTROLTYPE_MONO = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3)
+Const MIXERCONTROL_CONTROLTYPE_LOUDNESS = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4)
+Const MIXERCONTROL_CONTROLTYPE_STEREOENH = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5)
+Const MIXERCONTROL_CONTROLTYPE_BUTTON = (MIXERCONTROL_CT_CLASS_SWITCH OR MIXERCONTROL_CT_SC_SWITCH_BUTTON OR MIXERCONTROL_CT_UNITS_BOOLEAN)
+Const MIXERCONTROL_CONTROLTYPE_DECIBELS = (MIXERCONTROL_CT_CLASS_NUMBER OR MIXERCONTROL_CT_UNITS_DECIBELS)
+Const MIXERCONTROL_CONTROLTYPE_SIGNED = (MIXERCONTROL_CT_CLASS_NUMBER OR MIXERCONTROL_CT_UNITS_SIGNED)
+Const MIXERCONTROL_CONTROLTYPE_UNSIGNED = (MIXERCONTROL_CT_CLASS_NUMBER OR MIXERCONTROL_CT_UNITS_UNSIGNED)
+Const MIXERCONTROL_CONTROLTYPE_PERCENT = (MIXERCONTROL_CT_CLASS_NUMBER OR MIXERCONTROL_CT_UNITS_PERCENT)
+Const MIXERCONTROL_CONTROLTYPE_SLIDER = (MIXERCONTROL_CT_CLASS_SLIDER OR MIXERCONTROL_CT_UNITS_SIGNED)
+Const MIXERCONTROL_CONTROLTYPE_PAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 1)
+Const MIXERCONTROL_CONTROLTYPE_QSOUNDPAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 2)
+Const MIXERCONTROL_CONTROLTYPE_FADER = (MIXERCONTROL_CT_CLASS_FADER OR MIXERCONTROL_CT_UNITS_UNSIGNED)
+Const MIXERCONTROL_CONTROLTYPE_VOLUME = (MIXERCONTROL_CONTROLTYPE_FADER + 1)
+Const MIXERCONTROL_CONTROLTYPE_BASS = (MIXERCONTROL_CONTROLTYPE_FADER + 2)
+Const MIXERCONTROL_CONTROLTYPE_TREBLE = (MIXERCONTROL_CONTROLTYPE_FADER + 3)
+Const MIXERCONTROL_CONTROLTYPE_EQUALIZER = (MIXERCONTROL_CONTROLTYPE_FADER + 4)
+Const MIXERCONTROL_CONTROLTYPE_SINGLESELECT = (MIXERCONTROL_CT_CLASS_LIST OR MIXERCONTROL_CT_SC_LIST_SINGLE OR MIXERCONTROL_CT_UNITS_BOOLEAN)
+Const MIXERCONTROL_CONTROLTYPE_MUX = (MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1)
+Const MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = (MIXERCONTROL_CT_CLASS_LIST OR MIXERCONTROL_CT_SC_LIST_MULTIPLE OR MIXERCONTROL_CT_UNITS_BOOLEAN)
+Const MIXERCONTROL_CONTROLTYPE_MIXER = (MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1)
+Const MIXERCONTROL_CONTROLTYPE_MICROTIME = (MIXERCONTROL_CT_CLASS_TIME OR MIXERCONTROL_CT_SC_TIME_MICROSECS OR MIXERCONTROL_CT_UNITS_UNSIGNED)
+Const MIXERCONTROL_CONTROLTYPE_MILLITIME = (MIXERCONTROL_CT_CLASS_TIME OR MIXERCONTROL_CT_SC_TIME_MILLISECS OR MIXERCONTROL_CT_UNITS_UNSIGNED)
+
+Type MIXERLINECONTROLSW
+	cbStruct As DWord
+	dwLineID As DWord
+	dwControl_ID_Type As DWord
+	cControls As DWord
+	cbmxctrl As DWord
+	pamxctrl As *MIXERCONTROLW
+End Type
+TypeDef PMIXERLINECONTROLSW = *MIXERLINECONTROLSW
+TypeDef LPMIXERLINECONTROLSW = *MIXERLINECONTROLSW
+
+Type MIXERLINECONTROLSA
+	cbStruct As DWord
+	dwLineID As DWord
+	dwControl_ID_Type As DWord
+	cControls As DWord
+	cbmxctrl As DWord
+	pamxctrl As *MIXERCONTROL
+End Type
+TypeDef PMIXERLINECONTROLSA = *MIXERLINECONTROLSA
+TypeDef LPMIXERLINECONTROLSA = *MIXERLINECONTROLSA
+
+#ifdef UNICODE
+TypeDef MIXERLINECONTROLS = MIXERLINECONTROLSW
+TypeDef PMIXERLINECONTROLS = PMIXERLINECONTROLSW
+TypeDef LPMIXERLINECONTROLS = LPMIXERLINECONTROLSW
+Declare Function mixerGetLineControls Lib "winmm" Alias "mixerGetLineControlsA" (hmxobj As HMIXEROBJ, pmxlc As *MIXERLINECONTROLSW, fdwControls As DWord) As MMRESULT
+#else
+TypeDef MIXERLINECONTROLS = MIXERLINECONTROLSA
+TypeDef PMIXERLINECONTROLS = PMIXERLINECONTROLSA
+TypeDef LPMIXERLINECONTROLS = LPMIXERLINECONTROLSA
+Declare Function mixerGetLineControls Lib "winmm" Alias "mixerGetLineControlsA" (hmxobj As HMIXEROBJ, pmxlc As *MIXERLINECONTROLS, fdwControls As DWord) As MMRESULT
+#endif
+
+Const MIXER_GETLINECONTROLSF_ALL = &H00000000
+Const MIXER_GETLINECONTROLSF_ONEBYID = &H00000001
+Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H00000002
+Const MIXER_GETLINECONTROLSF_QUERYMASK = &H0000000F
+
+Type MIXERCONTROLDETAILS
+	cbStruct As DWord
+	dwControlID As DWord
+	cChannels As DWord
+	cMultipleItems As DWord
+	cbDetails As DWord
+	paDetails As VoidPtr
+End Type
+TypeDef PMIXERCONTROLDETAILS = *MIXERCONTROLDETAILS
+TypeDef LPMIXERCONTROLDETAILS = *MIXERCONTROLDETAILS
+
+Type MIXERCONTROLDETAILS_LISTTEXTW
+	dwParam1 As DWord
+	dwParam2 As DWord
+	szName[ELM(MIXER_LONG_NAME_CHARS)] As WCHAR
+End Type
+TypeDef PMIXERCONTROLDETAILS_LISTTEXTW = *MIXERCONTROLDETAILS_LISTTEXTW
+TypeDef LPMIXERCONTROLDETAILS_LISTTEXTW = *MIXERCONTROLDETAILS_LISTTEXTW
+
+Type MIXERCONTROLDETAILS_LISTTEXTA
+	dwParam1 As DWord
+	dwParam2 As DWord
+	szName[ELM(MIXER_LONG_NAME_CHARS)] As SByte
+End Type
+TypeDef PMIXERCONTROLDETAILS_LISTTEXTA = *MIXERCONTROLDETAILS_LISTTEXTA
+TypeDef LPMIXERCONTROLDETAILS_LISTTEXTA = *MIXERCONTROLDETAILS_LISTTEXTA
+
+#ifdef UNICODE
+TypeDef MIXERCONTROLDETAILS_LISTTEXT = MIXERCONTROLDETAILS_LISTTEXTW
+TypeDef PMIXERCONTROLDETAILS_LISTTEXT = PMIXERCONTROLDETAILS_LISTTEXTW
+TypeDef LPMIXERCONTROLDETAILS_LISTTEXT = LPMIXERCONTROLDETAILS_LISTTEXTW
+#else
+TypeDef MIXERCONTROLDETAILS_LISTTEXT = MIXERCONTROLDETAILS_LISTTEXTA
+TypeDef PMIXERCONTROLDETAILS_LISTTEXT = PMIXERCONTROLDETAILS_LISTTEXTA
+TypeDef LPMIXERCONTROLDETAILS_LISTTEXT = LPMIXERCONTROLDETAILS_LISTTEXTA
+#endif
+
+Type MIXERCONTROLDETAILS_BOOLEAN
+	fValue As Long
+End Type
+TypeDef PMIXERCONTROLDETAILS_BOOLEAN = *MIXERCONTROLDETAILS_BOOLEAN
+TypeDef LPMIXERCONTROLDETAILS_BOOLEAN = *MIXERCONTROLDETAILS_BOOLEAN
+
+Type MIXERCONTROLDETAILS_SIGNED
+	lValue As Long
+End Type
+TypeDef PMIXERCONTROLDETAILS_SIGNED = *MIXERCONTROLDETAILS_SIGNED
+TypeDef LPMIXERCONTROLDETAILS_SIGNED = *MIXERCONTROLDETAILS_SIGNED
+
+Type MIXERCONTROLDETAILS_UNSIGNED
+	dwValue As DWord
+End Type
+TypeDef PMIXERCONTROLDETAILS_UNSIGNED = *MIXERCONTROLDETAILS_UNSIGNED
+TypeDef LPMIXERCONTROLDETAILS_UNSIGNED = *MIXERCONTROLDETAILS_UNSIGNED
+
+Declare Function mixerGetControlDetailsA Lib "winmm" (hmxobj As HMIXEROBJ, pmxcd As *MIXERCONTROLDETAILS, fdwDetails As DWord) As MMRESULT
+Declare Function mixerGetControlDetailsW Lib "winmm" (hmxobj As HMIXEROBJ, pmxcd As *MIXERCONTROLDETAILS, fdwDetails As DWord) As MMRESULT
+#ifdef UNICODE
+Declare Function mixerGetControlDetails Lib "winmm" Alias "mixerGetControlDetailsW" (hmxobj As HMIXEROBJ, pmxcd As *MIXERCONTROLDETAILS, fdwDetails As DWord) As MMRESULT
+#else
+Declare Function mixerGetControlDetails Lib "winmm" Alias "mixerGetControlDetailsA" (hmxobj As HMIXEROBJ, pmxcd As *MIXERCONTROLDETAILS, fdwDetails As DWord) As MMRESULT
+#endif
+
+Const MIXER_GETCONTROLDETAILSF_VALUE = &H00000000
+Const MIXER_GETCONTROLDETAILSF_LISTTEXT = &H00000001
+Const MIXER_GETCONTROLDETAILSF_QUERYMASK = &H0000000F
+
+Declare Function mixerSetControlDetails Lib "winmm" (hmxobj As HMIXEROBJ, pmxcd As *MIXERCONTROLDETAILS, fdwDetails As DWord) As MMRESULT
+
+Const MIXER_SETCONTROLDETAILSF_VALUE = &H00000000
+Const MIXER_SETCONTROLDETAILSF_CUSTOM = &H00000001
+Const MIXER_SETCONTROLDETAILSF_QUERYMASK = &H0000000F
+
+
+'--------------------------------------------------------
+' Timer support
+
+' timer error
+Const TIMERR_NOERROR = (0)
+Const TIMERR_NOCANDO = (TIMERR_BASE+1)
+Const TIMERR_STRUCT = (TIMERR_BASE+33)
+
+TypeDef LPTIMECALLBACK = *Sub(uTimerID As DWord, uMsg As DWord, dwUser As DWord, dw1 As DWord, dw2 As DWord)
+
+Const TIME_ONESHOT = &H0000
+Const TIME_PERIODIC = &H0001
+
+Const TIME_CALLBACK_FUNCTION = &H0000
+Const TIME_CALLBACK_EVENT_SET = &H0010
+Const TIME_CALLBACK_EVENT_PULSE = &H0020
+
+' timer device capabilities data structure
+Type TIMECAPS
+	wPeriodMin As DWord
+	wPeriodMax As DWord
+End Type
+TypeDef PTIMECAPS = *TIMECAPS
+TypeDef NPTIMECAPS = *TIMECAPS
+TypeDef LPTIMECAPS = *TIMECAPS
+
+' timer function prototypes
+Declare Function timeGetSystemTime Lib "winmm" (pmmt As *MMTIME, cbmmt As DWord) As MMRESULT
+Declare Function timeGetTime Lib "winmm" () As DWord
+Declare Function timeSetEvent Lib "winmm" (uDelay As DWord, uResolution As DWord, fptc As LPTIMECALLBACK, dwUser As DWord, fuEvent As DWord) As MMRESULT
+Declare Function timeKillEvent Lib "winmm" (uTimerID As DWord) As MMRESULT
+Declare Function timeGetDevCaps Lib "winmm" (ptc As *TIMECAPS, cbtc As DWord) As MMRESULT
+Declare Function timeBeginPeriod Lib "winmm" (uPeriod As DWord) As MMRESULT
+Declare Function timeEndPeriod Lib "winmm" (uPeriod As DWord) As MMRESULT
+
+
+'--------------------------------------------------------
+' Joystick support
+
+' joystick error
+Const JOYERR_NOERROR = (0)
+Const JOYERR_PARMS = (JOYERR_BASE+5)
+Const JOYERR_NOCANDO = (JOYERR_BASE+6)
+Const JOYERR_UNPLUGGED = (JOYERR_BASE+7)
+
+' constants used with JOYINFO and JOYINFOEX structures and MM_JOY* messages
+Const JOY_BUTTON1 = &H0001
+Const JOY_BUTTON2 = &H0002
+Const JOY_BUTTON3 = &H0004
+Const JOY_BUTTON4 = &H0008
+Const JOY_BUTTON1CHG = &H0100
+Const JOY_BUTTON2CHG = &H0200
+Const JOY_BUTTON3CHG = &H0400
+Const JOY_BUTTON4CHG = &H0800
+
+' constants used with JOYINFOEX
+Const JOY_BUTTON5 = &H00000010
+Const JOY_BUTTON6 = &H00000020
+Const JOY_BUTTON7 = &H00000040
+Const JOY_BUTTON8 = &H00000080
+Const JOY_BUTTON9 = &H00000100
+Const JOY_BUTTON10 = &H00000200
+Const JOY_BUTTON11 = &H00000400
+Const JOY_BUTTON12 = &H00000800
+Const JOY_BUTTON13 = &H00001000
+Const JOY_BUTTON14 = &H00002000
+Const JOY_BUTTON15 = &H00004000
+Const JOY_BUTTON16 = &H00008000
+Const JOY_BUTTON17 = &H00010000
+Const JOY_BUTTON18 = &H00020000
+Const JOY_BUTTON19 = &H00040000
+Const JOY_BUTTON20 = &H00080000
+Const JOY_BUTTON21 = &H00100000
+Const JOY_BUTTON22 = &H00200000
+Const JOY_BUTTON23 = &H00400000
+Const JOY_BUTTON24 = &H00800000
+Const JOY_BUTTON25 = &H01000000
+Const JOY_BUTTON26 = &H02000000
+Const JOY_BUTTON27 = &H04000000
+Const JOY_BUTTON28 = &H08000000
+Const JOY_BUTTON29 = &H10000000
+Const JOY_BUTTON30 = &H20000000
+Const JOY_BUTTON31 = &H40000000
+Const JOY_BUTTON32 = &H80000000
+
+' constants used with JOYINFOEX structure
+Const JOY_POVCENTERED = (-1)
+Const JOY_POVFORWARD = 0
+Const JOY_POVRIGHT = 9000
+Const JOY_POVBACKWARD = 18000
+Const JOY_POVLEFT = 27000
+
+Const JOY_RETURNX = &H00000001
+Const JOY_RETURNY = &H00000002
+Const JOY_RETURNZ = &H00000004
+Const JOY_RETURNR = &H00000008
+Const JOY_RETURNU = &H00000010
+Const JOY_RETURNV = &H00000020
+Const JOY_RETURNPOV = &H00000040
+Const JOY_RETURNBUTTONS = &H00000080
+Const JOY_RETURNRAWDATA = &H00000100
+Const JOY_RETURNPOVCTS = &H00000200
+Const JOY_RETURNCENTERED = &H00000400
+Const JOY_USEDEADZONE = &H00000800
+Const JOY_RETURNALL = (JOY_RETURNX OR JOY_RETURNY OR JOY_RETURNZ OR JOY_RETURNR OR JOY_RETURNU OR JOY_RETURNV OR JOY_RETURNPOV OR JOY_RETURNBUTTONS)
+Const JOY_CAL_READALWAYS = &H00010000
+Const JOY_CAL_READXYONLY = &H00020000
+Const JOY_CAL_READ3 = &H00040000
+Const JOY_CAL_READ4 = &H00080000
+Const JOY_CAL_READXONLY = &H00100000
+Const JOY_CAL_READYONLY = &H00200000
+Const JOY_CAL_READ5 = &H00400000
+Const JOY_CAL_READ6 = &H00800000
+Const JOY_CAL_READZONLY = &H01000000
+Const JOY_CAL_READRONLY = &H02000000
+Const JOY_CAL_READUONLY = &H04000000
+Const JOY_CAL_READVONLY = &H08000000
+
+' joystick ID constants
+Const JOYSTICKID1 = 0
+Const JOYSTICKID2 = 1
+
+' joystick driver capabilites
+Const JOYCAPS_HASZ = &H0001
+Const JOYCAPS_HASR = &H0002
+Const JOYCAPS_HASU = &H0004
+Const JOYCAPS_HASV = &H0008
+Const JOYCAPS_HASPOV = &H0010
+Const JOYCAPS_POV4DIR = &H0020
+Const JOYCAPS_POVCTS = &H0040
+
+Type JOYCAPSW
+	wMid As Word
+	wPid As Word
+	szPname[ELM(MAXPNAMELEN)] As WCHAR
+	wXmin As DWord
+	wXmax As DWord
+	wYmin As DWord
+	wYmax As DWord
+	wZmin As DWord
+	wZmax As DWord
+	wNumButtons As DWord
+	wPeriodMin As DWord
+	wPeriodMax As DWord
+	wRmin As DWord
+	wRmax As DWord
+	wUmin As DWord
+	wUmax As DWord
+	wVmin As DWord
+	wVmax As DWord
+	wCaps As DWord
+	wMaxAxes As DWord
+	wNumAxes As DWord
+	wMaxButtons As DWord
+	szRegKey[ELM(MAXPNAMELEN)] As WCHAR
+	szOEMVxD[ELM(MAX_JOYSTICKOEMVXDNAME)] As WCHAR
+End Type
+TypeDef PJOYCAPSW = *JOYCAPSW
+TypeDef NPJOYCAPSW = *JOYCAPSW
+TypeDef LPJOYCAPSW = *JOYCAPSW
+
+Type JOYCAPSA
+	wMid As Word
+	wPid As Word
+	szPname[ELM(MAXPNAMELEN)] As SByte
+	wXmin As DWord
+	wXmax As DWord
+	wYmin As DWord
+	wYmax As DWord
+	wZmin As DWord
+	wZmax As DWord
+	wNumButtons As DWord
+	wPeriodMin As DWord
+	wPeriodMax As DWord
+	wRmin As DWord
+	wRmax As DWord
+	wUmin As DWord
+	wUmax As DWord
+	wVmin As DWord
+	wVmax As DWord
+	wCaps As DWord
+	wMaxAxes As DWord
+	wNumAxes As DWord
+	wMaxButtons As DWord
+	szRegKey[ELM(MAXPNAMELEN)] As SByte
+	szOEMVxD[ELM(MAX_JOYSTICKOEMVXDNAME)] As SByte
+End Type
+TypeDef PJOYCAPSA = *JOYCAPSA
+TypeDef NPJOYCAPSA = *JOYCAPSA
+TypeDef LPJOYCAPSA = *JOYCAPSA
+
+#ifdef UNICODE
+TypeDef JOYCAPS = JOYCAPSW
+TypeDef PJOYCAPS = PJOYCAPSW
+TypeDef NPJOYCAPS = NPJOYCAPSW
+TypeDef LPJOYCAPS = LPJOYCAPSW
+#else
+TypeDef JOYCAPS = JOYCAPSA
+TypeDef PJOYCAPS = PJOYCAPSA
+TypeDef NPJOYCAPS = NPJOYCAPSA
+TypeDef LPJOYCAPS = LPJOYCAPSA
+#endif
+
+Type JOYINFO
+	wXpos As DWord
+	wYpos As DWord
+	wZpos As DWord
+	wButtons As DWord
+End Type
+TypeDef PJOYINFO = *JOYINFO
+TypeDef NPJOYINFO = *JOYINFO
+TypeDef LPJOYINFO = *JOYINFO
+
+Type JOYINFOEX
+	dwSize As DWord
+	dwFlags As DWord
+	dwXpos As DWord
+	dwYpos As DWord
+	dwZpos As DWord
+	dwRpos As DWord
+	dwUpos As DWord
+	dwVpos As DWord
+	dwButtons As DWord
+	dwButtonNumber As DWord
+	dwPOV As DWord
+	dwReserved1 As DWord
+	dwReserved2 As DWord
+End Type
+TypeDef PJOYINFOEX = *JOYINFOEX
+TypeDef NPJOYINFOEX = *JOYINFOEX
+TypeDef LPJOYINFOEX = *JOYINFOEX
+
+' joystick function prototypes
+Declare Function joyGetNumDevs Lib "winmm" () As DWord
+#ifdef UNICODE
+Declare Function joyGetDevCaps Lib "winmm" Alias "joyGetDevCapsW" (uJoyID As DWord, pjc As *JOYCAPSW, cbjc As DWord) As MMRESULT
+#else
+Declare Function joyGetDevCaps Lib "winmm" Alias "joyGetDevCapsA" (uJoyID As DWord, pjc As *JOYCAPS, cbjc As DWord) As MMRESULT
+#endif
+Declare Function joyGetPos Lib "winmm" (uJoyID As DWord, pji As *JOYINFO) As MMRESULT
+Declare Function joyGetPosEx Lib "winmm" (uJoyID As DWord, pji As *JOYINFOEX) As MMRESULT
+Declare Function joyGetThreshold Lib "winmm" (uJoyID As DWord, puThreshold As *DWord) As MMRESULT
+Declare Function joyReleaseCapture Lib "winmm" (uJoyID As DWord) As MMRESULT
+Declare Function joySetCapture Lib "winmm" (hwnd As HWND, uJoyID As DWord, uPeriod As DWord, fChanged As BOOL) As MMRESULT
+Declare Function joySetThreshold Lib "winmm" (uJoyID As DWord, uThreshold As DWord) As MMRESULT
+
+
+'--------------------------------------------------------
+' Multimedia File I/O support
+
+' MMIO error return values
+Const MMIOERR_BASE = 256
+Const MMIOERR_FILENOTFOUND = (MMIOERR_BASE + 1)
+Const MMIOERR_OUTOFMEMORY = (MMIOERR_BASE + 2)
+Const MMIOERR_CANNOTOPEN = (MMIOERR_BASE + 3)
+Const MMIOERR_CANNOTCLOSE = (MMIOERR_BASE + 4)
+Const MMIOERR_CANNOTREAD = (MMIOERR_BASE + 5)
+Const MMIOERR_CANNOTWRITE = (MMIOERR_BASE + 6)
+Const MMIOERR_CANNOTSEEK = (MMIOERR_BASE + 7)
+Const MMIOERR_CANNOTEXPAND = (MMIOERR_BASE + 8)
+Const MMIOERR_CHUNKNOTFOUND = (MMIOERR_BASE + 9)
+Const MMIOERR_UNBUFFERED = (MMIOERR_BASE + 10)
+Const MMIOERR_PATHNOTFOUND = (MMIOERR_BASE + 11)
+Const MMIOERR_ACCESSDENIED = (MMIOERR_BASE + 12)
+Const MMIOERR_SHARINGVIOLATION = (MMIOERR_BASE + 13)
+Const MMIOERR_NETWORKERROR = (MMIOERR_BASE + 14)
+Const MMIOERR_TOOMANYOPENFILES = (MMIOERR_BASE + 15)
+Const MMIOERR_INVALIDFILE = (MMIOERR_BASE + 16)
+
+' MMIO constants
+Const CFSEPCHAR = "+"
+
+' MMIO data types
+TypeDef FOURCC = DWord
+TypeDef HPSTR = *Char
+TypeDef HMMIO = VoidPtr
+
+TypeDef LPMMIOPROC = *Function(lpmmioinfo As LPSTR, uMsg As DWord, lParam1 As LPARAM, lParam2 As LPARAM) As LRESULT
+
+Type MMIOINFO
+	dwFlags As DWord
+	fccIOProc As FOURCC
+	pIOProc As LPMMIOPROC
+	wErrorRet As DWord
+	htask As HTASK
+	cchBuffer As Long
+	pchBuffer As HPSTR
+	pchNext As HPSTR
+	pchEndRead As HPSTR
+	pchEndWrite As HPSTR
+	lBufOffset As Long
+	lDiskOffset As Long
+	adwInfo[ELM(3)] As DWord
+	dwReserved1 As DWord
+	dwReserved2 As DWord
+	hmmio As HMMIO
+End Type
+TypeDef PMMIOINFO = *MMIOINFO
+TypeDef NPMMIOINFO = *MMIOINFO
+TypeDef LPMMIOINFO = *MMIOINFO
+
+Type MMCKINFO
+	ckid As FOURCC
+	cksize As DWord
+	fccType As FOURCC
+	dwDataOffset As DWord
+	dwFlags As DWord
+End Type
+TypeDef PMMCKINFO = *MMCKINFO
+TypeDef NPMMCKINFO = *MMCKINFO
+TypeDef LPMMCKINFO = *MMCKINFO
+
+Const MMIO_RWMODE = &H00000003
+Const MMIO_SHAREMODE = &H00000070
+Const MMIO_CREATE = &H00001000
+Const MMIO_PARSE = &H00000100
+Const MMIO_DELETE = &H00000200
+Const MMIO_EXIST = &H00004000
+Const MMIO_ALLOCBUF = &H00010000
+Const MMIO_GETTEMP = &H00020000
+Const MMIO_DIRTY = &H10000000
+Const MMIO_READ = &H00000000
+Const MMIO_WRITE = &H00000001
+Const MMIO_READWRITE = &H00000002
+Const MMIO_COMPAT = &H00000000
+Const MMIO_EXCLUSIVE = &H00000010
+Const MMIO_DENYWRITE = &H00000020
+Const MMIO_DENYREAD = &H00000030
+Const MMIO_DENYNONE = &H00000040
+Const MMIO_FHOPEN = &H0010
+Const MMIO_EMPTYBUF = &H0010
+Const MMIO_TOUPPER = &H0010
+Const MMIO_INSTALLPROC = &H00010000
+Const MMIO_GLOBALPROC = &H10000000
+Const MMIO_REMOVEPROC = &H00020000
+Const MMIO_UNICODEPROC = &H01000000
+Const MMIO_FINDPROC = &H00040000
+Const MMIO_FINDCHUNK = &H0010
+Const MMIO_FINDRIFF = &H0020
+Const MMIO_FINDLIST = &H0040
+Const MMIO_CREATERIFF = &H0020
+Const MMIO_CREATELIST = &H0040
+
+Const MMIOM_READ = MMIO_READ
+Const MMIOM_WRITE = MMIO_WRITE
+Const MMIOM_SEEK = 2
+Const MMIOM_OPEN = 3
+Const MMIOM_CLOSE = 4
+Const MMIOM_WRITEFLUSH = 5
+Const MMIOM_RENAME = 6
+Const MMIOM_USER = &H8000
+
+Const FOURCC_RIFF = MAKEFOURCC(&H52, &H49, &H46, &H46)
+Const FOURCC_LIST = MAKEFOURCC(&H4C, &H49, &H53, &H54)
+Const FOURCC_DOS = MAKEFOURCC(&H44, &H4F, &H53, &H20)
+Const FOURCC_MEM = MAKEFOURCC(&H4D, &H45, &H4D, &H20)
+
+Const SEEK_SET = 0
+Const SEEK_CUR = 1
+Const SEEK_END = 2
+
+Const MMIO_DEFAULTBUFFER = 8192
+
+Function mmioFOURCC(ch0 As String, ch1 As String, ch2 As String, ch3 As String) As FOURCC
+	mmioFOURCC = MAKEFOURCC(Asc(ch0), Asc(ch1), Asc(ch2), Asc(ch3))
+End Function
+
+' MMIO function prototypes
+#ifdef UNICODE
+Declare Function mmioStringToFOURCC Lib "winmm" Alias "mmioStringToFOURCCW" (sz As LPWSTR, uFlags As DWord) As FOURCC
+Declare Function mmioInstallIOProc Lib "winmm" Alias "mmioInstallIOProcW" (fccIOProc As FOURCC, pIOProc As LPMMIOPROC, dwFlags As DWord) As LPMMIOPROC
+Declare Function mmioOpen Lib "winmm" Alias "mmioOpenW" (pszFileName As LPWSTR, pmmioinfo As *MMIOINFO, fdwOpen As DWord) As HMMIO
+Declare Function mmioRename Lib "winmm" Alias "mmioRenameW" (pszFileName As LPSTR, pszNewFileName As LPWSTR, pmmioinfo As *MMIOINFO, fdwRename As DWord) As MMRESULT
+#else
+Declare Function mmioStringToFOURCC Lib "winmm" Alias "mmioStringToFOURCCA" (sz As LPSTR, uFlags As DWord) As FOURCC
+Declare Function mmioInstallIOProc Lib "winmm" Alias "mmioInstallIOProcA" (fccIOProc As FOURCC, pIOProc As LPMMIOPROC, dwFlags As DWord) As LPMMIOPROC
+Declare Function mmioOpen Lib "winmm" Alias "mmioOpenA" (pszFileName As LPSTR, pmmioinfo As *MMIOINFO, fdwOpen As DWord) As HMMIO
+Declare Function mmioRename Lib "winmm" Alias "mmioRenameA" (pszFileName As LPSTR, pszNewFileName As LPSTR, pmmioinfo As *MMIOINFO, fdwRename As DWord) As MMRESULT
+#endif
+Declare Function mmioClose Lib "winmm" (hmmio As HMMIO, fuClose As DWord) As MMRESULT
+Declare Function mmioRead Lib "winmm" (hmmio As HMMIO, pch As HPSTR, cch As Long) As Long
+Declare Function mmioWrite Lib "winmm" (hmmio As HMMIO, pch As HPSTR, cch As Long) As Long
+Declare Function mmioSeek Lib "winmm" (hmmio As HMMIO, lOffset As Long, iOrigin As Long) As Long
+Declare Function mmioGetInfo Lib "winmm" (hmmio As HMMIO, pmmioinfo As *MMIOINFO, fuInfo As DWord) As MMRESULT
+Declare Function mmioSetInfo Lib "winmm" (hmmio As HMMIO, pmmioinfo As *MMIOINFO, fuInfo As DWord) As MMRESULT
+Declare Function mmioSetBuffer Lib "winmm" (hmmio As HMMIO, pchBuffer As LPSTR, cchBuffer As Long, fuBuffer As DWord) As MMRESULT
+Declare Function mmioFlush Lib "winmm" (hmmio As HMMIO, fuFlush As DWord) As MMRESULT
+Declare Function mmioAdvance Lib "winmm" (hmmio As HMMIO, pmmioinfo As *MMIOINFO, fuAdvance As DWord) As MMRESULT
+Declare Function mmioSendMessage Lib "winmm" (hmmio As HMMIO, uMsg As DWord, lParam1 As LPARAM, lParam2 As LPARAM) As LRESULT
+Declare Function mmioDescend Lib "winmm" (hmmio As HMMIO, pmmcki As *MMCKINFO, pmmckiParent As *MMCKINFO, fuDescend As DWord) As MMRESULT
+Declare Function mmioAscend Lib "winmm" (hmmio As HMMIO, pmmcki As *MMCKINFO, fuAscend As DWord) As MMRESULT
+Declare Function mmioCreateChunk Lib "winmm" (hmmio As HMMIO, pmmcki As *MMCKINFO, fuCreate As DWord) As MMRESULT
+
+
+'--------------------------------------------------------
+' MCI support
+
+TypeDef MCIERROR = DWord
+TypeDef MCIDEVICEID = DWord
+TypeDef YIELDPROC = *Function(mciId As MCIDEVICEID, dwYieldData As DWord) As DWord
+
+' MCI Functions
+#ifdef UNICODE
+Declare Function mciSendCommand Lib "winmm" Alias "mciSendCommandW" (mciId As MCIDEVICEID, uMsg As DWord, dwParam1 As DWord, ByRef dwParam2 As Any) As MCIERROR
+Declare Function mciSendString Lib "winmm" Alias "mciSendStringW" (lpstrCommand As LPWSTR, lpstrReturnString As LPWSTR, uReturnLength As DWord, hwndCallback As HWND) As MCIERROR
+Declare Function mciGetDeviceID Lib "winmm" Alias "mciGetDeviceIDW" (pszDevice As LPWSTR) As MCIDEVICEID
+Declare Function mciGetErrorString Lib "winmm" Alias "mciGetErrorStringA" (mcierr As MCIERROR, pszText As LPWSTR, cchText As DWord) As BOOL
+#else
+Declare Function mciSendCommand Lib "winmm" Alias "mciSendCommandA" (mciId As MCIDEVICEID, uMsg As DWord, dwParam1 As DWord, ByRef dwParam2 As Any) As MCIERROR
+Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (lpstrCommand As LPSTR, lpstrReturnString As LPSTR, uReturnLength As DWord, hwndCallback As HWND) As MCIERROR
+Declare Function mciGetDeviceID Lib "winmm" Alias "mciGetDeviceIDA" (pszDevice As LPSTR) As MCIDEVICEID
+Declare Function mciGetErrorString Lib "winmm" Alias "mciGetErrorStringA" (mcierr As MCIERROR, pszText As LPSTR, cchText As DWord) As BOOL
+#endif
+
+Declare Function mciSetYieldProc Lib "winmm" (mciId As MCIDEVICEID, fpYieldProc As YIELDPROC, dwYieldData As DWord) As BOOL
+Declare Function mciGetCreatorTask Lib "winmm" (mciId As MCIDEVICEID) As HTASK
+Declare Function mciGetYieldProc Lib "winmm" (mciId As MCIDEVICEID, pdwYieldData As *DWord) As YIELDPROC
+Declare Function mciExecute Lib "winmm" (pszCommand As LPSTR) As BOOL
+
+Const MCIERR_INVALID_DEVICE_ID = (MCIERR_BASE + 1)
+Const MCIERR_UNRECOGNIZED_KEYWORD = (MCIERR_BASE + 3)
+Const MCIERR_UNRECOGNIZED_COMMAND = (MCIERR_BASE + 5)
+Const MCIERR_HARDWARE = (MCIERR_BASE + 6)
+Const MCIERR_INVALID_DEVICE_NAME = (MCIERR_BASE + 7)
+Const MCIERR_OUT_OF_MEMORY = (MCIERR_BASE + 8)
+Const MCIERR_DEVICE_OPEN = (MCIERR_BASE + 9)
+Const MCIERR_CANNOT_LOAD_DRIVER = (MCIERR_BASE + 10)
+Const MCIERR_MISSING_COMMAND_STRING = (MCIERR_BASE + 11)
+Const MCIERR_PARAM_OVERFLOW = (MCIERR_BASE + 12)
+Const MCIERR_MISSING_STRING_ARGUMENT = (MCIERR_BASE + 13)
+Const MCIERR_BAD_INTEGER = (MCIERR_BASE + 14)
+Const MCIERR_PARSER_INTERNAL = (MCIERR_BASE + 15)
+Const MCIERR_DRIVER_INTERNAL = (MCIERR_BASE + 16)
+Const MCIERR_MISSING_PARAMETER = (MCIERR_BASE + 17)
+Const MCIERR_UNSUPPORTED_FUNCTION = (MCIERR_BASE + 18)
+Const MCIERR_FILE_NOT_FOUND = (MCIERR_BASE + 19)
+Const MCIERR_DEVICE_NOT_READY = (MCIERR_BASE + 20)
+Const MCIERR_INTERNAL = (MCIERR_BASE + 21)
+Const MCIERR_DRIVER = (MCIERR_BASE + 22)
+Const MCIERR_CANNOT_USE_ALL = (MCIERR_BASE + 23)
+Const MCIERR_MULTIPLE = (MCIERR_BASE + 24)
+Const MCIERR_EXTENSION_NOT_FOUND = (MCIERR_BASE + 25)
+Const MCIERR_OUTOFRANGE = (MCIERR_BASE + 26)
+Const MCIERR_FLAGS_NOT_COMPATIBLE = (MCIERR_BASE + 28)
+Const MCIERR_FILE_NOT_SAVED = (MCIERR_BASE + 30)
+Const MCIERR_DEVICE_TYPE_REQUIRED = (MCIERR_BASE + 31)
+Const MCIERR_DEVICE_LOCKED = (MCIERR_BASE + 32)
+Const MCIERR_DUPLICATE_ALIAS = (MCIERR_BASE + 33)
+Const MCIERR_BAD_CONSTANT = (MCIERR_BASE + 34)
+Const MCIERR_MUST_USE_SHAREABLE = (MCIERR_BASE + 35)
+Const MCIERR_MISSING_DEVICE_NAME = (MCIERR_BASE + 36)
+Const MCIERR_BAD_TIME_FORMAT = (MCIERR_BASE + 37)
+Const MCIERR_NO_CLOSING_QUOTE = (MCIERR_BASE + 38)
+Const MCIERR_DUPLICATE_FLAGS = (MCIERR_BASE + 39)
+Const MCIERR_INVALID_FILE = (MCIERR_BASE + 40)
+Const MCIERR_NULL_PARAMETER_BLOCK = (MCIERR_BASE + 41)
+Const MCIERR_UNNAMED_RESOURCE = (MCIERR_BASE + 42)
+Const MCIERR_NEW_REQUIRES_ALIAS = (MCIERR_BASE + 43)
+Const MCIERR_NOTIFY_ON_AUTO_OPEN = (MCIERR_BASE + 44)
+Const MCIERR_NO_ELEMENT_ALLOWED = (MCIERR_BASE + 45)
+Const MCIERR_NONAPPLICABLE_FUNCTION = (MCIERR_BASE + 46)
+Const MCIERR_ILLEGAL_FOR_AUTO_OPEN = (MCIERR_BASE + 47)
+Const MCIERR_FILENAME_REQUIRED = (MCIERR_BASE + 48)
+Const MCIERR_EXTRA_CHARACTERS = (MCIERR_BASE + 49)
+Const MCIERR_DEVICE_NOT_INSTALLED = (MCIERR_BASE + 50)
+Const MCIERR_GET_CD = (MCIERR_BASE + 51)
+Const MCIERR_SET_CD = (MCIERR_BASE + 52)
+Const MCIERR_SET_DRIVE = (MCIERR_BASE + 53)
+Const MCIERR_DEVICE_LENGTH = (MCIERR_BASE + 54)
+Const MCIERR_DEVICE_ORD_LENGTH = (MCIERR_BASE + 55)
+Const MCIERR_NO_INTEGER = (MCIERR_BASE + 56)
+
+Const MCIERR_WAVE_OUTPUTSINUSE = (MCIERR_BASE + 64)
+Const MCIERR_WAVE_SETOUTPUTINUSE = (MCIERR_BASE + 65)
+Const MCIERR_WAVE_INPUTSINUSE = (MCIERR_BASE + 66)
+Const MCIERR_WAVE_SETINPUTINUSE = (MCIERR_BASE + 67)
+Const MCIERR_WAVE_OUTPUTUNSPECIFIED = (MCIERR_BASE + 68)
+Const MCIERR_WAVE_INPUTUNSPECIFIED = (MCIERR_BASE + 69)
+Const MCIERR_WAVE_OUTPUTSUNSUITABLE = (MCIERR_BASE + 70)
+Const MCIERR_WAVE_SETOUTPUTUNSUITABLE = (MCIERR_BASE + 71)
+Const MCIERR_WAVE_INPUTSUNSUITABLE = (MCIERR_BASE + 72)
+Const MCIERR_WAVE_SETINPUTUNSUITABLE = (MCIERR_BASE + 73)
+
+Const MCIERR_SEQ_DIV_INCOMPATIBLE = (MCIERR_BASE + 80)
+Const MCIERR_SEQ_PORT_INUSE = (MCIERR_BASE + 81)
+Const MCIERR_SEQ_PORT_NONEXISTENT = (MCIERR_BASE + 82)
+Const MCIERR_SEQ_PORT_MAPNODEVICE = (MCIERR_BASE + 83)
+Const MCIERR_SEQ_PORT_MISCERROR = (MCIERR_BASE + 84)
+Const MCIERR_SEQ_TIMER = (MCIERR_BASE + 85)
+Const MCIERR_SEQ_PORTUNSPECIFIED = (MCIERR_BASE + 86)
+Const MCIERR_SEQ_NOMIDIPRESENT = (MCIERR_BASE + 87)
+
+Const MCIERR_NO_WINDOW = (MCIERR_BASE + 90)
+Const MCIERR_CREATEWINDOW = (MCIERR_BASE + 91)
+Const MCIERR_FILE_READ = (MCIERR_BASE + 92)
+Const MCIERR_FILE_WRITE = (MCIERR_BASE + 93)
+Const MCIERR_NO_IDENTITY = (MCIERR_BASE + 94)
+Const MCIERR_CUSTOM_DRIVER_BASE = (MCIERR_BASE + 256)
+
+Const MCI_FIRST = DRV_MCI_FIRST
+Const MCI_OPEN = &H0803
+Const MCI_CLOSE = &H0804
+Const MCI_ESCAPE = &H0805
+Const MCI_PLAY = &H0806
+Const MCI_SEEK = &H0807
+Const MCI_STOP = &H0808
+Const MCI_PAUSE = &H0809
+Const MCI_INFO = &H080A
+Const MCI_GETDEVCAPS = &H080B
+Const MCI_SPIN = &H080C
+Const MCI_SET = &H080D
+Const MCI_STEP = &H080E
+Const MCI_RECORD = &H080F
+Const MCI_SYSINFO = &H0810
+Const MCI_BREAK = &H0811
+Const MCI_SAVE = &H0813
+Const MCI_STATUS = &H0814
+Const MCI_CUE = &H0830
+Const MCI_REALIZE = &H0840
+Const MCI_WINDOW = &H0841
+Const MCI_PUT = &H0842
+Const MCI_WHERE = &H0843
+Const MCI_FREEZE = &H0844
+Const MCI_UNFREEZE = &H0845
+Const MCI_LOAD = &H0850
+Const MCI_CUT = &H0851
+Const MCI_COPY = &H0852
+Const MCI_PASTE = &H0853
+Const MCI_UPDATE = &H0854
+Const MCI_RESUME = &H0855
+Const MCI_DELETE = &H0856
+
+Const MCI_USER_MESSAGES = (DRV_MCI_FIRST + &H400)
+Const MCI_LAST = &H0FFF
+
+Const MCI_ALL_DEVICE_ID = (-1)
+
+' constants for predefined MCI device types
+Const MCI_DEVTYPE_VCR =               513
+Const MCI_DEVTYPE_VIDEODISC =         514
+Const MCI_DEVTYPE_OVERLAY =           515
+Const MCI_DEVTYPE_CD_AUDIO =          516
+Const MCI_DEVTYPE_DAT =               517
+Const MCI_DEVTYPE_SCANNER =           518
+Const MCI_DEVTYPE_ANIMATION =         519
+Const MCI_DEVTYPE_DIGITAL_VIDEO =     520
+Const MCI_DEVTYPE_OTHER =             521
+Const MCI_DEVTYPE_WAVEFORM_AUDIO =    522
+Const MCI_DEVTYPE_SEQUENCER =         523
+Const MCI_DEVTYPE_FIRST =             MCI_DEVTYPE_VCR
+Const MCI_DEVTYPE_LAST =              MCI_DEVTYPE_SEQUENCER
+Const MCI_DEVTYPE_FIRST_USER =        &H1000
+
+' return values for 'status mode' command
+Const MCI_MODE_NOT_READY =            MCI_STRING_OFFSET + 12
+Const MCI_MODE_STOP =                 MCI_STRING_OFFSET + 13
+Const MCI_MODE_PLAY =                 MCI_STRING_OFFSET + 14
+Const MCI_MODE_RECORD =               MCI_STRING_OFFSET + 15
+Const MCI_MODE_SEEK =                 MCI_STRING_OFFSET + 16
+Const MCI_MODE_PAUSE =                MCI_STRING_OFFSET + 17
+Const MCI_MODE_OPEN =                 MCI_STRING_OFFSET + 18
+
+'--------------------------------------------------------
+' Time Format(used in MCI_SET_PARAMS, MCI_STATUS_PARAMS)
+
+Const MCI_FORMAT_MILLISECONDS =       0
+Const MCI_FORMAT_HMS =                1
+Const MCI_FORMAT_MSF =                2
+Const MCI_FORMAT_FRAMES =             3
+Const MCI_FORMAT_SMPTE_24 =           4
+Const MCI_FORMAT_SMPTE_25 =           5
+Const MCI_FORMAT_SMPTE_30 =           6
+Const MCI_FORMAT_SMPTE_30DROP =       7
+Const MCI_FORMAT_BYTES =              8
+Const MCI_FORMAT_SAMPLES =            9
+Const MCI_FORMAT_TMSF =               10
+
+'------------
+' MCI Macros
+
+'MSF
+Function MCI_MSF_MINUTE(msf As DWord) As Byte
+	Return (&HFF and msf) As Byte
+End Function
+Function MCI_MSF_SECOND(msf As DWord) As Byte
+	Return (&HFF and (msf>> 8)) As Byte
+End Function
+Function MCI_MSF_FRAME(msf As DWord) As Byte
+	Return (&HFF and (msf>>16)) As Byte
+End Function
+Function MCI_MAKE_MSF(minutes As Byte, seconds As Byte, frames As Byte) As DWord
+	Return MAKELONG(minutes,MAKEWORD(seconds,frames))
+End Function
+
+'TMSF
+Function MCI_TMSF_TRACK(tmsf As DWord) As Byte
+	Return (&HFF and (tmsf)) As Byte
+End Function
+Function MCI_TMSF_MINUTE(tmsf As DWord) As Byte
+	Return (&HFF and (((tmsf)) >> 8)) As Byte
+End Function
+Function MCI_TMSF_SECOND(tmsf As DWord) As Byte
+	Return (&HFF and ((tmsf)>>16)) As Byte
+End Function
+Function MCI_TMSF_FRAME(tmsf As DWord) As Byte
+	Return (&HFF and ((tmsf)>>24)) As Byte
+End Function
+Function MCI_MAKE_TMSF(tracks As Byte, minutes As Byte, seconds As Byte, frames As Byte) As DWord
+	Return MAKELONG(MAKEWORD(tracks,minutes),MAKEWORD(seconds,frames))
+End Function
+
+'HMS
+Function MCI_HMS_HOUR(hms As DWord) As Byte
+	Return (&HFF and (hms)) As Byte
+End Function
+Function MCI_HMS_MINUTE(hms As DWord) As Byte
+	Return (&HFF and ((hms)>> 8)) As Byte
+End Function
+Function MCI_HMS_SECOND(hms As DWord) As Byte
+	Return (&HFF and ((hms)>>16)) As Byte
+End Function
+Function MCI_MAKE_HMS(hours As Byte, minutes As Byte, seconds As Byte) As DWord
+	Return MAKELONG(hours,MAKEWORD(minutes,seconds))
+End Function
+
+' flags for wParam of MM_MCINOTIFY message
+Const MCI_NOTIFY_SUCCESSFUL = &H0001
+Const MCI_NOTIFY_SUPERSEDED = &H0002
+Const MCI_NOTIFY_ABORTED = &H0004
+Const MCI_NOTIFY_FAILURE = &H0008
+
+' common flags for dwFlags parameter of MCI command messages
+Const MCI_NOTIFY =                    &H00000001
+Const MCI_WAIT =                      &H00000002
+Const MCI_FROM =                      &H00000004
+Const MCI_TO =                        &H00000008
+Const MCI_TRACK =                     &H00000010
+
+' flags for dwFlags parameter of MCI_OPEN command message
+Const MCI_OPEN_SHAREABLE =            &H00000100
+Const MCI_OPEN_ELEMENT =              &H00000200
+Const MCI_OPEN_ALIAS =                &H00000400
+Const MCI_OPEN_ELEMENT_ID =           &H00000800
+Const MCI_OPEN_TYPE_ID =              &H00001000
+Const MCI_OPEN_TYPE =                 &H00002000
+
+' flags for dwFlags parameter of MCI_SEEK command message
+Const MCI_SEEK_TO_START = &H00000100
+Const MCI_SEEK_TO_END = &H00000200
+
+' flags for dwFlags parameter of MCI_STATUS command message
+Const MCI_STATUS_ITEM = &H00000100
+Const MCI_STATUS_START = &H00000200
+
+' flags for dwItem field of the MCI_STATUS_PARMS parameter block
+Const MCI_STATUS_LENGTH = &H00000001
+Const MCI_STATUS_POSITION = &H00000002
+Const MCI_STATUS_NUMBER_OF_TRACKS = &H00000003
+Const MCI_STATUS_MODE = &H00000004
+Const MCI_STATUS_MEDIA_PRESENT = &H00000005
+Const MCI_STATUS_TIME_FORMAT = &H00000006
+Const MCI_STATUS_READY = &H00000007
+Const MCI_STATUS_CURRENT_TRACK = &H00000008
+
+' flags for dwFlags parameter of MCI_INFO command message
+Const MCI_INFO_PRODUCT = &H00000100
+Const MCI_INFO_FILE = &H00000200
+Const MCI_INFO_MEDIA_UPC = &H00000400
+Const MCI_INFO_MEDIA_IDENTITY = &H00000800
+Const MCI_INFO_NAME = &H00001000
+Const MCI_INFO_COPYRIGHT = &H00002000
+
+' flags for dwFlags parameter of MCI_GETDEVCAPS command message
+Const MCI_GETDEVCAPS_ITEM = &H00000100
+
+' flags for dwItem field of the MCI_GETDEVCAPS_PARMS parameter block
+Const MCI_GETDEVCAPS_CAN_RECORD = &H00000001
+Const MCI_GETDEVCAPS_HAS_AUDIO = &H00000002
+Const MCI_GETDEVCAPS_HAS_VIDEO = &H00000003
+Const MCI_GETDEVCAPS_DEVICE_TYPE = &H00000004
+Const MCI_GETDEVCAPS_USES_FILES = &H00000005
+Const MCI_GETDEVCAPS_COMPOUND_DEVICE = &H00000006
+Const MCI_GETDEVCAPS_CAN_EJECT = &H00000007
+Const MCI_GETDEVCAPS_CAN_PLAY = &H00000008
+Const MCI_GETDEVCAPS_CAN_SAVE = &H00000009
+
+' flags for dwFlags parameter of MCI_SYSINFO command message
+Const MCI_SYSINFO_QUANTITY = &H00000100
+Const MCI_SYSINFO_OPEN = &H00000200
+Const MCI_SYSINFO_NAME = &H00000400
+Const MCI_SYSINFO_INSTALLNAME = &H00000800
+
+' flags for dwFlags parameter of MCI_SET command message
+Const MCI_SET_DOOR_OPEN = &H00000100
+Const MCI_SET_DOOR_CLOSED = &H00000200
+Const MCI_SET_TIME_FORMAT = &H00000400
+Const MCI_SET_AUDIO = &H00000800
+Const MCI_SET_VIDEO = &H00001000
+Const MCI_SET_ON = &H00002000
+Const MCI_SET_OFF = &H00004000
+
+' flags for dwAudio field of MCI_SET_PARMS or MCI_SEQ_SET_PARMS
+Const MCI_SET_AUDIO_ALL = &H00000000
+Const MCI_SET_AUDIO_LEFT = &H00000001
+Const MCI_SET_AUDIO_RIGHT = &H00000002
+
+' flags for dwFlags parameter of MCI_BREAK command message
+Const MCI_BREAK_KEY = &H00000100
+Const MCI_BREAK_HWND = &H00000200
+Const MCI_BREAK_OFF = &H00000400
+
+' flags for dwFlags parameter of MCI_RECORD command message
+Const MCI_RECORD_INSERT = &H00000100
+Const MCI_RECORD_OVERWRITE = &H00000200
+
+' flags for dwFlags parameter of MCI_SAVE command message
+Const MCI_SAVE_FILE = &H00000100
+
+' flags for dwFlags parameter of MCI_LOAD command message
+Const MCI_LOAD_FILE = &H00000100
+
+Type MCI_GENERIC_PARMS
+	dwCallback As DWord
+End Type
+TypeDef PMCI_GENERIC_PARMS = *MCI_GENERIC_PARMS
+TypeDef LPMCI_GENERIC_PARMS = *MCI_GENERIC_PARMS
+
+Type MCI_OPEN_PARMS
+	dwCallback As DWord
+	wDeviceID As DWord
+	lpstrDeviceType As LPSTR
+	lpstrElementName As LPSTR
+	lpstrAlias As LPSTR
+End Type
+TypeDef PMCI_OPEN_PARMS = *MCI_OPEN_PARMS
+TypeDef LPMCI_OPEN_PARMS = *MCI_OPEN_PARMS
+
+Type MCI_PLAY_PARMS
+	dwCallback As DWord
+	dwFrom As DWord
+	dwTo As DWord
+End Type
+TypeDef PMCI_PLAY_PARMS = *MCI_PLAY_PARMS
+TypeDef LPMCI_PLAY_PARMS = *MCI_PLAY_PARMS
+
+Type MCI_SEEK_PARMS
+	dwCallback As DWord
+	dwTo As DWord
+End Type
+TypeDef PMCI_SEEK_PARMS = *MCI_SEEK_PARMS
+TypeDef LPMCI_SEEK_PARMS = *MCI_SEEK_PARMS
+
+Type MCI_STATUS_PARMS
+	dwCallback As DWord
+	dwReturn As DWord
+	dwItem As DWord
+	dwTrack As DWord
+End Type
+TypeDef PMCI_STATUS_PARMS = *MCI_STATUS_PARMS
+TypeDef LPMCI_STATUS_PARMS = *MCI_STATUS_PARMS
+
+Type MCI_INFO_PARMSW
+	dwCallback As DWord
+	lpstrReturn As LPWSTR
+	dwRetSize As DWord
+End Type
+TypeDef PMCI_INFO_PARMSW = *MCI_INFO_PARMSW
+TypeDef LPMCI_INFO_PARMSW = *MCI_INFO_PARMSW
+
+Type MCI_INFO_PARMSA
+	dwCallback As DWord
+	lpstrReturn As LPSTR
+	dwRetSize As DWord
+End Type
+TypeDef PMCI_INFO_PARMSA = *MCI_INFO_PARMSA
+TypeDef LPMCI_INFO_PARMSA = *MCI_INFO_PARMSA
+
+#ifdef UNICODE
+TypeDef MCI_INFO_PARMS = MCI_INFO_PARMSW
+TypeDef PMCI_INFO_PARMS = PMCI_INFO_PARMSW
+TypeDef LPMCI_INFO_PARMS = LPMCI_INFO_PARMSW
+#else
+TypeDef MCI_INFO_PARMS = MCI_INFO_PARMSA
+TypeDef PMCI_INFO_PARMS = PMCI_INFO_PARMSA
+TypeDef LPMCI_INFO_PARMS = LPMCI_INFO_PARMSA
+#endif
+
+Type MCI_GETDEVCAPS_PARMS
+	dwCallback As DWord
+	dwReturn As DWord
+	dwItem As DWord
+End Type
+TypeDef PMCI_GETDEVCAPS_PARMS = *MCI_GETDEVCAPS_PARMS
+TypeDef LPMCI_GETDEVCAPS_PARMS = *MCI_GETDEVCAPS_PARMS
+
+Type MCI_SYSINFO_PARMSW
+	dwCallback As DWord
+	lpstrReturn As LPWSTR
+	dwRetSize As DWord
+	dwNumber As DWord
+	wDeviceType As DWord
+End Type
+TypeDef PMCI_SYSINFO_PARMSW = *MCI_SYSINFO_PARMSW
+TypeDef LPMCI_SYSINFO_PARMSW = *MCI_SYSINFO_PARMSW
+
+Type MCI_SYSINFO_PARMSA
+	dwCallback As DWord
+	lpstrReturn As LPSTR
+	dwRetSize As DWord
+	dwNumber As DWord
+	wDeviceType As DWord
+End Type
+TypeDef PMCI_SYSINFO_PARMSA = *MCI_SYSINFO_PARMSA
+TypeDef LPMCI_SYSINFO_PARMSA = *MCI_SYSINFO_PARMSA
+
+#ifdef UNICODE
+TypeDef MCI_SYSINFO_PARMS = MCI_SYSINFO_PARMSW
+TypeDef PMCI_SYSINFO_PARMS = PMCI_SYSINFO_PARMSW
+TypeDef LPMCI_SYSINFO_PARMS = LPMCI_SYSINFO_PARMSW
+#else
+TypeDef MCI_SYSINFO_PARMS = MCI_SYSINFO_PARMSA
+TypeDef PMCI_SYSINFO_PARMS = PMCI_SYSINFO_PARMSA
+TypeDef LPMCI_SYSINFO_PARMS = LPMCI_SYSINFO_PARMSA
+#endif
+
+Type MCI_SET_PARMS
+	dwCallback As DWord
+	dwTimeFormat As DWord
+	dwAudio As DWord
+End Type
+TypeDef PMCI_SET_PARMS = *MCI_SET_PARMS
+TypeDef LPMCI_SET_PARMS = *MCI_SET_PARMS
+
+Type MCI_BREAK_PARMS
+	dwCallback As DWord
+	nVirtKey As Long
+	hwndBreak As HWND
+End Type
+TypeDef PMCI_BREAK_PARMS = *MCI_BREAK_PARMS
+TypeDef LPMCI_BREAK_PARMS = *MCI_BREAK_PARMS
+
+Type MCI_SAVE_PARMSW
+	dwCallback As DWord
+	lpfilename As LPWSTR
+End Type
+TypeDef PMCI_SAVE_PARMSW = *MCI_SAVE_PARMSW
+TypeDef LPMCI_SAVE_PARMSW = *MCI_SAVE_PARMSW
+
+Type MCI_SAVE_PARMSA
+	dwCallback As DWord
+	lpfilename As LPSTR
+End Type
+TypeDef PMCI_SAVE_PARMSA = *MCI_SAVE_PARMSA
+TypeDef LPMCI_SAVE_PARMSA = *MCI_SAVE_PARMSA
+
+#ifdef UNICODE
+TypeDef MCI_SAVE_PARMS = MCI_SAVE_PARMSW
+TypeDef PMCI_SAVE_PARMS = PMCI_SAVE_PARMSW
+TypeDef LPMCI_SAVE_PARMS = LPMCI_SAVE_PARMSW
+#else
+TypeDef MCI_SAVE_PARMS = MCI_SAVE_PARMSA
+TypeDef PMCI_SAVE_PARMS = PMCI_SAVE_PARMSA
+TypeDef LPMCI_SAVE_PARMS = LPMCI_SAVE_PARMSA
+#endif
+
+Type MCI_LOAD_PARMSW
+	dwCallback As DWord
+	lpfilename As LPWSTR
+End Type
+TypeDef PMCI_LOAD_PARMSW = *MCI_LOAD_PARMSW
+TypeDef LPMCI_LOAD_PARMSW = *MCI_LOAD_PARMSW
+
+Type MCI_LOAD_PARMSA
+	dwCallback As DWord
+	lpfilename As LPSTR
+End Type
+TypeDef PMCI_LOAD_PARMSA = *MCI_LOAD_PARMSA
+TypeDef LPMCI_LOAD_PARMSA = *MCI_LOAD_PARMSA
+
+#ifdef UNICODE
+TypeDef MCI_LOAD_PARMS = MCI_LOAD_PARMSW
+TypeDef PMCI_LOAD_PARMS = PMCI_LOAD_PARMSW
+TypeDef LPMCI_LOAD_PARMS = LPMCI_LOAD_PARMSW
+#else
+TypeDef MCI_LOAD_PARMS = MCI_LOAD_PARMSA
+TypeDef PMCI_LOAD_PARMS = PMCI_LOAD_PARMSA
+TypeDef LPMCI_LOAD_PARMS = LPMCI_LOAD_PARMSA
+#endif
+
+Type MCI_RECORD_PARMS
+	dwCallback As DWord
+	dwFrom As DWord
+	dwTo As DWord
+End Type
+TypeDef PMCI_RECORD_PARMS = *MCI_RECORD_PARMS
+TypeDef LPMCI_RECORD_PARMS = *MCI_RECORD_PARMS
+
+' MCI extensions for videodisc devices
+Const MCI_VD_MODE_PARK =              (MCI_VD_OFFSET + 1)
+Const MCI_VD_MEDIA_CLV =              (MCI_VD_OFFSET + 2)
+Const MCI_VD_MEDIA_CAV =              (MCI_VD_OFFSET + 3)
+Const MCI_VD_MEDIA_OTHER =            (MCI_VD_OFFSET + 4)
+Const MCI_VD_FORMAT_TRACK =           &H4001
+Const MCI_VD_PLAY_REVERSE =           &H00010000
+Const MCI_VD_PLAY_FAST =              &H00020000
+Const MCI_VD_PLAY_SPEED =             &H00040000
+Const MCI_VD_PLAY_SCAN =              &H00080000
+Const MCI_VD_PLAY_SLOW =              &H00100000
+Const MCI_VD_SEEK_REVERSE =           &H00010000
+Const MCI_VD_STATUS_SPEED =           &H00004002
+Const MCI_VD_STATUS_FORWARD =         &H00004003
+Const MCI_VD_STATUS_MEDIA_TYPE =      &H00004004
+Const MCI_VD_STATUS_SIDE =            &H00004005
+Const MCI_VD_STATUS_DISC_SIZE =       &H00004006
+Const MCI_VD_GETDEVCAPS_CLV =         &H00010000
+Const MCI_VD_GETDEVCAPS_CAV =         &H00020000
+Const MCI_VD_SPIN_UP =                &H00010000
+Const MCI_VD_SPIN_DOWN =              &H00020000
+Const MCI_VD_GETDEVCAPS_CAN_REVERSE = &H00004002
+Const MCI_VD_GETDEVCAPS_FAST_RATE =   &H00004003
+Const MCI_VD_GETDEVCAPS_SLOW_RATE =   &H00004004
+Const MCI_VD_GETDEVCAPS_NORMAL_RATE = &H00004005
+Const MCI_VD_STEP_FRAMES =            &H00010000
+Const MCI_VD_STEP_REVERSE =           &H00020000
+Const MCI_VD_ESCAPE_STRING =          &H00000100
+
+Type MCI_VD_PLAY_PARMS
+	dwCallback As DWord
+	dwFrom As DWord
+	dwTo As DWord
+	dwSpeed As DWord
+End Type
+TypeDef PMCI_VD_PLAY_PARMS = *MCI_VD_PLAY_PARMS
+TypeDef LPMCI_VD_PLAY_PARMS = *MCI_VD_PLAY_PARMS
+
+Type MCI_VD_STEP_PARMS
+	dwCallback As DWord
+	dwFrames As DWord
+End Type
+TypeDef PMCI_VD_STEP_PARMS = *MCI_VD_STEP_PARMS
+TypeDef LPMCI_VD_STEP_PARMS = *MCI_VD_STEP_PARMS
+
+Type MCI_VD_ESCAPE_PARMSW
+	dwCallback As DWord
+	lpstrCommand As LPWSTR
+End Type
+TypeDef PMCI_VD_ESCAPE_PARMSW = *MCI_VD_ESCAPE_PARMSW
+TypeDef LPMCI_VD_ESCAPE_PARMSW = *MCI_VD_ESCAPE_PARMSW
+
+Type MCI_VD_ESCAPE_PARMSA
+	dwCallback As DWord
+	lpstrCommand As LPSTR
+End Type
+TypeDef PMCI_VD_ESCAPE_PARMSA = *MCI_VD_ESCAPE_PARMSA
+TypeDef LPMCI_VD_ESCAPE_PARMSA = *MCI_VD_ESCAPE_PARMSA
+
+#ifdef UNICODE
+TypeDef MCI_VD_ESCAPE_PARMS = MCI_VD_ESCAPE_PARMSW
+TypeDef PMCI_VD_ESCAPE_PARMS = PMCI_VD_ESCAPE_PARMSW
+TypeDef LPMCI_VD_ESCAPE_PARMS = LPMCI_VD_ESCAPE_PARMSW
+#else
+TypeDef MCI_VD_ESCAPE_PARMS = MCI_VD_ESCAPE_PARMSA
+TypeDef PMCI_VD_ESCAPE_PARMS = PMCI_VD_ESCAPE_PARMSA
+TypeDef LPMCI_VD_ESCAPE_PARMS = LPMCI_VD_ESCAPE_PARMSA
+#endif
+
+' MCI extensions for CD audio devices
+Const MCI_CDA_STATUS_TYPE_TRACK = &H00004001
+Const MCI_CDA_TRACK_AUDIO = (MCI_CD_OFFSET + 0)
+Const MCI_CDA_TRACK_OTHER = (MCI_CD_OFFSET + 1)
+
+' MCI extensions for waveform audio devices
+Const MCI_WAVE_PCM =                   (MCI_WAVE_OFFSET + 0)
+Const MCI_WAVE_MAPPER =                (MCI_WAVE_OFFSET + 1)
+Const MCI_WAVE_OPEN_BUFFER =           &H00010000
+Const MCI_WAVE_SET_FORMATTAG =         &H00010000
+Const MCI_WAVE_SET_CHANNELS =          &H00020000
+Const MCI_WAVE_SET_SAMPLESPERSEC =     &H00040000
+Const MCI_WAVE_SET_AVGBYTESPERSEC =    &H00080000
+Const MCI_WAVE_SET_BLOCKALIGN =        &H00100000
+Const MCI_WAVE_SET_BITSPERSAMPLE =     &H00200000
+Const MCI_WAVE_INPUT =                 &H00400000
+Const MCI_WAVE_OUTPUT =                &H00800000
+Const MCI_WAVE_STATUS_FORMATTAG =      &H00004001
+Const MCI_WAVE_STATUS_CHANNELS =       &H00004002
+Const MCI_WAVE_STATUS_SAMPLESPERSEC =  &H00004003
+Const MCI_WAVE_STATUS_AVGBYTESPERSEC = &H00004004
+Const MCI_WAVE_STATUS_BLOCKALIGN =     &H00004005
+Const MCI_WAVE_STATUS_BITSPERSAMPLE =  &H00004006
+Const MCI_WAVE_STATUS_LEVEL =          &H00004007
+Const MCI_WAVE_SET_ANYINPUT =          &H04000000
+Const MCI_WAVE_SET_ANYOUTPUT =         &H08000000
+Const MCI_WAVE_GETDEVCAPS_INPUTS =     &H00004001
+Const MCI_WAVE_GETDEVCAPS_OUTPUTS =    &H00004002
+
+Type MCI_WAVE_OPEN_PARMSW
+	dwCallback As DWord
+	wDeviceID As MCIDEVICEID
+	lpstrDeviceType As LPWSTR
+	lpstrElementName As LPWSTR
+	lpstrAlias As LPWSTR
+	dwBufferSeconds As DWord
+End Type
+TypeDef PMCI_WAVE_OPEN_PARMSW = *MCI_WAVE_OPEN_PARMSW
+TypeDef LPMCI_WAVE_OPEN_PARMSW = *MCI_WAVE_OPEN_PARMSW
+
+Type MCI_WAVE_OPEN_PARMSA
+	dwCallback As DWord
+	wDeviceID As MCIDEVICEID
+	lpstrDeviceType As LPSTR
+	lpstrElementName As LPSTR
+	lpstrAlias As LPSTR
+	dwBufferSeconds As DWord
+End Type
+TypeDef PMCI_WAVE_OPEN_PARMSA = *MCI_WAVE_OPEN_PARMSA
+TypeDef LPMCI_WAVE_OPEN_PARMSA = *MCI_WAVE_OPEN_PARMSA
+
+#ifdef UNICODE
+TypeDef MCI_WAVE_OPEN_PARMS = MCI_WAVE_OPEN_PARMSW
+TypeDef PMCI_WAVE_OPEN_PARMS = PMCI_WAVE_OPEN_PARMSW
+TypeDef LPMCI_WAVE_OPEN_PARMS = LPMCI_WAVE_OPEN_PARMSW
+#else
+TypeDef MCI_WAVE_OPEN_PARMS = MCI_WAVE_OPEN_PARMSA
+TypeDef PMCI_WAVE_OPEN_PARMS = PMCI_WAVE_OPEN_PARMSA
+TypeDef LPMCI_WAVE_OPEN_PARMS = LPMCI_WAVE_OPEN_PARMSA
+#endif
+
+Type MCI_WAVE_DELETE_PARMS
+	dwCallback As DWord
+	dwFrom As DWord
+	dwTo As DWord
+End Type
+TypeDef PMCI_WAVE_DELETE_PARMS = *MCI_WAVE_DELETE_PARMS
+TypeDef LPMCI_WAVE_DELETE_PARMS = *MCI_WAVE_DELETE_PARMS
+
+Type MCI_WAVE_SET_PARMS
+	dwCallback As DWord
+	dwTimeFormat As DWord
+	dwAudio As DWord
+	wInput As DWord
+	wOutput As DWord
+	wFormatTag As Word
+	wReserved2 As Word
+	nChannels As Word
+	wReserved3 As Word
+	nSamplesPerSec As DWord
+	nAvgBytesPerSec As DWord
+	nBlockAlign As Word
+	wReserved4 As Word
+	wBitsPerSample As Word
+	wReserved5 As Word
+End Type
+TypeDef PMCI_WAVE_SET_PARMS = *MCI_WAVE_SET_PARMS
+TypeDef LPMCI_WAVE_SET_PARMS = *MCI_WAVE_SET_PARMS
+
+' MCI extensions for MIDI sequencer devices
+Const MCI_SEQ_DIV_PPQN =         (0 + MCI_SEQ_OFFSET)
+Const MCI_SEQ_DIV_SMPTE_24 =     (1 + MCI_SEQ_OFFSET)
+Const MCI_SEQ_DIV_SMPTE_25 =     (2 + MCI_SEQ_OFFSET)
+Const MCI_SEQ_DIV_SMPTE_30DROP = (3 + MCI_SEQ_OFFSET)
+Const MCI_SEQ_DIV_SMPTE_30 =     (4 + MCI_SEQ_OFFSET)
+Const MCI_SEQ_FORMAT_SONGPTR =   &H4001
+Const MCI_SEQ_FILE =             &H4002
+Const MCI_SEQ_MIDI =             &H4003
+Const MCI_SEQ_SMPTE =            &H4004
+Const MCI_SEQ_NONE =             65533
+Const MCI_SEQ_MAPPER =           65535
+Const MCI_SEQ_STATUS_TEMPO =     &H00004002
+Const MCI_SEQ_STATUS_PORT =      &H00004003
+Const MCI_SEQ_STATUS_SLAVE =     &H00004007
+Const MCI_SEQ_STATUS_MASTER =    &H00004008
+Const MCI_SEQ_STATUS_OFFSET =    &H00004009
+Const MCI_SEQ_STATUS_DIVTYPE =   &H0000400A
+Const MCI_SEQ_STATUS_NAME =      &H0000400B
+Const MCI_SEQ_STATUS_COPYRIGHT = &H0000400C
+Const MCI_SEQ_SET_TEMPO =        &H00010000
+Const MCI_SEQ_SET_PORT =         &H00020000
+Const MCI_SEQ_SET_SLAVE =        &H00040000
+Const MCI_SEQ_SET_MASTER =       &H00080000
+Const MCI_SEQ_SET_OFFSET =       &H01000000
+
+Type MCI_SEQ_SET_PARMS
+	dwCallback As DWord
+	dwTimeFormat As DWord
+	dwAudio As DWord
+	dwTempo As DWord
+	dwPort As DWord
+	dwSlave As DWord
+	dwMaster As DWord
+	dwOffset As DWord
+End Type
+TypeDef PMCI_SEQ_SET_PARMS = *MCI_SEQ_SET_PARMS
+TypeDef LPMCI_SEQ_SET_PARMS = *MCI_SEQ_SET_PARMS
+
+' MCI extensions for animation devices
+Const MCI_ANIM_OPEN_WS =                &H00010000
+Const MCI_ANIM_OPEN_PARENT =            &H00020000
+Const MCI_ANIM_OPEN_NOSTATIC =          &H00040000
+Const MCI_ANIM_PLAY_SPEED =             &H00010000
+Const MCI_ANIM_PLAY_REVERSE =           &H00020000
+Const MCI_ANIM_PLAY_FAST =              &H00040000
+Const MCI_ANIM_PLAY_SLOW =              &H00080000
+Const MCI_ANIM_PLAY_SCAN =              &H00100000
+Const MCI_ANIM_STEP_REVERSE =           &H00010000
+Const MCI_ANIM_STEP_FRAMES =            &H00020000
+Const MCI_ANIM_STATUS_SPEED =           &H00004001
+Const MCI_ANIM_STATUS_FORWARD =         &H00004002
+Const MCI_ANIM_STATUS_HWND =            &H00004003
+Const MCI_ANIM_STATUS_HPAL =            &H00004004
+Const MCI_ANIM_STATUS_STRETCH =         &H00004005
+Const MCI_ANIM_INFO_TEXT =              &H00010000
+Const MCI_ANIM_GETDEVCAPS_CAN_REVERSE = &H00004001
+Const MCI_ANIM_GETDEVCAPS_FAST_RATE =   &H00004002
+Const MCI_ANIM_GETDEVCAPS_SLOW_RATE =   &H00004003
+Const MCI_ANIM_GETDEVCAPS_NORMAL_RATE = &H00004004
+Const MCI_ANIM_GETDEVCAPS_PALETTES =    &H00004006
+Const MCI_ANIM_GETDEVCAPS_CAN_STRETCH = &H00004007
+Const MCI_ANIM_GETDEVCAPS_MAX_WINDOWS = &H00004008
+Const MCI_ANIM_REALIZE_NORM =           &H00010000
+Const MCI_ANIM_REALIZE_BKGD =           &H00020000
+Const MCI_ANIM_WINDOW_HWND =            &H00010000
+Const MCI_ANIM_WINDOW_STATE =           &H00040000
+Const MCI_ANIM_WINDOW_TEXT =            &H00080000
+Const MCI_ANIM_WINDOW_ENABLE_STRETCH =  &H00100000
+Const MCI_ANIM_WINDOW_DISABLE_STRETCH = &H00200000
+Const MCI_ANIM_WINDOW_DEFAULT =         &H00000000
+Const MCI_ANIM_RECT =                   &H00010000
+Const MCI_ANIM_PUT_SOURCE =             &H00020000
+Const MCI_ANIM_PUT_DESTINATION =        &H00040000
+Const MCI_ANIM_WHERE_SOURCE =           &H00020000
+Const MCI_ANIM_WHERE_DESTINATION =      &H00040000
+Const MCI_ANIM_UPDATE_HDC =             &H00020000
+
+Type MCI_ANIM_OPEN_PARMSW
+	dwCallback As DWord
+	wDeviceID As MCIDEVICEID
+	lpstrDeviceType As LPWSTR
+	lpstrElementName As LPWSTR
+	lpstrAlias As LPWSTR
+	dwStyle As DWord
+	hWndParent As HWND
+End Type
+TypeDef PMCI_ANIM_OPEN_PARMSW = *MCI_ANIM_OPEN_PARMSW
+TypeDef LPMCI_ANIM_OPEN_PARMSW = *MCI_ANIM_OPEN_PARMSW
+
+Type MCI_ANIM_OPEN_PARMSA
+	dwCallback As DWord
+	wDeviceID As MCIDEVICEID
+	lpstrDeviceType As LPSTR
+	lpstrElementName As LPSTR
+	lpstrAlias As LPSTR
+	dwStyle As DWord
+	hWndParent As HWND
+End Type
+TypeDef PMCI_ANIM_OPEN_PARMSA = *MCI_ANIM_OPEN_PARMSA
+TypeDef LPMCI_ANIM_OPEN_PARMSA = *MCI_ANIM_OPEN_PARMSA
+
+#ifdef UNICODE
+TypeDef MCI_ANIM_OPEN_PARMS = MCI_ANIM_OPEN_PARMSW
+TypeDef PMCI_ANIM_OPEN_PARMS = PMCI_ANIM_OPEN_PARMSW
+TypeDef LPMCI_ANIM_OPEN_PARMS = LPMCI_ANIM_OPEN_PARMSW
+#else
+TypeDef MCI_ANIM_OPEN_PARMS = MCI_ANIM_OPEN_PARMSA
+TypeDef PMCI_ANIM_OPEN_PARMS = PMCI_ANIM_OPEN_PARMSA
+TypeDef LPMCI_ANIM_OPEN_PARMS = LPMCI_ANIM_OPEN_PARMSA
+#endif
+
+Type MCI_ANIM_PLAY_PARMS
+	dwCallback As DWord
+	dwFrom As DWord
+	dwTo As DWord
+	dwSpeed As DWord
+End Type
+TypeDef PMCI_ANIM_PLAY_PARMS = *MCI_ANIM_PLAY_PARMS
+TypeDef LPMCI_ANIM_PLAY_PARMS = *MCI_ANIM_PLAY_PARMS
+
+Type MCI_ANIM_STEP_PARMS
+	dwCallback As DWord
+	dwFrames As DWord
+End Type
+TypeDef PMCI_ANIM_STEP_PARMS = *MCI_ANIM_STEP_PARMS
+TypeDef LPMCI_ANIM_STEP_PARMS = *MCI_ANIM_STEP_PARMS
+
+Type MCI_ANIM_WINDOW_PARMSA
+	dwCallback As DWord
+	hWnd As HWND
+	nCmdShow As DWord
+	lpstrText As LPSTR
+End Type
+TypeDef PMCI_ANIM_WINDOW_PARMSA = *MCI_ANIM_WINDOW_PARMSA
+TypeDef LPMCI_ANIM_WINDOW_PARMSA = *MCI_ANIM_WINDOW_PARMSA
+TypeDef MCI_ANIM_WINDOW_PARMS = MCI_ANIM_WINDOW_PARMSA
+TypeDef PMCI_ANIM_WINDOW_PARMS = PMCI_ANIM_WINDOW_PARMSA
+TypeDef LPMCI_ANIM_WINDOW_PARMS = LPMCI_ANIM_WINDOW_PARMSA
+
+Type MCI_ANIM_RECT_PARMS
+	dwCallback As DWord
+	rc As RECT
+End Type
+TypeDef PMCI_ANIM_RECT_PARMS = *MCI_ANIM_RECT_PARMS
+TypeDef LPMCI_ANIM_RECT_PARMS = *MCI_ANIM_RECT_PARMS
+
+Type MCI_ANIM_UPDATE_PARMS
+	dwCallback As DWord
+	rc As RECT
+	hDC As HDC
+End Type
+TypeDef PMCI_ANIM_UPDATE_PARMS = *MCI_ANIM_UPDATE_PARMS
+TypeDef LPMCI_ANIM_UPDATE_PARMS = *MCI_ANIM_UPDATE_PARMS
+
+' MCI extensions for video overlay devices
+Const MCI_OVLY_OPEN_WS =                &H00010000
+Const MCI_OVLY_OPEN_PARENT =            &H00020000
+Const MCI_OVLY_STATUS_HWND =            &H00004001
+Const MCI_OVLY_STATUS_STRETCH =         &H00004002
+Const MCI_OVLY_INFO_TEXT =              &H00010000
+Const MCI_OVLY_GETDEVCAPS_CAN_STRETCH = &H00004001
+Const MCI_OVLY_GETDEVCAPS_CAN_FREEZE =  &H00004002
+Const MCI_OVLY_GETDEVCAPS_MAX_WINDOWS = &H00004003
+Const MCI_OVLY_WINDOW_HWND =            &H00010000
+Const MCI_OVLY_WINDOW_STATE =           &H00040000
+Const MCI_OVLY_WINDOW_TEXT =            &H00080000
+Const MCI_OVLY_WINDOW_ENABLE_STRETCH =  &H00100000
+Const MCI_OVLY_WINDOW_DISABLE_STRETCH = &H00200000
+Const MCI_OVLY_WINDOW_DEFAULT =         &H00000000
+Const MCI_OVLY_RECT =                   &H00010000
+Const MCI_OVLY_PUT_SOURCE =             &H00020000
+Const MCI_OVLY_PUT_DESTINATION =        &H00040000
+Const MCI_OVLY_PUT_FRAME =              &H00080000
+Const MCI_OVLY_PUT_VIDEO =              &H00100000
+Const MCI_OVLY_WHERE_SOURCE =           &H00020000
+Const MCI_OVLY_WHERE_DESTINATION =      &H00040000
+Const MCI_OVLY_WHERE_FRAME =            &H00080000
+Const MCI_OVLY_WHERE_VIDEO =            &H00100000
+
+Type MCI_OVLY_OPEN_PARMSW
+	dwCallback As DWord
+	wDeviceID As MCIDEVICEID
+	lpstrDeviceType As LPWSTR
+	lpstrElementName As LPWSTR
+	lpstrAlias As LPWSTR
+	dwStyle As DWord
+	hWndParent As HWND
+End Type
+TypeDef PMCI_OVLY_OPEN_PARMSW = *MCI_OVLY_OPEN_PARMSW
+TypeDef LPMCI_OVLY_OPEN_PARMSW = *MCI_OVLY_OPEN_PARMSW
+
+Type MCI_OVLY_OPEN_PARMSA
+	dwCallback As DWord
+	wDeviceID As MCIDEVICEID
+	lpstrDeviceType As LPSTR
+	lpstrElementName As LPSTR
+	lpstrAlias As LPSTR
+	dwStyle As DWord
+	hWndParent As HWND
+End Type
+TypeDef PMCI_OVLY_OPEN_PARMSA = *MCI_OVLY_OPEN_PARMSA
+TypeDef LPMCI_OVLY_OPEN_PARMSA = *MCI_OVLY_OPEN_PARMSA
+
+#ifdef UNICODE
+TypeDef MCI_OVLY_OPEN_PARMS = MCI_OVLY_OPEN_PARMSW
+TypeDef PMCI_OVLY_OPEN_PARMS = PMCI_OVLY_OPEN_PARMSW
+TypeDef LPMCI_OVLY_OPEN_PARMS = LPMCI_OVLY_OPEN_PARMSW
+#else
+TypeDef MCI_OVLY_OPEN_PARMS = MCI_OVLY_OPEN_PARMSA
+TypeDef PMCI_OVLY_OPEN_PARMS = PMCI_OVLY_OPEN_PARMSA
+TypeDef LPMCI_OVLY_OPEN_PARMS = LPMCI_OVLY_OPEN_PARMSA
+#endif
+
+Type MCI_OVLY_WINDOW_PARMSA
+	dwCallback As DWord
+	hWnd As HWND
+	nCmdShow As DWord
+	lpstrText As LPSTR
+End Type
+TypeDef PMCI_OVLY_WINDOW_PARMSA = *MCI_OVLY_WINDOW_PARMSA
+TypeDef LPMCI_OVLY_WINDOW_PARMSA = *MCI_OVLY_WINDOW_PARMSA
+
+Type MCI_OVLY_WINDOW_PARMSW
+	dwCallback As DWord
+	hWnd As HWND
+	nCmdShow As DWord
+	lpstrText As LPWSTR
+End Type
+TypeDef PMCI_OVLY_WINDOW_PARMSW = *MCI_OVLY_WINDOW_PARMSW
+TypeDef LPMCI_OVLY_WINDOW_PARMSW = *MCI_OVLY_WINDOW_PARMSW
+
+#ifdef UNICODE
+TypeDef MCI_OVLY_WINDOW_PARMS = MCI_OVLY_WINDOW_PARMSW
+TypeDef PMCI_OVLY_WINDOW_PARMS = PMCI_OVLY_WINDOW_PARMSW
+TypeDef LPMCI_OVLY_WINDOW_PARMS = LPMCI_OVLY_WINDOW_PARMSW
+#else
+TypeDef MCI_OVLY_WINDOW_PARMS = MCI_OVLY_WINDOW_PARMSA
+TypeDef PMCI_OVLY_WINDOW_PARMS = PMCI_OVLY_WINDOW_PARMSA
+TypeDef LPMCI_OVLY_WINDOW_PARMS = LPMCI_OVLY_WINDOW_PARMSA
+#endif
+
+Type MCI_OVLY_RECT_PARMS
+	dwCallback As DWord
+	rc As RECT
+End Type
+TypeDef PMCI_OVLY_RECT_PARMS = *MCI_OVLY_RECT_PARMS
+TypeDef LPMCI_OVLY_RECT_PARMS = *MCI_OVLY_RECT_PARMS
+
+Type MCI_OVLY_SAVE_PARMSW
+	dwCallback As DWord
+	lpfilename As LPWSTR
+	rc As RECT
+End Type
+TypeDef PMCI_OVLY_SAVE_PARMSW = *MCI_OVLY_SAVE_PARMSW
+TypeDef LPMCI_OVLY_SAVE_PARMSW = *MCI_OVLY_SAVE_PARMSW
+
+Type MCI_OVLY_SAVE_PARMSA
+	dwCallback As DWord
+	lpfilename As LPSTR
+	rc As RECT
+End Type
+TypeDef PMCI_OVLY_SAVE_PARMSA = *MCI_OVLY_SAVE_PARMSA
+TypeDef LPMCI_OVLY_SAVE_PARMSA = *MCI_OVLY_SAVE_PARMSA
+
+#ifdef UNICODE
+TypeDef MCI_OVLY_SAVE_PARMS = MCI_OVLY_SAVE_PARMSW
+TypeDef PMCI_OVLY_SAVE_PARMS = PMCI_OVLY_SAVE_PARMSW
+TypeDef LPMCI_OVLY_SAVE_PARMS = LPMCI_OVLY_SAVE_PARMSW
+#else
+TypeDef MCI_OVLY_SAVE_PARMS = MCI_OVLY_SAVE_PARMSA
+TypeDef PMCI_OVLY_SAVE_PARMS = PMCI_OVLY_SAVE_PARMSA
+TypeDef LPMCI_OVLY_SAVE_PARMS = LPMCI_OVLY_SAVE_PARMSA
+#endif
+
+Type MCI_OVLY_LOAD_PARMSW
+	dwCallback As DWord
+	lpfilename As LPWSTR
+	rc As RECT
+End Type
+TypeDef PMCI_OVLY_LOAD_PARMSW = *MCI_OVLY_LOAD_PARMSW
+TypeDef LPMCI_OVLY_LOAD_PARMSW = *MCI_OVLY_LOAD_PARMSW
+
+Type MCI_OVLY_LOAD_PARMSA
+	dwCallback As DWord
+	lpfilename As LPSTR
+	rc As RECT
+End Type
+TypeDef PMCI_OVLY_LOAD_PARMSA = *MCI_OVLY_LOAD_PARMSA
+TypeDef LPMCI_OVLY_LOAD_PARMSA = *MCI_OVLY_LOAD_PARMSA
+
+#ifdef UNICODE
+TypeDef MCI_OVLY_LOAD_PARMS = MCI_OVLY_LOAD_PARMSW
+TypeDef PMCI_OVLY_LOAD_PARMS = PMCI_OVLY_LOAD_PARMSW
+TypeDef LPMCI_OVLY_LOAD_PARMS = LPMCI_OVLY_LOAD_PARMSW
+#else
+TypeDef MCI_OVLY_LOAD_PARMS = MCI_OVLY_LOAD_PARMSA
+TypeDef PMCI_OVLY_LOAD_PARMS = PMCI_OVLY_LOAD_PARMSA
+TypeDef LPMCI_OVLY_LOAD_PARMS = LPMCI_OVLY_LOAD_PARMSA
+#endif
+
+' DISPLAY Driver extensions
+Const NEWTRANSPARENT = 3
+Const QUERYROPSUPPORT = 40
+
+' DIB Driver extensions
+Const SELECTDIB = 41
+Const DIBINDEX(n) = MAKELONG(n,&H10FF)
+
+#endif '_INC_MMSYS
Index: /trunk/ab5.0/ablib/src/api_msg.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_msg.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_msg.sbp	(revision 506)
@@ -0,0 +1,1057 @@
+' api_msg.sbp - declarations file for window control.
+
+'------------------------------
+'  Virtual Keys, Standard Set
+'------------------------------
+
+Const VK_LBUTTON =      &H01
+Const VK_RBUTTON =      &H02
+Const VK_CANCEL =       &H03
+Const VK_MBUTTON =      &H04
+'#if _WIN32_WINNT >= &H0500
+Const VK_XBUTTON1 =     &H05
+Const VK_XBUTTON2 =     &H06
+'#endif
+Const VK_BACK =         &H08
+Const VK_TAB =          &H09
+
+Const VK_CLEAR =        &H0C
+Const VK_RETURN =       &H0D
+
+Const VK_SHIFT =        &H10
+Const VK_CONTROL =      &H11
+Const VK_MENU =         &H12
+Const VK_PAUSE =        &H13
+Const VK_CAPITAL =      &H14
+
+Const VK_KANA =         &H15
+Const VK_HANGEUL =      &H15
+Const VK_HANGUL =       &H15
+Const VK_JUNJA =        &H17
+Const VK_FINAL =        &H18
+Const VK_HANJA =        &H19
+Const VK_KANJI =        &H19
+
+Const VK_ESCAPE =       &H1B
+
+Const VK_CONVERT =      &H1C
+Const VK_NONCONVERT =   &H1D
+Const VK_ACCEPT =       &H1E
+Const VK_MODECHANGE =   &H1F
+
+Const VK_SPACE =        &H20
+Const VK_PRIOR =        &H21
+Const VK_NEXT =         &H22
+Const VK_END =          &H23
+Const VK_HOME =         &H24
+Const VK_LEFT =         &H25
+Const VK_UP =           &H26
+Const VK_RIGHT =        &H27
+Const VK_DOWN =         &H28
+Const VK_SELECT =       &H29
+Const VK_PRINT =        &H2A
+Const VK_EXECUTE =      &H2B
+Const VK_SNAPSHOT =     &H2C
+Const VK_INSERT =       &H2D
+Const VK_DELETE =       &H2E
+Const VK_HELP =         &H2F
+
+Const VK_LWIN =         &H5B
+Const VK_RWIN =         &H5C
+Const VK_APPS =         &H5D
+Const VK_SLEEP =        &H5F
+
+Const VK_NUMPAD0 =      &H60
+Const VK_NUMPAD1 =      &H61
+Const VK_NUMPAD2 =      &H62
+Const VK_NUMPAD3 =      &H63
+Const VK_NUMPAD4 =      &H64
+Const VK_NUMPAD5 =      &H65
+Const VK_NUMPAD6 =      &H66
+Const VK_NUMPAD7 =      &H67
+Const VK_NUMPAD8 =      &H68
+Const VK_NUMPAD9 =      &H69
+Const VK_MULTIPLY =     &H6A
+Const VK_ADD =          &H6B
+Const VK_SEPARATOR =    &H6C
+Const VK_SUBTRACT =     &H6D
+Const VK_DECIMAL =      &H6E
+Const VK_DIVIDE =       &H6F
+Const VK_F1 =           &H70
+Const VK_F2 =           &H71
+Const VK_F3 =           &H72
+Const VK_F4 =           &H73
+Const VK_F5 =           &H74
+Const VK_F6 =           &H75
+Const VK_F7 =           &H76
+Const VK_F8 =           &H77
+Const VK_F9 =           &H78
+Const VK_F10 =          &H79
+Const VK_F11 =          &H7A
+Const VK_F12 =          &H7B
+Const VK_F13 =          &H7C
+Const VK_F14 =          &H7D
+Const VK_F15 =          &H7E
+Const VK_F16 =          &H7F
+Const VK_F17 =          &H80
+Const VK_F18 =          &H81
+Const VK_F19 =          &H82
+Const VK_F20 =          &H83
+Const VK_F21 =          &H84
+Const VK_F22 =          &H85
+Const VK_F23 =          &H86
+Const VK_F24 =          &H87
+
+Const VK_NUMLOCK =      &H90
+Const VK_SCROLL =       &H91
+
+' Used only as parameters to GetAsyncKeyState() and GetKeyState().
+Const VK_LSHIFT =       &HA0
+Const VK_RSHIFT =       &HA1
+Const VK_LCONTROL =     &HA2
+Const VK_RCONTROL =     &HA3
+Const VK_LMENU =        &HA4
+Const VK_RMENU =        &HA5
+
+'#if _WIN32_WINNT >= &h0500
+Const VK_BROWSER_BACK =        &HA6
+Const VK_BROWSER_FORWARD =     &HA7
+Const VK_BROWSER_REFRESH =     &HA8
+Const VK_BROWSER_STOP =        &HA9
+Const VK_BROWSER_SEARCH =      &HAA
+Const VK_BROWSER_FAVORITES =   &HAB
+Const VK_BROWSER_HOME =        &HAC
+
+Const VK_VOLUME_MUTE =         &HAD
+Const VK_VOLUME_DOWN =         &HAE
+Const VK_VOLUME_UP =           &HAF
+Const VK_MEDIA_NEXT_TRACK =    &HB0
+Const VK_MEDIA_PREV_TRACK =    &HB1
+Const VK_MEDIA_STOP =          &HB2
+Const VK_MEDIA_PLAY_PAUSE =    &HB3
+Const VK_LAUNCH_MAIL =         &HB4
+Const VK_LAUNCH_MEDIA_SELECT = &HB5
+Const VK_LAUNCH_APP1 =         &HB6
+Const VK_LAUNCH_APP2 =         &HB7
+'#endif
+
+Const VK_OEM_1 =        &HBA
+Const VK_OEM_PLUS =     &HBB
+Const VK_OEM_COMMA =    &HBC
+Const VK_OEM_MINUS =    &HBD
+Const VK_OEM_PERIOD =   &HBE
+Const VK_OEM_2 =        &HBF
+Const VK_OEM_3 =        &HC0
+Const VK_OEM_4 =        &HDB
+Const VK_OEM_5 =        &HDC
+Const VK_OEM_6 =        &HDD
+Const VK_OEM_7 =        &HDE
+Const VK_OEM_8 =        &HDF
+Const VK_OEM_AX =       &HE1
+Const VK_OEM_102 =      &HE2
+Const VK_ICO_HELP =     &HE3
+Const VK_ICO_00 =       &HE4
+
+Const VK_PROCESSKEY =   &HE5
+
+Const VK_ICO_CLEAR =    &HE6
+
+
+'#if _WIN32_WINNT >= &h0500
+Const VK_PACKET =       &HE7
+'#endif
+
+Const VK_OEM_RESET =    &HE9
+Const VK_OEM_JUMP =     &HEA
+Const VK_OEM_PA1 =      &HEB
+Const VK_OEM_PA2 =      &HEC
+Const VK_OEM_PA3 =      &HED
+Const VK_OEM_WSCTRL =   &HEE
+Const VK_OEM_CUSEL =    &HEF
+Const VK_OEM_ATTN =     &HF0
+Const VK_OEM_FINISH =   &HF1
+Const VK_OEM_COPY =     &HF2
+Const VK_OEM_AUTO =     &HF3
+Const VK_OEM_ENLW =     &HF4
+Const VK_OEM_BACKTAB =  &HF5
+
+Const VK_ATTN =         &HF6
+Const VK_CRSEL =        &HF7
+Const VK_EXSEL =        &HF8
+Const VK_EREOF =        &HF9
+Const VK_PLAY =         &HFA
+Const VK_ZOOM =         &HFB
+Const VK_NONAME =       &HFC
+Const VK_PA1 =          &HFD
+Const VK_OEM_CLEAR =    &HFE
+
+'-------------------
+'  Window Messages
+'-------------------
+
+Const WM_NULL =                       &H0000
+Const WM_CREATE =                     &H0001
+' lParam of WM_CREATE message point to...
+Type CREATESTRUCTA
+	lpCreateParams As VoidPtr
+	hInstance As HINSTANCE
+	hMenu As HMENU
+	hwndParent As HWND
+	cy As Long
+	cx As Long
+	y As Long
+	x As Long
+	style As Long
+	lpszName As PCSTR
+	lpszClass As PCSTR
+	dwExStyle As DWord
+End Type
+Type CREATESTRUCTW
+	lpCreateParams As VoidPtr
+	hInstance As HINSTANCE
+	hMenu As HMENU
+	hwndParent As HWND
+	cy As Long
+	cx As Long
+	y As Long
+	x As Long
+	style As Long
+	lpszName As PCWSTR
+	lpszClass As PCWSTR
+	dwExStyle As DWord
+End Type
+#ifdef UNICODE
+TypeDef CREATESTRUCT = CREATESTRUCTW
+#else
+TypeDef CREATESTRUCT = CREATESTRUCTA
+#endif
+Const WM_DESTROY =                    &H0002
+Const WM_MOVE =                       &H0003
+Const WM_SIZE =                       &H0005
+' WM_SIZE message wParam values
+Const   SIZE_RESTORED =     0
+Const   SIZE_MINIMIZED =    1
+Const   SIZE_MAXIMIZED =    2
+Const   SIZE_MAXSHOW =      3
+Const   SIZE_MAXHIDE =      4
+
+Const WM_ACTIVATE =                   &H0006
+' WM_ACTIVATE state values
+Const     WA_INACTIVE =    0
+Const     WA_ACTIVE =      1
+Const     WA_CLICKACTIVE = 2
+
+Const WM_SETFOCUS =                   &H0007
+Const WM_KILLFOCUS =                  &H0008
+Const WM_ENABLE =                     &H000A
+Const WM_SETREDRAW =                  &H000B
+Const WM_SETTEXT =                    &H000C
+Const WM_GETTEXT =                    &H000D
+Const WM_GETTEXTLENGTH =              &H000E
+Const WM_PAINT =                      &H000F
+Const WM_CLOSE =                      &H0010
+Const WM_QUERYENDSESSION =            &H0011
+Const WM_QUIT =                       &H0012
+Const WM_QUERYOPEN =                  &H0013
+Const WM_ERASEBKGND =                 &H0014
+Const WM_SYSCOLORCHANGE =             &H0015
+Const WM_ENDSESSION =                 &H0016
+Const WM_SHOWWINDOW =                 &H0018
+' Identifiers for the WM_SHOWWINDOW message
+Const   SW_PARENTCLOSING =  1
+Const   SW_OTHERZOOM =      2
+Const   SW_PARENTOPENING =  3
+Const   SW_OTHERUNZOOM =    4
+Const WM_WININICHANGE =               &H001A
+Const WM_SETTINGCHANGE =              WM_WININICHANGE
+
+Const WM_DEVMODECHANGE =              &H001B
+Const WM_ACTIVATEAPP =                &H001C
+Const WM_FONTCHANGE =                 &H001D
+Const WM_TIMECHANGE =                 &H001E
+Const WM_CANCELMODE =                 &H001F
+Const WM_SETCURSOR =                  &H0020
+Const WM_MOUSEACTIVATE =              &H0021
+Const WM_CHILDACTIVATE =              &H0022
+Const WM_QUEUESYNC =                  &H0023
+
+Const WM_GETMINMAXINFO =              &H0024
+' Struct pointed to by WM_GETMINMAXINFO lParam
+Type MINMAXINFO
+	ptReserved As POINTAPI
+	ptMaxSize As POINTAPI
+	ptMaxPosition As POINTAPI
+	ptMinTrackSize As POINTAPI
+	ptMaxTrackSize As POINTAPI
+End Type
+
+Const WM_PAINTICON =                  &H0026
+Const WM_ICONERASEBKGND =             &H0027
+Const WM_NEXTDLGCTL =                 &H0028
+Const WM_SPOOLERSTATUS =              &H002A
+
+
+Const WM_DRAWITEM =                   &H002B
+
+'DRAWITEMSTRUCT for ownerdraw
+Type DRAWITEMSTRUCT
+	CtlType As DWord
+	CtlID As DWord
+	itemID As DWord
+	itemAction As DWord
+	itemState As DWord
+	hwndItem As HWND
+	hDC As HDC
+	rcItem As RECT
+	itemData As ULONG_PTR
+End Type
+
+
+Const WM_MEASUREITEM =                &H002C
+
+' Owner draw control types
+Const ODT_MENU       = 1
+Const ODT_LISTBOX    = 2
+Const ODT_COMBOBOX   = 3
+Const ODT_BUTTON     = 4
+Const ODT_STATIC     = 5
+
+'Owner draw actions
+Const ODA_DRAWENTIRE  = &H0001
+Const ODA_SELECT      = &H0002
+Const ODA_FOCUS       = &H0004
+
+'Owner draw state
+Const ODS_SELECTED    = &H0001
+Const ODS_GRAYED      = &H0002
+Const ODS_DISABLED    = &H0004
+Const ODS_CHECKED     = &H0008
+Const ODS_FOCUS       = &H0010
+Const ODS_DEFAULT         = &H0020
+Const ODS_COMBOBOXEDIT    = &H1000
+Const ODS_HOTLIGHT        = &H0040
+Const ODS_INACTIVE        = &H0080
+Const ODS_NOACCEL         = &H0100
+Const ODS_NOFOCUSRECT     = &H0200
+
+'MEASUREITEMSTRUCT for ownerdraw
+Type MEASUREITEMSTRUCT
+	CtlType As DWord
+	CtlID As DWord
+	itemID As DWord
+	itemWidth As DWord
+	itemHeight As DWord
+	itemData As ULONG_PTR
+End Type
+
+
+Const WM_DELETEITEM =                 &H002D
+
+' DELETEITEMSTRUCT for ownerdraw
+Type DELETEITEMSTRUCT
+	CtlType As DWord
+	CtlID As DWord
+	itemID As DWord
+	hwndItem As HWND
+	itemData As DWord
+End Type
+
+
+Const WM_VKEYTOITEM =                 &H002E
+Const WM_CHARTOITEM =                 &H002F
+Const WM_SETFONT =                    &H0030
+Const WM_GETFONT =                    &H0031
+Const WM_SETHOTKEY =                  &H0032
+Const WM_GETHOTKEY =                  &H0033
+Const WM_QUERYDRAGICON =              &H0037
+Const WM_COMPAREITEM =                &H0039
+' COMPAREITEMSTUCT for ownerdraw sorting
+Type COMPAREITEMSTRUCT
+	CtlType As DWord
+	CtlID As DWord
+	hwndItem As HWND
+	itemID1 As DWord
+	itemData1 As DWord
+	itemID2 As DWord
+	itemData2 As DWord
+	dwLocaleId As DWord
+End Type
+'#if WINVER > &h0500
+Const WM_GETOBJECT =                  &H003D
+'#endif
+Const WM_COMPACTING =                 &H0041
+Const WM_COMMNOTIFY =                 &H0044
+Const WM_WINDOWPOSCHANGING =          &H0046
+Const WM_WINDOWPOSCHANGED =           &H0047
+' WM_WINDOWPOSCHANGING/CHANGED struct pointed to by lParam
+Type WINDOWPOS
+	hwnd As HWND
+	hwndInsertAfter As HWND
+	x As Long
+	y As Long
+	cx As Long
+	cy As Long
+	flags As DWord
+End Type
+
+Const WM_POWER =                      &H0048
+' wParam for WM_POWER window message and DRV_POWER driver notification
+Const   PWR_OK =            1
+Const   PWR_FAIL =          -1
+Const   PWR_SUSPENDREQUEST =1
+Const   PWR_SUSPENDRESUME = 2
+Const   PWR_CRITICALRESUME =3
+
+Const WM_COPYDATA =                   &H004A
+' lParam of WM_COPYDATA message points to...
+Type COPYDATASTRUCT
+	dwData As DWord
+	cbData As DWord
+	lpData As VoidPtr
+End Type
+
+Const WM_CANCELJOURNAL =              &H004B
+Const WM_NOTIFY =                     &H004E
+Const WM_INPUTLANGCHANGEREQUEST =     &H0050
+Const WM_INPUTLANGCHANGE =            &H0051
+Const WM_TCARD =                      &H0052
+Const WM_HELP =                       &H0053
+' lParam of WM_HELP messgae point to...
+Type HELPINFO
+	cbSize As DWord
+	iContextType As Long
+	iCtrlId As Long
+	hItemHandle As HANDLE
+	dwContextId As DWord
+	MousePos As POINTAPI
+End Type
+Const WM_USERCHANGED =                &H0054
+Const WM_NOTIFYFORMAT =               &H0055
+Const   NFR_ANSI =                           1
+Const   NFR_UNICODE =                        2
+Const   NF_QUERY =                           3
+Const   NF_REQUERY =                         4
+
+Const WM_CONTEXTMENU =                &H007B
+Const WM_STYLECHANGING =              &H007C
+Const WM_STYLECHANGED =               &H007D
+Const WM_DISPLAYCHANGE =              &H007E
+Const WM_GETICON =                    &H007F
+Const WM_SETICON =                    &H0080
+' WM_SETICON / WM_GETICON Type Codes
+Const   ICON_SMALL =        0
+Const   ICON_BIG =          1
+
+Const WM_NCCREATE =                   &H0081
+Const WM_NCDESTROY =                  &H0082
+Const WM_NCCALCSIZE =                 &H0083
+Const WM_NCHITTEST =                  &H0084
+' WM_NCHITTEST and MOUSEHOOKSTRUCT Mouse Position Codes
+Const   HTERROR =           -2
+Const   HTTRANSPARENT =     -1
+Const   HTNOWHERE =         0
+Const   HTCLIENT =          1
+Const   HTCAPTION =         2
+Const   HTSYSMENU =         3
+Const   HTGROWBOX =         4
+Const   HTSIZE =            HTGROWBOX
+Const   HTMENU =            5
+Const   HTHSCROLL =         6
+Const   HTVSCROLL =         7
+Const   HTMINBUTTON =       8
+Const   HTMAXBUTTON =       9
+Const   HTLEFT =            10
+Const   HTRIGHT =           11
+Const   HTTOP =             12
+Const   HTTOPLEFT =         13
+Const   HTTOPRIGHT =        14
+Const   HTBOTTOM =          15
+Const   HTBOTTOMLEFT =      16
+Const   HTBOTTOMRIGHT =     17
+Const   HTBORDER =          18
+Const   HTREDUCE =          HTMINBUTTON
+Const   HTZOOM =            HTMAXBUTTON
+Const   HTSIZEFIRST =       HTLEFT
+Const   HTSIZELAST =        HTBOTTOMRIGHT
+Const   HTOBJECT =          19
+Const   HTCLOSE =           20
+Const   HTHELP =            21
+Const WM_NCPAINT =                    &H0085
+Const WM_NCACTIVATE =                 &H0086
+Const WM_GETDLGCODE =                 &H0087
+Const WM_SYNCPAINT =                  &H0088
+Const WM_NCMOUSEMOVE =                &H00A0
+Const WM_NCLBUTTONDOWN =              &H00A1
+Const WM_NCLBUTTONUP =                &H00A2
+Const WM_NCLBUTTONDBLCLK =            &H00A3
+Const WM_NCRBUTTONDOWN =              &H00A4
+Const WM_NCRBUTTONUP =                &H00A5
+Const WM_NCRBUTTONDBLCLK =            &H00A6
+Const WM_NCMBUTTONDOWN =              &H00A7
+Const WM_NCMBUTTONUP =                &H00A8
+Const WM_NCMBUTTONDBLCLK =            &H00A9
+'#if _WIN32_WINNT >= &h0500
+Const WM_NCXBUTTONDOWN =              &H00AB
+Const WM_NCXBUTTONUP =                &H00AC
+Const WM_NCXBUTTONDBLCLK =            &h00AD
+'#endif
+'#if _WIN32_WINNT >= &H0501
+Const WM_INPUT_DEVICE_CHANGE =        &H00FE
+Const WM_INPUT =                      &H00FF
+'#endif
+Const WM_KEYFIRST =                   &H0100
+Const WM_KEYDOWN =                    &H0100
+Const WM_KEYUP =                      &H0101
+Const WM_CHAR =                       &H0102
+Const WM_DEADCHAR =                   &H0103
+Const WM_SYSKEYDOWN =                 &H0104
+Const WM_SYSKEYUP =                   &H0105
+Const WM_SYSCHAR =                    &H0106
+Const WM_SYSDEADCHAR =                &H0107
+'#if _WIN32_WINNT >= &h0501
+Const WM_UNICHAR =                    &H0109
+Const UNICODE_NOCHAR =                &HFFFF
+Const WM_KEYLAST =                    &H0109
+'#else
+'Const WM_KEYLAST =                    &H0108
+'#endif
+Const WM_IME_STARTCOMPOSITION =       &H010D
+Const WM_IME_ENDCOMPOSITION =         &H010E
+Const WM_IME_COMPOSITION =            &H010F
+Const WM_IME_KEYLAST =                &H010F
+
+Const WM_INITDIALOG =                 &H0110
+Const WM_COMMAND =                    &H0111
+Const WM_SYSCOMMAND =                 &H0112
+' System Menu Command Values
+Const   SC_SIZE =         &HF000
+Const   SC_MOVE =         &HF010
+Const   SC_MINIMIZE =     &HF020
+Const   SC_MAXIMIZE =     &HF030
+Const   SC_NEXTWINDOW =   &HF040
+Const   SC_PREVWINDOW =   &HF050
+Const   SC_CLOSE =        &HF060
+Const   SC_VSCROLL =      &HF070
+Const   SC_HSCROLL =      &HF080
+Const   SC_MOUSEMENU =    &HF090
+Const   SC_KEYMENU =      &HF100
+Const   SC_ARRANGE =      &HF110
+Const   SC_RESTORE =      &HF120
+Const   SC_TASKLIST =     &HF130
+Const   SC_SCREENSAVE =   &HF140
+Const   SC_HOTKEY =       &HF150
+Const   SC_DEFAULT =      &HF160
+Const   SC_MONITORPOWER = &HF170
+Const   SC_CONTEXTHELP =  &HF180
+Const   SC_SEPARATOR =    &HF00F
+Const WM_TIMER =                      &H0113
+Const WM_HSCROLL =                    &H0114
+Const WM_VSCROLL =                    &H0115
+' Scroll Bar Commands
+Const   SB_LINEUP =         0
+Const   SB_LINELEFT =       0
+Const   SB_LINEDOWN =       1
+Const   SB_LINERIGHT =      1
+Const   SB_PAGEUP =         2
+Const   SB_PAGELEFT =       2
+Const   SB_PAGEDOWN =       3
+Const   SB_PAGERIGHT =      3
+Const   SB_THUMBPOSITION =  4
+Const   SB_THUMBTRACK =     5
+Const   SB_TOP =            6
+Const   SB_LEFT =           6
+Const   SB_BOTTOM =         7
+Const   SB_RIGHT =          7
+Const   SB_ENDSCROLL =      8
+Const WM_INITMENU =                   &H0116
+Const WM_INITMENUPOPUP =              &H0117
+Const WM_MENUSELECT =                 &H011F
+Const WM_MENUCHAR =                   &H0120
+' return codes for WM_MENUCHAR
+Const   MNC_IGNORE =  0
+Const   MNC_CLOSE =   1
+Const   MNC_EXECUTE = 2
+Const   MNC_SELECT = 3
+Const WM_ENTERIDLE =                  &H0121
+'#if WINVER >= &H0500
+Const WM_MENURBUTTONUP =              &H0122
+Const WM_MENUDRAG =                   &H0123
+Const WM_MENUGETOBJECT =              &H0124
+Const WM_UNINITMENUPOPUP =            &H0125
+Const WM_MENUCOMMAND =                &H0126
+
+Const WM_CHANGEUISTATE =              &H0127
+Const WM_UPDATEUISTATE =              &H0128
+Const WM_QUERYUISTATE =               &H0129
+'#endif
+Const WM_CTLCOLORMSGBOX =             &H0132
+Const WM_CTLCOLOREDIT =               &H0133
+Const WM_CTLCOLORLISTBOX =            &H0134
+Const WM_CTLCOLORBTN =                &H0135
+Const WM_CTLCOLORDLG =                &H0136
+Const WM_CTLCOLORSCROLLBAR =          &H0137
+Const WM_CTLCOLORSTATIC =             &H0138
+Const MN_GETHMENU =                   &H01E1
+
+Const WM_MOUSEFIRST =                 &H0200
+Const WM_MOUSEMOVE =                  &H0200
+Const WM_LBUTTONDOWN =                &H0201
+Const WM_LBUTTONUP =                  &H0202
+Const WM_LBUTTONDBLCLK =              &H0203
+Const WM_RBUTTONDOWN =                &H0204
+Const WM_RBUTTONUP =                  &H0205
+Const WM_RBUTTONDBLCLK =              &H0206
+Const WM_MBUTTONDOWN =                &H0207
+Const WM_MBUTTONUP =                  &H0208
+Const WM_MBUTTONDBLCLK =              &H0209
+'#if _WIN32_WINNT >= &H0400 || _WIN32_WINDOWS > &H0400
+Const WM_MOUSEWHEEL =                 &H020A
+'#endif
+'#if _WIN32_WINNT >= &H0500
+Const WM_XBUTTONDOWN =                &H020B
+Const WM_XBUTTONUP =                  &H020C
+Const WM_XBUTTONDBLCLK =              &H020D
+'#endif
+'#if _WIN32_WINNT >= &H0600
+Const WM_MOUSEHWHEEL =                &H020E
+'#endif
+Const WM_MOUSELAST =                  &H020E
+
+Const WHEEL_DELTA =                   120
+Const WHEEL_PAGESCROLL =              &HFFFFFFFF
+Const GET_WHEEL_DELTA_WPARAM(wp) = (HIWORD(wp) As Integer)
+'#if _WIN32_WINNT >= &H0500
+Const GET_KEYSTATE_WPARAM(wp) = (LOWORD(wp))
+Const GET_NCHITTEST_WPARAM(wp) = (LOWORD(wp) As Integer)
+Const GET_XBUTTON_WPARAM(wp) = (HIWORD(wp))
+
+Const XBUTTON1 = &H0001
+Const XBUTTON2 = &H0002
+'#endif
+
+Const WM_PARENTNOTIFY =               &H0210
+Const WM_ENTERMENULOOP =              &H0211
+Const WM_EXITMENULOOP =               &H0212
+
+Const WM_NEXTMENU =                   &H0213
+Const WM_SIZING =                     &H0214
+' wParam for WM_SIZING message
+Const   WMSZ_LEFT =         1
+Const   WMSZ_RIGHT =        2
+Const   WMSZ_TOP =          3
+Const   WMSZ_TOPLEFT =      4
+Const   WMSZ_TOPRIGHT =     5
+Const   WMSZ_BOTTOM =       6
+Const   WMSZ_BOTTOMLEFT =   7
+Const   WMSZ_BOTTOMRIGHT =  8
+
+Const WM_CAPTURECHANGED =             &H0215
+Const WM_MOVING =                     &H0216
+
+Const WM_POWERBROADCAST =             &H0218
+' wParam for WM_POWERBROADCAST message
+Const   PBT_APMQUERYSUSPEND =           &H0000
+Const   PBT_APMQUERYSTANDBY =           &H0001
+Const   PBT_APMQUERYSUSPENDFAILED =     &H0002
+Const   PBT_APMQUERYSTANDBYFAILED =     &H0003
+Const   PBT_APMSUSPEND =                &H0004
+Const   PBT_APMSTANDBY =                &H0005
+Const   PBT_APMRESUMECRITICAL =         &H0006
+Const   PBT_APMRESUMESUSPEND =          &H0007
+Const   PBT_APMRESUMESTANDBY =          &H0008
+Const   PBTF_APMRESUMEFROMFAILURE =     &H00000001
+Const   PBT_APMBATTERYLOW =             &H0009
+Const   PBT_APMPOWERSTATUSCHANGE =      &H000A
+Const   PBT_APMOEMEVENT =               &H000B
+Const   PBT_APMRESUMEAUTOMATIC =        &H0012
+'#if _WIN32_WINNT >= &H0502
+Const   PBT_POWERSETTINGCHANGE =        &H0013
+Type POWERBROADCAST_SETTING
+	PowerSetting As GUID
+	DataLength As DWord
+	Data[ELM(1)] As Byte
+End Type
+'#endif
+
+Const WM_DEVICECHANGE =               &H0219
+
+Const WM_MDICREATE =                  &H0220
+' lParam of WM_MDICREATE message point to...
+Type MDICREATESTRUCTA
+	szClass As PCSTR
+	szTitle As PCSTR
+	hOwner As HANDLE
+	x As Long
+	y As Long
+	cx As Long
+	cy As Long
+	style As DWord
+	lParam As LPARAM
+End Type
+Type MDICREATESTRUCTW
+	szClass As PCWSTR
+	szTitle As PCWSTR
+	hOwner As HANDLE
+	x As Long
+	y As Long
+	cx As Long
+	cy As Long
+	style As DWord
+	lParam As LPARAM
+End Type
+#ifdef UNICODE
+TypeDef MDICREATESTRUCT = MDICREATESTRUCTW
+#else
+TypeDef MDICREATESTRUCT = MDICREATESTRUCTA
+#endif
+Const WM_MDIDESTROY =                 &H0221
+Const WM_MDIACTIVATE =                &H0222
+Const WM_MDIRESTORE =                 &H0223
+Const WM_MDINEXT =                    &H0224
+Const WM_MDIMAXIMIZE =                &H0225
+Const WM_MDITILE =                    &H0226
+' wParam Flags for WM_MDITILE and WM_MDICASCADE messages.
+Const   MDITILE_VERTICAL =     &H0000
+Const   MDITILE_HORIZONTAL =   &H0001
+Const   MDITILE_SKIPDISABLED = &H0002
+Const WM_MDICASCADE =                 &H0227
+Const WM_MDIICONARRANGE =             &H0228
+Const WM_MDIGETACTIVE =               &H0229
+
+Const WM_MDISETMENU =                 &H0230
+Const WM_ENTERSIZEMOVE =              &H0231
+Const WM_EXITSIZEMOVE =               &H0232
+Const WM_DROPFILES =                  &H0233
+Const WM_MDIREFRESHMENU =             &H0234
+
+Const WM_IME_SETCONTEXT =             &H0281
+Const WM_IME_NOTIFY =                 &H0282
+Const WM_IME_CONTROL =                &H0283
+Const WM_IME_COMPOSITIONFULL =        &H0284
+Const WM_IME_SELECT =                 &H0285
+Const WM_IME_CHAR =                   &H0286
+'#if WINVER >= 0x0500
+Const WM_IME_REQUEST =                &H0288
+'#endif
+Const WM_IME_KEYDOWN =                &H0290
+Const WM_IME_KEYUP =                  &H0291
+'#if _WIN32_WINNT >= &H0400 Or WINVER >= &H0500
+Const WM_MOUSEHOVER =                 &H02A1
+Const WM_MOUSELEAVE =                 &H02A3
+'#endif
+'#if WINVER >= &H0500
+Const WM_NCMOUSEHOVER =               &H02A1
+Const WM_NCMOUSELEAVE =               &H02A3
+'#endif
+'#if _WIN32_WINNT >= &H0501
+Const WM_WTSSESSION_CHANGE =          &H02B1
+
+Const WM_TABLET_FIRST =               &H02C0
+Const WM_TABLET_LAST =                &H02DF
+'#endif
+Const WM_CUT =                        &H0300
+Const WM_COPY =                       &H0301
+Const WM_PASTE =                      &H0302
+Const WM_CLEAR =                      &H0303
+Const WM_UNDO =                       &H0304
+Const WM_RENDERFORMAT =               &H0305
+Const WM_RENDERALLFORMATS =           &H0306
+Const WM_DESTROYCLIPBOARD =           &H0307
+Const WM_DRAWCLIPBOARD =              &H0308
+Const WM_PAINTCLIPBOARD =             &H0309
+Const WM_VSCROLLCLIPBOARD =           &H030A
+Const WM_SIZECLIPBOARD =              &H030B
+Const WM_ASKCBFORMATNAME =            &H030C
+Const WM_CHANGECBCHAIN =              &H030D
+Const WM_HSCROLLCLIPBOARD =           &H030E
+Const WM_QUERYNEWPALETTE =            &H030F
+Const WM_PALETTEISCHANGING =          &H0310
+Const WM_PALETTECHANGED =             &H0311
+Const WM_HOTKEY =                     &H0312
+
+Const WM_PRINT =                      &H0317
+Const WM_PRINTCLIENT =                &H0318
+' WM_PRINT flags
+Const   PRF_CHECKVISIBLE =  &H00000001
+Const   PRF_NONCLIENT =     &H00000002
+Const   PRF_CLIENT =        &H00000004
+Const   PRF_ERASEBKGND =    &H00000008
+Const   PRF_CHILDREN =      &H00000010
+Const   PRF_OWNED =         &H00000020
+
+'#if _WIN32_WINNT >= &H0500
+Const WM_APPCOMMAND =                 &H0319
+'#endif
+'#if _WIN32_WINNT >= &H0501
+Const WM_THEMECHANGED =               &H031A
+'#endif
+
+'#if _WIN32_WINNT >= &H0501
+Const WM_CLIPBOARDUPDATE =            &H031D
+'#endif
+
+'#if _WIN32_WINNT >= &H0600
+Const WM_DWMCOMPOSITIONCHANGED =      &H031E
+Const WM_DWMNCRENDERINGCHANGED =      &H031F
+Const WM_DWMCOLORIZATIONCOLORCHANGED =&H0320
+Const WM_DWMWINDOWMAXIMIZEDCHANGE =   &H0321
+'#endif
+
+'#if WINVER >= &H0600
+Const WM_GETTITLEBARINFOEX =          &H033F
+'#endif
+
+Const WM_HANDHELDFIRST =              &H0358
+Const WM_HANDHELDLAST =               &H035F
+
+Const WM_AFXFIRST =                   &H0360
+Const WM_AFXLAST =                    &H037F
+
+Const WM_PENWINFIRST =                &H0380
+Const WM_PENWINLAST =                 &H038F
+
+Const WM_APP =                        &H8000
+Const WM_USER =                       &H0400
+
+' WM_MOUSEACTIVATE Return Codes
+Const MA_ACTIVATE =         1
+Const MA_ACTIVATEANDEAT =   2
+Const MA_NOACTIVATE =       3
+Const MA_NOACTIVATEANDEAT = 4
+
+' Key State Masks for Mouse Messages
+Const MK_LBUTTON =        &H0001
+Const MK_RBUTTON =        &H0002
+Const MK_SHIFT =          &H0004
+Const MK_CONTROL =        &H0008
+Const MK_MBUTTON =        &H0010
+'#if _WIN32_WINNT >= 0x0500
+Const MK_XBUTTON1 =       &h0020
+Const MK_XBUTTON2 =       &h0040
+'#endif
+
+
+'----------------------------------
+' Edit Control Notification Codes
+'----------------------------------
+
+Const EN_SETFOCUS =       &H0100
+Const EN_KILLFOCUS =      &H0200
+Const EN_CHANGE =         &H0300
+Const EN_UPDATE =         &H0400
+Const EN_ERRSPACE =       &H0500
+Const EN_MAXTEXT =        &H0501
+Const EN_HSCROLL =        &H0601
+Const EN_VSCROLL =        &H0602
+
+
+'------------------------
+' Edit Control Messages
+'------------------------
+Const EM_GETSEL =             &H00B0
+Const EM_SETSEL =             &H00B1
+Const EM_GETRECT =            &H00B2
+Const EM_SETRECT =            &H00B3
+Const EM_SETRECTNP =          &H00B4
+Const EM_SCROLL =             &H00B5
+Const EM_LINESCROLL =         &H00B6
+Const EM_SCROLLCARET =        &H00B7
+Const EM_GETMODIFY =          &H00B8
+Const EM_SETMODIFY =          &H00B9
+Const EM_GETLINECOUNT =       &H00BA
+Const EM_LINEINDEX =          &H00BB
+Const EM_SETHANDLE =          &H00BC
+Const EM_GETHANDLE =          &H00BD
+Const EM_GETTHUMB =           &H00BE
+Const EM_LINELENGTH =         &H00C1
+Const EM_REPLACESEL =         &H00C2
+Const EM_GETLINE =            &H00C4
+Const EM_LIMITTEXT =          &H00C5
+Const EM_CANUNDO =            &H00C6
+Const EM_UNDO =               &H00C7
+Const EM_FMTLINES =           &H00C8
+Const EM_LINEFROMCHAR =       &H00C9
+Const EM_SETTABSTOPS =        &H00CB
+Const EM_SETPASSWORDCHAR =    &H00CC
+Const EM_EMPTYUNDOBUFFER =    &H00CD
+Const EM_GETFIRSTVISIBLELINE =&H00CE
+Const EM_SETREADONLY =        &H00CF
+Const EM_SETWORDBREAKPROC =   &H00D0
+Const EM_GETWORDBREAKPROC =   &H00D1
+Const EM_GETPASSWORDCHAR =    &H00D2
+
+Const EM_SETMARGINS =         &H00D3
+Const EC_LEFTMARGIN =     &H0001
+Const EC_RIGHTMARGIN =    &H0002
+Const EC_USEFONTINFO =    &Hffff
+
+Const EM_GETMARGINS =         &H00D4
+Const EM_SETLIMITTEXT =       EM_LIMITTEXT
+Const EM_GETLIMITTEXT =       &H00D5
+Const EM_POSFROMCHAR =        &H00D6
+Const EM_CHARFROMPOS =        &H00D7
+
+Const EM_SETIMESTATUS =       &H00D8
+Const EM_GETIMESTATUS =       &H00D9
+Const EMSIS_COMPOSITIONSTRING =      &H0001
+Const EIMES_GETCOMPSTRATONCE =       &H0001
+Const EIMES_CANCELCOMPSTRINFOCUS =   &H0002
+Const EIMES_COMPLETECOMPSTRKILLFOCUS =&H0004
+
+
+'---------------------------------
+' User Button Notification Codes
+'---------------------------------
+
+Const BN_CLICKED =        0
+Const BN_PAINT =          1
+Const BN_HILITE =         2
+Const BN_UNHILITE =       3
+Const BN_DISABLE =        4
+Const BN_DOUBLECLICKED =  5
+Const BN_PUSHED =         BN_HILITE
+Const BN_UNPUSHED =       BN_UNHILITE
+Const BN_DBLCLK =         BN_DOUBLECLICKED
+Const BN_SETFOCUS =       6
+Const BN_KILLFOCUS =      7
+
+
+'--------------------------
+' Button Control Messages
+'--------------------------
+
+Const BM_GETCHECK =      &H00F0
+Const BM_SETCHECK =      &H00F1
+Const BM_GETSTATE =      &H00F2
+Const BM_SETSTATE =      &H00F3
+Const BM_SETSTYLE =      &H00F4
+Const BM_CLICK =         &H00F5
+Const BM_GETIMAGE =      &H00F6
+Const BM_SETIMAGE =      &H00F7
+
+Const BST_UNCHECKED =    &H0000
+Const BST_CHECKED =      &H0001
+Const BST_INDETERMINATE =&H0002
+Const BST_PUSHED =       &H0004
+Const BST_FOCUS =        &H0008
+
+
+'-------------------------
+' Static Control Mesages
+'-------------------------
+Const STM_SETICON =       &H0170
+Const STM_GETICON =       &H0171
+Const STM_SETIMAGE =      &H0172
+Const STM_GETIMAGE =      &H0173
+Const STN_CLICKED =       0
+Const STN_DBLCLK =        1
+Const STN_ENABLE =        2
+Const STN_DISABLE =       3
+Const STM_MSGMAX =        &H0174
+
+
+'--------------------------
+' ListBox Control Mesages
+'--------------------------
+Const LB_ADDSTRING =           &H0180
+Const LB_INSERTSTRING =        &H0181
+Const LB_DELETESTRING =        &H0182
+Const LB_SELITEMRANGEEX =      &H0183
+Const LB_RESETCONTENT =        &H0184
+Const LB_SETSEL =              &H0185
+Const LB_SETCURSEL =           &H0186
+Const LB_GETSEL =              &H0187
+Const LB_GETCURSEL =           &H0188
+Const LB_GETTEXT =             &H0189
+Const LB_GETTEXTLEN =          &H018A
+Const LB_GETCOUNT =            &H018B
+Const LB_SELECTSTRING =        &H018C
+Const LB_DIR =                 &H018D
+Const LB_GETTOPINDEX =         &H018E
+Const LB_FINDSTRING =          &H018F
+Const LB_GETSELCOUNT =         &H0190
+Const LB_GETSELITEMS =         &H0191
+Const LB_SETTABSTOPS =         &H0192
+Const LB_GETHORIZONTALEXTENT = &H0193
+Const LB_SETHORIZONTALEXTENT = &H0194
+Const LB_SETCOLUMNWIDTH =      &H0195
+Const LB_ADDFILE =             &H0196
+Const LB_SETTOPINDEX =         &H0197
+Const LB_GETITEMRECT =         &H0198
+Const LB_GETITEMDATA =         &H0199
+Const LB_SETITEMDATA =         &H019A
+Const LB_SELITEMRANGE =        &H019B
+Const LB_SETANCHORINDEX =      &H019C
+Const LB_GETANCHORINDEX =      &H019D
+Const LB_SETCARETINDEX =       &H019E
+Const LB_GETCARETINDEX =       &H019F
+Const LB_SETITEMHEIGHT =       &H01A0
+Const LB_GETITEMHEIGHT =       &H01A1
+Const LB_FINDSTRINGEXACT =     &H01A2
+Const LB_SETLOCALE =           &H01A5
+Const LB_GETLOCALE =           &H01A6
+Const LB_SETCOUNT =            &H01A7
+Const LB_INITSTORAGE =         &H01A8
+Const LB_ITEMFROMPOINT =       &H01A9
+
+Const LBN_ERRSPACE =      -2
+Const LBN_SELCHANGE =     1
+Const LBN_DBLCLK =        2
+Const LBN_SELCANCEL =     3
+Const LBN_SETFOCUS =      4
+Const LBN_KILLFOCUS =     5
+
+Const LB_ERR =      -1
+Const LB_ERRSPACE = -2
+
+
+'---------------------------
+' ComboBox Control Mesages
+'---------------------------
+Const CB_GETEDITSEL =             &H0140
+Const CB_LIMITTEXT =              &H0141
+Const CB_SETEDITSEL =             &H0142
+Const CB_ADDSTRING =              &H0143
+Const CB_DELETESTRING =           &H0144
+Const CB_DIR =                    &H0145
+Const CB_GETCOUNT =               &H0146
+Const CB_GETCURSEL =              &H0147
+Const CB_GETLBTEXT =              &H0148
+Const CB_GETLBTEXTLEN =           &H0149
+Const CB_INSERTSTRING =           &H014A
+Const CB_RESETCONTENT =           &H014B
+Const CB_FINDSTRING =             &H014C
+Const CB_SELECTSTRING =           &H014D
+Const CB_SETCURSEL =              &H014E
+Const CB_SHOWDROPDOWN =           &H014F
+Const CB_GETITEMDATA =            &H0150
+Const CB_SETITEMDATA =            &H0151
+Const CB_GETDROPPEDCONTROLRECT =  &H0152
+Const CB_SETITEMHEIGHT =          &H0153
+Const CB_GETITEMHEIGHT =          &H0154
+Const CB_SETEXTENDEDUI =          &H0155
+Const CB_GETEXTENDEDUI =          &H0156
+Const CB_GETDROPPEDSTATE =        &H0157
+Const CB_FINDSTRINGEXACT =        &H0158
+Const CB_SETLOCALE =              &H0159
+Const CB_GETLOCALE =              &H015A
+Const CB_GETTOPINDEX =            &H015B
+Const CB_SETTOPINDEX =            &H015C
+Const CB_GETHORIZONTALEXTENT =    &H015D
+Const CB_SETHORIZONTALEXTENT =    &H015E
+Const CB_GETDROPPEDWIDTH =        &H015F
+Const CB_SETDROPPEDWIDTH =        &H0160
+Const CB_INITSTORAGE =            &H0161
+Const CB_MSGMAX =                 &H0162
+
+Const CBN_ERRSPACE =      -1
+Const CBN_SELCHANGE =     1
+Const CBN_DBLCLK =        2
+Const CBN_SETFOCUS =      3
+Const CBN_KILLFOCUS =     4
+Const CBN_EDITCHANGE =    5
+Const CBN_EDITUPDATE =    6
+Const CBN_DROPDOWN =      7
+Const CBN_CLOSEUP =       8
+Const CBN_SELENDOK =      9
+Const CBN_SELENDCANCEL =  10
Index: /trunk/ab5.0/ablib/src/api_psapi.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_psapi.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_psapi.sbp	(revision 506)
@@ -0,0 +1,126 @@
+' api_psapi.sbp
+
+#ifdef UNICODE
+Const _FuncName_GetModuleBaseName = "GetModuleBaseNameW"
+Const _FuncName_GetModuleFileNameEx = "GetModuleFileNameExW"
+Const _FuncName_GetMappedFileName = "GetMappedFileNameW"
+Const _FuncName_GetDeviceDriverBaseName = "GetDeviceDriverBaseNameW"
+Const _FuncName_GetDeviceDriverFileName = "GetDeviceDriverFileNameW"
+Const _FuncName_GetProcessImageFileName = "GetProcessImageFileNameW"
+Const _FuncName_EnumPageFiles = "EnumPageFilesW"
+#else
+Const _FuncName_GetModuleBaseName = "GetModuleBaseNameA"
+Const _FuncName_GetModuleFileNameEx = "GetModuleFileNameExA"
+Const _FuncName_GetMappedFileName = "GetMappedFileNameA"
+Const _FuncName_GetDeviceDriverBaseName = "GetDeviceDriverBaseNameA"
+Const _FuncName_GetDeviceDriverFileName = "GetDeviceDriverFileNameA"
+Const _FuncName_GetProcessImageFileName = "GetProcessImageFileNameA"
+Const _FuncName_EnumPageFiles = "EnumPageFilesA"
+#endif
+
+Declare Function EnumProcesses Lib "psapi" (lpidProcess As *DWord, cb As DWord, ByRef cbNeeded As DWord) As BOOL
+Declare Function EnumProcessModules Lib "psapi" (hProcess As HANDLE, lphModule As *HANDLE, cb As DWord, ByRef lpcbNeeded As DWord) As BOOL
+Declare Function GetModuleBaseName Lib "psapi" Alias _FuncName_GetModuleBaseName (hProcess As HANDLE, hModule As HANDLE, lpBaseName As LPTSTR, nSize As DWord) As DWORD
+Declare Function GetModuleFileNameEx Lib "psapi" Alias _FuncName_GetModuleFileNameEx (hProcess As HANDLE, hModule As HANDLE, lpFilename As LPTSTR, nSize As DWord) As DWORD
+
+Type MODULEINFO
+	lpBaseOfDll As VoidPtr
+	SizeOfImage As DWORD
+	EntryPoint As VoidPtr
+End Type
+TypeDef LPMODULEINFO = *MODULEINFO
+
+Declare Function GetModuleInformation Lib "psapi" (hProcess As HANDLE, hModule As HANDLE, lpmodinfo As LPMODULEINFO, cb As DWord) As BOOL
+Declare Function EmptyWorkingSet Lib "psapi" (hProcess As HANDLE) As BOOL
+Declare Function QueryWorkingSet Lib "psapi" (hProcess As HANDLE, pv As VoidPtr, cb As DWord) As BOOL
+Declare Function QueryWorkingSetEx Lib "psapi" (hProcess As HANDLE, pv As VoidPtr, cb As DWord) As BOOL
+Declare Function InitializeProcessForWsWatch Lib "psapi" (hProcess As HANDLE) As BOOL
+
+Type PSAPI_WS_WATCH_INFORMATION
+	FaultingPc As VoidPtr
+	FaultingVa As VoidPtr
+End Type
+TypeDef PPSAPI_WS_WATCH_INFORMATION = *PSAPI_WS_WATCH_INFORMATION
+
+Declare Function GetWsChanges Lib "psapi" (hProcess As HANDLE, lpWatchInfo As PPSAPI_WS_WATCH_INFORMATION, cb As DWord) As BOOL
+Declare Function GetMappedFileName Lib "psapi" Alias _FuncName_GetMappedFileName (hProcess As HANDLE, lpv As VoidPtr, lpFilename As LPTSTR, nSize As DWord) As DWORD
+Declare Function EnumDeviceDrivers Lib "psapi" (ByRef lpImageBase As VoidPtr, cb As DWord, ByRef lpcbNeeded As DWord) As BOOL
+Declare Function GetDeviceDriverBaseName Lib "psapi" Alias _FuncName_GetDeviceDriverBaseName (ImageBase As VoidPtr, lpBaseName As LPTSTR, nSize As DWord) As DWORD
+Declare Function GetDeviceDriverFileName Lib "psapi" Alias _FuncName_GetDeviceDriverFileName (ImageBase As VoidPtr, lpFilename As LPTSTR, nSize As DWord) As DWORD
+
+' Structure for GetProcessMemoryInfo()
+Type PROCESS_MEMORY_COUNTERS
+	cb As DWORD
+	PageFaultCount As DWORD
+	PeakWorkingSetSize As SIZE_T
+	WorkingSetSize As SIZE_T
+	QuotaPeakPagedPoolUsage As SIZE_T
+	QuotaPagedPoolUsage As SIZE_T
+	QuotaPeakNonPagedPoolUsage As SIZE_T
+	QuotaNonPagedPoolUsage As SIZE_T
+	PagefileUsage As SIZE_T
+	PeakPagefileUsage As SIZE_T
+End Type
+
+TypeDef PPROCESS_MEMORY_COUNTERS = *PROCESS_MEMORY_COUNTERS
+
+#ifdef _WIN32_WINNT
+Type PROCESS_MEMORY_COUNTERS_EX
+	cb As DWORD
+	PageFaultCount As DWORD
+	PeakWorkingSetSize As SIZE_T
+	WorkingSetSize As SIZE_T
+	QuotaPeakPagedPoolUsage As SIZE_T
+	QuotaPagedPoolUsage As SIZE_T
+	QuotaPeakNonPagedPoolUsage As SIZE_T
+	QuotaNonPagedPoolUsage As SIZE_T
+	PagefileUsage As SIZE_T
+	PeakPagefileUsage As SIZE_T
+	PrivateUsage As SIZE_T
+End Type
+TypeDef PPROCESS_MEMORY_COUNTERS_EX = *PROCESS_MEMORY_COUNTERS_EX
+#endif
+
+Declare Function GetProcessMemoryInfo Lib "psapi" (Process As HANDLE, ppsmemCounters As PPROCESS_MEMORY_COUNTERS, cb As DWord) As BOOL
+
+Type PERFORMANCE_INFORMATION
+	cb As DWORD
+	CommitTotal As SIZE_T
+	CommitLimit As SIZE_T
+	CommitPeak As SIZE_T
+	PhysicalTotal As SIZE_T
+	PhysicalAvailable As SIZE_T
+	SystemCache As SIZE_T
+	KernelTotal As SIZE_T
+	KernelPaged As SIZE_T
+	KernelNonpaged As SIZE_T
+	PageSize As SIZE_T
+	HandleCount As DWORD
+	ProcessCount As DWORD
+	ThreadCount As DWORD
+End Type
+TypeDef PPERFORMANCE_INFORMATION = *PERFORMANCE_INFORMATION
+TypeDef PERFORMACE_INFORMATION = PERFORMANCE_INFORMATION
+TypeDef PPERFORMACE_INFORMATION = *PERFORMANCE_INFORMATION
+
+Declare Function GetPerformanceInfo Lib "psapi" (pPerformanceInformation As PPERFORMACE_INFORMATION, cb As DWord) As BOOL
+
+Type ENUM_PAGE_FILE_INFORMATION
+	cb As DWORD
+	Reserved As DWORD
+	TotalSize As SIZE_T
+	TotalInUse As SIZE_T
+	PeakUsage As SIZE_T
+End Type
+TypeDef PENUM_PAGE_FILE_INFORMATION = *ENUM_PAGE_FILE_INFORMATION
+
+TypeDef PENUM_PAGE_FILE_CALLBACKW = *Function(pContext As VoidPtr, pPageFileInfo As PENUM_PAGE_FILE_INFORMATION, lpFilename As LPCWSTR) As BOOL
+TypeDef PENUM_PAGE_FILE_CALLBACKA = *Function(pContext As VoidPtr, pPageFileInfo As PENUM_PAGE_FILE_INFORMATION, lpFilename As LPCSTR) As BOOL
+#ifdef UNICODE
+TypeDef PENUM_PAGE_FILE_CALLBACK = PENUM_PAGE_FILE_CALLBACKW
+#else
+TypeDef PENUM_PAGE_FILE_CALLBACK = PENUM_PAGE_FILE_CALLBACKA
+#endif
+
+Declare Function EnumPageFiles Lib "psapi" Alias _FuncName_EnumPageFiles (pCallBackRoutine As PENUM_PAGE_FILE_CALLBACK, pContext As VoidPtr) As BOOL
+Declare Function GetProcessImageFileName Lib "psapi" Alias _FuncName_GetProcessImageFileName (hProcess As HANDLE, lpImageFileName As LPTSTR, nSize As DWord) As DWORD
Index: /trunk/ab5.0/ablib/src/api_reg.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_reg.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_reg.sbp	(revision 506)
@@ -0,0 +1,162 @@
+' api_reg.sbp
+' Registry Operation
+
+#ifdef UNICODE
+Const _FuncName_RegConnectRegistry = "RegConnectRegistryW"
+Const _FuncName_RegConnectRegistryEx = "RegConnectRegistryExW"
+Const _FuncName_RegCreateKeyEx = "RegCreateKeyExW"
+Const _FuncName_RegCreateKeyTransacted = "RegCreateKeyTransactedW"
+Const _FuncName_RegDeleteKey = "RegDeleteKeyW"
+Const _FuncName_RegDeleteKeyEx = "RegDeleteKeyExW"
+Const _FuncName_RegDeleteKeyTransacted = "RegDeleteKeyTransactedW"
+Const _FuncName_RegDeleteValue = "RegDeleteValueW"
+Const _FuncName_RegEnumKeyEx = "RegEnumKeyExW"
+Const _FuncName_RegEnumValue = "RegEnumValueW"
+Const _FuncName_RegLoadKey = "RegLoadKeyW"
+Const _FuncName_RegOpenKeyEx = "RegOpenKeyExW"
+Const _FuncName_RegOpenKeyTransacted = "RegOpenKeyTransactedW"
+Const _FuncName_RegQueryInfoKey = "RegQueryInfoKeyW"
+Const _FuncName_RegQueryMultipleValues = "RegQueryMultipleValuesW"
+Const _FuncName_RegQueryValueEx = "RegQueryValueExW"
+Const _FuncName_RegReplaceKey = "RegReplaceKeyW"
+Const _FuncName_RegRestoreKey = "RegRestoreKeyW"
+Const _FuncName_RegSaveKey = "RegSaveKeyW"
+Const _FuncName_RegSetValueEx = "RegSetValueExW"
+Const _FuncName_RegUnLoadKey = "RegUnLoadKeyW"
+Const _FuncName_RegDeleteKeyValue = "RegDeleteKeyValueW"
+Const _FuncName_RegSetKeyValue = "RegSetKeyValueW"
+Const _FuncName_RegDeleteTree = "RegDeleteTreeW"
+Const _FuncName_RegCopyTree = "RegCopyTreeW"
+Const _FuncName_RegGetValue = "RegGetValueW"
+Const _FuncName_RegLoadMUIString = "RegLoadMUIStringW"
+Const _FuncName_RegLoadAppKey = "RegLoadAppKeyW"
+Const _FuncName_RegSaveKeyEx = "RegSaveKeyExW"
+#else
+Const _FuncName_RegConnectRegistry = "RegConnectRegistryA"
+Const _FuncName_RegConnectRegistryEx = "RegConnectRegistryExA"
+Const _FuncName_RegCreateKeyEx = "RegCreateKeyExA"
+Const _FuncName_RegCreateKeyTransacted = "RegCreateKeyTransactedA"
+Const _FuncName_RegDeleteKey = "RegDeleteKeyA"
+Const _FuncName_RegDeleteKeyEx = "RegDeleteKeyExA"
+Const _FuncName_RegDeleteKeyTransacted = "RegDeleteKeyTransactedA"
+Const _FuncName_RegDeleteValue = "RegDeleteValueA"
+Const _FuncName_RegEnumKeyEx = "RegEnumKeyExA"
+Const _FuncName_RegEnumValue = "RegEnumValueA"
+Const _FuncName_RegLoadKey = "RegLoadKeyA"
+Const _FuncName_RegOpenKeyEx = "RegOpenKeyExA"
+Const _FuncName_RegOpenKeyTransacted = "RegOpenKeyTransactedA"
+Const _FuncName_RegQueryInfoKey = "RegQueryInfoKeyA"
+Const _FuncName_RegQueryMultipleValues = "RegQueryMultipleValuesA"
+Const _FuncName_RegQueryValueEx = "RegQueryValueExA"
+Const _FuncName_RegReplaceKey = "RegReplaceKeyA"
+Const _FuncName_RegRestoreKey = "RegRestoreKeyA"
+Const _FuncName_RegSaveKey = "RegSaveKeyA"
+Const _FuncName_RegSetValueEx = "RegSetValueExA"
+Const _FuncName_RegUnLoadKey = "RegUnLoadKeyA"
+Const _FuncName_RegDeleteKeyValue = "RegDeleteKeyValueA"
+Const _FuncName_RegSetKeyValue = "RegSetKeyValueA"
+Const _FuncName_RegDeleteTree = "RegDeleteTreeA"
+Const _FuncName_RegCopyTree = "RegCopyTreeA"
+Const _FuncName_RegGetValue = "RegGetValueA"
+Const _FuncName_RegLoadMUIString = "RegLoadMUIStringA"
+Const _FuncName_RegLoadAppKey = "RegLoadAppKeyA"
+Const _FuncName_RegSaveKeyEx = "RegSaveKeyExA"
+#endif
+
+TypeDef REGSAM = Long 'ACCESS_MASK
+
+' Reserved Key Handles
+Const HKEY_CLASSES_ROOT =     ((&H80000000 As Long) As ULONG_PTR) As HKEY
+Const HKEY_CURRENT_USER =     ((&H80000001 As Long) As ULONG_PTR) As HKEY
+Const HKEY_LOCAL_MACHINE =    ((&H80000002 As Long) As ULONG_PTR) As HKEY
+Const HKEY_USERS =            ((&H80000003 As Long) As ULONG_PTR) As HKEY
+Const HKEY_PERFORMANCE_DATA = ((&H80000004 As Long) As ULONG_PTR) As HKEY
+Const HKEY_CURRENT_CONFIG =   ((&H80000005 As Long) As ULONG_PTR) As HKEY
+Const HKEY_DYN_DATA =         ((&H80000006 As Long) As ULONG_PTR) As HKEY
+
+Const REG_SECURE_CONNECTION = 1
+
+Type VALENTW
+	ve_valuename As PWSTR
+	ve_valuelen As DWord
+	ve_valueptr As ULONG_PTR
+	ve_type As DWord
+End Type
+Type VALENTA
+	ve_valuename As PSTR
+	ve_valuelen As DWord
+	ve_valueptr As ULONG_PTR
+	ve_type As DWord
+End Type
+
+#ifdef UNICODE
+TypeDef VALENT = VALENTW
+#else
+TypeDef VALENT = VALENTA
+#endif
+'------------------------
+' Registry API Functions
+
+Declare Function RegCloseKey Lib "advapi32" (hKey As HKEY) As Long
+'#if WINVER >= 0x0500 'AB
+Declare Function RegOverridePredefKey Lib "advapi32" (hKey As HKEY, hNewKey As HKEY) As Long
+Declare Function RegOpenUserClassesRoot Lib "advapi32" (hToken As HANDLE, dwOptions As DWord, samDesired As REGSAM, ByRef hkResult As HKEY) As Long
+Declare Function RegOpenCurrentUser Lib "advapi32" (samDesired As REGSAM, ByRef hkResult As HKEY) As Long
+Declare Function RegDisablePredefinedCache Lib "advapi32" () As Long
+Declare Function RegDisablePredefinedCacheEx Lib "advapi32" () As Long
+'#endif
+Declare Function RegConnectRegistry Lib "advapi32" Alias _FuncName_RegConnectRegistry (pMachineName As PCTSTR, hKey As HKEY, ByRef hkResult As HKEY) As Long
+Declare Function RegConnectRegistryEx Lib "advapi32" Alias _FuncName_RegConnectRegistryEx (lpMachineName As LPCTSTR, hKey As HKEY, Flags As DWord, ByRef hkResult As HKEY) As Long
+Declare Function RegCreateKeyEx Lib "advapi32" Alias _FuncName_RegCreateKeyEx (hKey As HKEY, lpSubKey As PCTSTR, Reserved As DWord, lpClass As PTSTR, dwOptions As DWord, samDesired As REGSAM, lpSecurityAttributes As *SECURITY_ATTRIBUTES, ByRef phkResult As HKEY, lpdwDisposition As *DWord) As Long
+'#if WINVER >= 0x0600 'AB
+Declare Function RegCreateKeyTransacted Lib "advapi32" Alias _FuncName_RegCreateKeyTransacted (hKey As HKEY, lpSubKey As LPCTSTR, Reserved As DWord, lpClass As LPTSTR, dwOptions As DWord, samDesired As REGSAM, lpSecurityAttributes As *SECURITY_ATTRIBUTES, ByRef phkResult As HKEY, lpdwDisposition As *DWord, hTransaction As HANDLE, pExtendedParemeter As VoidPtr) As Long
+'#endif
+Declare Function RegDeleteKey Lib "advapi32" Alias _FuncName_RegDeleteKey (hKey As HKEY, lpSubKey As PCTSTR) As Long
+'#if WINVER >= 0x0520 'AB
+Declare Function RegDeleteKeyEx Lib "advapi32" Alias _FuncName_RegDeleteKeyEx (hKey As HKEY, lpSubKey As LPCTSTR, samDesired As REGSAM, Reserved As DWord) As Long
+'#endif
+'#if WINVER >= 0x0600 'AB
+Declare Function RegDeleteKeyTransacted Lib "advapi32" Alias _FuncName_RegDeleteKeyTransacted (hKey As HKEY, lpSubKey As LPCTSTR, samDesired As REGSAM, Reserved As DWord, hTransaction As HANDLE, pExtendedParameter As VoidPtr) As Long
+'#endif
+'#if WINVER >= 0x0520 'AB
+Declare Function RegDisableReflectionKey Lib "advapi32" (hBase As HKEY) As Long
+Declare Function RegEnableReflectionKey Lib "advapi32" (hBase As HKEY) As Long
+Declare Function RegQueryReflectionKey Lib "advapi32" (hBase As HKEY, ByRef bIsReflectionDisabled As BOOL) As Long
+'#endif
+Declare Function RegDeleteValue Lib "advapi32" Alias _FuncName_RegDeleteValue (hKey As HKEY, lpValueName As PCTSTR) As Long
+Declare Function RegEnumKeyEx Lib "advapi32" Alias _FuncName_RegEnumKeyEx (hKey As HKEY, dwIndex As DWord, pName As PTSTR, ByRef cName As DWord, pReserved As *DWord, pClass As PTSTR, ByRef cClass As DWord, pftLastWriteTime As *FILETIME) As Long
+Declare Function RegEnumValue Lib "advapi32" Alias _FuncName_RegEnumValue (hKey As HKEY, dwIndex As DWord, pValueName As PTSTR, ByRef cValueName As DWord, pReserved As *DWord, pType As *DWord, pData As *Byte, pcbData As *DWord) As Long
+Declare Function RegFlushKey Lib "advapi32" (hKey As HKEY) As Long
+'#if _WIN32_WINNT >= &h0310 'AB
+Declare Function RegGetKeySecurity Lib "advapi32"(hKey As HKEY, SecurityInformation As SECURITY_INFORMATION, pSecurityDescriptor As *SECURITY_DESCRIPTOR, ByRef lpcbSecurityDescriptor As DWord) As Long
+'#endif
+Declare Function RegLoadKey Lib "advapi32" Alias _FuncName_RegLoadKey (hKey As HKEY, pSubKey As PCTSTR, pFile As PCTSTR) As Long
+Declare Function RegOpenKeyEx Lib "advapi32" Alias _FuncName_RegOpenKeyEx (hKey As HKEY, lpSubKey As PCTSTR, ulOptions As DWord, samDesired As Long, ByRef phkResult As HKEY) As Long
+'#if WINVER >= 0x0600 'AB
+Declare Function RegOpenKeyTransacted Lib "advapi32" Alias _FuncName_RegOpenKeyTransacted (hKey As HKEY, lpSubKey As LPCTSTR, ulOptions As DWord, samDesired As REGSAM, ByRef phkResult As HKEY, hTransaction As HANDLE, pExtendedParemeter As VoidPtr) As Long
+'#endif
+Declare Function RegQueryInfoKey Lib "advapi32" Alias _FuncName_RegQueryInfoKey (hKey As HKEY, pClass As PTSTR, pcClass As *DWord, pReserved As *DWord, pcSubKeys As *DWord, pcMaxSubKeyLen As *DWord, pcMaxClassLen As *DWord, pcValues As *DWord, pcMaxValueNameLen As *DWord, pcMaxValueLen As *DWord, pcbSecurityDescriptor As *DWord, pftLastWriteTime As *FILETIME) As Long
+Declare Function RegQueryMultipleValues Lib "advapi32" Alias _FuncName_RegQueryMultipleValues (hKey As HKEY, val_list As *VALENT, num_vals As DWord, pValueBuf As PTSTR, ByRef dwTotsize As DWord) As Long
+Declare Function RegQueryValueEx Lib "advapi32" Alias _FuncName_RegQueryValueEx (hKey As HKEY, lpValueName As PCTSTR, lpReserved As DWord, lpType As *DWord, lpData As VoidPtr, lpcbData As *DWord) As Long
+Declare Function RegReplaceKey Lib "advapi32" Alias _FuncName_RegReplaceKey (hKey As HKEY, lpSubKey As LPCTSTR, lpNewFile As LPCTSTR, lpOldFile As LPCTSTR) As Long
+'#if _WIN32_WINNT >= &h0310 'AB
+Declare Function RegRestoreKey Lib "advapi32" Alias _FuncName_RegRestoreKey (hKey As HKEY, lpFile As LPCTSTR, dwFlags As DWord) As Long
+'#endif
+Declare Function RegSaveKey Lib "advapi32" Alias _FuncName_RegSaveKey (hKey As HKEY, pFile As PCTSTR, pSecurityAttributes As *SECURITY_ATTRIBUTES) As Long
+'#if _WIN32_WINNT >= &h0310 'AB
+Declare Function RegSetKeySecurity Lib "advapi32" (hKey As HKEY, SecurityInformation As SECURITY_INFORMATION, pSecurityDescriptor As *SECURITY_DESCRIPTOR) AS Long
+'#endif
+Declare Function RegSetValueEx Lib "advapi32" Alias _FuncName_RegSetValueEx (hKey As HKEY, lpValueName As LPCTSTR, Reserved As DWord, dwType As DWord, lpData As VoidPtr, cbData As DWord) As Long
+Declare Function RegUnLoadKey Lib "advapi32" Alias _FuncName_RegUnLoadKey (hKey As HKEY, lpSubKey As LPCTSTR) As Long
+'#if _WIN32_WINNT >= &h0600
+Declare Function RegDeleteKeyValue Lib "advapi32" Alias _FuncName_RegDeleteKeyValue (hKey As HKEY, lpSubKey As LPCTSTR, lpValueName As LPCTSTR) As Long
+Declare Function RegSetKeyValue Lib "advapi32" Alias _FuncName_RegSetKeyValue (hKey As HKEY, lpSubKey As LPCTSTR, lpValueName As LPCTSTR, dwType As DWord, lpData As VoidPtr, cbData As DWord) As Long
+Declare Function RegDeleteTree Lib "advapi32" Alias _FuncName_RegDeleteTree (hKey As HKEY, lpSubKey As LPCTSTR) As Long
+Declare Function RegCopyTree Lib "advapi32" Alias _FuncName_RegCopyTree (hKeySrc As HKEY, lpSubKey As LPCTSTR, hKeyDest As HKEY) As Long
+Declare Function RegGetValue Lib "advapi32" Alias _FuncName_RegGetValue (hKey As HKEY, lpSubKey As LPCTSTR, lpValue As LPCTSTR, dwFlags As DWord, pdwType As *DWord, pvData As VoidPtr, pcbData As *DWord) As Long
+Declare Function RegLoadMUIString Lib "advapi32" Alias _FuncName_RegLoadMUIString (hKey As HKEY, pszValue As LPCTSTR, pszOutBuf As LPTSTR, cbOutBuf As DWord, pcbData As *DWord, Flags As DWord, pszDirectory As LPCTSTR) As Long
+Declare Function RegLoadAppKey Lib "advapi32" Alias _FuncName_RegLoadAppKey (lpFile As LPCTSTR, ByRef hkResult As HKEY, samDesired As REGSAM, dwOptions As DWord, Reserved As DWord) As Long
+'#endif
+'#if WINVER >= 0x0510 'AB
+Declare Function RegSaveKeyEx Lib "advapi32" Alias _FuncName_RegSaveKeyEx (hKey As HKEY, lpFile As LPCTSTR, lpSecurityAttributes As *SECURITY_ATTRIBUTES, Flags As DWord) As Long
+'#endif
Index: /trunk/ab5.0/ablib/src/api_richedit.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_richedit.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_richedit.sbp	(revision 506)
@@ -0,0 +1,374 @@
+' api_richedit.sbp
+
+
+#ifndef _INC_RICHEDIT
+#define _INC_RICHEDIT
+
+
+Const MAX_TAB_STOPS = 32
+
+
+'CHARFORMAT struct
+Const CFM_BOLD =      &H00000001
+Const CFM_ITALIC =    &H00000002
+Const CFM_UNDERLINE = &H00000004
+Const CFM_STRIKEOUT = &H00000008
+Const CFM_PROTECTED = &H00000010
+Const CFM_LINK =      &H00000020
+Const CFM_SIZE =      &H80000000
+Const CFM_COLOR =     &H40000000
+Const CFM_FACE =      &H20000000
+Const CFM_OFFSET =    &H10000000
+Const CFM_CHARSET =   &H08000000
+
+Const CFE_BOLD =      &H0001
+Const CFE_ITALIC =    &H0002
+Const CFE_UNDERLINE = &H0004
+Const CFE_STRIKEOUT = &H0008
+Const CFE_PROTECTED = &H0010
+Const CFE_LINK =      &H0020
+Const CFE_AUTOCOLOR = &H40000000
+
+Type CHARFORMATW
+	cbSize As DWord
+	dwMask As DWord
+	dwEffects As DWord
+	yHeight As Long
+	yOffset As Long
+	crTextColor As COLORREF
+	bCharSet As Byte
+	bPitchAndFamily As Byte
+	szFaceName[ELM(LF_FACESIZE)] As WCHAR
+End Type
+Type CHARFORMATA
+	cbSize As DWord
+	dwMask As DWord
+	dwEffects As DWord
+	yHeight As Long
+	yOffset As Long
+	crTextColor As COLORREF
+	bCharSet As Byte
+	bPitchAndFamily As Byte
+	szFaceName[ELM(LF_FACESIZE)] As SByte
+End Type
+#ifdef UNICODE
+TypeDef CHARFORMAT = CHARFORMATW
+#else
+TypeDef CHARFORMAT = CHARFORMATA
+#endif
+
+'CHARFORMAT2 struct
+Const CFM_SMALLCAPS =     &H0040
+Const CFM_ALLCAPS =       &H0080
+Const CFM_HIDDEN =        &H0100
+Const CFM_OUTLINE =       &H0200
+Const CFM_SHADOW =        &H0400
+Const CFM_EMBOSS =        &H0800
+Const CFM_IMPRINT =       &H1000
+Const CFM_DISABLED =      &H2000
+Const CFM_REVISED =       &H4000
+Const CFM_BACKCOLOR =     &H04000000
+Const CFM_LCID =          &H02000000
+Const CFM_UNDERLINETYPE = &H00800000
+Const CFM_WEIGHT =        &H00400000
+Const CFM_SPACING =       &H00200000
+Const CFM_KERNING =       &H00100000
+Const CFM_STYLE =         &H00080000
+Const CFM_ANIMATION =     &H00040000
+Const CFM_REVAUTHOR =     &H00008000
+Const CFM_SUBSCRIPT =     &H00030000
+Const CFM_SUPERSCRIPT =   CFM_SUBSCRIPT
+
+Const CFE_SUBSCRIPT =     &H00010000
+Const CFE_SUPERSCRIPT =   &H00020000
+Const CFE_SMALLCAPS =    CFM_SMALLCAPS
+Const CFE_ALLCAPS =      CFM_ALLCAPS
+Const CFE_HIDDEN =       CFM_HIDDEN
+Const CFE_OUTLINE =      CFM_OUTLINE
+Const CFE_SHADOW =       CFM_SHADOW
+Const CFE_EMBOSS =       CFM_EMBOSS
+Const CFE_IMPRINT =      CFM_IMPRINT
+Const CFE_DISABLED =     CFM_DISABLED
+Const CFE_REVISED =      CFM_REVISED
+
+Const CFU_CF1UNDERLINE =    &HFF
+Const CFU_INVERT =          &HFE
+Const CFU_UNDERLINEDOTTED = &H4
+Const CFU_UNDERLINEDOUBLE = &H3
+Const CFU_UNDERLINEWORD =   &H2
+Const CFU_UNDERLINE =       &H1
+Const CFU_UNDERLINENONE =   0
+
+Type CHARFORMAT2W
+	cbSize As DWord
+	dwMask As DWord
+	dwEffects As DWord
+	yHeight As Long
+	yOffset As Long
+	crTextColor As DWord
+	bCharSet As Byte
+	bPitchAndFamily As Byte
+	szFaceName[ELM(LF_FACESIZE)] As WCHAR
+	wWeight As Word
+	sSpacing As Integer
+	crBackColor As DWord
+	lcid As DWord
+	dwReserved As DWord
+	sStyle As Integer
+	wKerning As Word
+	bUnderlineType As Byte
+	bAnimation As Byte
+	bRevAuthor As Byte
+	bReserved1 As Byte
+End Type
+Type CHARFORMAT2A
+	cbSize As DWord
+	dwMask As DWord
+	dwEffects As DWord
+	yHeight As Long
+	yOffset As Long
+	crTextColor As DWord
+	bCharSet As Byte
+	bPitchAndFamily As Byte
+	szFaceName[ELM(LF_FACESIZE)] As CHAR
+	wWeight As Word
+	sSpacing As Integer
+	crBackColor As DWord
+	lcid As DWord
+	dwReserved As DWord
+	sStyle As Integer
+	wKerning As Word
+	bUnderlineType As Byte
+	bAnimation As Byte
+	bRevAuthor As Byte
+	bReserved1 As Byte
+End Type
+#ifdef UNICODE
+TypeDef CHARFORMAT2 = CHARFORMAT2W
+#else
+TypeDef CHARFORMAT2 = CHARFORMAT2A
+#endif
+
+
+'PARAFORMAT struct
+Const PFM_STARTINDENT =  &H00000001
+Const PFM_RIGHTINDENT =  &H00000002
+Const PFM_OFFSET =       &H00000004
+Const PFM_ALIGNMENT =    &H00000008
+Const PFM_TABSTOPS =     &H00000010
+Const PFM_NUMBERING =    &H00000020
+Const PFM_OFFSETINDENT = &H80000000
+
+Const PFA_LEFT =   &H0001
+Const PFA_RIGHT =  &H0002
+Const PFA_CENTER = &H0003
+
+Type PARAFORMAT
+	cbSize As DWord
+	dwMask As DWord
+	wNumbering As Word
+	wReserved As Word
+	dxStartIndent As Long
+	dxRightIndent As Long
+	dxOffset As Long
+	wAlignment As Word
+	cTabCount As Integer
+	rgxTabs[ELM(MAX_TAB_STOPS)] As Long
+End Type
+
+
+'PARAFORMAT2 struct
+Const PFM_SPACEBEFORE =     &H00000040
+Const PFM_SPACEAFTER =      &H00000080
+Const PFM_LINESPACING =     &H00000100
+Const PFM_STYLE =           &H00000400
+Const PFM_BORDER =          &H00000800
+Const PFM_SHADING =         &H00001000
+Const PFM_NUMBERINGSTYLE =  &H00002000
+Const PFM_NUMBERINGTAB =    &H00004000
+Const PFM_NUMBERINGSTART =  &H00008000
+Const PFM_DIR =             &H00010000
+Const PFM_RTLPARA =         &H00010000
+Const PFM_KEEP =            &H00020000
+Const PFM_KEEPNEXT =        &H00040000
+Const PFM_PAGEBREAKBEFORE = &H00080000
+Const PFM_NOLINENUMBER =    &H00100000
+Const PFM_NOWIDOWCONTROL =  &H00200000
+Const PFM_DONOTHYPHEN =     &H00400000
+Const PFM_SIDEBYSIDE =      &H00800000
+Const PFM_TABLE =           &Hc0000000
+
+Const PFE_RTLPARA =         PFM_DIR             >> 16
+Const PFE_RTLPAR =          PFM_RTLPARA         >> 16
+Const PFE_KEEP =            PFM_KEEP            >> 16
+Const PFE_KEEPNEXT =        PFM_KEEPNEXT        >> 16
+Const PFE_PAGEBREAKBEFORE = PFM_PAGEBREAKBEFORE >> 16
+Const PFE_NOLINENUMBER =    PFM_NOLINENUMBER    >> 16
+Const PFE_NOWIDOWCONTROL =  PFM_NOWIDOWCONTROL  >> 16
+Const PFE_DONOTHYPHEN =     PFM_DONOTHYPHEN     >> 16
+Const PFE_SIDEBYSIDE =      PFM_SIDEBYSIDE      >> 16
+
+Const PFA_JUSTIFY = &H0004
+
+Type PARAFORMAT2
+	cbSize As DWord
+	dwMask As DWord
+	wNumbering As Word
+	wReserved As Word
+	dxStartIndent As Long
+	dxRightIndent As Long
+	dxOffset As Long
+	wAlignment As Word
+	cTabCount As Integer
+	rgxTabs[ELM(MAX_TAB_STOPS)] As Long
+	dySpaceBefore As Long
+	dySpaceAfter As Long
+	dyLineSpacing As Long
+	sStyle As Integer
+	bLineSpacingRule As Byte
+	bCRC As Byte
+	wShadingWeight As Word
+	wShadingStyle As Word
+	wNumberingStart As Word
+	wNumberingStyle As Word
+	wNumberingTab As Word
+	wBorderSpace As Word
+	wBorderWidth As Word
+	wBorders As Word
+End Type
+
+
+
+'----------
+' Messages
+'----------
+
+Const EM_CANPASTE =           WM_USER + 50
+Const EM_DISPLAYBAND =        WM_USER + 51
+Const EM_EXGETSEL =           WM_USER + 52
+Const EM_EXLIMITTEXT =        WM_USER + 53
+Const EM_EXLINEFROMCHAR =     WM_USER + 54
+Const EM_EXSETSEL =           WM_USER + 55
+Const EM_FINDTEXT =           WM_USER + 56
+Const EM_FORMATRANGE =        WM_USER + 57
+Const EM_GETCHARFORMAT =      WM_USER + 58
+Const EM_GETEVENTMASK =       WM_USER + 59
+Const EM_GETOLEINTERFACE =    WM_USER + 60
+Const EM_GETPARAFORMAT =      WM_USER + 61
+Const EM_GETSELTEXT =         WM_USER + 62
+Const EM_HIDESELECTION =      WM_USER + 63
+Const EM_PASTESPECIAL =       WM_USER + 64
+Const EM_REQUESTRESIZE =      WM_USER + 65
+Const EM_SELECTIONTYPE =      WM_USER + 66
+Const EM_SETBKGNDCOLOR =      WM_USER + 67
+
+Const EM_SETCHARFORMAT =      WM_USER + 68
+Const SCF_SELECTION =  &H0001
+Const SCF_WORD =       &H0002
+Const SCF_DEFAULT =    &H0000
+Const SCF_ALL =        &H0004
+Const SCF_USEUIRULES = &H0008
+
+Const EM_SETEVENTMASK =       WM_USER + 69
+Const ENM_NONE =             &H00000000
+Const ENM_CHANGE =           &H00000001
+Const ENM_UPDATE =           &H00000002
+Const ENM_SCROLL =           &H00000004
+Const ENM_KEYEVENTS =        &H00010000
+Const ENM_MOUSEEVENTS =      &H00020000
+Const ENM_REQUESTRESIZE =    &H00040000
+Const ENM_SELCHANGE =        &H00080000
+Const ENM_DROPFILES =        &H00100000
+Const ENM_PROTECTED =        &H00200000
+Const ENM_CORRECTTEXT =      &H00400000
+Const ENM_SCROLLEVENTS =     &H00000008
+Const ENM_DRAGDROPDONE =     &H00000010
+Const ENM_IMECHANGE =        &H00800000
+Const ENM_LANGCHANGE =       &H01000000
+Const ENM_OBJECTPOSITIONS =  &H02000000
+Const ENM_LINK =             &H04000000
+
+Const EM_SETOLECALLBACK =     WM_USER + 70
+Const EM_SETPARAFORMAT =      WM_USER + 71
+Const EM_SETTARGETDEVICE =    WM_USER + 72
+Const EM_STREAMIN =           WM_USER + 73
+Const EM_STREAMOUT =          WM_USER + 74
+Const EM_GETTEXTRANGE =       WM_USER + 75
+Const EM_FINDWORDBREAK =      WM_USER + 76
+Const EM_SETOPTIONS =         WM_USER + 77
+Const EM_GETOPTIONS =         WM_USER + 78
+Const EM_FINDTEXTEX =         WM_USER + 79
+Const EM_GETWORDBREAKPROCEX = WM_USER + 80
+Const EM_SETWORDBREAKPROCEX = WM_USER + 81
+Const EM_SETUNDOLIMIT =       WM_USER + 82
+Const EM_REDO =               WM_USER + 84
+Const EM_CANREDO =            WM_USER + 85
+Const EM_GETUNDONAME =        WM_USER + 86
+Const EM_GETREDONAME =        WM_USER + 87
+Const EM_STOPGROUPTYPING =    WM_USER + 88
+Const EM_SETTEXTMODE =        WM_USER + 89
+Const EM_GETTEXTMODE =        WM_USER + 90
+Const EM_AUTOURLDETECT =      WM_USER + 91
+Const EM_GETAUTOURLDETECT =   WM_USER + 92
+Const EM_SETPALETTE =         WM_USER + 93
+Const EM_GETTEXTEX =          WM_USER + 94
+Const EM_GETTEXTLENGTHEX =    WM_USER + 95
+Const EM_SETPUNCTUATION =     WM_USER + 100
+Const EM_GETPUNCTUATION =     WM_USER + 101
+Const EM_SETWORDWRAPMODE =    WM_USER + 102
+Const EM_GETWORDWRAPMODE =    WM_USER + 103
+Const EM_SETIMECOLOR =        WM_USER + 104
+Const EM_GETIMECOLOR =        WM_USER + 105
+Const EM_SETIMEOPTIONS =      WM_USER + 106
+Const EM_GETIMEOPTIONS =      WM_USER + 107
+Const EM_CONVPOSITION =       WM_USER + 108
+Const EM_SETLANGOPTIONS =     WM_USER + 120
+Const EM_GETLANGOPTIONS =     WM_USER + 121
+Const EM_GETIMECOMPMODE =     WM_USER + 122
+Const EM_FINDTEXTW =          WM_USER + 123
+Const EM_FINDTEXTEXW =        WM_USER + 124
+Const EM_SETBIDIOPTIONS =     WM_USER + 200
+Const EM_GETBIDIOPTIONS =     WM_USER + 201
+
+
+
+'---------------
+' notifications
+'---------------
+
+Const EN_MSGFILTER =       &H0700
+Type MSGFILTER
+	nmhdr As NMHDR
+	msg As DWord
+	wParam As WPARAM
+	lParam As LPARAM
+End Type
+
+Type CHARRANGE
+	cpMin As Long
+	cpMax As Long
+End Type
+
+Type EDITSTREAM
+	dwCookie As ULONG_PTR
+	dwError As DWord
+	pfnCallback As VoidPtr
+End Type
+
+Const EN_REQUESTRESIZE =   &H0701
+Const EN_SELCHANGE =       &H0702
+Const EN_DROPFILES =       &H0703
+Const EN_PROTECTED =       &H0704
+Const EN_CORRECTTEXT =     &H0705
+Const EN_STOPNOUNDO =      &H0706
+Const EN_IMECHANGE =       &H0707
+Const EN_SAVECLIPBOARD =   &H0708
+Const EN_OLEOPFAILED =     &H0709
+Const EN_OBJECTPOSITIONS = &H070a
+Const EN_LINK =            &H070b
+Const EN_DRAGDROPDONE =    &H070c
+Const EN_ALIGN_LTR =       &H0710
+Const EN_ALIGN_RTL =       &H0711
+
+
+#endif '_INC_RICHEDIT
Index: /trunk/ab5.0/ablib/src/api_shell.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_shell.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_shell.sbp	(revision 506)
@@ -0,0 +1,709 @@
+' api_shell.sbp
+
+#ifdef UNICODE
+Const _FuncName_DoEnvironmentSubst = "DoEnvironmentSubstW"
+Const _FuncName_DragQueryFile = "DragQueryFileW"
+Const _FuncName_ExtractAssociatedIcon = "ExtractAssociatedIconW"
+Const _FuncName_ExtractIcon = "ExtractIconW"
+Const _FuncName_ExtractIconEx = "ExtractIconExW"
+Const _FuncName_FindExecutable = "FindExecutableW"
+Const _FuncName_GUIDFromString = "GUIDFromStringW"
+Const _FuncName_SHBrowseForFolder = "SHBrowseForFolderW"
+Const _FuncName_ShellAbout = "ShellAboutW"
+Const _FuncName_ShellExecute = "ShellExecuteW"
+Const _FuncName_ShellExecuteEx = "ShellExecuteExW"
+Const _FuncName_Shell_NotifyIcon = "NotifyIconW"
+Const _FuncName_SHEmptyRecycleBin = "SHEmptyRecycleBinW"
+Const _FuncName_SHFileOperation = "SHFileOperationW"
+Const _FuncName_SHGetFileInfo = "SHGetFileInfoW"
+Const _FuncName_SHGetPathFromIDList = "SHGetPathFromIDListW"
+Const _FuncName_SHGetSpecialFolderPath = "SHGetSpecialFolderPathW"
+#else
+Const _FuncName_DoEnvironmentSubst = "DoEnvironmentSubstA"
+Const _FuncName_DragQueryFile = "DragQueryFileA"
+Const _FuncName_ExtractAssociatedIcon = "ExtractAssociatedIconA"
+Const _FuncName_ExtractIcon = "ExtractIconA"
+Const _FuncName_ExtractIconEx = "ExtractIconExA"
+Const _FuncName_FindExecutable = "FindExecutableA"
+Const _FuncName_GUIDFromString = "GUIDFromStringA"
+Const _FuncName_SHBrowseForFolder = "SHBrowseForFolderA"
+Const _FuncName_ShellAbout = "ShellAboutA"
+Const _FuncName_ShellExecute = "ShellExecuteA"
+Const _FuncName_ShellExecuteEx = "ShellExecuteExA"
+Const _FuncName_Shell_NotifyIcon = "Shell_NotifyIconA"
+Const _FuncName_SHEmptyRecycleBin = "SHEmptyRecycleBinA"
+Const _FuncName_SHFileOperation = "SHFileOperationA"
+Const _FuncName_SHGetFileInfo = "SHGetFileInfoA"
+Const _FuncName_SHGetPathFromIDList = "SHGetPathFromIDListA"
+Const _FuncName_SHGetSpecialFolderPath = "SHGetSpecialFolderPathA"
+#endif
+
+Type _System_DeclareHandle_HDROP:unused As DWord:End Type
+TypeDef HDROP     = *_System_DeclareHandle_HDROP
+
+Interface IEnumIDList
+	Inherits IUnknown
+End Interface
+
+'-----------
+' Shell API
+
+' shellapi.h
+Declare Function DoEnvironmentSubst Lib "shell32" Alias _FuncName_DoEnvironmentSubst (
+	pszString As PTSTR,
+	cchString As DWord
+) As DWord
+
+' shellapi.h
+Declare Sub DragAcceptFiles Lib "shell32" (hWnd As HWND, bAccept As BOOL)
+Declare Sub DragFinish Lib "shell32" (hDrop As HDROP)
+Declare Function DragQueryFile Lib "shell32" Alias _FuncName_DragQueryFile (hDrop As HDROP, iFile As Long, lpszFile As LPTSTR, cch As DWord) As DWord
+Declare Function DragQueryPoint Lib "shell32" (hDrop As HDROP, ByRef lpPoint As POINTAPI) As Long
+Declare Function ExtractAssociatedIcon Lib "shell32" Alias _FuncName_ExtractAssociatedIcon (hInst As HINSTANCE, lpIconPath As LPTSTR, lpiIcon As *Word) As HICON
+' Shellapi.h
+Declare Function ExtractIcon Lib "shell32" Alias _FuncName_ExtractIcon (hInst As HINSTANCE, lpszExeFileName As LPCTSTR, nIconIndex As Long) As HICON
+Declare Function ExtractIconEx Lib "shell32" Alias _FuncName_ExtractIconEx (lpszFile As PCSTR, nIconIndex As Long, phiconLarge As *DWord, phiconSmall As *DWord, nIcons As Long) As HICON
+
+' shellapi.h
+Declare Function FindExecutable Lib "shell32" Alias _FuncName_FindExecutable (
+	lpFile As LPCTSTR,
+	lpDirectory As LPCTSTR,
+	lpResult As LPCTSTR
+) As Long
+
+Declare Function GUIDFromString Lib "shell32" Alias _FuncName_GUIDFromString (
+	ByVal psz As PCTSTR,
+	ByRef guid As GUID
+) As BOOL
+
+' intshcut.h
+Declare Function InetIsOffline Lib "url" (dwFlags As DWord) As BOOL
+' intshcut.h
+Declare Function MIMEAssociationDialog Lib "url" (
+	hwndParent As HWND,
+	dwInFlags As DWord,
+	pcszFile As PCTSTR,
+	pcszMIMEContentType As PCTSTR,
+	pszAppBuf As PTSTR,
+	ucAppBufLen As DWord
+) As HRESULT
+
+' shlobj.h
+Declare Sub SHAddToRecentDocs Lib "shell32" (ByVal uFlags As Long, ByVal pv As VoidPtr)
+
+Const ABM_NEW = &h00000000
+Const ABM_REMOVE = &h00000001
+Const ABM_QUERYPOS = &h00000002
+Const ABM_SETPOS = &h00000003
+Const ABM_GETSTATE = &h00000004
+Const ABM_GETTASKBARPOS = &h00000005
+Const ABM_ACTIVATE = &h00000006
+Const ABM_GETAUTOHIDEBAR = &h00000007
+Const ABM_SETAUTOHIDEBAR = &h00000008
+Const ABM_WINDOWPOSCHANGED = &h0000009
+Const ABM_SETSTATE = &h0000000a
+
+Const ABN_STATECHANGE = &h0000000
+Const ABN_POSCHANGED = &h0000001
+Const ABN_FULLSCREENAPP = &h0000002
+Const ABN_WINDOWARRANGE = &h0000003
+
+Const ABS_AUTOHIDE = &h0000001
+Const ABS_ALWAYSONTOP = &h0000002
+
+Const ABE_LEFT = 0
+Const ABE_TOP = 1
+Const ABE_RIGHT = 2
+Const ABE_BOTTOM = 3
+
+Type APPBARDATA
+	cbSize As DWord
+	hWnd As HWND
+	uCallbackMessage As DWord
+	uEdge As DWord
+	rc As RECT
+	lParam As LPARAM
+End Type
+
+' shellapi.h
+Declare Function SHAppBarMessage Lib "shell32" (dwMessage As DWord, ByRef Data As APPBARDATA) As ULONG_PTR
+
+Const BIF_RETURNONLYFSDIRS =   &H0001
+Const BIF_DONTGOBELOWDOMAIN =  &H0002
+Const BIF_STATUSTEXT =         &H0004
+Const BIF_RETURNFSANCESTORS =  &H0008
+Const BIF_EDITBOX =            &H0010
+Const BIF_VALIDATE =           &H0020
+Const BIF_BROWSEFORCOMPUTER =  &H1000
+Const BIF_BROWSEFORPRINTER =   &H2000
+Const BIF_BROWSEINCLUDEFILES = &H4000
+
+Typedef BFFCALLBACK = *Function(hwnd As HWND, uMsg As DWord, lParam As LPARAM, lpData As LPARAM) As Long
+
+Type BROWSEINFOW
+	hwndOwner      As HWND
+	pidlRoot       As VoidPtr
+	pszDisplayName As LPWSTR
+	lpszTitle      As LPCWSTR
+	ulFlags        As DWord
+	lpfn           As BFFCALLBACK
+	lParam         As LPARAM
+	iImage         As Long
+End Type
+Type BROWSEINFOA
+	hwndOwner      As HWND
+	pidlRoot       As VoidPtr
+	pszDisplayName As LPSTR
+	lpszTitle      As LPCSTR
+	ulFlags        As DWord
+	lpfn           As BFFCALLBACK
+	lParam         As LPARAM
+	iImage         As Long
+End Type
+#ifdef UNICODE
+TypeDef BROWSEINFO = BROWSEINFOW
+#else
+TypeDef BROWSEINFO = BROWSEINFOA
+#endif
+
+Type SHITEMID 'shtypes.h
+	cb As Word
+	abID[ELM(1)] As Byte
+End Type
+
+Type ITEMIDLIST 'shtypes.h
+	mkid As SHITEMID
+End Type
+
+typedef LPITEMIDLIST = /*__unaligned*/ *ITEMIDLIST
+typedef LPCITEMIDLIST = /*__unaligned const*/ *ITEMIDLIST
+
+'shlobj.h
+Declare Function SHBrowseForFolder Lib "shell32" Alias _FuncName_SHBrowseForFolder (ByRef bi As BROWSEINFO) As *ITEMIDLIST
+
+Const SHCNE_RENAMEITEM          = &h00000001
+Const SHCNE_CREATE              = &h00000002
+Const SHCNE_DELETE              = &h00000004
+Const SHCNE_MKDIR               = &h00000008
+Const SHCNE_RMDIR               = &h00000010
+Const SHCNE_MEDIAINSERTED       = &h00000020
+Const SHCNE_MEDIAREMOVED        = &h00000040
+Const SHCNE_DRIVEREMOVED        = &h00000080
+Const SHCNE_DRIVEADD            = &h00000100
+Const SHCNE_NETSHARE            = &h00000200
+Const SHCNE_NETUNSHARE          = &h00000400
+Const SHCNE_ATTRIBUTES          = &h00000800
+Const SHCNE_UPDATEDIR           = &h00001000
+Const SHCNE_UPDATEITEM          = &h00002000
+Const SHCNE_SERVERDISCONNECT    = &h00004000
+Const SHCNE_UPDATEIMAGE         = &h00008000
+Const SHCNE_DRIVEADDGUI         = &h00010000
+Const SHCNE_RENAMEFOLDER        = &h00020000
+Const SHCNE_FREESPACE           = &h00040000
+
+#ifdef __UNDEFINED__ '#if _WIN32_IE >= 0x0400
+Const SHCNE_EXTENDED_EVENT      = &h04000000
+#endif
+
+Const SHCNE_ASSOCCHANGED        = &h08000000
+
+Const SHCNE_DISKEVENTS          = &h0002381F
+Const SHCNE_GLOBALEVENTS        = &h0C0581E0
+Const SHCNE_ALLEVENTS           = &h7FFFFFFF
+Const SHCNE_INTERRUPT           = &h80000000
+
+#ifdef __UNDEFINED__ '#if _WIN32_IE >= 0x0400
+Const SHCNEE_ORDERCHANGED = 2
+Const SHCNEE_MSI_CHANGE = 4
+Const SHCNEE_MSI_UNINSTALL = 5
+#endif
+
+Const SHCNF_IDLIST      = &h0000
+Const SHCNF_PATHA       = &h0001
+Const SHCNF_PRINTERA    = &h0002
+Const SHCNF_DWORD       = &h0003
+Const SHCNF_PATHW       = &h0005
+Const SHCNF_PRINTERW    = &h0006
+Const SHCNF_TYPE        = &h00FF
+Const SHCNF_FLUSH       = &h1000
+Const SHCNF_FLUSHNOWAIT = &h2000
+
+#ifdef UNICODE
+Const SHCNF_PATH     = SHCNF_PATHW
+Const SHCNF_PRINTER  = SHCNF_PRINTERW
+#else
+Const SHCNF_PATH     = SHCNF_PATHA
+Const SHCNF_PRINTER  = SHCNF_PRINTERA
+#endif
+
+' ShlObj.h
+Declare Sub SHChangeNotify Lib "shell32" (wEventId As Long, uFlags As DWord, dwItem1 As VoidPtr, dwItem2 As VoidPtr)
+
+' ShellApi.h
+Declare Function ShellAbout Lib "shell32" Alias _FuncName_ShellAbout (hWnd As HWND, szApp As PCTSTR, szOtherStuff As PCTSTR, hIcon As HICON) As Long
+
+Const SE_ERR_FNF =             2
+Const SE_ERR_PNF =             3
+Const SE_ERR_ACCESSDENIED =    5
+Const SE_ERR_OOM =             8
+Const SE_ERR_DLLNOTFOUND =     32
+Const SE_ERR_SHARE =           26
+Const SE_ERR_ASSOCINCOMPLETE = 27
+Const SE_ERR_DDETIMEOUT =      28
+Const SE_ERR_DDEFAIL =         29
+Const SE_ERR_DDEBUSY =         30
+Const SE_ERR_NOASSOC =         31
+' ShellApi.h
+Declare Function ShellExecute Lib "shell32" Alias _FuncName_ShellExecute (hWnd As HWND, lpOperation As LPCTSTR, lpFile As LPCTSTR, lpParameters As LPCTSTR, lpDirectory As LPCTSTR, nShowCmd As Long) As HINSTANCE
+
+Const SEE_MASK_CLASSNAME      = &H0001
+Const SEE_MASK_CLASSKEY       = &H0003
+Const SEE_MASK_IDLIST         = &H0004
+Const SEE_MASK_INVOKEIDLIST   = &H000C
+Const SEE_MASK_ICON           = &H0010
+Const SEE_MASK_HOTKEY         = &H0020
+Const SEE_MASK_NOCLOSEPROCESS = &H0040
+Const SEE_MASK_CONNECTNETDRV  = &H0080
+Const SEE_MASK_FLAG_DDEWAIT   = &H0100
+Const SEE_MASK_DOENVSUBST     = &H0200
+Const SEE_MASK_FLAG_NO_UI     = &H0400
+
+Type SHELLEXECUTEINFOA
+	cbSize As DWord
+	fMask As DWord
+	hwnd As HWND
+	lpVerb As LPCSTR
+	lpFile As LPCSTR
+	lpParameters As LPCSTR
+	lpDirectory As LPCSTR
+	nShow As Long
+	hInstApp As HINSTANCE
+	lpIDList As LPVOID
+	lpClass As LPCSTR
+	hkeyClass As HKEY
+	dwHotKey As DWord
+	hIcon As HANDLE
+	hProcess As HANDLE
+End Type
+Type SHELLEXECUTEINFOW
+	cbSize As DWord
+	fMask As DWord
+	hwnd As HWND
+	lpVerb As LPCWSTR
+	lpFile As LPCWSTR
+	lpParameters As LPCWSTR
+	lpDirectory As LPCWSTR
+	nShow As Long
+	hInstApp As HINSTANCE
+	lpIDList As LPVOID
+	lpClass As LPCWSTR
+	hkeyClass As HKEY
+	dwHotKey As DWord
+	hIcon As HANDLE
+	hProcess As HANDLE
+End Type
+#ifdef UNICODE
+TypeDef SHELLEXECUTEINFO = SHELLEXECUTEINFOW
+#else
+TypeDef SHELLEXECUTEINFO = SHELLEXECUTEINFOA
+#endif
+TypeDef LPSHELLEXECUTEINFO = *SHELLEXECUTEINFO
+Declare Function ShellExecuteEx Lib "shell32" Alias _FuncName_ShellExecuteEx (ByRef ExecInfo As SHELLEXECUTEINFO) As BOOL
+
+Const FO_MOVE =   &H0001
+Const FO_COPY =   &H0002
+Const FO_DELETE = &H0003
+Const FO_RENAME = &H0004
+Const FOF_MULTIDESTFILES =        &H0001
+Const FOF_CONFIRMMOUSE =          &H0002
+Const FOF_SILENT =                &H0004
+Const FOF_RENAMEONCOLLISION =     &H0008
+Const FOF_NOCONFIRMATION =        &H0010
+Const FOF_WANTMAPPINGHANDLE =     &H0020
+Const FOF_ALLOWUNDO =             &H0040
+Const FOF_FILESONLY =             &H0080
+Const FOF_SIMPLEPROGRESS =        &H0100
+Const FOF_NOCONFIRMMKDIR =        &H0200
+Const FOF_NOERRORUI =             &H0400
+Const FOF_NOCOPYSECURITYATTRIBS = &H0800
+Type SHFILEOPSTRUCTW
+	hwnd As HWND
+	wFunc As DWord
+	pFrom As PCWSTR
+	pTo As PCWSTR
+	fFlags As Word
+	fAnyOperationsAborted As BOOL
+	hNameMappings As VoidPtr
+	lpszProgressTitle As LPCWSTR
+End Type
+Type SHFILEOPSTRUCTA
+	hwnd As HWND
+	wFunc As DWord
+	pFrom As PCSTR
+	pTo As PCSTR
+	fFlags As Word
+	fAnyOperationsAborted As BOOL
+	hNameMappings As VoidPtr
+	lpszProgressTitle As LPCSTR
+End Type
+#ifdef UNICODE
+TypeDef SHFILEOPSTRUCT = SHFILEOPSTRUCTW
+#else
+TypeDef SHFILEOPSTRUCT = SHFILEOPSTRUCTA
+#endif
+
+' ShellApi.h
+Declare Function SHFileOperation Lib "shell32" Alias _FuncName_SHFileOperation (ByRef FileOp As SHFILEOPSTRUCT) As Long
+
+' ShellApi.h
+Declare Sub SHFreeNameMappings Lib "shell32" (hNameMappings As HANDLE)
+
+'SHGetDataFromIDList
+
+'shlobj.h
+Declare Function SHGetDesktopFolder Lib "shell32" (ByRef pshf As *IShellFolder) As HRESULT
+
+Declare Function SHGetPathFromIDList Lib "shell32" Alias _FuncName_SHGetPathFromIDList (pidl As *ITEMIDLIST, pszPath As PTSTR) As Long
+
+' ShellApi.h
+Declare Function SHEmptyRecycleBin Lib"shell32" Alias _FuncName_SHEmptyRecycleBin (hwnd As HWND, pszRootPath As LPCTSTR, dwFlags As DWord) As HRESULT
+
+' ShlObj.h
+
+'要IE4
+Declare Function SHGetSpecialFolderPath Lib "shell32" Alias _FuncName_SHGetSpecialFolderPath (hwndOwner As HWND, lpszPath As LPTSTR, nFolder As Long, fCreate As BOOL) As BOOL
+
+' shlobj.h
+Declare Function SHGetInstanceExplorer Lib "shell32" (ByRef ppunk As *IUnknown) As HRESULT
+
+'shlobj.h
+Declare Function SHGetSpecialFolderLocation Lib "shell32" (hwndOwner As HWND, nFolder As Long, ByRef pidl As LPITEMIDLIST) As HRESULT
+
+'shlobj.h
+'要Win2k/Me
+'Declare Function SHGetFolderLocation Lib "shell32" (hwndOwner As HWND, nFolder As Long, hToken As HANDLE, dwReserved As DWord, ByRef pidl As LPITEMIDLIST) As HRESULT
+
+Const CSIDL_DESKTOP = &h0000
+Const CSIDL_INTERNET = &h0001
+Const CSIDL_PROGRAMS = &h0002
+Const CSIDL_CONTROLS = &h0003
+Const CSIDL_PRINTERS = &h0004
+Const CSIDL_PERSONAL = &h0005
+Const CSIDL_FAVORITES = &h0006
+Const CSIDL_STARTUP = &h0007
+Const CSIDL_RECENT = &h0008
+Const CSIDL_SENDTO = &h0009
+Const CSIDL_BITBUCKET = &h000a
+Const CSIDL_STARTMENU = &h000b
+Const CSIDL_MYMUSIC = &h000d
+Const CSIDL_DESKTOPDIRECTORY = &h0010
+Const CSIDL_DRIVES = &h0011
+Const CSIDL_NETWORK = &h0012
+Const CSIDL_NETHOOD = &h0013
+Const CSIDL_FONTS = &h0014
+Const CSIDL_TEMPLATES = &h0015
+Const CSIDL_COMMON_STARTMENU = &h0016
+Const CSIDL_COMMON_PROGRAMS = &h0017
+Const CSIDL_COMMON_STARTUP = &h0018
+Const CSIDL_COMMON_DESKTOPDIRECTORY = &h0019
+Const CSIDL_APPDATA = &h001a
+Const CSIDL_PRINTHOOD = &h001b
+Const CSIDL_LOCAL_APPDATA = &h001c
+Const CSIDL_ALTSTARTUP = &h001d
+Const CSIDL_COMMON_ALTSTARTUP = &h001e
+Const CSIDL_COMMON_FAVORITES = &h001f
+Const CSIDL_INTERNET_CACHE = &h0020
+Const CSIDL_COOKIES = &h0021
+Const CSIDL_HISTORY = &h0022
+Const CSIDL_COMMON_APPDATA = &h0023
+Const CSIDL_WINDOWS = &h0024
+Const CSIDL_SYSTEM = &h0025
+Const CSIDL_PROGRAM_FILES = &h0026
+Const CSIDL_MYPICTURES = &h0027
+Const CSIDL_PROFILE = &h0028
+Const CSIDL_PROGRAM_FILES_COMMON = &h002b
+Const CSIDL_COMMON_TEMPLATES = &h002d
+Const CSIDL_COMMON_DOCUMENTS = &h002e
+Const CSIDL_COMMON_ADMINTOOLS = &h002f
+Const CSIDL_ADMINTOOLS = &h0030
+
+Const SHGFI_ICON              = &H000000100
+Const SHGFI_DISPLAYNAME       = &H000000200
+Const SHGFI_TYPENAME          = &H000000400
+Const SHGFI_ATTRIBUTES        = &H000000800
+Const SHGFI_ICONLOCATION      = &H000001000
+Const SHGFI_EXETYPE           = &H000002000
+Const SHGFI_SYSICONINDEX      = &H000004000
+Const SHGFI_LINKOVERLAY       = &H000008000
+Const SHGFI_SELECTED          = &H000010000
+Const SHGFI_ATTR_SPECIFIED    = &H000020000
+Const SHGFI_LARGEICON         = &H000000000
+Const SHGFI_SMALLICON         = &H000000001
+Const SHGFI_OPENICON          = &H000000002
+Const SHGFI_SHELLICONSIZE     = &H000000004
+Const SHGFI_PIDL              = &H000000008
+Const SHGFI_USEFILEATTRIBUTES = &H000000010
+Const SHGFI_ADDOVERLAYS       = &H000000020
+Const SHGFI_OVERLAYINDEX      = &H000000040
+
+' ShellApi.h
+Type SHFILEINFO
+	hIcon As HICON
+	iIcon As Long
+	dwAttributes As DWord
+	szDisplayName[ELM(MAX_PATH)] As TCHAR
+	szTypeName[ELM(80)] As TCHAR
+End Type
+
+' shellapi.h
+Declare Function SHGetFileInfo Lib "shell32" Alias _FuncName_SHGetFileInfo (pszPath As LPCTSTR, dwFileAttributes As DWord, ByRef sfi As SHFILEINFO, cbFileInfo As DWord, uFlags As DWord) As ULONG_PTR
+
+Type NOTIFYICONDATAW
+	cbSize As DWord
+	hWnd As HWND
+	uID As DWord
+	uFlags As DWord
+	uCallbackMessage As DWord
+	hIcon As HICON
+	szTip[ELM(64)] As WCHAR
+	dwState As DWord
+	dwStateMask As DWord
+	szInfo[ELM(256)] As WCHAR
+	'Union
+		uTimeout As DWord
+	'	uVersion As DWord
+	'End Union
+	szInfoTitle[ELM(64)] As WCHAR
+	dwInfoFlags As DWord
+	guidItem As GUID
+End Type
+Type NOTIFYICONDATAA
+	cbSize As DWord
+	hWnd As HWND
+	uID As DWord
+	uFlags As DWord
+	uCallbackMessage As DWord
+	hIcon As HICON
+	szTip[ELM(64)] As SByte
+	dwState As DWord
+	dwStateMask As DWord
+	szInfo[ELM(256)] As SByte
+	'Union
+		uTimeout As DWord
+	'	uVersion As DWord
+	'End Union
+	szInfoTitle[ELM(64)] As SByte
+	dwInfoFlags As DWord
+	guidItem As GUID
+End Type
+#ifdef UNICODE
+TypeDef NOTIFYICONDATA = NOTIFYICONDATAW
+#else
+TypeDef NOTIFYICONDATA = NOTIFYICONDATAA
+#endif
+Declare Function Shell_NotifyIcon Lib "shell32" Alias _FuncName_Shell_NotifyIcon (dwMessage As DWORD, ByRef data As NOTIFYICONDATA) As BOOL
+
+Type STRRET 'shtypes.h
+	uType As DWord
+	'Union
+		'pOleStr As *WCHAR
+		'uOffset As DWord
+		cStr[ELM(MAX_PATH)] As Byte
+	'End Union
+End Type
+
+' shobjidl.h
+Enum SLGP_FLAGS
+	SLGP_SHORTPATH = &h1
+	SLGP_UNCPRIORITY = &h2
+	SLGP_RAWPATH = &h4
+	SLGP_RELATIVEPRIORITY = &h8
+End Enum
+
+Interface IShellLinkA 'shobjidl.h
+	Inherits IUnknown
+
+	Function GetPath(
+		/* [size_is][out] */ pszFile As PSTR,
+		/* [in] */ cch As Long,
+		/* [full][out][in] */ pfd As *WIN32_FIND_DATAA,
+		/* [in] */ fFlags As DWord) As HRESULT
+	Function GetIDList(
+		/* [out] */ ByRef ppidl As LPITEMIDLIST) As HRESULT
+	Function SetIDList(
+		/* [in] */ pidl As LPCITEMIDLIST) As HRESULT
+	Function GetDescription(
+		/* [size_is][out] */ pszName As PSTR,
+		/* [in] */ cch As Long) As HRESULT
+	Function SetDescription(
+		/* [in] */ pszName As PCSTR) As HRESULT
+	Function GetWorkingDirectory(
+		/* [size_is][out] */ pszDir As PSTR,
+		/* [in] */ cch As Long) As HRESULT
+	Function SetWorkingDirectory(
+		/* [in] */ pszDir As PCSTR) As HRESULT
+	Function GetArguments(
+		/* [size_is][out] */ pszArgs As PSTR,
+		/* [in] */ cch As Long) As HRESULT
+	Function SetArguments(
+		/* [in] */ pszArgs As PCSTR) As HRESULT
+	Function GetHotkey(
+		/* [out] */ ByRef wHotkey As Word) As HRESULT
+	Function SetHotkey(
+		/* [in] */ wHotkey As Word) As HRESULT
+	Function GetShowCmd(
+		/* [out] */ ByRef piShowCmd As Long) As HRESULT
+	Function SetShowCmd(
+		/* [in] */ iShowCmd As Long) As HRESULT
+	Function GetIconLocation(
+		/* [size_is][out] */ pszIconPath As PSTR,
+		/* [in] */ cch As Long,
+		/* [out] */ ByRef iIcon As Long) As HRESULT
+	Function SetIconLocation(
+		/* [in] */ pszIconPath As PCSTR,
+		/* [in] */ iIcon As Long) As HRESULT
+	Function SetRelativePath(
+		/* [in] */ pszPathRel As PCSTR,
+		/* [in] */ dwReserved As DWord) As HRESULT
+	Function Resolve(
+		/* [in] */ hwnd As HWND,
+		/* [in] */ fFlags As DWord) As HRESULT
+	Function SetPath(
+		/* [in] */ pszFile As PCSTR) As HRESULT
+End Interface
+
+Interface IShellLinkW 'shobjidl.h
+	Inherits IUnknown
+
+	Function GetPath(
+		/* [size_is][out] */ pszFile As PWSTR,
+		/* [in] */ cch As Long,
+		/* [full][out][in] */ pfd As *WIN32_FIND_DATAW,
+		/* [in] */ fFlags As DWord) As HRESULT
+	Function GetIDList(
+		/* [out] */ ppidl As *LPITEMIDLIST) As HRESULT
+	Function SetIDList(
+		/* [in] */ pidl As LPCITEMIDLIST) As HRESULT
+	Function GetDescription(
+		/* [size_is][out] */ pszName As PWSTR,
+		/* [in] */ cch As Long) As HRESULT
+	Function SetDescription(
+		/* [in] */ pszName As PCWSTR) As HRESULT
+	Function GetWorkingDirectory(
+		/* [size_is][out] */ pszDir As PSTR,
+		/* [in] */ cch As Long) As HRESULT
+	Function SetWorkingDirectory(
+		/* [in] */ pszDir As PCWSTR) As HRESULT
+	Function GetArguments(
+		/* [size_is][out] */ pszArgs As PSTR,
+		/* [in] */ cch As Long) As HRESULT
+	Function SetArguments(
+		/* [in] */ pszArgs As PCWSTR) As HRESULT
+	Function GetHotkey(
+		/* [out] */ ByRef wHotkey As Word) As HRESULT
+	Function SetHotkey(
+		/* [in] */ wHotkey As Word) As HRESULT
+	Function GetShowCmd(
+		/* [out] */ ByRef piShowCmd As Long) As HRESULT
+	Function SetShowCmd(
+		/* [in] */ iShowCmd As Long) As HRESULT
+	Function GetIconLocation(
+		/* [size_is][out] */ pszIconPath As PWSTR,
+		/* [in] */ cch As Long,
+		/* [out] */ ByRef iIcon As Long) As HRESULT
+	Function SetIconLocation(
+		/* [in] */ pszIconPath As PCWSTR,
+		/* [in] */ iIcon As Long) As HRESULT
+	Function SetRelativePath(
+		/* [in] */ pszPathRel As PCWSTR,
+		/* [in] */ dwReserved As DWord) As HRESULT
+	Function Resolve(
+		/* [in] */ hwnd As HWND,
+		/* [in] */ fFlags As DWord) As HRESULT
+	Function SetPath(
+		/* [in] */ pszFile As PCWSTR) As HRESULT
+End Interface
+
+#ifdef UNICODE
+TypeDef IShellLink = IShellLinkW
+#else
+TypeDef IShellLink = IShellLinkA
+#endif
+
+Enum SHCONT
+	SHCONTF_FOLDERS = &h0020
+	SHCONTF_NONFOLDERS = &h0040
+	SHCONTF_INCLUDEHIDDEN = &h0080
+	SHCONTF_INIT_ON_FIRST_NEXT = &h0100
+	SHCONTF_NETPRINTERSRCH = &h0200
+	SHCONTF_SHAREABLE = &h0400
+	SHCONTF_STORAGE = &h0800
+End Enum
+
+Enum SHGNO
+	SHGDN_NORMAL = &h0000
+	SHGDN_INFOLDER = &h0001
+	SHGDN_FOREDITING = &h1000
+	SHGDN_FORADDRESSBAR = &h4000
+	SHGDN_FORPARSING = &h8000
+End Enum
+
+TypeDef SHCONTF = DWord
+TypeDef SFGAOF = DWord
+TypeDef SHGDNF = DWord
+
+Dim IID_IShellFolder = [&h000214E6, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IShellFolder 'shobjidl.h
+	Inherits IUnknown
+
+	Function ParseDisplayName(
+		/* [in] */ hwnd As HWND,
+		/* [in] */ pbc As *IBindCtx,
+		/* [string][in] */ pszDisplayName As LPOLESTR,
+		/* [out] */ pchEaten As *DWord,
+		/* [out] */ ByRef pidl As *ITEMIDLIST,
+		/* [unique][out][in] */ pdwAttributes As *DWord) As HRESULT
+	Function EnumObjects(
+		/* [in] */ hwnd As HWND,
+		/* [in] */ grfFlags As SHCONTF,
+		/* [out] */ ByRef penumIDList As *IEnumIDList) As HRESULT
+	Function BindToObject(
+		/* [in] */ pidl As *ITEMIDLIST,
+		/* [in] */ pbc As *IBindCtx,
+		/* [in] */ ByRef riid As IID,
+		/* [iid_is][out] */ ppv As *VoidPtr) As HRESULT
+	Function BindToStorage(
+		/* [in] */ pidl As *ITEMIDLIST,
+		/* [in] */ pbc As *IBindCtx,
+		/* [in] */ ByRef riid As IID,
+		/* [iid_is][out] */ ppv As *VoidPtr) As HRESULT
+	Function CompareIDs(
+		/* [in] */ lParam As LPARAM,
+		/* [in] */ pidl1 As *ITEMIDLIST,
+		/* [in] */ pidl2 As *ITEMIDLIST) As HRESULT
+	Function CreateViewObject(
+		/* [in] */ hwndOwner As HWND,
+		/* [in] */ ByRef riid As IID,
+		/* [iid_is][out] */ ppv As *VoidPtr) As HRESULT
+	Function GetAttributesOf(
+		/* [in] */ cidl As DWord,
+		/* [size_is][in] */ apidl As *ITEMIDLIST,
+		/* [out][in] */ ByRef rgfInOut As SFGAOF) As HRESULT
+	Function GetUIObjectOf(
+		/* [in] */ hwndOwner As HWND,
+		/* [in] */ cidl As DWord,
+		/* [size_is][in] */ apidl As *ITEMIDLIST,
+		/* [in] */ ByRef riid As IID,
+		/* [unique][out][in] */ rgfReserved As *DWord,
+		/* [iid_is][out] */ ppv As *VoidPtr) As HRESULT
+	Function GetDisplayNameOf(
+		/* [in] */ pidl As *ITEMIDLIST,
+		/* [in] */ uFlags As SHGDNF,
+		/* [out] */ ByRef pName As STRRET) As HRESULT
+	Function SetNameOf(
+		/* [in] */ hwnd As HWND,
+		/* [in] */ pidl As *ITEMIDLIST,
+		/* [string][in] */ pszName As LPCWSTR,
+		/* [in] */ uFlags As SHGDNF,
+		/* [out] */ ByRef ppidlOut As LPITEMIDLIST) As HRESULT
+End Interface
Index: /trunk/ab5.0/ablib/src/api_shlwapi.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_shlwapi.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_shlwapi.sbp	(revision 506)
@@ -0,0 +1,82 @@
+' api_shlwapi.sbp
+
+Declare Function PathGetArgsA Lib "shlwapi" (pszPath As LPCWSTR) As LPWSTR
+Declare Function PathGetArgsW Lib "shlwapi" (pszPath As LPCSTR) As LPSTR
+#ifdef UNICODE
+Declare Function PathGetArgs Lib "shlwapi" Alias "PathGetArgsW" (pszPath As LPCWSTR) As LPWSTR
+#else
+Declare Function PathGetArgs Lib "shlwapi" Alias "PathGetArgsA" (pszPath As LPCSTR) As LPSTR
+#endif
+
+Declare Function StrFormatByteSize64W Lib "shlwapi" (ll As Int64, pszBuf As PWSTR, BufSize As DWord) As PWSTR
+Declare Function StrFormatByteSize64A Lib "shlwapi" (ll As Int64, pszBuf As PSTR, BufSize As DWord) As PSTR
+#ifdef UNICODE
+Declare Function StrFormatByteSize64 Lib "shlwapi" Alias "StrFormatByteSize64W" (ll As Int64, pszBuf As PWSTR, BufSize As DWord) As PWSTR
+#else
+Declare Function StrFormatByteSize64 Lib "shlwapi" Alias "StrFormatByteSize64A" (ll As Int64, pszBuf As PSTR, BufSize As DWord) As PSTR
+#endif
+
+Declare Function StrFormatKBSizeA Lib "shlwapi" (ByVal Value As Int64, ByVal pszBuf As LPSTR, ByVal uiBuSize As DWord) As LPSTR
+Declare Function StrFormatKBSizeW Lib "shlwapi" (ByVal Value As Int64, ByVal pszBuf As LPWSTR, ByVal uiBuSize As DWord) As LPWSTR
+#ifdef UNICODE
+Declare Function StrFormatKBSize Lib "shlwapi" Alias "StrFormatKBSizeW" (ByVal Value As Int64, ByVal pszBuf As LPWSTR, ByVal uiBuSize As DWord) As LPWSTR
+#else
+Declare Function StrFormatKBSize Lib "shlwapi" Alias "StrFormatKBSizeA" (ByVal Value As Int64, ByVal pszBuf As LPSTR, ByVal uiBuSize As DWord) As LPSTR
+#endif
+
+Declare Function StrRetToStrA Lib "shlwapi" (ByRef pstr As STRRET, pidl As *ITEMIDLIST, ByRef pszName As PSTR) As HRESULT
+Declare Function StrRetToStrW Lib "shlwapi" (ByRef pstr As STRRET, pidl As *ITEMIDLIST, ByRef pszName As PWSTR) As HRESULT
+#ifdef UNICODE
+Declare Function StrRetToStr Lib "shlwapi" Alias "StrRetToStrW" (ByRef str As STRRET, pidl As *ITEMIDLIST, ByRef pszName As PWSTR) As HRESULT
+#else
+Declare Function StrRetToStr Lib "shlwapi" Alias "StrRetToStrA" (ByRef str As STRRET, pidl As *ITEMIDLIST, ByRef pszName As PSTR) As HRESULT
+#endif
+
+Declare Function StrChrA Lib "shlwapi" (lpStart As LPCSTR, ch As SByte) As LPSTR
+Declare Function StrChrW Lib "shlwapi" (lpStart As LPCWSTR, ch As WCHAR) As LPWSTR
+#ifdef UNICODE
+Declare Function StrChr Lib "shlwapi" Alias "StrChrW" (lpStart As LPCWSTR, ch As WCHAR) As LPWSTR
+#else
+Declare Function StrChr Lib "shlwapi" Alias "StrChrA" (lpStart As LPCSTR, ch As SByte) As LPSTR
+#endif
+
+Declare Function StrStrA Lib "shlwapi" (lpFirst As LPCSTR, lpSrch As LPCSTR) As LPSTR
+Declare Function StrStrW Lib "shlwapi" (lpFirst As LPCWSTR, lpSrch As LPCWSTR) As LPWSTR
+#ifdef UNICODE
+Declare Function StrStr Lib "shlwapi" Alias "StrStrW" (lpFirst As LPCWSTR, lpSrch As LPCWSTR) As LPWSTR
+#else
+Declare Function StrStr Lib "shlwapi" Alias "StrStrA" (lpFirst As LPCSTR, lpSrch As LPCSTR) As LPSTR
+#endif
+
+Declare Function StrToIntA Lib "shlwapi" (psz As LPCSTR) As Long
+Declare Function StrToIntW Lib "shlwapi" (psz As LPCWSTR) As Long
+#ifdef UNICODE
+Declare Function StrToInt Lib "shlwapi" Alias "StrToIntW" (psz As LPCWSTR) As Long
+#else
+Declare Function StrToInt Lib "shlwapi" Alias "StrToIntA" (psz As LPCSTR) As Long
+#endif
+
+Declare Function PathRenameExtensionA Lib "shlwapi" (pszPath As LPSTR, pszExt As LPCSTR) As BOOL
+Declare Function PathRenameExtensionW Lib "shlwapi" (pszPath As LPWSTR, pszExt As LPCWSTR) As BOOL
+#ifdef UNICODE
+Declare Function PathRenameExtension Lib "shlwapi" Alias "PathRenameExtensionW" (pszPath As LPWSTR, pszExt As LPCWSTR) As BOOL
+#else
+Declare Function PathRenameExtension Lib "shlwapi" Alias "PathRenameExtensionA" (pszPath As LPSTR, pszExt As LPCSTR) As BOOL
+#endif
+
+
+Declare Function PathRemoveFileSpecA Lib "shlwapi" (pszPath As LPCSTR) As BOOL
+Declare Function PathRemoveFileSpecW Lib "shlwapi" (pszPath As LPCWSTR) As BOOL
+#ifdef UNICODE
+Declare Function PathRemoveFileSpec Lib "shlwapi" Alias "PathRemoveFileSpecW" (pszPath As LPCWSTR) As BOOL
+#else
+Declare Function PathRemoveFileSpec Lib "shlwapi" Alias "PathRemoveFileSpecA" (pszPath As LPCSTR) As BOOL
+#endif
+
+Declare Function PathRenameExtensionA Lib "shlwapi" (hKey As HKEY, pszSubKey As LPCSTR) As DWord
+Declare Function PathRenameExtensionW Lib "shlwapi" (hKey As HKEY, pszSubKey As LPCWSTR) As DWord
+#ifdef UNICODE
+Declare Function PathRenameExtension Lib "shlwapi" Alias "PathRenameExtensionW" (hKey As HKEY, pszSubKey As LPCWSTR) As DWord
+#else
+Declare Function PathRenameExtension Lib "shlwapi" Alias "PathRenameExtensionA" (hKey As HKEY, pszSubKey As LPCSTR) As DWord
+#endif
Index: /trunk/ab5.0/ablib/src/api_sql.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_sql.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_sql.sbp	(revision 506)
@@ -0,0 +1,806 @@
+' api_sql.sbp
+
+/* API declaration data types */
+TypeDef SQLCHAR        = Byte
+TypeDef SQLSCHAR       = Char
+TypeDef SQLDATE        = Byte
+TypeDef SQLDECIMAL     = Byte
+TypeDef SQLDOUBLE      = Double
+TypeDef SQLFLOAT       = Double
+TypeDef SQLINTEGER     = Long
+TypeDef SQLUINTEGER    = DWord
+TypeDef SQLSMALLINT    = Integer
+TypeDef SQLUSMALLINT   = Word
+#ifdef _WIN64
+TypeDef SQLLEN         = Int64
+TypeDef SQLULEN        = QWord
+TypeDef SQLSETPOSIROW  = QWord
+#else 
+TypeDef SQLLEN         = SQLINTEGER
+TypeDef SQLULEN        = SQLUINTEGER
+TypeDef SQLSETPOSIROW  = SQLUSMALLINT
+#endif
+
+'For Backward compatibility
+TypeDef SQLROWCOUNT    = SQLULEN
+TypeDef SQLROWSETSIZE  = SQLULEN
+TypeDef SQLTRANSID     = SQLULEN
+TypeDef SQLROWOFFSET   = SQLLEN
+
+TypeDef SQLNUMERIC = Byte
+TypeDef SQLPOINTER = VoidPtr
+TypeDef SQLREAL = Single
+TypeDef SQLSMALLINT = Integer
+TypeDef SQLUSMALLINT = Word
+TypeDef SQLTIME = Byte
+TypeDef SQLTIMESTAMP = Byte
+TypeDef SQLVARCHAR = Byte
+
+/* function return type */
+TypeDef SQLRETURN = SQLSMALLINT
+
+/* generic data structures */
+TypeDef SQLHANDLE = VoidPtr
+TypeDef SQLHENV = SQLHANDLE
+TypeDef SQLHDBC = SQLHANDLE
+TypeDef SQLHSTMT = SQLHANDLE
+TypeDef SQLHDESC = SQLHANDLE
+
+
+
+/* transfer types for DATE, TIME, TIMESTAMP */
+Type DATE_STRUCT
+	year As SQLSMALLINT
+	month As SQLUSMALLINT
+	day As SQLUSMALLINT
+End Type
+TypeDef SQL_DATE_STRUCT = DATE_STRUCT
+
+
+Type TIME_STRUCT
+	hour As SQLUSMALLINT
+	minute As SQLUSMALLINT
+	second As SQLUSMALLINT
+End Type
+TypeDef SQL_TIME_STRUCT = TIME_STRUCT
+
+
+Type TIMESTAMP_STRUCT
+	year As SQLSMALLINT
+	month As SQLUSMALLINT
+	day As SQLUSMALLINT
+	hour As SQLUSMALLINT
+	minute As SQLUSMALLINT
+	second As SQLUSMALLINT
+	fraction As SQLUSMALLINT
+End Type
+TypeDef SQL_TIMESTAMP_STRUCT = TIMESTAMP_STRUCT
+
+
+Const Enum SQLINTERVAL
+	SQL_IS_YEAR						= 1
+	SQL_IS_MONTH					= 2
+	SQL_IS_DAY						= 3
+	SQL_IS_HOUR						= 4
+	SQL_IS_MINUTE					= 5
+	SQL_IS_SECOND					= 6
+	SQL_IS_YEAR_TO_MONTH			= 7
+	SQL_IS_DAY_TO_HOUR				= 8
+	SQL_IS_DAY_TO_MINUTE			= 9
+	SQL_IS_DAY_TO_SECOND			= 10
+	SQL_IS_HOUR_TO_MINUTE			= 11
+	SQL_IS_HOUR_TO_SECOND			= 12
+	SQL_IS_MINUTE_TO_SECOND			= 13
+End Enum
+
+
+Type SQL_YEAR_MONTH_STRUCT
+	year As SQLUINTEGER
+	month As SQLUINTEGER
+End Type
+
+Type SQL_DAY_SECOND_STRUCT
+	day As SQLUINTEGER
+	hour As SQLUINTEGER
+	minute As SQLUINTEGER
+	second As SQLUINTEGER
+	fraction As SQLUINTEGER
+End Type
+
+Type SQL_INTERVAL_STRUCT
+	interval_type As SQLINTERVAL
+	interval_sign As SQLSMALLINT
+
+	'Union intval
+		year_month As SQL_YEAR_MONTH_STRUCT
+		'day_second As SQL_DAY_SECOND_STRUCT
+	'End Union
+End Type
+
+
+Const SQL_MAX_NUMERIC_LEN = 16
+Type SQL_NUMERIC_STRUCT
+	precision As SQLCHAR
+	scale As SQLSCHAR
+	sign As SQLCHAR
+	val[ELM(SQL_MAX_NUMERIC_LEN)] As SQLCHAR
+End Type
+
+
+TypeDef SQLGUID = GUID
+
+TypeDef BOOKMARK = SQLULEN
+
+typedef SQLWCHAR = Word
+TypeDef SQLTCHAR = SQLCHAR
+
+
+
+
+/* special length/indicator values */
+Const SQL_NULL_DATA             = (-1)
+Const SQL_DATA_AT_EXEC          = (-2)
+
+
+/* return values from functions */
+Const SQL_SUCCESS                = 0
+Const SQL_SUCCESS_WITH_INFO      = 1
+Const SQL_NO_DATA              = 100
+Const SQL_ERROR                 = (-1)
+Const SQL_INVALID_HANDLE        = (-2)
+
+Const SQL_STILL_EXECUTING        = 2
+Const SQL_NEED_DATA             = 99
+
+/* test for SQL_SUCCESS or SQL_SUCCESS_WITH_INFO */
+Const SQL_SUCCEEDED(rc) = (((rc) and (not 1))=0)
+
+/* flags for null-terminated string */
+Const SQL_NTS                   = (-3)
+Const SQL_NTSL                  = (-3)
+
+/* maximum message length */
+Const SQL_MAX_MESSAGE_LENGTH   = 512
+
+/* date/time length constants */
+Const SQL_DATE_LEN           = 10
+Const SQL_TIME_LEN           =  8  /* add P+1 if precision is nonzero */
+Const SQL_TIMESTAMP_LEN      = 19  /* add P+1 if precision is nonzero */
+
+/* handle type identifiers */
+Const SQL_HANDLE_ENV             = 1
+Const SQL_HANDLE_DBC             = 2
+Const SQL_HANDLE_STMT            = 3
+Const SQL_HANDLE_DESC            = 4
+
+/* environment attribute */
+Const SQL_ATTR_OUTPUT_NTS    = 10001
+
+/* connection attributes */
+Const SQL_ATTR_AUTO_IPD      = 10001
+Const SQL_ATTR_METADATA_ID   = 10014
+
+/* statement attributes */
+Const SQL_ATTR_APP_ROW_DESC       = 10010
+Const SQL_ATTR_APP_PARAM_DESC     = 10011
+Const SQL_ATTR_IMP_ROW_DESC       = 10012
+Const SQL_ATTR_IMP_PARAM_DESC     = 10013
+Const SQL_ATTR_CURSOR_SCROLLABLE  = (-1)
+Const SQL_ATTR_CURSOR_SENSITIVITY = (-2)
+
+/* SQL_ATTR_CURSOR_SCROLLABLE values */
+Const SQL_NONSCROLLABLE		 = 0
+Const SQL_SCROLLABLE			 = 1
+
+/* identifiers of fields in the SQL descriptor */
+Const SQL_DESC_COUNT                  = 1001
+Const SQL_DESC_TYPE                   = 1002
+Const SQL_DESC_LENGTH                 = 1003
+Const SQL_DESC_OCTET_LENGTH_PTR       = 1004
+Const SQL_DESC_PRECISION              = 1005
+Const SQL_DESC_SCALE                  = 1006
+Const SQL_DESC_DATETIME_INTERVAL_CODE = 1007
+Const SQL_DESC_NULLABLE               = 1008
+Const SQL_DESC_INDICATOR_PTR          = 1009
+Const SQL_DESC_DATA_PTR               = 1010
+Const SQL_DESC_NAME                   = 1011
+Const SQL_DESC_UNNAMED                = 1012
+Const SQL_DESC_OCTET_LENGTH           = 1013
+Const SQL_DESC_ALLOC_TYPE             = 1099
+
+/* identifiers of fields in the diagnostics area */
+Const SQL_DIAG_RETURNCODE        = 1
+Const SQL_DIAG_NUMBER            = 2
+Const SQL_DIAG_ROW_COUNT         = 3
+Const SQL_DIAG_SQLSTATE          = 4
+Const SQL_DIAG_NATIVE            = 5
+Const SQL_DIAG_MESSAGE_TEXT      = 6
+Const SQL_DIAG_DYNAMIC_FUNCTION  = 7
+Const SQL_DIAG_CLASS_ORIGIN      = 8
+Const SQL_DIAG_SUBCLASS_ORIGIN   = 9
+Const SQL_DIAG_CONNECTION_NAME  = 10
+Const SQL_DIAG_SERVER_NAME      = 11
+Const SQL_DIAG_DYNAMIC_FUNCTION_CODE = 12
+
+/* dynamic function codes */
+Const SQL_DIAG_ALTER_DOMAIN		 = 3
+Const SQL_DIAG_ALTER_TABLE            = 4
+Const SQL_DIAG_CALL				 = 7
+Const SQL_DIAG_CREATE_ASSERTION	 = 6
+Const SQL_DIAG_CREATE_CHARACTER_SET = 8
+Const SQL_DIAG_CREATE_COLLATION	 = 10
+Const SQL_DIAG_CREATE_DOMAIN		 = 23
+Const SQL_DIAG_CREATE_INDEX          = (-1)
+Const SQL_DIAG_CREATE_SCHEMA		 = 64
+Const SQL_DIAG_CREATE_TABLE          = 77
+Const SQL_DIAG_CREATE_TRANSLATION	 = 79
+Const SQL_DIAG_CREATE_VIEW           = 84
+Const SQL_DIAG_DELETE_WHERE          = 19
+Const SQL_DIAG_DROP_ASSERTION		 = 24
+Const SQL_DIAG_DROP_CHARACTER_SET	 = 25
+Const SQL_DIAG_DROP_COLLATION		 = 26
+Const SQL_DIAG_DROP_DOMAIN		 = 27
+Const SQL_DIAG_DROP_INDEX            = (-2)
+Const SQL_DIAG_DROP_SCHEMA		 = 31
+Const SQL_DIAG_DROP_TABLE            = 32
+Const SQL_DIAG_DROP_TRANSLATION      = 33
+Const SQL_DIAG_DROP_VIEW             = 36
+Const SQL_DIAG_DYNAMIC_DELETE_CURSOR = 38
+Const SQL_DIAG_DYNAMIC_UPDATE_CURSOR = 81
+Const SQL_DIAG_GRANT                 = 48
+Const SQL_DIAG_INSERT                = 50
+Const SQL_DIAG_REVOKE                = 59
+Const SQL_DIAG_SELECT_CURSOR         = 85
+Const SQL_DIAG_UNKNOWN_STATEMENT      = 0
+Const SQL_DIAG_UPDATE_WHERE          = 82
+
+/* SQL data type codes */
+Const SQL_UNKNOWN_TYPE = 0
+Const SQL_CHAR            = 1
+Const SQL_NUMERIC         = 2
+Const SQL_DECIMAL         = 3
+Const SQL_INTEGER         = 4
+Const SQL_SMALLINT        = 5
+Const SQL_FLOAT           = 6
+Const SQL_REAL            = 7
+Const SQL_DOUBLE          = 8
+Const SQL_DATETIME        = 9
+Const SQL_VARCHAR        = 12
+
+/* One-parameter shortcuts for date/time data types */
+Const SQL_TYPE_DATE      = 91
+Const SQL_TYPE_TIME      = 92
+Const SQL_TYPE_TIMESTAMP = 93
+
+/* Statement attribute values for cursor sensitivity */
+Const SQL_UNSPECIFIED     = 0
+Const SQL_INSENSITIVE     = 1
+Const SQL_SENSITIVE       = 2
+
+/* GetTypeInfo() request for all data types */
+Const SQL_ALL_TYPES       = 0
+
+/* Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData() */
+Const SQL_DEFAULT        = 99
+
+/* SQLSQLLEN GetData() code indicating that the application row descriptor
+ * specifies the data type
+ */
+Const SQL_ARD_TYPE      = (-99)
+
+/* SQL date/time type subcodes */
+Const SQL_CODE_DATE       = 1
+Const SQL_CODE_TIME       = 2
+Const SQL_CODE_TIMESTAMP  = 3
+
+/* CLI option values */
+Const SQL_FALSE           = 0
+Const SQL_TRUE            = 1
+
+/* values of NULLABLE field in descriptor */
+Const SQL_NO_NULLS        = 0
+Const SQL_NULLABLE        = 1
+
+/* Value returned by SQLGetTypeInfo() to denote that it is
+ * not known whether or not a data type supports null values.
+ */
+Const SQL_NULLABLE_UNKNOWN  = 2
+
+/* Values returned by SQLGetTypeInfo() to show WHERE clause
+ * supported
+ */
+Const SQL_PRED_NONE     = 0
+Const SQL_PRED_CHAR     = 1
+Const SQL_PRED_BASIC    = 2
+
+/* values of UNNAMED field in descriptor */
+Const SQL_NAMED           = 0
+Const SQL_UNNAMED         = 1
+
+/* values of ALLOC_TYPE field in descriptor */
+Const SQL_DESC_ALLOC_AUTO = 1
+Const SQL_DESC_ALLOC_USER = 2
+
+/* FreeStmt() options */
+Const SQL_CLOSE           = 0
+Const SQL_DROP            = 1
+Const SQL_UNBIND          = 2
+Const SQL_RESET_PARAMS    = 3
+
+/* Codes used for FetchOrientation in SQLFetchScroll(), 
+   and in SQLDataSources() 
+*/
+Const SQL_FETCH_NEXT      = 1
+Const SQL_FETCH_FIRST     = 2
+
+/* Other codes used for FetchOrientation in SQLFetchScroll() */
+Const SQL_FETCH_LAST      = 3
+Const SQL_FETCH_PRIOR     = 4
+Const SQL_FETCH_ABSOLUTE  = 5
+Const SQL_FETCH_RELATIVE  = 6
+
+/* SQLEndTran() options */
+Const SQL_COMMIT          = 0
+Const SQL_ROLLBACK        = 1
+
+/* null handles returned by SQLAllocHandle() */
+Const SQL_NULL_HENV       = 0
+Const SQL_NULL_HDBC       = 0
+Const SQL_NULL_HSTMT      = 0
+Const SQL_NULL_HDESC      = 0
+
+/* null handle used in place of parent handle when allocating HENV */
+Const SQL_NULL_HANDLE     = 0
+
+/* Values that may appear in the result set of SQLSpecialColumns() */
+Const SQL_SCOPE_CURROW    = 0
+Const SQL_SCOPE_TRANSACTION = 1
+Const SQL_SCOPE_SESSION   = 2
+
+Const SQL_PC_UNKNOWN      = 0
+Const SQL_PC_NON_PSEUDO   = 1
+Const SQL_PC_PSEUDO       = 2
+
+/* Reserved value for the IdentifierType argument of SQLSpecialColumns() */
+Const SQL_ROW_IDENTIFIER  = 1
+
+/* Reserved values for UNIQUE argument of SQLStatistics() */
+Const SQL_INDEX_UNIQUE    = 0
+Const SQL_INDEX_ALL       = 1
+
+/* Values that may appear in the result set of SQLStatistics() */
+Const SQL_INDEX_CLUSTERED = 1
+Const SQL_INDEX_HASHED    = 2
+Const SQL_INDEX_OTHER     = 3
+
+/* SQLGetFunctions() values to identify ODBC APIs */
+Const SQL_API_SQLALLOCCONNECT         = 1
+Const SQL_API_SQLALLOCENV             = 2
+Const SQL_API_SQLALLOCHANDLE       = 1001
+Const SQL_API_SQLALLOCSTMT            = 3
+Const SQL_API_SQLBINDCOL              = 4
+Const SQL_API_SQLBINDPARAM         = 1002
+Const SQL_API_SQLCANCEL               = 5
+Const SQL_API_SQLCLOSECURSOR       = 1003
+Const SQL_API_SQLCOLATTRIBUTE         = 6
+Const SQL_API_SQLCOLUMNS             = 40
+Const SQL_API_SQLCONNECT              = 7
+Const SQL_API_SQLCOPYDESC          = 1004
+Const SQL_API_SQLDATASOURCES         = 57
+Const SQL_API_SQLDESCRIBECOL          = 8
+Const SQL_API_SQLDISCONNECT           = 9
+Const SQL_API_SQLENDTRAN           = 1005
+Const SQL_API_SQLERROR               = 10
+Const SQL_API_SQLEXECDIRECT          = 11
+Const SQL_API_SQLEXECUTE             = 12
+Const SQL_API_SQLFETCH               = 13
+Const SQL_API_SQLFETCHSCROLL       = 1021
+Const SQL_API_SQLFREECONNECT         = 14
+Const SQL_API_SQLFREEENV             = 15
+Const SQL_API_SQLFREEHANDLE        = 1006
+Const SQL_API_SQLFREESTMT            = 16
+Const SQL_API_SQLGETCONNECTATTR    = 1007
+Const SQL_API_SQLGETCONNECTOPTION    = 42
+Const SQL_API_SQLGETCURSORNAME       = 17
+Const SQL_API_SQLGETDATA             = 43
+Const SQL_API_SQLGETDESCFIELD      = 1008
+Const SQL_API_SQLGETDESCREC        = 1009
+Const SQL_API_SQLGETDIAGFIELD      = 1010
+Const SQL_API_SQLGETDIAGREC        = 1011
+Const SQL_API_SQLGETENVATTR        = 1012
+Const SQL_API_SQLGETFUNCTIONS        = 44
+Const SQL_API_SQLGETINFO             = 45
+Const SQL_API_SQLGETSTMTATTR       = 1014
+Const SQL_API_SQLGETSTMTOPTION       = 46
+Const SQL_API_SQLGETTYPEINFO         = 47
+Const SQL_API_SQLNUMRESULTCOLS       = 18
+Const SQL_API_SQLPARAMDATA           = 48
+Const SQL_API_SQLPREPARE             = 19
+Const SQL_API_SQLPUTDATA             = 49
+Const SQL_API_SQLROWCOUNT            = 20
+Const SQL_API_SQLSETCONNECTATTR    = 1016
+Const SQL_API_SQLSETCONNECTOPTION    = 50
+Const SQL_API_SQLSETCURSORNAME       = 21
+Const SQL_API_SQLSETDESCFIELD      = 1017
+Const SQL_API_SQLSETDESCREC        = 1018
+Const SQL_API_SQLSETENVATTR        = 1019
+Const SQL_API_SQLSETPARAM            = 22
+Const SQL_API_SQLSETSTMTATTR       = 1020
+Const SQL_API_SQLSETSTMTOPTION       = 51
+Const SQL_API_SQLSPECIALCOLUMNS      = 52
+Const SQL_API_SQLSTATISTICS          = 53
+Const SQL_API_SQLTABLES              = 54
+Const SQL_API_SQLTRANSACT            = 23
+
+/* Information requested by SQLGetInfo() */
+Const SQL_MAX_DRIVER_CONNECTIONS           = 0
+Const SQL_MAXIMUM_DRIVER_CONNECTIONS	 = SQL_MAX_DRIVER_CONNECTIONS
+Const SQL_MAX_CONCURRENT_ACTIVITIES        = 1
+Const SQL_MAXIMUM_CONCURRENT_ACTIVITIES = SQL_MAX_CONCURRENT_ACTIVITIES
+Const SQL_DATA_SOURCE_NAME                 = 2
+Const SQL_FETCH_DIRECTION                  = 8
+Const SQL_SERVER_NAME                     = 13
+Const SQL_SEARCH_PATTERN_ESCAPE           = 14
+Const SQL_DBMS_NAME                       = 17
+Const SQL_DBMS_VER                        = 18
+Const SQL_ACCESSIBLE_TABLES               = 19
+Const SQL_ACCESSIBLE_PROCEDURES         = 20
+Const SQL_CURSOR_COMMIT_BEHAVIOR          = 23
+Const SQL_DATA_SOURCE_READ_ONLY           = 25
+Const SQL_DEFAULT_TXN_ISOLATION           = 26
+Const SQL_IDENTIFIER_CASE                 = 28
+Const SQL_IDENTIFIER_QUOTE_CHAR           = 29
+Const SQL_MAX_COLUMN_NAME_LEN             = 30
+Const SQL_MAXIMUM_COLUMN_NAME_LENGTH	 = SQL_MAX_COLUMN_NAME_LEN
+Const SQL_MAX_CURSOR_NAME_LEN             = 31
+Const SQL_MAXIMUM_CURSOR_NAME_LENGTH	 = SQL_MAX_CURSOR_NAME_LEN
+Const SQL_MAX_SCHEMA_NAME_LEN             = 32
+Const SQL_MAXIMUM_SCHEMA_NAME_LENGTH	 = SQL_MAX_SCHEMA_NAME_LEN
+Const SQL_MAX_CATALOG_NAME_LEN            = 34
+Const SQL_MAXIMUM_CATALOG_NAME_LENGTH	 = SQL_MAX_CATALOG_NAME_LEN
+Const SQL_MAX_TABLE_NAME_LEN              = 35
+Const SQL_SCROLL_CONCURRENCY              = 43
+Const SQL_TXN_CAPABLE                     = 46
+Const SQL_TRANSACTION_CAPABLE			 = SQL_TXN_CAPABLE
+Const SQL_USER_NAME                       = 47
+Const SQL_TXN_ISOLATION_OPTION            = 72
+Const SQL_TRANSACTION_ISOLATION_OPTION = SQL_TXN_ISOLATION_OPTION
+Const SQL_INTEGRITY                       = 73
+Const SQL_GETDATA_EXTENSIONS              = 81
+Const SQL_NULL_COLLATION                  = 85
+Const SQL_ALTER_TABLE                     = 86
+Const SQL_ORDER_BY_COLUMNS_IN_SELECT      = 90
+Const SQL_SPECIAL_CHARACTERS              = 94
+Const SQL_MAX_COLUMNS_IN_GROUP_BY         = 97
+Const SQL_MAXIMUM_COLUMNS_IN_GROUP_BY	 = SQL_MAX_COLUMNS_IN_GROUP_BY
+Const SQL_MAX_COLUMNS_IN_INDEX            = 98
+Const SQL_MAXIMUM_COLUMNS_IN_INDEX	 = SQL_MAX_COLUMNS_IN_INDEX
+Const SQL_MAX_COLUMNS_IN_ORDER_BY         = 99
+Const SQL_MAXIMUM_COLUMNS_IN_ORDER_BY	 = SQL_MAX_COLUMNS_IN_ORDER_BY
+Const SQL_MAX_COLUMNS_IN_SELECT          = 100
+Const SQL_MAXIMUM_COLUMNS_IN_SELECT	   = SQL_MAX_COLUMNS_IN_SELECT
+Const SQL_MAX_COLUMNS_IN_TABLE           = 101
+Const SQL_MAX_INDEX_SIZE                 = 102
+Const SQL_MAXIMUM_INDEX_SIZE			   = SQL_MAX_INDEX_SIZE
+Const SQL_MAX_ROW_SIZE                   = 104
+Const SQL_MAXIMUM_ROW_SIZE			   = SQL_MAX_ROW_SIZE
+Const SQL_MAX_STATEMENT_LEN              = 105
+Const SQL_MAXIMUM_STATEMENT_LENGTH	   = SQL_MAX_STATEMENT_LEN
+Const SQL_MAX_TABLES_IN_SELECT           = 106
+Const SQL_MAXIMUM_TABLES_IN_SELECT	   = SQL_MAX_TABLES_IN_SELECT
+Const SQL_MAX_USER_NAME_LEN              = 107
+Const SQL_MAXIMUM_USER_NAME_LENGTH	   = SQL_MAX_USER_NAME_LEN
+Const SQL_OJ_CAPABILITIES                = 115
+Const SQL_OUTER_JOIN_CAPABILITIES		   = SQL_OJ_CAPABILITIES
+
+Const SQL_XOPEN_CLI_YEAR               = 10000
+Const SQL_CURSOR_SENSITIVITY           = 10001
+Const SQL_DESCRIBE_PARAMETER           = 10002
+Const SQL_CATALOG_NAME                 = 10003
+Const SQL_COLLATION_SEQ                = 10004
+Const SQL_MAX_IDENTIFIER_LEN           = 10005
+Const SQL_MAXIMUM_IDENTIFIER_LENGTH	 = SQL_MAX_IDENTIFIER_LEN
+
+/* SQL_ALTER_TABLE bitmasks */
+Const SQL_AT_ADD_COLUMN                    = &H00000001
+Const SQL_AT_DROP_COLUMN                   = &H00000002
+Const SQL_AT_ADD_CONSTRAINT                = &H00000008
+
+/* SQL_ASYNC_MODE values */
+Const SQL_AM_NONE                         = 0
+Const SQL_AM_CONNECTION                   = 1
+Const SQL_AM_STATEMENT                    = 2
+
+/* SQL_CURSOR_COMMIT_BEHAVIOR values */
+Const SQL_CB_DELETE                       = 0
+Const SQL_CB_CLOSE                        = 1
+Const SQL_CB_PRESERVE                     = 2
+
+/* SQL_FETCH_DIRECTION bitmasks */
+Const SQL_FD_FETCH_NEXT                   = &H00000001
+Const SQL_FD_FETCH_FIRST                  = &H00000002
+Const SQL_FD_FETCH_LAST                   = &H00000004
+Const SQL_FD_FETCH_PRIOR                  = &H00000008
+Const SQL_FD_FETCH_ABSOLUTE               = &H00000010
+Const SQL_FD_FETCH_RELATIVE               = &H00000020
+
+/* SQL_GETDATA_EXTENSIONS bitmasks */
+Const SQL_GD_ANY_COLUMN                   = &H00000001
+Const SQL_GD_ANY_ORDER                    = &H00000002
+
+/* SQL_IDENTIFIER_CASE values */
+Const SQL_IC_UPPER                        = 1
+Const SQL_IC_LOWER                        = 2
+Const SQL_IC_SENSITIVE                    = 3
+Const SQL_IC_MIXED                        = 4
+
+/* SQL_OJ_CAPABILITIES bitmasks */
+/* NB: this means 'outer join', not what  you may be thinking */
+
+
+Const SQL_OJ_LEFT                         = &H00000001
+Const SQL_OJ_RIGHT                        = &H00000002
+Const SQL_OJ_FULL                         = &H00000004
+Const SQL_OJ_NESTED                       = &H00000008
+Const SQL_OJ_NOT_ORDERED                  = &H00000010
+Const SQL_OJ_INNER                        = &H00000020
+Const SQL_OJ_ALL_COMPARISON_OPS           = &H00000040
+
+/* SQL_SCROLL_CONCURRENCY bitmasks */
+Const SQL_SCCO_READ_ONLY                  = &H00000001
+Const SQL_SCCO_LOCK                       = &H00000002
+Const SQL_SCCO_OPT_ROWVER                 = &H00000004
+Const SQL_SCCO_OPT_VALUES                 = &H00000008
+
+/* SQL_TXN_CAPABLE values */
+Const SQL_TC_NONE                         = 0
+Const SQL_TC_DML                          = 1
+Const SQL_TC_ALL                          = 2
+Const SQL_TC_DDL_COMMIT                   = 3
+Const SQL_TC_DDL_IGNORE                   = 4
+
+/* SQL_TXN_ISOLATION_OPTION bitmasks */
+Const SQL_TXN_READ_UNCOMMITTED            = &H00000001
+Const SQL_TRANSACTION_READ_UNCOMMITTED = SQL_TXN_READ_UNCOMMITTED
+Const SQL_TXN_READ_COMMITTED              = &H00000002
+Const SQL_TRANSACTION_READ_COMMITTED	 = SQL_TXN_READ_COMMITTED
+Const SQL_TXN_REPEATABLE_READ             = &H00000004
+Const SQL_TRANSACTION_REPEATABLE_READ	 = SQL_TXN_REPEATABLE_READ
+Const SQL_TXN_SERIALIZABLE                = &H00000008
+Const SQL_TRANSACTION_SERIALIZABLE	 = SQL_TXN_SERIALIZABLE
+
+/* SQL_NULL_COLLATION values */
+Const SQL_NC_HIGH                         = 0
+Const SQL_NC_LOW                          = 1
+
+
+Declare Function SQLAllocConnect Lib "odbc32.dll" (
+	EnvironmentHandle As SQLHENV,
+	ByRef ConnectionHandle As SQLHDBC) As SQLRETURN
+
+Declare Function SQLAllocEnv Lib "odbc32.dll" (ByRef EnvironmentHandle As SQLHENV) As SQLRETURN
+
+Declare Function SQLAllocHandle Lib "odbc32.dll" (HandleType As SQLSMALLINT,
+           InputHandle As SQLHANDLE, ByRef OutputHandle As SQLHANDLE) As SQLRETURN
+
+Declare Function SQLAllocStmt Lib "odbc32.dll" (ConnectionHandle As SQLHDBC,
+           ByRef StatementHandle As SQLHSTMT) As SQLRETURN
+
+Declare Function SQLBindCol Lib "odbc32.dll" (StatementHandle As SQLHSTMT, 
+		   ColumnNumber As SQLUSMALLINT, TargetType As SQLSMALLINT, 
+		   ByRef TargetValue As Any, BufferLength As SQLLEN, 
+	   	   ByRef StrLen_or_Ind As SQLLEN) As SQLRETURN
+
+Declare Function SQLBindParam Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           ParameterNumber As SQLUSMALLINT, ValueType As SQLSMALLINT,
+           ParameterType As SQLSMALLINT, LengthPrecision As SQLULEN,
+           ParameterScale As SQLSMALLINT, ParameterValue As SQLPOINTER,
+           ByRef StrLen_or_Ind As SQLLEN) As SQLRETURN
+
+Declare Function SQLCancel Lib "odbc32.dll" (StatementHandle As SQLHSTMT) As SQLRETURN
+
+Declare Function SQLCloseCursor Lib "odbc32.dll" (StatementHandle As SQLHSTMT) As SQLRETURN
+
+#ifdef _WIN64
+Declare Function SQLColAttribute Lib "odbc32.dll"  (StatementHandle As SQLHSTMT,
+           ColumnNumber As SQLUSMALLINT, FieldIdentifier As SQLUSMALLINT,
+           CharacterAttribute As SQLPOINTER, BufferLength As SQLSMALLINT,
+           ByRef StringLength As SQLSMALLINT, ByRef NumericAttribute As SQLLEN) As SQLRETURN
+#else
+Declare Function SQLColAttribute Lib "odbc32.dll"  (StatementHandle As SQLHSTMT,
+           ColumnNumber As SQLUSMALLINT, FieldIdentifier As SQLUSMALLINT,
+           CharacterAttribute As SQLPOINTER, BufferLength As SQLSMALLINT,
+           ByRef StringLength As SQLSMALLINT, NumericAttribute As SQLPOINTER) As SQLRETURN
+#endif
+
+
+Declare Function SQLColumns Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           CatalogName As *SQLCHAR, NameLength1 As SQLSMALLINT,
+           SchemaName As *SQLCHAR, NameLength2 As SQLSMALLINT,
+           TableName As *SQLCHAR, NameLength3 As SQLSMALLINT,
+           ColumnName As *SQLCHAR, NameLength4 As SQLSMALLINT) As SQLRETURN
+
+
+Declare Function SQLConnect Lib "odbc32.dll" (ConnectionHandle As SQLHDBC,
+           ServerName As *SQLCHAR, NameLength1 As SQLSMALLINT,
+           UserName As *SQLCHAR, NameLength2 As SQLSMALLINT,
+           Authentication As *SQLCHAR, NameLength3 As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLCopyDesc Lib "odbc32.dll" (SourceDescHandle As SQLHDESC,
+           TargetDescHandle As SQLHDESC) As SQLRETURN
+
+Declare Function SQLDataSources Lib "odbc32.dll" (EnvironmentHandle As SQLHENV,
+           Direction As SQLUSMALLINT, ServerName As *SQLCHAR,
+           BufferLength1 As SQLSMALLINT, ByRef NameLength1 As SQLSMALLINT,
+           Description As *SQLCHAR, BufferLength2 As SQLSMALLINT,
+           ByRef NameLength2 As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLDescribeCol Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           ColumnNumber As SQLSMALLINT, ColumnName As *SQLCHAR,
+           BufferLength As SQLSMALLINT, ByRef NameLength As SQLSMALLINT,
+           ByRef DataType As SQLSMALLINT, ByRef ColumnSize As SQLINTEGER,
+           ByRef DecimalDigits As SQLSMALLINT, ByRef Nullable As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLDisconnect Lib "odbc32.dll" (ConnectionHandle As SQLHDBC) As SQLRETURN
+
+Declare Function SQLEndTran Lib "odbc32.dll" (HandleType As SQLSMALLINT, Handle As SQLHANDLE,
+           CompletionType As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLError Lib "odbc32.dll" (EnvironmentHandle As SQLHENV,
+           ConnectionHandle As SQLHDBC, StatementHandle As SQLHSTMT,
+           Sqlstate As *SQLCHAR, ByRef NativeError As SQLINTEGER,
+           MessageText As *SQLCHAR, BufferLength As SQLSMALLINT,
+           ByRef TextLength As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLExecDirect Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           StatementText As *SQLCHAR, TextLength As SQLINTEGER) As SQLRETURN
+
+Declare Function SQLExecute Lib "odbc32.dll" (StatementHandle As SQLHSTMT) As SQLRETURN
+
+Declare Function SQLFetch Lib "odbc32.dll" (StatementHandle As SQLHSTMT) As SQLRETURN
+
+Declare Function SQLFetchScroll Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           FetchOrientation As SQLSMALLINT, FetchOffset As SQLLEN) As SQLRETURN
+
+Declare Function SQLFreeConnect Lib "odbc32.dll" (ConnectionHandle As SQLHDBC) As SQLRETURN
+
+Declare Function SQLFreeEnv Lib "odbc32.dll" (EnvironmentHandle As SQLHENV) As SQLRETURN
+
+Declare Function SQLFreeHandle Lib "odbc32.dll" (HandleType As SQLSMALLINT, Handle As SQLHANDLE) As SQLRETURN
+
+Declare Function SQLFreeStmt Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           Option As SQLUSMALLINT) As SQLRETURN
+
+Declare Function SQLGetConnectAttr Lib "odbc32.dll" (ConnectionHandle As SQLHDBC,
+           Attribute As SQLINTEGER, Value As SQLPOINTER,
+           BufferLength As SQLINTEGER, ByRef StringLength As SQLINTEGER) As SQLRETURN
+
+Declare Function SQLGetConnectOption Lib "odbc32.dll" (ConnectionHandle As SQLHDBC,
+           Option As SQLUSMALLINT, Value As SQLPOINTER) As SQLRETURN
+
+Declare Function SQLGetCursorName Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           CursorName As *SQLCHAR, BufferLength As SQLSMALLINT,
+           ByRef NameLength As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLGetData Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           ColumnNumber As SQLUSMALLINT, TargetType As SQLSMALLINT,
+           TargetValue As SQLPOINTER, BufferLength As SQLLEN,
+           ByRef StrLen_or_Ind As SQLLEN) As SQLRETURN
+
+Declare Function SQLGetDescField Lib "odbc32.dll" (DescriptorHandle As SQLHDESC,
+           RecNumber As SQLSMALLINT, FieldIdentifier As SQLSMALLINT,
+           Value As SQLPOINTER, BufferLength As SQLINTEGER,
+           ByRef StringLength As SQLINTEGER) As SQLRETURN
+
+Declare Function SQLGetDescRec Lib "odbc32.dll" (DescriptorHandle As SQLHDESC,
+           RecNumber As SQLSMALLINT, Name As *SQLCHAR,
+           BufferLength As SQLSMALLINT, ByRef StringLength As SQLSMALLINT,
+           ByRef iType As SQLSMALLINT, ByRef SubType As SQLSMALLINT, 
+           ByRef Length As SQLLEN, ByRef Precision As SQLSMALLINT, 
+           ByRef Scale As SQLSMALLINT, ByRef Nullable As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLGetDiagField Lib "odbc32.dll" (HandleType As SQLSMALLINT, Handle As SQLHANDLE,
+           RecNumber As SQLSMALLINT, DiagIdentifier As SQLSMALLINT,
+           DiagInfo As SQLPOINTER, BufferLength As SQLSMALLINT,
+           ByRef StringLength As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLGetDiagRec Lib "odbc32.dll" (HandleType As SQLSMALLINT, Handle As SQLHANDLE,
+           RecNumber As SQLSMALLINT, Sqlstate As *SQLCHAR,
+           ByRef NativeError As SQLINTEGER, MessageText As *SQLCHAR,
+           BufferLength As SQLSMALLINT, ByRef TextLength As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLGetEnvAttr Lib "odbc32.dll" (EnvironmentHandle As SQLHENV,
+           Attribute As SQLINTEGER, Value As SQLPOINTER,
+           BufferLength As SQLINTEGER, ByRef StringLength As SQLINTEGER) As SQLRETURN
+
+Declare Function SQLGetFunctions Lib "odbc32.dll" (ConnectionHandle As SQLHDBC,
+           FunctionId As SQLUSMALLINT, ByRef Supported As SQLUSMALLINT) As SQLRETURN
+
+Declare Function SQLGetInfo Lib "odbc32.dll" (ConnectionHandle As SQLHDBC,
+           InfoType As SQLUSMALLINT, InfoValue As SQLPOINTER,
+           BufferLength As SQLSMALLINT, ByRef StringLength As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLGetStmtAttr Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           Attribute As SQLINTEGER, Value As SQLPOINTER,
+           BufferLength As SQLINTEGER, ByRef StringLength As SQLINTEGER) As SQLRETURN
+
+Declare Function SQLGetStmtOption Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           Option As SQLUSMALLINT, Value As SQLPOINTER) As SQLRETURN
+
+Declare Function SQLGetTypeInfo Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           DataType As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLNumResultCols Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           ByRef ColumnCount As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLParamData Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           ByRef Value As SQLPOINTER) As SQLRETURN
+
+Declare Function SQLPrepare Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           StatementText As *SQLCHAR, TextLength As SQLINTEGER) As SQLRETURN
+
+Declare Function SQLPutData Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           Data As SQLPOINTER, StrLen_or_Ind As SQLLEN) As SQLRETURN
+
+Declare Function SQLRowCount Lib "odbc32.dll" (StatementHandle As SQLHSTMT, 
+	   ByRef RowCount As SQLLEN) As SQLRETURN
+
+Declare Function SQLSetConnectAttr Lib "odbc32.dll" (ConnectionHandle As SQLHDBC,
+           Attribute As SQLINTEGER, Value As SQLPOINTER,
+           StringLength As SQLINTEGER) As SQLRETURN
+
+Declare Function SQLSetConnectOption Lib "odbc32.dll" (ConnectionHandle As SQLHDBC,
+           Option As SQLUSMALLINT, Value As SQLULEN) As SQLRETURN
+
+Declare Function SQLSetCursorName Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           CursorName As *SQLCHAR, NameLength As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLSetDescField Lib "odbc32.dll" (DescriptorHandle As SQLHDESC,
+           RecNumber As SQLSMALLINT, FieldIdentifier As SQLSMALLINT,
+           Value As SQLPOINTER, BufferLength As SQLINTEGER) As SQLRETURN
+
+Declare Function SQLSetDescRec Lib "odbc32.dll" (DescriptorHandle As SQLHDESC,
+           RecNumber As SQLSMALLINT, iType As SQLSMALLINT,
+           SubType As SQLSMALLINT, Length As SQLLEN,
+           Precision As SQLSMALLINT, Scale As SQLSMALLINT,
+           Data As SQLPOINTER, ByRef StringLength As SQLLEN,
+           ByRef Indicator As SQLLEN) As SQLRETURN
+
+Declare Function SQLSetEnvAttr Lib "odbc32.dll" (EnvironmentHandle As SQLHENV,
+           Attribute As SQLINTEGER, Value As SQLPOINTER,
+           StringLength As SQLINTEGER) As SQLRETURN
+
+Declare Function SQLSetParam Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           ParameterNumber As SQLUSMALLINT, ValueType As SQLSMALLINT,
+           ParameterType As SQLSMALLINT, LengthPrecision As SQLULEN,
+           ParameterScale As SQLSMALLINT, ParameterValue As SQLPOINTER,
+           ByRef StrLen_or_Ind As SQLLEN) As SQLRETURN
+
+Declare Function SQLSetStmtAttr Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           Attribute As SQLINTEGER, Value As SQLPOINTER,
+           StringLength As SQLINTEGER) As SQLRETURN
+
+Declare Function SQLSetStmtOption Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           Option As SQLUSMALLINT, Value As SQLULEN) As SQLRETURN
+
+Declare Function SQLSpecialColumns Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           IdentifierType As SQLUSMALLINT, CatalogName As *SQLCHAR,
+           NameLength1 As SQLSMALLINT, SchemaName As *SQLCHAR,
+           NameLength2 As SQLSMALLINT, TableName As *SQLCHAR,
+           NameLength3 As SQLSMALLINT, Scope As SQLUSMALLINT,
+           Nullable As SQLUSMALLINT) As SQLRETURN
+
+Declare Function SQLStatistics Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           CatalogName As *SQLCHAR, NameLength1 As SQLSMALLINT,
+           SchemaName As *SQLCHAR, NameLength2 As SQLSMALLINT,
+           TableName As *SQLCHAR, NameLength3 As SQLSMALLINT,
+           Unique As SQLUSMALLINT, Reserved As SQLUSMALLINT) As SQLRETURN
+
+Declare Function SQLTables Lib "odbc32.dll" (StatementHandle As SQLHSTMT,
+           CatalogName As *SQLCHAR, NameLength1 As SQLSMALLINT,
+           SchemaName As *SQLCHAR, NameLength2 As SQLSMALLINT,
+           TableName As *SQLCHAR, NameLength3 As SQLSMALLINT,
+           TableType As *SQLCHAR, NameLength4 As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLTransact Lib "odbc32.dll" (EnvironmentHandle As SQLHENV,
+           ConnectionHandle As SQLHDBC, CompletionType As SQLUSMALLINT) As SQLRETURN
Index: /trunk/ab5.0/ablib/src/api_sqlext.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_sqlext.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_sqlext.sbp	(revision 506)
@@ -0,0 +1,1787 @@
+' api_sqlext.sbp
+
+#require <api_sql.sbp>
+
+/* generally useful constants */
+Const SQL_SPEC_MAJOR      = 3     	/* Major version of specification  */
+Const SQL_SPEC_MINOR	    = 52     	/* Minor version of specification  */
+Const SQL_SPEC_STRING    = "03.52"	/* String constant for version */
+
+Const SQL_SQLSTATE_SIZE	 = 5	/* size of SQLSTATE */
+Const SQL_MAX_DSN_LENGTH	 = 32	/* maximum data source name size */
+
+Const SQL_MAX_OPTION_STRING_LENGTH     = 256
+
+/* return code SQL_NO_DATA_FOUND is the same as SQL_NO_DATA */
+Const SQL_NO_DATA_FOUND	 = SQL_NO_DATA
+
+/* an end handle type */
+Const SQL_HANDLE_SENV		 = 5
+
+
+/* env attribute */
+Const SQL_ATTR_ODBC_VERSION				 = 200
+Const SQL_ATTR_CONNECTION_POOLING			 = 201
+Const SQL_ATTR_CP_MATCH					 = 202
+
+
+/* values for SQL_ATTR_CONNECTION_POOLING */
+Const SQL_CP_OFF							 = 0
+Const SQL_CP_ONE_PER_DRIVER				 = 1
+Const SQL_CP_ONE_PER_HENV					 = 2
+Const SQL_CP_DEFAULT						 = SQL_CP_OFF
+
+/* values for SQL_ATTR_CP_MATCH */
+Const SQL_CP_STRICT_MATCH					 = 0
+Const SQL_CP_RELAXED_MATCH				 = 1
+Const SQL_CP_MATCH_DEFAULT				 = SQL_CP_STRICT_MATCH		
+
+/* values for SQL_ATTR_ODBC_VERSION */
+Const SQL_OV_ODBC2						 = 2
+Const SQL_OV_ODBC3						 = 3
+
+
+/* connection attributes */
+Const SQL_ACCESS_MODE                  = 101
+Const SQL_AUTOCOMMIT                   = 102
+Const SQL_LOGIN_TIMEOUT                = 103
+Const SQL_OPT_TRACE                    = 104
+Const SQL_OPT_TRACEFILE                = 105
+Const SQL_TRANSLATE_DLL                = 106
+Const SQL_TRANSLATE_OPTION             = 107
+Const SQL_TXN_ISOLATION                = 108
+Const SQL_CURRENT_QUALIFIER            = 109
+Const SQL_ODBC_CURSORS                 = 110
+Const SQL_QUIET_MODE                   = 111
+Const SQL_PACKET_SIZE                  = 112
+
+/* connection attributes with new names */
+Const SQL_ATTR_ACCESS_MODE		 = SQL_ACCESS_MODE
+Const SQL_ATTR_AUTOCOMMIT			 = SQL_AUTOCOMMIT
+Const SQL_ATTR_CONNECTION_TIMEOUT	 = 113
+Const SQL_ATTR_CURRENT_CATALOG	 = SQL_CURRENT_QUALIFIER
+Const SQL_ATTR_DISCONNECT_BEHAVIOR	 = 114
+Const SQL_ATTR_ENLIST_IN_DTC		 = 1207
+Const SQL_ATTR_ENLIST_IN_XA		 = 1208
+Const SQL_ATTR_LOGIN_TIMEOUT		 = SQL_LOGIN_TIMEOUT
+Const SQL_ATTR_ODBC_CURSORS		 = SQL_ODBC_CURSORS
+Const SQL_ATTR_PACKET_SIZE		 = SQL_PACKET_SIZE
+Const SQL_ATTR_QUIET_MODE			 = SQL_QUIET_MODE
+Const SQL_ATTR_TRACE				 = SQL_OPT_TRACE
+Const SQL_ATTR_TRACEFILE			 = SQL_OPT_TRACEFILE
+Const SQL_ATTR_TRANSLATE_LIB		 = SQL_TRANSLATE_DLL
+Const SQL_ATTR_TRANSLATE_OPTION	 = SQL_TRANSLATE_OPTION
+Const SQL_ATTR_TXN_ISOLATION		 = SQL_TXN_ISOLATION
+
+
+Const SQL_ATTR_CONNECTION_DEAD	 = 1209	/* GetConnectAttr only */
+
+/*	ODBC Driver Manager sets this connection attribute to a unicode driver 
+	(which supports SQLConnectW) when the application is an ANSI application
+	(which calls SQLConnect, SQLDriverConnect, or SQLBrowseConnect). 
+	This is SetConnectAttr only and application does not set this attribute
+	This attribute was introduced because some unicode driver's some APIs may 
+	need to behave differently on ANSI or Unicode applications. A unicode 
+	driver, which  has same behavior for both ANSI or Unicode applications,
+	should return SQL_ERROR when the driver manager sets this connection 
+	attribute. When a unicode driver returns SQL_SUCCESS on this attribute,
+	the driver manager treates ANSI and Unicode connections differently in
+	connection pooling.
+*/
+Const SQL_ATTR_ANSI_APP			 = 115
+
+
+/* SQL_ACCESS_MODE options */
+Const SQL_MODE_READ_WRITE              = 0
+Const SQL_MODE_READ_ONLY               = 1
+Const SQL_MODE_DEFAULT                 = SQL_MODE_READ_WRITE
+
+/* SQL_AUTOCOMMIT options */
+Const SQL_AUTOCOMMIT_OFF               = 0
+Const SQL_AUTOCOMMIT_ON                = 1
+Const SQL_AUTOCOMMIT_DEFAULT           = SQL_AUTOCOMMIT_ON
+
+/* SQL_LOGIN_TIMEOUT options */
+Const SQL_LOGIN_TIMEOUT_DEFAULT        = 15
+
+/* SQL_OPT_TRACE options */
+Const SQL_OPT_TRACE_OFF                = 0
+Const SQL_OPT_TRACE_ON                 = 1
+Const SQL_OPT_TRACE_DEFAULT            = SQL_OPT_TRACE_OFF
+Const SQL_OPT_TRACE_FILE_DEFAULT       = "\SQL.LOG"
+
+/* SQL_ODBC_CURSORS options */
+Const SQL_CUR_USE_IF_NEEDED            = 0
+Const SQL_CUR_USE_ODBC                 = 1
+Const SQL_CUR_USE_DRIVER               = 2
+Const SQL_CUR_DEFAULT                  = SQL_CUR_USE_DRIVER
+
+/* values for SQL_ATTR_DISCONNECT_BEHAVIOR */
+Const SQL_DB_RETURN_TO_POOL			 = 0
+Const SQL_DB_DISCONNECT				 = 1
+Const SQL_DB_DEFAULT					 = SQL_DB_RETURN_TO_POOL
+
+/* values for SQL_ATTR_ENLIST_IN_DTC */
+Const SQL_DTC_DONE					 = 0
+
+
+/* values for SQL_ATTR_CONNECTION_DEAD */
+Const SQL_CD_TRUE					 = 1		/* Connection is closed/dead */
+Const SQL_CD_FALSE				 = 0		/* Connection is open/available */
+
+/* values for SQL_ATTR_ANSI_APP */
+Const SQL_AA_TRUE					 = 1	/* the application is an ANSI app */
+Const SQL_AA_FALSE					 = 0	/* the application is a Unicode app */
+
+/* statement attributes */
+Const SQL_QUERY_TIMEOUT		 = 0
+Const SQL_MAX_ROWS			 = 1
+Const SQL_NOSCAN				 = 2
+Const SQL_MAX_LENGTH			 = 3
+Const SQL_ASYNC_ENABLE		 = 4	/* same as SQL_ATTR_ASYNC_ENABLE */	
+Const SQL_BIND_TYPE			 = 5
+Const SQL_CURSOR_TYPE			 = 6
+Const SQL_CONCURRENCY			 = 7
+Const SQL_KEYSET_SIZE			 = 8
+Const SQL_ROWSET_SIZE			 = 9
+Const SQL_SIMULATE_CURSOR		 = 10
+Const SQL_RETRIEVE_DATA		 = 11
+Const SQL_USE_BOOKMARKS		 = 12
+Const SQL_GET_BOOKMARK		 = 13      /*      GetStmtOption Only */
+Const SQL_ROW_NUMBER			 = 14      /*      GetStmtOption Only */
+
+/* statement attributes for ODBC 3.0 */
+Const SQL_ATTR_ASYNC_ENABLE				 = 4
+Const SQL_ATTR_CONCURRENCY				 = SQL_CONCURRENCY
+Const SQL_ATTR_CURSOR_TYPE				 = SQL_CURSOR_TYPE
+Const SQL_ATTR_ENABLE_AUTO_IPD			 = 15
+Const SQL_ATTR_FETCH_BOOKMARK_PTR			 = 16
+Const SQL_ATTR_KEYSET_SIZE				 = SQL_KEYSET_SIZE
+Const SQL_ATTR_MAX_LENGTH					 = SQL_MAX_LENGTH
+Const SQL_ATTR_MAX_ROWS					 = SQL_MAX_ROWS
+Const SQL_ATTR_NOSCAN						 = SQL_NOSCAN
+Const SQL_ATTR_PARAM_BIND_OFFSET_PTR		 = 17
+Const SQL_ATTR_PARAM_BIND_TYPE			 = 18
+Const SQL_ATTR_PARAM_OPERATION_PTR		 = 19
+Const SQL_ATTR_PARAM_STATUS_PTR			 = 20
+Const SQL_ATTR_PARAMS_PROCESSED_PTR		 = 21
+Const SQL_ATTR_PARAMSET_SIZE				 = 22
+Const SQL_ATTR_QUERY_TIMEOUT				 = SQL_QUERY_TIMEOUT
+Const SQL_ATTR_RETRIEVE_DATA				 = SQL_RETRIEVE_DATA
+Const SQL_ATTR_ROW_BIND_OFFSET_PTR		 = 23
+Const SQL_ATTR_ROW_BIND_TYPE				 = SQL_BIND_TYPE
+Const SQL_ATTR_ROW_NUMBER					 = SQL_ROW_NUMBER	  	/*GetStmtAttr*/
+Const SQL_ATTR_ROW_OPERATION_PTR			 = 24
+Const SQL_ATTR_ROW_STATUS_PTR				 = 25
+Const SQL_ATTR_ROWS_FETCHED_PTR			 = 26
+Const SQL_ATTR_ROW_ARRAY_SIZE				 = 27	
+Const SQL_ATTR_SIMULATE_CURSOR			 = SQL_SIMULATE_CURSOR
+Const SQL_ATTR_USE_BOOKMARKS				 = SQL_USE_BOOKMARKS	
+
+
+
+
+/* whether an attribute is a pointer or not */
+Const SQL_IS_POINTER							 = (-4)
+Const SQL_IS_UINTEGER							 = (-5)
+Const SQL_IS_INTEGER							 = (-6)
+Const SQL_IS_USMALLINT						 = (-7)
+Const SQL_IS_SMALLINT							 = (-8)
+
+
+/* the value of SQL_ATTR_PARAM_BIND_TYPE */
+Const SQL_PARAM_BIND_BY_COLUMN			 = 0
+Const SQL_PARAM_BIND_TYPE_DEFAULT			 = SQL_PARAM_BIND_BY_COLUMN
+
+
+/* SQL_QUERY_TIMEOUT options */
+Const SQL_QUERY_TIMEOUT_DEFAULT        = 0
+
+/* SQL_MAX_ROWS options */
+Const SQL_MAX_ROWS_DEFAULT             = 0
+
+/* SQL_NOSCAN options */
+Const SQL_NOSCAN_OFF                   = 0     /*      1.0 FALSE */
+Const SQL_NOSCAN_ON                    = 1     /*      1.0 TRUE */
+Const SQL_NOSCAN_DEFAULT               = SQL_NOSCAN_OFF
+
+/* SQL_MAX_LENGTH options */
+Const SQL_MAX_LENGTH_DEFAULT           = 0
+
+/* values for SQL_ATTR_ASYNC_ENABLE */
+Const SQL_ASYNC_ENABLE_OFF			 = 0
+Const SQL_ASYNC_ENABLE_ON				 = 1
+Const SQL_ASYNC_ENABLE_DEFAULT         = SQL_ASYNC_ENABLE_OFF
+
+/* SQL_BIND_TYPE options */
+Const SQL_BIND_BY_COLUMN               = 0
+Const SQL_BIND_TYPE_DEFAULT            = SQL_BIND_BY_COLUMN  /* Default value */
+
+/* SQL_CONCURRENCY options */
+Const SQL_CONCUR_READ_ONLY             = 1
+Const SQL_CONCUR_LOCK                  = 2
+Const SQL_CONCUR_ROWVER                = 3
+Const SQL_CONCUR_VALUES                = 4
+Const SQL_CONCUR_DEFAULT               = SQL_CONCUR_READ_ONLY /* Default value */
+
+/* SQL_CURSOR_TYPE options */
+Const SQL_CURSOR_FORWARD_ONLY          = 0
+Const SQL_CURSOR_KEYSET_DRIVEN         = 1
+Const SQL_CURSOR_DYNAMIC               = 2
+Const SQL_CURSOR_STATIC                = 3
+Const SQL_CURSOR_TYPE_DEFAULT          = SQL_CURSOR_FORWARD_ONLY /* Default value */
+
+/* SQL_ROWSET_SIZE options */
+Const SQL_ROWSET_SIZE_DEFAULT          = 1
+
+/* SQL_KEYSET_SIZE options */
+Const SQL_KEYSET_SIZE_DEFAULT          = 0
+
+/* SQL_SIMULATE_CURSOR options */
+Const SQL_SC_NON_UNIQUE                = 0
+Const SQL_SC_TRY_UNIQUE                = 1
+Const SQL_SC_UNIQUE                    = 2
+
+/* SQL_RETRIEVE_DATA options */
+Const SQL_RD_OFF                       = 0
+Const SQL_RD_ON                        = 1
+Const SQL_RD_DEFAULT                   = SQL_RD_ON
+
+/* SQL_USE_BOOKMARKS options */
+Const SQL_UB_OFF                       = 0
+Const SQL_UB_ON						 = 01
+Const SQL_UB_DEFAULT                   = SQL_UB_OFF
+
+/* New values for SQL_USE_BOOKMARKS attribute */
+Const SQL_UB_FIXED					 = SQL_UB_ON
+Const SQL_UB_VARIABLE					 = 2
+
+
+/* SQLColAttributes defines */
+Const SQL_COLUMN_COUNT                 = 0
+Const SQL_COLUMN_NAME                  = 1
+Const SQL_COLUMN_TYPE                  = 2
+Const SQL_COLUMN_LENGTH                = 3
+Const SQL_COLUMN_PRECISION             = 4
+Const SQL_COLUMN_SCALE                 = 5
+Const SQL_COLUMN_DISPLAY_SIZE          = 6
+Const SQL_COLUMN_NULLABLE              = 7
+Const SQL_COLUMN_UNSIGNED              = 8
+Const SQL_COLUMN_MONEY                 = 9
+Const SQL_COLUMN_UPDATABLE             = 10
+Const SQL_COLUMN_AUTO_INCREMENT        = 11
+Const SQL_COLUMN_CASE_SENSITIVE        = 12
+Const SQL_COLUMN_SEARCHABLE            = 13
+Const SQL_COLUMN_TYPE_NAME             = 14
+Const SQL_COLUMN_TABLE_NAME            = 15
+Const SQL_COLUMN_OWNER_NAME            = 16
+Const SQL_COLUMN_QUALIFIER_NAME        = 17
+Const SQL_COLUMN_LABEL                 = 18
+Const SQL_COLATT_OPT_MAX               = SQL_COLUMN_LABEL
+
+
+/* extended descriptor field */
+Const SQL_DESC_ARRAY_SIZE						 = 20
+Const SQL_DESC_ARRAY_STATUS_PTR				 = 21
+Const SQL_DESC_AUTO_UNIQUE_VALUE				 = SQL_COLUMN_AUTO_INCREMENT
+Const SQL_DESC_BASE_COLUMN_NAME				 = 22
+Const SQL_DESC_BASE_TABLE_NAME				 = 23
+Const SQL_DESC_BIND_OFFSET_PTR				 = 24
+Const SQL_DESC_BIND_TYPE						 = 25
+Const SQL_DESC_CASE_SENSITIVE					 = SQL_COLUMN_CASE_SENSITIVE
+Const SQL_DESC_CATALOG_NAME					 = SQL_COLUMN_QUALIFIER_NAME
+Const SQL_DESC_CONCISE_TYPE					 = SQL_COLUMN_TYPE
+Const SQL_DESC_DATETIME_INTERVAL_PRECISION	 = 26
+Const SQL_DESC_DISPLAY_SIZE					 = SQL_COLUMN_DISPLAY_SIZE
+Const SQL_DESC_FIXED_PREC_SCALE				 = SQL_COLUMN_MONEY
+Const SQL_DESC_LABEL							 = SQL_COLUMN_LABEL
+Const SQL_DESC_LITERAL_PREFIX					 = 27
+Const SQL_DESC_LITERAL_SUFFIX					 = 28
+Const SQL_DESC_LOCAL_TYPE_NAME				 = 29
+Const SQL_DESC_MAXIMUM_SCALE					 = 30
+Const SQL_DESC_MINIMUM_SCALE					 = 31
+Const SQL_DESC_NUM_PREC_RADIX					 = 32
+Const SQL_DESC_PARAMETER_TYPE					 = 33
+Const SQL_DESC_ROWS_PROCESSED_PTR				 = 34
+Const SQL_DESC_ROWVER							 = 35
+Const SQL_DESC_SCHEMA_NAME					 = SQL_COLUMN_OWNER_NAME
+Const SQL_DESC_SEARCHABLE						 = SQL_COLUMN_SEARCHABLE
+Const SQL_DESC_TYPE_NAME						 = SQL_COLUMN_TYPE_NAME
+Const SQL_DESC_TABLE_NAME						 = SQL_COLUMN_TABLE_NAME
+Const SQL_DESC_UNSIGNED						 = SQL_COLUMN_UNSIGNED
+Const SQL_DESC_UPDATABLE						 = SQL_COLUMN_UPDATABLE
+
+
+/* defines for diagnostics fields */
+Const SQL_DIAG_CURSOR_ROW_COUNT			 = (-1249)
+Const SQL_DIAG_ROW_NUMBER					 = (-1248)
+Const SQL_DIAG_COLUMN_NUMBER				 = (-1247)	
+
+/* SQL extended datatypes */
+Const SQL_DATE                                 = 9
+Const SQL_INTERVAL							 = 10
+
+Const SQL_TIME                                 = 10
+Const SQL_TIMESTAMP                            = 11
+Const SQL_LONGVARCHAR                          = (-1)
+Const SQL_BINARY                               = (-2)
+Const SQL_VARBINARY                            = (-3)
+Const SQL_LONGVARBINARY                        = (-4)
+Const SQL_BIGINT                               = (-5)
+Const SQL_TINYINT                              = (-6)
+Const SQL_BIT                                  = (-7)
+Const SQL_GUID				 = (-11)
+
+/* interval code */
+Const SQL_CODE_YEAR				 = 1
+Const SQL_CODE_MONTH				 = 2
+Const SQL_CODE_DAY				 = 3
+Const SQL_CODE_HOUR				 = 4
+Const SQL_CODE_MINUTE				 = 5
+Const SQL_CODE_SECOND				 = 6
+Const SQL_CODE_YEAR_TO_MONTH			 = 7
+Const SQL_CODE_DAY_TO_HOUR			 = 8
+Const SQL_CODE_DAY_TO_MINUTE			 = 9
+Const SQL_CODE_DAY_TO_SECOND			 = 10
+Const SQL_CODE_HOUR_TO_MINUTE			 = 11
+Const SQL_CODE_HOUR_TO_SECOND			 = 12
+Const SQL_CODE_MINUTE_TO_SECOND		 = 13
+
+Const SQL_INTERVAL_YEAR					 = (100 + SQL_CODE_YEAR)
+Const SQL_INTERVAL_MONTH					 = (100 + SQL_CODE_MONTH)
+Const SQL_INTERVAL_DAY					 = (100 + SQL_CODE_DAY) 
+Const SQL_INTERVAL_HOUR					 = (100 + SQL_CODE_HOUR) 
+Const SQL_INTERVAL_MINUTE					 = (100 + SQL_CODE_MINUTE) 
+Const SQL_INTERVAL_SECOND                	 = (100 + SQL_CODE_SECOND) 
+Const SQL_INTERVAL_YEAR_TO_MONTH			 = (100 + SQL_CODE_YEAR_TO_MONTH)
+Const SQL_INTERVAL_DAY_TO_HOUR			 = (100 + SQL_CODE_DAY_TO_HOUR) 
+Const SQL_INTERVAL_DAY_TO_MINUTE			 = (100 + SQL_CODE_DAY_TO_MINUTE) 
+Const SQL_INTERVAL_DAY_TO_SECOND			 = (100 + SQL_CODE_DAY_TO_SECOND) 
+Const SQL_INTERVAL_HOUR_TO_MINUTE			 = (100 + SQL_CODE_HOUR_TO_MINUTE)
+Const SQL_INTERVAL_HOUR_TO_SECOND			 = (100 + SQL_CODE_HOUR_TO_SECOND) 
+Const SQL_INTERVAL_MINUTE_TO_SECOND		 = (100 + SQL_CODE_MINUTE_TO_SECOND)
+
+
+
+/* C datatype to SQL datatype mapping      SQL types
+                                           ------------------- */
+Const SQL_C_CHAR     = SQL_CHAR             /* CHAR, VARCHAR, DECIMAL, NUMERIC */
+Const SQL_C_LONG     = SQL_INTEGER          /* INTEGER                      */
+Const SQL_C_SHORT    = SQL_SMALLINT         /* SMALLINT                     */
+Const SQL_C_FLOAT    = SQL_REAL             /* REAL                         */
+Const SQL_C_DOUBLE   = SQL_DOUBLE           /* FLOAT, DOUBLE                */
+Const SQL_C_NUMERIC		 = SQL_NUMERIC
+
+Const SQL_C_DEFAULT  = 99
+
+Const SQL_SIGNED_OFFSET        = (-20)
+Const SQL_UNSIGNED_OFFSET      = (-22)
+
+/* C datatype to SQL datatype mapping */
+Const SQL_C_DATE        = SQL_DATE
+Const SQL_C_TIME        = SQL_TIME
+Const SQL_C_TIMESTAMP   = SQL_TIMESTAMP
+Const SQL_C_TYPE_DATE					 = SQL_TYPE_DATE
+Const SQL_C_TYPE_TIME					 = SQL_TYPE_TIME
+Const SQL_C_TYPE_TIMESTAMP			 = SQL_TYPE_TIMESTAMP
+Const SQL_C_INTERVAL_YEAR				 = SQL_INTERVAL_YEAR
+Const SQL_C_INTERVAL_MONTH			 = SQL_INTERVAL_MONTH
+Const SQL_C_INTERVAL_DAY				 = SQL_INTERVAL_DAY
+Const SQL_C_INTERVAL_HOUR				 = SQL_INTERVAL_HOUR
+Const SQL_C_INTERVAL_MINUTE			 = SQL_INTERVAL_MINUTE
+Const SQL_C_INTERVAL_SECOND			 = SQL_INTERVAL_SECOND
+Const SQL_C_INTERVAL_YEAR_TO_MONTH	 = SQL_INTERVAL_YEAR_TO_MONTH
+Const SQL_C_INTERVAL_DAY_TO_HOUR		 = SQL_INTERVAL_DAY_TO_HOUR
+Const SQL_C_INTERVAL_DAY_TO_MINUTE	 = SQL_INTERVAL_DAY_TO_MINUTE
+Const SQL_C_INTERVAL_DAY_TO_SECOND	 = SQL_INTERVAL_DAY_TO_SECOND
+Const SQL_C_INTERVAL_HOUR_TO_MINUTE	 = SQL_INTERVAL_HOUR_TO_MINUTE
+Const SQL_C_INTERVAL_HOUR_TO_SECOND	 = SQL_INTERVAL_HOUR_TO_SECOND
+Const SQL_C_INTERVAL_MINUTE_TO_SECOND	 = SQL_INTERVAL_MINUTE_TO_SECOND
+
+Const SQL_C_BINARY      = SQL_BINARY
+Const SQL_C_BIT         = SQL_BIT
+Const SQL_C_SBIGINT	 = (SQL_BIGINT+SQL_SIGNED_OFFSET)	   /* SIGNED BIGINT */
+Const SQL_C_UBIGINT	 = (SQL_BIGINT+SQL_UNSIGNED_OFFSET)   /* UNSIGNED BIGINT */
+
+Const SQL_C_TINYINT     = SQL_TINYINT
+Const SQL_C_SLONG       = (SQL_C_LONG+SQL_SIGNED_OFFSET)    /* SIGNED INTEGER  */
+Const SQL_C_SSHORT      = (SQL_C_SHORT+SQL_SIGNED_OFFSET)   /* SIGNED SMALLINT */
+Const SQL_C_STINYINT    = (SQL_TINYINT+SQL_SIGNED_OFFSET)   /* SIGNED TINYINT  */
+Const SQL_C_ULONG       = (SQL_C_LONG+SQL_UNSIGNED_OFFSET)  /* UNSIGNED INTEGER*/
+Const SQL_C_USHORT      = (SQL_C_SHORT+SQL_UNSIGNED_OFFSET) /* UNSIGNED SMALLINT*/
+Const SQL_C_UTINYINT    = (SQL_TINYINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED TINYINT*/
+
+#ifdef _WIN64
+Const SQL_C_BOOKMARK    = SQL_C_UBIGINT                     /* BOOKMARK        */
+#else
+Const SQL_C_BOOKMARK    = SQL_C_ULONG                       /* BOOKMARK        */
+#endif
+
+
+Const SQL_TYPE_NULL                    = 0
+
+Const SQL_C_VARBOOKMARK		 = SQL_C_BINARY
+
+
+/* define for SQL_DIAG_ROW_NUMBER and SQL_DIAG_COLUMN_NUMBER */
+Const SQL_NO_ROW_NUMBER						 = (-1)
+Const SQL_NO_COLUMN_NUMBER					 = (-1)
+Const SQL_ROW_NUMBER_UNKNOWN					 = (-2)
+Const SQL_COLUMN_NUMBER_UNKNOWN				 = (-2)
+
+/* SQLBindParameter extensions */
+Const SQL_DEFAULT_PARAM             = (-5)
+Const SQL_IGNORE                    = (-6)
+Const SQL_COLUMN_IGNORE			 = SQL_IGNORE
+
+Const SQL_LEN_DATA_AT_EXEC_OFFSET   = (-100)
+#define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET)
+
+/* binary length for driver specific attributes */
+Const SQL_LEN_BINARY_ATTR_OFFSET	  = (-100)
+#define SQL_LEN_BINARY_ATTR(length)	 (-(length)+SQL_LEN_BINARY_ATTR_OFFSET)
+
+/* Defines for SQLBindParameter and
+                           SQLProcedureColumns (returned in the result set) */
+Const SQL_PARAM_TYPE_UNKNOWN            = 0
+Const SQL_PARAM_INPUT                   = 1
+Const SQL_PARAM_INPUT_OUTPUT            = 2
+Const SQL_RESULT_COL                    = 3
+Const SQL_PARAM_OUTPUT                  = 4
+Const SQL_RETURN_VALUE                  = 5
+
+/* Defines used by Driver Manager when mapping SQLSetParam to SQLBindParameter
+*/
+Const SQL_PARAM_TYPE_DEFAULT            = SQL_PARAM_INPUT_OUTPUT
+Const SQL_SETPARAM_VALUE_MAX            = (-1)
+
+
+Const SQL_COLATT_OPT_MIN               = SQL_COLUMN_COUNT
+
+/* SQLColAttributes subdefines for SQL_COLUMN_UPDATABLE */
+Const SQL_ATTR_READONLY                = 0
+Const SQL_ATTR_WRITE                   = 1
+Const SQL_ATTR_READWRITE_UNKNOWN       = 2
+
+/* SQLColAttributes subdefines for SQL_COLUMN_SEARCHABLE */
+/* These are also used by SQLGetInfo                     */
+Const SQL_UNSEARCHABLE                 = 0
+Const SQL_LIKE_ONLY                    = 1
+Const SQL_ALL_EXCEPT_LIKE              = 2
+Const SQL_SEARCHABLE                   = 3
+Const SQL_PRED_SEARCHABLE				 = SQL_SEARCHABLE
+
+
+/* Special return values for SQLGetData */
+Const SQL_NO_TOTAL                     = (-4)
+
+/********************************************/
+/* SQLGetFunctions: additional values for   */
+/* fFunction to represent functions that    */
+/* are not in the X/Open spec.				*/
+/********************************************/
+
+Const SQL_API_SQLALLOCHANDLESTD	 = 73
+Const SQL_API_SQLBULKOPERATIONS	 = 24
+Const SQL_API_SQLBINDPARAMETER     = 72
+Const SQL_API_SQLBROWSECONNECT     = 55    
+Const SQL_API_SQLCOLATTRIBUTES     = 6 
+Const SQL_API_SQLCOLUMNPRIVILEGES  = 56
+Const SQL_API_SQLDESCRIBEPARAM     = 58
+Const SQL_API_SQLDRIVERCONNECT	 = 41 
+Const SQL_API_SQLDRIVERS           = 71
+Const SQL_API_SQLEXTENDEDFETCH     = 59
+Const SQL_API_SQLFOREIGNKEYS       = 60
+Const SQL_API_SQLMORERESULTS       = 61
+Const SQL_API_SQLNATIVESQL         = 62
+Const SQL_API_SQLNUMPARAMS         = 63
+Const SQL_API_SQLPARAMOPTIONS      = 64
+Const SQL_API_SQLPRIMARYKEYS       = 65
+Const SQL_API_SQLPROCEDURECOLUMNS  = 66
+Const SQL_API_SQLPROCEDURES        = 67
+Const SQL_API_SQLSETPOS            = 68
+Const SQL_API_SQLSETSCROLLOPTIONS  = 69
+Const SQL_API_SQLTABLEPRIVILEGES   = 70
+
+
+/*--------------------------------------------*/
+/* SQL_API_ALL_FUNCTIONS returns an array     */
+/* of 'booleans' representing whether a       */
+/* function is implemented by the driver.     */
+/*                                            */
+/* CAUTION: Only functions defined in ODBC    */
+/* version 2.0 and earlier are returned, the  */
+/* new high-range function numbers defined by */
+/* X/Open break this scheme.   See the new    */
+/* method -- SQL_API_ODBC3_ALL_FUNCTIONS      */
+/*--------------------------------------------*/
+
+Const SQL_API_ALL_FUNCTIONS        = 0		/* See CAUTION above */
+
+/*----------------------------------------------*/
+/* 2.X drivers export a dummy function with  	*/
+/* ordinal number SQL_API_LOADBYORDINAL to speed*/
+/* loading under the windows operating system.  */
+/* 						*/
+/* CAUTION: Loading by ordinal is not supported */
+/* for 3.0 and above drivers.			*/
+/*----------------------------------------------*/
+
+Const SQL_API_LOADBYORDINAL        = 199		/* See CAUTION above */	
+
+/*----------------------------------------------*/
+/* SQL_API_ODBC3_ALL_FUNCTIONS                  */
+/* This returns a bitmap, which allows us to    */
+/* handle the higher-valued function numbers.   */
+/* Use  SQL_FUNC_EXISTS(bitmap,function_number) */
+/* to determine if the function exists.         */
+/*----------------------------------------------*/
+
+
+Const SQL_API_ODBC3_ALL_FUNCTIONS	 = 999
+Const SQL_API_ODBC3_ALL_FUNCTIONS_SIZE	 = 250		/* array of 250 words */
+
+
+
+/************************************************/
+/* Extended definitions for SQLGetInfo			*/
+/************************************************/
+
+/*---------------------------------*/
+/* Values in ODBC 2.0 that are not */
+/* in the X/Open spec              */
+/*---------------------------------*/
+
+Const SQL_INFO_FIRST                        = 0		
+Const SQL_ACTIVE_CONNECTIONS                = 0	/* MAX_DRIVER_CONNECTIONS */
+Const SQL_ACTIVE_STATEMENTS                 = 1	/* MAX_CONCURRENT_ACTIVITIES */
+Const SQL_DRIVER_HDBC                       = 3
+Const SQL_DRIVER_HENV                       = 4
+Const SQL_DRIVER_HSTMT                      = 5
+Const SQL_DRIVER_NAME                       = 6
+Const SQL_DRIVER_VER                        = 7
+Const SQL_ODBC_API_CONFORMANCE              = 9
+Const SQL_ODBC_VER                         = 10
+Const SQL_ROW_UPDATES                      = 11
+Const SQL_ODBC_SAG_CLI_CONFORMANCE         = 12
+Const SQL_ODBC_SQL_CONFORMANCE             = 15
+Const SQL_PROCEDURES                       = 21
+Const SQL_CONCAT_NULL_BEHAVIOR             = 22
+Const SQL_CURSOR_ROLLBACK_BEHAVIOR         = 24
+Const SQL_EXPRESSIONS_IN_ORDERBY           = 27
+Const SQL_MAX_OWNER_NAME_LEN               = 32	/* MAX_SCHEMA_NAME_LEN */
+Const SQL_MAX_PROCEDURE_NAME_LEN           = 33
+Const SQL_MAX_QUALIFIER_NAME_LEN           = 34	/* MAX_CATALOG_NAME_LEN */
+Const SQL_MULT_RESULT_SETS                 = 36
+Const SQL_MULTIPLE_ACTIVE_TXN              = 37
+Const SQL_OUTER_JOINS                      = 38
+Const SQL_OWNER_TERM                       = 39
+Const SQL_PROCEDURE_TERM                   = 40
+Const SQL_QUALIFIER_NAME_SEPARATOR         = 41
+Const SQL_QUALIFIER_TERM                   = 42
+Const SQL_SCROLL_OPTIONS                   = 44
+Const SQL_TABLE_TERM                       = 45
+Const SQL_CONVERT_FUNCTIONS                = 48
+Const SQL_NUMERIC_FUNCTIONS                = 49
+Const SQL_STRING_FUNCTIONS                 = 50
+Const SQL_SYSTEM_FUNCTIONS                 = 51
+Const SQL_TIMEDATE_FUNCTIONS               = 52
+Const SQL_CONVERT_BIGINT                   = 53
+Const SQL_CONVERT_BINARY                   = 54
+Const SQL_CONVERT_BIT                      = 55
+Const SQL_CONVERT_CHAR                     = 56
+Const SQL_CONVERT_DATE                     = 57
+Const SQL_CONVERT_DECIMAL                  = 58
+Const SQL_CONVERT_DOUBLE                   = 59
+Const SQL_CONVERT_FLOAT                    = 60
+Const SQL_CONVERT_INTEGER                  = 61
+Const SQL_CONVERT_LONGVARCHAR              = 62
+Const SQL_CONVERT_NUMERIC                  = 63
+Const SQL_CONVERT_REAL                     = 64
+Const SQL_CONVERT_SMALLINT                 = 65
+Const SQL_CONVERT_TIME                     = 66
+Const SQL_CONVERT_TIMESTAMP                = 67
+Const SQL_CONVERT_TINYINT                  = 68
+Const SQL_CONVERT_VARBINARY                = 69
+Const SQL_CONVERT_VARCHAR                  = 70
+Const SQL_CONVERT_LONGVARBINARY            = 71
+Const SQL_ODBC_SQL_OPT_IEF                 = 73		/* SQL_INTEGRITY */
+Const SQL_CORRELATION_NAME                 = 74
+Const SQL_NON_NULLABLE_COLUMNS             = 75
+Const SQL_DRIVER_HLIB                      = 76
+Const SQL_DRIVER_ODBC_VER                  = 77
+Const SQL_LOCK_TYPES                       = 78
+Const SQL_POS_OPERATIONS                   = 79
+Const SQL_POSITIONED_STATEMENTS            = 80
+Const SQL_BOOKMARK_PERSISTENCE             = 82
+Const SQL_STATIC_SENSITIVITY               = 83
+Const SQL_FILE_USAGE                       = 84
+Const SQL_COLUMN_ALIAS                     = 87
+Const SQL_GROUP_BY                         = 88
+Const SQL_KEYWORDS                         = 89
+Const SQL_OWNER_USAGE                      = 91
+Const SQL_QUALIFIER_USAGE                  = 92
+Const SQL_QUOTED_IDENTIFIER_CASE           = 93
+Const SQL_SUBQUERIES                       = 95
+Const SQL_UNION                            = 96
+Const SQL_MAX_ROW_SIZE_INCLUDES_LONG       = 103
+Const SQL_MAX_CHAR_LITERAL_LEN             = 108
+Const SQL_TIMEDATE_ADD_INTERVALS           = 109
+Const SQL_TIMEDATE_DIFF_INTERVALS          = 110
+Const SQL_NEED_LONG_DATA_LEN               = 111
+Const SQL_MAX_BINARY_LITERAL_LEN           = 112
+Const SQL_LIKE_ESCAPE_CLAUSE               = 113
+Const SQL_QUALIFIER_LOCATION               = 114
+
+
+
+/*-----------------------------------------------*/
+/* ODBC 3.0 SQLGetInfo values that are not part  */
+/* of the X/Open standard at this time.   X/Open */
+/* standard values are in sql.h.				 */
+/*-----------------------------------------------*/
+
+Const SQL_ACTIVE_ENVIRONMENTS					 = 116
+Const SQL_ALTER_DOMAIN						 = 117
+
+Const SQL_SQL_CONFORMANCE						 = 118
+Const SQL_DATETIME_LITERALS					 = 119
+
+Const SQL_ASYNC_MODE							 = 10021	/* new X/Open spec */
+Const SQL_BATCH_ROW_COUNT						 = 120
+Const SQL_BATCH_SUPPORT						 = 121
+Const SQL_CATALOG_LOCATION					 = SQL_QUALIFIER_LOCATION
+Const SQL_CATALOG_NAME_SEPARATOR				 = SQL_QUALIFIER_NAME_SEPARATOR
+Const SQL_CATALOG_TERM						 = SQL_QUALIFIER_TERM
+Const SQL_CATALOG_USAGE						 = SQL_QUALIFIER_USAGE
+Const SQL_CONVERT_WCHAR						 = 122
+Const SQL_CONVERT_INTERVAL_DAY_TIME			 = 123
+Const SQL_CONVERT_INTERVAL_YEAR_MONTH			 = 124
+Const SQL_CONVERT_WLONGVARCHAR				 = 125
+Const SQL_CONVERT_WVARCHAR					 = 126
+Const SQL_CREATE_ASSERTION					 = 127
+Const SQL_CREATE_CHARACTER_SET				 = 128
+Const SQL_CREATE_COLLATION					 = 129
+Const SQL_CREATE_DOMAIN						 = 130
+Const SQL_CREATE_SCHEMA						 = 131
+Const SQL_CREATE_TABLE						 = 132
+Const SQL_CREATE_TRANSLATION					 = 133
+Const SQL_CREATE_VIEW							 = 134
+Const SQL_DRIVER_HDESC						 = 135
+Const SQL_DROP_ASSERTION						 = 136
+Const SQL_DROP_CHARACTER_SET					 = 137
+Const SQL_DROP_COLLATION						 = 138
+Const SQL_DROP_DOMAIN							 = 139
+Const SQL_DROP_SCHEMA							 = 140
+Const SQL_DROP_TABLE							 = 141
+Const SQL_DROP_TRANSLATION					 = 142
+Const SQL_DROP_VIEW							 = 143
+Const SQL_DYNAMIC_CURSOR_ATTRIBUTES1			 = 144
+Const SQL_DYNAMIC_CURSOR_ATTRIBUTES2			 = 145
+Const SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1		 = 146		
+Const SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2		 = 147
+Const SQL_INDEX_KEYWORDS						 = 148
+Const SQL_INFO_SCHEMA_VIEWS					 = 149
+Const SQL_KEYSET_CURSOR_ATTRIBUTES1			 = 150
+Const SQL_KEYSET_CURSOR_ATTRIBUTES2			 = 151
+Const SQL_MAX_ASYNC_CONCURRENT_STATEMENTS		 = 10022	/* new X/Open spec */
+Const SQL_ODBC_INTERFACE_CONFORMANCE			 = 152
+Const SQL_PARAM_ARRAY_ROW_COUNTS     			 = 153
+Const SQL_PARAM_ARRAY_SELECTS     			 = 154
+Const SQL_SCHEMA_TERM							 = SQL_OWNER_TERM
+Const SQL_SCHEMA_USAGE						 = SQL_OWNER_USAGE
+Const SQL_SQL92_DATETIME_FUNCTIONS			 = 155
+Const SQL_SQL92_FOREIGN_KEY_DELETE_RULE		 = 156		
+Const SQL_SQL92_FOREIGN_KEY_UPDATE_RULE		 = 157		
+Const SQL_SQL92_GRANT							 = 158
+Const SQL_SQL92_NUMERIC_VALUE_FUNCTIONS		 = 159
+Const SQL_SQL92_PREDICATES					 = 160
+Const SQL_SQL92_RELATIONAL_JOIN_OPERATORS		 = 161
+Const SQL_SQL92_REVOKE						 = 162
+Const SQL_SQL92_ROW_VALUE_CONSTRUCTOR			 = 163
+Const SQL_SQL92_STRING_FUNCTIONS				 = 164
+Const SQL_SQL92_VALUE_EXPRESSIONS				 = 165
+Const SQL_STANDARD_CLI_CONFORMANCE			 = 166
+Const SQL_STATIC_CURSOR_ATTRIBUTES1			 = 167	
+Const SQL_STATIC_CURSOR_ATTRIBUTES2			 = 168
+
+Const SQL_AGGREGATE_FUNCTIONS					 = 169
+Const SQL_DDL_INDEX							 = 170
+Const SQL_DM_VER								 = 171
+Const SQL_INSERT_STATEMENT					 = 172
+Const SQL_CONVERT_GUID						 = 173		
+Const SQL_UNION_STATEMENT						 = SQL_UNION
+
+
+Const SQL_DTC_TRANSITION_COST					 = 1750
+
+/* SQL_ALTER_TABLE bitmasks */
+/* the following 5 bitmasks are defined in sql.h
+*Const SQL_AT_ADD_COLUMN                   	 = &H00000001
+*Const SQL_AT_DROP_COLUMN                  	 = &H00000002
+*Const SQL_AT_ADD_CONSTRAINT               	 = &H00000008
+*/
+Const SQL_AT_ADD_COLUMN_SINGLE				 = &H00000020	
+Const SQL_AT_ADD_COLUMN_DEFAULT				 = &H00000040
+Const SQL_AT_ADD_COLUMN_COLLATION				 = &H00000080
+Const SQL_AT_SET_COLUMN_DEFAULT				 = &H00000100
+Const SQL_AT_DROP_COLUMN_DEFAULT				 = &H00000200
+Const SQL_AT_DROP_COLUMN_CASCADE				 = &H00000400
+Const SQL_AT_DROP_COLUMN_RESTRICT				 = &H00000800
+Const SQL_AT_ADD_TABLE_CONSTRAINT				 = &H00001000		
+Const SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE	 = &H00002000		
+Const SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT	 = &H00004000		
+Const SQL_AT_CONSTRAINT_NAME_DEFINITION		 = &H00008000
+Const SQL_AT_CONSTRAINT_INITIALLY_DEFERRED	 = &H00010000
+Const SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE	 = &H00020000
+Const SQL_AT_CONSTRAINT_DEFERRABLE			 = &H00040000
+Const SQL_AT_CONSTRAINT_NON_DEFERRABLE		 = &H00080000
+
+/* SQL_CONVERT_*  return value bitmasks */
+
+Const SQL_CVT_CHAR                         = &H00000001
+Const SQL_CVT_NUMERIC                      = &H00000002
+Const SQL_CVT_DECIMAL                      = &H00000004
+Const SQL_CVT_INTEGER                      = &H00000008
+Const SQL_CVT_SMALLINT                     = &H00000010
+Const SQL_CVT_FLOAT                        = &H00000020
+Const SQL_CVT_REAL                         = &H00000040
+Const SQL_CVT_DOUBLE                       = &H00000080
+Const SQL_CVT_VARCHAR                      = &H00000100
+Const SQL_CVT_LONGVARCHAR                  = &H00000200
+Const SQL_CVT_BINARY                       = &H00000400
+Const SQL_CVT_VARBINARY                    = &H00000800
+Const SQL_CVT_BIT                          = &H00001000
+Const SQL_CVT_TINYINT                      = &H00002000
+Const SQL_CVT_BIGINT                       = &H00004000
+Const SQL_CVT_DATE                         = &H00008000
+Const SQL_CVT_TIME                         = &H00010000
+Const SQL_CVT_TIMESTAMP                    = &H00020000
+Const SQL_CVT_LONGVARBINARY                = &H00040000
+Const SQL_CVT_INTERVAL_YEAR_MONTH	    	 = &H00080000
+Const SQL_CVT_INTERVAL_DAY_TIME	    	 = &H00100000
+Const SQL_CVT_WCHAR						 = &H00200000
+Const SQL_CVT_WLONGVARCHAR				 = &H00400000
+Const SQL_CVT_WVARCHAR					 = &H00800000
+Const SQL_CVT_GUID						 = &H01000000
+
+
+
+
+/* SQL_CONVERT_FUNCTIONS functions */
+Const SQL_FN_CVT_CONVERT                   = &H00000001
+Const SQL_FN_CVT_CAST						 = &H00000002
+
+
+
+/* SQL_STRING_FUNCTIONS functions */
+
+Const SQL_FN_STR_CONCAT                    = &H00000001
+Const SQL_FN_STR_INSERT                    = &H00000002
+Const SQL_FN_STR_LEFT                      = &H00000004
+Const SQL_FN_STR_LTRIM                     = &H00000008
+Const SQL_FN_STR_LENGTH                    = &H00000010
+Const SQL_FN_STR_LOCATE                    = &H00000020
+Const SQL_FN_STR_LCASE                     = &H00000040
+Const SQL_FN_STR_REPEAT                    = &H00000080
+Const SQL_FN_STR_REPLACE                   = &H00000100
+Const SQL_FN_STR_RIGHT                     = &H00000200
+Const SQL_FN_STR_RTRIM                     = &H00000400
+Const SQL_FN_STR_SUBSTRING                 = &H00000800
+Const SQL_FN_STR_UCASE                     = &H00001000
+Const SQL_FN_STR_ASCII                     = &H00002000
+Const SQL_FN_STR_CHAR                      = &H00004000
+Const SQL_FN_STR_DIFFERENCE                = &H00008000
+Const SQL_FN_STR_LOCATE_2                  = &H00010000
+Const SQL_FN_STR_SOUNDEX                   = &H00020000
+Const SQL_FN_STR_SPACE                     = &H00040000
+Const SQL_FN_STR_BIT_LENGTH				 = &H00080000
+Const SQL_FN_STR_CHAR_LENGTH				 = &H00100000
+Const SQL_FN_STR_CHARACTER_LENGTH			 = &H00200000
+Const SQL_FN_STR_OCTET_LENGTH				 = &H00400000
+Const SQL_FN_STR_POSITION					 = &H00800000
+
+
+/* SQL_SQL92_STRING_FUNCTIONS */
+Const SQL_SSF_CONVERT						 = &H00000001	
+Const SQL_SSF_LOWER						 = &H00000002
+Const SQL_SSF_UPPER						 = &H00000004
+Const SQL_SSF_SUBSTRING					 = &H00000008
+Const SQL_SSF_TRANSLATE					 = &H00000010
+Const SQL_SSF_TRIM_BOTH					 = &H00000020
+Const SQL_SSF_TRIM_LEADING				 = &H00000040
+Const SQL_SSF_TRIM_TRAILING				 = &H00000080
+
+/* SQL_NUMERIC_FUNCTIONS functions */
+
+Const SQL_FN_NUM_ABS                       = &H00000001
+Const SQL_FN_NUM_ACOS                      = &H00000002
+Const SQL_FN_NUM_ASIN                      = &H00000004
+Const SQL_FN_NUM_ATAN                      = &H00000008
+Const SQL_FN_NUM_ATAN2                     = &H00000010
+Const SQL_FN_NUM_CEILING                   = &H00000020
+Const SQL_FN_NUM_COS                       = &H00000040
+Const SQL_FN_NUM_COT                       = &H00000080
+Const SQL_FN_NUM_EXP                       = &H00000100
+Const SQL_FN_NUM_FLOOR                     = &H00000200
+Const SQL_FN_NUM_LOG                       = &H00000400
+Const SQL_FN_NUM_MOD                       = &H00000800
+Const SQL_FN_NUM_SIGN                      = &H00001000
+Const SQL_FN_NUM_SIN                       = &H00002000
+Const SQL_FN_NUM_SQRT                      = &H00004000
+Const SQL_FN_NUM_TAN                       = &H00008000
+Const SQL_FN_NUM_PI                        = &H00010000
+Const SQL_FN_NUM_RAND                      = &H00020000
+Const SQL_FN_NUM_DEGREES                   = &H00040000
+Const SQL_FN_NUM_LOG10                     = &H00080000
+Const SQL_FN_NUM_POWER                     = &H00100000
+Const SQL_FN_NUM_RADIANS                   = &H00200000
+Const SQL_FN_NUM_ROUND                     = &H00400000
+Const SQL_FN_NUM_TRUNCATE                  = &H00800000
+
+/* SQL_SQL92_NUMERIC_VALUE_FUNCTIONS */
+Const SQL_SNVF_BIT_LENGTH					 = &H00000001
+Const SQL_SNVF_CHAR_LENGTH				 = &H00000002
+Const SQL_SNVF_CHARACTER_LENGTH			 = &H00000004
+Const SQL_SNVF_EXTRACT					 = &H00000008
+Const SQL_SNVF_OCTET_LENGTH				 = &H00000010
+Const SQL_SNVF_POSITION					 = &H00000020
+
+
+/* SQL_TIMEDATE_FUNCTIONS functions */
+
+Const SQL_FN_TD_NOW                        = &H00000001
+Const SQL_FN_TD_CURDATE                    = &H00000002
+Const SQL_FN_TD_DAYOFMONTH                 = &H00000004
+Const SQL_FN_TD_DAYOFWEEK                  = &H00000008
+Const SQL_FN_TD_DAYOFYEAR                  = &H00000010
+Const SQL_FN_TD_MONTH                      = &H00000020
+Const SQL_FN_TD_QUARTER                    = &H00000040
+Const SQL_FN_TD_WEEK                       = &H00000080
+Const SQL_FN_TD_YEAR                       = &H00000100
+Const SQL_FN_TD_CURTIME                    = &H00000200
+Const SQL_FN_TD_HOUR                       = &H00000400
+Const SQL_FN_TD_MINUTE                     = &H00000800
+Const SQL_FN_TD_SECOND                     = &H00001000
+Const SQL_FN_TD_TIMESTAMPADD               = &H00002000
+Const SQL_FN_TD_TIMESTAMPDIFF              = &H00004000
+Const SQL_FN_TD_DAYNAME                    = &H00008000
+Const SQL_FN_TD_MONTHNAME                  = &H00010000
+Const SQL_FN_TD_CURRENT_DATE				 = &H00020000
+Const SQL_FN_TD_CURRENT_TIME				 = &H00040000
+Const SQL_FN_TD_CURRENT_TIMESTAMP			 = &H00080000
+Const SQL_FN_TD_EXTRACT					 = &H00100000
+
+
+/* SQL_SQL92_DATETIME_FUNCTIONS */
+Const SQL_SDF_CURRENT_DATE				 = &H00000001
+Const SQL_SDF_CURRENT_TIME				 = &H00000002
+Const SQL_SDF_CURRENT_TIMESTAMP			 = &H00000004
+
+/* SQL_SYSTEM_FUNCTIONS functions */
+
+Const SQL_FN_SYS_USERNAME                  = &H00000001
+Const SQL_FN_SYS_DBNAME                    = &H00000002
+Const SQL_FN_SYS_IFNULL                    = &H00000004
+
+/* SQL_TIMEDATE_ADD_INTERVALS and SQL_TIMEDATE_DIFF_INTERVALS functions */
+
+Const SQL_FN_TSI_FRAC_SECOND               = &H00000001
+Const SQL_FN_TSI_SECOND                    = &H00000002
+Const SQL_FN_TSI_MINUTE                    = &H00000004
+Const SQL_FN_TSI_HOUR                      = &H00000008
+Const SQL_FN_TSI_DAY                       = &H00000010
+Const SQL_FN_TSI_WEEK                      = &H00000020
+Const SQL_FN_TSI_MONTH                     = &H00000040
+Const SQL_FN_TSI_QUARTER                   = &H00000080
+Const SQL_FN_TSI_YEAR                      = &H00000100
+
+/* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES1,
+ * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1, 
+ * SQL_KEYSET_CURSOR_ATTRIBUTES1, and SQL_STATIC_CURSOR_ATTRIBUTES1 
+ */
+/* supported SQLFetchScroll FetchOrientation's */
+Const SQL_CA1_NEXT						 = &H00000001
+Const SQL_CA1_ABSOLUTE					 = &H00000002
+Const SQL_CA1_RELATIVE					 = &H00000004
+Const SQL_CA1_BOOKMARK					 = &H00000008
+
+/* supported SQLSetPos LockType's */
+Const SQL_CA1_LOCK_NO_CHANGE				 = &H00000040
+Const SQL_CA1_LOCK_EXCLUSIVE				 = &H00000080
+Const SQL_CA1_LOCK_UNLOCK					 = &H00000100
+
+/* supported SQLSetPos Operations */
+Const SQL_CA1_POS_POSITION				 = &H00000200
+Const SQL_CA1_POS_UPDATE					 = &H00000400
+Const SQL_CA1_POS_DELETE					 = &H00000800
+Const SQL_CA1_POS_REFRESH					 = &H00001000
+
+/* positioned updates and deletes */
+Const SQL_CA1_POSITIONED_UPDATE			 = &H00002000
+Const SQL_CA1_POSITIONED_DELETE			 = &H00004000
+Const SQL_CA1_SELECT_FOR_UPDATE			 = &H00008000
+
+/* supported SQLBulkOperations operations */
+Const SQL_CA1_BULK_ADD					 = &H00010000
+Const SQL_CA1_BULK_UPDATE_BY_BOOKMARK		 = &H00020000
+Const SQL_CA1_BULK_DELETE_BY_BOOKMARK		 = &H00040000
+Const SQL_CA1_BULK_FETCH_BY_BOOKMARK		 = &H00080000
+
+
+/* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES2,
+ * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2, 
+ * SQL_KEYSET_CURSOR_ATTRIBUTES2, and SQL_STATIC_CURSOR_ATTRIBUTES2 
+ */
+/* supported values for SQL_ATTR_SCROLL_CONCURRENCY */
+Const SQL_CA2_READ_ONLY_CONCURRENCY		 = &H00000001
+Const SQL_CA2_LOCK_CONCURRENCY			 = &H00000002
+Const SQL_CA2_OPT_ROWVER_CONCURRENCY		 = &H00000004
+Const SQL_CA2_OPT_VALUES_CONCURRENCY		 = &H00000008
+
+/* sensitivity of the cursor to its own inserts, deletes, and updates */
+Const SQL_CA2_SENSITIVITY_ADDITIONS		 = &H00000010
+Const SQL_CA2_SENSITIVITY_DELETIONS		 = &H00000020
+Const SQL_CA2_SENSITIVITY_UPDATES			 = &H00000040
+
+/* semantics of SQL_ATTR_MAX_ROWS */
+Const SQL_CA2_MAX_ROWS_SELECT				 = &H00000080
+Const SQL_CA2_MAX_ROWS_INSERT				 = &H00000100
+Const SQL_CA2_MAX_ROWS_DELETE				 = &H00000200
+Const SQL_CA2_MAX_ROWS_UPDATE				 = &H00000400
+Const SQL_CA2_MAX_ROWS_CATALOG			 = &H00000800
+Const SQL_CA2_MAX_ROWS_AFFECTS_ALL		 = (SQL_CA2_MAX_ROWS_SELECT or _
+					SQL_CA2_MAX_ROWS_INSERT or SQL_CA2_MAX_ROWS_DELETE or _
+					SQL_CA2_MAX_ROWS_UPDATE or SQL_CA2_MAX_ROWS_CATALOG)
+
+/* semantics of SQL_DIAG_CURSOR_ROW_COUNT */
+Const SQL_CA2_CRC_EXACT					 = &H00001000
+Const SQL_CA2_CRC_APPROXIMATE				 = &H00002000
+
+/* the kinds of positioned statements that can be simulated */
+Const SQL_CA2_SIMULATE_NON_UNIQUE			 = &H00004000
+Const SQL_CA2_SIMULATE_TRY_UNIQUE			 = &H00008000
+Const SQL_CA2_SIMULATE_UNIQUE				 = &H00010000
+
+
+/* SQL_ODBC_API_CONFORMANCE values */
+
+Const SQL_OAC_NONE                         = &H0000
+Const SQL_OAC_LEVEL1                       = &H0001
+Const SQL_OAC_LEVEL2                       = &H0002
+
+/* SQL_ODBC_SAG_CLI_CONFORMANCE values */
+
+Const SQL_OSCC_NOT_COMPLIANT               = &H0000
+Const SQL_OSCC_COMPLIANT                   = &H0001
+
+/* SQL_ODBC_SQL_CONFORMANCE values */
+
+Const SQL_OSC_MINIMUM                      = &H0000
+Const SQL_OSC_CORE                         = &H0001
+Const SQL_OSC_EXTENDED                     = &H0002
+
+
+/* SQL_CONCAT_NULL_BEHAVIOR values */
+
+Const SQL_CB_NULL                          = &H0000
+Const SQL_CB_NON_NULL                      = &H0001
+
+/* SQL_SCROLL_OPTIONS masks */
+
+Const SQL_SO_FORWARD_ONLY                  = &H00000001
+Const SQL_SO_KEYSET_DRIVEN                 = &H00000002
+Const SQL_SO_DYNAMIC                       = &H00000004
+Const SQL_SO_MIXED                         = &H00000008
+Const SQL_SO_STATIC                        = &H00000010
+
+/* SQL_FETCH_DIRECTION masks */
+
+/* SQL_FETCH_RESUME is no longer supported
+Const SQL_FD_FETCH_RESUME                  = &H00000040 
+*/
+Const SQL_FD_FETCH_BOOKMARK                = &H00000080
+
+/* SQL_TXN_ISOLATION_OPTION masks */
+/* SQL_TXN_VERSIONING is no longer supported
+Const SQL_TXN_VERSIONING                   = &H00000010
+*/
+
+/* SQL_CORRELATION_NAME values */
+
+Const SQL_CN_NONE                          = &H0000
+Const SQL_CN_DIFFERENT                     = &H0001
+Const SQL_CN_ANY                           = &H0002
+
+/* SQL_NON_NULLABLE_COLUMNS values */
+
+Const SQL_NNC_NULL                         = &H0000
+Const SQL_NNC_NON_NULL                     = &H0001
+
+/* SQL_NULL_COLLATION values */
+
+Const SQL_NC_START                         = &H0002
+Const SQL_NC_END                           = &H0004
+
+/* SQL_FILE_USAGE values */
+
+Const SQL_FILE_NOT_SUPPORTED               = &H0000
+Const SQL_FILE_TABLE                       = &H0001
+Const SQL_FILE_QUALIFIER                   = &H0002
+Const SQL_FILE_CATALOG					 = SQL_FILE_QUALIFIER	' ODBC 3.0
+
+
+/* SQL_GETDATA_EXTENSIONS values */
+
+Const SQL_GD_BLOCK                         = &H00000004
+Const SQL_GD_BOUND                         = &H00000008
+
+/* SQL_POSITIONED_STATEMENTS masks */
+
+Const SQL_PS_POSITIONED_DELETE             = &H00000001
+Const SQL_PS_POSITIONED_UPDATE             = &H00000002
+Const SQL_PS_SELECT_FOR_UPDATE             = &H00000004
+
+/* SQL_GROUP_BY values */
+
+Const SQL_GB_NOT_SUPPORTED                 = &H0000
+Const SQL_GB_GROUP_BY_EQUALS_SELECT        = &H0001
+Const SQL_GB_GROUP_BY_CONTAINS_SELECT      = &H0002
+Const SQL_GB_NO_RELATION                   = &H0003
+Const SQL_GB_COLLATE						 = &H0004
+
+
+
+/* SQL_OWNER_USAGE masks */
+
+Const SQL_OU_DML_STATEMENTS                = &H00000001
+Const SQL_OU_PROCEDURE_INVOCATION          = &H00000002
+Const SQL_OU_TABLE_DEFINITION              = &H00000004
+Const SQL_OU_INDEX_DEFINITION              = &H00000008
+Const SQL_OU_PRIVILEGE_DEFINITION          = &H00000010
+
+/* SQL_SCHEMA_USAGE masks */
+Const SQL_SU_DML_STATEMENTS			 = SQL_OU_DML_STATEMENTS 
+Const SQL_SU_PROCEDURE_INVOCATION		 = SQL_OU_PROCEDURE_INVOCATION
+Const SQL_SU_TABLE_DEFINITION			 = SQL_OU_TABLE_DEFINITION
+Const SQL_SU_INDEX_DEFINITION			 = SQL_OU_INDEX_DEFINITION
+Const SQL_SU_PRIVILEGE_DEFINITION		 = SQL_OU_PRIVILEGE_DEFINITION
+
+
+/* SQL_QUALIFIER_USAGE masks */
+
+Const SQL_QU_DML_STATEMENTS                = &H00000001
+Const SQL_QU_PROCEDURE_INVOCATION          = &H00000002
+Const SQL_QU_TABLE_DEFINITION              = &H00000004
+Const SQL_QU_INDEX_DEFINITION              = &H00000008
+Const SQL_QU_PRIVILEGE_DEFINITION          = &H00000010
+
+/* SQL_CATALOG_USAGE masks */
+Const SQL_CU_DML_STATEMENTS			 = SQL_QU_DML_STATEMENTS
+Const SQL_CU_PROCEDURE_INVOCATION		 = SQL_QU_PROCEDURE_INVOCATION 
+Const SQL_CU_TABLE_DEFINITION			 = SQL_QU_TABLE_DEFINITION
+Const SQL_CU_INDEX_DEFINITION			 = SQL_QU_INDEX_DEFINITION 
+Const SQL_CU_PRIVILEGE_DEFINITION		 = SQL_QU_PRIVILEGE_DEFINITION 
+
+
+/* SQL_SUBQUERIES masks */
+
+Const SQL_SQ_COMPARISON                    = &H00000001
+Const SQL_SQ_EXISTS                        = &H00000002
+Const SQL_SQ_IN                            = &H00000004
+Const SQL_SQ_QUANTIFIED                    = &H00000008
+Const SQL_SQ_CORRELATED_SUBQUERIES         = &H00000010
+
+/* SQL_UNION masks */
+
+Const SQL_U_UNION                          = &H00000001
+Const SQL_U_UNION_ALL                      = &H00000002
+
+/* SQL_BOOKMARK_PERSISTENCE values */
+
+Const SQL_BP_CLOSE                         = &H00000001
+Const SQL_BP_DELETE                        = &H00000002
+Const SQL_BP_DROP                          = &H00000004
+Const SQL_BP_TRANSACTION                   = &H00000008
+Const SQL_BP_UPDATE                        = &H00000010
+Const SQL_BP_OTHER_HSTMT                   = &H00000020
+Const SQL_BP_SCROLL                        = &H00000040
+
+/* SQL_STATIC_SENSITIVITY values */
+
+Const SQL_SS_ADDITIONS                     = &H00000001
+Const SQL_SS_DELETIONS                     = &H00000002
+Const SQL_SS_UPDATES                       = &H00000004
+
+/* SQL_VIEW values */
+Const SQL_CV_CREATE_VIEW					 = &H00000001
+Const SQL_CV_CHECK_OPTION					 = &H00000002
+Const SQL_CV_CASCADED						 = &H00000004
+Const SQL_CV_LOCAL						 = &H00000008
+
+/* SQL_LOCK_TYPES masks */
+
+Const SQL_LCK_NO_CHANGE                    = &H00000001
+Const SQL_LCK_EXCLUSIVE                    = &H00000002
+Const SQL_LCK_UNLOCK                       = &H00000004
+
+/* SQL_POS_OPERATIONS masks */
+
+Const SQL_POS_POSITION                     = &H00000001
+Const SQL_POS_REFRESH                      = &H00000002
+Const SQL_POS_UPDATE                       = &H00000004
+Const SQL_POS_DELETE                       = &H00000008
+Const SQL_POS_ADD                          = &H00000010
+
+/* SQL_QUALIFIER_LOCATION values */
+
+Const SQL_QL_START                         = &H0001
+Const SQL_QL_END                           = &H0002
+
+/* Here start return values for ODBC 3.0 SQLGetInfo */
+
+/* SQL_AGGREGATE_FUNCTIONS bitmasks */
+Const SQL_AF_AVG						 = &H00000001
+Const SQL_AF_COUNT					 = &H00000002
+Const SQL_AF_MAX						 = &H00000004
+Const SQL_AF_MIN						 = &H00000008
+Const SQL_AF_SUM						 = &H00000010
+Const SQL_AF_DISTINCT					 = &H00000020
+Const SQL_AF_ALL						 = &H00000040	
+
+/* SQL_SQL_CONFORMANCE bit masks */
+Const SQL_SC_SQL92_ENTRY				 = &H00000001
+Const SQL_SC_FIPS127_2_TRANSITIONAL	 = &H00000002
+Const SQL_SC_SQL92_INTERMEDIATE		 = &H00000004
+Const SQL_SC_SQL92_FULL				 = &H00000008
+
+/* SQL_DATETIME_LITERALS masks */
+Const SQL_DL_SQL92_DATE						 = &H00000001
+Const SQL_DL_SQL92_TIME						 = &H00000002
+Const SQL_DL_SQL92_TIMESTAMP					 = &H00000004
+Const SQL_DL_SQL92_INTERVAL_YEAR				 = &H00000008
+Const SQL_DL_SQL92_INTERVAL_MONTH				 = &H00000010
+Const SQL_DL_SQL92_INTERVAL_DAY				 = &H00000020
+Const SQL_DL_SQL92_INTERVAL_HOUR				 = &H00000040
+Const SQL_DL_SQL92_INTERVAL_MINUTE			 = &H00000080
+Const SQL_DL_SQL92_INTERVAL_SECOND			 = &H00000100
+Const SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH		 = &H00000200
+Const SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR		 = &H00000400
+Const SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE		 = &H00000800
+Const SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND		 = &H00001000
+Const SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE	 = &H00002000
+Const SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND	 = &H00004000
+Const SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND	 = &H00008000
+
+/* SQL_CATALOG_LOCATION values */
+Const SQL_CL_START						 = SQL_QL_START
+Const SQL_CL_END							 = SQL_QL_END
+
+/* values for SQL_BATCH_ROW_COUNT */
+Const SQL_BRC_PROCEDURES			 = &H0000001
+Const SQL_BRC_EXPLICIT			 = &H0000002
+Const SQL_BRC_ROLLED_UP			 = &H0000004
+
+/* bitmasks for SQL_BATCH_SUPPORT */
+Const SQL_BS_SELECT_EXPLICIT				 = &H00000001
+Const SQL_BS_ROW_COUNT_EXPLICIT			 = &H00000002
+Const SQL_BS_SELECT_PROC					 = &H00000004
+Const SQL_BS_ROW_COUNT_PROC				 = &H00000008
+
+/* Values for SQL_PARAM_ARRAY_ROW_COUNTS getinfo */
+Const SQL_PARC_BATCH		 = 1
+Const SQL_PARC_NO_BATCH	 = 2
+
+/* values for SQL_PARAM_ARRAY_SELECTS */
+Const SQL_PAS_BATCH				 = 1
+Const SQL_PAS_NO_BATCH			 = 2		
+Const SQL_PAS_NO_SELECT			 = 3
+
+/* Bitmasks for SQL_INDEX_KEYWORDS */
+Const SQL_IK_NONE							 = &H00000000
+Const SQL_IK_ASC							 = &H00000001
+Const SQL_IK_DESC							 = &H00000002
+Const SQL_IK_ALL							 = (SQL_IK_ASC or SQL_IK_DESC)
+
+/* Bitmasks for SQL_INFO_SCHEMA_VIEWS */
+
+Const SQL_ISV_ASSERTIONS					 = &H00000001
+Const SQL_ISV_CHARACTER_SETS				 = &H00000002
+Const SQL_ISV_CHECK_CONSTRAINTS			 = &H00000004
+Const SQL_ISV_COLLATIONS					 = &H00000008
+Const SQL_ISV_COLUMN_DOMAIN_USAGE			 = &H00000010
+Const SQL_ISV_COLUMN_PRIVILEGES			 = &H00000020
+Const SQL_ISV_COLUMNS						 = &H00000040
+Const SQL_ISV_CONSTRAINT_COLUMN_USAGE		 = &H00000080
+Const SQL_ISV_CONSTRAINT_TABLE_USAGE		 = &H00000100
+Const SQL_ISV_DOMAIN_CONSTRAINTS			 = &H00000200
+Const SQL_ISV_DOMAINS						 = &H00000400
+Const SQL_ISV_KEY_COLUMN_USAGE			 = &H00000800
+Const SQL_ISV_REFERENTIAL_CONSTRAINTS		 = &H00001000
+Const SQL_ISV_SCHEMATA					 = &H00002000
+Const SQL_ISV_SQL_LANGUAGES				 = &H00004000
+Const SQL_ISV_TABLE_CONSTRAINTS			 = &H00008000
+Const SQL_ISV_TABLE_PRIVILEGES			 = &H00010000
+Const SQL_ISV_TABLES						 = &H00020000
+Const SQL_ISV_TRANSLATIONS				 = &H00040000
+Const SQL_ISV_USAGE_PRIVILEGES			 = &H00080000
+Const SQL_ISV_VIEW_COLUMN_USAGE			 = &H00100000
+Const SQL_ISV_VIEW_TABLE_USAGE			 = &H00200000
+Const SQL_ISV_VIEWS						 = &H00400000
+
+
+/* Bitmasks for SQL_ALTER_DOMAIN */
+Const SQL_AD_CONSTRAINT_NAME_DEFINITION			 = &H00000001	
+Const SQL_AD_ADD_DOMAIN_CONSTRAINT	 			 = &H00000002
+Const SQL_AD_DROP_DOMAIN_CONSTRAINT	 			 = &H00000004
+Const SQL_AD_ADD_DOMAIN_DEFAULT   	 			 = &H00000008
+Const SQL_AD_DROP_DOMAIN_DEFAULT   	 			 = &H00000010
+Const SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED	 = &H00000020
+Const SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE	 = &H00000040
+Const SQL_AD_ADD_CONSTRAINT_DEFERRABLE			 = &H00000080
+Const SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE		 = &H00000100
+
+
+/* SQL_CREATE_SCHEMA bitmasks */
+Const SQL_CS_CREATE_SCHEMA				 = &H00000001
+Const SQL_CS_AUTHORIZATION				 = &H00000002
+Const SQL_CS_DEFAULT_CHARACTER_SET		 = &H00000004
+
+/* SQL_CREATE_TRANSLATION bitmasks */
+Const SQL_CTR_CREATE_TRANSLATION			 = &H00000001
+
+/* SQL_CREATE_ASSERTION bitmasks */
+Const SQL_CA_CREATE_ASSERTION					 = &H00000001
+Const SQL_CA_CONSTRAINT_INITIALLY_DEFERRED	 = &H00000010
+Const SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE	 = &H00000020
+Const SQL_CA_CONSTRAINT_DEFERRABLE			 = &H00000040
+Const SQL_CA_CONSTRAINT_NON_DEFERRABLE		 = &H00000080
+
+/* SQL_CREATE_CHARACTER_SET bitmasks */
+Const SQL_CCS_CREATE_CHARACTER_SET		 = &H00000001
+Const SQL_CCS_COLLATE_CLAUSE				 = &H00000002
+Const SQL_CCS_LIMITED_COLLATION			 = &H00000004
+
+/* SQL_CREATE_COLLATION bitmasks */
+Const SQL_CCOL_CREATE_COLLATION			 = &H00000001
+
+/* SQL_CREATE_DOMAIN bitmasks */
+Const SQL_CDO_CREATE_DOMAIN					 = &H00000001
+Const SQL_CDO_DEFAULT							 = &H00000002
+Const SQL_CDO_CONSTRAINT						 = &H00000004
+Const SQL_CDO_COLLATION						 = &H00000008
+Const SQL_CDO_CONSTRAINT_NAME_DEFINITION		 = &H00000010
+Const SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED	 = &H00000020
+Const SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE	 = &H00000040
+Const SQL_CDO_CONSTRAINT_DEFERRABLE			 = &H00000080
+Const SQL_CDO_CONSTRAINT_NON_DEFERRABLE		 = &H00000100
+
+/* SQL_CREATE_TABLE bitmasks */
+Const SQL_CT_CREATE_TABLE						 = &H00000001
+Const SQL_CT_COMMIT_PRESERVE					 = &H00000002
+Const SQL_CT_COMMIT_DELETE					 = &H00000004
+Const SQL_CT_GLOBAL_TEMPORARY					 = &H00000008
+Const SQL_CT_LOCAL_TEMPORARY					 = &H00000010
+Const SQL_CT_CONSTRAINT_INITIALLY_DEFERRED	 = &H00000020
+Const SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE	 = &H00000040
+Const SQL_CT_CONSTRAINT_DEFERRABLE			 = &H00000080
+Const SQL_CT_CONSTRAINT_NON_DEFERRABLE		 = &H00000100
+Const SQL_CT_COLUMN_CONSTRAINT				 = &H00000200
+Const SQL_CT_COLUMN_DEFAULT					 = &H00000400
+Const SQL_CT_COLUMN_COLLATION					 = &H00000800
+Const SQL_CT_TABLE_CONSTRAINT					 = &H00001000
+Const SQL_CT_CONSTRAINT_NAME_DEFINITION		 = &H00002000
+
+/* SQL_DDL_INDEX bitmasks */
+Const SQL_DI_CREATE_INDEX						 = &H00000001
+Const SQL_DI_DROP_INDEX						 = &H00000002
+
+/* SQL_DROP_COLLATION bitmasks */
+Const SQL_DC_DROP_COLLATION					 = &H00000001
+
+/* SQL_DROP_DOMAIN bitmasks */
+Const SQL_DD_DROP_DOMAIN						 = &H00000001
+Const SQL_DD_RESTRICT							 = &H00000002
+Const SQL_DD_CASCADE							 = &H00000004
+
+/* SQL_DROP_SCHEMA bitmasks */
+Const SQL_DS_DROP_SCHEMA						 = &H00000001
+Const SQL_DS_RESTRICT							 = &H00000002
+Const SQL_DS_CASCADE							 = &H00000004
+
+/* SQL_DROP_CHARACTER_SET bitmasks */
+Const SQL_DCS_DROP_CHARACTER_SET				 = &H00000001
+
+/* SQL_DROP_ASSERTION bitmasks */
+Const SQL_DA_DROP_ASSERTION					 = &H00000001
+
+/* SQL_DROP_TABLE bitmasks */
+Const SQL_DT_DROP_TABLE						 = &H00000001
+Const SQL_DT_RESTRICT							 = &H00000002
+Const SQL_DT_CASCADE							 = &H00000004
+
+/* SQL_DROP_TRANSLATION bitmasks */
+Const SQL_DTR_DROP_TRANSLATION				 = &H00000001
+
+/* SQL_DROP_VIEW bitmasks */
+Const SQL_DV_DROP_VIEW						 = &H00000001
+Const SQL_DV_RESTRICT							 = &H00000002
+Const SQL_DV_CASCADE							 = &H00000004
+
+/* SQL_INSERT_STATEMENT bitmasks */
+Const SQL_IS_INSERT_LITERALS					 = &H00000001
+Const SQL_IS_INSERT_SEARCHED					 = &H00000002
+Const SQL_IS_SELECT_INTO						 = &H00000004
+
+/* SQL_ODBC_INTERFACE_CONFORMANCE values */
+Const SQL_OIC_CORE							 = 1
+Const SQL_OIC_LEVEL1							 = 2
+Const SQL_OIC_LEVEL2							 = 3
+
+/* SQL_SQL92_FOREIGN_KEY_DELETE_RULE bitmasks */
+Const SQL_SFKD_CASCADE						 = &H00000001
+Const SQL_SFKD_NO_ACTION						 = &H00000002
+Const SQL_SFKD_SET_DEFAULT					 = &H00000004
+Const SQL_SFKD_SET_NULL						 = &H00000008
+
+/* SQL_SQL92_FOREIGN_KEY_UPDATE_RULE bitmasks */
+Const SQL_SFKU_CASCADE						 = &H00000001
+Const SQL_SFKU_NO_ACTION						 = &H00000002
+Const SQL_SFKU_SET_DEFAULT					 = &H00000004
+Const SQL_SFKU_SET_NULL						 = &H00000008
+
+/* SQL_SQL92_GRANT	bitmasks */
+Const SQL_SG_USAGE_ON_DOMAIN					 = &H00000001
+Const SQL_SG_USAGE_ON_CHARACTER_SET			 = &H00000002
+Const SQL_SG_USAGE_ON_COLLATION				 = &H00000004
+Const SQL_SG_USAGE_ON_TRANSLATION				 = &H00000008
+Const SQL_SG_WITH_GRANT_OPTION				 = &H00000010
+Const SQL_SG_DELETE_TABLE						 = &H00000020
+Const SQL_SG_INSERT_TABLE						 = &H00000040
+Const SQL_SG_INSERT_COLUMN					 = &H00000080
+Const SQL_SG_REFERENCES_TABLE					 = &H00000100
+Const SQL_SG_REFERENCES_COLUMN				 = &H00000200
+Const SQL_SG_SELECT_TABLE						 = &H00000400
+Const SQL_SG_UPDATE_TABLE						 = &H00000800
+Const SQL_SG_UPDATE_COLUMN					 = &H00001000	
+
+/* SQL_SQL92_PREDICATES bitmasks */
+Const SQL_SP_EXISTS							 = &H00000001
+Const SQL_SP_ISNOTNULL						 = &H00000002
+Const SQL_SP_ISNULL							 = &H00000004
+Const SQL_SP_MATCH_FULL						 = &H00000008
+Const SQL_SP_MATCH_PARTIAL					 = &H00000010
+Const SQL_SP_MATCH_UNIQUE_FULL				 = &H00000020
+Const SQL_SP_MATCH_UNIQUE_PARTIAL				 = &H00000040
+Const SQL_SP_OVERLAPS							 = &H00000080
+Const SQL_SP_UNIQUE							 = &H00000100
+Const SQL_SP_LIKE								 = &H00000200
+Const SQL_SP_IN								 = &H00000400
+Const SQL_SP_BETWEEN							 = &H00000800
+Const SQL_SP_COMPARISON						 = &H00001000
+Const SQL_SP_QUANTIFIED_COMPARISON			 = &H00002000
+
+/* SQL_SQL92_RELATIONAL_JOIN_OPERATORS bitmasks */
+Const SQL_SRJO_CORRESPONDING_CLAUSE			 = &H00000001
+Const SQL_SRJO_CROSS_JOIN						 = &H00000002
+Const SQL_SRJO_EXCEPT_JOIN					 = &H00000004
+Const SQL_SRJO_FULL_OUTER_JOIN				 = &H00000008
+Const SQL_SRJO_INNER_JOIN						 = &H00000010
+Const SQL_SRJO_INTERSECT_JOIN					 = &H00000020
+Const SQL_SRJO_LEFT_OUTER_JOIN				 = &H00000040
+Const SQL_SRJO_NATURAL_JOIN					 = &H00000080
+Const SQL_SRJO_RIGHT_OUTER_JOIN				 = &H00000100
+Const SQL_SRJO_UNION_JOIN						 = &H00000200
+
+/* SQL_SQL92_REVOKE bitmasks */
+Const SQL_SR_USAGE_ON_DOMAIN					 = &H00000001
+Const SQL_SR_USAGE_ON_CHARACTER_SET			 = &H00000002
+Const SQL_SR_USAGE_ON_COLLATION				 = &H00000004
+Const SQL_SR_USAGE_ON_TRANSLATION				 = &H00000008
+Const SQL_SR_GRANT_OPTION_FOR					 = &H00000010
+Const SQL_SR_CASCADE							 = &H00000020
+Const SQL_SR_RESTRICT							 = &H00000040
+Const SQL_SR_DELETE_TABLE						 = &H00000080
+Const SQL_SR_INSERT_TABLE						 = &H00000100
+Const SQL_SR_INSERT_COLUMN					 = &H00000200
+Const SQL_SR_REFERENCES_TABLE					 = &H00000400
+Const SQL_SR_REFERENCES_COLUMN				 = &H00000800
+Const SQL_SR_SELECT_TABLE						 = &H00001000
+Const SQL_SR_UPDATE_TABLE						 = &H00002000
+Const SQL_SR_UPDATE_COLUMN					 = &H00004000
+
+/* SQL_SQL92_ROW_VALUE_CONSTRUCTOR bitmasks */
+Const SQL_SRVC_VALUE_EXPRESSION				 = &H00000001
+Const SQL_SRVC_NULL							 = &H00000002
+Const SQL_SRVC_DEFAULT						 = &H00000004
+Const SQL_SRVC_ROW_SUBQUERY					 = &H00000008
+
+/* SQL_SQL92_VALUE_EXPRESSIONS bitmasks */
+Const SQL_SVE_CASE							 = &H00000001
+Const SQL_SVE_CAST							 = &H00000002
+Const SQL_SVE_COALESCE						 = &H00000004
+Const SQL_SVE_NULLIF							 = &H00000008
+
+/* SQL_STANDARD_CLI_CONFORMANCE bitmasks */
+Const SQL_SCC_XOPEN_CLI_VERSION1				 = &H00000001
+Const SQL_SCC_ISO92_CLI						 = &H00000002
+
+/* SQL_UNION_STATEMENT bitmasks */
+Const SQL_US_UNION							 = SQL_U_UNION
+Const SQL_US_UNION_ALL						 = SQL_U_UNION_ALL
+
+
+
+/* SQL_DTC_TRANSITION_COST bitmasks */
+Const SQL_DTC_ENLIST_EXPENSIVE				 = &H00000001
+Const SQL_DTC_UNENLIST_EXPENSIVE				 = &H00000002
+
+/* additional SQLDataSources fetch directions */
+Const SQL_FETCH_FIRST_USER				 = 31
+Const SQL_FETCH_FIRST_SYSTEM				 = 32
+
+
+
+/* Defines for SQLSetPos */
+Const SQL_ENTIRE_ROWSET             = 0
+
+/* Operations in SQLSetPos */
+Const SQL_POSITION                  = 0               /*      1.0 FALSE */
+Const SQL_REFRESH                   = 1               /*      1.0 TRUE */
+Const SQL_UPDATE                    = 2
+Const SQL_DELETE                    = 3
+
+/* Operations in SQLBulkOperations */
+Const SQL_ADD                       = 4
+Const SQL_SETPOS_MAX_OPTION_VALUE			 = SQL_ADD
+Const SQL_UPDATE_BY_BOOKMARK		  = 5
+Const SQL_DELETE_BY_BOOKMARK		  = 6
+Const SQL_FETCH_BY_BOOKMARK		  = 7
+
+
+/* Lock options in SQLSetPos */
+Const SQL_LOCK_NO_CHANGE            = 0               /*      1.0 FALSE */
+Const SQL_LOCK_EXCLUSIVE            = 1               /*      1.0 TRUE */
+Const SQL_LOCK_UNLOCK               = 2
+
+Const SQL_SETPOS_MAX_LOCK_VALUE		 = SQL_LOCK_UNLOCK
+
+/* Macros for SQLSetPos */
+#define SQL_POSITION_TO(hstmt,irow) SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE)
+#define SQL_LOCK_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_POSITION,fLock)
+#define SQL_REFRESH_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_REFRESH,fLock)
+#define SQL_UPDATE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE)
+#define SQL_DELETE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE)
+#define SQL_ADD_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE)
+
+/* Column types and scopes in SQLSpecialColumns.  */
+Const SQL_BEST_ROWID                   = 1
+Const SQL_ROWVER                       = 2
+
+/* Defines for SQLSpecialColumns (returned in the result set) 
+   SQL_PC_UNKNOWN and SQL_PC_PSEUDO are defined in sql.h */
+Const SQL_PC_NOT_PSEUDO                = 1
+
+/* Defines for SQLStatistics */
+Const SQL_QUICK                        = 0
+Const SQL_ENSURE                       = 1
+
+/* Defines for SQLStatistics (returned in the result set) 
+   SQL_INDEX_CLUSTERED, SQL_INDEX_HASHED, and SQL_INDEX_OTHER are
+   defined in sql.h */
+Const SQL_TABLE_STAT                   = 0
+
+
+/* Defines for SQLTables */
+Const SQL_ALL_CATALOGS				 = "%"
+Const SQL_ALL_SCHEMAS					 = "%"
+Const SQL_ALL_TABLE_TYPES				 = "%"
+
+
+/* Options for SQLDriverConnect */
+Const SQL_DRIVER_NOPROMPT              = 0
+Const SQL_DRIVER_COMPLETE              = 1
+Const SQL_DRIVER_PROMPT                = 2
+Const SQL_DRIVER_COMPLETE_REQUIRED     = 3
+
+
+Declare Function SQLDriverConnect Lib "odbc32.dll" (
+    hdbc As SQLHDBC,
+    hwnd As HWND,
+    szConnStrIn As *SQLCHAR,
+    cbConnStrIn As SQLSMALLINT,
+    szConnStrOut As *SQLCHAR,
+    cbConnStrOutMax As SQLSMALLINT,
+    ByRef pcbConnStrOut As SQLSMALLINT,
+    fDriverCompletion As SQLUSMALLINT) As SQLRETURN
+
+
+/* Level 2 Functions                             */
+
+/* SQLExtendedFetch "fFetchType" values */
+Const SQL_FETCH_BOOKMARK                = 8
+
+/* SQLExtendedFetch "rgfRowStatus" element values */
+Const SQL_ROW_SUCCESS                   = 0
+Const SQL_ROW_DELETED                   = 1
+Const SQL_ROW_UPDATED                   = 2
+Const SQL_ROW_NOROW                     = 3
+Const SQL_ROW_ADDED                     = 4
+Const SQL_ROW_ERROR                     = 5
+Const SQL_ROW_SUCCESS_WITH_INFO		  = 6
+Const SQL_ROW_PROCEED					  = 0
+Const SQL_ROW_IGNORE					  = 1
+
+/* value for SQL_DESC_ARRAY_STATUS_PTR */
+Const SQL_PARAM_SUCCESS				 = 0
+Const SQL_PARAM_SUCCESS_WITH_INFO		 = 6
+Const SQL_PARAM_ERROR					 = 5
+Const SQL_PARAM_UNUSED				 = 7
+Const SQL_PARAM_DIAG_UNAVAILABLE		 = 1
+
+Const SQL_PARAM_PROCEED				 = 0
+Const SQL_PARAM_IGNORE				 = 1
+
+
+/* Defines for SQLForeignKeys (UPDATE_RULE and DELETE_RULE) */
+Const SQL_CASCADE                       = 0
+Const SQL_RESTRICT                      = 1
+Const SQL_SET_NULL                      = 2
+Const SQL_NO_ACTION			  = 3
+Const SQL_SET_DEFAULT			  = 4
+
+/* Note that the following are in a different column of SQLForeignKeys than */
+/* the previous #defines.   These are for DEFERRABILITY.                    */
+
+Const SQL_INITIALLY_DEFERRED			 = 5
+Const SQL_INITIALLY_IMMEDIATE			 = 6
+Const SQL_NOT_DEFERRABLE			 = 7
+
+
+/* Defines for SQLProcedures (returned in the result set) */
+Const SQL_PT_UNKNOWN                    = 0
+Const SQL_PT_PROCEDURE                  = 1
+Const SQL_PT_FUNCTION                   = 2
+
+
+Declare Function SQLBrowseConnect Lib "odbc32.dll" (
+    hdbc As SQLHDBC,
+    szConnStrIn As *SQLCHAR,
+    cbConnStrIn As SQLSMALLINT,
+    szConnStrOut As *SQLCHAR,
+    cbConnStrOutMax As SQLSMALLINT,
+    ByRef pcbConnStrOut As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLBulkOperations Lib "odbc32.dll" (
+	StatementHandle As SQLHSTMT,
+	Operation As SQLSMALLINT) As SQLRETURN
+
+
+Declare Function SQLColAttributes Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    icol As SQLUSMALLINT,
+    fDescType As SQLUSMALLINT,
+    rgbDesc As SQLPOINTER,
+    cbDescMax As SQLSMALLINT,
+    ByRef cbDesc As SQLSMALLINT,
+    ByRef fDesc As SQLLEN) As SQLRETURN
+
+Declare Function SQLColumnPrivileges Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    szCatalogName As *SQLCHAR,
+    cbCatalogName As SQLSMALLINT,
+    szSchemaName As *SQLCHAR,
+    cbSchemaName As SQLSMALLINT,
+    szTableName As *SQLCHAR,
+    cbTableName As SQLSMALLINT,
+    szColumnName As *SQLCHAR,
+    cbColumnName As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLDescribeParam Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    ipar As SQLUSMALLINT,
+    pfSqlType As *SQLSMALLINT,
+    pcbParamDef As *SQLULEN,
+    pibScale As *SQLSMALLINT,
+    pfNullable As *SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLExtendedFetch Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    fFetchType As SQLUSMALLINT,
+    irow As SQLLEN,
+    pcrow As *SQLULEN,
+    rgfRowStatus As *SQLUSMALLINT) As SQLRETURN
+
+Declare Function SQLForeignKeys Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    szPkCatalogName As *SQLCHAR,
+    cbPkCatalogName As SQLSMALLINT,
+    szPkSchemaName As *SQLCHAR,
+    cbPkSchemaName As SQLSMALLINT,
+    szPkTableName As *SQLCHAR,
+    cbPkTableName As SQLSMALLINT,
+    szFkCatalogName As *SQLCHAR,
+    cbFkCatalogName As SQLSMALLINT,
+    szFkSchemaName As *SQLCHAR,
+    cbFkSchemaName As SQLSMALLINT,
+    szFkTableName As *SQLCHAR,
+    cbFkTableName As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLMoreResults Lib "odbc32.dll" (
+    hstmt As SQLHSTMT) As SQLRETURN
+
+Declare Function SQLNativeSql Lib "odbc32.dll" (
+    hdbc As SQLHDBC,
+    szSqlStrIn As *SQLCHAR,
+    cbSqlStrIn As SQLINTEGER,
+    szSqlStr As *SQLCHAR,
+    cbSqlStrMax As SQLINTEGER,
+    pcbSqlStr As *SQLINTEGER) As SQLRETURN
+
+Declare Function SQLNumParams Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    pcpar As *SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLParamOptions Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    crow As SQLULEN,
+    pirow As *SQLULEN) As SQLRETURN
+
+Declare Function SQLPrimaryKeys Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    szCatalogName As *SQLCHAR,
+    cbCatalogName As SQLSMALLINT,
+    szSchemaName As *SQLCHAR,
+    cbSchemaName As SQLSMALLINT,
+    szTableName As *SQLCHAR,
+    cbTableName As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLProcedureColumns Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    szCatalogName As *SQLCHAR,
+    cbCatalogName As SQLSMALLINT,
+    szSchemaName As *SQLCHAR,
+    cbSchemaName As SQLSMALLINT,
+    szProcName As *SQLCHAR,
+    cbProcName As SQLSMALLINT,
+    szColumnName As *SQLCHAR,
+    cbColumnName As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLProcedures Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    szCatalogName As *SQLCHAR,
+    cbCatalogName As SQLSMALLINT,
+    szSchemaName As *SQLCHAR,
+    cbSchemaName As SQLSMALLINT,
+    szProcName As *SQLCHAR,
+    cbProcName As SQLSMALLINT) As SQLRETURN
+
+
+
+Declare Function SQLSetPos Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    irow As SQLSETPOSIROW,
+    fOption As SQLUSMALLINT,
+    fLock As SQLUSMALLINT) As SQLRETURN
+
+Declare Function SQLTablePrivileges Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    szCatalogName As *SQLCHAR,
+    cbCatalogName As SQLSMALLINT,
+    szSchemaName As *SQLCHAR,
+    cbSchemaName As SQLSMALLINT,
+    szTableName As *SQLCHAR,
+    cbTableName As SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLDrivers Lib "odbc32.dll" (
+    henv As SQLHENV,
+    fDirection As SQLUSMALLINT,
+    szDriverDesc As *SQLCHAR,
+    cbDriverDescMax As SQLSMALLINT,
+    pcbDriverDesc As *SQLSMALLINT,
+    szDriverAttributes As *SQLCHAR,
+    cbDrvrAttrMax As SQLSMALLINT,
+    pcbDrvrAttr As *SQLSMALLINT) As SQLRETURN
+
+Declare Function SQLBindParameter Lib "odbc32.dll" (
+    hstmt As SQLHSTMT,
+    ipar As SQLUSMALLINT,
+    fParamType As SQLSMALLINT,
+    fCType As SQLSMALLINT,
+    fSqlType As SQLSMALLINT,
+    cbColDef As SQLULEN,
+    ibScale As SQLSMALLINT,
+    rgbValue As SQLPOINTER,
+    cbValueMax As SQLLEN,
+    pcbValue As *SQLLEN) As SQLRETURN
+
+
+
+
+
+Declare Function SQLAllocHandleStd Lib "odbc32.dll" (
+	fHandleType As SQLSMALLINT,
+	hInput As SQLHANDLE,
+	phOutput As *SQLHANDLE) As SQLRETURN
+
+/*      Deprecated defines from prior versions of ODBC */
+Const SQL_DATABASE_NAME                = 16    /* Use SQLGetConnectOption/SQL_CURRENT_QUALIFIER */
+Const SQL_FD_FETCH_PREV                = SQL_FD_FETCH_PRIOR
+Const SQL_FETCH_PREV                   = SQL_FETCH_PRIOR
+Const SQL_CONCUR_TIMESTAMP             = SQL_CONCUR_ROWVER
+Const SQL_SCCO_OPT_TIMESTAMP           = SQL_SCCO_OPT_ROWVER
+Const SQL_CC_DELETE                    = SQL_CB_DELETE
+Const SQL_CR_DELETE                    = SQL_CB_DELETE
+Const SQL_CC_CLOSE                     = SQL_CB_CLOSE
+Const SQL_CR_CLOSE                     = SQL_CB_CLOSE
+Const SQL_CC_PRESERVE                  = SQL_CB_PRESERVE
+Const SQL_CR_PRESERVE                  = SQL_CB_PRESERVE
+/* SQL_FETCH_RESUME is not supported by 2.0+ drivers 
+Const SQL_FETCH_RESUME                 = 7    
+*/
+Const SQL_SCROLL_FORWARD_ONLY          = 0    /*-SQL_CURSOR_FORWARD_ONLY */
+Const SQL_SCROLL_KEYSET_DRIVEN         = (-1) /*-SQL_CURSOR_KEYSET_DRIVEN */
+Const SQL_SCROLL_DYNAMIC               = (-2) /*-SQL_CURSOR_DYNAMIC */
+Const SQL_SCROLL_STATIC                = (-3) /*-SQL_CURSOR_STATIC */
+
+
+Declare Function SQLSetScrollOptions Lib "odbc32.dll" (    /*      Use SQLSetStmtOptions */
+    hstmt As SQLHSTMT,
+    fConcurrency As SQLUSMALLINT,
+    crowKeyset As SQLLEN,
+    crowRowset As SQLUSMALLINT) As SQLRETURN
+
+			
+
+/* Functions for setting the connection pooling failure detection code */
+/* The "TryWait" value is the time (in seconds) that the DM will wait  */
+/* between detecting that a connection is dead (using                  */
+/* SQL_ATTR_CONNECTION_DEAD) and retrying the connection.  During that */
+/* interval, connection requests will get "The server appears to be    */
+/* dead" error returns.                                                */ 
+
+
+Declare Function ODBCSetTryWaitValue Lib "odbc32.dll" (dwValue As DWORD) As BOOL	/* In seconds */
+Declare Function ODBCGetTryWaitValue Lib "odbc32.dll" () As DWord			/* In Milliseconds(!) */
+
+
+/* the flags in ODBC_VS_ARGS */
+Const ODBC_VS_FLAG_UNICODE_ARG	 = &H00000001	/* the argument is unicode */
+Const ODBC_VS_FLAG_UNICODE_COR	 = &H00000002	/* the correlation is unicode */
+Const ODBC_VS_FLAG_RETCODE		 = &H00000004	/* RetCode field is set */
+Const ODBC_VS_FLAG_STOP		 = &H00000008	/* Stop firing visual studio analyzer events */
+
+TypeDef RETCODE = Integer
+Type ODBC_VS_ARGS
+	pguidEvent As *GUID
+	dwFlags As DWord
+	'Union
+		'wszArg As *WCHAR
+		szArg As LPSTR
+	'End Union
+	'Union
+		'wszCorrelation As *WCHAR
+		szCorrelation As LPSTR
+	'End Union
+	RetCode As RETCODE
+End Type
Index: /trunk/ab5.0/ablib/src/api_system.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_system.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_system.sbp	(revision 506)
@@ -0,0 +1,968 @@
+' api_system.sbp - System API
+
+#ifdef UNICODE
+Const _FuncName_AddAtom = "AddAtomW"
+Const _FuncName_CompareString = "CompareStringW"
+Const _FuncName_CopyFile = "CopyFileW"
+Const _FuncName_CreateDirectory = "CreateDirectoryW"
+Const _FuncName_CreateEvent = "CreateEventW"
+Const _FuncName_CreateMutex = "CreateMutexW"
+Const _FuncName_CreateSemaphore = "CreateSemaphoreW"
+Const _FuncName_CreateWaitableTimer = "CreateWaitableTimerW"
+Const _FuncName_CreateFile = "CreateFileW"
+Const _FuncName_CreateFileMapping = "CreateFileMappingW"
+Const _FuncName_OpenFileMapping = "OpenFileMappingW"
+Const _FuncName_CreateMailslot = "CreateMailslotW"
+Const _FuncName_CreateProcess = "CreateProcessW"
+Const _FuncName_DeleteFile = "DeleteFileW"
+Const _FuncName_ExpandEnvironmentStrings = "ExpandEnvironmentStringsW"
+Const _FuncName_FatalAppExit = "FatalAppExitW"
+Const _FuncName_FindAtom = "FindAtomW"
+Const _FuncName_FindFirstChangeNotification = "FindFirstChangeNotificationW"
+Const _FuncName_FindFirstFile = "FindFirstFileW"
+Const _FuncName_FindNextFile = "FindNextFileW"
+Const _FuncName_FindResource = "FindResourceW"
+Const _FuncName_FormatMessage = "FormatMessageW"
+Const _FuncName_FreeEnvironmentStrings = "FreeEnvironmentStringsW"
+Const _FuncName_GetCompressedFileSize = "GetCompressedFileSizeW"
+Const _FuncName_GetComputerName = "GetComputerNameW"
+Const _FuncName_GetCurrentDirectory = "GetCurrentDirectoryW"
+Const _FuncName_GetDateFormat = "GetDateFormatW"
+Const _FuncName_GetDiskFreeSpace = "GetDiskFreeSpaceW"
+Const _FuncName_GetDiskFreeSpaceEx = "GetDiskFreeSpaceExW"
+Const _FuncName_GetVolumeInformation = "GetVolumeInformationW"
+Const _FuncName_GetDriveType = "GetDriveTypeW"
+Const _FuncName_GetEnvironmentVariable = "GetEnvironmentVariableW"
+Const _FuncName_GetEnvironmentStrings = "GetEnvironmentStringsW"
+Const _FuncName_GetFileAttributes = "GetFileAttributesW"
+Const _FuncName_GetFullPathName = "GetFullPathNameW"
+Const _FuncName_GetAtomName = "GetAtomNameW"
+Const _FuncName_GlobalAddAtom = "GlobalAddAtomW"
+Const _FuncName_GlobalFindAtom = "GlobalFindAtomW"
+Const _FuncName_GlobalGetAtomName = "GlobalGetAtomNameW"
+Const _FuncName_GetLogicalDriveStrings = "GetLogicalDriveStringsW"
+Const _FuncName_GetLongPathName = "GetLongPathNameW"
+Const _FuncName_GetModuleFileName = "GetModuleFileNameW"
+Const _FuncName_GetModuleHandle = "GetModuleHandleW"
+Const _FuncName_GetShortPathName = "GetShortPathNameW"
+Const _FuncName_GetStartupInfo = "GetStartupInfoW"
+Const _FuncName_GetSystemDirectory = "GetSystemDirectoryW"
+Const _FuncName_GetTempFileName = "GetTempFileNameW"
+Const _FuncName_GetTempPath = "GetTempPathW"
+Const _FuncName_GetTimeFormat = "GetTimeFormatW"
+Const _FuncName_GetUserName = "GetUserNameW"
+Const _FuncName_GetVersionEx = "GetVersionExW"
+Const _FuncName_GetWindowsDirectory = "GetWindowsDirectoryW"
+Const _FuncName_LCMapString = "LCMapStringW"
+Const _FuncName_LoadLibrary = "LoadLibraryW"
+Const _FuncName_LoadLibraryEx = "LoadLibraryExW"
+Const _FuncName_LookupPrivilegeValue = "LookupPrivilegeValueW"
+Const _FuncName_lstrcat = "lstrcatW"
+Const _FuncName_lstrcmp = "lstrcmpW"
+Const _FuncName_lstrcmpi = "lstrcmpiW"
+Const _FuncName_lstrcpy = "lstrcpyW"
+Const _FuncName_lstrcpyn = "lstrcpynW"
+Const _FuncName_MoveFile = "MoveFileW"
+Const _FuncName_OpenEvent = "OpenEventW"
+Const _FuncName_OpenMutex = "OpenMutexW"
+Const _FuncName_OpenSemaphore = "OpenSemaphoreW"
+Const _FuncName_OpenWaitableTimer = "OpenWaitableTimerW"
+Const _FuncName_RemoveDirectory = "RemoveDirectoryW"
+Const _FuncName_SetComputerName = "SetComputerNameW"
+Const _FuncName_SetCurrentDirectory = "SetCurrentDirectoryW"
+Const _FuncName_SearchPath = "SearchPathW"
+Const _FuncName_SetEnvironmentVariable = "SetEnvironmentVariableW"
+Const _FuncName_SetFileAttributes = "SetFileAttributesW"
+#else
+Const _FuncName_AddAtom = "AddAtomA"
+Const _FuncName_CompareString = "CompareStringA"
+Const _FuncName_CopyFile = "CopyFileA"
+Const _FuncName_CreateDirectory = "CreateDirectoryA"
+Const _FuncName_CreateEvent = "CreateEventA"
+Const _FuncName_CreateMutex = "CreateMutexA"
+Const _FuncName_CreateSemaphore = "CreateSemaphoreA"
+Const _FuncName_CreateWaitableTimer = "CreateWaitableTimerA"
+Const _FuncName_CreateFile = "CreateFileA"
+Const _FuncName_CreateFileMapping = "CreateFileMappingA"
+Const _FuncName_OpenFileMapping = "OpenFileMappingA"
+Const _FuncName_CreateMailslot = "CreateMailslotA"
+Const _FuncName_CreateProcess = "CreateProcessA"
+Const _FuncName_DeleteFile = "DeleteFileA"
+Const _FuncName_ExpandEnvironmentStrings = "ExpandEnvironmentStringsA"
+Const _FuncName_FatalAppExit = "FatalAppExitA"
+Const _FuncName_FindAtom = "FindAtomA"
+Const _FuncName_FindFirstChangeNotification = "FindFirstChangeNotificationA"
+Const _FuncName_FindFirstFile = "FindFirstFileA"
+Const _FuncName_FindNextFile = "FindNextFileA"
+Const _FuncName_FindResource = "FindResourceA"
+Const _FuncName_FormatMessage = "FormatMessageA"
+Const _FuncName_FreeEnvironmentStrings = "FreeEnvironmentStringsA"
+Const _FuncName_GetAtomName = "GetAtomNameA"
+Const _FuncName_GlobalAddAtom = "GlobalAddAtomA"
+Const _FuncName_GlobalFindAtom = "GlobalFindAtomA"
+Const _FuncName_GlobalGetAtomName = "GlobalGetAtomNameA"
+Const _FuncName_GetCompressedFileSize = "GetCompressedFileSizeA"
+Const _FuncName_GetComputerName = "GetComputerNameA"
+Const _FuncName_GetCurrentDirectory = "GetCurrentDirectoryA"
+Const _FuncName_GetDateFormat = "GetDateFormatA"
+Const _FuncName_GetDiskFreeSpace = "GetDiskFreeSpaceA"
+Const _FuncName_GetDiskFreeSpaceEx = "GetDiskFreeSpaceExA"
+Const _FuncName_GetVolumeInformation = "GetVolumeInformationA"
+Const _FuncName_GetDriveType = "GetDriveTypeA"
+Const _FuncName_GetEnvironmentVariable = "GetEnvironmentVariableA"
+Const _FuncName_GetEnvironmentStrings = "GetEnvironmentStringsA"
+Const _FuncName_GetFileAttributes = "GetFileAttributesA"
+Const _FuncName_GetFullPathName = "GetFullPathNameA"
+Const _FuncName_GetLogicalDriveStrings = "GetLogicalDriveStringsA"
+Const _FuncName_GetLongPathName = "GetLongPathNameA"
+Const _FuncName_GetModuleFileName = "GetModuleFileNameA"
+Const _FuncName_GetModuleHandle = "GetModuleHandleA"
+Const _FuncName_GetShortPathName = "GetShortPathNameA"
+Const _FuncName_GetStartupInfo = "GetStartupInfoA"
+Const _FuncName_GetSystemDirectory = "GetSystemDirectoryA"
+Const _FuncName_GetTempFileName = "GetTempFileNameA"
+Const _FuncName_GetTempPath = "GetTempPathA"
+Const _FuncName_GetTimeFormat = "GetTimeFormatA"
+Const _FuncName_GetUserName = "GetUserNameA"
+Const _FuncName_GetVersionEx = "GetVersionExA"
+Const _FuncName_GetWindowsDirectory = "GetWindowsDirectoryA"
+Const _FuncName_LCMapString = "LCMapStringA"
+Const _FuncName_LoadLibrary = "LoadLibraryA"
+Const _FuncName_LoadLibraryEx = "LoadLibraryExA"
+Const _FuncName_LookupPrivilegeValue = "LookupPrivilegeValueA"
+Const _FuncName_lstrcat = "lstrcatA"
+Const _FuncName_lstrcmp = "lstrcmpA"
+Const _FuncName_lstrcmpi = "lstrcmpiA"
+Const _FuncName_lstrcpy = "lstrcpyA"
+Const _FuncName_lstrcpyn = "lstrcpynA"
+Const _FuncName_MoveFile = "MoveFileA"
+Const _FuncName_OpenEvent = "OpenEventA"
+Const _FuncName_OpenMutex = "OpenMutexA"
+Const _FuncName_OpenSemaphore = "OpenSemaphoreA"
+Const _FuncName_OpenWaitableTimer = "OpenWaitableTimerA"
+Const _FuncName_RemoveDirectory = "RemoveDirectoryA"
+Const _FuncName_SetComputerName = "SetComputerNameA"
+Const _FuncName_SetCurrentDirectory = "SetCurrentDirectoryA"
+Const _FuncName_SearchPath = "SearchPathA"
+Const _FuncName_SetEnvironmentVariable = "SetEnvironmentVariableA"
+Const _FuncName_SetFileAttributes = "SetFileAttributesA"
+#endif
+
+
+'-------------------
+' default constants
+Const INVALID_HANDLE_VALUE = -1 As HANDLE
+Const INVALID_FILE_SIZE = &HFFFFFFFF As DWord
+Const INVALID_SET_FILE_POINTER = &HFFFFFFFF As DWord
+Const INVALID_FILE_ATTRIBUTES = &HFFFFFFFF As DWord
+
+'-----------------
+' data structs
+
+'variable type - System
+TypeDef HFILE = Long
+Type _System_DeclareHandle_HANDLE:unused As DWord:End Type
+TypeDef HRSRC = *_System_DeclareHandle_HANDLE
+
+' File structure
+Type SECURITY_ATTRIBUTES
+	nLength As DWord
+	lpSecurityDescriptor As VoidPtr
+	bInheritHandle As BOOL
+End Type
+
+Type OVERLAPPED
+	Internal As ULONG_PTR
+	InternalHigh As ULONG_PTR
+	Offset As DWord
+	OffsetHigh As DWord
+	hEvent As HANDLE
+End Type
+
+' System time
+Type SYSTEMTIME
+	wYear As Word
+	wMonth As Word
+	wDayOfWeek As Word
+	wDay As Word
+	wHour As Word
+	wMinute As Word
+	wSecond As Word
+	wMilliseconds As Word
+End Type
+
+' Global Memory Flags
+Const GMEM_FIXED =          &H0000
+Const GMEM_MOVEABLE =       &H0002
+Const GMEM_NOCOMPACT =      &H0010
+Const GMEM_NODISCARD =      &H0020
+Const GMEM_ZEROINIT =       &H0040
+Const GMEM_MODIFY =         &H0080
+Const GMEM_DISCARDABLE =    &H0100
+Const GMEM_NOT_BANKED =     &H1000
+Const GMEM_SHARE =          &H2000
+Const GMEM_DDESHARE =       &H2000
+Const GMEM_INVALID_HANDLE = &H8000
+Const GHND =                GMEM_MOVEABLE or GMEM_ZEROINIT
+Const GPTR =                GMEM_FIXED or GMEM_ZEROINIT
+Const GMEM_DISCARDED =      &H4000
+
+' Locale flag
+Const LOCALE_NOUSEROVERRIDE = &H80000000
+
+'Critical Section
+Type CRITICAL_SECTION
+	DebugInfo As VoidPtr
+	LockCount As Long
+	RecursionCount As Long
+	OwningThread As HANDLE
+	LockSemaphore As HANDLE
+	SpinCount As ULONG_PTR
+End Type
+
+'Mutex
+Const MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS
+
+'Lmcons.ab
+Const UNLEN = 256
+
+'----------------------
+' Kernel Operation API
+#ifdef _WIN64
+Function InterlockedIncrement(ByRef lpAddend As Long) As Long
+	lpAddend++
+	Return lpAddend
+End Function
+Function InterlockedDecrement(ByRef lpAddend As Long) As Long
+	lpAddend--
+	Return lpAddend
+End Function
+Function InterlockedExchange(ByRef Target As Long, Value As Long) As Long
+	InterlockedExchange=Target
+	Target = Value
+End Function
+Function InterlockedCompareExchange(ByRef Destination As Long, Exchange As Long, Comperand As Long) As Long
+	InterlockedCompareExchange = Destination
+	If Destination = Comperand Then
+		Destination = Exchange
+	End If
+End Function
+Function InterlockedExchangeAdd(ByRef Addend As Long, Value As Long) As Long
+	InterlockedExchangeAdd = Addend
+	Addend += Value
+End Function
+Function InterlockedExchangePointer(ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
+	InterlockedExchangePointer = Target
+	Target = Value
+End Function
+Function InterlockedCompareExchangePointer(ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
+	InterlockedCompareExchangePointer = Destination
+	If Destination = Comperand Then
+		Destination = Exchange
+	End If
+End Function
+#else
+Declare Function InterlockedIncrement Lib "kernel32" (ByRef lpAddend As Long) As Long
+Declare Function InterlockedDecrement Lib "kernel32" (ByRef lpAddend As Long) As Long
+Declare Function InterlockedExchange Lib "kernel32" (ByRef Target As Long, Value As Long) As Long
+Declare Function InterlockedCompareExchange Lib "kernel32" (ByRef Destination As Long, Exchange As Long, Comperand As Long) As Long
+Declare Function InterlockedExchangeAdd Lib "kernel32" (ByRef Addend As Long, Value As Long) As Long
+Declare Function InterlockedCompareExchangePointer Lib "kernel32" Alias "InterlockedCompareExchange" (ByRef Destination As VoidPtr, Exchange As VoidPtr, Comperand As VoidPtr) As VoidPtr
+Declare Function InterlockedExchangePointer Lib "kernel32" Alias "InterlockedExchange" (ByRef Target As VoidPtr, Value As VoidPtr) As VoidPtr
+#endif
+
+
+Declare Function Beep Lib "kernel32" (dwFreq As DWord, dwDuration As DWord) As BOOL
+Declare Function CloseHandle Lib "kernel32" (hObject As HANDLE) As BOOL
+
+Declare Function CompareFileTime Lib "kernel32" (ByRef FileTime1 As FILETIME, ByRef FileTime2 As FILETIME) As Long
+
+Const NORM_IGNORECASE =     &H00000001
+Const NORM_IGNORENONSPACE = &H00000002
+Const NORM_IGNORESYMBOLS =  &H00000004
+Const SORT_STRINGSORT =     &H00001000
+Const NORM_IGNOREKANATYPE = &H00010000
+Const NORM_IGNOREWIDTH =    &H00020000
+Const CSTR_LESS_THAN =    1
+Const CSTR_EQUAL =        2
+Const CSTR_GREATER_THAN = 3
+Declare Function CompareString Lib "kernel32" Alias _FuncName_CompareString (Locale As LCID, dwCmpFlags As DWord, pString1 As PCTSTR, cchCount1 As Long, pString2 As PCTSTR, cchCount2 As Long) As Long
+
+Declare Function CopyFile Lib "kernel32" Alias _FuncName_CopyFile (pExistingFileName As PCTSTR, pNewFileName As PCTSTR, bFailIfExists As BOOL) As BOOL
+Declare Function CreateDirectory Lib "kernel32" Alias _FuncName_CreateDirectory (pPathName As PCTSTR, pSecurityAttributes As *SECURITY_ATTRIBUTES) As BOOL
+Declare Function CreateEvent Lib "kernel32" Alias _FuncName_CreateEvent (pEventAttributes As *SECURITY_ATTRIBUTES, bManualReset As BOOL, bInitialState As BOOL, pName As PCTSTR) As HANDLE
+Declare Function CreateMutex Lib "kernel32" Alias _FuncName_CreateMutex (lpMutexAttributes As *SECURITY_ATTRIBUTES, bInitialOwner As BOOL, lpName As PCTSTR) As HANDLE
+Declare Function CreatePipe Lib "Kernel32" (
+    ByRef hReadPipe As HANDLE,
+    ByRef hWritePipe As HANDLE,
+    ByVal pPipeAttributes As *SECURITY_ATTRIBUTES,
+    ByVal nSize As DWord) As Long
+Declare Function CreateSemaphore Lib "kernel32" Alias _FuncName_CreateSemaphore (pSemaphoreAttributes As *SECURITY_ATTRIBUTES, lInitialCount As Long, lMaximumCount As Long, pName As PCTSTR) As HANDLE
+
+TypeDef PTIMERAPCROUTINE = *Sub(lpArgToCompletionRoutine As VoidPtr, dwTimerLowValue As DWord, dwTimerHighValue As DWord)
+Declare Function CreateWaitableTimer Lib "kernel32" Alias _FuncName_CreateWaitableTimer (pTimerAttributes As *SECURITY_ATTRIBUTES, bManualReset As BOOL, pTimerName As PCTSTR) As HANDLE
+Declare Function OpenWaitableTimer Lib "kernel32" Alias _FuncName_OpenWaitableTimer (dwDesiredAccess As DWord, bInheritHandle As BOOL, pTimerName As PCTSTR) As HANDLE
+Declare Function SetWaitableTimer Lib "kernel32" (hTimer As HANDLE, pDueTime As *LARGE_INTEGER, lPeriod As Long, pfnCompletionRoutine As PTIMERAPCROUTINE, pArgToCompletionRoutine As VoidPtr, fResume As BOOL) As BOOL
+Declare Function CancelWaitableTimer Lib "kernel32" (hTimer As HANDLE) As BOOL
+
+Const CREATE_NEW =        1
+Const CREATE_ALWAYS =     2
+Const OPEN_EXISTING =     3
+Const OPEN_ALWAYS =       4
+Const TRUNCATE_EXISTING = 5
+Const FILE_FLAG_WRITE_THROUGH =       &H80000000
+Const FILE_FLAG_OVERLAPPED =          &H40000000
+Const FILE_FLAG_NO_BUFFERING =        &H20000000
+Const FILE_FLAG_RANDOM_ACCESS =       &H10000000
+Const FILE_FLAG_SEQUENTIAL_SCAN =     &H08000000
+Const FILE_FLAG_DELETE_ON_CLOSE =     &H04000000
+Const FILE_FLAG_BACKUP_SEMANTICS =    &H02000000
+Const FILE_FLAG_POSIX_SEMANTICS =     &H01000000
+Const FILE_FLAG_OPEN_REPARSE_POINT =  &H00200000
+Const FILE_FLAG_OPEN_NO_RECALL =      &H00100000
+Declare Function CreateFile Lib "kernel32" Alias _FuncName_CreateFile (pFileName As PCTSTR, dwDesiredAccess As DWord, dwShareMode As DWord, ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, dwCreationDisposition As DWord, dwFlagsAndAttributes As DWord, hTemplateFile As HANDLE) As HANDLE
+
+Const FILE_MAP_COPY   = SECTION_QUERY
+Const FILE_MAP_WRITE   = SECTION_MAP_WRITE
+Const FILE_MAP_READ   = SECTION_MAP_READ
+Const FILE_MAP_ALL_ACCESS  =  SECTION_ALL_ACCESS
+Declare Function CreateFileMapping Lib "kernel32" Alias _FuncName_CreateFileMapping (hFile As HANDLE, pFileMappingAttributes As *SECURITY_ATTRIBUTES, flProtect As DWord, dwMaximumSizeHigh As DWord, dwMaximumSizeLow As DWord, pName As PCSTR) As HANDLE
+Declare Function OpenFileMapping Lib "kernel32" Alias _FuncName_OpenFileMapping (dwDesiredAccess As DWord, bInheritHandle As BOOL, pName As PCSTR) As HANDLE
+Declare Function MapViewOfFile Lib "kernel32" (hFileMappingObject As HANDLE, dwDesiredAccess As DWord, dwFileOffsetHigh As DWord, dwFileOffsetLow As DWord, dwNumberOfBytesToMap As DWord) As VoidPtr
+Declare Function MapViewOfFileEx Lib "kernel32" (hFileMappingObject As HANDLE, dwDesiredAccess As DWord, dwFileOffsetHigh As DWord, dwFileOffsetLow As DWord, dwNumberOfBytesToMap As DWord, lpBaseAddress As VoidPtr) As VoidPtr
+Declare Function FlushViewOfFile Lib "kernel32" (lpBaseAddress As VoidPtr, dwNumberOfBytesToFlush As DWord) As BOOL
+Declare Function UnmapViewOfFile Lib "kernel32" (lpBaseAddress As VoidPtr) As BOOL
+Declare Function CreateMailslot Lib "kernel32" Alias _FuncName_CreateMailslot (pName As PCTSTR, nMaxMessageSize As DWord, lReadTimeout As DWord, pSecurityAttributes As *SECURITY_ATTRIBUTES) As HANDLE
+
+Const DEBUG_PROCESS =              &H00000001
+Const DEBUG_ONLY_THIS_PROCESS =    &H00000002
+Const CREATE_SUSPENDED =           &H00000004
+Const DETACHED_PROCESS =           &H00000008
+Const CREATE_NEW_CONSOLE =         &H00000010
+Const NORMAL_PRIORITY_CLASS =      &H00000020
+Const IDLE_PRIORITY_CLASS =        &H00000040
+Const HIGH_PRIORITY_CLASS =        &H00000080
+Const REALTIME_PRIORITY_CLASS =    &H00000100
+Const CREATE_NEW_PROCESS_GROUP =   &H00000200
+Const CREATE_UNICODE_ENVIRONMENT = &H00000400
+Const CREATE_SEPARATE_WOW_VDM =    &H00000800
+Const CREATE_SHARED_WOW_VDM =      &H00001000
+Const CREATE_FORCEDOS =            &H00002000
+Const CREATE_DEFAULT_ERROR_MODE =  &H04000000
+Const CREATE_NO_WINDOW =           &H08000000
+Const PROFILE_USER =               &H10000000
+Const PROFILE_KERNEL =             &H20000000
+Const PROFILE_SERVER =             &H40000000
+
+Const STARTF_USESHOWWINDOW =    &H00000001
+Const STARTF_USESIZE =          &H00000002
+Const STARTF_USEPOSITION =      &H00000004
+Const STARTF_USECOUNTCHARS =    &H00000008
+Const STARTF_USEFILLATTRIBUTE = &H00000010
+Const STARTF_RUNFULLSCREEN =    &H00000020
+Const STARTF_FORCEONFEEDBACK =  &H00000040
+Const STARTF_FORCEOFFFEEDBACK = &H00000080
+Const STARTF_USESTDHANDLES =    &H00000100
+Const STARTF_USEHOTKEY =        &H00000200
+Type STARTUPINFOW
+	cb As DWord
+	lpReserved As LPWSTR
+	lpDesktop As LPWSTR
+	lpTitle As LPWSTR
+	dwX As DWord
+	dwY As DWord
+	dwXSize As DWord
+	dwYSize As DWord
+	dwXCountChars As DWord
+	dwYCountChars As DWord
+	dwFillAttribute As DWord
+	dwFlags As DWord
+	wShowWindow As Word
+	cbReserved2 As Word
+	lpReserved2 As *Byte
+	hStdInput As HANDLE
+	hStdOutput As HANDLE
+	hStdError As HANDLE
+End Type
+Type STARTUPINFOA
+	cb As DWord
+	lpReserved As LPSTR
+	lpDesktop As LPSTR
+	lpTitle As LPSTR
+	dwX As DWord
+	dwY As DWord
+	dwXSize As DWord
+	dwYSize As DWord
+	dwXCountChars As DWord
+	dwYCountChars As DWord
+	dwFillAttribute As DWord
+	dwFlags As DWord
+	wShowWindow As Word
+	cbReserved2 As Word
+	lpReserved2 As *Byte
+	hStdInput As HANDLE
+	hStdOutput As HANDLE
+	hStdError As HANDLE
+End Type
+#ifdef UNICODE
+TypeDef STARTUPINFO = STARTUPINFOW
+#else
+TypeDef STARTUPINFO = STARTUPINFOA
+#endif
+Type PROCESS_INFORMATION
+	hProcess As HANDLE
+	hThread As HANDLE
+	dwProcessId As DWord
+	dwThreadId As DWord
+End Type
+Declare Function CreateProcess Lib "kernel32" Alias _FuncName_CreateProcess (pApplicationName As PCTSTR, pCommandLine As PTSTR, ByRef ProcessAttributes As SECURITY_ATTRIBUTES, ByRef ThreadAttributes As SECURITY_ATTRIBUTES, bInheritHandles As BOOL, dwCreationFlags As DWord, lpEnvironment As VoidPtr, pCurrentDirectory As PCTSTR, ByRef lpStartupInfo As STARTUPINFO, ByRef lpProcessInformation As PROCESS_INFORMATION) As BOOL
+
+TypeDef LPTHREAD_START_ROUTINE = *Function(lpThreadParameter As VoidPtr) As DWord
+Declare Function CreateThread Lib "kernel32" (lpThreadAttributes As *SECURITY_ATTRIBUTES, dwStackSize As DWord, lpStartAddress As LPTHREAD_START_ROUTINE, pParameter As VoidPtr, dwCreationFlags As DWord, ByRef ThreadId As DWord) As HANDLE
+
+Declare Sub DebugBreak Lib "kernel32" ()
+Declare Sub DeleteCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION)
+Declare Function DeleteFile Lib "kernel32" Alias _FuncName_DeleteFile (pFileName As PCTSTR) As BOOL
+Declare Function DeviceIoControl Lib "Kernel32" (
+	hDevice As HANDLE,
+	dwIoControlCode As DWord,
+	pInBuffer As VoidPtr,
+	nInBufferSize As DWord,
+	pOutBuffer As VoidPtr,
+	nOutBufferSize As DWord,
+	pBytesReturned As DWordPtr,
+	pOverlapped As *OVERLAPPED
+) As Long
+Declare Function DisableThreadLibraryCalls Lib "kernel32" (hLibModule As HINSTANCE) As BOOL
+Declare Function DosDateTimeToFileTime Lib "kernel32" (wFatDate As Word, wFatTime As Word, ByRef FileTime As FILETIME) As BOOL
+Declare Function DuplicateHandle Lib "kernel32" (hSourceProcessHandle As HANDLE, hSourceHandle As HANDLE, hTargetProcessHandle As HANDLE, ByRef TargetHandle As HANDLE, dwDesiredAccess As DWord, bInheritHandle As BOOL, dwOptions As DWord) As BOOL
+Declare Sub EnterCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION)
+Declare Sub ExitProcess Lib "kernel32" (dwExitCode As DWord)
+Declare Sub ExitThread Lib "kernel32" (dwExitCode As DWord)
+Declare Sub FatalAppExit Lib "kernel32" Alias _FuncName_FatalAppExit (Action As DWord, pMessageText As PCTSTR)
+Declare Function FileTimeToDosDateTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpFatDate As Word, ByRef lpFatTime As Word) As BOOL
+Declare Function FileTimeToLocalFileTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpLocalFileTime As FILETIME) As BOOL
+Declare Function FileTimeToSystemTime Lib "kernel32" (ByRef lpFileTime As FILETIME, ByRef lpSystemTime As SYSTEMTIME) As BOOL
+Declare Sub FillMemory Lib "kernel32" Alias "RtlFillMemory" (pDest As VoidPtr, stLength As SIZE_T, c As Byte)
+Declare Function FindClose Lib "kernel32" (hFindFile As HANDLE) As BOOL
+Declare Function FindCloseChangeNotification Lib "kernel32" (hChangeHandle As HANDLE) As BOOL
+Declare Function FindFirstChangeNotification Lib "kernel32" Alias _FuncName_FindFirstChangeNotification (
+	pPathName As PCTSTR,
+	bWatchSubtree As BOOL,
+	dwNotifyFilter As DWord
+) As HANDLE
+
+Type WIN32_FIND_DATAW
+	dwFileAttributes As DWord
+	ftCreationTime As FILETIME
+	ftLastAccessTime As FILETIME
+	ftLastWriteTime As FILETIME
+	nFileSizeHigh As DWord
+	nFileSizeLow As DWord
+	dwReserved0 As DWord
+	dwReserved1 As DWord
+	cFileName[ELM(MAX_PATH)] As WCHAR
+	cAlternateFileName[13] As WCHAR
+End Type
+Type WIN32_FIND_DATAA
+	dwFileAttributes As DWord
+	ftCreationTime As FILETIME
+	ftLastAccessTime As FILETIME
+	ftLastWriteTime As FILETIME
+	nFileSizeHigh As DWord
+	nFileSizeLow As DWord
+	dwReserved0 As DWord
+	dwReserved1 As DWord
+	cFileName[ELM(MAX_PATH)] As SByte
+	cAlternateFileName[13] As SByte
+End Type
+#ifdef UNICODE
+TypeDef WIN32_FIND_DATA = WIN32_FIND_DATAW
+#else
+TypeDef WIN32_FIND_DATA = WIN32_FIND_DATAA
+#endif
+TypeDef LPWIN32_FIND_DATA = *WIN32_FIND_DATA
+Declare Function FindFirstFile Lib "kernel32" Alias _FuncName_FindFirstFile (pFileName As PCTSTR, ByRef FindFildData As WIN32_FIND_DATA) As HANDLE
+Declare Function FindNextChangeNotification Lib "kernel32" (hChangeHandle As HANDLE) As BOOL
+Declare Function FindNextFile Lib "kernel32" Alias _FuncName_FindNextFile (hFindFile As HANDLE, ByRef FindFildData As WIN32_FIND_DATA) As BOOL
+Declare Function FlushFileBuffers Lib "kernel32" (hFile As HANDLE) As BOOL
+Declare Function FlushInstructionCache Lib "kernel32"(hProcess As HANDLE, pBaseAddress As VoidPtr, Size As SIZE_T) As BOOL
+
+Const FORMAT_MESSAGE_ALLOCATE_BUFFER = &H00000100
+Const FORMAT_MESSAGE_IGNORE_INSERTS =  &H00000200
+Const FORMAT_MESSAGE_FROM_STRING =     &H00000400
+Const FORMAT_MESSAGE_FROM_HMODULE =    &H00000800
+Const FORMAT_MESSAGE_FROM_SYSTEM =     &H00001000
+Const FORMAT_MESSAGE_ARGUMENT_ARRAY =  &H00002000
+Declare Function FormatMessage Lib "kernel32" Alias _FuncName_FormatMessage (dwFlags As DWord, lpSource As VoidPtr, dwMessageId As DWord, dwLanguageId As DWord, pBuffer As PTSTR, nSize As DWord, Arguments As *DWord) As DWord
+Declare Function FreeEnvironmentStrings Lib "kernel32" Alias _FuncName_FreeEnvironmentStrings (pszEnvironmentBlock As PCTSTR) As BOOL
+Declare Function FreeLibrary Lib "kernel32" (hLibModule As HINSTANCE) As BOOL
+Declare Sub FreeLibraryAndExitThread Lib "kernel32" (hModule As HANDLE, dwExitCode As DWord)
+Declare Function GetCommandLineA Lib "kernel32" () As PCSTR
+Declare Function GetCommandLineW Lib "kernel32" () As PCWSTR
+#ifdef UNICODE
+Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineW" () As PCWSTR
+#else
+Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As PCSTR
+#endif
+Declare Function GetCompressedFileSize Lib "kernel32" Alias _FuncName_GetCompressedFileSize (pFileName As PCTSTR, ByRef FileSizeHigh As DWord) As DWord
+
+Const MAX_COMPUTERNAME_LENGTH = 15
+Declare Function GetComputerName Lib "kernel32" Alias _FuncName_GetComputerName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL
+
+Declare Function GetCurrentDirectory Lib "kernel32" Alias _FuncName_GetCurrentDirectory (nBufferLength As DWord, pBuffer As PTSTR) As DWord
+Declare Function GetCurrentProcess Lib "kernel32" () As HANDLE
+Declare Function GetCurrentProcessId Lib "kernel32" () As DWord
+Declare Function GetCurrentThread Lib "kernel32" () As HANDLE
+Declare Function GetCurrentThreadId Lib "kernel32" () As DWord
+
+Const DATE_SHORTDATE =        &H00000001
+Const DATE_LONGDATE =         &H00000002
+Const DATE_USE_ALT_CALENDAR = &H00000004
+Declare Function GetDateFormat Lib "kernel32" Alias _FuncName_GetDateFormat (Locale As LCID, dwFlags As DWord, ByRef Date As SYSTEMTIME, pFormat As PCTSTR, pDateStr As PTSTR, cchDate As Long) As Long
+
+Declare Function GetDiskFreeSpace Lib "kernel32" Alias _FuncName_GetDiskFreeSpace (pRootPathName As PCTSTR, lpSectorsPerCluster As *DWord, pBytesPerSector As *DWord, pNumberOfFreeClusters As *DWord, pTotalNumberOfClusters As *DWord) As BOOL
+Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias _FuncName_GetDiskFreeSpaceEx (pDirectoryName As PCTSTR, ByRef lpFreeBytesAvailableToCaller As ULARGE_INTEGER, ByRef TotalNumberOfBytes As ULARGE_INTEGER, ByRef TotalNumberOfFreeBytes As ULARGE_INTEGER) As BOOL
+
+Const DRIVE_UNKNOWN =     0
+Const DRIVE_NO_ROOT_DIR = 1
+Const DRIVE_REMOVABLE =   2
+Const DRIVE_FIXED =       3
+Const DRIVE_REMOTE =      4
+Const DRIVE_CDROM =       5
+Const DRIVE_RAMDISK =     6
+Declare Function GetVolumeInformation Lib "kernel32" Alias _FuncName_GetVolumeInformation (pRootPathName As PCTSTR, pVolumeNameBuffer As PTSTR, nVolumeNameSize As DWord, lpVolumeSerialNumber As *Word, lpMaximumComponentLength As *Word, lpFileSystemFlags As *Word, pFileSystemNameBuffer As PTSTR, nFileSystemNameSize As DWord) As BOOL
+Declare Function GetDriveType Lib "kernel32" Alias _FuncName_GetDriveType (lpRootPathName As PCTSTR) As DWord
+
+Declare Function GetEnvironmentVariable Lib "kernel32" Alias _FuncName_GetEnvironmentVariable (lpName As PCTSTR, lpBuffer As PTSTR, nSize As DWord) As DWord
+Declare Function GetEnvironmentStrings Lib "kernel32" Alias _FuncName_GetEnvironmentStrings () As VoidPtr
+Const STILL_ACTIVE = &H00000103
+Declare Function GetExitCodeProcess Lib "kernel32" (hProcess As HANDLE, ByRef lpExitCode As DWord) As BOOL
+Declare Function GetExitCodeThread Lib "kernel32" (hThread As HANDLE, ByRef lpExitCode As DWord) As BOOL
+
+Declare Function GetFileAttributes Lib "kernel32" Alias _FuncName_GetFileAttributes (lpFileName As PCTSTR) As DWord
+Type BY_HANDLE_FILE_INFORMATION
+	dwFileAttributes As DWord
+	ftCreationTime As FILETIME
+	ftLastAccessTime As FILETIME
+	ftLastWriteTime As FILETIME
+	dwVolumeSerialNumber As DWord
+	nFileSizeHigh As DWord
+	nFileSizeLow As DWord
+	nNumberOfLinks As DWord
+	nFileIndexHigh As DWord
+	nFileIndexLow As DWord
+End Type
+Declare Function GetFileInformationByHandle Lib "kernel32" (
+    ByVal hFile As HANDLE,
+    ByRef FileInformation As BY_HANDLE_FILE_INFORMATION
+) As BOOL
+Declare Function GetFileSize Lib "kernel32" (hFile As HANDLE, pFileSizeHigh As *DWord) As DWord
+Declare Function GetFileSizeEx Lib "kernel32" (hFile As HANDLE, pFileSizeHigh As *QWord) As Boolean
+Declare Function GetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL
+
+Const FILE_TYPE_UNKNOWN = &H0000
+Const FILE_TYPE_DISK =    &H0001
+Const FILE_TYPE_CHAR =    &H0002
+Const FILE_TYPE_PIPE =    &H0003
+Const FILE_TYPE_REMOTE =  &H8000
+Declare Function GetFileType Lib "kernel32" (hFile As HANDLE) As DWord
+
+Declare Function GetFullPathName Lib "kernel32" Alias _FuncName_GetFullPathName (lpFileName As PCSTR, nBufferLength As DWord, pBuffer As PSTR, lpFilePart As *DWord) As DWord
+Declare Function GetLastError Lib "kernel32" () As DWord
+Declare Sub GetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME)
+Declare Function GetLogicalDrives Lib "kernel32" () As DWord
+Declare Function GetLogicalDriveStrings Lib "kernel32" Alias _FuncName_GetLogicalDriveStrings (nBufferLength As DWord, pBuffer As PTSTR) As DWord
+Declare Function GetLongPathName Lib "kernel32" Alias _FuncName_GetLongPathName (lpszShortPath As LPCTSTR, lpszLongPath As LPTSTR, cchBuffer As DWord) As DWord
+Declare Function GetModuleFileName Lib "kernel32" Alias _FuncName_GetModuleFileName (hModule As HINSTANCE, lpFileName As PTSTR, nSize As DWord) As DWord
+Declare Function GetModuleHandle Lib "kernel32" Alias _FuncName_GetModuleHandle (lpModuleName As PTSTR) As HINSTANCE
+Declare Function GetOverlappedResult Lib "kernel32" (
+	hFile As HANDLE,
+	ByRef Overlapped As OVERLAPPED,
+	ByRef pNumberOfBytesTransferred As DWord,
+	bWait As BOOL
+) As BOOL
+Type SYSTEM_POWER_STATUS
+	ACLineStatus As Byte
+	BatteryFlag As Byte
+	BatteryLifePercent As Byte
+	Reserved1 As Byte
+	BatteryLifeTime As Long
+	BatteryFullLifeTime As Long
+End Type
+Declare Function GetSystemPowerStatus Lib "kernel32" (ByRef SystemPowerStatus As SYSTEM_POWER_STATUS) As Long
+Declare Function GetPriorityClass Lib "kernel32" (hProcess As HANDLE) As DWord
+Declare Function GetProcAddress Lib "kernel32" (hModule As HINSTANCE, pProcName As PCSTR) As DWord
+Declare Function GetProcessAffinityMask Lib "kernel32" (
+	hProcess As HANDLE,
+	ByRef ProcessAffinityMask As ULONG_PTR,
+	ByRef SystemAffinityMask As ULONG_PTR
+) As BOOL
+Declare Function GetProcessHeap Lib "kernel32" () As HANDLE
+Declare Function GetShortPathName Lib "kernel32" Alias _FuncName_GetShortPathName (
+	pszLongPath As PCTSTR,
+	pszShortPath As PTSTR,
+	cchBuffer As DWord
+) As DWord
+
+Declare Sub GetStartupInfo Lib "kernel32" Alias _FuncName_GetStartupInfo (ByRef StartupInfo As STARTUPINFO)
+
+Const STD_INPUT_HANDLE  = -10
+Const STD_OUTPUT_HANDLE = -11
+Const STD_ERROR_HANDLE  = -12
+Declare Function GetStdHandle Lib "kernel32" (nStdHandle As DWord) As HANDLE
+
+Declare Function GetSystemDirectory Lib "kernel32" Alias _FuncName_GetSystemDirectory (pBuffer As PTSTR, uSize As DWord) As DWord
+
+Type SYSTEM_INFO
+	dwOemId As DWord
+	dwPageSize As DWord
+	lpMinimumApplicationAddress As VoidPtr
+	lpMaximumApplicationAddress As VoidPtr
+	dwActiveProcessorMask As ULONG_PTR
+	dwNumberOfProcessors As DWord
+	dwProcessorType As DWord
+	dwAllocationGranularity As DWord
+	wProcessorLevel As Word
+	wProcessorRevision As Word
+End Type
+Declare Sub GetSystemInfo Lib "kernel32" (ByRef SystemInfo As SYSTEM_INFO)
+
+Declare Sub GetSystemTime Lib "kernel32" (ByRef SystemTime As SYSTEMTIME)
+Declare Sub GetSystemTimeAsFileTime Lib "kernel32" (ByRef SystemTimeAsFileTime As FILETIME)
+
+Declare Function GetTempFileName Lib "kernel32" Alias _FuncName_GetTempFileName (
+	pPathName As PCTSTR,
+	pPrefixString As PCTSTR,
+	uUnique As DWord,
+	pTempFileName As PTSTR
+) As DWord
+Declare Function GetTempPath Lib "kernel32" Alias _FuncName_GetTempPath (nBufferLength As DWord, lpBuffer As PTSTR) As DWord
+Declare Function GetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL
+/*
+Const THREAD_PRIORITY_LOWEST =        THREAD_BASE_PRIORITY_MIN
+Const THREAD_PRIORITY_BELOW_NORMAL =  THREAD_PRIORITY_LOWEST+1
+Const THREAD_PRIORITY_NORMAL =        0
+Const THREAD_PRIORITY_HIGHEST =       THREAD_BASE_PRIORITY_MAX
+Const THREAD_PRIORITY_ABOVE_NORMAL =  THREAD_PRIORITY_HIGHEST-1
+Const THREAD_PRIORITY_ERROR_RETURN =  LONG_MAX
+Const THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
+Const THREAD_PRIORITY_IDLE =          THREAD_BASE_PRIORITY_IDLE
+*/
+Declare Function GetThreadPriority Lib "kernel32" (hThread As HANDLE) As Long
+Declare Function GetThreadPriorityBoost Lib "kernel32" (
+	hThread As HANDLE,
+	ByRef pDisablePriorityBoost As BOOL) As BOOL
+Declare Function GetTickCount Lib "kernel32" () As DWord
+
+Const TIME_NOMINUTESORSECONDS  = &H00000001
+Const TIME_NOSECONDS           = &H00000002
+Const TIME_NOTIMEMARKER        = &H00000004
+Const TIME_FORCE24HOURFORMAT   = &H00000008
+Declare Function GetTimeFormat Lib "kernel32" Alias _FuncName_GetTimeFormat (Locale As LCID, dwFlags As DWord, ByRef Time As SYSTEMTIME, lpFormat As PCTSTR, lpTimeStr As PTSTR, cchTime As DWord) As BOOL
+Declare Function GetUserDefaultLCID Lib "kernel32" () As LCID
+Declare Function GetUserName Lib "advapi32" Alias _FuncName_GetUserName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL
+Declare Function GetVersionEx Lib "kernel32" Alias _FuncName_GetVersionEx (ByRef VersionInformation As OSVERSIONINFO) As BOOL
+Declare Function GetWindowsDirectory Lib "kernel32" Alias _FuncName_GetWindowsDirectory (pBuffer As PTSTR, uSize As DWord) As DWord
+Declare Function GlobalAlloc Lib "kernel32" (uFlags As DWord, dwBytes As SIZE_T) As HGLOBAL
+Declare Function GlobalFrags Lib "kernel32" (hMem As HGLOBAL) As DWord
+Declare Function GlobalFree Lib "kernel32" (hMem As HGLOBAL) As HGLOBAL
+Declare Function GlobalHandle Lib "kernel32" (pMem As VoidPtr) As HGLOBAL
+Declare Function GlobalLock Lib "kernel32" (hMem As HGLOBAL) As VoidPtr
+
+Type MEMORYSTATUS
+	dwLength As DWord
+	dwMemoryLoad As DWord
+	dwTotalPhys As SIZE_T
+	dwAvailPhys As SIZE_T
+	dwTotalPageFile As SIZE_T
+	dwAvailPageFile As SIZE_T
+	dwTotalVirtual As SIZE_T
+	dwAvailVirtual As SIZE_T
+End Type
+Declare Sub GlobalMemoryStatus Lib "kernel32" (ByRef lpMemStatus As MEMORYSTATUS)
+
+Declare Function GlobalReAlloc Lib "kernel32" (hMem As HGLOBAL, dwBytes As SIZE_T, uFlags As DWord) As HGLOBAL
+Declare Function GlobalSize Lib "kernel32" (hMem As HGLOBAL) As SIZE_T
+Declare Function GlobalUnlock Lib "kernel32" (hMem As HGLOBAL) As BOOL
+Declare Function HeapAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, dwBytes As SIZE_T) As VoidPtr
+Declare Function HeapCreate Lib "kernel32" (flOptions As DWord, dwInitialSize As SIZE_T, dwMaximumSize As SIZE_T) As HANDLE
+Declare Function HeapDestroy Lib "kernel32" (hHeap As HANDLE) As Long
+Declare Function HeapFree Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As Long
+Declare Function HeapReAlloc Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr, dwBytes As SIZE_T) As VoidPtr
+Declare Function HeapSize Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As SIZE_T
+Declare Function HeapValidate Lib "kernel32" (hHeap As HANDLE, dwFlags As DWord, lpMem As VoidPtr) As BOOL
+Declare Sub InitializeCriticalSection Lib "kernel32" (ByRef CriticalSection As CRITICAL_SECTION)
+Declare Function IsBadReadPtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL
+Declare Function IsBadWritePtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL
+Declare Function IsDBCSLeadByte Lib "kernel32" (TestChar As Byte) As BOOL
+
+#ifdef _WIN64
+Declare Function IsWow64Process Lib "kernel32" (hProcess As HANDLE, ByRef bWow64Process As BOOL) As BOOL
+#endif
+
+Const LCMAP_LOWERCASE           = &H00000100  ' lower case letters
+Const LCMAP_UPPERCASE           = &H00000200  ' upper case letters
+Const LCMAP_SORTKEY             = &H00000400  ' WC sort key (normalize)
+Const LCMAP_BYTEREV             = &H00000800  ' byte reversal
+Const LCMAP_HIRAGANA            = &H00100000  ' map katakana to hiragana
+Const LCMAP_KATAKANA            = &H00200000  ' map hiragana to katakana
+Const LCMAP_HALFWIDTH           = &H00400000  ' map double byte to single byte
+Const LCMAP_FULLWIDTH           = &H00800000  ' map single byte to double byte
+Const LCMAP_LINGUISTIC_CASING   = &H01000000  ' use linguistic rules for casing
+Const LCMAP_SIMPLIFIED_CHINESE  = &H02000000  ' map traditional chinese to simplified chinese
+Const LCMAP_TRADITIONAL_CHINESE = &H04000000  ' map simplified chinese to traditional chinese
+Declare Function LCMapString Lib "kernel32" Alias _FuncName_LCMapString (Locale As LCID, dwMapFlags As DWord, lpSrcStr As LPCTSTR, cchSrc As Long, lpDestStr As LPTSTR, cchDest As Long) As Long
+
+Declare Sub LeaveCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION)
+Declare Function LocalAlloc Lib "kernel32" (uFlags As DWord, uBytes As SIZE_T) As HLOCAL
+Declare Function LocalFileTimeToFileTime Lib "kernel32" (ByRef lpLocalFileTime As FILETIME, ByRef lpFileTime As FILETIME) As BOOL
+Declare Function LocalFree Lib "kernel32" (hMem As HLOCAL) As HLOCAL
+Declare Function LocalHandle Lib "kernel32" (pMem As VoidPtr) As HLOCAL
+Declare Function LocalLock Lib "kernel32" (hMem As HLOCAL) As VoidPtr
+Declare Function LocalReAlloc Lib "kernel32" (hMem As HLOCAL, dwBytes As SIZE_T, uFlags As DWord) As HLOCAL
+Declare Function LocalSize Lib "kernel32" (hMem As HLOCAL) As SIZE_T
+Declare Function LocalUnlock Lib "kernel32" (hMem As HLOCAL) As BOOL
+Declare Function LockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToLockLow As DWord, nNumberOfBytesToLockHigh As DWord) As BOOL
+Declare Function LoadLibrary Lib "kernel32" Alias _FuncName_LoadLibrary (pLibFileName As PCTSTR) As HINSTANCE
+
+Const DONT_RESOLVE_DLL_REFERENCES   = &h00000001
+Const LOAD_LIBRARY_AS_DATAFILE      = &h00000002
+Const LOAD_WITH_ALTERED_SEARCH_PATH = &h00000008
+Const LOAD_IGNORE_CODE_AUTHZ_LEVEL  = &h00000010
+Declare Function LoadLibraryEx Lib "kernel32" Alias _FuncName_LoadLibraryEx (pLibFileName As PCTSTR, hFile As HANDLE, dwFlags As DWord) As HINSTANCE
+
+Declare Function lstrcat Lib "kernel32" Alias _FuncName_lstrcat (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR
+Declare Function lstrcmp Lib "kernel32" Alias _FuncName_lstrcmp (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long
+Declare Function lstrcmpi Lib "kernel32" Alias _FuncName_lstrcmpi (lpString1 As LPCTSTR, lpString2 As LPCTSTR) As Long
+Declare Function lstrcpy Lib "kernel32" Alias _FuncName_lstrcpy (lpString1 As LPTSTR, lpString2 As LPCTSTR) As LPTSTR
+Declare Function lstrcpyn Lib "kernel32" Alias _FuncName_lstrcpyn (lpString1 As LPTSTR,ByVal lpString2 As LPCTSTR,ByVal iMaxLength As Long) As LPTSTR
+Declare Function lstrlenA Lib "kernel32" (lpString As LPCSTR) As Long
+Declare Function lstrlenW Lib "kernel32" (lpString As LPCWSTR) As Long
+#ifdef UNICODE
+Declare Function lstrlen Lib "kernel32" Alias "lstrlenW" (lpString As LPCWSTR) As Long
+#else
+Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (lpString As LPCSTR) As Long
+#endif
+Declare Sub memcpy Lib "kernel32" Alias "RtlMoveMemory" (pDest As VoidPtr, pSrc As VoidPtr, length As SIZE_T)
+Declare Function MoveFile Lib "kernel32" Alias _FuncName_MoveFile (lpExistingFileName As LPCTSTR, lpNewFileName As LPCTSTR) As BOOL
+Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As PVOID, pSrc As VoidPtr, length As SIZE_T)
+
+Declare Function MulDiv Lib "kernel32" (
+	nNumber As Long,
+	nNumerator As Long,
+	nDenominator As Long
+) As Long
+
+Const CP_ACP        = 0      'default to ANSI code page
+Const CP_OEMCP      = 1      'default to OEM  code page
+Const CP_MACCP      = 2      'default to MAC  code page
+Const CP_THREAD_ACP = 3      'current thread's ANSI code page
+Const CP_SYMBOL     = 42     'SYMBOL translations
+Const CP_UTF7       = 65000  'UTF-7 translation
+Const CP_UTF8       = 65001  'UTF-8 translation
+
+Declare Function MultiByteToWideChar Lib "kernel32" (CodePage As DWord, dwFlags As DWord, pMultiByteStr As PCSTR, cchMultiByte As Long, pWideCharStr As PWSTR, cchWideChar As Long) As Long
+Declare Function OpenEvent Lib "kernel32" Alias _FuncName_OpenEvent (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
+Declare Function OpenMutex Lib "kernel32" Alias _FuncName_OpenMutex (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
+Declare Function OpenSemaphore Lib "kernel32" Alias _FuncName_OpenSemaphore (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE
+Declare Function OpenProcess Lib "kernel32" (dwDesiredAccess As DWord, bInheritHandle As Long, dwProcessId As DWord) As HANDLE
+Declare Sub OutputDebugStringA Lib "kernel32" (pOutputString As PCSTR)
+Declare Sub OutputDebugStringW Lib "kernel32" (pOutputString As PCWSTR)
+#ifdef UNICODE
+Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringW" (pOutputString As PCWSTR)
+#else
+Declare Sub OutputDebugString Lib "kernel32" Alias "OutputDebugStringA" (pOutputString As PCSTR)
+#endif
+Declare Function PulseEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
+Declare Sub RaiseException Lib "kernel32" (
+	dwExceptionCode As DWord,
+	dwExceptionFlags As DWord,
+	NumberOfArguments As DWord,
+	pArguments As *ULONG_PTR)
+Declare Function ReadFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToRead As DWord, lpNumberOfBytesRead As *DWord, ByRef Overlapped As OVERLAPPED) As BOOL
+Declare Function ReadProcessMemory Lib "Kernel32"  (hProcess As HANDLE, lpBaseAddress As VoidPtr, lpBuffer As VoidPtr, nSize As SIZE_T, lpNumberOfBytesRead As *SIZE_T) As BOOL
+Declare Function ReleaseMutex Lib "kernel32" (hMutex As HANDLE) As BOOL
+Declare Function ReleaseSemaphore Lib "kernel32" (hSemaphore As HANDLE, lReleaseCount As Long, ByRef lpPreviousCount As Long) As BOOL
+Declare Function RemoveDirectory Lib "kernel32" Alias _FuncName_RemoveDirectory (lpPathName As LPCTSTR) As BOOL
+Declare Function ResetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
+Declare Function ResumeThread Lib "kernel32" (hThread As HANDLE) As DWord
+Declare Function SetComputerName Lib "kernel32" Alias _FuncName_SetComputerName (lpComputerName As LPCTSTR) As BOOL
+Declare Function SetCurrentDirectory Lib "kernel32" Alias _FuncName_SetCurrentDirectory (lpPathName As LPCTSTR) As BOOL
+Declare Function SearchPath Lib "kernel32" Alias _FuncName_SearchPath (pPath As PCSTR, pFileName As PCTSTR, pExtension As PCTSTR, BufferLength As DWord, pBuffer As PTSTR, ByRef pFilePart As PTSTR) As DWord
+Declare Function SetEndOfFile Lib "kernel32" (hFile As HANDLE) As BOOL
+Declare Function SetEnvironmentVariable Lib "kernel32" Alias _FuncName_SetEnvironmentVariable (lpName As LPCTSTR, lpValue As LPTSTR) As BOOL
+
+Const SEM_FAILCRITICALERRORS = &h0001
+Const SEM_NOGPFAULTERRORBOX = &h0002
+Const SEM_NOALIGNMENTFAULTEXCEPT = &h0004
+Const SEM_NOOPENFILEERRORBOX = &h8000
+Declare Function SetErrorMode Lib "kernel32" (uMode As DWord) As DWord
+Declare Function SetEvent Lib "kernel32" (hEvent As HANDLE) As BOOL
+Declare Function SetFileAttributes Lib "kernel32" Alias _FuncName_SetFileAttributes (lpFileName As LPCTSTR, dwFileAttributes As DWord) As BOOL
+
+Const FILE_BEGIN =   0
+Const FILE_CURRENT = 1
+Const FILE_END =     2
+Declare Function SetFilePointer Lib "kernel32" (hFile As HANDLE, lDistanceToMove As Long, lpDistanceToMoveHigh As DWordPtr, dwMoveMethod As DWord) As DWord
+
+Declare Function SetFileTime Lib "kernel32" (hFile As HANDLE, ByRef lpCreationTime As FILETIME, ByRef lpLastAccessTime As FILETIME, ByRef lpLastWriteTime As FILETIME) As BOOL
+Declare Sub SetLastError Lib "kernel32" (dwErrCode As DWord)
+Declare Sub SetLastErrorEx Lib "kernel32" (dwErrCode As DWord, dwType As DWord)
+Declare Function SetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) As BOOL
+Declare Function SetPriorityClass Lib "kernel32" (hProcess As HANDLE, dwPriorityClass As DWord) As BOOL
+Declare Function SetThreadContext Lib "kernel32" (hThread As HANDLE, ByRef Context As CONTEXT) As BOOL
+Declare Function SetThreadPriority Lib "kernel32" (hThread As HANDLE, nPriority As Long) As BOOL
+Declare Function SetThreadPriorityBoost Lib "kernel32" (
+	hThread As HANDLE,
+	DisablePriorityBoost As BOOL
+) As BOOL
+
+TypeDef PTOP_LEVEL_EXCEPTION_FILTER = *Function(ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
+
+Declare Function SetUnhandledExceptionFilter Lib "kernel32" (pTopLevelExceptionFilter As PTOP_LEVEL_EXCEPTION_FILTER) As PTOP_LEVEL_EXCEPTION_FILTER
+
+Const INFINITE = &HFFFFFFFF
+Declare Sub Sleep Lib "kernel32" (dwMilliseconds As DWord)
+Declare Function SleepEx Lib "kernel32" (dwMilliseconds As DWord, bAlertable As BOOL) As DWord
+
+Declare Function SuspendThread Lib "kernel32" (hThread As HANDLE) As DWord
+Declare Function SystemTimeToFileTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME, ByRef lpFileTime As FILETIME) As BOOL
+Declare Function TerminateProcess Lib "kernel32" (hProcess As HANDLE, dwExitCode As DWord) As BOOL
+Declare Function TerminateThread Lib "kernel32" (hThread As HANDLE, dwExitCode As DWord) As BOOL
+Declare Function TlsAlloc Lib "kernel32" () As DWord
+Declare Function TlsFree Lib "kernel32" (dwTlsIndex As DWord) As BOOL
+Declare Function TlsGetValue Lib "kernel32" (dwTlsIndex As DWord) As VoidPtr
+Declare Function TlsSetValue Lib "kernel32" (dwTlsIndex As DWord, pTlsValue As VoidPtr) As BOOL
+Declare Function UnlockFile Lib "kernel32" (hFile As HANDLE, dwFileOffsetLow As DWord, dwFileOffsetHigh As DWord, nNumberOfBytesToUnlockLow As DWord, nNumberOfBytesToUnlockHigh As DWord) As BOOL
+Declare Function UnhandledExceptionFilter Lib "kernel32" (ByRef ExceptionInfo As EXCEPTION_POINTERS) As Long
+Declare Function VirtualAlloc Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, flAllocationType As DWord, flProtect As DWord) As VoidPtr
+Declare Function VirtualFree Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T, dwFreeType As DWord) As BOOL
+Declare Function VirtualLock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL
+Declare Function VirtualProtect Lib "kernel32" (
+	pAddress As VoidPtr,
+	Size As SIZE_T,
+	flNewProtect As DWord,
+	ByRef flOldProtect As DWord
+) As BOOL
+Declare Function VirtualProtectEx Lib "kernel32" (
+	hProcess As HANDLE,
+	pAddress As VoidPtr,
+	Size As SIZE_T,
+	flNewProtect As DWord,
+	ByRef flOldProtect As DWord
+) As BOOL
+Declare Function VirtualQuery Lib "kernel32" (
+	pAddress As VoidPtr,
+	ByRef mbi As MEMORY_BASIC_INFORMATION,
+	Length As SIZE_T
+) As SIZE_T
+Declare Function VirtualQueryEx Lib "kernel32" (
+	hProcess As HANDLE,
+	pAddress As VoidPtr,
+	ByRef mbi As MEMORY_BASIC_INFORMATION,
+	Length As SIZE_T
+) As SIZE_T
+Declare Function VirtualUnlock Lib "kernel32" (lpAddress As VoidPtr, dwSize As SIZE_T) As BOOL
+Declare Function WaitForMultipleObjects Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord) As DWord
+Declare Function WaitForMultipleObjectsEx Lib "kernel32" (nCount As DWord, pHandles As *HANDLE, fWaitAll As BOOL, dwMilliseconds As DWord, bAlertable As BOOL) As DWord
+Declare Function WaitForSingleObject Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord) As DWord
+Declare Function WaitForSingleObjectEx Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord, bAlertable As BOOL) As DWord
+
+Const WC_COMPOSITECHECK    = &H00000200
+Const WC_DISCARDNS         = &H00000010
+Const WC_SEPCHARS          = &H00000020
+Const WC_DEFAULTCHAR       = &H00000040
+Const WC_NO_BEST_FIT_CHARS = &H00000400
+Declare Function WideCharToMultiByte Lib "Kernel32" (
+	CodePage As DWord,
+	dwFlags As DWord,
+	pWideCharStr As PCWSTR,
+	cchWideChar As Long,
+	pMultiByteStr As PSTR,
+	cbMultiByte As Long,
+	pDefaultChar As PCSTR,
+	pUsedDefaultChar As *BOOL
+) As Long
+
+Declare Function WriteFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToWrite As DWord, lpNumberOfBytesWritten As *DWord, ByRef pOverlapped As OVERLAPPED) As BOOL
+Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As VoidPtr, dwLength As DWord)
+
+'
+'  Wait functions' results.
+'
+Const WAIT_FAILED = (&hFFFFFFFF As DWord)
+Const WAIT_OBJECT_0 = ((STATUS_WAIT_0 ) + 0)
+
+Const WAIT_ABANDONED = ((STATUS_ABANDONED_WAIT_0 ) + 0)
+Const WAIT_ABANDONED_0 = ((STATUS_ABANDONED_WAIT_0 ) + 0)
+
+Const WAIT_IO_COMPLETION = STATUS_USER_APC
+
+Declare Function FindResource Lib "kernel32" Alias _FuncName_FindResource (hInstance As HINSTANCE, lpName As LPCTSTR, lpType As LPCTSTR) As HRSRC
+Declare Function LoadResource Lib "kernel32" (hModule As HMODULE, hResInfo As HRSRC) As HGLOBAL
+Declare Function FreeResource Lib "kernel32" (hResData As HGLOBAL) As BOOL
+Declare Function LockResource Lib "kernel32" (hResData As HGLOBAL) As VoidPtr
+Declare Function SizeofResource Lib "kernel32" (hModule As HANDLE, hResInfo As HRSRC) As DWord
+
+Declare Function ExpandEnvironmentStrings Lib "kernel32" Alias _FuncName_ExpandEnvironmentStrings (lpSrc As LPCTSTR, lpDst As LPTSTR, nSize As DWord) As DWord
+
+Type DCB
+	DCBlength As DWord
+	BaudRate As DWord
+	fBitFields As DWord
+	wReserved As Word
+	XonLim As Word
+	XoffLim As Word
+	ByteSize As Byte
+	Parity As Byte
+	StopBits As Byte
+	XonChar As CHAR
+	XoffChar As CHAR
+	ErrorChar As CHAR
+	EofChar As CHAR
+	EvtChar As CHAR
+	wReserved1 As Word
+End Type
+
+Type COMMTIMEOUTS
+	ReadIntervalTimeout As DWord
+	ReadTotalTimeoutMultiplier As DWord
+	ReadTotalTimeoutConstant As DWord
+	WriteTotalTimeoutMultiplier As DWord
+	WriteTotalTimeoutConstant As DWord
+End Type
+Type COMSTAT
+ fCoBitFlds As Long 'See Comment in Win32API.Txt
+ cbInQue As DWord
+ cbOutQue As DWord
+End Type
+Declare Function SetCommState Lib "kernel32" (hCommDev As HANDLE, ByRef dcb As DCB) As BOOL
+Declare Function SetCommTimeouts Lib "kernel32" (hFile As HANDLE ,ByRef pCommTimeouts As COMMTIMEOUTS) As BOOL
+Declare Function ClearCommError Lib "kernel32" (hCommDevs As HANDLE, ByRef Errors As DWord, ByRef Stat As COMSTAT) As BOOL
+Declare Function EscapeCommFunction Lib "kernel32" (nCid As HANDLE, ByVal nFunc As DWord) As BOOL
+Declare Function GetCommModemStatus Lib "kernel32" (hFile As HANDLE, ByRef ModemStat As DWord) As BOOL
+Declare Function SetCommMask Lib "kernel32" (hFile As HANDLE, dwEvtMask As DWord) As BOOL
+Declare Function WaitCommEvent Lib "kernel32" (hFile As HANDLE, ByRef EvtMask As DWord, lpOverlapped As *OVERLAPPED)  As BOOL
+
+Declare Function OpenProcessToken Lib "advapi32" (ProcessHandle As HANDLE, DesiredAccess As DWord, ByRef TokenHandle As HANDLE) As BOOL
+Declare Function LookupPrivilegeValue Lib "advapi32" Alias _FuncName_LookupPrivilegeValue (lpSystemName As LPCTSTR, lpName As LPCTSTR, ByRef Luid As LUID) As Long
+Declare Function AdjustTokenPrivileges Lib "advapi32" (TokenHandle As Long, DisableAllPrivileges As Long,_
+	ByRef NewState As TOKEN_PRIVILEGES, BufferLength As Long,
+	ByRef PreviousState As TOKEN_PRIVILEGES, ByRef ReturnLength As Long) As Long
+
+Declare Function AddAtom Lib "kernel32" Alias _FuncName_AddAtom (lpString As LPCTSTR) As ATOM
+Declare Function DeleteAtom Lib "kernel32" (nAtom As ATOM) As ATOM
+Declare Function FindAtom Lib "kernel32" Alias _FuncName_AddAtom (lpString As LPCTSTR) As ATOM
+Declare Function GetAtomName Lib "kernel32" Alias _FuncName_GetAtomName (nAtom As ATOM, lpBuffer As LPCTSTR, nSize As Long) As DWord
+
+Declare Function GlobalAddAtom Lib "kernel32" Alias _FuncName_GlobalAddAtom (lpString As LPCTSTR) As ATOM
+Declare Function GlobalDeleteAtom Lib "kernel32" (a As ATOM) As ATOM
+Declare Function GlobalFindAtom Lib "kernel32" Alias _FuncName_GlobalAddAtom (lpString As LPCTSTR) As ATOM
+Declare Function GlobalGetAtomName Lib "kernel32" Alias _FuncName_GlobalGetAtomName (nAtom As ATOM, lpBuffer As LPCTSTR, nSize As Long) As DWord
+
+Declare Function InitAtomTable Lib "kernel32" (nSize As DWord) As BOOL
+
+Const MAXINTATOM = &hC000
+Const MAKEINTATOM(i) = (i As Word As ULONG_PTR As LPTSTR)
+Const INVALID_ATOM = 0 As ATOM
Index: /trunk/ab5.0/ablib/src/api_tlhelp32.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_tlhelp32.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_tlhelp32.sbp	(revision 506)
@@ -0,0 +1,132 @@
+' api_tlhelp32.sbp
+
+Const MAX_MODULE_NAME32 = 255
+
+
+
+'-----------------------
+' Shapshot function
+'-----------------------
+
+Const TH32CS_SNAPHEAPLIST = &H00000001
+Const TH32CS_SNAPPROCESS  = &H00000002
+Const TH32CS_SNAPTHREAD   = &H00000004
+Const TH32CS_SNAPMODULE   = &H00000008
+Const TH32CS_SNAPALL      = (TH32CS_SNAPHEAPLIST or TH32CS_SNAPPROCESS or TH32CS_SNAPTHREAD or TH32CS_SNAPMODULE)
+Const TH32CS_INHERIT      = &H80000000
+Declare Function CreateToolhelp32Snapshot Lib "kernel32" (dwFlags As DWord, th32ProcessID As DWord) As HANDLE
+
+
+
+'-----------------------
+' heap walking
+'-----------------------
+
+Type HEAPLIST32
+	dwSize As DWord
+	th32ProcessID As DWord
+	th32HeapID As DWord
+	dwFlags As DWord
+End Type
+TypeDef PHEAPLIST32 = *HEAPLIST32
+TypeDef LPHEAPLIST32 = *HEAPLIST32
+
+'dwFlags
+Const HF32_DEFAULT  =    1  ' process's default heap
+Const HF32_SHARED   =    2  ' is shared heap
+
+Declare Function Heap32ListFirst Lib "kernel32" (hSnapshot As HANDLE, ByRef hi As HEAPLIST32) As BOOL
+Declare Function Heap32ListNext Lib "kernel32" (hSnapshot As HANDLE, ByRef hi As HEAPLIST32) As BOOL
+
+Type HEAPENTRY32
+	dwSize As DWord
+	hHandle As DWord
+	dwAddress As DWord
+	dwBlockSize As DWord
+	dwFlags As DWord
+	dwLockCount As DWord
+	dwResvd As DWord
+	th32ProcessID As DWord
+	th32HeapID As DWord
+End Type
+TypeDef PHEAPENTRY32 = *HEAPENTRY32
+TypeDef LPHEAPENTRY32 = *HEAPENTRY32
+
+'dwFlags
+Const LF32_FIXED    = &H00000001
+Const LF32_FREE     = &H00000002
+Const LF32_MOVEABLE = &H00000004
+
+Declare Function Heap32First Lib "kernel32" (ByRef he As HEAPENTRY32, th32ProcessID As DWord, th32HeapID As DWord) As BOOL
+Declare Function Heap32Next Lib "kernel32" (ByRef he As HEAPENTRY32) As BOOL
+
+Declare Function Toolhelp32ReadProcessMemory Lib "kernel32" (th32ProcessID As DWord, lpBaseAddress As VoidPtr, lpBuffer As VoidPtr, cbRead As DWord, ByRef NumberOfBytesRead As DWord) As BOOL
+
+
+
+'-----------------------
+' Process walking
+'-----------------------
+
+Type PROCESSENTRY32
+	dwSize As DWord
+	cntUsage As DWord
+	th32ProcessID As DWord
+	th32DefaultHeapID As DWord
+	th32ModuleID As DWord
+	cntThreads As DWord
+	th32ParentProcessID As DWord
+	pcPriClassBase As Long
+	dwFlags As DWord
+	szExeFile[ELM(MAX_PATH)] As Byte
+End Type
+TypeDef PPROCESSENTRY32 = *PROCESSENTRY32
+TypeDef LPPROCESSENTRY32 = *PROCESSENTRY32
+
+Declare Function Process32First Lib "kernel32" (hSnapshot As HANDLE, ByRef pe As PROCESSENTRY32) As BOOL
+Declare Function Process32Next Lib "kernel32" (hSnapshot As HANDLE, ByRef pe As PROCESSENTRY32) As BOOL
+
+
+
+'-----------------------
+' Thread walking
+'-----------------------
+
+Type THREADENTRY32
+	dwSize As DWord
+	cntUsage As DWord
+	th32ThreadID As DWord
+	th32OwnerProcessID As DWord
+	tpBasePri As Long
+	tpDeltaPri As Long
+	dwFlags As DWord
+End Type
+TypeDef PTHREADENTRY32 = *THREADENTRY32
+TypeDef LPTHREADENTRY32 = *THREADENTRY32
+
+Declare Function Thread32First Lib "kernel32" (hSnapshot As HANDLE, ByRef te As THREADENTRY32) As BOOL
+Declare Function Thread32Next Lib "kernel32" (hSnapshot As HANDLE, ByRef te As THREADENTRY32) As BOOL
+
+
+
+'-----------------------
+' Module walking
+'-----------------------
+
+Type MODULEENTRY32
+	dwSize As DWord
+	th32ModuleID As DWord
+	th32ProcessID As DWord
+	GlblcntUsage As DWord
+	ProccntUsage As DWord
+	modBaseAddr As *Byte
+	modBaseSize As DWord
+	hModule As HANDLE
+	szModule[ELM(MAX_MODULE_NAME32 + 1)] As Byte
+	szExePath[ELM(MAX_PATH)] As Byte
+End Type
+TypeDef PMODULEENTRY32 = *MODULEENTRY32
+TypeDef LPMODULEENTRY32 = *MODULEENTRY32
+
+Declare Function Module32First Lib "kernel32" (hSnapshot As HANDLE, ByRef me As MODULEENTRY32) As BOOL
+Declare Function Module32Next Lib "kernel32" (hSnapshot As HANDLE, ByRef me As MODULEENTRY32) As BOOL
Index: /trunk/ab5.0/ablib/src/api_window.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_window.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_window.sbp	(revision 506)
@@ -0,0 +1,2128 @@
+' api_window.sbp - Window Control API
+
+'-------------
+' Window API Function Names
+#ifdef UNICODE
+Const _FuncName_CallWindowProc = "CallWindowProcW"
+Const _FuncName_CharLower = "CharLowerW"
+Const _FuncName_CharNext = "CharNextW"
+Const _FuncName_CharPrev = "CharPrevW"
+Const _FuncName_CharUpper = "CharUpperW"
+Const _FuncName_CreateAcceleratorTable = "CreateAcceleratorTableW"
+Const _FuncName_CreateWindowEx = "CreateWindowExW"
+Const _FuncName_DefDlgProc = "DefDlgProcW"
+Const _FuncName_DefWindowProc = "DefWindowProcW"
+Const _FuncName_DialogBoxIndirectParam = "DialogBoxIndirectParamW"
+Const _FuncName_DispatchMessage = "DispatchMessageW"
+Const _FuncName_DlgDirList = "DlgDirListW"
+Const _FuncName_DlgDirListComboBox = "DlgDirListComboBoxW"
+Const _FuncName_DlgDirSelectComboBoxEx = "DlgDirSelectComboBoxExW"
+Const _FuncName_DlgDirSelectEx = "DlgDirSelectExW"
+Const _FuncName_DrawText = "DrawTextW"
+Const _FuncName_DrawTextEx = "DrawTextExW"
+Const _FuncName_FindWindow = "FindWindowW"
+Const _FuncName_FindWindowEx = "FindWindowExW"
+Const _FuncName_GetClassInfoEx = "GetClassInfoExW"
+Const _FuncName_GetClassLong = "GetClassLongW"
+Const _FuncName_GetClassLongPtr = "GetClassLongPtrW"
+Const _FuncName_GetClassName = "GetClassNameW"
+Const _FuncName_GetClipboardFormatName = "GetClipboardFormatNameW"
+Const _FuncName_GetDlgItemText = "GetDlgItemTextW"
+Const _FuncName_GetMonitorInfo = "GetMonitorInfoW"
+Const _FuncName_GetMenuItemInfo = "GetMenuItemInfoW"
+Const _FuncName_GetMessage = "GetMessageW"
+Const _FuncName_GetProp = "GetPropW"
+Const _FuncName_GetWindowLong = "GetWindowLongW"
+Const _FuncName_GetWindowLongPtr = "GetWindowLongPtrW"
+Const _FuncName_GetWindowText = "GetWindowTextW"
+Const _FuncName_GetWindowTextLength = "GetWindowTextLengthW"
+Const _FuncName_GetWindowModuleFileName = "GetWindowModuleFileNameW"
+Const _FuncName_InsertMenuItem = "InsertMenuItemW"
+Const _FuncName_IsCharAlpha = "IsCharAlphaW"
+Const _FuncName_IsCharAlphaNumeric = "IsCharAlphaNumericW"
+Const _FuncName_IsCharLower = "IsCharLowerW"
+Const _FuncName_IsCharUpper = "IsCharUpperW"
+Const _FuncName_IsDialogMessage = "IsDialogMessageW"
+Const _FuncName_LoadBitmap = "LoadBitmapW"
+Const _FuncName_LoadCursor = "LoadCursorW"
+Const _FuncName_LoadCursorFromFile = "LoadCursorFromFileW"
+Const _FuncName_LoadIcon = "LoadIconW"
+Const _FuncName_LoadImage = "LoadImageW"
+Const _FuncName_LoadString = "LoadStringW"
+Const _FuncName_MapVirtualKey = "MapVirtualKeyW"
+Const _FuncName_PeekMessage = "PeekMessageW"
+Const _FuncName_PostMessage = "PostMessageW"
+Const _FuncName_PostThreadMessage = "PostThreadMessageW"
+Const _FuncName_RegisterClassEx = "RegisterClassExW"
+Const _FuncName_RegisterClipboardFormat = "RegisterClipboardFormatW"
+Const _FuncName_RegisterWindowMessage = "RegisterWindowMessageW"
+Const _FuncName_RemoveProp = "RemovePropW"
+Const _FuncName_SendDlgItemMessage = "SendDlgItemMessageW"
+Const _FuncName_SendMessage = "SendMessageW"
+Const _FuncName_SendNotifyMessage = "SendNotifyMessageW"
+Const _FuncName_SetDlgItemText = "SetDlgItemTextW"
+Const _FuncName_SetClassLong = "SetClassLongW"
+Const _FuncName_SetClassLongPtr = "SetClassLongPtrW"
+Const _FuncName_SetMenuItemInfo = "SetMenuItemInfoW"
+Const _FuncName_SetProp = "SetPropW"
+Const _FuncName_SetWindowLong = "SetWindowLongW"
+Const _FuncName_SetWindowLongPtr = "SetWindowLongPtrW"
+Const _FuncName_SetWindowText = "SetWindowTextW"
+Const _FuncName_SetWindowsHookEx = "SetWindowsHookExW"
+Const _FuncName_SystemParametersInfo = "SystemParametersInfoW"
+Const _FuncName_TranslateAccelerator = "TranslateAcceleratorW"
+Const _FuncName_UnregisterClass = "UnregisterClassW"
+Const _FuncName_wsprintf = "wsprintfW"
+Const _FuncName_wvsprintf = "wvsprintfW"
+Const _FuncName_ChangeDisplaySettings = "ChangeDisplaySettingsW"
+Const _FuncName_ChangeDisplaySettingsEx= "ChangeDisplaySettingsExW"
+Const _FuncName_EnumDisplaySettings= "EnumDisplaySettingsW"
+Const _FuncName_EnumDisplaySettingsEx= "EnumDisplaySettingsExW"
+Const _FuncName_EnumDisplayDevices= "EnumDisplayDevicesW"
+#else
+Const _FuncName_CallWindowProc = "CallWindowProcA"
+Const _FuncName_CharLower = "CharLowerA"
+Const _FuncName_CharNext = "CharNextA"
+Const _FuncName_CharPrev = "CharPrevA"
+Const _FuncName_CharUpper = "CharUpperA"
+Const _FuncName_CreateAcceleratorTable = "CreateAcceleratorTableA"
+Const _FuncName_CreateWindowEx = "CreateWindowExA"
+Const _FuncName_DefDlgProc = "DefDlgProcA"
+Const _FuncName_DefWindowProc = "DefWindowProcA"
+Const _FuncName_DialogBoxIndirectParam = "DialogBoxIndirectParamA"
+Const _FuncName_DispatchMessage = "DispatchMessageA"
+Const _FuncName_DlgDirList = "DlgDirListA"
+Const _FuncName_DlgDirListComboBox = "DlgDirListComboBoxA"
+Const _FuncName_DlgDirSelectComboBoxEx = "DlgDirSelectComboBoxExA"
+Const _FuncName_DlgDirSelectEx = "DlgDirSelectExA"
+Const _FuncName_DrawText = "DrawTextA"
+Const _FuncName_DrawTextEx = "DrawTextExA"
+Const _FuncName_FindWindow = "FindWindowA"
+Const _FuncName_FindWindowEx = "FindWindowExA"
+Const _FuncName_GetClassInfoEx = "GetClassInfoExA"
+Const _FuncName_GetClassLong = "GetClassLongA"
+Const _FuncName_GetClassLongPtr = "GetClassLongPtrA"
+Const _FuncName_GetClassName = "GetClassNameA"
+Const _FuncName_GetClipboardFormatName = "GetClipboardFormatNameA"
+Const _FuncName_GetDlgItemText = "GetDlgItemTextA"
+Const _FuncName_GetMenuItemInfo = "GetMenuItemInfoA"
+Const _FuncName_GetMessage = "GetMessageA"
+Const _FuncName_GetMonitorInfo = "GetMonitorInfoA"
+Const _FuncName_GetProp = "GetPropA"
+Const _FuncName_GetWindowLong = "GetWindowLongA"
+Const _FuncName_GetWindowLongPtr = "GetWindowLongPtrA"
+Const _FuncName_GetWindowText = "GetWindowTextA"
+Const _FuncName_GetWindowTextLength = "GetWindowTextLengthA"
+Const _FuncName_GetWindowModuleFileName = "GetWindowModuleFileNameA"
+Const _FuncName_InsertMenuItem = "InsertMenuItemA"
+Const _FuncName_IsCharAlpha = "IsCharAlphaA"
+Const _FuncName_IsCharAlphaNumeric = "IsCharAlphaNumericA"
+Const _FuncName_IsCharLower = "IsCharLowerA"
+Const _FuncName_IsCharUpper = "IsCharUpperA"
+Const _FuncName_IsDialogMessage = "IsDialogMessageA"
+Const _FuncName_LoadBitmap = "LoadBitmapA"
+Const _FuncName_LoadCursor = "LoadCursorA"
+Const _FuncName_LoadCursorFromFile = "LoadCursorFromFileA"
+Const _FuncName_LoadIcon = "LoadIconA"
+Const _FuncName_LoadImage = "LoadImageA"
+Const _FuncName_LoadString = "LoadStringA"
+Const _FuncName_MapVirtualKey = "MapVirtualKeyA"
+Const _FuncName_PeekMessage = "PeekMessageA"
+Const _FuncName_PostMessage = "PostMessageA"
+Const _FuncName_PostThreadMessage = "PostThreadMessageA"
+Const _FuncName_RegisterClassEx = "RegisterClassExA"
+Const _FuncName_RegisterClipboardFormat = "RegisterClipboardFormatA"
+Const _FuncName_RegisterWindowMessage = "RegisterWindowMessageA"
+Const _FuncName_RemoveProp = "RemovePropA"
+Const _FuncName_SendDlgItemMessage = "SendDlgItemMessageA"
+Const _FuncName_SendMessage = "SendMessageA"
+Const _FuncName_SendNotifyMessage = "SendNotifyMessageA"
+Const _FuncName_SetDlgItemText = "SetDlgItemTextA"
+Const _FuncName_SetClassLong = "SetClassLongA"
+Const _FuncName_SetClassLongPtr = "SetClassLongPtrA"
+Const _FuncName_SetMenuItemInfo = "SetMenuItemInfoA"
+Const _FuncName_SetProp = "SetPropA"
+Const _FuncName_SetWindowLong = "SetWindowLongA"
+Const _FuncName_SetWindowLongPtr = "SetWindowLongPtrA"
+Const _FuncName_SetWindowsHookEx = "SetWindowsHookExA"
+Const _FuncName_SetWindowText = "SetWindowTextA"
+Const _FuncName_SystemParametersInfo = "SystemParametersInfoA"
+Const _FuncName_TranslateAccelerator = "TranslateAcceleratorA"
+Const _FuncName_UnregisterClass = "UnregisterClassA"
+Const _FuncName_wsprintf = "wsprintfA"
+Const _FuncName_wvsprintf = "wvsprintfA"
+Const _FuncName_ChangeDisplaySettings = "ChangeDisplaySettingsA"
+Const _FuncName_ChangeDisplaySettingsEx= "ChangeDisplaySettingsExA"
+Const _FuncName_EnumDisplaySettings= "EnumDisplaySettingsA"
+Const _FuncName_EnumDisplaySettingsEx= "EnumDisplaySettingsExA"
+Const _FuncName_EnumDisplayDevices= "EnumDisplayDevicesA"
+#endif
+
+Type _System_DeclareHandle_HDWP:unused As DWord:End Type
+TypeDef HDWP = *_System_DeclareHandle_HDWP
+
+TypeDef WNDPROC = *Function(hwnd As HWND, msg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
+TypeDef DLGPROC = *Function(hwnd As HWND, msg As DWord, wParam As WPARAM, lParam As LPARAM) As LONG_PTR
+
+Type MSG
+	hwnd As HWND
+	message As DWord
+	wParam As WPARAM
+	lParam As LPARAM
+	time As DWord
+	pt As POINTAPI
+End Type
+
+Const IS_INTRESOURCE(_r) = ((((_r) As ULONG_PTR) >> 16) = 0)
+Const MAKEINTRESOURCEW(i) = ((((i) As Word) As ULONG_PTR) As PCWSTR)
+Const MAKEINTRESOURCEA(i) = ((((i) As Word) As ULONG_PTR) As PCSTR)
+Const MAKEINTRESOURCE(i) = ((((i) As Word) As ULONG_PTR) As PCTSTR)
+
+Const RT_CURSOR = MAKEINTRESOURCE(1)
+Const RT_BITMAP = MAKEINTRESOURCE(2)
+Const RT_ICON = MAKEINTRESOURCE(3)
+Const RT_MENU = MAKEINTRESOURCE(4)
+Const RT_DIALOG = MAKEINTRESOURCE(5)
+Const RT_STRING = MAKEINTRESOURCE(6)
+Const RT_FONTDIR = MAKEINTRESOURCE(7)
+Const RT_FONT = MAKEINTRESOURCE(8)
+Const RT_ACCELERATOR = MAKEINTRESOURCE(9)
+Const RT_RCDATA = MAKEINTRESOURCE(10)
+Const RT_MESSAGETABLE = MAKEINTRESOURCE(11)
+
+Const DIFFERENCE = 11
+Const RT_GROUP_CURSOR = MAKEINTRESOURCE((RT_CURSOR) As ULONG_PTR + DIFFERENCE)
+Const RT_GROUP_ICON = MAKEINTRESOURCE((RT_ICON) As ULONG_PTR + DIFFERENCE)
+Const RT_VERSION = MAKEINTRESOURCE(16)
+Const RT_DLGINCLUDE = MAKEINTRESOURCE(17)
+Const RT_PLUGPLAY = MAKEINTRESOURCE(19)
+Const RT_VXD = MAKEINTRESOURCE(20)
+Const RT_ANICURSOR = MAKEINTRESOURCE(21)
+Const RT_ANIICON = MAKEINTRESOURCE(22)
+Const RT_HTML = MAKEINTRESOURCE(23)
+Const RT_MANIFEST = MAKEINTRESOURCE(24)
+Const CREATEPROCESS_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE(1)
+Const ISOLATIONAWARE_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE(2)
+Const ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE(3)
+Const MINIMUM_RESERVED_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE(1)
+Const MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID = MAKEINTRESOURCE(16)
+
+TypeDef WNDENUMPROC = *Function(hwnd As HWND, lParam As LPARAM) As BOOL
+TypeDef HOOKPROC = *Function(code As Long, wParam As WPARAM, lParam As LPARAM) As LRESULT
+TypeDef MONITORENUMPROC = *Function(hm As HMONITOR, hdc As HDC, ByRef rc As RECT, dwData As LPARAM) As BOOL
+
+Const CS_VREDRAW =         &H0001
+Const CS_HREDRAW =         &H0002
+Const CS_DBLCLKS =         &H0008
+Const CS_OWNDC =           &H0020
+Const CS_CLASSDC =         &H0040
+Const CS_PARENTDC =        &H0080
+Const CS_NOCLOSE =         &H0200
+Const CS_SAVEBITS =        &H0800
+Const CS_BYTEALIGNCLIENT = &H1000
+Const CS_BYTEALIGNWINDOW = &H2000
+Const CS_GLOBALCLASS =     &H4000
+Type WNDCLASSEXA
+	cbSize        As DWord
+	style         As DWord
+	lpfnWndProc   As WNDPROC
+	cbClsExtra    As Long
+	cbWndExtra    As Long
+	hInstance     As HINSTANCE
+	hIcon         As HICON
+	hCursor       As HCURSOR
+	hbrBackground As HBRUSH
+	lpszMenuName  As LPCSTR
+	lpszClassName As LPCSTR
+	hIconSm       As HICON
+End Type
+Type WNDCLASSEXW
+	cbSize        As DWord
+	style         As DWord
+	lpfnWndProc   As WNDPROC
+	cbClsExtra    As Long
+	cbWndExtra    As Long
+	hInstance     As HINSTANCE
+	hIcon         As HICON
+	hCursor       As HCURSOR
+	hbrBackground As HBRUSH
+	lpszMenuName  As LPCWSTR
+	lpszClassName As LPCWSTR
+	hIconSm       As HICON
+End Type
+#ifdef UNICODE
+TypeDef WNDCLASSEX = WNDCLASSEXW
+#else
+TypeDef WNDCLASSEX = WNDCLASSEXA
+#endif
+
+'------------------------
+' Dialog Box Command IDs
+Const IDOK =              1
+Const IDCANCEL =          2
+Const IDABORT =           3
+Const IDRETRY =           4
+Const IDIGNORE =          5
+Const IDYES =             6
+Const IDNO =              7
+Const IDCLOSE =           8
+Const IDHELP =            9
+
+
+'------------------------
+' Menu flags and structs
+Const MF_INSERT =          &H00000000
+Const MF_CHANGE =          &H00000080
+Const MF_APPEND =          &H00000100
+Const MF_DELETE =          &H00000200
+Const MF_REMOVE =          &H00001000
+Const MF_BYCOMMAND =       &H00000000
+Const MF_BYPOSITION =      &H00000400
+Const MF_SEPARATOR =       &H00000800
+Const MF_ENABLED =         &H00000000
+Const MF_GRAYED =          &H00000001
+Const MF_DISABLED =        &H00000002
+Const MF_UNCHECKED =       &H00000000
+Const MF_CHECKED =         &H00000008
+Const MF_USECHECKBITMAPS = &H00000200
+Const MF_STRING =          &H00000000
+Const MF_BITMAP =          &H00000004
+Const MF_OWNERDRAW =       &H00000100
+Const MF_POPUP =           &H00000010
+Const MF_MENUBARBREAK =    &H00000020
+Const MF_MENUBREAK =       &H00000040
+Const MF_UNHILITE =        &H00000000
+Const MF_HILITE =          &H00000080
+Const MF_DEFAULT =         &H00001000
+Const MF_SYSMENU =         &H00002000
+Const MF_HELP =            &H00004000
+Const MF_RIGHTJUSTIFY =    &H00004000
+Const MF_MOUSESELECT =     &H00008000
+
+Const MFS_GRAYED =        &H00000003
+Const MFS_DISABLED =      MFS_GRAYED
+Const MFS_CHECKED =       MF_CHECKED
+Const MFS_HILITE =        MF_HILITE
+Const MFS_ENABLED =       MF_ENABLED
+Const MFS_UNCHECKED =     MF_UNCHECKED
+Const MFS_UNHILITE =      MF_UNHILITE
+Const MFS_DEFAULT =       MF_DEFAULT
+Const MFS_MASK =          &H0000108B
+Const MFS_HOTTRACKDRAWN = &H10000000
+Const MFS_CACHEDBMP =     &H20000000
+Const MFS_BOTTOMGAPDROP = &H40000000
+Const MFS_TOPGAPDROP =    &H80000000
+Const MFS_GAPDROP =       &HC0000000
+
+Const MIIM_STATE =      &H00000001
+Const MIIM_ID =         &H00000002
+Const MIIM_SUBMENU =    &H00000004
+Const MIIM_CHECKMARKS = &H00000008
+Const MIIM_TYPE =       &H00000010
+Const MIIM_DATA =       &H00000020
+Const MIIM_STRING =     &H00000040
+Const MIIM_BITMAP =     &H00000080
+Const MIIM_FTYPE =      &H00000100
+Const MFT_STRING =        MF_STRING
+Const MFT_BITMAP =        MF_BITMAP
+Const MFT_MENUBARBREAK =  MF_MENUBARBREAK
+Const MFT_MENUBREAK =     MF_MENUBREAK
+Const MFT_OWNERDRAW =     MF_OWNERDRAW
+Const MFT_RADIOCHECK =    &H00000200
+Const MFT_SEPARATOR =     MF_SEPARATOR
+Const MFT_RIGHTORDER =    &H00002000
+Const MFT_RIGHTJUSTIFY =  MF_RIGHTJUSTIFY
+
+Type MENUITEMINFOW
+	cbSize        As DWord
+	fMask         As DWord
+	fType         As DWord
+	fState        As DWord
+	wID           As DWord
+	hSubMenu      As HMENU
+	hbmpChecked   As HBITMAP
+	hbmpUnchecked As HBITMAP
+	dwItemData    As ULONG_PTR
+	dwTypeData    As LPWSTR
+	cch           As DWord
+End Type
+Type MENUITEMINFOA
+	cbSize        As DWord
+	fMask         As DWord
+	fType         As DWord
+	fState        As DWord
+	wID           As DWord
+	hSubMenu      As HMENU
+	hbmpChecked   As HBITMAP
+	hbmpUnchecked As HBITMAP
+	dwItemData    As ULONG_PTR
+	dwTypeData    As LPSTR
+	cch           As DWord
+End Type
+#ifdef UNICODE
+TypeDef MENUITEMINFO = MENUITEMINFOW
+#else
+TypeDef MENUITEMINFO = MENUITEMINFOA
+#endif
+
+'------------
+' Scroll Bar
+Const SB_HORZ = 0
+Const SB_VERT = 1
+Const SB_CTL =  2
+Const SB_BOTH = 3
+
+' SCROLLINFO struct
+Const SIF_RANGE =           &H0001
+Const SIF_PAGE =            &H0002
+Const SIF_POS =             &H0004
+Const SIF_DISABLENOSCROLL = &H0008
+Const SIF_TRACKPOS =        &H0010
+Const SIF_ALL =             SIF_RANGE or SIF_PAGE or SIF_POS or SIF_TRACKPOS
+Type SCROLLINFO
+	cbSize As DWord
+	fMask As DWord
+	nMin As Long
+	nMax As Long
+	nPage As DWord
+	nPos As Long
+	nTrackPos As Long
+End Type
+
+
+' combo box
+Const CB_ERR =      -1
+Const CB_ERRSPACE = -2
+
+
+' Clipboard Formats
+Const CF_TEXT =         1
+Const CF_BITMAP =       2
+Const CF_METAFILEPICT = 3
+Const CF_SYLK =         4
+Const CF_DIF =          5
+Const CF_TIFF =         6
+Const CF_OEMTEXT =      7
+Const CF_DIB =          8
+Const CF_PALETTE =      9
+Const CF_PENDATA =      10
+Const CF_RIFF =         11
+Const CF_WAVE =         12
+Const CF_UNICODETEXT =  13
+Const CF_ENHMETAFILE =  14
+Const CF_HDROP =        15
+Const CF_LOCALE =       16
+Const CF_MAX =          17
+Const CF_OWNERDISPLAY =    &H0080
+Const CF_DSPTEXT =         &H0081
+Const CF_DSPBITMAP =       &H0082
+Const CF_DSPMETAFILEPICT = &H0083
+Const CF_DSPENHMETAFILE =  &H008E
+Const CF_PRIVATEFIRST =    &H0200
+Const CF_PRIVATELAST =     &H02FF
+Const CF_GDIOBJFIRST =     &H0300
+Const CF_GDIOBJLAST =      &H03FF
+
+'-------------
+' Window API
+
+Declare Function AdjustWindowRect Lib "user32" (ByRef Rect As RECT, dwStyle As DWord, bMenu As BOOL) As BOOL
+Declare Function AdjustWindowRectEx Lib "user32" (ByRef Rect As RECT, dwStyle As DWord, bMenu As BOOL, dwExStyle As DWord) As BOOL
+Declare Function AnyPopup Lib "user32" () As BOOL
+Declare Function ArrangeIconicWindows Lib "user32" (hWnd As HWND) As DWord
+
+Type PAINTSTRUCT
+	hdc As HDC
+	fErase As BOOL
+	rcPaint As RECT
+	fRestore As BOOL
+	fIncUpdate As BOOL
+	rgbReserved[ELM(32)] As Byte
+End Type
+Declare Function BeginPaint Lib "user32" (hWnd As HWND, ByRef Paint As PAINTSTRUCT) As HDC
+Declare Function BringWindowToTop Lib "user32" (hWnd As HWND) As Long
+
+Declare Function CallNextHookEx Lib "user32" (hHook As HHOOK, nCode As Long, wParam As WPARAM, lParam As LPARAM) As LRESULT
+Function DefHookProc(ByVal nCode As Long, ByVal wParam As WPARAM, ByVal lParam As LPARAM, ByVal phhk As *HHOOK) As LRESULT
+	Return CallNextHookEx(phhk[0], nCode, wParam, lParam)
+End Function
+
+Declare Function CallWindowProc Lib "user32" Alias _FuncName_CallWindowProc (lpPrevWndFunc As WNDPROC, hWnd As HWND, Msg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
+Declare Function ChangeClipboardChain Lib "user32" (hwndRemove As HWND, hwndNewNext As HWND) As BOOL
+Declare Function CharLower Lib "user32" Alias _FuncName_CharLower (psz As PTSTR) As DWord
+Declare Function CharNext Lib "user32" Alias _FuncName_CharNext (lpszCurrent As LPCTSTR) As LPTSTR
+Declare Function CharNextExA Lib "user32" (CodePage As Word, lpCurrentChar As LPCSTR, dwFlags As DWord) As LPSTR
+Declare Function CharPrev Lib "user32" Alias _FuncName_CharPrev (lpszStart As LPCTSTR, lpszCurrent As LPCTSTR) As LPTSTR
+Declare Function CharPrevExA Lib "user32" (CodePage As Word, lpStart As LPCSTR, lpCurrentChar As LPCSTR, dwFlags As DWord) As LPSTR
+Declare Function CharUpper Lib "user32" Alias _FuncName_CharUpper (psz As PTSTR) As DWord
+Declare Function CheckMenuItem Lib "user32" (hMenu As HMENU, uIDCheckItem As DWord, uCheck As DWord) As DWord
+Declare Function CheckMenuRadioItem Lib "user32" (hMenu As HMENU, idFirst As DWord, idLast As DWord, idCheck As DWord, uFlags As DWord) As BOOL
+Declare Function CheckDlgButton Lib "user32" (hDlg As HWND, nIDButton As Long, uCheck As DWord) As BOOL
+Declare Function CheckRadioButton Lib "user32" (hDlg As HWND, nIDFirstButton As Long, nIDLastButton As Long, nIDCheckButton As Long) As BOOL
+Declare Function ChildWindowFromPoint Lib "user32" (hWndParent As HWND, x As Long, y As Long) As HWND
+Const CWP_ALL =             &H0000
+Const CWP_SKIPINVISIBLE =   &H0001
+Const CWP_SKIPDISABLED =    &H0002
+Const CWP_SKIPTRANSPARENT = &H0004
+Declare Function ChildWindowFromPointEx Lib "user32" (hWndParent As HWND, x As Long, y As Long, uFlags As DWord) As HWND
+
+Declare Function ClientToScreen Lib "user32" (hWnd As HWND, ByRef lpPoint As POINTAPI) As BOOL
+Declare Function ClipCursor Lib "user32" (ByRef lpRect As RECT) As BOOL
+Declare Function CloseClipboard Lib "user32" () As BOOL
+Declare Function CloseWindow Lib "user32" (hWnd As HWND) As BOOL
+Declare Function CopyImage Lib "user32" (hImage As HANDLE, uType As DWord, cxDesired As Long, cyDesired As Long, fuFlags As DWord) As HANDLE
+Declare Function CountClipboardFormats Lib "user32" () As Long
+Const FVIRTKEY = &H01
+Const FNOINVERT = &H02
+Const FSHIFT = &H04
+Const FCONTROL = &H08
+Const FALT = &H10
+Type ACCEL
+	fVirt As Byte
+	key As Word
+	cmd As Word
+End Type
+Declare Function CreateAcceleratorTable Lib "user32" Alias _FuncName_CreateAcceleratorTable (ByRef acl As ACCEL, i As Long) As HACCEL
+Declare Function CreateCaret Lib "user32" (hWnd As HWND, hBitmap As HBITMAP, nWidth As Long, nHeight As Long) As BOOL
+Declare Function CreateCursor Lib "user32" (hInst As HINSTANCE, xHotSpot As Long, yHotSpot As Long, nWidth As Long, nHeight As Long, pvANDPlane As VoidPtr, pvXORPlane As VoidPtr) As HCURSOR
+Declare Function CreateIcon Lib "user32" (hInst As HINSTANCE, nWidth As Long, nHeight As Long, cPlanes As Byte, cBitsPixel As Byte, lpbANDbits As VoidPtr, lpbXORbits As VoidPtr) As HICON
+Declare Function LookupIconIdFromDirectory Lib "user32" (ByVal presbits As *BYTE, ByVal fIcon As BOOL) As Long
+Declare Function LookupIconIdFromDirectoryEx Lib "user32" (ByVal presbits As *BYTE, ByVal fIcon As BOOL, ByVal cxDesired As Long, ByVal cyDesired As Long, ByVal Flags As DWord) As Long
+
+Type ICONINFO
+	fIcon As BOOL
+	xHotspot As DWord
+	yHotspot As DWord
+	hbmMask As HBITMAP
+	hbmColor As HBITMAP
+End Type
+Declare Function CreateIconIndirect Lib "user32" (ByRef pIconInfo As ICONINFO) As HICON
+
+Declare Function CreateMenu Lib "user32" () As HMENU
+Declare Function CreatePopupMenu Lib "user32" () As HMENU
+
+Const CW_USEDEFAULT = &H80000000
+Declare Function CreateWindowEx Lib "user32" Alias _FuncName_CreateWindowEx (dwExStyle As DWord, pClassName As PCTSTR, lpWindowName As PCTSTR, dwStyle As DWord, x As Long, y As Long, nWidth As Long, nHeight As Long, hwndParent As HWND, hmenu As HMENU, hInstance As HINSTANCE, pParm As VoidPtr) As HWND
+
+Declare Function CreateMDIWindowA Lib "user32" (ByVal lpClassName As LPCSTR, ByVal lpWindowName As LPCSTR, ByVal dwStyle As DWord, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As HWND, ByVal hInstance As HINSTANCE, ByVal lParam As LPARAM) As HWND
+Declare Function CreateMDIWindowW Lib "user32" (ByVal lpClassName As LPCWSTR, ByVal lpWindowName As LPCWSTR, ByVal dwStyle As DWord, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As HWND, ByVal hInstance As HINSTANCE, ByVal lParam As LPARAM) As HWND
+#ifdef UNICODE
+Declare Function CreateMDIWindow Lib "user32" Alias "CreateMDIWindowW" (ByVal lpClassName As LPCWSTR, ByVal lpWindowName As LPCWSTR, ByVal dwStyle As DWord, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As HWND, ByVal hInstance As HINSTANCE, ByVal lParam As LPARAM) As HWND
+#else
+Declare Function CreateMDIWindow Lib "user32" Alias "CreateMDIWindowA" (ByVal lpClassName As LPCSTR, ByVal lpWindowName As LPCSTR, ByVal dwStyle As DWord, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As HWND, ByVal hInstance As HINSTANCE, ByVal lParam As LPARAM) As HWND
+#endif ' !UNICODE
+
+Declare Function DefDlgProc Lib "user32" Alias _FuncName_DefWindowProc (hDlg As HWND, Msg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
+Declare Function DefWindowProc Lib "user32" Alias _FuncName_DefWindowProc (hWnd As HWND, wMsg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
+
+Declare Function DefFrameProcA Lib "user32" (ByRef hWnd As HWND, ByRef hWndMDIClient As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
+Declare Function DefFrameProcW Lib "user32" (ByRef hWnd As HWND, ByRef hWndMDIClient As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
+#ifdef UNICODE
+Declare Function DefFrameProc Lib "user32" Alias "DefFrameProcW" (ByRef hWnd As HWND, ByRef hWndMDIClient As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
+#else
+Declare Function DefFrameProc Lib "user32" Alias "DefFrameProcA" (ByRef hWnd As HWND, ByRef hWndMDIClient As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
+#endif ' !UNICODE
+
+Declare Function DefMDIChildProcA Lib "user32" (ByVal hWnd As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
+Declare Function DefMDIChildProcW Lib "user32" (ByVal hWnd As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
+#ifdef UNICODE
+Declare Function DefMDIChildProc Lib "user32" Alias "DefMDIChildProcW" (ByVal hWnd As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
+#else
+Declare Function DefMDIChildProc Lib "user32" Alias "DefMDIChildProcA" (ByVal hWnd As HWND, ByVal uMsg As DWord, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
+#endif ' !UNICODE
+
+Declare Function DeleteMenu Lib "user32" (hMenu As HMENU, uPosition As DWord, uFlags As DWord) As BOOL
+Declare Function DestroyAcceleratorTable Lib "user32" (hAccel As HACCEL) As BOOL
+
+Declare Function TranslateMDISysAccel Lib "user32" (ByVal hWndClient As HWND, ByRef lpMsg As MSG) As BOOL
+Declare Function ArrangeIconicWindows Lib "user32" (ByVal hWnd As HWND) As DWord
+Declare Function TileWindows Lib "user32" (ByVal hwndParent As HWND, ByVal wHow As DWord, ByRef lpRect As RECT, ByVal cKids As DWord, ByVal lpKids As *HWND) As Word
+Declare Function CascadeWindows Lib "user32" (ByVal hwndParent As HWND, ByVal wHow As DWord, ByRef lpRect As RECT, ByVal cKids As DWord, ByVal lpKids As *HWND) As Word
+
+Declare Function DestroyCaret Lib "user32" () As BOOL
+Declare Function DestroyCursor Lib "user32" (hCursor As HCURSOR) As BOOL
+Declare Function DestroyIcon Lib "user32" (hIcon As HICON) As BOOL
+Declare Function DestroyMenu Lib "user32" (hMenu As HMENU) As BOOL
+Declare Function DestroyWindow Lib "user32" (hWnd As HWND) As BOOL
+Type DLGITEMTEMPLATE
+	style As DWord
+	dwExtendedStyle As DWord
+	x As Integer
+	y As Integer
+	cx As Integer
+	cy As Integer
+	id As Word
+End Type
+Type DLGTEMPLATE
+	style As DWord
+	dwExtendedStyle As DWord
+	cdit As Word
+	x As Integer
+	y As Integer
+	cx As Integer
+	cy As Integer
+End Type
+Declare Function DialogBoxIndirectParam Lib "user32" Alias _FuncName_DialogBoxIndirectParam (hInstance As HINSTANCE, DialogTemplate As *DLGTEMPLATE, hwndParent As HWND, pDialogFunc As DLGPROC, InitParam As LPARAM) As LONG_PTR
+Declare Function MapDialogRect Lib "user32" (ByVal hDlg As HWND, ByRef lpRect As RECT) As BOOL
+Declare Function DispatchMessage Lib "user32" Alias _FuncName_DispatchMessage (ByRef Msg As MSG) As LRESULT
+Declare Function DlgDirList Lib "user32" Alias _FuncName_DlgDirList (hDlg As HWND, lpPathSpec As LPTSTR, nIDListBox As Long, nIDStaticPath As Long, uFileType As DWord) As Long
+Declare Function DlgDirListComboBox Lib "user32" Alias _FuncName_DlgDirListComboBox (hDlg As HWND, lpPathSpec As LPTSTR, nIDComboBox As Long, nIDStaticPath As Long,uFileType As DWord) As Long
+Declare Function DlgDirSelectComboBoxEx Lib "user32" Alias _FuncName_DlgDirSelectComboBoxEx (hDlg As HWND, lpString As LPTSTR, nCount As Long, nIDComboBox As Long) As BOOL
+Declare Function DlgDirSelectEx Lib "user32" Alias _FuncName_DlgDirSelectEx (hDlg As HWND, lpString As LPTSTR, nCount As Long, nIDListBox As Long) As BOOL
+Const BDR_RAISEDOUTER = &H0001
+Const BDR_SUNKENOUTER = &H0002
+Const BDR_RAISEDINNER = &H0004
+Const BDR_SUNKENINNER = &H0008
+Const BDR_OUTER =       &H0003
+Const BDR_INNER =       &H000c
+Const EDGE_RAISED =     BDR_RAISEDOUTER or BDR_RAISEDINNER
+Const EDGE_SUNKEN =     BDR_SUNKENOUTER or BDR_SUNKENINNER
+Const EDGE_ETCHED =     BDR_SUNKENOUTER or BDR_RAISEDINNER
+Const EDGE_BUMP =       BDR_RAISEDOUTER or BDR_SUNKENINNER
+Const BF_LEFT =        &H0001
+Const BF_TOP =         &H0002
+Const BF_RIGHT =       &H0004
+Const BF_BOTTOM =      &H0008
+Const BF_TOPLEFT =     BF_TOP or BF_LEFT
+Const BF_TOPRIGHT =    BF_TOP or BF_RIGHT
+Const BF_BOTTOMLEFT =  BF_BOTTOM or BF_LEFT
+Const BF_BOTTOMRIGHT = BF_BOTTOM or BF_RIGHT
+Const BF_RECT =        BF_LEFT or BF_TOP or BF_RIGHT or BF_BOTTOM
+Const BF_DIAGONAL =    &H0010
+Const BF_DIAGONAL_ENDTOPRIGHT =    BF_DIAGONAL or BF_TOP or BF_RIGHT
+Const BF_DIAGONAL_ENDTOPLEFT =     BF_DIAGONAL or BF_TOP or BF_LEFT
+Const BF_DIAGONAL_ENDBOTTOMLEFT =  BF_DIAGONAL or BF_BOTTOM or BF_LEFT
+Const BF_DIAGONAL_ENDBOTTOMRIGHT = BF_DIAGONAL or BF_BOTTOM or BF_RIGHT
+Const BF_MIDDLE =     &H0800
+Const BF_SOFT =       &H1000
+Const BF_ADJUST =     &H2000
+Const BF_FLAT =       &H4000
+Const BF_MONO =       &H8000
+Declare Function DrawEdge Lib "user32" (hdc As HDC, ByRef lpRect As RECT, edge As DWord, grfFlags As DWord) As BOOL
+
+Const DFC_CAPTION =   1
+Const DFC_MENU =      2
+Const DFC_SCROLL =    3
+Const DFC_BUTTON =    4
+Const DFC_POPUPMENU = 5
+Const DFCS_CAPTIONCLOSE =        &H0000
+Const DFCS_CAPTIONMIN =          &H0001
+Const DFCS_CAPTIONMAX =          &H0002
+Const DFCS_CAPTIONRESTORE =      &H0003
+Const DFCS_CAPTIONHELP =         &H0004
+Const DFCS_MENUARROW =           &H0000
+Const DFCS_MENUCHECK =           &H0001
+Const DFCS_MENUBULLET =          &H0002
+Const DFCS_MENUARROWRIGHT =      &H0004
+Const DFCS_SCROLLUP =            &H0000
+Const DFCS_SCROLLDOWN =          &H0001
+Const DFCS_SCROLLLEFT =          &H0002
+Const DFCS_SCROLLRIGHT =         &H0003
+Const DFCS_SCROLLCOMBOBOX =      &H0005
+Const DFCS_SCROLLSIZEGRIP =      &H0008
+Const DFCS_SCROLLSIZEGRIPRIGHT = &H0010
+Const DFCS_BUTTONCHECK =         &H0000
+Const DFCS_BUTTONRADIOIMAGE =    &H0001
+Const DFCS_BUTTONRADIOMASK =     &H0002
+Const DFCS_BUTTONRADIO =         &H0004
+Const DFCS_BUTTON3STATE =        &H0008
+Const DFCS_BUTTONPUSH =          &H0010
+Const DFCS_INACTIVE =            &H0100
+Const DFCS_PUSHED =              &H0200
+Const DFCS_CHECKED =             &H0400
+Const DFCS_TRANSPARENT =         &H0800
+Const DFCS_HOT =                 &H1000
+Const DFCS_ADJUSTRECT =          &H2000
+Const DFCS_FLAT =                &H4000
+Const DFCS_MONO =                &H8000
+Declare Function DrawFrameControl Lib "user32" (hdc As HDC, ByRef lpRect As RECT, uType As DWord, uState As DWord) As BOOL
+
+Declare Function DrawIcon Lib "user32" (hdc As HDC, x As Long, y As Long, hIcon As HICON) As BOOL
+
+Const DI_MASK =        &H0001
+Const DI_IMAGE =       &H0002
+Const DI_NORMAL =      &H0003
+Const DI_COMPAT =      &H0004
+Const DI_DEFAULTSIZE = &H0008
+Declare Function DrawIconEx Lib "user32" (hdc As HDC, xLeft As Long, yTop As Long, hIcon As HICON, cxWidth As Long, cyWidth As Long, istepIfAniCur As DWord, hbrFlickerFreeDraw As HBRUSH, diFlags As DWord) As BOOL
+
+Declare Function DrawMenuBar Lib "user32" (hwnd As HWND) As BOOL
+
+Type DROPSTRUCT
+	hwndSource As HWND
+	hwndSink As HWND
+	wFmt As DWord
+	dwData As ULONG_PTR
+	ptDrop As POINTAPI
+	dwControlData As DWord
+End Type
+TypeDef PDROPSTRUCT= *DROPSTRUCT
+TypeDef LPDROPSTRUCT= *DROPSTRUCT
+
+Const DOF_EXECUTABLE = &H8001
+Const DOF_DOCUMENT = &H8002
+Const DOF_DIRECTORY = &H8003
+Const DOF_MULTIPLE = &H8004
+Const DOF_PROGMAN = &H0001
+Const DOF_SHELLDATA = &H0002
+
+Const DO_DROPFILE = &H454C4946
+Const DO_PRINTFILE = &H544E5250
+
+Declare Function DragObject Lib "user32" (ByVal hwndParent As HWND, ByVal hwndFrom As HWND, ByVal fmt As DWord, ByVal data As ULONG_PTR, ByVal hcur As HCURSOR) As DWord
+Declare Function DragDetect Lib "user32" (ByVal hwnd As HWND, ByRef pt As POINTAPI) As BOOL
+
+
+Const DT_TOP =            &H00000000
+Const DT_LEFT =           &H00000000
+Const DT_CENTER =         &H00000001
+Const DT_RIGHT =          &H00000002
+Const DT_VCENTER =        &H00000004
+Const DT_BOTTOM =         &H00000008
+Const DT_WORDBREAK =      &H00000010
+Const DT_SINGLELINE =     &H00000020
+Const DT_EXPANDTABS =     &H00000040
+Const DT_TABSTOP =        &H00000080
+Const DT_NOCLIP =         &H00000100
+Const DT_EXTERNALLEADING =&H00000200
+Const DT_CALCRECT =       &H00000400
+Const DT_NOPREFIX =       &H00000800
+Const DT_INTERNAL =       &H00001000
+Const DT_EDITCONTROL =    &H00002000
+Const DT_PATH_ELLIPSIS =  &H00004000
+Const DT_END_ELLIPSIS =   &H00008000
+Const DT_MODIFYSTRING =   &H00010000
+Const DT_RTLREADING =     &H00020000
+Const DT_WORD_ELLIPSIS =  &H00040000
+Declare Function DrawText Lib "user32" Alias _FuncName_DrawText (hdc As HDC, lpStr As PCTSTR, nCount As Long, ByRef Rect As RECT, dwFormat As DWord) As BOOL
+
+Type DRAWTEXTPARAMS
+	cbSize As DWord
+	iTabLength As Long
+	iLeftMargin As Long
+	iRightMargin As Long
+	uiLengthDrawn As DWord
+End Type
+Declare Function DrawTextEx Lib "user32" Alias _FuncName_DrawTextEx (hdc As HDC, pchText As PCTSTR, cchText As Long, ByRef Rect As RECT, dwDTFormat As DWord, ByRef DTParams As DRAWTEXTPARAMS) As BOOL
+
+TypeDef GRAYSTRINGPROC = *Function(hDC As HDC, lParam As LPARAM, l As Long) As BOOL
+
+Declare Function GrayStringA Lib "user32" (ByVal hDC As HDC, ByVal hBrush As HBRUSH, ByVal lpOutputFunc As GRAYSTRINGPROC, ByVal lpData As LPARAM, ByVal nCount As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long) As BOOL
+Declare Function GrayStringW Lib "user32" (ByVal hDC As HDC, ByVal hBrush As HBRUSH, ByVal lpOutputFunc As GRAYSTRINGPROC, ByVal lpData As LPARAM, ByVal nCount As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long) As BOOL
+#ifdef UNICODE
+Declare Function GrayString Lib "user32" Alias "GrayStringW" (ByVal hDC As HDC, ByVal hBrush As HBRUSH, ByVal lpOutputFunc As GRAYSTRINGPROC, ByVal lpData As LPARAM, ByVal nCount As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long) As BOOL
+#else
+Declare Function GrayString Lib "user32" Alias "GrayStringA" (ByVal hDC As HDC, ByVal hBrush As HBRUSH, ByVal lpOutputFunc As GRAYSTRINGPROC, ByVal lpData As LPARAM, ByVal nCount As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long) As BOOL
+#endif ' !UNICODE
+
+Const DST_COMPLEX = &H0000
+Const DST_TEXT = &H0001
+Const DST_PREFIXTEXT = &H0002
+Const DST_ICON = &H0003
+Const DST_BITMAP = &H0004
+
+Const DSS_NORMAL = &H0000
+Const DSS_UNION = &H0010
+Const DSS_DISABLED = &H0020
+Const DSS_MONO = &H0080
+Const DSS_HIDEPREFIX = &H0200
+Const DSS_PREFIXONLY = &H0400
+Const DSS_RIGHT = &H8000
+
+TypeDef DRAWSTATEPROC = *Function(hdc As HDC, lData As LPARAM, wData As WPARAM, cx As Long, cy As Long) As BOOL
+
+Declare Function DrawStateA Lib "user32" (ByVal hdc As HDC, ByVal hbrFore As HBRUSH, ByVal qfnCallBack As DRAWSTATEPROC, ByVal lData As LPARAM, ByVal wData As WPARAM, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal uFlags As DWord) As BOOL
+Declare Function DrawStateW Lib "user32" (ByVal hdc As HDC, ByVal hbrFore As HBRUSH, ByVal qfnCallBack As DRAWSTATEPROC, ByVal lData As LPARAM, ByVal wData As WPARAM, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal uFlags As DWord) As BOOL
+#ifdef UNICODE
+Declare Function DrawState Lib "user32" Alias "DrawStateW" (ByVal hdc As HDC, ByVal hbrFore As HBRUSH, ByVal qfnCallBack As DRAWSTATEPROC, ByVal lData As LPARAM, ByVal wData As WPARAM, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal uFlags As DWord) As BOOL
+#else
+Declare Function DrawState Lib "user32" Alias "DrawStateA" (ByVal hdc As HDC, ByVal hbrFore As HBRUSH, ByVal qfnCallBack As DRAWSTATEPROC, ByVal lData As LPARAM, ByVal wData As WPARAM, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal uFlags As DWord) As BOOL
+#endif ' !UNICODE
+
+Declare Function TabbedTextOutA Lib "user32" (ByVal hdc As HDC, ByVal x As Long, ByVal y As Long, ByVal lpString As LPCSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long, ByVal nTabOrigin As Long) As Long
+Declare Function TabbedTextOutW Lib "user32" (ByVal hdc As HDC, ByVal x As Long, ByVal y As Long, ByVal lpString As LPCWSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long, ByVal nTabOrigin As Long) As Long
+#ifdef UNICODE
+Declare Function TabbedTextOut Lib "user32" Alias "TabbedTextOutW" (ByVal hdc As HDC, ByVal x As Long, ByVal y As Long, ByVal lpString As LPCWSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long, ByVal nTabOrigin As Long) As Long
+#else
+Declare Function TabbedTextOut Lib "user32" Alias "TabbedTextOutA" (ByVal hdc As HDC, ByVal x As Long, ByVal y As Long, ByVal lpString As LPCSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long, ByVal nTabOrigin As Long) As Long
+#endif ' !UNICODE
+
+Declare Function GetTabbedTextExtentA Lib "user32" (ByVal hdc As HDC, ByVal lpString As LPCSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long) As DWord
+Declare Function GetTabbedTextExtentW Lib "user32" (ByVal hdc As HDC, ByVal lpString As LPCWSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long) As DWord
+#ifdef UNICODE
+Declare Function GetTabbedTextExtent Lib "user32" Alias "GetTabbedTextExtentW" (ByVal hdc As HDC, ByVal lpString As LPCWSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long) As DWord
+#else
+Declare Function GetTabbedTextExtent Lib "user32" Alias "GetTabbedTextExtentA" (ByVal hdc As HDC, ByVal lpString As LPCSTR, ByVal chCount As Long, ByVal nTabPositions As Long, ByVal lpnTabStopPositions As *Long) As DWord
+#endif ' !UNICODE
+
+Declare Function EmptyClipboard Lib "user32" () As BOOL
+Declare Function EnableMenuItem Lib "user32" (hMenu As HMENU, uIDEnableItem As DWord, uEnable As DWord) As BOOL
+
+Const ESB_ENABLE_BOTH =   &H0000
+Const ESB_DISABLE_BOTH =  &H0003
+Const ESB_DISABLE_LEFT =  &H0001
+Const ESB_DISABLE_RIGHT = &H0002
+Const ESB_DISABLE_UP =    &H0001
+Const ESB_DISABLE_DOWN =  &H0002
+Const ESB_DISABLE_LTUP =  ESB_DISABLE_LEFT
+Const ESB_DISABLE_RTDN =  ESB_DISABLE_RIGHT
+Declare Function EnableScrollBar Lib "user32" (hWnd As HWND, dwSBflags As DWord, dwArrows As DWord) As BOOL
+
+Declare Function EnableWindow Lib "user32" (hWnd As HWND, bEnable As BOOL) As BOOL
+Declare Function EndDialogAPI Lib "user32" Alias "EndDialog" (hwndDlg As HWND, nRet As Long) As BOOL
+Declare Function EndPaint Lib "user32" (hWnd As HWND, ByRef lpPaint As PAINTSTRUCT) As BOOL
+Declare Function EnumClipboardFormats Lib "user32" (uFormat As DWord) As DWord
+Declare Function EnumChildWindows Lib "user32" (hwndParent As HWND, pEnumFunc As WNDENUMPROC, lParam As LPARAM) As BOOL
+Declare Function EnumDisplayMonitors Lib "user32.dll" (ByVal hdc As HDC, lprcClip As *RECT, ByVal lpfnEnum As MONITORENUMPROC, dwData As LPARAM) As BOOL
+Declare Function EnumThreadWindows Lib "user32" (dwThreadId As DWord, pEnumFunc As WNDENUMPROC, lParam As LPARAM) As BOOL
+Declare Function EnumWindows Lib "user32" (pEnumFunc As WNDENUMPROC, lParam As LPARAM) As BOOL
+Declare Function ExitWindowsEx Lib "user32" (uFlags As DWord, dwReserved As DWord) As BOOL
+Declare Function FillRect Lib "user32" (hdc As HDC, ByRef lpRect As RECT, hBrush As HBRUSH) As BOOL
+
+Declare Function DrawFocusRect Lib "user32" (ByVal hDC As HDC, ByRef lprc As RECT) As BOOL
+
+Declare Function FindWindow Lib "user32" Alias _FuncName_FindWindow (pClassName As PCTSTR, lpWindowName As PCTSTR) As HWND
+Declare Function FindWindowEx Lib "user32" Alias _FuncName_FindWindowEx (hwndParent As HWND, hwndChildAfter As HWND, pszClass As PCTSTR, pszWindow As PCTSTR) As HWND
+Declare Function FlashWindow Lib "user32" (hWnd As HWND, bInvert As BOOL) As BOOL
+Const FLASHW_STOP = 0
+Const FLASHW_CAPTION = 1
+Const FLASHW_TRAY = 2
+Const FLASHW_ALL = (FLASHW_CAPTION Or FLASHW_TRAY)
+Const FLASHW_TIMER = 4
+Const FLASHW_TIMERNOFG = 12
+Type FLASHWINFO
+	cbSize As DWord
+	hWnd As HWND
+	dwFlags As DWord
+	uCount As DWord
+	dwTimeout As DWord
+End Type
+Declare Function FlashWindowEx Lib "user32" (ByRef fwi As FLASHWINFO) As Long
+Declare Function FrameRect Lib "user32" (hdc As HDC, ByRef lpRect As RECT, hBrush As HBRUSH) As Long
+Declare Function GetActiveWindow Lib "user32" () As HWND
+Declare Function GetAsyncKeyState Lib "user32" (vKey As Long) As Integer
+Declare Function GetCapture Lib "user32" () As HWND
+Declare Function GetCaretPos Lib "user32" (ByRef lpPoint As POINTAPI) As BOOL
+Declare Function GetClassInfoEx Lib "user32" Alias _FuncName_GetClassInfoEx (hInst As HINSTANCE, pszClass As PCTSTR, ByRef lpwcx As WNDCLASSEX) As BOOL
+
+Const GCL_MENUNAME =      -8
+Const GCL_HBRBACKGROUND = -10
+Const GCL_HCURSOR =       -12
+Const GCL_HICON =         -14
+Const GCL_HMODULE =       -16
+Const GCL_CBWNDEXTRA =    -18
+Const GCL_CBCLSEXTRA =    -20
+Const GCL_WNDPROC =       -24
+Const GCL_STYLE =         -26
+Const GCW_ATOM =          -32
+Const GCL_HICONSM =       -34
+#ifdef _WIN64
+Declare Function GetClassLong Lib "user32" Alias _FuncName_GetClassLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
+Declare Function GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
+#else
+Declare Function GetClassLong Lib "user32" Alias _FuncName_GetClassLong (hWnd As HWND, nIndex As Long) As LONG_PTR
+Declare Function GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLong (hWnd As HWND, nIndex As Long) As LONG_PTR
+#endif
+
+Declare Function GetClassName Lib "user32" Alias _FuncName_GetClassName (hWnd As HWND, lpClassName As PTSTR, nMaxCount As Long) As Long
+Declare Function GetClientRect Lib "user32" (hWnd As HWND, ByRef lpRect As RECT) As BOOL
+Declare Function GetClipboardData Lib "user32" (uFormat As DWord) As HANDLE
+Declare Function GetClipboardFormatName Lib "user32" Alias _FuncName_GetClipboardFormatName (uFormat As DWord, pszFormatName As PTSTR, cchMaxCount As Long) As BOOL
+Declare Function GetClipboardOwner Lib "user32" () As HWND
+Declare Function GetClipboardViewer Lib "user32" () As HWND
+Declare Function GetClipCursor Lib "user32" (ByRef lpRect As RECT) As BOOL
+Declare Function GetCursor Lib "user32" () As HCURSOR
+Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As POINTAPI) As BOOL
+Declare Function GetDC Lib "user32" (hWnd As HWND) As HDC
+
+Const DCX_WINDOW =           &H00000001
+Const DCX_CACHE =            &H00000002
+Const DCX_NORESETATTRS =     &H00000004
+Const DCX_CLIPCHILDREN =     &H00000008
+Const DCX_CLIPSIBLINGS =     &H00000010
+Const DCX_PARENTCLIP =       &H00000020
+Const DCX_EXCLUDERGN =       &H00000040
+Const DCX_INTERSECTRGN =     &H00000080
+Const DCX_EXCLUDEUPDATE =    &H00000100
+Const DCX_INTERSECTUPDATE =  &H00000200
+Const DCX_LOCKWINDOWUPDATE = &H00000400
+Const DCX_VALIDATE =         &H00200000
+Declare Function GetDCEx Lib "user32" (hWnd As HWND, hrgnClip As HRGN, dwFlags As DWord) As HDC
+
+Declare Function GetDesktopWindow Lib "user32" () As HWND
+Declare Function GetDialogBaseUnits Lib "user32" () As Long
+Declare Function GetDlgCtrlID Lib "user32" (hWnd As HWND) As Long
+Declare Function GetDlgItem Lib "user32" (hDlg As HWND, nIDDlgItem As Long) As HWND
+Declare Function GetDlgItemInt Lib "user32" (hDlg As HWND, nIDDlgItem As Long, lpTranslated As *BOOL, bSigned As BOOL) As DWord
+Declare Function GetDlgItemText Lib "user32" Alias _FuncName_GetDlgItemText (hDlg As HWND, nIDDlgItem As Long, pString As PTSTR, nMaxCount As Long) As Long
+Declare Function GetDoubleClickTime Lib "user32" () As DWord
+Declare Function GetFocus Lib "user32" () As HWND
+Declare Function GetForegroundWindow Lib "user32" () As HWND
+Declare Function GetIconInfo Lib "user32" (hIcon As HICON, ByRef pIconInfo As ICONINFO) As Long
+Declare Function GetKeyboardState Lib "user32" (lpKeyState As *Byte) As BOOL
+Declare Function GetKeyState Lib "user32" (nVirtKey As Long) As Integer
+Declare Function GetListBoxInfo Lib "user32" (ByVal hwnd As HWND) As DWord
+Declare Function GetMenu Lib "user32" (hWnd As HWND) As HMENU
+
+Declare Function GetMenuContextHelpId Lib "user32" (hmenu As HMENU) As DWord
+Const GMDI_USEDISABLED  = &H0001
+Const GMDI_GOINTOPOPUPS = &H0002
+Declare Function GetMenuDefaultItem Lib "user32" (hMenu As HMENU, fByPos As DWord, gmdiFlags As DWord) As DWord
+
+Declare Function GetMenuItemID Lib "user32" (hMenu As HMENU, nPos As Long) As DWord
+Declare Function GetMenuItemCount Lib "user32" (hMenu As HMENU) As Long
+Declare Function GetMenuItemInfo Lib "user32" Alias _FuncName_GetMenuItemInfo (hMenu As HMENU, uItem As DWord, fByPosition As DWord, ByRef mii As MENUITEMINFO) As BOOL
+Declare Function GetMessage Lib "user32" Alias _FuncName_GetMessage (ByRef Msg As MSG, hWnd As HWND, wMsgFilterMin As DWord, wMsgFilterMax As DWord) As Long
+Const CCHDEVICENAME = 32
+Type MONITORINFO
+	cbSize As DWord
+	rcMonitor As RECT
+	rcWork As RECT
+	dwFlags As DWord
+End Type
+Type MONITORINFOEXA
+	cbSize As DWord
+	rcMonitor As RECT
+	rcWork As RECT
+	dwFlags As DWord
+	szDevice[ELM(CCHDEVICENAME)] As SByte
+End Type
+Type MONITORINFOEXW
+	cbSize As DWord
+	rcMonitor As RECT
+	rcWork As RECT
+	dwFlags As DWord
+	szDevice[ELM(CCHDEVICENAME)] As WCHAR
+End Type
+Declare Function GetMonitorInfo Lib "user32.dll" Alias _FuncName_GetMonitorInfo (hMonitor As HMONITOR, ByRef mi As Any /*MONITORINFO*/) As BOOL
+Declare Function GetNextDlgGroupItem Lib "user32" (hDlg As HWND, hCtl As HWND, bPrevious As BOOL) As HWND
+Declare Function GetNextDlgTabItem Lib "user32" (hDlg As HWND, hCtl As HWND, bPrevious As BOOL) As HWND
+Declare Function GetOpenClipboardWindow Lib "user32" () As HWND
+Declare Function GetParent Lib "user32" (hWnd As HWND) As HWND
+Declare Function GetPriorityClipboardFormat Lib "user32" (lpFormatList As *DWord, FormatNum As Long) As Long
+Declare Function GetProp Lib "user32" Alias _FuncName_GetProp (hWnd As HWND, pString As PCTSTR) As HANDLE
+Declare Function GetScrollInfo Lib "user32" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO) As BOOL
+
+Declare Function GetSubMenu Lib "user32" (hMenu As HMENU, nPos As Long) As HMENU
+
+Const COLOR_SCROLLBAR =               0
+Const COLOR_BACKGROUND =              1
+Const COLOR_ACTIVECAPTION =           2
+Const COLOR_INACTIVECAPTION =         3
+Const COLOR_MENU =                    4
+Const COLOR_WINDOW =                  5
+Const COLOR_WINDOWFRAME =             6
+Const COLOR_MENUTEXT =                7
+Const COLOR_WINDOWTEXT =              8
+Const COLOR_CAPTIONTEXT =             9
+Const COLOR_ACTIVEBORDER =            10
+Const COLOR_INACTIVEBORDER =          11
+Const COLOR_APPWORKSPACE =            12
+Const COLOR_HIGHLIGHT =               13
+Const COLOR_HIGHLIGHTTEXT =           14
+Const COLOR_BTNFACE =                 15
+Const COLOR_BTNSHADOW =               16
+Const COLOR_GRAYTEXT =                17
+Const COLOR_BTNTEXT =                 18
+Const COLOR_INACTIVECAPTIONTEXT =     19
+Const COLOR_BTNHIGHLIGHT =            20
+Const COLOR_3DDKSHADOW =              21
+Const COLOR_3DLIGHT =                 22
+Const COLOR_INFOTEXT =                23
+Const COLOR_INFOBK =                  24
+Const COLOR_HOTLIGHT =                26
+Const COLOR_GRADIENTACTIVECAPTION =   27
+Const COLOR_GRADIENTINACTIVECAPTION = 28
+Const COLOR_DESKTOP =                 COLOR_BACKGROUND
+Const COLOR_3DFACE =                  COLOR_BTNFACE
+Const COLOR_3DSHADOW =                COLOR_BTNSHADOW
+Const COLOR_3DHIGHLIGHT =             COLOR_BTNHIGHLIGHT
+Const COLOR_3DHILIGHT =               COLOR_BTNHIGHLIGHT
+Const COLOR_BTNHILIGHT =              COLOR_BTNHIGHLIGHT
+Declare Function GetSysColor Lib "user32" (nIndex As Long) As DWord
+Declare Function GetSysColorBrush Lib "user32" (nIndex As Long) As HBRUSH
+
+Declare Function GetSystemMenu Lib "user32" (hWnd As HWND, bRevert As BOOL) As HMENU
+
+Const SM_CXSCREEN =           0
+Const SM_CYSCREEN =           1
+Const SM_CXVSCROLL =          2
+Const SM_CYHSCROLL =          3
+Const SM_CYCAPTION =          4
+Const SM_CXBORDER =           5
+Const SM_CYBORDER =           6
+Const SM_CXDLGFRAME =         7
+Const SM_CYDLGFRAME =         8
+Const SM_CYVTHUMB =           9
+Const SM_CXHTHUMB =           10
+Const SM_CXICON =             11
+Const SM_CYICON =             12
+Const SM_CXCURSOR =           13
+Const SM_CYCURSOR =           14
+Const SM_CYMENU =             15
+Const SM_CXFULLSCREEN =       16
+Const SM_CYFULLSCREEN =       17
+Const SM_CYKANJIWINDOW =      18
+Const SM_MOUSEPRESENT =       19
+Const SM_CYVSCROLL =          20
+Const SM_CXHSCROLL =          21
+Const SM_DEBUG =              22
+Const SM_SWAPBUTTON =         23
+Const SM_RESERVED1 =          24
+Const SM_RESERVED2 =          25
+Const SM_RESERVED3 =          26
+Const SM_RESERVED4 =          27
+Const SM_CXMIN =              28
+Const SM_CYMIN =              29
+Const SM_CXSIZE =             30
+Const SM_CYSIZE =             31
+Const SM_CXFRAME =            32
+Const SM_CYFRAME =            33
+Const SM_CXMINTRACK =         34
+Const SM_CYMINTRACK =         35
+Const SM_CXDOUBLECLK =        36
+Const SM_CYDOUBLECLK =        37
+Const SM_CXICONSPACING =      38
+Const SM_CYICONSPACING =      39
+Const SM_MENUDROPALIGNMENT =  40
+Const SM_PENWINDOWS =         41
+Const SM_DBCSENABLED =        42
+Const SM_CMOUSEBUTTONS =      43
+Const SM_CXFIXEDFRAME =       SM_CXDLGFRAME
+Const SM_CYFIXEDFRAME =       SM_CYDLGFRAME
+Const SM_CXSIZEFRAME =        SM_CXFRAME
+Const SM_CYSIZEFRAME =        SM_CYFRAME
+Const SM_SECURE =             44
+Const SM_CXEDGE =             45
+Const SM_CYEDGE =             46
+Const SM_CXMINSPACING =       47
+Const SM_CYMINSPACING =       48
+Const SM_CXSMICON =           49
+Const SM_CYSMICON =           50
+Const SM_CYSMCAPTION =        51
+Const SM_CXSMSIZE =           52
+Const SM_CYSMSIZE =           53
+Const SM_CXMENUSIZE =         54
+Const SM_CYMENUSIZE =         55
+Const SM_ARRANGE =            56
+Const SM_CXMINIMIZED =        57
+Const SM_CYMINIMIZED =        58
+Const SM_CXMAXTRACK =         59
+Const SM_CYMAXTRACK =         60
+Const SM_CXMAXIMIZED =        61
+Const SM_CYMAXIMIZED =        62
+Const SM_NETWORK =            63
+Const SM_CLEANBOOT =          67
+Const SM_CXDRAG =             68
+Const SM_CYDRAG =             69
+Const SM_SHOWSOUNDS =         70
+Const SM_CXMENUCHECK =        71
+Const SM_CYMENUCHECK =        72
+Const SM_SLOWMACHINE =        73
+Const SM_MIDEASTENABLED =     74
+Const SM_MOUSEWHEELPRESENT =  75
+Declare Function GetSystemMetrics Lib "user32" (nIndex As Long) As Long
+
+Declare Function GetUpdateRect Lib "user32" (hWnd As HWND, ByRef lpRect As RECT, bErase As BOOL) As BOOL
+Declare Function GetUpdateRgn Lib "user32" (hWnd As HWND, hRgn As HRGN, bErase As BOOL) As BOOL
+
+Const GW_HWNDFIRST =      0
+Const GW_HWNDLAST =       1
+Const GW_HWNDNEXT =       2
+Const GW_HWNDPREV =       3
+Const GW_OWNER =          4
+Const GW_CHILD =          5
+Declare Function GetWindow Lib "user32" (hWnd As HWND, uCmd As DWord) As HWND
+
+Declare Function GetTopWindow Lib "user32" (ByVal hWnd As HWND) As HWND
+
+Function GetNextWindow(ByVal hWnd As HWND, ByVal wCmd As DWord) As HWND
+	Return GetWindow(hWnd, wCmd) As HWND
+End Function
+Function GetSysModalWindow() As HWND
+	Return (NULL) As HWND
+End Function
+Function SetSysModalWindow(ByVal hWnd As HWND) As HWND
+	Return (NULL) As HWND
+End Function
+
+Function GetWindowTask(hWnd As HWND) As HANDLE
+	Return GetWindowThreadProcessId(hWnd, NULL) As HANDLE
+End Function
+
+Declare Function GetLastActivePopup Lib "user32" (ByVal hWnd As HWND) As HWND
+
+
+Declare Function GetWindowContextHelpId Lib "user32" (hwnd As HWND) As DWord
+
+Declare Function GetWindowDC Lib "user32" (hWnd As HWND) As HDC
+
+#ifndef _WIN64
+Const GWL_WNDPROC =       -4
+Const GWL_HINSTANCE =     -6
+Const GWL_HWNDPARENT =    -8
+Const GWL_USERDATA =      -21
+Const GWL_ID =            -12
+#endif
+
+Const GWL_STYLE =         -16
+Const GWL_EXSTYLE =       -20
+
+Const GWLP_WNDPROC =      -4
+Const GWLP_HINSTANCE =    -6
+Const GWLP_HWNDPARENT =   -8
+Const GWLP_USERDATA =     -21
+Const GWLP_ID =           -12
+
+
+#ifdef _WIN64
+Declare Function GetWindowLong Lib "user32" Alias _FuncName_GetWindowLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
+Declare Function GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
+#else
+Declare Function GetWindowLong Lib "user32" Alias _FuncName_GetWindowLong (hWnd As HWND, nIndex As Long) As LONG_PTR
+Declare Function GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLong (hWnd As HWND, nIndex As Long) As LONG_PTR
+#endif
+Declare Function GetWindowModuleFileName Lib "user32" Alias _FuncName_GetWindowModuleFileName (hwnd As HWND, pszFileName As LPTSTR, cchFileNameMax As DWord) As DWord
+
+Const WPF_SETMINPOSITION =     &H0001
+Const WPF_RESTORETOMAXIMIZED = &H0002
+Type WINDOWPLACEMENT
+	length As DWord
+	flags As DWord
+	showCmd As DWord
+	ptMinPosition As POINTAPI
+	ptMaxPosition As POINTAPI
+	rcNormalPosition As RECT
+End Type
+Declare Function GetWindowPlacement Lib "user32" (hWnd As HWND, ByRef lpwndpl As WINDOWPLACEMENT) As BOOL
+
+Declare Function GetWindowRect Lib "user32" (hWnd As HWND, ByRef lpRect As RECT) As BOOL
+
+Declare Function GetWindowRgn Lib "user32" (hWnd As HWND, hRgn As HRGN) As Long
+Declare Function ExcludeUpdateRgn Lib "user32" (ByVal hDC As HDC, ByVal hWnd As HWND) As Long
+
+Declare Function GetWindowText Lib "user32" Alias _FuncName_GetWindowText (hWnd As HWND, lpString As PTSTR, nMaxCount As Long) As Long
+Declare Function GetWindowTextLength Lib "user32" Alias _FuncName_GetWindowTextLength (hWnd As HWND) As Long
+Declare Function GetWindowThreadProcessId Lib "user32" (hWnd As HWND, pdwProcessId As *DWord) As DWord
+Declare Function HideCaret Lib "user32" (hWnd As HWND) As BOOL
+Declare Function InsertMenuItem Lib "user32" Alias _FuncName_InsertMenuItem (hMenu As HMENU, uItem As DWord, fByPosition As BOOL, ByRef mii As MENUITEMINFO) As BOOL
+Declare Function InvalidateRect Lib "user32" (hWnd As HWND, ByRef Rect As RECT, bErase As BOOL) As BOOL
+Declare Function InvalidateRgn Lib "user32" (hWnd As HWND, hRgn As HRGN, bErase As BOOL) As BOOL
+Declare Function InvertRect Lib "user32" (hdc As HDC, ByRef lpRect As RECT) As BOOL
+Declare Function IsCharAlpha Lib "user32" Alias _FuncName_IsCharAlpha (ch As TCHAR) As BOOL
+Declare Function IsCharAlphaNumeric Lib "user32" Alias _FuncName_IsCharAlphaNumeric (ch As TCHAR) As BOOL
+Declare Function IsCharLower Lib "user32" Alias _FuncName_IsCharLower (ch As TCHAR) As BOOL
+Declare Function IsCharUpper Lib "user32" Alias _FuncName_IsCharUpper (ch As TCHAR) As BOOL
+Declare Function IsChild Lib "user32" (hWndParent As HWND, hWnd As HWND) As BOOL
+Declare Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As DWord) As BOOL
+Declare Function IsDialogMessage Lib "user32" Alias _FuncName_IsDialogMessage (hDlg As HWND, ByRef msg As MSG) As BOOL
+Declare Function IsDlgButtonChecked Lib "user32" (hDlg As HWND, nIDButton As Long) As DWord
+Declare Function IsIconic Lib "user32" (hWnd As HWND) As BOOL
+Declare Function IsWindow Lib "user32" (hWnd As HWND) As BOOL
+Declare Function IsWindowEnabled Lib "user32" (hWnd As HWND) As BOOL
+Declare Function IsWindowUnicode Lib "user32" (hWnd As HWND) As BOOL
+Declare Function IsWindowVisible Lib "user32" (hWnd As HWND) As BOOL
+Declare Function IsZoomed Lib "user32" (hWnd As HWND) As BOOL
+
+Const KEYEVENTF_EXTENDEDKEY = &H0001
+Const KEYEVENTF_KEYUP       = &H0002
+Declare Sub keybd_event Lib "user32" (bVk As Byte, bScan As Byte, dwFlags As DWord, dwExtraInfo As DWord)
+
+Declare Function KillTimer Lib "user32" (hWnd As HWND, nIDEvent As ULONG_PTR) As BOOL
+Declare Function LoadBitmap Lib "user32" Alias _FuncName_LoadBitmap (hInst As HINSTANCE, pBitmapName As PCTSTR) As HBITMAP
+
+Const IDC_ARROW =         32512
+Const IDC_IBEAM =         32513
+Const IDC_WAIT =          32514
+Const IDC_CROSS =         32515
+Const IDC_UPARROW =       32516
+Const IDC_SIZE =          32640
+Const IDC_ICON =          32641
+Const IDC_SIZENWSE =      32642
+Const IDC_SIZENESW =      32643
+Const IDC_SIZEWE =        32644
+Const IDC_SIZENS =        32645
+Const IDC_SIZEALL =       32646
+Const IDC_NO =            32648
+Const IDC_HAND =          32649
+Const IDC_APPSTARTING =   32650
+Const IDC_HELP =          32651
+Declare Function LoadCursor Lib "user32" Alias _FuncName_LoadCursor (hInst As HINSTANCE, pCursorName As PCTSTR) As HCURSOR
+
+Declare Function LoadCursorFromFile Lib "user32" Alias _FuncName_LoadCursorFromFile (pFileName As PCTSTR) As HCURSOR
+
+Const IDI_APPLICATION =   32512
+Const IDI_HAND =          32513
+Const IDI_QUESTION =      32514
+Const IDI_EXCLAMATION =   32515
+Const IDI_ASTERISK =      32516
+Const IDI_WINLOGO =       32517
+Declare Function LoadIcon Lib "user32" Alias _FuncName_LoadIcon (hInst As HINSTANCE, pIconName As PCTSTR) As HICON
+
+Const IMAGE_BITMAP =      0
+Const IMAGE_ICON =        1
+Const IMAGE_CURSOR =      2
+Const IMAGE_ENHMETAFILE = 3
+Const LR_DEFAULTCOLOR =     &H0000
+Const LR_MONOCHROME =       &H0001
+Const LR_COLOR =            &H0002
+Const LR_COPYRETURNORG =    &H0004
+Const LR_COPYDELETEORG =    &H0008
+Const LR_LOADFROMFILE =     &H0010
+Const LR_LOADTRANSPARENT =  &H0020
+Const LR_DEFAULTSIZE =      &H0040
+Const LR_VGACOLOR =         &H0080
+Const LR_LOADMAP3DCOLORS =  &H1000
+Const LR_CREATEDIBSECTION = &H2000
+Const LR_COPYFROMRESOURCE = &H4000
+Const LR_SHARED =           &H8000
+Declare Function LoadImage Lib "user32" Alias _FuncName_LoadImage (hinst As HINSTANCE, pszName As PCTSTR, dwImageType As DWord, cxDesired As Long, cyDesired As Long, dwFlags As DWord) As HANDLE
+Declare Function LoadString Lib "user32" Alias _FuncName_LoadString (hInstance As HINSTANCE, uID As DWord, lpBuffer As LPTSTR, nBufferMax As Long) As Long
+Declare Function LockWindowUpdate Lib "user32" (hWnd As HWND) As BOOL
+Declare Function MapVirtualKey Lib "user32" Alias _FuncName_MapVirtualKey (wCode As DWord, wMapType As DWord) As DWord
+Declare Function MapWindowPoints Lib "user32" (
+	hWndFrom As HWND,
+	hWndTo As HWND,
+	pPoints As *POINTAPI,
+	cPoints As DWord) As Long
+Declare Function MessageBeep Lib "user32" (uType As DWord) As BOOL
+
+Const MB_OK =                     &H00000000
+Const MB_OKCANCEL =               &H00000001
+Const MB_ABORTRETRYIGNORE =       &H00000002
+Const MB_YESNOCANCEL =            &H00000003
+Const MB_YESNO =                  &H00000004
+Const MB_RETRYCANCEL =            &H00000005
+Const MB_ICONHAND =               &H00000010
+Const MB_ICONQUESTION =           &H00000020
+Const MB_ICONEXCLAMATION =        &H00000030
+Const MB_ICONASTERISK =           &H00000040
+Const MB_USERICON =               &H00000080
+Const MB_ICONWARNING =            MB_ICONEXCLAMATION
+Const MB_ICONERROR =              MB_ICONHAND
+Const MB_ICONINFORMATION =        MB_ICONASTERISK
+Const MB_ICONSTOP =               MB_ICONHAND
+Const MB_DEFBUTTON1 =             &H00000000
+Const MB_DEFBUTTON2 =             &H00000100
+Const MB_DEFBUTTON3 =             &H00000200
+Const MB_DEFBUTTON4 =             &H00000300
+Const MB_APPLMODAL =              &H00000000
+Const MB_SYSTEMMODAL =            &H00001000
+Const MB_TASKMODAL =              &H00002000
+Const MB_HELP =                   &H00004000
+Const MB_NOFOCUS =                &H00008000
+Const MB_SETFOREGROUND =          &H00010000
+Const MB_DEFAULT_DESKTOP_ONLY =   &H00020000
+Const MB_TOPMOST =                &H00040000
+Const MB_RIGHT =                  &H00080000
+Const MB_RTLREADING =             &H00100000
+Const MB_SERVICE_NOTIFICATION =   &H00200000
+#ifdef UNICODE
+Declare Function MessageBox Lib "user32" Alias "MessageBoxW" (hwnd As HWND, pText As PCWSTR, pCaption As PCWSTR, uType As DWord) As Long
+#else
+Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (hwnd As HWND, pText As PCSTR, pCaption As PCSTR, uType As DWord) As Long
+#endif
+Declare Function MessageBoxW Lib "user32" (hWnd As HWND, pText As PCWSTR, pCaption As PCWSTR, uType As DWord) As Long
+Declare Function MessageBoxA Lib "user32" (hWnd As HWND, pText As PCSTR, pCaption As PCSTR, uType As DWord) As Long
+Const MOUSEEVENTF_MOVE =       &H0001
+Const MOUSEEVENTF_LEFTDOWN =   &H0002
+Const MOUSEEVENTF_LEFTUP =     &H0004
+Const MOUSEEVENTF_RIGHTDOWN =  &H0008
+Const MOUSEEVENTF_RIGHTUP =    &H0010
+Const MOUSEEVENTF_MIDDLEDOWN = &H0020
+Const MOUSEEVENTF_MIDDLEUP =   &H0040
+Const MOUSEEVENTF_WHEEL =      &H0800
+Const MOUSEEVENTF_ABSOLUTE =   &H8000
+Declare Sub mouse_event Lib "user32" (dwFlags As DWord, dx As DWord, dy As DWord, dwData As DWord, dwExtraInfo As DWord)
+
+Declare Function MoveWindow Lib "user32" (hWnd As HWND, x As Long, y As Long, nWidth As Long, nHight As Long, bRepaint As BOOL) As BOOL
+Declare Function OpenClipboard Lib "user32" (hWndNewOwner As HWND) As BOOL
+Declare Function OpenIcon Lib "user32" (hWnd As HWND) As BOOL
+
+Const PM_NOREMOVE = &H0000
+Const PM_REMOVE =   &H0001
+Declare Function PeekMessage Lib "user32" Alias _FuncName_PeekMessage (ByRef Msg As MSG, hWnd As HWND, wMsgFilterMin As DWord, wMsgFilterMax As DWord, wRemoveMsg As DWord) As BOOL
+
+Const HWND_BROADCAST = &HFFFF
+Declare Function PostMessage Lib "user32" Alias _FuncName_PostMessage (hWnd As HWND, wMsg As DWord, wParam As WPARAM, lParam As LPARAM) As BOOL
+
+Declare Sub PostQuitMessage Lib "user32" (nExitCode As Long)
+Declare Function PostThreadMessage Lib "user32" Alias _FuncName_PostThreadMessage (idThread As DWord, Msg As DWord, wParam As WPARAM, lParam As LPARAM) As BOOL
+Declare Function RealChildWindowFromPoint Lib "user32" (hwndParent As HWND, xPoint As Long, yPoint As Long) As HWND
+
+Const RDW_INVALIDATE =        &H0001
+Const RDW_INTERNALPAINT =     &H0002
+Const RDW_ERASE =             &H0004
+Const RDW_VALIDATE =          &H0008
+Const RDW_NOINTERNALPAINT =   &H0010
+Const RDW_NOERASE =           &H0020
+Const RDW_NOCHILDREN =        &H0040
+Const RDW_ALLCHILDREN =       &H0080
+Const RDW_UPDATENOW =         &H0100
+Const RDW_ERASENOW =          &H0200
+Const RDW_FRAME =             &H0400
+Const RDW_NOFRAME =           &H0800
+Declare Function RedrawWindow Lib "user32" (hWnd As HWND, ByRef lprcUpdate As RECT, hrgnUpdate As HRGN, flags As DWord) As BOOL
+
+Declare Function RegisterClassEx Lib "user32" Alias _FuncName_RegisterClassEx (ByRef wcx As WNDCLASSEX) As ATOM
+Declare Function RegisterClipboardFormat Lib "user32" Alias _FuncName_RegisterClipboardFormat (pszFormat As PCTSTR) As DWord
+Declare Function RegisterHotKey lib "user32.dll" (hwnd As HWND, id As Long, dwModufuers As DWord, vk As DWord) As BOOL
+Declare Function RegisterWindowMessage Lib "user32" Alias _FuncName_RegisterWindowMessage (pString As PCTSTR) As DWord
+Declare Function ReleaseCapture Lib "user32" () As BOOL
+Declare Function ReleaseDC Lib "user32" (hWnd As HWND, hdc As HDC) As BOOL
+Declare Function RemoveMenu Lib "user32" (hMenu As HMENU, uPosition As DWord, uFlags As DWord) As BOOL
+Declare Function RemoveProp Lib "user32" Alias _FuncName_RemoveProp (hWnd As HWND, pString As PCTSTR) As HANDLE
+Declare Function TranslateAccelerator Lib "user32" Alias _FuncName_TranslateAccelerator (hwnd As HWND, hAccTable As HACCEL, ByRef msg As MSG) As Long
+Declare Function TranslateMessage Lib "user32" (ByRef msg As MSG) As Long
+Declare Function ScreenToClient Lib "user32" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
+Declare Function ScrollDC Lib "user32" (hdc As HDC, dx As Long, dy As Long, ByRef rcScroll As RECT, ByRef rcClip As RECT, hrgnUpdate As HRGN, ByRef rcUpdate As RECT) As BOOL
+
+Declare Function SetScrollPos Lib "user32" (ByVal hWnd As HWND, ByVal nBar As Long, ByVal nPos As Long, ByVal bRedraw As BOOL) As Long
+Declare Function GetScrollPos Lib "user32" (ByVal hWnd As HWND, ByVal nBar As Long) As Long
+Declare Function SetScrollRange Lib "user32" (ByVal hWnd As HWND, ByVal nBar As Long, ByVal nMinPos As Long, ByVal nMaxPos As Long, ByVal bRedraw As BOOL) As BOOL
+Declare Function GetScrollRange Lib "user32" (ByVal hWnd As HWND, ByVal nBar As Long, ByRef lpMinPos As Long, ByRef lpMaxPos As Long) As BOOL
+
+Const SW_SCROLLCHILDREN = &H0001
+Const SW_INVALIDATE =     &H0002
+Const SW_ERASE =          &H0004
+Declare Function ScrollWindowEx Lib "user32" (hWnd As HWND, dx As Long, dy As Long, ByRef rcScroll As RECT, ByRef rcClip As RECT, hrgnUpdate As HRGN, ByRef rcUpdate As RECT, flags As DWord) As BOOL
+
+Declare Function SendDlgItemMessage Lib "user32" Alias _FuncName_SendDlgItemMessage (hDlg As HWND, nIDDlgItem As Long, Msg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
+Declare Function SendMessage Lib "user32" Alias _FuncName_SendMessage (hWnd As HWND, wMsg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
+Declare Function SendNotifyMessage Lib "user32" Alias _FuncName_SendNotifyMessage (hWnd As HWND, wMsg As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
+Declare Function SetActiveWindow Lib "user32" (hWnd As HWND) As HWND
+Declare Function SetDlgItemInt Lib "user32" (hDlg As HWND, nIDDlgItem As Long, uValue As DWord, bSigned As BOOL) As BOOL
+Declare Function SetDlgItemText Lib "user32" Alias _FuncName_SetDlgItemText (hDlg As HWND, nIDDlgItem As Long, lpString As PCTSTR) As BOOL
+Declare Function SetCapture Lib "user32" (hWnd As HWND) As HWND
+Declare Function SetCaretPos Lib "user32" (x As Long, y As Long) As BOOL
+
+#ifdef _WIN64
+Declare Function SetClassLong Lib "user32" Alias _FuncName_SetClassLongPtr (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
+Declare Function SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLongPtr (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
+#else
+Declare Function SetClassLong Lib "user32" Alias _FuncName_SetClassLong (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
+Declare Function SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLong (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
+#endif
+
+Declare Function SetClipboardData Lib "user32" (uFormat As DWord, hMem As HANDLE) As HANDLE
+Declare Function SetClipboardViewer Lib "user32" (ByVal hWndNewViewer As HWND) As HWND
+Declare Function SetCursor Lib "user32" (hCursor As HCURSOR) As HCURSOR
+Declare Function SetCursorPos Lib "user32" (x As Long, y As Long) As BOOL
+Declare Function SetDoubleClickTime Lib "user32" (uInterval As DWord) As BOOL
+Declare Function SetFocus Lib "user32" (hWnd As HWND) As HWND
+Declare Function SetForegroundWindow Lib "user32" (hWnd As HWND) As BOOL
+Declare Function SetKeyboardState Lib "user32" (lpKeyState As *Byte) As BOOL
+
+Declare Function GetKeyNameTextA Lib "user32" (ByVal lParam As Long, ByVal lpString As LPSTR, ByVal cchSize As Long) As Long
+Declare Function GetKeyNameTextW Lib "user32" (ByVal lParam As Long, ByVal lpString As LPWSTR, ByVal cchSize As Long) As Long
+#ifdef UNICODE
+Declare Function GetKeyNameText Lib "user32" Alias "GetKeyNameTextW" (ByVal lParam As Long, ByVal lpString As LPWSTR, ByVal cchSize As Long) As Long
+#else
+Declare Function GetKeyNameText Lib "user32" Alias "GetKeyNameTextA" (ByVal lParam As Long, ByVal lpString As LPSTR, ByVal cchSize As Long) As Long
+#endif ' !UNICODE
+Declare Function GetKeyboardType Lib "user32" (ByVal nTypeFlag As Long) As Long
+
+Declare Function ToAscii Lib "user32" (ByVal uVirtKey As DWord, ByVal uScanCode As DWord, ByVal lpKeyState As *Byte, ByVal lpChar As *WORD, ByVal uFlags As DWord) As Long
+Declare Function ToAsciiEx Lib "user32" (ByVal uVirtKey As DWord, ByVal uScanCode As DWord, ByVal lpKeyState As *Byte, ByVal lpChar As *WORD, ByVal uFlags As DWord, ByVal dwhkl As HKL) As Long
+
+Declare Function ToUnicode Lib "user32" (ByVal uVirtKey As DWord, ByVal uScanCode As DWord, ByVal lpKeyState As *Byte, ByVal pwszBuff As LPWSTR, ByVal cchBuff As Long, ByVal wFlags As DWord) As Long
+
+Declare Function OemKeyScan Lib "user32" (ByVal wOemChar As Word) As DWord
+
+Declare Function VkKeyScanA Lib "user32" (ByVal ch As SByte) As Integer
+Declare Function VkKeyScanW Lib "user32" (ByVal ch As Word) As Integer
+#ifdef UNICODE
+Declare Function VkKeyScan Lib "user32" Alias "VkKeyScanW" (ByVal ch As Word) As Integer
+#else
+Declare Function VkKeyScan Lib "user32" Alias "VkKeyScanA" (ByVal ch As SByte) As Integer
+#endif ' !UNICODE
+
+Declare Function VkKeyScanExA Lib "user32" (ByVal ch As SByte, ByVal dwhkl As HKL) As Integer
+Declare Function VkKeyScanExW Lib "user32" (ByVal ch As Word, ByVal dwhkl As HKL) As Integer
+#ifdef UNICODE
+Declare Function VkKeyScanEx Lib "user32" Alias "VkKeyScanW" (ByVal ch As Word, ByVal dwhkl As HKL) As Integer
+#else
+Declare Function VkKeyScanEx Lib "user32" Alias "VkKeyScanA" (ByVal ch As SByte, ByVal dwhkl As HKL) As Integer
+#endif ' !UNICODE
+
+Type MOUSEINPUT
+	dx As Long
+	dy As Long
+	mouseData As DWord
+	dwFlags As DWord
+	time As DWord
+	dwExtraInfo As ULONG_PTR
+End Type
+TypeDef PMOUSEINPUT = *MOUSEINPUT
+TypeDef LPMOUSEINPUT = *MOUSEINPUT
+
+Type KEYBDINPUT
+	wVk As Word
+	wScan As Word
+	dwFlags As DWord
+	time As DWord
+	dwExtraInfo As ULONG_PTR
+End Type
+TypeDef PKEYBDINPUT = *KEYBDINPUT
+TypeDef LPKEYBDINPUT = *KEYBDINPUT
+
+Type HARDWAREINPUT
+	uMsg As DWord
+	wParamL As Word
+	wParamH As Word
+End Type
+TypeDef PHARDWAREINPUT = *HARDWAREINPUT
+TypeDef LPHARDWAREINPUT = *HARDWAREINPUT
+
+Const INPUT_MOUSE = 0
+Const INPUT_KEYBOARD = 1
+Const INPUT_HARDWARE = 2
+
+Type INPUT
+	types As DWord
+#ifdef _WIN64
+	union[6] As DWord
+#else
+	union[5] As DWord
+#endif
+/*	Union
+		mi As MOUSEINPUT
+		ki As KEYBDINPUT
+		hi As HARDWAREINPUT
+	End Union*/
+End Type
+TypeDef PINPUT = *INPUT
+TypeDef LPINPUT = *INPUT
+
+Declare Function SendInput Lib "user32" (ByVal cInputs As DWord, ByVal pInputs As *INPUT, ByVal cbSize As Long) As DWord
+
+Declare Function MapVirtualKeyA Lib "user32" (ByVal uCode As DWord, ByVal uMapType As DWord) As DWord
+Declare Function MapVirtualKeyW Lib "user32" (ByVal uCode As DWord, ByVal uMapType As DWord) As DWord
+#ifdef UNICODE
+Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyW" (ByVal uCode As DWord, ByVal uMapType As DWord) As DWord
+#else
+Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal uCode As DWord, ByVal uMapType As DWord) As DWord
+#endif ' !UNICODE
+
+Declare Function MapVirtualKeyExA Lib "user32" (ByVal uCode As DWord, ByVal uMapType As DWord, ByVal dwhkl As HKL) As DWord
+Declare Function MapVirtualKeyExW Lib "user32" (ByVal uCode As DWord, ByVal uMapType As DWord, ByVal dwhkl As HKL) As DWord
+#ifdef UNICODE
+Declare Function MapVirtualKeyEx Lib "user32" Alias "MapVirtualKeyExW" (ByVal uCode As DWord, ByVal uMapType As DWord, ByVal dwhkl As HKL) As DWord
+#else
+Declare Function MapVirtualKeyEx Lib "user32" Alias "MapVirtualKeyExA" (ByVal uCode As DWord, ByVal uMapType As DWord, ByVal dwhkl As HKL) As DWord
+#endif ' !UNICODE
+
+Declare Function GetInputState Lib "user32" () As BOOL
+Declare Function GetQueueStatus Lib "user32" (ByVal flags As DWord) As DWord
+
+Const QS_KEY = &H0001
+Const QS_MOUSEMOVE = &H0002
+Const QS_MOUSEBUTTON = &H0004
+Const QS_POSTMESSAGE = &H0008
+Const QS_TIMER = &H0010
+Const QS_PAINT = &H0020
+Const QS_SENDMESSAGE = &H0040
+Const QS_HOTKEY = &H0080
+Const QS_ALLPOSTMESSAGE = &H0100
+'Const QS_RAWINPUT = &H0400
+
+Const QS_MOUSE = (QS_MOUSEMOVE or QS_MOUSEBUTTON)
+Const QS_INPUT = (QS_MOUSE or QS_KEY /* or QS_RAWINPUT*/)
+Const QS_ALLEVENTS = (QS_INPUT or QS_POSTMESSAGE or QS_TIMER or QS_PAINT or QS_HOTKEY)
+Const QS_ALLINPUT = (QS_INPUT or QS_POSTMESSAGE or QS_TIMER or QS_PAINT or QS_HOTKEY or QS_SENDMESSAGE)
+
+Declare Function MsgWaitForMultipleObjects Lib "user32" (ByVal nCount As DWord, ByVal pHandles As *HANDLE, ByVal fWaitAll As BOOL, ByVal dwMilliseconds As DWord, ByVal dwWakeMask As DWord) As DWord
+Declare Function MsgWaitForMultipleObjectsEx Lib "user32" (ByVal nCount As DWord, ByVal pHandles As *HANDLE, ByVal dwMilliseconds As DWord, ByVal dwWakeMask As DWord, ByVal dwFlags As DWord) As DWord
+
+Const MWMO_WAITALL = &H0001
+Const MWMO_ALERTABLE = &H0002
+Const MWMO_INPUTAVAILABLE = &H0004
+
+
+Declare Function SetMenu Lib "user32" (hWnd As HWND, hMenu As HMENU) As BOOL
+
+Declare Function ChangeMenuA Lib "user32" (ByVal hMenu As HMENU, ByVal cmd As DWord, ByVal lpszNewItem As LPCSTR, ByVal cmdInsert As DWord, ByVal flags As DWord) As BOOL
+Declare Function ChangeMenuW Lib "user32" (ByVal hMenu As HMENU, ByVal cmd As DWord, ByVal lpszNewItem As LPCWSTR, ByVal cmdInsert As DWord, ByVal flags As DWord) As BOOL
+#ifdef UNICODE
+Declare Function ChangeMenu Lib "user32" Alias "ChangeMenuW" (ByVal hMenu As HMENU, ByVal cmd As DWord, ByVal lpszNewItem As LPCWSTR, ByVal cmdInsert As DWord, ByVal flags As DWord) As BOOL
+#else
+Declare Function ChangeMenu Lib "user32" Alias "ChangeMenuA" (ByVal hMenu As HMENU, ByVal cmd As DWord, ByVal lpszNewItem As LPCSTR, ByVal cmdInsert As DWord, ByVal flags As DWord) As BOOL
+#endif ' !UNICODE
+
+Declare Function HiliteMenuItem Lib "user32" (ByVal hWnd As HWND, ByVal hMenu As HMENU, ByVal uIDHiliteItem As DWord, ByVal uHilite As DWord) As BOOL
+
+Declare Function GetMenuStringA Lib "user32" (ByVal hMenu As HMENU, ByVal uIDItem As DWord, ByVal lpString As LPSTR, ByVal cchMax As Long, ByVal flags As DWord) As Long
+Declare Function GetMenuStringW Lib "user32" (ByVal hMenu As HMENU, ByVal uIDItem As DWord, ByVal lpString As LPWSTR, ByVal cchMax As Long, ByVal flags As DWord) As Long
+#ifdef UNICODE
+Declare Function GetMenuString Lib "user32" Alias "GetMenuStringW" (ByVal hMenu As HMENU, ByVal uIDItem As DWord, ByVal lpString As LPWSTR, ByVal cchMax As Long, ByVal flags As DWord) As Long
+#else
+Declare Function GetMenuString Lib "user32" Alias "GetMenuStringA" (ByVal hMenu As HMENU, ByVal uIDItem As DWord, ByVal lpString As LPSTR, ByVal cchMax As Long, ByVal flags As DWord) As Long
+#endif ' !UNICODE
+
+Declare Function GetMenuState Lib "user32" (ByVal hMenu As HMENU, ByVal uId As DWord, ByVal uFlags As DWord) As DWord
+
+Declare Function AppendMenuA Lib "user32" (ByVal hMenu As HMENU, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCSTR) As BOOL
+Declare Function AppendMenuW Lib "user32" (ByVal hMenu As HMENU, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCWSTR) As BOOL
+#ifdef UNICODE
+Declare Function AppendMenu Lib "user32" Alias "AppendMenuW" (ByVal hMenu As HMENU, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCWSTR) As BOOL
+#else
+Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As HMENU, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCSTR) As BOOL
+#endif ' !UNICODE
+
+Declare Function ModifyMenuA Lib "user32" (ByVal hMnu As HMENU, ByVal uPosition As DWord, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCSTR) As BOOL
+Declare Function ModifyMenuW Lib "user32" (ByVal hMnu As HMENU, ByVal uPosition As DWord, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCWSTR) As BOOL
+#ifdef UNICODE
+Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuW" (ByVal hMnu As HMENU, ByVal uPosition As DWord, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCWSTR) As BOOL
+#else
+Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMnu As HMENU, ByVal uPosition As DWord, ByVal uFlags As DWord, ByVal uIDNewItem As ULONG_PTR, ByVal lpNewItem As LPCSTR) As BOOL
+#endif ' !UNICODE
+
+Declare Function SetMenuItemBitmaps Lib "user32" (ByVal hMenu As HMENU, ByVal uPosition As DWord, ByVal uFlags As DWord, ByVal hBitmapUnchecked As HBITMAP, ByVal hBitmapChecked As HBITMAP) As BOOL
+
+Declare Function GetMenuCheckMarkDimensions Lib "user32" () As Long
+
+Type TPMPARAMS
+	cbSize As DWord
+	rcExclude As RECT
+End Type
+TypeDef LPTPMPARAMS = *TPMPARAMS
+
+Declare Function TrackPopupMenuEx Lib "user32" (ByVal hMenu As HMENU, ByVal fuFlags As DWord, ByVal x As Long, ByVal y As Long, ByVal hwnd As HWND, ByVal lptpm As *TPMPARAMS) As BOOL
+Declare Function GetMenuItemRect Lib "user32" (ByVal hWnd As HWND, ByVal hMenu As HMENU, ByVal uItem As DWord, ByRef lprcItem As RECT) As BOOL
+Declare Function MenuItemFromPoint Lib "user32" (ByVal hWnd As HWND, ByVal hMenu As HMENU, ByRef ptScreen As POINTAPI) As Long
+
+Declare Function SetMenuContextHelpId Lib "user32" (hmenu As HMENU, dwContextHelpId As DWord) As BOOL
+Declare Function SetMenuDefaultItem Lib "user32" (hMenu As HMENU, uItem As DWord, fByPos As DWord) As BOOL
+Declare Function SetMenuItemInfo Lib "user32" Alias _FuncName_SetMenuItemInfo (hMenu As HMENU, uItem As DWord, fByPosition As BOOL, ByRef mii As MENUITEMINFO) As BOOL
+Declare Function SetParent Lib "user32" (hWndChild As HWND, hWndNewParent As HWND) As HWND
+Declare Function SetProp Lib "user32" Alias _FuncName_SetProp (hWnd As HWND, pString As PCTSTR, hData As HANDLE) As BOOL
+
+TypeDef PROPENUMPROCEXA = *Function(ByVal hwnd As HWND, ByVal lpszString As LPSTR, ByVal hData As HANDLE, ByVal dwData As ULONG_PTR) As BOOL
+TypeDef PROPENUMPROCEXW = *Function(ByVal hwnd As HWND, ByVal lpszString As LPWSTR, ByVal hData As HANDLE, ByVal dwData As ULONG_PTR) As BOOL
+#ifdef UNICODE
+TypeDef PROPENUMPROCEX = PROPENUMPROCEXW
+#else
+TypeDef PROPENUMPROCEX = PROPENUMPROCEXA
+#endif ' !UNICODE
+
+Declare Function EnumPropsExA Lib "user32" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCEXA, ByVal lParam As LPARAM) As Long
+Declare Function EnumPropsExW Lib "user32" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCEXW, ByVal lParam As LPARAM) As Long
+#ifdef UNICODE
+Declare Function EnumPropsEx Lib "user32" Alias "EnumPropsExW" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCEXW, ByVal lParam As LPARAM) As Long
+#else
+Declare Function EnumPropsEx Lib "user32" Alias "EnumPropsExA" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCEXA, ByVal lParam As LPARAM) As Long
+#endif ' !UNICODE
+
+
+TypeDef PROPENUMPROCA = *Function(ByVal hwnd As HWND, ByVal lpszString As LPCSTR, ByVal hData As HANDLE) As BOOL
+TypeDef PROPENUMPROCW = *Function(ByVal hwnd As HWND, ByVal lpszString As LPCWSTR, ByVal hData As HANDLE) As BOOL
+#ifdef UNICODE
+TypeDef PROPENUMPROC = PROPENUMPROCW
+#else
+TypeDef PROPENUMPROC = PROPENUMPROCA
+#endif ' !UNICODE
+
+Declare Function EnumPropsA Lib "user32" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCA) As Long
+Declare Function EnumPropsW Lib "user32" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCW) As Long
+#ifdef UNICODE
+Declare Function EnumProps Lib "user32" Alias "EnumPropsW" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCW) As Long
+#else
+Declare Function EnumProps Lib "user32" Alias "EnumPropsA" (ByVal hWnd As HWND, ByVal lpEnumFunc As PROPENUMPROCA) As Long
+#endif ' !UNICODE
+
+Declare Function SetRect Lib "User32" (ByRef rc As RECT, xLeft As Long, yTop As Long, xRight As Long, yBottom As Long) As Long
+Declare Function SetRectEmpty Lib "user32" (ByRef lprc As RECT) As BOOL
+Declare Function CopyRect Lib "user32" (ByRef lprcDst As RECT, ByRef lprcSrc As RECT) As BOOL
+Declare Function InflateRect Lib "user32" (ByRef lprc As RECT, ByVal dx As Long, ByVal dy As Long) As BOOL
+Declare Function IntersectRect Lib "user32" (ByRef lprcDst As RECT, ByRef lprcSrc1 As RECT, ByRef lprcSrc2 As RECT) As BOOL
+Declare Function UnionRect Lib "user32" (ByRef lprcDst As RECT, ByRef lprcSrc1 As RECT, ByRef lprcSrc2 As RECT) As BOOL
+Declare Function SubtractRect Lib "user32" (ByRef lprcDst As RECT, ByRef lprcSrc1 As RECT, ByRef lprcSrc2 As RECT) As BOOL
+Declare Function OffsetRect Lib "user32" (ByRef lprc As RECT, ByVal dx As Long, ByVal dy As Long) As BOOL
+Declare Function IsRectEmpty Lib "user32" (ByRef lprc As RECT) As BOOL
+Declare Function EqualRect Lib "user32" (ByRef lprc1 As RECT, ByRef lprc2 As RECT) As BOOL
+Declare Function PtInRect Lib "user32" (ByRef lprc As RECT, ByRef pt As POINTAPI) As BOOL
+Declare Function SetScrollInfo Lib "user32" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO, bRedraw As Long) As BOOL
+Declare Function SetSysColors Lib "user32" (cElements As Long, lpaElements As *DWord, lpaRgbValues As *DWord) As BOOL
+Declare Function SetSystemCursor Lib "user32" (ByVal hcur As HCURSOR, ByVal id As DWord) As BOOL
+
+Const USER_TIMER_MAXIMUM = &H7FFFFFFF
+Const USER_TIMER_MINIMUM = &H0000000A
+
+TypeDef TIMERPROC = *Sub(hwnd As HWND, msg As DWord, idEvent As ULONG_PTR, dwTime As DWord)
+Declare Function SetTimer Lib "user32" (hWnd As HWND, nIDEvent As ULONG_PTR, nElapse As DWord, lpTimerFunc As TIMERPROC) As ULONG_PTR
+
+Declare Function SetWindowContextHelpId Lib "user32"(hwnd As HWND, dwContextHelpId As DWord) As BOOL
+#ifdef _WIN64
+Declare Function SetWindowLong Lib "user32" Alias _FuncName_SetWindowLongPtr (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
+Declare Function SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLongPtr (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
+#else
+Declare Function SetWindowLong Lib "user32" Alias _FuncName_SetWindowLong (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
+Declare Function SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLong (hWnd As HWND, nIndex As Long, NewLong As LONG_PTR) As LONG_PTR
+#endif
+
+Declare Function SetWindowPlacement Lib "user32" (hWnd As HWND, ByRef lpwndpl As WINDOWPLACEMENT) As BOOL
+
+Const HWND_TOP =       0  As HWND
+Const HWND_BOTTOM =    1  As HWND
+Const HWND_TOPMOST =   -1 As HWND
+Const HWND_NOTOPMOST = -2 As HWND
+Const SWP_NOSIZE =         &H0001
+Const SWP_NOMOVE =         &H0002
+Const SWP_NOZORDER =       &H0004
+Const SWP_NOREDRAW =       &H0008
+Const SWP_NOACTIVATE =     &H0010
+Const SWP_FRAMECHANGED =   &H0020
+Const SWP_SHOWWINDOW =     &H0040
+Const SWP_HIDEWINDOW =     &H0080
+Const SWP_NOCOPYBITS =     &H0100
+Const SWP_NOOWNERZORDER =  &H0200
+Const SWP_NOSENDCHANGING = &H0400
+Const SWP_DRAWFRAME =      SWP_FRAMECHANGED
+Const SWP_NOREPOSITION =   SWP_NOOWNERZORDER
+Const SWP_DEFERERASE =     &H2000
+Const SWP_ASYNCWINDOWPOS = &H4000
+Declare Function SetWindowPos Lib "user32" (hWnd As HWND, hWndInsertAfter As HWND, X As Long, Y As Long, cx As Long, cy As Long, uFlags As DWord) As BOOL
+
+Declare Function SetWindowRgn Lib "user32" (hWnd As HWND, hRgn As HRGN, bRedraw As BOOL) As BOOL
+Declare Function SetWindowsHookEx Lib "user32" Alias _FuncName_SetWindowsHookEx (idHook As Long, lpfn As HOOKPROC, hMod As HINSTANCE, dwThreadId As DWord) As HHOOK
+Declare Function SetWindowText Lib "user32" Alias _FuncName_SetWindowText (hWnd As HWND, pString As PCTSTR) As BOOL
+Declare Function ShowCaret Lib "user32" (hWnd As HWND) As BOOL
+Declare Function ShowCursor Lib "user32" (bShow As Long) As BOOL
+Declare Function ShowScrollBar Lib "user32" (hWnd As HWND, wBar As DWord, bShow As BOOL) As BOOL
+
+Const SW_HIDE =            0
+Const SW_SHOWNORMAL =      1
+Const SW_NORMAL =          1
+Const SW_SHOWMINIMIZED =   2
+Const SW_SHOWMAXIMIZED =   3
+Const SW_MAXIMIZE =        3
+Const SW_SHOWNOACTIVATE =  4
+Const SW_SHOW =            5
+Const SW_MINIMIZE =        6
+Const SW_SHOWMINNOACTIVE = 7
+Const SW_SHOWNA =          8
+Const SW_RESTORE =         9
+Const SW_SHOWDEFAULT =     10
+Const SW_FORCEMINIMIZE =   11
+Const SW_MAX =             11
+Declare Function ShowWindow Lib "user32" (hWnd As HWND, nCmdShow As Long) As BOOL
+Declare Function ShowWindowAsync Lib "user32" (hWnd As HWND, nCmdShow As Long) As BOOL
+
+Type NONCLIENTMETRICSW
+	cbSize As DWord
+	iBorderWidth As Long
+	iScrollWidth As Long
+	iScrollHeight As Long
+	iCaptionWidth As Long
+	iCaptionHeight As Long
+	lfCaptionFont As LOGFONTW
+	iSmCaptionWidth As Long
+	iSmCaptionHeight As Long
+	lfSmCaptionFont As LOGFONTW
+	iMenuWidth As Long
+	iMenuHeight As Long
+	lfMenuFont As LOGFONTW
+	lfStatusFont As LOGFONTW
+	lfMessageFont As LOGFONTW
+End Type
+Type NONCLIENTMETRICSA
+	cbSize As DWord
+	iBorderWidth As Long
+	iScrollWidth As Long
+	iScrollHeight As Long
+	iCaptionWidth As Long
+	iCaptionHeight As Long
+	lfCaptionFont As LOGFONTA
+	iSmCaptionWidth As Long
+	iSmCaptionHeight As Long
+	lfSmCaptionFont As LOGFONTA
+	iMenuWidth As Long
+	iMenuHeight As Long
+	lfMenuFont As LOGFONTA
+	lfStatusFont As LOGFONTA
+	lfMessageFont As LOGFONTA
+End Type
+#ifdef UNICODE
+TypeDef NONCLIENTMETRICS = NONCLIENTMETRICSW
+#else
+TypeDef NONCLIENTMETRICS = NONCLIENTMETRICSA
+#endif
+Const SPI_GETBEEP =               1
+Const SPI_SETBEEP =               2
+Const SPI_GETMOUSE =              3
+Const SPI_SETMOUSE =              4
+Const SPI_GETBORDER =             5
+Const SPI_SETBORDER =             6
+Const SPI_GETKEYBOARDSPEED =      10
+Const SPI_SETKEYBOARDSPEED =      11
+Const SPI_LANGDRIVER =            12
+Const SPI_ICONHORIZONTALSPACING = 13
+Const SPI_GETSCREENSAVETIMEOUT =  14
+Const SPI_SETSCREENSAVETIMEOUT =  15
+Const SPI_GETSCREENSAVEACTIVE =   16
+Const SPI_SETSCREENSAVEACTIVE =   17
+Const SPI_GETGRIDGRANULARITY =    18
+Const SPI_SETGRIDGRANULARITY =    19
+Const SPI_SETDESKWALLPAPER =      20
+Const SPI_SETDESKPATTERN =        21
+Const SPI_GETKEYBOARDDELAY =      22
+Const SPI_SETKEYBOARDDELAY =      23
+Const SPI_ICONVERTICALSPACING =   24
+Const SPI_GETICONTITLEWRAP =      25
+Const SPI_SETICONTITLEWRAP =      26
+Const SPI_GETMENUDROPALIGNMENT =  27
+Const SPI_SETMENUDROPALIGNMENT =  28
+Const SPI_SETDOUBLECLKWIDTH =     29
+Const SPI_SETDOUBLECLKHEIGHT =    30
+Const SPI_GETICONTITLELOGFONT =   31
+Const SPI_SETDOUBLECLICKTIME =    32
+Const SPI_SETMOUSEBUTTONSWAP =    33
+Const SPI_SETICONTITLELOGFONT =   34
+Const SPI_GETFASTTASKSWITCH =     35
+Const SPI_SETFASTTASKSWITCH =     36
+Const SPI_SETDRAGFULLWINDOWS =    37
+Const SPI_GETDRAGFULLWINDOWS =    38
+Const SPI_GETNONCLIENTMETRICS =   41
+Const SPI_SETNONCLIENTMETRICS =   42
+Const SPI_GETMINIMIZEDMETRICS =   43
+Const SPI_SETMINIMIZEDMETRICS =   44
+Const SPI_GETICONMETRICS =        45
+Const SPI_SETICONMETRICS =        46
+Const SPI_SETWORKAREA =           47
+Const SPI_GETWORKAREA =           48
+Const SPI_SETPENWINDOWS =         49
+Const SPI_GETHIGHCONTRAST =       66
+Const SPI_SETHIGHCONTRAST =       67
+Const SPI_GETKEYBOARDPREF =       68
+Const SPI_SETKEYBOARDPREF =       69
+Const SPI_GETSCREENREADER =       70
+Const SPI_SETSCREENREADER =       71
+Const SPI_GETANIMATION =          72
+Const SPI_SETANIMATION =          73
+Const SPI_GETFONTSMOOTHING =      74
+Const SPI_SETFONTSMOOTHING =      75
+Const SPI_SETDRAGWIDTH =          76
+Const SPI_SETDRAGHEIGHT =         77
+Const SPI_SETHANDHELD =           78
+Const SPI_GETLOWPOWERTIMEOUT =    79
+Const SPI_GETPOWEROFFTIMEOUT =    80
+Const SPI_SETLOWPOWERTIMEOUT =    81
+Const SPI_SETPOWEROFFTIMEOUT =    82
+Const SPI_GETLOWPOWERACTIVE =     83
+Const SPI_GETPOWEROFFACTIVE =     84
+Const SPI_SETLOWPOWERACTIVE =     85
+Const SPI_SETPOWEROFFACTIVE =     86
+Const SPI_SETCURSORS =            87
+Const SPI_SETICONS =              88
+Const SPI_GETDEFAULTINPUTLANG =   89
+Const SPI_SETDEFAULTINPUTLANG =   90
+Const SPI_SETLANGTOGGLE =         91
+Const SPI_GETWINDOWSEXTENSION =   92
+Const SPI_SETMOUSETRAILS =        93
+Const SPI_GETMOUSETRAILS =        94
+Const SPI_SETSCREENSAVERRUNNING = 97
+Const SPI_SCREENSAVERRUNNING =    SPI_SETSCREENSAVERRUNNING
+Const SPI_GETFILTERKEYS =         50
+Const SPI_SETFILTERKEYS =         51
+Const SPI_GETTOGGLEKEYS =         52
+Const SPI_SETTOGGLEKEYS =         53
+Const SPI_GETMOUSEKEYS =          54
+Const SPI_SETMOUSEKEYS =          55
+Const SPI_GETSHOWSOUNDS =         56
+Const SPI_SETSHOWSOUNDS =         57
+Const SPI_GETSTICKYKEYS =         58
+Const SPI_SETSTICKYKEYS =         59
+Const SPI_GETACCESSTIMEOUT =      60
+Const SPI_SETACCESSTIMEOUT =      61
+Const SPI_GETSERIALKEYS =         62
+Const SPI_SETSERIALKEYS =         63
+Const SPI_GETSOUNDSENTRY =        64
+Const SPI_SETSOUNDSENTRY =        65
+Const SPI_GETMOUSEHOVERWIDTH =    98
+Const SPI_SETMOUSEHOVERWIDTH =    99
+Const SPI_GETMOUSEHOVERHEIGHT =   100
+Const SPI_SETMOUSEHOVERHEIGHT =   101
+Const SPI_GETMOUSEHOVERTIME =     102
+Const SPI_SETMOUSEHOVERTIME =     103
+Const SPI_GETWHEELSCROLLLINES =   104
+Const SPI_SETWHEELSCROLLLINES =   105
+Const SPI_GETSHOWIMEUI =          110
+Const SPI_SETSHOWIMEUI =          111
+Const SPI_GETMOUSESPEED =         112
+Const SPI_SETMOUSESPEED =         113
+Const SPI_GETSCREENSAVERRUNNING = 114
+Const SPI_GETACTIVEWINDOWTRACKING =       &H1000	'Windows 2000 or later
+Const SPI_SETACTIVEWINDOWTRACKING =       &H1001
+Const SPI_GETMENUANIMATION =              &H1002
+Const SPI_SETMENUANIMATION =              &H1003
+Const SPI_GETCOMBOBOXANIMATION =          &H1004
+Const SPI_SETCOMBOBOXANIMATION =          &H1005
+Const SPI_GETLISTBOXSMOOTHSCROLLING =     &H1006
+Const SPI_SETLISTBOXSMOOTHSCROLLING =     &H1007
+Const SPI_GETGRADIENTCAPTIONS =           &H1008
+Const SPI_SETGRADIENTCAPTIONS =           &H1009
+Const SPI_GETMENUUNDERLINES =             &H100A
+Const SPI_SETMENUUNDERLINES =             &H100B
+Const SPI_GETACTIVEWNDTRKZORDER =         &H100C
+Const SPI_SETACTIVEWNDTRKZORDER =         &H100D
+Const SPI_GETHOTTRACKING =                &H100E
+Const SPI_SETHOTTRACKING =                &H100F
+Const SPI_GETFOREGROUNDLOCKTIMEOUT =      &H2000
+Const SPI_SETFOREGROUNDLOCKTIMEOUT =      &H2001
+Const SPI_GETACTIVEWNDTRKTIMEOUT =        &H2002
+Const SPI_SETACTIVEWNDTRKTIMEOUT =        &H2003
+Const SPI_GETFOREGROUNDFLASHCOUNT =       &H2004
+Const SPI_SETFOREGROUNDFLASHCOUNT =       &H2005
+Const SPIF_UPDATEINIFILE =    &H0001
+Const SPIF_SENDWININICHANGE = &H0002
+Const SPIF_SENDCHANGE =       SPIF_SENDWININICHANGE
+Declare Function SystemParametersInfo Lib "user32" Alias _FuncName_SystemParametersInfo (uiAction As DWord, uiParam As DWord, pvParam As VoidPtr, fWinIni As DWord) As BOOL
+
+Const CDS_UPDATEREGISTRY = &H00000001
+Const CDS_TEST            = &H00000002
+Const CDS_FULLSCREEN      = &H00000004
+Const CDS_GLOBAL          = &H00000008
+Const CDS_SET_PRIMARY     = &H00000010
+Const CDS_VIDEOPARAMETERS = &H00000020
+Const CDS_RESET           = &H40000000
+Const CDS_NORESET         = &H10000000
+
+Const DISP_CHANGE_SUCCESSFUL    =   0
+Const DISP_CHANGE_RESTART       =   1
+Const DISP_CHANGE_FAILED        =  -1
+Const DISP_CHANGE_BADMODE       =  -2
+Const DISP_CHANGE_NOTUPDATED    =  -3
+Const DISP_CHANGE_BADFLAGS      =  -4
+Const DISP_CHANGE_BADPARAM      =  -5
+Const DISP_CHANGE_BADDUALVIEW   =  -6
+
+#ifdef _INC_GDI
+Declare Function ChangeDisplaySettingsA Lib "user32" (ByVal lpDevMode As *DEVMODEA, ByVal dwFlags As DWord) As Long
+Declare Function ChangeDisplaySettingsW Lib "user32" (ByVal lpDevMode As *DEVMODEW, ByVal dwFlags As DWord) As Long
+#ifdef UNICODE
+Declare Function ChangeDisplaySettings Lib "user32" Alias _FuncName_ChangeDisplaySettings (ByVal lpDevMode As *DEVMODEW, ByVal dwFlags As DWord) As Long
+#else
+Declare Function ChangeDisplaySettings Lib "user32" Alias _FuncName_ChangeDisplaySettings (ByVal lpDevMode As *DEVMODEA, ByVal dwFlags As DWord) As Long
+#endif
+
+Declare Function ChangeDisplaySettingsExA Lib "user32" (ByVal lpszDeviceName As LPCSTR, ByVal lpDevMode As *DEVMODEA, ByVal hwnd As HWND, ByVal dwFlags As DWord, ByVal lParam As VoidPtr) As Long
+Declare Function ChangeDisplaySettingsExW Lib "user32" (ByVal lpszDeviceName As LPCWSTR, ByVal lpDevMode As *DEVMODEW, ByVal hwnd As HWND, ByVal dwFlags As DWord, ByVal lParam As VoidPtr) As Long
+#ifdef UNICODE
+Declare Function ChangeDisplaySettingsEx Lib "user32" Alias _FuncName_ChangeDisplaySettingsEx (ByVal lpszDeviceName As LPCWSTR, ByVal lpDevMode As *DEVMODEW, ByVal hwnd As HWND, ByVal dwFlags As DWord, ByVal lParam As VoidPtr) As Long
+#else
+Declare Function ChangeDisplaySettingsEx Lib "user32" Alias _FuncName_ChangeDisplaySettingsEx (ByVal lpszDeviceName As LPCSTR, ByVal lpDevMode As *DEVMODEA, ByVal hwnd As HWND, ByVal dwFlags As DWord, ByVal lParam As VoidPtr) As Long
+#endif
+
+Const ENUM_CURRENT_SETTINGS       = ((-1) As DWord)
+Const ENUM_REGISTRY_SETTINGS      = ((-2) As DWord)
+
+Declare Function EnumDisplaySettingsA Lib "user32" (ByVal lpszDeviceName As LPCSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEA) As BOOL
+Declare Function EnumDisplaySettingsW Lib "user32" (ByVal lpszDeviceName As LPCWSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEW) As BOOL
+#ifdef UNICODE
+Declare Function EnumDisplaySettings Lib "user32" Alias _FuncName_EnumDisplaySettings (ByVal lpszDeviceName As LPCWSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEW) As BOOL
+#else
+Declare Function EnumDisplaySettings Lib "user32" Alias _FuncName_EnumDisplaySettings (ByVal lpszDeviceName As LPCSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEA) As BOOL
+#endif
+
+/*#ifdef(WINVER >= 0x0500)
+Declare Function EnumDisplaySettingsExA Lib "user32" (ByVal lpszDeviceName As LPCSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEA, ByVal dwFlags As DWord) As BOOL
+Declare Function EnumDisplaySettingsExW Lib "user32" (ByVal lpszDeviceName As LPCWSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEW, ByVal dwFlags As DWord) As BOOL
+#ifdef UNICODE
+Declare Function EnumDisplaySettingsEx Lib "user32" Alias _FuncName_EnumDisplaySettingsEx (ByVal lpszDeviceName As LPCWSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEW, ByVal dwFlags As DWord) As BOOL
+#else
+Declare Function EnumDisplaySettingsEx Lib "user32" Alias _FuncName_EnumDisplaySettingsEx (ByVal lpszDeviceName As LPCSTR, ByVal iModeNum As DWord, ByVal lpDevMode As *DEVMODEA, ByVal dwFlags As DWord) As BOOL
+#endif
+
+Const EDS_RAWMODE  = &H00000002
+
+Declare Function EnumDisplayDevicesA Lib "user32" (ByVal lpDevice As LPCSTR, ByVal iDevNum As DWord, ByVal lpDisplayDevice As *DISPLAY_DEVICEA, ByVal dwFlags As DWord) As BOOL
+Declare Function EnumDisplayDevicesW Lib "user32" (ByVal lpDevice As LPCWSTR, ByVal iDevNum As DWord, ByVal lpDisplayDevice As *DISPLAY_DEVICEW, ByVal dwFlags As DWord)As BOOL
+#ifdef UNICODE
+Declare Function EnumDisplayDevices Lib "user32" Alias _FuncName_EnumDisplayDevices (ByVal lpDevice As LPCWSTR, ByVal iDevNum As DWord, ByVal lpDisplayDevice As *DISPLAY_DEVICEW, ByVal dwFlags As DWord)As BOOL
+#else
+Declare Function EnumDisplayDevices Lib "user32" Alias _FuncName_EnumDisplayDevices (ByVal lpDevice As LPCSTR, ByVal iDevNum As DWord, ByVal lpDisplayDevice As *DISPLAY_DEVICEA, ByVal dwFlags As DWord) As BOOL
+#endif
+#endif */ /* WINVER >= 0x0500 */
+#endif ' _INC_GDI
+
+Const TME_HOVER       = &H00000001
+Const TME_LEAVE       = &H00000002
+Const TME_NONCLIENT   = &H00000010
+Const TME_QUERY       = &H40000000
+Const TME_CANCEL      = &H80000000
+Const HOVER_DEFAULT   = &HFFFFFFFF
+Type TRACKMOUSEEVENT
+	cbSize As DWord
+	dwFlags As DWord
+	hwndTrack As HWND
+	dwHoverTime As DWord
+End Type
+Declare Function TrackMouseEvent Lib "user32" (ByRef EventTrack As TRACKMOUSEEVENT) As BOOL
+
+Const TPM_LEFTBUTTON =   &H0000
+Const TPM_RIGHTBUTTON =  &H0002
+Const TPM_LEFTALIGN =    &H0000
+Const TPM_CENTERALIGN =  &H0004
+Const TPM_RIGHTALIGN =   &H0008
+Const TPM_TOPALIGN =     &H0000
+Const TPM_VCENTERALIGN = &H0010
+Const TPM_BOTTOMALIGN =  &H0020
+Const TPM_HORIZONTAL =   &H0000
+Const TPM_VERTICAL =     &H0040
+Const TPM_NONOTIFY =     &H0080
+Const TPM_RETURNCMD =    &H0100
+Const TPM_RECURSE =      &H0001
+Declare Function TrackPopupMenu Lib "user32" (hMenu As HMENU, uFlags As DWord, x As Long, y As Long, nReserved As Long, ByVal hWnd As HWND, ByRef prcRect As RECT) As BOOL
+
+declare function UnhookWindowsHookEx lib "user32" (ByVal hhk As HHOOK) As BOOL
+Declare Function UnregisterClass Lib "user32" Alias _FuncName_UnregisterClass (pClassName As PCTSTR, hinst As HINSTANCE) As BOOL
+Declare Function UnregisterHotKey Lib "user32" (hwnd As HWND, id As Long) As BOOL
+Declare Function UpdateWindow Lib "user32" (hWnd As HWND) As BOOL
+Declare Function ValidateRect Lib "user32" (hWnd As HWND, ByRef lpRect As RECT) As BOOL
+Declare Function ValidateRgn Lib "user32" (hWnd As HWND, hRgn As HRGN) As BOOL
+Declare Function WaitForInputIdle Lib "user32" (hProcess As HANDLE, dwMilliseconds As DWord) As DWord
+
+Declare Function WaitMessage Lib "user32" () As BOOL
+Declare Function WindowFromDC Lib "user32" (hDC As HDC) As HWND
+Declare Function WindowFromPoint Lib "user32" (ptX As Long, ptY As Long) As HWND
+
+TypeDef HELPPOLY = DWord
+
+Type MULTIKEYHELPA
+	mkSize As DWord
+	mkKeylist As SByte
+	szKeyphrase[ELM(1)] As SByte
+End Type
+TypeDef PMULTIKEYHELPA=*MULTIKEYHELPA
+TypeDef LPMULTIKEYHELPA=*MULTIKEYHELPA
+Type MULTIKEYHELPW
+	mkSize As DWord
+	mkKeylist As Word
+	szKeyphrase[ELM(1)] As Word
+End Type
+TypeDef PMULTIKEYHELPW=*MULTIKEYHELPW
+TypeDef LPMULTIKEYHELPW=*MULTIKEYHELPW
+
+#ifdef UNICODE
+TypeDef MULTIKEYHELP = MULTIKEYHELPW
+TypeDef PMULTIKEYHELP = PMULTIKEYHELPW
+TypeDef LPMULTIKEYHELP = LPMULTIKEYHELPW
+#else
+TypeDef MULTIKEYHELP = MULTIKEYHELPA
+TypeDef PMULTIKEYHELP = PMULTIKEYHELPA
+TypeDef LPMULTIKEYHELP = LPMULTIKEYHELPA
+#endif ' UNICODE
+
+Type HELPWININFOA
+	wStructSize As Long
+	x As Long
+	y As Long
+	dx As Long
+	dy As Long
+	wMax As Long
+	rgchMember[ELM(2)] As SByte
+End Type
+TypeDef PHELPWININFOA=*HELPWININFOA
+TypeDef LPHELPWININFOA=*HELPWININFOA
+Type HELPWININFOW
+	wStructSize As Long
+	x As Long
+	y As Long
+	dx As Long
+	dy As Long
+	wMax As Long
+	rgchMember[ELM(2)] As Word
+End Type
+TypeDef PHELPWININFOW=*HELPWININFOW
+TypeDef LPHELPWININFOW=*HELPWININFOW
+
+#ifdef UNICODE
+TypeDef HELPWININFO = HELPWININFOW
+TypeDef PHELPWININFO = PHELPWININFOW
+TypeDef LPHELPWININFO = LPHELPWININFOW
+#else
+TypeDef HELPWININFO = HELPWININFOA
+TypeDef PHELPWININFO = PHELPWININFOA
+TypeDef LPHELPWININFO = LPHELPWININFOA
+#endif ' UNICODE
+
+Const HELP_CONTEXT = &H0001
+Const HELP_QUIT = &H0002
+Const HELP_INDEX = &H0003
+Const HELP_CONTENTS = &H0003
+Const HELP_HELPONHELP = &H0004
+Const HELP_SETINDEX = &H0005
+Const HELP_SETCONTENTS = &H0005
+Const HELP_CONTEXTPOPUP = &H0008
+Const HELP_FORCEFILE = &H0009
+Const HELP_KEY = &H0101
+Const HELP_COMMAND = &H0102
+Const HELP_PARTIALKEY = &H0105
+Const HELP_MULTIKEY = &H0201
+Const HELP_SETWINPOS = &H0203
+Const HELP_CONTEXTMENU = &H000a
+Const HELP_FINDER = &H000b
+Const HELP_WM_HELP = &H000c
+Const HELP_SETPOPUP_POS = &H000d
+Const HELP_TCARD = &H8000
+Const HELP_TCARD_DATA = &H0010
+Const HELP_TCARD_OTHER_CALLER = &H0011
+
+Const IDH_NO_HELP = 28440
+Const IDH_MISSING_CONTEXT = 28441
+Const IDH_GENERIC_HELP_BUTTON = 28442
+Const IDH_OK = 28443
+Const IDH_CANCEL = 28444
+Const IDH_HELP = 28445
+
+Declare Function WinHelpA Lib "user32" (ByVal hWndMain As HWND, ByVal lpszHelp As LPCSTR, ByVal uCommand As DWord, ByVal dwData As ULONG_PTR) As BOOL
+Declare Function WinHelpW Lib "user32" (ByVal hWndMain As HWND, ByVal lpszHelp As LPCWSTR, ByVal uCommand As DWord, ByVal dwData As ULONG_PTR) As BOOL
+#ifdef UNICODE
+Declare Function WinHelp Lib "user32" Alias "WinHelpW" (ByVal hWndMain As HWND, ByVal lpszHelp As LPCWSTR, ByVal uCommand As DWord, ByVal dwData As ULONG_PTR) As BOOL
+#else
+Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hWndMain As HWND, ByVal lpszHelp As LPCSTR, ByVal uCommand As DWord, ByVal dwData As ULONG_PTR) As BOOL
+#endif ' !UNICODE
+
+Declare Function wsprintf cdecl Lib "user32" Alias _FuncName_wsprintf (pText As PTSTR, pFormat As PCTSTR, ...) As Long
+Declare Function wvsprintf Lib "user32" Alias _FuncName_wvsprintf (pOutput As PTSTR, pFormat As PCTSTR, arglist As DWordPtr) As Long
+
+Type GUITHREADINFO
+	cbSize As DWord
+	flags As DWord
+	hwndActive As HWND
+	hwndFocus As HWND
+	hwndCapture As HWND
+	hwndMenuOwner As HWND
+	hwndMoveSize As HWND
+	hwndCaret As HWND
+	rcCaret As RECT
+End Type
+TypeDef PGUITHREADINFO = *GUITHREADINFO
+TypeDef LPGUITHREADINFO = *GUITHREADINFO
+
+Const GUI_CARETBLINKING = &H00000001
+Const GUI_INMOVESIZE = &H00000002
+Const GUI_INMENUMODE = &H00000004
+Const GUI_SYSTEMMENUMODE = &H00000008
+Const GUI_POPUPMENUMODE = &H00000010
+Const GUI_16BITTASK = &H00000020
+
+Declare Function GetGUIThreadInfo Lib "user32" (ByVal idThread As DWord, ByRef pgui As GUITHREADINFO) As BOOL
+
+Const STATE_SYSTEM_UNAVAILABLE = &H00000001
+Const STATE_SYSTEM_SELECTED = &H00000002
+Const STATE_SYSTEM_FOCUSED = &H00000004
+Const STATE_SYSTEM_PRESSED = &H00000008
+Const STATE_SYSTEM_CHECKED = &H00000010
+Const STATE_SYSTEM_MIXED = &H00000020
+Const STATE_SYSTEM_INDETERMINATE = STATE_SYSTEM_MIXED
+Const STATE_SYSTEM_READONLY = &H00000040
+Const STATE_SYSTEM_HOTTRACKED = &H00000080
+Const STATE_SYSTEM_DEFAULT = &H00000100
+Const STATE_SYSTEM_EXPANDED = &H00000200
+Const STATE_SYSTEM_COLLAPSED = &H00000400
+Const STATE_SYSTEM_BUSY = &H00000800
+Const STATE_SYSTEM_FLOATING = &H00001000
+Const STATE_SYSTEM_MARQUEED = &H00002000
+Const STATE_SYSTEM_ANIMATED = &H00004000
+Const STATE_SYSTEM_INVISIBLE = &H00008000
+Const STATE_SYSTEM_OFFSCREEN = &H00010000
+Const STATE_SYSTEM_SIZEABLE = &H00020000
+Const STATE_SYSTEM_MOVEABLE = &H00040000
+Const STATE_SYSTEM_SELFVOICING = &H00080000
+Const STATE_SYSTEM_FOCUSABLE = &H00100000
+Const STATE_SYSTEM_SELECTABLE = &H00200000
+Const STATE_SYSTEM_LINKED = &H00400000
+Const STATE_SYSTEM_TRAVERSED = &H00800000
+Const STATE_SYSTEM_MULTISELECTABLE = &H01000000
+Const STATE_SYSTEM_EXTSELECTABLE = &H02000000
+Const STATE_SYSTEM_ALERT_LOW = &H04000000
+Const STATE_SYSTEM_ALERT_MEDIUM = &H08000000
+Const STATE_SYSTEM_ALERT_HIGH = &H10000000
+Const STATE_SYSTEM_PROTECTED = &H20000000
+Const STATE_SYSTEM_VALID = &H3FFFFFFF
+
+Const CCHILDREN_TITLEBAR = 5
+Const CCHILDREN_SCROLLBAR = 5
+
+
+Type CURSORINFO
+	cbSize As DWord
+	flags As DWord
+	hCursor As HCURSOR
+	ptScreenPos As POINTAPI
+End Type
+TypeDef PCURSORINFO=*CURSORINFO
+TypeDef LPCURSORINFO=*CURSORINFO
+
+Const CURSOR_SHOWING = &H00000001
+
+Declare Function GetCursorInfo Lib "user32" (ByRef pci As CURSORINFO) As BOOL
+
+
+Type MENUBARINFO
+	cbSize As DWord
+	rcBar As RECT
+	hMenu As HMENU
+	hwndMenu As HWND
+	fields As BOOL
+/*	fBarFocused As BOOL
+	fFocused As BOOL*/
+End Type
+TypeDef PMENUBARINFO=*MENUBARINFO
+TypeDef LPMENUBARINFO=*MENUBARINFO
+
+Declare Function GetMenuBarInfo Lib "user32" (ByVal hwnd As HWND, ByVal idObject As Long, ByVal idItem As Long, ByRef pmbi As MENUBARINFO) As BOOL
+
+Type COMBOBOXINFO
+	cbSize As DWord
+	rcItem As RECT
+	rcButton As RECT
+	stateButton As DWord
+	hwndCombo As HWND
+	hwndItem As HWND
+	hwndList As HWND
+End Type
+TypeDef PCOMBOBOXINFO=*COMBOBOXINFO
+TypeDef LPCOMBOBOXINFO=*COMBOBOXINFO
+
+Declare Function GetComboBoxInfo Lib "user32" (ByVal hwndCombo As HWND, ByRef pcbi As COMBOBOXINFO) As BOOL
+
+
+Const GA_PARENT = 1
+Const GA_ROOT = 2
+Const GA_ROOTOWNER = 3
+
+Declare Function GetAncestor Lib "user32" (ByVal hwnd As HWND, ByVal gaFlags As DWord) As HWND
+
+
+Declare Function RealGetWindowClassA Lib "user32" (ByVal hwnd As HWND, ByVal ptszClassName As LPSTR, ByVal cchClassNameMax As DWord) As DWord
+Declare Function RealGetWindowClassW Lib "user32" (ByVal hwnd As HWND, ByVal ptszClassName As LPWSTR, ByVal cchClassNameMax As DWord) As DWord
+#ifdef UNICODE
+Declare Function RealGetWindowClass Lib "user32" Alias "RealGetWindowClassW" (ByVal hwnd As HWND, ByVal ptszClassName As LPWSTR, ByVal cchClassNameMax As DWord) As DWord
+#else
+Declare Function RealGetWindowClass Lib "user32" Alias "RealGetWindowClassA" (ByVal hwnd As HWND, ByVal ptszClassName As LPSTR, ByVal cchClassNameMax As DWord) As DWord
+#endif ' !UNICODE
+
+
+Type ALTTABINFO
+	cbSize As DWord
+	cItems As Long
+	cColumns As Long
+	cRows As Long
+	iColFocus As Long
+	iRowFocus As Long
+	cxItem As Long
+	cyItem As Long
+	ptStart As POINTAPI
+End Type
+TypeDef PALTTABINFO=*ALTTABINFO
+TypeDef LPALTTABINFO=*ALTTABINFO
+
+Declare Function GetAltTabInfoA Lib "user32" (ByVal hwnd As HWND, ByVal iItem As Long, ByRef pati As ALTTABINFO, ByVal pszItemText As LPSTR, ByVal cchItemText As DWord) As BOOL
+Declare Function GetAltTabInfoW Lib "user32" (ByVal hwnd As HWND, ByVal iItem As Long, ByRef pati As ALTTABINFO, ByVal pszItemText As LPWSTR, ByVal cchItemText As DWord) As BOOL
+#ifdef UNICODE
+Declare Function GetAltTabInfo Lib "user32" Alias "GetAltTabInfoW" (ByVal hwnd As HWND, ByVal iItem As Long, ByRef pati As ALTTABINFO, ByVal pszItemText As LPWSTR, ByVal cchItemText As DWord) As BOOL
+#else
+Declare Function GetAltTabInfo Lib "user32" Alias "GetAltTabInfoA" (ByVal hwnd As HWND, ByVal iItem As Long, ByRef pati As ALTTABINFO, ByVal pszItemText As LPSTR, ByVal cchItemText As DWord) As BOOL
+#endif ' !UNICODE
Index: /trunk/ab5.0/ablib/src/api_windowstyles.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_windowstyles.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_windowstyles.sbp	(revision 506)
@@ -0,0 +1,233 @@
+' api_windowstyles.sbp
+
+'---------------
+'Window Styles
+'---------------
+
+Const WS_OVERLAPPED =     &H00000000
+Const WS_POPUP =          &H80000000
+Const WS_CHILD =          &H40000000
+Const WS_MINIMIZE =       &H20000000
+Const WS_VISIBLE =        &H10000000
+Const WS_DISABLED =       &H08000000
+Const WS_CLIPSIBLINGS =   &H04000000
+Const WS_CLIPCHILDREN =   &H02000000
+Const WS_MAXIMIZE =       &H01000000
+Const WS_CAPTION =        &H00C00000     'WS_BORDER or WS_DLGFRAME
+Const WS_BORDER =         &H00800000
+Const WS_DLGFRAME =       &H00400000
+Const WS_VSCROLL =        &H00200000
+Const WS_HSCROLL =        &H00100000
+Const WS_SYSMENU =        &H00080000
+Const WS_THICKFRAME =     &H00040000
+Const WS_GROUP =          &H00020000
+Const WS_TABSTOP =        &H00010000
+
+Const WS_MINIMIZEBOX =    &H00020000
+Const WS_MAXIMIZEBOX =    &H00010000
+
+Const WS_TILED =          WS_OVERLAPPED
+Const WS_ICONIC =         WS_MINIMIZE
+Const WS_SIZEBOX =        WS_THICKFRAME
+
+' Common Window Styles
+Const WS_OVERLAPPEDWINDOW =WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX
+Const WS_POPUPWINDOW =    WS_POPUP or WS_BORDER or WS_SYSMENU
+Const WS_CHILDWINDOW =    WS_CHILD
+Const WS_TILEDWINDOW =    WS_OVERLAPPEDWINDOW
+
+
+'-------------------------
+' Extended Window Styles
+'-------------------------
+
+Const WS_EX_DLGMODALFRAME =   &H00000001
+Const WS_EX_NOPARENTNOTIFY =  &H00000004
+Const WS_EX_TOPMOST =         &H00000008
+Const WS_EX_ACCEPTFILES =     &H00000010
+Const WS_EX_TRANSPARENT =     &H00000020
+Const WS_EX_MDICHILD =        &H00000040
+Const WS_EX_TOOLWINDOW =      &H00000080
+Const WS_EX_WINDOWEDGE =      &H00000100
+Const WS_EX_CLIENTEDGE =      &H00000200
+Const WS_EX_CONTEXTHELP =     &H00000400
+
+Const WS_EX_RIGHT =           &H00001000
+Const WS_EX_LEFT =            &H00000000
+Const WS_EX_RTLREADING =      &H00002000
+Const WS_EX_LTRREADING =      &H00000000
+Const WS_EX_LEFTSCROLLBAR =   &H00004000
+Const WS_EX_RIGHTSCROLLBAR =  &H00000000
+
+Const WS_EX_CONTROLPARENT =   &H00010000
+Const WS_EX_STATICEDGE =      &H00020000
+Const WS_EX_APPWINDOW =       &H00040000
+
+Const WS_EX_OVERLAPPEDWINDOW =WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE
+Const WS_EX_PALETTEWINDOW =   WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST
+
+
+'------------------------
+' Button Control Styles
+'------------------------
+
+Const BS_PUSHBUTTON =     &H00000000
+Const BS_DEFPUSHBUTTON =  &H00000001
+Const BS_CHECKBOX =       &H00000002
+Const BS_AUTOCHECKBOX =   &H00000003
+Const BS_RADIOBUTTON =    &H00000004
+Const BS_3STATE =         &H00000005
+Const BS_AUTO3STATE =     &H00000006
+Const BS_GROUPBOX =       &H00000007
+Const BS_USERBUTTON =     &H00000008
+Const BS_AUTORADIOBUTTON =&H00000009
+Const BS_OWNERDRAW =      &H0000000B
+Const BS_LEFTTEXT =       &H00000020
+Const BS_TEXT =           &H00000000
+Const BS_ICON =           &H00000040
+Const BS_BITMAP =         &H00000080
+Const BS_LEFT =           &H00000100
+Const BS_RIGHT =          &H00000200
+Const BS_CENTER =         &H00000300
+Const BS_TOP =            &H00000400
+Const BS_BOTTOM =         &H00000800
+Const BS_VCENTER =        &H00000C00
+Const BS_PUSHLIKE =       &H00001000
+Const BS_MULTILINE =      &H00002000
+Const BS_NOTIFY =         &H00004000
+Const BS_FLAT =           &H00008000
+Const BS_RIGHTBUTTON =    BS_LEFTTEXT
+
+
+'-------------------
+' Combo Box styles
+'-------------------
+
+Const CBS_SIMPLE =           &H0001
+Const CBS_DROPDOWN =         &H0002
+Const CBS_DROPDOWNLIST =     &H0003
+Const CBS_OWNERDRAWFIXED =   &H0010
+Const CBS_OWNERDRAWVARIABLE =&H0020
+Const CBS_AUTOHSCROLL =      &H0040
+Const CBS_OEMCONVERT =       &H0080
+Const CBS_SORT =             &H0100
+Const CBS_HASSTRINGS =       &H0200
+Const CBS_NOINTEGRALHEIGHT = &H0400
+Const CBS_DISABLENOSCROLL =  &H0800
+Const CBS_UPPERCASE =        &H2000
+Const CBS_LOWERCASE =        &H4000
+
+
+'----------------------
+' Edit Control Styles
+'----------------------
+
+Const ES_LEFT =           &H0000
+Const ES_CENTER =         &H0001
+Const ES_RIGHT =          &H0002
+Const ES_MULTILINE =      &H0004
+Const ES_UPPERCASE =      &H0008
+Const ES_LOWERCASE =      &H0010
+Const ES_PASSWORD =       &H0020
+Const ES_AUTOVSCROLL =    &H0040
+Const ES_AUTOHSCROLL =    &H0080
+Const ES_NOHIDESEL =      &H0100
+Const ES_OEMCONVERT =     &H0400
+Const ES_READONLY =       &H0800
+Const ES_WANTRETURN =     &H1000
+Const ES_NUMBER =         &H2000
+
+
+'-----------------
+' Listbox Styles
+'-----------------
+
+Const LBS_NOTIFY =           &H0001
+Const LBS_SORT =             &H0002
+Const LBS_NOREDRAW =         &H0004
+Const LBS_MULTIPLESEL =      &H0008
+Const LBS_OWNERDRAWFIXED =   &H0010
+Const LBS_OWNERDRAWVARIABLE =&H0020
+Const LBS_HASSTRINGS =       &H0040
+Const LBS_USETABSTOPS =      &H0080
+Const LBS_NOINTEGRALHEIGHT = &H0100
+Const LBS_MULTICOLUMN =      &H0200
+Const LBS_WANTKEYBOARDINPUT =&H0400
+Const LBS_EXTENDEDSEL =      &H0800
+Const LBS_DISABLENOSCROLL =  &H1000
+Const LBS_NODATA =           &H2000
+Const LBS_NOSEL =            &H4000
+Const LBS_STANDARD =         LBS_NOTIFY or LBS_SORT or WS_VSCROLL or WS_BORDER
+
+
+'--------------------
+' Scroll Bar Styles
+'--------------------
+
+Const SBS_HORZ =                   &H0000
+Const SBS_VERT =                   &H0001
+Const SBS_TOPALIGN =               &H0002
+Const SBS_LEFTALIGN =              &H0002
+Const SBS_BOTTOMALIGN =            &H0004
+Const SBS_RIGHTALIGN =             &H0004
+Const SBS_SIZEBOXTOPLEFTALIGN =    &H0002
+Const SBS_SIZEBOXBOTTOMRIGHTALIGN =&H0004
+Const SBS_SIZEBOX =                &H0008
+Const SBS_SIZEGRIP =               &H0010
+
+
+'---------------------------
+' Static Control Constants
+'---------------------------
+
+Const SS_LEFT =           &H00000000
+Const SS_CENTER =         &H00000001
+Const SS_RIGHT =          &H00000002
+Const SS_ICON =           &H00000003
+Const SS_BLACKRECT =      &H00000004
+Const SS_GRAYRECT =       &H00000005
+Const SS_WHITERECT =      &H00000006
+Const SS_BLACKFRAME =     &H00000007
+Const SS_GRAYFRAME =      &H00000008
+Const SS_WHITEFRAME =     &H00000009
+Const SS_USERITEM =       &H0000000A
+Const SS_SIMPLE =         &H0000000B
+Const SS_LEFTNOWORDWRAP = &H0000000C
+Const SS_OWNERDRAW =      &H0000000D
+Const SS_BITMAP =         &H0000000E
+Const SS_ENHMETAFILE =    &H0000000F
+Const SS_ETCHEDHORZ =     &H00000010
+Const SS_ETCHEDVERT =     &H00000011
+Const SS_ETCHEDFRAME =    &H00000012
+Const SS_TYPEMASK =       &H0000001F
+Const SS_NOPREFIX =       &H00000080
+Const SS_NOTIFY =         &H00000100
+Const SS_CENTERIMAGE =    &H00000200
+Const SS_RIGHTJUST =      &H00000400
+Const SS_REALSIZEIMAGE =  &H00000800
+Const SS_SUNKEN =         &H00001000
+Const SS_ENDELLIPSIS =    &H00004000
+Const SS_PATHELLIPSIS =   &H00008000
+Const SS_WORDELLIPSIS =   &H0000C000
+Const SS_ELLIPSISMASK =   &H0000C000
+
+
+'----------------
+' Dialog Styles
+'----------------
+
+Const DS_ABSALIGN =       &H01
+Const DS_SYSMODAL =       &H02
+Const DS_LOCALEDIT =      &H20
+Const DS_SETFONT =        &H40
+Const DS_MODALFRAME =     &H80
+Const DS_NOIDLEMSG =      &H100
+Const DS_SETFOREGROUND =  &H200
+
+Const DS_3DLOOK =         &H0004
+Const DS_FIXEDSYS =       &H0008
+Const DS_NOFAILCREATE =   &H0010
+Const DS_CONTROL =        &H0400
+Const DS_CENTER =         &H0800
+Const DS_CENTERMOUSE =    &H1000
+Const DS_CONTEXTHELP =    &H2000
Index: /trunk/ab5.0/ablib/src/api_winerror.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_winerror.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_winerror.sbp	(revision 506)
@@ -0,0 +1,3094 @@
+' api_winerror.sbp
+
+Const FACILITY_WINDOWSUPDATE = 36
+Const FACILITY_WINDOWS_CE = 24
+Const FACILITY_WINDOWS = 8
+Const FACILITY_URT = 19
+Const FACILITY_UMI = 22
+Const FACILITY_SXS = 23
+Const FACILITY_STORAGE = 3
+Const FACILITY_STATE_MANAGEMENT = 34
+Const FACILITY_SSPI = 9
+Const FACILITY_SCARD = 16
+Const FACILITY_SETUPAPI = 15
+Const FACILITY_SECURITY = 9
+Const FACILITY_RPC = 1
+Const FACILITY_WIN32 = 7
+Const FACILITY_CONTROL = 10
+Const FACILITY_NULL = 0
+Const FACILITY_METADIRECTORY = 35
+Const FACILITY_MSMQ = 14
+Const FACILITY_MEDIASERVER = 13
+Const FACILITY_INTERNET = 12
+Const FACILITY_ITF = 4
+Const FACILITY_HTTP = 25
+Const FACILITY_DPLAY = 21
+Const FACILITY_DISPATCH = 2
+Const FACILITY_DIRECTORYSERVICE = 37
+Const FACILITY_CONFIGURATION = 33
+Const FACILITY_COMPLUS = 17
+Const FACILITY_CERT = 11
+Const FACILITY_BACKGROUNDCOPY = 32
+Const FACILITY_ACS = 20
+Const FACILITY_AAF = 18
+Const ERROR_SUCCESS = 0
+Const NO_ERROR = 0
+Const SEC_E_OK = (&h00000000 As HRESULT)
+Const ERROR_INVALID_FUNCTION = 1
+Const ERROR_FILE_NOT_FOUND = 2
+Const ERROR_PATH_NOT_FOUND = 3
+Const ERROR_TOO_MANY_OPEN_FILES = 4
+Const ERROR_ACCESS_DENIED = 5
+Const ERROR_INVALID_HANDLE = 6
+Const ERROR_ARENA_TRASHED = 7
+Const ERROR_NOT_ENOUGH_MEMORY = 8
+Const ERROR_INVALID_BLOCK = 9
+Const ERROR_BAD_ENVIRONMENT = 10
+Const ERROR_BAD_FORMAT = 11
+Const ERROR_INVALID_ACCESS = 12
+Const ERROR_INVALID_DATA = 13
+Const ERROR_OUTOFMEMORY = 14
+Const ERROR_INVALID_DRIVE = 15
+Const ERROR_CURRENT_DIRECTORY = 16
+Const ERROR_NOT_SAME_DEVICE = 17
+Const ERROR_NO_MORE_FILES = 18
+Const ERROR_WRITE_PROTECT = 19
+Const ERROR_BAD_UNIT = 20
+Const ERROR_NOT_READY = 21
+Const ERROR_BAD_COMMAND = 22
+Const ERROR_CRC = 23
+Const ERROR_BAD_LENGTH = 24
+Const ERROR_SEEK = 25
+Const ERROR_NOT_DOS_DISK = 26
+Const ERROR_SECTOR_NOT_FOUND = 27
+Const ERROR_OUT_OF_PAPER = 28
+Const ERROR_WRITE_FAULT = 29
+Const ERROR_READ_FAULT = 30
+Const ERROR_GEN_FAILURE = 31
+Const ERROR_SHARING_VIOLATION = 32
+Const ERROR_LOCK_VIOLATION = 33
+Const ERROR_WRONG_DISK = 34
+Const ERROR_SHARING_BUFFER_EXCEEDED = 36
+Const ERROR_HANDLE_EOF = 38
+Const ERROR_HANDLE_DISK_FULL = 39
+Const ERROR_NOT_SUPPORTED = 50
+Const ERROR_REM_NOT_LIST = 51
+Const ERROR_DUP_NAME = 52
+Const ERROR_BAD_NETPATH = 53
+Const ERROR_NETWORK_BUSY = 54
+Const ERROR_DEV_NOT_EXIST = 55
+Const ERROR_TOO_MANY_CMDS = 56
+Const ERROR_ADAP_HDW_ERR = 57
+Const ERROR_BAD_NET_RESP = 58
+Const ERROR_UNEXP_NET_ERR = 59
+Const ERROR_BAD_REM_ADAP = 60
+Const ERROR_PRINTQ_FULL = 61
+Const ERROR_NO_SPOOL_SPACE = 62
+Const ERROR_PRINT_CANCELLED = 63
+Const ERROR_NETNAME_DELETED = 64
+Const ERROR_NETWORK_ACCESS_DENIED = 65
+Const ERROR_BAD_DEV_TYPE = 66
+Const ERROR_BAD_NET_NAME = 67
+Const ERROR_TOO_MANY_NAMES = 68
+Const ERROR_TOO_MANY_SESS = 69
+Const ERROR_SHARING_PAUSED = 70
+Const ERROR_REQ_NOT_ACCEP = 71
+Const ERROR_REDIR_PAUSED = 72
+Const ERROR_FILE_EXISTS = 80
+Const ERROR_CANNOT_MAKE = 82
+Const ERROR_FAIL_I24 = 83
+Const ERROR_OUT_OF_STRUCTURES = 84
+Const ERROR_ALREADY_ASSIGNED = 85
+Const ERROR_INVALID_PASSWORD = 86
+Const ERROR_INVALID_PARAMETER = 87
+Const ERROR_NET_WRITE_FAULT = 88
+Const ERROR_NO_PROC_SLOTS = 89
+Const ERROR_TOO_MANY_SEMAPHORES = 100
+Const ERROR_EXCL_SEM_ALREADY_OWNED = 101
+Const ERROR_SEM_IS_SET = 102
+Const ERROR_TOO_MANY_SEM_REQUESTS = 103
+Const ERROR_INVALID_AT_INTERRUPT_TIME = 104
+Const ERROR_SEM_OWNER_DIED = 105
+Const ERROR_SEM_USER_LIMIT = 106
+Const ERROR_DISK_CHANGE = 107
+Const ERROR_DRIVE_LOCKED = 108
+Const ERROR_BROKEN_PIPE = 109
+Const ERROR_OPEN_FAILED = 110
+Const ERROR_BUFFER_OVERFLOW = 111
+Const ERROR_DISK_FULL = 112
+Const ERROR_NO_MORE_SEARCH_HANDLES = 113
+Const ERROR_INVALID_TARGET_HANDLE = 114
+Const ERROR_INVALID_CATEGORY = 117
+Const ERROR_INVALID_VERIFY_SWITCH = 118
+Const ERROR_BAD_DRIVER_LEVEL = 119
+Const ERROR_CALL_NOT_IMPLEMENTED = 120
+Const ERROR_SEM_TIMEOUT = 121
+Const ERROR_INSUFFICIENT_BUFFER = 122
+Const ERROR_INVALID_NAME = 123
+Const ERROR_INVALID_LEVEL = 124
+Const ERROR_NO_VOLUME_LABEL = 125
+Const ERROR_MOD_NOT_FOUND = 126
+Const ERROR_PROC_NOT_FOUND = 127
+Const ERROR_WAIT_NO_CHILDREN = 128
+Const ERROR_CHILD_NOT_COMPLETE = 129
+Const ERROR_DIRECT_ACCESS_HANDLE = 130
+Const ERROR_NEGATIVE_SEEK = 131
+Const ERROR_SEEK_ON_DEVICE = 132
+Const ERROR_IS_JOIN_TARGET = 133
+Const ERROR_IS_JOINED = 134
+Const ERROR_IS_SUBSTED = 135
+Const ERROR_NOT_JOINED = 136
+Const ERROR_NOT_SUBSTED = 137
+Const ERROR_JOIN_TO_JOIN = 138
+Const ERROR_SUBST_TO_SUBST = 139
+Const ERROR_JOIN_TO_SUBST = 140
+Const ERROR_SUBST_TO_JOIN = 141
+Const ERROR_BUSY_DRIVE = 142
+Const ERROR_SAME_DRIVE = 143
+Const ERROR_DIR_NOT_ROOT = 144
+Const ERROR_DIR_NOT_EMPTY = 145
+Const ERROR_IS_SUBST_PATH = 146
+Const ERROR_IS_JOIN_PATH = 147
+Const ERROR_PATH_BUSY = 148
+Const ERROR_IS_SUBST_TARGET = 149
+Const ERROR_SYSTEM_TRACE = 150
+Const ERROR_INVALID_EVENT_COUNT = 151
+Const ERROR_TOO_MANY_MUXWAITERS = 152
+Const ERROR_INVALID_LIST_FORMAT = 153
+Const ERROR_LABEL_TOO_LONG = 154
+Const ERROR_TOO_MANY_TCBS = 155
+Const ERROR_SIGNAL_REFUSED = 156
+Const ERROR_DISCARDED = 157
+Const ERROR_NOT_LOCKED = 158
+Const ERROR_BAD_THREADID_ADDR = 159
+Const ERROR_BAD_ARGUMENTS = 160
+Const ERROR_BAD_PATHNAME = 161
+Const ERROR_SIGNAL_PENDING = 162
+Const ERROR_MAX_THRDS_REACHED = 164
+Const ERROR_LOCK_FAILED = 167
+Const ERROR_BUSY = 170
+Const ERROR_CANCEL_VIOLATION = 173
+Const ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174
+Const ERROR_INVALID_SEGMENT_NUMBER = 180
+Const ERROR_INVALID_ORDINAL = 182
+Const ERROR_ALREADY_EXISTS = 183
+Const ERROR_INVALID_FLAG_NUMBER = 186
+Const ERROR_SEM_NOT_FOUND = 187
+Const ERROR_INVALID_STARTING_CODESEG = 188
+Const ERROR_INVALID_STACKSEG = 189
+Const ERROR_INVALID_MODULETYPE = 190
+Const ERROR_INVALID_EXE_SIGNATURE = 191
+Const ERROR_EXE_MARKED_INVALID = 192
+Const ERROR_BAD_EXE_FORMAT = 193
+Const ERROR_ITERATED_DATA_EXCEEDS_64k = 194
+Const ERROR_INVALID_MINALLOCSIZE = 195
+Const ERROR_DYNLINK_FROM_INVALID_RING = 196
+Const ERROR_IOPL_NOT_ENABLED = 197
+Const ERROR_INVALID_SEGDPL = 198
+Const ERROR_AUTODATASEG_EXCEEDS_64k = 199
+Const ERROR_RING2SEG_MUST_BE_MOVABLE = 200
+Const ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201
+Const ERROR_INFLOOP_IN_RELOC_CHAIN = 202
+Const ERROR_ENVVAR_NOT_FOUND = 203
+Const ERROR_NO_SIGNAL_SENT = 205
+Const ERROR_FILENAME_EXCED_RANGE = 206
+Const ERROR_RING2_STACK_IN_USE = 207
+Const ERROR_META_EXPANSION_TOO_LONG = 208
+Const ERROR_INVALID_SIGNAL_NUMBER = 209
+Const ERROR_THREAD_1_INACTIVE = 210
+Const ERROR_LOCKED = 212
+Const ERROR_TOO_MANY_MODULES = 214
+Const ERROR_NESTING_NOT_ALLOWED = 215
+Const ERROR_EXE_MACHINE_TYPE_MISMATCH = 216
+Const ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY = 217
+Const ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY = 218
+Const ERROR_BAD_PIPE = 230
+Const ERROR_PIPE_BUSY = 231
+Const ERROR_NO_DATA = 232
+Const ERROR_PIPE_NOT_CONNECTED = 233
+Const ERROR_MORE_DATA = 234
+Const ERROR_VC_DISCONNECTED = 240
+Const ERROR_INVALID_EA_NAME = 254
+Const ERROR_EA_LIST_INCONSISTENT = 255
+Const WAIT_TIMEOUT = 258
+Const ERROR_NO_MORE_ITEMS = 259
+Const ERROR_CANNOT_COPY = 266
+Const ERROR_DIRECTORY = 267
+Const ERROR_EAS_DIDNT_FIT = 275
+Const ERROR_EA_FILE_CORRUPT = 276
+Const ERROR_EA_TABLE_FULL = 277
+Const ERROR_INVALID_EA_HANDLE = 278
+Const ERROR_EAS_NOT_SUPPORTED = 282
+Const ERROR_NOT_OWNER = 288
+Const ERROR_TOO_MANY_POSTS = 298
+Const ERROR_PARTIAL_COPY = 299
+Const ERROR_OPLOCK_NOT_GRANTED = 300
+Const ERROR_INVALID_OPLOCK_PROTOCOL = 301
+Const ERROR_DISK_TOO_FRAGMENTED = 302
+Const ERROR_DELETE_PENDING = 303
+Const ERROR_MR_MID_NOT_FOUND = 317
+Const ERROR_SCOPE_NOT_FOUND = 318
+Const ERROR_INVALID_ADDRESS = 487
+Const ERROR_ARITHMETIC_OVERFLOW = 534
+Const ERROR_PIPE_CONNECTED = 535
+Const ERROR_PIPE_LISTENING = 536
+Const ERROR_EA_ACCESS_DENIED = 994
+Const ERROR_OPERATION_ABORTED = 995
+Const ERROR_IO_INCOMPLETE = 996
+Const ERROR_IO_PENDING = 997
+Const ERROR_NOACCESS = 998
+Const ERROR_SWAPERROR = 999
+Const ERROR_STACK_OVERFLOW = 1001
+Const ERROR_INVALID_MESSAGE = 1002
+Const ERROR_CAN_NOT_COMPLETE = 1003
+Const ERROR_INVALID_FLAGS = 1004
+Const ERROR_UNRECOGNIZED_VOLUME = 1005
+Const ERROR_FILE_INVALID = 1006
+Const ERROR_FULLSCREEN_MODE = 1007
+Const ERROR_NO_TOKEN = 1008
+Const ERROR_BADDB = 1009
+Const ERROR_BADKEY = 1010
+Const ERROR_CANTOPEN = 1011
+Const ERROR_CANTREAD = 1012
+Const ERROR_CANTWRITE = 1013
+Const ERROR_REGISTRY_RECOVERED = 1014
+Const ERROR_REGISTRY_CORRUPT = 1015
+Const ERROR_REGISTRY_IO_FAILED = 1016
+Const ERROR_NOT_REGISTRY_FILE = 1017
+Const ERROR_KEY_DELETED = 1018
+Const ERROR_NO_LOG_SPACE = 1019
+Const ERROR_KEY_HAS_CHILDREN = 1020
+Const ERROR_CHILD_MUST_BE_VOLATILE = 1021
+Const ERROR_NOTIFY_ENUM_DIR = 1022
+Const ERROR_DEPENDENT_SERVICES_RUNNING = 1051
+Const ERROR_INVALID_SERVICE_CONTROL = 1052
+Const ERROR_SERVICE_REQUEST_TIMEOUT = 1053
+Const ERROR_SERVICE_NO_THREAD = 1054
+Const ERROR_SERVICE_DATABASE_LOCKED = 1055
+Const ERROR_SERVICE_ALREADY_RUNNING = 1056
+Const ERROR_INVALID_SERVICE_ACCOUNT = 1057
+Const ERROR_SERVICE_DISABLED = 1058
+Const ERROR_CIRCULAR_DEPENDENCY = 1059
+Const ERROR_SERVICE_DOES_NOT_EXIST = 1060
+Const ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061
+Const ERROR_SERVICE_NOT_ACTIVE = 1062
+Const ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063
+Const ERROR_EXCEPTION_IN_SERVICE = 1064
+Const ERROR_DATABASE_DOES_NOT_EXIST = 1065
+Const ERROR_SERVICE_SPECIFIC_ERROR = 1066
+Const ERROR_PROCESS_ABORTED = 1067
+Const ERROR_SERVICE_DEPENDENCY_FAIL = 1068
+Const ERROR_SERVICE_LOGON_FAILED = 1069
+Const ERROR_SERVICE_START_HANG = 1070
+Const ERROR_INVALID_SERVICE_LOCK = 1071
+Const ERROR_SERVICE_MARKED_FOR_DELETE = 1072
+Const ERROR_SERVICE_EXISTS = 1073
+Const ERROR_ALREADY_RUNNING_LKG = 1074
+Const ERROR_SERVICE_DEPENDENCY_DELETED = 1075
+Const ERROR_BOOT_ALREADY_ACCEPTED = 1076
+Const ERROR_SERVICE_NEVER_STARTED = 1077
+Const ERROR_DUPLICATE_SERVICE_NAME = 1078
+Const ERROR_DIFFERENT_SERVICE_ACCOUNT = 1079
+Const ERROR_CANNOT_DETECT_DRIVER_FAILURE = 1080
+Const ERROR_CANNOT_DETECT_PROCESS_ABORT = 1081
+Const ERROR_NO_RECOVERY_PROGRAM = 1082
+Const ERROR_SERVICE_NOT_IN_EXE = 1083
+Const ERROR_NOT_SAFEBOOT_SERVICE = 1084
+Const ERROR_END_OF_MEDIA = 1100
+Const ERROR_FILEMARK_DETECTED = 1101
+Const ERROR_BEGINNING_OF_MEDIA = 1102
+Const ERROR_SETMARK_DETECTED = 1103
+Const ERROR_NO_DATA_DETECTED = 1104
+Const ERROR_PARTITION_FAILURE = 1105
+Const ERROR_INVALID_BLOCK_LENGTH = 1106
+Const ERROR_DEVICE_NOT_PARTITIONED = 1107
+Const ERROR_UNABLE_TO_LOCK_MEDIA = 1108
+Const ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109
+Const ERROR_MEDIA_CHANGED = 1110
+Const ERROR_BUS_RESET = 1111
+Const ERROR_NO_MEDIA_IN_DRIVE = 1112
+Const ERROR_NO_UNICODE_TRANSLATION = 1113
+Const ERROR_DLL_INIT_FAILED = 1114
+Const ERROR_SHUTDOWN_IN_PROGRESS = 1115
+Const ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116
+Const ERROR_IO_DEVICE = 1117
+Const ERROR_SERIAL_NO_DEVICE = 1118
+Const ERROR_IRQ_BUSY = 1119
+Const ERROR_MORE_WRITES = 1120
+Const ERROR_COUNTER_TIMEOUT = 1121
+Const ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122
+Const ERROR_FLOPPY_WRONG_CYLINDER = 1123
+Const ERROR_FLOPPY_UNKNOWN_ERROR = 1124
+Const ERROR_FLOPPY_BAD_REGISTERS = 1125
+Const ERROR_DISK_RECALIBRATE_FAILED = 1126
+Const ERROR_DISK_OPERATION_FAILED = 1127
+Const ERROR_DISK_RESET_FAILED = 1128
+Const ERROR_EOM_OVERFLOW = 1129
+Const ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130
+Const ERROR_POSSIBLE_DEADLOCK = 1131
+Const ERROR_MAPPED_ALIGNMENT = 1132
+Const ERROR_SET_POWER_STATE_VETOED = 1140
+Const ERROR_SET_POWER_STATE_FAILED = 1141
+Const ERROR_TOO_MANY_LINKS = 1142
+Const ERROR_OLD_WIN_VERSION = 1150
+Const ERROR_APP_WRONG_OS = 1151
+Const ERROR_SINGLE_INSTANCE_APP = 1152
+Const ERROR_RMODE_APP = 1153
+Const ERROR_INVALID_DLL = 1154
+Const ERROR_NO_ASSOCIATION = 1155
+Const ERROR_DDE_FAIL = 1156
+Const ERROR_DLL_NOT_FOUND = 1157
+Const ERROR_NO_MORE_USER_HANDLES = 1158
+Const ERROR_MESSAGE_SYNC_ONLY = 1159
+Const ERROR_SOURCE_ELEMENT_EMPTY = 1160
+Const ERROR_DESTINATION_ELEMENT_FULL = 1161
+Const ERROR_ILLEGAL_ELEMENT_ADDRESS = 1162
+Const ERROR_MAGAZINE_NOT_PRESENT = 1163
+Const ERROR_DEVICE_REINITIALIZATION_NEEDED = 1164
+Const ERROR_DEVICE_REQUIRES_CLEANING = 1165
+Const ERROR_DEVICE_DOOR_OPEN = 1166
+Const ERROR_DEVICE_NOT_CONNECTED = 1167
+Const ERROR_NOT_FOUND = 1168
+Const ERROR_NO_MATCH = 1169
+Const ERROR_SET_NOT_FOUND = 1170
+Const ERROR_POINT_NOT_FOUND = 1171
+Const ERROR_NO_TRACKING_SERVICE = 1172
+Const ERROR_NO_VOLUME_ID = 1173
+Const ERROR_UNABLE_TO_REMOVE_REPLACED = 1175
+Const ERROR_UNABLE_TO_MOVE_REPLACEMENT = 1176
+Const ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 = 1177
+Const ERROR_JOURNAL_DELETE_IN_PROGRESS = 1178
+Const ERROR_JOURNAL_NOT_ACTIVE = 1179
+Const ERROR_POTENTIAL_FILE_FOUND = 1180
+Const ERROR_JOURNAL_ENTRY_DELETED = 1181
+Const ERROR_BAD_DEVICE = 1200
+Const ERROR_CONNECTION_UNAVAIL = 1201
+Const ERROR_DEVICE_ALREADY_REMEMBERED = 1202
+Const ERROR_NO_NET_OR_BAD_PATH = 1203
+Const ERROR_BAD_PROVIDER = 1204
+Const ERROR_CANNOT_OPEN_PROFILE = 1205
+Const ERROR_BAD_PROFILE = 1206
+Const ERROR_NOT_CONTAINER = 1207
+Const ERROR_EXTENDED_ERROR = 1208
+Const ERROR_INVALID_GROUPNAME = 1209
+Const ERROR_INVALID_COMPUTERNAME = 1210
+Const ERROR_INVALID_EVENTNAME = 1211
+Const ERROR_INVALID_DOMAINNAME = 1212
+Const ERROR_INVALID_SERVICENAME = 1213
+Const ERROR_INVALID_NETNAME = 1214
+Const ERROR_INVALID_SHARENAME = 1215
+Const ERROR_INVALID_PASSWORDNAME = 1216
+Const ERROR_INVALID_MESSAGENAME = 1217
+Const ERROR_INVALID_MESSAGEDEST = 1218
+Const ERROR_SESSION_CREDENTIAL_CONFLICT = 1219
+Const ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220
+Const ERROR_DUP_DOMAINNAME = 1221
+Const ERROR_NO_NETWORK = 1222
+Const ERROR_CANCELLED = 1223
+Const ERROR_USER_MAPPED_FILE = 1224
+Const ERROR_CONNECTION_REFUSED = 1225
+Const ERROR_GRACEFUL_DISCONNECT = 1226
+Const ERROR_ADDRESS_ALREADY_ASSOCIATED = 1227
+Const ERROR_ADDRESS_NOT_ASSOCIATED = 1228
+Const ERROR_CONNECTION_INVALID = 1229
+Const ERROR_CONNECTION_ACTIVE = 1230
+Const ERROR_NETWORK_UNREACHABLE = 1231
+Const ERROR_HOST_UNREACHABLE = 1232
+Const ERROR_PROTOCOL_UNREACHABLE = 1233
+Const ERROR_PORT_UNREACHABLE = 1234
+Const ERROR_REQUEST_ABORTED = 1235
+Const ERROR_CONNECTION_ABORTED = 1236
+Const ERROR_RETRY = 1237
+Const ERROR_CONNECTION_COUNT_LIMIT = 1238
+Const ERROR_LOGIN_TIME_RESTRICTION = 1239
+Const ERROR_LOGIN_WKSTA_RESTRICTION = 1240
+Const ERROR_INCORRECT_ADDRESS = 1241
+Const ERROR_ALREADY_REGISTERED = 1242
+Const ERROR_SERVICE_NOT_FOUND = 1243
+Const ERROR_NOT_AUTHENTICATED = 1244
+Const ERROR_NOT_LOGGED_ON = 1245
+Const ERROR_CONTINUE = 1246
+Const ERROR_ALREADY_INITIALIZED = 1247
+Const ERROR_NO_MORE_DEVICES = 1248
+Const ERROR_NO_SUCH_SITE = 1249
+Const ERROR_DOMAIN_CONTROLLER_EXISTS = 1250
+Const ERROR_ONLY_IF_CONNECTED = 1251
+Const ERROR_OVERRIDE_NOCHANGES = 1252
+Const ERROR_BAD_USER_PROFILE = 1253
+Const ERROR_NOT_SUPPORTED_ON_SBS = 1254
+Const ERROR_SERVER_SHUTDOWN_IN_PROGRESS = 1255
+Const ERROR_HOST_DOWN = 1256
+Const ERROR_NON_ACCOUNT_SID = 1257
+Const ERROR_NON_DOMAIN_SID = 1258
+Const ERROR_APPHELP_BLOCK = 1259
+Const ERROR_ACCESS_DISABLED_BY_POLICY = 1260
+Const ERROR_REG_NAT_CONSUMPTION = 1261
+Const ERROR_CSCSHARE_OFFLINE = 1262
+Const ERROR_PKINIT_FAILURE = 1263
+Const ERROR_SMARTCARD_SUBSYSTEM_FAILURE = 1264
+Const ERROR_DOWNGRADE_DETECTED = 1265
+Const ERROR_MACHINE_LOCKED = 1271
+Const ERROR_CALLBACK_SUPPLIED_INVALID_DATA = 1273
+Const ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED = 1274
+Const ERROR_DRIVER_BLOCKED = 1275
+Const ERROR_INVALID_IMPORT_OF_NON_DLL = 1276
+Const ERROR_ACCESS_DISABLED_WEBBLADE = 1277
+Const ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER = 1278
+Const ERROR_RECOVERY_FAILURE = 1279
+Const ERROR_ALREADY_FIBER = 1280
+Const ERROR_ALREADY_THREAD = 1281
+Const ERROR_STACK_BUFFER_OVERRUN = 1282
+Const ERROR_PARAMETER_QUOTA_EXCEEDED = 1283
+Const ERROR_DEBUGGER_INACTIVE = 1284
+Const ERROR_DELAY_LOAD_FAILED = 1285
+Const ERROR_VDM_DISALLOWED = 1286
+Const ERROR_UNIDENTIFIED_ERROR = 1287
+Const ERROR_NOT_ALL_ASSIGNED = 1300
+Const ERROR_SOME_NOT_MAPPED = 1301
+Const ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302
+Const ERROR_LOCAL_USER_SESSION_KEY = 1303
+Const ERROR_NULL_LM_PASSWORD = 1304
+Const ERROR_UNKNOWN_REVISION = 1305
+Const ERROR_REVISION_MISMATCH = 1306
+Const ERROR_INVALID_OWNER = 1307
+Const ERROR_INVALID_PRIMARY_GROUP = 1308
+Const ERROR_NO_IMPERSONATION_TOKEN = 1309
+Const ERROR_CANT_DISABLE_MANDATORY = 1310
+Const ERROR_NO_LOGON_SERVERS = 1311
+Const ERROR_NO_SUCH_LOGON_SESSION = 1312
+Const ERROR_NO_SUCH_PRIVILEGE = 1313
+Const ERROR_PRIVILEGE_NOT_HELD = 1314
+Const ERROR_INVALID_ACCOUNT_NAME = 1315
+Const ERROR_USER_EXISTS = 1316
+Const ERROR_NO_SUCH_USER = 1317
+Const ERROR_GROUP_EXISTS = 1318
+Const ERROR_NO_SUCH_GROUP = 1319
+Const ERROR_MEMBER_IN_GROUP = 1320
+Const ERROR_MEMBER_NOT_IN_GROUP = 1321
+Const ERROR_LAST_ADMIN = 1322
+Const ERROR_WRONG_PASSWORD = 1323
+Const ERROR_ILL_FORMED_PASSWORD = 1324
+Const ERROR_PASSWORD_RESTRICTION = 1325
+Const ERROR_LOGON_FAILURE = 1326
+Const ERROR_ACCOUNT_RESTRICTION = 1327
+Const ERROR_INVALID_LOGON_HOURS = 1328
+Const ERROR_INVALID_WORKSTATION = 1329
+Const ERROR_PASSWORD_EXPIRED = 1330
+Const ERROR_ACCOUNT_DISABLED = 1331
+Const ERROR_NONE_MAPPED = 1332
+Const ERROR_TOO_MANY_LUIDS_REQUESTED = 1333
+Const ERROR_LUIDS_EXHAUSTED = 1334
+Const ERROR_INVALID_SUB_AUTHORITY = 1335
+Const ERROR_INVALID_ACL = 1336
+Const ERROR_INVALID_SID = 1337
+Const ERROR_INVALID_SECURITY_DESCR = 1338
+Const ERROR_BAD_INHERITANCE_ACL = 1340
+Const ERROR_SERVER_DISABLED = 1341
+Const ERROR_SERVER_NOT_DISABLED = 1342
+Const ERROR_INVALID_ID_AUTHORITY = 1343
+Const ERROR_ALLOTTED_SPACE_EXCEEDED = 1344
+Const ERROR_INVALID_GROUP_ATTRIBUTES = 1345
+Const ERROR_BAD_IMPERSONATION_LEVEL = 1346
+Const ERROR_CANT_OPEN_ANONYMOUS = 1347
+Const ERROR_BAD_VALIDATION_CLASS = 1348
+Const ERROR_BAD_TOKEN_TYPE = 1349
+Const ERROR_NO_SECURITY_ON_OBJECT = 1350
+Const ERROR_CANT_ACCESS_DOMAIN_INFO = 1351
+Const ERROR_INVALID_SERVER_STATE = 1352
+Const ERROR_INVALID_DOMAIN_STATE = 1353
+Const ERROR_INVALID_DOMAIN_ROLE = 1354
+Const ERROR_NO_SUCH_DOMAIN = 1355
+Const ERROR_DOMAIN_EXISTS = 1356
+Const ERROR_DOMAIN_LIMIT_EXCEEDED = 1357
+Const ERROR_INTERNAL_DB_CORRUPTION = 1358
+Const ERROR_INTERNAL_ERROR = 1359
+Const ERROR_GENERIC_NOT_MAPPED = 1360
+Const ERROR_BAD_DESCRIPTOR_FORMAT = 1361
+Const ERROR_NOT_LOGON_PROCESS = 1362
+Const ERROR_LOGON_SESSION_EXISTS = 1363
+Const ERROR_NO_SUCH_PACKAGE = 1364
+Const ERROR_BAD_LOGON_SESSION_STATE = 1365
+Const ERROR_LOGON_SESSION_COLLISION = 1366
+Const ERROR_INVALID_LOGON_TYPE = 1367
+Const ERROR_CANNOT_IMPERSONATE = 1368
+Const ERROR_RXACT_INVALID_STATE = 1369
+Const ERROR_RXACT_COMMIT_FAILURE = 1370
+Const ERROR_SPECIAL_ACCOUNT = 1371
+Const ERROR_SPECIAL_GROUP = 1372
+Const ERROR_SPECIAL_USER = 1373
+Const ERROR_MEMBERS_PRIMARY_GROUP = 1374
+Const ERROR_TOKEN_ALREADY_IN_USE = 1375
+Const ERROR_NO_SUCH_ALIAS = 1376
+Const ERROR_MEMBER_NOT_IN_ALIAS = 1377
+Const ERROR_MEMBER_IN_ALIAS = 1378
+Const ERROR_ALIAS_EXISTS = 1379
+Const ERROR_LOGON_NOT_GRANTED = 1380
+Const ERROR_TOO_MANY_SECRETS = 1381
+Const ERROR_SECRET_TOO_LONG = 1382
+Const ERROR_INTERNAL_DB_ERROR = 1383
+Const ERROR_TOO_MANY_CONTEXT_IDS = 1384
+Const ERROR_LOGON_TYPE_NOT_GRANTED = 1385
+Const ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386
+Const ERROR_NO_SUCH_MEMBER = 1387
+Const ERROR_INVALID_MEMBER = 1388
+Const ERROR_TOO_MANY_SIDS = 1389
+Const ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390
+Const ERROR_NO_INHERITANCE = 1391
+Const ERROR_FILE_CORRUPT = 1392
+Const ERROR_DISK_CORRUPT = 1393
+Const ERROR_NO_USER_SESSION_KEY = 1394
+Const ERROR_LICENSE_QUOTA_EXCEEDED = 1395
+Const ERROR_WRONG_TARGET_NAME = 1396
+Const ERROR_MUTUAL_AUTH_FAILED = 1397
+Const ERROR_TIME_SKEW = 1398
+Const ERROR_CURRENT_DOMAIN_NOT_ALLOWED = 1399
+Const ERROR_INVALID_WINDOW_HANDLE = 1400
+Const ERROR_INVALID_MENU_HANDLE = 1401
+Const ERROR_INVALID_CURSOR_HANDLE = 1402
+Const ERROR_INVALID_ACCEL_HANDLE = 1403
+Const ERROR_INVALID_HOOK_HANDLE = 1404
+Const ERROR_INVALID_DWP_HANDLE = 1405
+Const ERROR_TLW_WITH_WSCHILD = 1406
+Const ERROR_CANNOT_FIND_WND_CLASS = 1407
+Const ERROR_WINDOW_OF_OTHER_THREAD = 1408
+Const ERROR_HOTKEY_ALREADY_REGISTERED = 1409
+Const ERROR_CLASS_ALREADY_EXISTS = 1410
+Const ERROR_CLASS_DOES_NOT_EXIST = 1411
+Const ERROR_CLASS_HAS_WINDOWS = 1412
+Const ERROR_INVALID_INDEX = 1413
+Const ERROR_INVALID_ICON_HANDLE = 1414
+Const ERROR_PRIVATE_DIALOG_INDEX = 1415
+Const ERROR_LISTBOX_ID_NOT_FOUND = 1416
+Const ERROR_NO_WILDCARD_CHARACTERS = 1417
+Const ERROR_CLIPBOARD_NOT_OPEN = 1418
+Const ERROR_HOTKEY_NOT_REGISTERED = 1419
+Const ERROR_WINDOW_NOT_DIALOG = 1420
+Const ERROR_CONTROL_ID_NOT_FOUND = 1421
+Const ERROR_INVALID_COMBOBOX_MESSAGE = 1422
+Const ERROR_WINDOW_NOT_COMBOBOX = 1423
+Const ERROR_INVALID_EDIT_HEIGHT = 1424
+Const ERROR_DC_NOT_FOUND = 1425
+Const ERROR_INVALID_HOOK_FILTER = 1426
+Const ERROR_INVALID_FILTER_PROC = 1427
+Const ERROR_HOOK_NEEDS_HMOD = 1428
+Const ERROR_GLOBAL_ONLY_HOOK = 1429
+Const ERROR_JOURNAL_HOOK_SET = 1430
+Const ERROR_HOOK_NOT_INSTALLED = 1431
+Const ERROR_INVALID_LB_MESSAGE = 1432
+Const ERROR_SETCOUNT_ON_BAD_LB = 1433
+Const ERROR_LB_WITHOUT_TABSTOPS = 1434
+Const ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435
+Const ERROR_CHILD_WINDOW_MENU = 1436
+Const ERROR_NO_SYSTEM_MENU = 1437
+Const ERROR_INVALID_MSGBOX_STYLE = 1438
+Const ERROR_INVALID_SPI_VALUE = 1439
+Const ERROR_SCREEN_ALREADY_LOCKED = 1440
+Const ERROR_HWNDS_HAVE_DIFF_PARENT = 1441
+Const ERROR_NOT_CHILD_WINDOW = 1442
+Const ERROR_INVALID_GW_COMMAND = 1443
+Const ERROR_INVALID_THREAD_ID = 1444
+Const ERROR_NON_MDICHILD_WINDOW = 1445
+Const ERROR_POPUP_ALREADY_ACTIVE = 1446
+Const ERROR_NO_SCROLLBARS = 1447
+Const ERROR_INVALID_SCROLLBAR_RANGE = 1448
+Const ERROR_INVALID_SHOWWIN_COMMAND = 1449
+Const ERROR_NO_SYSTEM_RESOURCES = 1450
+Const ERROR_NONPAGED_SYSTEM_RESOURCES = 1451
+Const ERROR_PAGED_SYSTEM_RESOURCES = 1452
+Const ERROR_WORKING_SET_QUOTA = 1453
+Const ERROR_PAGEFILE_QUOTA = 1454
+Const ERROR_COMMITMENT_LIMIT = 1455
+Const ERROR_MENU_ITEM_NOT_FOUND = 1456
+Const ERROR_INVALID_KEYBOARD_HANDLE = 1457
+Const ERROR_HOOK_TYPE_NOT_ALLOWED = 1458
+Const ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION = 1459
+Const ERROR_TIMEOUT = 1460
+Const ERROR_INVALID_MONITOR_HANDLE = 1461
+Const ERROR_INCORRECT_SIZE = 1462
+Const ERROR_EVENTLOG_FILE_CORRUPT = 1500
+Const ERROR_EVENTLOG_CANT_START = 1501
+Const ERROR_LOG_FILE_FULL = 1502
+Const ERROR_EVENTLOG_FILE_CHANGED = 1503
+Const ERROR_INSTALL_SERVICE_FAILURE = 1601
+Const ERROR_INSTALL_USEREXIT = 1602
+Const ERROR_INSTALL_FAILURE = 1603
+Const ERROR_INSTALL_SUSPEND = 1604
+Const ERROR_UNKNOWN_PRODUCT = 1605
+Const ERROR_UNKNOWN_FEATURE = 1606
+Const ERROR_UNKNOWN_COMPONENT = 1607
+Const ERROR_UNKNOWN_PROPERTY = 1608
+Const ERROR_INVALID_HANDLE_STATE = 1609
+Const ERROR_BAD_CONFIGURATION = 1610
+Const ERROR_INDEX_ABSENT = 1611
+Const ERROR_INSTALL_SOURCE_ABSENT = 1612
+Const ERROR_INSTALL_PACKAGE_VERSION = 1613
+Const ERROR_PRODUCT_UNINSTALLED = 1614
+Const ERROR_BAD_QUERY_SYNTAX = 1615
+Const ERROR_INVALID_FIELD = 1616
+Const ERROR_DEVICE_REMOVED = 1617
+Const ERROR_INSTALL_ALREADY_RUNNING = 1618
+Const ERROR_INSTALL_PACKAGE_OPEN_FAILED = 1619
+Const ERROR_INSTALL_PACKAGE_INVALID = 1620
+Const ERROR_INSTALL_UI_FAILURE = 1621
+Const ERROR_INSTALL_LOG_FAILURE = 1622
+Const ERROR_INSTALL_LANGUAGE_UNSUPPORTED = 1623
+Const ERROR_INSTALL_TRANSFORM_FAILURE = 1624
+Const ERROR_INSTALL_PACKAGE_REJECTED = 1625
+Const ERROR_FUNCTION_NOT_CALLED = 1626
+Const ERROR_FUNCTION_FAILED = 1627
+Const ERROR_INVALID_TABLE = 1628
+Const ERROR_DATATYPE_MISMATCH = 1629
+Const ERROR_UNSUPPORTED_TYPE = 1630
+Const ERROR_CREATE_FAILED = 1631
+Const ERROR_INSTALL_TEMP_UNWRITABLE = 1632
+Const ERROR_INSTALL_PLATFORM_UNSUPPORTED = 1633
+Const ERROR_INSTALL_NOTUSED = 1634
+Const ERROR_PATCH_PACKAGE_OPEN_FAILED = 1635
+Const ERROR_PATCH_PACKAGE_INVALID = 1636
+Const ERROR_PATCH_PACKAGE_UNSUPPORTED = 1637
+Const ERROR_PRODUCT_VERSION = 1638
+Const ERROR_INVALID_COMMAND_LINE = 1639
+Const ERROR_INSTALL_REMOTE_DISALLOWED = 1640
+Const ERROR_SUCCESS_REBOOT_INITIATED = 1641
+Const ERROR_PATCH_TARGET_NOT_FOUND = 1642
+Const ERROR_PATCH_PACKAGE_REJECTED = 1643
+Const ERROR_INSTALL_TRANSFORM_REJECTED = 1644
+Const ERROR_INSTALL_REMOTE_PROHIBITED = 1645
+Const RPC_S_INVALID_STRING_BINDING = 1700
+Const RPC_S_WRONG_KIND_OF_BINDING = 1701
+Const RPC_S_INVALID_BINDING = 1702
+Const RPC_S_PROTSEQ_NOT_SUPPORTED = 1703
+Const RPC_S_INVALID_RPC_PROTSEQ = 1704
+Const RPC_S_INVALID_STRING_UUID = 1705
+Const RPC_S_INVALID_ENDPOINT_FORMAT = 1706
+Const RPC_S_INVALID_NET_ADDR = 1707
+Const RPC_S_NO_ENDPOINT_FOUND = 1708
+Const RPC_S_INVALID_TIMEOUT = 1709
+Const RPC_S_OBJECT_NOT_FOUND = 1710
+Const RPC_S_ALREADY_REGISTERED = 1711
+Const RPC_S_TYPE_ALREADY_REGISTERED = 1712
+Const RPC_S_ALREADY_LISTENING = 1713
+Const RPC_S_NO_PROTSEQS_REGISTERED = 1714
+Const RPC_S_NOT_LISTENING = 1715
+Const RPC_S_UNKNOWN_MGR_TYPE = 1716
+Const RPC_S_UNKNOWN_IF = 1717
+Const RPC_S_NO_BINDINGS = 1718
+Const RPC_S_NO_PROTSEQS = 1719
+Const RPC_S_CANT_CREATE_ENDPOINT = 1720
+Const RPC_S_OUT_OF_RESOURCES = 1721
+Const RPC_S_SERVER_UNAVAILABLE = 1722
+Const RPC_S_SERVER_TOO_BUSY = 1723
+Const RPC_S_INVALID_NETWORK_OPTIONS = 1724
+Const RPC_S_NO_CALL_ACTIVE = 1725
+Const RPC_S_CALL_FAILED = 1726
+Const RPC_S_CALL_FAILED_DNE = 1727
+Const RPC_S_PROTOCOL_ERROR = 1728
+Const RPC_S_UNSUPPORTED_TRANS_SYN = 1730
+Const RPC_S_UNSUPPORTED_TYPE = 1732
+Const RPC_S_INVALID_TAG = 1733
+Const RPC_S_INVALID_BOUND = 1734
+Const RPC_S_NO_ENTRY_NAME = 1735
+Const RPC_S_INVALID_NAME_SYNTAX = 1736
+Const RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737
+Const RPC_S_UUID_NO_ADDRESS = 1739
+Const RPC_S_DUPLICATE_ENDPOINT = 1740
+Const RPC_S_UNKNOWN_AUTHN_TYPE = 1741
+Const RPC_S_MAX_CALLS_TOO_SMALL = 1742
+Const RPC_S_STRING_TOO_LONG = 1743
+Const RPC_S_PROTSEQ_NOT_FOUND = 1744
+Const RPC_S_PROCNUM_OUT_OF_RANGE = 1745
+Const RPC_S_BINDING_HAS_NO_AUTH = 1746
+Const RPC_S_UNKNOWN_AUTHN_SERVICE = 1747
+Const RPC_S_UNKNOWN_AUTHN_LEVEL = 1748
+Const RPC_S_INVALID_AUTH_IDENTITY = 1749
+Const RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750
+Const EPT_S_INVALID_ENTRY = 1751
+Const EPT_S_CANT_PERFORM_OP = 1752
+Const EPT_S_NOT_REGISTERED = 1753
+Const RPC_S_NOTHING_TO_EXPORT = 1754
+Const RPC_S_INCOMPLETE_NAME = 1755
+Const RPC_S_INVALID_VERS_OPTION = 1756
+Const RPC_S_NO_MORE_MEMBERS = 1757
+Const RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758
+Const RPC_S_INTERFACE_NOT_FOUND = 1759
+Const RPC_S_ENTRY_ALREADY_EXISTS = 1760
+Const RPC_S_ENTRY_NOT_FOUND = 1761
+Const RPC_S_NAME_SERVICE_UNAVAILABLE = 1762
+Const RPC_S_INVALID_NAF_ID = 1763
+Const RPC_S_CANNOT_SUPPORT = 1764
+Const RPC_S_NO_CONTEXT_AVAILABLE = 1765
+Const RPC_S_INTERNAL_ERROR = 1766
+Const RPC_S_ZERO_DIVIDE = 1767
+Const RPC_S_ADDRESS_ERROR = 1768
+Const RPC_S_FP_DIV_ZERO = 1769
+Const RPC_S_FP_UNDERFLOW = 1770
+Const RPC_S_FP_OVERFLOW = 1771
+Const RPC_X_NO_MORE_ENTRIES = 1772
+Const RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773
+Const RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774
+Const RPC_X_SS_IN_NULL_CONTEXT = 1775
+Const RPC_X_SS_CONTEXT_DAMAGED = 1777
+Const RPC_X_SS_HANDLES_MISMATCH = 1778
+Const RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779
+Const RPC_X_NULL_REF_POINTER = 1780
+Const RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781
+Const RPC_X_BYTE_COUNT_TOO_SMALL = 1782
+Const RPC_X_BAD_STUB_DATA = 1783
+Const ERROR_INVALID_USER_BUFFER = 1784
+Const ERROR_UNRECOGNIZED_MEDIA = 1785
+Const ERROR_NO_TRUST_LSA_SECRET = 1786
+Const ERROR_NO_TRUST_SAM_ACCOUNT = 1787
+Const ERROR_TRUSTED_DOMAIN_FAILURE = 1788
+Const ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789
+Const ERROR_TRUST_FAILURE = 1790
+Const RPC_S_CALL_IN_PROGRESS = 1791
+Const ERROR_NETLOGON_NOT_STARTED = 1792
+Const ERROR_ACCOUNT_EXPIRED = 1793
+Const ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794
+Const ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795
+Const ERROR_UNKNOWN_PORT = 1796
+Const ERROR_UNKNOWN_PRINTER_DRIVER = 1797
+Const ERROR_UNKNOWN_PRINTPROCESSOR = 1798
+Const ERROR_INVALID_SEPARATOR_FILE = 1799
+Const ERROR_INVALID_PRIORITY = 1800
+Const ERROR_INVALID_PRINTER_NAME = 1801
+Const ERROR_PRINTER_ALREADY_EXISTS = 1802
+Const ERROR_INVALID_PRINTER_COMMAND = 1803
+Const ERROR_INVALID_DATATYPE = 1804
+Const ERROR_INVALID_ENVIRONMENT = 1805
+Const RPC_S_NO_MORE_BINDINGS = 1806
+Const ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807
+Const ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808
+Const ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809
+Const ERROR_DOMAIN_TRUST_INCONSISTENT = 1810
+Const ERROR_SERVER_HAS_OPEN_HANDLES = 1811
+Const ERROR_RESOURCE_DATA_NOT_FOUND = 1812
+Const ERROR_RESOURCE_TYPE_NOT_FOUND = 1813
+Const ERROR_RESOURCE_NAME_NOT_FOUND = 1814
+Const ERROR_RESOURCE_LANG_NOT_FOUND = 1815
+Const ERROR_NOT_ENOUGH_QUOTA = 1816
+Const RPC_S_NO_INTERFACES = 1817
+Const RPC_S_CALL_CANCELLED = 1818
+Const RPC_S_BINDING_INCOMPLETE = 1819
+Const RPC_S_COMM_FAILURE = 1820
+Const RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821
+Const RPC_S_NO_PRINC_NAME = 1822
+Const RPC_S_NOT_RPC_ERROR = 1823
+Const RPC_S_UUID_LOCAL_ONLY = 1824
+Const RPC_S_SEC_PKG_ERROR = 1825
+Const RPC_S_NOT_CANCELLED = 1826
+Const RPC_X_INVALID_ES_ACTION = 1827
+Const RPC_X_WRONG_ES_VERSION = 1828
+Const RPC_X_WRONG_STUB_VERSION = 1829
+Const RPC_X_INVALID_PIPE_OBJECT = 1830
+Const RPC_X_WRONG_PIPE_ORDER = 1831
+Const RPC_X_WRONG_PIPE_VERSION = 1832
+Const RPC_S_GROUP_MEMBER_NOT_FOUND = 1898
+Const EPT_S_CANT_CREATE = 1899
+Const RPC_S_INVALID_OBJECT = 1900
+Const ERROR_INVALID_TIME = 1901
+Const ERROR_INVALID_FORM_NAME = 1902
+Const ERROR_INVALID_FORM_SIZE = 1903
+Const ERROR_ALREADY_WAITING = 1904
+Const ERROR_PRINTER_DELETED = 1905
+Const ERROR_INVALID_PRINTER_STATE = 1906
+Const ERROR_PASSWORD_MUST_CHANGE = 1907
+Const ERROR_DOMAIN_CONTROLLER_NOT_FOUND = 1908
+Const ERROR_ACCOUNT_LOCKED_OUT = 1909
+Const OR_INVALID_OXID = 1910
+Const OR_INVALID_OID = 1911
+Const OR_INVALID_SET = 1912
+Const RPC_S_SEND_INCOMPLETE = 1913
+Const RPC_S_INVALID_ASYNC_HANDLE = 1914
+Const RPC_S_INVALID_ASYNC_CALL = 1915
+Const RPC_X_PIPE_CLOSED = 1916
+Const RPC_X_PIPE_DISCIPLINE_ERROR = 1917
+Const RPC_X_PIPE_EMPTY = 1918
+Const ERROR_NO_SITENAME = 1919
+Const ERROR_CANT_ACCESS_FILE = 1920
+Const ERROR_CANT_RESOLVE_FILENAME = 1921
+Const RPC_S_ENTRY_TYPE_MISMATCH = 1922
+Const RPC_S_NOT_ALL_OBJS_EXPORTED = 1923
+Const RPC_S_INTERFACE_NOT_EXPORTED = 1924
+Const RPC_S_PROFILE_NOT_ADDED = 1925
+Const RPC_S_PRF_ELT_NOT_ADDED = 1926
+Const RPC_S_PRF_ELT_NOT_REMOVED = 1927
+Const RPC_S_GRP_ELT_NOT_ADDED = 1928
+Const RPC_S_GRP_ELT_NOT_REMOVED = 1929
+Const ERROR_KM_DRIVER_BLOCKED = 1930
+Const ERROR_CONTEXT_EXPIRED = 1931
+Const ERROR_PER_USER_TRUST_QUOTA_EXCEEDED = 1932
+Const ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED = 1933
+Const ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED = 1934
+Const ERROR_AUTHENTICATION_FIREWALL_FAILED = 1935
+Const ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED = 1936
+Const ERROR_INVALID_PIXEL_FORMAT = 2000
+Const ERROR_BAD_DRIVER = 2001
+Const ERROR_INVALID_WINDOW_STYLE = 2002
+Const ERROR_METAFILE_NOT_SUPPORTED = 2003
+Const ERROR_TRANSFORM_NOT_SUPPORTED = 2004
+Const ERROR_CLIPPING_NOT_SUPPORTED = 2005
+Const ERROR_INVALID_CMM = 2010
+Const ERROR_INVALID_PROFILE = 2011
+Const ERROR_TAG_NOT_FOUND = 2012
+Const ERROR_TAG_NOT_PRESENT = 2013
+Const ERROR_DUPLICATE_TAG = 2014
+Const ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015
+Const ERROR_PROFILE_NOT_FOUND = 2016
+Const ERROR_INVALID_COLORSPACE = 2017
+Const ERROR_ICM_NOT_ENABLED = 2018
+Const ERROR_DELETING_ICM_XFORM = 2019
+Const ERROR_INVALID_TRANSFORM = 2020
+Const ERROR_COLORSPACE_MISMATCH = 2021
+Const ERROR_INVALID_COLORINDEX = 2022
+Const ERROR_CONNECTED_OTHER_PASSWORD = 2108
+Const ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT = 2109
+Const ERROR_BAD_USERNAME = 2202
+Const ERROR_NOT_CONNECTED = 2250
+Const ERROR_OPEN_FILES = 2401
+Const ERROR_ACTIVE_CONNECTIONS = 2402
+Const ERROR_DEVICE_IN_USE = 2404
+Const ERROR_UNKNOWN_PRINT_MONITOR = 3000
+Const ERROR_PRINTER_DRIVER_IN_USE = 3001
+Const ERROR_SPOOL_FILE_NOT_FOUND = 3002
+Const ERROR_SPL_NO_STARTDOC = 3003
+Const ERROR_SPL_NO_ADDJOB = 3004
+Const ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005
+Const ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006
+Const ERROR_INVALID_PRINT_MONITOR = 3007
+Const ERROR_PRINT_MONITOR_IN_USE = 3008
+Const ERROR_PRINTER_HAS_JOBS_QUEUED = 3009
+Const ERROR_SUCCESS_REBOOT_REQUIRED = 3010
+Const ERROR_SUCCESS_RESTART_REQUIRED = 3011
+Const ERROR_PRINTER_NOT_FOUND = 3012
+Const ERROR_PRINTER_DRIVER_WARNED = 3013
+Const ERROR_PRINTER_DRIVER_BLOCKED = 3014
+Const ERROR_WINS_INTERNAL = 4000
+Const ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001
+Const ERROR_STATIC_INIT = 4002
+Const ERROR_INC_BACKUP = 4003
+Const ERROR_FULL_BACKUP = 4004
+Const ERROR_REC_NON_EXISTENT = 4005
+Const ERROR_RPL_NOT_ALLOWED = 4006
+Const ERROR_DHCP_ADDRESS_CONFLICT = 4100
+Const ERROR_WMI_GUID_NOT_FOUND = 4200
+Const ERROR_WMI_INSTANCE_NOT_FOUND = 4201
+Const ERROR_WMI_ITEMID_NOT_FOUND = 4202
+Const ERROR_WMI_TRY_AGAIN = 4203
+Const ERROR_WMI_DP_NOT_FOUND = 4204
+Const ERROR_WMI_UNRESOLVED_INSTANCE_REF = 4205
+Const ERROR_WMI_ALREADY_ENABLED = 4206
+Const ERROR_WMI_GUID_DISCONNECTED = 4207
+Const ERROR_WMI_SERVER_UNAVAILABLE = 4208
+Const ERROR_WMI_DP_FAILED = 4209
+Const ERROR_WMI_INVALID_MOF = 4210
+Const ERROR_WMI_INVALID_REGINFO = 4211
+Const ERROR_WMI_ALREADY_DISABLED = 4212
+Const ERROR_WMI_READ_ONLY = 4213
+Const ERROR_WMI_SET_FAILURE = 4214
+Const ERROR_INVALID_MEDIA = 4300
+Const ERROR_INVALID_LIBRARY = 4301
+Const ERROR_INVALID_MEDIA_POOL = 4302
+Const ERROR_DRIVE_MEDIA_MISMATCH = 4303
+Const ERROR_MEDIA_OFFLINE = 4304
+Const ERROR_LIBRARY_OFFLINE = 4305
+Const ERROR_EMPTY = 4306
+Const ERROR_NOT_EMPTY = 4307
+Const ERROR_MEDIA_UNAVAILABLE = 4308
+Const ERROR_RESOURCE_DISABLED = 4309
+Const ERROR_INVALID_CLEANER = 4310
+Const ERROR_UNABLE_TO_CLEAN = 4311
+Const ERROR_OBJECT_NOT_FOUND = 4312
+Const ERROR_DATABASE_FAILURE = 4313
+Const ERROR_DATABASE_FULL = 4314
+Const ERROR_MEDIA_INCOMPATIBLE = 4315
+Const ERROR_RESOURCE_NOT_PRESENT = 4316
+Const ERROR_INVALID_OPERATION = 4317
+Const ERROR_MEDIA_NOT_AVAILABLE = 4318
+Const ERROR_DEVICE_NOT_AVAILABLE = 4319
+Const ERROR_REQUEST_REFUSED = 4320
+Const ERROR_INVALID_DRIVE_OBJECT = 4321
+Const ERROR_LIBRARY_FULL = 4322
+Const ERROR_MEDIUM_NOT_ACCESSIBLE = 4323
+Const ERROR_UNABLE_TO_LOAD_MEDIUM = 4324
+Const ERROR_UNABLE_TO_INVENTORY_DRIVE = 4325
+Const ERROR_UNABLE_TO_INVENTORY_SLOT = 4326
+Const ERROR_UNABLE_TO_INVENTORY_TRANSPORT = 4327
+Const ERROR_TRANSPORT_FULL = 4328
+Const ERROR_CONTROLLING_IEPORT = 4329
+Const ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA = 4330
+Const ERROR_CLEANER_SLOT_SET = 4331
+Const ERROR_CLEANER_SLOT_NOT_SET = 4332
+Const ERROR_CLEANER_CARTRIDGE_SPENT = 4333
+Const ERROR_UNEXPECTED_OMID = 4334
+Const ERROR_CANT_DELETE_LAST_ITEM = 4335
+Const ERROR_MESSAGE_EXCEEDS_MAX_SIZE = 4336
+Const ERROR_VOLUME_CONTAINS_SYS_FILES = 4337
+Const ERROR_INDIGENOUS_TYPE = 4338
+Const ERROR_NO_SUPPORTING_DRIVES = 4339
+Const ERROR_CLEANER_CARTRIDGE_INSTALLED = 4340
+Const ERROR_IEPORT_FULL = 4341
+Const ERROR_FILE_OFFLINE = 4350
+Const ERROR_REMOTE_STORAGE_NOT_ACTIVE = 4351
+Const ERROR_REMOTE_STORAGE_MEDIA_ERROR = 4352
+Const ERROR_NOT_A_REPARSE_POINT = 4390
+Const ERROR_REPARSE_ATTRIBUTE_CONFLICT = 4391
+Const ERROR_INVALID_REPARSE_DATA = 4392
+Const ERROR_REPARSE_TAG_INVALID = 4393
+Const ERROR_REPARSE_TAG_MISMATCH = 4394
+Const ERROR_VOLUME_NOT_SIS_ENABLED = 4500
+Const ERROR_DEPENDENT_RESOURCE_EXISTS = 5001
+Const ERROR_DEPENDENCY_NOT_FOUND = 5002
+Const ERROR_DEPENDENCY_ALREADY_EXISTS = 5003
+Const ERROR_RESOURCE_NOT_ONLINE = 5004
+Const ERROR_HOST_NODE_NOT_AVAILABLE = 5005
+Const ERROR_RESOURCE_NOT_AVAILABLE = 5006
+Const ERROR_RESOURCE_NOT_FOUND = 5007
+Const ERROR_SHUTDOWN_CLUSTER = 5008
+Const ERROR_CANT_EVICT_ACTIVE_NODE = 5009
+Const ERROR_OBJECT_ALREADY_EXISTS = 5010
+Const ERROR_OBJECT_IN_LIST = 5011
+Const ERROR_GROUP_NOT_AVAILABLE = 5012
+Const ERROR_GROUP_NOT_FOUND = 5013
+Const ERROR_GROUP_NOT_ONLINE = 5014
+Const ERROR_HOST_NODE_NOT_RESOURCE_OWNER = 5015
+Const ERROR_HOST_NODE_NOT_GROUP_OWNER = 5016
+Const ERROR_RESMON_CREATE_FAILED = 5017
+Const ERROR_RESMON_ONLINE_FAILED = 5018
+Const ERROR_RESOURCE_ONLINE = 5019
+Const ERROR_QUORUM_RESOURCE = 5020
+Const ERROR_NOT_QUORUM_CAPABLE = 5021
+Const ERROR_CLUSTER_SHUTTING_DOWN = 5022
+Const ERROR_INVALID_STATE = 5023
+Const ERROR_RESOURCE_PROPERTIES_STORED = 5024
+Const ERROR_NOT_QUORUM_CLASS = 5025
+Const ERROR_CORE_RESOURCE = 5026
+Const ERROR_QUORUM_RESOURCE_ONLINE_FAILED = 5027
+Const ERROR_QUORUMLOG_OPEN_FAILED = 5028
+Const ERROR_CLUSTERLOG_CORRUPT = 5029
+Const ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE = 5030
+Const ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE = 5031
+Const ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND = 5032
+Const ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE = 5033
+Const ERROR_QUORUM_OWNER_ALIVE = 5034
+Const ERROR_NETWORK_NOT_AVAILABLE = 5035
+Const ERROR_NODE_NOT_AVAILABLE = 5036
+Const ERROR_ALL_NODES_NOT_AVAILABLE = 5037
+Const ERROR_RESOURCE_FAILED = 5038
+Const ERROR_CLUSTER_INVALID_NODE = 5039
+Const ERROR_CLUSTER_NODE_EXISTS = 5040
+Const ERROR_CLUSTER_JOIN_IN_PROGRESS = 5041
+Const ERROR_CLUSTER_NODE_NOT_FOUND = 5042
+Const ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND = 5043
+Const ERROR_CLUSTER_NETWORK_EXISTS = 5044
+Const ERROR_CLUSTER_NETWORK_NOT_FOUND = 5045
+Const ERROR_CLUSTER_NETINTERFACE_EXISTS = 5046
+Const ERROR_CLUSTER_NETINTERFACE_NOT_FOUND = 5047
+Const ERROR_CLUSTER_INVALID_REQUEST = 5048
+Const ERROR_CLUSTER_INVALID_NETWORK_PROVIDER = 5049
+Const ERROR_CLUSTER_NODE_DOWN = 5050
+Const ERROR_CLUSTER_NODE_UNREACHABLE = 5051
+Const ERROR_CLUSTER_NODE_NOT_MEMBER = 5052
+Const ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS = 5053
+Const ERROR_CLUSTER_INVALID_NETWORK = 5054
+Const ERROR_CLUSTER_NODE_UP = 5056
+Const ERROR_CLUSTER_IPADDR_IN_USE = 5057
+Const ERROR_CLUSTER_NODE_NOT_PAUSED = 5058
+Const ERROR_CLUSTER_NO_SECURITY_CONTEXT = 5059
+Const ERROR_CLUSTER_NETWORK_NOT_INTERNAL = 5060
+Const ERROR_CLUSTER_NODE_ALREADY_UP = 5061
+Const ERROR_CLUSTER_NODE_ALREADY_DOWN = 5062
+Const ERROR_CLUSTER_NETWORK_ALREADY_ONLINE = 5063
+Const ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE = 5064
+Const ERROR_CLUSTER_NODE_ALREADY_MEMBER = 5065
+Const ERROR_CLUSTER_LAST_INTERNAL_NETWORK = 5066
+Const ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS = 5067
+Const ERROR_INVALID_OPERATION_ON_QUORUM = 5068
+Const ERROR_DEPENDENCY_NOT_ALLOWED = 5069
+Const ERROR_CLUSTER_NODE_PAUSED = 5070
+Const ERROR_NODE_CANT_HOST_RESOURCE = 5071
+Const ERROR_CLUSTER_NODE_NOT_READY = 5072
+Const ERROR_CLUSTER_NODE_SHUTTING_DOWN = 5073
+Const ERROR_CLUSTER_JOIN_ABORTED = 5074
+Const ERROR_CLUSTER_INCOMPATIBLE_VERSIONS = 5075
+Const ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED = 5076
+Const ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED = 5077
+Const ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND = 5078
+Const ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED = 5079
+Const ERROR_CLUSTER_RESNAME_NOT_FOUND = 5080
+Const ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED = 5081
+Const ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST = 5082
+Const ERROR_CLUSTER_DATABASE_SEQMISMATCH = 5083
+Const ERROR_RESMON_INVALID_STATE = 5084
+Const ERROR_CLUSTER_GUM_NOT_LOCKER = 5085
+Const ERROR_QUORUM_DISK_NOT_FOUND = 5086
+Const ERROR_DATABASE_BACKUP_CORRUPT = 5087
+Const ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT = 5088
+Const ERROR_RESOURCE_PROPERTY_UNCHANGEABLE = 5089
+Const ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE = 5890
+Const ERROR_CLUSTER_QUORUMLOG_NOT_FOUND = 5891
+Const ERROR_CLUSTER_MEMBERSHIP_HALT = 5892
+Const ERROR_CLUSTER_INSTANCE_ID_MISMATCH = 5893
+Const ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP = 5894
+Const ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH = 5895
+Const ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP = 5896
+Const ERROR_CLUSTER_PARAMETER_MISMATCH = 5897
+Const ERROR_NODE_CANNOT_BE_CLUSTERED = 5898
+Const ERROR_CLUSTER_WRONG_OS_VERSION = 5899
+Const ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME = 5900
+Const ERROR_CLUSCFG_ALREADY_COMMITTED = 5901
+Const ERROR_CLUSCFG_ROLLBACK_FAILED = 5902
+Const ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT = 5903
+Const ERROR_CLUSTER_OLD_VERSION = 5904
+Const ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME = 5905
+Const ERROR_ENCRYPTION_FAILED = 6000
+Const ERROR_DECRYPTION_FAILED = 6001
+Const ERROR_FILE_ENCRYPTED = 6002
+Const ERROR_NO_RECOVERY_POLICY = 6003
+Const ERROR_NO_EFS = 6004
+Const ERROR_WRONG_EFS = 6005
+Const ERROR_NO_USER_KEYS = 6006
+Const ERROR_FILE_NOT_ENCRYPTED = 6007
+Const ERROR_NOT_EXPORT_FORMAT = 6008
+Const ERROR_FILE_READ_ONLY = 6009
+Const ERROR_DIR_EFS_DISALLOWED = 6010
+Const ERROR_EFS_SERVER_NOT_TRUSTED = 6011
+Const ERROR_BAD_RECOVERY_POLICY = 6012
+Const ERROR_EFS_ALG_BLOB_TOO_BIG = 6013
+Const ERROR_VOLUME_NOT_SUPPORT_EFS = 6014
+Const ERROR_EFS_DISABLED = 6015
+Const ERROR_EFS_VERSION_NOT_SUPPORT = 6016
+Const ERROR_NO_BROWSER_SERVERS_FOUND = 6118
+Const SCHED_E_SERVICE_NOT_LOCALSYSTEM = 6200
+Const ERROR_CTX_WINSTATION_NAME_INVALID = 7001
+Const ERROR_CTX_INVALID_PD = 7002
+Const ERROR_CTX_PD_NOT_FOUND = 7003
+Const ERROR_CTX_WD_NOT_FOUND = 7004
+Const ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY = 7005
+Const ERROR_CTX_SERVICE_NAME_COLLISION = 7006
+Const ERROR_CTX_CLOSE_PENDING = 7007
+Const ERROR_CTX_NO_OUTBUF = 7008
+Const ERROR_CTX_MODEM_INF_NOT_FOUND = 7009
+Const ERROR_CTX_INVALID_MODEMNAME = 7010
+Const ERROR_CTX_MODEM_RESPONSE_ERROR = 7011
+Const ERROR_CTX_MODEM_RESPONSE_TIMEOUT = 7012
+Const ERROR_CTX_MODEM_RESPONSE_NO_CARRIER = 7013
+Const ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE = 7014
+Const ERROR_CTX_MODEM_RESPONSE_BUSY = 7015
+Const ERROR_CTX_MODEM_RESPONSE_VOICE = 7016
+Const ERROR_CTX_TD_ERROR = 7017
+Const ERROR_CTX_WINSTATION_NOT_FOUND = 7022
+Const ERROR_CTX_WINSTATION_ALREADY_EXISTS = 7023
+Const ERROR_CTX_WINSTATION_BUSY = 7024
+Const ERROR_CTX_BAD_VIDEO_MODE = 7025
+Const ERROR_CTX_GRAPHICS_INVALID = 7035
+Const ERROR_CTX_LOGON_DISABLED = 7037
+Const ERROR_CTX_NOT_CONSOLE = 7038
+Const ERROR_CTX_CLIENT_QUERY_TIMEOUT = 7040
+Const ERROR_CTX_CONSOLE_DISCONNECT = 7041
+Const ERROR_CTX_CONSOLE_CONNECT = 7042
+Const ERROR_CTX_SHADOW_DENIED = 7044
+Const ERROR_CTX_WINSTATION_ACCESS_DENIED = 7045
+Const ERROR_CTX_INVALID_WD = 7049
+Const ERROR_CTX_SHADOW_INVALID = 7050
+Const ERROR_CTX_SHADOW_DISABLED = 7051
+Const ERROR_CTX_CLIENT_LICENSE_IN_USE = 7052
+Const ERROR_CTX_CLIENT_LICENSE_NOT_SET = 7053
+Const ERROR_CTX_LICENSE_NOT_AVAILABLE = 7054
+Const ERROR_CTX_LICENSE_CLIENT_INVALID = 7055
+Const ERROR_CTX_LICENSE_EXPIRED = 7056
+Const ERROR_CTX_SHADOW_NOT_RUNNING = 7057
+Const ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE = 7058
+Const ERROR_ACTIVATION_COUNT_EXCEEDED = 7059
+Const FRS_ERR_INVALID_API_SEQUENCE = 8001
+Const FRS_ERR_STARTING_SERVICE = 8002
+Const FRS_ERR_STOPPING_SERVICE = 8003
+Const FRS_ERR_INTERNAL_API = 8004
+Const FRS_ERR_INTERNAL = 8005
+Const FRS_ERR_SERVICE_COMM = 8006
+Const FRS_ERR_INSUFFICIENT_PRIV = 8007
+Const FRS_ERR_AUTHENTICATION = 8008
+Const FRS_ERR_PARENT_INSUFFICIENT_PRIV = 8009
+Const FRS_ERR_PARENT_AUTHENTICATION = 8010
+Const FRS_ERR_CHILD_TO_PARENT_COMM = 8011
+Const FRS_ERR_PARENT_TO_CHILD_COMM = 8012
+Const FRS_ERR_SYSVOL_POPULATE = 8013
+Const FRS_ERR_SYSVOL_POPULATE_TIMEOUT = 8014
+Const FRS_ERR_SYSVOL_IS_BUSY = 8015
+Const FRS_ERR_SYSVOL_DEMOTE = 8016
+Const FRS_ERR_INVALID_SERVICE_PARAMETER = 8017
+Const DS_S_SUCCESS = NO_ERROR
+Const ERROR_DS_NOT_INSTALLED = 8200
+Const ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY = 8201
+Const ERROR_DS_NO_ATTRIBUTE_OR_VALUE = 8202
+Const ERROR_DS_INVALID_ATTRIBUTE_SYNTAX = 8203
+Const ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED = 8204
+Const ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS = 8205
+Const ERROR_DS_BUSY = 8206
+Const ERROR_DS_UNAVAILABLE = 8207
+Const ERROR_DS_NO_RIDS_ALLOCATED = 8208
+Const ERROR_DS_NO_MORE_RIDS = 8209
+Const ERROR_DS_INCORRECT_ROLE_OWNER = 8210
+Const ERROR_DS_RIDMGR_INIT_ERROR = 8211
+Const ERROR_DS_OBJ_CLASS_VIOLATION = 8212
+Const ERROR_DS_CANT_ON_NON_LEAF = 8213
+Const ERROR_DS_CANT_ON_RDN = 8214
+Const ERROR_DS_CANT_MOD_OBJ_CLASS = 8215
+Const ERROR_DS_CROSS_DOM_MOVE_ERROR = 8216
+Const ERROR_DS_GC_NOT_AVAILABLE = 8217
+Const ERROR_SHARED_POLICY = 8218
+Const ERROR_POLICY_OBJECT_NOT_FOUND = 8219
+Const ERROR_POLICY_ONLY_IN_DS = 8220
+Const ERROR_PROMOTION_ACTIVE = 8221
+Const ERROR_NO_PROMOTION_ACTIVE = 8222
+Const ERROR_DS_OPERATIONS_ERROR = 8224
+Const ERROR_DS_PROTOCOL_ERROR = 8225
+Const ERROR_DS_TIMELIMIT_EXCEEDED = 8226
+Const ERROR_DS_SIZELIMIT_EXCEEDED = 8227
+Const ERROR_DS_ADMIN_LIMIT_EXCEEDED = 8228
+Const ERROR_DS_COMPARE_FALSE = 8229
+Const ERROR_DS_COMPARE_TRUE = 8230
+Const ERROR_DS_AUTH_METHOD_NOT_SUPPORTED = 8231
+Const ERROR_DS_STRONG_AUTH_REQUIRED = 8232
+Const ERROR_DS_INAPPROPRIATE_AUTH = 8233
+Const ERROR_DS_AUTH_UNKNOWN = 8234
+Const ERROR_DS_REFERRAL = 8235
+Const ERROR_DS_UNAVAILABLE_CRIT_EXTENSION = 8236
+Const ERROR_DS_CONFIDENTIALITY_REQUIRED = 8237
+Const ERROR_DS_INAPPROPRIATE_MATCHING = 8238
+Const ERROR_DS_CONSTRAINT_VIOLATION = 8239
+Const ERROR_DS_NO_SUCH_OBJECT = 8240
+Const ERROR_DS_ALIAS_PROBLEM = 8241
+Const ERROR_DS_INVALID_DN_SYNTAX = 8242
+Const ERROR_DS_IS_LEAF = 8243
+Const ERROR_DS_ALIAS_DEREF_PROBLEM = 8244
+Const ERROR_DS_UNWILLING_TO_PERFORM = 8245
+Const ERROR_DS_LOOP_DETECT = 8246
+Const ERROR_DS_NAMING_VIOLATION = 8247
+Const ERROR_DS_OBJECT_RESULTS_TOO_LARGE = 8248
+Const ERROR_DS_AFFECTS_MULTIPLE_DSAS = 8249
+Const ERROR_DS_SERVER_DOWN = 8250
+Const ERROR_DS_LOCAL_ERROR = 8251
+Const ERROR_DS_ENCODING_ERROR = 8252
+Const ERROR_DS_DECODING_ERROR = 8253
+Const ERROR_DS_FILTER_UNKNOWN = 8254
+Const ERROR_DS_PARAM_ERROR = 8255
+Const ERROR_DS_NOT_SUPPORTED = 8256
+Const ERROR_DS_NO_RESULTS_RETURNED = 8257
+Const ERROR_DS_CONTROL_NOT_FOUND = 8258
+Const ERROR_DS_CLIENT_LOOP = 8259
+Const ERROR_DS_REFERRAL_LIMIT_EXCEEDED = 8260
+Const ERROR_DS_SORT_CONTROL_MISSING = 8261
+Const ERROR_DS_OFFSET_RANGE_ERROR = 8262
+Const ERROR_DS_ROOT_MUST_BE_NC = 8301
+Const ERROR_DS_ADD_REPLICA_INHIBITED = 8302
+Const ERROR_DS_ATT_NOT_DEF_IN_SCHEMA = 8303
+Const ERROR_DS_MAX_OBJ_SIZE_EXCEEDED = 8304
+Const ERROR_DS_OBJ_STRING_NAME_EXISTS = 8305
+Const ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA = 8306
+Const ERROR_DS_RDN_DOESNT_MATCH_SCHEMA = 8307
+Const ERROR_DS_NO_REQUESTED_ATTS_FOUND = 8308
+Const ERROR_DS_USER_BUFFER_TO_SMALL = 8309
+Const ERROR_DS_ATT_IS_NOT_ON_OBJ = 8310
+Const ERROR_DS_ILLEGAL_MOD_OPERATION = 8311
+Const ERROR_DS_OBJ_TOO_LARGE = 8312
+Const ERROR_DS_BAD_INSTANCE_TYPE = 8313
+Const ERROR_DS_MASTERDSA_REQUIRED = 8314
+Const ERROR_DS_OBJECT_CLASS_REQUIRED = 8315
+Const ERROR_DS_MISSING_REQUIRED_ATT = 8316
+Const ERROR_DS_ATT_NOT_DEF_FOR_CLASS = 8317
+Const ERROR_DS_ATT_ALREADY_EXISTS = 8318
+Const ERROR_DS_CANT_ADD_ATT_VALUES = 8320
+Const ERROR_DS_SINGLE_VALUE_CONSTRAINT = 8321
+Const ERROR_DS_RANGE_CONSTRAINT = 8322
+Const ERROR_DS_ATT_VAL_ALREADY_EXISTS = 8323
+Const ERROR_DS_CANT_REM_MISSING_ATT = 8324
+Const ERROR_DS_CANT_REM_MISSING_ATT_VAL = 8325
+Const ERROR_DS_ROOT_CANT_BE_SUBREF = 8326
+Const ERROR_DS_NO_CHAINING = 8327
+Const ERROR_DS_NO_CHAINED_EVAL = 8328
+Const ERROR_DS_NO_PARENT_OBJECT = 8329
+Const ERROR_DS_PARENT_IS_AN_ALIAS = 8330
+Const ERROR_DS_CANT_MIX_MASTER_AND_REPS = 8331
+Const ERROR_DS_CHILDREN_EXIST = 8332
+Const ERROR_DS_OBJ_NOT_FOUND = 8333
+Const ERROR_DS_ALIASED_OBJ_MISSING = 8334
+Const ERROR_DS_BAD_NAME_SYNTAX = 8335
+Const ERROR_DS_ALIAS_POINTS_TO_ALIAS = 8336
+Const ERROR_DS_CANT_DEREF_ALIAS = 8337
+Const ERROR_DS_OUT_OF_SCOPE = 8338
+Const ERROR_DS_OBJECT_BEING_REMOVED = 8339
+Const ERROR_DS_CANT_DELETE_DSA_OBJ = 8340
+Const ERROR_DS_GENERIC_ERROR = 8341
+Const ERROR_DS_DSA_MUST_BE_INT_MASTER = 8342
+Const ERROR_DS_CLASS_NOT_DSA = 8343
+Const ERROR_DS_INSUFF_ACCESS_RIGHTS = 8344
+Const ERROR_DS_ILLEGAL_SUPERIOR = 8345
+Const ERROR_DS_ATTRIBUTE_OWNED_BY_SAM = 8346
+Const ERROR_DS_NAME_TOO_MANY_PARTS = 8347
+Const ERROR_DS_NAME_TOO_LONG = 8348
+Const ERROR_DS_NAME_VALUE_TOO_LONG = 8349
+Const ERROR_DS_NAME_UNPARSEABLE = 8350
+Const ERROR_DS_NAME_TYPE_UNKNOWN = 8351
+Const ERROR_DS_NOT_AN_OBJECT = 8352
+Const ERROR_DS_SEC_DESC_TOO_SHORT = 8353
+Const ERROR_DS_SEC_DESC_INVALID = 8354
+Const ERROR_DS_NO_DELETED_NAME = 8355
+Const ERROR_DS_SUBREF_MUST_HAVE_PARENT = 8356
+Const ERROR_DS_NCNAME_MUST_BE_NC = 8357
+Const ERROR_DS_CANT_ADD_SYSTEM_ONLY = 8358
+Const ERROR_DS_CLASS_MUST_BE_CONCRETE = 8359
+Const ERROR_DS_INVALID_DMD = 8360
+Const ERROR_DS_OBJ_GUID_EXISTS = 8361
+Const ERROR_DS_NOT_ON_BACKLINK = 8362
+Const ERROR_DS_NO_CROSSREF_FOR_NC = 8363
+Const ERROR_DS_SHUTTING_DOWN = 8364
+Const ERROR_DS_UNKNOWN_OPERATION = 8365
+Const ERROR_DS_INVALID_ROLE_OWNER = 8366
+Const ERROR_DS_COULDNT_CONTACT_FSMO = 8367
+Const ERROR_DS_CROSS_NC_DN_RENAME = 8368
+Const ERROR_DS_CANT_MOD_SYSTEM_ONLY = 8369
+Const ERROR_DS_REPLICATOR_ONLY = 8370
+Const ERROR_DS_OBJ_CLASS_NOT_DEFINED = 8371
+Const ERROR_DS_OBJ_CLASS_NOT_SUBCLASS = 8372
+Const ERROR_DS_NAME_REFERENCE_INVALID = 8373
+Const ERROR_DS_CROSS_REF_EXISTS = 8374
+Const ERROR_DS_CANT_DEL_MASTER_CROSSREF = 8375
+Const ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD = 8376
+Const ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX = 8377
+Const ERROR_DS_DUP_RDN = 8378
+Const ERROR_DS_DUP_OID = 8379
+Const ERROR_DS_DUP_MAPI_ID = 8380
+Const ERROR_DS_DUP_SCHEMA_ID_GUID = 8381
+Const ERROR_DS_DUP_LDAP_DISPLAY_NAME = 8382
+Const ERROR_DS_SEMANTIC_ATT_TEST = 8383
+Const ERROR_DS_SYNTAX_MISMATCH = 8384
+Const ERROR_DS_EXISTS_IN_MUST_HAVE = 8385
+Const ERROR_DS_EXISTS_IN_MAY_HAVE = 8386
+Const ERROR_DS_NONEXISTENT_MAY_HAVE = 8387
+Const ERROR_DS_NONEXISTENT_MUST_HAVE = 8388
+Const ERROR_DS_AUX_CLS_TEST_FAIL = 8389
+Const ERROR_DS_NONEXISTENT_POSS_SUP = 8390
+Const ERROR_DS_SUB_CLS_TEST_FAIL = 8391
+Const ERROR_DS_BAD_RDN_ATT_ID_SYNTAX = 8392
+Const ERROR_DS_EXISTS_IN_AUX_CLS = 8393
+Const ERROR_DS_EXISTS_IN_SUB_CLS = 8394
+Const ERROR_DS_EXISTS_IN_POSS_SUP = 8395
+Const ERROR_DS_RECALCSCHEMA_FAILED = 8396
+Const ERROR_DS_TREE_DELETE_NOT_FINISHED = 8397
+Const ERROR_DS_CANT_DELETE = 8398
+Const ERROR_DS_ATT_SCHEMA_REQ_ID = 8399
+Const ERROR_DS_BAD_ATT_SCHEMA_SYNTAX = 8400
+Const ERROR_DS_CANT_CACHE_ATT = 8401
+Const ERROR_DS_CANT_CACHE_CLASS = 8402
+Const ERROR_DS_CANT_REMOVE_ATT_CACHE = 8403
+Const ERROR_DS_CANT_REMOVE_CLASS_CACHE = 8404
+Const ERROR_DS_CANT_RETRIEVE_DN = 8405
+Const ERROR_DS_MISSING_SUPREF = 8406
+Const ERROR_DS_CANT_RETRIEVE_INSTANCE = 8407
+Const ERROR_DS_CODE_INCONSISTENCY = 8408
+Const ERROR_DS_DATABASE_ERROR = 8409
+Const ERROR_DS_GOVERNSID_MISSING = 8410
+Const ERROR_DS_MISSING_EXPECTED_ATT = 8411
+Const ERROR_DS_NCNAME_MISSING_CR_REF = 8412
+Const ERROR_DS_SECURITY_CHECKING_ERROR = 8413
+Const ERROR_DS_SCHEMA_NOT_LOADED = 8414
+Const ERROR_DS_SCHEMA_ALLOC_FAILED = 8415
+Const ERROR_DS_ATT_SCHEMA_REQ_SYNTAX = 8416
+Const ERROR_DS_GCVERIFY_ERROR = 8417
+Const ERROR_DS_DRA_SCHEMA_MISMATCH = 8418
+Const ERROR_DS_CANT_FIND_DSA_OBJ = 8419
+Const ERROR_DS_CANT_FIND_EXPECTED_NC = 8420
+Const ERROR_DS_CANT_FIND_NC_IN_CACHE = 8421
+Const ERROR_DS_CANT_RETRIEVE_CHILD = 8422
+Const ERROR_DS_SECURITY_ILLEGAL_MODIFY = 8423
+Const ERROR_DS_CANT_REPLACE_HIDDEN_REC = 8424
+Const ERROR_DS_BAD_HIERARCHY_FILE = 8425
+Const ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED = 8426
+Const ERROR_DS_CONFIG_PARAM_MISSING = 8427
+Const ERROR_DS_COUNTING_AB_INDICES_FAILED = 8428
+Const ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED = 8429
+Const ERROR_DS_INTERNAL_FAILURE = 8430
+Const ERROR_DS_UNKNOWN_ERROR = 8431
+Const ERROR_DS_ROOT_REQUIRES_CLASS_TOP = 8432
+Const ERROR_DS_REFUSING_FSMO_ROLES = 8433
+Const ERROR_DS_MISSING_FSMO_SETTINGS = 8434
+Const ERROR_DS_UNABLE_TO_SURRENDER_ROLES = 8435
+Const ERROR_DS_DRA_GENERIC = 8436
+Const ERROR_DS_DRA_INVALID_PARAMETER = 8437
+Const ERROR_DS_DRA_BUSY = 8438
+Const ERROR_DS_DRA_BAD_DN = 8439
+Const ERROR_DS_DRA_BAD_NC = 8440
+Const ERROR_DS_DRA_DN_EXISTS = 8441
+Const ERROR_DS_DRA_INTERNAL_ERROR = 8442
+Const ERROR_DS_DRA_INCONSISTENT_DIT = 8443
+Const ERROR_DS_DRA_CONNECTION_FAILED = 8444
+Const ERROR_DS_DRA_BAD_INSTANCE_TYPE = 8445
+Const ERROR_DS_DRA_OUT_OF_MEM = 8446
+Const ERROR_DS_DRA_MAIL_PROBLEM = 8447
+Const ERROR_DS_DRA_REF_ALREADY_EXISTS = 8448
+Const ERROR_DS_DRA_REF_NOT_FOUND = 8449
+Const ERROR_DS_DRA_OBJ_IS_REP_SOURCE = 8450
+Const ERROR_DS_DRA_DB_ERROR = 8451
+Const ERROR_DS_DRA_NO_REPLICA = 8452
+Const ERROR_DS_DRA_ACCESS_DENIED = 8453
+Const ERROR_DS_DRA_NOT_SUPPORTED = 8454
+Const ERROR_DS_DRA_RPC_CANCELLED = 8455
+Const ERROR_DS_DRA_SOURCE_DISABLED = 8456
+Const ERROR_DS_DRA_SINK_DISABLED = 8457
+Const ERROR_DS_DRA_NAME_COLLISION = 8458
+Const ERROR_DS_DRA_SOURCE_REINSTALLED = 8459
+Const ERROR_DS_DRA_MISSING_PARENT = 8460
+Const ERROR_DS_DRA_PREEMPTED = 8461
+Const ERROR_DS_DRA_ABANDON_SYNC = 8462
+Const ERROR_DS_DRA_SHUTDOWN = 8463
+Const ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET = 8464
+Const ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA = 8465
+Const ERROR_DS_DRA_EXTN_CONNECTION_FAILED = 8466
+Const ERROR_DS_INSTALL_SCHEMA_MISMATCH = 8467
+Const ERROR_DS_DUP_LINK_ID = 8468
+Const ERROR_DS_NAME_ERROR_RESOLVING = 8469
+Const ERROR_DS_NAME_ERROR_NOT_FOUND = 8470
+Const ERROR_DS_NAME_ERROR_NOT_UNIQUE = 8471
+Const ERROR_DS_NAME_ERROR_NO_MAPPING = 8472
+Const ERROR_DS_NAME_ERROR_DOMAIN_ONLY = 8473
+Const ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 8474
+Const ERROR_DS_CONSTRUCTED_ATT_MOD = 8475
+Const ERROR_DS_WRONG_OM_OBJ_CLASS = 8476
+Const ERROR_DS_DRA_REPL_PENDING = 8477
+Const ERROR_DS_DS_REQUIRED = 8478
+Const ERROR_DS_INVALID_LDAP_DISPLAY_NAME = 8479
+Const ERROR_DS_NON_BASE_SEARCH = 8480
+Const ERROR_DS_CANT_RETRIEVE_ATTS = 8481
+Const ERROR_DS_BACKLINK_WITHOUT_LINK = 8482
+Const ERROR_DS_EPOCH_MISMATCH = 8483
+Const ERROR_DS_SRC_NAME_MISMATCH = 8484
+Const ERROR_DS_SRC_AND_DST_NC_IDENTICAL = 8485
+Const ERROR_DS_DST_NC_MISMATCH = 8486
+Const ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC = 8487
+Const ERROR_DS_SRC_GUID_MISMATCH = 8488
+Const ERROR_DS_CANT_MOVE_DELETED_OBJECT = 8489
+Const ERROR_DS_PDC_OPERATION_IN_PROGRESS = 8490
+Const ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD = 8491
+Const ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION = 8492
+Const ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS = 8493
+Const ERROR_DS_NC_MUST_HAVE_NC_PARENT = 8494
+Const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE = 8495
+Const ERROR_DS_DST_DOMAIN_NOT_NATIVE = 8496
+Const ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER = 8497
+Const ERROR_DS_CANT_MOVE_ACCOUNT_GROUP = 8498
+Const ERROR_DS_CANT_MOVE_RESOURCE_GROUP = 8499
+Const ERROR_DS_INVALID_SEARCH_FLAG = 8500
+Const ERROR_DS_NO_TREE_DELETE_ABOVE_NC = 8501
+Const ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE = 8502
+Const ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE = 8503
+Const ERROR_DS_SAM_INIT_FAILURE = 8504
+Const ERROR_DS_SENSITIVE_GROUP_VIOLATION = 8505
+Const ERROR_DS_CANT_MOD_PRIMARYGROUPID = 8506
+Const ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD = 8507
+Const ERROR_DS_NONSAFE_SCHEMA_CHANGE = 8508
+Const ERROR_DS_SCHEMA_UPDATE_DISALLOWED = 8509
+Const ERROR_DS_CANT_CREATE_UNDER_SCHEMA = 8510
+Const ERROR_DS_INSTALL_NO_SRC_SCH_VERSION = 8511
+Const ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE = 8512
+Const ERROR_DS_INVALID_GROUP_TYPE = 8513
+Const ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 8514
+Const ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 8515
+Const ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 8516
+Const ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 8517
+Const ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 8518
+Const ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 8519
+Const ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 8520
+Const ERROR_DS_HAVE_PRIMARY_MEMBERS = 8521
+Const ERROR_DS_STRING_SD_CONVERSION_FAILED = 8522
+Const ERROR_DS_NAMING_MASTER_GC = 8523
+Const ERROR_DS_DNS_LOOKUP_FAILURE = 8524
+Const ERROR_DS_COULDNT_UPDATE_SPNS = 8525
+Const ERROR_DS_CANT_RETRIEVE_SD = 8526
+Const ERROR_DS_KEY_NOT_UNIQUE = 8527
+Const ERROR_DS_WRONG_LINKED_ATT_SYNTAX = 8528
+Const ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD = 8529
+Const ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY = 8530
+Const ERROR_DS_CANT_START = 8531
+Const ERROR_DS_INIT_FAILURE = 8532
+Const ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION = 8533
+Const ERROR_DS_SOURCE_DOMAIN_IN_FOREST = 8534
+Const ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST = 8535
+Const ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED = 8536
+Const ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN = 8537
+Const ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER = 8538
+Const ERROR_DS_SRC_SID_EXISTS_IN_FOREST = 8539
+Const ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH = 8540
+Const ERROR_SAM_INIT_FAILURE = 8541
+Const ERROR_DS_DRA_SCHEMA_INFO_SHIP = 8542
+Const ERROR_DS_DRA_SCHEMA_CONFLICT = 8543
+Const ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT = 8544
+Const ERROR_DS_DRA_OBJ_NC_MISMATCH = 8545
+Const ERROR_DS_NC_STILL_HAS_DSAS = 8546
+Const ERROR_DS_GC_REQUIRED = 8547
+Const ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 8548
+Const ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS = 8549
+Const ERROR_DS_CANT_ADD_TO_GC = 8550
+Const ERROR_DS_NO_CHECKPOINT_WITH_PDC = 8551
+Const ERROR_DS_SOURCE_AUDITING_NOT_ENABLED = 8552
+Const ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC = 8553
+Const ERROR_DS_INVALID_NAME_FOR_SPN = 8554
+Const ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS = 8555
+Const ERROR_DS_UNICODEPWD_NOT_IN_QUOTES = 8556
+Const ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 8557
+Const ERROR_DS_MUST_BE_RUN_ON_DST_DC = 8558
+Const ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER = 8559
+Const ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ = 8560
+Const ERROR_DS_INIT_FAILURE_CONSOLE = 8561
+Const ERROR_DS_SAM_INIT_FAILURE_CONSOLE = 8562
+Const ERROR_DS_FOREST_VERSION_TOO_HIGH = 8563
+Const ERROR_DS_DOMAIN_VERSION_TOO_HIGH = 8564
+Const ERROR_DS_FOREST_VERSION_TOO_LOW = 8565
+Const ERROR_DS_DOMAIN_VERSION_TOO_LOW = 8566
+Const ERROR_DS_INCOMPATIBLE_VERSION = 8567
+Const ERROR_DS_LOW_DSA_VERSION = 8568
+Const ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN = 8569
+Const ERROR_DS_NOT_SUPPORTED_SORT_ORDER = 8570
+Const ERROR_DS_NAME_NOT_UNIQUE = 8571
+Const ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 = 8572
+Const ERROR_DS_OUT_OF_VERSION_STORE = 8573
+Const ERROR_DS_INCOMPATIBLE_CONTROLS_USED = 8574
+Const ERROR_DS_NO_REF_DOMAIN = 8575
+Const ERROR_DS_RESERVED_LINK_ID = 8576
+Const ERROR_DS_LINK_ID_NOT_AVAILABLE = 8577
+Const ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 8578
+Const ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE = 8579
+Const ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC = 8580
+Const ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG = 8581
+Const ERROR_DS_MODIFYDN_WRONG_GRANDPARENT = 8582
+Const ERROR_DS_NAME_ERROR_TRUST_REFERRAL = 8583
+Const ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER = 8584
+Const ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD = 8585
+Const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 = 8586
+Const ERROR_DS_THREAD_LIMIT_EXCEEDED = 8587
+Const ERROR_DS_NOT_CLOSEST = 8588
+Const ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF = 8589
+Const ERROR_DS_SINGLE_USER_MODE_FAILED = 8590
+Const ERROR_DS_NTDSCRIPT_SYNTAX_ERROR = 8591
+Const ERROR_DS_NTDSCRIPT_PROCESS_ERROR = 8592
+Const ERROR_DS_DIFFERENT_REPL_EPOCHS = 8593
+Const ERROR_DS_DRS_EXTENSIONS_CHANGED = 8594
+Const ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR = 8595
+Const ERROR_DS_NO_MSDS_INTID = 8596
+Const ERROR_DS_DUP_MSDS_INTID = 8597
+Const ERROR_DS_EXISTS_IN_RDNATTID = 8598
+Const ERROR_DS_AUTHORIZATION_FAILED = 8599
+Const ERROR_DS_INVALID_SCRIPT = 8600
+Const ERROR_DS_REMOTE_CROSSREF_OP_FAILED = 8601
+Const ERROR_DS_CROSS_REF_BUSY = 8602
+Const ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN = 8603
+Const ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC = 8604
+Const ERROR_DS_DUPLICATE_ID_FOUND = 8605
+Const ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT = 8606
+Const ERROR_DS_GROUP_CONVERSION_ERROR = 8607
+Const ERROR_DS_CANT_MOVE_APP_BASIC_GROUP = 8608
+Const ERROR_DS_CANT_MOVE_APP_QUERY_GROUP = 8609
+Const ERROR_DS_ROLE_NOT_VERIFIED = 8610
+Const ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL = 8611
+Const ERROR_DS_DOMAIN_RENAME_IN_PROGRESS = 8612
+Const ERROR_DS_EXISTING_AD_CHILD_NC = 8613
+Const ERROR_DS_REPL_LIFETIME_EXCEEDED = 8614
+Const ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER = 8615
+Const ERROR_DS_LDAP_SEND_QUEUE_FULL = 8616
+Const ERROR_DS_DRA_OUT_SCHEDULE_WINDOW = 8617
+Const DNS_ERROR_RESPONSE_CODES_BASE = 9000
+Const DNS_ERROR_RCODE_NO_ERROR = NO_ERROR
+Const DNS_ERROR_MASK = &h00002328
+Const DNS_ERROR_RCODE_FORMAT_ERROR = 9001
+Const DNS_ERROR_RCODE_SERVER_FAILURE = 9002
+Const DNS_ERROR_RCODE_NAME_ERROR = 9003
+Const DNS_ERROR_RCODE_NOT_IMPLEMENTED = 9004
+Const DNS_ERROR_RCODE_REFUSED = 9005
+Const DNS_ERROR_RCODE_YXDOMAIN = 9006
+Const DNS_ERROR_RCODE_YXRRSET = 9007
+Const DNS_ERROR_RCODE_NXRRSET = 9008
+Const DNS_ERROR_RCODE_NOTAUTH = 9009
+Const DNS_ERROR_RCODE_NOTZONE = 9010
+Const DNS_ERROR_RCODE_BADSIG = 9016
+Const DNS_ERROR_RCODE_BADKEY = 9017
+Const DNS_ERROR_RCODE_BADTIME = 9018
+Const DNS_ERROR_RCODE_LAST = DNS_ERROR_RCODE_BADTIME
+Const DNS_ERROR_PACKET_FMT_BASE = 9500
+Const DNS_INFO_NO_RECORDS = 9501
+Const DNS_ERROR_BAD_PACKET = 9502
+Const DNS_ERROR_NO_PACKET = 9503
+Const DNS_ERROR_RCODE = 9504
+Const DNS_ERROR_UNSECURE_PACKET = 9505
+Const DNS_STATUS_PACKET_UNSECURE = DNS_ERROR_UNSECURE_PACKET
+Const DNS_ERROR_NO_MEMORY = ERROR_OUTOFMEMORY
+Const DNS_ERROR_INVALID_NAME = ERROR_INVALID_NAME
+Const DNS_ERROR_INVALID_DATA = ERROR_INVALID_DATA
+Const DNS_ERROR_GENERAL_API_BASE = 9550
+Const DNS_ERROR_INVALID_TYPE = 9551
+Const DNS_ERROR_INVALID_IP_ADDRESS = 9552
+Const DNS_ERROR_INVALID_PROPERTY = 9553
+Const DNS_ERROR_TRY_AGAIN_LATER = 9554
+Const DNS_ERROR_NOT_UNIQUE = 9555
+Const DNS_ERROR_NON_RFC_NAME = 9556
+Const DNS_STATUS_FQDN = 9557
+Const DNS_STATUS_DOTTED_NAME = 9558
+Const DNS_STATUS_SINGLE_PART_NAME = 9559
+Const DNS_ERROR_INVALID_NAME_CHAR = 9560
+Const DNS_ERROR_NUMERIC_NAME = 9561
+Const DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER = 9562
+Const DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION = 9563
+Const DNS_ERROR_CANNOT_FIND_ROOT_HINTS = 9564
+Const DNS_ERROR_INCONSISTENT_ROOT_HINTS = 9565
+Const DNS_ERROR_ZONE_BASE = 9600
+Const DNS_ERROR_ZONE_DOES_NOT_EXIST = 9601
+Const DNS_ERROR_NO_ZONE_INFO = 9602
+Const DNS_ERROR_INVALID_ZONE_OPERATION = 9603
+Const DNS_ERROR_ZONE_CONFIGURATION_ERROR = 9604
+Const DNS_ERROR_ZONE_HAS_NO_SOA_RECORD = 9605
+Const DNS_ERROR_ZONE_HAS_NO_NS_RECORDS = 9606
+Const DNS_ERROR_ZONE_LOCKED = 9607
+Const DNS_ERROR_ZONE_CREATION_FAILED = 9608
+Const DNS_ERROR_ZONE_ALREADY_EXISTS = 9609
+Const DNS_ERROR_AUTOZONE_ALREADY_EXISTS = 9610
+Const DNS_ERROR_INVALID_ZONE_TYPE = 9611
+Const DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP = 9612
+Const DNS_ERROR_ZONE_NOT_SECONDARY = 9613
+Const DNS_ERROR_NEED_SECONDARY_ADDRESSES = 9614
+Const DNS_ERROR_WINS_INIT_FAILED = 9615
+Const DNS_ERROR_NEED_WINS_SERVERS = 9616
+Const DNS_ERROR_NBSTAT_INIT_FAILED = 9617
+Const DNS_ERROR_SOA_DELETE_INVALID = 9618
+Const DNS_ERROR_FORWARDER_ALREADY_EXISTS = 9619
+Const DNS_ERROR_ZONE_REQUIRES_MASTER_IP = 9620
+Const DNS_ERROR_ZONE_IS_SHUTDOWN = 9621
+Const DNS_ERROR_DATAFILE_BASE = 9650
+Const DNS_ERROR_PRIMARY_REQUIRES_DATAFILE = 9651
+Const DNS_ERROR_INVALID_DATAFILE_NAME = 9652
+Const DNS_ERROR_DATAFILE_OPEN_FAILURE = 9653
+Const DNS_ERROR_FILE_WRITEBACK_FAILED = 9654
+Const DNS_ERROR_DATAFILE_PARSING = 9655
+Const DNS_ERROR_DATABASE_BASE = 9700
+Const DNS_ERROR_RECORD_DOES_NOT_EXIST = 9701
+Const DNS_ERROR_RECORD_FORMAT = 9702
+Const DNS_ERROR_NODE_CREATION_FAILED = 9703
+Const DNS_ERROR_UNKNOWN_RECORD_TYPE = 9704
+Const DNS_ERROR_RECORD_TIMED_OUT = 9705
+Const DNS_ERROR_NAME_NOT_IN_ZONE = 9706
+Const DNS_ERROR_CNAME_LOOP = 9707
+Const DNS_ERROR_NODE_IS_CNAME = 9708
+Const DNS_ERROR_CNAME_COLLISION = 9709
+Const DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT = 9710
+Const DNS_ERROR_RECORD_ALREADY_EXISTS = 9711
+Const DNS_ERROR_SECONDARY_DATA = 9712
+Const DNS_ERROR_NO_CREATE_CACHE_DATA = 9713
+Const DNS_ERROR_NAME_DOES_NOT_EXIST = 9714
+Const DNS_WARNING_PTR_CREATE_FAILED = 9715
+Const DNS_WARNING_DOMAIN_UNDELETED = 9716
+Const DNS_ERROR_DS_UNAVAILABLE = 9717
+Const DNS_ERROR_DS_ZONE_ALREADY_EXISTS = 9718
+Const DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE = 9719
+Const DNS_ERROR_OPERATION_BASE = 9750
+Const DNS_INFO_AXFR_COMPLETE = 9751
+Const DNS_ERROR_AXFR = 9752
+Const DNS_INFO_ADDED_LOCAL_WINS = 9753
+Const DNS_ERROR_SECURE_BASE = 9800
+Const DNS_STATUS_CONTINUE_NEEDED = 9801
+Const DNS_ERROR_SETUP_BASE = 9850
+Const DNS_ERROR_NO_TCPIP = 9851
+Const DNS_ERROR_NO_DNS_SERVERS = 9852
+Const DNS_ERROR_DP_BASE = 9900
+Const DNS_ERROR_DP_DOES_NOT_EXIST = 9901
+Const DNS_ERROR_DP_ALREADY_EXISTS = 9902
+Const DNS_ERROR_DP_NOT_ENLISTED = 9903
+Const DNS_ERROR_DP_ALREADY_ENLISTED = 9904
+Const DNS_ERROR_DP_NOT_AVAILABLE = 9905
+Const DNS_ERROR_DP_FSMO_ERROR = 9906
+
+Const WSABASEERR = 10000
+Const WSAEINTR = 10004
+Const WSAEBADF = 10009
+Const WSAEACCES = 10013
+Const WSAEFAULT = 10014
+Const WSAEINVAL = 10022
+Const WSAEMFILE = 10024
+Const WSAEWOULDBLOCK = 10035
+Const WSAEINPROGRESS = 10036
+Const WSAEALREADY = 10037
+Const WSAENOTSOCK = 10038
+Const WSAEDESTADDRREQ = 10039
+Const WSAEMSGSIZE = 10040
+Const WSAEPROTOTYPE = 10041
+Const WSAENOPROTOOPT = 10042
+Const WSAEPROTONOSUPPORT = 10043
+Const WSAESOCKTNOSUPPORT = 10044
+Const WSAEOPNOTSUPP = 10045
+Const WSAEPFNOSUPPORT = 10046
+Const WSAEAFNOSUPPORT = 10047
+Const WSAEADDRINUSE = 10048
+Const WSAEADDRNOTAVAIL = 10049
+Const WSAENETDOWN = 10050
+Const WSAENETUNREACH = 10051
+Const WSAENETRESET = 10052
+Const WSAECONNABORTED = 10053
+Const WSAECONNRESET = 10054
+Const WSAENOBUFS = 10055
+Const WSAEISCONN = 10056
+Const WSAENOTCONN = 10057
+Const WSAESHUTDOWN = 10058
+Const WSAETOOMANYREFS = 10059
+Const WSAETIMEDOUT = 10060
+Const WSAECONNREFUSED = 10061
+Const WSAELOOP = 10062
+Const WSAENAMETOOLONG = 10063
+Const WSAEHOSTDOWN = 10064
+Const WSAEHOSTUNREACH = 10065
+Const WSAENOTEMPTY = 10066
+Const WSAEPROCLIM = 10067
+Const WSAEUSERS = 10068
+Const WSAEDQUOT = 10069
+Const WSAESTALE = 10070
+Const WSAEREMOTE = 10071
+Const WSASYSNOTREADY = 10091
+Const WSAVERNOTSUPPORTED = 10092
+Const WSANOTINITIALISED = 10093
+Const WSAEDISCON = 10101
+Const WSAENOMORE = 10102
+Const WSAECANCELLED = 10103
+Const WSAEINVALIDPROCTABLE = 10104
+Const WSAEINVALIDPROVIDER = 10105
+Const WSAEPROVIDERFAILEDINIT = 10106
+Const WSASYSCALLFAILURE = 10107
+Const WSASERVICE_NOT_FOUND = 10108
+Const WSATYPE_NOT_FOUND = 10109
+Const WSA_E_NO_MORE = 10110
+Const WSA_E_CANCELLED = 10111
+Const WSAEREFUSED = 10112
+Const WSAHOST_NOT_FOUND = 11001
+Const WSATRY_AGAIN = 11002
+Const WSANO_RECOVERY = 11003
+Const WSANO_DATA = 11004
+Const WSA_QOS_RECEIVERS = 11005
+Const WSA_QOS_SENDERS = 11006
+Const WSA_QOS_NO_SENDERS = 11007
+Const WSA_QOS_NO_RECEIVERS = 11008
+Const WSA_QOS_REQUEST_CONFIRMED = 11009
+Const WSA_QOS_ADMISSION_FAILURE = 11010
+Const WSA_QOS_POLICY_FAILURE = 11011
+Const WSA_QOS_BAD_STYLE = 11012
+Const WSA_QOS_BAD_OBJECT = 11013
+Const WSA_QOS_TRAFFIC_CTRL_ERROR = 11014
+Const WSA_QOS_GENERIC_ERROR = 11015
+Const WSA_QOS_ESERVICETYPE = 11016
+Const WSA_QOS_EFLOWSPEC = 11017
+Const WSA_QOS_EPROVSPECBUF = 11018
+Const WSA_QOS_EFILTERSTYLE = 11019
+Const WSA_QOS_EFILTERTYPE = 11020
+Const WSA_QOS_EFILTERCOUNT = 11021
+Const WSA_QOS_EOBJLENGTH = 11022
+Const WSA_QOS_EFLOWCOUNT = 11023
+Const WSA_QOS_EUNKOWNPSOBJ = 11024
+Const WSA_QOS_EPOLICYOBJ = 11025
+Const WSA_QOS_EFLOWDESC = 11026
+Const WSA_QOS_EPSFLOWSPEC = 11027
+Const WSA_QOS_EPSFILTERSPEC = 11028
+Const WSA_QOS_ESDMODEOBJ = 11029
+Const WSA_QOS_ESHAPERATEOBJ = 11030
+Const WSA_QOS_RESERVED_PETYPE = 11031
+
+Const ERROR_SXS_SECTION_NOT_FOUND = 14000
+Const ERROR_SXS_CANT_GEN_ACTCTX = 14001
+Const ERROR_SXS_INVALID_ACTCTXDATA_FORMAT = 14002
+Const ERROR_SXS_ASSEMBLY_NOT_FOUND = 14003
+Const ERROR_SXS_MANIFEST_FORMAT_ERROR = 14004
+Const ERROR_SXS_MANIFEST_PARSE_ERROR = 14005
+Const ERROR_SXS_ACTIVATION_CONTEXT_DISABLED = 14006
+Const ERROR_SXS_KEY_NOT_FOUND = 14007
+Const ERROR_SXS_VERSION_CONFLICT = 14008
+Const ERROR_SXS_WRONG_SECTION_TYPE = 14009
+Const ERROR_SXS_THREAD_QUERIES_DISABLED = 14010
+Const ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET = 14011
+Const ERROR_SXS_UNKNOWN_ENCODING_GROUP = 14012
+Const ERROR_SXS_UNKNOWN_ENCODING = 14013
+Const ERROR_SXS_INVALID_XML_NAMESPACE_URI = 14014
+Const ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14015
+Const ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14016
+Const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE = 14017
+Const ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE = 14018
+Const ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE = 14019
+Const ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT = 14020
+Const ERROR_SXS_DUPLICATE_DLL_NAME = 14021
+Const ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME = 14022
+Const ERROR_SXS_DUPLICATE_CLSID = 14023
+Const ERROR_SXS_DUPLICATE_IID = 14024
+Const ERROR_SXS_DUPLICATE_TLBID = 14025
+Const ERROR_SXS_DUPLICATE_PROGID = 14026
+Const ERROR_SXS_DUPLICATE_ASSEMBLY_NAME = 14027
+Const ERROR_SXS_FILE_HASH_MISMATCH = 14028
+Const ERROR_SXS_POLICY_PARSE_ERROR = 14029
+Const ERROR_SXS_XML_E_MISSINGQUOTE = 14030
+Const ERROR_SXS_XML_E_COMMENTSYNTAX = 14031
+Const ERROR_SXS_XML_E_BADSTARTNAMECHAR = 14032
+Const ERROR_SXS_XML_E_BADNAMECHAR = 14033
+Const ERROR_SXS_XML_E_BADCHARINSTRING = 14034
+Const ERROR_SXS_XML_E_XMLDECLSYNTAX = 14035
+Const ERROR_SXS_XML_E_BADCHARDATA = 14036
+Const ERROR_SXS_XML_E_MISSINGWHITESPACE = 14037
+Const ERROR_SXS_XML_E_EXPECTINGTAGEND = 14038
+Const ERROR_SXS_XML_E_MISSINGSEMICOLON = 14039
+Const ERROR_SXS_XML_E_UNBALANCEDPAREN = 14040
+Const ERROR_SXS_XML_E_INTERNALERROR = 14041
+Const ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE = 14042
+Const ERROR_SXS_XML_E_INCOMPLETE_ENCODING = 14043
+Const ERROR_SXS_XML_E_MISSING_PAREN = 14044
+Const ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE = 14045
+Const ERROR_SXS_XML_E_MULTIPLE_COLONS = 14046
+Const ERROR_SXS_XML_E_INVALID_DECIMAL = 14047
+Const ERROR_SXS_XML_E_INVALID_HEXIDECIMAL = 14048
+Const ERROR_SXS_XML_E_INVALID_UNICODE = 14049
+Const ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK = 14050
+Const ERROR_SXS_XML_E_UNEXPECTEDENDTAG = 14051
+Const ERROR_SXS_XML_E_UNCLOSEDTAG = 14052
+Const ERROR_SXS_XML_E_DUPLICATEATTRIBUTE = 14053
+Const ERROR_SXS_XML_E_MULTIPLEROOTS = 14054
+Const ERROR_SXS_XML_E_INVALIDATROOTLEVEL = 14055
+Const ERROR_SXS_XML_E_BADXMLDECL = 14056
+Const ERROR_SXS_XML_E_MISSINGROOT = 14057
+Const ERROR_SXS_XML_E_UNEXPECTEDEOF = 14058
+Const ERROR_SXS_XML_E_BADPEREFINSUBSET = 14059
+Const ERROR_SXS_XML_E_UNCLOSEDSTARTTAG = 14060
+Const ERROR_SXS_XML_E_UNCLOSEDENDTAG = 14061
+Const ERROR_SXS_XML_E_UNCLOSEDSTRING = 14062
+Const ERROR_SXS_XML_E_UNCLOSEDCOMMENT = 14063
+Const ERROR_SXS_XML_E_UNCLOSEDDECL = 14064
+Const ERROR_SXS_XML_E_UNCLOSEDCDATA = 14065
+Const ERROR_SXS_XML_E_RESERVEDNAMESPACE = 14066
+Const ERROR_SXS_XML_E_INVALIDENCODING = 14067
+Const ERROR_SXS_XML_E_INVALIDSWITCH = 14068
+Const ERROR_SXS_XML_E_BADXMLCASE = 14069
+Const ERROR_SXS_XML_E_INVALID_STANDALONE = 14070
+Const ERROR_SXS_XML_E_UNEXPECTED_STANDALONE = 14071
+Const ERROR_SXS_XML_E_INVALID_VERSION = 14072
+Const ERROR_SXS_XML_E_MISSINGEQUALS = 14073
+Const ERROR_SXS_PROTECTION_RECOVERY_FAILED = 14074
+Const ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT = 14075
+Const ERROR_SXS_PROTECTION_CATALOG_NOT_VALID = 14076
+Const ERROR_SXS_UNTRANSLATABLE_HRESULT = 14077
+Const ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING = 14078
+Const ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE = 14079
+Const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME = 14080
+Const ERROR_IPSEC_QM_POLICY_EXISTS = 13000
+Const ERROR_IPSEC_QM_POLICY_NOT_FOUND = 13001
+Const ERROR_IPSEC_QM_POLICY_IN_USE = 13002
+Const ERROR_IPSEC_MM_POLICY_EXISTS = 13003
+Const ERROR_IPSEC_MM_POLICY_NOT_FOUND = 13004
+Const ERROR_IPSEC_MM_POLICY_IN_USE = 13005
+Const ERROR_IPSEC_MM_FILTER_EXISTS = 13006
+Const ERROR_IPSEC_MM_FILTER_NOT_FOUND = 13007
+Const ERROR_IPSEC_TRANSPORT_FILTER_EXISTS = 13008
+Const ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND = 13009
+Const ERROR_IPSEC_MM_AUTH_EXISTS = 13010
+Const ERROR_IPSEC_MM_AUTH_NOT_FOUND = 13011
+Const ERROR_IPSEC_MM_AUTH_IN_USE = 13012
+Const ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND = 13013
+Const ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND = 13014
+Const ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND = 13015
+Const ERROR_IPSEC_TUNNEL_FILTER_EXISTS = 13016
+Const ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND = 13017
+Const ERROR_IPSEC_MM_FILTER_PENDING_DELETION = 13018
+Const ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION = 13019
+Const ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION = 13020
+Const ERROR_IPSEC_MM_POLICY_PENDING_DELETION = 13021
+Const ERROR_IPSEC_MM_AUTH_PENDING_DELETION = 13022
+Const ERROR_IPSEC_QM_POLICY_PENDING_DELETION = 13023
+Const WARNING_IPSEC_MM_POLICY_PRUNED = 13024
+Const WARNING_IPSEC_QM_POLICY_PRUNED = 13025
+Const ERROR_IPSEC_IKE_NEG_STATUS_BEGIN = 13800
+Const ERROR_IPSEC_IKE_AUTH_FAIL = 13801
+Const ERROR_IPSEC_IKE_ATTRIB_FAIL = 13802
+Const ERROR_IPSEC_IKE_NEGOTIATION_PENDING = 13803
+Const ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR = 13804
+Const ERROR_IPSEC_IKE_TIMED_OUT = 13805
+Const ERROR_IPSEC_IKE_NO_CERT = 13806
+Const ERROR_IPSEC_IKE_SA_DELETED = 13807
+Const ERROR_IPSEC_IKE_SA_REAPED = 13808
+Const ERROR_IPSEC_IKE_MM_ACQUIRE_DROP = 13809
+Const ERROR_IPSEC_IKE_QM_ACQUIRE_DROP = 13810
+Const ERROR_IPSEC_IKE_QUEUE_DROP_MM = 13811
+Const ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM = 13812
+Const ERROR_IPSEC_IKE_DROP_NO_RESPONSE = 13813
+Const ERROR_IPSEC_IKE_MM_DELAY_DROP = 13814
+Const ERROR_IPSEC_IKE_QM_DELAY_DROP = 13815
+Const ERROR_IPSEC_IKE_ERROR = 13816
+Const ERROR_IPSEC_IKE_CRL_FAILED = 13817
+Const ERROR_IPSEC_IKE_INVALID_KEY_USAGE = 13818
+Const ERROR_IPSEC_IKE_INVALID_CERT_TYPE = 13819
+Const ERROR_IPSEC_IKE_NO_PRIVATE_KEY = 13820
+Const ERROR_IPSEC_IKE_DH_FAIL = 13822
+Const ERROR_IPSEC_IKE_INVALID_HEADER = 13824
+Const ERROR_IPSEC_IKE_NO_POLICY = 13825
+Const ERROR_IPSEC_IKE_INVALID_SIGNATURE = 13826
+Const ERROR_IPSEC_IKE_KERBEROS_ERROR = 13827
+Const ERROR_IPSEC_IKE_NO_PUBLIC_KEY = 13828
+Const ERROR_IPSEC_IKE_PROCESS_ERR = 13829
+Const ERROR_IPSEC_IKE_PROCESS_ERR_SA = 13830
+Const ERROR_IPSEC_IKE_PROCESS_ERR_PROP = 13831
+Const ERROR_IPSEC_IKE_PROCESS_ERR_TRANS = 13832
+Const ERROR_IPSEC_IKE_PROCESS_ERR_KE = 13833
+Const ERROR_IPSEC_IKE_PROCESS_ERR_ID = 13834
+Const ERROR_IPSEC_IKE_PROCESS_ERR_CERT = 13835
+Const ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ = 13836
+Const ERROR_IPSEC_IKE_PROCESS_ERR_HASH = 13837
+Const ERROR_IPSEC_IKE_PROCESS_ERR_SIG = 13838
+Const ERROR_IPSEC_IKE_PROCESS_ERR_NONCE = 13839
+Const ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY = 13840
+Const ERROR_IPSEC_IKE_PROCESS_ERR_DELETE = 13841
+Const ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR = 13842
+Const ERROR_IPSEC_IKE_INVALID_PAYLOAD = 13843
+Const ERROR_IPSEC_IKE_LOAD_SOFT_SA = 13844
+Const ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN = 13845
+Const ERROR_IPSEC_IKE_INVALID_COOKIE = 13846
+Const ERROR_IPSEC_IKE_NO_PEER_CERT = 13847
+Const ERROR_IPSEC_IKE_PEER_CRL_FAILED = 13848
+Const ERROR_IPSEC_IKE_POLICY_CHANGE = 13849
+Const ERROR_IPSEC_IKE_NO_MM_POLICY = 13850
+Const ERROR_IPSEC_IKE_NOTCBPRIV = 13851
+Const ERROR_IPSEC_IKE_SECLOADFAIL = 13852
+Const ERROR_IPSEC_IKE_FAILSSPINIT = 13853
+Const ERROR_IPSEC_IKE_FAILQUERYSSP = 13854
+Const ERROR_IPSEC_IKE_SRVACQFAIL = 13855
+Const ERROR_IPSEC_IKE_SRVQUERYCRED = 13856
+Const ERROR_IPSEC_IKE_GETSPIFAIL = 13857
+Const ERROR_IPSEC_IKE_INVALID_FILTER = 13858
+Const ERROR_IPSEC_IKE_OUT_OF_MEMORY = 13859
+Const ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED = 13860
+Const ERROR_IPSEC_IKE_INVALID_POLICY = 13861
+Const ERROR_IPSEC_IKE_UNKNOWN_DOI = 13862
+Const ERROR_IPSEC_IKE_INVALID_SITUATION = 13863
+Const ERROR_IPSEC_IKE_DH_FAILURE = 13864
+Const ERROR_IPSEC_IKE_INVALID_GROUP = 13865
+Const ERROR_IPSEC_IKE_ENCRYPT = 13866
+Const ERROR_IPSEC_IKE_DECRYPT = 13867
+Const ERROR_IPSEC_IKE_POLICY_MATCH = 13868
+Const ERROR_IPSEC_IKE_UNSUPPORTED_ID = 13869
+Const ERROR_IPSEC_IKE_INVALID_HASH = 13870
+Const ERROR_IPSEC_IKE_INVALID_HASH_ALG = 13871
+Const ERROR_IPSEC_IKE_INVALID_HASH_SIZE = 13872
+Const ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG = 13873
+Const ERROR_IPSEC_IKE_INVALID_AUTH_ALG = 13874
+Const ERROR_IPSEC_IKE_INVALID_SIG = 13875
+Const ERROR_IPSEC_IKE_LOAD_FAILED = 13876
+Const ERROR_IPSEC_IKE_RPC_DELETE = 13877
+Const ERROR_IPSEC_IKE_BENIGN_REINIT = 13878
+Const ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY = 13879
+Const ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN = 13881
+Const ERROR_IPSEC_IKE_MM_LIMIT = 13882
+Const ERROR_IPSEC_IKE_NEGOTIATION_DISABLED = 13883
+Const ERROR_IPSEC_IKE_NEG_STATUS_END = 13884
+Const SEVERITY_SUCCESS = 0
+Const SEVERITY_ERROR = 1
+Const SUCCEEDED(hr) = ((hr) As HRESULT >= 0)
+Const FAILED(hr) = ((hr) As HRESULT < 0)
+Const IS_ERROR(Status) = ((Status) As DWord >> 31 = SEVERITY_ERROR)
+Const HRESULT_CODE(hr) = ((hr) And &hFFFF)
+Const SCODE_CODE(sc) = ((sc) And &hFFFF)
+Const HRESULT_FACILITY(hr) = (((hr) >> 16) And &h1fff)
+Const SCODE_FACILITY(sc) = (((sc) >> 16) And &h1fff)
+Const HRESULT_SEVERITY(hr) = (((hr) >> 31) And &h1)
+Const SCODE_SEVERITY(sc) = (((sc) >> 31) And &h1)
+Const MAKE_HRESULT(sev,fac,code) = ((((sev) As DWord << 31) Or ((fac) As DWord << 16) Or ((code) As DWord)) As HRESULT)
+Const MAKE_SCODE(sev,fac,code) = ((((sev) As DWord << 31) Or ((fac) As DWord << 16) Or ((code) As DWord)) As SCODE)
+Const FACILITY_NT_BIT = &h10000000
+Function HRESULT_FROM_WIN32(x As Long) As HRESULT
+	If x <= 0 Then
+		HRESULT_FROM_WIN32 = x As HRESULT
+	Else
+		HRESULT_FROM_WIN32 = (x And &h0000FFFF) Or (FACILITY_WIN32 << 16) Or &h80000000
+	End If
+End Function
+Const HRESULT_FROM_NT(x) = (((x) Or FACILITY_NT_BIT) As HRESULT)
+Const GetScode(hr) = ((hr) As SCODE)
+Const ResultFromScode(sc) = ((sc) As HRESULT)
+Const PropagateResult(hrPrevious, scBase) = ((scBase) As HRESULT)
+Const _HRESULT_TYPEDEF_(_sc) = ((_sc) As HRESULT)
+Const NOERROR = 0
+Const E_UNEXPECTED = _HRESULT_TYPEDEF_(&h8000FFFF)
+Const E_NOTIMPL = _HRESULT_TYPEDEF_(&h80004001)
+Const E_OUTOFMEMORY = _HRESULT_TYPEDEF_(&h8007000E)
+Const E_INVALIDARG = _HRESULT_TYPEDEF_(&h80070057)
+Const E_NOINTERFACE = _HRESULT_TYPEDEF_(&h80004002)
+Const E_POINTER = _HRESULT_TYPEDEF_(&h80004003)
+Const E_HANDLE = _HRESULT_TYPEDEF_(&h80070006)
+Const E_ABORT = _HRESULT_TYPEDEF_(&h80004004)
+Const E_FAIL = _HRESULT_TYPEDEF_(&h80004005)
+Const E_ACCESSDENIED = _HRESULT_TYPEDEF_(&h80070005)
+Const E_PENDING = _HRESULT_TYPEDEF_(&h8000000A)
+Const CO_E_INIT_TLS = _HRESULT_TYPEDEF_(&h80004006)
+Const CO_E_INIT_SHARED_ALLOCATOR = _HRESULT_TYPEDEF_(&h80004007)
+Const CO_E_INIT_MEMORY_ALLOCATOR = _HRESULT_TYPEDEF_(&h80004008)
+Const CO_E_INIT_CLASS_CACHE = _HRESULT_TYPEDEF_(&h80004009)
+Const CO_E_INIT_RPC_CHANNEL = _HRESULT_TYPEDEF_(&h8000400A)
+Const CO_E_INIT_TLS_SET_CHANNEL_CONTROL = _HRESULT_TYPEDEF_(&h8000400B)
+Const CO_E_INIT_TLS_CHANNEL_CONTROL = _HRESULT_TYPEDEF_(&h8000400C)
+Const CO_E_INIT_UNACCEPTED_USER_ALLOCATOR = _HRESULT_TYPEDEF_(&h8000400D)
+Const CO_E_INIT_SCM_MUTEX_EXISTS = _HRESULT_TYPEDEF_(&h8000400E)
+Const CO_E_INIT_SCM_FILE_MAPPING_EXISTS = _HRESULT_TYPEDEF_(&h8000400F)
+Const CO_E_INIT_SCM_MAP_VIEW_OF_FILE = _HRESULT_TYPEDEF_(&h80004010)
+Const CO_E_INIT_SCM_EXEC_FAILURE = _HRESULT_TYPEDEF_(&h80004011)
+Const CO_E_INIT_ONLY_SINGLE_THREADED = _HRESULT_TYPEDEF_(&h80004012)
+Const CO_E_CANT_REMOTE = _HRESULT_TYPEDEF_(&h80004013)
+Const CO_E_BAD_SERVER_NAME = _HRESULT_TYPEDEF_(&h80004014)
+Const CO_E_WRONG_SERVER_IDENTITY = _HRESULT_TYPEDEF_(&h80004015)
+Const CO_E_OLE1DDE_DISABLED = _HRESULT_TYPEDEF_(&h80004016)
+Const CO_E_RUNAS_SYNTAX = _HRESULT_TYPEDEF_(&h80004017)
+Const CO_E_CREATEPROCESS_FAILURE = _HRESULT_TYPEDEF_(&h80004018)
+Const CO_E_RUNAS_CREATEPROCESS_FAILURE = _HRESULT_TYPEDEF_(&h80004019)
+Const CO_E_RUNAS_LOGON_FAILURE = _HRESULT_TYPEDEF_(&h8000401A)
+Const CO_E_LAUNCH_PERMSSION_DENIED = _HRESULT_TYPEDEF_(&h8000401B)
+Const CO_E_START_SERVICE_FAILURE = _HRESULT_TYPEDEF_(&h8000401C)
+Const CO_E_REMOTE_COMMUNICATION_FAILURE = _HRESULT_TYPEDEF_(&h8000401D)
+Const CO_E_SERVER_START_TIMEOUT = _HRESULT_TYPEDEF_(&h8000401E)
+Const CO_E_CLSREG_INCONSISTENT = _HRESULT_TYPEDEF_(&h8000401F)
+Const CO_E_IIDREG_INCONSISTENT = _HRESULT_TYPEDEF_(&h80004020)
+Const CO_E_NOT_SUPPORTED = _HRESULT_TYPEDEF_(&h80004021)
+Const CO_E_RELOAD_DLL = _HRESULT_TYPEDEF_(&h80004022)
+Const CO_E_MSI_ERROR = _HRESULT_TYPEDEF_(&h80004023)
+Const CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT = _HRESULT_TYPEDEF_(&h80004024)
+Const CO_E_SERVER_PAUSED = _HRESULT_TYPEDEF_(&h80004025)
+Const CO_E_SERVER_NOT_PAUSED = _HRESULT_TYPEDEF_(&h80004026)
+Const CO_E_CLASS_DISABLED = _HRESULT_TYPEDEF_(&h80004027)
+Const CO_E_CLRNOTAVAILABLE = _HRESULT_TYPEDEF_(&h80004028)
+Const CO_E_ASYNC_WORK_REJECTED = _HRESULT_TYPEDEF_(&h80004029)
+Const CO_E_SERVER_INIT_TIMEOUT = _HRESULT_TYPEDEF_(&h8000402A)
+Const CO_E_NO_SECCTX_IN_ACTIVATE = _HRESULT_TYPEDEF_(&h8000402B)
+Const CO_E_TRACKER_CONFIG = _HRESULT_TYPEDEF_(&h80004030)
+Const CO_E_THREADPOOL_CONFIG = _HRESULT_TYPEDEF_(&h80004031)
+Const CO_E_SXS_CONFIG = _HRESULT_TYPEDEF_(&h80004032)
+Const CO_E_MALFORMED_SPN = _HRESULT_TYPEDEF_(&h80004033)
+Const S_OK = (&h00000000 As HRESULT)
+Const S_FALSE = (&h00000001 As HRESULT)
+Const OLE_E_FIRST = (&h80040000 As HRESULT)
+Const OLE_E_LAST = (&h800400FF As HRESULT)
+Const OLE_S_FIRST = (&h00040000 As HRESULT)
+Const OLE_S_LAST = (&h000400FF As HRESULT)
+Const OLE_E_OLEVERB = _HRESULT_TYPEDEF_(&h80040000)
+Const OLE_E_ADVF = _HRESULT_TYPEDEF_(&h80040001)
+Const OLE_E_ENUM_NOMORE = _HRESULT_TYPEDEF_(&h80040002)
+Const OLE_E_ADVISENOTSUPPORTED = _HRESULT_TYPEDEF_(&h80040003)
+Const OLE_E_NOCONNECTION = _HRESULT_TYPEDEF_(&h80040004)
+Const OLE_E_NOTRUNNING = _HRESULT_TYPEDEF_(&h80040005)
+Const OLE_E_NOCACHE = _HRESULT_TYPEDEF_(&h80040006)
+Const OLE_E_BLANK = _HRESULT_TYPEDEF_(&h80040007)
+Const OLE_E_CLASSDIFF = _HRESULT_TYPEDEF_(&h80040008)
+Const OLE_E_CANT_GETMONIKER = _HRESULT_TYPEDEF_(&h80040009)
+Const OLE_E_CANT_BINDTOSOURCE = _HRESULT_TYPEDEF_(&h8004000A)
+Const OLE_E_STATIC = _HRESULT_TYPEDEF_(&h8004000B)
+Const OLE_E_PROMPTSAVECANCELLED = _HRESULT_TYPEDEF_(&h8004000C)
+Const OLE_E_INVALIDRECT = _HRESULT_TYPEDEF_(&h8004000D)
+Const OLE_E_WRONGCOMPOBJ = _HRESULT_TYPEDEF_(&h8004000E)
+Const OLE_E_INVALIDHWND = _HRESULT_TYPEDEF_(&h8004000F)
+Const OLE_E_NOT_INPLACEACTIVE = _HRESULT_TYPEDEF_(&h80040010)
+Const OLE_E_CANTCONVERT = _HRESULT_TYPEDEF_(&h80040011)
+Const OLE_E_NOSTORAGE = _HRESULT_TYPEDEF_(&h80040012)
+Const DV_E_FORMATETC = _HRESULT_TYPEDEF_(&h80040064)
+Const DV_E_DVTARGETDEVICE = _HRESULT_TYPEDEF_(&h80040065)
+Const DV_E_STGMEDIUM = _HRESULT_TYPEDEF_(&h80040066)
+Const DV_E_STATDATA = _HRESULT_TYPEDEF_(&h80040067)
+Const DV_E_LINDEX = _HRESULT_TYPEDEF_(&h80040068)
+Const DV_E_TYMED = _HRESULT_TYPEDEF_(&h80040069)
+Const DV_E_CLIPFORMAT = _HRESULT_TYPEDEF_(&h8004006A)
+Const DV_E_DVASPECT = _HRESULT_TYPEDEF_(&h8004006B)
+Const DV_E_DVTARGETDEVICE_SIZE = _HRESULT_TYPEDEF_(&h8004006C)
+Const DV_E_NOIVIEWOBJECT = _HRESULT_TYPEDEF_(&h8004006D)
+Const DRAGDROP_E_FIRST = &h80040100
+Const DRAGDROP_E_LAST = &h8004010F
+Const DRAGDROP_S_FIRST = &h00040100
+Const DRAGDROP_S_LAST = &h0004010F
+Const DRAGDROP_E_NOTREGISTERED = _HRESULT_TYPEDEF_(&h80040100)
+Const DRAGDROP_E_ALREADYREGISTERED = _HRESULT_TYPEDEF_(&h80040101)
+Const DRAGDROP_E_INVALIDHWND = _HRESULT_TYPEDEF_(&h80040102)
+Const CLASSFACTORY_E_FIRST = &h80040110
+Const CLASSFACTORY_E_LAST = &h8004011F
+Const CLASSFACTORY_S_FIRST = &h00040110
+Const CLASSFACTORY_S_LAST = &h0004011F
+Const CLASS_E_NOAGGREGATION = _HRESULT_TYPEDEF_(&h80040110)
+Const CLASS_E_CLASSNOTAVAILABLE = _HRESULT_TYPEDEF_(&h80040111)
+Const CLASS_E_NOTLICENSED = _HRESULT_TYPEDEF_(&h80040112)
+Const MARSHAL_E_FIRST = &h80040120
+Const MARSHAL_E_LAST = &h8004012F
+Const MARSHAL_S_FIRST = &h00040120
+Const MARSHAL_S_LAST = &h0004012F
+Const DATA_E_FIRST = &h80040130
+Const DATA_E_LAST = &h8004013F
+Const DATA_S_FIRST = &h00040130
+Const DATA_S_LAST = &h0004013F
+Const VIEW_E_FIRST = &h80040140
+Const VIEW_E_LAST = &h8004014F
+Const VIEW_S_FIRST = &h00040140
+Const VIEW_S_LAST = &h0004014F
+Const VIEW_E_DRAW = _HRESULT_TYPEDEF_(&h80040140)
+Const REGDB_E_FIRST = &h80040150
+Const REGDB_E_LAST = &h8004015F
+Const REGDB_S_FIRST = &h00040150
+Const REGDB_S_LAST = &h0004015F
+Const REGDB_E_READREGDB = _HRESULT_TYPEDEF_(&h80040150)
+Const REGDB_E_WRITEREGDB = _HRESULT_TYPEDEF_(&h80040151)
+Const REGDB_E_KEYMISSING = _HRESULT_TYPEDEF_(&h80040152)
+Const REGDB_E_INVALIDVALUE = _HRESULT_TYPEDEF_(&h80040153)
+Const REGDB_E_CLASSNOTREG = _HRESULT_TYPEDEF_(&h80040154)
+Const REGDB_E_IIDNOTREG = _HRESULT_TYPEDEF_(&h80040155)
+Const REGDB_E_BADTHREADINGMODEL = _HRESULT_TYPEDEF_(&h80040156)
+Const CAT_E_FIRST = &h80040160
+Const CAT_E_LAST = &h80040161
+Const CAT_E_CATIDNOEXIST = _HRESULT_TYPEDEF_(&h80040160)
+Const CAT_E_NODESCRIPTION = _HRESULT_TYPEDEF_(&h80040161)
+Const CS_E_FIRST = &h80040164
+Const CS_E_LAST = &h8004016F
+Const CS_E_PACKAGE_NOTFOUND = _HRESULT_TYPEDEF_(&h80040164)
+Const CS_E_NOT_DELETABLE = _HRESULT_TYPEDEF_(&h80040165)
+Const CS_E_CLASS_NOTFOUND = _HRESULT_TYPEDEF_(&h80040166)
+Const CS_E_INVALID_VERSION = _HRESULT_TYPEDEF_(&h80040167)
+Const CS_E_NO_CLASSSTORE = _HRESULT_TYPEDEF_(&h80040168)
+Const CS_E_OBJECT_NOTFOUND = _HRESULT_TYPEDEF_(&h80040169)
+Const CS_E_OBJECT_ALREADY_EXISTS = _HRESULT_TYPEDEF_(&h8004016A)
+Const CS_E_INVALID_PATH = _HRESULT_TYPEDEF_(&h8004016B)
+Const CS_E_NETWORK_ERROR = _HRESULT_TYPEDEF_(&h8004016C)
+Const CS_E_ADMIN_LIMIT_EXCEEDED = _HRESULT_TYPEDEF_(&h8004016D)
+Const CS_E_SCHEMA_MISMATCH = _HRESULT_TYPEDEF_(&h8004016E)
+Const CS_E_INTERNAL_ERROR = _HRESULT_TYPEDEF_(&h8004016F)
+Const CACHE_E_FIRST = &h80040170
+Const CACHE_E_LAST = &h8004017F
+Const CACHE_S_FIRST = &h00040170
+Const CACHE_S_LAST = &h0004017F
+Const CACHE_E_NOCACHE_UPDATED = _HRESULT_TYPEDEF_(&h80040170)
+Const OLEOBJ_E_FIRST = &h80040180
+Const OLEOBJ_E_LAST = &h8004018F
+Const OLEOBJ_S_FIRST = &h00040180
+Const OLEOBJ_S_LAST = &h0004018F
+Const OLEOBJ_E_NOVERBS = _HRESULT_TYPEDEF_(&h80040180)
+Const OLEOBJ_E_INVALIDVERB = _HRESULT_TYPEDEF_(&h80040181)
+Const CLIENTSITE_E_FIRST = &h80040190
+Const CLIENTSITE_E_LAST = &h8004019F
+Const CLIENTSITE_S_FIRST = &h00040190
+Const CLIENTSITE_S_LAST = &h0004019F
+Const INPLACE_E_NOTUNDOABLE = _HRESULT_TYPEDEF_(&h800401A0)
+Const INPLACE_E_NOTOOLSPACE = _HRESULT_TYPEDEF_(&h800401A1)
+Const INPLACE_E_FIRST = &h800401A0
+Const INPLACE_E_LAST = &h800401AF
+Const INPLACE_S_FIRST = &h000401A0
+Const INPLACE_S_LAST = &h000401AF
+Const ENUM_E_FIRST = &h800401B0
+Const ENUM_E_LAST = &h800401BF
+Const ENUM_S_FIRST = &h000401B0
+Const ENUM_S_LAST = &h000401BF
+Const CONVERT10_E_FIRST = &h800401C0
+Const CONVERT10_E_LAST = &h800401CF
+Const CONVERT10_S_FIRST = &h000401C0
+Const CONVERT10_S_LAST = &h000401CF
+Const CONVERT10_E_OLESTREAM_GET = _HRESULT_TYPEDEF_(&h800401C0)
+Const CONVERT10_E_OLESTREAM_PUT = _HRESULT_TYPEDEF_(&h800401C1)
+Const CONVERT10_E_OLESTREAM_FMT = _HRESULT_TYPEDEF_(&h800401C2)
+Const CONVERT10_E_OLESTREAM_BITMAP_TO_DIB = _HRESULT_TYPEDEF_(&h800401C3)
+Const CONVERT10_E_STG_FMT = _HRESULT_TYPEDEF_(&h800401C4)
+Const CONVERT10_E_STG_NO_STD_STREAM = _HRESULT_TYPEDEF_(&h800401C5)
+Const CONVERT10_E_STG_DIB_TO_BITMAP = _HRESULT_TYPEDEF_(&h800401C6)
+Const CLIPBRD_E_FIRST = &h800401D0
+Const CLIPBRD_E_LAST = &h800401DF
+Const CLIPBRD_S_FIRST = &h000401D0
+Const CLIPBRD_S_LAST = &h000401DF
+Const CLIPBRD_E_CANT_OPEN = _HRESULT_TYPEDEF_(&h800401D0)
+Const CLIPBRD_E_CANT_EMPTY = _HRESULT_TYPEDEF_(&h800401D1)
+Const CLIPBRD_E_CANT_SET = _HRESULT_TYPEDEF_(&h800401D2)
+Const CLIPBRD_E_BAD_DATA = _HRESULT_TYPEDEF_(&h800401D3)
+Const CLIPBRD_E_CANT_CLOSE = _HRESULT_TYPEDEF_(&h800401D4)
+Const MK_E_FIRST = &h800401E0
+Const MK_E_LAST = &h800401EF
+Const MK_S_FIRST = &h000401E0
+Const MK_S_LAST = &h000401EF
+Const MK_E_CONNECTMANUALLY = _HRESULT_TYPEDEF_(&h800401E0)
+Const MK_E_EXCEEDEDDEADLINE = _HRESULT_TYPEDEF_(&h800401E1)
+Const MK_E_NEEDGENERIC = _HRESULT_TYPEDEF_(&h800401E2)
+Const MK_E_UNAVAILABLE = _HRESULT_TYPEDEF_(&h800401E3)
+Const MK_E_SYNTAX = _HRESULT_TYPEDEF_(&h800401E4)
+Const MK_E_NOOBJECT = _HRESULT_TYPEDEF_(&h800401E5)
+Const MK_E_INVALIDEXTENSION = _HRESULT_TYPEDEF_(&h800401E6)
+Const MK_E_INTERMEDIATEINTERFACENOTSUPPORTED = _HRESULT_TYPEDEF_(&h800401E7)
+Const MK_E_NOTBINDABLE = _HRESULT_TYPEDEF_(&h800401E8)
+Const MK_E_NOTBOUND = _HRESULT_TYPEDEF_(&h800401E9)
+Const MK_E_CANTOPENFILE = _HRESULT_TYPEDEF_(&h800401EA)
+Const MK_E_MUSTBOTHERUSER = _HRESULT_TYPEDEF_(&h800401EB)
+Const MK_E_NOINVERSE = _HRESULT_TYPEDEF_(&h800401EC)
+Const MK_E_NOSTORAGE = _HRESULT_TYPEDEF_(&h800401ED)
+Const MK_E_NOPREFIX = _HRESULT_TYPEDEF_(&h800401EE)
+Const MK_E_ENUMERATION_FAILED = _HRESULT_TYPEDEF_(&h800401EF)
+Const CO_E_FIRST = &h800401F0
+Const CO_E_LAST = &h800401FF
+Const CO_S_FIRST = &h000401F0
+Const CO_S_LAST = &h000401FF
+Const CO_E_NOTINITIALIZED = _HRESULT_TYPEDEF_(&h800401F0)
+Const CO_E_ALREADYINITIALIZED = _HRESULT_TYPEDEF_(&h800401F1)
+Const CO_E_CANTDETERMINECLASS = _HRESULT_TYPEDEF_(&h800401F2)
+Const CO_E_CLASSSTRING = _HRESULT_TYPEDEF_(&h800401F3)
+Const CO_E_IIDSTRING = _HRESULT_TYPEDEF_(&h800401F4)
+Const CO_E_APPNOTFOUND = _HRESULT_TYPEDEF_(&h800401F5)
+Const CO_E_APPSINGLEUSE = _HRESULT_TYPEDEF_(&h800401F6)
+Const CO_E_ERRORINAPP = _HRESULT_TYPEDEF_(&h800401F7)
+Const CO_E_DLLNOTFOUND = _HRESULT_TYPEDEF_(&h800401F8)
+Const CO_E_ERRORINDLL = _HRESULT_TYPEDEF_(&h800401F9)
+Const CO_E_WRONGOSFORAPP = _HRESULT_TYPEDEF_(&h800401FA)
+Const CO_E_OBJNOTREG = _HRESULT_TYPEDEF_(&h800401FB)
+Const CO_E_OBJISREG = _HRESULT_TYPEDEF_(&h800401FC)
+Const CO_E_OBJNOTCONNECTED = _HRESULT_TYPEDEF_(&h800401FD)
+Const CO_E_APPDIDNTREG = _HRESULT_TYPEDEF_(&h800401FE)
+Const CO_E_RELEASED = _HRESULT_TYPEDEF_(&h800401FF)
+Const EVENT_E_FIRST = &h80040200
+Const EVENT_E_LAST = &h8004021F
+Const EVENT_S_FIRST = &h00040200
+Const EVENT_S_LAST = &h0004021F
+Const EVENT_S_SOME_SUBSCRIBERS_FAILED = _HRESULT_TYPEDEF_(&h00040200)
+Const EVENT_E_ALL_SUBSCRIBERS_FAILED = _HRESULT_TYPEDEF_(&h80040201)
+Const EVENT_S_NOSUBSCRIBERS = _HRESULT_TYPEDEF_(&h00040202)
+Const EVENT_E_QUERYSYNTAX = _HRESULT_TYPEDEF_(&h80040203)
+Const EVENT_E_QUERYFIELD = _HRESULT_TYPEDEF_(&h80040204)
+Const EVENT_E_INTERNALEXCEPTION = _HRESULT_TYPEDEF_(&h80040205)
+Const EVENT_E_INTERNALERROR = _HRESULT_TYPEDEF_(&h80040206)
+Const EVENT_E_INVALID_PER_USER_SID = _HRESULT_TYPEDEF_(&h80040207)
+Const EVENT_E_USER_EXCEPTION = _HRESULT_TYPEDEF_(&h80040208)
+Const EVENT_E_TOO_MANY_METHODS = _HRESULT_TYPEDEF_(&h80040209)
+Const EVENT_E_MISSING_EVENTCLASS = _HRESULT_TYPEDEF_(&h8004020A)
+Const EVENT_E_NOT_ALL_REMOVED = _HRESULT_TYPEDEF_(&h8004020B)
+Const EVENT_E_COMPLUS_NOT_INSTALLED = _HRESULT_TYPEDEF_(&h8004020C)
+Const EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT = _HRESULT_TYPEDEF_(&h8004020D)
+Const EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT = _HRESULT_TYPEDEF_(&h8004020E)
+Const EVENT_E_INVALID_EVENT_CLASS_PARTITION = _HRESULT_TYPEDEF_(&h8004020F)
+Const EVENT_E_PER_USER_SID_NOT_LOGGED_ON = _HRESULT_TYPEDEF_(&h80040210)
+Const XACT_E_FIRST = &h8004D000
+Const XACT_E_LAST = &h8004D029
+Const XACT_S_FIRST = &h0004D000
+Const XACT_S_LAST = &h0004D010
+Const XACT_E_ALREADYOTHERSINGLEPHASE = _HRESULT_TYPEDEF_(&h8004D000)
+Const XACT_E_CANTRETAIN = _HRESULT_TYPEDEF_(&h8004D001)
+Const XACT_E_COMMITFAILED = _HRESULT_TYPEDEF_(&h8004D002)
+Const XACT_E_COMMITPREVENTED = _HRESULT_TYPEDEF_(&h8004D003)
+Const XACT_E_HEURISTICABORT = _HRESULT_TYPEDEF_(&h8004D004)
+Const XACT_E_HEURISTICCOMMIT = _HRESULT_TYPEDEF_(&h8004D005)
+Const XACT_E_HEURISTICDAMAGE = _HRESULT_TYPEDEF_(&h8004D006)
+Const XACT_E_HEURISTICDANGER = _HRESULT_TYPEDEF_(&h8004D007)
+Const XACT_E_ISOLATIONLEVEL = _HRESULT_TYPEDEF_(&h8004D008)
+Const XACT_E_NOASYNC = _HRESULT_TYPEDEF_(&h8004D009)
+Const XACT_E_NOENLIST = _HRESULT_TYPEDEF_(&h8004D00A)
+Const XACT_E_NOISORETAIN = _HRESULT_TYPEDEF_(&h8004D00B)
+Const XACT_E_NORESOURCE = _HRESULT_TYPEDEF_(&h8004D00C)
+Const XACT_E_NOTCURRENT = _HRESULT_TYPEDEF_(&h8004D00D)
+Const XACT_E_NOTRANSACTION = _HRESULT_TYPEDEF_(&h8004D00E)
+Const XACT_E_NOTSUPPORTED = _HRESULT_TYPEDEF_(&h8004D00F)
+Const XACT_E_UNKNOWNRMGRID = _HRESULT_TYPEDEF_(&h8004D010)
+Const XACT_E_WRONGSTATE = _HRESULT_TYPEDEF_(&h8004D011)
+Const XACT_E_WRONGUOW = _HRESULT_TYPEDEF_(&h8004D012)
+Const XACT_E_XTIONEXISTS = _HRESULT_TYPEDEF_(&h8004D013)
+Const XACT_E_NOIMPORTOBJECT = _HRESULT_TYPEDEF_(&h8004D014)
+Const XACT_E_INVALIDCOOKIE = _HRESULT_TYPEDEF_(&h8004D015)
+Const XACT_E_INDOUBT = _HRESULT_TYPEDEF_(&h8004D016)
+Const XACT_E_NOTIMEOUT = _HRESULT_TYPEDEF_(&h8004D017)
+Const XACT_E_ALREADYINPROGRESS = _HRESULT_TYPEDEF_(&h8004D018)
+Const XACT_E_ABORTED = _HRESULT_TYPEDEF_(&h8004D019)
+Const XACT_E_LOGFULL = _HRESULT_TYPEDEF_(&h8004D01A)
+Const XACT_E_TMNOTAVAILABLE = _HRESULT_TYPEDEF_(&h8004D01B)
+Const XACT_E_CONNECTION_DOWN = _HRESULT_TYPEDEF_(&h8004D01C)
+Const XACT_E_CONNECTION_DENIED = _HRESULT_TYPEDEF_(&h8004D01D)
+Const XACT_E_REENLISTTIMEOUT = _HRESULT_TYPEDEF_(&h8004D01E)
+Const XACT_E_TIP_CONNECT_FAILED = _HRESULT_TYPEDEF_(&h8004D01F)
+Const XACT_E_TIP_PROTOCOL_ERROR = _HRESULT_TYPEDEF_(&h8004D020)
+Const XACT_E_TIP_PULL_FAILED = _HRESULT_TYPEDEF_(&h8004D021)
+Const XACT_E_DEST_TMNOTAVAILABLE = _HRESULT_TYPEDEF_(&h8004D022)
+Const XACT_E_TIP_DISABLED = _HRESULT_TYPEDEF_(&h8004D023)
+Const XACT_E_NETWORK_TX_DISABLED = _HRESULT_TYPEDEF_(&h8004D024)
+Const XACT_E_PARTNER_NETWORK_TX_DISABLED = _HRESULT_TYPEDEF_(&h8004D025)
+Const XACT_E_XA_TX_DISABLED = _HRESULT_TYPEDEF_(&h8004D026)
+Const XACT_E_UNABLE_TO_READ_DTC_CONFIG = _HRESULT_TYPEDEF_(&h8004D027)
+Const XACT_E_UNABLE_TO_LOAD_DTC_PROXY = _HRESULT_TYPEDEF_(&h8004D028)
+Const XACT_E_ABORTING = _HRESULT_TYPEDEF_(&h8004D029)
+Const XACT_E_CLERKNOTFOUND = _HRESULT_TYPEDEF_(&h8004D080)
+Const XACT_E_CLERKEXISTS = _HRESULT_TYPEDEF_(&h8004D081)
+Const XACT_E_RECOVERYINPROGRESS = _HRESULT_TYPEDEF_(&h8004D082)
+Const XACT_E_TRANSACTIONCLOSED = _HRESULT_TYPEDEF_(&h8004D083)
+Const XACT_E_INVALIDLSN = _HRESULT_TYPEDEF_(&h8004D084)
+Const XACT_E_REPLAYREQUEST = _HRESULT_TYPEDEF_(&h8004D085)
+Const XACT_S_ASYNC = _HRESULT_TYPEDEF_(&h0004D000)
+Const XACT_S_DEFECT = _HRESULT_TYPEDEF_(&h0004D001)
+Const XACT_S_READONLY = _HRESULT_TYPEDEF_(&h0004D002)
+Const XACT_S_SOMENORETAIN = _HRESULT_TYPEDEF_(&h0004D003)
+Const XACT_S_OKINFORM = _HRESULT_TYPEDEF_(&h0004D004)
+Const XACT_S_MADECHANGESCONTENT = _HRESULT_TYPEDEF_(&h0004D005)
+Const XACT_S_MADECHANGESINFORM = _HRESULT_TYPEDEF_(&h0004D006)
+Const XACT_S_ALLNORETAIN = _HRESULT_TYPEDEF_(&h0004D007)
+Const XACT_S_ABORTING = _HRESULT_TYPEDEF_(&h0004D008)
+Const XACT_S_SINGLEPHASE = _HRESULT_TYPEDEF_(&h0004D009)
+Const XACT_S_LOCALLY_OK = _HRESULT_TYPEDEF_(&h0004D00A)
+Const XACT_S_LASTRESOURCEMANAGER = _HRESULT_TYPEDEF_(&h0004D010)
+Const CONTEXT_E_FIRST = &h8004E000
+Const CONTEXT_E_LAST = &h8004E02F
+Const CONTEXT_S_FIRST = &h0004E000
+Const CONTEXT_S_LAST = &h0004E02F
+Const CONTEXT_E_ABORTED = _HRESULT_TYPEDEF_(&h8004E002)
+Const CONTEXT_E_ABORTING = _HRESULT_TYPEDEF_(&h8004E003)
+Const CONTEXT_E_NOCONTEXT = _HRESULT_TYPEDEF_(&h8004E004)
+Const CONTEXT_E_WOULD_DEADLOCK = _HRESULT_TYPEDEF_(&h8004E005)
+Const CONTEXT_E_SYNCH_TIMEOUT = _HRESULT_TYPEDEF_(&h8004E006)
+Const CONTEXT_E_OLDREF = _HRESULT_TYPEDEF_(&h8004E007)
+Const CONTEXT_E_ROLENOTFOUND = _HRESULT_TYPEDEF_(&h8004E00C)
+Const CONTEXT_E_TMNOTAVAILABLE = _HRESULT_TYPEDEF_(&h8004E00F)
+Const CO_E_ACTIVATIONFAILED = _HRESULT_TYPEDEF_(&h8004E021)
+Const CO_E_ACTIVATIONFAILED_EVENTLOGGED = _HRESULT_TYPEDEF_(&h8004E022)
+Const CO_E_ACTIVATIONFAILED_CATALOGERROR = _HRESULT_TYPEDEF_(&h8004E023)
+Const CO_E_ACTIVATIONFAILED_TIMEOUT = _HRESULT_TYPEDEF_(&h8004E024)
+Const CO_E_INITIALIZATIONFAILED = _HRESULT_TYPEDEF_(&h8004E025)
+Const CONTEXT_E_NOJIT = _HRESULT_TYPEDEF_(&h8004E026)
+Const CONTEXT_E_NOTRANSACTION = _HRESULT_TYPEDEF_(&h8004E027)
+Const CO_E_THREADINGMODEL_CHANGED = _HRESULT_TYPEDEF_(&h8004E028)
+Const CO_E_NOIISINTRINSICS = _HRESULT_TYPEDEF_(&h8004E029)
+Const CO_E_NOCOOKIES = _HRESULT_TYPEDEF_(&h8004E02A)
+Const CO_E_DBERROR = _HRESULT_TYPEDEF_(&h8004E02B)
+Const CO_E_NOTPOOLED = _HRESULT_TYPEDEF_(&h8004E02C)
+Const CO_E_NOTCONSTRUCTED = _HRESULT_TYPEDEF_(&h8004E02D)
+Const CO_E_NOSYNCHRONIZATION = _HRESULT_TYPEDEF_(&h8004E02E)
+Const CO_E_ISOLEVELMISMATCH = _HRESULT_TYPEDEF_(&h8004E02F)
+Const OLE_S_USEREG = _HRESULT_TYPEDEF_(&h00040000)
+Const OLE_S_STATIC = _HRESULT_TYPEDEF_(&h00040001)
+Const OLE_S_MAC_CLIPFORMAT = _HRESULT_TYPEDEF_(&h00040002)
+Const DRAGDROP_S_DROP = _HRESULT_TYPEDEF_(&h00040100)
+Const DRAGDROP_S_CANCEL = _HRESULT_TYPEDEF_(&h00040101)
+Const DRAGDROP_S_USEDEFAULTCURSORS = _HRESULT_TYPEDEF_(&h00040102)
+Const DATA_S_SAMEFORMATETC = _HRESULT_TYPEDEF_(&h00040130)
+Const VIEW_S_ALREADY_FROZEN = _HRESULT_TYPEDEF_(&h00040140)
+Const CACHE_S_FORMATETC_NOTSUPPORTED = _HRESULT_TYPEDEF_(&h00040170)
+Const CACHE_S_SAMECACHE = _HRESULT_TYPEDEF_(&h00040171)
+Const CACHE_S_SOMECACHES_NOTUPDATED = _HRESULT_TYPEDEF_(&h00040172)
+Const OLEOBJ_S_INVALIDVERB = _HRESULT_TYPEDEF_(&h00040180)
+Const OLEOBJ_S_CANNOT_DOVERB_NOW = _HRESULT_TYPEDEF_(&h00040181)
+Const OLEOBJ_S_INVALIDHWND = _HRESULT_TYPEDEF_(&h00040182)
+Const INPLACE_S_TRUNCATED = _HRESULT_TYPEDEF_(&h000401A0)
+Const CONVERT10_S_NO_PRESENTATION = _HRESULT_TYPEDEF_(&h000401C0)
+Const MK_S_REDUCED_TO_SELF = _HRESULT_TYPEDEF_(&h000401E2)
+Const MK_S_ME = _HRESULT_TYPEDEF_(&h000401E4)
+Const MK_S_HIM = _HRESULT_TYPEDEF_(&h000401E5)
+Const MK_S_US = _HRESULT_TYPEDEF_(&h000401E6)
+Const MK_S_MONIKERALREADYREGISTERED = _HRESULT_TYPEDEF_(&h000401E7)
+Const SCHED_S_TASK_READY = _HRESULT_TYPEDEF_(&h00041300)
+Const SCHED_S_TASK_RUNNING = _HRESULT_TYPEDEF_(&h00041301)
+Const SCHED_S_TASK_DISABLED = _HRESULT_TYPEDEF_(&h00041302)
+Const SCHED_S_TASK_HAS_NOT_RUN = _HRESULT_TYPEDEF_(&h00041303)
+Const SCHED_S_TASK_NO_MORE_RUNS = _HRESULT_TYPEDEF_(&h00041304)
+Const SCHED_S_TASK_NOT_SCHEDULED = _HRESULT_TYPEDEF_(&h00041305)
+Const SCHED_S_TASK_TERMINATED = _HRESULT_TYPEDEF_(&h00041306)
+Const SCHED_S_TASK_NO_VALID_TRIGGERS = _HRESULT_TYPEDEF_(&h00041307)
+Const SCHED_S_EVENT_TRIGGER = _HRESULT_TYPEDEF_(&h00041308)
+Const SCHED_E_TRIGGER_NOT_FOUND = _HRESULT_TYPEDEF_(&h80041309)
+Const SCHED_E_TASK_NOT_READY = _HRESULT_TYPEDEF_(&h8004130A)
+Const SCHED_E_TASK_NOT_RUNNING = _HRESULT_TYPEDEF_(&h8004130B)
+Const SCHED_E_SERVICE_NOT_INSTALLED = _HRESULT_TYPEDEF_(&h8004130C)
+Const SCHED_E_CANNOT_OPEN_TASK = _HRESULT_TYPEDEF_(&h8004130D)
+Const SCHED_E_INVALID_TASK = _HRESULT_TYPEDEF_(&h8004130E)
+Const SCHED_E_ACCOUNT_INFORMATION_NOT_SET = _HRESULT_TYPEDEF_(&h8004130F)
+Const SCHED_E_ACCOUNT_NAME_NOT_FOUND = _HRESULT_TYPEDEF_(&h80041310)
+Const SCHED_E_ACCOUNT_DBASE_CORRUPT = _HRESULT_TYPEDEF_(&h80041311)
+Const SCHED_E_NO_SECURITY_SERVICES = _HRESULT_TYPEDEF_(&h80041312)
+Const SCHED_E_UNKNOWN_OBJECT_VERSION = _HRESULT_TYPEDEF_(&h80041313)
+Const SCHED_E_UNSUPPORTED_ACCOUNT_OPTION = _HRESULT_TYPEDEF_(&h80041314)
+Const SCHED_E_SERVICE_NOT_RUNNING = _HRESULT_TYPEDEF_(&h80041315)
+Const CO_E_CLASS_CREATE_FAILED = _HRESULT_TYPEDEF_(&h80080001)
+Const CO_E_SCM_ERROR = _HRESULT_TYPEDEF_(&h80080002)
+Const CO_E_SCM_RPC_FAILURE = _HRESULT_TYPEDEF_(&h80080003)
+Const CO_E_BAD_PATH = _HRESULT_TYPEDEF_(&h80080004)
+Const CO_E_SERVER_EXEC_FAILURE = _HRESULT_TYPEDEF_(&h80080005)
+Const CO_E_OBJSRV_RPC_FAILURE = _HRESULT_TYPEDEF_(&h80080006)
+Const MK_E_NO_NORMALIZED = _HRESULT_TYPEDEF_(&h80080007)
+Const CO_E_SERVER_STOPPING = _HRESULT_TYPEDEF_(&h80080008)
+Const MEM_E_INVALID_ROOT = _HRESULT_TYPEDEF_(&h80080009)
+Const MEM_E_INVALID_LINK = _HRESULT_TYPEDEF_(&h80080010)
+Const MEM_E_INVALID_SIZE = _HRESULT_TYPEDEF_(&h80080011)
+Const CO_S_NOTALLINTERFACES = _HRESULT_TYPEDEF_(&h00080012)
+Const CO_S_MACHINENAMENOTFOUND = _HRESULT_TYPEDEF_(&h00080013)
+Const DISP_E_UNKNOWNINTERFACE = _HRESULT_TYPEDEF_(&h80020001)
+Const DISP_E_MEMBERNOTFOUND = _HRESULT_TYPEDEF_(&h80020003)
+Const DISP_E_PARAMNOTFOUND = _HRESULT_TYPEDEF_(&h80020004)
+Const DISP_E_TYPEMISMATCH = _HRESULT_TYPEDEF_(&h80020005)
+Const DISP_E_UNKNOWNNAME = _HRESULT_TYPEDEF_(&h80020006)
+Const DISP_E_NONAMEDARGS = _HRESULT_TYPEDEF_(&h80020007)
+Const DISP_E_BADVARTYPE = _HRESULT_TYPEDEF_(&h80020008)
+Const DISP_E_EXCEPTION = _HRESULT_TYPEDEF_(&h80020009)
+Const DISP_E_OVERFLOW = _HRESULT_TYPEDEF_(&h8002000A)
+Const DISP_E_BADINDEX = _HRESULT_TYPEDEF_(&h8002000B)
+Const DISP_E_UNKNOWNLCID = _HRESULT_TYPEDEF_(&h8002000C)
+Const DISP_E_ARRAYISLOCKED = _HRESULT_TYPEDEF_(&h8002000D)
+Const DISP_E_BADPARAMCOUNT = _HRESULT_TYPEDEF_(&h8002000E)
+Const DISP_E_PARAMNOTOPTIONAL = _HRESULT_TYPEDEF_(&h8002000F)
+Const DISP_E_BADCALLEE = _HRESULT_TYPEDEF_(&h80020010)
+Const DISP_E_NOTACOLLECTION = _HRESULT_TYPEDEF_(&h80020011)
+Const DISP_E_DIVBYZERO = _HRESULT_TYPEDEF_(&h80020012)
+Const DISP_E_BUFFERTOOSMALL = _HRESULT_TYPEDEF_(&h80020013)
+Const TYPE_E_BUFFERTOOSMALL = _HRESULT_TYPEDEF_(&h80028016)
+Const TYPE_E_FIELDNOTFOUND = _HRESULT_TYPEDEF_(&h80028017)
+Const TYPE_E_INVDATAREAD = _HRESULT_TYPEDEF_(&h80028018)
+Const TYPE_E_UNSUPFORMAT = _HRESULT_TYPEDEF_(&h80028019)
+Const TYPE_E_REGISTRYACCESS = _HRESULT_TYPEDEF_(&h8002801C)
+Const TYPE_E_LIBNOTREGISTERED = _HRESULT_TYPEDEF_(&h8002801D)
+Const TYPE_E_UNDEFINEDTYPE = _HRESULT_TYPEDEF_(&h80028027)
+Const TYPE_E_QUALIFIEDNAMEDISALLOWED = _HRESULT_TYPEDEF_(&h80028028)
+Const TYPE_E_INVALIDSTATE = _HRESULT_TYPEDEF_(&h80028029)
+Const TYPE_E_WRONGTYPEKIND = _HRESULT_TYPEDEF_(&h8002802A)
+Const TYPE_E_ELEMENTNOTFOUND = _HRESULT_TYPEDEF_(&h8002802B)
+Const TYPE_E_AMBIGUOUSNAME = _HRESULT_TYPEDEF_(&h8002802C)
+Const TYPE_E_NAMECONFLICT = _HRESULT_TYPEDEF_(&h8002802D)
+Const TYPE_E_UNKNOWNLCID = _HRESULT_TYPEDEF_(&h8002802E)
+Const TYPE_E_DLLFUNCTIONNOTFOUND = _HRESULT_TYPEDEF_(&h8002802F)
+Const TYPE_E_BADMODULEKIND = _HRESULT_TYPEDEF_(&h800288BD)
+Const TYPE_E_SIZETOOBIG = _HRESULT_TYPEDEF_(&h800288C5)
+Const TYPE_E_DUPLICATEID = _HRESULT_TYPEDEF_(&h800288C6)
+Const TYPE_E_INVALIDID = _HRESULT_TYPEDEF_(&h800288CF)
+Const TYPE_E_TYPEMISMATCH = _HRESULT_TYPEDEF_(&h80028CA0)
+Const TYPE_E_OUTOFBOUNDS = _HRESULT_TYPEDEF_(&h80028CA1)
+Const TYPE_E_IOERROR = _HRESULT_TYPEDEF_(&h80028CA2)
+Const TYPE_E_CANTCREATETMPFILE = _HRESULT_TYPEDEF_(&h80028CA3)
+Const TYPE_E_CANTLOADLIBRARY = _HRESULT_TYPEDEF_(&h80029C4A)
+Const TYPE_E_INCONSISTENTPROPFUNCS = _HRESULT_TYPEDEF_(&h80029C83)
+Const TYPE_E_CIRCULARTYPE = _HRESULT_TYPEDEF_(&h80029C84)
+Const STG_E_INVALIDFUNCTION = _HRESULT_TYPEDEF_(&h80030001)
+Const STG_E_FILENOTFOUND = _HRESULT_TYPEDEF_(&h80030002)
+Const STG_E_PATHNOTFOUND = _HRESULT_TYPEDEF_(&h80030003)
+Const STG_E_TOOMANYOPENFILES = _HRESULT_TYPEDEF_(&h80030004)
+Const STG_E_ACCESSDENIED = _HRESULT_TYPEDEF_(&h80030005)
+Const STG_E_INVALIDHANDLE = _HRESULT_TYPEDEF_(&h80030006)
+Const STG_E_INSUFFICIENTMEMORY = _HRESULT_TYPEDEF_(&h80030008)
+Const STG_E_INVALIDPOINTER = _HRESULT_TYPEDEF_(&h80030009)
+Const STG_E_NOMOREFILES = _HRESULT_TYPEDEF_(&h80030012)
+Const STG_E_DISKISWRITEPROTECTED = _HRESULT_TYPEDEF_(&h80030013)
+Const STG_E_SEEKERROR = _HRESULT_TYPEDEF_(&h80030019)
+Const STG_E_WRITEFAULT = _HRESULT_TYPEDEF_(&h8003001D)
+Const STG_E_READFAULT = _HRESULT_TYPEDEF_(&h8003001E)
+Const STG_E_SHAREVIOLATION = _HRESULT_TYPEDEF_(&h80030020)
+Const STG_E_LOCKVIOLATION = _HRESULT_TYPEDEF_(&h80030021)
+Const STG_E_FILEALREADYEXISTS = _HRESULT_TYPEDEF_(&h80030050)
+Const STG_E_INVALIDPARAMETER = _HRESULT_TYPEDEF_(&h80030057)
+Const STG_E_MEDIUMFULL = _HRESULT_TYPEDEF_(&h80030070)
+Const STG_E_PROPSETMISMATCHED = _HRESULT_TYPEDEF_(&h800300F0)
+Const STG_E_ABNORMALAPIEXIT = _HRESULT_TYPEDEF_(&h800300FA)
+Const STG_E_INVALIDHEADER = _HRESULT_TYPEDEF_(&h800300FB)
+Const STG_E_INVALIDNAME = _HRESULT_TYPEDEF_(&h800300FC)
+Const STG_E_UNKNOWN = _HRESULT_TYPEDEF_(&h800300FD)
+Const STG_E_UNIMPLEMENTEDFUNCTION = _HRESULT_TYPEDEF_(&h800300FE)
+Const STG_E_INVALIDFLAG = _HRESULT_TYPEDEF_(&h800300FF)
+Const STG_E_INUSE = _HRESULT_TYPEDEF_(&h80030100)
+Const STG_E_NOTCURRENT = _HRESULT_TYPEDEF_(&h80030101)
+Const STG_E_REVERTED = _HRESULT_TYPEDEF_(&h80030102)
+Const STG_E_CANTSAVE = _HRESULT_TYPEDEF_(&h80030103)
+Const STG_E_OLDFORMAT = _HRESULT_TYPEDEF_(&h80030104)
+Const STG_E_OLDDLL = _HRESULT_TYPEDEF_(&h80030105)
+Const STG_E_SHAREREQUIRED = _HRESULT_TYPEDEF_(&h80030106)
+Const STG_E_NOTFILEBASEDSTORAGE = _HRESULT_TYPEDEF_(&h80030107)
+Const STG_E_EXTANTMARSHALLINGS = _HRESULT_TYPEDEF_(&h80030108)
+Const STG_E_DOCFILECORRUPT = _HRESULT_TYPEDEF_(&h80030109)
+Const STG_E_BADBASEADDRESS = _HRESULT_TYPEDEF_(&h80030110)
+Const STG_E_DOCFILETOOLARGE = _HRESULT_TYPEDEF_(&h80030111)
+Const STG_E_NOTSIMPLEFORMAT = _HRESULT_TYPEDEF_(&h80030112)
+Const STG_E_INCOMPLETE = _HRESULT_TYPEDEF_(&h80030201)
+Const STG_E_TERMINATED = _HRESULT_TYPEDEF_(&h80030202)
+Const STG_S_CONVERTED = _HRESULT_TYPEDEF_(&h00030200)
+Const STG_S_BLOCK = _HRESULT_TYPEDEF_(&h00030201)
+Const STG_S_RETRYNOW = _HRESULT_TYPEDEF_(&h00030202)
+Const STG_S_MONITORING = _HRESULT_TYPEDEF_(&h00030203)
+Const STG_S_MULTIPLEOPENS = _HRESULT_TYPEDEF_(&h00030204)
+Const STG_S_CONSOLIDATIONFAILED = _HRESULT_TYPEDEF_(&h00030205)
+Const STG_S_CANNOTCONSOLIDATE = _HRESULT_TYPEDEF_(&h00030206)
+Const STG_E_STATUS_COPY_PROTECTION_FAILURE = _HRESULT_TYPEDEF_(&h80030305)
+Const STG_E_CSS_AUTHENTICATION_FAILURE = _HRESULT_TYPEDEF_(&h80030306)
+Const STG_E_CSS_KEY_NOT_PRESENT = _HRESULT_TYPEDEF_(&h80030307)
+Const STG_E_CSS_KEY_NOT_ESTABLISHED = _HRESULT_TYPEDEF_(&h80030308)
+Const STG_E_CSS_SCRAMBLED_SECTOR = _HRESULT_TYPEDEF_(&h80030309)
+Const STG_E_CSS_REGION_MISMATCH = _HRESULT_TYPEDEF_(&h8003030A)
+Const STG_E_RESETS_EXHAUSTED = _HRESULT_TYPEDEF_(&h8003030B)
+Const RPC_E_CALL_REJECTED = _HRESULT_TYPEDEF_(&h80010001)
+Const RPC_E_CALL_CANCELED = _HRESULT_TYPEDEF_(&h80010002)
+Const RPC_E_CANTPOST_INSENDCALL = _HRESULT_TYPEDEF_(&h80010003)
+Const RPC_E_CANTCALLOUT_INASYNCCALL = _HRESULT_TYPEDEF_(&h80010004)
+Const RPC_E_CANTCALLOUT_INEXTERNALCALL = _HRESULT_TYPEDEF_(&h80010005)
+Const RPC_E_CONNECTION_TERMINATED = _HRESULT_TYPEDEF_(&h80010006)
+Const RPC_E_SERVER_DIED = _HRESULT_TYPEDEF_(&h80010007)
+Const RPC_E_CLIENT_DIED = _HRESULT_TYPEDEF_(&h80010008)
+Const RPC_E_INVALID_DATAPACKET = _HRESULT_TYPEDEF_(&h80010009)
+Const RPC_E_CANTTRANSMIT_CALL = _HRESULT_TYPEDEF_(&h8001000A)
+Const RPC_E_CLIENT_CANTMARSHAL_DATA = _HRESULT_TYPEDEF_(&h8001000B)
+Const RPC_E_CLIENT_CANTUNMARSHAL_DATA = _HRESULT_TYPEDEF_(&h8001000C)
+Const RPC_E_SERVER_CANTMARSHAL_DATA = _HRESULT_TYPEDEF_(&h8001000D)
+Const RPC_E_SERVER_CANTUNMARSHAL_DATA = _HRESULT_TYPEDEF_(&h8001000E)
+Const RPC_E_INVALID_DATA = _HRESULT_TYPEDEF_(&h8001000F)
+Const RPC_E_INVALID_PARAMETER = _HRESULT_TYPEDEF_(&h80010010)
+Const RPC_E_CANTCALLOUT_AGAIN = _HRESULT_TYPEDEF_(&h80010011)
+Const RPC_E_SERVER_DIED_DNE = _HRESULT_TYPEDEF_(&h80010012)
+Const RPC_E_SYS_CALL_FAILED = _HRESULT_TYPEDEF_(&h80010100)
+Const RPC_E_OUT_OF_RESOURCES = _HRESULT_TYPEDEF_(&h80010101)
+Const RPC_E_ATTEMPTED_MULTITHREAD = _HRESULT_TYPEDEF_(&h80010102)
+Const RPC_E_NOT_REGISTERED = _HRESULT_TYPEDEF_(&h80010103)
+Const RPC_E_FAULT = _HRESULT_TYPEDEF_(&h80010104)
+Const RPC_E_SERVERFAULT = _HRESULT_TYPEDEF_(&h80010105)
+Const RPC_E_CHANGED_MODE = _HRESULT_TYPEDEF_(&h80010106)
+Const RPC_E_INVALIDMETHOD = _HRESULT_TYPEDEF_(&h80010107)
+Const RPC_E_DISCONNECTED = _HRESULT_TYPEDEF_(&h80010108)
+Const RPC_E_RETRY = _HRESULT_TYPEDEF_(&h80010109)
+Const RPC_E_SERVERCALL_RETRYLATER = _HRESULT_TYPEDEF_(&h8001010A)
+Const RPC_E_SERVERCALL_REJECTED = _HRESULT_TYPEDEF_(&h8001010B)
+Const RPC_E_INVALID_CALLDATA = _HRESULT_TYPEDEF_(&h8001010C)
+Const RPC_E_CANTCALLOUT_ININPUTSYNCCALL = _HRESULT_TYPEDEF_(&h8001010D)
+Const RPC_E_WRONG_THREAD = _HRESULT_TYPEDEF_(&h8001010E)
+Const RPC_E_THREAD_NOT_INIT = _HRESULT_TYPEDEF_(&h8001010F)
+Const RPC_E_VERSION_MISMATCH = _HRESULT_TYPEDEF_(&h80010110)
+Const RPC_E_INVALID_HEADER = _HRESULT_TYPEDEF_(&h80010111)
+Const RPC_E_INVALID_EXTENSION = _HRESULT_TYPEDEF_(&h80010112)
+Const RPC_E_INVALID_IPID = _HRESULT_TYPEDEF_(&h80010113)
+Const RPC_E_INVALID_OBJECT = _HRESULT_TYPEDEF_(&h80010114)
+Const RPC_S_CALLPENDING = _HRESULT_TYPEDEF_(&h80010115)
+Const RPC_S_WAITONTIMER = _HRESULT_TYPEDEF_(&h80010116)
+Const RPC_E_CALL_COMPLETE = _HRESULT_TYPEDEF_(&h80010117)
+Const RPC_E_UNSECURE_CALL = _HRESULT_TYPEDEF_(&h80010118)
+Const RPC_E_TOO_LATE = _HRESULT_TYPEDEF_(&h80010119)
+Const RPC_E_NO_GOOD_SECURITY_PACKAGES = _HRESULT_TYPEDEF_(&h8001011A)
+Const RPC_E_ACCESS_DENIED = _HRESULT_TYPEDEF_(&h8001011B)
+Const RPC_E_REMOTE_DISABLED = _HRESULT_TYPEDEF_(&h8001011C)
+Const RPC_E_INVALID_OBJREF = _HRESULT_TYPEDEF_(&h8001011D)
+Const RPC_E_NO_CONTEXT = _HRESULT_TYPEDEF_(&h8001011E)
+Const RPC_E_TIMEOUT = _HRESULT_TYPEDEF_(&h8001011F)
+Const RPC_E_NO_SYNC = _HRESULT_TYPEDEF_(&h80010120)
+Const RPC_E_FULLSIC_REQUIRED = _HRESULT_TYPEDEF_(&h80010121)
+Const RPC_E_INVALID_STD_NAME = _HRESULT_TYPEDEF_(&h80010122)
+Const CO_E_FAILEDTOIMPERSONATE = _HRESULT_TYPEDEF_(&h80010123)
+Const CO_E_FAILEDTOGETSECCTX = _HRESULT_TYPEDEF_(&h80010124)
+Const CO_E_FAILEDTOOPENTHREADTOKEN = _HRESULT_TYPEDEF_(&h80010125)
+Const CO_E_FAILEDTOGETTOKENINFO = _HRESULT_TYPEDEF_(&h80010126)
+Const CO_E_TRUSTEEDOESNTMATCHCLIENT = _HRESULT_TYPEDEF_(&h80010127)
+Const CO_E_FAILEDTOQUERYCLIENTBLANKET = _HRESULT_TYPEDEF_(&h80010128)
+Const CO_E_FAILEDTOSETDACL = _HRESULT_TYPEDEF_(&h80010129)
+Const CO_E_ACCESSCHECKFAILED = _HRESULT_TYPEDEF_(&h8001012A)
+Const CO_E_NETACCESSAPIFAILED = _HRESULT_TYPEDEF_(&h8001012B)
+Const CO_E_WRONGTRUSTEENAMESYNTAX = _HRESULT_TYPEDEF_(&h8001012C)
+Const CO_E_INVALIDSID = _HRESULT_TYPEDEF_(&h8001012D)
+Const CO_E_CONVERSIONFAILED = _HRESULT_TYPEDEF_(&h8001012E)
+Const CO_E_NOMATCHINGSIDFOUND = _HRESULT_TYPEDEF_(&h8001012F)
+Const CO_E_LOOKUPACCSIDFAILED = _HRESULT_TYPEDEF_(&h80010130)
+Const CO_E_NOMATCHINGNAMEFOUND = _HRESULT_TYPEDEF_(&h80010131)
+Const CO_E_LOOKUPACCNAMEFAILED = _HRESULT_TYPEDEF_(&h80010132)
+Const CO_E_SETSERLHNDLFAILED = _HRESULT_TYPEDEF_(&h80010133)
+Const CO_E_FAILEDTOGETWINDIR = _HRESULT_TYPEDEF_(&h80010134)
+Const CO_E_PATHTOOLONG = _HRESULT_TYPEDEF_(&h80010135)
+Const CO_E_FAILEDTOGENUUID = _HRESULT_TYPEDEF_(&h80010136)
+Const CO_E_FAILEDTOCREATEFILE = _HRESULT_TYPEDEF_(&h80010137)
+Const CO_E_FAILEDTOCLOSEHANDLE = _HRESULT_TYPEDEF_(&h80010138)
+Const CO_E_EXCEEDSYSACLLIMIT = _HRESULT_TYPEDEF_(&h80010139)
+Const CO_E_ACESINWRONGORDER = _HRESULT_TYPEDEF_(&h8001013A)
+Const CO_E_INCOMPATIBLESTREAMVERSION = _HRESULT_TYPEDEF_(&h8001013B)
+Const CO_E_FAILEDTOOPENPROCESSTOKEN = _HRESULT_TYPEDEF_(&h8001013C)
+Const CO_E_DECODEFAILED = _HRESULT_TYPEDEF_(&h8001013D)
+Const CO_E_ACNOTINITIALIZED = _HRESULT_TYPEDEF_(&h8001013F)
+Const CO_E_CANCEL_DISABLED = _HRESULT_TYPEDEF_(&h80010140)
+Const RPC_E_UNEXPECTED = _HRESULT_TYPEDEF_(&h8001FFFF)
+Const ERROR_AUDITING_DISABLED = _HRESULT_TYPEDEF_(&hC0090001)
+Const ERROR_ALL_SIDS_FILTERED = _HRESULT_TYPEDEF_(&hC0090002)
+Const NTE_BAD_UID = _HRESULT_TYPEDEF_(&h80090001)
+Const NTE_BAD_HASH = _HRESULT_TYPEDEF_(&h80090002)
+Const NTE_BAD_KEY = _HRESULT_TYPEDEF_(&h80090003)
+Const NTE_BAD_LEN = _HRESULT_TYPEDEF_(&h80090004)
+Const NTE_BAD_DATA = _HRESULT_TYPEDEF_(&h80090005)
+Const NTE_BAD_SIGNATURE = _HRESULT_TYPEDEF_(&h80090006)
+Const NTE_BAD_VER = _HRESULT_TYPEDEF_(&h80090007)
+Const NTE_BAD_ALGID = _HRESULT_TYPEDEF_(&h80090008)
+Const NTE_BAD_FLAGS = _HRESULT_TYPEDEF_(&h80090009)
+Const NTE_BAD_TYPE = _HRESULT_TYPEDEF_(&h8009000A)
+Const NTE_BAD_KEY_STATE = _HRESULT_TYPEDEF_(&h8009000B)
+Const NTE_BAD_HASH_STATE = _HRESULT_TYPEDEF_(&h8009000C)
+Const NTE_NO_KEY = _HRESULT_TYPEDEF_(&h8009000D)
+Const NTE_NO_MEMORY = _HRESULT_TYPEDEF_(&h8009000E)
+Const NTE_EXISTS = _HRESULT_TYPEDEF_(&h8009000F)
+Const NTE_PERM = _HRESULT_TYPEDEF_(&h80090010)
+Const NTE_NOT_FOUND = _HRESULT_TYPEDEF_(&h80090011)
+Const NTE_DOUBLE_ENCRYPT = _HRESULT_TYPEDEF_(&h80090012)
+Const NTE_BAD_PROVIDER = _HRESULT_TYPEDEF_(&h80090013)
+Const NTE_BAD_PROV_TYPE = _HRESULT_TYPEDEF_(&h80090014)
+Const NTE_BAD_PUBLIC_KEY = _HRESULT_TYPEDEF_(&h80090015)
+Const NTE_BAD_KEYSET = _HRESULT_TYPEDEF_(&h80090016)
+Const NTE_PROV_TYPE_NOT_DEF = _HRESULT_TYPEDEF_(&h80090017)
+Const NTE_PROV_TYPE_ENTRY_BAD = _HRESULT_TYPEDEF_(&h80090018)
+Const NTE_KEYSET_NOT_DEF = _HRESULT_TYPEDEF_(&h80090019)
+Const NTE_KEYSET_ENTRY_BAD = _HRESULT_TYPEDEF_(&h8009001A)
+Const NTE_PROV_TYPE_NO_MATCH = _HRESULT_TYPEDEF_(&h8009001B)
+Const NTE_SIGNATURE_FILE_BAD = _HRESULT_TYPEDEF_(&h8009001C)
+Const NTE_PROVIDER_DLL_FAIL = _HRESULT_TYPEDEF_(&h8009001D)
+Const NTE_PROV_DLL_NOT_FOUND = _HRESULT_TYPEDEF_(&h8009001E)
+Const NTE_BAD_KEYSET_PARAM = _HRESULT_TYPEDEF_(&h8009001F)
+Const NTE_FAIL = _HRESULT_TYPEDEF_(&h80090020)
+Const NTE_SYS_ERR = _HRESULT_TYPEDEF_(&h80090021)
+Const NTE_SILENT_CONTEXT = _HRESULT_TYPEDEF_(&h80090022)
+Const NTE_TOKEN_KEYSET_STORAGE_FULL = _HRESULT_TYPEDEF_(&h80090023)
+Const NTE_TEMPORARY_PROFILE = _HRESULT_TYPEDEF_(&h80090024)
+Const NTE_FIXEDPARAMETER = _HRESULT_TYPEDEF_(&h80090025)
+Const SEC_E_INSUFFICIENT_MEMORY = _HRESULT_TYPEDEF_(&h80090300)
+Const SEC_E_INVALID_HANDLE = _HRESULT_TYPEDEF_(&h80090301)
+Const SEC_E_UNSUPPORTED_FUNCTION = _HRESULT_TYPEDEF_(&h80090302)
+Const SEC_E_TARGET_UNKNOWN = _HRESULT_TYPEDEF_(&h80090303)
+Const SEC_E_INTERNAL_ERROR = _HRESULT_TYPEDEF_(&h80090304)
+Const SEC_E_SECPKG_NOT_FOUND = _HRESULT_TYPEDEF_(&h80090305)
+Const SEC_E_NOT_OWNER = _HRESULT_TYPEDEF_(&h80090306)
+Const SEC_E_CANNOT_INSTALL = _HRESULT_TYPEDEF_(&h80090307)
+Const SEC_E_INVALID_TOKEN = _HRESULT_TYPEDEF_(&h80090308)
+Const SEC_E_CANNOT_PACK = _HRESULT_TYPEDEF_(&h80090309)
+Const SEC_E_QOP_NOT_SUPPORTED = _HRESULT_TYPEDEF_(&h8009030A)
+Const SEC_E_NO_IMPERSONATION = _HRESULT_TYPEDEF_(&h8009030B)
+Const SEC_E_LOGON_DENIED = _HRESULT_TYPEDEF_(&h8009030C)
+Const SEC_E_UNKNOWN_CREDENTIALS = _HRESULT_TYPEDEF_(&h8009030D)
+Const SEC_E_NO_CREDENTIALS = _HRESULT_TYPEDEF_(&h8009030E)
+Const SEC_E_MESSAGE_ALTERED = _HRESULT_TYPEDEF_(&h8009030F)
+Const SEC_E_OUT_OF_SEQUENCE = _HRESULT_TYPEDEF_(&h80090310)
+Const SEC_E_NO_AUTHENTICATING_AUTHORITY = _HRESULT_TYPEDEF_(&h80090311)
+Const SEC_I_CONTINUE_NEEDED = _HRESULT_TYPEDEF_(&h00090312)
+Const SEC_I_COMPLETE_NEEDED = _HRESULT_TYPEDEF_(&h00090313)
+Const SEC_I_COMPLETE_AND_CONTINUE = _HRESULT_TYPEDEF_(&h00090314)
+Const SEC_I_LOCAL_LOGON = _HRESULT_TYPEDEF_(&h00090315)
+Const SEC_E_BAD_PKGID = _HRESULT_TYPEDEF_(&h80090316)
+Const SEC_E_CONTEXT_EXPIRED = _HRESULT_TYPEDEF_(&h80090317)
+Const SEC_I_CONTEXT_EXPIRED = _HRESULT_TYPEDEF_(&h00090317)
+Const SEC_E_INCOMPLETE_MESSAGE = _HRESULT_TYPEDEF_(&h80090318)
+Const SEC_E_INCOMPLETE_CREDENTIALS = _HRESULT_TYPEDEF_(&h80090320)
+Const SEC_E_BUFFER_TOO_SMALL = _HRESULT_TYPEDEF_(&h80090321)
+Const SEC_I_INCOMPLETE_CREDENTIALS = _HRESULT_TYPEDEF_(&h00090320)
+Const SEC_I_RENEGOTIATE = _HRESULT_TYPEDEF_(&h00090321)
+Const SEC_E_WRONG_PRINCIPAL = _HRESULT_TYPEDEF_(&h80090322)
+Const SEC_I_NO_LSA_CONTEXT = _HRESULT_TYPEDEF_(&h00090323)
+Const SEC_E_TIME_SKEW = _HRESULT_TYPEDEF_(&h80090324)
+Const SEC_E_UNTRUSTED_ROOT = _HRESULT_TYPEDEF_(&h80090325)
+Const SEC_E_ILLEGAL_MESSAGE = _HRESULT_TYPEDEF_(&h80090326)
+Const SEC_E_CERT_UNKNOWN = _HRESULT_TYPEDEF_(&h80090327)
+Const SEC_E_CERT_EXPIRED = _HRESULT_TYPEDEF_(&h80090328)
+Const SEC_E_ENCRYPT_FAILURE = _HRESULT_TYPEDEF_(&h80090329)
+Const SEC_E_DECRYPT_FAILURE = _HRESULT_TYPEDEF_(&h80090330)
+Const SEC_E_ALGORITHM_MISMATCH = _HRESULT_TYPEDEF_(&h80090331)
+Const SEC_E_SECURITY_QOS_FAILED = _HRESULT_TYPEDEF_(&h80090332)
+Const SEC_E_UNFINISHED_CONTEXT_DELETED = _HRESULT_TYPEDEF_(&h80090333)
+Const SEC_E_NO_TGT_REPLY = _HRESULT_TYPEDEF_(&h80090334)
+Const SEC_E_NO_IP_ADDRESSES = _HRESULT_TYPEDEF_(&h80090335)
+Const SEC_E_WRONG_CREDENTIAL_HANDLE = _HRESULT_TYPEDEF_(&h80090336)
+Const SEC_E_CRYPTO_SYSTEM_INVALID = _HRESULT_TYPEDEF_(&h80090337)
+Const SEC_E_MAX_REFERRALS_EXCEEDED = _HRESULT_TYPEDEF_(&h80090338)
+Const SEC_E_MUST_BE_KDC = _HRESULT_TYPEDEF_(&h80090339)
+Const SEC_E_STRONG_CRYPTO_NOT_SUPPORTED = _HRESULT_TYPEDEF_(&h8009033A)
+Const SEC_E_TOO_MANY_PRINCIPALS = _HRESULT_TYPEDEF_(&h8009033B)
+Const SEC_E_NO_PA_DATA = _HRESULT_TYPEDEF_(&h8009033C)
+Const SEC_E_PKINIT_NAME_MISMATCH = _HRESULT_TYPEDEF_(&h8009033D)
+Const SEC_E_SMARTCARD_LOGON_REQUIRED = _HRESULT_TYPEDEF_(&h8009033E)
+Const SEC_E_SHUTDOWN_IN_PROGRESS = _HRESULT_TYPEDEF_(&h8009033F)
+Const SEC_E_KDC_INVALID_REQUEST = _HRESULT_TYPEDEF_(&h80090340)
+Const SEC_E_KDC_UNABLE_TO_REFER = _HRESULT_TYPEDEF_(&h80090341)
+Const SEC_E_KDC_UNKNOWN_ETYPE = _HRESULT_TYPEDEF_(&h80090342)
+Const SEC_E_UNSUPPORTED_PREAUTH = _HRESULT_TYPEDEF_(&h80090343)
+Const SEC_E_DELEGATION_REQUIRED = _HRESULT_TYPEDEF_(&h80090345)
+Const SEC_E_BAD_BINDINGS = _HRESULT_TYPEDEF_(&h80090346)
+Const SEC_E_MULTIPLE_ACCOUNTS = _HRESULT_TYPEDEF_(&h80090347)
+Const SEC_E_NO_KERB_KEY = _HRESULT_TYPEDEF_(&h80090348)
+Const SEC_E_CERT_WRONG_USAGE = _HRESULT_TYPEDEF_(&h80090349)
+Const SEC_E_DOWNGRADE_DETECTED = _HRESULT_TYPEDEF_(&h80090350)
+Const SEC_E_SMARTCARD_CERT_REVOKED = _HRESULT_TYPEDEF_(&h80090351)
+Const SEC_E_ISSUING_CA_UNTRUSTED = _HRESULT_TYPEDEF_(&h80090352)
+Const SEC_E_REVOCATION_OFFLINE_C = _HRESULT_TYPEDEF_(&h80090353)
+Const SEC_E_PKINIT_CLIENT_FAILURE = _HRESULT_TYPEDEF_(&h80090354)
+Const SEC_E_SMARTCARD_CERT_EXPIRED = _HRESULT_TYPEDEF_(&h80090355)
+Const SEC_E_NO_S4U_PROT_SUPPORT = _HRESULT_TYPEDEF_(&h80090356)
+Const SEC_E_CROSSREALM_DELEGATION_FAILURE = _HRESULT_TYPEDEF_(&h80090357)
+Const SEC_E_REVOCATION_OFFLINE_KDC = _HRESULT_TYPEDEF_(&h80090358)
+Const SEC_E_ISSUING_CA_UNTRUSTED_KDC = _HRESULT_TYPEDEF_(&h80090359)
+Const SEC_E_KDC_CERT_EXPIRED = _HRESULT_TYPEDEF_(&h8009035A)
+Const SEC_E_KDC_CERT_REVOKED = _HRESULT_TYPEDEF_(&h8009035B)
+Const SEC_E_NO_SPM = SEC_E_INTERNAL_ERROR
+Const SEC_E_NOT_SUPPORTED = SEC_E_UNSUPPORTED_FUNCTION
+Const CRYPT_E_MSG_ERROR = _HRESULT_TYPEDEF_(&h80091001)
+Const CRYPT_E_UNKNOWN_ALGO = _HRESULT_TYPEDEF_(&h80091002)
+Const CRYPT_E_OID_FORMAT = _HRESULT_TYPEDEF_(&h80091003)
+Const CRYPT_E_INVALID_MSG_TYPE = _HRESULT_TYPEDEF_(&h80091004)
+Const CRYPT_E_UNEXPECTED_ENCODING = _HRESULT_TYPEDEF_(&h80091005)
+Const CRYPT_E_AUTH_ATTR_MISSING = _HRESULT_TYPEDEF_(&h80091006)
+Const CRYPT_E_HASH_VALUE = _HRESULT_TYPEDEF_(&h80091007)
+Const CRYPT_E_INVALID_INDEX = _HRESULT_TYPEDEF_(&h80091008)
+Const CRYPT_E_ALREADY_DECRYPTED = _HRESULT_TYPEDEF_(&h80091009)
+Const CRYPT_E_NOT_DECRYPTED = _HRESULT_TYPEDEF_(&h8009100A)
+Const CRYPT_E_RECIPIENT_NOT_FOUND = _HRESULT_TYPEDEF_(&h8009100B)
+Const CRYPT_E_CONTROL_TYPE = _HRESULT_TYPEDEF_(&h8009100C)
+Const CRYPT_E_ISSUER_SERIALNUMBER = _HRESULT_TYPEDEF_(&h8009100D)
+Const CRYPT_E_SIGNER_NOT_FOUND = _HRESULT_TYPEDEF_(&h8009100E)
+Const CRYPT_E_ATTRIBUTES_MISSING = _HRESULT_TYPEDEF_(&h8009100F)
+Const CRYPT_E_STREAM_MSG_NOT_READY = _HRESULT_TYPEDEF_(&h80091010)
+Const CRYPT_E_STREAM_INSUFFICIENT_DATA = _HRESULT_TYPEDEF_(&h80091011)
+Const CRYPT_I_NEW_PROTECTION_REQUIRED = _HRESULT_TYPEDEF_(&h00091012)
+Const CRYPT_E_BAD_LEN = _HRESULT_TYPEDEF_(&h80092001)
+Const CRYPT_E_BAD_ENCODE = _HRESULT_TYPEDEF_(&h80092002)
+Const CRYPT_E_FILE_ERROR = _HRESULT_TYPEDEF_(&h80092003)
+Const CRYPT_E_NOT_FOUND = _HRESULT_TYPEDEF_(&h80092004)
+Const CRYPT_E_EXISTS = _HRESULT_TYPEDEF_(&h80092005)
+Const CRYPT_E_NO_PROVIDER = _HRESULT_TYPEDEF_(&h80092006)
+Const CRYPT_E_SELF_SIGNED = _HRESULT_TYPEDEF_(&h80092007)
+Const CRYPT_E_DELETED_PREV = _HRESULT_TYPEDEF_(&h80092008)
+Const CRYPT_E_NO_MATCH = _HRESULT_TYPEDEF_(&h80092009)
+Const CRYPT_E_UNEXPECTED_MSG_TYPE = _HRESULT_TYPEDEF_(&h8009200A)
+Const CRYPT_E_NO_KEY_PROPERTY = _HRESULT_TYPEDEF_(&h8009200B)
+Const CRYPT_E_NO_DECRYPT_CERT = _HRESULT_TYPEDEF_(&h8009200C)
+Const CRYPT_E_BAD_MSG = _HRESULT_TYPEDEF_(&h8009200D)
+Const CRYPT_E_NO_SIGNER = _HRESULT_TYPEDEF_(&h8009200E)
+Const CRYPT_E_PENDING_CLOSE = _HRESULT_TYPEDEF_(&h8009200F)
+Const CRYPT_E_REVOKED = _HRESULT_TYPEDEF_(&h80092010)
+Const CRYPT_E_NO_REVOCATION_DLL = _HRESULT_TYPEDEF_(&h80092011)
+Const CRYPT_E_NO_REVOCATION_CHECK = _HRESULT_TYPEDEF_(&h80092012)
+Const CRYPT_E_REVOCATION_OFFLINE = _HRESULT_TYPEDEF_(&h80092013)
+Const CRYPT_E_NOT_IN_REVOCATION_DATABASE = _HRESULT_TYPEDEF_(&h80092014)
+Const CRYPT_E_INVALID_NUMERIC_STRING = _HRESULT_TYPEDEF_(&h80092020)
+Const CRYPT_E_INVALID_PRINTABLE_STRING = _HRESULT_TYPEDEF_(&h80092021)
+Const CRYPT_E_INVALID_IA5_STRING = _HRESULT_TYPEDEF_(&h80092022)
+Const CRYPT_E_INVALID_X500_STRING = _HRESULT_TYPEDEF_(&h80092023)
+Const CRYPT_E_NOT_CHAR_STRING = _HRESULT_TYPEDEF_(&h80092024)
+Const CRYPT_E_FILERESIZED = _HRESULT_TYPEDEF_(&h80092025)
+Const CRYPT_E_SECURITY_SETTINGS = _HRESULT_TYPEDEF_(&h80092026)
+Const CRYPT_E_NO_VERIFY_USAGE_DLL = _HRESULT_TYPEDEF_(&h80092027)
+Const CRYPT_E_NO_VERIFY_USAGE_CHECK = _HRESULT_TYPEDEF_(&h80092028)
+Const CRYPT_E_VERIFY_USAGE_OFFLINE = _HRESULT_TYPEDEF_(&h80092029)
+Const CRYPT_E_NOT_IN_CTL = _HRESULT_TYPEDEF_(&h8009202A)
+Const CRYPT_E_NO_TRUSTED_SIGNER = _HRESULT_TYPEDEF_(&h8009202B)
+Const CRYPT_E_MISSING_PUBKEY_PARA = _HRESULT_TYPEDEF_(&h8009202C)
+Const CRYPT_E_OSS_ERROR = _HRESULT_TYPEDEF_(&h80093000)
+Const OSS_MORE_BUF = _HRESULT_TYPEDEF_(&h80093001)
+Const OSS_NEGATIVE_UINTEGER = _HRESULT_TYPEDEF_(&h80093002)
+Const OSS_PDU_RANGE = _HRESULT_TYPEDEF_(&h80093003)
+Const OSS_MORE_INPUT = _HRESULT_TYPEDEF_(&h80093004)
+Const OSS_DATA_ERROR = _HRESULT_TYPEDEF_(&h80093005)
+Const OSS_BAD_ARG = _HRESULT_TYPEDEF_(&h80093006)
+Const OSS_BAD_VERSION = _HRESULT_TYPEDEF_(&h80093007)
+Const OSS_OUT_MEMORY = _HRESULT_TYPEDEF_(&h80093008)
+Const OSS_PDU_MISMATCH = _HRESULT_TYPEDEF_(&h80093009)
+Const OSS_LIMITED = _HRESULT_TYPEDEF_(&h8009300A)
+Const OSS_BAD_PTR = _HRESULT_TYPEDEF_(&h8009300B)
+Const OSS_BAD_TIME = _HRESULT_TYPEDEF_(&h8009300C)
+Const OSS_INDEFINITE_NOT_SUPPORTED = _HRESULT_TYPEDEF_(&h8009300D)
+Const OSS_MEM_ERROR = _HRESULT_TYPEDEF_(&h8009300E)
+Const OSS_BAD_TABLE = _HRESULT_TYPEDEF_(&h8009300F)
+Const OSS_TOO_LONG = _HRESULT_TYPEDEF_(&h80093010)
+Const OSS_CONSTRAINT_VIOLATED = _HRESULT_TYPEDEF_(&h80093011)
+Const OSS_FATAL_ERROR = _HRESULT_TYPEDEF_(&h80093012)
+Const OSS_ACCESS_SERIALIZATION_ERROR = _HRESULT_TYPEDEF_(&h80093013)
+Const OSS_NULL_TBL = _HRESULT_TYPEDEF_(&h80093014)
+Const OSS_NULL_FCN = _HRESULT_TYPEDEF_(&h80093015)
+Const OSS_BAD_ENCRULES = _HRESULT_TYPEDEF_(&h80093016)
+Const OSS_UNAVAIL_ENCRULES = _HRESULT_TYPEDEF_(&h80093017)
+Const OSS_CANT_OPEN_TRACE_WINDOW = _HRESULT_TYPEDEF_(&h80093018)
+Const OSS_UNIMPLEMENTED = _HRESULT_TYPEDEF_(&h80093019)
+Const OSS_OID_DLL_NOT_LINKED = _HRESULT_TYPEDEF_(&h8009301A)
+Const OSS_CANT_OPEN_TRACE_FILE = _HRESULT_TYPEDEF_(&h8009301B)
+Const OSS_TRACE_FILE_ALREADY_OPEN = _HRESULT_TYPEDEF_(&h8009301C)
+Const OSS_TABLE_MISMATCH = _HRESULT_TYPEDEF_(&h8009301D)
+Const OSS_TYPE_NOT_SUPPORTED = _HRESULT_TYPEDEF_(&h8009301E)
+Const OSS_REAL_DLL_NOT_LINKED = _HRESULT_TYPEDEF_(&h8009301F)
+Const OSS_REAL_CODE_NOT_LINKED = _HRESULT_TYPEDEF_(&h80093020)
+Const OSS_OUT_OF_RANGE = _HRESULT_TYPEDEF_(&h80093021)
+Const OSS_COPIER_DLL_NOT_LINKED = _HRESULT_TYPEDEF_(&h80093022)
+Const OSS_CONSTRAINT_DLL_NOT_LINKED = _HRESULT_TYPEDEF_(&h80093023)
+Const OSS_COMPARATOR_DLL_NOT_LINKED = _HRESULT_TYPEDEF_(&h80093024)
+Const OSS_COMPARATOR_CODE_NOT_LINKED = _HRESULT_TYPEDEF_(&h80093025)
+Const OSS_MEM_MGR_DLL_NOT_LINKED = _HRESULT_TYPEDEF_(&h80093026)
+Const OSS_PDV_DLL_NOT_LINKED = _HRESULT_TYPEDEF_(&h80093027)
+Const OSS_PDV_CODE_NOT_LINKED = _HRESULT_TYPEDEF_(&h80093028)
+Const OSS_API_DLL_NOT_LINKED = _HRESULT_TYPEDEF_(&h80093029)
+Const OSS_BERDER_DLL_NOT_LINKED = _HRESULT_TYPEDEF_(&h8009302A)
+Const OSS_PER_DLL_NOT_LINKED = _HRESULT_TYPEDEF_(&h8009302B)
+Const OSS_OPEN_TYPE_ERROR = _HRESULT_TYPEDEF_(&h8009302C)
+Const OSS_MUTEX_NOT_CREATED = _HRESULT_TYPEDEF_(&h8009302D)
+Const OSS_CANT_CLOSE_TRACE_FILE = _HRESULT_TYPEDEF_(&h8009302E)
+Const CRYPT_E_ASN1_ERROR = _HRESULT_TYPEDEF_(&h80093100)
+Const CRYPT_E_ASN1_INTERNAL = _HRESULT_TYPEDEF_(&h80093101)
+Const CRYPT_E_ASN1_EOD = _HRESULT_TYPEDEF_(&h80093102)
+Const CRYPT_E_ASN1_CORRUPT = _HRESULT_TYPEDEF_(&h80093103)
+Const CRYPT_E_ASN1_LARGE = _HRESULT_TYPEDEF_(&h80093104)
+Const CRYPT_E_ASN1_CONSTRAINT = _HRESULT_TYPEDEF_(&h80093105)
+Const CRYPT_E_ASN1_MEMORY = _HRESULT_TYPEDEF_(&h80093106)
+Const CRYPT_E_ASN1_OVERFLOW = _HRESULT_TYPEDEF_(&h80093107)
+Const CRYPT_E_ASN1_BADPDU = _HRESULT_TYPEDEF_(&h80093108)
+Const CRYPT_E_ASN1_BADARGS = _HRESULT_TYPEDEF_(&h80093109)
+Const CRYPT_E_ASN1_BADREAL = _HRESULT_TYPEDEF_(&h8009310A)
+Const CRYPT_E_ASN1_BADTAG = _HRESULT_TYPEDEF_(&h8009310B)
+Const CRYPT_E_ASN1_CHOICE = _HRESULT_TYPEDEF_(&h8009310C)
+Const CRYPT_E_ASN1_RULE = _HRESULT_TYPEDEF_(&h8009310D)
+Const CRYPT_E_ASN1_UTF8 = _HRESULT_TYPEDEF_(&h8009310E)
+Const CRYPT_E_ASN1_PDU_TYPE = _HRESULT_TYPEDEF_(&h80093133)
+Const CRYPT_E_ASN1_NYI = _HRESULT_TYPEDEF_(&h80093134)
+Const CRYPT_E_ASN1_EXTENDED = _HRESULT_TYPEDEF_(&h80093201)
+Const CRYPT_E_ASN1_NOEOD = _HRESULT_TYPEDEF_(&h80093202)
+Const CERTSRV_E_BAD_REQUESTSUBJECT = _HRESULT_TYPEDEF_(&h80094001)
+Const CERTSRV_E_NO_REQUEST = _HRESULT_TYPEDEF_(&h80094002)
+Const CERTSRV_E_BAD_REQUESTSTATUS = _HRESULT_TYPEDEF_(&h80094003)
+Const CERTSRV_E_PROPERTY_EMPTY = _HRESULT_TYPEDEF_(&h80094004)
+Const CERTSRV_E_INVALID_CA_CERTIFICATE = _HRESULT_TYPEDEF_(&h80094005)
+Const CERTSRV_E_SERVER_SUSPENDED = _HRESULT_TYPEDEF_(&h80094006)
+Const CERTSRV_E_ENCODING_LENGTH = _HRESULT_TYPEDEF_(&h80094007)
+Const CERTSRV_E_ROLECONFLICT = _HRESULT_TYPEDEF_(&h80094008)
+Const CERTSRV_E_RESTRICTEDOFFICER = _HRESULT_TYPEDEF_(&h80094009)
+Const CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED = _HRESULT_TYPEDEF_(&h8009400A)
+Const CERTSRV_E_NO_VALID_KRA = _HRESULT_TYPEDEF_(&h8009400B)
+Const CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL = _HRESULT_TYPEDEF_(&h8009400C)
+Const CERTSRV_E_NO_CAADMIN_DEFINED = _HRESULT_TYPEDEF_(&h8009400D)
+Const CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE = _HRESULT_TYPEDEF_(&h8009400E)
+Const CERTSRV_E_NO_DB_SESSIONS = _HRESULT_TYPEDEF_(&h8009400F)
+Const CERTSRV_E_ALIGNMENT_FAULT = _HRESULT_TYPEDEF_(&h80094010)
+Const CERTSRV_E_ENROLL_DENIED = _HRESULT_TYPEDEF_(&h80094011)
+Const CERTSRV_E_TEMPLATE_DENIED = _HRESULT_TYPEDEF_(&h80094012)
+Const CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE = _HRESULT_TYPEDEF_(&h80094013)
+Const CERTSRV_E_UNSUPPORTED_CERT_TYPE = _HRESULT_TYPEDEF_(&h80094800)
+Const CERTSRV_E_NO_CERT_TYPE = _HRESULT_TYPEDEF_(&h80094801)
+Const CERTSRV_E_TEMPLATE_CONFLICT = _HRESULT_TYPEDEF_(&h80094802)
+Const CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED = _HRESULT_TYPEDEF_(&h80094803)
+Const CERTSRV_E_ARCHIVED_KEY_REQUIRED = _HRESULT_TYPEDEF_(&h80094804)
+Const CERTSRV_E_SMIME_REQUIRED = _HRESULT_TYPEDEF_(&h80094805)
+Const CERTSRV_E_BAD_RENEWAL_SUBJECT = _HRESULT_TYPEDEF_(&h80094806)
+Const CERTSRV_E_BAD_TEMPLATE_VERSION = _HRESULT_TYPEDEF_(&h80094807)
+Const CERTSRV_E_TEMPLATE_POLICY_REQUIRED = _HRESULT_TYPEDEF_(&h80094808)
+Const CERTSRV_E_SIGNATURE_POLICY_REQUIRED = _HRESULT_TYPEDEF_(&h80094809)
+Const CERTSRV_E_SIGNATURE_COUNT = _HRESULT_TYPEDEF_(&h8009480A)
+Const CERTSRV_E_SIGNATURE_REJECTED = _HRESULT_TYPEDEF_(&h8009480B)
+Const CERTSRV_E_ISSUANCE_POLICY_REQUIRED = _HRESULT_TYPEDEF_(&h8009480C)
+Const CERTSRV_E_SUBJECT_UPN_REQUIRED = _HRESULT_TYPEDEF_(&h8009480D)
+Const CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED = _HRESULT_TYPEDEF_(&h8009480E)
+Const CERTSRV_E_SUBJECT_DNS_REQUIRED = _HRESULT_TYPEDEF_(&h8009480F)
+Const CERTSRV_E_ARCHIVED_KEY_UNEXPECTED = _HRESULT_TYPEDEF_(&h80094810)
+Const CERTSRV_E_KEY_LENGTH = _HRESULT_TYPEDEF_(&h80094811)
+Const CERTSRV_E_SUBJECT_EMAIL_REQUIRED = _HRESULT_TYPEDEF_(&h80094812)
+Const CERTSRV_E_UNKNOWN_CERT_TYPE = _HRESULT_TYPEDEF_(&h80094813)
+Const CERTSRV_E_CERT_TYPE_OVERLAP = _HRESULT_TYPEDEF_(&h80094814)
+Const XENROLL_E_KEY_NOT_EXPORTABLE = _HRESULT_TYPEDEF_(&h80095000)
+Const XENROLL_E_CANNOT_ADD_ROOT_CERT = _HRESULT_TYPEDEF_(&h80095001)
+Const XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND = _HRESULT_TYPEDEF_(&h80095002)
+Const XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH = _HRESULT_TYPEDEF_(&h80095003)
+Const XENROLL_E_RESPONSE_KA_HASH_MISMATCH = _HRESULT_TYPEDEF_(&h80095004)
+Const XENROLL_E_KEYSPEC_SMIME_MISMATCH = _HRESULT_TYPEDEF_(&h80095005)
+Const TRUST_E_SYSTEM_ERROR = _HRESULT_TYPEDEF_(&h80096001)
+Const TRUST_E_NO_SIGNER_CERT = _HRESULT_TYPEDEF_(&h80096002)
+Const TRUST_E_COUNTER_SIGNER = _HRESULT_TYPEDEF_(&h80096003)
+Const TRUST_E_CERT_SIGNATURE = _HRESULT_TYPEDEF_(&h80096004)
+Const TRUST_E_TIME_STAMP = _HRESULT_TYPEDEF_(&h80096005)
+Const TRUST_E_BAD_DIGEST = _HRESULT_TYPEDEF_(&h80096010)
+Const TRUST_E_BASIC_CONSTRAINTS = _HRESULT_TYPEDEF_(&h80096019)
+Const TRUST_E_FINANCIAL_CRITERIA = _HRESULT_TYPEDEF_(&h8009601E)
+Const MSSIPOTF_E_OUTOFMEMRANGE = _HRESULT_TYPEDEF_(&h80097001)
+Const MSSIPOTF_E_CANTGETOBJECT = _HRESULT_TYPEDEF_(&h80097002)
+Const MSSIPOTF_E_NOHEADTABLE = _HRESULT_TYPEDEF_(&h80097003)
+Const MSSIPOTF_E_BAD_MAGICNUMBER = _HRESULT_TYPEDEF_(&h80097004)
+Const MSSIPOTF_E_BAD_OFFSET_TABLE = _HRESULT_TYPEDEF_(&h80097005)
+Const MSSIPOTF_E_TABLE_TAGORDER = _HRESULT_TYPEDEF_(&h80097006)
+Const MSSIPOTF_E_TABLE_LONGWORD = _HRESULT_TYPEDEF_(&h80097007)
+Const MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT = _HRESULT_TYPEDEF_(&h80097008)
+Const MSSIPOTF_E_TABLES_OVERLAP = _HRESULT_TYPEDEF_(&h80097009)
+Const MSSIPOTF_E_TABLE_PADBYTES = _HRESULT_TYPEDEF_(&h8009700A)
+Const MSSIPOTF_E_FILETOOSMALL = _HRESULT_TYPEDEF_(&h8009700B)
+Const MSSIPOTF_E_TABLE_CHECKSUM = _HRESULT_TYPEDEF_(&h8009700C)
+Const MSSIPOTF_E_FILE_CHECKSUM = _HRESULT_TYPEDEF_(&h8009700D)
+Const MSSIPOTF_E_FAILED_POLICY = _HRESULT_TYPEDEF_(&h80097010)
+Const MSSIPOTF_E_FAILED_HINTS_CHECK = _HRESULT_TYPEDEF_(&h80097011)
+Const MSSIPOTF_E_NOT_OPENTYPE = _HRESULT_TYPEDEF_(&h80097012)
+Const MSSIPOTF_E_FILE = _HRESULT_TYPEDEF_(&h80097013)
+Const MSSIPOTF_E_CRYPT = _HRESULT_TYPEDEF_(&h80097014)
+Const MSSIPOTF_E_BADVERSION = _HRESULT_TYPEDEF_(&h80097015)
+Const MSSIPOTF_E_DSIG_STRUCTURE = _HRESULT_TYPEDEF_(&h80097016)
+Const MSSIPOTF_E_PCONST_CHECK = _HRESULT_TYPEDEF_(&h80097017)
+Const MSSIPOTF_E_STRUCTURE = _HRESULT_TYPEDEF_(&h80097018)
+Const NTE_OP_OK = 0
+Const TRUST_E_PROVIDER_UNKNOWN = _HRESULT_TYPEDEF_(&h800B0001)
+Const TRUST_E_ACTION_UNKNOWN = _HRESULT_TYPEDEF_(&h800B0002)
+Const TRUST_E_SUBJECT_FORM_UNKNOWN = _HRESULT_TYPEDEF_(&h800B0003)
+Const TRUST_E_SUBJECT_NOT_TRUSTED = _HRESULT_TYPEDEF_(&h800B0004)
+Const DIGSIG_E_ENCODE = _HRESULT_TYPEDEF_(&h800B0005)
+Const DIGSIG_E_DECODE = _HRESULT_TYPEDEF_(&h800B0006)
+Const DIGSIG_E_EXTENSIBILITY = _HRESULT_TYPEDEF_(&h800B0007)
+Const DIGSIG_E_CRYPTO = _HRESULT_TYPEDEF_(&h800B0008)
+Const PERSIST_E_SIZEDEFINITE = _HRESULT_TYPEDEF_(&h800B0009)
+Const PERSIST_E_SIZEINDEFINITE = _HRESULT_TYPEDEF_(&h800B000A)
+Const PERSIST_E_NOTSELFSIZING = _HRESULT_TYPEDEF_(&h800B000B)
+Const TRUST_E_NOSIGNATURE = _HRESULT_TYPEDEF_(&h800B0100)
+Const CERT_E_EXPIRED = _HRESULT_TYPEDEF_(&h800B0101)
+Const CERT_E_VALIDITYPERIODNESTING = _HRESULT_TYPEDEF_(&h800B0102)
+Const CERT_E_ROLE = _HRESULT_TYPEDEF_(&h800B0103)
+Const CERT_E_PATHLENCONST = _HRESULT_TYPEDEF_(&h800B0104)
+Const CERT_E_CRITICAL = _HRESULT_TYPEDEF_(&h800B0105)
+Const CERT_E_PURPOSE = _HRESULT_TYPEDEF_(&h800B0106)
+Const CERT_E_ISSUERCHAINING = _HRESULT_TYPEDEF_(&h800B0107)
+Const CERT_E_MALFORMED = _HRESULT_TYPEDEF_(&h800B0108)
+Const CERT_E_UNTRUSTEDROOT = _HRESULT_TYPEDEF_(&h800B0109)
+Const CERT_E_CHAINING = _HRESULT_TYPEDEF_(&h800B010A)
+Const TRUST_E_FAIL = _HRESULT_TYPEDEF_(&h800B010B)
+Const CERT_E_REVOKED = _HRESULT_TYPEDEF_(&h800B010C)
+Const CERT_E_UNTRUSTEDTESTROOT = _HRESULT_TYPEDEF_(&h800B010D)
+Const CERT_E_REVOCATION_FAILURE = _HRESULT_TYPEDEF_(&h800B010E)
+Const CERT_E_CN_NO_MATCH = _HRESULT_TYPEDEF_(&h800B010F)
+Const CERT_E_WRONG_USAGE = _HRESULT_TYPEDEF_(&h800B0110)
+Const TRUST_E_EXPLICIT_DISTRUST = _HRESULT_TYPEDEF_(&h800B0111)
+Const CERT_E_UNTRUSTEDCA = _HRESULT_TYPEDEF_(&h800B0112)
+Const CERT_E_INVALID_POLICY = _HRESULT_TYPEDEF_(&h800B0113)
+Const CERT_E_INVALID_NAME = _HRESULT_TYPEDEF_(&h800B0114)
+Function HRESULT_FROM_SETUPAPI(x As Long) As HRESULT
+	If x And (APPLICATION_ERROR_MASK Or ERROR_SEVERITY_ERROR) = (APPLICATION_ERROR_MASK Or ERROR_SEVERITY_ERROR) Then
+		HRESULT_FROM_SETUPAPI = (x And &h0000FFFF) Or (FACILITY_SETUPAPI << 16) Or &h80000000
+	Else
+		HRESULT_FROM_SETUPAPI = HRESULT_FROM_WIN32(x)
+	End If
+End Function
+Const SPAPI_E_EXPECTED_SECTION_NAME = _HRESULT_TYPEDEF_(&h800F0000)
+Const SPAPI_E_BAD_SECTION_NAME_LINE = _HRESULT_TYPEDEF_(&h800F0001)
+Const SPAPI_E_SECTION_NAME_TOO_LONG = _HRESULT_TYPEDEF_(&h800F0002)
+Const SPAPI_E_GENERAL_SYNTAX = _HRESULT_TYPEDEF_(&h800F0003)
+Const SPAPI_E_WRONG_INF_STYLE = _HRESULT_TYPEDEF_(&h800F0100)
+Const SPAPI_E_SECTION_NOT_FOUND = _HRESULT_TYPEDEF_(&h800F0101)
+Const SPAPI_E_LINE_NOT_FOUND = _HRESULT_TYPEDEF_(&h800F0102)
+Const SPAPI_E_NO_BACKUP = _HRESULT_TYPEDEF_(&h800F0103)
+Const SPAPI_E_NO_ASSOCIATED_CLASS = _HRESULT_TYPEDEF_(&h800F0200)
+Const SPAPI_E_CLASS_MISMATCH = _HRESULT_TYPEDEF_(&h800F0201)
+Const SPAPI_E_DUPLICATE_FOUND = _HRESULT_TYPEDEF_(&h800F0202)
+Const SPAPI_E_NO_DRIVER_SELECTED = _HRESULT_TYPEDEF_(&h800F0203)
+Const SPAPI_E_KEY_DOES_NOT_EXIST = _HRESULT_TYPEDEF_(&h800F0204)
+Const SPAPI_E_INVALID_DEVINST_NAME = _HRESULT_TYPEDEF_(&h800F0205)
+Const SPAPI_E_INVALID_CLASS = _HRESULT_TYPEDEF_(&h800F0206)
+Const SPAPI_E_DEVINST_ALREADY_EXISTS = _HRESULT_TYPEDEF_(&h800F0207)
+Const SPAPI_E_DEVINFO_NOT_REGISTERED = _HRESULT_TYPEDEF_(&h800F0208)
+Const SPAPI_E_INVALID_REG_PROPERTY = _HRESULT_TYPEDEF_(&h800F0209)
+Const SPAPI_E_NO_INF = _HRESULT_TYPEDEF_(&h800F020A)
+Const SPAPI_E_NO_SUCH_DEVINST = _HRESULT_TYPEDEF_(&h800F020B)
+Const SPAPI_E_CANT_LOAD_CLASS_ICON = _HRESULT_TYPEDEF_(&h800F020C)
+Const SPAPI_E_INVALID_CLASS_INSTALLER = _HRESULT_TYPEDEF_(&h800F020D)
+Const SPAPI_E_DI_DO_DEFAULT = _HRESULT_TYPEDEF_(&h800F020E)
+Const SPAPI_E_DI_NOFILECOPY = _HRESULT_TYPEDEF_(&h800F020F)
+Const SPAPI_E_INVALID_HWPROFILE = _HRESULT_TYPEDEF_(&h800F0210)
+Const SPAPI_E_NO_DEVICE_SELECTED = _HRESULT_TYPEDEF_(&h800F0211)
+Const SPAPI_E_DEVINFO_LIST_LOCKED = _HRESULT_TYPEDEF_(&h800F0212)
+Const SPAPI_E_DEVINFO_DATA_LOCKED = _HRESULT_TYPEDEF_(&h800F0213)
+Const SPAPI_E_DI_BAD_PATH = _HRESULT_TYPEDEF_(&h800F0214)
+Const SPAPI_E_NO_CLASSINSTALL_PARAMS = _HRESULT_TYPEDEF_(&h800F0215)
+Const SPAPI_E_FILEQUEUE_LOCKED = _HRESULT_TYPEDEF_(&h800F0216)
+Const SPAPI_E_BAD_SERVICE_INSTALLSECT = _HRESULT_TYPEDEF_(&h800F0217)
+Const SPAPI_E_NO_CLASS_DRIVER_LIST = _HRESULT_TYPEDEF_(&h800F0218)
+Const SPAPI_E_NO_ASSOCIATED_SERVICE = _HRESULT_TYPEDEF_(&h800F0219)
+Const SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE = _HRESULT_TYPEDEF_(&h800F021A)
+Const SPAPI_E_DEVICE_INTERFACE_ACTIVE = _HRESULT_TYPEDEF_(&h800F021B)
+Const SPAPI_E_DEVICE_INTERFACE_REMOVED = _HRESULT_TYPEDEF_(&h800F021C)
+Const SPAPI_E_BAD_INTERFACE_INSTALLSECT = _HRESULT_TYPEDEF_(&h800F021D)
+Const SPAPI_E_NO_SUCH_INTERFACE_CLASS = _HRESULT_TYPEDEF_(&h800F021E)
+Const SPAPI_E_INVALID_REFERENCE_STRING = _HRESULT_TYPEDEF_(&h800F021F)
+Const SPAPI_E_INVALID_MACHINENAME = _HRESULT_TYPEDEF_(&h800F0220)
+Const SPAPI_E_REMOTE_COMM_FAILURE = _HRESULT_TYPEDEF_(&h800F0221)
+Const SPAPI_E_MACHINE_UNAVAILABLE = _HRESULT_TYPEDEF_(&h800F0222)
+Const SPAPI_E_NO_CONFIGMGR_SERVICES = _HRESULT_TYPEDEF_(&h800F0223)
+Const SPAPI_E_INVALID_PROPPAGE_PROVIDER = _HRESULT_TYPEDEF_(&h800F0224)
+Const SPAPI_E_NO_SUCH_DEVICE_INTERFACE = _HRESULT_TYPEDEF_(&h800F0225)
+Const SPAPI_E_DI_POSTPROCESSING_REQUIRED = _HRESULT_TYPEDEF_(&h800F0226)
+Const SPAPI_E_INVALID_COINSTALLER = _HRESULT_TYPEDEF_(&h800F0227)
+Const SPAPI_E_NO_COMPAT_DRIVERS = _HRESULT_TYPEDEF_(&h800F0228)
+Const SPAPI_E_NO_DEVICE_ICON = _HRESULT_TYPEDEF_(&h800F0229)
+Const SPAPI_E_INVALID_INF_LOGCONFIG = _HRESULT_TYPEDEF_(&h800F022A)
+Const SPAPI_E_DI_DONT_INSTALL = _HRESULT_TYPEDEF_(&h800F022B)
+Const SPAPI_E_INVALID_FILTER_DRIVER = _HRESULT_TYPEDEF_(&h800F022C)
+Const SPAPI_E_NON_WINDOWS_NT_DRIVER = _HRESULT_TYPEDEF_(&h800F022D)
+Const SPAPI_E_NON_WINDOWS_DRIVER = _HRESULT_TYPEDEF_(&h800F022E)
+Const SPAPI_E_NO_CATALOG_FOR_OEM_INF = _HRESULT_TYPEDEF_(&h800F022F)
+Const SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE = _HRESULT_TYPEDEF_(&h800F0230)
+Const SPAPI_E_NOT_DISABLEABLE = _HRESULT_TYPEDEF_(&h800F0231)
+Const SPAPI_E_CANT_REMOVE_DEVINST = _HRESULT_TYPEDEF_(&h800F0232)
+Const SPAPI_E_INVALID_TARGET = _HRESULT_TYPEDEF_(&h800F0233)
+Const SPAPI_E_DRIVER_NONNATIVE = _HRESULT_TYPEDEF_(&h800F0234)
+Const SPAPI_E_IN_WOW64 = _HRESULT_TYPEDEF_(&h800F0235)
+Const SPAPI_E_SET_SYSTEM_RESTORE_POINT = _HRESULT_TYPEDEF_(&h800F0236)
+Const SPAPI_E_INCORRECTLY_COPIED_INF = _HRESULT_TYPEDEF_(&h800F0237)
+Const SPAPI_E_SCE_DISABLED = _HRESULT_TYPEDEF_(&h800F0238)
+Const SPAPI_E_UNKNOWN_EXCEPTION = _HRESULT_TYPEDEF_(&h800F0239)
+Const SPAPI_E_PNP_REGISTRY_ERROR = _HRESULT_TYPEDEF_(&h800F023A)
+Const SPAPI_E_REMOTE_REQUEST_UNSUPPORTED = _HRESULT_TYPEDEF_(&h800F023B)
+Const SPAPI_E_NOT_AN_INSTALLED_OEM_INF = _HRESULT_TYPEDEF_(&h800F023C)
+Const SPAPI_E_INF_IN_USE_BY_DEVICES = _HRESULT_TYPEDEF_(&h800F023D)
+Const SPAPI_E_DI_FUNCTION_OBSOLETE = _HRESULT_TYPEDEF_(&h800F023E)
+Const SPAPI_E_NO_AUTHENTICODE_CATALOG = _HRESULT_TYPEDEF_(&h800F023F)
+Const SPAPI_E_AUTHENTICODE_DISALLOWED = _HRESULT_TYPEDEF_(&h800F0240)
+Const SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER = _HRESULT_TYPEDEF_(&h800F0241)
+Const SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED = _HRESULT_TYPEDEF_(&h800F0242)
+Const SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED = _HRESULT_TYPEDEF_(&h800F0243)
+Const SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH = _HRESULT_TYPEDEF_(&h800F0244)
+Const SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE = _HRESULT_TYPEDEF_(&h800F0245)
+Const SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW = _HRESULT_TYPEDEF_(&h800F0300)
+Const SPAPI_E_ERROR_NOT_INSTALLED = _HRESULT_TYPEDEF_(&h800F1000)
+Const SCARD_S_SUCCESS = NO_ERROR
+Const SCARD_F_INTERNAL_ERROR = _HRESULT_TYPEDEF_(&h80100001)
+Const SCARD_E_CANCELLED = _HRESULT_TYPEDEF_(&h80100002)
+Const SCARD_E_INVALID_HANDLE = _HRESULT_TYPEDEF_(&h80100003)
+Const SCARD_E_INVALID_PARAMETER = _HRESULT_TYPEDEF_(&h80100004)
+Const SCARD_E_INVALID_TARGET = _HRESULT_TYPEDEF_(&h80100005)
+Const SCARD_E_NO_MEMORY = _HRESULT_TYPEDEF_(&h80100006)
+Const SCARD_F_WAITED_TOO_LONG = _HRESULT_TYPEDEF_(&h80100007)
+Const SCARD_E_INSUFFICIENT_BUFFER = _HRESULT_TYPEDEF_(&h80100008)
+Const SCARD_E_UNKNOWN_READER = _HRESULT_TYPEDEF_(&h80100009)
+Const SCARD_E_TIMEOUT = _HRESULT_TYPEDEF_(&h8010000A)
+Const SCARD_E_SHARING_VIOLATION = _HRESULT_TYPEDEF_(&h8010000B)
+Const SCARD_E_NO_SMARTCARD = _HRESULT_TYPEDEF_(&h8010000C)
+Const SCARD_E_UNKNOWN_CARD = _HRESULT_TYPEDEF_(&h8010000D)
+Const SCARD_E_CANT_DISPOSE = _HRESULT_TYPEDEF_(&h8010000E)
+Const SCARD_E_PROTO_MISMATCH = _HRESULT_TYPEDEF_(&h8010000F)
+Const SCARD_E_NOT_READY = _HRESULT_TYPEDEF_(&h80100010)
+Const SCARD_E_INVALID_VALUE = _HRESULT_TYPEDEF_(&h80100011)
+Const SCARD_E_SYSTEM_CANCELLED = _HRESULT_TYPEDEF_(&h80100012)
+Const SCARD_F_COMM_ERROR = _HRESULT_TYPEDEF_(&h80100013)
+Const SCARD_F_UNKNOWN_ERROR = _HRESULT_TYPEDEF_(&h80100014)
+Const SCARD_E_INVALID_ATR = _HRESULT_TYPEDEF_(&h80100015)
+Const SCARD_E_NOT_TRANSACTED = _HRESULT_TYPEDEF_(&h80100016)
+Const SCARD_E_READER_UNAVAILABLE = _HRESULT_TYPEDEF_(&h80100017)
+Const SCARD_P_SHUTDOWN = _HRESULT_TYPEDEF_(&h80100018)
+Const SCARD_E_PCI_TOO_SMALL = _HRESULT_TYPEDEF_(&h80100019)
+Const SCARD_E_READER_UNSUPPORTED = _HRESULT_TYPEDEF_(&h8010001A)
+Const SCARD_E_DUPLICATE_READER = _HRESULT_TYPEDEF_(&h8010001B)
+Const SCARD_E_CARD_UNSUPPORTED = _HRESULT_TYPEDEF_(&h8010001C)
+Const SCARD_E_NO_SERVICE = _HRESULT_TYPEDEF_(&h8010001D)
+Const SCARD_E_SERVICE_STOPPED = _HRESULT_TYPEDEF_(&h8010001E)
+Const SCARD_E_UNEXPECTED = _HRESULT_TYPEDEF_(&h8010001F)
+Const SCARD_E_ICC_INSTALLATION = _HRESULT_TYPEDEF_(&h80100020)
+Const SCARD_E_ICC_CREATEORDER = _HRESULT_TYPEDEF_(&h80100021)
+Const SCARD_E_UNSUPPORTED_FEATURE = _HRESULT_TYPEDEF_(&h80100022)
+Const SCARD_E_DIR_NOT_FOUND = _HRESULT_TYPEDEF_(&h80100023)
+Const SCARD_E_FILE_NOT_FOUND = _HRESULT_TYPEDEF_(&h80100024)
+Const SCARD_E_NO_DIR = _HRESULT_TYPEDEF_(&h80100025)
+Const SCARD_E_NO_FILE = _HRESULT_TYPEDEF_(&h80100026)
+Const SCARD_E_NO_ACCESS = _HRESULT_TYPEDEF_(&h80100027)
+Const SCARD_E_WRITE_TOO_MANY = _HRESULT_TYPEDEF_(&h80100028)
+Const SCARD_E_BAD_SEEK = _HRESULT_TYPEDEF_(&h80100029)
+Const SCARD_E_INVALID_CHV = _HRESULT_TYPEDEF_(&h8010002A)
+Const SCARD_E_UNKNOWN_RES_MNG = _HRESULT_TYPEDEF_(&h8010002B)
+Const SCARD_E_NO_SUCH_CERTIFICATE = _HRESULT_TYPEDEF_(&h8010002C)
+Const SCARD_E_CERTIFICATE_UNAVAILABLE = _HRESULT_TYPEDEF_(&h8010002D)
+Const SCARD_E_NO_READERS_AVAILABLE = _HRESULT_TYPEDEF_(&h8010002E)
+Const SCARD_E_COMM_DATA_LOST = _HRESULT_TYPEDEF_(&h8010002F)
+Const SCARD_E_NO_KEY_CONTAINER = _HRESULT_TYPEDEF_(&h80100030)
+Const SCARD_E_SERVER_TOO_BUSY = _HRESULT_TYPEDEF_(&h80100031)
+Const SCARD_W_UNSUPPORTED_CARD = _HRESULT_TYPEDEF_(&h80100065)
+Const SCARD_W_UNRESPONSIVE_CARD = _HRESULT_TYPEDEF_(&h80100066)
+Const SCARD_W_UNPOWERED_CARD = _HRESULT_TYPEDEF_(&h80100067)
+Const SCARD_W_RESET_CARD = _HRESULT_TYPEDEF_(&h80100068)
+Const SCARD_W_REMOVED_CARD = _HRESULT_TYPEDEF_(&h80100069)
+Const SCARD_W_SECURITY_VIOLATION = _HRESULT_TYPEDEF_(&h8010006A)
+Const SCARD_W_WRONG_CHV = _HRESULT_TYPEDEF_(&h8010006B)
+Const SCARD_W_CHV_BLOCKED = _HRESULT_TYPEDEF_(&h8010006C)
+Const SCARD_W_EOF = _HRESULT_TYPEDEF_(&h8010006D)
+Const SCARD_W_CANCELLED_BY_USER = _HRESULT_TYPEDEF_(&h8010006E)
+Const SCARD_W_CARD_NOT_AUTHENTICATED = _HRESULT_TYPEDEF_(&h8010006F)
+Const COMADMIN_E_OBJECTERRORS = _HRESULT_TYPEDEF_(&h80110401)
+Const COMADMIN_E_OBJECTINVALID = _HRESULT_TYPEDEF_(&h80110402)
+Const COMADMIN_E_KEYMISSING = _HRESULT_TYPEDEF_(&h80110403)
+Const COMADMIN_E_ALREADYINSTALLED = _HRESULT_TYPEDEF_(&h80110404)
+Const COMADMIN_E_APP_FILE_WRITEFAIL = _HRESULT_TYPEDEF_(&h80110407)
+Const COMADMIN_E_APP_FILE_READFAIL = _HRESULT_TYPEDEF_(&h80110408)
+Const COMADMIN_E_APP_FILE_VERSION = _HRESULT_TYPEDEF_(&h80110409)
+Const COMADMIN_E_BADPATH = _HRESULT_TYPEDEF_(&h8011040A)
+Const COMADMIN_E_APPLICATIONEXISTS = _HRESULT_TYPEDEF_(&h8011040B)
+Const COMADMIN_E_ROLEEXISTS = _HRESULT_TYPEDEF_(&h8011040C)
+Const COMADMIN_E_CANTCOPYFILE = _HRESULT_TYPEDEF_(&h8011040D)
+Const COMADMIN_E_NOUSER = _HRESULT_TYPEDEF_(&h8011040F)
+Const COMADMIN_E_INVALIDUSERIDS = _HRESULT_TYPEDEF_(&h80110410)
+Const COMADMIN_E_NOREGISTRYCLSID = _HRESULT_TYPEDEF_(&h80110411)
+Const COMADMIN_E_BADREGISTRYPROGID = _HRESULT_TYPEDEF_(&h80110412)
+Const COMADMIN_E_AUTHENTICATIONLEVEL = _HRESULT_TYPEDEF_(&h80110413)
+Const COMADMIN_E_USERPASSWDNOTVALID = _HRESULT_TYPEDEF_(&h80110414)
+Const COMADMIN_E_CLSIDORIIDMISMATCH = _HRESULT_TYPEDEF_(&h80110418)
+Const COMADMIN_E_REMOTEINTERFACE = _HRESULT_TYPEDEF_(&h80110419)
+Const COMADMIN_E_DLLREGISTERSERVER = _HRESULT_TYPEDEF_(&h8011041A)
+Const COMADMIN_E_NOSERVERSHARE = _HRESULT_TYPEDEF_(&h8011041B)
+Const COMADMIN_E_DLLLOADFAILED = _HRESULT_TYPEDEF_(&h8011041D)
+Const COMADMIN_E_BADREGISTRYLIBID = _HRESULT_TYPEDEF_(&h8011041E)
+Const COMADMIN_E_APPDIRNOTFOUND = _HRESULT_TYPEDEF_(&h8011041F)
+Const COMADMIN_E_REGISTRARFAILED = _HRESULT_TYPEDEF_(&h80110423)
+Const COMADMIN_E_COMPFILE_DOESNOTEXIST = _HRESULT_TYPEDEF_(&h80110424)
+Const COMADMIN_E_COMPFILE_LOADDLLFAIL = _HRESULT_TYPEDEF_(&h80110425)
+Const COMADMIN_E_COMPFILE_GETCLASSOBJ = _HRESULT_TYPEDEF_(&h80110426)
+Const COMADMIN_E_COMPFILE_CLASSNOTAVAIL = _HRESULT_TYPEDEF_(&h80110427)
+Const COMADMIN_E_COMPFILE_BADTLB = _HRESULT_TYPEDEF_(&h80110428)
+Const COMADMIN_E_COMPFILE_NOTINSTALLABLE = _HRESULT_TYPEDEF_(&h80110429)
+Const COMADMIN_E_NOTCHANGEABLE = _HRESULT_TYPEDEF_(&h8011042A)
+Const COMADMIN_E_NOTDELETEABLE = _HRESULT_TYPEDEF_(&h8011042B)
+Const COMADMIN_E_SESSION = _HRESULT_TYPEDEF_(&h8011042C)
+Const COMADMIN_E_COMP_MOVE_LOCKED = _HRESULT_TYPEDEF_(&h8011042D)
+Const COMADMIN_E_COMP_MOVE_BAD_DEST = _HRESULT_TYPEDEF_(&h8011042E)
+Const COMADMIN_E_REGISTERTLB = _HRESULT_TYPEDEF_(&h80110430)
+Const COMADMIN_E_SYSTEMAPP = _HRESULT_TYPEDEF_(&h80110433)
+Const COMADMIN_E_COMPFILE_NOREGISTRAR = _HRESULT_TYPEDEF_(&h80110434)
+Const COMADMIN_E_COREQCOMPINSTALLED = _HRESULT_TYPEDEF_(&h80110435)
+Const COMADMIN_E_SERVICENOTINSTALLED = _HRESULT_TYPEDEF_(&h80110436)
+Const COMADMIN_E_PROPERTYSAVEFAILED = _HRESULT_TYPEDEF_(&h80110437)
+Const COMADMIN_E_OBJECTEXISTS = _HRESULT_TYPEDEF_(&h80110438)
+Const COMADMIN_E_COMPONENTEXISTS = _HRESULT_TYPEDEF_(&h80110439)
+Const COMADMIN_E_REGFILE_CORRUPT = _HRESULT_TYPEDEF_(&h8011043B)
+Const COMADMIN_E_PROPERTY_OVERFLOW = _HRESULT_TYPEDEF_(&h8011043C)
+Const COMADMIN_E_NOTINREGISTRY = _HRESULT_TYPEDEF_(&h8011043E)
+Const COMADMIN_E_OBJECTNOTPOOLABLE = _HRESULT_TYPEDEF_(&h8011043F)
+Const COMADMIN_E_APPLID_MATCHES_CLSID = _HRESULT_TYPEDEF_(&h80110446)
+Const COMADMIN_E_ROLE_DOES_NOT_EXIST = _HRESULT_TYPEDEF_(&h80110447)
+Const COMADMIN_E_START_APP_NEEDS_COMPONENTS = _HRESULT_TYPEDEF_(&h80110448)
+Const COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM = _HRESULT_TYPEDEF_(&h80110449)
+Const COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY = _HRESULT_TYPEDEF_(&h8011044A)
+Const COMADMIN_E_CAN_NOT_START_APP = _HRESULT_TYPEDEF_(&h8011044B)
+Const COMADMIN_E_CAN_NOT_EXPORT_SYS_APP = _HRESULT_TYPEDEF_(&h8011044C)
+Const COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT = _HRESULT_TYPEDEF_(&h8011044D)
+Const COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER = _HRESULT_TYPEDEF_(&h8011044E)
+Const COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE = _HRESULT_TYPEDEF_(&h8011044F)
+Const COMADMIN_E_BASE_PARTITION_ONLY = _HRESULT_TYPEDEF_(&h80110450)
+Const COMADMIN_E_START_APP_DISABLED = _HRESULT_TYPEDEF_(&h80110451)
+Const COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME = _HRESULT_TYPEDEF_(&h80110457)
+Const COMADMIN_E_CAT_INVALID_PARTITION_NAME = _HRESULT_TYPEDEF_(&h80110458)
+Const COMADMIN_E_CAT_PARTITION_IN_USE = _HRESULT_TYPEDEF_(&h80110459)
+Const COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES = _HRESULT_TYPEDEF_(&h8011045A)
+Const COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED = _HRESULT_TYPEDEF_(&h8011045B)
+Const COMADMIN_E_AMBIGUOUS_APPLICATION_NAME = _HRESULT_TYPEDEF_(&h8011045C)
+Const COMADMIN_E_AMBIGUOUS_PARTITION_NAME = _HRESULT_TYPEDEF_(&h8011045D)
+Const COMADMIN_E_REGDB_NOTINITIALIZED = _HRESULT_TYPEDEF_(&h80110472)
+Const COMADMIN_E_REGDB_NOTOPEN = _HRESULT_TYPEDEF_(&h80110473)
+Const COMADMIN_E_REGDB_SYSTEMERR = _HRESULT_TYPEDEF_(&h80110474)
+Const COMADMIN_E_REGDB_ALREADYRUNNING = _HRESULT_TYPEDEF_(&h80110475)
+Const COMADMIN_E_MIG_VERSIONNOTSUPPORTED = _HRESULT_TYPEDEF_(&h80110480)
+Const COMADMIN_E_MIG_SCHEMANOTFOUND = _HRESULT_TYPEDEF_(&h80110481)
+Const COMADMIN_E_CAT_BITNESSMISMATCH = _HRESULT_TYPEDEF_(&h80110482)
+Const COMADMIN_E_CAT_UNACCEPTABLEBITNESS = _HRESULT_TYPEDEF_(&h80110483)
+Const COMADMIN_E_CAT_WRONGAPPBITNESS = _HRESULT_TYPEDEF_(&h80110484)
+Const COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED = _HRESULT_TYPEDEF_(&h80110485)
+Const COMADMIN_E_CAT_SERVERFAULT = _HRESULT_TYPEDEF_(&h80110486)
+Const COMQC_E_APPLICATION_NOT_QUEUED = _HRESULT_TYPEDEF_(&h80110600)
+Const COMQC_E_NO_QUEUEABLE_INTERFACES = _HRESULT_TYPEDEF_(&h80110601)
+Const COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE = _HRESULT_TYPEDEF_(&h80110602)
+Const COMQC_E_NO_IPERSISTSTREAM = _HRESULT_TYPEDEF_(&h80110603)
+Const COMQC_E_BAD_MESSAGE = _HRESULT_TYPEDEF_(&h80110604)
+Const COMQC_E_UNAUTHENTICATED = _HRESULT_TYPEDEF_(&h80110605)
+Const COMQC_E_UNTRUSTED_ENQUEUER = _HRESULT_TYPEDEF_(&h80110606)
+Const MSDTC_E_DUPLICATE_RESOURCE = _HRESULT_TYPEDEF_(&h80110701)
+Const COMADMIN_E_OBJECT_PARENT_MISSING = _HRESULT_TYPEDEF_(&h80110808)
+Const COMADMIN_E_OBJECT_DOES_NOT_EXIST = _HRESULT_TYPEDEF_(&h80110809)
+Const COMADMIN_E_APP_NOT_RUNNING = _HRESULT_TYPEDEF_(&h8011080A)
+Const COMADMIN_E_INVALID_PARTITION = _HRESULT_TYPEDEF_(&h8011080B)
+Const COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE = _HRESULT_TYPEDEF_(&h8011080D)
+Const COMADMIN_E_USER_IN_SET = _HRESULT_TYPEDEF_(&h8011080E)
+Const COMADMIN_E_CANTRECYCLELIBRARYAPPS = _HRESULT_TYPEDEF_(&h8011080F)
+Const COMADMIN_E_CANTRECYCLESERVICEAPPS = _HRESULT_TYPEDEF_(&h80110811)
+Const COMADMIN_E_PROCESSALREADYRECYCLED = _HRESULT_TYPEDEF_(&h80110812)
+Const COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED = _HRESULT_TYPEDEF_(&h80110813)
+Const COMADMIN_E_CANTMAKEINPROCSERVICE = _HRESULT_TYPEDEF_(&h80110814)
+Const COMADMIN_E_PROGIDINUSEBYCLSID = _HRESULT_TYPEDEF_(&h80110815)
+Const COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET = _HRESULT_TYPEDEF_(&h80110816)
+Const COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED = _HRESULT_TYPEDEF_(&h80110817)
+Const COMADMIN_E_PARTITION_ACCESSDENIED = _HRESULT_TYPEDEF_(&h80110818)
+Const COMADMIN_E_PARTITION_MSI_ONLY = _HRESULT_TYPEDEF_(&h80110819)
+Const COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT = _HRESULT_TYPEDEF_(&h8011081A)
+Const COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS = _HRESULT_TYPEDEF_(&h8011081B)
+Const COMADMIN_E_COMP_MOVE_SOURCE = _HRESULT_TYPEDEF_(&h8011081C)
+Const COMADMIN_E_COMP_MOVE_DEST = _HRESULT_TYPEDEF_(&h8011081D)
+Const COMADMIN_E_COMP_MOVE_PRIVATE = _HRESULT_TYPEDEF_(&h8011081E)
+Const COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET = _HRESULT_TYPEDEF_(&h8011081F)
+Const COMADMIN_E_CANNOT_ALIAS_EVENTCLASS = _HRESULT_TYPEDEF_(&h80110820)
+Const COMADMIN_E_PRIVATE_ACCESSDENIED = _HRESULT_TYPEDEF_(&h80110821)
+Const COMADMIN_E_SAFERINVALID = _HRESULT_TYPEDEF_(&h80110822)
+Const COMADMIN_E_REGISTRY_ACCESSDENIED = _HRESULT_TYPEDEF_(&h80110823)
+Const COMADMIN_E_PARTITIONS_DISABLED = _HRESULT_TYPEDEF_(&h80110824)
Index: /trunk/ab5.0/ablib/src/api_wininet.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_wininet.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_wininet.sbp	(revision 506)
@@ -0,0 +1,104 @@
+' api_wininet.sbp
+
+#ifdef UNICODE
+Const _FuncName_InternetOpen = "InternetOpenW"
+Const _FuncName_InternetConnect = "InternetConnectW"
+Const _FuncName_FtpGetFile = "FtpGetFileW"
+Const _FuncName_FtpGetCurrentDirectory = "FtpGetCurrentDirectoryW"
+Const _FuncName_FtpSetCurrentDirectory = "FtpSetCurrentDirectoryW"
+Const _FuncName_FtpFindFirstFile = "FtpFindFirstFileW"
+Const _FuncName_InternetFindNextFile = "InternetFindNextFileW"
+#else
+Const _FuncName_InternetOpen = "InternetOpenA"
+Const _FuncName_InternetConnect = "InternetConnectA"
+Const _FuncName_FtpGetFile = "FtpGetFileA"
+Const _FuncName_FtpGetCurrentDirectory = "FtpGetCurrentDirectoryA"
+Const _FuncName_FtpSetCurrentDirectory = "FtpSetCurrentDirectoryA"
+Const _FuncName_FtpFindFirstFile = "FtpFindFirstFileA"
+Const _FuncName_InternetFindNextFile = "InternetFindNextFileA"
+#endif
+
+TypeDef HINTERNET = VoidPtr
+
+TypeDef INTERNET_PORT = Word
+
+
+Const INTERNET_FLAG_RELOAD = &H80000000  'retrieve the original item
+
+
+Const FTP_TRANSFER_TYPE_UNKNOWN = &H00000000
+Const FTP_TRANSFER_TYPE_ASCII   = &H00000001
+Const FTP_TRANSFER_TYPE_BINARY  = &H00000002
+
+
+Const INTERNET_OPEN_TYPE_PRECONFIG                   = 0   'use registry configuration
+Const INTERNET_OPEN_TYPE_DIRECT                      = 1   'direct to net
+Const INTERNET_OPEN_TYPE_PROXY                       = 3   'via named proxy
+Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4   'prevent using java/script/INS
+
+Declare Function InternetOpen Lib "wininet.dll" Alias _FuncName_InternetOpen (
+	lpszAgent As LPCTSTR,
+	dwAccessType As DWord,
+	lpszProxy As LPCTSTR,
+	lpszProxyBypass As LPCTSTR,
+	dwFlags As DWord) As HINTERNET
+
+Const INTERNET_SERVICE_FTP    = 1
+Const INTERNET_SERVICE_GOPHER = 2
+Const INTERNET_SERVICE_HTTP   = 3
+
+Const INTERNET_FLAG_PASSIVE   = &H08000000  'used for FTP connections
+
+Const INTERNET_INVALID_PORT_NUMBER   = 0           'use the protocol-specific default
+Const INTERNET_DEFAULT_FTP_PORT      = 21          'default for FTP servers
+Const INTERNET_DEFAULT_GOPHER_PORT   = 70          '   "     "  gopher "
+Const INTERNET_DEFAULT_HTTP_PORT     = 80          '   "     "  HTTP   "
+Const INTERNET_DEFAULT_HTTPS_PORT    = 443         '   "     "  HTTPS  "
+Const INTERNET_DEFAULT_SOCKS_PORT    = 1080        'default for SOCKS firewall servers.
+
+Declare Function InternetConnect Lib "wininet.dll" Alias _FuncName_InternetConnect (
+	hInternet As HINTERNET,
+	lpszServerName As LPCTSTR,
+	nServerPort As INTERNET_PORT,
+	lpszUserName As LPCTSTR,
+	lpszPassword As LPCTSTR,
+	dwService As DWord,
+	dwFlags As DWord,
+	dwContext As DWORD_PTR) As HINTERNET
+
+Declare Function InternetCloseHandle Lib "wininet.dll" (hInternet As HINTERNET) As BOOL
+
+
+
+'----------------
+' FTP
+'----------------
+
+Declare Function FtpGetFile Lib "wininet.dll" Alias _FuncName_FtpGetFile (
+	hConnect As HINTERNET,
+	lpszRemoteFile As LPCTSTR,
+	lpszNewFile As LPCTSTR,
+	fFailIfExists As BOOL,
+	dwFlagsAndAttributes As DWord,
+	dwFlags As DWord,
+	dwContext As DWORD_PTR) As BOOL
+
+Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias _FuncName_FtpGetCurrentDirectory (
+	hConnect As HINTERNET,
+	lpszCurrentDirectory As LPTSTR,
+	lpdwCurrentDirectory As DWord) As BOOL
+
+Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias _FuncName_FtpSetCurrentDirectory (
+	hConnect As HINTERNET,
+	lpszDirectory As LPCTSTR) As BOOL
+
+Declare Function FtpFindFirstFile Lib "wininet.dll" Alias _FuncName_FtpFindFirstFile (
+	hConnect As HINTERNET,
+	lpszSearchFile As LPCTSTR,
+	ByRef FindFileData As WIN32_FIND_DATA,
+	dwFlags As DWord,
+	dwContext As DWORD_PTR) As HINTERNET
+
+Declare Function InternetFindNextFile Lib "wininet.dll" Alias _FuncName_InternetFindNextFile (
+	hFind As HINTERNET,
+	ByREf vFindData As Any) As BOOL
Index: /trunk/ab5.0/ablib/src/api_winsock2.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_winsock2.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_winsock2.sbp	(revision 506)
@@ -0,0 +1,2120 @@
+#ifndef _WINSOCK2API_
+#define _WINSOCK2API_
+#define _WINSOCKAPI_
+
+Const WINSOCK_VERSION = MAKEWORD(2, 2)
+
+TypeDef SOCKET = ULONG_PTR
+
+Const FD_SETSIZE = 64
+
+Type fd_set
+	fd_count As DWord
+	fd_array[ELM(FD_SETSIZE)] As SOCKET
+End Type
+
+Declare Function __WSAFDIsSet Lib "ws2_32" (fd As SOCKET, ByRef set As fd_set) As Long
+
+Sub FD_CLR(fd As SOCKET, ByRef set As fd_set)
+	Dim i As DWord
+	With set
+		For i = 0 To .fd_count
+			If .fd_array[i] = fd Then
+				While i < .fd_count - 1
+					.fd_array[i] = .fd_array[i + 1]
+				WEnd
+				.fd_count--
+				Exit For
+			End If
+		Next
+	End With
+End Sub
+
+Sub FD_SET(fd As SOCKET, ByRef set As fd_set)
+	Dim i As DWord
+	With set
+		For i = 0 To ELM(.fd_count)
+			If .fd_array[i] = fd Then
+				Exit Sub
+			End If
+		Next
+		If i = .fd_count Then
+			If .fd_count < FD_SETSIZE Then
+				.fd_array[i] = fd
+				.fd_count++
+			End If
+		End If
+	End With
+End Sub
+
+Sub FD_ZERO(ByRef set As fd_set)
+	set.fd_count = 0
+End Sub
+
+Const FD_ISSET(fd, set) = __WSAFDIsSet(fd, set)
+
+Type timeval
+	tv_sec As  Long
+	tv_usec As  Long
+End Type
+
+' Operations on timevals.
+Function timerisset(ByRef tvp As timeval) As BOOL
+	Return tvp.tv_sec Or tvp.tv_usec
+End Function
+
+/*
+#define timercmp(tvp, uvp, cmp) \
+        ((tvp)->tv_sec cmp (uvp)->tv_sec || \
+         (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
+*/
+
+Sub timerclear(ByRef tvp As timeval)
+	tvp.tv_sec = 0
+	tvp.tv_usec = 0
+End Sub
+
+' Commands for ioctlsocket(),  taken from the BSD file fcntl.h.
+Const IOCPARM_MASK = &h7f
+Const IOC_VOID = &h20000000
+Const IOC_OUT = &h40000000
+Const IOC_IN = &h80000000
+Const IOC_INOUT= (IOC_IN Or IOC_OUT)
+
+Const _IO(x ,y) = (IOC_VOID Or (x << 8) Or y)
+
+Const _IOR(x, y, size) = (IOC_OUT Or ((size And IOCPARM_MASK) << 16) Or ((x) << 8) Or (y))
+
+Const _IOW(x, y, size) = (IOC_IN Or ((size And IOCPARM_MASK) << 16) Or ((x) << 8) Or (y))
+
+Const FIONREAD = _IOR(&h66,127, SizeOf (DWord)) '&h66は'f'
+Const FIONBIO = _IOW(&h66,126, SizeOf (DWord))
+Const FIOASYNC = _IOW(&h66,125, SizeOf (DWord))
+
+' Socket I/O Controls
+Const SIOCSHIWAT = _IOW(&h73, 0, SizeOf (DWord)) '&h73は's'
+Const SIOCGHIWAT = _IOR(&h73, 1, SizeOf (DWord))
+Const SIOCSLOWAT = _IOW(&h73, 2, SizeOf (DWord))
+Const SIOCGLOWAT = _IOR(&h73, 3, SizeOf (DWord))
+Const SIOCATMARK = _IOR(&h73, 7, SizeOf (DWord))
+
+
+Type /*Class*/ hostent
+'Public
+	h_name As *Byte
+	h_aliases As **Byte
+	h_addrtype As Integer
+	h_lengt As Integer
+	h_addr_list As **Byte
+/*
+	Function h_addr() As *Byte
+		Return h_addr_list[0]
+	End Function
+
+	Sub h_addr(l As *Byte)
+		h_addr_list[0] = i
+	End Sub
+*/
+End Type 'Class
+
+Type netent
+	FAR * n_name As *Byte
+	FAR * FAR * n_aliases As **Byte
+	n_addrtyp As Integer
+	n_net As DWord
+End Type
+
+Type servent
+	s_name As *Byte
+	s_aliases As **Byte
+#ifdef _WIN64
+	s_proto As *Byte
+	s_port As Integer
+#else
+	s_port As Integer
+	s_proto As *Byte
+#endif
+End Type
+
+Type protoent
+	p_name As *Byte
+	p_aliases As **Byte
+	p_proto As Integer
+End Type
+
+' Protocols
+Const IPPROTO_IP = 0
+Const IPPROTO_HOPOPTS = 0
+Const IPPROTO_ICMP = 1
+Const IPPROTO_IGMP = 2
+Const IPPROTO_GGP = 3
+Const IPPROTO_IPV4 = 4
+Const IPPROTO_TCP = 6
+Const IPPROTO_PUP = 12
+Const IPPROTO_UDP = 17
+Const IPPROTO_IDP = 22
+Const IPPROTO_IPV6 = 41
+Const IPPROTO_ROUTING = 43
+Const IPPROTO_FRAGMENT = 44
+Const IPPROTO_ESP = 50
+Const IPPROTO_AH = 51
+Const IPPROTO_ICMPV6 = 58
+Const IPPROTO_NONE = 59
+Const IPPROTO_DSTOPTS = 60
+Const IPPROTO_ND = 77
+Const IPPROTO_ICLFXBM = 78
+
+Const IPPROTO_RAW = 255
+Const IPPROTO_MAX = 256
+
+' Port/socket numbers: network standard functions
+Const IPPORT_ECHO = 7
+Const IPPORT_DISCARD = 9
+Const IPPORT_SYSTAT = 11
+Const IPPORT_DAYTIME = 13
+Const IPPORT_NETSTAT = 15
+Const IPPORT_FTP = 21
+Const IPPORT_TELNET = 23
+Const IPPORT_SMTP = 25
+Const IPPORT_TIMESERVER = 37
+Const IPPORT_NAMESERVER = 42
+Const IPPORT_WHOIS = 43
+Const IPPORT_MTP = 57
+
+' Port/socket numbers: host specific functions
+Const IPPORT_TFTP = 69
+Const IPPORT_RJE = 77
+Const IPPORT_FINGER = 79
+Const IPPORT_TTYLINK = 87
+Const IPPORT_SUPDUP = 95
+
+' UNIX TCP sockets
+Const IPPORT_EXECSERVER = 512
+Const IPPORT_LOGINSERVER = 513
+Const IPPORT_CMDSERVER = 514
+Const IPPORT_EFSSERVER = 520
+
+' UNIX UDP sockets
+Const IPPORT_BIFFUDP = 512
+Const IPPORT_WHOSERVER = 513
+Const IPPORT_ROUTESERVER = 520
+' 520+1 also used
+
+' Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root).
+Const IPPORT_RESERVED = 1024
+
+' Link numbers
+Const IMPLINK_IP = 155
+Const IMPLINK_LOWEXPER = 156
+Const IMPLINK_HIGHEXPER = 158
+
+' Internet address (old style... should be updated)
+Type /*Class*/ in_addr
+'Public
+/*
+	Union S_un
+		S_un_b As Type
+			s_b1 As Byte
+			s_b2 As Byte
+			s_b3 As Byte
+			s_b4 As Byte
+		End Type
+		S_un_w As Type
+			s_w1 As Word
+			s_w2 As Word
+		End Type
+		S_addr As DWord
+	End Union
+*/
+	s_addr As DWord
+/*
+	Function s_host() As Byte
+		Return GetByte(VarPtr(s_addr) + 1)
+	End Function
+
+	Sub s_host(h As Byte)
+		Return SetByte(VarPtr(s_addr) + 2, h)
+	End Sub
+
+	Function s_net() As Byte
+		Return GetByte(VarPtr(s_addr) + 0)
+	End Function
+
+	Sub s_net(n As Byte)
+		Return SetByte(VarPtr(s_addr) + 0, n)
+	End Sub
+
+	Function s_imp() As Word
+		Return GetWord(VarPtr(s_addr) + 1)
+	End Function
+
+	Sub s_imp(i As Word)
+		Return SetWord(VarPtr(s_addr) + 1, i)
+	End Sub
+
+	Function s_impno() As Byte
+		Return GetByte(VarPtr(s_addr) + 3)
+	End Function
+
+	Sub s_impno(i As Byte)
+		Return SetByte(VarPtr(s_addr) + 3, i)
+	End Sub
+
+	Function s_lh() As Byte
+		Return GetByte(VarPtr(s_addr) + 2)
+	End Function
+
+	Sub s_lh(l As Byte)
+		Return SetByte(VarPtr(s_addr) + 2, l)
+	End Sub
+*/
+End Type 'Class
+
+Const IN_CLASSA(i) = (((i) As DWord And &h80000000) = 0)
+Const IN_CLASSA_NET = &hff000000
+Const IN_CLASSA_NSHIFT = 24
+Const IN_CLASSA_HOST = &h00ffffff
+Const IN_CLASSA_MAX = 128
+
+Const IN_CLASSB(i) = (((i) As DWord & &hc0000000) = &h80000000)
+Const IN_CLASSB_NET= &hffff0000
+Const IN_CLASSB_NSHIFT = 16
+Const IN_CLASSB_HOST = &h0000ffff
+Const IN_CLASSB_MAX = 65536
+
+Const IN_CLASSC(i) = (((i) As DWord And &he0000000) = &hc0000000)
+Const IN_CLASSC_NET = &hffffff00
+Const IN_CLASSC_NSHIFT = 8
+Const IN_CLASSC_HOST = &h000000ff
+
+Const IN_CLASSD(i) = (((i) As DWord And &hf0000000) = &he0000000)
+Const IN_CLASSD_NET  = &hf0000000
+Const IN_CLASSD_NSHIFT = 28
+Const IN_CLASSD_HOST = &h0fffffff
+Const IN_MULTICAST(i) = IN_CLASSD(i)
+
+Const INADDR_ANY = &h00000000 As DWord
+Const INADDR_LOOPBACK = &h7f000001
+Const INADDR_BROADCAST = &hffffffff As DWord
+Const INADDR_NONE = &hffffffff
+
+Const ADDR_ANY = INADDR_ANY
+
+' Socket address, internet style.
+Type sockaddr_in
+	sin_family As Integer
+	sin_port As Word
+	sin_addr As in_addr
+	sin_zero[ELM(8)] As Byte
+End Type
+
+Const WSADESCRIPTION_LEN = 256
+Const WSASYS_STATUS_LEN = 128
+
+Type WSADATA
+	wVersion As Word
+	wHighVersion As Word
+#ifdef _WIN64
+	iMaxSockets As Word
+	iMaxUdpDg As Word
+	lpVendorInfo As *Byte
+	szDescription[WSADESCRIPTION_LEN] As Byte
+	szSystemStatus[WSASYS_STATUS_LEN] As Byte
+#else
+	szDescription[WSADESCRIPTION_LEN] As Byte
+	szSystemStatus[WSASYS_STATUS_LEN] As Byte
+	iMaxSockets As Word
+	iMaxUdpDg As Word
+	lpVendorInfo As *Byte
+#endif
+End Type
+
+TypeDef LPWSADATA = *WSADATA
+
+' Definitions related to sockets: types, address families, options,  taken from the BSD file sys/socket.h.
+
+Const INVALID_SOCKET = (Not 0) As ULONG_PTR
+Const SOCKET_ERROR = (-1)
+
+Const FROM_PROTOCOL_INFO = (-1)
+
+' Types
+Const SOCK_STREAM = 1
+Const SOCK_DGRAM = 2
+Const SOCK_RAW = 3
+Const SOCK_RDM = 4
+Const SOCK_SEQPACKET = 5
+
+' Option flags per-socket.
+Const SO_DEBUG = &h0001
+Const SO_ACCEPTCONN = &h0002
+Const SO_REUSEADDR = &h0004
+Const SO_KEEPALIVE = &h0008
+Const SO_DONTROUTE = &h0010
+Const SO_BROADCAST = &h0020
+Const SO_USELOOPBACK = &h0040
+Const SO_LINGER = &h0080
+Const SO_OOBINLINE = &h0100
+
+Const SO_DONTLINGER = ((Not SO_LINGER) As Long)
+Const SO_EXCLUSIVEADDRUSE = ((Not SO_REUSEADDR) As Long)
+
+' Additional options.
+Const SO_SNDBUF = &h1001
+Const SO_RCVBUF = &h1002
+Const SO_SNDLOWAT = &h1003
+Const SO_RCVLOWAT = &h1004
+Const SO_SNDTIMEO = &h1005
+Const SO_RCVTIMEO = &h1006
+Const SO_ERROR = &h1007
+Const SO_TYPE = &h1008
+
+' WinSock 2 extension -- new options
+Const SO_GROUP_ID = &h2001
+Const SO_GROUP_PRIORITY = &h2002
+Const SO_MAX_MSG_SIZE = &h2003
+Const SO_PROTOCOL_INFOA = &h2004
+Const SO_PROTOCOL_INFOW = &h2005
+#ifdef UNICODE
+Const SO_PROTOCOL_INFO = SO_PROTOCOL_INFOW
+#else
+Const SO_PROTOCOL_INFO = SO_PROTOCOL_INFOA
+#endif /* UNICODE */
+Const PVD_CONFIG = &h3001
+Const SO_CONDITIONAL_ACCEPT = &h3002
+
+' TCP options.
+Const TCP_NODELAY = &h0001
+
+' Address families.
+Const AF_UNSPEC = 0
+Const AF_UNIX = 1
+Const AF_INET = 2
+Const AF_IMPLINK = 3
+Const AF_PUP = 4
+Const AF_CHAOS = 5
+Const AF_NS = 6
+Const AF_IPX = AF_NS
+Const AF_ISO = 7
+Const AF_OSI = AF_ISO
+Const AF_ECMA = 8
+Const AF_DATAKIT = 9
+Const AF_CCITT = 10
+Const AF_SNA = 11
+Const AF_DECnet = 12
+Const AF_DLI = 13
+Const AF_LAT = 14
+Const AF_HYLINK = 15
+Const AF_APPLETALK = 16
+Const AF_NETBIOS = 17
+Const AF_VOICEVIEW = 18
+Const AF_FIREFOX = 19
+Const AF_UNKNOWN1 = 20
+Const AF_BAN = 21
+Const AF_ATM = 22
+Const AF_INET6 = 23
+Const AF_CLUSTER = 24
+Const AF_12844 = 25
+Const AF_IRDA = 26
+Const AF_NETDES = 28
+
+Const AF_TCNPROCESS = 29
+Const AF_TCNMESSAGE = 30
+Const AF_ICLFXBM = 31
+
+Const AF_MAX = 32
+
+' Structure used by kernel to store most addresses.
+Type sockaddr
+	sa_family As Word
+	sa_data[ELM(14)] As Byte
+End Type
+
+' Portable socket structure (RFC 2553).
+
+' Desired design of maximum size and alignment.
+' These are implementation specific.
+Const _SS_MAXSIZE = 128 ' Maximum size.
+Const _SS_ALIGNSIZE = (SizeOf (Int64)) 'Desired alignment.
+
+' Definitions used for sockaddr_storage structure paddings design.
+Const _SS_PAD1SIZE = (_SS_ALIGNSIZE - SizeOf (Integer))
+Const _SS_PAD2SIZE = (_SS_MAXSIZE - (SizeOf (Integer) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
+
+Type sockaddr_storage
+	ss_family As Integer
+	__ss_pad1[ELM(_SS_PAD1SIZE)] As Byte
+	__ss_align As Int64
+	__ss_pad2[ELM(_SS_PAD2SIZE)] As Byte
+End Type
+
+Type sockproto
+	sp_family As Word
+	sp_protocol As Word
+End Type
+
+' Protocol families, same as address families for now.
+Const PF_UNSPEC = AF_UNSPEC
+Const PF_UNIX = AF_UNIX
+Const PF_INET = AF_INET
+Const PF_IMPLINK = AF_IMPLINK
+Const PF_PUP = AF_PUP
+Const PF_CHAOS = AF_CHAOS
+Const PF_NS = AF_NS
+Const PF_IPX = AF_IPX
+Const PF_ISO = AF_ISO
+Const PF_OSI = AF_OSI
+Const PF_ECMA = AF_ECMA
+Const PF_DATAKIT = AF_DATAKIT
+Const PF_CCITT = AF_CCITT
+Const PF_SNA = AF_SNA
+Const PF_DECnet = AF_DECnet
+Const PF_DLI = AF_DLI
+Const PF_LAT = AF_LAT
+Const PF_HYLINK = AF_HYLINK
+Const PF_APPLETALK = AF_APPLETALK
+Const PF_VOICEVIEW = AF_VOICEVIEW
+Const PF_FIREFOX = AF_FIREFOX
+Const PF_UNKNOWN1 = AF_UNKNOWN1
+Const PF_BAN = AF_BAN
+Const PF_ATM = AF_ATM
+Const PF_INET6 = AF_INET6
+
+Const PF_MAX = AF_MAX
+
+' Structure used for manipulating linger option.
+Type linger
+	l_onoff As Word
+	l_linger As Word
+End Type
+
+' Level number for (get/set)sockopt() to apply to socket itself.
+Const SOL_SOCKET = &hffff
+
+' Maximum queue length specifiable by listen.
+Const SOMAXCONN = &h7fffffff
+
+Const MSG_OOB = &h1
+Const MSG_PEEK = &h2
+Const MSG_DONTROUTE = &h4
+Const MSG_WAITALL = &h8
+
+Const MSG_PARTIAL = &h8000
+
+' WinSock 2 extension -- new flags for WSASend(), WSASendTo(), WSARecv() and
+'                          WSARecvFrom()
+Const MSG_INTERRUPT = &h10
+
+Const MSG_MAXIOVLEN = 16
+
+' Define constant based on rfc883, used by gethostbyxxxx() calls.
+Const MAXGETHOSTSTRUCT = 1024
+
+' WinSock 2 extension -- bit values and indices for FD_XXX network events
+Const FD_READ_BIT = 0
+Const FD_READ = (1 << FD_READ_BIT)
+
+Const FD_WRITE_BIT = 1
+Const FD_WRITE = (1 << FD_WRITE_BIT)
+
+Const FD_OOB_BIT = 2
+Const FD_OOB = (1 << FD_OOB_BIT)
+
+Const FD_ACCEPT_BIT = 3
+Const FD_ACCEPT = (1 << FD_ACCEPT_BIT)
+
+Const FD_CONNECT_BIT = 4
+Const FD_CONNECT = (1 << FD_CONNECT_BIT)
+
+Const FD_CLOSE_BIT = 5
+Const FD_CLOSE = (1 << FD_CLOSE_BIT)
+
+Const FD_QOS_BIT = 6
+Const FD_QOS = (1 << FD_QOS_BIT)
+
+Const FD_GROUP_QOS_BIT = 7
+Const FD_GROUP_QOS = (1 << FD_GROUP_QOS_BIT)
+
+Const FD_ROUTING_INTERFACE_CHANGE_BIT = 8
+Const FD_ROUTING_INTERFACE_CHANGE = (1 << FD_ROUTING_INTERFACE_CHANGE_BIT)
+
+Const FD_ADDRESS_LIST_CHANGE_BIT = 9
+Const FD_ADDRESS_LIST_CHANGE = (1 << FD_ADDRESS_LIST_CHANGE_BIT)
+
+Const FD_MAX_EVENTS = 10
+Const FD_ALL_EVENTS = ((1 << FD_MAX_EVENTS) - 1)
+
+#require <api_winerror.sbp>
+
+' Compatibility macros.
+
+'Const h_errno = WSAGetLastError()
+Const HOST_NOT_FOUND = WSAHOST_NOT_FOUND
+Const TRY_AGAIN = WSATRY_AGAIN
+Const NO_RECOVERY = WSANO_RECOVERY
+Const NO_DATA = WSANO_DATA
+Const WSANO_ADDRESS = WSANO_DATA
+Const NO_ADDRESS = WSANO_ADDRESS
+
+' WinSock 2 extension -- new error codes and type definition
+
+'#ifdef _WIN32
+
+TypeDef WSAEVENT = HANDLE
+TypeDef LPWSAEVENT = *HANDLE
+TypeDef WSAOVERLAPPED = OVERLAPPED
+TypeDef LPWSAOVERLAPPED = *OVERLAPPED
+
+Const WSA_IO_PENDING = (ERROR_IO_PENDING)
+Const WSA_IO_INCOMPLETE = (ERROR_IO_INCOMPLETE)
+Const WSA_INVALID_HANDLE = (ERROR_INVALID_HANDLE)
+Const WSA_INVALID_PARAMETER = (ERROR_INVALID_PARAMETER)
+Const WSA_NOT_ENOUGH_MEMORY = (ERROR_NOT_ENOUGH_MEMORY)
+Const WSA_OPERATION_ABORTED = (ERROR_OPERATION_ABORTED)
+
+Const WSA_INVALID_EVENT = (0 As WSAEVENT)
+Const WSA_MAXIMUM_WAIT_EVENTS = (MAXIMUM_WAIT_OBJECTS)
+Const WSA_WAIT_FAILED = (WAIT_FAILED)
+Const WSA_WAIT_EVENT_0 = (WAIT_OBJECT_0)
+Const WSA_WAIT_IO_COMPLETION = (WAIT_IO_COMPLETION)
+Const WSA_WAIT_TIMEOUT = (WAIT_TIMEOUT)
+Const WSA_INFINITE = (INFINITE)
+
+'#elif defined _WIN16
+'#endif
+
+Type WSABUF
+	len As DWord
+	buf As *Byte
+End Type
+TypeDef LPWSABUF = *WSABUF
+
+#require <qos.ab>
+
+Type QOS 'struct _QualityOfService
+	SendingFlowspec As FLOWSPEC
+	ReceivingFlowspec As FLOWSPEC
+	ProviderSpecific As WSABUF
+End Type
+TypeDef LPQOS = *QOS
+
+' WinSock 2 extension -- manifest constants for return values of the condition function
+Const CF_ACCEPT = &h0000
+Const CF_REJECT = &h0001
+Const CF_DEFER = &h0002
+
+' WinSock 2 extension -- manifest constants for shutdown()
+Const SD_RECEIVE = &h00
+Const SD_SEND = &h01
+Const SD_BOTH = &h02
+
+' WinSock 2 extension -- data type and manifest constants for socket groups
+TypeDef GROUP = DWord
+
+Const SG_UNCONSTRAINED_GROUP = &h01
+Const SG_CONSTRAINED_GROUP = &h02
+
+' WinSock 2 extension -- data type for WSAEnumNetworkEvents()
+Type WSANETWORKEVENTS
+	lNetworkEvents As Long
+	iErrorCode[ELM(FD_MAX_EVENTS)] As Long
+End Type
+TypeDef LPWSANETWORKEVENTS = *WSANETWORKEVENTS
+
+' WinSock 2 extension -- WSAPROTOCOL_INFO structure and associated
+' manifest constants
+
+Const MAX_PROTOCOL_CHAIN = 7
+
+Const BASE_PROTOCOL = 1
+Const LAYERED_PROTOCOL = 0
+
+Type WSAPROTOCOLCHAIN
+	ChainLen As Long
+	ChainEntries[ELM(MAX_PROTOCOL_CHAIN)] As DWord
+End Type
+TypeDef LPWSAPROTOCOLCHAIN = *WSAPROTOCOLCHAIN
+
+Const WSAPROTOCOL_LEN = 255
+
+Type WSAPROTOCOL_INFOA
+	dwServiceFlags1 As DWord
+	dwServiceFlags2 As DWord
+	dwServiceFlags3 As DWord
+	dwServiceFlags4 As DWord
+	dwProviderFlags As DWord
+	ProviderId As GUID
+	dwCatalogEntryId As DWord
+	ProtocolChain As WSAPROTOCOLCHAIN
+	iVersion As Long
+	iAddressFamily As Long
+	iMaxSockAddr As Long
+	iMinSockAddr As Long
+	iSocketType As Long
+	iProtocol As Long
+	iProtocolMaxOffset As Long
+	iNetworkByteOrder As Long
+	iSecurityScheme As Long
+	dwMessageSize As DWord
+	dwProviderReserved As DWord
+	szProtocol[WSAPROTOCOL_LEN] As Byte
+End Type
+TypeDef LPWSAPROTOCOL_INFOA = *WSAPROTOCOL_INFOA
+
+Type WSAPROTOCOL_INFOW
+	dwServiceFlags1 As DWord
+	dwServiceFlags2 As DWord
+	dwServiceFlags3 As DWord
+	dwServiceFlags4 As DWord
+	dwProviderFlags As DWord
+	ProviderId As GUID
+	dwCatalogEntryId As DWord
+	ProtocolChain As WSAPROTOCOLCHAIN
+	iVersion As Long
+	iAddressFamily As Long
+	iMaxSockAddr As Long
+	iMinSockAddr As Long
+	iSocketType As Long
+	iProtocol As Long
+	iProtocolMaxOffset As Long
+	iNetworkByteOrder As Long
+	iSecurityScheme As Long
+	dwMessageSize As DWord
+	dwProviderReserved As DWord
+	szProtocol[WSAPROTOCOL_LEN] As WCHAR
+End Type
+TypeDef LPWSAPROTOCOL_INFOW = *WSAPROTOCOL_INFOW
+
+#ifdef UNICODE
+TypeDef WSAPROTOCOL_INFO = WSAPROTOCOL_INFOW
+TypeDef LPWSAPROTOCOL_INFO = LPWSAPROTOCOL_INFOW
+#else
+TypeDef WSAPROTOCOL_INFO = WSAPROTOCOL_INFOA
+TypeDef LPWSAPROTOCOL_INFO = LPWSAPROTOCOL_INFOA
+#endif
+
+' Flag bit definitions for dwProviderFlags
+Const PFL_MULTIPLE_PROTO_ENTRIES = &h00000001
+Const PFL_RECOMMENDED_PROTO_ENTRY = &h00000002
+Const PFL_HIDDEN = &h00000004
+Const PFL_MATCHES_PROTOCOL_ZERO = &h00000008
+
+' Flag bit definitions for dwServiceFlags1
+Const XP1_CONNECTIONLESS = &h00000001
+Const XP1_GUARANTEED_DELIVERY = &h00000002
+Const XP1_GUARANTEED_ORDER = &h00000004
+Const XP1_MESSAGE_ORIENTED = &h00000008
+Const XP1_PSEUDO_STREAM = &h00000010
+Const XP1_GRACEFUL_CLOSE = &h00000020
+Const XP1_EXPEDITED_DATA = &h00000040
+Const XP1_CONNECT_DATA = &h00000080
+Const XP1_DISCONNECT_DATA = &h00000100
+Const XP1_SUPPORT_BROADCAST = &h00000200
+Const XP1_SUPPORT_MULTIPOINT = &h00000400
+Const XP1_MULTIPOINT_CONTROL_PLANE = &h00000800
+Const XP1_MULTIPOINT_DATA_PLANE = &h00001000
+Const XP1_QOS_SUPPORTED = &h00002000
+Const XP1_INTERRUPT = &h00004000
+Const XP1_UNI_SEND = &h00008000
+Const XP1_UNI_RECV = &h00010000
+Const XP1_IFS_HANDLES = &h00020000
+Const XP1_PARTIAL_MESSAGE = &h00040000
+
+Const BIGENDIAN = &h0000
+Const LITTLEENDIAN = &h0001
+
+Const SECURITY_PROTOCOL_NONE = &h0000
+
+' WinSock 2 extension -- manifest constants for WSAJoinLeaf()
+Const JL_SENDER_ONLY = &h01
+Const JL_RECEIVER_ONLY = &h02
+Const JL_BOTH = &h04
+
+' WinSock 2 extension -- manifest constants for WSASocket()
+Const WSA_FLAG_OVERLAPPED = &h01
+Const WSA_FLAG_MULTIPOINT_C_ROOT = &h02
+Const WSA_FLAG_MULTIPOINT_C_LEAF = &h04
+Const WSA_FLAG_MULTIPOINT_D_ROOT = &h08
+Const WSA_FLAG_MULTIPOINT_D_LEAF = &h10
+
+' WinSock 2 extension -- manifest constants for WSAIoctl()
+Const IOC_UNIX = &h00000000
+Const IOC_WS2 = &h08000000
+Const IOC_PROTOCOL = &h10000000
+Const IOC_VENDOR = &h18000000
+
+Const _WSAIO(x, y) = (IOC_VOID Or (x) Or (y))
+Const _WSAIOR(x, y) = (IOC_OUT Or (x) Or (y))
+Const _WSAIOW(x, y) = (IOC_IN Or (x) Or (y))
+Const _WSAIORW(x, y) = (IOC_INOUT Or (x) Or (y))
+
+Const SIO_ASSOCIATE_HANDLE = _WSAIOW(IOC_WS2, 1)
+Const SIO_ENABLE_CIRCULAR_QUEUEING = _WSAIO(IOC_WS2, 2)
+Const SIO_FIND_ROUTE = _WSAIOR(IOC_WS2, 3)
+Const SIO_FLUSH = _WSAIO(IOC_WS2, 4)
+Const SIO_GET_BROADCAST_ADDRESS = _WSAIOR(IOC_WS2, 5)
+Const SIO_GET_EXTENSION_FUNCTION_POINTER = _WSAIORW(IOC_WS2, 6)
+Const SIO_GET_QOS = _WSAIORW(IOC_WS2, 7)
+Const SIO_GET_GROUP_QOS = _WSAIORW(IOC_WS2, 8)
+Const SIO_MULTIPOINT_LOOPBACK = _WSAIOW(IOC_WS2, 9)
+Const SIO_MULTICAST_SCOPE = _WSAIOW(IOC_WS2, 10)
+Const SIO_SET_QOS = _WSAIOW(IOC_WS2, 11)
+Const SIO_SET_GROUP_QOS = _WSAIOW(IOC_WS2, 12)
+Const SIO_TRANSLATE_HANDLE = _WSAIORW(IOC_WS2, 13)
+Const SIO_ROUTING_INTERFACE_QUERY = _WSAIORW(IOC_WS2, 20)
+Const SIO_ROUTING_INTERFACE_CHANGE = _WSAIOW(IOC_WS2, 21)
+Const SIO_ADDRESS_LIST_QUERY = _WSAIOR(IOC_WS2, 22)
+Const SIO_ADDRESS_LIST_CHANGE = _WSAIO(IOC_WS2, 23)
+Const SIO_QUERY_TARGET_PNP_HANDLE = _WSAIOR(IOC_WS2, 24)
+Const SIO_ADDRESS_LIST_SORT = _WSAIORW(IOC_WS2, 25)
+
+' WinSock 2 extensions -- data types for the condition function in
+' WSAAccept() and overlapped I/O completion routine.
+
+TypeDef LPCONDITIONPROC = *Function(
+	ByRef CallerId As WSABUF,
+	ByRef CallerData As WSABUF,
+	ByRef lpSQOS As QOS,
+	ByRef lpGQOS As QOS,
+	ByRef lpCalleeId As WSABUF,
+	ByRef lpCalleeData As WSABUF,
+	ByRef g As GROUP,
+	dwCallbackData As ULONG_PTR
+) As Long
+
+TypeDef LPWSAOVERLAPPED_COMPLETION_ROUTINE = *Sub(
+	dwError As DWord,
+	cbTransferred As DWord,
+	ByRef Overlapped As WSAOVERLAPPED,
+	dwFlags As DWord)
+
+' WinSock 2 extension -- manifest constants and associated structures
+' for WSANSPIoctl()
+Const SIO_NSP_NOTIFY_CHANGE = _WSAIOW(IOC_WS2, 25)
+
+Const Enum WSACOMPLETIONTYPE
+	NSP_NOTIFY_IMMEDIATELY = 0
+	NSP_NOTIFY_HWND
+	NSP_NOTIFY_EVENT
+	NSP_NOTIFY_PORT
+	NSP_NOTIFY_APC
+End Enum
+
+TypeDef PWSACOMPLETIONTYPE = *WSACOMPLETIONTYPE
+TypeDef LPWSACOMPLETIONTYPE = *WSACOMPLETIONTYPE
+
+Type _System_WinSock_WSACOMPLETION_WINDOWMESSAGE
+	hWnd As HWND
+	uMsg As DWord
+	context As WPARAM
+End Type
+
+Type _System_WinSock_WSACOMPLETION_EVENT
+	lpOverlapped As LPWSAOVERLAPPED
+End Type
+
+Type _System_WinSock_WSACOMPLETION_APC
+	lpOverlapped As LPWSAOVERLAPPED
+	lpfnCompletionProc As LPWSAOVERLAPPED_COMPLETION_ROUTINE
+End Type
+
+Type _System_WinSock_WSACOMPLETION_PORT
+	lpOverlapped As LPWSAOVERLAPPED
+	hPort As HANDLE
+	Key As ULONG_PTR
+End Type
+
+Type /*Class*/ WSACOMPLETION
+'Public
+	Type_ As WSACOMPLETIONTYPE
+/*
+	Parameters As Union
+		WindowMessage As _System_WinSock_WSACOMPLETION_WINDOWMESSAGE
+		Event As _System_WinSock_WSACOMPLETION_EVENT
+		Apc As _System_WinSock_WSACOMPLETION_APC
+		Port As _System_WinSock_WSACOMPLETION_PORT
+	End Union
+*/
+	Port As _System_WinSock_WSACOMPLETION_PORT
+/*
+	Function WindowMessage() As _System_WinSock_WSACOMPLETION_WINDOWMESSAGE
+		Dim p As *_System_WinSock_WSACOMPLETION_WINDOWMESSAGE
+		p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_WINDOWMESSAGE
+		Return p[0]
+	End Function
+
+	Sub WindowMessage(w As _System_WinSock_WSACOMPLETION_WINDOWMESSAGE)
+		Dim p As *_System_WinSock_WSACOMPLETION_WINDOWMESSAGE
+		p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_WINDOWMESSAGE
+		p[0] = w
+	End Sub
+
+	Function Event() As _System_WinSock_WSACOMPLETION_EVENT
+		Dim p As *_System_WinSock_WSACOMPLETION_EVENT
+		p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_EVENT
+		Return p[0]
+	End Function
+
+	Sub Event(e As _System_WinSock_WSACOMPLETION_EVENT)
+		Dim p As *_System_WinSock_WSACOMPLETION_EVENT
+		p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_EVENT
+		p[0] = e
+	End Sub
+
+	Function Apc() As _System_WinSock_WSACOMPLETION_APC
+		Dim p As *_System_WinSock_WSACOMPLETION_APC
+		p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_APC
+		Return p[0]
+	End Function
+
+	Sub Apc(a As _System_WinSock_WSACOMPLETION_APC)
+		Dim p As *_System_WinSock_WSACOMPLETION_APC
+		p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_APC
+		p[0] = a
+	End Sub
+/*
+	Function Port() As _System_WinSock_WSACOMPLETION_PORT
+		Dim p As *_System_WinSock_WSACOMPLETION_PORT
+		p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_PORT
+		Return p[0]
+	End Function
+
+	Sub Port(p As _System_WinSock_WSACOMPLETION_PORT)
+		Dim p As *_System_WinSock_WSACOMPLETION_PORT
+		p = VarPtr(Port) As *_System_WinSock_WSACOMPLETION_PORT
+		p[0] = p
+	End Sub
+*/
+End Type 'Class
+
+TypeDef PWSACOMPLETION = *WSACOMPLETION
+TypeDef LPWSACOMPLETION = *WSACOMPLETION
+
+' WinSock 2 extension -- manifest constants for SIO_TRANSLATE_HANDLE ioctl
+Const TH_NETDEV = &h00000001
+Const TH_TAPI = &h00000002
+
+TypeDef SOCKADDR = sockaddr
+TypeDef PSOCKADDR = *sockaddr
+TypeDef LPSOCKADDR = *sockaddr
+
+TypeDef SOCKADDR_STORAGE = sockaddr_storage
+TypeDef PSOCKADDR_STORAGE = *sockaddr_storage
+TypeDef LPSOCKADDR_STORAGE = *sockaddr_storage
+
+' Manifest constants and type definitions related to name resolution and
+' registration (RNR) API
+
+Type BLOB
+	cbSize As DWord
+#ifdef MIDL_PASS
+	[size_is(cbSize)] pBlobData As *Byte
+#else
+	pBlobData As *Byte
+#endif
+End Type
+TypeDef LPBLOB = *BLOB
+
+' Service Install Flags
+Const SERVICE_MULTIPLE = (&h00000001)
+
+' Name Spaces
+
+Const NS_ALL = (0)
+
+Const NS_SAP = (1)
+Const NS_NDS = (2)
+Const NS_PEER_BROWSE = (3)
+Const NS_SLP = (5)
+Const NS_DHCP = (6)
+
+Const NS_TCPIP_LOCAL = (10)
+Const NS_TCPIP_HOSTS = (11)
+Const NS_DNS = (12)
+Const NS_NETBT = (13)
+Const NS_WINS = (14)
+Const NS_NLA = (15)
+
+Const NS_NBP = (20)
+
+Const NS_MS = (30)
+Const NS_STDA = (31)
+Const NS_NTDS = (32)
+
+Const NS_X500 = (40)
+Const NS_NIS = (41)
+Const NS_NISPLUS = (42)
+
+Const NS_WRQ = (50)
+
+Const NS_NETDES = (60)
+
+' Resolution flags for WSAGetAddressByName().
+Const RES_UNUSED_1 = (&h00000001)
+Const RES_FLUSH_CACHE = (&h00000002)
+Const RES_SERVICE = (&h00000004)
+
+' Well known value names for Service Types
+
+'Const SERVICE_TYPE_VALUE_IPXPORTA = "IpxSocket"
+'Const SERVICE_TYPE_VALUE_IPXPORTW = L"IpxSocket"
+'Const SERVICE_TYPE_VALUE_SAPIDA = "SapId"
+'Const SERVICE_TYPE_VALUE_SAPIDW = L"SapId"
+
+'Const SERVICE_TYPE_VALUE_TCPPORTA = "TcpPort"
+'Const SERVICE_TYPE_VALUE_TCPPORTW = L"TcpPort"
+
+'Const SERVICE_TYPE_VALUE_UDPPORTA = "UdpPort"
+'Const SERVICE_TYPE_VALUE_UDPPORTW = L"UdpPort"
+
+'Const SERVICE_TYPE_VALUE_OBJECTIDA = "ObjectId"
+'Const SERVICE_TYPE_VALUE_OBJECTIDW = L"ObjectId"
+/*
+#ifdef UNICODE
+Const SERVICE_TYPE_VALUE_SAPID = SERVICE_TYPE_VALUE_SAPIDW
+Const SERVICE_TYPE_VALUE_TCPPORT = SERVICE_TYPE_VALUE_TCPPORTW
+Const SERVICE_TYPE_VALUE_UDPPORT = SERVICE_TYPE_VALUE_UDPPORTW
+Const SERVICE_TYPE_VALUE_OBJECTID = SERVICE_TYPE_VALUE_OBJECTIDW
+#else
+Const SERVICE_TYPE_VALUE_SAPID = SERVICE_TYPE_VALUE_SAPIDA
+Const SERVICE_TYPE_VALUE_TCPPORT = SERVICE_TYPE_VALUE_TCPPORTA
+Const SERVICE_TYPE_VALUE_UDPPORT = SERVICE_TYPE_VALUE_UDPPORTA
+Const SERVICE_TYPE_VALUE_OBJECTID = SERVICE_TYPE_VALUE_OBJECTIDA
+#endif
+*/
+Const SERVICE_TYPE_VALUE_IPXPORT = "IpxSocket"
+Const SERVICE_TYPE_VALUE_SAPID = "SapId"
+Const SERVICE_TYPE_VALUE_TCPPORT = "TcpPort"
+Const SERVICE_TYPE_VALUE_UDPPORT = "UdpPort"
+Const SERVICE_TYPE_VALUE_OBJECTID = "ObjectId"
+
+' SockAddr Information
+Type SOCKET_ADDRESS
+	lpSockaddr As LPSOCKADDR
+	iSockaddrLength As Long
+End Type
+TypeDef PSOCKET_ADDRESS = *SOCKET_ADDRESS
+TypeDef LPSOCKET_ADDRESS = *SOCKET_ADDRESS
+
+' CSAddr Information
+Type CSADDR_INFO
+	LocalAddr As SOCKET_ADDRESS
+	RemoteAddr As SOCKET_ADDRESS
+	iSocketType As Long
+	iProtocol As Long
+End Type
+TypeDef PCSADDR_INFO = *CSADDR_INFO
+TypeDef LPCSADDR_INFO = *CSADDR_INFO
+
+' Address list returned via SIO_ADDRESS_LIST_QUERY
+Type SOCKET_ADDRESS_LIST
+	iAddressCount As Long
+	Address[ELM(1)] As SOCKET_ADDRESS
+End Type
+TypeDef LPSOCKET_ADDRESS_LIST = *SOCKET_ADDRESS_LIST
+
+' Address Family/Protocol Tuples
+Type AFPROTOCOLS
+	iAddressFamily As Long
+	iProtocol As Long
+End Type
+TypeDef PAFPROTOCOLS = *AFPROTOCOLS
+TypeDef LPAFPROTOCOLS = *AFPROTOCOLS
+
+' Client Query API Typedefs
+
+' The comparators
+Const Enum WSAECOMPARATOR
+	COMP_EQUAL = 0
+	COMP_NOTLESS
+End Enum
+TypeDef PWSAECOMPARATOR = *WSAECOMPARATOR
+TypeDef LPWSAECOMPARATOR = *WSAECOMPARATOR
+
+Type WSAVERSION
+	dwVersion As DWord
+	ecHow As WSAECOMPARATOR
+End Type
+TypeDef PWSAVERSION = *WSAVERSION
+TypeDef LPWSAVERSION = *WSAVERSION
+
+Type WSAQUERYSETA
+	dwSize As DWord
+	lpszServiceInstanceName As LPSTR
+	lpServiceClassId As *GUID
+	lpVersion As LPWSAVERSION
+	lpszComment As LPSTR
+	dwNameSpace As DWord
+	lpNSProviderId As *GUID
+	lpszContext As LPSTR
+	dwNumberOfProtocols As DWord
+	lpafpProtocols As LPAFPROTOCOLS
+	lpszQueryString As LPSTR
+	dwNumberOfCsAddrs As DWord
+	lpcsaBuffer As LPCSADDR_INFO
+	dwOutputFlags As DWord
+	lpBlob As LPBLOB
+End Type
+TypeDef PWSAQUERYSETA = *WSAQUERYSETA
+TypeDef LPWSAQUERYSETA = *WSAQUERYSETA
+
+Type WSAQUERYSETW
+	dwSize As DWord
+	lpszServiceInstanceName As LPWSTR
+	lpServiceClassId As *GUID
+	lpVersion As LPWSAVERSION
+	lpszComment As LPWSTR
+	dwNameSpace As DWord
+	lpNSProviderId As *GUID
+	lpszContext As LPWSTR
+	dwNumberOfProtocols As DWord
+	lpafpProtocols As LPAFPROTOCOLS
+	lpszQueryString As LPWSTR
+	dwNumberOfCsAddrs As DWord
+	lpcsaBuffer As LPCSADDR_INFO
+	dwOutputFlags As DWord
+	lpBlob As LPBLOB
+End Type
+TypeDef PWSAQUERYSETW = *WSAQUERYSETW
+TypeDef LPWSAQUERYSETW = *WSAQUERYSETW
+
+#ifdef UNICODE
+TypeDef WSAQUERYSET = WSAQUERYSETW
+TypeDef PWSAQUERYSET = PWSAQUERYSETW
+TypeDef LPWSAQUERYSET = LPWSAQUERYSETW
+#else
+TypeDef WSAQUERYSET = WSAQUERYSETA
+TypeDef PWSAQUERYSET = PWSAQUERYSETA
+TypeDef LPWSAQUERYSET = LPWSAQUERYSETA
+#endif
+
+Const LUP_DEEP = &h0001
+Const LUP_CONTAINERS = &h0002
+Const LUP_NOCONTAINERS = &h0004
+Const LUP_NEAREST = &h0008
+Const LUP_RETURN_NAME = &h0010
+Const LUP_RETURN_TYPE = &h0020
+Const LUP_RETURN_VERSION = &h0040
+Const LUP_RETURN_COMMENT = &h0080
+Const LUP_RETURN_ADDR = &h0100
+Const LUP_RETURN_BLOB = &h0200
+Const LUP_RETURN_ALIASES = &h0400
+Const LUP_RETURN_QUERY_STRING = &h0800
+Const LUP_RETURN_ALL = &h0FF0
+Const LUP_RES_SERVICE = &h8000
+
+Const LUP_FLUSHCACHE = &h1000
+Const LUP_FLUSHPREVIOUS = &h2000
+
+' Return flags
+Const RESULT_IS_ALIAS = &h0001
+Const RESULT_IS_ADDED = &h0010
+Const RESULT_IS_CHANGED = &h0020
+Const RESULT_IS_DELETED = &h0040
+
+' Service Address Registration and Deregistration Data Types.
+
+Const Enum WSAESETSERVICEOP
+	RNRSERVICE_REGISTER = 0
+	RNRSERVICE_DEREGISTER
+	RNRSERVICE_DELETE
+End Enum
+TypeDef PWSAESETSERVICEOP = *WSAESETSERVICEOP
+TypeDef LPWSAESETSERVICEOP = *WSAESETSERVICEOP
+
+' Service Installation/Removal Data Types.
+
+Type WSANSCLASSINFOA
+	lpszName As LPSTR
+	dwNameSpace As DWord
+	dwValueType As DWord
+	dwValueSize As DWord
+	lpValue As VoidPtr
+End Type
+TypeDef PWSANSCLASSINFOA = *WSANSCLASSINFOA
+TypeDef LPWSANSCLASSINFOA = *WSANSCLASSINFOA
+
+Type WSANSCLASSINFOW
+	lpszName As LPWSTR
+	dwNameSpace As DWord
+	dwValueType As DWord
+	dwValueSize As DWord
+	lpValue As VoidPtr
+End Type
+TypeDef PWSANSCLASSINFOW = *WSANSCLASSINFOW
+TypeDef LPWSANSCLASSINFOW = *WSANSCLASSINFOW
+
+#ifdef UNICODE
+TypeDef WSANSCLASSINFO = WSANSCLASSINFOW
+TypeDef PWSANSCLASSINFO = PWSANSCLASSINFOW
+TypeDef LPWSANSCLASSINFO = LPWSANSCLASSINFOW
+#else
+TypeDef WSANSCLASSINFO = WSANSCLASSINFOA
+TypeDef PWSANSCLASSINFO = PWSANSCLASSINFOA
+TypeDef LPWSANSCLASSINFO = LPWSANSCLASSINFOA
+#endif
+
+Type WSASERVICECLASSINFOA
+	lpServiceClassId As *GUID
+	lpszServiceClassName As LPSTR
+	dwCount As DWord
+	lpClassInfos As LPWSANSCLASSINFOA
+End Type
+TypeDef PWSASERVICECLASSINFOA = *WSASERVICECLASSINFOA
+TypeDef LPWSASERVICECLASSINFOA = *WSASERVICECLASSINFOA
+
+Type WSASERVICECLASSINFOW
+	lpServiceClassId As *GUID
+	lpszServiceClassName As LPWSTR
+	dwCount As DWord
+	lpClassInfos As LPWSANSCLASSINFOA
+End Type
+TypeDef PWSASERVICECLASSINFOW = *WSASERVICECLASSINFOW
+TypeDef LPWSASERVICECLASSINFOW = *WSASERVICECLASSINFOW
+
+#ifdef UNICODE
+TypeDef WSASERVICECLASSINFO = WSASERVICECLASSINFOW
+TypeDef PWSASERVICECLASSINFO = PWSASERVICECLASSINFOW
+TypeDef LPWSASERVICECLASSINFO = LPWSASERVICECLASSINFOW
+#else
+TypeDef WSASERVICECLASSINFO = WSASERVICECLASSINFOA
+TypeDef PWSASERVICECLASSINFO = PWSASERVICECLASSINFOA
+TypeDef LPWSASERVICECLASSINFO = LPWSASERVICECLASSINFOA
+#endif
+
+Type WSANAMESPACE_INFOA
+	NSProviderId As GUID
+	dwNameSpace As DWord
+	fActive As BOOL
+	dwVersion As DWord
+	lpszIdentifier As LPSTR
+End Type
+TypeDef PWSANAMESPACE_INFOA = *WSANAMESPACE_INFOA
+TypeDef LPWSANAMESPACE_INFOA = *WSANAMESPACE_INFOA
+
+Type WSANAMESPACE_INFOW
+	NSProviderId As GUID
+	dwNameSpace As DWord
+	fActive As BOOL
+	dwVersion As DWord
+	lpszIdentifier As LPWSTR
+End Type
+TypeDef PWSANAMESPACE_INFOW = *WSANAMESPACE_INFOW
+TypeDef LPWSANAMESPACE_INFOW = *WSANAMESPACE_INFOW
+
+#ifdef UNICODE
+TypeDef WSANAMESPACE_INFO = WSANAMESPACE_INFOW
+TypeDef PWSANAMESPACE_INFO = PWSANAMESPACE_INFOW
+TypeDef LPWSANAMESPACE_INFO = LPWSANAMESPACE_INFOW
+#else
+TypeDef WSANAMESPACE_INFO = WSANAMESPACE_INFOA
+TypeDef PWSANAMESPACE_INFO = PWSANAMESPACE_INFOA
+TypeDef LPWSANAMESPACE_INFO = LPWSANAMESPACE_INFOA
+#endif
+
+' Socket function prototypes
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function accept Lib "ws2_32" (s As SOCKET, ByRef addr As sockaddr, ByRef addrlen As Long) As SOCKET
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_ACCEPT = *Function(s As SOCKET, ByRef addr As sockaddr, ByRef addrlen As Long) As SOCKET
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function bind Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, addrlen As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_BIND = *Function(s As SOCKET, ByRef name As sockaddr, addrlen As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function closesocket Lib "ws2_32" (s As SOCKET) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_CLOSESOCKET = *Function(s As SOCKET) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function connect Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, namelen As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_CONNECT = *Function(s As SOCKET, ByRef name As sockaddr, namelen As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function ioctlsocket Lib "ws2_32" (s As SOCKET, cmd As Long, ByRef argp As DWord) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_IOCTLSOCKET = *Function(s As SOCKET, cmd As Long, ByRef argp As DWord) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function getpeername Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, ByRef namelen As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_GETPEERNAME = *Function(s As SOCKET, ByRef name As sockaddr, ByRef namelen As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function getsockname Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, ByRef namelen As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_GETSOCKNAME = *Function(s As SOCKET, ByRef name As sockaddr, ByRef namelen As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function getsockopt Lib "ws2_32" (s As SOCKET, level As Long, optname As Long, optval As *Byte, ByRef optlen As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_GETSOCKOPT = *Function(s As SOCKET, level As Long, optname As Long, optval As *Byte, ByRef optlen As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function htonl Lib "ws2_32" (hostlong As DWord) As DWord
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_HTONL = *Function(hostlong As DWord) As DWord
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function htons Lib "ws2_32" (hostshort As Word) As Word
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_HTONS = *Function(hostshort As Word) As Word
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function inet_addr Lib "ws2_32" (cp As *Byte) As DWord
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_INET_ADDR = *Function(cp As *Byte) As DWord
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function inet_ntoa Lib "ws2_32" (in As DWord /*in_addr*/ ) As *Byte
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_INET_NTOA = *Function(in As in_addr) As *Byte
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function listen Lib "ws2_32" (s As SOCKET, backlog As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_LISTEN = *Function(s As SOCKET, backlog As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function ntohl Lib "ws2_32" (netlong As DWord) As DWord
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_NTOHL = *Function(netlong As DWord) As DWord
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function ntohs Lib "ws2_32" (netshort As Word) As Word
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_NTOHS = *Function(netshort As Word) As Word
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function recv Lib "ws2_32" (s As SOCKET, buf As *Byte, len As Long, flags As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_RECV = *Function(s As SOCKET, buf As *Byte, len As Long, flags As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function recvfrom Lib "ws2_32" (s As SOCKET, buf As *Byte, len As Long, flags As Long, ByRef from As sockaddr, ByRef fromlen As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_RECVFROM = *Function(s As SOCKET, buf As *Byte, len As Long, flags As Long, ByRef from As sockaddr, ByRef fromlen As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function select Lib "ws2_32" (nfds As Long, ByRef readfds As fd_set, ByRef writefds As fd_set, ByRef exceptfds As fd_set, ByRef timeout As timeval) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_SELECT = *Function(nfds As Long, ByRef readfds As fd_set, ByRef writefds As fd_set, ByRef exceptfds As fd_set, ByRef timeout As timeval) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function send Lib "ws2_32" (s As SOCKET, buf As *Byte, len As Long, flags As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_SEND = *Function(s As SOCKET, buf As *Byte, len As Long, flags As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function sendto Lib "ws2_32" (s As SOCKET, buf As *Byte, len As Long, flags As Long, ByRef to_ As sockaddr, tolen As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_SENDTO = *Function(s As SOCKET, buf As *Byte, len As Long, flags As Long, ByRef to_ As sockaddr, tolen As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function setsockopt Lib "ws2_32" (s As SOCKET, level As Long, optname As Long, optval As *Byte, optlen As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_SETSOCKOPT = *Function(s As SOCKET, level As Long, optname As Long, optval As *Byte, optlen As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function shutdown Lib "ws2_32" (s As SOCKET, how As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_SHUTDOWN = *Function(s As SOCKET, how As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function socket Lib "ws2_32" (af As Long, type_ As Long, protocol As Long) As SOCKET
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_SOCKET = *Function(af As Long, type_ As Long, protocol As Long) As SOCKET
+#endif
+
+' Database function prototypes
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function gethostbyaddr Lib "ws2_32" (addr As PCSTR, len As Long, type_ As Long) As *hostent
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_GETHOSTBYADDR = *Function(addr As PCSTR, len As Long, type_ As Long) As *hostent
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function gethostbyname Lib "ws2_32" (name As PCSTR) As *hostent
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_GETHOSTBYNAME = *Function(name As PCSTR) As *hostent
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function gethostname Lib "ws2_32" (name As PCSTR, namelen As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_GETHOSTNAME = *Function(name As PCSTR, namelen As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function getservbyport Lib "ws2_32" (port As Long, proto As PCSTR) As *servent
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_GETSERVBYPORT = *Function(port As Long, proto As PCSTR) As *servent
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function getservbyname Lib "ws2_32" (name As PCSTR, proto As PCSTR) As *servent
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_GETSERVBYNAME = *Function(name As PCSTR, proto As PCSTR) As *servent
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function getprotobynumber Lib "ws2_32" (number As Long) As *protoent
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_GETPROTOBYNUMBER = *Function(number As Long) As *protoent
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function getprotobyname Lib "ws2_32" (name As PCSTR) As *protoent
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_GETPROTOBYNAME = (name As PCSTR) As *protoent
+#endif
+
+' Microsoft Windows Extension function prototypes
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAStartup Lib "ws2_32" (wVersionRequested As Word, ByRef WSAData As WSADATA) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSASTARTUP = *Function(wVersionRequested As Word, ByRef WSAData As WSADATA) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSACleanup Lib "ws2_32" () As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSACLEANUP = *Function() As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Sub WSASetLastError Lib "ws2_32" (iError As Long)
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSASETLASTERROR = *Sub(iError As Long)
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAGetLastError Lib "ws2_32" () As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAGETLASTERROR = *Function() As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAIsBlocking Lib "ws2_32" () As BOOL
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAISBLOCKING = *Function() As BOOL
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAUnhookBlockingHook Lib "ws2_32" () As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAUNHOOKBLOCKINGHOOK = *Function() As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSASetBlockingHook Lib "ws2_32" (lpBlockFunc As FARPROC) As FARPROC
+
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSASETBLOCKINGHOOK = *Function(lpBlockFunc As FARPROC) As FARPROC
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSACancelBlockingCall Lib "ws2_32" () As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSACANCELBLOCKINGCALL = *Function() As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAAsyncGetServByName Lib "ws2_32" (hwnd As HWND, msg As DWord, name As PCSTR, proto As PCSTR, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAASYNCGETSERVBYNAME = *Function(hwnd As HWND, msg As DWord, name As PCSTR, proto As PCSTR, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAAsyncGetServByPort Lib "ws2_32" (hwnd As HWND, msg As DWord, port As Long, proto As PCSTR, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAASYNCGETSERVBYPORT = *Function(hwnd As HWND, msg As DWord, port As Long, proto As PCSTR, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAAsyncGetProtoByName Lib "ws2_32" (hwnd As HWND, msg As DWord, name As PCSTR, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAASYNCGETPROTOBYNAME = *Function(hwnd As HWND, msg As DWord, name As PCSTR, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAAsyncGetProtoByNumber Lib "ws2_32" (hwnd As HWND, msg As DWord, number As Long, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAASYNCGETPROTOBYNUMBER = *Function(hwnd As HWND, msg As DWord, number As Long, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAAsyncGetHostByName Lib "ws2_32" (hwnd As HWND, msg As DWord, name As PCSTR, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAASYNCGETHOSTBYNAME = *Function(hwnd As HWND, msg As DWord, name As PCSTR, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAAsyncGetHostByAddr Lib "ws2_32" (hwnd As HWND, msg As DWord, addr As PCSTR, len As Long, type_ As Long, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAASYNCGETHOSTBYADDR = *Function(hwnd As HWND, msg As DWord, addr As PCSTR, len As Long, type_ As Long, buf As *Byte, buflen As Long) As HANDLE
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSACancelAsyncRequest Lib "ws2_32" (hAsyncTaskHandle As HANDLE) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSACANCELASYNCREQUEST = *Function(hAsyncTaskHandle As HANDLE) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAAsyncSelect Lib "ws2_32" (s As SOCKET, hwnd As HWND, msg As DWord, Event As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAASYNCSELECT = *Function(s As SOCKET, hwnd As HWND, msg As DWord, Event As Long) As Long
+#endif
+
+/* WinSock 2 API new function prototypes */
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAAccept Lib "ws2_32" (s As SOCKET, ByRef addr As sockaddr, ByRef addrlen As Long, lpfnCondition As LPCONDITIONPROC, CallbackData As ULONG_PTR) As SOCKET
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAACCEPT = *Function(s As SOCKET, ByRef addr As sockaddr, ByRef addrlen As Long, lpfnCondition As LPCONDITIONPROC, CallbackData As ULONG_PTR) As SOCKET
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSACloseEvent Lib "ws2_32" (hEvent As WSAEVENT) As BOOL
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSACLOSEEVENT = *Function(hEvent As WSAEVENT) As BOOL
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAConnect Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, namelen As Long, ByRef CallerData As WSABUF, ByRef CalleeData As WSABUF, ByRef SQOS As QOS, ByRef GQOS As QOS) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSACONNECT = *Functions As SOCKET, ByRef name As sockaddr, namelen As Long, ByRef CallerData As WSABUF, ByRef CalleeData As WSABUF, ByRef SQOS As QOS, ByRef GQOS As QOS) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSACreateEvent Lib "ws2_32" () As WSAEVENT
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSACREATEEVENT = *Function() As WSAEVENT
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSADuplicateSocketA Lib "ws2_32" (s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA) As Long
+Declare Function WSADuplicateSocketW Lib "ws2_32" (s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOW) As Long
+#ifdef UNICODE
+Declare Function WSADuplicateSocket Lib "ws2_32" Alias "WSADuplicateSocketW" (s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFO) As Long
+#else
+Declare Function WSADuplicateSocket Lib "ws2_32" Alias "WSADuplicateSocketA" (s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFO) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSADUPLICATESOCKETA = *Function(s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA) As Long
+TypeDef LPFN_WSADUPLICATESOCKETW = *Function(s As SOCKET, ProcessId As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOW) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSADUPLICATESOCKET = LPFN_WSADUPLICATESOCKETW
+#else
+TypeDef LPFN_WSADUPLICATESOCKET = LPFN_WSADUPLICATESOCKETA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAEnumNetworkEvents Lib "ws2_32" (s As SOCKET, hEventObject As WSAEVENT, ByRef NetworkEvents As WSANETWORKEVENTS) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAENUMNETWORKEVENTS = *Function(s As SOCKET, hEventObject As WSAEVENT, ByRef NetworkEvents As WSANETWORKEVENTS) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAEnumProtocolsA Lib "ws2_32" (Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFOA, ByRef BufferLength As DWord) As Long
+Declare Function WSAEnumProtocolsW Lib "ws2_32" (Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFOW, ByRef BufferLength As DWord) As Long
+#ifdef UNICODE
+Declare Function WSAEnumProtocols Lib "ws2_32" Alias "WSAEnumProtocolsW" (Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFO, ByRef BufferLength As DWord) As Long
+#else
+Declare Function WSAEnumProtocols Lib "ws2_32" Alias "WSAEnumProtocolsA" (Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFO, ByRef BufferLength As DWord) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAENUMPROTOCOLSA = *Function(Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFOA, ByRef BufferLength As DWord) As Long
+TypeDef LPFN_WSAENUMPROTOCOLSW = *Function(Protocols As *Long, ByRef ProtocolBuffer As WSAPROTOCOL_INFOW, ByRef BufferLength As DWord) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSAENUMPROTOCOLS = LPFN_WSAENUMPROTOCOLSW
+#else
+TypeDef LPFN_WSAENUMPROTOCOLS = LPFN_WSAENUMPROTOCOLSA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAEventSelect Lib "ws2_32" (s As SOCKET, hEventObject As WSAEVENT, NetworkEvents As Long) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAEVENTSELECT = *Function(s As SOCKET, hEventObject As WSAEVENT, NetworkEvents As Long) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAGetOverlappedResult Lib "ws2_32" (s As SOCKET, ByRef Overlapped As WSAOVERLAPPED, ByRef cbTransfer As DWord, Wait As BOOL, ByRef Flags As DWord) As BOOL
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAGETOVERLAPPEDRESULT = *Function(s As SOCKET, ByRef Overlapped As WSAOVERLAPPED, ByRef cbTransfer As DWord, Wait As BOOL, ByRef Flags As DWord) As BOOL
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAGetQOSByName Lib "ws2_32" (s As SOCKET, ByRef QOSName As WSABUF, ByRef qos As QOS) As BOOL
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAGETQOSBYNAME = *Function(s As SOCKET, ByRef QOSName As WSABUF, ByRef qos As QOS) As BOOL
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAHtonl Lib "ws2_32" (s As SOCKET, hostlong As DWord, ByRef netlong As DWord) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAHTONL = *Function(s As SOCKET, hostlong As DWord, ByRef netlong As DWord) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAHtons Lib "ws2_32" (s As SOCKET, hostshort As Word, ByRef netshort As Word) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAHTONS = *Function(s As SOCKET, hostshort As Word, ByRef netshort As Word) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAIoctl Lib "ws2_32" (s As SOCKET, IoControlCode As DWord, pvInBuffer As VoidPtr, cbInBuffer As DWord, pvOutBuffer As VoidPtr, cbOutBuffer As DWord,
+	ByRef cbBytesReturned As DWord, ByRef Overlapped As WSAOVERLAPPED, pCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAIOCTL = *Function(s As SOCKET, IoControlCode As DWord, pvInBuffer As VoidPtr, cbInBuffer As DWord, pvOutBuffer As VoidPtr, cbOutBuffer As DWord,
+	ByRef cbBytesReturned As DWord, ByRef Overlapped As WSAOVERLAPPED, pCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAJoinLeaf Lib "ws2_32" (s As SOCKET, ByRef name As sockaddr, namelen As Long, ByRef CallerData As WSABUF, ByRef CalleeData As WSABUF,
+	ByRef SQOS As QOS, ByRef GQOS AS QOS, Flags As DWord) As SOCKET
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAJOINLEAF = *Function(s As SOCKET, ByRef name As sockaddr, namelen As Long, ByRef CallerData As WSABUF, ByRef CalleeData As WSABUF,
+	ByRef SQOS As QOS, ByRef GQOS AS QOS, Flags As DWord) As SOCKET
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSANtohl Lib "ws2_32" (s As SOCKET, netlong As DWord, ByRef hostlong As DWord) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSANTOHL = *Function(s As SOCKET, netlong As DWord, ByRef hostlong As DWord) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSANtohs Lib "ws2_32" (s As SOCKET, netshort As Word, ByRef hostshort As Word) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSANTOHS = *Function(s As SOCKET, netshort As Word, ByRef hostshort As Word) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSARecv Lib "ws2_32" (s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesRecvd As DWord, ByRef Flags As DWord,
+	ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSARECV = *Function(s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesRecvd As DWord, ByRef Flags As DWord,
+	ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSARecvDisconnect Lib "ws2_32" (s As SOCKET, ByRef InboundDisconnectData As WSABUF) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSARECVDISCONNECT = *Function(s As SOCKET, ByRef InboundDisconnectData As WSABUF) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSARecvFrom Lib "ws2_32" (s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesRecvd As DWord, ByRef Flags As DWord,
+	ByRef From As sockaddr, ByRef Fromlen As Long, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSARECVFROM = *Function(s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesRecvd As DWord, ByRef Flags As DWord,
+	ByRef From As sockaddr, ByRef Fromlen As Long, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAResetEvent Lib "ws2_32" (hEvent As WSAEVENT) As BOOL
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSARESETEVENT = *Function(hEvent As WSAEVENT) As BOOL
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSASend Lib "ws2_32" (s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesSent As DWord, ByRef Flags As DWord,
+	ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSASEND = *Function(s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesSent As DWord, ByRef Flags As DWord,
+	ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSASendDisconnect Lib "ws2_32" (s As SOCKET, ByRef OutboundDisconnectData As WSABUF) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSASENDDISCONNECT = *Function(s As SOCKET, ByRef OutboundDisconnectData As WSABUF) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSASendTo Lib "ws2_32" (s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesSent As DWord, ByRef Flags As DWord,
+	ByRef To_ As sockaddr, ToLen As Long, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSASENDTO = *Function(s As SOCKET, ByRef Buffers As WSABUF, BufferCount As DWord, ByRef NumberOfBytesSent As DWord, ByRef Flags As DWord,
+	ByRef To_ As sockaddr, ToLen As Long, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSASetEvent Lib "ws2_32" (hEvent As WSAEVENT) As BOOL
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSASETEVENT = *Function(hEvent As WSAEVENT) As BOOL
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSASocketA Lib "ws2_32" (af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOA, g As GROUP, Flags As DWord) As SOCKET
+Declare Function WSASocketW Lib "ws2_32" (af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOW, g As GROUP, Flags As DWord) As SOCKET
+#ifdef UNICODE
+Declare Function WSASocket Lib "ws2_32" Alias "WSASocketW" (af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFO, g As GROUP, Flags As DWord) As SOCKET
+#else
+Declare Function WSASocket Lib "ws2_32" Alias "WSASocketA" (af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFO, g As GROUP, Flags As DWord) As SOCKET
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSASOCKETA = *Function(af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOA, g As GROUP, Flags As DWord) As SOCKET
+TypeDef LPFN_WSASOCKETW = *Function(af As Long, type_ As Long, protocol As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOW, g As GROUP, Flags As DWord) As SOCKET
+#ifdef UNICODE
+TypeDef LPFN_WSASOCKET = LPFN_WSASOCKETW
+#else
+TypeDef LPFN_WSASOCKET = LPFN_WSASOCKETA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAWaitForMultipleEvents Lib "ws2_32" (cEvents As DWord, phEvents As *WSAEVENT, WaitAll As BOOL, Timeout As DWord, Alertable As BOOL) As DWord
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAWAITFORMULTIPLEEVENTS = *Function(cEvents As DWord, phEvents As *WSAEVENT, WaitAll As BOOL, Timeout As DWord, Alertable As BOOL) As DWord
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAAddressToStringA Lib "ws2_32" (ByRef saAddress As SOCKADDR, AddressLength As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
+	AddressString As PSTR, ByRef dwAddressStringLength As DWord) As Long
+Declare Function WSAAddressToStringW Lib "ws2_32" (ByRef saAddress As SOCKADDR, AddressLength As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
+	AddressString As PWSTR, ByRef dwAddressStringLength As DWord) As Long
+#ifdef UNICODE
+Declare Function WSAAddressToString Lib "ws2_32" Alias "WSAAddressToStringW" (ByRef saAddress As SOCKADDR, AddressLength As DWord,
+	ByRef ProtocolInfo As WSAPROTOCOL_INFO, AddressString As PSTR, ByRef dwAddressStringLength As DWord) As Long
+#else
+Declare Function WSAAddressToString Lib "ws2_32" Alias "WSAAddressToStringA" (ByRef saAddress As SOCKADDR, AddressLength As DWord,
+	ByRef ProtocolInfo As WSAPROTOCOL_INFO, AddressString As PSTR, ByRef dwAddressStringLength As DWord) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAADDRESSTOSTRINGA = *Function(ByRef saAddress As SOCKADDR, AddressLength As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
+	AddressString As PSTR, ByRef dwAddressStringLength As DWord) As Long
+TypeDef LPFN_WSAADDRESSTOSTRINGW = *Function(ByRef saAddress As SOCKADDR, AddressLength As DWord, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
+	AddressString As PWSTR, ByRef dwAddressStringLength As DWord) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSAADDRESSTOSTRING = LPFN_WSAADDRESSTOSTRINGW
+#else
+TypeDef LPFN_WSAADDRESSTOSTRING = LPFN_WSAADDRESSTOSTRINGA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAStringToAddressA Lib "ws2_32" (AddressString As PSTR, AddressFamily As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
+	ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
+Declare Function WSAStringToAddressW Lib "ws2_32" (AddressString As PWSTR, AddressFamily As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOW,
+	ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
+#ifdef UNICODE
+Declare Function WSAStringToAddress Lib "ws2_32" Alias "WSAStringToAddressW" (AddressString As PSTR, AddressFamily As Long,
+	ByRef ProtocolInfo As WSAPROTOCOL_INFO, ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
+#else
+Declare Function WSAStringToAddress Lib "ws2_32" Alias "WSAStringToAddressA" (AddressString As PSTR, AddressFamily As Long,
+	ByRef ProtocolInfo As WSAPROTOCOL_INFO, ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSASTRINGTOADDRESSA = *Function(AddressString As PSTR, AddressFamily As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOA,
+	ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
+TypeDef LPFN_WSASTRINGTOADDRESSW = *Function(AddressString As PWSTR, AddressFamily As Long, ByRef ProtocolInfo As WSAPROTOCOL_INFOW,
+	ByRef Address As SOCKADDR, ByRef AddressLength As Long) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSASTRINGTOADDRESS = LPFN_WSASTRINGTOADDRESSW
+#else
+TypeDef LPFN_WSASTRINGTOADDRESS = LPFN_WSASTRINGTOADDRESSA
+#endif
+#endif
+
+' Registration and Name Resolution API functions
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSALookupServiceBeginA Lib "ws2_32" (ByRef qsRestrictions As WSAQUERYSETA, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
+Declare Function WSALookupServiceBeginW Lib "ws2_32" (ByRef qsRestrictions As WSAQUERYSETW, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
+#ifdef UNICODE
+Declare Function WSALookupServiceBegin Lib "ws2_32" Alias "WSALookupServiceBeginW" (ByRef qsRestrictions As WSAQUERYSET, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
+#else
+Declare Function WSALookupServiceBegin Lib "ws2_32" Alias "WSALookupServiceBeginA" (ByRef qsRestrictions As WSAQUERYSET, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSALOOKUPSERVICEBEGINA = *Function(ByRef qsRestrictions As WSAQUERYSETA, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
+TypeDef LPFN_WSALOOKUPSERVICEBEGINW = *Function(ByRef qsRestrictions As WSAQUERYSETW, ControlFlags As DWord, ByRef hLookup As HANDLE) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSALOOKUPSERVICEBEGIN = LPFN_WSALOOKUPSERVICEBEGINW
+#else
+TypeDef LPFN_WSALOOKUPSERVICEBEGIN = LPFN_WSALOOKUPSERVICEBEGINA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSALookupServiceNextA Lib "ws2_32" (hLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSETA) As Long
+Declare Function WSALookupServiceNextW Lib "ws2_32" (hLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSETW) As Long
+#ifdef UNICODE
+Declare Function WSALookupServiceNext Lib "ws2_32" Alias "WSALookupServiceNextW" (hLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSET) As Long
+#else
+Declare Function WSALookupServiceNext Lib "ws2_32" Alias "WSALookupServiceNextA" (hLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSET) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSALOOKUPSERVICENEXTA = *FunctionhLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSETA) As Long
+TypeDef LPFN_WSALOOKUPSERVICENEXTW = *FunctionhLookup As HANDLE, ControlFlags As DWord, ByRef BufferLength As DWord, ByRef qsResults As WSAQUERYSETW) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSALOOKUPSERVICENEXT = LPFN_WSALOOKUPSERVICENEXTW
+#else
+TypeDef LPFN_WSALOOKUPSERVICENEXT = LPFN_WSALOOKUPSERVICENEXTA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSANSPIoctl Lib "ws2_32" (hLookup As HANDLE, ControlCode As DWord, pvInBuffer As VoidPtr, cbInBuffer As DWord,
+	pvOutBuffer As VoidPtr, cbOutBuffer As DWord, ByRef cbBytesReturned As DWord, ByRef Completion As WSACOMPLETION) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSANSPIOCTL = *Function(hLookup As HANDLE, ControlCode As DWord, pvInBuffer As VoidPtr, cbInBuffer As DWord,
+	pvOutBuffer As VoidPtr, cbOutBuffer As DWord, ByRef cbBytesReturned As DWord, ByRef Completion As WSACOMPLETION) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSALookupServiceEnd Lib "ws2_32" (hLookup As HANDLE) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSALOOKUPSERVICEEND = *Function(hLookup As HANDLE) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAInstallServiceClassA Lib "ws2_32" (ByRef ServiceClassInfo As WSASERVICECLASSINFOA) As Long
+Declare Function WSAInstallServiceClassW Lib "ws2_32" (ByRef ServiceClassInfo As WSASERVICECLASSINFOW) As Long
+#ifdef UNICODE
+Declare Function WSAInstallServiceClass Lib "ws2_32" Alias "WSAInstallServiceClassW" (ByRef ServiceClassInfo As WSASERVICECLASSINFO) As Long
+#else
+Declare Function WSAInstallServiceClass Lib "ws2_32" Alias "WSAInstallServiceClassA" (ByRef ServiceClassInfo As WSASERVICECLASSINFO) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAINSTALLSERVICECLASSA = *Function(ByRef ServiceClassInfo As WSASERVICECLASSINFOA) As Long
+TypeDef LPFN_WSAINSTALLSERVICECLASSW = *Function(ByRef ServiceClassInfo As WSASERVICECLASSINFOW) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSAINSTALLSERVICECLASS = LPFN_WSAINSTALLSERVICECLASSW
+#else
+TypeDef LPFN_WSAINSTALLSERVICECLASS = LPFN_WSAINSTALLSERVICECLASSA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSARemoveServiceClass Lib "ws2_32" (ByRef ServiceClassId As GUID) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAREMOVESERVICECLASS = *Function(ByRef ServiceClassId As GUID) As Long
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAGetServiceClassInfoA Lib "ws2_32" (ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFOA) As Long
+Declare Function WSAGetServiceClassInfoW Lib "ws2_32" (ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFOW) As Long
+#ifdef UNICODE
+Declare Function WSAGetServiceClassInfo Lib "ws2_32" Alias "WSAGetServiceClassInfoW" (ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFO) As Long
+#else
+Declare Function WSAGetServiceClassInfo Lib "ws2_32" Alias "WSAGetServiceClassInfoA" (ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFO) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAGETSERVICECLASSINFOA = *Function(ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFOA) As Long
+TypeDef LPFN_WSAGETSERVICECLASSINFOW = *Function(ByRef ProviderId As GUID, ByRef ServiceClassId As GUID, ByRef BufSize As DWord, ByRef ServiceClassInfo As WSASERVICECLASSINFOW) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSAGETSERVICECLASSINFO = LPFN_WSAGETSERVICECLASSINFOW
+#else
+TypeDef LPFN_WSAGETSERVICECLASSINFO = LPFN_WSAGETSERVICECLASSINFOA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAEnumNameSpaceProvidersA Lib "ws2_32" (ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFOA) As Long
+Declare Function WSAEnumNameSpaceProvidersW Lib "ws2_32" (ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFOW) As Long
+#ifdef UNICODE
+Declare Function WSAEnumNameSpaceProviders Lib "ws2_32" Alias "WSAEnumNameSpaceProvidersW" (ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFO) As Long
+#else
+Declare Function WSAEnumNameSpaceProviders Lib "ws2_32" Alias "WSAEnumNameSpaceProvidersA" (ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFO) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAENUMNAMESPACEPROVIDERSA = *Function(ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFOA) As Long
+TypeDef LPFN_WSAENUMNAMESPACEPROVIDERSW = *Function(ByRef BufferLength As DWord, ByRef nspBuffer As WSANAMESPACE_INFOW) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSAENUMNAMESPACEPROVIDERS = LPFN_WSAENUMNAMESPACEPROVIDERSW
+#else
+TypeDef LPFN_WSAENUMNAMESPACEPROVIDERS = LPFN_WSAENUMNAMESPACEPROVIDERSA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAGetServiceClassNameByClassIdA Lib "ws2_32" (ByRef ServiceClassId As GUID, ServiceClassName As PSTR, ByRef BufferLength As DWord) As Long
+Declare Function WSAGetServiceClassNameByClassIdW Lib "ws2_32" (ByRef ServiceClassId As GUID, ServiceClassName As PWSTR, ByRef BufferLength As DWord) As Long
+#ifdef UNICODE
+Declare Function WSAGetServiceClassNameByClassId Lib "ws2_32" Alias "WSAGetServiceClassNameByClassIdW" (ByRef ServiceClassId As GUID, ServiceClassName As PWSTR, ByRef BufferLength As DWord) As Long
+#else
+Declare Function WSAGetServiceClassNameByClassId Lib "ws2_32" Alias "WSAGetServiceClassNameByClassIdA" (ByRef ServiceClassId As GUID, ServiceClassName As PSTR, ByRef BufferLength As DWord) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA = *Function(ByRef ServiceClassId As GUID, ServiceClassName As PSTR, ByRef BufferLength As DWord) As Long
+TypeDef LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW = *Function(ByRef ServiceClassId As GUID, ServiceClassName As PWSTR, ByRef BufferLength As DWord) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSAGETSERVICECLASSNAMEBYCLASSID = LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
+#else
+TypeDef LPFN_WSAGETSERVICECLASSNAMEBYCLASSID = LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSASetServiceA Lib "ws2_32" (ByRef qsRegInfo As WSAQUERYSETA, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
+Declare Function WSASetServiceW Lib "ws2_32" (ByRef qsRegInfo As WSAQUERYSETW, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
+#ifdef UNICODE
+Declare Function WSASetService Lib "ws2_32" Alias "WSASetServiceW" (ByRef qsRegInfo As WSAQUERYSET, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
+#else
+Declare Function WSASetService Lib "ws2_32" Alias "WSASetServiceA" (ByRef qsRegInfo As WSAQUERYSET, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
+#endif
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSASETSERVICEA = *Function(ByRef qsRegInfo As WSAQUERYSETA, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
+TypeDef LPFN_WSASETSERVICEW = *Function(ByRef qsRegInfo As WSAQUERYSETW, essoperation As WSAESETSERVICEOP, ControlFlags As DWord) As Long
+#ifdef UNICODE
+TypeDef LPFN_WSASETSERVICE = LPFN_WSASETSERVICEW
+#else
+TypeDef LPFN_WSASETSERVICE = LPFN_WSASETSERVICEA
+#endif
+#endif
+
+#ifndef NO_INCL_WINSOCK_API_PROTOTYPES
+Declare Function WSAProviderConfigChange Lib "ws2_32" (ByRef NotificationHandle As HANDLE, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+#ifdef INCL_WINSOCK_API_TYPEDEFS
+TypeDef LPFN_WSAPROVIDERCONFIGCHANGE = *Function(ByRef NotificationHandle As HANDLE, ByRef Overlapped As WSAOVERLAPPED, lpCompletionRoutine As LPWSAOVERLAPPED_COMPLETION_ROUTINE) As Long
+#endif
+
+' Microsoft Windows Extended data types
+TypeDef SOCKADDR_IN = sockaddr_in
+TypeDef PSOCKADDR_IN = *sockaddr_in
+TypeDef LPSOCKADDR_IN = *sockaddr_in
+
+TypeDef LINGER = linger
+TypeDef PLINGER = *linger
+TypeDef LPLINGER = *linger
+
+TypeDef IN_ADDR = in_addr
+TypeDef PIN_ADDR = *in_addr
+TypeDef LPIN_ADDR = *in_addr
+
+TypeDef FD_SET = fd_set
+TypeDef PFD_SET = *fd_set
+TypeDef LPFD_SET = *fd_set
+
+TypeDef HOSTENT = hostent
+TypeDef PHOSTENT = *hostent
+TypeDef LPHOSTENT = *hostent
+
+TypeDef SERVENT = servent
+TypeDef PSERVENT = *servent
+TypeDef LPSERVENT = *servent
+
+TypeDef PROTOENT = protoent
+TypeDef PPROTOENT = *protoent
+TypeDef LPPROTOENT = *protoent
+
+TypeDef TIMEVAL = timeval
+TypeDef PTIMEVAL = *timeval
+TypeDef LPTIMEVAL = *timeval
+
+' Windows message parameter composition and decomposition macros.
+Const WSAMAKEASYNCREPLY(buflen, error) = MAKELONG(buflen, error)
+Const WSAMAKESELECTREPLY(event, error) = MAKELONG(event, error)
+Const WSAGETASYNCBUFLEN(lParam) = LOWORD(lParam)
+Const WSAGETASYNCERROR(lParam) = HIWORD(lParam)
+Const WSAGETSELECTEVENT(lParam) = LOWORD(lParam)
+Const WSAGETSELECTERROR(lParam) = HIWORD(lParam)
+
+'#ifdef IPV6STRICT
+'#require <wsipv6ok.ab>
+'#endif
+
+#endif
Index: /trunk/ab5.0/ablib/src/api_winspool.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/api_winspool.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/api_winspool.sbp	(revision 506)
@@ -0,0 +1,57 @@
+'api_winspool.sbp
+
+#ifdef UNICODE
+Const _FuncName_EnumPrinters = "EnumPrintersW"
+#else
+Const _FuncName_EnumPrinters = "EnumPrintersA"
+#endif
+
+Type PRINTER_INFO_5W
+	pPrinterName As LPWSTR
+	pPortName As LPWSTR
+	Attributes As DWord
+	DeviceNotSelectedTimeout As DWord
+	TransmissionRetryTimeout As DWord
+End Type
+
+Type PRINTER_INFO_5A
+	pPrinterName As LPSTR
+	pPortName As LPSTR
+	Attributes As DWord
+	DeviceNotSelectedTimeout As DWord
+	TransmissionRetryTimeout As DWord
+End Type
+
+#ifdef UNICODE
+TypeDef PRINTER_INFO_5 = PRINTER_INFO_5W
+#else
+TypeDef PRINTER_INFO_5 = PRINTER_INFO_5A
+#endif
+
+Declare Function EnumPrinters Lib "winspool.drv" Alias _FuncName_EnumPrinters (Flags As DWord, Name As LPTSTR, Level As DWord, pPrinterEnum As *Byte, cbBuf As DWord, ByRef cbNeeded As DWord, ByRef cReturned As DWord) As BOOL
+
+Const PRINTER_ENUM_DEFAULT     = &H00000001
+Const PRINTER_ENUM_LOCAL       = &H00000002
+Const PRINTER_ENUM_CONNECTIONS = &H00000004
+Const PRINTER_ENUM_FAVORITE    = &H00000004
+Const PRINTER_ENUM_NAME        = &H00000008
+Const PRINTER_ENUM_REMOTE      = &H00000010
+Const PRINTER_ENUM_SHARED      = &H00000020
+Const PRINTER_ENUM_NETWORK     = &H00000040
+
+Const PRINTER_ENUM_EXPAND      = &H00004000
+Const PRINTER_ENUM_CONTAINER   = &H00008000
+
+Const PRINTER_ENUM_ICONMASK    = &H00ff0000
+Const PRINTER_ENUM_ICON1       = &H00010000
+Const PRINTER_ENUM_ICON2       = &H00020000
+Const PRINTER_ENUM_ICON3       = &H00040000
+Const PRINTER_ENUM_ICON4       = &H00080000
+Const PRINTER_ENUM_ICON5       = &H00100000
+Const PRINTER_ENUM_ICON6       = &H00200000
+Const PRINTER_ENUM_ICON7       = &H00400000
+Const PRINTER_ENUM_ICON8       = &H00800000
+Const PRINTER_ENUM_HIDE        = &H01000000
+
+Const SPOOL_FILE_PERSISTENT    = &H00000001
+Const SPOOL_FILE_TEMPORARY     = &H00000002
Index: /trunk/ab5.0/ablib/src/basic.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/basic.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/basic.sbp	(revision 506)
@@ -0,0 +1,181 @@
+'basic.sbp
+
+#_core
+
+Sub _System_InitDllGlobalVariables()	'dummy
+End Sub
+
+Const QWORD_MAX = &HFFFFFFFFFFFFFFFF As QWord
+Const INT64_MAX = &H7FFFFFFFFFFFFFFF As Int64
+Const INT64_MIN = &H8000000000000000 As Int64
+
+Const DWORD_MAX = &HFFFFFFFF As DWord
+Const LONG_MAX = &H7FFFFFFF As Long
+Const LONG_MIN = &H80000000 As Long
+
+Const WORD_MAX = &HFFFF As Word
+Const INTEGER_MAX = &H7FFF As Integer
+Const INTEGER_MIN = &H8000 As Integer
+
+Const BYTE_MAX = &HFF As Byte
+Const SBYTE_MAX = &H7F As SByte
+Const SBYTE_MIN = &H80 As SByte
+
+Const DBL_MAX = 1.7976931348623158e+308
+Const DBL_MIN = 2.2250738585072014e-308
+
+Const FLT_MAX = 3.402823466e+38
+Const FLT_MIN = 1.175494351e-38
+
+'-------------
+' Basic Types
+'-------------
+
+'Char
+'Byte
+'Integer
+'Word
+'Long
+'TypeDef Int32 = Long
+'DWord
+'Int64
+'QWord
+'Single
+'Double
+
+TypeDef Int16 = Integer
+TypeDef Int8 = SByte
+
+' Boolena型の定数
+Const True = 1 As Boolean
+Const False = 0 As Boolean
+
+' 文字型の定義
+TypeDef WCHAR = Word
+#ifdef UNICODE
+TypeDef Char = WCHAR
+#else
+TypeDef Char = SByte
+#endif
+
+'------------------
+' Types of pointer
+'------------------
+TypeDef BytePtr =   *Byte
+TypeDef WordPtr =   *Word
+TypeDef DWordPtr =  *DWord
+TypeDef SinglePtr = *Single
+TypeDef DoublePtr = *Double
+
+Sub SetPointer(pPtr As VoidPtr, p As VoidPtr)
+	Set_LONG_PTR(pPtr, p As LONG_PTR)
+End Sub
+
+Function GetPointer(pPtr As VoidPtr) As VoidPtr
+	GetPointer = Get_LONG_PTR(pPtr) As VoidPtr
+End Function
+
+Sub Set_LONG_PTR(pPtr As VoidPtr, lpData As LONG_PTR)
+#ifdef _WIN64
+	SetQWord(pPtr,lpData)
+#else
+	SetDWord(pPtr,lpData)
+#endif
+End Sub
+
+Function Get_LONG_PTR(pPtr As VoidPtr) As LONG_PTR
+#ifdef _WIN64
+	Get_LONG_PTR = GetQWord(pPtr)
+#else
+	Get_LONG_PTR = GetDWord(pPtr)
+#endif
+End Function
+
+Sub SetChar(p As *WCHAR, c As WCHAR)
+	p[0] = c
+End Sub
+
+Function GetChar(p As *WCHAR) As WCHAR
+	GetChar = p[0]
+End Function
+
+Sub SetChar(p As *CHAR, c As CHAR)
+	p[0] = c
+End Sub
+
+Function GetChar(p As *CHAR) As CHAR
+	GetChar = p[0]
+End Function
+
+
+'--------------------------
+' Specify elements number
+'--------------------------
+Const ELM(n) = ((n) - 1)
+
+#require <windows.sbp>
+#require <crt.sbp>
+
+
+Sub _System_GetEip()	'dummy
+End Sub
+
+
+Dim _System_CriticalSection As CRITICAL_SECTION
+Dim _System_hProcessHeap As HANDLE
+
+Sub _System_StartupProgram()
+	'Unsafe
+
+		'この関数はアプリケーションの起動時にシステムからコールバックされます
+
+		InitializeCriticalSection(_System_CriticalSection)
+
+		_System_hProcessHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0)
+
+		' GC管理オブジェクトを初期化
+		_System_CGarbageCollection.Initialize()
+
+		' 動的型情報を生成
+		ActiveBasic.Core._System_TypeBase.Initialize()
+
+		'Initialize static variables
+		_System_InitStaticLocalVariables()
+
+		'TODO:
+		' Set current thread priority
+		'Dim thread = Thread.CurrentThread()
+		'thread.Priority = ThreadPriority.Normal
+
+	'End Unsafe
+End Sub
+
+Sub _System_EndProgram()
+	'Unsafe
+
+		_System_Call_Destructor_of_GlobalObject()
+
+		' GC管理オブジェクトを破棄
+		_System_pGC->Finish()
+'		_System_free( _System_pGC )
+
+		DeleteCriticalSection(_System_CriticalSection)
+
+		HeapDestroy( _System_hProcessHeap )
+
+	'End Unsafe
+End Sub
+
+
+#require <system\built_in.ab>
+#require <system\string.sbp>
+#require <system\debug.sbp>
+#require <system\gc.sbp>
+#require <system\enum.sbp>
+#require <system\exception.ab>
+
+#require <Classes\index.ab>
+
+
+#require <basic\function.sbp>
+#require <basic\command.sbp>
Index: /trunk/ab5.0/ablib/src/basic/command.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/basic/command.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/basic/command.sbp	(revision 506)
@@ -0,0 +1,441 @@
+'command.sbp
+
+Const _System_Type_SByte = 1
+Const _System_Type_Byte = 2
+Const _System_Type_Integer = 3
+Const _System_Type_Word = 4
+Const _System_Type_Long = 5
+Const _System_Type_DWord = 6
+Const _System_Type_Int64 = 7
+Const _System_Type_QWord = 8
+Const _System_Type_Single =	9
+Const _System_Type_Double =	10
+Const _System_Type_Char =	11
+Const _System_Type_String =	13
+Const _System_Type_VoidPtr =	14
+Const _System_MAX_PARMSNUM = 32-1
+
+Dim _System_DummyStr As String
+Dim _System_DummyStr2 As String
+
+Macro BEEP()
+	MessageBeep(MB_OK)
+End Macro
+
+Sub _System_Call_Destructor_of_GlobalObject()	'dummy
+End Sub
+
+Sub _System_End()
+	System.Detail.hasShutdownStarted = True
+	Dim exitCode = System.Environment.ExitCode
+	_System_EndProgram()
+	ExitProcess(exitCode)
+End Sub
+
+Macro END()
+	_System_End()
+End Macro
+
+Macro EXEC(filePath As String)(cmdLine As String)
+	ShellExecute(0, "open", ToTCStr(filePath), ToTCStr(cmdLine), 0, SW_SHOWNORMAL)
+End Macro
+
+Macro INPUT()	'dummy（INPUT_FromFile、INPUT_FromPromptを参照）
+End Macro
+
+Macro PRINT()	'dummy（PRINT_ToFile、PRINT_ToPromptを参照）
+End Macro
+
+Macro RANDOMIZE()
+	srand(GetTickCount())
+End Macro
+
+Macro WRITE()	'dummy（PRINT_ToFile、PRINT_ToPromptを参照）
+End Macro
+
+'----------------
+' ウィンドウ関連
+'----------------
+
+Macro MSGBOX(hwnd As HWND, str As String)(title As String, boxType As DWord, ByRef retAns As DWord)
+'	Dim ret = MessageBox(hwnd, ToTCStr(str), ToTCStr(title), boxType)
+'	If VarPtr(retAns) Then
+'		retAns = ret
+'	End If
+End Macro
+
+Macro WINDOW(ByRef hwndRet As HWND, hOwner As HWND, x As Long, y As Long, width As Long, height As Long, title As String, dwStyle As DWord)(className As String, id As HMENU, lpFunc As DWord, dwExStyle As DWord)
+	Dim hwnd = CreateWindowEx(dwExStyle, ToTCStr(className), ToTCStr(title), dwStyle, x, y, width, height, hOwner, id, GetModuleHandle(0), 0)
+	If VarPtr(hwndRet) Then
+		hwndRet = hwnd
+	End If
+End Macro
+
+Macro DELWND(hWnd As HWND)
+	DestroyWindow(hWnd)
+End Macro
+
+Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(str As String, id As Long, hSubMenu As HMENU, state As Long)
+	Dim mii As MENUITEMINFO
+	ZeroMemory(VarPtr(mii), Len(mii))
+	With mii
+		.cbSize = Len(mii)
+		.fMask = MIIM_TYPE
+
+		If str.Length = 0 Then
+			mii.fType = MFT_SEPARATOR
+		Else
+			.fType = MFT_STRING
+			.fMask = .fMask or MIIM_STATE or MIIM_ID
+			.dwTypeData = ToTCStr(str)
+			.wID = id
+			If hSubMenu Then
+				.fMask = .fMask or MIIM_SUBMENU
+				.hSubMenu = hSubMenu
+			End If
+			.fState = state
+		End If
+	End With
+	InsertMenuItem(hMenu, PosID, flag, mii)
+End Macro
+
+
+'--------------
+' ファイル関連
+'--------------
+
+Dim _System_hFile(255) As HANDLE
+Macro OPEN(fileName As String, AccessFor As Long, FileNumber As Long)
+	Dim access As Long
+	Dim bAppend = False As Boolean
+	Dim creationDisposition As Long
+
+	FileNumber--
+
+	Select Case AccessFor
+		Case 0
+			access = GENERIC_READ or GENERIC_WRITE
+			creationDisposition = OPEN_ALWAYS
+		Case 1
+			access = GENERIC_READ
+			creationDisposition = OPEN_EXISTING
+		Case 2
+			access = GENERIC_WRITE
+			creationDisposition = CREATE_ALWAYS
+		Case 3
+			access = GENERIC_WRITE
+			creationDisposition = OPEN_ALWAYS
+			bAppend = True
+	End Select
+
+	_System_hFile(FileNumber) = CreateFile(ToTCStr(fileName), access, 0, ByVal 0, creationDisposition, FILE_ATTRIBUTE_NORMAL, 0)
+
+	If bAppend Then SetFilePointer(_System_hFile(FileNumber), 0, 0, FILE_END)
+End Macro
+
+Macro CLOSE()(FileNumber As Long)
+	FileNumber--
+
+	If _System_hFile(FileNumber) Then
+		CloseHandle(_System_hFile(FileNumber))
+		_System_hFile(FileNumber)=0
+	End If
+End Macro
+
+'INPUT Command Data
+Dim _System_InputDataPtr[_System_MAX_PARMSNUM] As VoidPtr
+Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord
+Sub INPUT_FromFile(FileNumber As Long)
+	FileNumber--
+
+	Dim i = 0 As Long
+	Dim buffer = New System.Text.StringBuilder(256)
+	Dim temp[1] As Char
+	Dim dwAccessBytes As DWord
+	Dim IsStr As Long
+
+	While 1
+		'次のデータをサーチ
+		Do
+			Dim ret = ReadFile(_System_hFile[FileNumber],temp,SizeOf (Char),VarPtr(dwAccessBytes),ByVal 0)
+			If ret=0 or dwAccessBytes=0 Then
+				'error
+				Exit Macro
+			End If
+		Loop While temp[0]=32 or temp[0]=9
+		SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT)
+
+		'読み込み
+		IsStr=0
+		While 1
+			Dim ret = ReadFile(_System_hFile[FileNumber],temp,SizeOf (Char),VarPtr(dwAccessBytes),ByVal 0)
+			If ret = 0 or dwAccessBytes = 0 Then
+				'error
+				Exit Macro
+			End If
+			If temp[0]=34 Then IsStr=IsStr xor 1
+
+			buffer.Append(temp[0])
+			If dwAccessBytes=0 or temp[0]=0 or temp[0]=13 or temp[0]=10 or (IsStr=0 and temp[0]=Asc(",")) or (IsStr=0 and (temp[0]=32 or temp[0]=9) and _System_InputDataType[i]<>_System_Type_String) Then
+				If temp[0]=13 Then
+					ReadFile(_System_hFile[FileNumber],temp,SizeOf (Char),VarPtr(dwAccessBytes),ByVal 0)
+					If Not(dwAccessBytes<>0 And temp[0]=10) Then
+						SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT)
+						Continue
+					End If
+				End If
+
+				If temp[0]=32 or temp[0]=9 Then
+					While 1
+						ReadFile(_System_hFile[FileNumber],temp,1,VarPtr(dwAccessBytes),ByVal 0)
+						If dwAccessBytes=0 Then Exit While
+						If temp[0]=Asc(",") Then Exit While
+						If Not(temp[0]=32 or temp[0]=9) Then
+							SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT)
+							Exit While
+						End If
+					Wend
+				End If
+
+				buffer.Append(0 As Char)
+				Exit While
+			End If
+		Wend
+
+		'データを変数に格納
+		_System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], buffer.ToString)
+
+
+		i++
+		If _System_InputDataPtr[i]=0 Then Exit While
+	Wend
+End Sub
+
+Sub _System_Input_SetArgument(arg As VoidPtr, dataType As DWord, buf As String)
+	Select Case dataType
+		Case _System_Type_Double
+			SetDouble(arg, Val(buf))
+		Case _System_Type_Single
+			SetSingle(arg, Val(buf))
+		Case _System_Type_Int64,_System_Type_QWord
+			SetQWord(arg, Val(buf))
+		Case _System_Type_Long,_System_Type_DWord
+			SetDWord(arg, Val(buf))
+		Case _System_Type_Integer,_System_Type_Word
+			SetWord(arg, Val(buf))
+		Case _System_Type_SByte,_System_Type_Byte
+			SetByte(arg, Val(buf))
+		Case _System_Type_Char
+			SetChar(arg, buf[0])
+		Case _System_Type_String
+			Dim pTempStr As *String
+			pTempStr = arg As *String
+			pTempStr[0] = buf
+	End Select
+End Sub
+
+Sub PRINT_ToFile(FileNumber As Long, buf As String)
+	Dim dwAccessByte As DWord
+	FileNumber--
+
+	WriteFile(_System_hFile(FileNumber), StrPtr(buf), Len(buf), VarPtr(dwAccessByte), ByVal 0)
+End Sub
+
+Dim _System_UsingDblData[_System_MAX_PARMSNUM] As Double
+Dim _System_UsingStrData[_System_MAX_PARMSNUM] As *Char		'TODO: 暫定対応（動作未確認）
+Dim _System_UsingDataType[_System_MAX_PARMSNUM] As DWord
+/*
+Function _System_GetUsingFormat(UsingStr As String) As String
+	Dim i2 As Long, i3 As Long, i4 As Long, i5 As Long, ParmNum As Long
+	Dim temporary[255] As Char
+	Dim buffer = New System.Text.StringBuilder(1024)
+
+	ParmNum = 0
+	i2 = 0
+	While 1
+		While 1
+			If UsingStr[i2]=Asc("#") or UsingStr[i2]=Asc("@") or UsingStr[i2]=Asc("&") Then Exit While
+			buffer[i3]=UsingStr[i2]
+			If UsingStr[i2]=0 Then Exit While
+			i2++
+			i3++
+		Wend
+
+		If UsingStr[i2]=0 Then Exit While
+
+		If UsingStr[i2]=Asc("#") Then
+			Dim dec As Long, sign As Long
+			Dim temp2 As *Char
+
+			Dim length_num As Long, length_buf As Long
+			Dim dblRoundOff=0 As Double
+
+
+			'----------------------
+			' 四捨五入を考慮
+			'----------------------
+
+			i4=i2
+			While UsingStr[i4]=Asc("#")
+				i4++
+			Wend
+			If UsingStr[i4]=Asc(".") Then
+				i4++
+
+				dblRoundOff=0.5
+				While UsingStr[i4]=Asc("#")
+					i4++
+					dblRoundOff /= 10
+				Wend
+			End If
+
+
+			'浮動小数点を文字列に変換
+			temp2=_ecvt(_System_UsingDblData[ParmNum]+dblRoundOff,15,dec,sign)
+
+			'整数部
+			length_num=dec
+			If length_num<=0 Then length_num=1
+
+			'符号が有る場合は、一文字分のスペースを考慮する
+			If sign Then length_num++
+
+			length_buf=0
+			Do
+				i2++
+				length_buf++
+			Loop While UsingStr[i2]=Asc("#")
+
+			If length_buf>=length_num Then
+				'通常時
+				ActiveBasic.Strings.Detail.ChrFill(VarPtr(buffer.Chars[i3]), length_buf - length_num, &h20) 'Asc(" ")
+
+				i3 += length_buf - length_num
+
+				If sign Then
+					buffer[i3] = Asc("-")
+					i3++
+
+					length_num--
+				End If
+
+				If dec > 0 Then
+					memcpy(VarPtr(buffer.Chars[i3]), temp2, SizeOf (Char) * length_num)
+				Else
+					buffer[i3] = &H30
+				End If
+
+				i3 += length_num
+			Else
+				'表示桁が足りないとき
+				ActiveBasic.Strings.Detail.ChrFill(VarPtr(buffer.Chars[i3]), length_buf, &h23) 'Asc("#")
+				i3 += length_buf
+			End If
+
+			If UsingStr[i2] = Asc(".") Then
+				buffer[i3] = UsingStr[i2]
+				i2++
+				i3++
+
+				i4=dec
+				While UsingStr[i2] = Asc("#")
+					If i4<0 Then
+						buffer[i3]=&H30
+					Else
+						buffer[i3]=temp2[i4]
+					End If
+					i3++
+					i4++
+
+					i2++
+				Wend
+			End If
+		ElseIf UsingStr[i2]=Asc("@") Then
+			i2++
+
+			lstrcat(VarPtr(buffer.Chars[i3]), _System_UsingStrData[ParmNum])
+			i3 += lstrlen(_System_UsingStrData[ParmNum])
+		ElseIf UsingStr[i2]=Asc("&") Then
+			i4=0
+			Do
+				i4++
+				i2++
+			Loop While UsingStr[i2]=Asc(" ")
+
+			If UsingStr[i2]=Asc("&") Then
+				i4++
+				i2++
+				i5=lstrlen(_System_UsingStrData[ParmNum])
+				If i4<=i5 Then
+					i5=i4
+				Else
+					ActiveBasic.Strings.Detail.ChrFill(VarPtr(buffer.Chars[i3]), i4, &h20) 'Asc(" ")
+				End If
+				memcpy(VarPtr(buffer.Chars[i3]), _System_UsingStrData[ParmNum], SizeOf (Char) * i5)
+				i3 += i4
+			Else
+				i2 -= i4
+				buffer[i3] = Asc("&")
+				i2++
+				i3++
+				Continue
+			End If
+		End If
+
+		ParmNum++
+	Wend
+
+	_System_GetUsingFormat = buffer.ToString(0, lstrlen(StrBPtr(buffer)))
+End Function
+
+' TODO: _System_GetUsingFormatを用意して実装する
+Sub PRINTUSING_ToFile(FileNumber As Long, UsingStr As String)
+	Dim dwAccessByte As DWord
+	Dim buf As String
+
+	FileNumber--
+	buf=_System_GetUsingFormat(UsingStr)
+
+	WriteFile(_System_hFile(FileNumber),buf,Len(buf),VarPtr(dwAccessByte),ByVal NULL)
+End Sub
+*/
+
+Dim _System_FieldSize(255) As Long
+Macro FIELD(FileNumber As Long, FieldSize As Long)
+	FileNumber--
+	_System_FieldSize(FileNumber)=FieldSize
+End Macro
+Macro GET(FileNumber As Long, RecodeNumber As Long, ByRef buffer As String)
+	Dim dwAccessByte As DWord
+
+	FileNumber--
+	RecodeNumber--
+
+	SetFilePointer(_System_hFile(FileNumber), SizeOf (Char) * RecodeNumber * _System_FieldSize(FileNumber), 0, FILE_BEGIN)
+	Dim t = ZeroString(_System_FieldSize(FileNumber))
+	ReadFile(_System_hFile(FileNumber), StrPtr(t), SizeOf (Char) * _System_FieldSize(FileNumber), VarPtr(dwAccessByte), ByVal 0)
+	If dwAccessByte = _System_FieldSize(FileNumber) Then
+		buffer = t.ToString
+	Else
+		buffer = Left$(t.ToString, dwAccessByte)
+	End If
+End Macro
+Macro PUT(FileNumber As Long, RecodeNumber As Long, buffer As String)
+	Dim dwAccessByte As DWord
+
+	FileNumber--
+	RecodeNumber--
+
+	SetFilePointer(_System_hFile(FileNumber), SizeOf (Char) * RecodeNumber*_System_FieldSize(FileNumber), 0, FILE_BEGIN)
+	WriteFile(_System_hFile(FileNumber), StrPtr(buffer), SizeOf (Char) * _System_FieldSize(FileNumber), VarPtr(dwAccessByte), ByVal 0)
+End Macro
+
+Macro CHDIR(path As String)
+	SetCurrentDirectory(ToTCStr(path))
+End Macro
+Macro MKDIR(path As String)
+	CreateDirectory(ToTCStr(path), 0)
+End Macro
+Macro KILL(path As String)
+	DeleteFile(ToTCStr(path))
+End Macro
Index: /trunk/ab5.0/ablib/src/basic/dos_console.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/basic/dos_console.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/basic/dos_console.sbp	(revision 506)
@@ -0,0 +1,67 @@
+'dos_console.sbp
+'このファイルには、コンソール アプリケーション用のサポート プログラムが記載されます。
+
+
+#ifndef _INC_DOS_CONSOLE
+#define _INC_DOS_CONSOLE
+
+
+Dim _System_hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE)
+Dim _System_hConsoleIn = GetStdHandle(STD_INPUT_HANDLE)
+System.Console.SetIn(
+	System.IO.TextReader.Synchronized(New System.IO.StreamReader(
+		New System.IO.FileStream(_System_hConsoleIn, System.IO.FileAccess.Read, False))))
+
+'---------- command.sbp内で定義済み ----------
+'Dim _System_InputDataPtr[_System_MAX_PARMSNUM] As VoidPtr
+'Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord
+'---------------------------------------------
+Sub INPUT_FromPrompt(ShowStr As String)
+*InputReStart '多重Continueがあるので、これはループ構文に直せない。
+	PRINT_ToPrompt(ShowStr)
+
+	'入力
+	Dim input = System.Console.ReadLine()
+	If ActiveBasic.IsNothing(input) Then
+		Exit Sub
+	End If
+
+	If input.Length = 0 Then Goto *InputReStart
+
+	'データを変数に格納
+	Const comma = &h2c As Char 'Asc(",")
+	Dim broken = ActiveBasic.Strings.Detail.Split(input, comma)
+	Dim i As Long
+	For i = 0 To ELM(broken.Count)
+		If _System_InputDataPtr[i] = 0 Then
+			PRINT_ToPrompt(Ex"入力データの個数が多すぎます\r\n")
+			 Goto *InputReStart
+		End If
+		_System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], broken[i])
+	Next
+
+	If _System_InputDataPtr[i]<>0 Then
+		PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n")
+		 Goto *InputReStart
+	End If
+End Sub
+
+Macro LOCATE(x As Long, y As Long)
+	SetConsoleCursorPosition(_System_hConsoleOut, MAKELONG(x, y))
+End Macro
+
+Sub PRINT_ToPrompt(buf As String)
+	If String.IsNullOrEmpty(buf) Then
+		Exit Sub
+	End If
+
+	Dim dwAccessBytes As DWord
+	WriteConsole(_System_hConsoleOut, buf.StrPtr, buf.Length, dwAccessBytes, 0)
+End Sub
+/* TODO: _System_GetUsingFormatを用意して実装する
+Sub PRINTUSING_ToPrompt(UsingStr As String)
+	PRINT_ToPrompt(_System_GetUsingFormat(UsingStr))
+End Sub
+*/
+
+#endif '_INC_DOS_CONSOLE
Index: /trunk/ab5.0/ablib/src/basic/function.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/basic/function.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/basic/function.sbp	(revision 506)
@@ -0,0 +1,987 @@
+'function.sbp
+
+Const _System_PI = 3.14159265358979323846264
+Const _System_LOG2 = 0.6931471805599453094172321214581765680755
+Const _System_SQRT2 = 1.41421356237309504880168872421
+Const _System_Log_N = 7 As Long
+
+'------------- サポート関数の定義 -------------
+
+Function ldexp(x As Double, n As Long) As Double
+	If x = 0 Then
+		ldexp = 0
+		Exit Function
+	End If
+	Dim pSrc = VarPtr(x) As *QWord
+	Dim pDest = VarPtr(ldexp) As *QWord
+	n += (pSrc[0] >> 52) As DWord And &h7FF
+	pDest[0] = n << 52 Or (pSrc[0] And &h800FFFFFFFFFFFFF)
+End Function
+
+Function frexp(x As Double, ByRef n As Long) As Double
+	If x = 0 Then
+		n = 0
+		frexp = 0
+		Exit Function
+	End If
+
+	Dim pSrc = VarPtr(x) As *QWord
+	Dim pDest = VarPtr(frexp) As *QWord
+	n = ((pSrc[0] >> 52) As DWord And &h7FF) - 1022
+	pDest[0] = (pSrc[0] And &h800FFFFFFFFFFFFF) Or &h3FE0000000000000
+End Function
+
+Function frexp(x As Single, ByRef n As Long) As Single
+	If x = 0 Then
+		n = 0
+		frexp = 0
+		Exit Function
+	End If
+
+	Dim pSrc As *DWord, pDest As *DWord
+	pSrc = VarPtr(x) As *DWord
+	pDest = VarPtr(frexp) As *DWord
+	n = ((pSrc[0] >> 23) And &hFF) - 126
+	pDest[0] = (pSrc[0] And &h807FFFFF) Or &h7E000000
+End Function
+
+Function ipow(x As Double, n As Long) As Double
+	Dim abs_n As Long
+	Dim r = 1 As Double
+
+	abs_n=Abs(n) As Long
+	While abs_n<>0
+		If abs_n and 1 Then r *= x
+		x = x * x
+		abs_n >>= 1 ' abs_n \= 2
+	Wend
+
+	If n>=0 Then
+		ipow=r
+	Else
+		ipow=1/r
+	End If
+End Function
+
+Function pow(x As Double, y As Double) As Double
+'	If -LONG_MAX<=y and y<=LONG_MAX and y=CDbl(Int(y)) Then
+	If y = (y As Long) Then
+		pow = ipow(x, y As Long)
+	ElseIf x>0 Then
+		pow = Exp(y * Log(x))
+		Exit Function
+	ElseIf x<>0 or y<=0 Then
+		pow = ActiveBasic.Math.Detail.GetNaN()
+	Else
+		pow = 0
+	End If
+End Function
+
+Const RAND_MAX = &H7FFFFFFF
+Dim _System_RndNext = 1 As DWord
+
+Function rand() As Long
+	_System_RndNext = _System_RndNext * 1103515245 + 12345
+	rand = (_System_RndNext >> 1) As Long
+End Function
+
+Sub srand(dwSeek As DWord)
+	_System_RndNext = dwSeek
+End Sub
+
+
+'------------- ここからBasic標準関数の定義 -------------
+
+'------------------
+' データ型変換関数
+'------------------
+
+Function CDbl(number As Double) As Double
+	CDbl=number
+End Function
+
+Function _CUDbl(number As QWord) As Double
+	_CUDbl=number As Double
+End Function
+
+Function CDWord(num As Double) As DWord
+	CDWord=num As DWord
+End Function
+
+Function CInt(number As Double) As Long
+	CInt=number As Long
+End Function
+
+Function CSng(number As Double) As Single
+	CSng=number As Single
+End Function
+
+#ifdef _WIN64
+Function Fix(number As Double) As Long
+	Fix=number As Long
+End Function
+#else
+'Fix関数はコンパイラに組み込まれている
+'Function Fix(number As Double) As Long
+#endif
+
+Function Int(number As Double) As Long
+	Int = Fix(number)
+	If number < 0 Then
+		If number < Fix(number) Then Int--
+	End If
+End Function
+
+
+'-------------------------------------
+' ポインタ関数（コンパイラに組み込み）
+'-------------------------------------
+
+'Function GetDouble(p As DWord) As Double
+'Function GetSingle(p As DWord) As Single
+'Function GetDWord(p As DWord) As DWord
+'Function GetWord(p As DWord) As Word
+'Function GetByte(p As DWord) As Byte
+'Sub SetDouble(p As DWord, dblData As Double)
+'Sub SetSingle(p As DWord, fltData As Single)
+'Sub SetDWord(p As DWord, dwData As DWord)
+'Sub SetWord(p As DWord, wData As Word)
+'Sub SetByte(p As DWord, byteData As Byte)
+
+
+'----------
+' 算術関数
+'----------
+
+Function Abs(number As Double) As Double
+	'Abs = System.Math.Abs(number)
+	If number < 0 then
+		Abs = -number
+	Else
+		Abs = number
+	End If
+End Function
+
+Function Abs(number As Int64) As Int64
+	If number < 0 then
+		Abs = -number
+	Else
+		Abs = number
+	End If
+End Function
+
+Function Abs(number As Long) As Long
+	If number < 0 then
+		Abs = -number
+	Else
+		Abs = number
+	End If
+End Function
+
+Function Exp(x As Double) As Double
+	Exp = System.Math.Exp(x)
+End Function
+
+Function Log(x As Double) As Double
+	Log = System.Math.Log(x)
+End Function
+
+Function Sgn(number As Double) As Long
+	Sgn = System.Math.Sign(number)
+End Function
+
+Function Sqr(number As Double) As Double
+	Sqr = System.Math.Sqrt(number)
+End Function
+
+Function Atn(number As Double) As Double
+	Atn = System.Math.Atan(number)
+End Function
+
+Function Atn2(y As Double, x As Double) As Double
+	Atn2 = System.Math.Atan2(y, x)
+End Function
+
+Function Sin(number As Double) As Double
+	Sin = System.Math.Sin(number)
+End Function
+
+Function Cos(number As Double) As Double
+	Cos = System.Math.Cos(number)
+End Function
+
+Function Tan(number As Double) As Double
+	Tan = System.Math.Tan(number)
+End Function
+
+Const RAND_UNIT = (1.0 / (LONG_MAX + 1.0))
+Function Rnd() As Double
+	Rnd = RAND_UNIT * rand()
+End Function
+
+Const HIDWORD(qw) = (((qw As QWord) >> 32) And &HFFFFFFFF) As DWord
+Const LODWORD(qw) = ((qw As QWord) And &HFFFFFFFF) As DWord
+
+Const MAKEDWORD(l, h) = (((l As DWord) And &HFFFF) Or (((h As DWord) And &HFFFF) << 16)) As DWord
+Const MAKEQWORD(l, h) = (((l As QWord) And &HFFFFFFFF) Or (((h As QWord) And &HFFFFFFFF) << 32)) As QWord
+
+'------------
+' 文字列関数
+'------------
+
+Function Asc(buf As String) As Char
+	Asc = buf[0]
+End Function
+
+Function Chr$(code As Char) As String
+	Chr$ = New String(code, 1)
+End Function
+
+#ifdef UNICODE
+Function AscW(s As String) As UCSCHAR
+	If String.IsNullOrEmpty(s) Then
+		AscW = 0
+		'ArgumentNullExceptionに変えるかも
+	Else
+		If _System_IsHighSurrogate(s[0]) Then
+			'有効なサロゲートペアになっていない場合には、
+			'例外を投げるようにしたほうがよいかもしれない。
+			If s.Length > 1 Then
+				If _System_IsLowSurrogate(s[0]) Then
+					AscW = ((s[0] And &h3FF) As DWord << 10) Or (s[1] And &h3FF)
+					AscW += &h10000
+					Exit Function
+				End If
+			End If
+		Else
+			AscW = s[0]
+		End If
+	End If
+End Function
+
+Function ChrW(c As UCSCHAR) As String
+	If c <= &hFFFF Then
+		Return New String(c As Char, 1)
+	ElseIf c <= &h10FFFF Then
+		c -= &h10000
+		Dim t[1] As WCHAR
+		t[0] = (&hD800 Or (c >> 10)) As WCHAR
+		t[1] = (&hDC00 Or (c And &h3FF)) As WCHAR
+		Return New String(t, 2)
+	Else
+		Throw New System.ArgumentOutOfRangeException("ChrW: c is invalid Unicode code point.", "c")
+	End If
+End Function
+#endif
+
+Function Date$() As String
+	Dim date = System.DateTime.Now
+	Dim buf = New System.Text.StringBuilder(10)
+
+	'year
+	buf.Append(date.Year)
+
+	'month
+	If date.Month < 10 Then
+		buf.Append("/0")
+	Else
+		buf.Append("/")
+	End If
+	buf.Append(date.Month)
+
+	'day
+	If date.Day < 10 Then
+		buf.Append("/0")
+	Else
+		buf.Append("/")
+	End If
+	buf.Append(date.Day)
+
+	Date$ = buf.ToString
+End Function
+
+Function Hex$(x As DWord) As String
+	Imports ActiveBasic.Strings.Detail
+	Hex$ = FormatIntegerX(x, 1, 0, None)
+End Function
+
+Function Hex$(x As QWord) As String
+	Imports ActiveBasic.Strings.Detail
+	Hex$ = FormatIntegerLX(x, 1, 0, None)
+End Function
+
+Function InStr(StartPos As Long, buf1 As String, buf2 As String) As Long
+	Dim i As Long, i2 As Long, i3 As Long
+
+	Dim len1 = buf1.Length
+	Dim len2 = buf2.Length
+
+	If len2=0 Then
+		InStr=StartPos
+		Exit Function
+	End If
+
+	StartPos--
+	If StartPos<0 Then
+		'error
+		InStr=0
+		Exit Function
+	End If
+
+	i=StartPos:InStr=0
+	While i<=len1-len2
+		i2=i:i3=0
+		Do
+			If i3=len2 Then
+				InStr=i+1
+				Exit Do
+			End If
+			If buf1[i2]<>buf2[i3] Then Exit Do
+
+			i2++
+			i3++
+		Loop
+		If InStr Then Exit While
+		i++
+	Wend
+End Function
+
+Function Left$(s As String, length As Long) As String
+	Left$ = s.Substring(0, System.Math.Min(s.Length, length))
+End Function
+
+Function Mid$(s As String, startPos As Long) As String
+	startPos--
+	Mid$ = s.Substring(startPos)
+End Function
+
+Function Mid$(s As String, startPos As Long, readLength = 0 As Long) As String
+	startPos--
+	Dim length = s.Length
+	Mid$ = s.Substring(System.Math.Min(startPos, length), System.Math.Min(readLength, length - startPos))
+End Function
+
+Function Oct$(n As QWord) As String
+	Imports ActiveBasic.Strings.Detail
+	Oct$ = FormatIntegerLO(n, 1, 0, None)
+End Function
+
+Function Oct$(n As DWord) As String
+	Imports ActiveBasic.Strings.Detail
+	Oct$ = FormatIntegerO(n, 1, 0, None)
+End Function
+
+Function Right$(s As String, length As Long) As String
+	Right$ = s.Substring(System.Math.Max(0, s.Length - length), s.Length)
+End Function
+
+Function Space$(length As Long) As String
+	Return New String(&h20 As Char, length)
+End Function
+
+Sub _ecvt_support(buf As *Char, count As Long, size As Long)
+	Dim i As Long
+	If buf[count] = 9 Then
+		buf[count] = 0
+		If count = 0 Then
+			For i = size To 1 Step -1
+				buf[i] = buf[i-1]
+			Next
+			buf[0] = 1
+		Else
+			_ecvt_support(buf, count-1, size)
+		End If
+	Else
+		buf[count]++
+	End If
+End Sub
+
+Sub _ecvt(buffer As *Char, value As Double, count As Long, ByRef dec As Long, ByRef sign As Boolean)
+	Dim i As Long, i2 As Long
+
+	'値が0の場合
+	If value = 0 Then
+		ActiveBasic.Strings.ChrFill(buffer, count As SIZE_T, &h30 As Char)
+		buffer[count] = 0
+		dec = 0
+		sign = 0
+		Exit Function
+	End If
+
+	'符号の判断（同時に符号を取り除く）
+	If value < 0 Then
+		sign = True
+		value = -value
+	Else
+		sign = False
+	End If
+
+	'正規化
+	dec = 1
+	While value < 0.999999999999999 'value<1
+		value *= 10
+		dec--
+	Wend
+	While 9.99999999999999 <= value '10<=value
+		value /= 10
+		dec++
+	Wend
+
+	For i = 0 To count - 1
+		buffer[i] = Int(value) As Char
+		value = (value-CDbl(Int(value))) * 10
+	Next
+
+	i--
+	If value >= 5 Then
+		'切り上げ処理
+		_ecvt_support(buffer, i, count)
+	End If
+
+	For i = 0 To count - 1
+		buffer[i] += &H30
+	Next
+	buffer[i] = 0
+End Sub
+
+Function Str$(dbl As Double) As String
+	Imports ActiveBasic.Math
+	Imports ActiveBasic.Strings
+	If IsNaN(dbl) Then
+		Return "NaN"
+	ElseIf IsInf(dbl) Then
+		If dbl > 0 Then
+			Return "Infinity"
+		Else
+			Return "-Infinity"
+		End If
+	End If
+	Dim dec As Long, sign As Boolean
+	Dim buffer[32] As Char, temp[15] As Char
+	Dim i = 0 As Long
+
+	'浮動小数点を文字列に変換
+	_ecvt(temp, dbl, 15, dec, sign)
+
+	'符号の取り付け
+	If sign Then
+		buffer[i] = Asc("-")
+		i++
+	End If
+
+	If dec > 15 Or dec < -3 Then
+		'指数表示
+		buffer[i] = temp[0]
+		i++
+		buffer[i] = Asc(".")
+		i++
+		ChrCopy(VarPtr(buffer[i]), VarPtr(temp[1]), 14 As SIZE_T)
+		i += 14
+		buffer[i] = 0
+		Return MakeStr(buffer) + SPrintf("e%+03d", New System.Int32(dec - 1))
+	End If
+
+	'整数部
+	Dim i2 = dec
+	Dim i3 = 0
+	If i2>0 Then
+		While i2>0
+			buffer[i]=temp[i3]
+			i++
+			i3++
+			i2--
+		Wend
+		buffer[i]=Asc(".")
+		i++
+	Else
+		buffer[i]=&H30
+		i++
+		buffer[i]=Asc(".")
+		i++
+
+		i2=dec
+		While i2<0
+			buffer[i]=&H30
+			i++
+			i2++
+		Wend
+	End If
+
+	'小数部
+	While i3<15
+		buffer[i]=temp[i3]
+		i++
+		i3++
+	Wend
+
+	While buffer[i-1]=&H30
+		i--
+	Wend
+	If buffer[i-1]=Asc(".") Then i--
+
+	buffer[i]=0
+	Return MakeStr(buffer)
+End Function
+
+Function Str$(x As Int64) As String
+	Imports ActiveBasic.Strings.Detail
+	Return FormatIntegerEx(TraitsIntegerD[1], x As QWord, 1, 0, None)
+End Function
+
+Function Str$(x As QWord) As String
+	Imports ActiveBasic.Strings.Detail
+	Return FormatIntegerEx(TraitsIntegerU[1], x, 1, 0, None)
+End Function
+
+Function Str$(x As Long) As String
+	Imports ActiveBasic.Strings.Detail
+	Return FormatIntegerEx(TraitsIntegerD[0], x, 1, 0, None)
+End Function
+
+Function Str$(x As DWord) As String
+	Imports ActiveBasic.Strings.Detail
+	Return FormatIntegerEx(TraitsIntegerU[0], x, 1, 0, None)
+End Function
+
+Function Str$(x As Word) As String
+	Return Str$(x As DWord)
+End Function
+
+Function Str$(x As Integer) As String
+	Return Str$(x As Long)
+End Function
+
+Function Str$(x As Byte) As String
+	Return Str$(x As DWord)
+End Function
+
+Function Str$(x As SByte) As String
+	Return Str$(x As Long)
+End Function
+
+Function Str$(x As Single) As String
+	Return Str$(x As Double)
+End Function
+
+Function Str$(b As Boolean) As String
+	If b Then
+		Return "True"
+	Else
+		Return "False"
+	End If
+End Function
+
+Function String$(n As Long, s As Char) As String
+	Return New String(s, n)
+End Function
+
+#ifdef _AB4_COMPATIBILITY_STRING$_
+Function String$(n As Long, s As String) As String
+	If n < 0 Then
+		'Throw ArgumentOutOfRangeException
+	End If
+	Dim buf = New System.Text.StringBuilder(s.Length * n)
+	Dim i As Long
+	For i = 1 To n
+		buf.Append(s)
+	Next
+End Function
+#else
+Function String$(n As Long, s As String) As String
+	Dim c As Char
+	If String.IsNullOrEmpty(s) Then
+		c = 0
+	Else
+		c = s[0]
+	End If
+	String$ = New String(c, n)
+End Function
+#endif
+
+Function Time$() As String
+	Dim time = System.DateTime.Now
+	Dim buf = New System.Text.StringBuilder(8)
+	'hour
+	If time.Hour < 10 Then
+		buf.Append("0")
+	End If
+	buf.Append(time.Hour)
+
+	'minute
+	If time.Minute < 10 Then
+		buf.Append(":0")
+	Else
+		buf.Append(":")
+	End If
+	buf.Append(time.Minute)
+
+	'second
+	If time.Second < 10 Then
+		buf.Append(":0")
+	Else
+		buf.Append(":")
+	End If
+	buf.Append(time.Second)
+	Time$ = buf.ToString
+End Function
+
+Function Val(buf As *Char) As Double
+	Dim i As Long, i2 As Long, i3 As Long, i4 As Long
+	Dim temporary As String
+	Dim TempPtr As *Char
+	Dim dbl As Double
+	Dim i64data As Int64
+
+	Val=0
+
+	While ActiveBasic.CType.IsSpace(buf[0])
+		buf = VarPtr(buf[1])
+	Wend
+
+	If buf[0]=Asc("&") Then
+		temporary = New String( buf )
+		temporary = temporary.ToUpper()
+		TempPtr = StrPtr(temporary)
+		If TempPtr(1) = Asc("O") Then
+			'8進数
+			i=2
+			While 1
+				'数字以外の文字の場合は抜け出す
+				i3=TempPtr[i]-&H30
+				If Not (0<=i3 And i3<=7) Then Exit While
+
+				TempPtr[i]=i3 As Char
+				i++
+			Wend
+			i--
+
+			i64data=1
+			While i>=2
+				Val += ( i64data * TempPtr[i] ) As Double
+
+				i64data *= &O10
+				i--
+			Wend
+		ElseIf TempPtr(1)=Asc("H") Then
+			'16進数
+			i=2
+			While 1
+				'数字以外の文字の場合は抜け出す
+				i3=TempPtr[i]-&H30
+				If Not(0<=i3 and i3<=9) Then
+					i3=TempPtr[i]-&H41+10
+					If Not(&HA<=i3 and i3<=&HF) Then Exit While
+				End If
+
+				TempPtr[i]=i3 As Char
+				i++
+			Wend
+			i--
+
+			i64data=1
+			While i>=2
+				Val += (i64data*TempPtr[i]) As Double
+
+				i64data *= &H10
+				i--
+			Wend
+		End If
+	Else
+		'10進数
+#ifdef UNICODE
+		swscanf(buf,"%lf",VarPtr(Val))
+#else
+		sscanf(buf,"%lf",VarPtr(Val))
+#endif
+	End If
+End Function
+
+
+'--------------
+' ファイル関数
+'--------------
+
+Function Eof(FileNum As Long) As Long
+	FileNum--
+	Dim dwCurrent = SetFilePointer(_System_hFile(FileNum), 0,NULL, FILE_CURRENT)
+	Dim dwEnd = SetFilePointer(_System_hFile(FileNum), 0, NULL, FILE_END)
+	SetFilePointer(_System_hFile(FileNum), dwCurrent, NULL, FILE_BEGIN)
+
+	If dwCurrent>=dwEnd Then
+		Eof=-1
+	Else
+		Eof=0
+	End If
+End Function
+
+Function Lof(FileNum As Long) As Long
+	Lof = GetFileSize(_System_hFile(FileNum-1), 0)
+End Function
+
+Function Loc(FileNum As Long) As Long
+	FileNum--
+
+	Dim NowPos = SetFilePointer(_System_hFile(FileNum), 0, 0, FILE_CURRENT)
+	Dim BeginPos = SetFilePointer(_System_hFile(FileNum), 0, 0, FILE_BEGIN)
+	SetFilePointer(_System_hFile(FileNum), NowPos - BeginPos, 0, FILE_BEGIN)
+
+	Loc = NowPos - BeginPos
+End Function
+
+
+'------------------
+' メモリ関連の関数
+'------------------
+
+Function malloc(stSize As SIZE_T) As VoidPtr
+	Return _System_pGC->__malloc(stSize,_System_GC_FLAG_NEEDFREE or _System_GC_FLAG_ATOMIC)
+End Function
+
+Function calloc(stSize As SIZE_T) As VoidPtr
+	Return _System_pGC->__malloc(stSize,_System_GC_FLAG_NEEDFREE or _System_GC_FLAG_ATOMIC or _System_GC_FLAG_INITZERO)
+End Function
+
+Function realloc(lpMem As VoidPtr, stSize As SIZE_T) As VoidPtr
+	If lpMem = 0 Then
+		Return malloc(stSize)
+	Else
+		Return _System_pGC->__realloc(lpMem,stSize)
+	End If
+End Function
+
+Sub free(lpMem As VoidPtr)
+	_System_pGC->__free(lpMem)
+End Sub
+
+Function _System_malloc(stSize As SIZE_T) As VoidPtr
+	Return HeapAlloc(_System_hProcessHeap, 0, stSize)
+End Function
+
+Function _System_calloc(stSize As SIZE_T) As VoidPtr
+	Return HeapAlloc(_System_hProcessHeap, HEAP_ZERO_MEMORY, stSize)
+End Function
+
+Function _System_realloc(lpMem As VoidPtr, stSize As SIZE_T) As VoidPtr
+	If lpMem = 0 Then
+		Return HeapAlloc(_System_hProcessHeap, 0, stSize)
+	Else
+		Return HeapReAlloc(_System_hProcessHeap, 0, lpMem, stSize)
+	End If
+End Function
+
+Sub _System_free(lpMem As VoidPtr)
+	HeapFree(_System_hProcessHeap, 0, lpMem)
+End Sub
+
+
+'--------
+' その他
+'--------
+
+Sub _splitpath(path As PCSTR, drive As PSTR, dir As PSTR, fname As PSTR, ext As PSTR)
+	Dim i As Long, i2 As Long, i3 As Long, length As Long
+	Dim buffer[MAX_PATH] As SByte
+
+	'":\"をチェック
+	If not(path[1]=&H3A and path[2]=&H5C) Then Exit Sub
+
+	'ドライブ名をコピー
+	If drive Then
+		drive[0]=path[0]
+		drive[1]=path[1]
+		drive[2]=0
+	End If
+
+	'ディレクトリ名をコピー
+	i=2
+	i2=0
+	Do
+		If IsDBCSLeadByte(path[i]) <> FALSE and path[i + 1] <> 0 Then
+			If dir Then
+				dir[i2]=path[i]
+				dir[i2+1]=path[i+1]
+			End If
+
+			i += 2
+			i2 += 2
+			Continue
+		End If
+
+		If path[i]=0 Then Exit Do
+
+		If path[i]=&H5C Then '"\"記号であるかどうか
+			i3=i2+1
+		End If
+
+		If dir Then dir[i2]=path[i]
+
+		i++
+		i2++
+	Loop
+	If dir Then dir[i3]=0
+	i3 += i-i2
+
+	'ファイル名をコピー
+	i=i3
+	i2=0
+	i3=-1
+	Do
+'#ifdef UNICODE
+'		If _System_IsSurrogatePair(path[i], path[i + 1]) Then
+'#else
+		If IsDBCSLeadByte(path[i]) <> FALSE and path[i + 1] <> 0 Then
+'#endif
+			If fname Then
+				fname[i2]=path[i]
+				fname[i2+1]=path[i+1]
+			End If
+
+			i += 2
+			i2 += 2
+			Continue
+		End If
+
+		If path[i]=0 Then Exit Do
+
+		If path[i]=&H2E Then	'.'記号であるかどうか
+			i3=i2
+		End If
+
+		If fname Then fname[i2]=path[i]
+
+		i++
+		i2++
+	Loop
+	If i3=-1 Then i3=i2
+	If fname Then fname[i3]=0
+	i3 += i-i2
+
+	'拡張子名をコピー
+	If ext Then
+		If i3 Then
+			lstrcpy(ext,path+i3)
+		End If
+		else ext[0]=0
+	End If
+End Sub
+
+Function GetBasicColor(ColorCode As Long) As Long
+	Select Case ColorCode
+		Case 0
+			GetBasicColor=RGB(0,0,0)
+		Case 1
+			GetBasicColor=RGB(0,0,255)
+		Case 2
+			GetBasicColor=RGB(255,0,0)
+		Case 3
+			GetBasicColor=RGB(255,0,255)
+		Case 4
+			GetBasicColor=RGB(0,255,0)
+		Case 5
+			GetBasicColor=RGB(0,255,255)
+		Case 6
+			GetBasicColor=RGB(255,255,0)
+		Case 7
+			GetBasicColor=RGB(255,255,255)
+	End Select
+End Function
+
+Function _System_BSwap(x As Word) As Word
+	Dim src = VarPtr(x) As *Byte
+	Dim dst = VarPtr(_System_BSwap) As *Byte
+	dst[0] = src[1]
+	dst[1] = src[0]
+End Function
+
+Function _System_BSwap(x As DWord) As DWord
+	Dim src = VarPtr(x) As *Byte
+	Dim dst = VarPtr(_System_BSwap) As *Byte
+	dst[0] = src[3]
+	dst[1] = src[2]
+	dst[2] = src[1]
+	dst[3] = src[0]
+End Function
+
+Function _System_BSwap(x As QWord) As QWord
+	Dim src = VarPtr(x) As *Byte
+	Dim dst = VarPtr(_System_BSwap) As *Byte
+	dst[0] = src[7]
+	dst[1] = src[6]
+	dst[2] = src[5]
+	dst[3] = src[4]
+	dst[4] = src[3]
+	dst[5] = src[2]
+	dst[6] = src[1]
+	dst[7] = src[0]
+End Function
+
+Function _System_HashFromUInt(x As QWord) As Long
+	Return (HIDWORD(x) Xor LODWORD(x)) As Long
+End Function
+
+Function _System_HashFromUInt(x As DWord) As Long
+	Return x As Long
+End Function
+
+Function _System_HashFromPtr(p As VoidPtr) As Long
+	Return _System_HashFromUInt(p As ULONG_PTR)
+End Function
+
+/*!
+@brief	ObjPtrの逆。ABオブジェクトを指すポインタをObject型へ変換。
+@author	Egtra
+@date	2007/08/24
+@param[in]	p	オブジェクトを指すポインタ
+@return Object参照型
+*/
+Function _System_PtrObj(p As VoidPtr) As Object
+	SetPointer(VarPtr(_System_PtrObj), p)
+End Function
+
+/*!
+@brief	IUnknownその他COMインタフェースを指すポインタをIUnknown参照型へ変換。
+@author	Egtra
+@date	2007/09/24
+@param[in]	p	COMインタフェースを指すポインタ
+@return IUnknown参照型
+*/
+Function _System_PtrUnknown(p As VoidPtr) As IUnknown
+	SetPointer(VarPtr(_System_PtrUnknown), p)
+End Function
+
+'--------
+' 文字列関数その2
+'--------
+Function _System_IsSurrogatePair(wcHigh As WCHAR, wcLow As WCHAR) As Boolean
+	If _System_IsHighSurrogate(wcHigh) Then
+		If _System_IsLowSurrogate(wcLow) Then
+			Return True
+		End If
+	End If
+	Return False
+End Function
+
+Function _System_IsHighSurrogate(c As WCHAR) As Boolean
+	Return &hD800 <= c And c < &hDC00
+End Function
+
+Function _System_IsLowSurrogate(c As WCHAR) As Boolean
+	Return &hDC00 <= c And c < &hE000
+End Function
+
+Function _System_IsDoubleUnitChar(lead As WCHAR, trail As WCHAR) As Boolean
+	Return _System_IsSurrogatePair(lead, trail)
+End Function
+
+Function _System_IsDoubleUnitChar(lead As SByte, trail As SByte) As Boolean
+	Return IsDBCSLeadByte(lead) <> FALSE
+End Function
+
+Function _System_GetHashFromWordArray(p As *Word, n As SIZE_T) As Long
+	Dim hash = 0 As DWord
+	Dim i As Long
+	For i = 0 To ELM(n)
+		hash = ((hash << 16) + p[i]) Mod &h7fffffff
+	Next
+	_System_GetHashFromWordArray = hash As Long
+End Function
Index: /trunk/ab5.0/ablib/src/basic/prompt.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/basic/prompt.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/basic/prompt.sbp	(revision 506)
@@ -0,0 +1,945 @@
+'prompt.sbp
+
+
+#ifndef _INC_PROMPT
+#define _INC_PROMPT
+
+Namespace ActiveBasic
+Namespace Prompt
+Namespace Detail
+
+Function _PromptSys_GetTextExtentPoint32(hdc As HDC, psz As PCSTR, cb As Long, ByRef Size As SIZE) As Long
+	_PromptSys_GetTextExtentPoint32 = GetTextExtentPoint32A(hdc, psz, cb, Size)
+End Function
+
+Function _PromptSys_GetTextExtentPoint32(hdc As HDC, psz As PCWSTR, cb As Long, ByRef Size As SIZE) As Long
+	_PromptSys_GetTextExtentPoint32 = GetTextExtentPoint32W(hdc, psz, cb, Size)
+End Function
+
+Function _PromptSys_TextOut(hdc As HDC, x As Long, y As Long, psz As PCSTR, cb As Long) As Long
+	_PromptSys_TextOut = TextOutA(hdc, x, y, psz, cb)
+	If _PromptSys_TextOut = 0 Then Debug
+End Function
+
+Function _PromptSys_TextOut(hdc As HDC, x As Long, y As Long, psz As PCWSTR, cb As Long) As Long
+	_PromptSys_TextOut = TextOutW(hdc, x, y, psz, cb)
+End Function
+
+Function _PromptSys_ImmGetCompositionString(himc As HIMC, index As DWord, pBuf As PSTR, bufLen As DWord) As Long
+	_PromptSys_ImmGetCompositionString = ImmGetCompositionStringA(himc, index, pBuf, bufLen)
+End Function
+
+Function _PromptSys_ImmGetCompositionString(himc As HIMC, index As DWord, pBuf As PWSTR, bufLen As DWord) As Long
+	_PromptSys_ImmGetCompositionString = ImmGetCompositionStringW(himc, index, pBuf, bufLen)
+End Function
+
+Dim _PromptSys_hWnd As HWND
+Dim _PromptSys_dwThreadID As DWord
+Dim _PromptSys_hInitFinish As HANDLE
+
+'text
+Type _PromptSys_CharacterInformation
+	ForeColor As COLORREF
+	BackColor As COLORREF
+	StartPos As Long
+End Type
+
+Type _PromptSys_LineInformation
+	Length As Long
+	Text As *Char
+	CharInfo As *_PromptSys_CharacterInformation
+End Type
+
+Dim _PromptSys_hFont As HFONT
+Dim _PromptSys_FontSize As SIZE
+Dim _PromptSys_InputStr[255] As Char
+Dim _PromptSys_InputLen = -1 As Long
+Dim _PromptSys_KeyChar As Byte
+Dim _PromptSys_CurPos As POINTAPI
+Dim _PromptSys_TextLine[100] As _PromptSys_LineInformation
+Dim _PromptSys_NowTextColor As COLORREF
+Dim _PromptSys_NowBackColor As COLORREF
+Dim _PromptSys_SectionOfBufferAccess As CRITICAL_SECTION
+
+
+'graphic
+Dim _PromptSys_hBitmap As HBITMAP
+Dim _PromptSys_hMemDC As HDC
+Dim _PromptSys_ScreenSize As SIZE
+Dim _PromptSys_GlobalPos As POINTAPI
+
+Sub _PromptSys_Initialize()
+	_PromptSys_hInitFinish = CreateEvent(0, FALSE, FALSE, 0)
+	Dim _PromptSys_hThread = CreateThread(0, 0, AddressOf(PromptMain), 0, 0, _PromptSys_dwThreadID)
+	If _PromptSys_hThread = 0 Then
+		Debug
+		ExitProcess(1)
+	End If
+	WaitForSingleObject(_PromptSys_hInitFinish, INFINITE)
+End Sub
+
+Sub DrawPromptBuffer(hDC As HDC, StartLine As Long, EndLine As Long)
+	Dim i As Long, i2 As Long, i3 As Long
+	Dim ret As Long
+
+	Dim hOldFont = SelectObject(hDC, _PromptSys_hFont) As HFONT
+
+	'Scroll
+	Dim rc As RECT
+	GetClientRect(_PromptSys_hWnd, rc)
+	While (_PromptSys_CurPos.y+1) * _PromptSys_FontSize.cy > rc.bottom and _PromptSys_CurPos.y > 0
+		_System_free(_PromptSys_TextLine[0].Text)
+		_System_free(_PromptSys_TextLine[0].CharInfo)
+		For i = 0 To 100 - 1
+			_PromptSys_TextLine[i].Length = _PromptSys_TextLine[i+1].Length
+			_PromptSys_TextLine[i].Text = _PromptSys_TextLine[i+1].Text
+			_PromptSys_TextLine[i].CharInfo = _PromptSys_TextLine[i+1].CharInfo
+		Next
+		_PromptSys_TextLine[100].Length = 0
+		_PromptSys_TextLine[100].Text = _System_calloc(SizeOf (Char) * 255)
+		_PromptSys_TextLine[100].CharInfo = _System_calloc(SizeOf (_PromptSys_CharacterInformation) * 255)
+		_PromptSys_CurPos.y--
+
+		'Redraw
+		StartLine = -1
+	Wend
+
+	i = 0' : Debug
+	While i * _PromptSys_FontSize.cy < rc.bottom and i <= 100
+		If StartLine=-1 or (StartLine<=i and i<=EndLine) Then
+			Dim currentLineCharInfo = _PromptSys_TextLine[i].CharInfo
+
+			Dim sz As SIZE
+			i3 = _PromptSys_TextLine[i].Length
+			_PromptSys_GetTextExtentPoint32(hDC, _PromptSys_TextLine[i].Text, i3, sz)
+
+'			BitBlt(hDC,_
+'				sz.cx, i * _PromptSys_FontSize.cy, _
+'				rc.right, _PromptSys_FontSize.cy, _
+'				_PromptSys_hMemDC, sz.cx, i * _PromptSys_FontSize.cy, SRCCOPY)
+
+			While i2 < i3
+				SetTextColor(hDC, currentLineCharInfo[i2].ForeColor)
+				If currentLineCharInfo[i2].BackColor = -1 Then
+					SetBkMode(hDC, TRANSPARENT)
+				Else
+					Debug
+					ret = SetBkMode(hDC, OPAQUE)
+					ret = SetBkColor(hDC, currentLineCharInfo[i2].BackColor)
+				End If
+
+				Dim tempLen As Long
+				If _System_IsDoubleUnitChar(_PromptSys_TextLine[i].Text[i2], _PromptSys_TextLine[i].Text[i2+1]) Then
+					tempLen = 2
+				Else
+					tempLen = 1
+				End If
+				With _PromptSys_FontSize
+					_PromptSys_TextOut(hDC, currentLineCharInfo[i2].StartPos, i * .cy, VarPtr(_PromptSys_TextLine[i].Text[i2]) As *Char, tempLen)
+				End With
+				i2 += tempLen
+			Wend
+		End If
+
+		i++
+	Wend
+
+	SelectObject(hDC, hOldFont)
+End Sub
+
+Sub PRINT_ToPrompt(buf As String)
+	OutputDebugString(ToTCStr(Ex"PRINT_ToPrompt " + buf + Ex"\r\n"))
+	EnterCriticalSection(_PromptSys_SectionOfBufferAccess)
+	If buf = "あ" Then Debug
+	With _PromptSys_CurPos
+		Dim hdc = GetDC(_PromptSys_hWnd)
+		Dim hOldFont = SelectObject(hdc, _PromptSys_hFont)
+		Dim StartLine = .y As Long
+		Dim bufLen = buf.Length
+		Dim doubleUnitChar = False As Boolean
+		'Addition
+		Dim i2 = 0 As Long, i3 As Long
+		For i2 = 0 To ELM(bufLen)
+			If buf[i2] = &h0d Then 'CR \r
+				_PromptSys_TextLine[.y].Length = .x
+				.x = 0
+			ElseIf buf[i2] = &h0a Then 'LF \n
+				_PromptSys_TextLine[.y].Length = System.Math.Max(_PromptSys_TextLine[.y].Length, .x)
+				.y++
+			Else
+				Dim currentLineCharInfo = _PromptSys_TextLine[.y].CharInfo
+				_PromptSys_TextLine[.y].Text[.x] = buf[i2]
+				currentLineCharInfo[.x].ForeColor = _PromptSys_NowTextColor
+				currentLineCharInfo[.x].BackColor = _PromptSys_NowBackColor
+
+				If buf[i2] = &h09 Then 'tab
+					Dim tabStop = _PromptSys_FontSize.cx * 8
+					currentLineCharInfo[.x + 1].StartPos = currentLineCharInfo[.x].StartPos + _
+						tabStop - currentLineCharInfo[.x].StartPos Mod tabStop
+				Else
+					If doubleUnitChar <> False Then
+						doubleUnitChar = False
+						currentLineCharInfo[.x + 1].StartPos = currentLineCharInfo[.x].StartPos
+					Else
+						Dim sz As SIZE
+						Dim charLen As Long
+						If _System_IsDoubleUnitChar(buf[i2], buf[i2 + 1]) Then
+							charLen = 2
+							doubleUnitChar = True
+						Else
+							charLen = 1
+						EndIf
+						Dim p = buf.StrPtr
+						_PromptSys_GetTextExtentPoint32(hdc, VarPtr(p[i2]) As *Char, charLen, sz)
+						currentLineCharInfo[.x + 1].StartPos = currentLineCharInfo[.x].StartPos + sz.cx
+					End If
+				End If
+				.x++
+			End If
+		Next
+		_PromptSys_TextLine[.y].Length = System.Math.Max(_PromptSys_TextLine[.y].Length, .x)
+
+		'Draw the text buffer added
+		'DrawPromptBuffer(hdc, StartLine, .y)
+		InvalidateRect(_PromptSys_hWnd, ByVal 0, TRUE)
+		UpdateWindow(_PromptSys_hWnd)
+		SelectObject(hdc, hOldFont)
+		ReleaseDC(_PromptSys_hWnd, hdc)
+	End With
+	LeaveCriticalSection(_PromptSys_SectionOfBufferAccess)
+End Sub
+
+Function PromptProc(hWnd As HWND, message As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT
+	Select Case message
+		Case WM_CREATE
+			Return _PromptWnd_OnCreate(hWnd, ByVal lParam As *CREATESTRUCT)
+		Case WM_PAINT
+			_PromptWnd_OnPaint(hWnd)
+		Case WM_SETFOCUS
+			_PromptWnd_OnSetFocus(hWnd, wParam As HWND)
+		Case WM_KILLFOCUS
+			_PromptWnd_OnKillForcus(hWnd, wParam As HWND)
+		Case WM_KEYDOWN
+			_PromptWnd_OnKeyDown(wParam As DWord, LOWORD(lParam) As DWord, HIWORD(lParam) As DWord)
+		Case WM_CHAR
+			_PromptWnd_OnChar(hWnd, wParam, lParam)
+		Case WM_IME_COMPOSITION
+			Return _PromptWnd_OnImeCompostion(hWnd, wParam, lParam)
+		Case WM_DESTROY
+			_PromptWnd_OnDestroy(hWnd)
+		Case Else
+			PromptProc = DefWindowProc(hWnd, message, wParam, lParam)
+			Exit Function
+	End Select
+	PromptProc = 0
+End Function
+
+Function _PromptWnd_OnCreate(hwnd As HWND, ByRef cs As CREATESTRUCT) As LRESULT
+	Dim hdc = GetDC(hwnd)
+	With _PromptSys_ScreenSize
+		_PromptSys_hBitmap = CreateCompatibleBitmap(hdc, .cx, .cy)
+	End With
+	_PromptSys_hMemDC = CreateCompatibleDC(hdc)
+	SelectObject(_PromptSys_hMemDC, _PromptSys_hBitmap)
+
+	'Initialize for Win9x
+	Dim hOldBrush = SelectObject(_PromptSys_hMemDC, GetStockObject(BLACK_BRUSH)) As HBRUSH
+	With _PromptSys_ScreenSize
+		PatBlt(_PromptSys_hMemDC, 0, 0, .cx, .cy, PATCOPY)
+	End With
+	SelectObject(_PromptSys_hMemDC, hOldBrush)
+
+	Dim tm As TEXTMETRIC
+	Dim hOldFont = SelectObject(_PromptSys_hMemDC, _PromptSys_hFont) As HFONT
+	GetTextMetrics(_PromptSys_hMemDC, tm)
+	SelectObject(_PromptSys_hMemDC, hOldFont)
+	With _PromptSys_FontSize
+		.cx = tm.tmAveCharWidth
+		.cy = tm.tmHeight
+	End With
+
+	'_PromptSys_hFont initialize
+	Dim lf As LOGFONT
+	With lf
+		.lfHeight = -MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72)
+		.lfWidth = 0
+		.lfEscapement = 0
+		.lfOrientation = 0
+		.lfWeight = 0
+		.lfItalic = 0
+		.lfUnderline = 0
+		.lfStrikeOut = 0
+		.lfCharSet = SHIFTJIS_CHARSET
+		.lfOutPrecision = OUT_DEFAULT_PRECIS
+		.lfClipPrecision = CLIP_DEFAULT_PRECIS
+		.lfQuality = DEFAULT_QUALITY
+		.lfPitchAndFamily = FIXED_PITCH
+		lstrcpy(.lfFaceName, ToTCStr("ＭＳ 明朝"))
+	End With
+
+	_PromptSys_hFont = CreateFontIndirect(lf)
+
+	ReleaseDC(hwnd, hdc)
+
+	_PromptWnd_OnCreate = 0
+End Function
+
+Sub _PromptWnd_OnPaint(hwnd As HWND)
+	Dim ps As PAINTSTRUCT
+	Dim hdc = BeginPaint(hwnd, ps)
+	With _PromptSys_ScreenSize
+		BitBlt(hdc, 0, 0, .cx, .cy, _PromptSys_hMemDC, 0, 0, SRCCOPY)
+'	With ps.rcPaint
+'		BitBlt(hdc, .left, .top, .right - .left, .bottom - .top, _PromptSys_hMemDC, .left, .top, SRCCOPY)
+	End With
+	DrawPromptBuffer(hdc, -1, 0)
+	EndPaint(hwnd, ps)
+End Sub
+
+Sub _PromptWnd_OnSetFocus(hwnd As HWND, hwndOldFocus As HWND)
+	If _PromptSys_InputLen <> -1 Then
+		Dim himc = ImmGetContext(hwnd)
+		If himc Then
+			Dim CompForm As COMPOSITIONFORM
+			With CompForm
+				.dwStyle = CFS_POINT
+				.ptCurrentPos.x = _PromptSys_CurPos.x * _PromptSys_FontSize.cx
+				.ptCurrentPos.y = _PromptSys_CurPos.y * _PromptSys_FontSize.cy
+			End With
+			ImmSetCompositionWindow(himc, CompForm)
+
+			Dim lf As LOGFONT
+			GetObject(_PromptSys_hFont, Len(lf), lf)
+			ImmSetCompositionFont(himc, lf)
+		End If
+		ImmReleaseContext(hwnd, himc)
+
+		CreateCaret(hwnd, 0, 9, 6)
+		With _PromptSys_CurPos
+			SetCaretPos(_PromptSys_TextLine[.y].CharInfo[.x].StartPos, (.y + 1) * _PromptSys_FontSize.cy - 7)
+		End With
+		ShowCaret(hwnd)
+	End If
+End Sub
+
+Sub _PromptWnd_OnKillForcus(hwnd As HWND, hwndNewFocus As HWND)
+	HideCaret(hwnd)
+	DestroyCaret()
+End Sub
+
+Sub _PromptWnd_OnKeyDown(vk As DWord, repeat As DWord, flags As DWord)
+	If _PromptSys_InputLen = -1 Then
+		_PromptSys_KeyChar = vk As Byte
+	End If
+End Sub
+
+Sub _PromptWnd_OnDestroy(hwnd As HWND)
+	DeleteDC(_PromptSys_hMemDC)
+	DeleteObject(_PromptSys_hBitmap)
+
+	PostQuitMessage(0)
+End Sub
+
+Sub _PromptWnd_OnChar(hwnd As HWND, wParam As WPARAM, lParam As LPARAM)
+	Dim TempStr As String
+	If _PromptSys_InputLen <> -1 Then
+		If wParam = VK_BACK Then
+			If _PromptSys_InputLen Then
+				_PromptSys_InputLen--
+				_PromptSys_InputStr[_PromptSys_InputLen] = 0
+
+				_PromptSys_CurPos.x--
+				With _PromptSys_CurPos
+					_PromptSys_TextLine[.y].Text[.x] = 0
+				End With
+			End If
+		ElseIf wParam = VK_RETURN Then
+			_PromptSys_InputStr[_PromptSys_InputLen] = 0
+			_PromptSys_InputLen = -1
+			TempStr = Ex"\r\n"
+		ElseIf wParam = &H16 Then
+/*
+			'Paste Command(Use Clippboard)
+			OpenClipboard(hwnd)
+			Dim hGlobal = GetClipboardData(CF_TEXT) As HGLOBAL
+			If hGlobal = 0 Then Exit Sub
+			Dim pTemp = GlobalLock(hGlobal) As PCSTR
+#ifdef UNICODE 'A版ウィンドウプロシージャ用
+			Dim tempSizeA = lstrlenA(pTemp)
+			Dim tempSizeW = MultiByteToWideChar(CP_ACP, 0, pTemp, tempSizeA, 0, 0) + 1
+			TempStr = ZeroString(tempSizeW)
+			MultiByteToWideChar(CP_ACP, 0, pTemp, tempSizeA, StrPtr(TempStr), tempSizeW)
+#else
+			TempStr = ZeroString(lstrlen(pTemp) + 1)
+			lstrcpy(StrPtr(TempStr), pTemp)
+#endif
+			memcpy(VarPtr(_PromptSys_InputStr[_PromptSys_InputLen]), TempStr.Chars, SizeOf (Char) * TempStr.Length)
+			_PromptSys_InputLen += TempStr.Length
+
+			GlobalUnlock(hGlobal)
+			CloseClipboard()
+*/
+		Else
+			Dim t = wParam As TCHAR
+			TempStr = New String(VarPtr(t), 1)
+			_PromptSys_InputStr[_PromptSys_InputLen] = TempStr[0]
+			_PromptSys_InputLen++
+		End If
+
+		SendMessage(hwnd, WM_KILLFOCUS, 0, 0)
+		ActiveBasic.Prompt.Detail.PRINT_ToPrompt(TempStr)
+		SendMessage(hwnd, WM_SETFOCUS, 0, 0)
+	End If
+End Sub
+
+Function _PromptWnd_GetCompositionStringW(himc As HIMC, ByRef rpsz As PWSTR) As Long
+	Dim size = ImmGetCompositionStringW(himc, GCS_RESULTSTR, 0, 0) 'sizeはバイト単位
+	rpsz = GC_malloc(size) As PWSTR
+	If rpsz = 0 Then
+		'Debug
+		Return 0
+	End If
+	Return ImmGetCompositionStringW(himc, GCS_RESULTSTR, rpsz, size)
+End Function
+
+Function _PromptWnd_GetCompositionStringA(himc As HIMC, ByRef rpsz As PSTR) As Long
+	Dim size = ImmGetCompositionStringA(himc, GCS_RESULTSTR, 0, 0) 'sizeはバイト単位
+	rpsz = GC_malloc(size) As PSTR
+	If rpsz = 0 Then
+		'Debug
+		Return 0
+	End If
+	Return ImmGetCompositionStringA(himc, GCS_RESULTSTR, rpsz, size)
+End Function
+
+Function _PromptWnd_OnImeCompostion(hwnd As HWND, wp As WPARAM, lp As LPARAM) As LRESULT
+	If (lp And GCS_RESULTSTR) <> 0 Then
+		Dim himc = ImmGetContext(hwnd)
+		If himc = 0 Then
+			'Debug
+			Return 0
+		End If
+		Dim tempStr = Nothing As String
+		Dim str As *Char
+#ifdef UNICODE
+		Dim osver = System.Environment.OSVersion
+		With osver
+			' GetCompositionStringW is not implimented in Windows 95
+			If .Version.Major = 4 And .Version.Minor = 0 And .Platform = System.PlatformID.Win32Windows Then
+				Dim strA As PCSTR
+				Dim sizeA = _PromptWnd_GetCompositionStringA(himc, strA)
+				tempStr = New String(strA, sizeA As Long)
+			Else
+				Dim size = _PromptWnd_GetCompositionStringW(himc, str)
+				tempStr = New String(str, (size \ SizeOf (WCHAR)) As Long)
+			End If
+		End With
+#else
+		Dim size = _PromptWnd_GetCompositionStringA(himc, str)
+		tempStr = New String(str, size As Long)
+#endif
+		ImmReleaseContext(hwnd, himc)
+
+		ActiveBasic.Strings.ChrCopy(VarPtr(_PromptSys_InputStr[_PromptSys_InputLen]), tempStr.StrPtr, tempStr.Length As SIZE_T)
+		_PromptSys_InputLen += tempStr.Length
+
+		SendMessage(hwnd, WM_KILLFOCUS, 0, 0)
+		ActiveBasic.Prompt.Detail.PRINT_ToPrompt(tempStr)
+		SendMessage(hwnd, WM_SETFOCUS, 0, 0)
+
+		_PromptWnd_OnImeCompostion = 0
+	Else
+		_PromptWnd_OnImeCompostion = DefWindowProc(hwnd, WM_IME_COMPOSITION, wp, lp)
+	End If
+End Function
+
+Function PromptMain(dwData As Long) As Long
+	Dim i As Long
+	'Allocate
+	For i = 0 To 100
+		With _PromptSys_TextLine[i]
+			.Length = 0
+			.Text = _System_calloc(SizeOf (Char) * 255)
+			.CharInfo = _System_calloc(SizeOf (_PromptSys_CharacterInformation) * 255)
+		End With
+	Next
+
+	'Current Colors initialize
+	_PromptSys_NowTextColor = RGB(255, 255, 255)
+	_PromptSys_NowBackColor = RGB(0, 0, 0)
+
+	'Setup
+	With _PromptSys_ScreenSize
+		.cx = GetSystemMetrics(SM_CXSCREEN)
+		.cy = GetSystemMetrics(SM_CYSCREEN)
+	End With
+
+	'Critical Section
+	InitializeCriticalSection(_PromptSys_SectionOfBufferAccess)
+
+	'Regist Prompt Class
+	Dim wcl As WNDCLASSEX
+	ZeroMemory(VarPtr(wcl), Len(wcl))
+	With wcl
+		.cbSize = Len(wcl)
+		.hInstance = GetModuleHandle(0)
+		.style = CS_HREDRAW Or CS_VREDRAW' or CS_DBLCLKS
+		.hIcon = LoadImage(0, MAKEINTRESOURCE(IDI_APPLICATION), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE Or LR_SHARED) As HICON
+		.hIconSm = LoadImage(0, MAKEINTRESOURCE(IDI_WINLOGO), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE Or LR_SHARED) As HICON
+		.hCursor = LoadImage(0, MAKEINTRESOURCE(IDC_ARROW), IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE Or LR_SHARED) As HCURSOR
+		.lpszClassName = ToTCStr("PROMPT")
+		.lpfnWndProc = AddressOf(PromptProc)
+		.hbrBackground = GetStockObject(BLACK_BRUSH)
+	End With
+	Dim atom = RegisterClassEx(wcl)
+
+	'Create Prompt Window
+	_PromptSys_hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, atom As ULONG_PTR As LPCTSTR, ToTCStr("BASIC PROMPT"), _
+		WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, _
+		0, 0, wcl.hInstance, 0)
+	ShowWindow(_PromptSys_hWnd, SW_SHOW)
+	UpdateWindow(_PromptSys_hWnd)
+	SetEvent(_PromptSys_hInitFinish)
+	Dim msg As MSG
+	Do
+		Dim iResult = GetMessage(msg, 0, 0, 0)
+		If iResult = 0 Then
+			System.Environment.ExitCode = msg.wParam As Long
+			Exit Do
+		ElseIf iResult = -1 Then
+			Exit Do
+		End If
+		TranslateMessage(msg)
+		DispatchMessage(msg)
+	Loop
+
+	'強制的に終了する
+	End
+
+	EnterCriticalSection(_PromptSys_SectionOfBufferAccess)
+
+	For i = 0 to 100
+		_System_free(_PromptSys_TextLine[i].Text)
+		_System_free(_PromptSys_TextLine[i].CharInfo)
+	Next
+
+	LeaveCriticalSection(_PromptSys_SectionOfBufferAccess)
+
+	DeleteCriticalSection(_PromptSys_SectionOfBufferAccess)
+
+	End
+End Function
+
+'Prompt text command functoins
+
+Sub Cls(n As Long)
+	Dim i As Long
+
+	'When parameter was omitted, num is set to 1
+	If n = 0 Then n = 1
+
+	If n = 1 Or n = 3 Then
+		'Clear the text screen
+		For i = 0 To 100
+			With _PromptSys_TextLine[i]
+				.Text[0] = 0 '_System_FillChar(_PromptSys_TextLine[i].Text, -1 As Char, 0)
+				.Length = 0
+			End With
+		Next
+		With _PromptSys_CurPos
+			.x = 0
+			.y = 0
+		End With
+	End If
+
+	If n = 2 Or n = 3 Then
+		'Clear the graphics screen
+		Dim hOldBrush = SelectObject(_PromptSys_hMemDC, GetStockObject(BLACK_BRUSH))
+		With _PromptSys_ScreenSize
+			PatBlt(_PromptSys_hMemDC, 0, 0, .cx, .cy, PATCOPY)
+		End With
+		SelectObject(_PromptSys_hMemDC, hOldBrush)
+	End If
+
+	'Redraw
+	InvalidateRect(_PromptSys_hWnd, ByVal 0, 0)
+End Sub
+
+Sub Color(textColorCode As Long, backColorCode As Long)
+	_PromptSys_NowTextColor = GetBasicColor(textColorCode)
+	If backColorCode = -1 Then
+		_PromptSys_NowBackColor = -1
+	Else
+		_PromptSys_NowBackColor = GetBasicColor(backColorCode)
+	End If
+End Sub
+
+Sub INPUT_FromPrompt(showStr As String)
+*InputReStart
+
+	ActiveBasic.Prompt.Detail.PRINT_ToPrompt(showStr)
+
+	'Input by keyboard
+	_PromptSys_InputLen = 0
+	SendMessage(_PromptSys_hWnd, WM_SETFOCUS, 0, 0)
+	While _PromptSys_InputLen <> -1
+		Sleep(10)
+	Wend
+	SendMessage(_PromptSys_hWnd, WM_KILLFOCUS, 0, 0)
+
+	'Set value to variable
+	Const comma = &h2c As Char 'Asc(",")
+	Dim broken = ActiveBasic.Strings.Detail.Split(New String(_PromptSys_InputStr), comma)
+	Dim i As Long
+	For i = 0 To ELM(broken.Count)
+		If _System_InputDataPtr[i] = 0 Then
+			ActiveBasic.Prompt.Detail.PRINT_ToPrompt(Ex"入力データの個数が多すぎます\r\n")
+			Goto *InputReStart
+		End If
+		_System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], broken[i])
+	Next
+
+	If _System_InputDataPtr[i]<>0 Then
+		ActiveBasic.Prompt.Detail.PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n")
+		Goto *InputReStart
+	End If
+End Sub
+
+Sub Locate(x As Long, y As Long)
+	If x < 0 Then x = 0
+	If y < 0 Then y = 0
+	If y > 100 Then y = 100
+	With _PromptSys_CurPos
+		.x = x
+		.y = y
+	End With
+
+	Dim i = _PromptSys_TextLine[y].Length
+	If i < x Then
+		ActiveBasic.Strings.ChrFill(VarPtr(_PromptSys_TextLine[y].Text[i]), x - i, &h20 As Char) 'Asc(" ")
+		Dim i2 As Long
+		For i2 = i To ELM(x)
+			_PromptSys_TextLine[y].CharInfo[i2].BackColor = -1
+		Next
+		_PromptSys_TextLine[y].Length = x
+	End If
+End Sub
+
+'Prompt graphic command functions
+
+Sub Circle(x As Long , y As Long, radius As Long, ColorCode As Long, StartPos As Double, EndPos As Double, Aspect As Double, bFill As Long, BrushColor As Long)
+	Dim i1 As Long, i2 As Long, i3 As Long, i4 As Long
+
+	Dim hPen = CreatePen(PS_SOLID,1,GetBasicColor(ColorCode))
+	Dim hBrush As HBRUSH
+	If bFill Then
+		hBrush = CreateSolidBrush(GetBasicColor(BrushColor))
+	Else
+		hBrush = GetStockObject(NULL_BRUSH)
+	End If
+
+	Dim hDC = GetDC(_PromptSys_hWnd)
+	Dim hOldPenDC = SelectObject(hDC, hPen)
+	Dim hOldBrushDC = SelectObject(hDC, hBrush)
+	Dim hOldPen = SelectObject(_PromptSys_hMemDC, hPen)
+	Dim hOldBrush = SelectObject(_PromptSys_hMemDC, hBrush)
+
+	Dim radi2 As Long
+	If Aspect<1 Then
+		radi2=(CDbl(radius)*Aspect) As Long
+	Else
+		radi2=radius
+		radius=(CDbl(radius)/Aspect) As Long
+	End If
+
+	If StartPos=0 And EndPos=0 Then
+		Ellipse(hDC,x-radius,y-radi2,x+radius,y+radi2)
+		Ellipse(_PromptSys_hMemDC,x-radius,y-radi2,x+radius,y+radi2)
+	Else
+		Dim sw As Boolean
+		StartPos *=StartPos
+		EndPos *=EndPos
+
+		If StartPos<0 Or EndPos<0 Then
+			sw = True
+		Else
+			sw = False
+		End If
+
+		StartPos = Abs(StartPos)
+		EndPos = Abs(EndPos)
+
+		If StartPos<=78.5 Then
+			i1=78
+			i2=Int(StartPos)
+		ElseIf StartPos<=235.5 Then
+			StartPos -= 78.5
+			i1=78-Int(StartPos)
+			i2=78
+		ElseIf StartPos<=392.5 Then
+			StartPos -= 235.5
+			i1=-78
+			i2=78-Int(StartPos)
+		ElseIf StartPos<=549.5 Then
+			StartPos -= 392.5
+			i1=-78+Int(StartPos)
+			i2=-78
+		ElseIf StartPos<=628 Then
+			StartPos -= 549.5
+			i1=78
+			i2=-78+Int(StartPos)
+		End If
+
+		If EndPos<=78.5 Then
+			i3=78
+			i4=Int(EndPos)
+		ElseIf EndPos<=235.5 Then
+			EndPos -= 78.5
+			i3=78-Int(EndPos)
+			i4=78
+		ElseIf EndPos<=392.5 Then
+			EndPos -= 235.5
+			i3=-78
+			i4=78-Int(EndPos)
+		ElseIf EndPos<=549.5 Then
+			EndPos -= 392.5
+			i3=-78+Int(EndPos)
+			i4=-78
+		ElseIf EndPos<=628 Then
+			EndPos -= 549.5
+			i3=78
+			i4=-78+Int(EndPos)
+		End If
+
+		If sw Then
+			Pie(hDC,x-radius,y-radi2,x+radius,y+radi2,  x+i1,y-i2,x+i3,y-i4)
+			Pie(_PromptSys_hMemDC,x-radius,y-radi2,x+radius,y+radi2,  x+i1,y-i2,x+i3,y-i4)
+		Else
+			Arc(hDC,x-radius,y-radi2,x+radius,y+radi2,  x+i1,y-i2,x+i3,y-i4)
+			Arc(_PromptSys_hMemDC,x-radius,y-radi2,x+radius,y+radi2,  x+i1,y-i2,x+i3,y-i4)
+		End If
+	End If
+
+	SelectObject(hDC, hOldPenDC)
+	SelectObject(hDC, hOldBrushDC)
+	ReleaseDC(_PromptSys_hWnd, hDC)
+	SelectObject(_PromptSys_hMemDC, hOldPen)
+	SelectObject(_PromptSys_hMemDC, hOldBrush)
+	DeleteObject(hPen)
+	If bFill Then DeleteObject(hBrush)
+End Sub
+
+Sub Line(sx As Long, sy As Long, bStep As Long, ex As Long, ey As Long, ColorCode As Long, fType As Long, BrushColor As Long)
+	Dim temp As Long
+
+	If sx = &H80000000 And sy = &H80000000 Then
+		With _PromptSys_GlobalPos
+			sx = .x
+			sy = .y
+		End With
+	End If
+
+	If bStep Then
+		ex += sx
+		ey += sy
+	Else
+		If fType Then
+			'ラインの場合（四角形でない場合）
+			If sx>ex Then
+				temp=ex
+				ex=sx
+				sx=temp
+			End If
+			If sy>ey Then
+				temp=ey
+				ey=sy
+				sy=temp
+			End If
+		End If
+	End If
+
+	Dim hdc = GetDC(_PromptSys_hWnd)
+	Dim hPen = CreatePen(PS_SOLID, 1, GetBasicColor(ColorCode))
+	Dim hBrush As HBRUSH
+	If fType=2 Then
+		hBrush = CreateSolidBrush(GetBasicColor(BrushColor))
+	Else
+		hBrush = GetStockObject(NULL_BRUSH)
+	End If
+
+	SelectObject(hdc, hPen)
+	SelectObject(hdc, hBrush)
+	Dim hOldPen = SelectObject(_PromptSys_hMemDC, hPen)
+	Dim hOldBrush = SelectObject(_PromptSys_hMemDC, hBrush)
+
+	Select Case fType
+		Case 0
+			'line
+			MoveToEx(_PromptSys_hMemDC,sx,sy,ByVal NULL)
+			LineTo(_PromptSys_hMemDC,ex,ey)
+			SetPixel(_PromptSys_hMemDC,ex,ey,GetBasicColor(ColorCode))
+			MoveToEx(hdc,sx,sy,ByVal NULL)
+			LineTo(hdc,ex,ey)
+			SetPixel(hdc,ex,ey,GetBasicColor(ColorCode))
+		Case Else
+			'Rectangle
+			Rectangle(hdc,sx,sy,ex+1,ey+1)
+			Rectangle(_PromptSys_hMemDC,sx,sy,ex+1,ey+1)
+	End Select
+
+	ReleaseDC(_PromptSys_hWnd,hdc)
+	SelectObject(_PromptSys_hMemDC,hOldPen)
+	SelectObject(_PromptSys_hMemDC,hOldBrush)
+	DeleteObject(hPen)
+	If fType = 2 Then DeleteObject(hBrush)
+	With _PromptSys_GlobalPos
+		.x = ex
+		.y = ey
+	End With
+End Sub
+
+Sub PSet(x As Long, y As Long, ColorCode As Long)
+	Dim hdc = GetDC(_PromptSys_hWnd)
+	SetPixel(hdc, x, y, GetBasicColor(ColorCode))
+	SetPixel(_PromptSys_hMemDC, x, y, GetBasicColor(ColorCode))
+	ReleaseDC(_PromptSys_hWnd, hdc)
+	With _PromptSys_GlobalPos
+		.x = x
+		.y = y
+	End With
+End Sub
+
+Sub Paint(x As Long, y As Long, BrushColor As Long, LineColor As Long)
+	Dim hbr = CreateSolidBrush(GetBasicColor(BrushColor))
+
+	Dim hdc = GetDC(_PromptSys_hWnd)
+	Dim hbrOld = SelectObject(_PromptSys_hMemDC, hbr)
+	Dim hbrOldWndDC = SelectObject(hdc, hbr)
+
+	ExtFloodFill(hdc, x, y, GetBasicColor(LineColor), FLOODFILLBORDER)
+	ExtFloodFill(_PromptSys_hMemDC, x, y, GetBasicColor(LineColor), FLOODFILLBORDER)
+
+	ReleaseDC(_PromptSys_hWnd, hdc)
+	SelectObject(_PromptSys_hMemDC, hbrOld)
+	SelectObject(hdc, hbrOldWndDC)
+	DeleteObject(hbr)
+End Sub
+
+Function Inkey$() As String
+	If _PromptSys_KeyChar=0 Then
+		Inkey$=""
+	Else
+		Inkey$=Chr$(_PromptSys_KeyChar)
+	End If
+	_PromptSys_KeyChar=0
+End Function
+
+Function Input$(length As Long) As String
+	Dim i = 0 As Long
+
+	If length<=0 Then
+		Input$=""
+		Exit Function
+	End If
+
+	While 1
+		If _PromptSys_KeyChar Then
+			Input$=Input$+Chr$(_PromptSys_KeyChar)
+			_PromptSys_KeyChar=0
+			i++
+			If i >= length Then
+				Exit While
+			End If
+		End If
+		Sleep(1)
+	Wend
+End Function
+
+End Namespace 'Detail
+
+Function OwnerWnd() As HWND
+	Return Detail._PromptSys_hWnd
+End Function
+
+End Namespace 'Prompt
+End Namespace 'ActiveBasic
+
+'----------------------
+' Prompt text Commands
+'----------------------
+
+Sub PRINT_ToPrompt(s As String)
+	ActiveBasic.Prompt.Detail.PRINT_ToPrompt(s)
+End Sub
+
+Macro CLS()(num As Long)
+	ActiveBasic.Prompt.Detail.Cls(num)
+End Macro
+
+Macro COLOR(TextColorCode As Long)(BackColorCode As Long)
+	ActiveBasic.Prompt.Detail.Color(TextColorCode, BackColorCode)
+End Macro
+
+'---------- Defined in "command.sbp" ----------
+'Dim _System_InputDataPtr[_System_MAX_PARMSNUM] As VoidPtr
+'Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord
+'----------------------------------------------
+Sub INPUT_FromPrompt(ShowStr As String)
+	ActiveBasic.Prompt.Detail.INPUT_FromPrompt(ShowStr)
+End Sub
+
+/* TODO: _System_GetUsingFormatを用意して実装する
+Sub PRINTUSING_ToPrompt(UsingStr As String)
+	ActiveBasic.Prompt.Detail.PRINT_ToPrompt(_System_GetUsingFormat(UsingStr))
+End Sub
+*/
+
+Macro LOCATE(x As Long, y As Long)
+	ActiveBasic.Prompt.Detail.Locate(x, y)
+End Macro
+
+
+'-------------------
+' Graphics Commands
+'-------------------
+
+Macro CIRCLE(x As Long , y As Long, radius As Long)(ColorCode As Long, StartPos As Double, EndPos As Double, Aspect As Double, bFill As Long, BrushColor As Long)
+	'呼び出し方法は以下のようになります（コンパイラがパラメータの並びを最適化します）
+	'Circle (x, y), radius [, color] [, start] [, end] [, aspect] [, f] [, color2]
+	ActiveBasic.Prompt.Detail.Circle(x, y, radius, ColorCode, StartPos, EndPos, Aspect, bFill, BrushColor)
+End Macro
+
+Macro LINE(sx As Long, sy As Long, bStep As Long, ex As Long, ey As Long)(ColorCode As Long, fType As Long, BrushColor As Long)
+	'呼び出し方法は以下のようになります（コンパイラがパラメータの並びを最適化します）
+	'Line (sx,sy)-[STEP](ex,ey),[ColorCode],[B/Bf],[BrushColor]
+	ActiveBasic.Prompt.Detail.Line(sx, sy, bStep, ex, ey, ColorCode, fType, BrushColor)
+End Macro
+
+Macro PSET(x As Long, y As Long)(ColorCode As Long)
+	'呼び出し方法は以下のようになります（コンパイラがパラメータの並びを最適化します）
+	'PSet (x,y),ColorCode
+	ActiveBasic.Prompt.Detail.PSet(x, y, ColorCode)
+End Macro
+
+Macro PAINT(x As Long, y As Long, BrushColor As Long)(ByVal LineColor As Long)
+	'呼び出し方法は以下のようになります（コンパイラがパラメータの並びを最適化します）
+	'Paint (x,y),BrushColor,LineColor
+	ActiveBasic.Prompt.Detail.Paint(x, y, BrushColor, LineColor)
+End Macro
+
+
+'-----------
+' Functions
+'-----------
+
+Function Inkey$() As String
+	Return ActiveBasic.Prompt.Detail.Inkey$()
+End Function
+
+Function Input$(length As Long) As String
+	Return ActiveBasic.Prompt.Detail.Input$(length)
+End Function
+
+ActiveBasic.Prompt.Detail._PromptSys_Initialize()
+
+#endif '_INC_PROMPT
Index: /trunk/ab5.0/ablib/src/com/bstring.ab
===================================================================
--- /trunk/ab5.0/ablib/src/com/bstring.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/com/bstring.ab	(revision 506)
@@ -0,0 +1,222 @@
+' com/bstring.ab
+
+Namespace ActiveBasic
+Namespace COM
+
+Class BString
+	Implements System.IDisposable ', System.ICloneable
+Public
+	Sub BString()
+		bs = 0
+	End Sub
+
+	Sub BString(len As DWord)
+		bs = SysAllocStringLen(0, len)
+	End Sub
+
+	Sub BString(s As BString)
+		If Not IsNothing(s) Then
+			bs = copy(s.bs)
+		End If
+	End Sub
+
+	Sub BString(s As LPCOLESTR, len As DWord)
+		If s <> 0 Then
+			bs = SysAllocStringLen(s, len)
+		End If
+	End Sub
+
+	Sub BString(s As String)
+		If Not IsNothing(s) Then
+			Init(s.StrPtr, s.Length As DWord)
+		End If
+	End Sub
+
+	Static Function FromBStr(bs As BSTR) As BString
+		FromBStr = New BString(bs, SysStringLen(bs))
+	End Function
+
+	Static Function FromCStr(s As PCWSTR) As BString
+		If s <> 0 Then
+			FromCStr = New BString(s, lstrlenW(s))
+		Else
+			FromCStr = New BString
+		End If
+	End Function
+
+	Static Function FromCStr(s As PCWSTR, len As DWord) As BString
+		If s <> 0 Then
+			FromCStr = New BString(s, len)
+		Else
+			FromCStr = New BString
+		End If
+	End Function
+
+	Static Function FromCStr(s As PCSTR) As BString
+		Dim dst As PCWSTR
+		Dim lenW = GetStr(s, dst)
+		FromCStr = FromCStr(s, lenW)
+	End Function
+
+	Static Function FromCStr(s As PCSTR, len As DWord) As BString
+		Dim dst As PCWSTR
+		Dim lenW = GetStr(s, len, dst)
+		FromCStr = FromCStr(s, lenW)
+	End Function
+
+	Sub ~BString()
+		Clear()
+	End Sub
+
+	Const Function Copy() As BSTR
+		Copy = copy(bs)
+	End Function
+
+	/*Override*/ Function Clone() As BString
+		Return New BString(This)
+	End Function
+
+	/*Override*/ Sub Dispose()
+		Clear()
+	End Sub
+
+	Sub Clear()
+		reset(0)
+	End Sub
+
+	Sub Attach(ByRef bstr As BSTR)
+		reset(move(bstr))
+	End Sub
+
+	Function Detach() As BSTR
+		Detach = move(bs)
+	End Function
+
+	Function BStr() As BSTR
+		BStr = bs
+	End Function
+
+	Static Function Attach(bs As BSTR) As BString
+		Attach = New BString
+		Attach.Attach(bs)
+	End Function
+
+	Const Function Length() As DWord
+		Length = GetDWord(bs As VoidPtr - SizeOf (DWord)) 'SysStringLen(bs)
+	End Function
+
+	Const Function Operator [](i As SIZE_T) As OLECHAR
+		If i > Length Then
+			Throw New ArgumentOutOfRangeException("i")
+		End If
+		Return bs[i]
+	End Function
+
+	Sub Operator []=(i As SIZE_T, c As OLECHAR)
+		If i > Length Then
+			Throw New ArgumentOutOfRangeException("i")
+		End If
+		bs[i] = c
+	End Sub
+
+	Override Function ToString() As String
+		Return New String(bs As PCWSTR, Length As Long)
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return _System_GetHashFromWordArray(bs, Length)
+	End Function
+
+	Override Function Equals(o As Object) As Boolean
+		If Not IsNothing(o) Then
+			If This.GetType().Equals(o.GetType()) Then
+				Equals(o As BString)
+			End If
+		End If
+	End Function
+
+	Const Function Equals(s As BString) As Boolean
+		Equals = Compare(This, s) = 0
+	End Function
+
+	Static Function Compare(l As BString, r As BString) As Long
+		If IsNullOrEmpty(l) Then
+			If IsNullOrEmpty(r) Then
+				Compare = 0
+			Else
+				Compare = -1
+			End If
+		Else
+			If IsNullOrEmpty(bsr) Then
+				Compare = 1
+			Else
+				Compare = Strings.ChrCmp(l.bs, l.Length As SIZE_T, r.bs, r.Length As SIZE_T)
+			End If
+		End If
+	End Function
+
+	Static Function IsNullOrEmpty(s As BString)
+		If IsNothing(s) Then
+			IsNullOrEmpty = True
+		ElseIf s.bs = 0 Then
+			IsNullOrEmpty = True
+		ElseIf s.Length = 0 Then
+			IsNullOrEmpty = True
+		Else
+			IsNullOrEmpty = False
+		End If
+	End Function
+
+	Function Operator ==(s As BString) As Boolean
+		Return Compare(This, s) = 0
+	End Function
+
+	Function Operator <>(s As BString) As Boolean
+		Return Compare(This, s) <> 0
+	End Function
+
+	Function Operator <(s As BString) As Boolean
+		Return Compare(This, s) < 0
+	End Function
+
+	Function Operator <=(s As BString) As Boolean
+		Return Compare(This, s) <= 0
+	End Function
+
+	Function Operator >(s As BString) As Boolean
+		Return Compare(This, s) > 0
+	End Function
+
+	Function Operator >=(s As BString) As Boolean
+		Return Compare(This, s) >= 0
+	End Function
+
+Private
+	bs As BSTR
+
+	Sub init(s As PCSTR, len As DWord)
+		If <> 0 Then
+			Dim lenBS = MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, 0, 0)
+			bs = SysAllocStringLen(0, lenBS)
+			If bs <> 0 Then
+				MultiByteToWideChar(CP_THREAD_ACP, 0, s, len As Long, bs, lenBS)
+			End If
+		End If
+	End Sub
+
+	Sub reset(newBS As BSTR)
+		Dim old = InterlockedExchangePointer(bs, newBS)
+		SysFreeString(old)
+	End Sub
+
+	Static Function copy(src As BSTR) As BSTR
+		copy = SysAllocStringLen(src, SysStringLen(src))
+	End Function
+
+	Static Function move(ByRef src As BSTR) As BSTR
+		move = InterlockedExchangePointer(src, 0)
+	End Function
+End Class
+
+End Namespace 'COM
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/com/currency.ab
===================================================================
--- /trunk/ab5.0/ablib/src/com/currency.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/com/currency.ab	(revision 506)
@@ -0,0 +1,223 @@
+' com/currency.ab
+
+#require <com/variant.ab>
+
+Namespace ActiveBasic
+Namespace COM
+
+Class Currency
+Public
+	Sub Currency()
+		cy = 0
+	End Sub
+
+/*
+	Sub Currency(x As CY)
+		cy = x
+	End Sub
+*/
+	Sub Currency(x As Double)
+		VarCyFromR8(x, cy)
+	End Sub
+/*
+	Sub Currency(x As Int64)
+		VarCyFromI8(x, cy)
+	End Sub
+*/
+/*
+	Const Function Operator +() As Currency
+		Return New Currency(This)
+	End Function
+*/
+	Const Function Operator -() As Currency
+		Dim ret = New Currency
+		VarCyNeg(This.cy, ret.cy)
+		Return ret
+	End Function
+
+	Const Function Operator *(y As Currency) As Currency
+		Dim ret = New Currency
+		VarCyMul(This.cy, y.cy, ret.cy)
+		Return ret
+	End Function
+
+	Const Function Operator *(y As Long) As Currency
+		Dim ret = New Currency
+		VarCyMulI4(This.cy, y, ret.cy)
+		Return ret
+	End Function
+
+	Const Function Operator *(y As Int64) As Currency
+		Dim ret = New Currency
+		VarCyMulI8(This.cy, y, ret.cy)
+		Return ret
+	End Function
+
+	Const Function Operator /(y As Variant) As Double
+		Dim vx = New Variant(This)
+		Dim ret = vx / y
+		Return ret.ValR8
+	End Function
+
+	Const Function Operator /(y As Currency) As Double
+		Dim vx = New Variant(This)
+		Dim vy = New Variant(y)
+		Dim ret = vx / vy
+		Return ret.ValR8
+	End Function
+
+	Const Function Operator +(y As Currency) As Currency
+		Dim ret = New Currency
+		VarCyAdd(This.cy, y.cy, ret.cy)
+		Return ret
+	End Function
+
+	Const Function Operator -(y As Currency) As Currency
+		Dim ret = New Currency
+		VarCySub(This.cy, y.cy, ret.cy)
+		Return ret
+	End Function
+
+	Static Function Compare(x As Currency, y As Currency) As HRESULT
+		Return VarCyCmp(x.cy, y.cy)
+	End Function
+
+	Static Function Compare(x As Currency, y As Double) As HRESULT
+		Return VarCyCmpR8(x.cy, y)
+	End Function
+
+	Static Function Compare(x As Double, y As Currency) As HRESULT
+		Dim ret = VarCyCmpR8(y.cy, x)
+		Select Case ret
+			Case VARCMP_LT
+				Return VARCMP_GT
+			Case VARCMP_GT
+				Return VARCMP_LT
+			Case Else
+				Return ret
+		End Select
+	End Function
+
+	Const Function Operator ==(y As Currency) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_EQ
+	End Function
+
+	Const Function Operator ==(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_EQ
+	End Function
+
+	Const Function Operator <>(y As Currency) As Boolean
+		Dim c = Compare(This, y)
+		Return c <> VARCMP_EQ
+	End Function
+
+	Const Function Operator <>(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c <> VARCMP_EQ
+	End Function
+
+	Const Function Operator <(y As Currency) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_LT
+	End Function
+
+	Const Function Operator <(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_LT
+	End Function
+
+	Const Function Operator >(y As Currency) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_GT
+	End Function
+
+	Const Function Operator >(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_GT
+	End Function
+
+	Const Function Operator <=(y As Currency) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_LT Or c = VARCMP_EQ
+	End Function
+
+	Const Function Operator <=(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_LT Or c = VARCMP_EQ
+	End Function
+
+	Const Function Operator >=(y As Currency) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_GT Or c = VARCMP_EQ
+	End Function
+
+	Const Function Operator >=(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_GT Or c = VARCMP_EQ
+	End Function
+
+	Const Function Abs() As Currency
+		Abs = New Currency
+		VarCyAbs(This.cy, Abs.cy)
+	End Function
+
+	Const Function Fix() As Currency
+		Fix = New Currency
+		VarCyFix(This.cy, Fix.cy)
+	End Function
+
+	Const Function Int() As Currency
+		Int = New Currency
+		VarCyInt(This.cy, Int.cy)
+	End Function
+
+	Const Function Round(c = 0 As Long) As Currency
+		Round = New Currency
+		VarCyRound(This.cy, c, Round.cy)
+	End Function
+
+	Const Function Cy() As CY
+		Cy = cy
+	End Function
+
+	Sub Cy(c As CY)
+		cy = c
+	End Sub
+
+	Const Function ToDouble() As Double
+		VarR8FromCy(cy, ToDouble)
+	End Function
+
+	Const Function ToInt64() As Int64
+		VarI8FromCy(cy, ToInt64)
+	End Function
+
+	Const Function ToVariant() As Variant
+		Return New Variant(This)
+	End Function
+
+	Override Function ToString() As String
+		/*Using*/ Dim bstr = New BString
+			Dim bs As BSTR
+			VarBstrFromCy(cy, LOCALE_USER_DEFAULT, LOCALE_USE_NLS, bs)
+			bstr.Attach(bs)
+			ToString = bstr.ToString
+		bstr.Dispose() 'End Using
+	End Function
+
+	Override Function GetHashCode() As Long
+		Return HIDWORD(cy) Xor LODWORD(cy)
+	End Function
+
+	Function Equals(y As Currency) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_EQ
+	End Function
+Private
+	cy As CY
+End Class
+
+End Namespace 'COM
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/com/decimal.ab
===================================================================
--- /trunk/ab5.0/ablib/src/com/decimal.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/com/decimal.ab	(revision 506)
@@ -0,0 +1,369 @@
+' com/decimal.ab
+
+#require <com/variant.ab>
+#require <com/currency.ab>
+
+Namespace ActiveBasic
+Namespace COM
+
+Class Decimal
+Public
+	Sub Decimal()
+	End Sub
+
+	Sub Decimal(d As Decimal)
+		dec = d.dec
+	End Sub
+
+	Sub Decimal(ByRef d As DECIMAL)
+		dec = d
+	End Sub
+
+	Sub Decimal(lo As Long, mid As Long, hi As Long, isNegative As Boolean, scale As Byte)
+		If scale > 28 Then
+			Throw New ArgumentOutOfRangeException("scale")
+		End If
+		Dim sign As Byte
+		If isNegative Then
+			sign = DECIMAL_NEG
+		Else
+			sign = 0
+		End If
+		dec.signscale = MAKEWORD(sign, scale) 'ToDo:どっちが上位だか検証すること
+		dec.Hi32 = hi
+		dec.Lo64 = MAKEQWORD(mid, lo)
+	End Sub
+
+	Sub Decimal(x As Long)
+		VarDecFromI4(x, dec)
+	End Sub
+
+	Sub Decimal(x As DWord)
+		VarDecFromUI4(x, dec)
+	End Sub
+
+	Sub Decimal(x As Int64)
+		VarDecFromI8(x, dec)
+	End Sub
+
+	Sub Decimal(x As QWord)
+		VarDecFromUI8(x, dec)
+	End Sub
+
+	Sub Decimal(x As Single)
+		VarDecFromR4(x, dec)
+	End Sub
+
+	Sub Decimal(x As Double)
+		VarDecFromR8(x, dec)
+	End Sub
+/*
+	Const Function Operator() As Variant
+		Return New Variant(This)
+	End Function
+/*
+	Static Function Operator(x As SByte) As Decimal
+		Dim d = New Decimal
+		VarDecFromI1(x, d.dec)
+		Return d
+	End Function
+
+	Static Function Operator(x As Byte) As Decimal
+		Dim d = New Decimal
+		VarDecFromUI1(x, d.dec)
+		Return d
+	End Function
+
+	Static Function Operator(x As Integer) As Decimal
+		Dim d = New Decimal
+		VarDecFromI2(x, d.dec)
+		Return d
+	End Function
+
+	Static Function Operator(x As Word) As Decimal
+		Dim d = New Decimal
+		VarDecFromUI2(x, d.dec)
+		Return d
+	End Function
+
+	Static Function Operator(x As Long) As Decimal
+		Dim d = New Decimal
+		VarDecFromI4(x, d.dec)
+		Return d
+	End Function
+
+	Static Function Operator(x As DWord) As Decimal
+		Dim d = New Decimal
+		VarDecFromUI4(x, d.dec)
+		Return d
+	End Function
+
+	Static Function Operator(x As Int64) As Decimal
+		Dim d = New Decimal
+		VarDecFromI8(x, d.dec)
+		Return d
+	End Function
+
+	Static Function Operator(x As QWord) As Decimal
+		Dim d = New Decimal
+		VarDecFromUI8(x, d.dec)
+		Return d
+	End Function
+
+	Static Function Operator(x As DECIMAL) As Decimal
+		Return New Decimal(X)
+	End Function
+
+	Const Function Operator As() As SByte
+		Dim x As SByte
+		VarI1FromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As Byte
+		Dim x As Byte
+		VarUI1FromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As Integer
+		Dim x As Integer
+		VarI2FromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As Word
+		Dim x As Word
+		VarUI2FromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As Long
+		Dim x As Long
+		VarI4FromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As DWord
+		Dim x As DWord
+		VarUI4FromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As Int64
+		Dim x As Int64
+		VarI8FromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As QWord
+		Dim x As QWord
+		VarUI8FromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As Single
+		Dim x As Single
+		VarR4FromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As Double
+		Dim x As Double
+		VarR8FromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As Currency
+		Dim x As Currency
+		VarCyFromDec(dec, x)
+		Return x
+	End Function
+
+	Const Function Operator As() As DECIMAL
+		Return dec
+	End Function
+
+	Static Function Operator As(x As Single) As Decimal
+		Dim d = New Decimal
+		VarDecFromR4(x, d.dec)
+		Return d
+	End Function
+
+	Static Function Operator As(x As Double) As Decimal
+		Dim d = New Decimal
+		VarDecFromR8(x, d.dec)
+		Return d
+	End Function
+*/
+/*
+	Const Function Operator +() As Decimal
+		Return New Decimal(dec)
+	End Function
+*/
+	Const Function Operator -() As Decimal
+		Dim ret = New Decimal
+		VarDecNeg(This.dec, ret.dec)
+		Return ret
+	End Function
+
+	Const Function Operator *(y As Decimal) As Decimal
+		Dim ret = New Decimal
+		VarDecMul(This.dec, y.dec, ret.dec)
+		Return ret
+	End Function
+
+	Const Function Operator /(y As Decimal) As Decimal
+		Dim ret = New Decimal
+		VarDecDiv(This.dec, y.dec, ret.dec)
+		Return ret
+	End Function
+
+	Const Function Operator +(y As Decimal) As Decimal
+		Dim ret = New Decimal
+		VarDecAdd(This.dec, y.dec, ret.dec)
+		Return ret
+	End Function
+
+	Const Function Operator -(y As Decimal) As Decimal
+		Dim ret = New Decimal
+		VarDecSub(This.dec, y.dec, ret.dec)
+		Return ret
+	End Function
+
+	Static Function Compare(x As Decimal, y As Decimal) As HRESULT
+		Return VarDecCmp(x.dec, y.dec)
+	End Function
+
+	Static Function Compare(x As Decimal, y As Double) As HRESULT
+		Return VarDecCmpR8(x.dec, y)
+	End Function
+
+	Static Function Compare(x As Double, y As Decimal) As HRESULT
+		Dim ret = VarDecCmpR8(y.dec, x)
+		Select Case ret
+			Case VARCMP_LT
+				Return VARCMP_GT
+			Case VARCMP_GT
+				Return VARCMP_LT
+			Case Else
+				Return ret
+		End Select
+	End Function
+
+	Const Function Operator ==(y As Decimal) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_EQ
+	End Function
+
+	Const Function Operator ==(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_EQ
+	End Function
+
+	Const Function Operator <>(y As Decimal) As Boolean
+		Dim c = Compare(This, y)
+		Return c <> VARCMP_EQ
+	End Function
+
+	Const Function Operator <>(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c <> VARCMP_EQ
+	End Function
+
+	Const Function Operator <(y As Decimal) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_LT
+	End Function
+
+	Const Function Operator <(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_LT
+	End Function
+
+	Const Function Operator >(y As Decimal) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_GT
+	End Function
+
+	Const Function Operator >(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_GT
+	End Function
+
+	Const Function Operator <=(y As Decimal) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_LT Or c = VARCMP_EQ
+	End Function
+
+	Const Function Operator <=(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_LT Or c = VARCMP_EQ
+	End Function
+
+	Const Function Operator >=(y As Decimal) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_GT Or c = VARCMP_EQ
+	End Function
+
+	Const Function Operator >=(y As Double) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_GT Or c = VARCMP_EQ
+	End Function
+
+	Const Function Abs() As Decimal
+		Abs = New Decimal
+		VarDecAbs(This.dec, Abs.dec)
+	End Function
+
+	Const Function Fix() As Decimal
+		Fix = New Decimal
+		VarDecFix(This.dec, Fix.dec)
+	End Function
+
+	Const Function Int() As Decimal
+		Int = New Decimal
+		VarDecInt(This.dec, Int.dec)
+	End Function
+
+	Const Function Round(c = 0 As Long) As Decimal
+		Round = New Decimal
+		VarDecRound(This.dec, c, Round.dec)
+	End Function
+
+	Const Function Dec() As DECIMAL
+		Return dec
+	End Function
+
+	Sub Dec(ByRef d As DECIMAL)
+		dec = d
+	End Sub
+
+	Const Function ToVariant() As Variant
+		Return New Variant(This)
+	End Function
+
+	Override Function ToString() As String
+		/*Using*/ Dim bstr = New BString
+			Dim bs As BSTR
+			VarBstrFromDec(dec, LOCALE_USER_DEFAULT, LOCALE_USE_NLS, bs)
+			bstr.Attach(bs)
+			ToString = bstr.ToString
+		bstr.Dispose() 'End Using
+	End Function
+
+	Override Function GetHashCode() As Long
+		Dim p = VarPtr(dec) As *DWord
+		Return (p[0] Xor p[1] Xor p[2] Xor p[3]) As Long
+	End Function
+
+	Function Equals(y As Decimal) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_EQ
+	End Function
+Private
+	dec As DECIMAL
+End Class
+
+End Namespace 'COM
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/com/index.ab
===================================================================
--- /trunk/ab5.0/ablib/src/com/index.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/com/index.ab	(revision 506)
@@ -0,0 +1,5 @@
+#require <com/bstring.ab>
+#require <com/variant.ab>
+'#require <com/vbobject.ab>
+#require <com/currency.ab>
+#require <com/decimal.ab>
Index: /trunk/ab5.0/ablib/src/com/variant.ab
===================================================================
--- /trunk/ab5.0/ablib/src/com/variant.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/com/variant.ab	(revision 506)
@@ -0,0 +1,623 @@
+' com/variant.ab
+
+'#require <com/index.ab>
+
+Namespace ActiveBasic
+Namespace COM
+
+Class Variant
+Public
+	Sub Variant()
+		VariantInit(v)
+	End Sub
+
+	Sub Variant(y As Variant)
+		VariantInit(v)
+		VariantCopy(v, y.v)
+	End Sub
+
+	Sub Variant(ByRef y As VARIANT)
+		VariantInit(v)
+		VariantCopy(v, y)
+	End Sub
+
+	Sub Variant(n As SByte)
+		v.vt = VT_I1
+		SetByte(VarPtr(v.val), n)
+	End Sub
+
+	Sub Variant(n As Byte)
+		v.vt = VT_UI1
+		SetByte(VarPtr(v.val), n)
+	End Sub
+
+	Sub Variant(n As Integer)
+		v.vt = VT_I2
+		SetWord(VarPtr(v.val), n)
+	End Sub
+
+	Sub Variant(n As Word)
+		v.vt = VT_UI2
+		SetWord(VarPtr(v.val), n)
+	End Sub
+
+	Sub Variant(n As Long)
+		v.vt = VT_I4
+		SetDWord(VarPtr(v.val), n)
+	End Sub
+
+	Sub Variant(n As DWord)
+		v.vt = VT_UI4
+		SetDWord(VarPtr(v.val), n)
+	End Sub
+
+	Sub Variant(n As Int64)
+		v.vt = VT_I8
+		SetQWord(VarPtr(v.val), n)
+	End Sub
+
+	Sub Variant(n As QWord)
+		v.vt = VT_UI8
+		SetQWord(VarPtr(v.val), n)
+	End Sub
+
+	Sub Variant(n As Single)
+		v.vt = VT_R4
+		SetSingle(VarPtr(v.val), n)
+	End Sub
+
+	Sub Variant(n As Double)
+		v.vt = VT_R8
+		SetDouble(VarPtr(v.val), n)
+	End Sub
+
+	Sub Variant(bs As BString)
+		v.vt = VT_BSTR
+		SetPointer(VarPtr(v.val), bs.Copy))
+	End Sub
+
+	Sub Variant(unk As IUnknown)
+		If Not IsNothing(unk) Then unk.AddRef()
+		v.vt = VT_UNKNOWN
+		SetPointer(VarPtr(v.val), ObjPtr(unk))
+	End Sub
+
+	Sub Variant(disp As IDispatch)
+		If Not IsNothing(disp) Then disp.AddRef()
+		v.vt = VT_DISPATCH
+		SetPointer(VarPtr(v.val), ObjPtr(disp))
+	End Sub
+/*
+	Sub Variant(b As VARIANT_BOOL)
+		v.vt = VT_BOOL
+		SetWord(VarPtr(v.val), b)
+	End Sub
+*/
+	Sub Variant(b As Boolean)
+		v.vt = VT_BOOL
+		If b Then
+			SetWord(VarPtr(v.val), VARIANT_TRUE)
+		Else
+			SetWord(VarPtr(v.val), VARIANT_FALSE)
+		End If
+	End Sub
+
+	Sub Variant(s As String)
+		ValStr = New BString(s)
+	End Sub
+
+	Sub Variant(n As Currency)
+		v.vt = VT_CY
+		SetQWord(VarPtr(v.val), n.Cy As QWord)
+	End Sub
+
+	Sub Variant(n As Decimal)
+		Dim p = VarPtr(v) As *DECIMAL
+		p[0] = n.Dec
+		v.vt = VT_DECIMAL
+	End Sub
+
+
+	Sub ~Variant()
+		Clear()
+	End Sub
+
+	Sub Clear()
+		VariantClear(v)
+		v.vt = VT_EMPTY
+	End Sub
+
+	Sub Assign(from As Variant)
+		Assign(from.v)
+	End Sub
+
+	Sub Assign(ByRef from As VARIANT)
+		Variant.Copy(v, from)
+	End Sub
+
+	Sub AssignInd(ByRef from As VARIANT)
+		VariantCopyInd(v, from)
+	End Sub
+
+	Sub Attach(ByRef from As VARIANT)
+		Variant.Move(v, from)
+	End Sub
+
+	Const Function Copy() As VARIANT
+		Variant.Copy(Copy, v)
+	End Function
+
+	Function Detach() As VARIANT
+		Variant.Move(Detach, v)
+	End Function
+/*
+	Static Function Assgin(ByRef from As VARIANT) As Variant
+		Assign = New Variant
+		Assgin.Assign(from)
+	End Function
+
+	Static Function Attach(ByRef from As VARIANT) As Variant
+		Attach = New Variant
+		Attach.Attach(from)
+	End Function
+*/
+	'Operators
+/*
+	Const Function Operator ^(y As Variant) As Variant
+		Dim ret = New Variant
+		VarPow(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator +() As Variant
+		Return New Variant(This)
+	End Function
+
+	Const Function Operator -() As Variant
+		Dim ret = New Variant
+		VarNeg(This.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator *(y As Variant) As Variant
+		Dim ret = New Variant
+		VarMul(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator /(y As Variant) As Variant
+		Dim ret = New Variant
+		VarDiv(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator \(y As Variant) As Variant
+		Dim ret = New Variant
+		VarIdiv(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator Mod(y As Variant) As Variant
+		Dim ret = New Variant
+		VarMod(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator +(y As Variant) As Variant
+		Dim ret = New Variant
+		VarAdd(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator -(y As Variant) As Variant
+		Dim ret = New Variant
+		VarSub(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator &(y As Variant) As Variant
+		Dim ret = New Variant
+		VarCat(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator And(y As Variant) As Variant
+		Dim ret = New Variant
+		VarAnd(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator Or(y As Variant) As Variant
+		Dim ret = New Variant
+		VarOr(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator Xor(y As Variant) As Variant
+		Dim ret = New Variant
+		VarXor(This.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Const Function Operator Not() As Variant
+		Dim ret = New Variant
+		VarNot(This.v, ret.v)
+		Return ret
+	End Function
+
+	Static Function Imp(x As Variant, y As Variant) As Variant
+		Dim ret = New Variant
+		VarImp(x.v, y.v, ret.v)
+		Return ret
+	End Function
+
+	Static Function Eqv(x As Variant, y As Variant) As Variant
+		Dim ret = New Variant
+		VarEqv(x.v, y.v, ret.v)
+		Return ret
+	End Function
+*/
+	Const Function Abs() As Variant
+		Abs = New Variant
+		VarAbs(This.v, Abs.v)
+	End Function
+
+	Const Function Fix() As Variant
+		Fix = New Variant
+		VarFix(This.v, Fix.v)
+	End Function
+
+	Const Function Int() As Variant
+		Int = New Variant
+		VarInt(This.v, Int.v)
+	End Function
+
+	Const Function Round(cDecimals = 0 As Long) As Variant
+		Round = New Variant
+		VarRound(This.v, cDecimals, Round.v)
+	End Function
+
+	Static Function Compare(x As Variant, y As Variant, lcid As LCID, flags As DWord) As HRESULT
+		Return VarCmp(removeNull(x).v, removeNull(y).v, lcid, flags)
+	End Function
+
+	Static Function Compare(x As Variant, y As Variant) As HRESULT
+		Return VarCmp(x.v, y.v, LOCALE_USER_DEFAULT, 0) 'VARCMP_NULL = 3を返す場合があるので注意
+	End Function
+
+	Const Function Operator ==(y As Variant) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_EQ
+	End Function
+
+	Const Function Operator <>(y As Variant) As Boolean
+		Dim c = Compare(This, y)
+		Return c <> VARCMP_EQ
+	End Function
+
+	Const Function Operator <(y As Variant) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_LT
+	End Function
+
+	Const Function Operator >(y As Variant) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_GT
+	End Function
+
+	Const Function Operator <=(y As Variant) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_LT Or c = VARCMP_EQ
+	End Function
+
+	Const Function Operator >=(y As Variant) As Boolean
+		Dim c = Compare(This, y)
+		Return c = VARCMP_GT Or c = VARCMP_EQ
+	End Function
+
+	Const Function ChangeType(vt As VARTYPE, flags As Word) As Variant
+		ChangeType = New Variant
+		ChangeType(ChangeType, flags, vt)
+	End Function
+
+	Const Function ChangeType(vt As VARTYPE) As Variant
+		Return ChangeType(vt, 0)
+	End Function
+
+	Const Function ChangeType(ByRef ret As VARIANT, flags As Word, vt As VARTYPE) As HRESULT
+		Return VariantChangeType(ret, v, flags, vt)
+	End Function
+
+	Const Function ChangeType(ByRef ret As Variant, flags As Word, vt As VARTYPE) As HRESULT
+		Return ChangeType(ret.v, flags, vt)
+	End Function
+
+	Const Function VarType() As VARTYPE
+		Return v.vt
+	End Function
+
+	Override Function ToString() As String
+		/*Using*/ Dim bs = ValStr
+		ToString = bs.ToString
+		bstr.Dispose() 'End Using
+	End Function
+
+	Override Function GetHashCode() As Long
+		Dim p = (VarPtr(v) As *DWord)
+		Return (p[0] Xor p[1] Xor p[2] Xor p[3]) As Long
+	End Function
+
+	Const Function ValUI1() As Byte
+		Dim r = ChangeType(VT_UI1)
+		Return GetByte(VarPtr(r.v.val))
+	End Function
+
+	Sub ValUI1(x As Byte)
+		Clear()
+		SetByte(VarPtr(v.val), x)
+		v.vt = VT_UI1
+	End Sub
+
+	Const Function ValUI2() As Word
+		Dim r = ChangeType(VT_UI2)
+		Return GetWord(VarPtr(r.v.val))
+	End Function
+
+	Sub ValUI2(x As Word)
+		Clear()
+		SetWord(VarPtr(v.val), x)
+		v.vt = VT_UI2
+	End Sub
+
+	Const Function ValUI4() As DWord
+		Dim r = ChangeType(VT_UI4)
+		Return GetDWord(VarPtr(r.v.val))
+	End Function
+
+	Sub ValUI4(x As DWord)
+		Clear()
+		SetDWord(VarPtr(v.val), x)
+		v.vt = VT_UI4
+	End Sub
+
+	Const Function ValUI8() As QWord
+		Dim r = ChangeType(VT_UI8)
+		Return GetQWord(VarPtr(r.v.val))
+	End Function
+
+	Sub ValUI8(x As QWord)
+		Clear()
+		SetQWord(VarPtr(v.val), x)
+		v.vt = VT_UI8
+	End Sub
+
+	Const Function ValI1() As SByte
+		Dim r = ChangeType(VT_I1)
+		Return GetByte(VarPtr(r.v.val)) As SByte
+	End Function
+
+	Sub ValI1(x As SByte)
+		Clear()
+		SetByte(VarPtr(v.val), x As Byte)
+		v.vt = VT_I1
+	End Sub
+
+	Const Function ValI2() As Integer
+		Dim r = ChangeType(VT_I2)
+		Return GetWord(VarPtr(r.v.val)) As Integer
+	End Function
+
+	Sub ValI2(x As Integer)
+		Clear()
+		SetWord(VarPtr(v.val), x As Word)
+		v.vt = VT_I2
+	End Sub
+
+	Const Function ValI4() As Long
+		Dim r = ChangeType(VT_I4)
+		Return GetDWord(VarPtr(r.v.val)) As Long
+	End Function
+
+	Sub ValI4(x As Long)
+		Clear()
+		SetDWord(VarPtr(v.val), x As DWord)
+		v.vt = VT_I4
+	End Sub
+
+	Const Function ValI8() As Int64
+		Dim r = ChangeType(VT_I8)
+		Return GetQWord(VarPtr(r.v.val)) As Int64
+	End Function
+
+	Sub ValI8(x As Int64)
+		Clear()
+		SetQWord(VarPtr(v.val), x As QWord)
+		v.vt = VT_I8
+	End Sub
+
+	Const Function ValR4() As Single
+		Dim r = ChangeType(VT_R4)
+		Return GetSingle(VarPtr(r.v.val))
+	End Function
+
+	Sub ValR4(x As Single)
+		Clear()
+		SetDWord(VarPtr(v.val), x)
+		v.vt = VT_R4
+	End Sub
+
+	Const Function ValR8() As Double
+		Dim r = ChangeType(VT_UI8)
+		Return GetDouble(VarPtr(r.v.val))
+	End Function
+
+	Sub ValR8(x As Double)
+		Clear()
+		SetDouble(VarPtr(v.val), x)
+		v.vt = VT_R8
+	End Sub
+
+	Const Function ValBool() As VARIANT_BOOL
+		Dim r = ChangeType(VT_BOOL)
+		Return GetWord(VarPtr(r.v.val))
+	End Function
+
+	Sub ValBool(x As VARIANT_BOOL)
+		Clear()
+		SetWord(VarPtr(v.val), x)
+		v.vt = VT_BOOL
+	End Sub
+
+	Const Function ValError() As SCODE
+		Dim r = ChangeType(VT_ERROR)
+		Return GetDWord(VarPtr(r.v.val))
+	End Function
+
+	Sub ValError(x As SCODE)
+		Clear()
+		SetDWord(VarPtr(v.val), x)
+		v.vt = VT_ERROR
+	End Sub
+
+	Const Function ValCy() As Currency
+		Dim r = ChangeType(VT_CY)
+		ValCy = New Currency
+		ValCy.Cy = GetQWord(VarPtr(r.v.val))
+	End Function
+
+	Sub ValCy(x As Currency)
+		Clear()
+		SetQWord(VarPtr(v.val), x.Cy)
+		v.vt = VT_CY
+	End Sub
+	
+	'ValDate
+
+	Const Function ValStr() As BString
+		ValStr = New BString
+		Dim r As VARIANT
+		ChangeType(r, VARIANT_ALPHABOOL, VT_BSTR)
+		ValStr.Attach(GetPointer(VarPtr(r.val)) As BSTR)
+	End Function
+
+	Sub ValStr(x As BString)
+		Clear()
+		v.vt = VT_BSTR
+		If IsNothing(x) Then
+			SetPointer(VarPtr(v.val), SysAllocStringLen(0))
+		Else
+			SetPointer(VarPtr(v.val), x.Copy())
+		End If
+	End Sub
+
+	Const Function ValUnknown() As IUnknown
+		Dim r As VARIANT
+		ChangeType(r, 0, VT_UNKNOWN)
+		Return _System_PtrUnknown(r.val As ULONG_PTR As VoidPtr)
+	End Function
+
+	Sub ValUnknown(x As IUnknown)
+		Clear()
+		SetPointer(VarPtr(v.val), ObjPtr(x))
+		If Not IsNothing(x) Then
+			x.AddRef()
+		End If
+		v.vt = VT_UNKNOWN
+	End Sub
+/*
+	Const Function ValObject() As VBObject
+		Dim r As VARIANT
+		ChangeType(r, 0, VT_DISPATCH)
+		Dim o As VBObject
+		o.Attach(GetPointer(VarPtr(r.val)) As *IDispatch)
+		Return o
+	End Function
+
+	Sub ValObject(x As VBObject)
+		Clear()
+		SetPointer(VarPtr(v.val), x.Copy())
+		x->AddRef()
+		v.vt = VT_DISPATH
+	End Sub
+*/
+	'ValArray
+
+	Const Function ValDecimal() As Decimal
+		Dim p = VarPtr(v) As *Decimal
+		Return New Deciaml(ByVal p)
+	End Function
+
+	Sub ValDecimal(x As Decimal)
+		Clear()
+		Dim p = VarPtr(v) As *DECIMAL
+		p[0] = x.Dec
+		v.vt = VT_DECIMAL '念の為
+	End Sub
+	
+
+	Function PtrToVariant() As *VARIANT
+		Return VarPtr(v)
+	End Function
+
+	Static Function OptionalParam() As Variant
+		If IsNothing(optionalParam) Then
+			Dim t = New Variant
+			t.ValError = DISP_E_PARAMNOTFOUND
+			InterlockedCompareExchangePointer(ByVal VarPtr(optionalParam), ObjPtr(t), 0)
+		End If
+		Return optionalParam
+	End Function
+
+	Static Function Null() As Variant
+		If IsNothing(optionalParam) Then
+			Dim t = New Variant
+			Dim p = t.PtrToVariant
+			p->vt = VT_NULL
+			InterlockedCompareExchangePointer(ByVal VarPtr(optionalParam), ObjPtr(t), 0)
+		End If
+		Return optionalParam
+	End Function
+Private
+	v As VARIANT
+
+	Static Sub Copy(ByRef dst As VARIANT, ByRef src As VARIANT)
+		VariantCopy(dst, src)
+	End Sub
+
+	Static Sub Move(ByRef dst As VARIANT, ByRef src As VARIANT)
+		dst = src
+'		src.vt = VT_EMPTY
+	End Sub
+
+	Static Function removeNull(v As Variant) As Varinat
+		If IsNothing(v) Then
+			removeNull = Null
+		Else
+			removeNull = v
+		End If
+	End Function
+
+	Static optionalParam = Nothing As Variant
+	Static null = Nothing As Variant
+End Class
+
+/*
+Function Abs(v As Variant) As Variant
+	Return v.Abs()
+End Function
+
+Function Fix(v As Variant) As Variant
+	Return v.Fix()
+End Function
+
+Function Int(v As Variant) As Variant
+	Return v.Int()
+End Function
+
+Function VarType(v As Variant) As VARTYPE
+	Return v.VarType()
+End Function
+*/
+
+End Namespace 'COM
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/com/vbobject.ab
===================================================================
--- /trunk/ab5.0/ablib/src/com/vbobject.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/com/vbobject.ab	(revision 506)
@@ -0,0 +1,369 @@
+' com/vbobject.ab
+
+#require <com/variant.ab>
+
+Namespace ActiveBasic
+Namespace COM
+
+Class VBObject
+Public
+	Sub VBObject()
+		pdisp = 0
+	End Sub
+
+	Sub VBObject(className As String, pOuter As *IUnknown, clsContext As DWord)
+		VBObject(ToWCStr(className), pOuter, clsContext)
+	End Sub
+
+	Sub VBObject(className As PCSTR, pOuter As *IUnknown, clsContext As DWord)
+		VBObject(ToWCStr(className), pOuter, clsContext)
+	End Sub
+
+	Sub VBObject(className As PCWSTR, pOuter As *IUnknown, clsContext As DWord)
+		pdisp = 0
+		Dim clsid As CLSID
+		Dim hr = _System_CLSIDFromString(className, clsid)
+		VBObject(clsid, pOuter, clsContext)
+	End Sub
+
+	Sub VBObject(ByRef clsid As CLSID, pOuter As *IUnknown, clsContext As DWord)
+		Dim hr = CoCreateInstance(clsid, pOuter, clsContext, IID_IDispatch, pdisp)
+	End Sub
+
+	Sub VBObject(ByRef obj As VBObject)
+		pdisp = obj.pdisp
+		pdisp->AddRef()
+	End Sub
+
+	Sub ~VBObject()
+		Clear()
+	End Sub
+
+	Sub Clear()
+		If pdisp <> 0 Then
+			pdisp->Release()
+			pdisp = 0
+		End If
+	End Sub
+
+	Function Operator [](name As PCWSTR) As DispatchCaller
+		Return GetCaller(name)
+	End Function
+
+	Function Operator [](name As String) As DispatchCaller
+		Return GetCaller(ToWCStr(name))
+	End Function
+
+	Function Equals(y As VBObject) As Boolean
+		Return _System_COMReferenceEquals(pdisp, y.pdisp)
+	End Function
+/*
+	Override Function GetHashCode() As Long
+		Dim punk = _System_GetUnknown(pdisp)
+		GetHashCode = _System_HashFromPtr(punk)
+		punk->Release()
+	End Function
+*/
+	Function Operator ==(y As VBObject) As Boolean
+		Return Equals(y)
+	End Function
+
+	Function Operator <>(y As VBObject) As Boolean
+		Return Not Equals(y)
+	End Function
+
+	Sub Assign(p As *IDispatch)
+		Clear()
+		VBObject.Copy(pdisp, p)
+	End Sub
+
+	Function Copy() As *IDispatch
+		VBObject.Copy(GetDispatch, pdisp)
+	End Function
+
+	Sub Attach(ByRef p As *IDispatch)
+		Clear()
+		VBObject.Move(pdisp, p)
+	End Sub
+
+	Function Detach() As *IDispatch
+		VBObject.Move(Detach, pdisp)
+	End Function
+
+	Function Dispatch() As *IDispatch
+		Dispatch = pdisp
+	End Function
+Private
+	Function GetCaller(name As PCWSTR) As DispatchCaller
+		Dim dispid As DISPID
+		Dim hr = pdisp->GetIDsOfNames(GUID_NULL, VarPtr(name), 1, LOCALE_USER_DEFAULT, VarPtr(dispid))
+		Return New DispatchCaller(pdisp, dispid)
+	End Function
+
+	pdisp As *IDispatch
+
+	Static Sub Copy(ByRef dst As *IDispatch, ByVal src As *IDispatch)
+		dst = src
+		dst->AddRef()
+	End Sub
+
+	Static Sub Move(ByRef dst As *IDispatch, ByRef src As *IDispatch)
+		dst = src
+		src = 0
+	End Sub
+End Class
+
+Class DispatchCaller
+Public
+	Sub DispatchCaller()
+	End Sub
+	Sub DispatchCaller(pDispatch As *IDispatch, dispatchId As DISPID)
+		pdisp = pDispatch
+		pdisp->AddRef()
+		dispid = dispatchId
+	End Sub
+
+	Sub DispatchCaller(ByRef dc As DispatchCaller)
+		pdisp = dc.pdisp
+		pdisp->AddRef()
+		dispid = dc.dispid
+	End Sub
+
+	Sub Operator =(ByRef dc As DispatchCaller)
+		Dispose()
+		DispatchCaller(dc)
+	End Sub
+
+	Sub Dispose()
+		If pdisp <> 0 Then
+			pdisp->Release()
+			pdisp = 0
+		End If
+	End Sub
+
+	Sub ~DispatchCaller()
+		Dispose()
+	End Sub
+
+	Function Prop() As Variant
+		Dim dispParams As DISPPARAMS
+		With dispParams
+			.rgvarg = 0
+			.rgdispidNamedArgs = 0
+			.cArgs = 0
+			.cNamedArgs = 0
+		End With
+		Dim ret As VARIANT
+		Dim hr = pdisp->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, dispParams, ret, 0, 0)
+		Dispose()
+		Prop = New Variant
+		v.Attach(ret)
+		Return v
+	End Function
+
+	Sub Prop(arg As Variant)
+		Prop(ByVal arg.PtrToVariant)
+	End Sub
+
+	Sub Prop(ByRef arg As VARIANT)
+		setProp(arg, DISPATCH_PROPERTYPUT)
+	End Sub
+
+	Sub PropRef(arg As Variant)
+		PropRef(ByVal arg.PtrToVariant)
+	End Sub
+
+	Sub PropRef(ByRef arg As VARIANT)
+		setProp(arg, DISPATCH_PROPERTYPUTREF)
+	End Sub
+
+	Function Call(cArgs As Long, args As *VARIANT) As Variant
+		Dim dispParams As DISPPARAMS
+		With dispParams
+			.rgvarg = args
+			.rgdispidNamedArgs = 0
+			.cArgs = cArgs
+			.cNamedArgs = 0
+		End With
+		Dim ret As VARIANT
+		Dim hr = pdisp->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, dispParams, ret, ByVal 0, 0)
+		Dispose()
+		Dim v = New Variant
+		v.Attach(ret)
+		Return v
+	End Function
+
+'	Function Call(cArgs As Long, args As *Variant) As Variant
+'	End Function
+
+	Function Call() As Variant
+		Return Call(0, 0)
+	End Function
+
+	Function Call(arg0 As Variant) As Variant
+		Return Call(1, arg0.PtrToVariant)
+	End Function
+
+	Function Call(arg0 As Variant, arg1 As Variant) As Variant
+		Dim arg[ELM(2)] As VARIANT
+		arg[0] = arg0.Copy()
+		arg[1] = arg1.Copy()
+		Return Call(2, arg)
+	End Function
+
+	Function Call(arg0 As Variant, arg1 As Variant, arg2 As Variant) As Variant
+		Dim arg[ELM(3)] As VARIANT
+		arg[0] = arg0.Copy()
+		arg[1] = arg1.Copy()
+		arg[2] = arg2.Copy()
+		Return Call(3, arg)
+	End Function
+
+	Function Call(arg0 As Variant, arg1 As Variant, arg2 As Variant, arg3 As Variant) As Variant
+		Dim arg[ELM(4)] As VARIANT
+		arg[0] = arg0.Copy()
+		arg[1] = arg1.Copy()
+		arg[2] = arg2.Copy()
+		arg[3] = arg3.Copy()
+		Return Call(4, arg)
+	End Function
+
+/*
+	Function Call(arg0 = Variant.OptionalParam As Variant, arg1 = Variant.OptionalParam As Variant,
+		arg2 = Variant.OptionalParam As Variant, arg3 = Variant.OptionalParam As Variant,
+		arg4 = Variant.OptionalParam As Variant, arg5 = Variant.OptionalParam As Variant,
+		arg6 = Variant.OptionalParam As Variant, arg7 = Variant.OptionalParam As Variant,
+		arg8 = Variant.OptionalParam As Variant, arg9 = Variant.OptionalParam As Variant) As Variant
+		Dim arg[ELM(10)] As VARIANT
+		arg[0] = arg0.Copy()
+		arg[1] = arg1.Copy()
+		arg[2] = arg2.Copy()
+		arg[3] = arg3.Copy()
+		arg[4] = arg3.Copy()
+		arg[5] = arg4.Copy()
+		arg[6] = arg5.Copy()
+		arg[7] = arg6.Copy()
+		arg[8] = arg7.Copy()
+		arg[9] = arg8.Copy()
+		Return Call(10, arg)
+	End Function
+*/
+Private
+	Sub setProp(ByRef arg As VARIANT, callType As Word)
+		Dim dispidNamed = DISPID_PROPERTYPUT As DISPID
+		Dim dispParams As DISPPARAMS
+		With dispParams
+			.rgvarg = VarPtr(arg)
+			.rgdispidNamedArgs = VarPtr(dispidNamed)
+			.cArgs = 1
+			.cNamedArgs = 1
+		End With
+		Dim hr = pdisp->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, callType, dispParams, ByVal 0, ByVal 0, 0)
+		Dispose()
+	End Sub
+
+
+	pdisp As *IDispatch
+	dispid As DISPID
+End Class
+
+Function CallByName(obj As VBObject, procName As String, callType As Word, cArgs As Long, args As *VARIANT) As Variant
+	Return CallByName(obj.Dispatch, ToWCStr(procName), callType, cArgs, args)
+End Function
+
+Function CallByName(obj As VBObject, procName As PCWSTR, callType As Word, cArgs As Long, args As *VARIANT) As Variant
+	Return CallByName(obj.Dispatch, procName, callType, cArgs, args)
+End Function
+
+Function CallByName(obj As *IDispatch, name As PCWSTR, callType As Word, cArgs As Long, args As *VARIANT) As Variant
+	Dim dispid As DISPID
+	Dim hr = obj->GetIDsOfNames(GUID_NULL, VarPtr(name), 1, LOCALE_USER_DEFAULT, VarPtr(dispid))
+	Dim dispParams As DISPPARAMS
+	With dispParams
+		.rgvarg = args
+		.rgdispidNamedArgs = 0
+		.cArgs = cArgs
+		.cNamedArgs = 0
+	End With
+	Dim ret As VARIANT
+	hr = obj->Invoke(dispid, GUID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, dispParams, ret, ByVal 0, 0)
+	CallByName = New Variant
+	CallByName.Attach(ret)
+	Return CallByName
+End Function
+/*
+Function CreateObject(className As PCWSTR) As VBObject
+	Return New VBObject(className, 0, CLSCTX_ALL)
+End Function
+
+Function CreateObject(className As String) As VBObject
+	Return New VBObject(ToWCStr(className), 0, CLSCTX_ALL)
+End Function
+/*
+#ifdef _WIN32_DCOM
+Function CreateObject(className As PCWSTR, serverName As PCWSTR) As VBObject
+	Dim clsid As CLSID
+	Dim si As COSERVERINFO
+	Dim context As DWord
+	If /*Server = 0 OrElse* / Server[0] = 0 Then
+		context = CLSCTX_SERVER
+	Else
+		context = CLSCTX_REMOTE_SERVER
+		si.pwszName = serverName
+	End If
+
+	Dim hr = _System_CLSIDFromString(className, clsid)
+
+	Dim mqi As MULTI_QI
+	mqi.pIID = VarPtr(IID_IUnknown)
+	hr = CoCreateInstanceEx(clsid, 0, context, si, 1, VarPtr(mqi))
+	If SUCCEEDED(hr) Then
+		Dim obj As VBObject
+		obj.Attach(mqi.pItf As IDispatch)
+		Return obj
+	Else
+		'Throw
+		Return Nothing
+	End If
+End Function
+
+Function CreateObject(className As String, serverName As String) As VBObject
+	Return CreateObject(ToWCStr(className), ToWCStr(serverName))
+End Function
+#endif
+*/
+Function _System_CLSIDFromString(pwString As PCWSTR, ByRef guid As GUID) As HRESULT
+	If pwString[0] = &h007b As WCHAR Then
+		' 1文字目が { ならクラスIDの文字列表現と見なしCLSIDFromStringで変換。
+		_System_CLSIDFromString = CLSIDFromString(pwString, guid)
+	Else
+		_System_CLSIDFromString = CLSIDFromProgID(pwString, guid)
+	End If
+End Function
+
+Function _System_COMReferenceEquals(p As *IUnknown, q As *IUnknown) As Boolean
+	If p = q Then
+		Return True
+	Else If p = 0 Or q = 0 Then
+		Return False
+	End If
+
+	Dim punkX = _System_GetUnknown(p)
+	Dim punkY = _System_GetUnknown(q)
+	If punkX = punkY Then
+		_System_COMReferenceEquals = True
+	Else
+		_System_COMReferenceEquals = False
+	End If
+	punkX->Release()
+	punkY->Release()
+End Function
+
+Function _System_GetUnknown(p As *IUnknown) As *IUnknown 'pは任意のCOMインタフェース
+	If FAILDED(pdisp->QueryInterface(IID_Unknown, _System_GetUnknown)) Then
+		GetUnknown = 0
+	End If
+End Function
+
+End Namespace 'COM
+End Namespace 'ActiveBasic
Index: /trunk/ab5.0/ablib/src/crt.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/crt.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/crt.sbp	(revision 506)
@@ -0,0 +1,74 @@
+'crt.sbp
+
+#ifndef _DEFINE_CRTDLL_NAME
+Const _CrtDllName = "msvcrt"
+#endif
+
+Declare Function _beginthread cdecl Lib _CrtDllName (start_address As VoidPtr, stack_size As DWord, arglist As VoidPtr) As HANDLE
+Declare Function _beginthreadex cdecl Lib _CrtDllName (
+	security As *SECURITY_ATTRIBUTES,
+	stack_size As DWord,
+	start_address As VoidPtr,
+	arglist As VoidPtr,
+	initflag As DWord,
+	ByRef thrdaddr As DWord) As HANDLE
+Declare Sub _endthread cdecl Lib _CrtDllName ()
+Declare Sub _endthreadex cdecl Lib _CrtDllName (retval As DWord)
+
+Declare Function strstr cdecl Lib _CrtDllName (s1 As LPSTR, s2 As LPSTR) As LPSTR
+Declare Function memmove cdecl Lib _CrtDllName (dest As VoidPtr, src As VoidPtr, count As SIZE_T) As VoidPtr
+Declare Function _mbsstr cdecl Lib _CrtDllName (s1 As LPSTR, s2 As LPSTR) As LPSTR
+
+Declare Function memcmp CDecl Lib _CrtDllName (buf1 As VoidPtr, buf2 As VoidPtr, c As SIZE_T) As Long
+Declare Function memicmp CDecl Lib _CrtDllName Alias "_memicmp" (buf1 As VoidPtr, buf2 As VoidPtr, c As SIZE_T) As Long
+
+TypeDef va_list = VoidPtr
+
+Declare Function sprintf CDecl Lib _CrtDllName (buffer As PSTR, format As PCSTR, ...) As Long
+Declare Function _snprintf CDecl Lib _CrtDllName (buffer As PSTR, count As SIZE_T, format As PCSTR, ...) As Long
+Declare Function _scprintf CDecl Lib _CrtDllName (format As PCSTR, ...) As Long
+Declare Function vsprintf CDecl Lib _CrtDllName (buffer As PSTR, format As PCSTR, argptr As va_list) As Long
+Declare Function _vsnprintf CDecl Lib _CrtDllName (buffer As PSTR, count As SIZE_T, format As PCSTR, argptr As va_list) As Long
+Declare Function _vscprintf CDecl Lib _CrtDllName (format As PCSTR, argptr As va_list) As Long
+
+Declare Function swprintf CDecl Lib _CrtDllName (buffer As PWSTR, format As PCWSTR, ...) As Long
+Declare Function _snwprintf CDecl Lib _CrtDllName (buffer As PWSTR, count As SIZE_T, format As PCWSTR, ...) As Long
+Declare Function _scwprintf CDecl Lib _CrtDllName (format As PCWSTR, ...) As Long
+Declare Function vswprintf CDecl Lib _CrtDllName (buffer As PWSTR, format As PCWSTR, argptr As va_list) As Long
+Declare Function _vsnwprintf CDecl Lib _CrtDllName (buffer As PWSTR, count As SIZE_T, format As PCWSTR, argptr As va_list) As Long
+Declare Function _vscwprintf CDecl Lib _CrtDllName (format As PCWSTR, argptr As va_list) As Long
+
+Declare Function sscanf CDecl Lib _CrtDllName (buffer As PCSTR, format As PCSTR, ...) As Long
+Declare Function swscanf CDecl Lib _CrtDllName (buffer As PCWSTR, format As PCWSTR, ...) As Long
+
+#ifdef UNICODE
+Declare Function _stprintf CDecl Lib _CrtDllName Alias "swprintf" (buffer As PWSTR, format As PCWSTR, ...) As Long
+Declare Function _sntprintf CDecl Lib _CrtDllName Alias "_snwprintf" (buffer As PWSTR, count As SIZE_T, format As PCWSTR, ...) As Long
+Declare Function _sctprintf CDecl Lib _CrtDllName Alias "_scwprintf" (format As PCWSTR, ...) As Long
+Declare Function _vstprintf CDecl Lib _CrtDllName Alias "vswprintf" (buffer As PWSTR, format As PCWSTR, argptr As va_list) As Long
+Declare Function _vsntprintf CDecl Lib _CrtDllName Alias "_vsnwprintf" (buffer As PWSTR, count As SIZE_T, format As PCWSTR, argptr As va_list) As Long
+Declare Function _vsctprintf CDecl Lib _CrtDllName Alias "_vscwprintf" (format As PCWSTR, argptr As va_list) As Long
+
+Declare Function _stscanf CDecl Lib _CrtDllName Alias "swscanf" (buffer As PCWSTR, format As PCWSTR, ...) As Long
+#else
+Declare Function _stprintf CDecl Lib _CrtDllName Alias "sprintf" (buffer As PSTR, format As PCSTR, ...) As Long
+Declare Function _sntprintf CDecl Lib _CrtDllName Alias "_snprintf" (buffer As PSTR, count As SIZE_T, format As PCSTR, ...) As Long
+Declare Function _sctprintf CDecl Lib _CrtDllName Alias "_scprintf" (format As PCSTR, ...) As Long
+Declare Function _vstprintf CDecl Lib _CrtDllName Alias "vsprintf" (buffer As PSTR, format As PCSTR, argptr As va_list) As Long
+Declare Function _vsntprintf CDecl Lib _CrtDllName Alias "_vsnprintf" (buffer As PSTR, count As SIZE_T, format As PCSTR, argptr As va_list) As Long
+Declare Function _vsctprintf CDecl Lib _CrtDllName Alias "_vscprintf" (format As PCSTR, argptr As va_list) As Long
+
+Declare Function _stscanf CDecl Lib _CrtDllName Alias "sscanf" (buffer As PCSTR, format As PCSTR, ...) As Long
+#endif
+
+Declare Function strtol CDecl Lib _CrtDllName (s As PCSTR, ByRef endPtr As PSTR, base As Long) As Long
+Declare Function wcstol CDecl Lib _CrtDllName (s As PCWSTR, ByRef endPtr As PWSTR, base As Long) As Long
+
+#ifdef UNICODE
+Declare Function _tcstol CDecl Lib _CrtDllName Alias "wcstol" (s As PCTSTR, ByRef endPtr As PTSTR, base As Long) As Long
+#else
+Declare Function _tcstol CDecl Lib _CrtDllName Alias "strtol" (s As PCTSTR, ByRef endPtr As PTSTR, base As Long) As Long
+#endif
+
+Declare Function memcmp cdecl lib "msvcrt" (p1 As VoidPtr, p2 As VoidPtr, n As SIZE_T) As Long
+Declare Function wmemcmp cdecl lib "msvcrt" (p1 As *WCHAR, p2 As WCHAR, n As SIZE_T) As Long
Index: /trunk/ab5.0/ablib/src/directx9/d3d9.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/d3d9.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/d3d9.sbp	(revision 506)
@@ -0,0 +1,447 @@
+'d3d9.sbp - Direct3D include file
+
+
+#ifndef _INC_D3D9
+#define _INC_D3D9
+
+
+Const DIRECT3D_VERSION = &H0900
+Const D3D_SDK_VERSION = 32
+
+#require <directx9\d3d9types.sbp>
+#require <directx9\d3d9caps.sbp>
+
+
+'--------------
+' DirectX9 API
+'--------------
+
+Declare Function Direct3DCreate9 Lib "d3d9.dll" (SDKVersion As DWord) As LPDIRECT3D9
+
+
+'--------------------
+' DirectX9 Interface
+'--------------------
+
+Interface IDirect3D9
+	Inherits IUnknown
+Public
+	'IDirect3D9 methods
+	Function ShoRegisterSoftwareDevice(pInitializeFunction As VoidPtr) As DWord
+	Function GetAdapterCount() As DWord
+	Function GetAdapterIdentifier(Adapter As DWord, Flags As DWord, pIdentifier As *D3DADAPTER_IDENTIFIER9) As DWord
+	Function GetAdapterModeCount(Adapter As DWord, Format As D3DFORMAT) As DWord
+	Function EnumAdapterModes(Adapter As DWord, Format As D3DFORMAT, Mode As DWord, pMode As *D3DDISPLAYMODE) As DWord
+	Function GetAdapterDisplayMode(Adapter As DWord, pMode As *D3DDISPLAYMODE) As DWord
+	Function CheckDeviceType(Adapter As DWord, DevType As D3DDEVTYPE, AdapterFormat As D3DFORMAT, BackBufferFormat As D3DFORMAT, bWindowed As Long) As DWord
+	Function CheckDeviceFormat(Adapter As DWord, DeviceType As D3DDEVTYPE, AdapterFormat As D3DFORMAT, Usage As DWord, RType As D3DRESOURCETYPE, CheckFormat As D3DFORMAT) As DWord
+	Function CheckDeviceMultiSampleType(Adapter As DWord, DeviceType As D3DDEVTYPE, SurfaceFormat As D3DFORMAT, Windowed As Long, MultiSampleType As D3DMULTISAMPLE_TYPE, pQualityLevels As DWordPtr) As DWord
+	Function CheckDepthStencilMatch(Adapter As DWord, DeviceType As D3DDEVTYPE, AdapterFormat As D3DFORMAT, RenderTargetFormat As D3DFORMAT, DepthStencilFormat As D3DFORMAT) As DWord
+	Function CheckDeviceFormatConversion(Adapter As DWord, DeviceType As D3DDEVTYPE, SourceFormat As D3DFORMAT, TargetFormat As D3DFORMAT) As DWord
+	Function GetDeviceCaps(Adapter As DWord, DeviceType As D3DDEVTYPE, pCaps As *D3DCAPS9) As DWord
+	Function GetAdapterMonitor(Adapter As DWord) As DWord
+	Function CreateDevice(Adapter As DWord, DeviceType As D3DDEVTYPE, hFocusWindow As HWND, BehaviorFlags As DWord, pPresentationParameters As *D3DPRESENT_PARAMETERS, ppReturnedDeviceInterface As *LPDIRECT3DDEVICE9) As DWord
+End Interface
+TypeDef LPDIRECT3D9 = *IDirect3D9
+
+Interface IDirect3DDevice9
+	Inherits IUnknown
+Public
+	'IDirect3DDevice9 methods
+	Function TestCooperativeLevel() As DWord
+	Function GetAvailableTextureMem() As DWord
+	Function EvictManagedResources() As DWord
+	Function GetDirect3D(ppD3D9 As *LPDIRECT3D9) As DWord
+	Function GetDeviceCaps(pCaps As *D3DCAPS9) As DWord
+	Function GetDisplayMode(iSwapChain As DWord, pMode As DWordPtr) As DWord
+	Function GetCreationParameters(pParameters As *D3DDEVICE_CREATION_PARAMETERS) As DWord
+	Function SetCursorProperties(XHotSpot As DWord, YHotSpot As DWord,pCursorBitmap As *IDirect3DSurface9) As DWord
+	Sub SetCursorPosition(X As Long, Y As Long, Flags As DWord)
+	Function ShowCursor(bShow As Long) As Long
+	Function CreateAdditionalSwapChain(pPresentationParameters As *D3DPRESENT_PARAMETERS, ppSwapChain As **IDirect3DSwapChain9) As DWord
+	Function GetSwapChain(iSwapChain As DWord, ppSwapChain As **IDirect3DSwapChain9) As DWord
+	Function GetNumberOfSwapChains() As DWord
+	Function Reset(pPresentationParameters As *D3DPRESENT_PARAMETERS) As DWord
+	Function Present(pSourceRect As *RECT, pDestRect As *RECT, hDestWindowOverride As DWord, pDirtyRegion As *RGNDATA) As DWord
+	Function GetBackBuffer(iSwapChain As DWord, iBackBuffer As DWord, bufType As D3DBACKBUFFER_TYPE, ppBackBuffer As **IDirect3DSurface9) As DWord
+	Function GetRasterStatus(iSwapChain As DWord, pRasterStatus As *D3DRASTER_STATUS) As DWord
+	Function SetDialogBoxMode(bEnableDialogs As Long) As DWord
+	Sub SetGammaRamp(iSwapChain As DWord, Flags As DWord, pRamp As *D3DGAMMARAMP)
+	Sub GetGammaRamp(iSwapChain As DWord, pRamp As *D3DGAMMARAMP)
+	Function CreateTexture(Width As DWord, Height As DWord, Levels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppTexture As **IDirect3DTexture9, pSharedHandle As DWordPtr) As DWord
+	Function CreateVolumeTexture(Width As DWord, Height As DWord, Depth As DWord, Levels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppVolumeTexture As **IDirect3DVolumeTexture9, pSharedHandle As DWordPtr) As DWord
+	Function CreateCubeTexture(EdgeLength As DWord, Levels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppCubeTexture As **IDirect3DCubeTexture9, pSharedHandle As DWordPtr) As DWord
+	Function CreateVertexBuffer(Length As DWord, Usage As DWord, FVF As DWord, Pool As D3DPOOL, ppVertexBuffer As **IDirect3DVertexBuffer9, pSharedHandle As DWordPtr) As DWord
+	Function CreateIndexBuffer(Length As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppIndexBuffer As **IDirect3DIndexBuffer9, pSharedHandle As DWordPtr) As DWord
+	Function CreateRenderTarget(Width As DWord, Height As DWord, Format As D3DFORMAT, MultiSample As D3DMULTISAMPLE_TYPE, MultisampleQuality As DWord, Lockable As Long, ppSurface As **IDirect3DSurface9, pSharedHandle As DWordPtr) As DWord
+	Function CreateDepthStencilSurface(Width As DWord, Height As DWord, Format As D3DFORMAT, MultiSample As D3DMULTISAMPLE_TYPE, MultisampleQuality As DWord, Discard As Long, ppSurface As **IDirect3DSurface9, pSharedHandle As DWordPtr) As DWord
+	Function UpdateSurface(pSourceSurface As *IDirect3DSurface9, pSourceRect As *RECT, pDestinationSurface As *IDirect3DSurface9, pDestPoint As *POINTAPI) As DWord
+	Function UpdateTexture(pSourceTexture As *IDirect3DBaseTexture9, pDestinationTexture As *IDirect3DBaseTexture9) As DWord
+	Function GetRenderTargetData(pRenderTarget As *IDirect3DSurface9, pDestSurface As *IDirect3DSurface9) As DWord
+	Function GetFrontBufferData(iSwapChain As DWord, pDestSurface As *IDirect3DSurface9) As DWord
+	Function StretchRect(pSourceSurface As *IDirect3DSurface9, pSourceRect As *RECT, pDestSurface As *IDirect3DSurface9, pDestRect As *RECT, Filter As D3DTEXTUREFILTERTYPE) As DWord
+	Function ColorFill(pSurface As *IDirect3DSurface9, pRect As *RECT,dwColor As DWord) As DWord
+	Function CreateOffscreenPlainSurface(Width As DWord, Height As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppSurface As **IDirect3DSurface9, pSharedHandle As DWordPtr) As DWord
+	Function SetRenderTarget(RenderTargetIndex As DWord, pRenderTarget As *IDirect3DSurface9) As DWord
+	Function GetRenderTarget(RenderTargetIndex As DWord, ppRenderTarget As **IDirect3DSurface9) As DWord
+	Function SetDepthStencilSurface(pNewZStencil As *IDirect3DSurface9) As DWord
+	Function GetDepthStencilSurface(ppZStencilSurface As **IDirect3DSurface9) As DWord
+	Function BeginScene() As DWord
+	Function EndScene() As DWord
+	Function Clear(Count As DWord, pRects As *D3DRECT, Flags As DWord, dwColor As DWord, Z As Single, Stencil As DWord) As DWord
+	Function SetTransform(State As D3DTRANSFORMSTATETYPE, pMatrix As *D3DMATRIX) As DWord
+	Function GetTransform(State As D3DTRANSFORMSTATETYPE, pMatrix As *D3DMATRIX) As DWord
+	Function MultiplyTransform(State As D3DTRANSFORMSTATETYPE, pMatrix As *D3DMATRIX) As DWord
+	Function SetViewport(pViewport As *D3DVIEWPORT9) As DWord
+	Function GetViewport(pViewport As *D3DVIEWPORT9) As DWord
+	Function SetMaterial(pMaterial As *D3DMATERIAL9) As DWord
+	Function GetMaterial(pMaterial As *D3DMATERIAL9) As DWord
+	Function SetLight(Index As DWord, pLight As *D3DLIGHT9) As DWord
+	Function GetLight(Index As DWord, pLight As *D3DLIGHT9) As DWord
+	Function LightEnable(Index As DWord, Enable As Long) As DWord
+	Function GetLightEnable(Index As DWord, pEnable As DWordPtr) As DWord
+	Function SetClipPlane(Index As DWord, pPlane As SinglePtr) As DWord
+	Function GetClipPlane(Index As DWord, pPlane As SinglePtr) As DWord
+	Function SetRenderState(State As D3DRENDERSTATETYPE, Value As DWord) As DWord
+	Function GetRenderState(State As D3DRENDERSTATETYPE, pValue As DWordPtr) As DWord
+	Function CreateStateBlock(BlockType As D3DSTATEBLOCKTYPE, ppSB As **IDirect3DStateBlock9) As DWord
+	Function BeginStateBlock() As DWord
+	Function EndStateBlock(ppSB As **IDirect3DStateBlock9) As DWord
+	Function SetClipStatus(pClipStatus As *D3DCLIPSTATUS9) As DWord
+	Function GetClipStatus(pClipStatus As *D3DCLIPSTATUS9) As DWord
+	Function GetTexture(Stage As DWord, ppTexture As **IDirect3DBaseTexture9) As DWord
+	Function SetTexture(Stage As DWord, pTexture As *IDirect3DBaseTexture9) As DWord
+	Function GetTextureStageState(Stage As DWord, StateType As D3DTEXTURESTAGESTATETYPE, pValue As DWordPtr) As DWord
+	Function SetTextureStageState(Stage As DWord, StateType As D3DTEXTURESTAGESTATETYPE, Value As DWord) As DWord
+	Function GetSamplerState(Sampler As DWord, SamplerStateType As D3DSAMPLERSTATETYPE, pValue As DWordPtr) As DWord
+	Function SetSamplerState(Sampler As DWord, SamplerStateType As D3DSAMPLERSTATETYPE, Value As DWord) As DWord
+	Function ValidateDevice(pNumPasses As DWordPtr) As DWord
+	Function SetPaletteEntries(PaletteNumber As DWord, pEntries As *PALETTEENTRY) As DWord
+	Function GetPaletteEntries(PaletteNumber As DWord, pEntries As *PALETTEENTRY) As DWord
+	Function SetCurrentTexturePalette(PaletteNumber As DWord) As DWord
+	Function GetCurrentTexturePalette(pPaletteNumber As DWordPtr) As DWord
+	Function SetScissorRect(pRect As *RECT) As DWord
+	Function GetScissorRect(pRect As *RECT) As DWord
+	Function SetSoftwareVertexProcessing(bSoftware As Long) As DWord
+	Function GetSoftwareVertexProcessing() As Long
+	Function SetNPatchMode(nSegments As Single) As DWord
+	Function GetNPatchMode() As Single
+	Function DrawPrimitive(PrimitiveType As D3DPRIMITIVETYPE, StartVertex As DWord, PrimitiveCount As DWord) As DWord
+	Function DrawIndexedPrimitive(PrimitiveType As D3DPRIMITIVETYPE, BaseVertexIndex As Long, MinVertexIndex As DWord, NumVertices As DWord, startIndex As DWord, primCount As DWord) As DWord
+	Function DrawPrimitiveUP(PrimitiveType As D3DPRIMITIVETYPE, PrimitiveCount As DWord, pVertexStreamZeroData As VoidPtr, VertexStreamZeroStride As DWord) As DWord
+	Function DrawIndexedPrimitiveUP(PrimitiveType As D3DPRIMITIVETYPE, MinVertexIndex As DWord, NumVertices As DWord, PrimitiveCount As DWord, pIndexData As VoidPtr, IndexDataFormat As D3DFORMAT, pVertexStreamZeroData As VoidPtr, VertexStreamZeroStride As DWord) As DWord
+	Function ProcessVertices(SrcStartIndex As DWord, DestIndex As DWord, VertexCount As DWord, pDestBuffer As *IDirect3DVertexBuffer9, pVertexDecl As *IDirect3DVertexDeclaration9, Flags As DWord) As DWord
+	Function CreateVertexDeclaration(pVertexElements As *D3DVERTEXELEMENT9, ppDecl As **IDirect3DVertexDeclaration9) As DWord
+	Function SetVertexDeclaration(pDecl As *IDirect3DVertexDeclaration9) As DWord
+	Function GetVertexDeclaration(ppDecl As **IDirect3DVertexDeclaration9) As DWord
+	Function SetFVF(FVF As DWord) As DWord
+	Function GetFVF(pFVF As DWordPtr) As DWord
+	Function CreateVertexShader(pFunction As DWordPtr, ppShader As **IDirect3DVertexShader9) As DWord
+	Function SetVertexShader(pShader As *IDirect3DVertexShader9) As DWord
+	Function GetVertexShader(ppShader As **IDirect3DVertexShader9) As DWord
+	Function SetVertexShaderConstantF(StartRegister As DWord, pConstantData As SinglePtr, Vector4fCount As DWord) As DWord
+	Function GetVertexShaderConstantF(StartRegister As DWord, pConstantData As SinglePtr, Vector4fCount As DWord) As DWord
+	Function SetVertexShaderConstantI(StartRegister As DWord, pConstantData As WordPtr, Vector4iCount As DWord) As DWord
+	Function GetVertexShaderConstantI(StartRegister As DWord, pConstantData As WordPtr, Vector4iCount As DWord) As DWord
+	Function SetVertexShaderConstantB(StartRegister As DWord, pConstantData As DWordPtr, BoolCount As DWord) As DWord
+	Function GetVertexShaderConstantB(StartRegister As DWord, pConstantData As DWordPtr, BoolCount As DWord) As DWord
+	Function SetStreamSource(StreamNumber As DWord, pStreamData As *IDirect3DVertexBuffer9, OffsetInBytes As DWord, Stride As DWord) As DWord
+	Function GetStreamSource(StreamNumber As DWord, ppStreamData As **IDirect3DVertexBuffer9, pOffsetInBytes As DWordPtr, pStride As DWordPtr) As DWord
+	Function SetStreamSourceFreq(StreamNumber As DWord, Setting As DWord) As DWord
+	Function GetStreamSourceFreq(StreamNumber As DWord, pSetting As DWordPtr) As DWord
+	Function SetIndices(pIndexData As *IDirect3DIndexBuffer9) As DWord
+	Function GetIndices(ppIndexData As **IDirect3DIndexBuffer9) As DWord
+	Function CreatePixelShader(pFunction As DWordPtr, ppShader As **IDirect3DPixelShader9) As DWord
+	Function SetPixelShader(pShader As *IDirect3DPixelShader9) As DWord
+	Function GetPixelShader(ppShader As **IDirect3DPixelShader9) As DWord
+	Function SetPixelShaderConstantF(StartRegister As DWord, pConstantData As SinglePtr, Vector4fCount As DWord) As DWord
+	Function GetPixelShaderConstantF(StartRegister As DWord, pConstantData As SinglePtr, Vector4fCount As DWord) As DWord
+	Function SetPixelShaderConstantI(StartRegister As DWord, pConstantData As WordPtr, Vector4iCount As DWord) As DWord
+	Function GetPixelShaderConstantI(StartRegister As DWord, pConstantData As WordPtr, Vector4iCount As DWord) As DWord
+	Function SetPixelShaderConstantB(StartRegister As DWord, pConstantData As DWordPtr, BoolCount As DWord) As DWord
+	Function GetPixelShaderConstantB(StartRegister As DWord, pConstantData As DWordPtr, BoolCount As DWord) As DWord
+	Function DrawRectPatch(Handle As DWord, pNumSegs As SinglePtr, pRectPatchInfo As *D3DRECTPATCH_INFO) As DWord
+	Function DrawTriPatch(Handle As DWord, pNumSegs As SinglePtr, pTriPatchInfo As *D3DTRIPATCH_INFO) As DWord
+	Function DeletePatch(Handle As DWord) As DWord
+	Function CreateQuery(QueryType As D3DQUERYTYPE, ppQuery As **IDirect3DQuery9) As DWord
+End Interface
+TypeDef LPDIRECT3DDEVICE9 = *IDirect3DDevice9
+
+Interface IDirect3DStateBlock9
+	Inherits IUnknown
+Public
+	'IDirect3DStateBlock9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function Capture() As DWord
+	Function Apply() As DWord
+End Interface
+TypeDef LPDIRECT3DSTATEBLOCK9 = *IDirect3DStateBlock9
+
+Interface IDirect3DSwapChain9
+	Inherits IUnknown
+Public
+	'IDirect3DSwapChain9 methods
+	Function Present(pSourceRect As *RECT, pDestRect As *RECT, hDestWindowOverride As DWord, pDirtyRegion As *RGNDATA, dwFlags As DWord) As DWord
+	Function GetFrontBufferData(pDestSurface As *IDirect3DSurface9) As DWord
+	Function GetBackBuffer(iBackBuffer As DWord, bbtype As D3DBACKBUFFER_TYPE, ppBackBuffer As **IDirect3DSurface9) As DWord
+	Function GetRasterStatus(pRasterStatus As *D3DRASTER_STATUS) As DWord
+	Function GetDisplayMode(pMode As *D3DDISPLAYMODE) As DWord
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function GetPresentParameters(pPresentationParameters As *D3DPRESENT_PARAMETERS) As DWord
+End Interface
+TypeDef LPDIRECT3DSWAPCHAIN9 = *IDirect3DSwapChain9
+
+Interface IDirect3DResource9
+	Inherits IUnknown
+Public
+	'IDirect3DResource9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
+	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
+	Function FreePrivateData(ByRef refguid As GUID) As DWord
+	Function SetPriority(PriorityNew As DWord) As DWord
+	Function GetPriority() As DWord
+	Sub PreLoad()
+	Function GetType() As D3DRESOURCETYPE
+End Interface
+TypeDef LPDIRECT3DRESOURCE9 = *IDirect3DResource9
+
+Interface IDirect3DVertexDeclaration9
+	Inherits IUnknown
+Public
+	'IDirect3DVertexDeclaration9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function GetDeclaration(pElement As *D3DVERTEXELEMENT9, pNumElements As DWordPtr) As DWord
+End Interface
+TypeDef LPDIRECT3DVERTEXDECLARATION9 = *IDirect3DVertexDeclaration9
+
+Interface IDirect3DVertexShader9
+	Inherits IUnknown
+Public
+	'IDirect3DVertexShader9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function GetFunction(pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
+End Interface
+TypeDef LPDIRECT3DVERTEXSHADER9 = *IDirect3DVertexShader9
+
+Interface IDirect3DPixelShader9
+	Inherits IUnknown
+Public
+	'IDirect3DPixelShader9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function GetFunction(pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
+End Interface
+TypeDef LPDIRECT3DPIXELSHADER9 = *IDirect3DPixelShader9
+
+Interface IDirect3DBaseTexture9
+	Inherits IUnknown
+Public
+	'IDirect3DResource9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
+	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
+	Function FreePrivateData(ByRef refguid As GUID) As DWord
+	Function SetPriority(PriorityNew As DWord) As DWord
+	Function GetPriority() As DWord
+	Sub PreLoad()
+	Function GetType() As D3DRESOURCETYPE
+	Function SetLOD(LODNew As DWord) As DWord
+	Function GetLOD() As DWord
+	Function GetLevelCount() As DWord
+	Function SetAutoGenFilterType(FilterType As D3DTEXTUREFILTERTYPE) As DWord
+	Function GetAutoGenFilterType() As D3DTEXTUREFILTERTYPE
+	Sub GenerateMipSubLevels()
+End Interface
+TypeDef LPDIRECT3DBASETEXTURE9 = *IDirect3DBaseTexture9
+
+Interface IDirect3DTexture9
+	Inherits IDirect3DBaseTexture9
+Public
+	Function GetLevelDesc(Level As DWord, pDesc As *D3DSURFACE_DESC) As DWord
+	Function GetSurfaceLevel(Level As DWord, ppSurfaceLevel As **IDirect3DSurface9) As DWord
+	Function LockRect(Level As DWord, pLockedRect As *D3DLOCKED_RECT, pRect As *RECT, Flags As DWord) As DWord
+	Function UnlockRect(Level As DWord) As DWord
+	Function AddDirtyRect(pDirtyRect As *RECT) As DWord
+End Interface
+TypeDef LPDIRECT3DTEXTURE9 = *IDirect3DTexture9
+
+Interface IDirect3DVolumeTexture9
+	Inherits IDirect3DBaseTexture9
+Public
+	Function GetLevelDesc(Level As DWord, pDesc As *D3DSURFACE_DESC) As DWord
+	Function GetVolumeLevel(Level As DWord, ppVolumeLevel As **IDirect3DVolume9) As DWord
+	Function LockBox(Level As DWord, pLockedVolume As *D3DLOCKED_BOX, pBox As *D3DBOX, Flags As DWord) As DWord
+	Function UnlockBox(Level As DWord) As DWord
+	Function AddDirtyBox(pDirtyBox As *D3DBOX) As DWord
+End Interface
+TypeDef LPDIRECT3DVOLUMETEXTURE9 = *IDirect3DVolumeTexture9
+
+Interface IDirect3DCubeTexture9
+	Inherits IDirect3DBaseTexture9
+End Interface
+TypeDef LPDIRECT3DCUBETEXTURE9 = *IDirect3DCubeTexture9
+
+Interface IDirect3DVertexBuffer9
+	Inherits IUnknown
+Public
+	'IDirect3DResource9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
+	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
+	Function FreePrivateData(ByRef refguid As GUID) As DWord
+	Function SetPriority(PriorityNew As DWord) As DWord
+	Function GetPriority() As DWord
+	Sub PreLoad()
+	Function GetType() As D3DRESOURCETYPE
+	Function Lock(OffsetToLock As DWord, SizeToLock As DWord, ppbData As VoidPtr, Flags As DWord) As DWord
+	Function Unlock() As DWord
+	Function GetDesc(pDesc As *D3DVERTEXBUFFER_DESC) As DWord
+End Interface
+TypeDef LPDIRECT3DVERTEXBUFFER9 = *IDirect3DVertexBuffer9
+
+Interface IDirect3DIndexBuffer9
+	Inherits IUnknown
+Public
+	'IDirect3DResource9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
+	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
+	Function FreePrivateData(ByRef refguid As GUID) As DWord
+	Function SetPriority(PriorityNew As DWord) As DWord
+	Function GetPriority() As DWord
+	Sub PreLoad()
+	Function GetType() As D3DRESOURCETYPE
+	Function Lock(OffsetToLock As DWord, SizeToLock As DWord, ppbData As VoidPtr, Flags As DWord) As DWord
+	Function Unlock() As DWord
+	Function GetDesc(pDesc As *D3DINDEXBUFFER_DESC) As DWord
+End Interface
+TypeDef LPDIRECT3DINDEXBUFFER9 = *IDirect3DIndexBuffer9
+
+Interface IDirect3DSurface9
+	Inherits IUnknown
+Public
+	'IDirect3DResource9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
+	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
+	Function FreePrivateData(ByRef refguid As GUID) As DWord
+	Function SetPriority(PriorityNew As DWord) As DWord
+	Function GetPriority() As DWord
+	Sub PreLoad()
+	Function GetType() As D3DRESOURCETYPE
+	Function GetContainer(ByRef riid As GUID, ppContainer As VoidPtr) As DWord
+	Function GetDesc(pDesc As *D3DSURFACE_DESC) As DWord
+	Function LockRect(pLockedRect As *D3DLOCKED_RECT, pRect As *RECT, Flags As DWord) As DWord
+	Function UnlockRect() As DWord
+	Function GetDC(phdc As DWordPtr) As DWord
+	Function ReleaseDC(hdc As DWord) As DWord
+End Interface
+TypeDef LPDIRECT3DSURFACE9 = *IDirect3DSurface9
+
+Interface IDirect3DVolume9
+	Inherits IUnknown
+Public
+	'IDirect3DVolume9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function SetPrivateData(ByRef refguid As GUID, pData As VoidPtr, SizeOfData As DWord, Flags As DWord) As DWord
+	Function GetPrivateData(ByRef refguid As GUID, pData As VoidPtr, pSizeOfData As DWordPtr) As DWord
+	Function FreePrivateData(ByRef refguid As GUID) As DWord
+	Function GetContainer(ByRef riid As GUID, ppContainer As DWordPtr) As DWord
+	Function GetDesc(pDesc As *D3DVOLUME_DESC) As DWord
+	Function LockBox(pLockedVolume As *D3DLOCKED_BOX, pBox As *D3DBOX, Flags As DWord) As DWord
+	Function UnlockBox() As DWord
+End Interface
+TypeDef LPDIRECT3DVOLUME9 = *IDirect3DVolume9
+
+Interface IDirect3DQuery9
+	Inherits IUnknown
+Public
+	'IDirect3DQuery9 methods
+	Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Function GetType() As D3DQUERYTYPE
+	Function GetDataSize() As DWord
+	Function Issue(dwIssueFlags As DWord) As DWord
+	Function GetData(pData As VoidPtr, dwSize As DWord, dwGetDataFlags As DWord) As DWord
+End Interface
+TypeDef LPDIRECT3DQUERY9 = *IDirect3DQuery9
+
+
+' Flags for SetPrivateData method on all D3D9 interfaces
+Const D3DSPD_IUNKNOWN = &H00000001
+
+
+' Flags for IDirect3D9::CreateDevice's BehaviorFlags
+Const D3DCREATE_FPU_PRESERVE                 = &H00000002
+Const D3DCREATE_MULTITHREADED                = &H00000004
+
+Const D3DCREATE_PUREDEVICE                   = &H00000010
+Const D3DCREATE_SOFTWARE_VERTEXPROCESSING    = &H00000020
+Const D3DCREATE_HARDWARE_VERTEXPROCESSING    = &H00000040
+Const D3DCREATE_MIXED_VERTEXPROCESSING       = &H00000080
+Const D3DCREATE_DISABLE_DRIVER_MANAGEMENT    = &H00000100
+Const D3DCREATE_ADAPTERGROUP_DEVICE          = &H00000200
+Const D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX = &H00000400
+
+Const D3DCREATE_NOWINDOWCHANGES = &H00000800
+
+
+' Parameter for IDirect3D9::CreateDevice's Adapter argument
+Const D3DADAPTER_DEFAULT = 0
+
+
+' Flags for IDirect3D9::EnumAdapters
+Const D3DENUM_WHQL_LEVEL = &H00000002
+
+
+' Maximum number of back-buffers supported in DX9
+Const D3DPRESENT_BACK_BUFFERS_MAX = 3
+
+
+' Flags for IDirect3DDevice9::SetGammaRamp
+Const D3DSGR_NO_CALIBRATION = &H00000000
+Const D3DSGR_CALIBRATE      = &H00000001
+
+
+' Flags for IDirect3DDevice9::SetCursorPosition
+Const D3DCURSOR_IMMEDIATE_UPDATE = &H00000001
+
+
+' Flags for IDirect3DSwapChain9::Present
+Const D3DPRESENT_DONOTWAIT      = &H00000001
+Const D3DPRESENT_LINEAR_CONTENT = &H00000002
+
+
+' DirectDraw error codes
+Const _FACD3D = &H876
+Const MAKE_D3DHRESULT(code) = MAKE_HRESULT( 1, _FACD3D, code )
+Const MAKE_D3DSTATUS(code)  = MAKE_HRESULT( 0, _FACD3D, code )
+
+' Direct3D Errors
+Const D3D_OK = S_OK
+Const D3DERR_WRONGTEXTUREFORMAT            = MAKE_D3DHRESULT(2072)
+Const D3DERR_UNSUPPORTEDCOLOROPERATION     = MAKE_D3DHRESULT(2073)
+Const D3DERR_UNSUPPORTEDCOLORARG           = MAKE_D3DHRESULT(2074)
+Const D3DERR_UNSUPPORTEDALPHAOPERATION     = MAKE_D3DHRESULT(2075)
+Const D3DERR_UNSUPPORTEDALPHAARG           = MAKE_D3DHRESULT(2076)
+Const D3DERR_TOOMANYOPERATIONS             = MAKE_D3DHRESULT(2077)
+Const D3DERR_CONFLICTINGTEXTUREFILTER      = MAKE_D3DHRESULT(2078)
+Const D3DERR_UNSUPPORTEDFACTORVALUE        = MAKE_D3DHRESULT(2079)
+Const D3DERR_CONFLICTINGRENDERSTATE        = MAKE_D3DHRESULT(2081)
+Const D3DERR_UNSUPPORTEDTEXTUREFILTER      = MAKE_D3DHRESULT(2082)
+Const D3DERR_CONFLICTINGTEXTUREPALETTE     = MAKE_D3DHRESULT(2086)
+Const D3DERR_DRIVERINTERNALERROR           = MAKE_D3DHRESULT(2087)
+
+Const D3DERR_NOTFOUND                      = MAKE_D3DHRESULT(2150)
+Const D3DERR_MOREDATA                      = MAKE_D3DHRESULT(2151)
+Const D3DERR_DEVICELOST                    = MAKE_D3DHRESULT(2152)
+Const D3DERR_DEVICENOTRESET                = MAKE_D3DHRESULT(2153)
+Const D3DERR_NOTAVAILABLE                  = MAKE_D3DHRESULT(2154)
+Const D3DERR_OUTOFVIDEOMEMORY              = MAKE_D3DHRESULT(380)
+Const D3DERR_INVALIDDEVICE                 = MAKE_D3DHRESULT(2155)
+Const D3DERR_INVALIDCALL                   = MAKE_D3DHRESULT(2156)
+Const D3DERR_DRIVERINVALIDCALL             = MAKE_D3DHRESULT(2157)
+Const D3DERR_WASSTILLDRAWING               = MAKE_D3DHRESULT(540)
+Const D3DOK_NOAUTOGEN                      = MAKE_D3DSTATUS(2159)
+
+
+#endif '_INC_D3D9
Index: /trunk/ab5.0/ablib/src/directx9/d3d9caps.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/d3d9caps.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/d3d9caps.sbp	(revision 506)
@@ -0,0 +1,391 @@
+'d3d9caps.sbp
+
+Type D3DVSHADERCAPS2_0
+	Caps As DWord
+	DynamicFlowControlDepth As Long
+	NumTemps As Long
+	StaticFlowControlDepth As Long
+End Type
+
+Const D3DVS20CAPS_PREDICATION = 1<<0
+
+Const D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH = 24
+Const D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0
+Const D3DVS20_MAX_NUMTEMPS                = 32
+Const D3DVS20_MIN_NUMTEMPS                = 12
+Const D3DVS20_MAX_STATICFLOWCONTROLDEPTH  = 4
+Const D3DVS20_MIN_STATICFLOWCONTROLDEPTH  = 1
+
+Type D3DPSHADERCAPS2_0
+	Caps As DWord
+	DynamicFlowControlDepth As Long
+	NumTemps As Long
+	StaticFlowControlDepth As Long
+	NumInstructionSlots As Long
+End Type
+
+Const D3DPS20CAPS_ARBITRARYSWIZZLE        = 1<<0
+Const D3DPS20CAPS_GRADIENTINSTRUCTIONS    = 1<<1
+Const D3DPS20CAPS_PREDICATION             = 1<<2
+Const D3DPS20CAPS_NODEPENDENTREADLIMIT    = 1<<3
+Const D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT   = 1<<4
+
+Const D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH = 24
+Const D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0
+Const D3DPS20_MAX_NUMTEMPS                = 32
+Const D3DPS20_MIN_NUMTEMPS                = 12
+Const D3DPS20_MAX_STATICFLOWCONTROLDEPTH  = 4
+Const D3DPS20_MIN_STATICFLOWCONTROLDEPTH  = 0
+Const D3DPS20_MAX_NUMINSTRUCTIONSLOTS     = 512
+Const D3DPS20_MIN_NUMINSTRUCTIONSLOTS     = 96
+
+Const D3DMIN30SHADERINSTRUCTIONS = 512
+Const D3DMAX30SHADERINSTRUCTIONS = 32768
+
+Type D3DCAPS9
+	'Device Info
+	DeviceType As DWord
+	AdapterOrdinal As DWord
+
+	'Caps from DX7 Draw
+	Caps As DWord
+	Caps2 As DWord
+	Caps3 As DWord
+	PresentationIntervals As DWord
+
+	'Cursor Caps
+	CursorCaps As DWord
+
+	'3D Device Caps
+	DevCaps As DWord
+
+	PrimitiveMiscCaps As DWord
+	RasterCaps As DWord
+	ZCmpCaps As DWord
+	SrcBlendCaps As DWord
+	DestBlendCaps As DWord
+	AlphaCmpCaps As DWord
+	ShadeCaps As DWord
+	TextureCaps As DWord
+	TextureFilterCaps As DWord
+	CubeTextureFilterCaps As DWord
+	VolumeTextureFilterCaps As DWord
+	TextureAddressCaps As DWord
+	VolumeTextureAddressCaps As DWord
+
+	LineCaps As DWord
+
+	MaxTextureWidth As DWord
+	MaxTextureHeight As DWord
+	MaxVolumeExtent As DWord
+
+	MaxTextureRepeat As DWord
+	MaxTextureAspectRatio As DWord
+	MaxAnisotropy As DWord
+	MaxVertexW As Single
+
+	GuardBandLeft As Single
+	GuardBandTop As Single
+	GuardBandRight As Single
+	GuardBandBottom As Single
+
+	ExtentsAdjust As Single
+	StencilCaps As DWord
+
+	FVFCaps As DWord
+	TextureOpCaps As DWord
+	MaxTextureBlendStages As DWord
+	MaxSimultaneousTextures As DWord
+
+	VertexProcessingCaps As DWord
+	MaxActiveLights As DWord
+	MaxUserClipPlanes As DWord
+	MaxVertexBlendMatrices As DWord
+	MaxVertexBlendMatrixIndex As DWord
+
+	MaxPointSize As Single
+
+	MaxPrimitiveCount As DWord
+	MaxVertexIndex As DWord
+	MaxStreams As DWord
+	MaxStreamStride As DWord
+
+	VertexShaderVersion As DWord
+	MaxVertexShaderConst As DWord
+
+	PixelShaderVersion As DWord
+	PixelShader1xMaxValue As Single
+
+	'Here are the DX9 specific ones
+	DevCaps2 As DWord
+
+	MaxNpatchTessellationLevel As Single
+	Reserved5 As DWord
+
+	MasterAdapterOrdinal As DWord
+	AdapterOrdinalInGroup As DWord
+	NumberOfAdaptersInGroup As DWord
+	DeclTypes As DWord
+	NumSimultaneousRTs As DWord
+	StretchRectFilterCaps As DWord
+	VS20Caps As D3DVSHADERCAPS2_0
+	PS20Caps As D3DPSHADERCAPS2_0
+	VertexTextureFilterCaps As DWord
+	MaxVShaderInstructionsExecuted As DWord
+	MaxPShaderInstructionsExecuted As DWord
+	MaxVertexShader30InstructionSlots As DWord
+	MaxPixelShader30InstructionSlots As DWord
+End Type
+
+
+' Caps
+Const D3DCAPS_READ_SCANLINE = &H00020000
+
+' Caps2
+Const D3DCAPS2_FULLSCREENGAMMA   = &H00020000
+Const D3DCAPS2_CANCALIBRATEGAMMA = &H00100000
+Const D3DCAPS2_RESERVED          = &H02000000
+Const D3DCAPS2_CANMANAGERESOURCE = &H10000000
+Const D3DCAPS2_DYNAMICTEXTURES   = &H20000000
+Const D3DCAPS2_CANAUTOGENMIPMAP  = &H40000000
+
+' Caps3
+Const D3DCAPS3_RESERVED = &H8000001F
+
+' Indicates that the device can respect the ALPHABLENDENABLE render state
+' when fullscreen while using the FLIP or DISCARD swap effect.
+' COPY and COPYVSYNC swap effects work whether or not this flag is set.
+Const D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD = &H00000020
+
+' Indicates that the device can perform a gamma correction from
+' a windowed back buffer containing linear content to the sRGB desktop.
+Const D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION = &H00000080
+
+Const D3DCAPS3_COPY_TO_VIDMEM    = &H00000100 'Device can acclerate copies from sysmem to local vidmem
+Const D3DCAPS3_COPY_TO_SYSTEMMEM = &H00000200 'Device can acclerate copies from local vidmem to sysmem
+
+' PresentationIntervals
+Const D3DPRESENT_INTERVAL_DEFAULT   = &H00000000
+Const D3DPRESENT_INTERVAL_ONE       = &H00000001
+Const D3DPRESENT_INTERVAL_TWO       = &H00000002
+Const D3DPRESENT_INTERVAL_THREE     = &H00000004
+Const D3DPRESENT_INTERVAL_FOUR      = &H00000008
+Const D3DPRESENT_INTERVAL_IMMEDIATE = &H80000000
+
+' CursorCaps
+Const D3DCURSORCAPS_COLOR  = &H00000001   'Driver supports HW color cursor in at least hi-res modes(height >=400)
+Const D3DCURSORCAPS_LOWRES = &H00000002   'Driver supports HW cursor also in low-res modes(height < 400)
+
+' DevCaps
+Const D3DDEVCAPS_EXECUTESYSTEMMEMORY     = &H00000010     'Device can use execute buffers from system memory
+Const D3DDEVCAPS_EXECUTEVIDEOMEMORY      = &H00000020     'Device can use execute buffers from video memory
+Const D3DDEVCAPS_TLVERTEXSYSTEMMEMORY    = &H00000040     'Device can use TL buffers from system memory
+Const D3DDEVCAPS_TLVERTEXVIDEOMEMORY     = &H00000080     'Device can use TL buffers from video memory
+Const D3DDEVCAPS_TEXTURESYSTEMMEMORY     = &H00000100     'Device can texture from system memory
+Const D3DDEVCAPS_TEXTUREVIDEOMEMORY      = &H00000200     'Device can texture from device memory
+Const D3DDEVCAPS_DRAWPRIMTLVERTEX        = &H00000400     'Device can draw TLVERTEX primitives
+Const D3DDEVCAPS_CANRENDERAFTERFLIP      = &H00000800     'Device can render without waiting for flip to complete
+Const D3DDEVCAPS_TEXTURENONLOCALVIDMEM   = &H00001000     'Device can texture from nonlocal video memory
+Const D3DDEVCAPS_DRAWPRIMITIVES2         = &H00002000     'Device can support DrawPrimitives2
+Const D3DDEVCAPS_SEPARATETEXTUREMEMORIES = &H00004000     'Device is texturing from separate memory pools
+Const D3DDEVCAPS_DRAWPRIMITIVES2EX       = &H00008000     'Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver
+Const D3DDEVCAPS_HWTRANSFORMANDLIGHT     = &H00010000     'Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also
+Const D3DDEVCAPS_CANBLTSYSTONONLOCAL     = &H00020000     'Device supports a Tex Blt from system memory to non-local vidmem
+Const D3DDEVCAPS_HWRASTERIZATION         = &H00080000     'Device has HW acceleration for rasterization
+Const D3DDEVCAPS_PUREDEVICE              = &H00100000     'Device supports D3DCREATE_PUREDEVICE
+Const D3DDEVCAPS_QUINTICRTPATCHES        = &H00200000     'Device supports quintic Beziers and BSplines
+Const D3DDEVCAPS_RTPATCHES               = &H00400000     'Device supports Rect and Tri patches
+Const D3DDEVCAPS_RTPATCHHANDLEZERO       = &H00800000     'Indicates that RT Patches may be drawn efficiently using handle 0
+Const D3DDEVCAPS_NPATCHES                = &H01000000     'Device supports N-Patches
+
+' PrimitiveMiscCaps
+Const D3DPMISCCAPS_MASKZ                      = &H00000002
+Const D3DPMISCCAPS_CULLNONE                   = &H00000010
+Const D3DPMISCCAPS_CULLCW                     = &H00000020
+Const D3DPMISCCAPS_CULLCCW                    = &H00000040
+Const D3DPMISCCAPS_COLORWRITEENABLE           = &H00000080
+Const D3DPMISCCAPS_CLIPPLANESCALEDPOINTS      = &H00000100     'Device correctly clips scaled points to clip planes
+Const D3DPMISCCAPS_CLIPTLVERTS                = &H00000200     'device will clip post-transformed vertex primitives
+Const D3DPMISCCAPS_TSSARGTEMP                 = &H00000400     'device supports D3DTA_TEMP for temporary register
+Const D3DPMISCCAPS_BLENDOP                    = &H00000800     'device supports D3DRS_BLENDOP
+Const D3DPMISCCAPS_NULLREFERENCE              = &H00001000     'Reference Device that doesnt render
+Const D3DPMISCCAPS_INDEPENDENTWRITEMASKS      = &H00004000     'Device supports independent write masks for MET or MRT
+Const D3DPMISCCAPS_PERSTAGECONSTANT           = &H00008000     'Device supports per-stage constants
+Const D3DPMISCCAPS_FOGANDSPECULARALPHA        = &H00010000     'Device supports separate fog and specular alpha (many devices use the specular alpha channel to store fog factor)
+Const D3DPMISCCAPS_SEPARATEALPHABLEND         = &H00020000     'Device supports separate blend settings for the alpha channel
+Const D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS    = &H00040000     'Device supports different bit depths for MRT
+Const D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING = &H00080000     'Device supports post-pixel shader operations for MRT
+Const D3DPMISCCAPS_FOGVERTEXCLAMPED           = &H00100000     'Device clamps fog blend factor per vertex
+
+' LineCaps
+Const D3DLINECAPS_TEXTURE   = &H00000001
+Const D3DLINECAPS_ZTEST     = &H00000002
+Const D3DLINECAPS_BLEND     = &H00000004
+Const D3DLINECAPS_ALPHACMP  = &H00000008
+Const D3DLINECAPS_FOG       = &H00000010
+Const D3DLINECAPS_ANTIALIAS = &H00000020
+
+' RasterCaps
+Const D3DPRASTERCAPS_DITHER              = &H00000001
+Const D3DPRASTERCAPS_ZTEST               = &H00000010
+Const D3DPRASTERCAPS_FOGVERTEX           = &H00000080
+Const D3DPRASTERCAPS_FOGTABLE            = &H00000100
+Const D3DPRASTERCAPS_MIPMAPLODBIAS       = &H00002000
+Const D3DPRASTERCAPS_ZBUFFERLESSHSR      = &H00008000
+Const D3DPRASTERCAPS_FOGRANGE            = &H00010000
+Const D3DPRASTERCAPS_ANISOTROPY          = &H00020000
+Const D3DPRASTERCAPS_WBUFFER             = &H00040000
+Const D3DPRASTERCAPS_WFOG                = &H00100000
+Const D3DPRASTERCAPS_ZFOG                = &H00200000
+Const D3DPRASTERCAPS_COLORPERSPECTIVE    = &H00400000   'Device iterates colors perspective correct
+Const D3DPRASTERCAPS_SCISSORTEST         = &H01000000
+Const D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS = &H02000000
+Const D3DPRASTERCAPS_DEPTHBIAS           = &H04000000
+Const D3DPRASTERCAPS_MULTISAMPLE_TOGGLE  = &H08000000
+
+' ZCmpCaps, AlphaCmpCaps
+Const D3DPCMPCAPS_NEVER        = &H00000001
+Const D3DPCMPCAPS_LESS         = &H00000002
+Const D3DPCMPCAPS_EQUAL        = &H00000004
+Const D3DPCMPCAPS_LESSEQUAL    = &H00000008
+Const D3DPCMPCAPS_GREATER      = &H00000010
+Const D3DPCMPCAPS_NOTEQUAL     = &H00000020
+Const D3DPCMPCAPS_GREATEREQUAL = &H00000040
+Const D3DPCMPCAPS_ALWAYS       = &H00000080
+
+' SourceBlendCaps, DestBlendCaps
+Const D3DPBLENDCAPS_ZERO            = &H00000001
+Const D3DPBLENDCAPS_ONE             = &H00000002
+Const D3DPBLENDCAPS_SRCCOLOR        = &H00000004
+Const D3DPBLENDCAPS_INVSRCCOLOR     = &H00000008
+Const D3DPBLENDCAPS_SRCALPHA        = &H00000010
+Const D3DPBLENDCAPS_INVSRCALPHA     = &H00000020
+Const D3DPBLENDCAPS_DESTALPHA       = &H00000040
+Const D3DPBLENDCAPS_INVDESTALPHA    = &H00000080
+Const D3DPBLENDCAPS_DESTCOLOR       = &H00000100
+Const D3DPBLENDCAPS_INVDESTCOLOR    = &H00000200
+Const D3DPBLENDCAPS_SRCALPHASAT     = &H00000400
+Const D3DPBLENDCAPS_BOTHSRCALPHA    = &H00000800
+Const D3DPBLENDCAPS_BOTHINVSRCALPHA = &H00001000
+Const D3DPBLENDCAPS_BLENDFACTOR     = &H00002000   'Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR
+
+' ShadeCaps
+Const D3DPSHADECAPS_COLORGOURAUDRGB    = &H00000008
+Const D3DPSHADECAPS_SPECULARGOURAUDRGB = &H00000200
+Const D3DPSHADECAPS_ALPHAGOURAUDBLEND  = &H00004000
+Const D3DPSHADECAPS_FOGGOURAUD         = &H00080000
+
+' TextureCaps
+Const D3DPTEXTURECAPS_PERSPECTIVE        = &H00000001  'Perspective-correct texturing is supported
+Const D3DPTEXTURECAPS_POW2               = &H00000002  'Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only.
+Const D3DPTEXTURECAPS_ALPHA              = &H00000004  'Alpha in texture pixels is supported
+Const D3DPTEXTURECAPS_SQUAREONLY         = &H00000020  'Only square textures are supported
+Const D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = &H00000040  'Texture indices are not scaled by the texture size prior to interpolation
+Const D3DPTEXTURECAPS_ALPHAPALETTE       = &H00000080  'Device can draw alpha from texture palettes
+Const D3DPTEXTURECAPS_NONPOW2CONDITIONAL = &H00000100
+Const D3DPTEXTURECAPS_PROJECTED          = &H00000400  'Device can do D3DTTFF_PROJECTED
+Const D3DPTEXTURECAPS_CUBEMAP            = &H00000800  'Device can do cubemap textures
+Const D3DPTEXTURECAPS_VOLUMEMAP          = &H00002000  'Device can do volume textures
+Const D3DPTEXTURECAPS_MIPMAP             = &H00004000  'Device can do mipmapped textures
+Const D3DPTEXTURECAPS_MIPVOLUMEMAP       = &H00008000  'Device can do mipmapped volume textures
+Const D3DPTEXTURECAPS_MIPCUBEMAP         = &H00010000  'Device can do mipmapped cube maps
+Const D3DPTEXTURECAPS_CUBEMAP_POW2       = &H00020000  'Device requires that cubemaps be power-of-2 dimension
+Const D3DPTEXTURECAPS_VOLUMEMAP_POW2     = &H00040000  'Device requires that volume maps be power-of-2 dimension
+Const D3DPTEXTURECAPS_NOPROJECTEDBUMPENV = &H00200000  'Device does not support projected bump env lookup operation in programmable and fixed function pixel shaders
+
+' TextureFilterCaps, StretchRectFilterCaps
+Const D3DPTFILTERCAPS_MINFPOINT         = &H00000100   'Min Filter
+Const D3DPTFILTERCAPS_MINFLINEAR        = &H00000200
+Const D3DPTFILTERCAPS_MINFANISOTROPIC   = &H00000400
+Const D3DPTFILTERCAPS_MINFPYRAMIDALQUAD = &H00000800
+Const D3DPTFILTERCAPS_MINFGAUSSIANQUAD  = &H00001000
+Const D3DPTFILTERCAPS_MIPFPOINT         = &H00010000   'Mip Filter
+Const D3DPTFILTERCAPS_MIPFLINEAR        = &H00020000
+Const D3DPTFILTERCAPS_MAGFPOINT         = &H01000000   'Mag Filter
+Const D3DPTFILTERCAPS_MAGFLINEAR        = &H02000000
+Const D3DPTFILTERCAPS_MAGFANISOTROPIC   = &H04000000
+Const D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD = &H08000000
+Const D3DPTFILTERCAPS_MAGFGAUSSIANQUAD  = &H10000000
+
+' TextureAddressCaps
+Const D3DPTADDRESSCAPS_WRAP          = &H00000001
+Const D3DPTADDRESSCAPS_MIRROR        = &H00000002
+Const D3DPTADDRESSCAPS_CLAMP         = &H00000004
+Const D3DPTADDRESSCAPS_BORDER        = &H00000008
+Const D3DPTADDRESSCAPS_INDEPENDENTUV = &H00000010
+Const D3DPTADDRESSCAPS_MIRRORONCE    = &H00000020
+
+' StencilCaps
+Const D3DSTENCILCAPS_KEEP     = &H00000001
+Const D3DSTENCILCAPS_ZERO     = &H00000002
+Const D3DSTENCILCAPS_REPLACE  = &H00000004
+Const D3DSTENCILCAPS_INCRSAT  = &H00000008
+Const D3DSTENCILCAPS_DECRSAT  = &H00000010
+Const D3DSTENCILCAPS_INVERT   = &H00000020
+Const D3DSTENCILCAPS_INCR     = &H00000040
+Const D3DSTENCILCAPS_DECR     = &H00000080
+Const D3DSTENCILCAPS_TWOSIDED = &H00000100
+
+' TextureOpCaps
+Const D3DTEXOPCAPS_DISABLE                   = &H00000001
+Const D3DTEXOPCAPS_SELECTARG1                = &H00000002
+Const D3DTEXOPCAPS_SELECTARG2                = &H00000004
+Const D3DTEXOPCAPS_MODULATE                  = &H00000008
+Const D3DTEXOPCAPS_MODULATE2X                = &H00000010
+Const D3DTEXOPCAPS_MODULATE4X                = &H00000020
+Const D3DTEXOPCAPS_ADD                       = &H00000040
+Const D3DTEXOPCAPS_ADDSIGNED                 = &H00000080
+Const D3DTEXOPCAPS_ADDSIGNED2X               = &H00000100
+Const D3DTEXOPCAPS_SUBTRACT                  = &H00000200
+Const D3DTEXOPCAPS_ADDSMOOTH                 = &H00000400
+Const D3DTEXOPCAPS_BLENDDIFFUSEALPHA         = &H00000800
+Const D3DTEXOPCAPS_BLENDTEXTUREALPHA         = &H00001000
+Const D3DTEXOPCAPS_BLENDFACTORALPHA          = &H00002000
+Const D3DTEXOPCAPS_BLENDTEXTUREALPHAPM       = &H00004000
+Const D3DTEXOPCAPS_BLENDCURRENTALPHA         = &H00008000
+Const D3DTEXOPCAPS_PREMODULATE               = &H00010000
+Const D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR    = &H00020000
+Const D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA    = &H00040000
+Const D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR = &H00080000
+Const D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA = &H00100000
+Const D3DTEXOPCAPS_BUMPENVMAP                = &H00200000
+Const D3DTEXOPCAPS_BUMPENVMAPLUMINANCE       = &H00400000
+Const D3DTEXOPCAPS_DOTPRODUCT3               = &H00800000
+Const D3DTEXOPCAPS_MULTIPLYADD               = &H01000000
+Const D3DTEXOPCAPS_LERP                      = &H02000000
+
+' FVFCaps
+Const D3DFVFCAPS_TEXCOORDCOUNTMASK  = &H0000ffff   'mask for texture coordinate count field
+Const D3DFVFCAPS_DONOTSTRIPELEMENTS = &H00080000   'Device prefers that vertex elements not be stripped
+Const D3DFVFCAPS_PSIZE              = &H00100000   'Device can receive point size
+
+' VertexProcessingCaps
+Const D3DVTXPCAPS_TEXGEN                   = &H00000001   'device can do texgen
+Const D3DVTXPCAPS_MATERIALSOURCE7          = &H00000002   'device can do DX7-level colormaterialsource ops
+Const D3DVTXPCAPS_DIRECTIONALLIGHTS        = &H00000008   'device can do directional lights
+Const D3DVTXPCAPS_POSITIONALLIGHTS         = &H00000010   'device can do positional lights (includes point and spot)
+Const D3DVTXPCAPS_LOCALVIEWER              = &H00000020   'device can do local viewer
+Const D3DVTXPCAPS_TWEENING                 = &H00000040   'device can do vertex tweening
+Const D3DVTXPCAPS_TEXGEN_SPHEREMAP         = &H00000100   'device supports D3DTSS_TCI_SPHEREMAP
+Const D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER = &H00000200   'device does not support TexGen in non-local viewer mode
+
+' DevCaps2
+Const D3DDEVCAPS2_STREAMOFFSET                       = &H00000001   'Device supports offsets in streams. Must be set by DX9 drivers
+Const D3DDEVCAPS2_DMAPNPATCH                         = &H00000002   'Device supports displacement maps for N-Patches
+Const D3DDEVCAPS2_ADAPTIVETESSRTPATCH                = &H00000004   'Device supports adaptive tesselation of RT-patches
+Const D3DDEVCAPS2_ADAPTIVETESSNPATCH                 = &H00000008   'Device supports adaptive tesselation of N-patches
+Const D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES      = &H00000010   'Device supports StretchRect calls with a texture as the source
+Const D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH               = &H00000020   'Device supports presampled displacement maps for N-Patches
+Const D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET = &H00000040   'Vertex elements in a vertex declaration can share the same stream offset
+
+' DeclTypes
+Const D3DDTCAPS_UBYTE4    = &H00000001
+Const D3DDTCAPS_UBYTE4N   = &H00000002
+Const D3DDTCAPS_SHORT2N   = &H00000004
+Const D3DDTCAPS_SHORT4N   = &H00000008
+Const D3DDTCAPS_USHORT2N  = &H00000010
+Const D3DDTCAPS_USHORT4N  = &H00000020
+Const D3DDTCAPS_UDEC3     = &H00000040
+Const D3DDTCAPS_DEC3N     = &H00000080
+Const D3DDTCAPS_FLOAT16_2 = &H00000100
+Const D3DDTCAPS_FLOAT16_4 = &H00000200
Index: /trunk/ab5.0/ablib/src/directx9/d3d9types.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/d3d9types.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/d3d9types.sbp	(revision 506)
@@ -0,0 +1,1200 @@
+' d3d9types.sbp
+
+Const D3DCOLOR_ARGB(a,r,g,b) = ((a and &HFF)<<24) or ((r and &HFF)<<16) or ((g and &HFF)<<8) or (b and &HFF)
+Const D3DCOLOR_RGBA(r,g,b,a) = D3DCOLOR_ARGB(a,r,g,b)
+Const D3DCOLOR_XRGB(r,g,b) = D3DCOLOR_ARGB(&HFF,r,g,b)
+
+Const D3DCOLOR_COLORVALUE(r,g,b,a) = D3DCOLOR_RGBA(r*255,g*255,b*255,a*255)
+
+
+Type D3DVECTOR
+	x As Single
+	y As Single
+	z As Single
+End Type
+
+Type D3DCOLORVALUE
+	r As Single
+	g As Single
+	b As Single
+	a As Single
+End Type
+
+Type D3DRECT
+	x1 As Long
+	y1 As Long
+	x2 As Long
+	y2 As Long
+End Type
+
+Type D3DMATRIX
+    m[3,3] As Single
+End Type
+
+Type D3DVIEWPORT9
+	X As DWord
+	Y As DWord
+	Width As DWord
+	Height As DWord
+	MinZ As Single
+	MaxZ As Single
+End Type
+
+' Max number of user clipping planes, supported in D3D.
+Const D3DMAXUSERCLIPPLANES = 32
+
+' These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE
+Const D3DCLIPPLANE0 = 1 << 0
+Const D3DCLIPPLANE1 = 1 << 1
+Const D3DCLIPPLANE2 = 1 << 2
+Const D3DCLIPPLANE3 = 1 << 3
+Const D3DCLIPPLANE4 = 1 << 4
+Const D3DCLIPPLANE5 = 1 << 5
+
+Const D3DCS_LEFT   = &H00000001
+Const D3DCS_RIGHT  = &H00000002
+Const D3DCS_TOP    = &H00000004
+Const D3DCS_BOTTOM = &H00000008
+Const D3DCS_FRONT  = &H00000010
+Const D3DCS_BACK   = &H00000020
+Const D3DCS_PLANE0 = &H00000040
+Const D3DCS_PLANE1 = &H00000080
+Const D3DCS_PLANE2 = &H00000100
+Const D3DCS_PLANE3 = &H00000200
+Const D3DCS_PLANE4 = &H00000400
+Const D3DCS_PLANE5 = &H00000800
+Const D3DCS_ALL    = D3DCS_LEFT or D3DCS_RIGHT or D3DCS_TOP or D3DCS_BOTTOM or D3DCS_FRONT or D3DCS_BACK or D3DCS_PLANE0 or D3DCS_PLANE1 or D3DCS_PLANE2 or D3DCS_PLANE3 or D3DCS_PLANE4 or D3DCS_PLANE5
+Type D3DCLIPSTATUS9
+	ClipUnion As DWord
+	ClipIntersection As DWord
+End Type
+
+Type D3DMATERIAL9
+	Diffuse As D3DCOLORVALUE
+	Ambient As D3DCOLORVALUE
+	Specular As D3DCOLORVALUE
+	Emissive As D3DCOLORVALUE
+	Power As Single
+End Type
+
+Const Enum D3DLIGHTTYPE
+    D3DLIGHT_POINT          = 1
+    D3DLIGHT_SPOT           = 2
+    D3DLIGHT_DIRECTIONAL    = 3
+    D3DLIGHT_FORCE_DWORD    = &H7FFFFFFF
+End Enum
+
+Type D3DLIGHT9
+	Type_ As D3DLIGHTTYPE
+	Diffuse As D3DCOLORVALUE
+	Specular As D3DCOLORVALUE
+	Ambient As D3DCOLORVALUE
+	Position As D3DVECTOR
+	Direction As D3DVECTOR
+	Range As Single
+	Falloff As Single
+	Attenuation0 As Single
+	Attenuation1 As Single
+	Attenuation2 As Single
+	Theta As Single
+	Phi As Single
+End Type
+
+
+' Options for clearing
+Const D3DCLEAR_TARGET  = &H00000001  'Clear target surface
+Const D3DCLEAR_ZBUFFER = &H00000002  'Clear target z buffer
+Const D3DCLEAR_STENCIL = &H00000004  'Clear stencil planes
+
+
+' The following defines the rendering states
+Const Enum D3DSHADEMODE
+	D3DSHADE_FLAT        = 1
+	D3DSHADE_GOURAUD     = 2
+	D3DSHADE_PHONG       = 3
+	D3DSHADE_FORCE_DWORD = &H7FFFFFFF
+End Enum
+
+Const Enum D3DFILLMODE
+	D3DFILL_POINT       = 1
+	D3DFILL_WIREFRAME   = 2
+	D3DFILL_SOLID       = 3
+	D3DFILL_FORCE_DWORD = &H7FFFFFFF
+End Enum
+
+Const Enum D3DBLEND
+    D3DBLEND_ZERO               = 1
+    D3DBLEND_ONE                = 2
+    D3DBLEND_SRCCOLOR           = 3
+    D3DBLEND_INVSRCCOLOR        = 4
+    D3DBLEND_SRCALPHA           = 5
+    D3DBLEND_INVSRCALPHA        = 6
+    D3DBLEND_DESTALPHA          = 7
+    D3DBLEND_INVDESTALPHA       = 8
+    D3DBLEND_DESTCOLOR          = 9
+    D3DBLEND_INVDESTCOLOR       = 10
+    D3DBLEND_SRCALPHASAT        = 11
+    D3DBLEND_BOTHSRCALPHA       = 12
+    D3DBLEND_BOTHINVSRCALPHA    = 13
+    D3DBLEND_BLENDFACTOR        = 14   'Only supported if D3DPBLENDCAPS_BLENDFACTOR is on
+    D3DBLEND_INVBLENDFACTOR     = 15   'Only supported if D3DPBLENDCAPS_BLENDFACTOR is on
+
+    D3DBLEND_FORCE_DWORD        = &H7FFFFFFF
+End Enum
+
+Const Enum D3DBLENDOP
+    D3DBLENDOP_ADD              = 1
+    D3DBLENDOP_SUBTRACT         = 2
+    D3DBLENDOP_REVSUBTRACT      = 3
+    D3DBLENDOP_MIN              = 4
+    D3DBLENDOP_MAX              = 5
+    D3DBLENDOP_FORCE_DWORD      = &H7FFFFFFF
+End Enum
+
+Const Enum D3DTEXTUREADDRESS
+    D3DTADDRESS_WRAP            = 1
+    D3DTADDRESS_MIRROR          = 2
+    D3DTADDRESS_CLAMP           = 3
+    D3DTADDRESS_BORDER          = 4
+    D3DTADDRESS_MIRRORONCE      = 5
+    D3DTADDRESS_FORCE_DWORD     = &H7FFFFFFF
+End Enum
+
+Const Enum D3DCULL
+    D3DCULL_NONE                = 1
+    D3DCULL_CW                  = 2
+    D3DCULL_CCW                 = 3
+    D3DCULL_FORCE_DWORD         = &H7FFFFFFF
+End Enum
+
+Const Enum D3DCMPFUNC
+    D3DCMP_NEVER                = 1
+    D3DCMP_LESS                 = 2
+    D3DCMP_EQUAL                = 3
+    D3DCMP_LESSEQUAL            = 4
+    D3DCMP_GREATER              = 5
+    D3DCMP_NOTEQUAL             = 6
+    D3DCMP_GREATEREQUAL         = 7
+    D3DCMP_ALWAYS               = 8
+    D3DCMP_FORCE_DWORD          = &H7FFFFFFF
+End Enum
+
+Const Enum D3DSTENCILOP
+    D3DSTENCILOP_KEEP           = 1
+    D3DSTENCILOP_ZERO           = 2
+    D3DSTENCILOP_REPLACE        = 3
+    D3DSTENCILOP_INCRSAT        = 4
+    D3DSTENCILOP_DECRSAT        = 5
+    D3DSTENCILOP_INVERT         = 6
+    D3DSTENCILOP_INCR           = 7
+    D3DSTENCILOP_DECR           = 8
+    D3DSTENCILOP_FORCE_DWORD    = &H7FFFFFFF
+End Enum
+
+Const Enum D3DFOGMODE
+    D3DFOG_NONE                 = 0
+    D3DFOG_EXP                  = 1
+    D3DFOG_EXP2                 = 2
+    D3DFOG_LINEAR               = 3
+    D3DFOG_FORCE_DWORD          = &H7FFFFFFF
+End Enum
+
+Const Enum D3DZBUFFERTYPE
+    D3DZB_FALSE                 = 0
+    D3DZB_TRUE                  = 1   'Z buffering
+    D3DZB_USEW                  = 2   'W buffering
+    D3DZB_FORCE_DWORD           = &H7FFFFFFF
+End Enum
+
+' Primitives supported by draw-primitive API
+Const Enum D3DPRIMITIVETYPE
+    D3DPT_POINTLIST             = 1
+    D3DPT_LINELIST              = 2
+    D3DPT_LINESTRIP             = 3
+    D3DPT_TRIANGLELIST          = 4
+    D3DPT_TRIANGLESTRIP         = 5
+    D3DPT_TRIANGLEFAN           = 6
+    D3DPT_FORCE_DWORD           = &H7FFFFFFF
+End Enum
+
+
+Const D3DTS_WORLDMATRIX(index) = index + 256
+Const Enum D3DTRANSFORMSTATETYPE
+    D3DTS_VIEW          = 2
+    D3DTS_PROJECTION    = 3
+    D3DTS_TEXTURE0      = 16
+    D3DTS_TEXTURE1      = 17
+    D3DTS_TEXTURE2      = 18
+    D3DTS_TEXTURE3      = 19
+    D3DTS_TEXTURE4      = 20
+    D3DTS_TEXTURE5      = 21
+    D3DTS_TEXTURE6      = 22
+    D3DTS_TEXTURE7      = 23
+	D3DTS_WORLD         = D3DTS_WORLDMATRIX(0)
+	D3DTS_WORLD1        = D3DTS_WORLDMATRIX(1)
+	D3DTS_WORLD2        = D3DTS_WORLDMATRIX(2)
+	D3DTS_WORLD3        = D3DTS_WORLDMATRIX(3)
+    D3DTS_FORCE_DWORD   = &H7FFFFFFF
+End Enum
+
+Const Enum D3DRENDERSTATETYPE
+    D3DRS_ZENABLE                   = 7    'D3DZBUFFERTYPE (or TRUE/FALSE for legacy)
+    D3DRS_FILLMODE                  = 8    'D3DFILLMODE
+    D3DRS_SHADEMODE                 = 9    'D3DSHADEMODE
+    D3DRS_ZWRITEENABLE              = 14   'TRUE to enable z writes
+    D3DRS_ALPHATESTENABLE           = 15   'TRUE to enable alpha tests
+    D3DRS_LASTPIXEL                 = 16   'TRUE for last-pixel on lines
+    D3DRS_SRCBLEND                  = 19   'D3DBLEND
+    D3DRS_DESTBLEND                 = 20   'D3DBLEND
+    D3DRS_CULLMODE                  = 22   'D3DCULL
+    D3DRS_ZFUNC                     = 23   'D3DCMPFUNC
+    D3DRS_ALPHAREF                  = 24   'D3DFIXED
+    D3DRS_ALPHAFUNC                 = 25   'D3DCMPFUNC
+    D3DRS_DITHERENABLE              = 26   'TRUE to enable dithering
+    D3DRS_ALPHABLENDENABLE          = 27   'TRUE to enable alpha blending
+    D3DRS_FOGENABLE                 = 28   'TRUE to enable fog blending
+    D3DRS_SPECULARENABLE            = 29   'TRUE to enable specular
+    D3DRS_FOGCOLOR                  = 34   'D3DCOLOR
+    D3DRS_FOGTABLEMODE              = 35   'D3DFOGMODE
+    D3DRS_FOGSTART                  = 36   'Fog start (for both vertex and pixel fog)
+    D3DRS_FOGEND                    = 37   'Fog end
+    D3DRS_FOGDENSITY                = 38   'Fog density
+    D3DRS_RANGEFOGENABLE            = 48   'Enables range-based fog
+    D3DRS_STENCILENABLE             = 52   'BOOL enable/disable stenciling
+    D3DRS_STENCILFAIL               = 53   'D3DSTENCILOP to do if stencil test fails
+    D3DRS_STENCILZFAIL              = 54   'D3DSTENCILOP to do if stencil test passes and Z test fails
+    D3DRS_STENCILPASS               = 55   'D3DSTENCILOP to do if both stencil and Z tests pass
+    D3DRS_STENCILFUNC               = 56   'D3DCMPFUNC fn.  Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true
+    D3DRS_STENCILREF                = 57   'Reference value used in stencil test
+    D3DRS_STENCILMASK               = 58   'Mask value used in stencil test
+    D3DRS_STENCILWRITEMASK          = 59   'Write mask applied to values written to stencil buffer
+    D3DRS_TEXTUREFACTOR             = 60   'D3DCOLOR used for multi-texture blend
+    D3DRS_WRAP0                     = 128  'wrap for 1st texture coord. set
+    D3DRS_WRAP1                     = 129  'wrap for 2nd texture coord. set
+    D3DRS_WRAP2                     = 130  'wrap for 3rd texture coord. set
+    D3DRS_WRAP3                     = 131  'wrap for 4th texture coord. set
+    D3DRS_WRAP4                     = 132  'wrap for 5th texture coord. set
+    D3DRS_WRAP5                     = 133  'wrap for 6th texture coord. set
+    D3DRS_WRAP6                     = 134  'wrap for 7th texture coord. set
+    D3DRS_WRAP7                     = 135  'wrap for 8th texture coord. set
+    D3DRS_CLIPPING                  = 136
+    D3DRS_LIGHTING                  = 137
+    D3DRS_AMBIENT                   = 139
+    D3DRS_FOGVERTEXMODE             = 140
+    D3DRS_COLORVERTEX               = 141
+    D3DRS_LOCALVIEWER               = 142
+    D3DRS_NORMALIZENORMALS          = 143
+    D3DRS_DIFFUSEMATERIALSOURCE     = 145
+    D3DRS_SPECULARMATERIALSOURCE    = 146
+    D3DRS_AMBIENTMATERIALSOURCE     = 147
+    D3DRS_EMISSIVEMATERIALSOURCE    = 148
+    D3DRS_VERTEXBLEND               = 151
+    D3DRS_CLIPPLANEENABLE           = 152
+    D3DRS_POINTSIZE                 = 154  'float point size
+    D3DRS_POINTSIZE_MIN             = 155  'float point size min threshold
+    D3DRS_POINTSPRITEENABLE         = 156  'BOOL point texture coord control
+    D3DRS_POINTSCALEENABLE          = 157  'BOOL point size scale enable
+    D3DRS_POINTSCALE_A              = 158  'float point attenuation A value
+    D3DRS_POINTSCALE_B              = 159  'float point attenuation B value
+    D3DRS_POINTSCALE_C              = 160  'float point attenuation C value
+    D3DRS_MULTISAMPLEANTIALIAS      = 161  ' BOOL - set to do FSAA with multisample buffer
+    D3DRS_MULTISAMPLEMASK           = 162  ' DWORD - per-sample enable/disable
+    D3DRS_PATCHEDGESTYLE            = 163  ' Sets whether patch edges will use float style tessellation
+    D3DRS_DEBUGMONITORTOKEN         = 165  ' DEBUG ONLY - token to debug monitor
+    D3DRS_POINTSIZE_MAX             = 166  'float point size max threshold
+    D3DRS_INDEXEDVERTEXBLENDENABLE  = 167
+    D3DRS_COLORWRITEENABLE          = 168  ' per-channel write enable
+    D3DRS_TWEENFACTOR               = 170  ' float tween factor
+    D3DRS_BLENDOP                   = 171  ' D3DBLENDOP setting
+    D3DRS_POSITIONDEGREE            = 172  ' NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default)
+    D3DRS_NORMALDEGREE              = 173  ' NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC
+    D3DRS_SCISSORTESTENABLE         = 174
+    D3DRS_SLOPESCALEDEPTHBIAS       = 175
+    D3DRS_ANTIALIASEDLINEENABLE     = 176
+    D3DRS_MINTESSELLATIONLEVEL      = 178
+    D3DRS_MAXTESSELLATIONLEVEL      = 179
+    D3DRS_ADAPTIVETESS_X            = 180
+    D3DRS_ADAPTIVETESS_Y            = 181
+    D3DRS_ADAPTIVETESS_Z            = 182
+    D3DRS_ADAPTIVETESS_W            = 183
+    D3DRS_ENABLEADAPTIVETESSELLATION = 184
+    D3DRS_TWOSIDEDSTENCILMODE       = 185   'BOOL enable/disable 2 sided stenciling
+    D3DRS_CCW_STENCILFAIL           = 186   'D3DSTENCILOP to do if ccw stencil test fails
+    D3DRS_CCW_STENCILZFAIL          = 187   'D3DSTENCILOP to do if ccw stencil test passes and Z test fails
+    D3DRS_CCW_STENCILPASS           = 188   'D3DSTENCILOP to do if both ccw stencil and Z tests pass
+    D3DRS_CCW_STENCILFUNC           = 189   'D3DCMPFUNC fn.  ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true
+    D3DRS_COLORWRITEENABLE1         = 190   'Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS
+    D3DRS_COLORWRITEENABLE2         = 191   'Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS
+    D3DRS_COLORWRITEENABLE3         = 192   'Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS
+    D3DRS_BLENDFACTOR               = 193   'D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR
+    D3DRS_SRGBWRITEENABLE           = 194   'Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE)
+    D3DRS_DEPTHBIAS                 = 195
+    D3DRS_WRAP8                     = 198   'Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD
+    D3DRS_WRAP9                     = 199
+    D3DRS_WRAP10                    = 200
+    D3DRS_WRAP11                    = 201
+    D3DRS_WRAP12                    = 202
+    D3DRS_WRAP13                    = 203
+    D3DRS_WRAP14                    = 204
+    D3DRS_WRAP15                    = 205
+    D3DRS_SEPARATEALPHABLENDENABLE  = 206  'TRUE to enable a separate blending function for the alpha channel
+    D3DRS_SRCBLENDALPHA             = 207  'SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE
+    D3DRS_DESTBLENDALPHA            = 208  'DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE
+    D3DRS_BLENDOPALPHA              = 209  'Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE
+    D3DRS_FORCE_DWORD               = &H7FFFFFFF
+End Enum
+
+' Values for material source
+Const Enum D3DMATERIALCOLORSOURCE
+    D3DMCS_MATERIAL         = 0            'Color from material is used
+    D3DMCS_COLOR1           = 1            'Diffuse vertex color is used
+    D3DMCS_COLOR2           = 2            'Specular vertex color is used
+    D3DMCS_FORCE_DWORD      = &H7FFFFFFF
+End Enum
+
+' Bias to apply to the texture coordinate set to apply a wrap to.
+Const D3DRENDERSTATE_WRAPBIAS = 128
+
+' Flags to construct the WRAP render states
+Const D3DWRAP_U = &H00000001
+Const D3DWRAP_V = &H00000002
+Const D3DWRAP_W = &H00000004
+
+' Flags to construct the WRAP render states for 1D thru 4D texture coordinates
+Const D3DWRAPCOORD_0 = &H00000001   'same as D3DWRAP_U
+Const D3DWRAPCOORD_1 = &H00000002   'same as D3DWRAP_V
+Const D3DWRAPCOORD_2 = &H00000004   'same as D3DWRAP_W
+Const D3DWRAPCOORD_3 = &H00000008
+
+' Flags to construct D3DRS_COLORWRITEENABLE
+Const D3DCOLORWRITEENABLE_RED   = 1<<0
+Const D3DCOLORWRITEENABLE_GREEN = 1<<1
+Const D3DCOLORWRITEENABLE_BLUE  = 1<<2
+Const D3DCOLORWRITEENABLE_ALPHA = 1<<3
+
+
+' State enumerants for per-stage processing of fixed function pixel processing
+' Two of these affect fixed function vertex processing as well: TEXTURETRANSFORMFLAGS and TEXCOORDINDEX.
+Const Enum D3DTEXTURESTAGESTATETYPE
+    D3DTSS_COLOROP        =  1          'D3DTEXTUREOP - per-stage blending controls for color channels
+    D3DTSS_COLORARG1      =  2          'D3DTA_* (texture arg)
+    D3DTSS_COLORARG2      =  3          'D3DTA_* (texture arg)
+    D3DTSS_ALPHAOP        =  4          'D3DTEXTUREOP - per-stage blending controls for alpha channel
+    D3DTSS_ALPHAARG1      =  5          'D3DTA_* (texture arg)
+    D3DTSS_ALPHAARG2      =  6          'D3DTA_* (texture arg)
+    D3DTSS_BUMPENVMAT00   =  7          'float (bump mapping matrix)
+    D3DTSS_BUMPENVMAT01   =  8          'float (bump mapping matrix)
+    D3DTSS_BUMPENVMAT10   =  9          'float (bump mapping matrix)
+    D3DTSS_BUMPENVMAT11   = 10          'float (bump mapping matrix)
+    D3DTSS_TEXCOORDINDEX  = 11          'identifies which set of texture coordinates index this texture
+    D3DTSS_BUMPENVLSCALE  = 22          'float scale for bump map luminance
+    D3DTSS_BUMPENVLOFFSET = 23          'float offset for bump map luminance
+    D3DTSS_TEXTURETRANSFORMFLAGS = 24   'D3DTEXTURETRANSFORMFLAGS controls texture transform
+    D3DTSS_COLORARG0      = 26          'D3DTA_* third arg for triadic ops
+    D3DTSS_ALPHAARG0      = 27          'D3DTA_* third arg for triadic ops
+    D3DTSS_RESULTARG      = 28          'D3DTA_* arg for result (CURRENT or TEMP)
+    D3DTSS_CONSTANT       = 32          'Per-stage constant D3DTA_CONSTANT
+
+    D3DTSS_FORCE_DWORD   = &H7FFFFFFF
+End Enum
+
+
+' State enumerants for per-sampler texture processing.
+Const Enum D3DSAMPLERSTATETYPE
+    D3DSAMP_ADDRESSU       = 1    'D3DTEXTUREADDRESS for U coordinate
+    D3DSAMP_ADDRESSV       = 2    'D3DTEXTUREADDRESS for V coordinate
+    D3DSAMP_ADDRESSW       = 3    'D3DTEXTUREADDRESS for W coordinate
+    D3DSAMP_BORDERCOLOR    = 4    'D3DCOLOR
+    D3DSAMP_MAGFILTER      = 5    'D3DTEXTUREFILTER filter to use for magnification
+    D3DSAMP_MINFILTER      = 6    'D3DTEXTUREFILTER filter to use for minification
+    D3DSAMP_MIPFILTER      = 7    'D3DTEXTUREFILTER filter to use between mipmaps during minification
+    D3DSAMP_MIPMAPLODBIAS  = 8    'float Mipmap LOD bias
+    D3DSAMP_MAXMIPLEVEL    = 9    'DWORD 0..(n-1) LOD index of largest map to use (0 == largest)
+    D3DSAMP_MAXANISOTROPY  = 10   'DWORD maximum anisotropy
+    D3DSAMP_SRGBTEXTURE    = 11   'Default = 0 (which means Gamma 1.0,
+                                  ' no correction required.) else correct for
+                                  ' Gamma = 2.2
+    D3DSAMP_ELEMENTINDEX   = 12   'When multi-element texture is assigned to sampler, this
+                                  ' indicates which element index to use.  Default = 0.
+    D3DSAMP_DMAPOFFSET     = 13   'Offset in vertices in the pre-sampled displacement map.
+                                  ' Only valid for D3DDMAPSAMPLER sampler
+
+    D3DSAMP_FORCE_DWORD    = &H7FFFFFFF
+End Enum
+
+' Special sampler which is used in the tesselator
+Const D3DDMAPSAMPLER = 256
+
+' Samplers used in vertex shaders
+Const D3DVERTEXTEXTURESAMPLER0 = D3DDMAPSAMPLER+1
+Const D3DVERTEXTEXTURESAMPLER1 = D3DDMAPSAMPLER+2
+Const D3DVERTEXTEXTURESAMPLER2 = D3DDMAPSAMPLER+3
+Const D3DVERTEXTEXTURESAMPLER3 = D3DDMAPSAMPLER+4
+
+' Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position
+' and normal in the camera space) should be taken as texture coordinates
+' Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from
+Const D3DTSS_TCI_PASSTHRU                    = &H00000000
+Const D3DTSS_TCI_CAMERASPACENORMAL           = &H00010000
+Const D3DTSS_TCI_CAMERASPACEPOSITION         = &H00020000
+Const D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR = &H00030000
+Const D3DTSS_TCI_SPHEREMAP                   = &H00040000
+
+
+' Enumerations for COLOROP and ALPHAOP texture blending operations set in
+' texture processing stage controls in D3DTSS.
+Const Enum D3DTEXTUREOP
+    'Control
+    D3DTOP_DISABLE              = 1      'disables stage
+    D3DTOP_SELECTARG1           = 2      'the default
+    D3DTOP_SELECTARG2           = 3
+
+    'Modulate
+    D3DTOP_MODULATE             = 4      'multiply args together
+    D3DTOP_MODULATE2X           = 5      'multiply and  1 bit
+    D3DTOP_MODULATE4X           = 6      'multiply and  2 bits
+
+    'Add
+    D3DTOP_ADD                  =  7   'add arguments together
+    D3DTOP_ADDSIGNED            =  8   'add with -0.5 bias
+    D3DTOP_ADDSIGNED2X          =  9   'as above but left  1 bit
+    D3DTOP_SUBTRACT             = 10   'Arg1 - Arg2, with no saturation
+    D3DTOP_ADDSMOOTH            = 11   'add 2 args, subtract product
+                                        'Arg1 + Arg2 - Arg1*Arg2
+                                        '= Arg1 + (1-Arg1)*Arg2
+
+    'Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha)
+    D3DTOP_BLENDDIFFUSEALPHA    = 12 'iterated alpha
+    D3DTOP_BLENDTEXTUREALPHA    = 13 'texture alpha
+    D3DTOP_BLENDFACTORALPHA     = 14 'alpha from D3DRS_TEXTUREFACTOR
+
+    'Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha)
+    D3DTOP_BLENDTEXTUREALPHAPM  = 15 'texture alpha
+    D3DTOP_BLENDCURRENTALPHA    = 16 'by alpha of current color
+
+    'Specular mapping
+    D3DTOP_PREMODULATE            = 17     'modulate with next texture before use
+    D3DTOP_MODULATEALPHA_ADDCOLOR = 18     'Arg1.RGB + Arg1.A*Arg2.RGB
+                                            'COLOROP only
+    D3DTOP_MODULATECOLOR_ADDALPHA = 19     'Arg1.RGB*Arg2.RGB + Arg1.A
+                                            'COLOROP only
+    D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20  '(1-Arg1.A)*Arg2.RGB + Arg1.RGB
+                                            'COLOROP only
+    D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21  '(1-Arg1.RGB)*Arg2.RGB + Arg1.A
+                                            'COLOROP only
+
+    'Bump mapping
+    D3DTOP_BUMPENVMAP           = 22 'per pixel env map perturbation
+    D3DTOP_BUMPENVMAPLUMINANCE  = 23 'with luminance channel
+
+    'This can do either diffuse or specular bump mapping with correct input.
+    'Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B)
+    'where each component has been scaled and offset to make it signed.
+    'The result is replicated into all four (including alpha) channels.
+    'This is a valid COLOROP only.
+    D3DTOP_DOTPRODUCT3          = 24
+
+    'Triadic ops
+    D3DTOP_MULTIPLYADD          = 25 'Arg0 + Arg1*Arg2
+    D3DTOP_LERP                 = 26 '(Arg0)*Arg1 + (1-Arg0)*Arg2
+
+    D3DTOP_FORCE_DWORD = &H7FFFFFFF
+End Enum
+
+
+' Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending
+' operations set in texture processing stage controls in D3DRENDERSTATE.
+Const D3DTA_SELECTMASK     = &H0000000f  'mask for arg selector
+Const D3DTA_DIFFUSE        = &H00000000  'select diffuse color (read only)
+Const D3DTA_CURRENT        = &H00000001  'select stage destination register (read/write)
+Const D3DTA_TEXTURE        = &H00000002  'select texture color (read only)
+Const D3DTA_TFACTOR        = &H00000003  'select D3DRS_TEXTUREFACTOR (read only)
+Const D3DTA_SPECULAR       = &H00000004  'select specular color (read only)
+Const D3DTA_TEMP           = &H00000005  'select temporary register color (read/write)
+Const D3DTA_CONSTANT       = &H00000006  'select texture stage constant
+Const D3DTA_COMPLEMENT     = &H00000010  'take 1.0 - x (read modifier)
+Const D3DTA_ALPHAREPLICATE = &H00000020  'replicate alpha to color components (read modifier)
+
+
+' Values for D3DSAMP_***FILTER texture stage states
+Const Enum D3DTEXTUREFILTERTYPE
+    D3DTEXF_NONE            = 0    ' filtering disabled (valid for mip filter only)
+    D3DTEXF_POINT           = 1    ' nearest
+    D3DTEXF_LINEAR          = 2    ' linear interpolation
+    D3DTEXF_ANISOTROPIC     = 3    ' anisotropic
+    D3DTEXF_PYRAMIDALQUAD   = 6    ' 4-sample tent
+    D3DTEXF_GAUSSIANQUAD    = 7    ' 4-sample gaussian
+    D3DTEXF_FORCE_DWORD     = &H7FFFFFFF   ' force 32-bit size enum
+End Enum
+
+' Bits for Flags in ProcessVertices call
+Const D3DPV_DONOTCOPYDATA = 1<<0
+
+
+'Flexible vertex format bits
+Const D3DFVF_RESERVED0        = &H001
+Const D3DFVF_POSITION_MASK    = &H400E
+Const D3DFVF_XYZ              = &H002
+Const D3DFVF_XYZRHW           = &H004
+Const D3DFVF_XYZB1            = &H006
+Const D3DFVF_XYZB2            = &H008
+Const D3DFVF_XYZB3            = &H00a
+Const D3DFVF_XYZB4            = &H00c
+Const D3DFVF_XYZB5            = &H00e
+Const D3DFVF_XYZW             = &H4002
+
+Const D3DFVF_NORMAL           = &H010
+Const D3DFVF_PSIZE            = &H020
+Const D3DFVF_DIFFUSE          = &H040
+Const D3DFVF_SPECULAR         = &H080
+
+Const D3DFVF_TEXCOUNT_MASK    = &Hf00
+Const D3DFVF_TEXCOUNT_SHIFT   = &H8
+Const D3DFVF_TEX0             = &H000
+Const D3DFVF_TEX1             = &H100
+Const D3DFVF_TEX2             = &H200
+Const D3DFVF_TEX3             = &H300
+Const D3DFVF_TEX4             = &H400
+Const D3DFVF_TEX5             = &H500
+Const D3DFVF_TEX6             = &H600
+Const D3DFVF_TEX7             = &H700
+Const D3DFVF_TEX8             = &H800
+
+Const D3DFVF_LASTBETA_UBYTE4   = &H1000
+Const D3DFVF_LASTBETA_D3DCOLOR = &H8000
+
+Const D3DFVF_RESERVED2         = &H6000  '2 reserved bits
+
+
+' Vertex element semantics
+Const Enum D3DDECLUSAGE
+    D3DDECLUSAGE_POSITION     = 0
+    D3DDECLUSAGE_BLENDWEIGHT  = 1
+    D3DDECLUSAGE_BLENDINDICES = 2
+    D3DDECLUSAGE_NORMAL       = 3
+    D3DDECLUSAGE_PSIZE        = 4
+    D3DDECLUSAGE_TEXCOORD     = 5
+    D3DDECLUSAGE_TANGENT      = 6
+    D3DDECLUSAGE_BINORMAL     = 7
+    D3DDECLUSAGE_TESSFACTOR   = 8
+    D3DDECLUSAGE_POSITIONT    = 9
+    D3DDECLUSAGE_COLOR        = 10
+    D3DDECLUSAGE_FOG          = 11
+    D3DDECLUSAGE_DEPTH        = 12
+    D3DDECLUSAGE_SAMPLE       = 13
+End Enum
+
+Const Enum D3DDECLMETHOD
+    D3DDECLMETHOD_DEFAULT          = 0
+    D3DDECLMETHOD_PARTIALU         = 1
+    D3DDECLMETHOD_PARTIALV         = 2
+    D3DDECLMETHOD_CROSSUV          = 3   'Normal
+    D3DDECLMETHOD_UV               = 4
+    D3DDECLMETHOD_LOOKUP           = 5   'Lookup a displacement map
+    D3DDECLMETHOD_LOOKUPPRESAMPLED = 6   'Lookup a pre-sampled displacement map
+End Enum
+
+' Declarations for _Type fields
+Const Enum D3DDECLTYPE
+    D3DDECLTYPE_FLOAT1    =  0  '1D float expanded to (value, 0., 0., 1.)
+    D3DDECLTYPE_FLOAT2    =  1  '2D float expanded to (value, value, 0., 1.)
+    D3DDECLTYPE_FLOAT3    =  2  '3D float expanded to (value, value, value, 1.)
+    D3DDECLTYPE_FLOAT4    =  3  '4D float
+    D3DDECLTYPE_D3DCOLOR  =  4  '4D packed unsigned bytes mapped to 0. to 1. range
+                                'Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A)
+    D3DDECLTYPE_UBYTE4    =  5  '4D unsigned byte
+    D3DDECLTYPE_SHORT2    =  6  '2D signed short expanded to (value, value, 0., 1.)
+    D3DDECLTYPE_SHORT4    =  7  '4D signed short
+
+'The following types are valid only with vertex shaders >= 2.0
+    D3DDECLTYPE_UBYTE4N   =  8  'Each of 4 bytes is normalized by dividing to 255.0
+    D3DDECLTYPE_SHORT2N   =  9  '2D signed short normalized (v[0]/32767.0,v[1]/32767.0,0,1)
+    D3DDECLTYPE_SHORT4N   = 10  '4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0)
+    D3DDECLTYPE_USHORT2N  = 11  '2D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,0,1)
+    D3DDECLTYPE_USHORT4N  = 12  '4D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,v[2]/65535.0,v[3]/65535.0)
+    D3DDECLTYPE_UDEC3     = 13  '3D unsigned 10 10 10 format expanded to (value, value, value, 1)
+    D3DDECLTYPE_DEC3N     = 14  '3D signed 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1)
+    D3DDECLTYPE_FLOAT16_2 = 15  'Two 16-bit floating point values, expanded to (value, value, 0, 1)
+    D3DDECLTYPE_FLOAT16_4 = 16  'Four 16-bit floating point values
+    D3DDECLTYPE_UNUSED    = 17  'When the type field in a decl is unused.
+End Enum
+
+Type D3DVERTEXELEMENT9
+	Stream As Word
+	Offset As Word
+	byType As Byte
+	Method As Byte
+	Usage As Byte
+	UsageIndex As Byte
+End Type
+
+' Maximum supported number of texture coordinate sets
+Const D3DDP_MAXTEXCOORD = 8
+
+
+' Values for IDirect3DDevice9::SetStreamSourceFreq's Setting parameter
+Const D3DSTREAMSOURCE_INDEXEDDATA  = 1<<30
+Const D3DSTREAMSOURCE_INSTANCEDATA = 2<<30
+
+Const D3DSP_TEXTURETYPE_SHIFT = 27
+Const Enum D3DSAMPLER_TEXTURE_TYPE
+    D3DSTT_UNKNOWN = 0<<D3DSP_TEXTURETYPE_SHIFT   'uninitialized value
+    D3DSTT_2D      = 2<<D3DSP_TEXTURETYPE_SHIFT   'dcl_2d s# (for declaring a 2-D texture)
+    D3DSTT_CUBE    = 3<<D3DSP_TEXTURETYPE_SHIFT   'dcl_cube s# (for declaring a cube texture)
+    D3DSTT_VOLUME  = 4<<D3DSP_TEXTURETYPE_SHIFT   'dcl_volume s# (for declaring a volume texture)
+    D3DSTT_FORCE_DWORD  = &H7FFFFFFF
+End Enum
+
+
+' pixel shader version token
+Const D3DPS_VERSION(_Major,_Minor) = &HFFFF0000 or (_Major<<8) or _Minor
+
+' vertex shader version token
+Const D3DVS_VERSION(_Major,_Minor) = &HFFFE0000 or (_Major<<8) or _Minor
+
+
+
+' High order surfaces
+Const Enum D3DBASISTYPE
+   D3DBASIS_BEZIER      = 0
+   D3DBASIS_BSPLINE     = 1
+   D3DBASIS_CATMULL_ROM = 2   ' In D3D8 this used to be D3DBASIS_INTERPOLATE
+   D3DBASIS_FORCE_DWORD = &H7FFFFFFF
+End Enum
+
+Const Enum D3DDEGREETYPE
+   D3DDEGREE_LINEAR      = 1
+   D3DDEGREE_QUADRATIC   = 2
+   D3DDEGREE_CUBIC       = 3
+   D3DDEGREE_QUINTIC     = 5
+   D3DDEGREE_FORCE_DWORD = &H7FFFFFFF
+End Enum
+
+Const Enum D3DPATCHEDGESTYLE
+   D3DPATCHEDGE_DISCRETE    = 0
+   D3DPATCHEDGE_CONTINUOUS  = 1
+   D3DPATCHEDGE_FORCE_DWORD = &H7FFFFFFF
+End Enum
+
+Const Enum D3DSTATEBLOCKTYPE
+    D3DSBT_ALL           = 1   'capture all state
+    D3DSBT_PIXELSTATE    = 2   'capture pixel state
+    D3DSBT_VERTEXSTATE   = 3   'capture vertex state
+    D3DSBT_FORCE_DWORD   = &H7FFFFFFF
+End Enum
+
+' The D3DVERTEXBLENDFLAGS type is used with D3DRS_VERTEXBLEND state.
+Const Enum D3DVERTEXBLENDFLAGS
+    D3DVBF_DISABLE  = 0     'Disable vertex blending
+    D3DVBF_1WEIGHTS = 1     '2 matrix blending
+    D3DVBF_2WEIGHTS = 2     '3 matrix blending
+    D3DVBF_3WEIGHTS = 3     '4 matrix blending
+    D3DVBF_TWEENING = 255   'blending using D3DRS_TWEENFACTOR
+    D3DVBF_0WEIGHTS = 256   'one matrix is used with weight 1.0
+    D3DVBF_FORCE_DWORD = &H7FFFFFFF
+End Enum
+
+Const Enum D3DTEXTURETRANSFORMFLAGS
+    D3DTTFF_DISABLE         = 0    'texture coordinates are passed directly
+    D3DTTFF_COUNT1          = 1    'rasterizer should expect 1-D texture coords
+    D3DTTFF_COUNT2          = 2    'rasterizer should expect 2-D texture coords
+    D3DTTFF_COUNT3          = 3    'rasterizer should expect 3-D texture coords
+    D3DTTFF_COUNT4          = 4    'rasterizer should expect 4-D texture coords
+    D3DTTFF_PROJECTED       = 256  'texcoords to be divided by COUNTth element
+    D3DTTFF_FORCE_DWORD     = &H7FFFFFFF
+End Enum
+
+' Macros to set texture coordinate format bits in the FVF id
+Const D3DFVF_TEXTUREFORMAT2 = 0   'Two floating point values
+Const D3DFVF_TEXTUREFORMAT1 = 3   'One floating point value
+Const D3DFVF_TEXTUREFORMAT3 = 1   'Three floating point values
+Const D3DFVF_TEXTUREFORMAT4 = 2   'Four floating point values
+
+Const D3DFVF_TEXCOORDSIZE3(CoordIndex) = D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16)
+Const D3DFVF_TEXCOORDSIZE2(CoordIndex) = D3DFVF_TEXTUREFORMAT2
+Const D3DFVF_TEXCOORDSIZE4(CoordIndex) = D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16)
+Const D3DFVF_TEXCOORDSIZE1(CoordIndex) = D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16)
+
+
+' Direct3D9 Device types
+Const Enum D3DDEVTYPE
+    D3DDEVTYPE_HAL         = 1
+    D3DDEVTYPE_REF         = 2
+    D3DDEVTYPE_SW          = 3
+
+    D3DDEVTYPE_NULLREF     = 4
+
+    D3DDEVTYPE_FORCE_DWORD  = &H7FFFFFFF
+End Enum
+
+
+' Multi-Sample buffer types
+Const Enum D3DMULTISAMPLE_TYPE
+    D3DMULTISAMPLE_NONE            =  0
+    D3DMULTISAMPLE_NONMASKABLE     =  1
+    D3DMULTISAMPLE_2_SAMPLES       =  2
+    D3DMULTISAMPLE_3_SAMPLES       =  3
+    D3DMULTISAMPLE_4_SAMPLES       =  4
+    D3DMULTISAMPLE_5_SAMPLES       =  5
+    D3DMULTISAMPLE_6_SAMPLES       =  6
+    D3DMULTISAMPLE_7_SAMPLES       =  7
+    D3DMULTISAMPLE_8_SAMPLES       =  8
+    D3DMULTISAMPLE_9_SAMPLES       =  9
+    D3DMULTISAMPLE_10_SAMPLES      = 10
+    D3DMULTISAMPLE_11_SAMPLES      = 11
+    D3DMULTISAMPLE_12_SAMPLES      = 12
+    D3DMULTISAMPLE_13_SAMPLES      = 13
+    D3DMULTISAMPLE_14_SAMPLES      = 14
+    D3DMULTISAMPLE_15_SAMPLES      = 15
+    D3DMULTISAMPLE_16_SAMPLES      = 16
+
+    D3DMULTISAMPLE_FORCE_DWORD     = &H7FFFFFFF
+End Enum
+
+Const Enum D3DFORMAT
+    D3DFMT_UNKNOWN              =  0
+
+    D3DFMT_R8G8B8               = 20
+    D3DFMT_A8R8G8B8             = 21
+    D3DFMT_X8R8G8B8             = 22
+    D3DFMT_R5G6B5               = 23
+    D3DFMT_X1R5G5B5             = 24
+    D3DFMT_A1R5G5B5             = 25
+    D3DFMT_A4R4G4B4             = 26
+    D3DFMT_R3G3B2               = 27
+    D3DFMT_A8                   = 28
+    D3DFMT_A8R3G3B2             = 29
+    D3DFMT_X4R4G4B4             = 30
+    D3DFMT_A2B10G10R10          = 31
+    D3DFMT_A8B8G8R8             = 32
+    D3DFMT_X8B8G8R8             = 33
+    D3DFMT_G16R16               = 34
+    D3DFMT_A2R10G10B10          = 35
+    D3DFMT_A16B16G16R16         = 36
+
+    D3DFMT_A8P8                 = 40
+    D3DFMT_P8                   = 41
+
+    D3DFMT_L8                   = 50
+    D3DFMT_A8L8                 = 51
+    D3DFMT_A4L4                 = 52
+
+    D3DFMT_V8U8                 = 60
+    D3DFMT_L6V5U5               = 61
+    D3DFMT_X8L8V8U8             = 62
+    D3DFMT_Q8W8V8U8             = 63
+    D3DFMT_V16U16               = 64
+    D3DFMT_A2W10V10U10          = 67
+
+    D3DFMT_UYVY                 = &H59565955 'MAKEFOURCC('U', 'Y', 'V', 'Y'),
+    D3DFMT_R8G8_B8G8            = &H47424752 'MAKEFOURCC('R', 'G', 'B', 'G'),
+    D3DFMT_YUY2                 = &H32595559 'MAKEFOURCC('Y', 'U', 'Y', '2'),
+    D3DFMT_G8R8_G8B8            = &H42475247 'MAKEFOURCC('G', 'R', 'G', 'B'),
+    D3DFMT_DXT1                 = &H31545844 'MAKEFOURCC('D', 'X', 'T', '1'),
+    D3DFMT_DXT2                 = &H32545844 'MAKEFOURCC('D', 'X', 'T', '2'),
+    D3DFMT_DXT3                 = &H33545844 'MAKEFOURCC('D', 'X', 'T', '3'),
+    D3DFMT_DXT4                 = &H34545844 'MAKEFOURCC('D', 'X', 'T', '4'),
+    D3DFMT_DXT5                 = &H35545844 'MAKEFOURCC('D', 'X', 'T', '5'),
+
+    D3DFMT_D16_LOCKABLE         = 70
+    D3DFMT_D32                  = 71
+    D3DFMT_D15S1                = 73
+    D3DFMT_D24S8                = 75
+    D3DFMT_D24X8                = 77
+    D3DFMT_D24X4S4              = 79
+    D3DFMT_D16                  = 80
+
+    D3DFMT_D32F_LOCKABLE        = 82
+    D3DFMT_D24FS8               = 83
+
+
+    D3DFMT_L16                  = 81
+
+    D3DFMT_VERTEXDATA           =100
+    D3DFMT_INDEX16              =101
+    D3DFMT_INDEX32              =102
+
+    D3DFMT_Q16W16V16U16         =110
+
+    D3DFMT_MULTI2_ARGB8         = &H3154454D 'MAKEFOURCC('M','E','T','1')
+
+    ' Floating point surface formats
+
+    ' s10e5 formats (16-bits per channel)
+    D3DFMT_R16F                 = 111
+    D3DFMT_G16R16F              = 112
+    D3DFMT_A16B16G16R16F        = 113
+
+    ' IEEE s23e8 formats (32-bits per channel)
+    D3DFMT_R32F                 = 114
+    D3DFMT_G32R32F              = 115
+    D3DFMT_A32B32G32R32F        = 116
+
+    D3DFMT_CxV8U8               = 117
+
+
+    D3DFMT_FORCE_DWORD          = &H7FFFFFFF
+End Enum
+
+Type D3DDISPLAYMODE
+	Width As DWord
+	Height As DWord
+	RefreshRate As DWord
+	Format As D3DFORMAT
+End Type
+
+' Creation Parameters
+Type D3DDEVICE_CREATION_PARAMETERS
+	AdapterOrdinal As DWord
+	DeviceType As DWord
+	hFocusWindow As DWord
+	BehaviorFlags As DWord
+End Type
+
+' SwapEffects
+Const Enum D3DSWAPEFFECT
+    D3DSWAPEFFECT_DISCARD           = 1
+    D3DSWAPEFFECT_FLIP              = 2
+    D3DSWAPEFFECT_COPY              = 3
+
+    D3DSWAPEFFECT_FORCE_DWORD       = &H7FFFFFFF
+End Enum
+
+' Pool types
+Const Enum D3DPOOL
+    D3DPOOL_DEFAULT                 = 0
+    D3DPOOL_MANAGED                 = 1
+    D3DPOOL_SYSTEMMEM               = 2
+    D3DPOOL_SCRATCH                 = 3
+
+    D3DPOOL_FORCE_DWORD             = &H7FFFFFFF
+End Enum
+
+'RefreshRate pre-defines
+Const D3DPRESENT_RATE_DEFAULT = &H00000000
+
+' Resize Optional Parameters
+Type D3DPRESENT_PARAMETERS
+	BackBufferWidth As DWord
+	BackBufferHeight As DWord
+	BackBufferFormat As D3DFORMAT
+	BackBufferCount As DWord
+
+	MultiSampleType As D3DMULTISAMPLE_TYPE
+	MultiSampleQuality As DWord
+
+	SwapEffect As D3DSWAPEFFECT
+	hDeviceWindow As HWND
+	Windowed As Long
+	EnableAutoDepthStencil As Long
+	AutoDepthStencilFormat As D3DFORMAT
+	Flags As DWord
+
+	'FullScreen_RefreshRateInHz must be zero for Windowed mode
+	FullScreen_RefreshRateInHz As DWord
+	PresentationInterval As DWord
+End Type
+
+' Values for D3DPRESENT_PARAMETERS.Flags
+Const D3DPRESENTFLAG_LOCKABLE_BACKBUFFER  = &H00000001
+Const D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL = &H00000002
+Const D3DPRESENTFLAG_DEVICECLIP           = &H00000004
+Const D3DPRESENTFLAG_VIDEO                = &H00000010
+
+' Gamma Ramp: Same as DX7
+Type D3DGAMMARAMP
+	red[255] As Word
+	green[255] As Word
+	blue[255] As Word
+End Type
+
+' Back buffer types
+Const Enum D3DBACKBUFFER_TYPE
+    D3DBACKBUFFER_TYPE_MONO         = 0
+    D3DBACKBUFFER_TYPE_LEFT         = 1
+    D3DBACKBUFFER_TYPE_RIGHT        = 2
+
+    D3DBACKBUFFER_TYPE_FORCE_DWORD  = &H7FFFFFFF
+End Enum
+
+Const Enum D3DRESOURCETYPE
+    D3DRTYPE_SURFACE                =  1
+    D3DRTYPE_VOLUME                 =  2
+    D3DRTYPE_TEXTURE                =  3
+    D3DRTYPE_VOLUMETEXTURE          =  4
+    D3DRTYPE_CUBETEXTURE            =  5
+    D3DRTYPE_VERTEXBUFFER           =  6
+    D3DRTYPE_INDEXBUFFER            =  7
+
+    D3DRTYPE_FORCE_DWORD            = &H7FFFFFFF
+End Enum
+
+' Usages
+Const D3DUSAGE_RENDERTARGET = &H00000001
+Const D3DUSAGE_DEPTHSTENCIL = &H00000002
+Const D3DUSAGE_DYNAMIC      = &H00000200
+
+' When passed to CheckDeviceFormat, D3DUSAGE_AUTOGENMIPMAP may return
+' D3DOK_NOAUTOGEN if the device doesn't support autogeneration for that format.
+' D3DOK_NOAUTOGEN is a success code, not a failure code... the SUCCEEDED and FAILED macros
+' will return true and false respectively for this code.
+Const D3DUSAGE_AUTOGENMIPMAP = &H00000400
+Const D3DUSAGE_DMAP          = &H00004000
+
+' The following usages are valid only for querying CheckDeviceFormat
+Const D3DUSAGE_QUERY_LEGACYBUMPMAP            = &H00008000
+Const D3DUSAGE_QUERY_SRGBREAD                 = &H00010000
+Const D3DUSAGE_QUERY_FILTER                   = &H00020000
+Const D3DUSAGE_QUERY_SRGBWRITE                = &H00040000
+Const D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING = &H00080000
+Const D3DUSAGE_QUERY_VERTEXTEXTURE            = &H00100000
+Const D3DUSAGE_QUERY_WRAPANDMIP	              = &H00200000
+
+' Usages for Vertex/Index buffers
+Const D3DUSAGE_WRITEONLY          = &H00000008
+Const D3DUSAGE_SOFTWAREPROCESSING = &H00000010
+Const D3DUSAGE_DONOTCLIP          = &H00000020
+Const D3DUSAGE_POINTS             = &H00000040
+Const D3DUSAGE_RTPATCHES          = &H00000080
+Const D3DUSAGE_NPATCHES           = &H00000100
+
+
+
+' CubeMap Face identifiers
+Const Enum D3DCUBEMAP_FACES
+    D3DCUBEMAP_FACE_POSITIVE_X     = 0
+    D3DCUBEMAP_FACE_NEGATIVE_X     = 1
+    D3DCUBEMAP_FACE_POSITIVE_Y     = 2
+    D3DCUBEMAP_FACE_NEGATIVE_Y     = 3
+    D3DCUBEMAP_FACE_POSITIVE_Z     = 4
+    D3DCUBEMAP_FACE_NEGATIVE_Z     = 5
+
+    D3DCUBEMAP_FACE_FORCE_DWORD    = &H7FFFFFFF
+End Enum
+
+' Lock flags
+Const D3DLOCK_READONLY        = &H00000010
+Const D3DLOCK_DISCARD         = &H00002000
+Const D3DLOCK_NOOVERWRITE     = &H00001000
+Const D3DLOCK_NOSYSLOCK       = &H00000800
+Const D3DLOCK_DONOTWAIT       = &H00004000
+Const D3DLOCK_NO_DIRTY_UPDATE = &H00008000
+
+
+
+' Vertex Buffer Description
+Type D3DVERTEXBUFFER_DESC
+	Format As D3DFORMAT
+	SourceType As D3DRESOURCETYPE
+	Usage As DWord
+	Pool As D3DPOOL
+	Size As DWord
+
+	FVF As DWord
+End Type
+
+' Index Buffer Description
+Type D3DINDEXBUFFER_DESC
+	Format As D3DFORMAT
+	SourceType As D3DRESOURCETYPE
+	Usage As DWord
+	Pool As D3DPOOL
+	Size As DWord
+End Type
+
+
+' Surface Description
+Type D3DSURFACE_DESC
+	Format As D3DFORMAT
+	SourceType As D3DRESOURCETYPE
+	Usage As DWord
+	Pool As D3DPOOL
+	MultiSampleType As D3DMULTISAMPLE_TYPE
+	MultiSampleQuality As DWord
+	Width As DWord
+	Height As DWord
+End Type
+
+
+Type D3DVOLUME_DESC
+	Format As D3DFORMAT
+	SourceType As D3DRESOURCETYPE
+	Usage As DWord
+	Pool As D3DPOOL
+	Width As DWord
+	Height As DWord
+	Depth As DWord
+End Type
+
+' Structure for LockRect
+Type D3DLOCKED_RECT
+	Pitch As Long
+	pBits As VoidPtr
+End Type
+
+'Structures for LockBox
+Type D3DBOX
+	Left As DWord
+	Top As DWord
+	Right As DWord
+	Bottom As DWord
+	Front As DWord
+	Back As DWord
+End Type
+
+Type D3DLOCKED_BOX
+	RowPitch As Long
+	SlicePitch As Long
+	pBits As VoidPtr
+End Type
+
+' Structures for LockRange
+Type D3DRANGE
+	Offset As DWord
+	Size As DWord
+End Type
+
+' Structures for high order primitives
+Type D3DRECTPATCH_INFO
+	StartVertexOffsetWidth As DWord
+	StartVertexOffsetHeight As DWord
+	Width As DWord
+	Height As DWord
+	Stride As DWord
+	Basis As D3DBASISTYPE
+	Degree As D3DDEGREETYPE
+End Type
+Type D3DTRIPATCH_INFO
+	StartVertexOffset As DWord
+	NumVertices As DWord
+	Basis As D3DBASISTYPE
+	Degree As D3DDEGREETYPE
+End Type
+
+
+' Adapter Identifier
+Const MAX_DEVICE_IDENTIFIER_STRING = 512
+Type D3DADAPTER_IDENTIFIER9
+	Driver[MAX_DEVICE_IDENTIFIER_STRING-1] As Byte
+	Description[MAX_DEVICE_IDENTIFIER_STRING-1] As Byte
+	DeviceName[31] As Byte
+
+	DriverVersionLowPart As DWord
+	DriverVersionHighPart As DWord
+
+	VendorId As DWord
+	DeviceId As DWord
+	SubSysId As DWord
+	Revision As DWord
+
+	DeviceIdentifier As GUID
+
+	WHQLLevel As DWord
+End Type
+
+' Raster Status structure returned by GetRasterStatus
+Type D3DRASTER_STATUS
+	InVBlank As Long
+	ScanLine As DWord
+End Type
+
+
+Const Enum D3DDEBUGMONITORTOKENS
+    D3DDMT_ENABLE            = 0   'enable debug monitor
+    D3DDMT_DISABLE           = 1   'disable debug monitor
+    D3DDMT_FORCE_DWORD       = &H7FFFFFFF
+End Enum
+
+
+'Async feedback
+Const Enum D3DQUERYTYPE
+    D3DQUERYTYPE_VCACHE                 = 4     'D3DISSUE_END
+    D3DQUERYTYPE_RESOURCEMANAGER        = 5     'D3DISSUE_END
+    D3DQUERYTYPE_VERTEXSTATS            = 6     'D3DISSUE_END
+    D3DQUERYTYPE_EVENT                  = 8     'D3DISSUE_END
+    D3DQUERYTYPE_OCCLUSION              = 9     'D3DISSUE_BEGIN, D3DISSUE_END
+    D3DQUERYTYPE_TIMESTAMP              = 10    'D3DISSUE_END
+    D3DQUERYTYPE_TIMESTAMPDISJOINT      = 11    'D3DISSUE_BEGIN, D3DISSUE_END
+    D3DQUERYTYPE_TIMESTAMPFREQ          = 12    'D3DISSUE_END
+    D3DQUERYTYPE_PIPELINETIMINGS        = 13    'D3DISSUE_BEGIN, D3DISSUE_END
+    D3DQUERYTYPE_INTERFACETIMINGS       = 14    'D3DISSUE_BEGIN, D3DISSUE_END
+    D3DQUERYTYPE_VERTEXTIMINGS          = 15    'D3DISSUE_BEGIN, D3DISSUE_END
+    D3DQUERYTYPE_PIXELTIMINGS           = 16    'D3DISSUE_BEGIN, D3DISSUE_END
+    D3DQUERYTYPE_BANDWIDTHTIMINGS       = 17    'D3DISSUE_BEGIN, D3DISSUE_END
+    D3DQUERYTYPE_CACHEUTILIZATION       = 18    'D3DISSUE_BEGIN, D3DISSUE_END
+End Enum
+
+' Flags field for Issue
+Const D3DISSUE_END   = 1<<0   'Tells the runtime to issue the end of a query, changing it's state to "non-signaled".
+Const D3DISSUE_BEGIN = 1<<1   'Tells the runtime to issue the beginng of a query.
+
+' Flags field for GetData
+Const D3DGETDATA_FLUSH = 1<<0   'Tells the runtime to flush if the query is outstanding.
+
+
+Type D3DRESOURCESTATS
+'Data collected since last Present()
+	bThrashing As Long             'indicates if thrashing
+	ApproxBytesDownloaded As DWord 'Approximate number of bytes downloaded by resource manager
+	NumEvicts As DWord             'number of objects evicted
+	NumVidCreates As DWord         'number of objects created in video memory
+	LastPri As DWord               'priority of last object evicted
+	NumUsed As DWord               'number of objects set to the device
+	NumUsedInVidMem As DWord       'number of objects set to the device, which are already in video memory
+'Persistent data
+	WorkingSet As DWord            'number of objects in video memory
+	WorkingSetBytes As DWord       'number of bytes in video memory
+	TotalManaged As DWord          'total number of managed objects
+	TotalBytes As DWord            'total number of bytes of managed objects
+End Type
+
+Const D3DRTYPECOUNT = 8
+
+Type D3DDEVINFO_RESOURCEMANAGER
+	stats[D3DRTYPECOUNT-1] As D3DRESOURCESTATS
+End Type
+
+Type D3DDEVINFO_D3DVERTEXSTATS
+	NumRenderedTriangles As DWord        'total number of triangles that are not clipped in this frame
+	NumExtraClippingTriangles As DWord   'Number of new triangles generated by clipping
+End Type
+
+Type D3DDEVINFO_VCACHE
+	Pattern As DWord
+	OptMethod As DWord
+	CacheSize As DWord
+	MagicNumber As DWord
+End Type
+
+Type D3DDEVINFO_D3D9PIPELINETIMINGS
+	VertexProcessingTimePercent As Single
+	PixelProcessingTimePercent As Single
+	OtherGPUProcessingTimePercent As Single
+	GPUIdleTimePercent As Single
+End Type
+
+Type D3DDEVINFO_D3D9INTERFACETIMINGS
+	WaitingForGPUToUseApplicationResourceTimePercent As Single
+	WaitingForGPUToAcceptMoreCommandsTimePercent As Single
+	WaitingForGPUToStayWithinLatencyTimePercent As Single
+	WaitingForGPUExclusiveResourceTimePercent As Single
+	WaitingForGPUOtherTimePercent As Single
+End Type
+
+Type D3DDEVINFO_D3D9STAGETIMINGS
+	MemoryProcessingPercent As Single
+	ComputationProcessingPercent As Single
+End Type
+
+Type D3DDEVINFO_D3D9BANDWIDTHTIMINGS
+	MaxBandwidthUtilized As Single
+	FrontEndUploadMemoryUtilizedPercent As Single
+	VertexRateUtilizedPercent As Single
+	TriangleSetupRateUtilizedPercent As Single
+	FillRateUtilizedPercent As Single
+End Type
+
+Type D3DDEVINFO_D3D9CACHEUTILIZATION
+	TextureCacheHitRate As Single
+	PostTransformVertexCacheHitRate As Single
+End Type
Index: /trunk/ab5.0/ablib/src/directx9/d3dx9.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/d3dx9.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/d3dx9.sbp	(revision 506)
@@ -0,0 +1,24 @@
+' d3dx9.sbp
+
+
+#ifndef _INC_D3DX9
+#define _INC_D3DX9
+
+
+TypeDef D3DCOLOR          = DWord
+
+Const D3DX_DEFAULT         = -1
+Const D3DX_DEFAULT_NONPOW2 = -2
+Const D3DX_DEFAULT_FLOAT   = FLT_MAX
+Const D3DX_FROM_FILE       = -3
+
+#require <directx9\d3d9.sbp>
+#require <directx9\d3dx9math.sbp>
+#require <directx9\d3dx9core.sbp>
+#require <directx9\d3dx9xof.sbp>
+#require <directx9\d3dx9mesh.sbp>
+#require <directx9\d3dx9shader.sbp>
+#require <directx9\d3dx9tex.sbp>
+
+
+#endif '_INC_D3DX9
Index: /trunk/ab5.0/ablib/src/directx9/d3dx9core.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/d3dx9core.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/d3dx9core.sbp	(revision 506)
@@ -0,0 +1,210 @@
+' d3dx9core.sbp
+
+Class ID3DXBuffer
+	Inherits IUnknown
+Public
+	'ID3DXBuffer
+	Abstract Function GetBufferPointer() As VoidPtr
+	Abstract Function GetBufferSize() As DWord
+End Class
+TypeDef LPD3DXBUFFER = *ID3DXBuffer
+
+
+Const D3DXSPRITE_DONOTSAVESTATE            = 1 << 0
+Const D3DXSPRITE_DONOTMODIFY_RENDERSTATE   = 1 << 1
+Const D3DXSPRITE_OBJECTSPACE               = 1 << 2
+Const D3DXSPRITE_BILLBOARD                 = 1 << 3
+Const D3DXSPRITE_ALPHABLEND                = 1 << 4
+Const D3DXSPRITE_SORT_TEXTURE              = 1 << 5
+Const D3DXSPRITE_SORT_DEPTH_FRONTTOBACK    = 1 << 6
+Const D3DXSPRITE_SORT_DEPTH_BACKTOFRONT    = 1 << 7
+
+
+Class ID3DXSprite
+	Inherits IUnknown
+Public
+	'ID3DXSprite
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+
+	Abstract Function GetTransform(pTransform As *D3DMATRIX) As DWord
+	Abstract Function SetTransform(pTransform As *D3DMATRIX) As DWord
+
+	Abstract Function SetWorldViewRH(pWorld As *D3DMATRIX, pView As *D3DMATRIX) As DWord
+	Abstract Function SetWorldViewLH(pWorld As *D3DMATRIX, pView As *D3DMATRIX) As DWord
+
+	Abstract Function Begin(Flags As DWord) As DWord
+	Abstract Function Draw(pTexture As *IDirect3DTexture9, pSrcRect As *RECT, pCenter As *D3DXVECTOR3, pPosition As *D3DVECTOR, Color As DWord) As DWord
+	Abstract Function Flush() As DWord
+	Abstract Function _End() As DWord
+
+	Abstract Function OnLostDevice() As DWord
+	Abstract Function OnResetDevice() As DWord
+End Class
+TypeDef LPD3DXSPRITE = *ID3DXSprite
+
+Declare Function D3DXCreateSprite Lib "dx9abm" Alias "D3DXCreateSprite_abm" (pDevice As LPDIRECT3DDEVICE9, ppSprite As **ID3DXSprite) As DWord
+
+
+Type D3DXFONT_DESC
+	Height As Long
+	Width As DWord
+	Weight As DWord
+	MipLevels As DWord
+	Italic As Long
+	CharSet As Byte
+	OutputPrecision As Byte
+	Quality As Byte
+	PitchAndFamily As Byte
+	FaceName[LF_FACESIZE-1] As Byte
+End Type
+Type D3DXFONT_DESCW
+	Height As Long
+	Width As DWord
+	Weight As DWord
+	MipLevels As DWord
+	Italic As Long
+	CharSet As Byte
+	OutputPrecision As Byte
+	Quality As Byte
+	PitchAndFamily As Byte
+    FaceName[LF_FACESIZE-1] As Word
+End Type
+
+Class ID3DXFont
+	Inherits IUnknown
+Public
+	'ID3DXFont
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Abstract Function GetDesc(pDesc As *D3DXFONT_DESC) As DWord
+	Abstract Function GetDescW(pDesc As *D3DXFONT_DESCW) As DWord
+	Abstract Function GetTextMetricsA(pTextMetrics As *TEXTMETRIC) As Long
+	Abstract Function GetTextMetricsW(pTextMetrics As VoidPtr) As Long
+
+	Abstract Function GetDC() As DWord
+	Abstract Function GetGlyphData(Glyph As DWord, ppTexture As **IDirect3DTexture9, pBlackBox As *RECT, pCellInc As *POINTAPI) As DWord
+
+	Abstract Function PreloadCharacters(First As DWord, Last As DWord) As DWord
+	Abstract Function PreloadGlyphs(First As DWord, Last As DWord) As DWord
+	Abstract Function PreloadText(pString As BytePtr, Count As Long) As DWord
+	Abstract Function PreloadTextW(pString As WordPtr, Count As Long) As DWord
+
+	Abstract Function DrawText(pSprite As *ID3DXSprite, pString As BytePtr, Count As Long, pRect As *RECT, Format As DWord, Color As DWord) As Long
+	Abstract Function DrawTextW(pSprite As *ID3DXSprite, pString As WordPtr, Count As Long, pRect As *RECT, Format As DWord, Color As DWord) As Long
+
+	Abstract Function OnLostDevice() As DWord
+	Abstract Function OnResetDevice() As DWord
+End Class
+TypeDef LPD3DXFONT = *ID3DXFont
+
+Declare Function D3DXCreateFont Lib "dx9abm" Alias "D3DXCreateFont_abm" (pDevice As LPDIRECT3DDEVICE9, Height As Long, Width As DWord, Weight As DWord, MipLevels As DWord, Italic As Long, CharSet As DWord, OutputPrecision As DWord, Quality As DWord, PitchAndFamily As DWord, pFaceName As BytePtr, ppFont As **ID3DXFont) As DWord
+
+Declare Function D3DXCreateFontIndirect Lib "dx9abm" Alias "D3DXCreateFontIndirect_abm" (pDevice As LPDIRECT3DDEVICE9, pDesc As *D3DXFONT_DESC, ppFont As **ID3DXFont) As DWord
+
+
+'----------------------
+' ID3DXRenderToSurface
+'----------------------
+
+Type D3DXRTS_DESC
+	Width As DWord
+	Height As DWord
+	Format As D3DFORMAT
+	DepthStencil As Long
+	DepthStencilFormat As D3DFORMAT
+End Type
+
+Class ID3DXRenderToSurface
+	Inherits IUnknown
+Public
+	'ID3DXRenderToSurface
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Abstract Function GetDesc(pDesc As *D3DXRTS_DESC) As DWord
+
+	Abstract Function BeginScene(pSurface As *IDirect3DSurface9, pViewport As *D3DVIEWPORT9) As DWord
+	Abstract Function EndScene(MipFilter As DWord) As DWord
+
+	Abstract Function OnLostDevice() As DWord
+	Abstract Function OnResetDevice() As DWord
+End Class
+TypeDef LPD3DXRENDERTOSURFACE = *ID3DXRenderToSurface
+
+Declare Function D3DXCreateRenderToSurface Lib "dx9abm" Alias "D3DXCreateRenderToSurface_abm" (pDevice As LPDIRECT3DDEVICE9, Width As DWord, Height As DWord, Format As D3DFORMAT, DepthStencil As Long, DepthStencilFormat As D3DFORMAT, ppRenderToSurface As **ID3DXRenderToSurface) As DWord
+
+
+'---------------------
+' ID3DXRenderToEnvMap
+'---------------------
+
+Type D3DXRTE_DESC
+	Size As DWord
+	MipLevels As DWord
+	Format As D3DFORMAT
+	DepthStencil As Long
+	DepthStencilFormat As D3DFORMAT
+End Type
+
+Class ID3DXRenderToEnvMap
+	Inherits IUnknown
+Public
+	'ID3DXRenderToEnvMap
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Abstract Function GetDesc(pDesc As *D3DXRTE_DESC) As DWord
+
+	Abstract Function BeginCube(pCubeTex As *IDirect3DCubeTexture9) As DWord
+
+	Abstract Function BeginSphere(pTex As *IDirect3DTexture9) As DWord
+
+	Abstract Function BeginHemisphere(pTexZPos As *IDirect3DTexture9, pTexZNeg As *IDirect3DTexture9) As DWord
+
+	Abstract Function BeginParabolic(pTexZPos As *IDirect3DTexture9, pTexZNeg As *IDirect3DTexture9) As DWord
+
+	Abstract Function Face(Face As D3DCUBEMAP_FACES, MipFilter As DWord) As DWord
+	Abstract Function _End(MipFilter As DWord) As DWord
+
+	Abstract Function OnLostDevice() As DWord
+	Abstract Function OnResetDevice() As DWord
+End Class
+TypeDef LPD3DXRenderToEnvMap = *ID3DXRenderToEnvMap
+
+Declare Function D3DXCreateRenderToEnvMap Lib "dx9abm" Alias "D3DXCreateRenderToEnvMap_abm" (pDevice As LPDIRECT3DDEVICE9, Size As DWord, MipLevels As DWord, Format As D3DFORMAT, DepthStencil As Long, DepthStencilFormat As D3DFORMAT, ppRenderToEnvMap As *LPD3DXRenderToEnvMap) As DWord
+
+
+'-----------
+' ID3DXLine
+'-----------
+
+Class ID3DXLine
+	Inherits IUnknown
+Public
+    'ID3DXLine
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+
+	Abstract Function Begin() As DWord
+
+	Abstract Function Draw(pVertexList As *D3DXVECTOR2, dwVertexListCount As DWord, dwColor As DWord) As DWord
+
+	Abstract Function DrawTransform(pVertexList As *D3DXVECTOR3, dwVertexListCount As DWord, pTransform As *D3DXMATRIX, dwColor As DWord) As DWord
+
+	Abstract Function SetPattern(dwPattern As DWord) As DWord
+	Abstract Function GetPattern() As DWord
+
+	Abstract Function SetPatternScale(fPatternScale As Single) As DWord
+	Abstract Function GetPatternScale() As Single
+
+	Abstract Function SetWidth(fWidth As Single) As DWord
+	Abstract Function GetWidth() As Single
+
+	Abstract Function SetAntialias(bAntialias As Long) As DWord
+	Abstract Function GetAntialias() As Long
+
+	Abstract Function SetGLLines(bGLLines As Long) As DWord
+	Abstract Function GetGLLines() As Long
+
+	Abstract Function _End() As DWord
+
+	Abstract Function OnLostDevice() As DWord
+	Abstract Function OnResetDevice() As DWord
+End Class
+TypeDef LPD3DXLINE = *ID3DXLine
+
+Declare Function D3DXCreateLine Lib "dx9abm" Alias "D3DXCreateLine_abm" (pDevice As LPDIRECT3DDEVICE9, ppLine As **ID3DXLine) As DWord
Index: /trunk/ab5.0/ablib/src/directx9/d3dx9math.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/d3dx9math.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/d3dx9math.sbp	(revision 506)
@@ -0,0 +1,261 @@
+'d3dx9math.sbp
+
+'---------------------------
+' General purpose utilities
+'---------------------------
+
+Const D3DX_PI    = 3.141592654
+Const D3DX_1BYPI = 0.318309886
+
+Const D3DXToRadian(degree) = degree * (D3DX_PI / 180.0)
+Const D3DXToDegree(radian) = radian * (180.0 / D3DX_PI)
+
+
+Type D3DXVECTOR2
+	x As Single
+	y As Single
+End Type
+
+Type D3DXVECTOR3
+	x As Single
+	y As Single
+	z As Single
+End Type
+
+Type D3DXVECTOR4
+	x As Single
+	y As Single
+	z As Single
+	w As Single
+End Type
+
+Type D3DXMATRIX
+	m[3,3] As Single
+End Type
+
+Type D3DXQUATERNION
+	x As Single
+	y As Single
+	z As Single
+	w As Single
+End Type
+
+Type D3DXPLANE
+	a As Single
+	b As Single
+	c As Single
+	d As Single
+End Type
+
+Type D3DXCOLOR
+	r As Single
+	g As Single
+	b As Single
+	a As Single
+End Type
+
+
+'-----------
+' 2D Vector
+'-----------
+Declare Function D3DXVec2Length Lib "dx9abm" Alias "D3DXVec2Length_abm" (pV As *D3DXVECTOR2) As Single
+Declare Function D3DXVec2LengthSq Lib "dx9abm" Alias "D3DXVec2LengthSq_abm" (pV As *D3DXVECTOR2) As Single
+Declare Function D3DXVec2Dot Lib "dx9abm" Alias "D3DXVec2Dot_abm" (pV1 As *D3DXVECTOR2, pV2 As *D3DXVECTOR2) As Single
+Declare Function D3DXVec2CCW Lib "dx9abm" Alias "D3DXVec2CCW_abm" (pV1 As *D3DXVECTOR2, pV2 As *D3DXVECTOR2) As Single
+Declare Function D3DXVec2Add Lib "dx9abm" Alias "D3DXVec2Add_abm" (pV1 As *D3DXVECTOR2, pV2 As *D3DXVECTOR2) As *D3DXVECTOR2
+Declare Function D3DXVec2Subtract Lib "dx9abm" Alias "D3DXVec2Subtract_abm" (pOut As *D3DXVECTOR2, pV1 As *D3DXVECTOR2, pV2 As *D3DXVECTOR2) As *D3DXVECTOR2
+Declare Function D3DXVec2Minimize Lib "dx9abm" Alias "D3DXVec2Minimize_abm" (pOut As *D3DXVECTOR2, pV1 As *D3DXVECTOR2, pV2 As *D3DXVECTOR2) As *D3DXVECTOR2
+Declare Function D3DXVec2Maximize Lib "dx9abm" Alias "D3DXVec2Maximize_abm" (pOut As *D3DXVECTOR2, pV1 As *D3DXVECTOR2, pV2 As *D3DXVECTOR2) As *D3DXVECTOR2
+Declare Function D3DXVec2Scale Lib "dx9abm" Alias "D3DXVec2Scale_abm" (pOut As *D3DXVECTOR2, pV As *D3DXVECTOR2, s As Single) As *D3DXVECTOR2
+Declare Function D3DXVec2Lerp Lib "dx9abm" Alias "D3DXVec2Lerp_abm" (pOut As *D3DXVECTOR2, pV1 As *D3DXVECTOR2, pV2 As *D3DXVECTOR2, s As Single) As *D3DXVECTOR2
+
+Declare Function D3DXVec2Normalize Lib "dx9abm" Alias "D3DXVec2Normalize_abm" (pOut As *D3DXVECTOR2, pV As *D3DXVECTOR2) As *D3DXVECTOR2
+Declare Function D3DXVec2Hermite Lib "dx9abm" Alias "D3DXVec2Hermite_abm" (pOut As *D3DXVECTOR2, pV1 As *D3DXVECTOR2, pT1 As *D3DXVECTOR2, pV2 As *D3DXVECTOR2, pT2 As *D3DXVECTOR2, s As Single) As *D3DXVECTOR2
+Declare Function D3DXVec2CatmullRom Lib "dx9abm" Alias "D3DXVec2CatmullRom_abm" (pOut As *D3DXVECTOR2, pV0 As *D3DXVECTOR2, pV1 As *D3DXVECTOR2, pV2 As *D3DXVECTOR2, pV3 As *D3DXVECTOR2, s As Single) As *D3DXVECTOR2
+Declare Function D3DXVec2BaryCentric Lib "dx9abm" Alias "D3DXVec2BaryCentric_abm" (pOut As *D3DXVECTOR2, pV1 As *D3DXVECTOR2, pV2 As *D3DXVECTOR2, pV3 As *D3DXVECTOR2, f As Single, g As Single) As *D3DXVECTOR2
+Declare Function D3DXVec2Transform Lib "dx9abm" Alias "D3DXVec2Transform_abm" (pOut As *D3DXVECTOR4, pV As *D3DXVECTOR2, pM As *D3DXMATRIX) As *D3DXVECTOR4
+Declare Function D3DXVec2TransformCoord Lib "dx9abm" Alias "D3DXVec2TransformCoord_abm" (pOut As *D3DXVECTOR2, pV As *D3DXVECTOR2, pM As *D3DXMATRIX) As *D3DXVECTOR2
+Declare Function D3DXVec2TransformNormal Lib "dx9abm" Alias "D3DXVec2TransformNormal_abm" (pOut As *D3DXVECTOR2, pV As *D3DXVECTOR2, pM As *D3DXMATRIX) As *D3DXVECTOR2
+Declare Function D3DXVec2TransformArray Lib "dx9abm" Alias "D3DXVec2TransformArray_abm" (pOut As *D3DXVECTOR4, OutStride As DWord, pV As *D3DXVECTOR2, VStride As DWord, pM As *D3DXMATRIX, n As DWord) As *D3DXVECTOR4
+Declare Function D3DXVec2TransformCoordArray Lib "dx9abm" Alias "D3DXVec2TransformCoordArray_abm" (pOut As *D3DXVECTOR2, OutStride As DWord, pV As *D3DXVECTOR2, VStride As DWord, pM As *D3DXMATRIX, n As DWord) As *D3DXVECTOR2
+Declare Function D3DXVec2TransformNormalArray Lib "dx9abm" Alias "D3DXVec2TransformNormalArray_abm" (pOut As *D3DXVECTOR2, OutStride As DWord, pV As *D3DXVECTOR2, VStride As DWord, pM As *D3DXMATRIX, n As DWord) As *D3DXVECTOR2
+
+
+'-----------
+' 3D Vector
+'-----------
+Declare Function D3DXVec3Length Lib "dx9abm" Alias "D3DXVec3Length_abm" (pV As *D3DXVECTOR3) As Single
+Declare Function D3DXVec3LengthSq Lib "dx9abm" Alias "D3DXVec3LengthSq_abm" (pV As *D3DXVECTOR3) As Single
+Declare Function D3DXVec3Dot Lib "dx9abm" Alias "D3DXVec3Dot_abm" (pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3) As Single
+Declare Function D3DXVec3Cross Lib "dx9abm" Alias "D3DXVec3Cross_abm" (pOut As *D3DXVECTOR3, pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3) As *D3DXVECTOR3
+Declare Function D3DXVec3Add Lib "dx9abm" Alias "D3DXVec3Add_abm" (pOut As *D3DXVECTOR3, pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3) As *D3DXVECTOR3
+Declare Function D3DXVec3Subtract Lib "dx9abm" Alias "D3DXVec3Subtract_abm" (pOut As *D3DXVECTOR3, pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3) As *D3DXVECTOR3
+Declare Function D3DXVec3Minimize Lib "dx9abm" Alias "D3DXVec3Minimize_abm" (pOut As *D3DXVECTOR3, pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3) As *D3DXVECTOR3
+Declare Function D3DXVec3Maximize Lib "dx9abm" Alias "D3DXVec3Maximize_abm" (pOut As *D3DXVECTOR3, pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3) As *D3DXVECTOR3
+Declare Function D3DXVec3Scale Lib "dx9abm" Alias "D3DXVec3Scale_abm" (pOut As *D3DXVECTOR3, pV As *D3DXVECTOR3, s As Single) As *D3DXVECTOR3
+Declare Function D3DXVec3Lerp Lib "dx9abm" Alias "D3DXVec3Lerp_abm" (pOut As *D3DXVECTOR3, pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3, s As Single) As *D3DXVECTOR3
+
+Declare Function D3DXVec3Normalize Lib "dx9abm" Alias "D3DXVec3Normalize_abm" (pOut As *D3DXVECTOR3, pV As *D3DXVECTOR3) As *D3DXVECTOR3
+Declare Function D3DXVec3Hermite Lib "dx9abm" Alias "D3DXVec3Hermite_abm" (pOut As *D3DXVECTOR3, pV1 As *D3DXVECTOR3, pT1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3, pT2 As *D3DXVECTOR3, s As Single) As *D3DXVECTOR3
+Declare Function D3DXVec3CatmullRom Lib "dx9abm" Alias "D3DXVec3CatmullRom_abm" (pOut As *D3DXVECTOR3, pV0 As *D3DXVECTOR3, pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3, pV3 As *D3DXVECTOR3, s As Single) As *D3DXVECTOR3
+Declare Function D3DXVec3BaryCentric Lib "dx9abm" Alias "D3DXVec3BaryCentric_abm" (pOut As *D3DXVECTOR3, pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3, pV3 As *D3DXVECTOR3, f As Single, g As Single) As *D3DXVECTOR3
+Declare Function D3DXVec3Transform Lib "dx9abm" Alias "D3DXVec3Transform_abm" (pOut As *D3DXVECTOR4, pV As *D3DXVECTOR3, pM As *D3DXMATRIX) As *D3DXVECTOR4
+Declare Function D3DXVec3TransformCoord Lib "dx9abm" Alias "D3DXVec3TransformCoord_abm" (pOut As *D3DXVECTOR3, pV As *D3DXVECTOR3, pM As *D3DXMATRIX) As *D3DXVECTOR3
+Declare Function D3DXVec3TransformNormal Lib "dx9abm" Alias "D3DXVec3TransformNormal_abm" (pOut As *D3DXVECTOR3, pV As *D3DXVECTOR3, pM As *D3DXMATRIX) As *D3DXVECTOR3
+Declare Function D3DXVec3TransformArray Lib "dx9abm" Alias "D3DXVec3TransformArray_abm" (pOut As *D3DXVECTOR4, OutStride As DWord, pV As *D3DXVECTOR3, VStride As DWord, pM As *D3DXMATRIX, n As DWord) As *D3DXVECTOR4
+Declare Function D3DXVec3TransformCoordArray Lib "dx9abm" Alias "D3DXVec3TransformCoordArray_abm" (pOut As *D3DXVECTOR3, OutStride As DWord, pV As *D3DXVECTOR3, VStride As DWord, pM As *D3DXMATRIX, n As DWord) As *D3DXVECTOR3
+Declare Function D3DXVec3TransformNormalArray Lib "dx9abm" Alias "D3DXVec3TransformNormalArray_abm" (pOut As *D3DXVECTOR3, OutStride As DWord, pV As *D3DXVECTOR3, VStride As DWord, pM As *D3DXMATRIX, n As DWord) As *D3DXVECTOR3
+Declare Function D3DXVec3Project Lib "dx9abm" Alias "D3DXVec3Project_abm" (pOut As *D3DXVECTOR3, pV As *D3DXVECTOR3, pViewport As *D3DVIEWPORT9, pProjection As *D3DXMATRIX, pView As *D3DXMATRIX, pWorld As *D3DXMATRIX) As *D3DXVECTOR3
+Declare Function D3DXVec3Unproject Lib "dx9abm" Alias "D3DXVec3Unproject_abm" (pOut As *D3DXVECTOR3, pV As *D3DXVECTOR3, pViewport As *D3DVIEWPORT9, pProjection As *D3DXMATRIX, pView As *D3DXMATRIX, pWorld As *D3DXMATRIX) As *D3DXVECTOR3
+Declare Function D3DXVec3ProjectArray Lib "dx9abm" Alias "D3DXVec3ProjectArray_abm" (pOut As *D3DXVECTOR3, OutStride As DWord, pV As *D3DXVECTOR3, VStride As DWord, pViewport As *D3DVIEWPORT9, pProjection As *D3DXMATRIX, pView As *D3DXMATRIX, pWorld As *D3DXMATRIX, n As DWord) As *D3DXVECTOR3
+Declare Function D3DXVec3UnprojectArray Lib "dx9abm" Alias "D3DXVec3UnprojectArray_abm" (pOut As *D3DXVECTOR3, OutStride As DWord, pV As *D3DXVECTOR3, VStride As DWord, pViewport As *D3DVIEWPORT9, pProjection As *D3DXMATRIX, pView As *D3DXMATRIX, pWorld As *D3DXMATRIX, n As DWord) As *D3DXVECTOR3
+
+
+'-----------
+' 4D Vector
+'-----------
+Declare Function D3DXVec4Length Lib "dx9abm" Alias "D3DXVec4Length_abm" (pV As *D3DXVECTOR4) As Single
+Declare Function D3DXVec4LengthSq Lib "dx9abm" Alias "D3DXVec4LengthSq_abm" (pV As *D3DXVECTOR4) As Single
+Declare Function D3DXVec4Dot Lib "dx9abm" Alias "D3DXVec4Dot_abm" (pV1 As *D3DXVECTOR4, pV2 As *D3DXVECTOR4) As Single
+Declare Function D3DXVec4Add Lib "dx9abm" Alias "D3DXVec4Add_abm" (pOut As *D3DXVECTOR4, pV1 As *D3DXVECTOR4, pV2 As *D3DXVECTOR4) As *D3DXVECTOR4
+Declare Function D3DXVec4Subtract Lib "dx9abm" Alias "D3DXVec4Subtract_abm" (pOut As *D3DXVECTOR4, pV1 As *D3DXVECTOR4, pV2 As *D3DXVECTOR4) As *D3DXVECTOR4
+Declare Function D3DXVec4Minimize Lib "dx9abm" Alias "D3DXVec4Minimize_abm" (pOut As *D3DXVECTOR4, pV1 As *D3DXVECTOR4, pV2 As *D3DXVECTOR4) As *D3DXVECTOR4
+Declare Function D3DXVec4Maximize Lib "dx9abm" Alias "D3DXVec4Maximize_abm" (pOut As *D3DXVECTOR4, pV1 As *D3DXVECTOR4, pV2 As *D3DXVECTOR4) As *D3DXVECTOR4
+Declare Function D3DXVec4Scale Lib "dx9abm" Alias "D3DXVec4Scale_abm" (pOut As *D3DXVECTOR4, pV As *D3DXVECTOR4, s As Single) As *D3DXVECTOR4
+Declare Function D3DXVec4Lerp Lib "dx9abm" Alias "D3DXVec4Lerp_abm" (pOut As *D3DXVECTOR4, pV1 As *D3DXVECTOR4, pV2 As *D3DXVECTOR4, s As Single) As *D3DXVECTOR4
+
+Declare Function D3DXVec4Cross Lib "dx9abm" Alias "D3DXVec4Cross_abm" (pOut As *D3DXVECTOR4, pV1 As *D3DXVECTOR4, pV2 As *D3DXVECTOR4, pV3 As *D3DXVECTOR4) As *D3DXVECTOR4
+Declare Function D3DXVec4Normalize Lib "dx9abm" Alias "D3DXVec4Normalize_abm" (pOut As *D3DXVECTOR4, pV As *D3DXVECTOR4) As *D3DXVECTOR4
+Declare Function D3DXVec4Hermite Lib "dx9abm" Alias "D3DXVec4Hermite_abm" (pOut As *D3DXVECTOR4, pV1 As *D3DXVECTOR4, pT1 As *D3DXVECTOR4, pV2 As *D3DXVECTOR4, pT2 As *D3DXVECTOR4, s As Single) As *D3DXVECTOR4
+Declare Function D3DXVec4CatmullRom Lib "dx9abm" Alias "D3DXVec4CatmullRom_abm" (pOut As *D3DXVECTOR4, pV0 As *D3DXVECTOR4, pV1 As *D3DXVECTOR4, pV2 As *D3DXVECTOR4, pV3 As *D3DXVECTOR4, s As Single) As *D3DXVECTOR4
+Declare Function D3DXVec4BaryCentric Lib "dx9abm" Alias "D3DXVec4BaryCentric_abm" (pOut As *D3DXVECTOR4, pV1 As *D3DXVECTOR4, pV2 As *D3DXVECTOR4, pV3 As *D3DXVECTOR4, f As Single, g As Single) As *D3DXVECTOR4
+Declare Function D3DXVec4Transform Lib "dx9abm" Alias "D3DXVec4Transform_abm" (pOut As *D3DXVECTOR4, pV As *D3DXVECTOR4, pM As *D3DXMATRIX) As *D3DXVECTOR4
+Declare Function D3DXVec4TransformArray Lib "dx9abm" Alias "D3DXVec4TransformArray_abm" (pOut As *D3DXVECTOR4, OutStride As DWord, pV As *D3DXVECTOR4, VStride As DWord, pM As *D3DXMATRIX, n As DWord) As *D3DXVECTOR4
+
+
+'-----------
+' 4D Matrix
+'-----------
+Declare Function D3DXMatrixIdentity Lib "dx9abm" Alias "D3DXMatrixIdentity_abm" (pOut As *D3DXMATRIX) As *D3DXMATRIX
+Declare Function D3DXMatrixIsIdentity Lib "dx9abm" Alias "D3DXMatrixIsIdentity_abm" (pM As *D3DXMATRIX) As Long
+
+Declare Function D3DXMatrixDeterminant Lib "dx9abm" Alias "D3DXMatrixDeterminant_abm" (pM As *D3DXMATRIX) As Single
+Declare Function D3DXMatrixDecompose Lib "dx9abm" Alias "D3DXMatrixDecompose_abm" (pOutScale As *D3DXVECTOR3, pOutRotation As *D3DXQUATERNION, pOutTranslation As *D3DXVECTOR3, pM As *D3DXMATRIX) As DWord
+Declare Function D3DXMatrixTranspose Lib "dx9abm" Alias "D3DXMatrixTranspose_abm" (pOut As *D3DXMATRIX, pM As *D3DXMATRIX) As *D3DXMATRIX
+Declare Function D3DXMatrixMultiply Lib "dx9abm" Alias "D3DXMatrixMultiply_abm" (pOut As *D3DXMATRIX, pM1 As *D3DXMATRIX, pM2 As *D3DXMATRIX) As *D3DXMATRIX
+Declare Function D3DXMatrixMultiplyTranspose Lib "dx9abm" Alias "D3DXMatrixMultiplyTranspose_abm" (pOut As *D3DXMATRIX, pM1 As *D3DXMATRIX, pM2 As *D3DXMATRIX) As *D3DXMATRIX
+Declare Function D3DXMatrixInverse Lib "dx9abm" Alias "D3DXMatrixInverse_abm" (pOut As *D3DXMATRIX, pDeterminant As SinglePtr, pM As *D3DXMATRIX) As *D3DXMATRIX
+Declare Function D3DXMatrixScaling Lib "dx9abm" Alias "D3DXMatrixScaling_abm" (pOut As *D3DXMATRIX, sx As Single, sy As Single, sz As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixTranslation Lib "dx9abm" Alias "D3DXMatrixTranslation_abm" (pOut As *D3DXMATRIX, x As Single, y As Single, z As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixRotationX Lib "dx9abm" Alias "D3DXMatrixRotationX_abm" (pOut As *D3DXMATRIX, Angle As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixRotationY Lib "dx9abm" Alias "D3DXMatrixRotationY_abm" (pOut As *D3DXMATRIX, Angle As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixRotationZ Lib "dx9abm" Alias "D3DXMatrixRotationZ_abm" (pOut As *D3DXMATRIX, Angle As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixRotationAxis Lib "dx9abm" Alias "D3DXMatrixRotationAxis_abm" (pOut As *D3DXMATRIX, pV As *D3DXVECTOR3, Angle As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixRotationQuaternion Lib "dx9abm" Alias "D3DXMatrixRotationQuaternion_abm" (pOut As *D3DXMATRIX, pQ As *D3DXQUATERNION) As *D3DXMATRIX
+Declare Function D3DXMatrixRotationYawPitchRoll Lib "dx9abm" Alias "D3DXMatrixRotationYawPitchRoll_abm" (pOut As *D3DXMATRIX, Yaw As Single, Pitch As Single, Roll As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixTransformation Lib "dx9abm" Alias "D3DXMatrixTransformation_abm" (pOut As *D3DXMATRIX, pScalingCenter As *D3DXVECTOR3, pScalingRotation As *D3DXQUATERNION, pScaling As *D3DXVECTOR3, pRotationCenter As *D3DXVECTOR3, pRotation As *D3DXQUATERNION, pTranslation As *D3DXVECTOR3) As *D3DXMATRIX
+Declare Function D3DXMatrixTransformation2D Lib "dx9abm" Alias "D3DXMatrixTransformation2D_abm" (pOut As *D3DXMATRIX, pScalingCenter As *D3DXVECTOR2, ScalingRotation As Single, pScaling As *D3DXVECTOR2, pRotationCenter As *D3DXVECTOR2, Rotation As Single, pTranslation As *D3DXVECTOR2) As *D3DXMATRIX
+Declare Function D3DXMatrixAffineTransformation Lib "dx9abm" Alias "D3DXMatrixAffineTransformation_abm" (pOut As *D3DXMATRIX, Scaling As Single, pRotationCenter As *D3DXVECTOR3, pRotation As *D3DXQUATERNION, pTranslation As *D3DXVECTOR3) As *D3DXMATRIX
+Declare Function D3DXMatrixAffineTransformation2D Lib "dx9abm" Alias "D3DXMatrixAffineTransformation2D_abm" (pOut As *D3DXMATRIX, Scaling As Single, pRotationCenter As *D3DXVECTOR2, Rotation As Single, pTranslation As *D3DXVECTOR2) As *D3DXMATRIX
+Declare Function D3DXMatrixLookAtRH Lib "dx9abm" Alias "D3DXMatrixLookAtRH_abm" (pOut As *D3DXMATRIX, pEye As *D3DXVECTOR3, pAt As *D3DXVECTOR3, pUp As *D3DXVECTOR3) As *D3DXMATRIX
+Declare Function D3DXMatrixLookAtLH Lib "dx9abm" Alias "D3DXMatrixLookAtLH_abm" (pOut As *D3DXMATRIX, pEye As *D3DXVECTOR3, pAt As *D3DXVECTOR3, pUp As *D3DXVECTOR3) As *D3DXMATRIX
+Declare Function D3DXMatrixPerspectiveRH Lib "dx9abm" Alias "D3DXMatrixPerspectiveRH_abm" (pOut As *D3DXMATRIX, w As Single, h As Single, zn As Single, zf As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixPerspectiveLH Lib "dx9abm" Alias "D3DXMatrixPerspectiveLH_abm" (pOut As *D3DXMATRIX, w As Single, h As Single, zn As Single, zf As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixPerspectiveFovRH Lib "dx9abm" Alias "D3DXMatrixPerspectiveFovRH_abm" (pOut As *D3DXMATRIX, fovy As Single, Aspect As Single, zn As Single, zf As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixPerspectiveFovLH Lib "dx9abm" Alias "D3DXMatrixPerspectiveFovLH_abm" (pOut As *D3DXMATRIX, fovy As Single, Aspect As Single, zn As Single, zf As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixPerspectiveOffCenterRH Lib "dx9abm" Alias "D3DXMatrixPerspectiveOffCenterRH_abm" (pOut As *D3DXMATRIX, l As Single, r As Single, b AS Single, t As Single, zn As Single, zf As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixPerspectiveOffCenterLH Lib "dx9abm" Alias "D3DXMatrixPerspectiveOffCenterLH_abm" (pOut As *D3DXMATRIX, l As Single, r As Single, b As Single, t As Single, zn As Single, zf As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixOrthoRH Lib "dx9abm" Alias "D3DXMatrixOrthoRH_abm" (pOut As *D3DXMATRIX, w As Single, h As Single, zn As Single, zf As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixOrthoLH Lib "dx9abm" Alias "D3DXMatrixOrthoLH_abm" (pOut As *D3DXMATRIX, w As Single, h As Single, zn As Single, zf As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixOrthoOffCenterRH Lib "dx9abm" Alias "D3DXMatrixOrthoOffCenterRH_abm" (pOut As *D3DXMATRIX, l As Single, r As Single, b As Single, t As Single, zn As Single, zf As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixOrthoOffCenterLH Lib "dx9abm" Alias "D3DXMatrixOrthoOffCenterLH_abm" (pOut As *D3DXMATRIX, l As Single, r As Single, b As Single, t As Single, zn As Single, zf As Single) As *D3DXMATRIX
+Declare Function D3DXMatrixShadow Lib "dx9abm" Alias "D3DXMatrixShadow_abm" (pOut As *D3DXMATRIX, pLight As *D3DXVECTOR4, pPlane As *D3DXPLANE) As *D3DXMATRIX
+Declare Function D3DXMatrixReflect Lib "dx9abm" Alias "D3DXMatrixReflect_abm" (pOut As *D3DXMATRIX, pPlane As *D3DXPLANE) As *D3DXMATRIX
+
+
+'------------
+' Quaternion
+'------------
+Declare Function D3DXQuaternionLength Lib "dx9abm" Alias "D3DXQuaternionLength_abm" (pQ As *D3DXQUATERNION) As Single
+Declare Function D3DXQuaternionLengthSq Lib "dx9abm" Alias "D3DXQuaternionLengthSq_abm" (pQ As *D3DXQUATERNION) As Single
+Declare Function D3DXQuaternionDot Lib "dx9abm" Alias "D3DXQuaternionDot_abm" (pQ1 As *D3DXQUATERNION, pQ2 As *D3DXQUATERNION) As Single
+Declare Function D3DXQuaternionIdentity Lib "dx9abm" Alias "D3DXQuaternionIdentity_abm" (pOut As *D3DXQUATERNION) As *D3DXQUATERNION
+Declare Function D3DXQuaternionIsIdentity Lib "dx9abm" Alias "D3DXQuaternionIsIdentity_abm" (pQ As *D3DXQUATERNION) As Long
+Declare Function D3DXQuaternionConjugate Lib "dx9abm" Alias "D3DXQuaternionConjugate_abm" (pOut As *D3DXQUATERNION, pQ As *D3DXQUATERNION) As *D3DXQUATERNION
+
+Declare Sub D3DXQuaternionToAxisAngle Lib "dx9abm" Alias "D3DXQuaternionToAxisAngle_abm" (pQ As *D3DXQUATERNION, pAxis As *D3DXVECTOR3, pAngle As SinglePtr)
+Declare Function D3DXQuaternionRotationMatrix Lib "dx9abm" Alias "D3DXQuaternionRotationMatrix_abm" (pOut As *D3DXQUATERNION, pM As *D3DXMATRIX) As *D3DXQUATERNION
+Declare Function D3DXQuaternionRotationAxis Lib "dx9abm" Alias "D3DXQuaternionRotationAxis_abm" (pOut As *D3DXQUATERNION, pV As *D3DXVECTOR3, Angle As Single) As *D3DXQUATERNION
+Declare Function D3DXQuaternionRotationYawPitchRoll Lib "dx9abm" Alias "D3DXQuaternionRotationYawPitchRoll_abm" (pOut As *D3DXQUATERNION, Yaw As Single, Pitch As Single, Roll As Single) As *D3DXQUATERNION
+Declare Function D3DXQuaternionMultiply Lib "dx9abm" Alias "D3DXQuaternionMultiply_abm" (pOut As *D3DXQUATERNION, pQ1 As *D3DXQUATERNION, pQ2 As *D3DXQUATERNION) As *D3DXQUATERNION
+Declare Function D3DXQuaternionNormalize Lib "dx9abm" Alias "D3DXQuaternionNormalize_abm" (pOut As *D3DXQUATERNION, pQ As *D3DXQUATERNION) As *D3DXQUATERNION
+Declare Function D3DXQuaternionInverse Lib "dx9abm" Alias "D3DXQuaternionInverse_abm" (pOut As *D3DXQUATERNION, pQ As *D3DXQUATERNION) As *D3DXQUATERNION
+Declare Function D3DXQuaternionLn Lib "dx9abm" Alias "D3DXQuaternionLn_abm" (pOut As *D3DXQUATERNION, pQ As *D3DXQUATERNION) As *D3DXQUATERNION
+Declare Function D3DXQuaternionExp Lib "dx9abm" Alias "D3DXQuaternionExp_abm" (pOut As *D3DXQUATERNION, pQ As *D3DXQUATERNION) As *D3DXQUATERNION
+Declare Function D3DXQuaternionSlerp Lib "dx9abm" Alias "D3DXQuaternionSlerp_abm" (pOut As *D3DXQUATERNION, pQ1 As *D3DXQUATERNION, pQ2 As *D3DXQUATERNION, t As Single) As *D3DXQUATERNION
+Declare Function D3DXQuaternionSquad Lib "dx9abm" Alias "D3DXQuaternionSquad_abm" (pOut As *D3DXQUATERNION, pQ1 As *D3DXQUATERNION, pA As *D3DXQUATERNION, pB As *D3DXQUATERNION, pC As *D3DXQUATERNION, t As Single) As *D3DXQUATERNION
+Declare Sub D3DXQuaternionSquadSetup Lib "dx9abm" Alias "D3DXQuaternionSquadSetup_abm" (pAOut As *D3DXQUATERNION, pBOut As *D3DXQUATERNION, pCOut As *D3DXQUATERNION, pQ0 As *D3DXQUATERNION, pQ1 As *D3DXQUATERNION, pQ2 As *D3DXQUATERNION, pQ3 As *D3DXQUATERNION)
+Declare Function D3DXQuaternionBaryCentric Lib "dx9abm" Alias "D3DXQuaternionBaryCentric_abm" (pOut As *D3DXQUATERNION, pQ1 As *D3DXQUATERNION, pQ2 As *D3DXQUATERNION, pQ3 As *D3DXQUATERNION, f As Single, g As Single) As *D3DXQUATERNION
+
+
+'-------
+' Plane
+'-------
+Declare Function D3DXPlaneDot Lib "dx9abm" Alias "D3DXPlaneDot_abm" (pP As *D3DXPLANE, pV As *D3DXVECTOR4) As Single
+Declare Function D3DXPlaneDotCoord Lib "dx9abm" Alias "D3DXPlaneDotCoord_abm" (pP As *D3DXPLANE, pV As *D3DXVECTOR3) As Single
+Declare Function D3DXPlaneDotNormal Lib "dx9abm" Alias "D3DXPlaneDotNormal_abm" (pP As *D3DXPLANE, pV As *D3DXVECTOR3) As Single
+Declare Function D3DXPlaneScale Lib "dx9abm" Alias "D3DXPlaneScale_abm" (pOut As *D3DXPLANE, pP As *D3DXPLANE, s As Single) As *D3DXPLANE
+
+Declare Function D3DXPlaneNormalize Lib "dx9abm" Alias "D3DXPlaneNormalize_abm" (pOut As *D3DXPLANE, pP As *D3DXPLANE) As *D3DXPLANE
+Declare Function D3DXPlaneIntersectLine Lib "dx9abm" Alias "D3DXPlaneIntersectLine_abm" (pOut As *D3DXVECTOR3, pP As *D3DXPLANE, pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3) As *D3DXVECTOR3
+Declare Function D3DXPlaneFromPointNormal Lib "dx9abm" Alias "D3DXPlaneFromPointNormal_abm" (pOut As *D3DXPLANE, pPoint As *D3DXVECTOR3, pNormal As *D3DXVECTOR3) As *D3DXPLANE
+Declare Function D3DXPlaneFromPoints Lib "dx9abm" Alias "D3DXPlaneFromPoints_abm" (pOut As *D3DXPLANE, pV1 As *D3DXVECTOR3, pV2 As *D3DXVECTOR3, pV3 As *D3DXVECTOR3) As *D3DXPLANE
+Declare Function D3DXPlaneTransform Lib "dx9abm" Alias "D3DXPlaneTransform_abm" (pOut As *D3DXPLANE, pP As *D3DXPLANE, pM As *D3DXMATRIX) As *D3DXPLANE
+Declare Function D3DXPlaneTransformArray Lib "dx9abm" Alias "D3DXPlaneTransformArray_abm" (pOut As *D3DXPLANE, OutStride As DWord, pP As *D3DXPLANE, PStride As DWord, pM As *D3DXMATRIX, n As DWord) As *D3DXPLANE
+
+
+'-------
+' Color
+'-------
+Declare Function D3DXColorNegative Lib "dx9abm" Alias "D3DXColorNegative_abm" (pOut As *D3DXCOLOR, pC As *D3DXCOLOR) As *D3DXCOLOR
+Declare Function D3DXColorAdd Lib "dx9abm" Alias "D3DXColorAdd_abm" (pOut As *D3DXCOLOR, pC1 As *D3DXCOLOR, pC2 As *D3DXCOLOR) As *D3DXCOLOR
+Declare Function D3DXColorSubtract Lib "dx9abm" Alias "D3DXColorSubtract_abm" (pOut As *D3DXCOLOR, pC1 As *D3DXCOLOR, pC2 As *D3DXCOLOR) As *D3DXCOLOR
+Declare Function D3DXColorScale Lib "dx9abm" Alias "D3DXColorScale_abm" (pOut As *D3DXCOLOR, pC As *D3DXCOLOR, s As Single) As *D3DXCOLOR
+Declare Function D3DXColorModulate Lib "dx9abm" Alias "D3DXColorModulate_abm" (pOut As *D3DXCOLOR, pC1 As *D3DXCOLOR, pC2 As *D3DXCOLOR) As *D3DXCOLOR
+Declare Function D3DXColorLerp Lib "dx9abm" Alias "D3DXColorLerp_abm" (pOut As *D3DXCOLOR, pC1 As *D3DXCOLOR, pC2 As *D3DXCOLOR, s As Single) As *D3DXCOLOR
+
+Declare Function D3DXColorAdjustSaturation Lib "dx9abm" Alias "D3DXColorAdjustSaturation_abm" (pOut As *D3DXCOLOR, pC As *D3DXCOLOR, s As Single) As *D3DXCOLOR
+Declare Function D3DXColorAdjustContrast Lib "dx9abm" Alias "D3DXColorAdjustContrast_abm" (pOut As *D3DXCOLOR, pC As *D3DXCOLOR, c As Single) As *D3DXCOLOR
+
+
+'------
+' Misc
+'------
+Declare Function D3DXFresnelTerm Lib "dx9abm" Alias "D3DXFresnelTerm_abm" (CosTheta As Single, RefractionIndex As Single) As Single
+
+
+'--------------
+' Matrix Stack
+'--------------
+Class ID3DXMatrixStack
+	Inherits IUnknown
+Public
+    'ID3DXMatrixStack methods
+	Abstract Function Pop() As DWord
+	Abstract Function Push() As DWord
+	Abstract Function LoadIdentity() As DWord
+	Abstract Function LoadMatrix(pM As *D3DXMATRIX) As DWord
+	Abstract Function MultMatrix(pM As *D3DXMATRIX) As DWord
+	Abstract Function MultMatrixLocal(pM As *D3DXMATRIX) As DWord
+	Abstract Function RotateAxis(pV As *D3DXVECTOR3, Angle As Single) As DWord
+	Abstract Function RotateAxisLocal(pV As *D3DXVECTOR3, Angle As Single) As DWord
+	Abstract Function RotateYawPitchRoll(Yaw As Single, Pitch As Single, Roll As Single) As DWord
+	Abstract Function RotateYawPitchRollLocal(Yaw As Single, Pitch As Single, Roll As Single) As DWord
+	Abstract Function Scale(x As Single, y As Single, z As Single) As DWord
+	Abstract Function ScaleLocal(x As Single, y As Single, z As Single) As DWord
+	Abstract Function Translate(x As Single, y As Single, z As Single) As DWord
+	Abstract Function TranslateLocal(x As Single, y As Single, z As Single) As DWord
+	Abstract Function GetTop() As *D3DXMATRIX
+End Class
+
+Declare Function D3DXCreateMatrixStack Lib "dx9abm" Alias "D3DXCreateMatrixStack_abm" (Flags As DWord, ppStack As **ID3DXMatrixStack) As DWord
Index: /trunk/ab5.0/ablib/src/directx9/d3dx9mesh.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/d3dx9mesh.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/d3dx9mesh.sbp	(revision 506)
@@ -0,0 +1,426 @@
+'d3dx9mesh.sbp
+
+' patch mesh can be quads or tris
+Const Enum D3DXPATCHMESHTYPE
+    D3DXPATCHMESH_RECT   = &H001
+    D3DXPATCHMESH_TRI    = &H002
+    D3DXPATCHMESH_NPATCH = &H003
+
+    D3DXPATCHMESH_FORCE_DWORD    = &H7FFFFFFF
+End Enum
+
+' Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags
+Const Enum D3DXMESH
+    D3DXMESH_32BIT                  = &H001  'If set, then use 32 bit indices, if not set use 16 bit indices.
+	D3DXMESH_DONOTCLIP              = &H002  'Use D3DUSAGE_DONOTCLIP for VB & IB.
+	D3DXMESH_POINTS                 = &H004  'Use D3DUSAGE_POINTS for VB & IB.
+	D3DXMESH_RTPATCHES              = &H008  'Use D3DUSAGE_RTPATCHES for VB & IB.
+	D3DXMESH_NPATCHES               = &H4000 'Use D3DUSAGE_NPATCHES for VB & IB.
+	D3DXMESH_VB_SYSTEMMEM           = &H010  'Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER
+	D3DXMESH_VB_MANAGED             = &H020  'Use D3DPOOL_MANAGED for VB.
+	D3DXMESH_VB_WRITEONLY           = &H040  'Use D3DUSAGE_WRITEONLY for VB.
+	D3DXMESH_VB_DYNAMIC             = &H080  'Use D3DUSAGE_DYNAMIC for VB.
+	D3DXMESH_VB_SOFTWAREPROCESSING  = &H8000 'Use D3DUSAGE_SOFTWAREPROCESSING for VB.
+	D3DXMESH_IB_SYSTEMMEM           = &H100  'Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER
+	D3DXMESH_IB_MANAGED             = &H200  'Use D3DPOOL_MANAGED for IB.
+	D3DXMESH_IB_WRITEONLY           = &H400  'Use D3DUSAGE_WRITEONLY for IB.
+	D3DXMESH_IB_DYNAMIC             = &H800  'Use D3DUSAGE_DYNAMIC for IB.
+	D3DXMESH_IB_SOFTWAREPROCESSING  = &H10000 'Use D3DUSAGE_SOFTWAREPROCESSING for IB.
+
+	D3DXMESH_VB_SHARE               = &H1000  'Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer
+
+	D3DXMESH_USEHWONLY              = &H2000  'Valid for ID3DXSkinInfo::ConvertToBlendedMesh
+
+    'Helper options
+	D3DXMESH_SYSTEMMEM              = &H110  'D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM
+	D3DXMESH_MANAGED                = &H220  'D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED
+	D3DXMESH_WRITEONLY              = &H440  'D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY
+	D3DXMESH_DYNAMIC                = &H880  'D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC
+	D3DXMESH_SOFTWAREPROCESSING     = &H18000  'D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING
+End Enum
+
+' patch mesh options
+Const Enum D3DXPATCHMESH
+    D3DXPATCHMESH_DEFAULT = 000
+End Enum
+
+Const Enum D3DXCLEANTYPE
+	D3DXCLEAN_BACKFACING	= &H00000001
+	D3DXCLEAN_BOWTIES		= &H00000002
+
+	' Helper options
+	D3DXCLEAN_SKINNING		= &H00000001	' Bowtie cleaning modifies geometry and breaks skinning
+	D3DXCLEAN_OPTIMIZATION	= &H00000001
+	D3DXCLEAN_SIMPLIFICATION= &H00000003
+End Enum
+
+Type D3DXATTRIBUTERANGE
+	AttribId As DWord
+	FaceStart As DWord
+	FaceCount As DWord
+	VertexStart As DWord
+	VertexCount As DWord
+End Type
+
+Type D3DXMATERIAL
+	MatD3D As D3DMATERIAL9
+	pTextureFilename As BytePtr
+End Type
+
+Const Enum D3DXEFFECTDEFAULTTYPE
+    D3DXEDT_STRING = &H1       ' pValue points to a null terminated ASCII string
+    D3DXEDT_FLOATS = &H2       ' pValue points to an array of floats - number of floats is NumBytes / sizeof(float)
+    D3DXEDT_DWORD  = &H3       ' pValue points to a DWORD
+
+    D3DXEDT_FORCEDWORD = &H7FFFFFFF
+End Enum
+
+Type D3DXEFFECTDEFAULT
+	pParamName As BytePtr
+	_Type As D3DXEFFECTDEFAULTTYPE
+	NumBytes As DWord
+	pValue As VoidPtr
+End Type
+
+Type D3DXEFFECTINSTANCE
+	pEffectFilename As BytePtr
+	NumDefaults As DWord
+	pDefaults As *D3DXEFFECTDEFAULT
+End Type
+
+Type D3DXATTRIBUTEWEIGHTS
+	Position As Single
+	Boundary As Single
+	Normal As Single
+	Diffuse As Single
+	Specular As Single
+	Texcoord[7] As Single
+	Tangent As Single
+	Binormal As Single
+End Type
+
+Type D3DXWELDEPSILONS
+	Position As Single
+	BlendWeights As Single
+	Normal As Single
+	PSize As Single
+	Specular As Single
+	Diffuse As Single
+	Texcoord[7] As Single
+	Tangent As Single
+	Binormal As Single
+	TessFactor As Single
+End Type
+
+
+Class ID3DXBaseMesh
+	Inherits IUnknown
+Public
+    'ID3DXBaseMesh
+	Abstract Function DrawSubset(AttribId As DWord) As DWord
+	Abstract Function GetNumFaces() As DWord
+	Abstract Function GetNumVertices() As DWord
+	Abstract Function GetFVF() As DWord
+	Abstract Function GetDeclaration(Declaration As *D3DVERTEXELEMENT9) As DWord
+	Abstract Function GetNumBytesPerVertex() As DWord
+	Abstract Function GetOptions() As DWord
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Abstract Function CloneMeshFVF(Options As DWord, FVF As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function CloneMesh(Options As DWord, pDeclaration As *D3DVERTEXELEMENT9, pD3DDevice As LPDIRECT3DDEVICE9, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function GetVertexBuffer(ppVB As **IDirect3DVertexBuffer9) As DWord
+	Abstract Function GetIndexBuffer(ppIB As **IDirect3DIndexBuffer9) As DWord
+	Abstract Function LockVertexBuffer(Flags As DWord, ppData As VoidPtr) As DWord
+	Abstract Function UnlockVertexBuffer() As DWord
+	Abstract Function LockIndexBuffer(Flags As DWord, ppData As VoidPtr) As DWord
+	Abstract Function UnlockIndexBuffer() As DWord
+	Abstract Function GetAttributeTable(pAttribTable As *D3DXATTRIBUTERANGE, pAttribTableSize As DWordPtr) As DWord
+
+	Abstract Function ConvertPointRepsToAdjacency(pPRep As DWordPtr, pAdjacency As DWordPtr) As DWord
+	Abstract Function ConvertAdjacencyToPointReps(pAdjacency As DWordPtr, pPRep As DWordPtr) As DWord
+	Abstract Function GenerateAdjacency(Epsilon As Single, pAdjacency As DWordPtr) As DWord
+
+	Abstract Function UpdateSemantics(Declaration As *D3DVERTEXELEMENT9) As DWord
+End Class
+TypeDef LPD3DXBASEMESH = *ID3DXBaseMesh
+
+
+Class ID3DXMesh
+	Inherits IUnknown
+Public
+    'ID3DXBaseMesh
+	Abstract Function DrawSubset(AttribId As DWord) As DWord
+	Abstract Function GetNumFaces() As DWord
+	Abstract Function GetNumVertices() As DWord
+	Abstract Function GetFVF() As DWord
+	Abstract Function GetDeclaration(Declaration As *D3DVERTEXELEMENT9) As DWord
+	Abstract Function GetNumBytesPerVertex() As DWord
+	Abstract Function GetOptions() As DWord
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Abstract Function CloneMeshFVF(Options As DWord, FVF As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function CloneMesh(Options As DWord, pDeclaration As *D3DVERTEXELEMENT9, pD3DDevice As LPDIRECT3DDEVICE9, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function GetVertexBuffer(ppVB As **IDirect3DVertexBuffer9) As DWord
+	Abstract Function GetIndexBuffer(ppIB As **IDirect3DIndexBuffer9) As DWord
+	Abstract Function LockVertexBuffer(Flags As DWord, ppData As VoidPtr) As DWord
+	Abstract Function UnlockVertexBuffer() As DWord
+	Abstract Function LockIndexBuffer(Flags As DWord, ppData As VoidPtr) As DWord
+	Abstract Function UnlockIndexBuffer() As DWord
+	Abstract Function GetAttributeTable(pAttribTable As *D3DXATTRIBUTERANGE, pAttribTableSize As DWordPtr) As DWord
+
+	Abstract Function ConvertPointRepsToAdjacency(pPRep As DWordPtr, pAdjacency As DWordPtr) As DWord
+	Abstract Function ConvertAdjacencyToPointReps(pAdjacency As DWordPtr, pPRep As DWordPtr) As DWord
+	Abstract Function GenerateAdjacency(Epsilon As Single, pAdjacency As DWordPtr) As DWord
+
+	Abstract Function UpdateSemantics(Declaration As *D3DVERTEXELEMENT9) As DWord
+
+    'ID3DXMesh
+	Abstract Function LockAttributeBuffer(Flags As DWord, ppData As VoidPtr) As DWord
+	Abstract Function UnlockAttributeBuffer() As DWord
+	Abstract Function Optimize(Flags As DWord, pAdjacencyIn As DWordPtr, pAdjacencyOut As DWordPtr, pFaceRemap As DWordPtr, ppVertexRemap As **ID3DXBuffer, ppOptMesh As **ID3DXMesh) As DWord
+	Abstract Function OptimizeInplace(Flags As DWord, pAdjacencyIn As DWordPtr, pAdjacencyOut As DWordPtr, pFaceRemap As DWordPtr, ppVertexRemap As **ID3DXBuffer) As DWord
+	Abstract Function SetAttributeTable(pAttribTable As *D3DXATTRIBUTERANGE, cAttribTableSize As DWord) As DWord
+End Class
+TypeDef LPD3DXMESH = *ID3DXMesh
+
+
+Class ID3DXPMesh
+	Inherits IUnknown
+Public
+    'ID3DXBaseMesh
+	Abstract Function DrawSubset(AttribId As DWord) As DWord
+	Abstract Function GetNumFaces() As DWord
+	Abstract Function GetNumVertices() As DWord
+	Abstract Function GetFVF() As DWord
+	Abstract Function GetDeclaration(Declaration As *D3DVERTEXELEMENT9) As DWord
+	Abstract Function GetNumBytesPerVertex() As DWord
+	Abstract Function GetOptions() As DWord
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Abstract Function CloneMeshFVF(Options As DWord, FVF As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function CloneMesh(Options As DWord, pDeclaration As *D3DVERTEXELEMENT9, pD3DDevice As LPDIRECT3DDEVICE9, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function GetVertexBuffer(ppVB As **IDirect3DVertexBuffer9) As DWord
+	Abstract Function GetIndexBuffer(ppIB As **IDirect3DIndexBuffer9) As DWord
+	Abstract Function LockVertexBuffer(Flags As DWord, ppData As VoidPtr) As DWord
+	Abstract Function UnlockVertexBuffer() As DWord
+	Abstract Function LockIndexBuffer(Flags As DWord, ppData As VoidPtr) As DWord
+	Abstract Function UnlockIndexBuffer() As DWord
+	Abstract Function GetAttributeTable(pAttribTable As *D3DXATTRIBUTERANGE, pAttribTableSize As DWordPtr) As DWord
+
+	Abstract Function ConvertPointRepsToAdjacency(pPRep As DWordPtr, pAdjacency As DWordPtr) As DWord
+	Abstract Function ConvertAdjacencyToPointReps(pAdjacency As DWordPtr, pPRep As DWordPtr) As DWord
+	Abstract Function GenerateAdjacency(Epsilon As Single, pAdjacency As DWordPtr) As DWord
+
+	Abstract Function UpdateSemantics(Declaration As *D3DVERTEXELEMENT9) As DWord
+
+    'ID3DXPMesh
+	Abstract Function ClonePMeshFVF(Options As DWord, FVF As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function ClonePMesh(Options As DWord, pDeclaration As *D3DVERTEXELEMENT9, pD3DDevice As LPDIRECT3DDEVICE9, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function SetNumFaces(Faces As DWord) As DWord
+	Abstract Function SetNumVertices(Vertices As DWord) As DWord
+	Abstract Function GetMaxFaces() As DWord
+	Abstract Function GetMinFaces() As DWord
+	Abstract Function GetMaxVertices() As DWord
+	Abstract Function GetMinVertices() As DWord
+	Abstract Function Save(pStream As *IStream, pMaterials As *D3DXMATERIAL, pEffectInstances As *D3DXEFFECTINSTANCE, NumMaterials As DWord) As DWord
+	Abstract Function Optimize(Flags As DWord, pAdjacencyOut As DWordPtr, pFaceRemap As DWordPtr, ppVertexRemap As **ID3DXBuffer, ppOptMesh As **ID3DXMesh) As DWord
+	Abstract Function OptimizeBaseLOD(Flags As DWord, pFaceRemap As DWordPtr) As DWord
+	Abstract Function TrimByFaces(NewFacesMin As DWord, NewFacesMax As DWord, rgiFaceRemap As DWordPtr, rgiVertRemap As DWordPtr) As DWord
+	Abstract Function TrimByVertices(NewVerticesMin As DWord, NewVerticesMax As DWord, rgiFaceRemap As DWordPtr, rgiVertRemap As DWord) As DWord
+	Abstract Function GetAdjacency(pAdjacency As DWordPtr) As DWord
+	Abstract Function GenerateVertexHistory(pVertexHistory As DWordPtr) As DWord
+End Class
+TypeDef LPD3DXPMESH = *ID3DXPMesh
+
+
+Class ID3DXSPMesh
+	Inherits IUnknown
+Public
+    'ID3DXSPMesh
+	Abstract Function GetNumFaces() As DWord
+	Abstract Function GetNumVertices() As DWord
+	Abstract Function GetFVF() As DWord
+	Abstract Function GetDeclaration(Declaration As *D3DVERTEXELEMENT9) As DWord
+	Abstract Function GetOptions() As DWord
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Abstract Function CloneMeshFVF(Options As DWord, FVF As DWord, pD3DDevice As LPDIRECT3DDEVICE9, pAdjacencyOut As DWordPtr, pVertexRemapOut As DWordPtr, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function CloneMesh(Options As DWord, pDeclaration As *D3DVERTEXELEMENT9, pD3DDevice As LPDIRECT3DDEVICE9, pAdjacencyOut As DWordPtr, pVertexRemapOut As DWordPtr, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function ClonePMeshFVF(Options As DWord, FVF As DWord, pD3DDevice As LPDIRECT3DDEVICE9, pVertexRemapOut As DWordPtr, pErrorsByFace As SinglePtr, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function ClonePMesh(Options As DWord, pDeclaration As *D3DVERTEXELEMENT9, pD3DDevice As LPDIRECT3DDEVICE9, pVertexRemapOut As DWordPtr, pErrorsbyFace As SinglePtr, ppCloneMesh As **ID3DXMesh) As DWord
+	Abstract Function ReduceFaces(Faces As DWord) As DWord
+	Abstract Function ReduceVertices(Vertices As DWord) As DWord
+	Abstract Function GetMaxFaces() As DWord
+	Abstract Function GetMaxVertices() As DWord
+	Abstract Function GetVertexAttributeWeights(pVertexAttributeWeights As *D3DXATTRIBUTEWEIGHTS) As DWord
+	Abstract Function GetVertexWeights(pVertexWeights As SinglePtr) As DWord
+End Class
+TypeDef LPD3DXSPMESH = *ID3DXSPMesh
+
+
+' Subset of the mesh that has the same attribute and bone combination.
+' This subset can be rendered in a single draw call
+Type D3DXBONECOMBINATION
+	AttribId As DWord
+	FaceStart As DWord
+	FaceCount As DWord
+	VertexStart As DWord
+	VertexCount As DWord
+	BoneId As DWordPtr
+End Type
+
+Type D3DXPATCHINFO
+	PatchType As D3DXPATCHMESHTYPE
+	Degree As D3DDEGREETYPE
+	Basis As D3DBASISTYPE
+End Type
+
+
+Class ID3DXPatchMesh
+	Inherits IUnknown
+Public
+	'ID3DXPatchMesh
+
+	'Return creation parameters
+	Abstract Function GetNumPatches() As DWord
+	Abstract Function GetNumVertices() As DWord
+	Abstract Function GetDeclaration(Declaration As *D3DVERTEXELEMENT9) As DWord
+	Abstract Function GetControlVerticesPerPatch() As DWord
+	Abstract Function GetOptions() As DWord
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Abstract Function GetPatchInfo(PatchInfo As *D3DXPATCHINFO) As DWord
+
+	'Control mesh access
+	Abstract Function GetVertexBuffer(ppVB As **IDirect3DVertexBuffer9) As DWord
+	Abstract Function GetIndexBuffer(ppIB As **IDirect3DIndexBuffer9) As DWord
+	Abstract Function LockVertexBuffer(flags As DWord, ppData As DWordPtr) As DWord
+	Abstract Function UnlockVertexBuffer() As DWord
+	Abstract Function LockIndexBuffer(flags As DWord, ppData As DWordPtr) As DWord
+	Abstract Function UnlockIndexBuffer() As DWord
+	Abstract Function LockAttributeBuffer(flags As DWord, ppData As DWordPtr) As DWord
+	Abstract Function UnlockAttributeBuffer() As DWord
+
+	Abstract Function GetTessSize(fTessLevel As Single, Adaptive As DWord, NumTriangles As DWordPtr, NumVertices As DWordPtr) As DWord
+	Abstract Function GenerateAdjacency(Tolerance As Single) As DWord
+	Abstract Function CloneMesh(Options As DWord, pDecl As *D3DVERTEXELEMENT9, pMesh As *ID3DXPatchMesh) As DWord
+	Abstract Function Optimize(flags As DWord) As DWord
+	Abstract Function SetDisplaceParam(pTexture As *IDirect3DBaseTexture9, MinFilter As D3DTEXTUREFILTERTYPE, MagFilter As D3DTEXTUREFILTERTYPE, MipFilter As D3DTEXTUREFILTERTYPE, Wrap As D3DTEXTUREADDRESS, dwLODBias As DWord) As DWord
+	Abstract Function GetDisplaceParam(ppTexture As **IDirect3DBaseTexture9, pMinFilter As *D3DTEXTUREFILTERTYPE, pMagFilter As *D3DTEXTUREFILTERTYPE, pMipFilter As *D3DTEXTUREFILTERTYPE, pWrap As *D3DTEXTUREADDRESS, lpdwLODBias As DWordPtr) As DWord
+	Abstract Function Tessellate(fTessLevel As Single, pMesh As *ID3DXMesh) As DWord
+	Abstract Function TessellateAdaptive(pTrans As *D3DXVECTOR4, dwMaxTessLevel As DWord, dwMinTessLevel As DWord, pMesh As *ID3DXMesh) As DWord
+End Class
+TypeDef LPD3DXPATCHMESH = *ID3DXPatchMesh
+
+
+'---------------
+' ID3DXSkinInfo
+'---------------
+
+Class ID3DXSkinInfo
+	Inherits IUnknown
+Public
+	'Specify the which vertices do each bones influence and by how much
+	Abstract Function SetBoneInfluence(bone As DWord, numInfluences As DWord, vertices As DWordPtr, weights As SinglePtr) As DWord
+	Abstract Function SetBoneVertexInfluence(boneNum As DWord, influenceNum As DWord, weight As Single) As DWord
+	Abstract Function GetNumBoneInfluences(bone As DWord) As DWord
+	Abstract Function GetBoneInfluence(bone As DWord, vertices As DWordPtr, weights As SinglePtr) As DWord
+	Abstract Function GetBoneVertexInfluence(boneNum As DWord, influenceNum As DWord, pWeight As SinglePtr, pVertexNum As DWordPtr) As DWord
+	Abstract Function GetMaxVertexInfluences(maxVertexInfluences As DWordPtr) As DWord
+	Abstract Function GetNumBones() As DWord
+	Abstract Function FindBoneVertexInfluenceIndex(boneNum As DWord, vertexNum As DWord, pInfluenceIndex As DWordPtr) As DWord
+
+	'This gets the max face influences based on a triangle mesh with the specified index buffer
+	Abstract Function GetMaxFaceInfluences(pIB As *IDirect3DIndexBuffer9, NumFaces As DWord, maxFaceInfluences As DWordPtr) As DWord
+
+	'Set min bone influence. Bone influences that are smaller than this are ignored
+	Abstract Function SetMinBoneInfluence(MinInfl As Single) As DWord
+	'Get min bone influence.
+	Abstract Function GetMinBoneInfluence() As Single
+
+	'Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object
+	Abstract Function SetBoneName(Bone As DWord, pName As BytePtr) As DWord
+	Abstract Function GetBoneName(Bone As DWord) As BytePtr
+
+	'Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object
+	Abstract Function SetBoneOffsetMatrix(Bone As DWord, pBoneTransform As *D3DXMATRIX) As DWord
+	Abstract Function GetBoneOffsetMatrix(Bone As DWord) As *D3DXMATRIX
+
+	'Clone a skin info object
+	Abstract Function Clone(ppSkinInfo As **ID3DXSkinInfo) As DWord
+
+	'Update bone influence information to match vertices after they are reordered. This should be called
+	'if the target vertex buffer has been reordered externally.
+	Abstract Function Remap(NumVertices As DWord, pVertexRemap As DWordPtr) As DWord
+
+	'These methods enable the modification of the vertex layout of the vertices that will be skinned
+	Abstract Function SetFVF(FVF As DWord) As DWord
+	Abstract Function SetDeclaration(pDeclaration As *D3DVERTEXELEMENT9) As DWord
+	Abstract Function GetFVF() As DWord
+	Abstract Function GetDeclaration(Declaration As *D3DVERTEXELEMENT9) As DWord
+
+	'Apply SW skinning based on current pose matrices to the target vertices.
+	Abstract Function UpdateSkinnedMesh(pBoneTransforms As *D3DXMATRIX, pBoneInvTransposeTransforms As *D3DXMATRIX, pVerticesSrc As VoidPtr, pVerticesDst As VoidPtr) As DWord
+
+	'Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination
+	'table that describes which bones affect which subsets of the mesh
+	Abstract Function ConvertToBlendedMesh(pMesh As *ID3DXMesh, Options As DWord, pAdjacencyIn As DWordPtr, pAdjacencyOut As DWordPtr, pFaceRemap As DWordPtr, ppVertexRemap As **ID3DXBuffer, pMaxFaceInfl As DWordPtr, pNumBoneCombinations As DWordPtr, ppBoneCombinationTable As **ID3DXBuffer, ppMesh As **ID3DXMesh) As DWord
+
+	'Takes a mesh and returns a new mesh with per vertex blend weights and indices
+	'and a bone combination table that describes which bones palettes affect which subsets of the mesh
+	Abstract Function ConvertToIndexedBlendedMesh(pMesh As *ID3DXMesh, Options As DWord, paletteSize As DWord, pAdjacencyIn As DWordPtr, pAdjacencyOut As DWordPtr, pFaceRemap As DWordPtr, ppVertexRemap As **ID3DXBuffer, pMaxVertexInfl As DWordPtr, pNumBoneCombinations As DWordPtr, ppBoneCombinationTable As **ID3DXBuffer, ppMesh As **ID3DXMesh) As DWord
+End Class
+TypeDef LPD3DXSKININFO = *ID3DXSkinInfo
+
+Declare Function D3DXCreateMesh Lib "dx9abm" Alias "D3DXCreateMesh_abm" (NumFaces As DWord, NumVertices As DWord, Options As DWord, pDeclaration As *D3DVERTEXELEMENT9, pD3DDevice As LPDIRECT3DDEVICE9, ppMesh As **ID3DXMesh) As DWord
+Declare Function D3DXCreateMeshFVF Lib "dx9abm" Alias "D3DXCreateMeshFVF_abm" (NumFaces As DWord, NumVertices As DWord, Options As DWord, FVF As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppMesh As **ID3DXMesh) As DWord
+Declare Function D3DXCreateSPMesh Lib "dx9abm" Alias "D3DXCreateSPMesh_abm" (pMesh As *ID3DXMesh, pAdjacency As DWordPtr, pVertexAttributeWeights As *D3DXATTRIBUTEWEIGHTS, ppSMesh As **ID3DXSPMesh) As DWord
+Declare Function D3DXCleanMesh Lib "dx9abm" Alias "D3DXCleanMesh_abm" (CleanType As D3DXCLEANTYPE, pMeshIn As *ID3DXMesh, pAdjacencyIn As DWordPtr, ppMeshOut As **ID3DXMesh, pAdjacencyOut As DWordPtr, ppErrorsAndWarnings As **ID3DXBuffer) As DWord
+Declare Function D3DXValidMesh Lib "dx9abm" Alias "D3DXValidMesh_abm" (pMeshIn As *ID3DXMesh, pAdjacency As DWordPtr, ppErrorsAndWarnings As **ID3DXBuffer) As DWord
+Declare Function D3DXGeneratePMesh Lib "dx9abm" Alias "D3DXGeneratePMesh_abm" (pMesh As *ID3DXMesh, pAdjacency As DWordPtr, pVertexAttributeWeights As *D3DXATTRIBUTEWEIGHTS, MinValue As DWord, Options As DWord, ppPMesh As **ID3DXPMesh) As DWord
+Declare Function D3DXSimplifyMesh Lib "dx9abm" Alias "D3DXSimplifyMesh_abm" (pMesh As *ID3DXMesh, pAdjacency As DWordPtr, pVertexAttributeWeights As *D3DXATTRIBUTEWEIGHTS, pVertexWeights As SinglePtr, MinValue As DWord, Options As DWord, ppMesh As **ID3DXMesh) As DWord
+Declare Function D3DXComputeBoundingSphere Lib "dx9abm" Alias "D3DXComputeBoundingSphere_abm" (pFirstPosition As *D3DXVECTOR3, NumVertices As DWord, dwStride As DWord, pCenter As *D3DXVECTOR3, pRadius As SinglePtr) As DWord
+Declare Function D3DXComputeBoundingBox Lib "dx9abm" Alias "D3DXComputeBoundingBox_abm" (pFirstPosition As *D3DXVECTOR3, NumVertices As DWord, dwStride As DWord, pMin As *D3DXVECTOR3, pMax As *D3DXVECTOR3) As DWord
+Declare Function D3DXComputeNormals Lib "dx9abm" Alias "D3DXComputeNormals_abm" (pMesh As *ID3DXBaseMesh, pAdjacency As DWordPtr) As DWord
+Declare Function D3DXCreateBuffer Lib "dx9abm" Alias "D3DXCreateBuffer_abm" (NumBytes As DWord, ppBuffer As **ID3DXBuffer) As DWord
+Declare Function D3DXLoadMeshFromX Lib "dx9abm" Alias "D3DXLoadMeshFromX_abm" (pFilename As BytePtr, Options As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppAdjacency As VoidPtr, ppMaterials As VoidPtr, ppEffectInstances As VoidPtr, pNumMaterials As DWordPtr, ppMesh As VoidPtr) As DWord
+Declare Function D3DXLoadMeshFromXInMemory Lib "dx9abm" Alias "D3DXLoadMeshFromXInMemory_abm" (Memory As VoidPtr, SizeOfMemory As DWord, Options As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppAdjacency As **ID3DXBuffer, ppMaterials As **ID3DXBuffer, ppEffectInstances As **ID3DXBuffer, pNumMaterials As DWordPtr, ppMesh As *ID3DXMesh) As DWord
+Declare Function D3DXLoadMeshFromXResource Lib "dx9abm" Alias "D3DXLoadMeshFromXResource_abm" (Module As DWord, Name As BytePtr, lpszType As BytePtr, Options As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppAdjacency As **ID3DXBuffer, ppMaterials As **ID3DXBuffer, ppEffectInstances As **ID3DXBuffer, pNumMaterials As DWordPtr, ppMesh As **ID3DXMesh) As DWord
+Declare Function D3DXSaveMeshToX Lib "dx9abm" Alias "D3DXSaveMeshToX_abm" (pFilename As BytePtr, pMesh As *ID3DXMesh, pAdjacency As DWordPtr, pMaterials As *D3DXMATERIAL, pEffectInstances As *D3DXEFFECTINSTANCE, NumMaterials As DWord, Format As DWord) As DWord
+Declare Function D3DXCreatePMeshFromStream Lib "dx9abm" Alias "D3DXCreatePMeshFromStream_abm" (pStream As *IStream, Options As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppMaterials As **ID3DXBuffer, ppEffectInstances As **ID3DXBuffer, pNumMaterials As DWordPtr, ppPMesh As **ID3DXPMesh) As DWord
+Declare Function D3DXCreateSkinInfo Lib "dx9abm" Alias "D3DXCreateSkinInfo_abm" (NumVertices As DWord, pDeclaration As *D3DVERTEXELEMENT9, NumBones As DWord, ppSkinInfo As **ID3DXSkinInfo) As DWord
+Declare Function D3DXCreateSkinInfoFVF Lib "dx9abm" Alias "D3DXCreateSkinInfoFVF_abm" (NumVertices As DWord, FVF As DWord, NumBones As DWord, ppSkinInfo As **ID3DXSkinInfo) As DWord
+
+Declare Function D3DXLoadMeshFromXof Lib "dx9abm" Alias "D3DXLoadMeshFromXof_abm" (pxofMesh As *ID3DXFileData, Options As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppAdjacency As **ID3DXBuffer, ppMaterials As **ID3DXBuffer, ppEffectInstances As **ID3DXBuffer, pNumMaterials As DWordPtr, ppMesh As **ID3DXMesh) As DWord
+Declare Function D3DXLoadSkinMeshFromXof Lib "dx9abm" Alias "D3DXLoadSkinMeshFromXof_abm" (pxofMesh As *ID3DXFileData, Options As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppAdjacency As **ID3DXBuffer, ppMaterials As **ID3DXBuffer, ppEffectInstances As **ID3DXBuffer, pMatOut As DWordPtr, ppSkinInfo As **ID3DXSkinInfo, ppMesh As **ID3DXMesh) As DWord
+Declare Function D3DXCreateSkinInfoFromBlendedMesh Lib "dx9abm" Alias "D3DXCreateSkinInfoFromBlendedMesh_abm" (pMesh As *ID3DXBaseMesh, NumBones As DWord, pBoneCombinationTable As *D3DXBONECOMBINATION, ppSkinInfo As **ID3DXSkinInfo) As DWord
+Declare Function D3DXTessellateNPatches Lib "dx9abm" Alias "D3DXTessellateNPatches_abm" (pMeshIn As *ID3DXMesh, pAdjacencyIn As DWordPtr, NumSegs As Single, QuadraticInterpNormals As Long, ppMeshOut As **ID3DXMesh, ppAdjacencyOut As **ID3DXBuffer) As DWord
+Declare Function D3DXGenerateOutputDecl Lib "dx9abm" Alias "D3DXGenerateOutputDecl_abm" (pOutput As *D3DVERTEXELEMENT9, pInput As *D3DVERTEXELEMENT9) As DWord
+Declare Function D3DXLoadPatchMeshFromXof Lib "dx9abm" Alias "D3DXLoadPatchMeshFromXof_abm" (pXofObjMesh As *ID3DXFileData, Options As DWord, pD3DDevice As LPDIRECT3DDEVICE9, ppMaterials As **ID3DXBuffer, ppEffectInstances As **ID3DXBuffer, pNumMaterials As DWordPtr, ppMesh As **ID3DXPatchMesh) As DWord
+Declare Function D3DXRectPatchSize Lib "dx9abm" Alias "D3DXRectPatchSize_abm" (pfNumSegs As SinglePtr, pdwTriangles As DWordPtr, pdwVertices As DWordPtr) As DWord
+Declare Function D3DXTriPatchSize Lib "dx9abm" Alias "D3DXTriPatchSize_abm" (pfNumSegs As SinglePtr, pdwTriangles As DWordPtr, pdwVertices As DWordPtr) As DWord
+Declare Function D3DXTessellateRectPatch Lib "dx9abm" Alias "D3DXTessellateRectPatch_abm" (pVB As *IDirect3DVertexBuffer9, pNumSegs As SinglePtr, pdwInDecl As *D3DVERTEXELEMENT9, pRectPatchInfo As *D3DRECTPATCH_INFO, pMesh As *ID3DXMesh) As DWord
+Declare Function D3DXTessellateTriPatch Lib "dx9abm" Alias "D3DXTessellateTriPatch_abm" (pVB As *IDirect3DVertexBuffer9, pNumSegs As SinglePtr, pInDecl As *D3DVERTEXELEMENT9, pTriPatchInfo As *D3DTRIPATCH_INFO, pMesh As *ID3DXMesh) As DWord
+Declare Function D3DXCreateNPatchMesh Lib "dx9abm" Alias "D3DXCreateNPatchMesh_abm" (pMeshSysMem As *ID3DXMesh, pPatchMesh As *ID3DXPatchMesh) As DWord
+Declare Function D3DXCreatePatchMesh Lib "dx9abm" Alias "D3DXCreatePatchMesh_abm" (pInfo As *D3DXPATCHINFO, dwNumPatches As DWord, dwNumVertices As DWord, dwOptions As DWord, pDecl As *D3DVERTEXELEMENT9, pD3DDevice As LPDIRECT3DDEVICE9, pPatchMesh As *ID3DXPatchMesh) As DWord
+Declare Function D3DXValidPatchMesh Lib "dx9abm" Alias "D3DXValidPatchMesh_abm" (pMesh As *ID3DXPatchMesh, dwcDegenerateVertices As DWord, dwcDegeneratePatches As DWord, ppErrorsAndWarnings As **ID3DXBuffer) As DWord
+Declare Function D3DXGetFVFVertexSize Lib "dx9abm" Alias "D3DXGetFVFVertexSize_abm" (FVF As DWord) As DWord
+Declare Function D3DXGetDeclVertexSize Lib "dx9abm" Alias "D3DXGetDeclVertexSize_abm" (pDecl As *D3DVERTEXELEMENT9, Stream As DWord) As DWord
+Declare Function D3DXGetDeclLength Lib "dx9abm" Alias "D3DXGetDeclLength_abm" (pDecl As *D3DVERTEXELEMENT9) As DWord
+Declare Function D3DXDeclaratorFromFVF Lib "dx9abm" Alias "D3DXDeclaratorFromFVF_abm" (FVF As DWord, pDeclarator As *D3DVERTEXELEMENT9) As DWord
+Declare Function D3DXFVFFromDeclarator Lib "dx9abm" Alias "D3DXFVFFromDeclarator_abm" (pDeclarator As *D3DVERTEXELEMENT9, pFVF As DWordPtr) As DWord
+Declare Function D3DXWeldVertices Lib "dx9abm" Alias "D3DXWeldVertices_abm" (pMesh As *ID3DXMesh, Flags As DWord, pEpsilons As *D3DXWELDEPSILONS, pAdjacencyOut As DWord, pFaceRemap As DWordPtr, ppVertexRemap As **ID3DXBuffer) As DWord
+
+Type D3DXINTERSECTINFO
+	FaceIndex As DWord
+	U As Single
+	V As Single
+	Dist As Single
+End Type
+
+Declare Function D3DXIntersect Lib "dx9abm" Alias "D3DXIntersect_abm" (pMesh As *ID3DXBaseMesh, pRayPos As *D3DXVECTOR3, pRayDir As *D3DXVECTOR3, pHit As DWordPtr, pFaceIndex As DWordPtr, pU As SinglePtr, pV As SinglePtr, pDist As SinglePtr, ppAllHits As **ID3DXBuffer, pCountOfHits As DWordPtr) As DWord
+Declare Function D3DXIntersectSubset Lib "dx9abm" Alias "D3DXIntersectSubset_abm" (pMesh As *ID3DXBaseMesh, AttribId As DWord, pRayPos As *D3DXVECTOR3, pRayDir As *D3DXVECTOR3, pHit As DWordPtr, pFaceIndex As DWordPtr, pU As SinglePtr, pV As SinglePtr, pDist As SinglePtr, ppAllHits As **ID3DXBuffer, pCountOfHits As DWordPtr) As DWord
+Declare Function D3DXSplitMesh Lib "dx9abm" Alias "D3DXSplitMesh_abm" (pMeshIn As *ID3DXMesh, pAdjacencyIn As DWord, MaxSize As DWord, Options As DWord, pMeshesOut As DWordPtr, ppMeshArrayOut As **ID3DXBuffer, ppAdjacencyArrayOut As **ID3DXBuffer, ppFaceRemapArrayOut As **ID3DXBuffer, ppVertRemapArrayOut As **ID3DXBuffer) As DWord
+Declare Function D3DXIntersectTri Lib "dx9abm" Alias "D3DXIntersectTri_abm" (p0 As *D3DXVECTOR3, p1 As *D3DXVECTOR3, p2 As *D3DXVECTOR3, pRayPos As *D3DXVECTOR3, pRayDir As *D3DXVECTOR3, pU As SinglePtr, pV As SinglePtr, pDist As SinglePtr) As Long
+Declare Function D3DXSphereBoundProbe Lib "dx9abm" Alias "D3DXSphereBoundProbe_abm" (pCenter As *D3DXVECTOR3, Radius As Single, pRayPos As *D3DXVECTOR3, pRayDir As *D3DXVECTOR3) As Long
+Declare Function D3DXBoxBoundProbe Lib "dx9abm" Alias "D3DXBoxBoundProbe_abm" (pMin As *D3DXVECTOR3, pMax As *D3DXVECTOR3, pRayPos As *D3DXVECTOR3, pRayDir As *D3DXVECTOR3) As Long
+Declare Function D3DXComputeTangent Lib "dx9abm" Alias "D3DXComputeTangent_abm" (pMesh As *ID3DXMesh, TexStage As DWord, TangentIndex As DWord, BinormIndex As DWord, Wrap As DWord, pAdjacency As DWordPtr) As DWord
+Declare Function D3DXConvertMeshSubsetToSingleStrip Lib "dx9abm" Alias "D3DXConvertMeshSubsetToSingleStrip_abm" (pMeshIn As *ID3DXBaseMesh, AttribId As DWord, IBOptions As DWord, ppIndexBuffer As **IDirect3DIndexBuffer9, pNumIndices As DWordPtr) As DWord
+Declare Function D3DXConvertMeshSubsetToStrips Lib "dx9abm" Alias "D3DXConvertMeshSubsetToStrips_abm" (pMeshIn As *ID3DXBaseMesh, AttribId As DWord, IBOptions As DWord, ppIndexBuffer As **IDirect3DIndexBuffer9, pNumIndices As DWordPtr, ppStripLengths As **ID3DXBuffer, pNumStrips As DWordPtr) As DWord
+Declare Function D3DXOptimizeFaces Lib "dx9abm" Alias "D3DXOptimizeFaces_abm" (pbIndices As VoidPtr, cFaces As DWord, cVertices As DWord, b32BitIndices As Long, pFaceRemap As DWordPtr) As DWord
+Declare Function D3DXOptimizeVertices Lib "dx9abm" Alias "D3DXOptimizeVertices_abm" (pbIndices As VoidPtr, cFaces As DWord, cVertices As DWord, b32BitIndices As Long, pFaceRemap As DWordPtr) As DWord
Index: /trunk/ab5.0/ablib/src/directx9/d3dx9shader.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/d3dx9shader.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/d3dx9shader.sbp	(revision 506)
@@ -0,0 +1,213 @@
+' d3dx9shader.sbp
+
+TypeDef D3DXHANDLE = BytePtr
+
+
+Type D3DXMACRO
+	Name As BytePtr
+	Definition As BytePtr
+End Type
+
+Type D3DXSEMANTIC
+	Usage As DWord
+	UsageIndex As DWord
+End Type
+
+Type D3DXFRAGMENT_DESC
+	Name As BytePtr
+	Target As DWord
+End Type
+
+Const Enum D3DXREGISTER_SET
+	D3DXRS_BOOL        = 0
+	D3DXRS_INT4        = 1
+	D3DXRS_FLOAT4      = 2
+	D3DXRS_SAMPLER     = 3
+	D3DXRS_FORCE_DWORD = &H7FFFFFFF
+End Enum
+
+Const Enum D3DXPARAMETER_CLASS
+	D3DXPC_SCALAR         = 0
+	D3DXPC_VECTOR         = 1
+	D3DXPC_MATRIX_ROWS    = 2
+	D3DXPC_MATRIX_COLUMNS = 3
+	D3DXPC_OBJECT         = 4
+	D3DXPC_STRUCT         = 5
+	D3DXPC_FORCE_DWORD    = &H7FFFFFFF
+End Enum
+
+Const Enum D3DXPARAMETER_TYPE
+	D3DXPT_VOID           = 0
+	D3DXPT_BOOL           = 1
+	D3DXPT_INT            = 2
+	D3DXPT_FLOAT          = 3
+	D3DXPT_STRING         = 4
+	D3DXPT_TEXTURE        = 5
+	D3DXPT_TEXTURE1D      = 6
+	D3DXPT_TEXTURE2D      = 7
+	D3DXPT_TEXTURE3D      = 8
+	D3DXPT_TEXTURECUBE    = 9
+	D3DXPT_SAMPLER        = 10
+	D3DXPT_SAMPLER1D      = 11
+	D3DXPT_SAMPLER2D      = 12
+	D3DXPT_SAMPLER3D      = 13
+	D3DXPT_SAMPLERCUBE    = 14
+	D3DXPT_PIXELSHADER    = 15
+	D3DXPT_VERTEXSHADER   = 16
+	D3DXPT_PIXELFRAGMENT  = 17
+	D3DXPT_VERTEXFRAGMENT = 18
+	D3DXPT_FORCE_DWORD    = &H7FFFFFFF
+End Enum
+
+Type D3DXCONSTANTTABLE_DESC
+	Creator As BytePtr
+	Version As DWord
+	Constants As DWord
+End Type
+
+Type D3DXCONSTANT_DESC
+	Name As BytePtr
+	RegisterSet As D3DXREGISTER_SET
+	RegisterIndex As DWord
+	RegisterCount As DWord
+	Class_ As D3DXPARAMETER_CLASS
+	Type_ As D3DXPARAMETER_TYPE
+	Rows As DWord
+	Columns As DWord
+	Elements As DWord
+	StructMembers As DWord
+	Bytes As DWord
+	DefaultValue As VoidPtr
+End Type
+
+
+Class ID3DXConstantTable
+	Inherits IUnknown
+Public
+	'Buffer
+	Abstract Function GetBufferPointer() As VoidPtr
+	Abstract Function GetBufferSize() As DWord
+
+	'Descs
+	Abstract Function GetDesc(pDesc As *D3DXCONSTANTTABLE_DESC) As DWord
+	Abstract Function GetConstantDesc(hConstant As D3DXHANDLE, pConstantDesc As *D3DXCONSTANT_DESC, pCount As DWordPtr) As DWord
+	Abstract Function GetSamplerIndex(hConstant As D3DXHANDLE) As DWord
+
+	'Handle operations
+	Abstract Function GetConstant(hConstant As D3DXHANDLE, Index As DWord) As D3DXHANDLE
+	Abstract Function GetConstantByName(hConstant As D3DXHANDLE, pName As BytePtr) As D3DXHANDLE
+	Abstract Function GetConstantElement(hConstant As D3DXHANDLE, Index As DWord) As D3DXHANDLE
+
+	'Set Constants
+	Abstract Function SetDefaults(pDevice As LPDIRECT3DDEVICE9) As DWord
+	Abstract Function SetValue(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pData As VoidPtr, Bytes As DWord) As DWord
+	Abstract Function SetBool(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, b As Long) As DWord
+	Abstract Function SetBoolArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pb As *Long, Count As DWord) As DWord
+	Abstract Function SetInt(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, n As Long) As DWord
+	Abstract Function SetIntArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pn As *Long, Count As DWord) As DWord
+	Abstract Function SetFloat(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, f As Single) As DWord
+	Abstract Function SetFloatArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pf As SinglePtr, Count As DWord) As DWord
+	Abstract Function SetVector(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pVector As *D3DXVECTOR4) As DWord
+	Abstract Function SetVectorArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pVector As *D3DXVECTOR4, Count As DWord) As DWord
+	Abstract Function SetMatrix(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX) As DWord
+	Abstract Function SetMatrixArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX, Count As DWord) As DWord
+	Abstract Function SetMatrixPointerArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, ppMatrix As **D3DXMATRIX, Count As DWord) As DWord
+	Abstract Function SetMatrixTranspose(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX) As DWord
+	Abstract Function SetMatrixTransposeArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX, Count As DWord) As DWord
+	Abstract Function SetMatrixTransposePointerArray(pDevice As LPDIRECT3DDEVICE9, hConstant As D3DXHANDLE, ppMatrix As **D3DXMATRIX, Count As DWord) As DWord
+End Class
+TypeDef LPD3DXCONSTANTTABLE = *ID3DXConstantTable
+
+
+Class ID3DXTextureShader
+	Inherits IUnknown
+Public
+    'Gets
+	Abstract Function GetFunction(ppFunction As *LPD3DXBUFFER) As DWord
+	Abstract Function GetConstantBuffer(ppConstantBuffer As *LPD3DXBUFFER) As DWord
+
+    'Descs
+	Abstract Function GetDesc(pDesc As *D3DXCONSTANTTABLE_DESC) As DWord
+	Abstract Function GetConstantDesc(hConstant As D3DXHANDLE, pConstantDesc As *D3DXCONSTANT_DESC, pCount As DWordPtr) As DWord
+
+    'Handle operations
+	Abstract Function GetConstant(hConstant As D3DXHANDLE, Index As DWord) As D3DXHANDLE
+	Abstract Function GetConstantByName(hConstant As D3DXHANDLE, pName As BytePtr) As D3DXHANDLE
+	Abstract Function GetConstantElement(hConstant As D3DXHANDLE, Index As DWord) As D3DXHANDLE
+
+    'Set Constants
+	Abstract Function SetDefaults() As DWord
+	Abstract Function SetValue(hConstant As D3DXHANDLE, pData As VoidPtr, Bytes As DWord) As DWord
+	Abstract Function SetBool(hConstant As D3DXHANDLE, b As Long) As DWord
+	Abstract Function SetBoolArray(hConstant As D3DXHANDLE, pb As *Long, Count As DWord) As DWord
+	Abstract Function SetInt(hConstant As D3DXHANDLE, n As Long) As DWord
+	Abstract Function SetIntArray(hConstant As D3DXHANDLE, pn As *Long, Count As DWord) As DWord
+	Abstract Function SetFloat(hConstant As D3DXHANDLE, f As Single) As DWord
+	Abstract Function SetFloatArray(hConstant As D3DXHANDLE, pf As SinglePtr, Count As DWord) As DWord
+	Abstract Function SetVector(hConstant As D3DXHANDLE, pVector As *D3DXVECTOR4) As DWord
+	Abstract Function SetVectorArray(hConstant As D3DXHANDLE, pVector As *D3DXVECTOR4, Count As DWord) As DWord
+	Abstract Function SetMatrix(hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX) As DWord
+	Abstract Function SetMatrixArray(hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX, Count As DWord) As DWord
+	Abstract Function SetMatrixPointerArray(hConstant As D3DXHANDLE, ppMatrix As **D3DXMATRIX, Count As DWord) As DWord
+	Abstract Function SetMatrixTranspose(hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX) As DWord
+	Abstract Function SetMatrixTransposeArray(hConstant As D3DXHANDLE, pMatrix As *D3DXMATRIX, Count As DWord) As DWord
+	Abstract Function SetMatrixTransposePointerArray(hConstant As D3DXHANDLE, ppMatrix As **D3DXMATRIX, Count As DWord) As DWord
+End Class
+TypeDef LPD3DXTEXTURESHADER = *ID3DXTextureShader
+
+
+Class ID3DXFragmentLinker
+	Inherits IUnknown
+Public
+	'fragment access and information retrieval functions
+	Abstract Function GetDevice(ppDevice As *LPDIRECT3DDEVICE9) As DWord
+	Abstract Function GetNumberOfFragments() As DWord
+
+	Abstract Function GetFragmentHandleByIndex(Index As DWord) As D3DXHANDLE
+	Abstract Function GetFragmentHandleByName(Name As BytePtr) As D3DXHANDLE
+	Abstract Function GetFragmentDesc(Name As D3DXHANDLE, FragDesc As *D3DXFRAGMENT_DESC) As DWord
+
+	'add the fragments in the buffer to the linker
+	Abstract Function AddFragments(Fragments As DWordPtr) As DWord
+
+	'Create a buffer containing the fragments.  Suitable for saving to disk
+	Abstract Function GetAllFragments(ppBuffer As *LPD3DXBUFFER) As DWord
+	Abstract Function GetFragment(Name As D3DXHANDLE, ppBuffer As *LPD3DXBUFFER) As DWord
+
+	Abstract Function LinkShader(pProfile As BytePtr, Flags As DWord, rgFragmentHandles As *D3DXHANDLE, cFragments As DWord, ppBuffer As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER) As DWord
+	Abstract Function LinkVertexShader(pProfile As BytePtr, Flags As DWord, rgFragmentHandles As *D3DXHANDLE, cFragments As DWord, pVShader As *LPDIRECT3DVERTEXSHADER9, ppErrorMsgs As *LPD3DXBUFFER) As DWord
+	Abstract Function LinkPixelShader(pProfile As BytePtr, Flags As DWord, rgFragmentHandles As *D3DXHANDLE, cFragments As DWord, pPShader As *LPDIRECT3DPIXELSHADER9, ppErrorMsgs As *LPD3DXBUFFER) As DWord
+
+	Abstract Function ClearCache() As DWord
+End Class
+TypeDef LPD3DXFRAGMENTLINKER = *ID3DXFragmentLinker
+
+
+Const Enum D3DXINCLUDE_TYPE
+	D3DXINC_LOCAL  = 0
+	D3DXINC_SYSTEM = 1
+
+	D3DXINC_FORCE_DWORD = &H7FFFFFFF
+End Enum
+
+Class ID3DXInclude
+	Abstract Function Open(IncludeType As D3DXINCLUDE_TYPE, pFileName As BytePtr, pParentData As VoidPtr, ppData As DWordPtr, pBytes As DWordPtr) As DWord
+	Abstract Function Close(pData As VoidPtr) As DWord
+End Class
+TypeDef LPD3DXINCLUDE = *ID3DXInclude
+
+
+'--------------------
+' D3DXAssembleShader
+'--------------------
+Declare Function D3DXAssembleShaderFromFile Lib "dx9abm" Alias "D3DXAssembleShaderFromFile_abm" (pSrcFile As BytePtr, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER) As DWord
+Declare Function D3DXAssembleShaderFromResource Lib "dx9abm" Alias "D3DXAssembleShaderFromResource_abm" (hSrcModule As HINSTANCE, pSrcResource As BytePtr, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER) As DWord
+Declare Function D3DXAssembleShader Lib "dx9abm" Alias "D3DXAssembleShader_abm" (pSrcData As BytePtr, SrcDataLen As DWord, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER) As DWord
+
+
+'-------------------
+' D3DXCompileShader
+'-------------------
+Declare Function D3DXCompileShaderFromFile Lib "dx9abm" Alias "D3DXCompileShaderFromFile_abm" (pSrcFile As BytePtr, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, pFunctionName As BytePtr, pProfile As BytePtr, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER, ppConstantTable As *LPD3DXCONSTANTTABLE) As DWord
+Declare Function D3DXCompileShaderFromResource Lib "dx9abm" Alias "D3DXCompileShaderFromResource_abm" (hSrcModule As HINSTANCE, pSrcResource As BytePtr, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, pFunctionName As BytePtr, pProfile As BytePtr, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER, ppConstantTable As *LPD3DXCONSTANTTABLE) As DWord
+Declare Function D3DXCompileShader Lib "dx9abm" Alias "D3DXCompileShader_abm" (pSrcData As BytePtr, SrcDataLen As DWord, pDefines As *D3DXMACRO, pInclude As LPD3DXINCLUDE, pFunctionName As BytePtr, pProfile As BytePtr, Flags As DWord, ppShader As *LPD3DXBUFFER, ppErrorMsgs As *LPD3DXBUFFER, ppConstantTable As *LPD3DXCONSTANTTABLE) As DWord
Index: /trunk/ab5.0/ablib/src/directx9/d3dx9tex.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/d3dx9tex.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/d3dx9tex.sbp	(revision 506)
@@ -0,0 +1,139 @@
+'d3dx9tex.sbp
+
+' D3DX_FILTER flags
+Const D3DX_FILTER_NONE             = 1
+Const D3DX_FILTER_POINT            = 2
+Const D3DX_FILTER_LINEAR           = 3
+Const D3DX_FILTER_TRIANGLE         = 4
+Const D3DX_FILTER_BOX              = 5
+
+Const D3DX_FILTER_MIRROR_U         = 1 << 16
+Const D3DX_FILTER_MIRROR_V         = 2 << 16
+Const D3DX_FILTER_MIRROR_W         = 4 << 16
+Const D3DX_FILTER_MIRROR           = 7 << 16
+
+Const D3DX_FILTER_DITHER           = 1 << 19
+Const D3DX_FILTER_DITHER_DIFFUSION = 2 << 19
+
+Const D3DX_FILTER_SRGB_IN          = 1 << 21
+Const D3DX_FILTER_SRGB_OUT         = 2 << 21
+Const D3DX_FILTER_SRGB             = 3 << 21
+
+
+' D3DX_NORMALMAP flags
+Const D3DX_NORMALMAP_MIRROR_U          = 1 << 16
+Const D3DX_NORMALMAP_MIRROR_V          = 2 << 16
+Const D3DX_NORMALMAP_MIRROR            = 3 << 16
+Const D3DX_NORMALMAP_INVERTSIGN        = 8 << 16
+Const D3DX_NORMALMAP_COMPUTE_OCCLUSION =16 << 16
+
+
+' D3DX_CHANNEL flags
+Const D3DX_CHANNEL_RED       = 1 << 0
+Const D3DX_CHANNEL_BLUE      = 1 << 1
+Const D3DX_CHANNEL_GREEN     = 1 << 2
+Const D3DX_CHANNEL_ALPHA     = 1 << 3
+Const D3DX_CHANNEL_LUMINANCE = 1 << 4
+
+
+Const Enum D3DXIMAGE_FILEFORMAT
+    D3DXIFF_BMP         = 0
+    D3DXIFF_JPG         = 1
+    D3DXIFF_TGA         = 2
+    D3DXIFF_PNG         = 3
+    D3DXIFF_DDS         = 4
+    D3DXIFF_PPM         = 5
+    D3DXIFF_DIB         = 6
+    D3DXIFF_HDR         = 7
+    D3DXIFF_PFM         = 8
+    D3DXIFF_FORCE_DWORD = &H7FFFFFFF
+End Enum
+
+
+Type D3DXIMAGE_INFO
+	Width As DWord
+	Height As DWord
+	Depth As DWord
+	MipLevels As DWord
+	Format As D3DFORMAT
+	ResourceType As D3DRESOURCETYPE
+	ImageFileFormat As D3DXIMAGE_FILEFORMAT
+End Type
+
+
+'-----------------
+' Image File APIs
+'-----------------
+
+Declare Function D3DXGetImageInfoFromFile Lib "dx9abm" Alias "D3DXGetImageInfoFromFile_abm" (pSrcFile As BytePtr, pSrcInfo As *D3DXIMAGE_INFO) As DWord
+Declare Function D3DXGetImageInfoFromResource Lib "dx9abm" Alias "D3DXGetImageInfoFromResource_abm" (hSrcModule As DWord, pSrcResource As BytePtr, pSrcInfo As *D3DXIMAGE_INFO) As DWord
+Declare Function D3DXGetImageInfoFromFileInMemory Lib "dx9abm" Alias "D3DXGetImageInfoFromFileInMemory_abm" (pSrcData As VoidPtr, SrcDataSize As DWord, pSrcInfo As *D3DXIMAGE_INFO) As DWord
+
+
+'------------------------
+' Load/Save Surface APIs
+'------------------------
+
+Declare Function D3DXLoadSurfaceFromFile Lib "dx9abm" Alias "D3DXLoadSurfaceFromFile_abm" (pDestSurface As *IDirect3DSurface9, pDestPalette As *PALETTEENTRY, pDestRect As *RECT, pSrcFile As BytePtr, pSrcRect As *RECT, Filter As DWord, ColorKey As DWord, pSrcInfo As *D3DXIMAGE_INFO) As DWord
+Declare Function D3DXLoadSurfaceFromResource Lib "dx9abm" Alias "D3DXLoadSurfaceFromResource_abm" (pDestSurface As *IDirect3DSurface9, pDestPalette As *PALETTEENTRY, pDestRect As *RECT, hSrcModule As DWord, hSrcResource As BytePtr, pSrcRect As *RECT, Filter As DWord, ColorKey As DWord, pSrcInfo As *D3DXIMAGE_INFO) As DWord
+Declare Function D3DXLoadSurfaceFromFileInMemory Lib "dx9abm" Alias "D3DXLoadSurfaceFromFileInMemory_abm" (pDestSurface As *IDirect3DSurface9, pDestPalette As *PALETTEENTRY, pDestRect As *RECT, pSrcData As VoidPtr, SrcDataSize As DWord, pSrcRect As *RECT, Filter As DWord, ColorKey As DWord, pSrcInfo As *D3DXIMAGE_INFO) As DWord
+Declare Function D3DXLoadSurfaceFromSurface Lib "dx9abm" Alias "D3DXLoadSurfaceFromSurface_abm" (pDestSurface As *IDirect3DSurface9, pDestPalette As *PALETTEENTRY, pDestRect As *RECT, pSrcSurface As *IDirect3DSurface9, pSrcPalette As *PALETTEENTRY, pSrcRect As *RECT, Filter As DWord, ColorKey As DWord) As DWord
+Declare Function D3DXLoadSurfaceFromMemory Lib "dx9abm" Alias "D3DXLoadSurfaceFromMemory_abm" (pDestSurface As *IDirect3DSurface9, pDestPalette As *PALETTEENTRY, pDestRect As *RECT, pSrcMemory As VoidPtr, SrcFormat As D3DFORMAT, SrcPitch As DWord, pSrcPalette As *PALETTEENTRY, pSrcRect As *RECT, Filter As DWord, ColorKey As DWord) As DWord
+Declare Function D3DXSaveSurfaceToFile Lib "dx9abm" Alias "D3DXSaveSurfaceToFile_abm" (pDestFile As BytePtr, DestFormat As D3DXIMAGE_FILEFORMAT, pSrcSurface As *IDirect3DSurface9, pSrcPalette As *PALETTEENTRY, pSrcRect As *RECT) As DWord
+Declare Function D3DXSaveSurfaceToFileInMemory Lib "dx9abm" Alias "D3DXSaveSurfaceToFileInMemory_abm" (ppDestBuf As *ID3DXBuffer, DestFormat As D3DXIMAGE_FILEFORMAT, pSrcSurface As *IDirect3DSurface9, pSrcPalette As *PALETTEENTRY, pSrcRect As *RECT) As DWord
+
+
+'-----------------------
+' Load/Save Volume APIs
+'-----------------------
+Declare Function D3DXLoadVolumeFromFile Lib "dx9abm" Alias "D3DXLoadVolumeFromFile_abm" (pDestVolume As *IDirect3DVolume9, pDestPalette As *PALETTEENTRY, pDestBox As *D3DBOX, pSrcFile As BytePtr, pSrcBox As *D3DBOX, Filter As DWord, ColorKey As DWord, pSrcInfo As *D3DXIMAGE_INFO) As DWord
+Declare Function D3DXLoadVolumeFromResource Lib "dx9abm" Alias "D3DXLoadVolumeFromResource_abm" (pDestVolume As *IDirect3DVolume9, pDestPalette As *PALETTEENTRY, pDestBox As *D3DBOX, hSrcModule As DWord, pSrcResource As BytePtr, pSrcBox As *D3DBOX, Filter As DWord, ColorKey As DWord, pSrcInfo As *D3DXIMAGE_INFO) As DWord
+Declare Function D3DXLoadVolumeFromFileInMemory Lib "dx9abm" Alias "D3DXLoadVolumeFromFileInMemory_abm" (pDestVolume As *IDirect3DVolume9, pDestPalette As *PALETTEENTRY, pDestBox As *D3DBOX, pSrcData As VoidPtr, SrcDataSize As DWord, pSrcBox As *D3DBOX, Filter As DWord, ColorKey As DWord, pSrcInfo As *D3DXIMAGE_INFO) As DWord
+Declare Function D3DXLoadVolumeFromVolume Lib "dx9abm" Alias "D3DXLoadVolumeFromVolume_abm" (pDestVolume As *IDirect3DVolume9, pDestPalette As *PALETTEENTRY, pDestBox As *D3DBOX, pSrcVolume As *IDirect3DVolume9, pSrcPalette As *PALETTEENTRY, pSrcBox As *D3DBOX, Filter As DWord, ColorKey As DWord) As DWord
+Declare Function D3DXLoadVolumeFromMemory Lib "dx9abm" Alias "D3DXLoadVolumeFromMemory_abm" (pDestVolume As *IDirect3DVolume9, pDestPalette As *PALETTEENTRY, pDestBox As *D3DBOX, pSrcMemory As VoidPtr, SrcFormat As D3DFORMAT, SrcRowPitch As DWord, SrcSlicePitch As DWord, pSrcPalette As *PALETTEENTRY, pSrcBox As *D3DBOX, Filter As DWord, ColorKey As DWord) As DWord
+Declare Function D3DXSaveVolumeToFile Lib "dx9abm" Alias "D3DXSaveVolumeToFile_abm" (pDestFile As BytePtr, DestFormat As D3DXIMAGE_FILEFORMAT, pSrcVolume As *IDirect3DVolume9, pSrcPalette As *PALETTEENTRY, pSrcBox As *D3DBOX) As DWord
+Declare Function D3DXSaveVolumeToFileInMemory Lib "dx9abm" Alias "D3DXSaveVolumeToFileInMemory_abm" (ppDestBuf As **ID3DXBuffer, DestFormat As D3DXIMAGE_FILEFORMAT, pSrcVolume As *IDirect3DVolume9, pSrcPalette As *PALETTEENTRY, pSrcBox As *D3DBOX) As DWord
+
+
+'--------------------------
+' Create/Save Texture APIs
+'--------------------------
+Declare Function D3DXCheckTextureRequirements Lib "dx9abm" Alias "D3DXCheckTextureRequirements_abm" (pDevice As LPDIRECT3DDEVICE9, pWidth As DWordPtr, pHeight As DWordPtr, pNumMipLevels As DWordPtr, Usage As DWord, pFormat As *D3DFORMAT, Pool As D3DPOOL) As DWord
+Declare Function D3DXCheckCubeTextureRequirements Lib "dx9abm" Alias "D3DXCheckCubeTextureRequirements_abm" (pDevice As LPDIRECT3DDEVICE9, pSize As DWordPtr, pNumMipLevels As DWordPtr, Usage As DWord, pFormat As *D3DFORMAT, Pool As D3DPOOL) As DWord
+Declare Function D3DXCheckVolumeTextureRequirements Lib "dx9abm" Alias "D3DXCheckVolumeTextureRequirements_abm" (pDevice As LPDIRECT3DDEVICE9, pWidth As DWordPtr, pHeight As DWordPtr, pDepth As DWordPtr, pNumMipLevels As DWordPtr, Usage As DWord, pFormat As *D3DFORMAT, Pool As D3DPOOL) As DWord
+Declare Function D3DXCreateTexture Lib "dx9abm" Alias "D3DXCreateTexture_abm" (pDevice As LPDIRECT3DDEVICE9, Width As DWord, Height As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppTexture As *LPDIRECT3DTEXTURE9) As DWord
+Declare Function D3DXCreateCubeTexture Lib "dx9abm" Alias "D3DXCreateCubeTexture_abm" (pDevice As LPDIRECT3DDEVICE9, Size As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppCubeTexture As *LPDIRECT3DCUBETEXTURE9) As DWord
+Declare Function D3DXCreateVolumeTexture Lib "dx9abm" Alias "D3DXCreateVolumeTexture_abm" (pDevice As LPDIRECT3DDEVICE9, Width As DWord, Height As DWord, Depth As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, ppVolumeTexture As *LPDIRECT3DVOLUMETEXTURE9) As DWord
+Declare Function D3DXCreateTextureFromFile Lib "dx9abm" Alias "D3DXCreateTextureFromFile_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcFile As BytePtr, ppTexture As *LPDIRECT3DTEXTURE9) As DWord
+Declare Function D3DXCreateCubeTextureFromFile Lib "dx9abm" Alias "D3DXCreateCubeTextureFromFile_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcFile As BytePtr, ppCubeTexture As *LPDIRECT3DCUBETEXTURE9) As DWord
+Declare Function D3DXCreateVolumeTextureFromFile Lib "dx9abm" Alias "D3DXCreateVolumeTextureFromFile_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcFile As BytePtr, ppVolumeTexture As *LPDIRECT3DVOLUMETEXTURE9) As DWord
+Declare Function D3DXCreateTextureFromResource Lib "dx9abm" Alias "D3DXCreateTextureFromResource_abm" (pDevice As LPDIRECT3DDEVICE9, hSrcModule As HINSTANCE, pSrcResource As BytePtr, ppTexture As *LPDIRECT3DTEXTURE9) As DWord
+Declare Function D3DXCreateCubeTextureFromResource Lib "dx9abm" Alias "D3DXCreateCubeTextureFromResource_abm" (pDevice As LPDIRECT3DDEVICE9, hSrcModule As HINSTANCE, pSrcResource As BytePtr, ppCubeTexture As *LPDIRECT3DCUBETEXTURE9) As DWord
+Declare Function D3DXCreateVolumeTextureFromResource Lib "dx9abm" Alias "D3DXCreateVolumeTextureFromResource_abm" (pDevice As LPDIRECT3DDEVICE9, hSrcModule As HINSTANCE, pSrcResource As BytePtr, ppVolumeTexture As *LPDIRECT3DVOLUMETEXTURE9) As DWord
+Declare Function D3DXCreateTextureFromFileEx Lib "dx9abm" Alias "D3DXCreateTextureFromFileEx_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcFile As BytePtr, Width As DWord, Height As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, Filter As DWord, MipFilter As DWord, ColorKey As D3DCOLOR, pSrcInfo As *D3DXIMAGE_INFO, pPalette As *PALETTEENTRY, ppTexture As *LPDIRECT3DTEXTURE9) As DWord
+Declare Function D3DXCreateCubeTextureFromFileEx Lib "dx9abm" Alias "D3DXCreateCubeTextureFromFileEx_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcFile As BytePtr, Size As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, Filter As DWord, MipFilter As DWord, ColorKey As D3DCOLOR, pSrcInfo As *D3DXIMAGE_INFO, pPalette As *PALETTEENTRY, ppCubeTexture As *LPDIRECT3DCUBETEXTURE9) As DWord
+Declare Function D3DXCreateVolumeTextureFromFileEx Lib "dx9abm" Alias "D3DXCreateVolumeTextureFromFileEx_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcFile As BytePtr, Width As DWord, Height As DWord, Depth As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, Filter As DWord, MipFilter As DWord, ColorKey As D3DCOLOR, pSrcInfo As *D3DXIMAGE_INFO, pPalette As *PALETTEENTRY, ppVolumeTexture As *LPDIRECT3DVOLUMETEXTURE9) As DWord
+Declare Function D3DXCreateTextureFromResourceEx Lib "dx9abm" Alias "D3DXCreateTextureFromResourceEx_abm" (pDevice As LPDIRECT3DDEVICE9, hSrcModule As HINSTANCE, pSrcResource As BytePtr, Width As DWord, Height As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, Filter As DWord, MipFilter As DWord, ColorKey As D3DCOLOR, pSrcInfo As *D3DXIMAGE_INFO, pPalette As *PALETTEENTRY, ppTexture As *LPDIRECT3DTEXTURE9) As DWord
+Declare Function D3DXCreateCubeTextureFromResourceEx Lib "dx9abm" Alias "D3DXCreateCubeTextureFromResourceEx_abm" (pDevice As LPDIRECT3DDEVICE9, hSrcModule As HINSTANCE, pSrcResource As BytePtr, Size As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, Filter As DWord, MipFilter As DWord, ColorKey As D3DCOLOR, pSrcInfo As *D3DXIMAGE_INFO, pPalette As *PALETTEENTRY, ppCubeTexture As *LPDIRECT3DCUBETEXTURE9) As DWord
+Declare Function D3DXCreateVolumeTextureFromResourceEx Lib "dx9abm" Alias "D3DXCreateVolumeTextureFromResourceEx_abm" (pDevice As LPDIRECT3DDEVICE9, hSrcModule As HINSTANCE, pSrcResource As BytePtr, Width As DWord, Height As DWord, Depth As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, Filter As DWord, MipFilter As DWord, ColorKey As D3DCOLOR, pSrcInfo As *D3DXIMAGE_INFO, pPalette As *PALETTEENTRY, ppVolumeTexture As *LPDIRECT3DVOLUMETEXTURE9) As DWord
+Declare Function D3DXCreateTextureFromFileInMemory Lib "dx9abm" Alias "D3DXCreateTextureFromFileInMemory_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcData As VoidPtr, SrcDataSize As DWord, ppTexture As *LPDIRECT3DTEXTURE9) As DWord
+Declare Function D3DXCreateCubeTextureFromFileInMemory Lib "dx9abm" Alias "D3DXCreateCubeTextureFromFileInMemory_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcData As VoidPtr, SrcDataSize As DWord, ppCubeTexture As *LPDIRECT3DCUBETEXTURE9) As DWord
+Declare Function D3DXCreateVolumeTextureFromFileInMemory Lib "dx9abm" Alias "D3DXCreateVolumeTextureFromFileInMemory_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcData As VoidPtr, SrcDataSize As DWord, ppVolumeTexture As *LPDIRECT3DVOLUMETEXTURE9) As DWord
+Declare Function D3DXCreateTextureFromFileInMemoryEx Lib "dx9abm" Alias "D3DXCreateTextureFromFileInMemoryEx_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcData As VoidPtr, SrcDataSize As DWord, Width As DWord, Height As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, Filter As DWord, MipFilter As DWord, ColorKey As D3DCOLOR, pSrcInfo As *D3DXIMAGE_INFO, pPalette As *PALETTEENTRY, ppTexture As *LPDIRECT3DTEXTURE9) As DWord
+Declare Function D3DXCreateCubeTextureFromFileInMemoryEx Lib "dx9abm" Alias "D3DXCreateCubeTextureFromFileInMemoryEx_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcData As VoidPtr, SrcDataSize As DWord,Size As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, Filter As DWord, MipFilter As DWord, ColorKey As D3DCOLOR, pSrcInfo As *D3DXIMAGE_INFO, pPalette As *PALETTEENTRY, ppCubeTexture As *LPDIRECT3DCUBETEXTURE9) As DWord
+Declare Function D3DXCreateVolumeTextureFromFileInMemoryEx Lib "dx9abm" Alias "D3DXCreateVolumeTextureFromFileInMemoryEx_abm" (pDevice As LPDIRECT3DDEVICE9, pSrcData As VoidPtr, SrcDataSize As DWord, Width As DWord, Height As DWord, Depth As DWord, MipLevels As DWord, Usage As DWord, Format As D3DFORMAT, Pool As D3DPOOL, Filter As DWord, MipFilter As DWord, ColorKey As D3DCOLOR, pSrcInfo As *D3DXIMAGE_INFO, pPalette As *PALETTEENTRY, ppVolumeTexture As *LPDIRECT3DVOLUMETEXTURE9) As DWord
+Declare Function D3DXSaveTextureToFile Lib "dx9abm" Alias "D3DXSaveTextureToFile_abm" (pDestFile As BytePtr, DestFormat As D3DXIMAGE_FILEFORMAT, pSrcTexture As LPDIRECT3DBASETEXTURE9, pSrcPalette As *PALETTEENTRY) As DWord
+Declare Function D3DXSaveTextureToFileInMemory Lib "dx9abm" Alias "D3DXSaveTextureToFileInMemory_abm" (ppDestBuf As *LPD3DXBUFFER, DestFormat As D3DXIMAGE_FILEFORMAT, pSrcTexture As LPDIRECT3DBASETEXTURE9, pSrcPalette As *PALETTEENTRY) As DWord
+
+
+'-------------------
+' Misc Texture APIs
+'-------------------
+Declare Function D3DXFilterTexture Lib "dx9abm" Alias "D3DXFilterTexture_abm" (pBaseTexture As LPDIRECT3DBASETEXTURE9, pPalette As *PALETTEENTRY, SrcLevel As DWord, Filter As DWord) As DWord
+Declare Function D3DXFillTexture Lib "dx9abm" Alias "D3DXFillTexture_abm" (pTexture As LPDIRECT3DTEXTURE9, pFunction As VoidPtr, pData As VoidPtr) As DWord
+Declare Function D3DXFillCubeTexture Lib "dx9abm" Alias "D3DXFillCubeTexture_abm" (pCubeTexture As LPDIRECT3DCUBETEXTURE9, pFunction As VoidPtr, pData As VoidPtr) As DWord
+Declare Function D3DXFillVolumeTexture Lib "dx9abm" Alias "D3DXFillVolumeTexture_abm" (pVolumeTexture As LPDIRECT3DVOLUMETEXTURE9, pFunction As VoidPtr, pData As VoidPtr) As DWord
+Declare Function D3DXFillTextureTX Lib "dx9abm" Alias "D3DXFillTextureTX_abm" (pTexture As LPDIRECT3DTEXTURE9, pTextureShader As LPD3DXTEXTURESHADER) As DWord
+Declare Function D3DXFillCubeTextureTX Lib "dx9abm" Alias "D3DXFillCubeTextureTX_abm" (pCubeTexture As LPDIRECT3DCUBETEXTURE9, pTextureShader As LPD3DXTEXTURESHADER) As DWord
+Declare Function D3DXFillVolumeTextureTX Lib "dx9abm" Alias "D3DXFillVolumeTextureTX_abm" (pVolumeTexture As LPDIRECT3DVOLUMETEXTURE9, pTextureShader As LPD3DXTEXTURESHADER) As DWord
+Declare Function D3DXComputeNormalMap Lib "dx9abm" Alias "D3DXComputeNormalMap_abm" (pTexture As LPDIRECT3DTEXTURE9, pSrcTexture As LPDIRECT3DTEXTURE9, pSrcPalette As *PALETTEENTRY, Flags As DWord, Channel As DWord, Amplitude As Single) As DWord
Index: /trunk/ab5.0/ablib/src/directx9/d3dx9xof.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/d3dx9xof.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/d3dx9xof.sbp	(revision 506)
@@ -0,0 +1,60 @@
+' d3dx9xof.sbp
+
+Class ID3DXFile
+	Inherits IUnknown
+Public
+	Abstract Function CreateEnumObject(pData As VoidPtr, dwFileLoadOptions As DWord, ppD3DXFileEnumObject As **ID3DXFileEnumObject) As DWord
+	Abstract Function CreateSaveObject(pData As VoidPtr, dwFileSaveOptions As DWord, dwFileFormat As DWord, ppD3DXFileSaveObject As **ID3DXFileSaveObject) As DWord
+	Abstract Function RegisterTemplates(pData As VoidPtr, dwSize As DWord) As DWord
+	Abstract Function RegisterEnumTemplates(pD3DXFileEnumObject As *ID3DXFileEnumObject) As DWord
+End Class
+
+
+Class ID3DXFileSaveObject
+	Inherits IUnknown
+Public
+	Abstract Function GetFile(ppD3DXFile As **ID3DXFile) As DWord
+	Abstract Function AddDataObject(ByRef rguidTemplate As GUID, szName As BytePtr, pId As *GUID, cbSize As DWord, pvData As VoidPtr, ppObj As **ID3DXFileSaveData) As DWord
+	Abstract Function Save() As DWord
+End Class
+
+
+Class ID3DXFileSaveData
+	Inherits IUnknown
+Public
+	Abstract Function GetSave(ppD3DXFileSaveObject As **ID3DXFileSaveObject) As DWord
+	Abstract Function GetName(pBuffer As BytePtr, lpdwSize As DWordPtr) As DWord
+	Abstract Function GetId(pGuid As *GUID) As DWord
+	Abstract Function GetType(pGuid As *GUID) As DWord
+	Abstract Function AddDataObject(ByRef rguidTemplate As GUID, szName As BytePtr, pId As *GUID, cbSize As DWord, pvData As VoidPtr, ppObj As **ID3DXFileSaveData) As DWord
+	Abstract Function AddDataReference(pBuffer As BytePtr, pGuid As *GUID) As DWord
+End Class
+
+
+Class ID3DXFileEnumObject
+	Inherits IUnknown
+Public
+	Abstract Function GetFile(ppD3DXFile As **ID3DXFile) As DWord
+	Abstract Function GetChildren(dwSize As DWord) As DWord
+	Abstract Function GetChild(dwSize As DWord, ppD3DXFileData As **ID3DXFileData) As DWord
+	Abstract Function GetDataObjectById(ByRef rguidTemplate As GUID, ppD3DXFileData As **ID3DXFileData) As DWord
+	Abstract Function GetDataObjectByName(pName As BytePtr, ppD3DXFileData As **ID3DXFileData) As DWord
+End Class
+
+
+Class ID3DXFileData
+	Inherits IUnknown
+Public
+	Abstract Function GetEnum(ppD3DXFileEnumObject As **ID3DXFileEnumObject) As DWord
+	Abstract Function GetName(pBuffer As BytePtr, lpdwSize As DWordPtr) As DWord
+	Abstract Function GetId(pId As *GUID) As DWord
+	Abstract Function Lock(dwSize As DWord, pData As VoidPtr) As DWord
+	Abstract Function Unlock() As DWord
+	Abstract Function GetType(pGuid As *GUID) As DWord
+	Abstract Function IsReference() As Long
+	Abstract Function GetChildren(dwSize As DWord) As DWord
+	Abstract Function GetChild(dwSize As DWord, ppD3DFileData As **ID3DXFileData) As DWord
+End Class
+
+'未完成
+'Declare Function  Lib "dx9abm" Alias "_abm" () As DWord
Index: /trunk/ab5.0/ablib/src/directx9/dinput.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/dinput.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/dinput.sbp	(revision 506)
@@ -0,0 +1,752 @@
+' dinput.sbp
+
+
+#ifndef _INC_DINPUT
+#define _INC_DINPUT
+
+
+'----------------
+' Version
+'----------------
+
+Const DIRECTINPUT_VERSION = &H0800
+
+
+'----------------
+' Interfaces
+'----------------
+
+Dim IID_IDirectInput8 = [&HBF798030,&H483A,&H4DA2,[&HAA,&H99,&H5D,&H64,&HED,&H36,&H97,&H00]] As GUID
+Dim IID_IDirectInputDevice8 = [&H54D41080,&HDC15,&H4833,[&HA4,&H1B,&H74,&H8F,&H73,&HA3,&H81,&H79]] As GUID
+Dim IID_IDirectInputEffect = [&HE7E1F7C0,&H88D2,&H11D0,[&H9A,&HD0,&H00,&HA0,&HC9,&HA0,&H6E,&H35]] As GUID
+
+
+'-------------------------
+' Predefined object types
+'-------------------------
+
+Dim GUID_XAxis = [&HA36D02E0,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_YAxis = [&HA36D02E1,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_ZAxis = [&HA36D02E2,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_RxAxis = [&HA36D02F4,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_RyAxis = [&HA36D02F5,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_RzAxis = [&HA36D02E3,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_Slider = [&HA36D02E4,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_Button = [&HA36D02F0,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_Key = [&H55728220,&HD33C,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_POV = [&HA36D02F2,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_Unknown = [&HA36D02F3,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+
+
+'--------------------------
+' Predefined product GUIDs
+'--------------------------
+
+Dim GUID_SysMouse = [&H6F1D2B60,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_SysKeyboard = [&H6F1D2B61,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_Joystick = [&H6F1D2B70,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_SysMouseEm = [&H6F1D2B80,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_SysMouseEm2 = [&H6F1D2B81,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_SysKeyboardEm = [&H6F1D2B82,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+Dim GUID_SysKeyboardEm2 = [&H6F1D2B83,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
+
+
+Type DIENVELOPE
+	dwSize As DWord
+	dwAttackLevel As DWord
+	dwAttackTime As DWord
+	dwFadeLevel As DWord
+	dwFadeTime As DWord
+End Type
+TypeDef LPDIENVELOPE = *DIENVELOPE
+
+
+Type DIEFFECT
+	dwSize As DWord
+	dwFlags As DWord
+	dwDuration As DWord
+	dwSamplePeriod As DWord
+	dwGain As DWord
+	dwTriggerButton As DWord
+	dwTriggerRepeatInterval As DWord
+	cAxes As DWord
+	rgdwAxes As *DWord
+	rglDirection As *Long
+	lpEnvelope As LPDIENVELOPE
+	cbTypeSpecificParams As DWord
+	lpvTypeSpecificParams As VoidPtr
+	dwStartDelay As DWord
+End Type
+TypeDef LPDIEFFECT = *DIEFFECT
+
+
+Type DIFILEEFFECT
+	dwSize As DWord
+	GuidEffect As GUID
+	lpDiEffect As LPDIEFFECT
+	szFriendlyName[MAX_PATH-1] As Char
+End Type
+TypeDef LPDIFILEEFFECT = *DIFILEEFFECT
+
+
+Type DIEFFESCAPE
+	dwSize As DWord
+	dwCommand As DWord
+	lpvInBuffer As VoidPtr
+	cbInBuffer As DWord
+	lpvOutBuffer As VoidPtr
+	cbOutBuffer As DWord
+End Type
+TypeDef LPDIEFFESCAPE = *DIEFFESCAPE
+
+
+Class IDirectInputEffect
+	Inherits IUnknown
+Public
+	'IDirectInputEffect methods
+	Abstract Function Initialize(hinst As HINSTANCE, dwVersion As DWord, ByRef rguid As GUID) As DWord
+	Abstract Function GetEffectGuid(pguid As *GUID) As DWord
+	Abstract Function GetParameters(peff As LPDIEFFECT, dwFlags As DWord) As DWord
+	Abstract Function SetParameters(peff As LPDIEFFECT, dwFlags As DWord) As DWord
+	Abstract Function Start(dwIterations As DWord, dwFlags As DWord) As DWord
+	Abstract Function Stop() As DWord
+	Abstract Function GetEffectStatus(pdwFlags As *DWord) As DWord
+	Abstract Function Download() As DWord
+	Abstract Function Unload() As DWord
+	Abstract Function Escape(pesc As LPDIEFFESCAPE) As DWord
+End Class
+TypeDef LPDIRECTINPUTEFFECT = *IDirectInputEffect
+
+
+Type DIDEVCAPS
+	dwSize As DWord
+	dwFlags As DWord
+	dwDevType As DWord
+	dwAxes As DWord
+	dwButtons As DWord
+	dwPOVs As DWord
+	dwFFSamplePeriod As DWord
+	dwFFMinTimeResolution As DWord
+	dwFirmwareRevision As DWord
+	dwHardwareRevision As DWord
+	dwFFDriverVersion As DWord
+End Type
+TypeDef LPDIDEVCAPS = *DIDEVCAPS
+
+
+Const DIDOI_FFACTUATOR      = &H00000001
+Const DIDOI_FFEFFECTTRIGGER = &H00000002
+Const DIDOI_POLLED          = &H00008000
+Const DIDOI_ASPECTPOSITION  = &H00000100
+Const DIDOI_ASPECTVELOCITY  = &H00000200
+Const DIDOI_ASPECTACCEL     = &H00000300
+Const DIDOI_ASPECTFORCE     = &H00000400
+Const DIDOI_ASPECTMASK      = &H00000F00
+Const DIDOI_GUIDISUSAGE     = &H00010000
+Type DIOBJECTDATAFORMAT
+	pguid As *GUID
+	dwOfs As DWord
+	dwType As DWord
+	dwFlags As DWord
+End Type
+TypeDef LPDIOBJECTDATAFORMAT = *DIOBJECTDATAFORMAT
+
+
+Const DIDFT_ALL           = &H00000000
+Const DIDFT_RELAXIS       = &H00000001
+Const DIDFT_ABSAXIS       = &H00000002
+Const DIDFT_AXIS          = &H00000003
+Const DIDFT_PSHBUTTON     = &H00000004
+Const DIDFT_TGLBUTTON     = &H00000008
+Const DIDFT_BUTTON        = &H0000000C
+Const DIDFT_POV           = &H00000010
+Const DIDFT_COLLECTION    = &H00000040
+Const DIDFT_NODATA        = &H00000080
+Const DIDFT_ANYINSTANCE   = &H00FFFF00
+Const DIDFT_INSTANCEMASK  = DIDFT_ANYINSTANCE
+Const DIDFT_FFACTUATOR        = &H01000000
+Const DIDFT_FFEFFECTTRIGGER   = &H02000000
+Const DIDFT_OUTPUT            = &H10000000
+Const DIDFT_VENDORDEFINED     = &H04000000
+Const DIDFT_ALIAS             = &H08000000
+Const DIDFT_OPTIONAL          = &H80000000
+Const DIDFT_NOCOLLECTION      = &H00FFFF00
+Type DIDATAFORMAT
+	dwSize As DWord
+	dwObjSize As DWord
+	dwFlags As DWord
+	dwDataSize As DWord
+	dwNumObjs As DWord
+	rgodf As LPDIOBJECTDATAFORMAT
+End Type
+TypeDef LPDIDATAFORMAT = *DIDATAFORMAT
+
+Const DIDF_ABSAXIS = &H00000001
+Const DIDF_RELAXIS = &H00000002
+
+
+Type DIACTION
+	uAppData As DWord
+	dwSemantic As DWord
+	dwFlags As DWord
+	lptszActionName As *Char
+	guidInstance As GUID
+	dwObjID As DWord
+	dwHow As DWord
+End Type
+TypeDef LPDIACTION = *DIACTION
+
+
+Type DIACTIONFORMAT
+	dwSize As DWord
+	dwActionSize As DWord
+	dwDataSize As DWord
+	dwNumActions As DWord
+	rgoAction As LPDIACTION
+	guidActionMap As GUID
+	dwGenre As DWord
+	dwBufferSize As DWord
+	lAxisMin As Long
+	lAxisMax As Long
+	hInstString As HINSTANCE
+	ftTimeStamp As FILETIME
+	dwCRC As DWord
+	tszActionMap[MAX_PATH-1] As Char
+End Type
+TypeDef LPDIACTIONFORMAT = *DIACTIONFORMAT
+
+
+Type DICOLORSET
+	dwSize As DWord
+	cTextFore As D3DCOLOR
+	cTextHighlight As D3DCOLOR
+	cCalloutLine As D3DCOLOR
+	cCalloutHighlight As D3DCOLOR
+	cBorder As D3DCOLOR
+	cControlFill As D3DCOLOR
+	cHighlightFill As D3DCOLOR
+	cAreaFill As D3DCOLOR
+End Type
+
+
+Type DICONFIGUREDEVICESPARAMS
+	dwSize As DWord
+	dwcUsers As DWord
+	lptszUserNames As *Char
+	dwcFormats As DWord
+	lprgFormats As LPDIACTIONFORMAT
+	hwnd As HWND
+	dics As DICOLORSET
+	lpUnkDDSTarget As *IUnknown
+End Type
+TypeDef LPDICONFIGUREDEVICESPARAMS = *DICONFIGUREDEVICESPARAMS
+
+
+Type DIDEVICEIMAGEINFO
+	tszImagePath[MAX_PATH-1] As Char
+	dwFlags As DWord
+	dwViewID As DWord
+	rcOverlay As RECT
+	dwObjID As DWord
+	dwcValidPts As DWord
+	rgptCalloutLine[5-1] As POINTAPI  
+	rcCalloutRect As RECT
+	dwTextAlign As DWord
+End Type
+TypeDef LPDIDEVICEIMAGEINFO = *DIDEVICEIMAGEINFO
+
+
+Type DIDEVICEIMAGEINFOHEADER
+	dwSize As DWord
+	dwSizeImageInfo As DWord
+	dwcViews As DWord
+	dwcButtons As DWord
+	dwcAxes As DWord
+	dwcPOVs As DWord
+	dwBufferSize As DWord
+	dwBufferUsed As DWord
+	lprgImageInfoArray As LPDIDEVICEIMAGEINFO
+End Type
+TypeDef LPDIDEVICEIMAGEINFOHEADER = *DIDEVICEIMAGEINFOHEADER
+
+
+Type DIDEVICEOBJECTINSTANCE
+	dwSize As DWord
+	guidType As GUID
+	dwOfs As DWord
+	dwType As DWord
+	dwFlags As DWord
+	tszName[MAX_PATH-1] As Char
+	dwFFMaxForce As DWord
+	dwFFForceResolution As DWord
+	wCollectionNumber As Word
+	wDesignatorIndex As Word
+	wUsagePage As Word
+	wUsage As Word
+	dwDimension As DWord
+	wExponent As Word
+	wReportId As Word
+End Type
+TypeDef LPDIDEVICEOBJECTINSTANCE = *DIDEVICEOBJECTINSTANCE
+
+
+Type DIPROPHEADER
+	dwSize As DWord
+	dwHeaderSize As DWord
+	dwObj As DWord
+	dwHow As DWord
+End Type
+TypeDef LPDIPROPHEADER = *DIPROPHEADER
+
+
+Type DIDEVICEOBJECTDATA
+	dwOfs As DWord
+	dwData As DWord
+	dwTimeStamp As DWord
+	dwSequence As DWord
+	uAppData As DWord
+End Type
+TypeDef LPDIDEVICEOBJECTDATA = *DIDEVICEOBJECTDATA
+
+
+Const DISCL_EXCLUSIVE    = &H00000001
+Const DISCL_NONEXCLUSIVE = &H00000002
+Const DISCL_FOREGROUND   = &H00000004
+Const DISCL_BACKGROUND   = &H00000008
+Const DISCL_NOWINKEY     = &H00000010
+
+
+Type DIDEVICEINSTANCE
+	dwSize As DWord
+	guidInstance As GUID
+	guidProduct As GUID
+	dwDevType As DWord
+	tszInstanceName[MAX_PATH-1] As Char
+	tszProductName[MAX_PATH-1] As Char
+	guidFFDriver As GUID
+	wUsagePage As Word
+	wUsage As Word
+End Type
+TypeDef LPDIDEVICEINSTANCE = *DIDEVICEINSTANCE
+
+
+Type DIEFFECTINFO
+	dwSize As DWord
+	guid As GUID
+	dwEffType As DWord
+	dwStaticParams As DWord
+	dwDynamicParams As DWord
+	tszName[MAX_PATH-1] As Char
+End Type
+TypeDef LPDIEFFECTINFO = *DIEFFECTINFO
+
+
+Class IDirectInputDevice8
+	Inherits IUnknown
+Public
+	'IDirectInputDevice8 methods
+	Abstract Function GetCapabilities(lpDIDevCaps As LPDIDEVCAPS) As DWord
+	Abstract Function EnumObjects(lpCallback As VoidPtr, pvRef As VoidPtr, dwFlags As DWord) As DWord
+	Abstract Function GetProperty(ByRef rguidProp As GUID, pdiph As LPDIPROPHEADER) As DWord
+	Abstract Function SetProperty(ByRef rguidProp As GUID, pdiph As LPDIPROPHEADER) As DWord
+	Abstract Function Acquire() As DWord
+	Abstract Function Unacquire() As DWord
+	Abstract Function GetDeviceState(cbData As DWord, lpvData As VoidPtr) As DWord
+	Abstract Function GetDeviceData(cbObjectData As DWord, rgdod As LPDIDEVICEOBJECTDATA, pdwInOut As *DWord, dwFlags As DWord) As DWord
+	Abstract Function SetDataFormat(lpdf As LPDIDATAFORMAT) As DWord
+	Abstract Function SetEventNotification(hEvent As HANDLE) As DWord
+	Abstract Function SetCooperativeLevel(hwnd As HWND, dwFlags As DWord) As DWord
+	Abstract Function GetObjectInfo(pdidoi As LPDIDEVICEOBJECTINSTANCE, dwObj As DWord, dwHow As DWord) As DWord
+	Abstract Function GetDeviceInfo(pdidi As LPDIDEVICEINSTANCE) As DWord
+	Abstract Function RunControlPanel(hwndOwner As HWND, dwFlags As DWord) As DWord
+	Abstract Function Initialize(hinst As HINSTANCE, dwVersion As DWord, ByRef rguid As GUID) As DWord
+	Abstract Function CreateEffect(ByRef rguid As GUID, lpeff As LPDIEFFECT, ppdeff As *LPDIRECTINPUTEFFECT, punkOuter As LPUNKNOWN) As DWord
+	Abstract Function EnumEffects(lpCallback As VoidPtr, pvRef As VoidPtr, dwEffType As DWord) As DWord
+	Abstract Function GetEffectInfo(pdei As LPDIEFFECTINFO, ByRef rguid As GUID) As DWord
+	Abstract Function GetForceFeedbackState(pdwOut As *DWord) As DWord
+	Abstract Function SendForceFeedbackCommand(dwFlags As DWord) As DWord
+	Abstract Function EnumCreatedEffectObjects(lpCallback As VoidPtr, pvRef As VoidPtr, fl As DWord) As DWord
+	Abstract Function Escape(pesc As LPDIEFFESCAPE) As DWord
+	Abstract Function Poll() As DWord
+	Abstract Function SendDeviceData(cbObjectData As DWord, rgdod As LPDIDEVICEOBJECTDATA, pdwInOut As *DWord, fl As DWord) As DWord
+	Abstract Function EnumEffectsInFile(lpszFileName As *Char, pec As VoidPtr, pvRef As VoidPtr, dwFlags As DWord) As DWord
+	Abstract Function WriteEffectToFile(lpszFileName As *Char, dwEntries As DWord, rgDiFileEft As LPDIFILEEFFECT, dwFlags As DWord) As DWord
+	Abstract Function BuildActionMap(lpdiaf As LPDIACTIONFORMAT, lpszUserName As *Char, dwFlags As DWord) As DWord
+	Abstract Function SetActionMap(lpdiActionFormat As LPDIACTIONFORMAT, lptszUserName As *Char, dwFlags As DWord) As DWord
+	Abstract Function GetImageInfo(lpdiDevImageInfoHeader As LPDIDEVICEIMAGEINFOHEADER) As DWord
+End Class
+TypeDef LPDIRECTINPUTDEVICE8 = *IDirectInputDevice8
+
+
+Class IDirectInput8
+	Inherits IUnknown
+Public
+	'IDirectInput8 methods
+	Abstract Function CreateDevice(ByRef rguid As GUID, lplpDirectInputDevice As *LPDIRECTINPUTDEVICE8, pUnkOuter As LPUNKNOWN) As DWord
+	Abstract Function EnumDevices(dwDevType As DWord, lpCallback As VoidPtr, pvRef As VoidPtr, dwFlags As DWord) As DWord
+	Abstract Function GetDeviceStatus(ByRef rguidInstance As GUID) As DWord
+	Abstract Function RunControlPanel(hwndOwner As HWND, dwFlags As DWord) As DWord
+	Abstract Function Initialize(hinst As HINSTANCE, dwVersion As DWord) As DWord
+	Abstract Function FindDevice(ByRef rguidClass As GUID, ptszName As *Char, pguidInstance As *GUID) As DWord
+	Abstract Function EnumDevicesBySemantics(ptszUserName As *Char, lpdiActionFormat As LPDIACTIONFORMAT, lpCallback As VoidPtr, pvRef As VoidPtr, dwFlags As DWord) As DWord
+	Abstract Function ConfigureDevices(lpdiCallback As VoidPtr, lpdiCDParams As LPDICONFIGUREDEVICESPARAMS, dwFlags As DWord, pvRefData As VoidPtr) As DWord
+End Class
+TypeDef LPDIRECTINPUT8 = *IDirectInput8
+
+
+'---------------------------------
+' DirectInput keyboard scan codes
+'---------------------------------
+
+Const DIK_ESCAPE          = &H01
+Const DIK_1               = &H02
+Const DIK_2               = &H03
+Const DIK_3               = &H04
+Const DIK_4               = &H05
+Const DIK_5               = &H06
+Const DIK_6               = &H07
+Const DIK_7               = &H08
+Const DIK_8               = &H09
+Const DIK_9               = &H0A
+Const DIK_0               = &H0B
+Const DIK_MINUS           = &H0C    '- on main keyboard
+Const DIK_EQUALS          = &H0D
+Const DIK_BACK            = &H0E    'backspace
+Const DIK_TAB             = &H0F
+Const DIK_Q               = &H10
+Const DIK_W               = &H11
+Const DIK_E               = &H12
+Const DIK_R               = &H13
+Const DIK_T               = &H14
+Const DIK_Y               = &H15
+Const DIK_U               = &H16
+Const DIK_I               = &H17
+Const DIK_O               = &H18
+Const DIK_P               = &H19
+Const DIK_LBRACKET        = &H1A
+Const DIK_RBRACKET        = &H1B
+Const DIK_RETURN          = &H1C    'Enter on main keyboard
+Const DIK_LCONTROL        = &H1D
+Const DIK_A               = &H1E
+Const DIK_S               = &H1F
+Const DIK_D               = &H20
+Const DIK_F               = &H21
+Const DIK_G               = &H22
+Const DIK_H               = &H23
+Const DIK_J               = &H24
+Const DIK_K               = &H25
+Const DIK_L               = &H26
+Const DIK_SEMICOLON       = &H27
+Const DIK_APOSTROPHE      = &H28
+Const DIK_GRAVE           = &H29    'accent grave
+Const DIK_LSHIFT          = &H2A
+Const DIK_BACKSLASH       = &H2B
+Const DIK_Z               = &H2C
+Const DIK_X               = &H2D
+Const DIK_C               = &H2E
+Const DIK_V               = &H2F
+Const DIK_B               = &H30
+Const DIK_N               = &H31
+Const DIK_M               = &H32
+Const DIK_COMMA           = &H33
+Const DIK_PERIOD          = &H34    '. on main keyboard
+Const DIK_SLASH           = &H35    '/ on main keyboard
+Const DIK_RSHIFT          = &H36
+Const DIK_MULTIPLY        = &H37    '* on numeric keypad
+Const DIK_LMENU           = &H38    'left Alt
+Const DIK_SPACE           = &H39
+Const DIK_CAPITAL         = &H3A
+Const DIK_F1              = &H3B
+Const DIK_F2              = &H3C
+Const DIK_F3              = &H3D
+Const DIK_F4              = &H3E
+Const DIK_F5              = &H3F
+Const DIK_F6              = &H40
+Const DIK_F7              = &H41
+Const DIK_F8              = &H42
+Const DIK_F9              = &H43
+Const DIK_F10             = &H44
+Const DIK_NUMLOCK         = &H45
+Const DIK_SCROLL          = &H46    'Scroll Lock
+Const DIK_NUMPAD7         = &H47
+Const DIK_NUMPAD8         = &H48
+Const DIK_NUMPAD9         = &H49
+Const DIK_SUBTRACT        = &H4A    '- on numeric keypad
+Const DIK_NUMPAD4         = &H4B
+Const DIK_NUMPAD5         = &H4C
+Const DIK_NUMPAD6         = &H4D
+Const DIK_ADD             = &H4E    '+ on numeric keypad
+Const DIK_NUMPAD1         = &H4F
+Const DIK_NUMPAD2         = &H50
+Const DIK_NUMPAD3         = &H51
+Const DIK_NUMPAD0         = &H52
+Const DIK_DECIMAL         = &H53    '. on numeric keypad
+Const DIK_OEM_102         = &H56    '<> or \| on RT 102-key keyboard (Non-U.S.)
+Const DIK_F11             = &H57
+Const DIK_F12             = &H58
+Const DIK_F13             = &H64    '                    (NEC PC98)
+Const DIK_F14             = &H65    '                    (NEC PC98)
+Const DIK_F15             = &H66    '                    (NEC PC98)
+Const DIK_KANA            = &H70    '(Japanese keyboard)           
+Const DIK_ABNT_C1         = &H73    '/? on Brazilian keyboard
+Const DIK_CONVERT         = &H79    '(Japanese keyboard)           
+Const DIK_NOCONVERT       = &H7B    '(Japanese keyboard)           
+Const DIK_YEN             = &H7D    '(Japanese keyboard)           
+Const DIK_ABNT_C2         = &H7E    'Numpad . on Brazilian keyboard
+Const DIK_NUMPADEQUALS    = &H8D    '= on numeric keypad (NEC PC98)
+Const DIK_PREVTRACK       = &H90    'Previous Track (DIK_CIRCUMFLEX on Japanese keyboard)
+Const DIK_AT              = &H91    '                    (NEC PC98)
+Const DIK_COLON           = &H92    '                    (NEC PC98)
+Const DIK_UNDERLINE       = &H93    '                    (NEC PC98)
+Const DIK_KANJI           = &H94    '(Japanese keyboard)           
+Const DIK_STOP            = &H95    '                    (NEC PC98)
+Const DIK_AX              = &H96    '                    (Japan AX)
+Const DIK_UNLABELED       = &H97    '                       (J3100)
+Const DIK_NEXTTRACK       = &H99    'Next Track
+Const DIK_NUMPADENTER     = &H9C    'Enter on numeric keypad
+Const DIK_RCONTROL        = &H9D
+Const DIK_MUTE            = &HA0    'Mute
+Const DIK_CALCULATOR      = &HA1    'Calculator
+Const DIK_PLAYPAUSE       = &HA2    'Play / Pause
+Const DIK_MEDIASTOP       = &HA4    'Media Stop
+Const DIK_VOLUMEDOWN      = &HAE    'Volume -
+Const DIK_VOLUMEUP        = &HB0    'Volume +
+Const DIK_WEBHOME         = &HB2    'Web home
+Const DIK_NUMPADCOMMA     = &HB3    ', on numeric keypad (NEC PC98)
+Const DIK_DIVIDE          = &HB5    '/ on numeric keypad
+Const DIK_SYSRQ           = &HB7
+Const DIK_RMENU           = &HB8    'right Alt
+Const DIK_PAUSE           = &HC5    'Pause
+Const DIK_HOME            = &HC7    'Home on arrow keypad
+Const DIK_UP              = &HC8    'UpArrow on arrow keypad
+Const DIK_PRIOR           = &HC9    'PgUp on arrow keypad
+Const DIK_LEFT            = &HCB    'LeftArrow on arrow keypad
+Const DIK_RIGHT           = &HCD    'RightArrow on arrow keypad
+Const DIK_END             = &HCF    'End on arrow keypad
+Const DIK_DOWN            = &HD0    'DownArrow on arrow keypad
+Const DIK_NEXT            = &HD1    'PgDn on arrow keypad
+Const DIK_INSERT          = &HD2    'Insert on arrow keypad
+Const DIK_DELETE          = &HD3    'Delete on arrow keypad
+Const DIK_LWIN            = &HDB    'Left Windows key
+Const DIK_RWIN            = &HDC    'Right Windows key
+Const DIK_APPS            = &HDD    'AppMenu key
+Const DIK_POWER           = &HDE    'System Power
+Const DIK_SLEEP           = &HDF    'System Sleep
+Const DIK_WAKE            = &HE3    'System Wake
+Const DIK_WEBSEARCH       = &HE5    'Web Search
+Const DIK_WEBFAVORITES    = &HE6    'Web Favorites
+Const DIK_WEBREFRESH      = &HE7    'Web Refresh
+Const DIK_WEBSTOP         = &HE8    'Web Stop
+Const DIK_WEBFORWARD      = &HE9    'Web Forward
+Const DIK_WEBBACK         = &HEA    'Web Back
+Const DIK_MYCOMPUTER      = &HEB    'My Computer
+Const DIK_MAIL            = &HEC    'Mail
+Const DIK_MEDIASELECT     = &HED    'Media Select
+
+' Alternate names for keys, to facilitate transition from DOS.
+Const DIK_BACKSPACE       = DIK_BACK            'backspace
+Const DIK_NUMPADSTAR      = DIK_MULTIPLY        '* on numeric keypad
+Const DIK_LALT            = DIK_LMENU           'left Alt
+Const DIK_CAPSLOCK        = DIK_CAPITAL         'CapsLock
+Const DIK_NUMPADMINUS     = DIK_SUBTRACT        '- on numeric keypad
+Const DIK_NUMPADPLUS      = DIK_ADD             '+ on numeric keypad
+Const DIK_NUMPADPERIOD    = DIK_DECIMAL         '. on numeric keypad
+Const DIK_NUMPADSLASH     = DIK_DIVIDE          '/ on numeric keypad
+Const DIK_RALT            = DIK_RMENU           'right Alt
+Const DIK_UPARROW         = DIK_UP              'UpArrow on arrow keypad
+Const DIK_PGUP            = DIK_PRIOR           'PgUp on arrow keypad
+Const DIK_LEFTARROW       = DIK_LEFT            'LeftArrow on arrow keypad
+Const DIK_RIGHTARROW      = DIK_RIGHT           'RightArrow on arrow keypad
+Const DIK_DOWNARROW       = DIK_DOWN            'DownArrow on arrow keypad
+Const DIK_PGDN            = DIK_NEXT            'PgDn on arrow keypad
+
+' Alternate names for keys originally not used on US keyboards.
+Const DIK_CIRCUMFLEX      = DIK_PREVTRACK       'Japanese keyboard
+
+
+'-----------------------
+' Mouse
+'-----------------------
+
+Type DIMOUSESTATE
+	lX As Long
+	lY As Long
+	lZ As Long
+	rgbButtons[3] As Byte
+End Type
+
+Type DIMOUSESTATE2
+	lX As Long
+	lY As Long
+	lZ As Long
+	rgbButtons[7] As Byte
+End Type
+
+
+Declare Function DirectInput8Create Lib "dinput8" (hinst As HINSTANCE, dwVersion As DWord, ByRef riidltf As GUID, ppvOut As *DWord, punkOuter As *IUnknown) As DWord
+
+
+'-------------------
+' Device Data Type
+'-------------------
+
+'c_dfDIKeyboard
+Sub _System_DirectInput_Keyboard_SetDataType(p As *DIOBJECTDATAFORMAT)
+	Dim i As Long
+	For i=0 To 255
+		p[i].pguid=VarPtr(GUID_Key)
+		p[i].dwOfs=i
+		p[i].dwType=DIDFT_BUTTON or DIDFT_OPTIONAL or (i<<8)
+		p[i].dwFlags=0
+	Next
+End Sub
+Dim _System_dfDIKeyboardObjectDataFormat[255] As DIOBJECTDATAFORMAT
+_System_DirectInput_Keyboard_SetDataType(_System_dfDIKeyboardObjectDataFormat)
+Dim c_dfDIKeyboard=[24,16,DIDF_RELAXIS,256,256,0] As DIDATAFORMAT
+c_dfDIKeyboard.rgodf=_System_dfDIKeyboardObjectDataFormat
+
+'c_dfDIMouse
+Dim _System_dfDIMouseObjectDataFormat[6]=[
+	[0,&H00,DIDFT_ANYINSTANCE or DIDFT_AXIS,0],
+	[0,&H04,DIDFT_ANYINSTANCE or DIDFT_AXIS,0],
+	[0,&H08,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,0],
+	[0,&H0C,DIDFT_ANYINSTANCE or DIDFT_BUTTON,0],
+	[0,&H0D,DIDFT_ANYINSTANCE or DIDFT_BUTTON,0],
+	[0,&H0E,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
+	[0,&H0F,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0]
+] As DIOBJECTDATAFORMAT
+_System_dfDIMouseObjectDataFormat[0].pguid=VarPtr(GUID_XAxis)
+_System_dfDIMouseObjectDataFormat[1].pguid=VarPtr(GUID_YAxis)
+_System_dfDIMouseObjectDataFormat[2].pguid=VarPtr(GUID_ZAxis)
+Dim c_dfDIMouse=[24,16,DIDF_RELAXIS,16,7,0] As DIDATAFORMAT
+c_dfDIMouse.rgodf=_System_dfDIMouseObjectDataFormat
+
+'c_dfDIMouse2
+Dim _System_dfDIMouse2ObjectDataFormat[10]=[
+	[0,&H00,DIDFT_ANYINSTANCE or DIDFT_AXIS,0],
+	[0,&H04,DIDFT_ANYINSTANCE or DIDFT_AXIS,0],
+	[0,&H08,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,0],
+	[0,&H0C,DIDFT_ANYINSTANCE or DIDFT_BUTTON,0],
+	[0,&H0D,DIDFT_ANYINSTANCE or DIDFT_BUTTON,0],
+	[0,&H0E,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
+	[0,&H0F,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
+	[0,&H10,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
+	[0,&H11,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
+	[0,&H12,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
+	[0,&H13,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0]
+] As DIOBJECTDATAFORMAT
+_System_dfDIMouse2ObjectDataFormat[0].pguid=VarPtr(GUID_XAxis)
+_System_dfDIMouse2ObjectDataFormat[1].pguid=VarPtr(GUID_YAxis)
+_System_dfDIMouse2ObjectDataFormat[2].pguid=VarPtr(GUID_ZAxis)
+Dim c_dfDIMouse2=[24,16,DIDF_RELAXIS,20,11,0] As DIDATAFORMAT
+c_dfDIMouse2.rgodf=_System_dfDIMouse2ObjectDataFormat
+
+'c_dfDIJoystick
+Sub _System_DirectInput_Joystick_SetDataType(p As *DIOBJECTDATAFORMAT)
+	Dim i As Long
+	For i=12 To &H2B
+		p[i].pguid=0
+		p[i].dwOfs=&H30+i-12
+		p[i].dwType=DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL or (i<<8)
+		p[i].dwFlags=0
+	Next
+End Sub
+Dim _System_dfDIJoystickObjectDataFormat[&H2B]=[
+	[0,&H00,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H04,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H08,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H0C,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H10,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H14,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H18,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H1C,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H20,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
+	[0,&H24,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
+	[0,&H28,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
+	[0,&H2C,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0]
+] As DIOBJECTDATAFORMAT
+_System_dfDIJoystickObjectDataFormat[0].pguid=VarPtr(GUID_XAxis)
+_System_dfDIJoystickObjectDataFormat[1].pguid=VarPtr(GUID_YAxis)
+_System_dfDIJoystickObjectDataFormat[2].pguid=VarPtr(GUID_ZAxis)
+_System_dfDIJoystickObjectDataFormat[3].pguid=VarPtr(GUID_RxAxis)
+_System_dfDIJoystickObjectDataFormat[4].pguid=VarPtr(GUID_RyAxis)
+_System_dfDIJoystickObjectDataFormat[5].pguid=VarPtr(GUID_RzAxis)
+_System_dfDIJoystickObjectDataFormat[6].pguid=VarPtr(GUID_Slider)
+_System_dfDIJoystickObjectDataFormat[7].pguid=VarPtr(GUID_Slider)
+_System_dfDIJoystickObjectDataFormat[8].pguid=VarPtr(GUID_POV)
+_System_dfDIJoystickObjectDataFormat[9].pguid=VarPtr(GUID_POV)
+_System_dfDIJoystickObjectDataFormat[10].pguid=VarPtr(GUID_POV)
+_System_dfDIJoystickObjectDataFormat[11].pguid=VarPtr(GUID_POV)
+_System_DirectInput_Joystick_SetDataType(_System_dfDIJoystickObjectDataFormat)
+Dim c_dfDIJoystick=[24,16,DIDF_ABSAXIS,&H50,&H2C,0] As DIDATAFORMAT
+c_dfDIJoystick.rgodf=_System_dfDIJoystickObjectDataFormat
+
+'c_dfDIJoystick2
+Sub _System_DirectInput_Joystick2_SetDataType(p As *DIOBJECTDATAFORMAT)
+	Dim i As Long
+	For i=12 To &H8B
+		p[i].pguid=0
+		p[i].dwOfs=&H30+i-12
+		p[i].dwType=DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL or (i<<8)
+		p[i].dwFlags=0
+	Next
+
+	With p[&H8C]:.pguid=VarPtr(GUID_XAxis):.dwOfs=&HB0:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
+	With p[&H8D]:.pguid=VarPtr(GUID_YAxis):.dwOfs=&HB4:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
+	With p[&H8E]:.pguid=VarPtr(GUID_ZAxis):.dwOfs=&HB8:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
+	With p[&H8F]:.pguid=VarPtr(GUID_RxAxis):.dwOfs=&HBC:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
+	With p[&H90]:.pguid=VarPtr(GUID_RyAxis):.dwOfs=&HC0:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
+	With p[&H91]:.pguid=VarPtr(GUID_RzAxis):.dwOfs=&HC4:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
+	With p[&H92]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H18:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
+	With p[&H93]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H1C:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
+
+	With p[&H94]:.pguid=VarPtr(GUID_XAxis):.dwOfs=&HD0:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
+	With p[&H95]:.pguid=VarPtr(GUID_YAxis):.dwOfs=&HD4:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
+	With p[&H96]:.pguid=VarPtr(GUID_ZAxis):.dwOfs=&HD8:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
+	With p[&H97]:.pguid=VarPtr(GUID_RxAxis):.dwOfs=&HDC:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
+	With p[&H98]:.pguid=VarPtr(GUID_RyAxis):.dwOfs=&HE0:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
+	With p[&H99]:.pguid=VarPtr(GUID_RzAxis):.dwOfs=&HE4:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
+	With p[&H9A]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H18:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
+	With p[&H9B]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H1C:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
+
+	With p[&H9C]:.pguid=VarPtr(GUID_XAxis):.dwOfs=&HF0:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
+	With p[&H9D]:.pguid=VarPtr(GUID_YAxis):.dwOfs=&HF4:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
+	With p[&H9E]:.pguid=VarPtr(GUID_ZAxis):.dwOfs=&HF8:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
+	With p[&H9F]:.pguid=VarPtr(GUID_RxAxis):.dwOfs=&HFC:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
+	With p[&HA0]:.pguid=VarPtr(GUID_RyAxis):.dwOfs=&H100:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
+	With p[&HA1]:.pguid=VarPtr(GUID_RzAxis):.dwOfs=&H104:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
+	With p[&HA2]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H18:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
+	With p[&HA3]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H1C:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
+End Sub
+Dim _System_dfDIJoystick2ObjectDataFormat[&HA3]=[
+	[0,&H00,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H04,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H08,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H0C,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H10,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H14,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H18,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H1C,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
+	[0,&H20,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
+	[0,&H24,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
+	[0,&H28,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
+	[0,&H2C,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0]
+] As DIOBJECTDATAFORMAT
+_System_dfDIJoystick2ObjectDataFormat[0].pguid=VarPtr(GUID_XAxis)
+_System_dfDIJoystick2ObjectDataFormat[1].pguid=VarPtr(GUID_YAxis)
+_System_dfDIJoystick2ObjectDataFormat[2].pguid=VarPtr(GUID_ZAxis)
+_System_dfDIJoystick2ObjectDataFormat[3].pguid=VarPtr(GUID_RxAxis)
+_System_dfDIJoystick2ObjectDataFormat[4].pguid=VarPtr(GUID_RyAxis)
+_System_dfDIJoystick2ObjectDataFormat[5].pguid=VarPtr(GUID_RzAxis)
+_System_dfDIJoystick2ObjectDataFormat[6].pguid=VarPtr(GUID_Slider)
+_System_dfDIJoystick2ObjectDataFormat[7].pguid=VarPtr(GUID_Slider)
+_System_dfDIJoystick2ObjectDataFormat[8].pguid=VarPtr(GUID_POV)
+_System_dfDIJoystick2ObjectDataFormat[9].pguid=VarPtr(GUID_POV)
+_System_dfDIJoystick2ObjectDataFormat[10].pguid=VarPtr(GUID_POV)
+_System_dfDIJoystick2ObjectDataFormat[11].pguid=VarPtr(GUID_POV)
+_System_DirectInput_Joystick2_SetDataType(_System_dfDIJoystickObjectDataFormat)
+Dim c_dfDIJoystick2=[24,16,DIDF_ABSAXIS,&H110,&HA4,0] As DIDATAFORMAT
+c_dfDIJoystick2.rgodf=_System_dfDIJoystick2ObjectDataFormat
+
+
+#endif '_INC_DINPUT
Index: /trunk/ab5.0/ablib/src/directx9/dmdls.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/dmdls.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/dmdls.sbp	(revision 506)
@@ -0,0 +1,6 @@
+' dmdls.sbp - DLS download definitions for DirectMusic API's
+
+Type DMUS_NOTERANGE
+	dwLowNote As DWord   'Sets the low note for the range of MIDI note events to which the instrument responds.
+	dwHighNote As DWord  'Sets the high note for the range of MIDI note events to which the instrument responds.
+End Type
Index: /trunk/ab5.0/ablib/src/directx9/dmplugin.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/dmplugin.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/dmplugin.sbp	(revision 506)
@@ -0,0 +1,67 @@
+' dmplugin.sbp - This module contains the API for plugins for the DirectMusic performance layer
+
+Class IDirectMusicTool
+	Inherits IUnknown
+Public
+	'IDirectMusicTool
+	Abstract Function Init(pGraph As *IDirectMusicGraph) As DWord
+	Abstract Function GetMsgDeliveryType(pdwDeliveryType As DWordPtr) As DWord
+	Abstract Function GetMediaTypeArraySize(pdwNumElements As DWordPtr) As DWord
+	Abstract Function GetMediaTypes(padwMediaTypes As **DWord, dwNumElements As DWord) As DWord
+	Abstract Function ProcessPMsg(pPerf As *IDirectMusicPerformance, pPMSG As *DMUS_PMSG) As DWord
+	Abstract Function Flush(pPerf As *IDirectMusicPerformance, pPMSG As *DMUS_PMSG, rtTime As REFERENCE_TIME) As DWord
+End Class
+
+Class IDirectMusicTool8
+	Inherits IDirectMusicTool
+Public
+	'IDirectMusicTool8
+	Abstract Function Clone(ppTool As **IDirectMusicTool) As DWord
+End Class
+
+' The following flags are sent in the IDirectMusicTrack::Play() method inside the dwFlags parameter
+Const Enum DMUS_TRACKF_FLAGS
+	DMUS_TRACKF_SEEK            = 1       'set on a seek
+	DMUS_TRACKF_LOOP            = 2       'set on a loop (repeat)
+	DMUS_TRACKF_START           = 4       'set on first call to Play
+	DMUS_TRACKF_FLUSH           = 8       'set when this call is in response to a flush on the perfomance
+	DMUS_TRACKF_DIRTY           = &H10    'set when the track should consider any cached values from a previous call to GetParam to be invalidated
+    'The following flags are DX8 only.
+	DMUS_TRACKF_NOTIFY_OFF      = &H20    'tells track not to send notifications.
+	DMUS_TRACKF_PLAY_OFF        = &H40    'tells track not to play anything (but can still send notifications.)
+	DMUS_TRACKF_LOOPEND         = &H80    'set when the end of range is also a loop end.
+	DMUS_TRACKF_STOP            = &H100   'set when the end of range is also end of playing this segment.
+	DMUS_TRACKF_RECOMPOSE       = &H200   'set to indicate the track should compose.
+	DMUS_TRACKF_CLOCK           = &H400   'set when time parameters are in reference (clock) time. Only valid for PlayEx().
+End Enum
+
+' The following flags are sent in the IDirectMusicTrack8::GetParamEx() and SetParamEx() methods
+' inside the dwFlags parameter.
+Const DMUS_TRACK_PARAMF_CLOCK = &H01   'set when the time is measured is in reference (clock) time
+
+Class IDirectMusicTrack
+	Inherits IUnknown
+Public
+	'IDirectMusicTrack
+	Abstract Function Init(pSegment As *IDirectMusicSegment) As DWord
+	Abstract Function InitPlay(pSegmentState As *IDirectMusicSegmentState, pPerformance As *IDirectMusicPerformance, ppStateData As DWordPtr, dwVirtualTrackID As DWord, dwFlags As DWord) As DWord
+	Abstract Function EndPlay(pStateData As VoidPtr) As DWord
+	Abstract Function Play(pStateData As VoidPtr, mtStart As MUSIC_TIME, mtEnd As MUSIC_TIME, mtOffset As MUSIC_TIME, dwFlags As DWord, pPerf As *IDirectMusicPerformance, pSegSt As *IDirectMusicSegmentState, dwVirtualID As DWord) As DWord
+	Abstract Function GetParam(ByRef rguidType As GUID, mtTime As MUSIC_TIME, pmtNext As *MUSIC_TIME, pParam As VoidPtr) As DWord
+	Abstract Function SetParam(ByRef rguidType As GUID, mtTime As MUSIC_TIME, pParam As VoidPtr) As DWord
+	Abstract Function IsParamSupported(ByRef rguidType As GUID) As DWord
+	Abstract Function AddNotificationType(ByRef rguidNotificationType As GUID) As DWord
+	Abstract Function RemoveNotificationType(ByRef rguidNotificationType As GUID) As DWord
+	Abstract Function Clone(mtStart As MUSIC_TIME, mtEnd As MUSIC_TIME, ppTrack As **IDirectMusicTrack) As DWord
+End Class
+
+Class IDirectMusicTrack8
+	Inherits IDirectMusicTrack
+Public
+	'IDirectMusicTrack8
+	Abstract Function PlayEx(pStateData As VoidPtr, rtStart As REFERENCE_TIME, rtEnd As REFERENCE_TIME, rtOffset As REFERENCE_TIME, dwFlags As DWord, pPerf As *IDirectMusicPerformance, pSegSt As *IDirectMusicSegmentState, dwVirtualID As DWord) As DWord
+	Abstract Function GetParamEx(ByRef rguidType As GUID, rtTime As REFERENCE_TIME, prtNext As *REFERENCE_TIME, pParam As VoidPtr, pStateData As VoidPtr, dwFlags As DWord) As DWord
+	Abstract Function SetParamEx(ByRef rguidType As GUID, rtTime As REFERENCE_TIME, pParam As VoidPtr, pStateData As VoidPtr, dwFlags As DWord) As DWord
+	Abstract Function Compose(pContext As *IUnknown, dwTrackGroup As DWord, ppResultTrack As **IDirectMusicTrack) As DWord
+	Abstract Function Join(pNewTrack As *IDirectMusicTrack, mtJoin As MUSIC_TIME, pContext As *IUnknown, dwTrackGroup As DWord, ppResultTrack As **IDirectMusicTrack) As DWord
+End Class
Index: /trunk/ab5.0/ablib/src/directx9/dmusic.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/dmusic.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/dmusic.sbp	(revision 506)
@@ -0,0 +1,715 @@
+' dmusic.sbp - This module contains the API for the DirectMusic performance layer
+
+
+#ifndef _INC_DMUSIC
+#define _INC_DMUSIC
+
+
+#require <directx9\dsound.sbp>
+#require <directx9\dmdls.sbp>
+#require <directx9\dmusicc.sbp>
+#require <directx9\dmplugin.sbp>
+
+
+TypeDef REFERENCE_TIME = Int64
+TypeDef MUSIC_TIME     = Long
+
+
+' For DMUS_PMSG dwFlags
+Const Enum DMUS_PMSGF_FLAGS
+	DMUS_PMSGF_REFTIME          = 1
+	DMUS_PMSGF_MUSICTIME        = 2
+	DMUS_PMSGF_TOOL_IMMEDIATE   = 4
+	DMUS_PMSGF_TOOL_QUEUE       = 8
+	DMUS_PMSGF_TOOL_ATTIME      = &H10
+	DMUS_PMSGF_TOOL_FLUSH       = &H20
+	DMUS_PMSGF_LOCKTOREFTIME    = &H40
+	DMUS_PMSGF_DX8              = &H80
+End Enum
+
+Const Enum DMUS_PMSGT_TYPES
+	DMUS_PMSGT_MIDI             = 0
+	DMUS_PMSGT_NOTE             = 1
+	DMUS_PMSGT_SYSEX            = 2
+	DMUS_PMSGT_NOTIFICATION     = 3
+	DMUS_PMSGT_TEMPO            = 4
+	DMUS_PMSGT_CURVE            = 5
+	DMUS_PMSGT_TIMESIG          = 6
+	DMUS_PMSGT_PATCH            = 7
+	DMUS_PMSGT_TRANSPOSE        = 8
+	DMUS_PMSGT_CHANNEL_PRIORITY = 9
+	DMUS_PMSGT_STOP             = 10
+	DMUS_PMSGT_DIRTY            = 11
+	DMUS_PMSGT_WAVE             = 12
+	DMUS_PMSGT_LYRIC            = 13
+	DMUS_PMSGT_SCRIPTLYRIC      = 14
+	DMUS_PMSGT_USER             = 255
+End Enum
+
+Const DMUS_PCHANNEL_BROADCAST_PERFORMANCE   = &HFFFFFFFF  'PMsg is sent on all PChannels of the performance.
+Const DMUS_PCHANNEL_BROADCAST_AUDIOPATH     = &HFFFFFFFE  'PMsg is sent on all PChannels of the audio path.
+Const DMUS_PCHANNEL_BROADCAST_SEGMENT       = &HFFFFFFFD  'PMsg is sent on all PChannels of the segment.
+Const DMUS_PCHANNEL_BROADCAST_GROUPS        = &HFFFFFFFC  'A duplicate PMsg is for each Channels Groups in the performance.
+
+Const DMUS_PATH_SEGMENT           = &H1000      'Get the segment itself (from a segment state.)
+Const DMUS_PATH_SEGMENT_TRACK     = &H1100      'Look in Track List of Segment.
+Const DMUS_PATH_SEGMENT_GRAPH     = &H1200      'Get the segment's tool graph.
+Const DMUS_PATH_SEGMENT_TOOL      = &H1300      'Look in Tool Graph of Segment.
+Const DMUS_PATH_AUDIOPATH         = &H2000      'Get the audiopath itself (from a segment state.)
+Const DMUS_PATH_AUDIOPATH_GRAPH   = &H2200      'Get the audiopath's tool graph.
+Const DMUS_PATH_AUDIOPATH_TOOL    = &H2300      'Look in Tool Graph of Audio Path.
+Const DMUS_PATH_PERFORMANCE       = &H3000      'Access the performance.
+Const DMUS_PATH_PERFORMANCE_GRAPH = &H3200      'Get the performance's tool graph.
+Const DMUS_PATH_PERFORMANCE_TOOL  = &H3300      'Look in Tool Graph of Performance.
+Const DMUS_PATH_PORT              = &H4000      'Access the synth.
+Const DMUS_PATH_BUFFER            = &H6000      'Look in DirectSoundBuffer.
+Const DMUS_PATH_BUFFER_DMO        = &H6100      'Access a DMO in the buffer.
+Const DMUS_PATH_MIXIN_BUFFER      = &H7000      'Look in a global mixin buffer. 
+Const DMUS_PATH_MIXIN_BUFFER_DMO  = &H7100      'Access a DMO in a global mixin buffer. 
+Const DMUS_PATH_PRIMARY_BUFFER    = &H8000      'Access the primary buffer. 
+
+Const DMUS_PCHANNEL_ALL           = &HFFFFFFFB      
+
+Type DMUS_PMSG
+	dwSize As DWord
+	rtTime As REFERENCE_TIME
+	mtTime As MUSIC_TIME
+	dwFlags As DWord
+	dwPChannel As DWord
+	dwVirtualTrackID As DWord
+	pTool As *IDirectMusicTool
+	pGraph As *IDirectMusicGraph
+	dwType As DWord
+	dwVoiceID As DWord
+	dwGroupID As DWord
+	punkUser As *IUnknown
+End Type
+
+Const DMUS_APATH_SHARED_STEREOPLUSREVERB = 1
+Const DMUS_APATH_DYNAMIC_3D              = 6
+Const DMUS_APATH_DYNAMIC_MONO            = 7
+Const DMUS_APATH_DYNAMIC_STEREO          = 8
+
+' For DMUS_AUDIOPARAMS dwFeatures
+Const DMUS_AUDIOF_3D         = &H1
+Const DMUS_AUDIOF_ENVIRON    = &H2
+Const DMUS_AUDIOF_EAX        = &H4
+Const DMUS_AUDIOF_DMOS       = &H8
+Const DMUS_AUDIOF_STREAMING  = &H10
+Const DMUS_AUDIOF_BUFFERS    = &H20
+Const DMUS_AUDIOF_ALL        = &H3F
+
+' For DMUS_AUDIOPARAMS dwValidData
+Const DMUS_AUDIOPARAMS_FEATURES      = &H00000001
+Const DMUS_AUDIOPARAMS_VOICES        = &H00000002
+Const DMUS_AUDIOPARAMS_SAMPLERATE    = &H00000004
+Const DMUS_AUDIOPARAMS_DEFAULTSYNTH  = &H00000008
+
+Type DMUS_AUDIOPARAMS
+	dwSize As DWord
+	fInitNow As Long
+	dwValidData As DWord
+	dwFeatures As DWord
+	dwVoices As DWord
+	dwSampleRate As DWord
+	clsidDefaultSynth As GUID
+End Type
+
+' DMUS_SEGF_FLAGS correspond to IDirectMusicPerformance::PlaySegment
+Const Enum DMUS_SEGF_FLAGS
+	DMUS_SEGF_REFTIME           = 1<<6    '&H40 Time parameter is in reference time
+	DMUS_SEGF_SECONDARY         = 1<<7    '&H80 Secondary segment
+	DMUS_SEGF_QUEUE             = 1<<8    '&H100 Queue at the end of the primary segment queue (primary only)
+	DMUS_SEGF_CONTROL           = 1<<9    '&H200 Play as a control track (secondary segments only)
+	DMUS_SEGF_AFTERPREPARETIME  = 1<<10   '&H400 Play after the prepare time (See IDirectMusicPerformance::GetPrepareTime)
+	DMUS_SEGF_GRID              = 1<<11   '&H800 Play on grid boundary
+	DMUS_SEGF_BEAT              = 1<<12   '&H1000 Play on beat boundary
+	DMUS_SEGF_MEASURE           = 1<<13   '&H2000 Play on measure boundary
+	DMUS_SEGF_DEFAULT           = 1<<14   '&H4000 Use segment's default boundary
+	DMUS_SEGF_NOINVALIDATE      = 1<<15   '&H8000 Play without invalidating the currently playing segment(s)
+	DMUS_SEGF_ALIGN             = 1<<16   '&H10000 Align segment with requested boundary, but switch at first valid point
+	DMUS_SEGF_VALID_START_BEAT  = 1<<17   '&H20000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any beat.
+	DMUS_SEGF_VALID_START_GRID  = 1<<18   '&H40000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any grid.
+	DMUS_SEGF_VALID_START_TICK  = 1<<19   '&H80000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur any time.
+	DMUS_SEGF_AUTOTRANSITION    = 1<<20   '&H100000 Compose and play a transition segment, using the transition template.
+	DMUS_SEGF_AFTERQUEUETIME    = 1<<21   '&H200000 Make sure to play after the queue time. This is default for primary segments
+	DMUS_SEGF_AFTERLATENCYTIME  = 1<<22   '&H400000 Make sure to play after the latency time. This is true for all segments, so this is a nop
+	DMUS_SEGF_SEGMENTEND        = 1<<23   '&H800000 Play at the next end of segment.
+	DMUS_SEGF_MARKER            = 1<<24   '&H1000000 Play at next marker in the primary segment. If there are no markers, default to any other resolution requests.
+	DMUS_SEGF_TIMESIG_ALWAYS    = 1<<25   '&H2000000 Even if there is no primary segment, align start time with current time signature.
+	DMUS_SEGF_USE_AUDIOPATH     = 1<<26   '&H4000000 Uses the audio path that is embedded in the segment.
+	DMUS_SEGF_VALID_START_MEASURE = 1<<27 '&H8000000 In conjunction with DMUS_SEGF_ALIGN, allows the switch to occur on any bar.
+	DMUS_SEGF_INVALIDATE_PRI    = 1<<28   '&H10000000 invalidate only the current primary seg state
+End Enum
+
+Const DMUS_SEG_REPEAT_INFINITE = &HFFFFFFFF  'For IDirectMusicSegment::SetRepeat
+Const DMUS_SEG_ALLTRACKS       = &H80000000  'For IDirectMusicSegment::SetParam() and SetTrackConfig() - selects all tracks instead on nth index.
+Const DMUS_SEG_ANYTRACK        = &H80000000  'For IDirectMusicSegment::GetParam() - checks each track until it finds one that returns data (not DMUS_E_NOT_FOUND.)
+
+Const Enum DMUS_TIME_RESOLVE_FLAGS
+	DMUS_TIME_RESOLVE_AFTERPREPARETIME  = DMUS_SEGF_AFTERPREPARETIME
+	DMUS_TIME_RESOLVE_AFTERQUEUETIME    = DMUS_SEGF_AFTERQUEUETIME
+	DMUS_TIME_RESOLVE_AFTERLATENCYTIME  = DMUS_SEGF_AFTERLATENCYTIME
+	DMUS_TIME_RESOLVE_GRID              = DMUS_SEGF_GRID
+	DMUS_TIME_RESOLVE_BEAT              = DMUS_SEGF_BEAT
+	DMUS_TIME_RESOLVE_MEASURE           = DMUS_SEGF_MEASURE
+	DMUS_TIME_RESOLVE_MARKER            = DMUS_SEGF_MARKER
+	DMUS_TIME_RESOLVE_SEGMENTEND        = DMUS_SEGF_SEGMENTEND
+End Enum
+
+' The following flags are sent inside the DMUS_CHORD_KEY.dwFlags parameter
+Const Enum DMUS_CHORDKEYF_FLAGS
+	DMUS_CHORDKEYF_SILENT = 1     'is the chord silent?
+End Enum
+
+Const DMUS_MAXSUBCHORD = 8
+Type DMUS_SUBCHORD
+	dwChordPattern As DWord
+	dwScalePattern As DWord
+	dwInversionPoints As DWord
+	dwLevels As DWord
+	bChordRoot As Byte
+	bScaleRoot As Byte
+End Type
+Type DMUS_CHORD_KEY
+	wszName[16-1] As WCHAR
+	wMeasure As Word
+	bBeat As Byte
+	bSubChordCount As Byte
+	SubChordList[DMUS_MAXSUBCHORD-1] As DMUS_SUBCHORD
+	dwScale As DWord
+	bKey As Byte
+	bFlags As Byte
+End Type
+
+Type DMUS_NOTIFICATION_PMSG
+	dwSize As DWord
+	rtTime As REFERENCE_TIME
+	mtTime As MUSIC_TIME
+	dwFlags As DWord
+	dwPChannel As DWord
+	dwVirtualTrackID As DWord
+	pTool As *IDirectMusicTool
+	pGraph As *IDirectMusicGraph
+	dwType As DWord
+	dwVoiceID As DWord
+	dwGroupID As DWord
+	punkUser As *IUnknown
+
+	guidNotificationType As GUID
+	dwNotificationOption As DWord
+	dwField1 As DWord
+	dwField2 As DWord
+End Type
+
+Const DMUS_MAX_NAME     = 64
+Const DMUS_MAX_CATEGORY = 64
+Const DMUS_MAX_FILENAME = MAX_PATH
+
+Type DMUS_VERSION
+	dwVersionMS As DWord
+	dwVersionLS As DWord
+End Type
+
+Type DMUS_TIMESIGNATURE
+	mtTime As MUSIC_TIME
+	bBeatsPerMeasure As Byte
+	bBeat As Byte
+	wGridsPerBeat As Word
+End Type
+
+' For DMUS_OBJECTDESC dwValidData
+Const DMUS_OBJ_OBJECT   = 1 << 0    'Object GUID is valid.
+Const DMUS_OBJ_CLASS    = 1 << 1    'Class GUID is valid.
+Const DMUS_OBJ_NAME     = 1 << 2    'Name is valid.
+Const DMUS_OBJ_CATEGORY = 1 << 3    'Category is valid.
+Const DMUS_OBJ_FILENAME = 1 << 4    'File path is valid.
+Const DMUS_OBJ_FULLPATH = 1 << 5    'Path is full path.
+Const DMUS_OBJ_URL      = 1 << 6    'Path is URL.
+Const DMUS_OBJ_VERSION  = 1 << 7    'Version is valid.
+Const DMUS_OBJ_DATE     = 1 << 8    'Date is valid.
+Const DMUS_OBJ_LOADED   = 1 << 9    'Object is currently loaded in memory.
+Const DMUS_OBJ_MEMORY   = 1 << 10   'Object is pointed to by pbMemData.
+Const DMUS_OBJ_STREAM   = 1 << 11   'Object is stored in pStream.
+
+Type DMUS_OBJECTDESC
+	dwSize As DWord
+	dwValidData As DWord
+	guidObject As GUID
+	guidClass As GUID
+	ftDate As FILETIME
+	vVersion As DMUS_VERSION
+	wszName[DMUS_MAX_NAME-1] As WCHAR
+	wszCategory[DMUS_MAX_CATEGORY-1] As WCHAR
+	wszFileName[DMUS_MAX_FILENAME-1] As WCHAR
+	llMemLength As Int64
+	pbMemData As BytePtr
+	pStream As *IStream
+End Type
+
+Type DMUS_SCRIPT_ERRORINFO
+	dwSize As DWord
+	hr As DWord
+	ulLineNumber As DWord
+	ichCharPosition As Long
+	wszSourceFile[DMUS_MAX_FILENAME-1] As WCHAR
+	wszSourceComponent[DMUS_MAX_FILENAME-1] As WCHAR
+	wszDescription[DMUS_MAX_FILENAME-1] As WCHAR
+	wszSourceLineText[DMUS_MAX_FILENAME-1] As WCHAR
+End Type
+
+' Track configuration flags, used with IDirectMusicSegment8::SetTrackConfig()
+Const DMUS_TRACKCONFIG_OVERRIDE_ALL           = 1	    'This track should get parameters from this segment before controlling and primary tracks.
+Const DMUS_TRACKCONFIG_OVERRIDE_PRIMARY       = 2	    'This track should get parameters from this segment before the primary segment tracks.
+Const DMUS_TRACKCONFIG_FALLBACK               = 4  	    'This track should get parameters from this segment if the primary and controlling segments don't succeed.
+Const DMUS_TRACKCONFIG_CONTROL_ENABLED        = 8       'GetParam() enabled for this track.
+Const DMUS_TRACKCONFIG_PLAY_ENABLED           = &H10    'Play() enabled for this track.
+Const DMUS_TRACKCONFIG_NOTIFICATION_ENABLED	  = &H20    'Notifications enabled for this track.
+Const DMUS_TRACKCONFIG_PLAY_CLOCKTIME         = &H40    'This track plays in clock time, not music time.
+Const DMUS_TRACKCONFIG_PLAY_COMPOSE 	      = &H80    'This track should regenerate data each time it starts playing.
+Const DMUS_TRACKCONFIG_LOOP_COMPOSE           = &H100   'This track should regenerate data each time it repeats.
+Const DMUS_TRACKCONFIG_COMPOSING              = &H200   'This track is used to compose other tracks.
+Const DMUS_TRACKCONFIG_CONTROL_PLAY           = &H10000 'This track, when played in a controlling segment, overrides playback of primary segment tracks.
+Const DMUS_TRACKCONFIG_CONTROL_NOTIFICATION   = &H20000 'This track, when played in a controlling segment, overrides notification of primary segment tracks.
+' Additional track config flags for composing transitions
+Const DMUS_TRACKCONFIG_TRANS1_FROMSEGSTART    = &H400    'Get track info from start of From segment
+Const DMUS_TRACKCONFIG_TRANS1_FROMSEGCURRENT  = &H800    'Get track info from current place in From segment
+Const DMUS_TRACKCONFIG_TRANS1_TOSEGSTART      = &H1000   'Get track info from start of To segment
+Const DMUS_TRACKCONFIG_DEFAULT                = DMUS_TRACKCONFIG_CONTROL_ENABLED or DMUS_TRACKCONFIG_PLAY_ENABLED or DMUS_TRACKCONFIG_NOTIFICATION_ENABLED
+
+
+'-----------------
+' Interfaces
+'-----------------
+
+Class IDirectMusicBand
+	Inherits IUnknown
+Public
+	'IDirectMusicBand
+	Abstract Function CreateSegment(ppSegment As **IDirectMusicSegment) As DWord
+	Abstract Function Download(pPerformance As *IDirectMusicPerformance) As DWord
+	Abstract Function Unload(pPerformance As *IDirectMusicPerformance) As DWord
+End Class
+TypeDef IDirectMusicBand8 = IDirectMusicBand
+
+Class IDirectMusicObject
+	Inherits IUnknown
+Public
+	'IDirectMusicObject
+	Abstract Function GetDescriptor(pDesc As *DMUS_OBJECTDESC) As DWord
+	Abstract Function SetDescriptor(pDesc As *DMUS_OBJECTDESC) As DWord
+	Abstract Function ParseDescriptor(pStream As LPSTREAM, pDesc As *DMUS_OBJECTDESC) As DWord
+End Class
+TypeDef IDirectMusicObject8 = IDirectMusicObject
+
+Class IDirectMusicLoader
+	Inherits IUnknown
+Public
+	'IDirectMusicLoader
+	Abstract Function GetObject(pDesc As *DMUS_OBJECTDESC, ByRef riid As GUID, ppv As VoidPtr) As DWord
+	Abstract Function SetObject(pDesc As *DMUS_OBJECTDESC) As DWord
+	Abstract Function SetSearchDirectory(ByRef rguidClass As GUID, pwzPath As *WCHAR, fClear As Long) As DWord
+	Abstract Function ScanDirectory(ByRef rguidClass As GUID, pwzFileExtension As *WCHAR, pwzScanFileName As *WCHAR) As DWord
+	Abstract Function CacheObject(pObject As *IDirectMusicObject) As DWord
+	Abstract Function ReleaseObject(pObject As *IDirectMusicObject) As DWord
+	Abstract Function ClearCache(ByRef rguidClass As GUID) As DWord
+	Abstract Function EnableCache(ByRef rguidClass As GUID, fEnable As Long) As DWord
+	Abstract Function EnumObject(ByRef rguidClass As GUID, dwIndex As DWord, pDesc As *DMUS_OBJECTDESC) As DWord
+End Class
+
+Class IDirectMusicLoader8
+	Inherits IDirectMusicLoader
+Public
+	'IDirectMusicLoader8
+	Abstract Sub CollectGarbage()
+	Abstract Function ReleaseObjectByUnknown(pObject As *IUnknown) As DWord
+	Abstract Function LoadObjectFromFile(ByRef rguidClassID As GUID, ByRef iidInterfaceID As GUID, pwzFilePath As *WCHAR, ppObject As DWordPtr) As DWord
+End Class
+
+Class IDirectMusicGetLoader
+	Inherits IUnknown
+Public
+	'IDirectMusicGetLoader
+	Abstract Function GetLoader(ppLoader As **IDirectMusicLoader) As DWord
+End Class
+
+Class IDirectMusicSegment
+	Inherits IUnknown
+Public
+	'IDirectMusicSegment
+	Abstract Function GetLength(pmtLength As *MUSIC_TIME) As DWord
+	Abstract Function SetLength(mtLength As MUSIC_TIME) As DWord
+	Abstract Function GetRepeats(pdwRepeats As DWordPtr) As DWord
+	Abstract Function SetRepeats(dwRepeats As DWord) As DWord
+	Abstract Function GetDefaultResolution(pdwResolution As DWordPtr) As DWord
+	Abstract Function SetDefaultResolution(dwResolution As DWord) As DWord
+	Abstract Function GetTrack(ByRef rguidType As GUID, dwGroupBits As DWord, dwIndex As DWord, ppTrack As **IDirectMusicTrack) As DWord
+	Abstract Function GetTrackGroup(pTrack As *IDirectMusicTrack, pdwGroupBits As DWordPtr) As DWord
+	Abstract Function InsertTrack(pTrack As *IDirectMusicTrack, dwGroupBits As DWord) As DWord
+	Abstract Function RemoveTrack(pTrack As *IDirectMusicTrack) As DWord
+	Abstract Function InitPlay(ppSegState As **IDirectMusicSegmentState, pPerformance As *IDirectMusicPerformance, dwFlags As DWord) As DWord
+	Abstract Function GetGraph(ppGraph As **IDirectMusicGraph) As DWord
+	Abstract Function SetGraph(pGraph As *IDirectMusicGraph) As DWord
+	Abstract Function AddNotificationType(ByRef rguidNotificationType As GUID) As DWord
+	Abstract Function RemoveNotificationType(ByRef rguidNotificationType As GUID) As DWord
+	Abstract Function GetParam(ByRef rguidType As GUID, dwGroupBits As DWord, dwIndex As DWord, mtTime As MUSIC_TIME, pmtNext As *MUSIC_TIME, pParam As VoidPtr) As DWord 
+	Abstract Function SetParam(ByRef rguidType As GUID, dwGroupBits As DWord, dwIndex As DWord, mtTime As MUSIC_TIME, pParam As VoidPtr) As DWord
+	Abstract Function Clone(mtStart As MUSIC_TIME, mtEnd As MUSIC_TIME, ppSegment As **IDirectMusicSegment) As DWord
+	Abstract Function SetStartPoint(mtStart As MUSIC_TIME) As DWord
+	Abstract Function GetStartPoint(pmtStart As *MUSIC_TIME) As DWord
+	Abstract Function SetLoopPoints(mtStart As MUSIC_TIME, mtEnd As MUSIC_TIME) As DWord
+	Abstract Function GetLoopPoints(pmtStart As *MUSIC_TIME, pmtEnd As *MUSIC_TIME) As DWord
+	Abstract Function SetPChannelsUsed(dwNumPChannels As DWord, paPChannels As DWordPtr) As DWord
+End Class
+
+Class IDirectMusicSegment8
+	Inherits IDirectMusicSegment
+Public
+	'IDirectMusicSegment8
+	Abstract Function SetTrackConfig(ByRef rguidTrackClassID As GUID, dwGroupBits As DWord, dwIndex As DWord, dwFlagsOn As DWord, dwFlagsOff As DWord) As DWord
+	Abstract Function GetAudioPathConfig(ppAudioPathConfig As **IUnknown) As DWord
+	Abstract Function Compose(mtTime As MUSIC_TIME, pFromSegment As *IDirectMusicSegment, pToSegment As *IDirectMusicSegment, ppComposedSegment As **IDirectMusicSegment) As DWord
+	Abstract Function Download(pAudioPath As *IUnknown) As DWord
+	Abstract Function Unload(pAudioPath As *IUnknown) As DWord
+End Class
+
+Class IDirectMusicSegmentState
+	Inherits IUnknown
+Public
+	'IDirectMusicSegmentState
+	Abstract Function GetRepeats(pdwRepeats As DWordPtr) As DWord
+	Abstract Function GetSegment(ppSegment As **IDirectMusicSegment) As DWord
+	Abstract Function GetStartTime(pmtStart As *MUSIC_TIME) As DWord
+	Abstract Function GetSeek(pmtSeek As *MUSIC_TIME) As DWord
+	Abstract Function GetStartPoint(pmtStart As *MUSIC_TIME) As DWord
+End Class
+
+Class IDirectMusicSegmentState8
+	Inherits IDirectMusicSegmentState
+Public
+	'IDirectMusicSegmentState8
+	Abstract Function SetTrackConfig(ByRef rguidTrackClassID As GUID, dwGroupBits As DWord, dwIndex As DWord, dwFlagsOn As DWord, dwFlagsOff As DWord) As DWord
+	Abstract Function GetObjectInPath(dwPChannel As DWord, dwStage As DWord, dwBuffer As DWord, ByRef guidObject As GUID, dwIndex As DWord, ByRef iidInterface As GUID, ppObject As DWordPtr) As DWord
+End Class
+
+Class IDirectMusicAudioPath
+	Inherits IUnknown
+Public
+	'IDirectMusicAudioPath
+	Abstract Function GetObjectInPath(dwPChannel As DWord, dwStage As DWord, dwBuffer As DWord, ByRef guidObject As GUID, dwIndex As DWord, ByRef iidInterface As GUID, ppObject As DWordPtr) As DWord
+	Abstract Function Activate(fActivate As Long) As DWord
+	Abstract Function SetVolume(lVolume As Long, dwDuration As DWord) As DWord
+	Abstract Function ConvertPChannel(dwPChannelIn As DWord, pdwPChannelOut As DWordPtr) As DWord
+End Class
+TypeDef IDirectMusicAudioPath8 = IDirectMusicAudioPath
+
+Class IDirectMusicPerformance
+	Inherits IUnknown
+Public
+	'IDirectMusicPerformance
+	Abstract Function Init(ppDirectMusic As **IDirectMusic, pDirectSound As LPDIRECTSOUND, hWnd As HWND) As DWord
+	Abstract Function PlaySegment(pSegment As *IDirectMusicSegment, dwFlags As DWord, i64StartTime As REFERENCE_TIME, ppSegmentState As **IDirectMusicSegmentState) As DWord
+	Abstract Function Stop(pSegment As *IDirectMusicSegment, pSegmentState As *IDirectMusicSegmentState, mtTime As MUSIC_TIME, dwFlags As DWord) As DWord
+	Abstract Function GetSegmentState(ppSegmentState As **IDirectMusicSegmentState, mtTime As MUSIC_TIME) As DWord
+	Abstract Function SetPrepareTime(dwMilliSeconds As DWord) As DWord
+	Abstract Function GetPrepareTime(pdwMilliSeconds As DWordPtr) As DWord
+	Abstract Function SetBumperLength(dwMilliSeconds As DWord) As DWord
+	Abstract Function GetBumperLength(pdwMilliSeconds As DWordPtr) As DWord
+	Abstract Function SendPMsg(pPMSG As *DMUS_PMSG) As DWord
+	Abstract Function MusicToReferenceTime(mtTime As MUSIC_TIME, prtTime As *REFERENCE_TIME) As DWord
+	Abstract Function ReferenceToMusicTime(rtTime As REFERENCE_TIME, pmtTime As *MUSIC_TIME) As DWord
+	Abstract Function IsPlaying(pSegment As *IDirectMusicSegment, pSegState As *IDirectMusicSegmentState) As DWord
+	Abstract Function GetTime(prtNow As *REFERENCE_TIME, pmtNow As *MUSIC_TIME) As DWord
+	Abstract Function AllocPMsg(cb As DWord, ppPMSG As **DMUS_PMSG) As DWord
+	Abstract Function FreePMsg(pPMSG As *DMUS_PMSG) As DWord
+	Abstract Function GetGraph(ppGraph As **IDirectMusicGraph) As DWord
+	Abstract Function SetGraph(pGraph As *IDirectMusicGraph) As DWord
+	Abstract Function SetNotificationHandle(hNotification As HANDLE, rtMinimum As REFERENCE_TIME) As DWord
+	Abstract Function GetNotificationPMsg(ppNotificationPMsg As **DMUS_NOTIFICATION_PMSG) As DWord
+	Abstract Function AddNotificationType(ByRef rguidNotificationType As GUID) As DWord
+	Abstract Function RemoveNotificationType(ByRef rguidNotificationType As GUID) As DWord
+	Abstract Function AddPort(pPort As *IDirectMusicPort) As DWord
+	Abstract Function RemovePort(pPort As *IDirectMusicPort) As DWord
+	Abstract Function AssignPChannelBlock(dwBlockNum As DWord, pPort As *IDirectMusicPort, dwGroup As DWord) As DWord
+	Abstract Function AssignPChannel(dwPChannel As DWord, pPort As *IDirectMusicPort, dwGroup As DWord, dwMChannel As DWord) As DWord
+	Abstract Function PChannelInfo(dwPChannel As DWord, ppPort As **IDirectMusicPort, pdwGroup As DWordPtr, pdwMChannel As DWordPtr) As DWord
+	Abstract Function DownloadInstrument(pInst As *IDirectMusicInstrument, dwPChannel As DWord, ppDownInst As **IDirectMusicDownloadedInstrument, pNoteRanges As *DMUS_NOTERANGE, dwNumNoteRanges As DWord, ppPort As **IDirectMusicPort, pdwGroup As DWordPtr, pdwMChannel As DWordPtr) As DWord
+	Abstract Function Invalidate(mtTime As MUSIC_TIME, dwFlags As DWord) As DWord
+	Abstract Function GetParam(ByRef rguidType As GUID, dwGroupBits As DWord, dwIndex As DWord, mtTime As MUSIC_TIME, pmtNext As *MUSIC_TIME, pParam As VoidPtr) As DWord 
+	Abstract Function SetParam(ByRef rguidType As GUID, dwGroupBits As DWord, dwIndex As DWord, mtTime As MUSIC_TIME, pParam As VoidPtr) As DWord
+	Abstract Function GetGlobalParam(ByRef rguidType As GUID, pParam As VoidPtr, dwSize As DWord) As DWord
+	Abstract Function SetGlobalParam(ByRef rguidType As GUID, pParam As VoidPtr, dwSize As DWord) As DWord
+	Abstract Function GetLatencyTime(prtTime As *REFERENCE_TIME) As DWord
+	Abstract Function GetQueueTime(prtTime As *REFERENCE_TIME) As DWord
+	Abstract Function AdjustTime(rtAmount As REFERENCE_TIME) As DWord
+	Abstract Function CloseDown() As DWord
+	Abstract Function GetResolvedTime(rtTime As REFERENCE_TIME, prtResolved As *REFERENCE_TIME, dwTimeResolveFlags As DWord) As DWord
+	Abstract Function MIDIToMusic(bMIDIValue As Byte, pChord As *DMUS_CHORD_KEY, bPlayMode As Byte, bChordLevel As Byte, pwMusicValue As WordPtr) As DWord
+	Abstract Function MusicToMIDI(wMusicValue As Word, pChord As *DMUS_CHORD_KEY, bPlayMode As Byte, bChordLevel As Byte, pbMIDIValue As BytePtr) As DWord
+	Abstract Function TimeToRhythm(mtTime As MUSIC_TIME, pTimeSig As *DMUS_TIMESIGNATURE, pwMeasure As WordPtr, pbBeat As BytePtr, pbGrid As BytePtr, pnOffset As WordPtr) As DWord
+	Abstract Function RhythmToTime(wMeasure As Word, bBeat As Byte, bGrid As Byte, nOffset As Integer, pTimeSig As *DMUS_TIMESIGNATURE, pmtTime As *MUSIC_TIME) As DWord                                        
+End Class
+
+Class IDirectMusicPerformance8
+	Inherits IDirectMusicPerformance
+Public
+	'IDirectMusicPerformance8
+	Abstract Function InitAudio(ppDirectMusic As **IDirectMusic, ppDirectSound As **IDirectSound, hWnd As HWND, dwDefaultPathType As DWord, dwPChannelCount As DWord, dwFlags As DWord, pParams As *DMUS_AUDIOPARAMS) As DWord
+	Abstract Function PlaySegmentEx(pSource As *IUnknown, pwzSegmentName As *WCHAR, pTransition As *IUnknown, dwFlags As DWord, i64StartTime As Int64, ppSegmentState As **IDirectMusicSegmentState, pFrom As *IUnknown, pAudioPath As *IUnknown) As DWord
+	Abstract Function StopEx(pObjectToStop As *IUnknown, i64StopTime As Int64, dwFlags As DWord) As DWord
+	Abstract Function ClonePMsg(pSourcePMSG As *DMUS_PMSG, ppCopyPMSG As **DMUS_PMSG) As DWord
+	Abstract Function CreateAudioPath(pSourceConfig As *IUnknown, fActivate As Long, ppNewPath As **IDirectMusicAudioPath) As DWord
+	Abstract Function CreateStandardAudioPath(dwType As DWord, dwPChannelCount As DWord, fActivate As Long, ppNewPath As **IDirectMusicAudioPath) As DWord
+	Abstract Function SetDefaultAudioPath(pAudioPath As *IDirectMusicAudioPath) As DWord
+	Abstract Function GetDefaultAudioPath(ppAudioPath As **IDirectMusicAudioPath) As DWord
+	Abstract Function GetParamEx(ByRef rguidType As GUID, dwTrackID As DWord, dwGroupBits As DWord, dwIndex As DWord, mtTime As MUSIC_TIME, pmtNext As *MUSIC_TIME, pParam As VoidPtr) As DWord
+End Class
+
+Class IDirectMusicGraph
+	Inherits IUnknown
+Public
+	'IDirectMusicGraph
+	Abstract Function StampPMsg(pPMSG As *DMUS_PMSG) As DWord
+	Abstract Function InsertTool(pTool As *IDirectMusicTool, pdwPChannels As DWordPtr, cPChannels As DWord, lIndex As Long) As DWord
+	Abstract Function GetTool(dwIndex As DWord, ppTool As **IDirectMusicTool) As DWord
+	Abstract Function RemoveTool(pTool As *IDirectMusicTool) As DWord
+End Class
+
+Class IDirectMusicStyle
+	Inherits IUnknown
+Public
+	'IDirectMusicStyle
+	Abstract Function GetBand(pwszName As *WCHAR, ppBand As **IDirectMusicBand) As DWord
+	Abstract Function EnumBand(dwIndex As DWord, pwszName As *WCHAR) As DWord
+	Abstract Function GetDefaultBand(ppBand As **IDirectMusicBand) As DWord
+	Abstract Function EnumMotif(dwIndex As DWord, pwszName As *WCHAR) As DWord
+	Abstract Function GetMotif(pwszName As *WCHAR, ppSegment As **IDirectMusicSegment) As DWord
+	Abstract Function GetDefaultChordMap(ppChordMap As **IDirectMusicChordMap) As DWord
+	Abstract Function EnumChordMap(dwIndex As DWord, pwszName As *WCHAR) As DWord
+	Abstract Function GetChordMap(pwszName As *WCHAR, ppChordMap As **IDirectMusicChordMap) As DWord
+	Abstract Function GetTimeSignature(pTimeSig As *DMUS_TIMESIGNATURE) As DWord
+	Abstract Function GetEmbellishmentLength(dwType As DWord, dwLevel As DWord, pdwMin As DWordPtr, pdwMax As DWordPtr) As DWord
+	Abstract Function GetTempo(pTempo As DoublePtr) As DWord
+End Class
+
+Class IDirectMusicStyle8
+	Inherits IDirectMusicStyle
+Public
+	'IDirectMusicStyle8 
+	Abstract Function EnumPattern(dwIndex As DWord, dwPatternType As DWord, pwszName As *WCHAR) As DWord
+End Class
+
+Class IDirectMusicChordMap
+	Inherits IUnknown
+Public
+	'IDirectMusicChordMap
+	Abstract Function GetScale(pdwScale As DWordPtr) As DWord
+End Class
+TypeDef IDirectMusicChordMap8 = IDirectMusicChordMap
+
+Class IDirectMusicComposer
+	Inherits IUnknown
+Public
+	'IDirectMusicComposer
+	Abstract Function ComposeSegmentFromTemplate(pStyle As *IDirectMusicStyle, pTemplate As *IDirectMusicSegment, wActivity As Word, pChordMap As *IDirectMusicChordMap, ppSegment As **IDirectMusicSegment) As DWord
+	Abstract Function ComposeSegmentFromShape(pStyle As *IDirectMusicStyle, wNumMeasures As Word, wShape As Word, wActivity As Word, fIntro As Long, fEnd As Long, pChordMap As *IDirectMusicChordMap, ppSegment As **IDirectMusicSegment) As DWord
+	Abstract Function ComposeTransition(pFromSeg As *IDirectMusicSegment, pToSeg As *IDirectMusicSegment, mtTime As MUSIC_TIME, wCommand As Word, dwFlags As DWord, pChordMap As *IDirectMusicChordMap, ppTransSeg As **IDirectMusicSegment) As DWord
+	Abstract Function AutoTransition(pPerformance As *IDirectMusicPerformance, pToSeg As *IDirectMusicSegment, wCommand As Word, dwFlags As DWord, pChordMap As *IDirectMusicChordMap, ppTransSeg As **IDirectMusicSegment, ppToSegState As **IDirectMusicSegmentState, ppTransSegState As **IDirectMusicSegmentState) As DWord
+	Abstract Function ComposeTemplateFromShape(wNumMeasures As Word, wShape As Word, fIntro As Long, fEnd As Long, wEndLength As Word, ppTemplate As **IDirectMusicSegment) As DWord
+	Abstract Function ChangeChordMap(pSegment As *IDirectMusicSegment, fTrackScale As Long, pChordMap As *IDirectMusicChordMap) As DWord
+End Class
+TypeDef IDirectMusicComposer8 = IDirectMusicComposer
+
+
+'-----------------
+' CLSID and IID
+'-----------------
+
+' CLSID's
+Dim CLSID_DirectMusicPerformance = [&Hd2ac2881, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim CLSID_DirectMusicSegment = [&Hd2ac2882, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim CLSID_DirectMusicSegmentState = [&Hd2ac2883, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim CLSID_DirectMusicGraph = [&Hd2ac2884, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim CLSID_DirectMusicStyle = [&Hd2ac288a, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim CLSID_DirectMusicChordMap = [&Hd2ac288f, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim CLSID_DirectMusicComposer = [&Hd2ac2890, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim CLSID_DirectMusicLoader = [&Hd2ac2892, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim CLSID_DirectMusicBand = [&H79ba9e00, &Hb6ee, &H11d1, [&H86, &Hbe, &H0, &Hc0, &H4f, &Hbf, &H8f, &Hef]] As GUID
+
+' New CLSID's for DX8
+Dim CLSID_DirectMusicPatternTrack = [&Hd2ac2897, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim CLSID_DirectMusicScript = [&H810b5013, &He88d, &H11d2, [&H8b, &Hc1, &H0, &H60, &H8, &H93, &Hb1, &Hb6]] As GUID ' {810B5013-E88D-11d2-8BC1-00600893B1B6}
+Dim CLSID_DirectMusicContainer = [&H9301e380, &H1f22, &H11d3, [&H82, &H26, &Hd2, &Hfa, &H76, &H25, &H5d, &H47]] As GUID
+Dim CLSID_DirectSoundWave = [&H8a667154, &Hf9cb, &H11d2, [&Had, &H8a, &H0, &H60, &Hb0, &H57, &H5a, &Hbc]] As GUID
+Dim CLSID_DirectMusicAudioPathConfig = [&Hee0b9ca0, &Ha81e, &H11d3, [&H9b, &Hd1, &H0, &H80, &Hc7, &H15, &Ha, &H74]] As GUID
+
+' Special GUID for all object types. This is used by the loader.
+Dim GUID_DirectMusicAllTypes = [&Hd2ac2893, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Notification guids
+Dim GUID_NOTIFICATION_SEGMENT = [&Hd2ac2899, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim GUID_NOTIFICATION_PERFORMANCE = [&H81f75bc5, &H4e5d, &H11d2, [&Hbc, &Hc7, &H0, &Ha0, &Hc9, &H22, &He6, &Heb]] As GUID
+Dim GUID_NOTIFICATION_MEASUREANDBEAT = [&Hd2ac289a, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim GUID_NOTIFICATION_CHORD = [&Hd2ac289b, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim GUID_NOTIFICATION_COMMAND = [&Hd2ac289c, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim GUID_NOTIFICATION_RECOMPOSE = [&Hd348372b, &H945b, &H45ae, [&Ha5, &H22, &H45, &Hf, &H12, &H5b, &H84, &Ha5]] As GUID
+
+' Track param type guids
+' Use to get/set a DMUS_COMMAND_PARAM param in the Command track
+Dim GUID_CommandParam = [&Hd2ac289d, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Use to get a DMUS_COMMAND_PARAM_2 param in the Command track
+Dim GUID_CommandParam2 = [&H28f97ef7, &H9538, &H11d2, [&H97, &Ha9, &H0, &Hc0, &H4f, &Ha3, &H6e, &H58]] As GUID
+
+' Use to get/set a DMUS_COMMAND_PARAM_2 param to be used as the command following all commands in
+' the Command track (this information can't be saved)
+Dim GUID_CommandParamNext = [&H472afe7a, &H281b, &H11d3, [&H81, &H7d, &H0, &Hc0, &H4f, &Ha3, &H6e, &H58]] As GUID
+
+' Use to get/set a DMUS_CHORD_PARAM param in the Chord track
+Dim GUID_ChordParam = [&Hd2ac289e, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Use to get a DMUS_RHYTHM_PARAM param in the Chord track
+Dim GUID_RhythmParam = [&Hd2ac289f, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Use to get/set an IDirectMusicStyle param in the Style track
+Dim GUID_IDirectMusicStyle = [&Hd2ac28a1, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Use to get a DMUS_TIMESIGNATURE param in the Style and TimeSig tracks
+Dim GUID_TimeSignature = [&Hd2ac28a4, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Use to get/set a DMUS_TEMPO_PARAM param in the Tempo track
+Dim GUID_TempoParam = [&Hd2ac28a5, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Use to get the next valid point in a segment at which it may start
+Dim GUID_Valid_Start_Time = [&H7f6b1760, &H1fdb, &H11d3, [&H82, &H26, &H44, &H45, &H53, &H54, &H0, &H0]] As GUID
+
+' Use to get the next point in the currently playing primary segment at which a new segment may start
+Dim GUID_Play_Marker = [&Hd8761a41, &H801a, &H11d3, [&H9b, &Hd1, &Hda, &Hf7, &He1, &Hc3, &Hd8, &H34]] As GUID
+
+' Use to get (GetParam) or add (SetParam) bands in the Band track
+Dim GUID_BandParam = [&H2bb1938, &Hcb8b, &H11d2, [&H8b, &Hb9, &H0, &H60, &H8, &H93, &Hb1, &Hb6]] As GUID
+Type DMUS_BAND_PARAM
+	mtTimePhysical As MUSIC_TIME
+	pBand As *IDirectMusicBand
+End Type
+
+' Obsolete -- doesn't distinguish physical and logical time.  Use GUID_BandParam instead.
+Dim GUID_IDirectMusicBand = [&Hd2ac28ac, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Use to get/set an IDirectMusicChordMap param in the ChordMap track
+Dim GUID_IDirectMusicChordMap = [&Hd2ac28ad, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Use to get/set a DMUS_MUTE_PARAM param in the Mute track
+Dim GUID_MuteParam = [&Hd2ac28af, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' These guids are used in IDirectMusicSegment::SetParam to tell the band track to perform various actions.
+'  Some of these guids (where noted) also apply to wave tracks.
+
+' Download bands/waves for the IDirectMusicSegment
+Dim GUID_Download = [&Hd2ac28a7, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Unload bands/waves for the IDirectMusicSegment
+Dim GUID_Unload = [&Hd2ac28a8, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Connect segment's bands to an IDirectMusicCollection
+Dim GUID_ConnectToDLSCollection = [&H1db1ae6b, &He92e, &H11d1, [&Ha8, &Hc5, &H0, &Hc0, &H4f, &Ha3, &H72, &H6e]] As GUID
+
+' Enable/disable autodownloading of bands/waves
+Dim GUID_Enable_Auto_Download = [&Hd2ac28a9, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim GUID_Disable_Auto_Download = [&Hd2ac28aa, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Clear all bands
+Dim GUID_Clear_All_Bands = [&Hd2ac28ab, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Set segment to manage all program changes, bank selects, etc. for simple playback of a standard MIDI file
+Dim GUID_StandardMIDIFile = [&H6621075, &He92e, &H11d1, [&Ha8, &Hc5, &H0, &Hc0, &H4f, &Ha3, &H72, &H6e]] As GUID
+
+' Disable/enable param guids. Use these in SetParam calls to disable or enable sending
+' * specific PMsg types.
+
+Dim GUID_DisableTimeSig = [&H45fc707b, &H1db4, &H11d2, [&Hbc, &Hac, &H0, &Ha0, &Hc9, &H22, &He6, &Heb]] As GUID
+Dim GUID_EnableTimeSig = [&H45fc707c, &H1db4, &H11d2, [&Hbc, &Hac, &H0, &Ha0, &Hc9, &H22, &He6, &Heb]] As GUID
+Dim GUID_DisableTempo = [&H45fc707d, &H1db4, &H11d2, [&Hbc, &Hac, &H0, &Ha0, &Hc9, &H22, &He6, &Heb]] As GUID
+Dim GUID_EnableTempo = [&H45fc707e, &H1db4, &H11d2, [&Hbc, &Hac, &H0, &Ha0, &Hc9, &H22, &He6, &Heb]] As GUID
+
+' Used in SetParam calls for pattern-based tracks.  A nonzero value seeds the random number
+' generator for variation selection; a value of zero reverts to the default behavior of 
+' getting the seed from the system clock.
+Dim GUID_SeedVariations = [&H65b76fa5, &Hff37, &H11d2, [&H81, &H4e, &H0, &Hc0, &H4f, &Ha3, &H6e, &H58]] As GUID
+
+' Used to get the variations currently in effect across PChannels
+Dim GUID_Variations = [&H11f72cce, &H26e6, &H4ecd, [&Haf, &H2e, &Hd6, &H68, &He6, &H67, &H7, &Hd8]] As GUID
+Type DMUS_VARIATIONS_PARAM
+	dwPChannelsUsed As DWord
+	padwPChannels As DWordPtr
+	padwVariations As DWordPtr
+End Type
+
+' Download bands/waves for the IDirectMusicSegment, passed an IDirectMusicAudioPath instead of an IDirectMusicPerformance
+Dim GUID_DownloadToAudioPath = [&H9f2c0341, &Hc5c4, &H11d3, [&H9b, &Hd1, &H44, &H45, &H53, &H54, &H0, &H0]] As GUID
+
+' Unload bands/waves for the IDirectMusicSegment, passed an IDirectMusicAudioPath instead of an IDirectMusicPerformance
+Dim GUID_UnloadFromAudioPath = [&H9f2c0342, &Hc5c4, &H11d3, [&H9b, &Hd1, &H44, &H45, &H53, &H54, &H0, &H0]] As GUID
+
+
+' Global data guids
+Dim GUID_PerfMasterTempo = [&Hd2ac28b0, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim GUID_PerfMasterVolume = [&Hd2ac28b1, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim GUID_PerfMasterGrooveLevel = [&Hd2ac28b2, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim GUID_PerfAutoDownload = [&Hfb09565b, &H3631, &H11d2, [&Hbc, &Hb8, &H0, &Ha0, &Hc9, &H22, &He6, &Heb]] As GUID
+
+' GUID for default GM/GS dls collection.
+Dim GUID_DefaultGMCollection = [&Hf17e8673, &Hc3b4, &H11d1, [&H87, &Hb, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' GUID to define default synth, placed in AudioPath configuration file.
+Dim GUID_Synth_Default = [&H26bb9432, &H45fe, &H48d3, [&Ha3, &H75, &H24, &H72, &Hc5, &He3, &He7, &H86]] As GUID
+
+' GUIDs to define default buffer configurations to place in AudioPath configuration file.
+Dim GUID_Buffer_Reverb = [&H186cc541, &Hdb29, &H11d3, [&H9b, &Hd1, &H0, &H80, &Hc7, &H15, &Ha, &H74]] As GUID
+Dim GUID_Buffer_EnvReverb = [&H186cc542, &Hdb29, &H11d3, [&H9b, &Hd1, &H0, &H80, &Hc7, &H15, &Ha, &H74]] As GUID
+Dim GUID_Buffer_Stereo = [&H186cc545, &Hdb29, &H11d3, [&H9b, &Hd1, &H0, &H80, &Hc7, &H15, &Ha, &H74]] As GUID
+Dim GUID_Buffer_3D_Dry = [&H186cc546, &Hdb29, &H11d3, [&H9b, &Hd1, &H0, &H80, &Hc7, &H15, &Ha, &H74]] As GUID
+Dim GUID_Buffer_Mono = [&H186cc547, &Hdb29, &H11d3, [&H9b, &Hd1, &H0, &H80, &Hc7, &H15, &Ha, &H74]] As GUID
+
+' IID's
+Dim IID_IDirectMusicLoader = [&H2ffaaca2, &H5dca, &H11d2, [&Haf, &Ha6, &H0, &Haa, &H0, &H24, &Hd8, &Hb6]] As GUID
+Dim IID_IDirectMusicGetLoader = [&H68a04844, &Hd13d, &H11d1, [&Haf, &Ha6, &H0, &Haa, &H0, &H24, &Hd8, &Hb6]] As GUID
+Dim IID_IDirectMusicObject = [&Hd2ac28b5, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicSegment = [&Hf96029a2, &H4282, &H11d2, [&H87, &H17, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicSegmentState = [&Ha3afdcc7, &Hd3ee, &H11d1, [&Hbc, &H8d, &H0, &Ha0, &Hc9, &H22, &He6, &Heb]] As GUID
+Dim IID_IDirectMusicPerformance = [&H7d43d03, &H6523, &H11d2, [&H87, &H1d, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicGraph = [&H2befc277, &H5497, &H11d2, [&Hbc, &Hcb, &H0, &Ha0, &Hc9, &H22, &He6, &Heb]] As GUID
+Dim IID_IDirectMusicStyle = [&Hd2ac28bd, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicChordMap = [&Hd2ac28be, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicComposer = [&Hd2ac28bf, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicBand = [&Hd2ac28c0, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Alternate interface IDs, available in DX7 release and after.
+Dim IID_IDirectMusicPerformance2 = [&H6fc2cae0, &Hbc78, &H11d2, [&Haf, &Ha6, &H0, &Haa, &H0, &H24, &Hd8, &Hb6]] As GUID
+Dim IID_IDirectMusicSegment2 = [&Hd38894d1, &Hc052, &H11d2, [&H87, &H2f, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+
+' Interface IDs for DX8
+' changed interfaces (GUID only)
+Dim IID_IDirectMusicLoader8 = [&H19e7c08c, &Ha44, &H4e6a, [&Ha1, &H16, &H59, &H5a, &H7c, &Hd5, &Hde, &H8c]] As GUID
+Dim IID_IDirectMusicPerformance8 = [&H679c4137, &Hc62e, &H4147, [&Hb2, &Hb4, &H9d, &H56, &H9a, &Hcb, &H25, &H4c]] As GUID
+Dim IID_IDirectMusicSegment8 = [&Hc6784488, &H41a3, &H418f, [&Haa, &H15, &Hb3, &H50, &H93, &Hba, &H42, &Hd4]] As GUID
+Dim IID_IDirectMusicSegmentState8 = [&Ha50e4730, &Hae4, &H48a7, [&H98, &H39, &Hbc, &H4, &Hbf, &He0, &H77, &H72]] As GUID
+Dim IID_IDirectMusicStyle8 = [&Hfd24ad8a, &Ha260, &H453d, [&Hbf, &H50, &H6f, &H93, &H84, &Hf7, &H9, &H85]] As GUID
+' new interfaces (GUID + alias)
+Dim IID_IDirectMusicPatternTrack = [&H51c22e10, &Hb49f, &H46fc, [&Hbe, &Hc2, &He6, &H28, &H8f, &Hb9, &Hed, &He6]] As GUID
+Dim IID_IDirectMusicScript = [&H2252373a, &H5814, &H489b, [&H82, &H9, &H31, &Hfe, &Hde, &Hba, &Hf1, &H37]] As GUID ' {2252373A-5814-489b-8209-31FEDEBAF137}
+Dim IID_IDirectMusicScript8 As GUID: IID_IDirectMusicScript8=IID_IDirectMusicScript
+Dim IID_IDirectMusicContainer = [&H9301e386, &H1f22, &H11d3, [&H82, &H26, &Hd2, &Hfa, &H76, &H25, &H5d, &H47]] As GUID
+Dim IID_IDirectMusicContainer8 As GUID: IID_IDirectMusicContainer8=IID_IDirectMusicContainer
+Dim IID_IDirectMusicAudioPath = [&Hc87631f5, &H23be, &H4986, [&H88, &H36, &H5, &H83, &H2f, &Hcc, &H48, &Hf9]] As GUID
+Dim IID_IDirectMusicAudioPath8 As GUID: IID_IDirectMusicAudioPath8=IID_IDirectMusicAudioPath
+' unchanged interfaces (alias only)
+Dim IID_IDirectMusicGetLoader8 As GUID: IID_IDirectMusicGetLoader8=IID_IDirectMusicGetLoader
+Dim IID_IDirectMusicChordMap8 As GUID: IID_IDirectMusicChordMap8=IID_IDirectMusicChordMap
+Dim IID_IDirectMusicGraph8 As GUID: IID_IDirectMusicGraph8=IID_IDirectMusicGraph
+Dim IID_IDirectMusicBand8 As GUID: IID_IDirectMusicBand8=IID_IDirectMusicBand
+Dim IID_IDirectMusicObject8 As GUID: IID_IDirectMusicObject8=IID_IDirectMusicObject
+Dim IID_IDirectMusicComposer8 As GUID: IID_IDirectMusicComposer8=IID_IDirectMusicComposer
+
+
+#endif '_INC_DMUSIC
Index: /trunk/ab5.0/ablib/src/directx9/dmusicc.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/dmusicc.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/dmusicc.sbp	(revision 506)
@@ -0,0 +1,258 @@
+' dmusicc.sbp - This module defines the DirectMusic core API's
+
+Const DMUS_MAX_DESCRIPTION = 128
+
+Type DMUS_BUFFERDESC
+	dwSize As DWord
+	dwFlags As DWord
+	guidBufferFormat As GUID
+	cbBuffer As DWord
+End Type
+
+' dwEffectFlags fields of both DMUS_PORTCAPS and DMUS_PORTPARAMS.
+Const DMUS_EFFECT_NONE   = &H00000000
+Const DMUS_EFFECT_REVERB = &H00000001
+Const DMUS_EFFECT_CHORUS = &H00000002
+Const DMUS_EFFECT_DELAY  = &H00000004
+
+' For DMUS_PORTCAPS dwClass
+Const DMUS_PC_INPUTCLASS  = 0
+Const DMUS_PC_OUTPUTCLASS = 1
+
+' For DMUS_PORTCAPS dwFlags
+Const DMUS_PC_DLS             = &H00000001   'Supports DLS downloading and DLS level 1.
+Const DMUS_PC_EXTERNAL        = &H00000002   'External MIDI module.
+Const DMUS_PC_SOFTWARESYNTH   = &H00000004   'Software synthesizer.
+Const DMUS_PC_MEMORYSIZEFIXED = &H00000008   'Memory size is fixed.
+Const DMUS_PC_GMINHARDWARE    = &H00000010   'GM sound set is built in, no need to download.
+Const DMUS_PC_GSINHARDWARE    = &H00000020   'GS sound set is built in.
+Const DMUS_PC_XGINHARDWARE    = &H00000040   'XG sound set is built in.
+Const DMUS_PC_DIRECTSOUND     = &H00000080   'Connects to DirectSound via a DSound buffer.
+Const DMUS_PC_SHAREABLE       = &H00000100   'Synth can be actively shared by multiple apps at once.
+Const DMUS_PC_DLS2            = &H00000200   'Supports DLS2 instruments.
+Const DMUS_PC_AUDIOPATH       = &H00000400   'Multiple outputs can be connected to DirectSound for audiopaths.
+Const DMUS_PC_WAVE            = &H00000800   'Supports streaming and one shot waves.
+Const DMUS_PC_SYSTEMMEMORY    = &H7FFFFFFF   'Sample memory is system memory.
+
+' For DMUS_PORTCAPS dwType
+Const DMUS_PORT_WINMM_DRIVER    = 0
+Const DMUS_PORT_USER_MODE_SYNTH = 1
+Const DMUS_PORT_KERNEL_MODE     = 2
+
+Type DMUS_PORTCAPS
+	dwSize As DWord
+	dwFlags As DWord
+	guidPort As GUID
+	dwClass As DWord
+	dwType As DWord
+	dwMemorySize As DWord
+	dwMaxChannelGroups As DWord
+	dwMaxVoices As DWord
+	dwMaxAudioChannels As DWord
+	dwEffectFlags As DWord
+	wszDescription[DMUS_MAX_DESCRIPTION-1] As WCHAR
+End Type
+
+' For DMUS_PORTPARAMS8 dwValidParams
+Const DMUS_PORTPARAMS_VOICES        = &H00000001
+Const DMUS_PORTPARAMS_CHANNELGROUPS = &H00000002
+Const DMUS_PORTPARAMS_AUDIOCHANNELS = &H00000004
+Const DMUS_PORTPARAMS_SAMPLERATE    = &H00000008
+Const DMUS_PORTPARAMS_EFFECTS       = &H00000020
+Const DMUS_PORTPARAMS_SHARE         = &H00000040
+Const DMUS_PORTPARAMS_FEATURES      = &H00000080
+
+' For DMUS_PORTPARAMS8 dwFeatures
+Const DMUS_PORT_FEATURE_AUDIOPATH = &H00000001	'Supports audiopath connection to DSound buffers.
+Const DMUS_PORT_FEATURE_STREAMING = &H00000002	'Supports streaming waves through the synth.
+
+Type DMUS_PORTPARAMS8
+	dwSize As DWord
+	dwValidParams As DWord
+	dwVoices As DWord
+	dwChannelGroups As DWord
+	dwAudioChannels As DWord
+	dwSampleRate As DWord
+	dwEffectFlags As DWord
+	fShare As Long
+	dwFeatures As DWord
+End Type
+TypeDef DMUS_PORTPARAMS = DMUS_PORTPARAMS8
+
+Type DMUS_SYNTHSTATS
+	dwSize As DWord         'Size in bytes of the structure
+	dwValidStats As DWord   'Flags indicating which fields below are valid.
+	dwVoices As DWord       'Average number of voices playing.
+	dwTotalCPU As DWord     'Total CPU usage as percent * 100.
+	dwCPUPerVoice As DWord  'CPU per voice as percent * 100.
+	dwLostNotes As DWord    'Number of notes lost in 1 second.
+	dwFreeMemory As DWord   'Free memory in bytes
+	lPeakVolume As Long     'Decibel level * 100.
+End Type
+
+Const Enum DMUS_CLOCKTYPE
+	DMUS_CLOCK_SYSTEM = 0
+	DMUS_CLOCK_WAVE = 1
+End Enum
+
+Type DMUS_CLOCKINFO
+	dwSize As DWord
+	ctType As DMUS_CLOCKTYPE
+	guidClock As GUID
+	wszDescription[DMUS_MAX_DESCRIPTION-1] As WCHAR
+	dwFlags As DWord
+End Type
+TypeDef DMUS_CLOCKINFO8 = DMUS_CLOCKINFO
+
+
+'-----------------
+' Interface
+'-----------------
+
+Class IDirectMusic
+	Inherits IUnknown
+Public
+	'IDirectMusic
+	Abstract Function EnumPort(dwIndex As DWord, pPortCaps As *DMUS_PORTCAPS) As DWord
+	Abstract Function CreateMusicBuffer(pBufferDesc As *DMUS_BUFFERDESC, ppBuffer As *LPDIRECTMUSICBUFFER, pUnkOuter As LPUNKNOWN) As DWord
+	Abstract Function CreatePort(ByRef rclsidPort As GUID, pPortParams As *DMUS_PORTPARAMS, ppPort As *LPDIRECTMUSICPORT8, pUnkOuter As LPUNKNOWN) As DWord
+	Abstract Function EnumMasterClock(dwIndex As DWord, lpClockInfo As *DMUS_CLOCKINFO) As DWord
+	Abstract Function GetMasterClock(pguidClock As *GUID, ppReferenceClock As **IReferenceClock) As DWord
+	Abstract Function SetMasterClock(ByRef rguidClock As GUID) As DWord
+	Abstract Function Activate(fEnable As Long) As DWord
+	Abstract Function GetDefaultPort(pguidPort As *GUID) As DWord
+	Abstract Function SetDirectSound(pDirectSound As LPDIRECTSOUND, hWnd As HWND) As DWord
+End Class
+TypeDef LPDIRECTMUSIC = *IDirectMusic
+
+Class IDirectMusic8
+	Inherits IDirectMusic
+Public
+	'IDirectMusic8
+	Abstract Function SetExternalMasterClock(pClock As *IReferenceClock) As DWord
+End Class
+TypeDef LPDIRECTMUSIC8 = *IDirectMusic8
+
+Class IDirectMusicBuffer
+	Inherits IUnknown
+Public
+	'IDirectMusicBuffer
+	Abstract Function Flush() As DWord
+	Abstract Function TotalTime(prtTime As *REFERENCE_TIME) As DWord
+	Abstract Function PackStructured(rt As REFERENCE_TIME, dwChannelGroup As DWord, dwChannelMessage As DWord) As DWord
+	Abstract Function PackUnstructured(rt As REFERENCE_TIME, dwChannelGroup As DWord, cb As DWord, lpb As BytePtr) As DWord
+	Abstract Function ResetReadPtr() As DWord
+	Abstract Function GetNextEvent(prt As *REFERENCE_TIME, pdwChannelGroup As DWordPtr, pdwLength As DWordPtr, ppData As **Byte) As DWord
+	Abstract Function GetRawBufferPtr(ppData As **Byte) As DWord
+	Abstract Function GetStartTime(prt As *REFERENCE_TIME) As DWord
+	Abstract Function GetUsedBytes(pcb As DWordPtr) As DWord
+	Abstract Function GetMaxBytes(pcb As DWordPtr) As DWord
+	Abstract Function GetBufferFormat(pGuidFormat As *GUID) As DWord
+	Abstract Function SetStartTime(rt As REFERENCE_TIME) As DWord
+	Abstract Function SetUsedBytes(cb As DWord) As DWord
+End Class
+TypeDef LPDIRECTMUSICBUFFER = *IDirectMusicBuffer
+TypeDef IDirectMusicBuffer8 = IDirectMusicBuffer
+TypeDef LPDIRECTMUSICBUFFER8 = *IDirectMusicBuffer8
+
+Class IDirectMusicInstrument
+	Inherits IUnknown
+Public
+	'IDirectMusicInstrument
+	Abstract Function GetPatch(pdwPatch As DWordPtr) As DWord
+	Abstract Function SetPatch(dwPatch As DWord) As DWord
+End Class
+TypeDef IDirectMusicInstrument8 = IDirectMusicInstrument
+TypeDef LPDIRECTMUSICINSTRUMENT8 = *IDirectMusicInstrument8
+
+Class IDirectMusicDownloadedInstrument
+	Inherits IUnknown
+End Class
+TypeDef IDirectMusicDownloadedInstrument8 = IDirectMusicDownloadedInstrument
+TypeDef LPDIRECTMUSICDOWNLOADEDINSTRUMENT8 = *IDirectMusicDownloadedInstrument8
+
+Class IDirectMusicCollection
+	Inherits IUnknown
+Public
+	'IDirectMusicCollection
+	Abstract Function GetInstrument(dwPatch As DWord, ppInstrument As **IDirectMusicInstrument) As DWord
+	Abstract Function EnumInstrument(dwIndex As DWord, pdwPatch As DWordPtr, pwszName As *WCHAR, dwNameLen As DWord) As DWord
+End Class
+TypeDef IDirectMusicCollection8 = IDirectMusicCollection
+TypeDef LPDIRECTMUSICCOLLECTION8 = *IDirectMusicCollection8
+
+Class IDirectMusicDownload
+	Inherits IUnknown
+Public
+	'IDirectMusicDownload
+	Abstract Function GetBuffer(ppvBuffer As DWordPtr, pdwSize As DWordPtr) As DWord
+End Class
+TypeDef IDirectMusicDownload8 = IDirectMusicDownload
+TypeDef LPDIRECTMUSICDOWNLOAD8 = *IDirectMusicDownload8
+
+Class IDirectMusicPortDownload
+	Inherits IUnknown
+Public
+	'IDirectMusicPortDownload
+	Abstract Function GetBuffer(dwDLId As DWord, ppIDMDownload As **IDirectMusicDownload) As DWord
+	Abstract Function AllocateBuffer(dwSize As DWord, ppIDMDownload As **IDirectMusicDownload) As DWord
+	Abstract Function GetDLId(pdwStartDLId As DWordPtr, dwCount As DWord) As DWord
+	Abstract Function GetAppend(pdwAppend As DWordPtr) As DWord
+	Abstract Function Download(pIDMDownload As *IDirectMusicDownload) As DWord
+	Abstract Function Unload(pIDMDownload As *IDirectMusicDownload) As DWord
+End Class
+TypeDef IDirectMusicPortDownload8 = IDirectMusicPortDownload
+TypeDef LPDIRECTMUSICPORTDOWNLOAD8 = *IDirectMusicPortDownload8
+
+Class IDirectMusicPort
+	Inherits IUnknown
+Public
+	'IDirectMusicPort
+	Abstract Function PlayBuffer(pBuffer As LPDIRECTMUSICBUFFER) As DWord
+	Abstract Function SetReadNotificationHandle(hEvent As HANDLE) As DWord
+	Abstract Function Read(pBuffer As LPDIRECTMUSICBUFFER) As DWord
+	Abstract Function DownloadInstrument(pInstrument As *IDirectMusicInstrument, ppDownloadedInstrument As **IDirectMusicDownloadedInstrument, pNoteRanges As *DMUS_NOTERANGE, dwNumNoteRanges As DWord) As DWord
+	Abstract Function UnloadInstrument(pDownloadedInstrument As *IDirectMusicDownloadedInstrument) As DWord
+	Abstract Function GetLatencyClock(ppClock As **IReferenceClock) As DWord
+	Abstract Function GetRunningStats(pStats As *DMUS_SYNTHSTATS) As DWord
+	Abstract Function Compact() As DWord
+	Abstract Function GetCaps(pPortCaps As *DMUS_PORTCAPS) As DWord
+	Abstract Function DeviceIoControl(dwIoControlCode As DWord, lpInBuffer As VoidPtr, nInBufferSize As DWord, lpOutBuffer As VoidPtr, nOutBufferSize As DWord, lpBytesReturned As DWordPtr, lpOverlapped As *OVERLAPPED) As DWord
+	Abstract Function SetNumChannelGroups(dwChannelGroups As DWord) As DWord
+	Abstract Function GetNumChannelGroups(pdwChannelGroups As DWordPtr) As DWord
+	Abstract Function Activate(fActive As Long) As DWord
+	Abstract Function SetChannelPriority(dwChannelGroup As DWord, dwChannel As DWord, dwPriority As DWord) As DWord
+	Abstract Function GetChannelPriority(dwChannelGroup As DWord, dwChannel As DWord, pdwPriority As DWordPtr) As DWord
+	Abstract Function SetDirectSound(pDirectSound As LPDIRECTSOUND, pDirectSoundBuffer As LPDIRECTSOUNDBUFFER) As DWord
+	Abstract Function GetFormat(pWaveFormatEx As *WAVEFORMATEX, pdwWaveFormatExSize As DWordPtr, pdwBufferSize As DWordPtr) As DWord
+End Class
+TypeDef IDirectMusicPort8 = IDirectMusicPort
+TypeDef LPDIRECTMUSICPORT8 = *IDirectMusicPort8
+
+Class IDirectMusicThru
+	Inherits IUnknown
+Public
+	'IDirectMusicThru
+	Abstract Function ThruChannel(dwSourceChannelGroup As DWord, dwSourceChannel As DWord, dwDestinationChannelGroup As DWord, dwDestinationChannel As DWord, pDestinationPort As LPDIRECTMUSICPORT8) As DWord
+End Class
+TypeDef IDirectMusicThru8 = IDirectMusicThru
+TypeDef LPDIRECTMUSICTHRU8 = *IDirectMusicThru8
+
+
+'-----------------
+' CLSID and IID
+'-----------------
+
+Dim CLSID_DirectMusic = [&H636b9f10,&H0c7d,&H11d1,[&H95,&Hb2,&H00,&H20,&Haf,&Hdc,&H74,&H21]] As GUID
+Dim CLSID_DirectMusicCollection = [&H480ff4b0, &H28b2, &H11d1, [&Hbe, &Hf7, &H0, &Hc0, &H4f, &Hbf, &H8f, &Hef]] As GUID
+Dim CLSID_DirectMusicSynth = [&H58C2B4D0,&H46E7,&H11D1,[&H89,&HAC,&H00,&HA0,&HC9,&H05,&H41,&H29]] As GUID
+
+Dim IID_IDirectMusic = [&H6536115a,&H7b2d,&H11d2,[&Hba,&H18,&H00,&H00,&Hf8,&H75,&Hac,&H12]] As GUID
+Dim IID_IDirectMusicBuffer = [&Hd2ac2878, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicPort = [&H08f2d8c9,&H37c2,&H11d2,[&Hb9,&Hf9,&H00,&H00,&Hf8,&H75,&Hac,&H12]] As GUID
+Dim IID_IDirectMusicThru = [&Hced153e7, &H3606, &H11d2, [&Hb9, &Hf9, &H00, &H00, &Hf8, &H75, &Hac, &H12]] As GUID
+Dim IID_IDirectMusicPortDownload = [&Hd2ac287a, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicDownload = [&Hd2ac287b, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicCollection = [&Hd2ac287c, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicInstrument = [&Hd2ac287d, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
+Dim IID_IDirectMusicDownloadedInstrument = [&Hd2ac287e, &Hb39b, &H11d1, [&H87, &H4, &H0, &H60, &H8, &H93, &Hb1, &Hbd]] As GUID
Index: /trunk/ab5.0/ablib/src/directx9/dsound.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/directx9/dsound.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/directx9/dsound.sbp	(revision 506)
@@ -0,0 +1,629 @@
+' dsound.sbp
+Const DIRECTSOUND_VERSION = &H0900
+
+
+Const _FACDS = &H878   'DirectSound's facility code
+Const MAKE_DSHRESULT(code) = MAKE_HRESULT(1, _FACDS, code)
+
+
+' DirectSound Component GUID {47D4D946-62E8-11CF-93BC-444553540000}
+Dim CLSID_DirectSound = [&H47d4d946, &H62e8, &H11cf, [&H93, &Hbc, &H44, &H45, &H53, &H54, &H0, &H0]] As GUID
+
+' DirectSound 8.0 Component GUID {3901CC3F-84B5-4FA4-BA35-AA8172B8A09B}
+Dim CLSID_DirectSound8 = [&H3901cc3f, &H84b5, &H4fa4, [&Hba, &H35, &Haa, &H81, &H72, &Hb8, &Ha0, &H9b]] As GUID
+
+' DirectSound Capture Component GUID {B0210780-89CD-11D0-AF08-00A0C925CD16}
+Dim CLSID_DirectSoundCapture = [&Hb0210780, &H89cd, &H11d0, [&Haf, &H8, &H0, &Ha0, &Hc9, &H25, &Hcd, &H16]] As GUID
+
+' DirectSound 8.0 Capture Component GUID {E4BCAC13-7F99-4908-9A8E-74E3BF24B6E1}
+Dim CLSID_DirectSoundCapture8 = [&He4bcac13, &H7f99, &H4908, [&H9a, &H8e, &H74, &He3, &Hbf, &H24, &Hb6, &He1]] As GUID
+
+' DirectSound Full Duplex Component GUID {FEA4300C-7959-4147-B26A-2377B9E7A91D}
+Dim CLSID_DirectSoundFullDuplex = [&Hfea4300c, &H7959, &H4147, [&Hb2, &H6a, &H23, &H77, &Hb9, &He7, &Ha9, &H1d]] As GUID
+
+
+' DirectSound default playback device GUID {DEF00000-9C6D-47ED-AAF1-4DDA8F2B5C03}
+Dim DSDEVID_DefaultPlayback = [&Hdef00000, &H9c6d, &H47ed, [&Haa, &Hf1, &H4d, &Hda, &H8f, &H2b, &H5c, &H03]] As GUID
+
+' DirectSound default capture device GUID {DEF00001-9C6D-47ED-AAF1-4DDA8F2B5C03}
+Dim DSDEVID_DefaultCapture = [&Hdef00001, &H9c6d, &H47ed, [&Haa, &Hf1, &H4d, &Hda, &H8f, &H2b, &H5c, &H03]] As GUID
+
+' DirectSound default device for voice playback {DEF00002-9C6D-47ED-AAF1-4DDA8F2B5C03}
+Dim DSDEVID_DefaultVoicePlayback = [&Hdef00002, &H9c6d, &H47ed, [&Haa, &Hf1, &H4d, &Hda, &H8f, &H2b, &H5c, &H03]] As GUID
+
+' DirectSound default device for voice capture {DEF00003-9C6D-47ED-AAF1-4DDA8F2B5C03}
+Dim DSDEVID_DefaultVoiceCapture = [&Hdef00003, &H9c6d, &H47ed, [&Haa, &Hf1, &H4d, &Hda, &H8f, &H2b, &H5c, &H03]] As GUID
+
+
+Type DSCAPS
+	dwSize As DWord
+	dwFlags As DWord
+	dwMinSecondarySampleRate As DWord
+	dwMaxSecondarySampleRate As DWord
+	dwPrimaryBuffers As DWord
+	dwMaxHwMixingAllBuffers As DWord
+	dwMaxHwMixingStaticBuffers As DWord
+	dwMaxHwMixingStreamingBuffers As DWord
+	dwFreeHwMixingAllBuffers As DWord
+	dwFreeHwMixingStaticBuffers As DWord
+	dwFreeHwMixingStreamingBuffers As DWord
+	dwMaxHw3DAllBuffers As DWord
+	dwMaxHw3DStaticBuffers As DWord
+	dwMaxHw3DStreamingBuffers As DWord
+	dwFreeHw3DAllBuffers As DWord
+	dwFreeHw3DStaticBuffers As DWord
+	dwFreeHw3DStreamingBuffers As DWord
+	dwTotalHwMemBytes As DWord
+	dwFreeHwMemBytes As DWord
+	dwMaxContigFreeHwMemBytes As DWord
+	dwUnlockTransferRateHwBuffers As DWord
+	dwPlayCpuOverheadSwBuffers As DWord
+	dwReserved1 As DWord
+	dwReserved2 As DWord
+End Type
+
+Type DSBCAPS
+	dwSize As DWord
+	dwFlags As DWord
+	dwBufferBytes As DWord
+	dwUnlockTransferRate As DWord
+	dwPlayCpuOverhead As DWord
+End Type
+
+Const DSFX_LOCHARDWARE = &H00000001
+Const DSFX_LOCSOFTWARE = &H00000002
+Type DSEFFECTDESC
+	dwSize As DWord
+	dwFlags As DWord
+	guidDSFXClass As GUID
+	dwReserved1 As DWord
+	dwReserved2 As DWord
+End Type
+
+Const DSCFX_LOCHARDWARE  = &H00000001
+Const DSCFX_LOCSOFTWARE  = &H00000002
+Const DSCFXR_LOCHARDWARE = &H00000010
+Const DSCFXR_LOCSOFTWARE = &H00000020
+Type DSCEFFECTDESC
+	dwSize As DWord
+	dwFlags As DWord
+	guidDSCFXClass As GUID
+	guidDSCFXInstance As GUID
+	dwReserved1 As DWord
+	dwReserved2 As DWord
+End Type
+
+Type DSBUFFERDESC
+	dwSize As DWord
+	dwFlags As DWord
+	dwBufferBytes As DWord
+	dwReserved As DWord
+	lpwfxFormat As *WAVEFORMATEX
+	guid3DAlgorithm As GUID
+End Type
+
+Type DS3DBUFFER
+	dwSize As DWord
+	vPosition As D3DVECTOR
+	vVelocity As D3DVECTOR
+	dwInsideConeAngle As DWord
+	dwOutsideConeAngle As DWord
+	vConeOrientation As D3DVECTOR
+	lConeOutsideVolume As Long
+	flMinDistance As Single
+	flMaxDistance As Single
+	dwMode As DWord
+End Type
+
+Type DS3DLISTENER
+	dwSize As DWord
+	vPosition As D3DVECTOR
+	vVelocity As D3DVECTOR
+	vOrientFront As D3DVECTOR
+	vOrientTop As D3DVECTOR
+	flDistanceFactor As Single
+	flRolloffFactor As Single
+	flDopplerFactor As Single
+End Type
+
+Type DSCCAPS
+	dwSize As DWord
+	dwFlags As DWord
+	dwFormats As DWord
+	dwChannels As DWord
+End Type
+
+Type DSCBUFFERDESC
+	dwSize As DWord
+	dwFlags As DWord
+	dwBufferBytes As DWord
+	dwReserved As DWord
+	lpwfxFormat As *WAVEFORMATEX
+	dwFXCount As DWord
+	lpDSCFXDesc As *DSCEFFECTDESC
+End Type
+
+Type DSCBCAPS
+	dwSize As DWord
+	dwFlags As DWord
+	dwBufferBytes As DWord
+	dwReserved As DWord
+End Type
+
+Type DSBPOSITIONNOTIFY
+	dwOffset As DWord
+	hEventNotify As HANDLE
+End Type
+
+
+'------------------------
+' DirectSound Interfaces
+'------------------------
+
+Class IReferenceClock
+	Inherits IUnknown
+Public
+	'IReferenceClock methods
+	Abstract Function GetTime(pTime As *REFERENCE_TIME) As DWord
+	Abstract Function AdviseTime(rtBaseTime As REFERENCE_TIME, rtStreamTime As REFERENCE_TIME, hEvent As HANDLE, pdwAdviseCookie As DWordPtr) As DWord
+	Abstract Function AdvisePeriodic(rtStartTime As REFERENCE_TIME, rtPeriodTime As REFERENCE_TIME, hSemaphore As HANDLE, pdwAdviseCookie As DWordPtr) As DWord
+	Abstract Function Unadvise(dwAdviseCookie As DWord) As DWord
+End Class
+
+Dim IID_IDirectSound = [&H279AFA83, &H4981, &H11CE, [&HA5, &H21, &H00, &H20, &HAF, &H0B, &HE5, &H60]] As GUID
+Class IDirectSound
+	Inherits IUnknown
+Public
+	'IDirectSound methods
+	Abstract Function CreateSoundBuffer(pcDSBufferDesc As *DSBUFFERDESC, ppDSBuffer As *LPDIRECTSOUNDBUFFER, pUnkOuter As LPUNKNOWN) As DWord
+	Abstract Function GetCaps(pDSCaps As *DSCAPS) As DWord
+	Abstract Function DuplicateSoundBuffer(pDSBufferOriginal As LPDIRECTSOUNDBUFFER, ppDSBufferDuplicate As *LPDIRECTSOUNDBUFFER) As DWord
+	Abstract Function SetCooperativeLevel(hwnd As HWND, dwLevel As DWord) As DWord
+	Abstract Function Compact() As DWord
+	Abstract Function GetSpeakerConfig(pdwSpeakerConfig As DWordPtr) As DWord
+	Abstract Function SetSpeakerConfig(dwSpeakerConfig As DWord) As DWord
+	Abstract Function Initialize(pcGuidDevice As *GUID) As DWord
+End Class
+TypeDef LPDIRECTSOUND = *IDirectSound
+
+Dim IID_IDirectSound8 = [&HC50A7E93, &HF395, &H4834, [&H9E, &HF6, &H7F, &HA9, &H9D, &HE5, &H09, &H66]] As GUID
+Class IDirectSound8
+	Inherits IDirectSound
+Public
+	'IDirectSound8 methods
+	Abstract Function VerifyCertification(pdwCertified As DWordPtr) As DWord
+End Class
+TypeDef LPDIRECTSOUND8 = *IDirectSound8
+
+Dim IID_IDirectSoundBuffer = [&H279AFA85, &H4981, &H11CE, [&HA5, &H21, &H00, &H20, &HAF, &H0B, &HE5, &H60]] As GUID
+Class IDirectSoundBuffer
+	Inherits IUnknown
+Public
+	'IDirectSoundBuffer methods
+	Abstract Function GetCaps(pDSBufferCaps As *DSBCAPS) As DWord
+	Abstract Function GetCurrentPosition(pdwCurrentPlayCursor As DWordPtr, pdwCurrentWriteCursor As DWordPtr) As DWord
+	Abstract Function GetFormat(pwfxFormat As *WAVEFORMATEX, dwSizeAllocated As DWord, pdwSizeWritten As DWordPtr) As DWord
+	Abstract Function GetVolume(plVolume As *Long) As DWord
+	Abstract Function GetPan(plPan As *Long) As DWord
+	Abstract Function GetFrequency(pdwFrequency As DWordPtr) As DWord
+	Abstract Function GetStatus(pdwStatus As DWordPtr) As DWord
+	Abstract Function Initialize(pDirectSound As LPDIRECTSOUND, pcDSBufferDesc As *DSBUFFERDESC) As DWord
+	Abstract Function Lock(dwOffset As DWord, dwBytes As DWord, ppvAudioPtr1 As DWordPtr, pdwAudioBytes1 As DWordPtr, ppvAudioPtr2 As DWordPtr, pdwAudioBytes2 As DWordPtr, dwFlags As DWord) As DWord
+	Abstract Function Play(dwReserved1 As DWord, dwPriority As DWord, dwFlags As DWord) As DWord
+	Abstract Function SetCurrentPosition(dwNewPosition As DWord) As DWord
+	Abstract Function SetFormat(pcfxFormat As *WAVEFORMATEX) As DWord
+	Abstract Function SetVolume(lVolume As Long) As DWord
+	Abstract Function SetPan(lPan As Long) As DWord
+	Abstract Function SetFrequency(dwFrequency As DWord) As DWord
+	Abstract Function Stop() As DWord
+	Abstract Function Unlock(pvAudioPtr1 As VoidPtr, dwAudioBytes1 As DWord, pvAudioPtr2 As VoidPtr, dwAudioBytes2 As DWord) As DWord
+	Abstract Function Restore() As DWord
+End Class
+TypeDef LPDIRECTSOUNDBUFFER = *IDirectSoundBuffer
+
+Dim IID_IDirectSoundBuffer8 = [&H6825a449, &H7524, &H4d82, [&H92, &H0f, &H50, &He3, &H6a, &Hb3, &Hab, &H1e]] As GUID
+Class IDirectSoundBuffer8
+	Inherits IDirectSoundBuffer
+Public
+	'IDirectSoundBuffer8 methods
+	Abstract Function SetFX(dwEffectsCount As DWord, pDSFXDesc As *DSEFFECTDESC, pdwResultCodes As DWordPtr) As DWord
+	Abstract Function AcquireResources(dwFlags As DWord, dwEffectsCount As DWord, pdwResultCodes As DWordPtr) As DWord
+	Abstract Function GetObjectInPath(ByRef rguidObject As GUID, dwIndex As DWord, ByRef rguidInterface As GUID, ppObject As DWordPtr) As DWord
+End Class
+TypeDef LPDIRECTSOUNDBUFFER8 = *IDirectSoundBuffer8
+
+' Special GUID meaning "select all objects" for use in GetObjectInPath()
+Dim GUID_All_Objects = [&Haa114de5, &Hc262, &H4169, [&Ha1, &Hc8, &H23, &Hd6, &H98, &Hcc, &H73, &Hb5]] As GUID
+
+Dim IID_IDirectSound3DListener = [&H279AFA84, &H4981, &H11CE, [&HA5, &H21, &H00, &H20, &HAF, &H0B, &HE5, &H60]] As GUID
+Class IDirectSound3DListener
+	Inherits IUnknown
+Public
+	'IDirectSound3DListener methods
+	Abstract Function GetAllParameters(pListener As *DS3DLISTENER) As DWord
+	Abstract Function GetDistanceFactor(pflDistanceFactor As SinglePtr) As DWord
+	Abstract Function GetDopplerFactor(pflDopplerFactor As SinglePtr) As DWord
+	Abstract Function GetOrientation(pvOrientFront As *D3DVECTOR, pvOrientTop As *D3DVECTOR) As DWord
+	Abstract Function GetPosition(pvPosition As *D3DVECTOR) As DWord
+	Abstract Function GetRolloffFactor(pflRolloffFactor As SinglePtr) As DWord
+	Abstract Function GetVelocity(pvVelocity As *D3DVECTOR) As DWord
+	Abstract Function SetAllParameters(pcListener As *DS3DLISTENER, dwApply As DWord) As DWord
+	Abstract Function SetDistanceFactor(flDistanceFactor As Single, dwApply As DWord) As DWord
+	Abstract Function SetDopplerFactor(flDopplerFactor As Single, dwApply As DWord) As DWord
+	Abstract Function SetOrientation(xFront As Single, yFront As Single, zFront As Single, xTop As Single, yTop As Single, zTop As Single, dwApply As DWord) As DWord
+	Abstract Function SetPosition(x As Single, y As Single, z As Single, dwApply As DWord) As DWord
+	Abstract Function SetRolloffFactor(flRolloffFactor As Single, dwApply As DWord) As DWord
+	Abstract Function SetVelocity(x As Single, y As Single, z As Single, dwApply As DWord) As DWord
+	Abstract Function CommitDeferredSettings() As DWord
+End Class
+TypeDef LPDIRECTSOUND3DLISTENER = *IDirectSound3DListener
+Dim IID_IDirectSound3DListener8 As GUID
+IID_IDirectSound3DListener8=IID_IDirectSound3DListener
+TypeDef IDirectSound3DListener8 = IDirectSound3DListener
+TypeDef LPDIRECTSOUND3DLISTENER8 = *IDirectSound3DListener8
+
+Dim IID_IDirectSound3DBuffer = [&H279AFA86, &H4981, &H11CE, [&HA5, &H21, &H00, &H20, &HAF, &H0B, &HE5, &H60]] As GUID
+Class IDirectSound3DBuffer
+	Inherits IUnknown
+Public
+	'IDirectSound3DBuffer methods
+	Abstract Function GetAllParameters(pDs3dBuffer As *DS3DBUFFER) As DWord
+	Abstract Function GetConeAngles(pdwInsideConeAngle As DWordPtr, pdwOutsideConeAngle As DWordPtr) As DWord
+	Abstract Function GetConeOrientation(pvOrientation As *D3DVECTOR) As DWord
+	Abstract Function GetConeOutsideVolume(plConeOutsideVolume As *Long) As DWord
+	Abstract Function GetMaxDistance(pflMaxDistance As SinglePtr) As DWord
+	Abstract Function GetMinDistance(pflMinDistance As SinglePtr) As DWord
+	Abstract Function GetMode(pdwMode As DWordPtr) As DWord
+	Abstract Function GetPosition(pvPosition As *D3DVECTOR) As DWord
+	Abstract Function GetVelocity(pvVelocity As *D3DVECTOR) As DWord
+	Abstract Function SetAllParameters(pcDs3dBuffer As *DS3DBUFFER, dwApply As DWord) As DWord
+	Abstract Function SetConeAngles(dwInsideConeAngle As DWord, dwOutsideConeAngle As DWord, dwApply As DWord) As DWord
+	Abstract Function SetConeOrientation(x As Single, y As Single, z As Single, dwApply As DWord) As DWord
+	Abstract Function SetConeOutsideVolume(lConeOutsideVolume As Long, dwApply As DWord) As DWord
+	Abstract Function SetMaxDistance(flMaxDistance As Single, dwApply As DWord) As DWord
+	Abstract Function SetMinDistance(flMinDistance As Single, dwApply As DWord) As DWord
+	Abstract Function SetMode(dwMode As DWord, dwApply As DWord) As DWord
+	Abstract Function SetPosition(x As Single, y As Single, z As Single, dwApply As DWord) As DWord
+	Abstract Function SetVelocity(x As Single, y As Single, z As Single, dwApply As DWord) As DWord
+End Class
+TypeDef LPDIRECTSOUND3DBUFFER = *IDirectSound3DBuffer
+Dim IID_IDirectSound3DBuffer8 As GUID
+IID_IDirectSound3DBuffer8=IID_IDirectSound3DBuffer
+TypeDef IDirectSound3DBuffer8 = IDirectSound3DBuffer
+TypeDef LPDIRECTSOUND3DBUFFER8 = *IDirectSound3DBuffer8
+
+Dim IID_IDirectSoundCapture = [&Hb0210781, &H89cd, &H11d0, [&Haf, &H8, &H0, &Ha0, &Hc9, &H25, &Hcd, &H16]] As GUID
+Class IDirectSoundCapture
+	Inherits IUnknown
+Public
+	'IDirectSoundCapture methods
+	Abstract Function CreateCaptureBuffer(pcDSCBufferDesc As *DSCBUFFERDESC, ppDSCBuffer As *LPDIRECTSOUNDCAPTUREBUFFER, pUnkOuter As LPUNKNOWN) As DWord
+	Abstract Function GetCaps(pDSCCaps As *DSCCAPS) As DWord
+	Abstract Function Initialize(pcGuidDevice As *GUID) As DWord
+End Class
+TypeDef LPDIRECTSOUNDCAPTURE = *IDirectSoundCapture
+TypeDef IDirectSoundCapture8 = IDirectSoundCapture
+TypeDef LPDIRECTSOUNDCAPTURE8 = *IDirectSoundCapture8
+
+Dim IID_IDirectSoundCaptureBuffer = [&Hb0210782, &H89cd, &H11d0, [&Haf, &H8, &H0, &Ha0, &Hc9, &H25, &Hcd, &H16]] As GUID
+Class IDirectSoundCaptureBuffer
+	Inherits IUnknown
+Public
+	'IDirectSoundCaptureBuffer methods
+	Abstract Function GetCaps(pDSCBCaps As *DSCBCAPS) As DWord
+	Abstract Function GetCurrentPosition(pdwCapturePosition As DWordPtr, pdwReadPosition As DWordPtr) As DWord
+	Abstract Function GetFormat(pwfxFormat As *WAVEFORMATEX, dwSizeAllocated As DWord, pdwSizeWritten As DWordPtr) As DWord
+	Abstract Function GetStatus(pdwStatus As DWordPtr) As DWord
+	Abstract Function Initialize(pDirectSoundCapture As LPDIRECTSOUNDCAPTURE, pcDSCBufferDesc As *DSCBUFFERDESC) As DWord
+	Abstract Function Lock(dwOffset As DWord, dwBytes As DWord, ppvAudioPtr1 As DWordPtr, pdwAudioBytes1 As DWordPtr, ppvAudioPtr2 As DWordPtr, pdwAudioBytes2 As DWordPtr, dwFlags As DWord) As DWord
+	Abstract Function Start(dwFlags As DWord) As DWord
+	Abstract Function Stop() As DWord
+	Abstract Function Unlock(pvAudioPtr1 As VoidPtr, dwAudioBytes1 As DWord, pvAudioPtr2 As VoidPtr, dwAudioBytes2 As DWord) As DWord
+End Class
+TypeDef LPDIRECTSOUNDCAPTUREBUFFER = *IDirectSoundCaptureBuffer
+
+Dim IID_IDirectSoundCaptureBuffer8 = [&H990df4, &Hdbb, &H4872, [&H83, &H3e, &H6d, &H30, &H3e, &H80, &Hae, &Hb6]] As GUID
+Class IDirectSoundCaptureBuffer8
+	Inherits IDirectSoundCaptureBuffer
+Public
+	'IDirectSoundCaptureBuffer8 methods
+	Abstract Function GetObjectInPath(ByRef rguidObject As GUID, dwIndex As DWord, ByRef rguidInterface As GUID, ppObject As DWord) As DWord
+	Abstract Function GetFXStatus(dwFXCount As DWord, pdwFXStatus As DWordPtr) As DWord
+End Class
+TypeDef LPDIRECTSOUNDCAPTUREBUFFER8 = *IDirectSoundCaptureBuffer8
+
+Dim IID_IDirectSoundNotify = [&Hb0210783, &H89cd, &H11d0, [&Haf, &H8, &H0, &Ha0, &Hc9, &H25, &Hcd, &H16]] As GUID
+Class IDirectSoundNotify
+	Inherits IUnknown
+Public
+	'IDirectSoundNotify methods
+	Abstract Function SetNotificationPositions(dwPositionNotifies As DWord, pcPositionNotifies As *DSBPOSITIONNOTIFY) As DWord
+End Class
+TypeDef LPDIRECTSOUNDNOTIFY = *IDirectSoundNotify
+
+Dim IID_IKsPropertySet = [&H31efac30, &H515c, &H11d0, [&Ha9, &Haa, &H00, &Haa, &H00, &H61, &Hbe, &H93]] As GUID
+Class IKsPropertySet
+	Inherits IUnknown
+Public
+	'IKsPropertySet methods
+	Abstract Function Get(ByRef rguidPropSet As GUID, ulId As DWord, pInstanceData As VoidPtr, ulInstanceLength As DWord, pPropertyData As VoidPtr, ulDataLength As DWord, pulBytesReturned As DWordPtr) As DWord
+	Abstract Function Set(ByRef rguidPropSet As GUID, ulId As DWord, pInstanceData As VoidPtr, ulInstanceLength As DWord, pPropertyData As VoidPtr, ulDataLength As DWord) As DWord
+	Abstract Function QuerySupport(ByRef rguidPropSet As GUID, ulId As DWord, pulTypeSupport As DWordPtr) As DWord
+End Class
+TypeDef LPKSPROPERTYSET = *IKsPropertySet
+
+Dim IID_IDirectSoundFullDuplex = [&Hedcb4c7a, &Hdaab, &H4216, [&Ha4, &H2e, &H6c, &H50, &H59, &H6d, &Hdc, &H1d]] As GUID
+Class IDirectSoundFullDuplex
+	Inherits IUnknown
+Public
+	'IDirectSoundFullDuplex methods
+	Abstract Function Initialize(pCaptureGuid As *GUID, pRenderGuid As *GUID, lpDscBufferDesc As *DSCBUFFERDESC, lpDsBufferDesc As *DSBUFFERDESC, hWnd As HWND, dwLevel As DWord, lplpDirectSoundCaptureBuffer8 As *LPDIRECTSOUNDCAPTUREBUFFER8, lplpDirectSoundBuffer8 As *LPDIRECTSOUNDBUFFER8) As DWord
+End Class
+TypeDef LPDIRECTSOUNDFULLDUPLEX = *IDirectSoundFullDuplex
+
+
+'-------------------
+' DirectSound APIs
+'-------------------
+
+Declare Function DirectSoundCreate Lib "dsound" (pcGuidDevice As *GUID, ppDS As *LPDIRECTSOUND, pUnkOuter As LPUNKNOWN) As DWord
+Declare Function DirectSoundEnumerate Lib "dsound" Alias "DirectSoundEnumerateA" (pDSEnumCallback As VoidPtr, pContext As VoidPtr) As DWord
+Declare Function DirectSoundCaptureCreate Lib "dsound" (pcGuidDevice As *GUID, ppDSC As *LPDIRECTSOUNDCAPTURE, pUnkOuter As LPUNKNOWN) As DWord
+Declare Function DirectSoundCaptureEnumerate Lib "dsound" Alias "DirectSoundCaptureEnumerateA" (pDSEnumCallback As VoidPtr, pContext As VoidPtr) As DWord
+Declare Function DirectSoundCreate8 Lib "dsound" (pcGuidDevice As *GUID, ppDS8 As *LPDIRECTSOUND8, pUnkOuter As LPUNKNOWN) As DWord
+Declare Function DirectSoundCaptureCreate8 Lib "dsound" (pcGuidDevice As *GUID, ppDSC8 As *LPDIRECTSOUNDCAPTURE8, pUnkOuter As LPUNKNOWN) As DWord
+Declare Function DirectSoundFullDuplexCreate Lib "dsound" (pcGuidCaptureDevice As *GUID, pcGuidRenderDevice As *GUID, pcDSCBufferDesc As *DSCBUFFERDESC, pcDSBufferDesc As *DSBUFFERDESC, hWnd As HWND, dwLevel As DWord, ppDSFD As *LPDIRECTSOUNDFULLDUPLEX, ppDSCBuffer8 As *LPDIRECTSOUNDCAPTUREBUFFER8, ppDSBuffer8 As *LPDIRECTSOUNDBUFFER8, pUnkOuter As LPUNKNOWN) As DWord
+Declare Function GetDeviceID Lib "dsound" (pGuidSrc As *GUID, pGuidDest As *GUID) As DWord
+
+
+'--------------
+' Return Codes
+'--------------
+
+' The function completed successfully
+Const DS_OK                        = S_OK
+
+' The call succeeded, but we had to substitute the 3D algorithm
+Const DS_NO_VIRTUALIZATION         = MAKE_HRESULT(0, _FACDS, 10)
+
+' The call failed because resources (such as a priority level)
+' were already being used by another caller
+Const DSERR_ALLOCATED              = MAKE_DSHRESULT(10)
+
+' The control (vol, pan, etc.) requested by the caller is not available
+Const DSERR_CONTROLUNAVAIL         = MAKE_DSHRESULT(30)
+
+' An invalid parameter was passed to the returning function
+Const DSERR_INVALIDPARAM           = E_INVALIDARG
+
+' This call is not valid for the current state of this object
+Const DSERR_INVALIDCALL            = MAKE_DSHRESULT(50)
+
+' An undetermined error occurred inside the DirectSound subsystem
+Const DSERR_GENERIC                = E_FAIL
+
+' The caller does not have the priority level required for the function to
+' succeed
+Const DSERR_PRIOLEVELNEEDED        = MAKE_DSHRESULT(70)
+
+' Not enough free memory is available to complete the operation
+Const DSERR_OUTOFMEMORY            = E_OUTOFMEMORY
+
+' The specified WAVE format is not supported
+Const DSERR_BADFORMAT              = MAKE_DSHRESULT(100)
+
+' The function called is not supported at this time
+Const DSERR_UNSUPPORTED            = E_NOTIMPL
+
+' No sound driver is available for use
+Const DSERR_NODRIVER               = MAKE_DSHRESULT(120)
+
+' This object is already initialized
+Const DSERR_ALREADYINITIALIZED     = MAKE_DSHRESULT(130)
+
+' This object does not support aggregation
+Const DSERR_NOAGGREGATION          = CLASS_E_NOAGGREGATION
+
+' The buffer memory has been lost, and must be restored
+Const DSERR_BUFFERLOST             = MAKE_DSHRESULT(150)
+
+' Another app has a higher priority level, preventing this call from
+' succeeding
+Const DSERR_OTHERAPPHASPRIO        = MAKE_DSHRESULT(160)
+
+' This object has not been initialized
+Const DSERR_UNINITIALIZED          = MAKE_DSHRESULT(170)
+
+' The requested COM interface is not available
+Const DSERR_NOINTERFACE            = E_NOINTERFACE
+
+' Access is denied
+Const DSERR_ACCESSDENIED           = E_ACCESSDENIED
+
+' Tried to create a DSBCAPS_CTRLFX buffer shorter than DSBSIZE_FX_MIN milliseconds
+Const DSERR_BUFFERTOOSMALL         = MAKE_DSHRESULT(180)
+
+' Attempt to use DirectSound 8 functionality on an older DirectSound object
+Const DSERR_DS8_REQUIRED           = MAKE_DSHRESULT(190)
+
+' A circular loop of send effects was detected
+Const DSERR_SENDLOOP               = MAKE_DSHRESULT(200)
+
+' The GUID specified in an audiopath file does not match a valid MIXIN buffer
+Const DSERR_BADSENDBUFFERGUID      = MAKE_DSHRESULT(210)
+
+' The object requested was not found (numerically equal to DMUS_E_NOT_FOUND)
+Const DSERR_OBJECTNOTFOUND         = MAKE_DSHRESULT(4449)
+
+' The effects requested could not be found on the system, or they were found
+' but in the wrong order, or in the wrong hardware/software locations.
+Const DSERR_FXUNAVAILABLE          = MAKE_DSHRESULT(220)
+
+
+'--------
+' Flags
+'--------
+
+Const DSCAPS_PRIMARYMONO          = &H00000001
+Const DSCAPS_PRIMARYSTEREO        = &H00000002
+Const DSCAPS_PRIMARY8BIT          = &H00000004
+Const DSCAPS_PRIMARY16BIT         = &H00000008
+Const DSCAPS_CONTINUOUSRATE       = &H00000010
+Const DSCAPS_EMULDRIVER           = &H00000020
+Const DSCAPS_CERTIFIED            = &H00000040
+Const DSCAPS_SECONDARYMONO        = &H00000100
+Const DSCAPS_SECONDARYSTEREO      = &H00000200
+Const DSCAPS_SECONDARY8BIT        = &H00000400
+Const DSCAPS_SECONDARY16BIT       = &H00000800
+
+Const DSSCL_NORMAL                = &H00000001
+Const DSSCL_PRIORITY              = &H00000002
+Const DSSCL_EXCLUSIVE             = &H00000003
+Const DSSCL_WRITEPRIMARY          = &H00000004
+
+Const DSSPEAKER_DIRECTOUT         = &H00000000
+Const DSSPEAKER_HEADPHONE         = &H00000001
+Const DSSPEAKER_MONO              = &H00000002
+Const DSSPEAKER_QUAD              = &H00000003
+Const DSSPEAKER_STEREO            = &H00000004
+Const DSSPEAKER_SURROUND          = &H00000005
+Const DSSPEAKER_5POINT1           = &H00000006
+Const DSSPEAKER_7POINT1           = &H00000007
+
+Const DSSPEAKER_GEOMETRY_MIN      = &H00000005  '   5 degrees
+Const DSSPEAKER_GEOMETRY_NARROW   = &H0000000A  '  10 degrees
+Const DSSPEAKER_GEOMETRY_WIDE     = &H00000014  '  20 degrees
+Const DSSPEAKER_GEOMETRY_MAX      = &H000000B4  ' 180 degrees
+
+Const DSBCAPS_PRIMARYBUFFER       = &H00000001
+Const DSBCAPS_STATIC              = &H00000002
+Const DSBCAPS_LOCHARDWARE         = &H00000004
+Const DSBCAPS_LOCSOFTWARE         = &H00000008
+Const DSBCAPS_CTRL3D              = &H00000010
+Const DSBCAPS_CTRLFREQUENCY       = &H00000020
+Const DSBCAPS_CTRLPAN             = &H00000040
+Const DSBCAPS_CTRLVOLUME          = &H00000080
+Const DSBCAPS_CTRLPOSITIONNOTIFY  = &H00000100
+Const DSBCAPS_CTRLFX              = &H00000200
+Const DSBCAPS_STICKYFOCUS         = &H00004000
+Const DSBCAPS_GLOBALFOCUS         = &H00008000
+Const DSBCAPS_GETCURRENTPOSITION2 = &H00010000
+Const DSBCAPS_MUTE3DATMAXDISTANCE = &H00020000
+Const DSBCAPS_LOCDEFER            = &H00040000
+
+Const DSBPLAY_LOOPING             = &H00000001
+Const DSBPLAY_LOCHARDWARE         = &H00000002
+Const DSBPLAY_LOCSOFTWARE         = &H00000004
+Const DSBPLAY_TERMINATEBY_TIME    = &H00000008
+Const DSBPLAY_TERMINATEBY_DISTANCE    = &H000000010
+Const DSBPLAY_TERMINATEBY_PRIORITY    = &H000000020
+
+Const DSBSTATUS_PLAYING           = &H00000001
+Const DSBSTATUS_BUFFERLOST        = &H00000002
+Const DSBSTATUS_LOOPING           = &H00000004
+Const DSBSTATUS_LOCHARDWARE       = &H00000008
+Const DSBSTATUS_LOCSOFTWARE       = &H00000010
+Const DSBSTATUS_TERMINATED        = &H00000020
+
+Const DSBLOCK_FROMWRITECURSOR     = &H00000001
+Const DSBLOCK_ENTIREBUFFER        = &H00000002
+
+Const DSBFREQUENCY_ORIGINAL       = 0
+Const DSBFREQUENCY_MIN            = 100
+Const DSBFREQUENCY_MAX            = 200000
+
+Const DSBPAN_LEFT                 = -10000
+Const DSBPAN_CENTER               = 0
+Const DSBPAN_RIGHT                = 10000
+
+Const DSBVOLUME_MIN               = -10000
+Const DSBVOLUME_MAX               = 0
+
+Const DSBSIZE_MIN                 = 4
+Const DSBSIZE_MAX                 = &H0FFFFFFF
+Const DSBSIZE_FX_MIN              = 150  ' NOTE: Milliseconds, not bytes
+
+Const DS3DMODE_NORMAL             = &H00000000
+Const DS3DMODE_HEADRELATIVE       = &H00000001
+Const DS3DMODE_DISABLE            = &H00000002
+
+Const DS3D_IMMEDIATE              = &H00000000
+Const DS3D_DEFERRED               = &H00000001
+
+Const DS3D_MINDISTANCEFACTOR      = FLT_MIN
+Const DS3D_MAXDISTANCEFACTOR      = FLT_MAX
+Const DS3D_DEFAULTDISTANCEFACTOR  = 1.0
+
+Const DS3D_MINROLLOFFFACTOR       = 0.0
+Const DS3D_MAXROLLOFFFACTOR       = 10.0
+Const DS3D_DEFAULTROLLOFFFACTOR   = 1.0
+
+Const DS3D_MINDOPPLERFACTOR       = 0.0
+Const DS3D_MAXDOPPLERFACTOR       = 10.0
+Const DS3D_DEFAULTDOPPLERFACTOR   = 1.0
+
+Const DS3D_DEFAULTMINDISTANCE     = 1.0
+Const DS3D_DEFAULTMAXDISTANCE     = 1000000000.0
+
+Const DS3D_MINCONEANGLE           = 0
+Const DS3D_MAXCONEANGLE           = 360
+Const DS3D_DEFAULTCONEANGLE       = 360
+
+Const DS3D_DEFAULTCONEOUTSIDEVOLUME = DSBVOLUME_MAX
+
+' IDirectSoundCapture attributes
+
+Const DSCCAPS_EMULDRIVER          = DSCAPS_EMULDRIVER
+Const DSCCAPS_CERTIFIED           = DSCAPS_CERTIFIED
+Const DSCCAPS_MULTIPLECAPTURE     = &H00000001
+
+' IDirectSoundCaptureBuffer attributes
+
+Const DSCBCAPS_WAVEMAPPED         = &H80000000
+
+Const DSCBCAPS_CTRLFX             = &H00000200
+
+
+Const DSCBLOCK_ENTIREBUFFER       = &H00000001
+
+Const DSCBSTATUS_CAPTURING        = &H00000001
+Const DSCBSTATUS_LOOPING          = &H00000002
+
+Const DSCBSTART_LOOPING           = &H00000001
+
+Const DSBPN_OFFSETSTOP            = &HFFFFFFFF
+
+Const DS_CERTIFIED                = &H00000000
+Const DS_UNCERTIFIED              = &H00000001
+
+
+'----------------------------------------
+' DirectSound Internal Effect Algorithms
+'----------------------------------------
+
+' Gargle {DAFD8210-5711-4B91-9FE3-F75B7AE279BF}
+Dim GUID_DSFX_STANDARD_GARGLE = [&Hdafd8210, &H5711, &H4b91, [&H9f, &He3, &Hf7, &H5b, &H7a, &He2, &H79, &Hbf]] As GUID
+
+' Chorus {EFE6629C-81F7-4281-BD91-C9D604A95AF6}
+Dim GUID_DSFX_STANDARD_CHORUS = [&Hefe6629c, &H81f7, &H4281, [&Hbd, &H91, &Hc9, &Hd6, &H04, &Ha9, &H5a, &Hf6]] As GUID
+
+' Flanger {EFCA3D92-DFD8-4672-A603-7420894BAD98}
+Dim GUID_DSFX_STANDARD_FLANGER = [&Hefca3d92, &Hdfd8, &H4672, [&Ha6, &H03, &H74, &H20, &H89, &H4b, &Had, &H98]] As GUID
+
+' Echo/Delay {EF3E932C-D40B-4F51-8CCF-3F98F1B29D5D}
+Dim GUID_DSFX_STANDARD_ECHO = [&Hef3e932c, &Hd40b, &H4f51, [&H8c, &Hcf, &H3f, &H98, &Hf1, &Hb2, &H9d, &H5d]] As GUID
+
+' Distortion {EF114C90-CD1D-484E-96E5-09CFAF912A21}
+Dim GUID_DSFX_STANDARD_DISTORTION = [&Hef114c90, &Hcd1d, &H484e, [&H96, &He5, &H09, &Hcf, &Haf, &H91, &H2a, &H21]] As GUID
+
+' Compressor/Limiter {EF011F79-4000-406D-87AF-BFFB3FC39D57}
+Dim GUID_DSFX_STANDARD_COMPRESSOR = [&Hef011f79, &H4000, &H406d, [&H87, &Haf, &Hbf, &Hfb, &H3f, &Hc3, &H9d, &H57]] As GUID
+
+' Parametric Equalization {120CED89-3BF4-4173-A132-3CB406CF3231}
+Dim GUID_DSFX_STANDARD_PARAMEQ = [&H120ced89, &H3bf4, &H4173, [&Ha1, &H32, &H3c, &Hb4, &H06, &Hcf, &H32, &H31]] As GUID
+
+' I3DL2 Environmental Reverberation: Reverb (Listener) Effect {EF985E71-D5C7-42D4-BA4D-2D073E2E96F4}
+Dim GUID_DSFX_STANDARD_I3DL2REVERB = [&Hef985e71, &Hd5c7, &H42d4, [&Hba, &H4d, &H2d, &H07, &H3e, &H2e, &H96, &Hf4]] As GUID
+
+' Waves Reverberation {87FC0268-9A55-4360-95AA-004A1D9DE26C}
+Dim GUID_DSFX_WAVES_REVERB = [&H87fc0268, &H9a55, &H4360, [&H95, &Haa, &H00, &H4a, &H1d, &H9d, &He2, &H6c]] As GUID
Index: /trunk/ab5.0/ablib/src/exdisp.ab
===================================================================
--- /trunk/ab5.0/ablib/src/exdisp.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/exdisp.ab	(revision 506)
@@ -0,0 +1,254 @@
+'exdisp.ab
+
+'#require <ocidl.ab>
+'#require <docobj.ab>
+
+
+Const Enum OLECMDID 'docobj.ab
+End Enum
+
+Const Enum OLECMDEXECOPT 'docobj.ab
+End Enum
+
+Const Enum OLECMDTEXTF 'docobj.ab
+End Enum
+
+Const Enum OLECMDF 'docobj.ab
+End Enum
+
+Const Enum READYSTATE 'ocidl.ab
+End Enum
+
+'SID_SkipHung
+
+/* library SHDocVw */
+/* [version][lcid][helpstring][uuid] */
+
+'各種列挙体
+
+'LIBID_SHDocVw
+
+/* interface IWebBrowser */
+/* [object][oleautomation][dual][hidden][helpcontext][helpstring][uuid] */
+
+/* [helpstring][uuid] 14EE5380-A378-11cf-A731-00A0C9082637*/
+Const Enum BrowserNavConstants
+	navOpenInNewWindow = &h1
+	navNoHistory = &h2
+	navNoReadFromCache = &h4
+	navNoWriteToCache = &h8
+	navAllowAutosearch = &h10
+	navBrowserBar = &h20
+	navHyperlink = &h40
+	navEnforceRestricted = &h80
+	navNewWindowsManaged = &h100
+	navUntrustedForDownload = &h200
+	navTrustedForActiveX = &h400
+	navOpenInNewTab = &h800
+	navOpenInBackgroundTab = &h1000
+	navKeepWordWheelText = &h2000
+End Enum
+
+/* [helpstring][uuid] C317C261-A991-11cf-A731-00A0C9082637*/
+Const Enum RefreshConstants
+	REFRESH_NORMAL = 0
+	REFRESH_IFEXPIRED = 1
+	REFRESH_COMPLETELY = 3
+End Enum
+
+Dim IID_IWebBrowser = [&hEAB22AC1, &h30C1, &h11CF, [&hA7, &hEB, &h00, &h00, &hC0, &h5B, &hAE, &h0B]] As IID
+Interface IWebBrowser
+	Inherits IDispatch
+
+	/* [helpcontext][helpstring][id] */ Function GoBack() As HRESULT
+	/* [helpcontext][helpstring][id] */ Function GoForward() As HRESULT
+	/* [helpcontext][helpstring][id] */ Function GoHome() As HRESULT
+	/* [helpcontext][helpstring][id] */ Function GoSearch() As HRESULT
+	/* [helpcontext][helpstring][id] */ Function Navigate(
+		/* [in] */ URL As BSTR,
+		/* [optional][in] */ Flags As *VARIANT,
+		/* [optional][in] */ TargetFrameName As *VARIANT,
+		/* [optional][in] */ PostData As *VARIANT,
+		/* [optional][in] */ Headers As *VARIANT) As HRESULT
+	/* [helpcontext][helpstring][id] */ Function Refresh() As HRESULT
+	/* [helpcontext][helpstring][id] */ Function Refresh2(
+		/* [optional][in] */ Level As *VARIANT) As HRESULT
+	/* [helpcontext][helpstring][id] */ Function Stop() As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Application(
+		/* [retval][out] */ ByRef Disp As IDispatch) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Parent(
+		/* [retval][out] */ ByRef Disp As IDispatch) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Container(
+		/* [retval][out] */ ByRef Disp As IDispatch) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Document(
+		/* [retval][out] */ ByRef Disp As IDispatch) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_TopLevelContainer(
+		/* [retval][out] */ ByRef Bool As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Type(
+		/* [retval][out] */ ByRef Type_ As BSTR) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Left(
+		/* [retval][out] */ ByRef l As Long) As HRESULT
+	/* [propput][id] */ Function put_Left(
+		/* [in] */ Left As Long) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Top(
+		/* [retval][out] */ ByRef l As Long) As HRESULT
+	/* [propput][id] */ Function put_Top(
+		/* [in] */ Top As Long) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Width(
+		/* [retval][out] */ ByRef l As Long) As HRESULT
+	/* [propput][id] */ Function put_Width(
+		/* [in] */ Width As Long) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Height(
+		/* [retval][out] */ ByRef l As Long) As HRESULT
+	/* [propput][id] */ Function put_Height(
+		/* [in] */ Height As Long) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_LocationName(
+		/* [retval][out] */ ByRef LocationName As BSTR) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_LocationURL(
+		/* [retval][out] */ ByRef LocationURL As BSTR) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Busy(
+		/* [retval][out] */ ByRef Bool As VARIANT_BOOL) As HRESULT
+End Interface
+
+/* dispinterface DWebBrowserEvents */
+/* [hidden][helpstring][uuid] */
+
+Dim DIID_DWebBrowserEvents = [&hEAB22AC2, &h30C1, &h11CF, [&hA7, &hEB, &h00, &h00, &hC0, &h5B, &hAE, &h0B]] As IID
+Interface DIID_DWebBrowserEvents
+	Inherits IDispatch
+End Interface
+
+/* interface IWebBrowserApp */
+/* [object][dual][oleautomation][hidden][helpcontext][helpstring][uuid] */
+
+Dim IID_IWebBrowserApp = [&h0002DF05, 0, 0, [&hC0, 0, 0, 0, 0, 0, 46]] As IID
+Interface IWebBrowserApp
+	Inherits IWebBrowser
+
+	/* [helpcontext][helpstring][id] */ Function Quit() As HRESULT
+	/* [helpcontext][helpstring][id] */ Function ClientToWindow(
+		/* [out][in] */ ByRef cx As Long,
+		/* [out][in] */ ByRef pcy As Long) As HRESULT
+	/* [helpcontext][helpstring][id] */ Function PutProperty(
+		/* [in] */ Property As BSTR,
+		/* [in] */ vtValue As VARIANT) As HRESULT
+	/* [helpcontext][helpstring][id] */ Function GetProperty(
+		/* [in] */ Property As BSTR,
+		/* [retval][out] */ ByRef vtValue As VARIANT) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Name(
+		/* [retval][out] */ ByRef Name As BSTR) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_HWND(
+		/* [retval][out] */ ByRef hwnd As LONG_PTR) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_FullName(
+		/* [retval][out] */ ByRef FullName As BSTR) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Path(
+		/* [retval][out] */ ByRef Path As BSTR) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Visible(
+		/* [retval][out] */ ByRef Bool As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_Visible(
+		/* [in] */ Value As Long) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_StatusBar(
+		/* [retval][out] */ ByRef Bool As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_StatusBar(
+		/* [in] */ Value As Long) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_StatusText(
+		/* [retval][out] */ ByRef StatusText As BSTR) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_StatusText(
+		/* [in] */ StatusText As BSTR) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_ToolBar(
+		/* [retval][out] */ ByRef Value As Long) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_ToolBar(
+		/* [in] */ Value As Long) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_MenuBar(
+		/* [retval][out] */ ByRef Value As Long) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_MenuBar(
+		/* [in] */ Value As Long) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_FullScreen(
+		/* [retval][out] */ ByRef bFullScreen As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_FullScreen(
+		/* [in] */ bFullScreen As VARIANT_BOOL) As HRESULT
+End Interface
+
+/* interface IWebBrowser2 */
+/* [object][dual][oleautomation][hidden][helpcontext][helpstring][uuid] */
+
+Dim IID_IWebBrowser2 = [&hD30C1661, &hCDAF, &h11d0, [&h8A, &h3E, &h00, &hC0, &h4F, &hC9, &hE2, &h6E]] As IID
+Interface IWebBrowser2
+	Inherits IWebBrowserApp
+
+	/* [helpcontext][helpstring][id] */ Function Navigate2(
+		/* [in] */ URL As *VARIANT,
+		/* [optional][in] */ Flags As *VARIANT,
+		/* [optional][in] */ TargetFrameName As *VARIANT,
+		/* [optional][in] */ PostData As *VARIANT,
+		/* [optional][in] */ Headers As *VARIANT) As HRESULT
+	/* [helpcontext][helpstring][id] */ Function QueryStatusWB(
+		/* [in] */ cmdID As OLECMDID,
+		/* [retval][out] */ ByRef cmdf As OLECMDF) As HRESULT
+	/* [helpcontext][helpstring][id] */ Function ExecWB(
+		/* [in] */ cmdID As OLECMDID,
+		/* [in] */ cmdexecopt As OLECMDEXECOPT,
+		/* [optional][in] */ pvaIn As *VARIANT,
+		/* [optional][in][out] */ pvaOut As *VARIANT) As HRESULT
+	/* [helpcontext][helpstring][id] */ Function ShowBrowserBar(
+		/* [in] */ ByRef vaClsid As VARIANT,
+		/* [optional][in] */ pvarShow As *VARIANT,
+		/* [optional][in] */ pvarSize As *VARIANT) As HRESULT
+	/* [bindable][propget][id] */ Function get_ReadyState(
+		/* [out][retval] */ ByRef lReadyState As READYSTATE) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Offline(
+		/* [retval][out] */ ByRef bOffline As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_Offline(
+		/* [in] */ bOffline As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Silent(
+		/* [retval][out] */ ByRef bSilent As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_Silent(
+		/* [in] */ bSilent As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_RegisterAsBrowser(
+		/* [retval][out] */ ByRef bRegister As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_RegisterAsBrowser(
+		/* [in] */ bRegister As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_RegisterAsDropTarget(
+		/* [retval][out] */ ByRef bRegister As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_RegisterAsDropTarget(
+		/* [in] */ bRegister As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_TheaterMode(
+		/* [retval][out] */ ByRef bRegister As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_TheaterMode(
+		/* [in] */ bRegister As VARIANT_BOOL) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_AddressBar(
+		/* [retval][out] */ ByRef Value As Long) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_AddressBar(
+		/* [in] */ Value As Long) As HRESULT
+	/* [helpcontext][helpstring][propget][id] */ Function get_Resizable(
+		/* [retval][out] */ ByRef Value As Long) As HRESULT
+	/* [helpcontext][helpstring][propput][id] */ Function put_Resizable(
+		/* [in] */ Value As Long) As HRESULT
+End Interface
+
+/* dispinterface DWebBrowserEvents2 */
+/* [hidden][helpstring][uuid] */
+
+Dim DIID_DWebBrowserEvents2 = [&h34A715A0, &h6587, &h11D0, [&h92, &h4A, &h00, &h20, &hAF, &hC7, &hAC, &h4D]] As IID
+Interface DWebBrowserEvents2
+	Inherits IDispatch
+End Interface
+
+Dim CLSID_WebBrowser_V1 = [&hEAB22AC3, &h30C1, &h11CF, [&hA7, &hEB, &h00, &h00, &hC0, &h5B, &hAE, &h0B]] As CLSID
+Dim CLSID_WebBrowser = [&h8856F961, &h340A, &h11D0, [&hA9, &h6B, &h00, &hC0, &h4F, &hD7, &h05, &hA2]] As CLSID
+Dim CLSID_InternetExplorer = [&h0002DF01, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As CLSID
+Dim CLSID_ShellBrowserWindow = [&hc08afd90, &hf2a1, &h11d1, [&h84, &h55, &h00, &ha0, &hc9, &h1f, &h38, &h80]] As CLSID
+
+'DShellWindowsEvents
+'IShellWindows
+'ShellWindows
+'IShellUIHelper
+'IShellUIHelper2
+'ShellUIHelper
+'DShellNameSpaceEvents
+'IShellFavoritesNameSpace
+'IShellNameSpace
+'ShellNameSpace
+'ShellShellNameSpace
+'IScriptErrorList
+'CScriptErrorList
Index: /trunk/ab5.0/ablib/src/gl/gl.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/gl/gl.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/gl/gl.sbp	(revision 506)
@@ -0,0 +1,1018 @@
+'gl/gl.sbp
+
+TypeDef GLenum = DWord
+TypeDef GLboolean = Byte
+TypeDef GLbitfield = DWord
+TypeDef GLbyte = SByte
+TypeDef GLshort = Integer
+TypeDef GLint = Long
+TypeDef GLsizei = Long
+TypeDef GLubyte = Byte
+TypeDef GLushort = Word
+TypeDef GLuint = DWord
+TypeDef GLfloat = Single
+TypeDef GLclampf = Single
+TypeDef GLdouble = Double
+TypeDef GLclampd = Double
+TypeDef GLvoid = DWord
+
+Const GL_VERSION_1_1 = 1
+
+Const GL_ACCUM = &H0100
+Const GL_LOAD = &H0101
+Const GL_RETURN = &H0102
+Const GL_MULT = &H0103
+Const GL_ADD = &H0104
+
+Const GL_NEVER = &H0200
+Const GL_LESS = &H0201
+Const GL_EQUAL = &H0202
+Const GL_LEQUAL = &H0203
+Const GL_GREATER = &H0204
+Const GL_NOTEQUAL = &H0205
+Const GL_GEQUAL = &H0206
+Const GL_ALWAYS = &H0207
+
+Const GL_CURRENT_BIT = &H00000001
+Const GL_POINT_BIT = &H00000002
+Const GL_LINE_BIT = &H00000004
+Const GL_POLYGON_BIT = &H00000008
+Const GL_POLYGON_STIPPLE_BIT = &H00000010
+Const GL_PIXEL_MODE_BIT = &H00000020
+Const GL_LIGHTING_BIT = &H00000040
+Const GL_FOG_BIT = &H00000080
+Const GL_DEPTH_BUFFER_BIT = &H00000100
+Const GL_ACCUM_BUFFER_BIT = &H00000200
+Const GL_STENCIL_BUFFER_BIT = &H00000400
+Const GL_VIEWPORT_BIT = &H00000800
+Const GL_TRANSFORM_BIT = &H00001000
+Const GL_ENABLE_BIT = &H00002000
+Const GL_COLOR_BUFFER_BIT = &H00004000
+Const GL_HINT_BIT = &H00008000
+Const GL_EVAL_BIT = &H00010000
+Const GL_LIST_BIT = &H00020000
+Const GL_TEXTURE_BIT = &H00040000
+Const GL_SCISSOR_BIT = &H00080000
+Const GL_ALL_ATTRIB_BITS = &H000fffff
+
+Const GL_POINTS = &H0000
+Const GL_LINES = &H0001
+Const GL_LINE_LOOP = &H0002
+Const GL_LINE_STRIP = &H0003
+Const GL_TRIANGLES = &H0004
+Const GL_TRIANGLE_STRIP = &H0005
+Const GL_TRIANGLE_FAN = &H0006
+Const GL_QUADS = &H0007
+Const GL_QUAD_STRIP = &H0008
+Const GL_POLYGON = &H0009
+
+Const GL_ZERO = 0
+Const GL_ONE = 1
+Const GL_SRC_COLOR = &H0300
+Const GL_ONE_MINUS_SRC_COLOR = &H0301
+Const GL_SRC_ALPHA = &H0302
+Const GL_ONE_MINUS_SRC_ALPHA = &H0303
+Const GL_DST_ALPHA = &H0304
+Const GL_ONE_MINUS_DST_ALPHA = &H0305
+
+Const GL_DST_COLOR = &H0306
+Const GL_ONE_MINUS_DST_COLOR = &H0307
+Const GL_SRC_ALPHA_SATURATE = &H0308
+
+Const GL_TRUE = 1
+Const GL_FALSE = 0
+
+Const GL_CLIP_PLANE0 = &H3000
+Const GL_CLIP_PLANE1 = &H3001
+Const GL_CLIP_PLANE2 = &H3002
+Const GL_CLIP_PLANE3 = &H3003
+Const GL_CLIP_PLANE4 = &H3004
+Const GL_CLIP_PLANE5 = &H3005
+
+Const GL_BYTE = &H1400
+Const GL_UNSIGNED_BYTE = &H1401
+Const GL_SHORT = &H1402
+Const GL_UNSIGNED_SHORT = &H1403
+Const GL_INT = &H1404
+Const GL_UNSIGNED_INT = &H1405
+Const GL_FLOAT = &H1406
+Const GL_2_BYTES = &H1407
+Const GL_3_BYTES = &H1408
+Const GL_4_BYTES = &H1409
+Const GL_DOUBLE = &H140A
+
+Const GL_NONE = 0
+Const GL_FRONT_LEFT = &H0400
+Const GL_FRONT_RIGHT = &H0401
+Const GL_BACK_LEFT = &H0402
+Const GL_BACK_RIGHT = &H0403
+Const GL_FRONT = &H0404
+Const GL_BACK = &H0405
+Const GL_LEFT = &H0406
+Const GL_RIGHT = &H0407
+Const GL_FRONT_AND_BACK = &H0408
+Const GL_AUX0 = &H0409
+Const GL_AUX1 = &H040A
+Const GL_AUX2 = &H040B
+Const GL_AUX3 = &H040C
+
+Const GL_NO_ERROR = 0
+Const GL_INVALID_ENUM = &H0500
+Const GL_INVALID_VALUE = &H0501
+Const GL_INVALID_OPERATION = &H0502
+Const GL_STACK_OVERFLOW = &H0503
+Const GL_STACK_UNDERFLOW = &H0504
+Const GL_OUT_OF_MEMORY = &H0505
+
+Const GL_2D = &H0600
+Const GL_3D = &H0601
+Const GL_3D_COLOR = &H0602
+Const GL_3D_COLOR_TEXTURE = &H0603
+Const GL_4D_COLOR_TEXTURE = &H0604
+
+Const GL_PASS_THROUGH_TOKEN = &H0700
+Const GL_POINT_TOKEN = &H0701
+Const GL_LINE_TOKEN = &H0702
+Const GL_POLYGON_TOKEN = &H0703
+Const GL_BITMAP_TOKEN = &H0704
+Const GL_DRAW_PIXEL_TOKEN = &H0705
+Const GL_COPY_PIXEL_TOKEN = &H0706
+Const GL_LINE_RESET_TOKEN = &H0707
+
+Const GL_EXP = &H0800
+Const GL_EXP2 = &H0801
+
+Const GL_CW = &H0900
+Const GL_CCW = &H0901
+
+Const GL_COEFF = &H0A00
+Const GL_ORDER = &H0A01
+Const GL_DOMAIN = &H0A02
+
+Const GL_CURRENT_COLOR = &H0B00
+Const GL_CURRENT_INDEX = &H0B01
+Const GL_CURRENT_NORMAL = &H0B02
+Const GL_CURRENT_TEXTURE_COORDS = &H0B03
+Const GL_CURRENT_RASTER_COLOR = &H0B04
+Const GL_CURRENT_RASTER_INDEX = &H0B05
+Const GL_CURRENT_RASTER_TEXTURE_COORDS = &H0B06
+Const GL_CURRENT_RASTER_POSITION = &H0B07
+Const GL_CURRENT_RASTER_POSITION_VALID = &H0B08
+Const GL_CURRENT_RASTER_DISTANCE = &H0B09
+Const GL_POINT_SMOOTH = &H0B10
+Const GL_POINT_SIZE = &H0B11
+Const GL_POINT_SIZE_RANGE = &H0B12
+Const GL_POINT_SIZE_GRANULARITY = &H0B13
+Const GL_LINE_SMOOTH = &H0B20
+Const GL_LINE_WIDTH = &H0B21
+Const GL_LINE_WIDTH_RANGE = &H0B22
+Const GL_LINE_WIDTH_GRANULARITY = &H0B23
+Const GL_LINE_STIPPLE = &H0B24
+Const GL_LINE_STIPPLE_PATTERN = &H0B25
+Const GL_LINE_STIPPLE_REPEAT = &H0B26
+Const GL_LIST_MODE = &H0B30
+Const GL_MAX_LIST_NESTING = &H0B31
+Const GL_LIST_BASE = &H0B32
+Const GL_LIST_INDEX = &H0B33
+Const GL_POLYGON_MODE = &H0B40
+Const GL_POLYGON_SMOOTH = &H0B41
+Const GL_POLYGON_STIPPLE = &H0B42
+Const GL_EDGE_FLAG = &H0B43
+Const GL_CULL_FACE = &H0B44
+Const GL_CULL_FACE_MODE = &H0B45
+Const GL_FRONT_FACE = &H0B46
+Const GL_LIGHTING = &H0B50
+Const GL_LIGHT_MODEL_LOCAL_VIEWER = &H0B51
+Const GL_LIGHT_MODEL_TWO_SIDE = &H0B52
+Const GL_LIGHT_MODEL_AMBIENT = &H0B53
+Const GL_SHADE_MODEL = &H0B54
+Const GL_COLOR_MATERIAL_FACE = &H0B55
+Const GL_COLOR_MATERIAL_PARAMETER = &H0B56
+Const GL_COLOR_MATERIAL = &H0B57
+Const GL_FOG = &H0B60
+Const GL_FOG_INDEX = &H0B61
+Const GL_FOG_DENSITY = &H0B62
+Const GL_FOG_START = &H0B63
+Const GL_FOG_END = &H0B64
+Const GL_FOG_MODE = &H0B65
+Const GL_FOG_COLOR = &H0B66
+Const GL_DEPTH_RANGE = &H0B70
+Const GL_DEPTH_TEST = &H0B71
+Const GL_DEPTH_WRITEMASK = &H0B72
+Const GL_DEPTH_CLEAR_VALUE = &H0B73
+Const GL_DEPTH_FUNC = &H0B74
+Const GL_ACCUM_CLEAR_VALUE = &H0B80
+Const GL_STENCIL_TEST = &H0B90
+Const GL_STENCIL_CLEAR_VALUE = &H0B91
+Const GL_STENCIL_FUNC = &H0B92
+Const GL_STENCIL_VALUE_MASK = &H0B93
+Const GL_STENCIL_FAIL = &H0B94
+Const GL_STENCIL_PASS_DEPTH_FAIL = &H0B95
+Const GL_STENCIL_PASS_DEPTH_PASS = &H0B96
+Const GL_STENCIL_REF = &H0B97
+Const GL_STENCIL_WRITEMASK = &H0B98
+Const GL_MATRIX_MODE = &H0BA0
+Const GL_NORMALIZE = &H0BA1
+Const GL_VIEWPORT = &H0BA2
+Const GL_MODELVIEW_STACK_DEPTH = &H0BA3
+Const GL_PROJECTION_STACK_DEPTH = &H0BA4
+Const GL_TEXTURE_STACK_DEPTH = &H0BA5
+Const GL_MODELVIEW_MATRIX = &H0BA6
+Const GL_PROJECTION_MATRIX = &H0BA7
+Const GL_TEXTURE_MATRIX = &H0BA8
+Const GL_ATTRIB_STACK_DEPTH = &H0BB0
+Const GL_CLIENT_ATTRIB_STACK_DEPTH = &H0BB1
+Const GL_ALPHA_TEST = &H0BC0
+Const GL_ALPHA_TEST_FUNC = &H0BC1
+Const GL_ALPHA_TEST_REF = &H0BC2
+Const GL_DITHER = &H0BD0
+Const GL_BLEND_DST = &H0BE0
+Const GL_BLEND_SRC = &H0BE1
+Const GL_BLEND = &H0BE2
+Const GL_LOGIC_OP_MODE = &H0BF0
+Const GL_INDEX_LOGIC_OP = &H0BF1
+Const GL_COLOR_LOGIC_OP = &H0BF2
+Const GL_AUX_BUFFERS = &H0C00
+Const GL_DRAW_BUFFER = &H0C01
+Const GL_READ_BUFFER = &H0C02
+Const GL_SCISSOR_BOX = &H0C10
+Const GL_SCISSOR_TEST = &H0C11
+Const GL_INDEX_CLEAR_VALUE = &H0C20
+Const GL_INDEX_WRITEMASK = &H0C21
+Const GL_COLOR_CLEAR_VALUE = &H0C22
+Const GL_COLOR_WRITEMASK = &H0C23
+Const GL_INDEX_MODE = &H0C30
+Const GL_RGBA_MODE = &H0C31
+Const GL_DOUBLEBUFFER = &H0C32
+Const GL_STEREO = &H0C33
+Const GL_RENDER_MODE = &H0C40
+Const GL_PERSPECTIVE_CORRECTION_HINT = &H0C50
+Const GL_POINT_SMOOTH_HINT = &H0C51
+Const GL_LINE_SMOOTH_HINT = &H0C52
+Const GL_POLYGON_SMOOTH_HINT = &H0C53
+Const GL_FOG_HINT = &H0C54
+Const GL_TEXTURE_GEN_S = &H0C60
+Const GL_TEXTURE_GEN_T = &H0C61
+Const GL_TEXTURE_GEN_R = &H0C62
+Const GL_TEXTURE_GEN_Q = &H0C63
+Const GL_PIXEL_MAP_I_TO_I = &H0C70
+Const GL_PIXEL_MAP_S_TO_S = &H0C71
+Const GL_PIXEL_MAP_I_TO_R = &H0C72
+Const GL_PIXEL_MAP_I_TO_G = &H0C73
+Const GL_PIXEL_MAP_I_TO_B = &H0C74
+Const GL_PIXEL_MAP_I_TO_A = &H0C75
+Const GL_PIXEL_MAP_R_TO_R = &H0C76
+Const GL_PIXEL_MAP_G_TO_G = &H0C77
+Const GL_PIXEL_MAP_B_TO_B = &H0C78
+Const GL_PIXEL_MAP_A_TO_A = &H0C79
+Const GL_PIXEL_MAP_I_TO_I_SIZE = &H0CB0
+Const GL_PIXEL_MAP_S_TO_S_SIZE = &H0CB1
+Const GL_PIXEL_MAP_I_TO_R_SIZE = &H0CB2
+Const GL_PIXEL_MAP_I_TO_G_SIZE = &H0CB3
+Const GL_PIXEL_MAP_I_TO_B_SIZE = &H0CB4
+Const GL_PIXEL_MAP_I_TO_A_SIZE = &H0CB5
+Const GL_PIXEL_MAP_R_TO_R_SIZE = &H0CB6
+Const GL_PIXEL_MAP_G_TO_G_SIZE = &H0CB7
+Const GL_PIXEL_MAP_B_TO_B_SIZE = &H0CB8
+Const GL_PIXEL_MAP_A_TO_A_SIZE = &H0CB9
+Const GL_UNPACK_SWAP_BYTES = &H0CF0
+Const GL_UNPACK_LSB_FIRST = &H0CF1
+Const GL_UNPACK_ROW_LENGTH = &H0CF2
+Const GL_UNPACK_SKIP_ROWS = &H0CF3
+Const GL_UNPACK_SKIP_PIXELS = &H0CF4
+Const GL_UNPACK_ALIGNMENT = &H0CF5
+Const GL_PACK_SWAP_BYTES = &H0D00
+Const GL_PACK_LSB_FIRST = &H0D01
+Const GL_PACK_ROW_LENGTH = &H0D02
+Const GL_PACK_SKIP_ROWS = &H0D03
+Const GL_PACK_SKIP_PIXELS = &H0D04
+Const GL_PACK_ALIGNMENT = &H0D05
+Const GL_MAP_COLOR = &H0D10
+Const GL_MAP_STENCIL = &H0D11
+Const GL_INDEX_SHIFT = &H0D12
+Const GL_INDEX_OFFSET = &H0D13
+Const GL_RED_SCALE = &H0D14
+Const GL_RED_BIAS = &H0D15
+Const GL_ZOOM_X = &H0D16
+Const GL_ZOOM_Y = &H0D17
+Const GL_GREEN_SCALE = &H0D18
+Const GL_GREEN_BIAS = &H0D19
+Const GL_BLUE_SCALE = &H0D1A
+Const GL_BLUE_BIAS = &H0D1B
+Const GL_ALPHA_SCALE = &H0D1C
+Const GL_ALPHA_BIAS = &H0D1D
+Const GL_DEPTH_SCALE = &H0D1E
+Const GL_DEPTH_BIAS = &H0D1F
+Const GL_MAX_EVAL_ORDER = &H0D30
+Const GL_MAX_LIGHTS = &H0D31
+Const GL_MAX_CLIP_PLANES = &H0D32
+Const GL_MAX_TEXTURE_SIZE = &H0D33
+Const GL_MAX_PIXEL_MAP_TABLE = &H0D34
+Const GL_MAX_ATTRIB_STACK_DEPTH = &H0D35
+Const GL_MAX_MODELVIEW_STACK_DEPTH = &H0D36
+Const GL_MAX_NAME_STACK_DEPTH = &H0D37
+Const GL_MAX_PROJECTION_STACK_DEPTH = &H0D38
+Const GL_MAX_TEXTURE_STACK_DEPTH = &H0D39
+Const GL_MAX_VIEWPORT_DIMS = &H0D3A
+Const GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = &H0D3B
+Const GL_SUBPIXEL_BITS = &H0D50
+Const GL_INDEX_BITS = &H0D51
+Const GL_RED_BITS = &H0D52
+Const GL_GREEN_BITS = &H0D53
+Const GL_BLUE_BITS = &H0D54
+Const GL_ALPHA_BITS = &H0D55
+Const GL_DEPTH_BITS = &H0D56
+Const GL_STENCIL_BITS = &H0D57
+Const GL_ACCUM_RED_BITS = &H0D58
+Const GL_ACCUM_GREEN_BITS = &H0D59
+Const GL_ACCUM_BLUE_BITS = &H0D5A
+Const GL_ACCUM_ALPHA_BITS = &H0D5B
+Const GL_NAME_STACK_DEPTH = &H0D70
+Const GL_AUTO_NORMAL = &H0D80
+Const GL_MAP1_COLOR_4 = &H0D90
+Const GL_MAP1_INDEX = &H0D91
+Const GL_MAP1_NORMAL = &H0D92
+Const GL_MAP1_TEXTURE_COORD_1 = &H0D93
+Const GL_MAP1_TEXTURE_COORD_2 = &H0D94
+Const GL_MAP1_TEXTURE_COORD_3 = &H0D95
+Const GL_MAP1_TEXTURE_COORD_4 = &H0D96
+Const GL_MAP1_VERTEX_3 = &H0D97
+Const GL_MAP1_VERTEX_4 = &H0D98
+Const GL_MAP2_COLOR_4 = &H0DB0
+Const GL_MAP2_INDEX = &H0DB1
+Const GL_MAP2_NORMAL = &H0DB2
+Const GL_MAP2_TEXTURE_COORD_1 = &H0DB3
+Const GL_MAP2_TEXTURE_COORD_2 = &H0DB4
+Const GL_MAP2_TEXTURE_COORD_3 = &H0DB5
+Const GL_MAP2_TEXTURE_COORD_4 = &H0DB6
+Const GL_MAP2_VERTEX_3 = &H0DB7
+Const GL_MAP2_VERTEX_4 = &H0DB8
+Const GL_MAP1_GRID_DOMAIN = &H0DD0
+Const GL_MAP1_GRID_SEGMENTS = &H0DD1
+Const GL_MAP2_GRID_DOMAIN = &H0DD2
+Const GL_MAP2_GRID_SEGMENTS = &H0DD3
+Const GL_TEXTURE_1D = &H0DE0
+Const GL_TEXTURE_2D = &H0DE1
+Const GL_FEEDBACK_BUFFER_POINTER = &H0DF0
+Const GL_FEEDBACK_BUFFER_SIZE = &H0DF1
+Const GL_FEEDBACK_BUFFER_TYPE = &H0DF2
+Const GL_SELECTION_BUFFER_POINTER = &H0DF3
+Const GL_SELECTION_BUFFER_SIZE = &H0DF4
+
+Const GL_TEXTURE_WIDTH = &H1000
+Const GL_TEXTURE_HEIGHT = &H1001
+Const GL_TEXTURE_INTERNAL_FORMAT = &H1003
+Const GL_TEXTURE_BORDER_COLOR = &H1004
+Const GL_TEXTURE_BORDER = &H1005
+
+Const GL_DONT_CARE = &H1100
+Const GL_FASTEST = &H1101
+Const GL_NICEST = &H1102
+
+Const GL_LIGHT0 = &H4000
+Const GL_LIGHT1 = &H4001
+Const GL_LIGHT2 = &H4002
+Const GL_LIGHT3 = &H4003
+Const GL_LIGHT4 = &H4004
+Const GL_LIGHT5 = &H4005
+Const GL_LIGHT6 = &H4006
+Const GL_LIGHT7 = &H4007
+
+Const GL_AMBIENT = &H1200
+Const GL_DIFFUSE = &H1201
+Const GL_SPECULAR = &H1202
+Const GL_POSITION = &H1203
+Const GL_SPOT_DIRECTION = &H1204
+Const GL_SPOT_EXPONENT = &H1205
+Const GL_SPOT_CUTOFF = &H1206
+Const GL_CONSTANT_ATTENUATION = &H1207
+Const GL_LINEAR_ATTENUATION = &H1208
+Const GL_QUADRATIC_ATTENUATION = &H1209
+
+Const GL_COMPILE = &H1300
+Const GL_COMPILE_AND_EXECUTE = &H1301
+
+Const GL_CLEAR = &H1500
+Const GL_AND = &H1501
+Const GL_AND_REVERSE = &H1502
+Const GL_COPY = &H1503
+Const GL_AND_INVERTED = &H1504
+Const GL_NOOP = &H1505
+Const GL_XOR = &H1506
+Const GL_OR = &H1507
+Const GL_NOR = &H1508
+Const GL_EQUIV = &H1509
+Const GL_INVERT = &H150A
+Const GL_OR_REVERSE = &H150B
+Const GL_COPY_INVERTED = &H150C
+Const GL_OR_INVERTED = &H150D
+Const GL_NAND = &H150E
+Const GL_SET = &H150F
+
+Const GL_EMISSION = &H1600
+Const GL_SHININESS = &H1601
+Const GL_AMBIENT_AND_DIFFUSE = &H1602
+Const GL_COLOR_INDEXES = &H1603
+
+Const GL_MODELVIEW = &H1700
+Const GL_PROJECTION = &H1701
+Const GL_TEXTURE = &H1702
+
+Const GL_COLOR = &H1800
+Const GL_DEPTH = &H1801
+Const GL_STENCIL = &H1802
+
+Const GL_COLOR_INDEX = &H1900
+Const GL_STENCIL_INDEX = &H1901
+Const GL_DEPTH_COMPONENT = &H1902
+Const GL_RED = &H1903
+Const GL_GREEN = &H1904
+Const GL_BLUE = &H1905
+Const GL_ALPHA = &H1906
+Const GL_RGB = &H1907
+Const GL_RGBA = &H1908
+Const GL_LUMINANCE = &H1909
+Const GL_LUMINANCE_ALPHA = &H190A
+
+Const GL_BITMAP = &H1A00
+
+Const GL_POINT = &H1B00
+Const GL_LINE = &H1B01
+Const GL_FILL = &H1B02
+
+Const GL_RENDER = &H1C00
+Const GL_FEEDBACK = &H1C01
+Const GL_SELECT = &H1C02
+
+Const GL_FLAT = &H1D00
+Const GL_SMOOTH = &H1D01
+
+Const GL_KEEP = &H1E00
+Const GL_REPLACE = &H1E01
+Const GL_INCR = &H1E02
+Const GL_DECR = &H1E03
+
+Const GL_VENDOR = &H1F00
+Const GL_RENDERER = &H1F01
+Const GL_VERSION = &H1F02
+Const GL_EXTENSIONS = &H1F03
+
+Const GL_S = &H2000
+Const GL_T = &H2001
+Const GL_R = &H2002
+Const GL_Q = &H2003
+
+Const GL_MODULATE = &H2100
+Const GL_DECAL = &H2101
+
+Const GL_TEXTURE_ENV_MODE = &H2200
+Const GL_TEXTURE_ENV_COLOR = &H2201
+
+Const GL_TEXTURE_ENV = &H2300
+
+Const GL_EYE_LINEAR = &H2400
+Const GL_OBJECT_LINEAR = &H2401
+Const GL_SPHERE_MAP = &H2402
+
+Const GL_TEXTURE_GEN_MODE = &H2500
+Const GL_OBJECT_PLANE = &H2501
+Const GL_EYE_PLANE = &H2502
+
+Const GL_NEAREST = &H2600
+Const GL_LINEAR = &H2601
+
+Const GL_NEAREST_MIPMAP_NEAREST = &H2700
+Const GL_LINEAR_MIPMAP_NEAREST = &H2701
+Const GL_NEAREST_MIPMAP_LINEAR = &H2702
+Const GL_LINEAR_MIPMAP_LINEAR = &H2703
+
+Const GL_TEXTURE_MAG_FILTER = &H2800
+Const GL_TEXTURE_MIN_FILTER = &H2801
+Const GL_TEXTURE_WRAP_S = &H2802
+Const GL_TEXTURE_WRAP_T = &H2803
+
+Const GL_CLAMP = &H2900
+Const GL_REPEAT = &H2901
+
+Const GL_CLIENT_PIXEL_STORE_BIT = &H00000001
+Const GL_CLIENT_VERTEX_ARRAY_BIT = &H00000002
+Const GL_CLIENT_ALL_ATTRIB_BITS = &Hffffffff
+
+Const GL_POLYGON_OFFSET_FACTOR = &H8038
+Const GL_POLYGON_OFFSET_UNITS = &H2A00
+Const GL_POLYGON_OFFSET_POINT = &H2A01
+Const GL_POLYGON_OFFSET_LINE = &H2A02
+Const GL_POLYGON_OFFSET_FILL = &H8037
+
+Const GL_ALPHA4 = &H803B
+Const GL_ALPHA8 = &H803C
+Const GL_ALPHA12 = &H803D
+Const GL_ALPHA16 = &H803E
+Const GL_LUMINANCE4 = &H803F
+Const GL_LUMINANCE8 = &H8040
+Const GL_LUMINANCE12 = &H8041
+Const GL_LUMINANCE16 = &H8042
+Const GL_LUMINANCE4_ALPHA4 = &H8043
+Const GL_LUMINANCE6_ALPHA2 = &H8044
+Const GL_LUMINANCE8_ALPHA8 = &H8045
+Const GL_LUMINANCE12_ALPHA4 = &H8046
+Const GL_LUMINANCE12_ALPHA12 = &H8047
+Const GL_LUMINANCE16_ALPHA16 = &H8048
+Const GL_INTENSITY = &H8049
+Const GL_INTENSITY4 = &H804A
+Const GL_INTENSITY8 = &H804B
+Const GL_INTENSITY12 = &H804C
+Const GL_INTENSITY16 = &H804D
+Const GL_R3_G3_B2 = &H2A10
+Const GL_RGB4 = &H804F
+Const GL_RGB5 = &H8050
+Const GL_RGB8 = &H8051
+Const GL_RGB10 = &H8052
+Const GL_RGB12 = &H8053
+Const GL_RGB16 = &H8054
+Const GL_RGBA2 = &H8055
+Const GL_RGBA4 = &H8056
+Const GL_RGB5_A1 = &H8057
+Const GL_RGBA8 = &H8058
+Const GL_RGB10_A2 = &H8059
+Const GL_RGBA12 = &H805A
+Const GL_RGBA16 = &H805B
+Const GL_TEXTURE_RED_SIZE = &H805C
+Const GL_TEXTURE_GREEN_SIZE = &H805D
+Const GL_TEXTURE_BLUE_SIZE = &H805E
+Const GL_TEXTURE_ALPHA_SIZE = &H805F
+Const GL_TEXTURE_LUMINANCE_SIZE = &H8060
+Const GL_TEXTURE_INTENSITY_SIZE = &H8061
+Const GL_PROXY_TEXTURE_1D = &H8063
+Const GL_PROXY_TEXTURE_2D = &H8064
+
+Const GL_TEXTURE_PRIORITY = &H8066
+Const GL_TEXTURE_RESIDENT = &H8067
+Const GL_TEXTURE_BINDING_1D = &H8068
+Const GL_TEXTURE_BINDING_2D = &H8069
+
+Const GL_VERTEX_ARRAY = &H8074
+Const GL_NORMAL_ARRAY = &H8075
+Const GL_COLOR_ARRAY = &H8076
+Const GL_INDEX_ARRAY = &H8077
+Const GL_TEXTURE_COORD_ARRAY = &H8078
+Const GL_EDGE_FLAG_ARRAY = &H8079
+Const GL_VERTEX_ARRAY_SIZE = &H807A
+Const GL_VERTEX_ARRAY_TYPE = &H807B
+Const GL_VERTEX_ARRAY_STRIDE = &H807C
+Const GL_NORMAL_ARRAY_TYPE = &H807E
+Const GL_NORMAL_ARRAY_STRIDE = &H807F
+Const GL_COLOR_ARRAY_SIZE = &H8081
+Const GL_COLOR_ARRAY_TYPE = &H8082
+Const GL_COLOR_ARRAY_STRIDE = &H8083
+Const GL_INDEX_ARRAY_TYPE = &H8085
+Const GL_INDEX_ARRAY_STRIDE = &H8086
+Const GL_TEXTURE_COORD_ARRAY_SIZE = &H8088
+Const GL_TEXTURE_COORD_ARRAY_TYPE = &H8089
+Const GL_TEXTURE_COORD_ARRAY_STRIDE = &H808A
+Const GL_EDGE_FLAG_ARRAY_STRIDE = &H808C
+Const GL_VERTEX_ARRAY_POINTER = &H808E
+Const GL_NORMAL_ARRAY_POINTER = &H808F
+Const GL_COLOR_ARRAY_POINTER = &H8090
+Const GL_INDEX_ARRAY_POINTER = &H8091
+Const GL_TEXTURE_COORD_ARRAY_POINTER = &H8092
+Const GL_EDGE_FLAG_ARRAY_POINTER = &H8093
+Const GL_V2F = &H2A20
+Const GL_V3F = &H2A21
+Const GL_C4UB_V2F = &H2A22
+Const GL_C4UB_V3F = &H2A23
+Const GL_C3F_V3F = &H2A24
+Const GL_N3F_V3F = &H2A25
+Const GL_C4F_N3F_V3F = &H2A26
+Const GL_T2F_V3F = &H2A27
+Const GL_T4F_V4F = &H2A28
+Const GL_T2F_C4UB_V3F = &H2A29
+Const GL_T2F_C3F_V3F = &H2A2A
+Const GL_T2F_N3F_V3F = &H2A2B
+Const GL_T2F_C4F_N3F_V3F = &H2A2C
+Const GL_T4F_C4F_N3F_V4F = &H2A2D
+
+Const GL_EXT_vertex_array = 1
+Const GL_EXT_bgra = 1
+Const GL_EXT_paletted_texture = 1
+Const GL_WIN_swap_hint = 1
+Const GL_WIN_draw_range_elements = 1
+
+Const GL_VERTEX_ARRAY_EXT = &H8074
+Const GL_NORMAL_ARRAY_EXT = &H8075
+Const GL_COLOR_ARRAY_EXT = &H8076
+Const GL_INDEX_ARRAY_EXT = &H8077
+Const GL_TEXTURE_COORD_ARRAY_EXT = &H8078
+Const GL_EDGE_FLAG_ARRAY_EXT = &H8079
+Const GL_VERTEX_ARRAY_SIZE_EXT = &H807A
+Const GL_VERTEX_ARRAY_TYPE_EXT = &H807B
+Const GL_VERTEX_ARRAY_STRIDE_EXT = &H807C
+Const GL_VERTEX_ARRAY_COUNT_EXT = &H807D
+Const GL_NORMAL_ARRAY_TYPE_EXT = &H807E
+Const GL_NORMAL_ARRAY_STRIDE_EXT = &H807F
+Const GL_NORMAL_ARRAY_COUNT_EXT = &H8080
+Const GL_COLOR_ARRAY_SIZE_EXT = &H8081
+Const GL_COLOR_ARRAY_TYPE_EXT = &H8082
+Const GL_COLOR_ARRAY_STRIDE_EXT = &H8083
+Const GL_COLOR_ARRAY_COUNT_EXT = &H8084
+Const GL_INDEX_ARRAY_TYPE_EXT = &H8085
+Const GL_INDEX_ARRAY_STRIDE_EXT = &H8086
+Const GL_INDEX_ARRAY_COUNT_EXT = &H8087
+Const GL_TEXTURE_COORD_ARRAY_SIZE_EXT = &H8088
+Const GL_TEXTURE_COORD_ARRAY_TYPE_EXT = &H8089
+Const GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = &H808A
+Const GL_TEXTURE_COORD_ARRAY_COUNT_EXT = &H808B
+Const GL_EDGE_FLAG_ARRAY_STRIDE_EXT = &H808C
+Const GL_EDGE_FLAG_ARRAY_COUNT_EXT = &H808D
+Const GL_VERTEX_ARRAY_POINTER_EXT = &H808E
+Const GL_NORMAL_ARRAY_POINTER_EXT = &H808F
+Const GL_COLOR_ARRAY_POINTER_EXT = &H8090
+Const GL_INDEX_ARRAY_POINTER_EXT = &H8091
+Const GL_TEXTURE_COORD_ARRAY_POINTER_EXT = &H8092
+Const GL_EDGE_FLAG_ARRAY_POINTER_EXT = &H8093
+Const GL_DOUBLE_EXT = GL_DOUBLE
+
+Const GL_BGR_EXT = &H80E0
+Const GL_BGRA_EXT = &H80E1
+
+Const GL_COLOR_TABLE_FORMAT_EXT = &H80D8
+Const GL_COLOR_TABLE_WIDTH_EXT = &H80D9
+Const GL_COLOR_TABLE_RED_SIZE_EXT = &H80DA
+Const GL_COLOR_TABLE_GREEN_SIZE_EXT = &H80DB
+Const GL_COLOR_TABLE_BLUE_SIZE_EXT = &H80DC
+Const GL_COLOR_TABLE_ALPHA_SIZE_EXT = &H80DD
+Const GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = &H80DE
+Const GL_COLOR_TABLE_INTENSITY_SIZE_EXT = &H80DF
+
+Const GL_COLOR_INDEX1_EXT = &H80E2
+Const GL_COLOR_INDEX2_EXT = &H80E3
+Const GL_COLOR_INDEX4_EXT = &H80E4
+Const GL_COLOR_INDEX8_EXT = &H80E5
+Const GL_COLOR_INDEX12_EXT = &H80E6
+Const GL_COLOR_INDEX16_EXT = &H80E7
+
+Const GL_MAX_ELEMENTS_VERTICES_WIN = &H80E8
+Const GL_MAX_ELEMENTS_INDICES_WIN = &H80E9
+
+Const GL_PHONG_WIN = &H80EA 
+Const GL_PHONG_HINT_WIN = &H80EB 
+
+Const GL_FOG_SPECULAR_TEXTURE_WIN = &H80EC
+
+Const GL_LOGIC_OP = GL_INDEX_LOGIC_OP
+Const GL_TEXTURE_COMPONENTS = GL_TEXTURE_INTERNAL_FORMAT
+
+Declare Sub glAccum Lib "opengl32" (op As GLenum, value As GLfloat)
+Declare Sub glAlphaFunc Lib "opengl32" (func As GLenum, ref As GLclampf)
+Declare Function glAreTexturesResident Lib "opengl32" (n As GLsizei, textures As *GLuint, residences As *GLboolean) As GLboolean
+Declare Sub glArrayElement Lib "opengl32" (i As GLint)
+Declare Sub glBegin Lib "opengl32" (mode As GLenum)
+Declare Sub glBindTexture Lib "opengl32" (target As GLenum, texture As GLuint)
+Declare Sub glBitmap Lib "opengl32" (width As GLsizei, height As GLsizei, xorig As GLfloat, yorig As GLfloat, xmove As GLfloat, ymove As GLfloat, bitmap As *GLubyte)
+Declare Sub glBlendFunc Lib "opengl32" (sfactor As GLenum, dfactor As GLenum)
+Declare Sub glCallList Lib "opengl32" (list As GLuint)
+Declare Sub glCallLists Lib "opengl32" (n As GLsizei, type_ As GLenum, lists As *GLvoid)
+Declare Sub glClear Lib "opengl32" (mask As GLbitfield)
+Declare Sub glClearAccum Lib "opengl32" (red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+Declare Sub glClearColor Lib "opengl32" (red As GLclampf, green As GLclampf, blue As GLclampf, alpha As GLclampf)
+Declare Sub glClearDepth Lib "opengl32" (depth As GLclampd)
+Declare Sub glClearIndex Lib "opengl32" (c As GLfloat)
+Declare Sub glClearStencil Lib "opengl32" (s As GLint)
+Declare Sub glClipPlane Lib "opengl32" (plane As GLenum, equation As *GLdouble)
+Declare Sub glColor3b Lib "opengl32" (red As GLbyte, green As GLbyte, blue As GLbyte)
+Declare Sub glColor3bv Lib "opengl32" (v As *GLbyte)
+Declare Sub glColor3d Lib "opengl32" (red As GLdouble, green As GLdouble, blue As GLdouble)
+Declare Sub glColor3dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glColor3f Lib "opengl32" (red As GLfloat, green As GLfloat, blue As GLfloat)
+Declare Sub glColor3fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glColor3i Lib "opengl32" (red As GLint, green As GLint, blue As GLint)
+Declare Sub glColor3iv Lib "opengl32" (v As *GLint)
+Declare Sub glColor3s Lib "opengl32" (red As GLshort, green As GLshort, blue As GLshort)
+Declare Sub glColor3sv Lib "opengl32" (v As *GLshort)
+Declare Sub glColor3ub Lib "opengl32" (red As GLubyte, green As GLubyte, blue As GLubyte)
+Declare Sub glColor3ubv Lib "opengl32" (v As *GLubyte)
+Declare Sub glColor3ui Lib "opengl32" (red As GLuint, green As GLuint, blue As GLuint)
+Declare Sub glColor3uiv Lib "opengl32" (v As *GLuint)
+Declare Sub glColor3us Lib "opengl32" (red As GLushort, green As GLushort, blue As GLushort)
+Declare Sub glColor3usv Lib "opengl32" (v As *GLushort)
+Declare Sub glColor4b Lib "opengl32" (red As GLbyte, green As GLbyte, blue As GLbyte, alpha As GLbyte)
+Declare Sub glColor4bv Lib "opengl32" (v As *GLbyte)
+Declare Sub glColor4d Lib "opengl32" (red As GLdouble, green As GLdouble, blue As GLdouble, alpha As GLdouble)
+Declare Sub glColor4dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glColor4f Lib "opengl32" (red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
+Declare Sub glColor4fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glColor4i Lib "opengl32" (red As GLint, green As GLint, blue As GLint, alpha As GLint)
+Declare Sub glColor4iv Lib "opengl32" (v As *GLint)
+Declare Sub glColor4s Lib "opengl32" (red As GLshort, green As GLshort, blue As GLshort, alpha As GLshort)
+Declare Sub glColor4sv Lib "opengl32" (v As *GLshort)
+Declare Sub glColor4ub Lib "opengl32" (red As GLubyte, green As GLubyte, blue As GLubyte, alpha As GLubyte)
+Declare Sub glColor4ubv Lib "opengl32" (v As *GLubyte)
+Declare Sub glColor4ui Lib "opengl32" (red As GLuint, green As GLuint, blue As GLuint, alpha As GLuint)
+Declare Sub glColor4uiv Lib "opengl32" (v As *GLuint)
+Declare Sub glColor4us Lib "opengl32" (red As GLushort, green As GLushort, blue As GLushort, alpha As GLushort)
+Declare Sub glColor4usv Lib "opengl32" (v As *GLushort)
+Declare Sub glColorMask Lib "opengl32" (red As GLboolean, green As GLboolean, blue As GLboolean, alpha As GLboolean)
+Declare Sub glColorMaterial Lib "opengl32" (face As GLenum, mode As GLenum)
+Declare Sub glColorPointer Lib "opengl32" (size As GLint, type_ As GLenum, stride As GLsizei, pointer As *GLvoid)
+Declare Sub glCopyPixels Lib "opengl32" (x As GLint, y As GLint, width As GLsizei, height As GLsizei, type_ As GLenum)
+Declare Sub glCopyTexImage1D Lib "opengl32" (target As GLenum, level As GLint, internalFormat As GLenum, x As GLint, y As GLint, width As GLsizei, border As GLint)
+Declare Sub glCopyTexImage2D Lib "opengl32" (target As GLenum, level As GLint, internalFormat As GLenum, x As GLint, y As GLint, width As GLsizei, height As GLsizei, border As GLint)
+Declare Sub glCopyTexSubImage1D Lib "opengl32" (target As GLenum, level As GLint, xoffset As GLint, x As GLint, y As GLint, width As GLsizei)
+Declare Sub glCopyTexSubImage2D Lib "opengl32" (target As GLenum, level As GLint, xoffset As GLint, yoffset As GLint, x As GLint, y As GLint, width As GLsizei, height As GLsizei)
+Declare Sub glCullFace Lib "opengl32" (mode As GLenum)
+Declare Sub glDeleteLists Lib "opengl32" (list As GLuint, range As GLsizei)
+Declare Sub glDeleteTextures Lib "opengl32" (n As GLsizei, textures As *GLuint)
+Declare Sub glDepthFunc Lib "opengl32" (func As GLenum)
+Declare Sub glDepthMask Lib "opengl32" (flag As GLboolean)
+Declare Sub glDepthRange Lib "opengl32" (zNear As GLclampd, zFar As GLclampd)
+Declare Sub glDisable Lib "opengl32" (cap As GLenum)
+Declare Sub glDisableClientState Lib "opengl32" (array As GLenum)
+Declare Sub glDrawArrays Lib "opengl32" (mode As GLenum, first As GLint, count As GLsizei)
+Declare Sub glDrawBuffer Lib "opengl32" (mode As GLenum)
+Declare Sub glDrawElements Lib "opengl32" (mode As GLenum, count As GLsizei, type_ As GLenum, indices As *GLvoid)
+Declare Sub glDrawPixels Lib "opengl32" (width As GLsizei, height As GLsizei, format As GLenum, type_ As GLenum, pixels As *GLvoid)
+Declare Sub glEdgeFlag Lib "opengl32" (flag As GLboolean)
+Declare Sub glEdgeFlagPointer Lib "opengl32" (stride As GLsizei, pointer As *GLvoid)
+Declare Sub glEdgeFlagv Lib "opengl32" (flag As *GLboolean)
+Declare Sub glEnable Lib "opengl32" (cap As GLenum)
+Declare Sub glEnableClientState Lib "opengl32" (array As GLenum)
+Declare Sub glEnd Lib "opengl32" ()
+Declare Sub glEndList Lib "opengl32" ()
+Declare Sub glEvalCoord1d Lib "opengl32" (u As GLdouble)
+Declare Sub glEvalCoord1dv Lib "opengl32" (u As *GLdouble)
+Declare Sub glEvalCoord1f Lib "opengl32" (u As GLfloat)
+Declare Sub glEvalCoord1fv Lib "opengl32" (u As *GLfloat)
+Declare Sub glEvalCoord2d Lib "opengl32" (u As GLdouble, v As GLdouble)
+Declare Sub glEvalCoord2dv Lib "opengl32" (u As *GLdouble)
+Declare Sub glEvalCoord2f Lib "opengl32" (u As GLfloat, v As GLfloat)
+Declare Sub glEvalCoord2fv Lib "opengl32" (u As *GLfloat)
+Declare Sub glEvalMesh1 Lib "opengl32" (mode As GLenum, i1 As GLint, i2 As GLint)
+Declare Sub glEvalMesh2 Lib "opengl32" (mode As GLenum, i1 As GLint, i2 As GLint, j1 As GLint, j2 As GLint)
+Declare Sub glEvalPoint1 Lib "opengl32" (i As GLint)
+Declare Sub glEvalPoint2 Lib "opengl32" (i As GLint, j As GLint)
+Declare Sub glFeedbackBuffer Lib "opengl32" (size As GLsizei, type_ As GLenum, buffer As *GLfloat)
+Declare Sub glFinish Lib "opengl32" ()
+Declare Sub glFlush Lib "opengl32" ()
+Declare Sub glFogf Lib "opengl32" (pname As GLenum, param As GLfloat)
+Declare Sub glFogfv Lib "opengl32" (pname As GLenum, params As *GLfloat)
+Declare Sub glFogi Lib "opengl32" (pname As GLenum, param As GLint)
+Declare Sub glFogiv Lib "opengl32" (pname As GLenum, params As *GLint)
+Declare Sub glFrontFace Lib "opengl32" (mode As GLenum)
+Declare Sub glFrustum Lib "opengl32" (left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble, zNear As GLdouble, zFar As GLdouble)
+Declare Function glGenLists Lib "opengl32" (range As GLsizei) As GLuint
+Declare Sub glGenTextures Lib "opengl32" (n As GLsizei, textures As *GLuint)
+Declare Sub glGetBooleanv Lib "opengl32" (pname As GLenum, params As *GLboolean)
+Declare Sub glGetClipPlane Lib "opengl32" (plane As GLenum, equation As *GLdouble)
+Declare Sub glGetDoublev Lib "opengl32" (pname As GLenum, params As *GLdouble)
+Declare Function glGetError Lib "opengl32" () As GLenum
+Declare Sub glGetFloatv Lib "opengl32" (pname As GLenum, params As *GLfloat)
+Declare Sub glGetIntegerv Lib "opengl32" (pname As GLenum, params As *GLint)
+Declare Sub glGetLightfv Lib "opengl32" (light As GLenum, pname As GLenum, params As *GLfloat)
+Declare Sub glGetLightiv Lib "opengl32" (light As GLenum, pname As GLenum, params As *GLint)
+Declare Sub glGetMapdv Lib "opengl32" (target As GLenum, query As GLenum, v As *GLdouble)
+Declare Sub glGetMapfv Lib "opengl32" (target As GLenum, query As GLenum, v As *GLfloat)
+Declare Sub glGetMapiv Lib "opengl32" (target As GLenum, query As GLenum, v As *GLint)
+Declare Sub glGetMaterialfv Lib "opengl32" (face As GLenum, pname As GLenum, params As *GLfloat)
+Declare Sub glGetMaterialiv Lib "opengl32" (face As GLenum, pname As GLenum, params As *GLint)
+Declare Sub glGetPixelMapfv Lib "opengl32" (map As GLenum, values As *GLfloat)
+Declare Sub glGetPixelMapuiv Lib "opengl32" (map As GLenum, values As *GLuint)
+Declare Sub glGetPixelMapusv Lib "opengl32" (map As GLenum, values As *GLushort)
+Declare Sub glGetPointerv Lib "opengl32" (pname As GLenum, ByRef values As *GLvoid)
+Declare Sub glGetPolygonStipple Lib "opengl32" (mask As *GLubyte)
+Declare Function glGetString Lib "opengl32" (name As GLenum) As *GLubyte
+Declare Sub glGetTexEnvfv Lib "opengl32" (target As GLenum, pname As GLenum, params As *GLfloat)
+Declare Sub glGetTexEnviv Lib "opengl32" (target As GLenum, pname As GLenum, params As *GLint)
+Declare Sub glGetTexGendv Lib "opengl32" (coord As GLenum, pname As GLenum, params As *GLdouble)
+Declare Sub glGetTexGenfv Lib "opengl32" (coord As GLenum, pname As GLenum, params As *GLfloat)
+Declare Sub glGetTexGeniv Lib "opengl32" (coord As GLenum, pname As GLenum, params As *GLint)
+Declare Sub glGetTexImage Lib "opengl32" (target As GLenum, level As GLint, format As GLenum, type_ As GLenum, pixels As *GLvoid)
+Declare Sub glGetTexLevelParameterfv Lib "opengl32" (target As GLenum, level As GLint, pname As GLenum, params As *GLfloat)
+Declare Sub glGetTexLevelParameteriv Lib "opengl32" (target As GLenum, level As GLint, pname As GLenum, params As *GLint)
+Declare Sub glGetTexParameterfv Lib "opengl32" (target As GLenum, pname As GLenum, params As *GLfloat)
+Declare Sub glGetTexParameteriv Lib "opengl32" (target As GLenum, pname As GLenum, params As *GLint)
+Declare Sub glHint Lib "opengl32" (target As GLenum, mode As GLenum)
+Declare Sub glIndexMask Lib "opengl32" (mask As GLuint)
+Declare Sub glIndexPointer Lib "opengl32" (type_ As GLenum, stride As GLsizei, pointer As *GLvoid)
+Declare Sub glIndexd Lib "opengl32" (c As GLdouble)
+Declare Sub glIndexdv Lib "opengl32" (c As *GLdouble)
+Declare Sub glIndexf Lib "opengl32" (c As GLfloat)
+Declare Sub glIndexfv Lib "opengl32" (c As *GLfloat)
+Declare Sub glIndexi Lib "opengl32" (c As GLint)
+Declare Sub glIndexiv Lib "opengl32" (c As *GLint)
+Declare Sub glIndexs Lib "opengl32" (c As GLshort)
+Declare Sub glIndexsv Lib "opengl32" (c As *GLshort)
+Declare Sub glIndexub Lib "opengl32" (c As GLubyte)
+Declare Sub glIndexubv Lib "opengl32" (c As *GLubyte)
+Declare Sub glInitNames Lib "opengl32" ()
+Declare Sub glInterleavedArrays Lib "opengl32" (format As GLenum, stride As GLsizei, pointer As *GLvoid)
+Declare Function glIsEnabled Lib "opengl32" (cap As GLenum) As GLboolean
+Declare Function glIsList Lib "opengl32" (list As GLuint) As GLboolean
+Declare Function glIsTexture Lib "opengl32" (texture As GLuint) As GLboolean
+Declare Sub glLightModelf Lib "opengl32" (pname As GLenum, param As GLfloat)
+Declare Sub glLightModelfv Lib "opengl32" (pname As GLenum, params As *GLfloat)
+Declare Sub glLightModeli Lib "opengl32" (pname As GLenum, param As GLint)
+Declare Sub glLightModeliv Lib "opengl32" (pname As GLenum, params As *GLint)
+Declare Sub glLightf Lib "opengl32" (light As GLenum, pname As GLenum, param As GLfloat)
+Declare Sub glLightfv Lib "opengl32" (light As GLenum, pname As GLenum, params As *GLfloat)
+Declare Sub glLighti Lib "opengl32" (light As GLenum, pname As GLenum, param As GLint)
+Declare Sub glLightiv Lib "opengl32" (light As GLenum, pname As GLenum, params As *GLint)
+Declare Sub glLineStipple Lib "opengl32" (factor As GLint, pattern As GLushort)
+Declare Sub glLineWidth Lib "opengl32" (width As GLfloat)
+Declare Sub glListBase Lib "opengl32" (base As GLuint)
+Declare Sub glLoadIdentity Lib "opengl32" ()
+Declare Sub glLoadMatrixd Lib "opengl32" (m As *GLdouble)
+Declare Sub glLoadMatrixf Lib "opengl32" (m As *GLfloat)
+Declare Sub glLoadName Lib "opengl32" (name As GLuint)
+Declare Sub glLogicOp Lib "opengl32" (opcode As GLenum)
+Declare Sub glMap1d Lib "opengl32" (target As GLenum, u1 As GLdouble, u2 As GLdouble, stride As GLint, order As GLint, points As *GLdouble)
+Declare Sub glMap1f Lib "opengl32" (target As GLenum, u1 As GLfloat, u2 As GLfloat, stride As GLint, order As GLint, points As *GLfloat)
+Declare Sub glMap2d Lib "opengl32" (target As GLenum, u1 As GLdouble, u2 As GLdouble, ustride As GLint, uorder As GLint, v1 As GLdouble, v2 As GLdouble, vstride As GLint, vorder As GLint, points As *GLdouble)
+Declare Sub glMap2f Lib "opengl32" (target As GLenum, u1 As GLfloat, u2 As GLfloat, ustride As GLint, uorder As GLint, v1 As GLfloat, v2 As GLfloat, vstride As GLint, vorder As GLint, points As *GLfloat)
+Declare Sub glMapGrid1d Lib "opengl32" (un As GLint, u1 As GLdouble, u2 As GLdouble)
+Declare Sub glMapGrid1f Lib "opengl32" (un As GLint, u1 As GLfloat, u2 As GLfloat)
+Declare Sub glMapGrid2d Lib "opengl32" (un As GLint, u1 As GLdouble, u2 As GLdouble, vn As GLint, v1 As GLdouble, v2 As GLdouble)
+Declare Sub glMapGrid2f Lib "opengl32" (un As GLint, u1 As GLfloat, u2 As GLfloat, vn As GLint, v1 As GLfloat, v2 As GLfloat)
+Declare Sub glMaterialf Lib "opengl32" (face As GLenum, pname As GLenum, param As GLfloat)
+Declare Sub glMaterialfv Lib "opengl32" (face As GLenum, pname As GLenum, params As *GLfloat)
+Declare Sub glMateriali Lib "opengl32" (face As GLenum, pname As GLenum, param As GLint)
+Declare Sub glMaterialiv Lib "opengl32" (face As GLenum, pname As GLenum, params As *GLint)
+Declare Sub glMatrixMode Lib "opengl32" (mode As GLenum)
+Declare Sub glMultMatrixd Lib "opengl32" (m As *GLdouble)
+Declare Sub glMultMatrixf Lib "opengl32" (m As *GLfloat)
+Declare Sub glNewList Lib "opengl32" (list As GLuint, mode As GLenum)
+Declare Sub glNormal3b Lib "opengl32" (nx As GLbyte, ny As GLbyte, nz As GLbyte)
+Declare Sub glNormal3bv Lib "opengl32" (v As *GLbyte)
+Declare Sub glNormal3d Lib "opengl32" (nx As GLdouble, ny As GLdouble, nz As GLdouble)
+Declare Sub glNormal3dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glNormal3f Lib "opengl32" (nx As GLfloat, ny As GLfloat, nz As GLfloat)
+Declare Sub glNormal3fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glNormal3i Lib "opengl32" (nx As GLint, ny As GLint, nz As GLint)
+Declare Sub glNormal3iv Lib "opengl32" (v As *GLint)
+Declare Sub glNormal3s Lib "opengl32" (nx As GLshort, ny As GLshort, nz As GLshort)
+Declare Sub glNormal3sv Lib "opengl32" (v As *GLshort)
+Declare Sub glNormalPointer Lib "opengl32" (type_ As GLenum, stride As GLsizei, pointer As *GLvoid)
+Declare Sub glOrtho Lib "opengl32" (left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble, zNear As GLdouble, zFar As GLdouble)
+Declare Sub glPassThrough Lib "opengl32" (token As GLfloat)
+Declare Sub glPixelMapfv Lib "opengl32" (map As GLenum, mapsize As GLsizei, values As *GLfloat)
+Declare Sub glPixelMapuiv Lib "opengl32" (map As GLenum, mapsize As GLsizei, values As *GLuint)
+Declare Sub glPixelMapusv Lib "opengl32" (map As GLenum, mapsize As GLsizei, values As *GLushort)
+Declare Sub glPixelStoref Lib "opengl32" (pname As GLenum, param As GLfloat)
+Declare Sub glPixelStorei Lib "opengl32" (pname As GLenum, param As GLint)
+Declare Sub glPixelTransferf Lib "opengl32" (pname As GLenum, param As GLfloat)
+Declare Sub glPixelTransferi Lib "opengl32" (pname As GLenum, param As GLint)
+Declare Sub glPixelZoom Lib "opengl32" (xfactor As GLfloat, yfactor As GLfloat)
+Declare Sub glPointSize Lib "opengl32" (size As GLfloat)
+Declare Sub glPolygonMode Lib "opengl32" (face As GLenum, mode As GLenum)
+Declare Sub glPolygonOffset Lib "opengl32" (factor As GLfloat, units As GLfloat)
+Declare Sub glPolygonStipple Lib "opengl32" (mask As *GLubyte)
+Declare Sub glPopAttrib Lib "opengl32" ()
+Declare Sub glPopClientAttrib Lib "opengl32" ()
+Declare Sub glPopMatrix Lib "opengl32" ()
+Declare Sub glPopName Lib "opengl32" ()
+Declare Sub glPrioritizeTextures Lib "opengl32" (n As GLsizei, textures As *GLuint, priorities As *GLclampf)
+Declare Sub glPushAttrib Lib "opengl32" (mask As GLbitfield)
+Declare Sub glPushClientAttrib Lib "opengl32" (mask As GLbitfield)
+Declare Sub glPushMatrix Lib "opengl32" ()
+Declare Sub glPushName Lib "opengl32" (name As GLuint)
+Declare Sub glRasterPos2d Lib "opengl32" (x As GLdouble, y As GLdouble)
+Declare Sub glRasterPos2dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glRasterPos2f Lib "opengl32" (x As GLfloat, y As GLfloat)
+Declare Sub glRasterPos2fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glRasterPos2i Lib "opengl32" (x As GLint, y As GLint)
+Declare Sub glRasterPos2iv Lib "opengl32" (v As *GLint)
+Declare Sub glRasterPos2s Lib "opengl32" (x As GLshort, y As GLshort)
+Declare Sub glRasterPos2sv Lib "opengl32" (v As *GLshort)
+Declare Sub glRasterPos3d Lib "opengl32" (x As GLdouble, y As GLdouble, z As GLdouble)
+Declare Sub glRasterPos3dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glRasterPos3f Lib "opengl32" (x As GLfloat, y As GLfloat, z As GLfloat)
+Declare Sub glRasterPos3fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glRasterPos3i Lib "opengl32" (x As GLint, y As GLint, z As GLint)
+Declare Sub glRasterPos3iv Lib "opengl32" (v As *GLint)
+Declare Sub glRasterPos3s Lib "opengl32" (x As GLshort, y As GLshort, z As GLshort)
+Declare Sub glRasterPos3sv Lib "opengl32" (v As *GLshort)
+Declare Sub glRasterPos4d Lib "opengl32" (x As GLdouble, y As GLdouble, z As GLdouble, w As GLdouble)
+Declare Sub glRasterPos4dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glRasterPos4f Lib "opengl32" (x As GLfloat, y As GLfloat, z As GLfloat, w As GLfloat)
+Declare Sub glRasterPos4fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glRasterPos4i Lib "opengl32" (x As GLint, y As GLint, z As GLint, w As GLint)
+Declare Sub glRasterPos4iv Lib "opengl32" (v As *GLint)
+Declare Sub glRasterPos4s Lib "opengl32" (x As GLshort, y As GLshort, z As GLshort, w As GLshort)
+Declare Sub glRasterPos4sv Lib "opengl32" (v As *GLshort)
+Declare Sub glReadBuffer Lib "opengl32" (mode As GLenum)
+Declare Sub glReadPixels Lib "opengl32" (x As GLint, y As GLint, width As GLsizei, height As GLsizei, format As GLenum, type_ As GLenum, pixels As *GLvoid)
+Declare Sub glRectd Lib "opengl32" (x1 As GLdouble, y1 As GLdouble, x2 As GLdouble, y2 As GLdouble)
+Declare Sub glRectdv Lib "opengl32" (v1 As *GLdouble, v2 As *GLdouble)
+Declare Sub glRectf Lib "opengl32" (x1 As GLfloat, y1 As GLfloat, x2 As GLfloat, y2 As GLfloat)
+Declare Sub glRectfv Lib "opengl32" (v1 As *GLfloat, v2 As *GLfloat)
+Declare Sub glRecti Lib "opengl32" (x1 As GLint, y1 As GLint, x2 As GLint, y2 As GLint)
+Declare Sub glRectiv Lib "opengl32" (v1 As *GLint, v2 As *GLint)
+Declare Sub glRects Lib "opengl32" ( x1 As GLshort, y1 As GLshort, x2 As GLshort, y2 As GLshort)
+Declare Sub glRectsv Lib "opengl32" (v1 As *GLshort, v2 As *GLshort)
+Declare Function glRenderMode Lib "opengl32" (mode As GLenum) As GLint
+Declare Sub glRotated Lib "opengl32" (angle As GLdouble, x As GLdouble, y As GLdouble, z As GLdouble)
+Declare Sub glRotatef Lib "opengl32" (angle As GLfloat, x As GLfloat, y As GLfloat, z As GLfloat)
+Declare Sub glScaled Lib "opengl32" (x As GLdouble, y As GLdouble, z As GLdouble)
+Declare Sub glScalef Lib "opengl32" (x As GLfloat, y As GLfloat, z As GLfloat)
+Declare Sub glScissor Lib "opengl32" (x As GLint, y As GLint, width As GLsizei, height As GLsizei)
+Declare Sub glSelectBuffer Lib "opengl32" (size As GLsizei, buffer As *GLuint)
+Declare Sub glShadeModel Lib "opengl32" (mode As GLenum)
+Declare Sub glStencilFunc Lib "opengl32" (func As GLenum, ref As GLint, mask As GLuint)
+Declare Sub glStencilMask Lib "opengl32" (mask As GLuint)
+Declare Sub glStencilOp Lib "opengl32" (fail As GLenum, zfail As GLenum, zpass As GLenum)
+Declare Sub glTexCoord1d Lib "opengl32" (s As GLdouble)
+Declare Sub glTexCoord1dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glTexCoord1f Lib "opengl32" (s As GLfloat)
+Declare Sub glTexCoord1fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glTexCoord1i Lib "opengl32" (s As GLint)
+Declare Sub glTexCoord1iv Lib "opengl32" (v As *GLint)
+Declare Sub glTexCoord1s Lib "opengl32" (s As GLshort)
+Declare Sub glTexCoord1sv Lib "opengl32" (v As *GLshort)
+Declare Sub glTexCoord2d Lib "opengl32" (s As GLdouble, t As GLdouble)
+Declare Sub glTexCoord2dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glTexCoord2f Lib "opengl32" (s As GLfloat, t As GLfloat)
+Declare Sub glTexCoord2fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glTexCoord2i Lib "opengl32" (s As GLint, t As GLint)
+Declare Sub glTexCoord2iv Lib "opengl32" (v As *GLint)
+Declare Sub glTexCoord2s Lib "opengl32" (s As GLshort, t As GLshort)
+Declare Sub glTexCoord2sv Lib "opengl32" (v As *GLshort)
+Declare Sub glTexCoord3d Lib "opengl32" (s As GLdouble, t As GLdouble, r As GLdouble)
+Declare Sub glTexCoord3dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glTexCoord3f Lib "opengl32" (s As GLfloat, t As GLfloat, r As GLfloat)
+Declare Sub glTexCoord3fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glTexCoord3i Lib "opengl32" (s As GLint, t As GLint, r As GLint)
+Declare Sub glTexCoord3iv Lib "opengl32" (v As *GLint)
+Declare Sub glTexCoord3s Lib "opengl32" (s As GLshort, t As GLshort, r As GLshort)
+Declare Sub glTexCoord3sv Lib "opengl32" (v As *GLshort)
+Declare Sub glTexCoord4d Lib "opengl32" (s As GLdouble, t As GLdouble, r As GLdouble, q As GLdouble)
+Declare Sub glTexCoord4dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glTexCoord4f Lib "opengl32" (s As GLfloat, t As GLfloat, r As GLfloat, q As GLfloat)
+Declare Sub glTexCoord4fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glTexCoord4i Lib "opengl32" (s As GLint, t As GLint, r As GLint, q As GLint)
+Declare Sub glTexCoord4iv Lib "opengl32" (v As *GLint)
+Declare Sub glTexCoord4s Lib "opengl32" (s As GLshort, t As GLshort, r As GLshort, q As GLshort)
+Declare Sub glTexCoord4sv Lib "opengl32" (v As *GLshort)
+Declare Sub glTexCoordPointer Lib "opengl32" (size As GLint, type_ As GLenum, stride As GLsizei, pointer As *GLvoid)
+Declare Sub glTexEnvf Lib "opengl32" (target As GLenum, pname As GLenum, param As GLfloat)
+Declare Sub glTexEnvfv Lib "opengl32" (target As GLenum, pname As GLenum, params As *GLfloat)
+Declare Sub glTexEnvi Lib "opengl32" (target As GLenum, pname As GLenum, param As GLint)
+Declare Sub glTexEnviv Lib "opengl32" (target As GLenum, pname As GLenum, params As *GLint)
+Declare Sub glTexGend Lib "opengl32" (coord As GLenum, pname As GLenum, param As GLdouble)
+Declare Sub glTexGendv Lib "opengl32" (coord As GLenum, pname As GLenum, params As *GLdouble)
+Declare Sub glTexGenf Lib "opengl32" (coord As GLenum, pname As GLenum, param As GLfloat)
+Declare Sub glTexGenfv Lib "opengl32" (coord As GLenum, pname As GLenum, params As *GLfloat)
+Declare Sub glTexGeni Lib "opengl32" (coord As GLenum, pname As GLenum, param As GLint)
+Declare Sub glTexGeniv Lib "opengl32" (coord As GLenum, pname As GLenum, params As *GLint)
+Declare Sub glTexImage1D Lib "opengl32" (target As GLenum, level As GLint, internalformat As GLint, width As GLsizei, border As GLint, format As GLenum, type_ As GLenum, pixels As *GLvoid)
+Declare Sub glTexImage2D Lib "opengl32" (target As GLenum, level As GLint, internalformat As GLint, width As GLsizei, height As GLsizei, border As GLint, format As GLenum, type_ As GLenum, pixels As *GLvoid)
+Declare Sub glTexParameterf Lib "opengl32" (target As GLenum, pname As GLenum, param As GLfloat)
+Declare Sub glTexParameterfv Lib "opengl32" (target As GLenum, pname As GLenum, params As *GLfloat)
+Declare Sub glTexParameteri Lib "opengl32" (target As GLenum, pname As GLenum, param As GLint)
+Declare Sub glTexParameteriv Lib "opengl32" (target As GLenum, pname As GLenum, params As *GLint)
+Declare Sub glTexSubImage1D Lib "opengl32" (target As GLenum, level As GLint, xoffset As GLint, width As GLsizei, format As GLenum, type_ As GLenum, pixels As *GLvoid)
+Declare Sub glTexSubImage2D Lib "opengl32" (target As GLenum, level As GLint, xoffset As GLint, yoffset As GLint, width As GLsizei, height As GLsizei, format As GLenum, type_ As GLenum, pixels As *GLvoid)
+Declare Sub glTranslated Lib "opengl32" (x As GLdouble, y As GLdouble, z As GLdouble)
+Declare Sub glTranslatef Lib "opengl32" (x As GLfloat, y As GLfloat, z As GLfloat)
+Declare Sub glVertex2d Lib "opengl32" (x As GLdouble, y As GLdouble)
+Declare Sub glVertex2dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glVertex2f Lib "opengl32" (x As GLfloat, y As GLfloat)
+Declare Sub glVertex2fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glVertex2i Lib "opengl32" (x As GLint, y As GLint)
+Declare Sub glVertex2iv Lib "opengl32" (v As *GLint)
+Declare Sub glVertex2s Lib "opengl32" (x As GLshort, y As GLshort)
+Declare Sub glVertex2sv Lib "opengl32" (v As *GLshort)
+Declare Sub glVertex3d Lib "opengl32" (x As GLdouble, y As GLdouble, z As GLdouble)
+Declare Sub glVertex3dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glVertex3f Lib "opengl32" (x As GLfloat, y As GLfloat, z As GLfloat)
+Declare Sub glVertex3fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glVertex3i Lib "opengl32" (x As GLint, y As GLint, z As GLint)
+Declare Sub glVertex3iv Lib "opengl32" (v As *GLint)
+Declare Sub glVertex3s Lib "opengl32" (x As GLshort, y As GLshort, z As GLshort)
+Declare Sub glVertex3sv Lib "opengl32" (v As *GLshort)
+Declare Sub glVertex4d Lib "opengl32" (x As GLdouble, y As GLdouble, z As GLdouble, w As GLdouble)
+Declare Sub glVertex4dv Lib "opengl32" (v As *GLdouble)
+Declare Sub glVertex4f Lib "opengl32" (x As GLfloat, y As GLfloat, z As GLfloat, w As GLfloat)
+Declare Sub glVertex4fv Lib "opengl32" (v As *GLfloat)
+Declare Sub glVertex4i Lib "opengl32" (x As GLint, y As GLint, z As GLint, w As GLint)
+Declare Sub glVertex4iv Lib "opengl32" (v As *GLint)
+Declare Sub glVertex4s Lib "opengl32" (x As GLshort, y As GLshort, z As GLshort, w As GLshort)
+Declare Sub glVertex4sv Lib "opengl32" (v As *GLshort)
+Declare Sub glVertexPointer Lib "opengl32" (size As GLint, type_ As GLenum, stride As GLsizei, pointer As *GLvoid)
+Declare Sub glViewport Lib "opengl32" (x As GLint, y As GLint, width As GLsizei, height As GLsizei)
+
+TypeDef PFNGLARRAYELEMENTEXTPROC = *Sub(i As GLint)
+TypeDef PFNGLDRAWARRAYSEXTPROC = *Sub(mode As GLenum, first As GLint, count As GLsizei)
+TypeDef PFNGLVERTEXPOINTEREXTPROC = *Sub(size As GLint, type_ As GLenum, stride As GLsizei, count As GLsizei, pointer As *GLvoid)
+TypeDef PFNGLNORMALPOINTEREXTPROC = *Sub(type_ As GLenum, stride As GLsizei, count As GLsizei, pointer As *GLvoid)
+TypeDef PFNGLCOLORPOINTEREXTPROC = *Sub(size As GLint, type_ As GLenum, stride As GLsizei, count As GLsizei, pointer As *GLvoid)
+TypeDef PFNGLINDEXPOINTEREXTPROC = *Sub(type_ As GLenum, stride As GLsizei, count As GLsizei, pointer As *GLvoid)
+TypeDef PFNGLTEXCOORDPOINTEREXTPROC = *Sub(size As GLint, type_ As GLenum, stride As GLsizei, count As GLsizei, pointer As *GLvoid)
+TypeDef PFNGLEDGEFLAGPOINTEREXTPROC = *Sub(stride As GLsizei, count As GLsizei, pointer As *GLboolean)
+TypeDef PFNGLGETPOINTERVEXTPROC = *Sub(pname As GLenum, ByRef values As *GLvoid)
+TypeDef PFNGLARRAYELEMENTARRAYEXTPROC = *Sub(mode As GLenum, count As GLsizei, pi As *GLvoid)
+TypeDef PFNGLDRAWRANGEELEMENTSWINPROC = *Sub(mode As GLenum, start As GLuint, end_ As GLuint, count As GLsizei, type_ As GLenum, indices As *GLvoid)
+TypeDef PFNGLADDSWAPHINTRECTWINPROC = *Sub(x As GLint, y As GLint, width As GLsizei, height As GLsizei)
+TypeDef PFNGLCOLORTABLEEXTPROC = *Sub(target As GLenum, internalFormat As GLenum, width As GLsizei, format As GLenum, type_ As GLenum, data As *GLvoid)
+TypeDef PFNGLCOLORSUBTABLEEXTPROC = *Sub(target As GLenum, start As GLsizei, count As GLsizei, format As GLenum, type_ As GLenum, data As *GLvoid)
+TypeDef PFNGLGETCOLORTABLEEXTPROC = *Sub(target As GLenum, format As GLenum, type_ As GLenum, data As *GLvoid)
+TypeDef PFNGLGETCOLORTABLEPARAMETERIVEXTPROC = *Sub(target As GLenum, pname As GLenum, params As *GLint)
+TypeDef PFNGLGETCOLORTABLEPARAMETERFVEXTPROC = *Sub(target As GLenum, pname As GLenum, params As *GLfloat)
Index: /trunk/ab5.0/ablib/src/gl/glu.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/gl/glu.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/gl/glu.sbp	(revision 506)
@@ -0,0 +1,222 @@
+Function gluErrorStringWIN(errCode As GLenum) As PSTR
+	gluErrorStringWIN = gluErrorString(errCode) As PSTR
+End Function
+
+Declare Function gluErrorString Lib "glu32"  (errCode As GLenum) As *GLubyte
+Declare Function gluErrorUnicodeStringEXT Lib "glu32"  (errCode As GLenum) As PWSTR
+Declare Function gluGetString Lib "glu32"  (name As GLenum) As *GLubyte
+
+Declare Sub gluOrtho2D Lib "glu32"  (left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble)
+Declare Sub gluPerspective Lib "glu32"  (fovy As GLdouble, aspect As GLdouble, zNear As GLdouble, zFar As GLdouble)
+Declare Sub gluPickMatrix Lib "glu32"  (x As GLdouble, y As GLdouble, width As GLdouble, height As GLdouble, viewport As *GLint)
+Declare Sub gluLookAt Lib "glu32"  (eyex As GLdouble, eyey As GLdouble, eyez As GLdouble, centerx As GLdouble, centery As GLdouble, centerz As GLdouble, upx As GLdouble, upy As GLdouble, upz As GLdouble)
+Declare Function gluProject Lib "glu32"  (objx As GLdouble, objy As GLdouble, objz As GLdouble, modelMatrix As *GLdouble, projMatrix As *GLdouble, viewport As *GLint, winx As *GLdouble, winy As *GLdouble, winz As *GLdouble) As Long
+Declare Function gluUnProject Lib "glu32"  (winx As GLdouble, winy As GLdouble, winz As GLdouble, modelMatrix As *GLdouble, projMatrix As *GLdouble, viewport As *GLint, objx As *GLdouble, objy As *GLdouble, objz As *GLdouble) As Long
+Declare Function gluScaleImage Lib "glu32"  (format As GLenum, widthin As GLint, heightin As GLint, typein As GLenum, datain As VoidPtr, widthout As GLint, heightout As GLint, typeout As GLenum, dataout As VoidPtr) As Long
+Declare Function gluBuild1DMipmaps Lib "glu32"  (target As GLenum, components As GLint, width As GLint, format As GLenum, type_ As GLenum, data As VoidPtr) As Long
+Declare Function gluBuild2DMipmaps Lib "glu32"  (target As GLenum, components As GLint, width As GLint, height As GLint, format As GLenum, type_ As GLenum, data As VoidPtr) As Long
+
+TypeDef GLUnurbs = VoidPtr
+TypeDef GLUquadric = VoidPtr
+TypeDef GLUtesselator = VoidPtr
+
+TypeDef  GLUnurbsObj = GLUnurbs
+TypeDef  GLUquadricObj = GLUquadric
+TypeDef  GLUtesselatorObj = GLUtesselator
+TypeDef  GLUtriangulatorObj = GLUtesselator
+
+Declare Function gluNewQuadric Lib "glu32"  () As *GLUquadric
+Declare Sub gluDeleteQuadric Lib "glu32"  (state As *GLUquadric)
+Declare Sub gluQuadricNormals Lib "glu32"  (quadObject As *GLUquadric, normals As GLenum)
+Declare Sub gluQuadricTexture Lib "glu32"  (quadObject As *GLUquadric, textureCoords As GLboolean)
+Declare Sub gluQuadricOrientation Lib "glu32"  (quadObject As *GLUquadric, orientation As GLenum)
+Declare Sub gluQuadricDrawStyle Lib "glu32"  (quadObject As *GLUquadric, drawStyle As GLenum)
+Declare Sub gluCylinder Lib "glu32"  (qobj As *GLUquadric, baseRadius As GLdouble, topRadius As GLdouble, height As GLdouble, slices As GLint, stacks As GLint)
+Declare Sub gluDisk Lib "glu32"  (qobj As *GLUquadric, innerRadius As GLdouble, outerRadius As GLdouble, slices As GLint, loops As GLint)
+Declare Sub gluPartialDisk Lib "glu32"  (qobj As *GLUquadric, innerRadius As GLdouble, outerRadius As GLdouble, slices As GLint, loops As GLint, startAngle As GLdouble, sweepAngle As GLdouble)
+Declare Sub gluSphere Lib "glu32"  (qobj As *GLUquadric, radius As GLdouble, slices As GLint, stacks As GLint)
+TypeDef PFN_QUADRICCALLBACK = *Sub()
+Declare Sub gluQuadricCallback Lib "glu32"  (qobj As *GLUquadric, which As GLenum, fn As PFN_QUADRICCALLBACK)
+Declare Function gluNewTess Lib "glu32" () As *GLUtesselator
+Declare Sub gluDeleteTess Lib "glu32" (tess As *GLUtesselator)
+Declare Sub gluTessBeginPolygon Lib "glu32" (tess As *GLUtesselator, polygon_data As VoidPtr)
+Declare Sub gluTessBeginContour Lib "glu32" (tess As *GLUtesselator)
+Declare Sub gluTessVertex Lib "glu32" (tess As *GLUtesselator, coords As *GLdouble, data As VoidPtr)
+Declare Sub gluTessEndContour Lib "glu32" (tess As *GLUtesselator)
+Declare Sub gluTessEndPolygon Lib "glu32" (tess As *GLUtesselator)
+Declare Sub gluTessProperty Lib "glu32" (tess As *GLUtesselator, which As GLenum, value As GLdouble)
+Declare Sub gluTessNormal Lib "glu32" (tess As *GLUtesselator, x As GLdouble, y As GLdouble, z As GLdouble)
+TypeDef PFN_TESSCALLBACK = *Sub()
+Declare Sub gluTessCallback Lib "glu32" (tess As *GLUtesselator, which As GLenum, fn As PFN_TESSCALLBACK)
+Declare Sub gluGetTessProperty Lib "glu32" (tess As *GLUtesselator, which As GLenum, value As *GLdouble)
+Declare Function gluNewNurbsRenderer Lib "glu32"  () As *GLUnurbs
+Declare Sub gluDeleteNurbsRenderer Lib "glu32"  (nobj As *GLUnurbs)
+Declare Sub gluBeginSurface Lib "glu32"  (nobj As *GLUnurbs)
+Declare Sub gluBeginCurve Lib "glu32"  (nobj As *GLUnurbs)
+Declare Sub gluEndCurve Lib "glu32"  (nobj As *GLUnurbs)
+Declare Sub gluEndSurface Lib "glu32"  (nobj As *GLUnurbs)
+Declare Sub gluBeginTrim Lib "glu32"  (nobj As *GLUnurbs)
+Declare Sub gluEndTrim Lib "glu32"  (nobj As *GLUnurbs)
+Declare Sub gluPwlCurve Lib "glu32"  (nobj As *GLUnurbs, count As GLint, array As *GLfloat, stride As GLint, type_ As GLenum)
+Declare Sub gluNurbsCurve Lib "glu32"  (nobj As *GLUnurbs, nknots As GLint, knot As *GLfloat, stride As GLint, ctlarray As *GLfloat, order As GLint, type_ As GLenum)
+Declare Sub gluNurbsSurface Lib "glu32" (nobj As *GLUnurbs, sknot_count As GLint, sknot As *Single, tknot_count As GLint, tknot As *GLfloat, s_stride As GLint, t_stride As GLint, ctlarray As *GLfloat, sorder As GLint, torder As GLint, type_ As GLenum)
+Declare Sub gluLoadSamplingMatrices Lib "glu32"  (nobj As *GLUnurbs, modelMatrix As *GLfloat, projMatrix As *GLfloat, viewport As *GLint)
+Declare Sub gluNurbsProperty Lib "glu32"  (nobj As *GLUnurbs, property As GLenum, value As GLfloat)
+Declare Sub gluGetNurbsProperty Lib "glu32"  (nobj As *GLUnurbs, property As GLenum, value As *GLfloat)
+TypeDef PFN_NURBSCALLBACK = *Sub()
+Declare Sub gluNurbsCallback Lib "glu32"  (nobj As *GLUnurbs, which As GLenum, fn As PFN_NURBSCALLBACK)
+
+TypeDef GLUquadricErrorProc= *Sub(e As GLenum)
+TypeDef GLUtessBeginProc= *Sub(e As GLenum)
+TypeDef GLUtessEdgeFlagProc= *Sub(b As GLboolean)
+TypeDef GLUtessVertexProc= *Sub(pv As VoidPtr)
+TypeDef GLUtessEndProc= *Sub()
+TypeDef GLUtessErrorProc= *Sub(e As GLenum)
+TypeDef GLUtessCombineProc= *Sub(dbl As *GLdouble, v As *VoidPtr, f As *GLfloat, ppv As VoidPtr)
+TypeDef GLUtessBeginDataProc= *Sub(e As GLenum, pv As VoidPtr)
+TypeDef GLUtessEdgeFlagDataProc= *Sub(b As GLboolean, pv As VoidPtr)
+TypeDef GLUtessVertexDataProc= *Sub(pv As VoidPtr, pv As VoidPtr)
+TypeDef GLUtessEndDataProc= *Sub(pv As VoidPtr)
+TypeDef GLUtessErrorDataProc= *Sub(e As GLenum, pv As VoidPtr)
+TypeDef GLUtessCombineDataProc= *Sub(dbl As GLdouble, v As VoidPtr, f As *GLfloat, ppv As *VoidPtr, ppv As *VoidPtr)
+TypeDef GLUnurbsErrorProc= *Sub(e As GLenum)
+
+Const GLU_VERSION_1_1 = 1
+Const GLU_VERSION_1_2 = 1
+
+Const GLU_INVALID_ENUM = 100900
+Const GLU_INVALID_VALUE = 100901
+Const GLU_OUT_OF_MEMORY = 100902
+Const GLU_INCOMPATIBLE_GL_VERSION = 100903
+
+Const GLU_VERSION = 100800
+Const GLU_EXTENSIONS = 100801
+
+'Const GLU_TRUE = GL_TRUE
+'Const GLU_FALSE = GL_FALSE
+
+Const GLU_SMOOTH = 100000
+Const GLU_FLAT = 100001
+Const GLU_NONE = 100002
+
+Const GLU_POINT = 100010
+Const GLU_LINE = 100011
+Const GLU_FILL = 100012
+Const GLU_SILHOUETTE = 100013
+
+Const GLU_OUTSIDE = 100020
+Const GLU_INSIDE = 100021
+
+Const GLU_TESS_MAX_COORD = 1.0e150
+
+Const GLU_TESS_WINDING_RULE = 100140
+Const GLU_TESS_BOUNDARY_ONLY = 100141
+Const GLU_TESS_TOLERANCE = 100142
+
+Const GLU_TESS_WINDING_ODD = 100130
+Const GLU_TESS_WINDING_NONZERO = 100131
+Const GLU_TESS_WINDING_POSITIVE = 100132
+Const GLU_TESS_WINDING_NEGATIVE = 100133
+Const GLU_TESS_WINDING_ABS_GEQ_TWO = 100134
+
+Const GLU_TESS_BEGIN = 100100
+Const GLU_TESS_VERTEX = 100101
+Const GLU_TESS_END = 100102
+Const GLU_TESS_ERROR = 100103
+Const GLU_TESS_EDGE_FLAG = 100104
+Const GLU_TESS_COMBINE = 100105
+Const GLU_TESS_BEGIN_DATA = 100106
+Const GLU_TESS_VERTEX_DATA = 100107
+Const GLU_TESS_END_DATA = 100108
+Const GLU_TESS_ERROR_DATA = 100109
+Const GLU_TESS_EDGE_FLAG_DATA = 100110
+Const GLU_TESS_COMBINE_DATA = 100111
+
+Const GLU_TESS_ERROR1 = 100151
+Const GLU_TESS_ERROR2 = 100152
+Const GLU_TESS_ERROR3 = 100153
+Const GLU_TESS_ERROR4 = 100154
+Const GLU_TESS_ERROR5 = 100155
+Const GLU_TESS_ERROR6 = 100156
+Const GLU_TESS_ERROR7 = 100157
+Const GLU_TESS_ERROR8 = 100158
+
+Const GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1
+Const GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2
+Const GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3
+Const GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4
+Const GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5
+Const GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6
+
+Const GLU_AUTO_LOAD_MATRIX = 100200
+Const GLU_CULLING = 100201
+Const GLU_SAMPLING_TOLERANCE = 100203
+Const GLU_DISPLAY_MODE = 100204
+Const GLU_PARAMETRIC_TOLERANCE = 100202
+Const GLU_SAMPLING_METHOD = 100205
+Const GLU_U_STEP = 100206
+Const GLU_V_STEP = 100207
+
+Const GLU_PATH_LENGTH = 100215
+Const GLU_PARAMETRIC_ERROR = 100216
+Const GLU_DOMAIN_DISTANCE = 100217
+
+Const GLU_MAP1_TRIM_2 = 100210
+Const GLU_MAP1_TRIM_3 = 100211
+
+Const GLU_OUTLINE_POLYGON = 100240
+Const GLU_OUTLINE_PATCH = 100241
+
+Const GLU_NURBS_ERROR1 = 100251
+Const GLU_NURBS_ERROR2 = 100252
+Const GLU_NURBS_ERROR3 = 100253
+Const GLU_NURBS_ERROR4 = 100254
+Const GLU_NURBS_ERROR5 = 100255
+Const GLU_NURBS_ERROR6 = 100256
+Const GLU_NURBS_ERROR7 = 100257
+Const GLU_NURBS_ERROR8 = 100258
+Const GLU_NURBS_ERROR9 = 100259
+Const GLU_NURBS_ERROR10 = 100260
+Const GLU_NURBS_ERROR11 = 100261
+Const GLU_NURBS_ERROR12 = 100262
+Const GLU_NURBS_ERROR13 = 100263
+Const GLU_NURBS_ERROR14 = 100264
+Const GLU_NURBS_ERROR15 = 100265
+Const GLU_NURBS_ERROR16 = 100266
+Const GLU_NURBS_ERROR17 = 100267
+Const GLU_NURBS_ERROR18 = 100268
+Const GLU_NURBS_ERROR19 = 100269
+Const GLU_NURBS_ERROR20 = 100270
+Const GLU_NURBS_ERROR21 = 100271
+Const GLU_NURBS_ERROR22 = 100272
+Const GLU_NURBS_ERROR23 = 100273
+Const GLU_NURBS_ERROR24 = 100274
+Const GLU_NURBS_ERROR25 = 100275
+Const GLU_NURBS_ERROR26 = 100276
+Const GLU_NURBS_ERROR27 = 100277
+Const GLU_NURBS_ERROR28 = 100278
+Const GLU_NURBS_ERROR29 = 100279
+Const GLU_NURBS_ERROR30 = 100280
+Const GLU_NURBS_ERROR31 = 100281
+Const GLU_NURBS_ERROR32 = 100282
+Const GLU_NURBS_ERROR33 = 100283
+Const GLU_NURBS_ERROR34 = 100284
+Const GLU_NURBS_ERROR35 = 100285
+Const GLU_NURBS_ERROR36 = 100286
+Const GLU_NURBS_ERROR37 = 100287
+
+Declare Sub gluBeginPolygon Lib "glu32" (tess As *GLUtesselator)
+Declare Sub gluNextContour Lib "glu32" (tess As *GLUtesselator, type_ As GLenum)
+Declare Sub gluEndPolygon Lib "glu32" (tess As *GLUtesselator)
+
+Const GLU_CW = 100120
+Const GLU_CCW = 100121
+Const GLU_INTERIOR = 100122
+Const GLU_EXTERIOR = 100123
+Const GLU_UNKNOWN = 100124
+
+Const GLU_BEGIN = GLU_TESS_BEGIN
+Const GLU_VERTEX = GLU_TESS_VERTEX
+Const GLU_END = GLU_TESS_END
+Const GLU_ERROR = GLU_TESS_ERROR
+Const GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG
Index: /trunk/ab5.0/ablib/src/gl/glut.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/gl/glut.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/gl/glut.sbp	(revision 506)
@@ -0,0 +1,349 @@
+#require <GL/gl.sbp>
+#require <GL/glu.sbp>
+
+Const GLUT_XLIB_IMPLEMENTATION = 13
+
+Const GLUT_RGB = 0
+Const GLUT_RGBA = GLUT_RGB
+Const GLUT_INDEX = 1
+Const GLUT_SINGLE = 0
+Const GLUT_DOUBLE = 2
+Const GLUT_ACCUM = 4
+Const GLUT_ALPHA = 8
+Const GLUT_DEPTH = 16
+Const GLUT_STENCIL = 32
+Const GLUT_MULTISAMPLE = 128
+Const GLUT_STEREO = 256
+Const GLUT_LUMINANCE = 512
+
+Const GLUT_LEFT_BUTTON = 0
+Const GLUT_MIDDLE_BUTTON = 1
+Const GLUT_RIGHT_BUTTON = 2
+
+Const GLUT_DOWN = 0
+Const GLUT_UP = 1
+
+Const GLUT_KEY_F1 = 1
+Const GLUT_KEY_F2 = 2
+Const GLUT_KEY_F3 = 3
+Const GLUT_KEY_F4 = 4
+Const GLUT_KEY_F5 = 5
+Const GLUT_KEY_F6 = 6
+Const GLUT_KEY_F7 = 7
+Const GLUT_KEY_F8 = 8
+Const GLUT_KEY_F9 = 9
+Const GLUT_KEY_F10 = 10
+Const GLUT_KEY_F11 = 11
+Const GLUT_KEY_F12 = 12
+Const GLUT_KEY_LEFT = 100
+Const GLUT_KEY_UP = 101
+Const GLUT_KEY_RIGHT = 102
+Const GLUT_KEY_DOWN = 103
+Const GLUT_KEY_PAGE_UP = 104
+Const GLUT_KEY_PAGE_DOWN = 105
+Const GLUT_KEY_HOME = 106
+Const GLUT_KEY_END = 107
+Const GLUT_KEY_INSERT = 108
+
+Const GLUT_LEFT = 0
+Const GLUT_ENTERED = 1
+
+Const GLUT_MENU_NOT_IN_USE = 0
+Const GLUT_MENU_IN_USE = 1
+
+Const GLUT_NOT_VISIBLE = 0
+Const GLUT_VISIBLE = 1
+
+Const GLUT_HIDDEN = 0
+Const GLUT_FULLY_RETAINED = 1
+Const GLUT_PARTIALLY_RETAINED = 2
+Const GLUT_FULLY_COVERED = 3
+
+Const GLUT_RED = 0
+Const GLUT_GREEN = 1
+Const GLUT_BLUE = 2
+
+Const GLUT_NORMAL = 0
+Const GLUT_OVERLAY = 1
+
+Const GLUT_STROKE_ROMAN = 0
+Const GLUT_STROKE_MONO_ROMAN = 1
+
+Const GLUT_BITMAP_9_BY_15 = 2
+Const GLUT_BITMAP_8_BY_13 = 3
+Const GLUT_BITMAP_TIMES_ROMAN_10 = 4
+Const GLUT_BITMAP_TIMES_ROMAN_24 = 5
+Const GLUT_BITMAP_HELVETICA_10 = 6
+Const GLUT_BITMAP_HELVETICA_12 = 7
+Const GLUT_BITMAP_HELVETICA_18 = 8
+
+Dim glutStrokeRoman As VoidPtr
+Dim glutStrokeMonoRoman As VoidPtr
+
+Dim glutBitmap9By15 As VoidPtr
+Dim glutBitmap8By13 As VoidPtr
+Dim glutBitmapTimesRoman10 As VoidPtr
+Dim glutBitmapTimesRoman24 As VoidPtr
+Dim glutBitmapHelvetica10 As VoidPtr
+Dim glutBitmapHelvetica12 As VoidPtr
+Dim glutBitmapHelvetica18 As VoidPtr
+
+Const GLUT_WINDOW_X = 100
+Const GLUT_WINDOW_Y = 101
+Const GLUT_WINDOW_WIDTH = 102
+Const GLUT_WINDOW_HEIGHT = 103
+Const GLUT_WINDOW_BUFFER_SIZE = 104
+Const GLUT_WINDOW_STENCIL_SIZE = 105
+Const GLUT_WINDOW_DEPTH_SIZE = 106
+Const GLUT_WINDOW_RED_SIZE = 107
+Const GLUT_WINDOW_GREEN_SIZE = 108
+Const GLUT_WINDOW_BLUE_SIZE = 109
+Const GLUT_WINDOW_ALPHA_SIZE = 110
+Const GLUT_WINDOW_ACCUM_RED_SIZE = 111
+Const GLUT_WINDOW_ACCUM_GREEN_SIZE = 112
+Const GLUT_WINDOW_ACCUM_BLUE_SIZE = 113
+Const GLUT_WINDOW_ACCUM_ALPHA_SIZE = 114
+Const GLUT_WINDOW_DOUBLEBUFFER = 115
+Const GLUT_WINDOW_RGBA = 116
+Const GLUT_WINDOW_PARENT = 117
+Const GLUT_WINDOW_NUM_CHILDREN = 118
+Const GLUT_WINDOW_COLORMAP_SIZE = 119
+Const GLUT_WINDOW_NUM_SAMPLES = 120
+Const GLUT_WINDOW_STEREO = 121
+Const GLUT_WINDOW_CURSOR = 122
+Const GLUT_SCREEN_WIDTH = 200
+Const GLUT_SCREEN_HEIGHT = 201
+Const GLUT_SCREEN_WIDTH_MM = 202
+Const GLUT_SCREEN_HEIGHT_MM = 203
+Const GLUT_MENU_NUM_ITEMS = 300
+Const GLUT_DISPLAY_MODE_POSSIBLE = 400
+Const GLUT_INIT_WINDOW_X = 500
+Const GLUT_INIT_WINDOW_Y = 501
+Const GLUT_INIT_WINDOW_WIDTH = 502
+Const GLUT_INIT_WINDOW_HEIGHT = 503
+Const GLUT_INIT_DISPLAY_MODE = 504
+Const GLUT_ELAPSED_TIME = 700
+Const GLUT_WINDOW_FORMAT_ID = 123
+
+Const GLUT_HAS_KEYBOARD = 600
+Const GLUT_HAS_MOUSE = 601
+Const GLUT_HAS_SPACEBALL = 602
+Const GLUT_HAS_DIAL_AND_BUTTON_BOX = 603
+Const GLUT_HAS_TABLET = 604
+Const GLUT_NUM_MOUSE_BUTTONS = 605
+Const GLUT_NUM_SPACEBALL_BUTTONS = 606
+Const GLUT_NUM_BUTTON_BOX_BUTTONS = 607
+Const GLUT_NUM_DIALS = 608
+Const GLUT_NUM_TABLET_BUTTONS = 609
+Const GLUT_DEVICE_IGNORE_KEY_REPEAT = 610
+Const GLUT_DEVICE_KEY_REPEAT = 611
+Const GLUT_HAS_JOYSTICK = 612
+Const GLUT_OWNS_JOYSTICK = 613
+Const GLUT_JOYSTICK_BUTTONS = 614
+Const GLUT_JOYSTICK_AXES = 615
+Const GLUT_JOYSTICK_POLL_RATE = 616
+
+Const GLUT_OVERLAY_POSSIBLE = 800
+Const GLUT_LAYER_IN_USE = 801
+Const GLUT_HAS_OVERLAY = 802
+Const GLUT_TRANSPARENT_INDEX = 803
+Const GLUT_NORMAL_DAMAGED = 804
+Const GLUT_OVERLAY_DAMAGED = 805
+
+Const GLUT_VIDEO_RESIZE_POSSIBLE = 900
+Const GLUT_VIDEO_RESIZE_IN_USE = 901
+Const GLUT_VIDEO_RESIZE_X_DELTA = 902
+Const GLUT_VIDEO_RESIZE_Y_DELTA = 903
+Const GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904
+Const GLUT_VIDEO_RESIZE_HEIGHT_DELTA = 905
+Const GLUT_VIDEO_RESIZE_X = 906
+Const GLUT_VIDEO_RESIZE_Y = 907
+Const GLUT_VIDEO_RESIZE_WIDTH = 908
+Const GLUT_VIDEO_RESIZE_HEIGHT = 909
+
+Const GLUT_ACTIVE_SHIFT = 1
+Const GLUT_ACTIVE_CTRL = 2
+Const GLUT_ACTIVE_ALT = 4
+
+Const GLUT_CURSOR_RIGHT_ARROW = 0
+Const GLUT_CURSOR_LEFT_ARROW = 1
+Const GLUT_CURSOR_INFO = 2
+Const GLUT_CURSOR_DESTROY = 3
+Const GLUT_CURSOR_HELP = 4
+Const GLUT_CURSOR_CYCLE = 5
+Const GLUT_CURSOR_SPRAY = 6
+Const GLUT_CURSOR_WAIT = 7
+Const GLUT_CURSOR_TEXT = 8
+Const GLUT_CURSOR_CROSSHAIR = 9
+Const GLUT_CURSOR_UP_DOWN = 10
+Const GLUT_CURSOR_LEFT_RIGHT = 11
+Const GLUT_CURSOR_TOP_SIDE = 12
+Const GLUT_CURSOR_BOTTOM_SIDE = 13
+Const GLUT_CURSOR_LEFT_SIDE = 14
+Const GLUT_CURSOR_RIGHT_SIDE = 15
+Const GLUT_CURSOR_TOP_LEFT_CORNER = 16
+Const GLUT_CURSOR_TOP_RIGHT_CORNER = 17
+Const GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18
+Const GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19
+Const GLUT_CURSOR_INHERIT = 100
+Const GLUT_CURSOR_NONE = 101
+Const GLUT_CURSOR_FULL_CROSSHAIR = 102
+
+Declare Sub glutInit Lib "glut32" (argcp As *Long, argv As *PSTR)
+Declare Sub glutInitDisplayMode Lib "glut32" (mode As DWord)
+Declare Sub glutInitDisplayString Lib "glut32" (pstring As PSTR)
+Declare Sub glutInitWindowPosition Lib "glut32" (x As Long, y As Long)
+Declare Sub glutInitWindowSize Lib "glut32" (width As Long, height As Long)
+Declare Sub glutMainLoop Lib "glut32" ()
+Declare Function glutCreateWindow Lib "glut32" (title As PSTR) As Long
+Declare Function glutCreateSubWindow Lib "glut32" (win As Long, x As Long, y As Long, width As Long, height As Long) As Long
+Declare Sub glutDestroyWindow Lib "glut32" (win As Long)
+Declare Sub glutPostRedisplay Lib "glut32" ()
+Declare Sub glutPostWindowRedisplay Lib "glut32" (win As Long)
+Declare Sub glutSwapBuffers Lib "glut32" ()
+Declare Function glutGetWindow Lib "glut32" () As Long
+Declare Sub glutSetWindow Lib "glut32" (win As Long)
+Declare Sub glutSetWindowTitle Lib "glut32" (title As PSTR)
+Declare Sub glutSetIconTitle Lib "glut32" (title As PSTR)
+Declare Sub glutPositionWindow Lib "glut32" (x As Long, y As Long)
+Declare Sub glutReshapeWindow Lib "glut32" (width As Long, height As Long)
+Declare Sub glutPopWindow Lib "glut32" ()
+Declare Sub glutPushWindow Lib "glut32" ()
+Declare Sub glutIconifyWindow Lib "glut32" ()
+Declare Sub glutShowWindow Lib "glut32" ()
+Declare Sub glutHideWindow Lib "glut32" ()
+Declare Sub glutFullScreen Lib "glut32" ()
+Declare Sub glutSetCursor Lib "glut32" (cursor As Long)
+Declare Sub glutWarpPointer Lib "glut32" (x As Long, y As Long)
+Declare Sub glutEstablishOverlay Lib "glut32" ()
+Declare Sub glutRemoveOverlay Lib "glut32" ()
+Declare Sub glutUseLayer Lib "glut32" (layer As GLenum)
+Declare Sub glutPostOverlayRedisplay Lib "glut32" ()
+Declare Sub glutPostWindowOverlayRedisplay Lib "glut32" (win As Long)
+Declare Sub glutShowOverlay Lib "glut32" ()
+Declare Sub glutHideOverlay Lib "glut32" ()
+Declare Function glutCreateMenu Lib "glut32" (i As VoidPtr) As Long
+Declare Sub glutDestroyMenu Lib "glut32" (menu As Long)
+Declare Function glutGetMenu Lib "glut32" () As Long
+Declare Sub glutSetMenu Lib "glut32" (menu As Long)
+Declare Sub glutAddMenuEntry Lib "glut32" (label As PSTR, value As Long)
+Declare Sub glutAddSubMenu Lib "glut32" (label As PSTR, submenu As Long)
+Declare Sub glutChangeToMenuEntry Lib "glut32" (item As Long, label As PSTR, value As Long)
+Declare Sub glutChangeToSubMenu Lib "glut32" (item As Long, label As PSTR, submenu As Long)
+Declare Sub glutRemoveMenuItem Lib "glut32" (item As Long)
+Declare Sub glutAttachMenu Lib "glut32" (button As Long)
+Declare Sub glutDetachMenu Lib "glut32" (button As Long)
+TypeDef LPDISPLAYFUNC = *Sub()
+Declare Sub glutDisplayFunc Lib "glut32" (func As LPDISPLAYFUNC)
+TypeDef LPRESHAPEFUNC = *Sub(width As Long, height As Long)
+Declare Sub glutReshapeFunc Lib "glut32" (func As LPRESHAPEFUNC)
+TypeDef LPKEYBOARDFUNC = *Sub(key As Byte, x As Long, y As Long)
+Declare Sub glutKeyboardFunc Lib "glut32" (func As LPKEYBOARDFUNC)
+TypeDef LPMOUSEFUNC = *Sub(button As Long, state As Long, x As Long, y As Long)
+Declare Sub glutMouseFunc Lib "glut32" (func As LPMOUSEFUNC)
+TypeDef LPMOTIONFUNC = *Sub(x As Long, y As Long)
+Declare Sub glutMotionFunc Lib "glut32" (func As LPMOTIONFUNC)
+TypeDef LPPASSIVEMOTIONFUNC = *Sub(x As Long, y As Long)
+Declare Sub glutPassiveMotionFunc Lib "glut32" (func As LPPASSIVEMOTIONFUNC)
+TypeDef LPENTRYFUNC = *Sub(state As Long)
+Declare Sub glutEntryFunc Lib "glut32" (func As LPENTRYFUNC)
+TypeDef LPVISIBILITYFUNC = *Sub(state As Long)
+Declare Sub glutVisibilityFunc Lib "glut32" (func As LPVISIBILITYFUNC)
+TypeDef LPIDLEFUNC = *Sub()
+Declare Sub glutIdleFunc Lib "glut32" (func As LPIDLEFUNC)
+TypeDef LPTIMERFUNC = *Sub(value As Long)
+Declare Sub glutTimerFunc Lib "glut32" (millis As DWord, func As LPTIMERFUNC, value As Long)
+TypeDef LPMENUSTATEFUNC = *Sub(state As Long)
+Declare Sub glutMenuStateFunc Lib "glut32" (func As LPMENUSTATEFUNC)
+TypeDef LPSPECIALFUNC = *Sub(int key, x As Long, y As Long)
+Declare Sub glutSpecialFunc Lib "glut32" (func As LPSPECIALFUNC)
+TypeDef LPSPACEBALLMOTIONFUNC = *Sub(x As Long, y As Long, int z)
+Declare Sub glutSpaceballMotionFunc Lib "glut32" (func As LPSPACEBALLMOTIONFUNC)
+TypeDef LPSPACEBALLROTATEFUNC = *Sub(x As Long, y As Long, int z)
+Declare Sub glutSpaceballRotateFunc Lib "glut32" (func As LPSPACEBALLROTATEFUNC)
+TypeDef LPSPACEBALLBUTTONFUNC = *Sub(button As Long, state As Long)
+Declare Sub glutSpaceballButtonFunc Lib "glut32" (func As LPSPACEBALLBUTTONFUNC)
+TypeDef LPBUTTONBOXFUNC = *Sub(button As Long, state As Long)
+Declare Sub glutButtonBoxFunc Lib "glut32" (func As LPBUTTONBOXFUNC)
+TypeDef LPDIALSFUNC = *Sub(dial As Long, value As Long)
+Declare Sub glutDialsFunc Lib "glut32" (func As LPDIALSFUNC)
+TypeDef LPTABLETMOTIONFUNC = *Sub(x As Long, y As Long)
+Declare Sub glutTabletMotionFunc Lib "glut32" (func As LPTABLETMOTIONFUNC)
+TypeDef LPTABLETBUTTONFUNC = *Sub(button As Long, state As Long, x As Long, y As Long)
+Declare Sub glutTabletButtonFunc Lib "glut32" (func As LPTABLETBUTTONFUNC)
+TypeDef LPMENUSTATUSFUNC = *Sub(int status, x As Long, y As Long)
+Declare Sub glutMenuStatusFunc Lib "glut32" (func As LPMENUSTATUSFUNC)
+TypeDef LPOVERLAYDISPLAYFUNC = *Sub()
+Declare Sub glutOverlayDisplayFunc Lib "glut32" (func As LPOVERLAYDISPLAYFUNC)
+TypeDef LPWINDOWSTATUSFUNC = *Sub(state As Long)
+Declare Sub glutWindowStatusFunc Lib "glut32" (func As LPWINDOWSTATUSFUNC)
+TypeDef LPKEYBOARDUPFUNC = *Sub(key As Byte, x As Long, y As Long)
+Declare Sub glutKeyboardUpFunc Lib "glut32" (func As LPKEYBOARDUPFUNC)
+TypeDef LPSPECIALUPFUNC = *Sub(int key, x As Long, y As Long)
+Declare Sub glutSpecialUpFunc Lib "glut32" (func As LPSPECIALUPFUNC)
+TypeDef LPJOYSTICKFUNC = *Sub(unsigned button As LongMask, x As Long, y As Long, int z)
+Declare Sub glutJoystickFunc Lib "glut32" (func As LPJOYSTICKFUNC, pollInterval As Long)
+Declare Sub glutSetColor Lib "glut32" (i As Long, red As GLfloat, green As GLfloat, blue As GLfloat)
+Declare Function glutGetColor Lib "glut32" (ndx As Long, component As Long) As GLfloat
+Declare Sub glutCopyColormap Lib "glut32" (win As Long)
+Declare Function glutGet Lib "glut32" (type_ As GLenum) As Long
+Declare Function glutDeviceGet Lib "glut32" (type_ As GLenum) As Long
+Declare Function glutExtensionSupported Lib "glut32" (name As PSTR) As Long
+Declare Function glutGetModifiers Lib "glut32" () As Long
+Declare Function glutLayerGet Lib "glut32" (type_ As GLenum) As Long
+Declare Sub glutBitmapCharacter Lib "glut32" (font As VoidPtr, character As Long)
+Declare Function glutBitmapWidth Lib "glut32" (font As VoidPtr, character As Long) As Long
+Declare Sub glutStrokeCharacter Lib "glut32" (font As VoidPtr, character As Long)
+Declare Function glutStrokeWidth Lib "glut32" (font As VoidPtr, character As Long) As Long
+Declare Function glutBitmapLength Lib "glut32" (font As VoidPtr, pstring As *Byte) As Long
+Declare Function glutStrokeLength Lib "glut32" (font As VoidPtr, pstring As *Byte) As Long
+Declare Sub glutWireSphere Lib "glut32" (radius As GLdouble, slices As GLint, stacks As GLint)
+Declare Sub glutSolidSphere Lib "glut32" (radius As GLdouble, slices As GLint, stacks As GLint)
+Declare Sub glutWireCone Lib "glut32" (base As GLdouble, height As GLdouble, slices As GLint, stacks As GLint)
+Declare Sub glutSolidCone Lib "glut32" (base As GLdouble, height As GLdouble, slices As GLint, stacks As GLint)
+Declare Sub glutWireCube Lib "glut32" (size As GLdouble)
+Declare Sub glutSolidCube Lib "glut32" (size As GLdouble)
+Declare Sub glutWireTorus Lib "glut32" (innerRadius As GLdouble, outerRadius As GLdouble, sides As GLint, rings As GLint)
+Declare Sub glutSolidTorus Lib "glut32" (innerRadius As GLdouble, outerRadius As GLdouble, sides As GLint, rings As GLint)
+Declare Sub glutWireDodecahedron Lib "glut32" ()
+Declare Sub glutSolidDodecahedron Lib "glut32" ()
+Declare Sub glutWireTeapot Lib "glut32" (size As GLdouble)
+Declare Sub glutSolidTeapot Lib "glut32" (size As GLdouble)
+Declare Sub glutWireOctahedron Lib "glut32" ()
+Declare Sub glutSolidOctahedron Lib "glut32" ()
+Declare Sub glutWireTetrahedron Lib "glut32" ()
+Declare Sub glutSolidTetrahedron Lib "glut32" ()
+Declare Sub glutWireIcosahedron Lib "glut32" ()
+Declare Sub glutSolidIcosahedron Lib "glut32" ()
+Declare Function glutVideoResizeGet Lib "glut32" (param As GLenum) As Long
+Declare Sub glutSetupVideoResizing Lib "glut32" ()
+Declare Sub glutStopVideoResizing Lib "glut32" ()
+Declare Sub glutVideoResize Lib "glut32" (x As Long, y As Long, width As Long, height As Long)
+Declare Sub glutVideoPan Lib "glut32" (x As Long, y As Long, width As Long, height As Long)
+Declare Sub glutReportErrors Lib "glut32" ()
+
+Const GLUT_KEY_REPEAT_OFF = 0
+Const GLUT_KEY_REPEAT_ON = 1
+Const GLUT_KEY_REPEAT_DEFAULT = 2
+
+Const GLUT_JOYSTICK_BUTTON_A = 1
+Const GLUT_JOYSTICK_BUTTON_B = 2
+Const GLUT_JOYSTICK_BUTTON_C = 4
+Const GLUT_JOYSTICK_BUTTON_D = 8
+
+Declare Sub glutIgnoreKeyRepeat Lib "glut32" (ignore As Long)
+Declare Sub glutSetKeyRepeat Lib "glut32" (repeatMode As Long)
+Declare Sub glutForceJoystickFunc Lib "glut32" ()
+
+Const GLUT_GAME_MODE_ACTIVE = 0
+Const GLUT_GAME_MODE_POSSIBLE = 1
+Const GLUT_GAME_MODE_WIDTH = 2
+Const GLUT_GAME_MODE_HEIGHT = 3
+Const GLUT_GAME_MODE_PIXEL_DEPTH = 4
+Const GLUT_GAME_MODE_REFRESH_RATE = 5
+Const GLUT_GAME_MODE_DISPLAY_CHANGED = 6
+
+Declare Sub glutGameModeString Lib "glut32" (pstring As PSTR)
+Declare Function glutEnterGameMode Lib "glut32" () As Long
+Declare Sub glutLeaveGameMode Lib "glut32" ()
+Declare Function glutGameModeGet Lib "glut32" (mode As GLenum) As Long
Index: /trunk/ab5.0/ablib/src/guiddef.ab
===================================================================
--- /trunk/ab5.0/ablib/src/guiddef.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/guiddef.ab	(revision 506)
@@ -0,0 +1,40 @@
+' guiddef.ab
+
+Type GUID
+	Data1 As DWord
+	Data2 As Word
+	Data3 As Word
+	Data4[7] As Byte
+End Type
+
+Dim GUID_NULL = [0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0]] As GUID
+
+TypeDef IID = GUID
+TypeDef CLSID = GUID
+TypeDef FMTID = GUID
+
+'Dim IID_NULL = GUID_NULL
+'Dim CLSID_NULL = GUID_NULL
+'Dim FMTID_NULL = GUID_NULL
+
+Function IsEqualGUID(ByRef x As GUID, ByRef y As GUID) As BOOL
+	IsEqualGUID = (memcmp(VarPtr(x), VarPtr(y), SizeOf (GUID)) = 0)
+End Function
+
+Function IsEqualIID(ByRef x As IID, ByRef y As IID) As BOOL
+	IsEqualIID = (memcmp(VarPtr(x), VarPtr(y), SizeOf (IID)) = 0)
+End Function
+
+Function IsEqualCLSID(ByRef x As CLSID, ByRef y As CLSID) As BOOL
+	IsEqualCLSID = (memcmp(VarPtr(x), VarPtr(y), SizeOf (CLSID)) = 0)
+End Function
+
+/*
+Function Operator ==(ByRef x As GUID, ByRef y As GUID) As Boolean
+	Return IsEqualGUID(x, y) <> FALSE
+End Function
+
+Function Operator <>(ByRef x As GUID, ByRef y As GUID) As Boolean
+	Return IsEqualGUID(x, y) = FALSE
+End Function
+*/
Index: /trunk/ab5.0/ablib/src/objbase.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/objbase.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/objbase.sbp	(revision 506)
@@ -0,0 +1,542 @@
+' objbase.sbp
+
+TypeDef RPC_AUTH_IDENTITY_HANDLE = VoidPtr 'Declared in Rpcdce.sbp; include Rpc.sbp.
+TypeDef RPC_AUTHZ_HANDLE = VoidPtr 'Declared in Rpcdce.sbp; include Rpc.sbp.
+
+Sub LISet32(ByRef li As LARGE_INTEGER, v As Long)
+	With li
+		If v < 0 Then
+			.HighPart = -1
+		Else
+			.HighPart = 0
+		End If
+		.LowPart = v
+	End With
+End Sub
+Sub ULISet32(ByRef li As ULARGE_INTEGER, v As DWord)
+	With li
+		.HighPart = 0
+		.LowPart = v
+	End With
+End Sub
+
+Const MARSHALINTERFACE_MIN = 500
+
+Const CWCSTORAGENAME = 32
+
+/* Storage instantiation modes */
+Const STGM_DIRECT             = &h00000000
+Const STGM_TRANSACTED         = &h00010000
+Const STGM_SIMPLE             = &h08000000
+
+Const STGM_READ               = &h00000000
+Const STGM_WRITE              = &h00000001
+Const STGM_READWRITE          = &h00000002
+
+Const STGM_SHARE_DENY_NONE    = &h00000040
+Const STGM_SHARE_DENY_READ    = &h00000030
+Const STGM_SHARE_DENY_WRITE   = &h00000020
+Const STGM_SHARE_EXCLUSIVE    = &h00000010
+
+Const STGM_PRIORITY           = &h00040000
+Const STGM_DELETEONRELEASE    = &h04000000
+'#if (WINVER >= &h400)
+Const STGM_NOSCRATCH          = &h00100000
+'#endif /* WINVER */
+
+Const STGM_CREATE             = &h00001000
+Const STGM_CONVERT            = &h00020000
+Const STGM_FAILIFTHERE        = &h00000000
+
+Const STGM_NOSNAPSHOT         = &h00200000
+'#if (_WIN32_WINNT >= &h0500)
+Const STGM_DIRECT_SWMR        = &h00400000
+'#endif
+
+/*  flags for internet asyncronous and layout docfile */
+Const ASYNC_MODE_COMPATIBILITY    = &h00000001
+Const ASYNC_MODE_DEFAULT          = &h00000000
+
+Const STGTY_REPEAT                = &h00000100
+Const STG_TOEND                   = &hFFFFFFFF
+
+Const STG_LAYOUT_SEQUENTIAL       = &h00000000
+Const STG_LAYOUT_INTERLEAVED      = &h00000001
+
+Const STGFMT_STORAGE          = 0
+Const STGFMT_NATIVE           = 1
+Const STGFMT_FILE             = 3
+Const STGFMT_ANY              = 4
+Const STGFMT_DOCFILE          = 5
+
+Const STGFMT_DOCUMENT = 0
+
+'/* here is where we pull in the MIDL generated headers for the interfaces */
+'typedef interface    IRpcStubBuffer     IRpcStubBuffer;
+'typedef interface    IRpcChannelBuffer  IRpcChannelBuffer;
+
+#require <wtypes.ab>
+#require <unknwn.sbp>
+#require <objidl.sbp>
+
+'-------------------
+' IStream Interface
+'-------------------
+
+Const CLSCTX_INPROC = CLSCTX_INPROC_SERVER or CLSCTX_INPROC_HANDLER
+'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM)
+Const CLSCTX_ALL    = CLSCTX_INPROC_SERVER or CLSCTX_INPROC_HANDLER or CLSCTX_LOCAL_SERVER or CLSCTX_REMOTE_SERVER
+Const CLSCTX_SERVER = CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER or CLSCTX_REMOTE_SERVER
+'#else
+'Const CLSCTX_ALL    = CLSCTX_INPROC_SERVER or CLSCTX_INPROC_HANDLER or CLSCTX_LOCAL_SERVER
+'Const CLSCTX_SERVER = CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER
+'#endif
+
+Const Enum REGCLS
+	REGCLS_SINGLEUSE = 0
+	REGCLS_MULTIPLEUSE = 1
+	REGCLS_MULTI_SEPARATE = 2
+	REGCLS_SUSPENDED = 4
+	REGCLS_SURROGATE = 8
+End Enum
+
+Declare Function CoInitialize Lib "ole32" (pvReserved As VoidPtr) As HRESULT
+Declare Sub CoUninitialize Lib "ole32" ()
+'Declare Sub CoGetMalloc Lib "ole32" (dwMemContext As DWord, ByRef Malloc As IMalloc) As HRESULT
+Declare Function CoGetCurrentProcess Lib "ole32" () As DWord
+'Declare Function CoRegisterMallocSpy Lib "ole32" (ByRef MallocSpy As IMallocSpy) As HRESULT
+Declare Function CoRevokeMallocSpy Lib "ole32" () As HRESULT
+'Declare Function CoCreateStandardMalloc Lib "ole32" (memctx As DWord, ByRef Malloc As IMalloc) As HRESULT
+
+
+'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM)
+Const Enum COINIT
+	COINIT_MULTITHREADED     = &h0
+	COINIT_APARTMENTTHREADED = &h2
+	COINIT_DISABLE_OLE1DDE   = &h4
+	COINIT_SPEED_OVER_MEMORY = &h8
+End Enum
+Declare Function CoInitializeEx Lib "ole32" (pvReserved As VoidPtr, dwCoInit As DWord) As HRESULT
+Declare Function CoGetCallerTID Lib "ole32" (ByRef dwTID AS DWord) As HRESULT
+'#endif
+
+#ifdef __UNDECLARED__
+'#if (_WIN32_WINNT >= &h0501)
+' 注意：このcokkieは本来ULARGE_INTEGER型
+'Declare Function CoRegisterInitializeSpy Lib "ole32" (Spy As IInitializeSpy, ByRef uliCokkie As QWord) As HRESULT
+Declare Function CoRevokeInitializeSpy Lib "ole32" (uliCookie As QWord) As HRESULT
+
+Declare Function CoGetContextToken Lib "ole32" (ByRef token As ULONG_PTR) As HRESULT
+
+Const Enum COMSD
+	SD_LAUNCHPERMISSIONS = 0
+	SD_ACCESSPERMISSIONS = 1
+	SD_LAUNCHRESTRICTIONS = 2
+	SD_ACCESSRESTRICTIONS = 3
+End Enum
+'Declare Function CoGetSystemSecurityPermissions(comSDType As COMSD, ByRef ppSD As *SECURITY_DESCRIPTOR) As HRESULT
+#endif
+
+'#if DBG == 1
+'Declare Function DebugCoGetRpcFault Lib "" () As DWord
+'Declare Sub DebugCoSetRpcFault Lib "" (ul As DWord)
+'#endif
+
+'#if (_WIN32_WINNT >= &h0500)
+
+Type SOleTlsDataPublic
+	pvReserved0[ELM(2)] As VoidPtr
+	dwReserved0[ELM(3)] As DWord
+	pvReserved1[ELM(1)] As VoidPtr
+	dwReserved1[ELM(3)] As DWord
+	pvReserved2[ELM(4)] As VoidPtr
+	dwReserved2[ELM(1)] As DWord
+	pCurrentCtx As VoidPtr
+End Type
+
+'#endif
+
+/* COM+ APIs */
+
+Declare Function CoGetObjectContext Lib "ole32" (ByRef riid As IID, ByRef ppv As Any) As HRESULT
+
+/* register/revoke/get class objects */
+
+Declare Function CoGetClassObject Lib "ole32" (ByRef rclsid As CLSID, dwClsContext As DWord, pServerInfo As *COSERVERINFO, ByRef refiid As IID, ByRef ppv As Any) As HRESULT
+Declare Function CoRegisterClassObject Lib "ole32" (ByRef rclsid As CLSID, pUnk As *IUnknown, dwClsContext As DWord, flags As DWord, ByRef dwRegister As DWord) As HRESULT
+Declare Function CoRevokeClassObject Lib "ole32" (dwRegister As DWord) As HRESULT
+Declare Function CoResumeClassObjects Lib "ole32" () As HRESULT
+Declare Function CoSuspendClassObjects Lib "ole32" () As HRESULT
+Declare Function CoAddRefServerProcess Lib "ole32" () As DWord
+Declare Function CoReleaseServerProcess Lib "ole32" () As DWord
+Declare Function CoGetPSClsid Lib "ole32" (ByRef riid As IID, ByRef rclsid As CLSID) As HRESULT
+Declare Function CoRegisterPSClsid Lib "ole32" (ByRef riid As IID, ByRef rclsid As CLSID) As HRESULT
+
+/* Registering surrogate processes */
+'Declare Function CoRegisterSurrogate Lib "ole32" (Surrogate As ISurrogate) As HRESULT
+
+/* marshaling interface pointers */
+
+Declare Function CoGetMarshalSizeMax Lib "ole32" (ByRef ulSize As DWord, ByRef riid As IID, pUnk As *IUnknown, dwDestContext As DWord, pvDestContext As VoidPtr, mshlflags As DWord) As HRESULT
+Declare Function CoMarshalInterface Lib "ole32" (pStm As *IStream, ByRef riid As IID, pUnk As *IUnknown, dwDestContext As DWord, pvDestContext As VoidPtr, mshlflags As DWord) As HRESULT
+Declare Function CoUnmarshalInterface Lib "ole32" (pstm As *IStream, ByRef riid As IID, ByRef ppv As Any) As HRESULT
+Declare Function CoMarshalHresult Lib "ole32" (pstm As *IStream, hresult As HRESULT) As HRESULT
+Declare Function CoUnmarshalHresult Lib "ole32" (pstm As *IStream, ByRef phresult As HRESULT) As HRESULT
+Declare Function CoReleaseMarshalData Lib "ole32" (pstm As *IStream) As HRESULT
+Declare Function CoDisconnectObject Lib "ole32" (pUnk As *IUnknown, dwReserved As DWord) As HRESULT
+Declare Function CoLockObjectExternal Lib "ole32" (pUnk As *IUnknown, fLock As BOOL, fLastUnlockReleases As BOOL) As HRESULT
+'Declare Function CoGetStandardMarshal Lib "ole32" (ByRef riid As IID, pUnk As *IUnknown, dwDestContext As DWord, pvDestContext As VoidPtr, mshlflags As DWord, ByRef pMarshal As *IMarshal) As HRESULT
+
+Declare Function CoGetStdMarshalEx Lib "ole32" (pUnkOuter As *IUnknown, smexflags As DWord, ByRef pUnkInner As *IUnknown) As HRESULT
+
+/* flags for CoGetStdMarshalEx */
+Const Enum STDMSHLFLAGS
+	SMEXF_SERVER  = &h01
+	SMEXF_HANDLER = &h02
+End Enum
+
+Declare Function CoIsHandlerConnected Lib "ole32" (pUnk As *IUnknown) As BOOL
+
+/* Apartment model inter-thread interface passing helpers */
+Declare Function CoMarshalInterThreadInterfaceInStream Lib "ole32" (ByRef riid As IID, pUnk As *IUnknown, ByRef pStm As *IStream) As HRESULT
+
+Declare Function CoGetInterfaceAndReleaseStream Lib "ole32" (pStm As *IStream, ByRef riid As IID, ByRef ppv As Any) As HRESULT
+Declare Function CoCreateFreeThreadedMarshaler Lib "ole32" (punkOuter As *IUnknown, ByRef punkMarshal As *IUnknown) As HRESULT
+
+/* dll loading helpers; keeps track of ref counts and unloads all on exit */
+
+Declare Function CoLoadLibrary Lib "ole32" (lpszLibName As LPOLESTR, bAutoFree As BOOL) As HINSTANCE
+Declare Sub CoFreeLibrary Lib "ole32" (hInst As HINSTANCE)
+Declare Sub CoFreeAllLibraries Lib "ole32" ()
+Declare Sub CoFreeUnusedLibraries Lib "ole32" ()
+'#if  (_WIN32_WINNT >= &h0501)
+Declare Sub CoFreeUnusedLibrariesEx Lib "ole32" (dwUnloadDelay As DWord, dwReserved As DWord)
+'#endif
+
+'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
+
+/* Call Security. */
+
+/*SOLE_AUTHENTICATION_SERVICE未定義
+Declare Function CoInitializeSecurity Lib "ole32" (
+	ByVal pSecDesc As *SECURITY_DESCRIPTOR,
+	ByVal cAuthSvc As *SOLE_AUTHENTICATION_SERVICE,
+	ByVal pReserved1 As VoidPtr,
+	ByVal dwAuthnLevel As DWord,
+	ByVal dwImpLevel As DWord,
+	ByVal pAuthList As VoidPtr,
+	ByVal dwCapabilities As DWord,
+	ByVal pReserved3 As VoidPtr) As HRESULT
+*/
+Declare Function CoGetCallContext Lib "ole32" (
+	ByRef riid As IID,
+	ByRef pInterface As Any) As HRESULT
+Declare Function CoQueryProxyBlanket Lib "ole32" (
+	ByVal pProxy As *IUnknown,
+	ByRef AuthnSvc As DWord,
+	ByVal pAuthzSvc As *DWord,
+	ByVal pServerPrincName As **OLECHAR,
+	ByVal pAuthnLevel As *DWord,
+	ByVal pImpLevel As *DWord,
+	ByVal pAuthInfo As *RPC_AUTH_IDENTITY_HANDLE,
+	ByVal pCapabilites As *DWord) As HRESULT
+Declare Function CoSetProxyBlanket Lib "ole32" (
+	ByVal pProxy As *IUnknown,
+	ByVal dwAuthnSvc As DWord,
+	ByVal dwAuthzSvc As DWord,
+	ByVal pServerPrincName As *OLECHAR,
+	ByVal dwAuthnLevel As DWord,
+	ByVal dwImpLevel As DWord,
+	ByVal pAuthInfo As RPC_AUTH_IDENTITY_HANDLE,
+	ByVal dwCapabilities As DWord) As HRESULT
+Declare Function CoCopyProxy Lib "ole32" (
+	ByVal pProxySrc As *IUnknown,
+	ByRef pProxyDst As *IUnknown) As HRESULT
+Declare Function CoQueryClientBlanket Lib "ole32" (
+	ByVal pAuthnSvc As *DWord,
+	ByVal pAuthzSvc As *DWord,
+	ByVal pServerPrincName As **OLECHAR,
+	ByVal pAuthnLevel As *DWord,
+	ByVal pImpLevel As *DWord,
+	ByVal pPrivs As *RPC_AUTHZ_HANDLE,
+	ByVal pCapabilities As *DWord) As HRESULT
+Declare Function CoImpersonateClient Lib "ole32" () As HRESULT
+Declare Function CoRevertToSelf Lib "ole32" () As HRESULT
+/*
+Declare Function CoRevertToSelf Lib "ole32" (
+	ByRef cAuthSvc As DWord,
+	ByRef asAuthSvc As *SOLE_AUTHENTICATION_SERVICE) As HRESULT
+*/
+Declare Function CoSwitchCallContext Lib "ole32" (
+	ByVal pNewObject As *IUnknown,
+	ByRef ppOldObject As *IUnknown) As HRESULT
+
+Const COM_RIGHTS_EXECUTE = 1
+Const COM_RIGHTS_EXECUTE_LOCAL = 2
+Const COM_RIGHTS_EXECUTE_REMOTE = 4
+Const COM_RIGHTS_ACTIVATE_LOCAL = 8
+Const COM_RIGHTS_ACTIVATE_REMOTE = 16
+'#endif ' DCOM
+
+Declare Function CoCreateInstance Lib "ole32" (ByRef clsid As CLSID, pUnknown As *IUnknown, dwClsContext As DWord, ByRef refiid As IID, ByRef pObj As Any) As HRESULT
+
+'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
+Declare Function CoGetInstanceFromFile Lib "ole32" (
+	ByVal pServerInfo As *COSERVERINFO,
+	ByRef clsid As CLSID,
+	ByVal punkOuter As *IUnknown,
+	ByVal dwClsCtx As DWord,
+	ByVal grfMode As DWord,
+	ByVal pwszName As *OLECHAR,
+	ByVal dwCount As DWord,
+	ByVal pResults As *MULTI_QI) As HRESULT
+
+Declare Function CoGetInstanceFromIStorage Lib "ole32" (
+	ByVal pServerInfo As *COSERVERINFO,
+	ByRef clsid As CLSID,
+	ByVal punkOuter As *IUnknown,
+	ByVal dwClsCtx As DWord,
+	ByVal grfMode As DWord,
+	ByVal pstg As *IStorage,
+	ByVal dwCount As DWord,
+	ByVal pResults As *MULTI_QI) As HRESULT
+
+Declare Function CoCreateInstanceEx Lib "ole32" (
+	ByRef clsid As CLSID,
+	ByVal punkOuter As *IUnknown,
+	ByVal dwClsCtx As DWord,
+	ByVal pServerInfo As *COSERVERINFO,
+	ByVal dwCount As DWord,
+	ByVal pResults As *MULTI_QI) As HRESULT
+'#endif ' DCOM
+
+/* Call related APIs */
+'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
+Declare Function CoGetCancelObject Lib "ole32" (dwThreadId As DWord, ByRef iid As IID, ByRef pUnk As Any) As HRESULT
+Declare Function CoSetCancelObject Lib "ole32" (pUnk As *IUnknown) As HRESULT
+Declare Function CoCancelCall Lib "ole32" (dwThreadId As DWord, ulTimeout As DWord) As HRESULT
+Declare Function CoTestCancel Lib "ole32" () As HRESULT
+Declare Function CoEnableCallCancellation Lib "ole32" (pReserved As VoidPtr) As HRESULT
+Declare Function CoDisableCallCancellation Lib "ole32" (pReserved As VoidPtr) As HRESULT
+Declare Function CoAllowSetForegroundWindow Lib "ole32" (pUnk As *IUnknown, pvReserved As VoidPtr) As HRESULT
+Declare Function DcomChannelSetHResult Lib "ole32" (pvReserved As HRESULT, pulReserved As DWord, appsHR As HRESULT) As HRESULT
+'#endif
+
+/* other helpers */
+
+Declare Function StringFromCLSID Lib "ole32" (ByRef rclsid As CLSID, ByRef lpsz As LPOLESTR) As HRESULT
+Declare Function CLSIDFromString Lib "ole32" (lpsz As LPOLESTR, ByRef clsid As CLSID) As HRESULT
+Declare Function StringFromIID Lib "ole32" (ByRef iid As IID, ByRef lpsz As LPOLESTR) As HRESULT
+Declare Function IIDFromString Lib "ole32" (lpsz As LPOLESTR, ByRef iid As IID) As HRESULT
+Declare Function CoIsOle1Class Lib "ole32" (ByRef rclsid As CLSID) As BOOL
+Declare Function ProgIDFromCLSID  Lib "ole32" (ByRef clsid As CLSID, ByRef lpszProgID As LPOLESTR) As HRESULT
+Declare Function CLSIDFromProgID  Lib "ole32" (lpszProgID As LPCOLESTR, ByRef clsid As CLSID) As HRESULT
+Declare Function CLSIDFromProgIDEx  Lib "ole32" (lpszProgID As LPCOLESTR, ByRef clsid As CLSID) As HRESULT
+Declare Function StringFromGUID2 Lib "ole32" (ByRef rguid As GUID, lpsz As LPOLESTR, cchMax As Long) As Long
+
+Declare Function CoCreateGuid Lib "ole32" (ByRef guid As GUID) As HRESULT
+
+Declare Function CoFileTimeToDosDateTime Lib "ole32" (ByRef FileTime As FILETIME, ByRef DosDate As Word, ByRef DosTime As Word) As BOOL
+Declare Function CoDosDateTimeToFileTime Lib "ole32" (nDosDate As Word, nDosTime As Word, ByRef FileTime As FILETIME) As BOOL
+Declare Function CoFileTimeNow Lib "ole32" (ByRef FileTime As FILETIME) As HRESULT
+
+Declare Function CoRegisterMessageFilter Lib "ole32" (pMessageFilter As *IMessageFilter, ByRef pMessageFilter As *IMessageFilter) As HRESULT
+
+'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
+'IChannelHook未定義
+'Declare Function CoRegisterChannelHook Lib "ole32" (ByRef ExtensionUuid As GUID, pChannelHook As *IChannelHook) As HRESULT
+'#endif ' DCOM
+
+'#if (_WIN32_WINNT >= &h0400) Or defined(_WIN32_DCOM) 'DCOM
+
+Declare Function CoWaitForMultipleHandles Lib "ole32" (
+	ByVal dwFlags As DWord,
+	ByVal dwTimeout As DWord,
+	ByVal cHandles As DWord,
+	ByVal pHandles As *HANDLE,
+	ByRef dwindex As DWord) As HRESULT
+
+/* Flags for Synchronization API and Classes */
+
+Const Enum COWAIT_FLAGS
+	COWAIT_WAITALL = 1
+	COWAIT_ALERTABLE = 2
+	COWAIT_INPUTAVAILABLE = 4
+End Enum
+
+'#endif ' DCOM
+
+/* for flushing OLESCM remote binding handles */
+
+#ifdef __UNDECLARED__
+'#if  (_WIN32_WINNT >= &h0501)
+Declare Function CoInvalidateRemoteMachineBindings Lib "ole32" (pszMachineName As LPOLESTR) As HRESULT
+#endif
+
+/* TreatAs APIS */
+
+Declare Function CoGetTreatAsClass Lib "ole32" (ByRef clsidOld As CLSID, ByRef ClsidNew As CLSID) As HRESULT
+Declare Function CoTreatAsClass Lib "ole32" (ByRef clsidOld As CLSID, ByRef clsidNew As CLSID) As HRESULT
+
+/* the server dlls must define their DllGetClassObject and DllCanUnloadNow
+ * to match these; the typedefs are located here to ensure all are changed at
+ * the same time.
+ */
+
+TypeDef LPFNGETCLASSOBJECT = *Function(ByRef rclsid As CLSID, ByRef riid As IID, ByRef ppv As Any) As HRESULT
+TypeDef LPFNCANUNLOADNOW = *Function() As HRESULT
+
+/*
+Declare Function DllGetClassObject(ByRef rclsid As CLSID, ByRef riid As IID, ByVal ppv As *VoidPtr) As HRESULT
+Declare Function DllCanUnloadNow() As HRESULT
+*/
+
+/****** Default Memory Allocation ******************************************/
+Declare Function CoTaskMemAlloc Lib "ole32" (cb As SIZE_T) As VoidPtr
+Declare Function CoTaskMemRealloc Lib "ole32" (pv As VoidPtr, cb As SIZE_T) As VoidPtr
+Declare Sub CoTaskMemFree Lib "ole32" (pv As VoidPtr)
+
+/****** DV APIs ***********************************************************/
+
+/* This function is declared in objbase.h and ole2.h */
+Declare Function CreateDataAdviseHolder Lib "ole32" (ByRef pDAHolder As *IDataAdviseHolder) As HRESULT
+Declare Function CreateDataCache Lib "ole32" (pUnkOuter As *IUnknown, ByRef rclsid As CLSID, ByRef riid As IID, ByRef ppv As Any) As HRESULT
+
+/****** Storage API Prototypes ********************************************/
+
+
+Declare Function StgCreateDocfile Lib "ole32" (
+	ByVal pwcsName As *OLECHAR,
+	ByVal grfMode As DWord,
+	ByVal reserved As DWord,
+	ByRef pstgOpen As *IStorage) As HRESULT
+
+Declare Function StgCreateDocfileOnILockBytes Lib "ole32" (
+	ByVal plkbyt As *ILockBytes,
+	ByVal grfMode As DWord,
+	ByVal reserved As DWord,
+	ByRef pstgOpen As *IStorage) As HRESULT
+
+Declare Function StgOpenStorage Lib "ole32" (
+	ByVal pwcsName As *OLECHAR,
+	ByVal pstgPriority As *IStorage,
+	ByVal grfMode As DWord,
+	ByVal snbExclude As SNB,
+	ByVal reserved As DWord,
+	ByRef pstgOpen As *IStorage) As HRESULT
+Declare Function StgOpenStorageOnILockBytes Lib "ole32" (
+	ByVal plkbyt As *ILockBytes,
+	ByVal pstgPriority As *IStorage,
+	ByVal grfMode As DWord,
+	ByVal snbExclude As SNB,
+	ByVal reserved As DWord,
+	ByRef pstgOpen As *IStorage) As HRESULT
+
+Declare Function StgIsStorageFile Lib "ole32" (pwcsName As *OLECHAR) As HRESULT
+Declare Function StgIsStorageILockBytes Lib "ole32" (plkbyt As *ILockBytes) As HRESULT
+
+Declare Function StgSetTimes Lib "ole32" (
+	ByVal pszName As *OLECHAR,
+	ByRef pctime As FILETIME,
+	ByRef patime As FILETIME,
+	ByRef pmtime As FILETIME) As HRESULT
+
+Declare Function StgOpenAsyncDocfileOnIFillLockBytes Lib "ole32" (
+	ByVal pflb As *IFillLockBytes,
+	ByVal grfMode As DWord,
+	ByVal asyncFlags As DWord,
+	ByRef pstgOpen As *IStorage) As HRESULT
+
+Declare Function StgGetIFillLockBytesOnILockBytes Lib "ole32" (
+	ByVal pilb As *ILockBytes,
+	ByRef pflb As *IFillLockBytes) As HRESULT
+
+Declare Function StgGetIFillLockBytesOnFile Lib "ole32" (
+	ByVal pwcsName As *OLECHAR,
+	ByRef pflb As *IFillLockBytes) As HRESULT
+/*
+Declare Function StgOpenLayoutDocfile Lib "ole32" (
+	ByVal pwcsName As *OLECHAR,
+	ByVal grfMode As DWord,
+	ByVal reserved As DWord,
+	ByRef pstgOpen As *IStorage) As HRESULT
+*/
+/*
+// STG initialization options for StgCreateStorageEx and StgOpenStorageEx
+#if _WIN32_WINNT == &h500
+#define STGOPTIONS_VERSION 1
+#elif _WIN32_WINNT > &h500
+#define STGOPTIONS_VERSION 2
+#else
+#define STGOPTIONS_VERSION 0
+#endif
+*/
+Type STGOPTIONS
+	usVersion As Word
+	reserved As Word
+	ulSectorSize As DWord
+'#if STGOPTIONS_VERSION >= 2
+'	pwcsTemplateFile As PCWSTR /' version 2 or above
+'#endif
+End Type
+
+Declare Function StgCreateStorageEx Lib "ole32" (
+	ByVal pwcsName As *OLECHAR,
+	ByVal grfMode As DWord,
+	ByVal stgfmt As DWord,
+	ByVal grfAttrs As DWord,
+	ByVal pStgOptions As *STGOPTIONS,
+	ByVal reserved As VoidPtr,
+	ByRef riid As IID,
+	ByRef pObjectOpen As Any) As HRESULT
+
+Declare Function StgOpenStorageEx Lib "ole32" (
+	ByVal pwcsName As *OLECHAR,
+	ByVal grfMode As DWord,
+	ByVal stgfmt As DWord,
+	ByVal grfAttrs As DWord,
+	ByVal pStgOptions As *STGOPTIONS,
+	ByVal reserved As VoidPtr,
+	ByRef riid As IID,
+	ByRef pObjectOpen As Any) As HRESULT
+
+
+' Moniker APIs
+
+Declare Function BindMoniker Lib "ole32" (pmk As *IMoniker, grfOpt As DWord, ByRef iidResult As IID, ByRef pvResult As Any) As HRESULT
+/*
+Declare Function CoInstall Lib "ole32" (
+	ByVal pbc As *IBindCtx,
+	ByVal dwFlags As DWord,
+	ByRef pClassSpec As uCLSSPEC,
+	ByRef pQuery As QUERYCONTEXT,
+	ByVal pszCodeBase As PWSTR) As HRESULT
+*/
+Declare Function CoGetObject Lib "ole32" (pszName As PCWSTR, pBindOptions As *BIND_OPTS, ByRef riid As IID, ByRef ppv As Any) As HRESULT
+Declare Function MkParseDisplayName Lib "ole32" (pbc As *IBindCtx, szUserName As LPCOLESTR, ByRef pchEaten As DWord, ByRef pmk As *IMoniker) As HRESULT
+Declare Function MonikerRelativePathTo Lib "ole32" (pmkSrc As *IMoniker, pmkDest As *IMoniker, ByRef pmkRelPath As *IMoniker, dwReserved As BOOL) As HRESULT
+Declare Function MonikerCommonPrefixWith Lib "ole32" (pmkThis As *IMoniker, pmkOther As *IMoniker, ByRef ppmkCommon As *IMoniker) As HRESULT
+Declare Function CreateBindCtx Lib "ole32" (reserved As DWord, ByRef pbc As *IBindCtx) As HRESULT
+Declare Function CreateGenericComposite Lib "ole32" ( pmkFirst As *IMoniker, pmkRest As *IMoniker, ByRef pmkComposite As *IMoniker) As HRESULT
+Declare Function GetClassFile Lib "ole32" (szFilename As LPCOLESTR, ByRef clsid As CLSID) As HRESULT
+Declare Function CreateClassMoniker Lib "ole32" (ByRef rclsid As CLSID, ByRef pmk As *IMoniker) As HRESULT
+Declare Function CreateFileMoniker Lib "ole32" (lpszPathName As LPCOLESTR, ByRef pmk As *IMoniker) As HRESULT
+Declare Function CreateItemMoniker Lib "ole32" (lpszDelim As LPCOLESTR, lpszItem As LPCOLESTR, ByRef pmk As *IMoniker) As HRESULT
+Declare Function CreateAntiMoniker Lib "ole32" (ByRef pmk As *IMoniker) As HRESULT
+Declare Function CreatePointerMoniker Lib "ole32" (punk As *IUnknown, ByRef pmk As *IMoniker) As HRESULT
+Declare Function CreateObjrefMoniker Lib "ole32" (punk As *IUnknown, ByRef pmk As *IMoniker) As HRESULT
+Declare Function  GetRunningObjectTable Lib "ole32" (reserved As DWord, ByRef prot As *IRunningObjectTable) As HRESULT
+
+Interface IBindStatusCallback ' urlmon.sbp
+	Inherits IUnknown
+End Interface
+'#require <urlmon.sbp>
+'#require <propidl.sbp>
+
+' Standard Progress Indicator impolementation
+
+Declare Function CreateStdProgressIndicator Lib "ole32" (
+	ByVal hwndParent As HWND,
+	ByVal pszTitle As LPCOLESTR,
+	ByVal pIbscCaller As *IBindStatusCallback,
+	ByRef pIbsc As *IBindStatusCallback) As HRESULT
Index: /trunk/ab5.0/ablib/src/objidl.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/objidl.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/objidl.sbp	(revision 506)
@@ -0,0 +1,1063 @@
+'Include/objidl.sbp
+
+TypeDef SNB = **OLECHAR
+
+Type COSERVERINFO
+	dwReserved1 As DWord
+	pwszName As LPWSTR
+	pAuthInfo As *COAUTHINFO
+	dwReserved2 As DWord
+End Type
+
+/* interface IMarshal */
+/* [uuid][object][local] */
+
+Dim IID_IMarshal = [&h00000003, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IMarshal
+	Inherits IUnknown
+
+	Function GetUnmarshalClass(
+		/* [in] */ ByRef iid As IID,
+		/* [unique][in] */ pv As VoidPtr,
+		/* [in] */ dwDestContext As DWord,
+		/* [unique][in] */ pvDestContext As VoidPtr,
+		/* [in] */ mshlflags As DWord,
+		/* [out] */ ByRef Cid As CLSID) As HRESULT
+	Function GetMarshalSizeMax(
+		/* [in] */ ByRef iid As IID,
+		/* [unique][in] */ pv As VoidPtr,
+		/* [in] */ dwDestContext As DWord,
+		/* [unique][in] */ pvDestContext As VoidPtr,
+		/* [in] */ mshlflags As DWord,
+		/* [out] */ ByRef Size As DWord) As HRESULT
+	Function MarshalInterface(
+		/* [unique][in] */ pStm As IStream,
+		/* [in] */ ByRef iid As IID,
+		/* [unique][in] */ pv As VoidPtr,
+		/* [in] */ dwDestContext As DWord,
+		/* [unique][in] */ pvDestContext As VoidPtr,
+		/* [in] */ mshlflags As DWord) As HRESULT
+	Function UnmarshalInterface(
+		/* [unique][in] */ pStm As IStream,
+		/* [in] */ ByRef iid As IID,
+		/* [out] */ ByRef ppv As VoidPtr) As HRESULT
+	Function ReleaseMarshalData(
+		/* [unique][in] */ pStm As *IStream) As HRESULT
+	Function DisconnectObject(
+		/* [in] */ dwReserved As DWord) As HRESULT
+End Interface
+
+/* interface IMarshal2 */
+/* [uuid][object][local] */
+
+Dim IID_IMarshal2 = [&h000001Cf, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IMarshal2
+	Inherits IMarshal
+End Interface
+
+/* interface IMalloc */
+/* [uuid][object][local] */
+
+Dim IID_IMalloc = [&h00000002, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IMalloc
+	Inherits IUnknown
+
+	Function Alloc(
+		/* [in] */ cb As SIZE_T) As VoidPtr
+	Function Realloc(
+		/* [in] */ pv As VoidPtr,
+		/* [in] */ cb As SIZE_T) As VoidPtr
+	Sub Free(
+		/* [in] */ pv As VoidPtr)
+	Function GetSize(pv As VoidPtr) As SIZE_T
+	Function DidAlloc(pv As VoidPtr) As Long
+	Sub HeapMinimize()
+End Interface
+
+/* interface IMallocSpy */
+/* [uuid][object][local] */
+
+Dim IID_IMallocSpy = [&h0000001d, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IMallocSpy
+	Inherits IUnknown
+
+	Function PreAlloc(
+		/* [in] */ cbRequest As SIZE_T) As HRESULT
+	Function PostAlloc(
+		/* [in] */ pActual As VoidPtr) As VoidPtr
+	Function PreFree(
+		/* [in] */ pRequest As VoidPtr,
+		/* [in] */ fSpyed As BOOL) As VoidPtr
+	Sub PostFree(
+		/* [in] */ fSpyed As BOOL)
+	Function PreRealloc(
+		/* [in] */ pRequest As VoidPtr,
+		/* [in] */ cbRequestt As SIZE_T,
+		/* [out] */ ByRef ppNewRequest As VoidPtr,
+		/* [in] */ fSpyed As BOOL) As HRESULT
+	Function PostRealloc(
+		/* [in] */ pActual As VoidPtr,
+		/* [in] */ fSpyed As BOOL) As VoidPtr
+	Function PreGetSize(
+		/* [in] */ pRequest As VoidPtr,
+		/* [in] */ fSpyed As BOOL) As VoidPtr
+	Function PostGetSize(
+		/* [in] */ cbActual As SIZE_T,
+		/* [in] */ fSpyed As BOOL) As HRESULT
+	Function PreDidAlloc(
+		/* [in] */ pRequest As VoidPtr,
+		/* [in] */ fSpyed As BOOL) As VoidPtr
+	Function PostDidAlloc(
+		/* [in] */ pRequest As VoidPtr,
+		/* [in] */ fSpyed As BOOL,
+		/* [in] */ fActual As Long) As Long
+	Sub PreHeapMinimize()
+	Sub PostHeapMinimize()
+End Interface
+
+/* interface IStdMarshalInfo */
+/* [uuid][object][local] */
+
+Dim IID_IStdMarshalInfo = [&h00000018, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+
+Interface IStdMarshalInfo
+	Inherits IUnknown
+
+	Function GetClassForHandler(
+		/* [in] */ dwDestContext As DWord,
+		/* [unique][in] */ pvDestContext As VoidPtr,
+		/* [out] */ ByRef clsid As CLSID) As HRESULT
+End Interface
+
+/* interface IExternalConnection */
+/* [uuid][local][object] */
+
+Const Enum EXTCONN
+	EXTCONN_STRONG = 1
+	EXTCONN_WEAK = 2
+	EXTCONN_CALLABLE = 4
+End Enum
+
+Dim IID_IExternalConnection = [&h00000019, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+
+Interface IExternalConnection
+	Inherits IUnknown
+
+	Function AddConnection(
+		/* [in] */ extconn As DWord,
+		/* [in] */ reserved As DWord) As DWord
+	Function ReleaseConnection(
+		/* [in] */ extconn As DWord,
+		/* [in] */ reserved As DWord,
+		/* [in] */ fLastReleaseCloses As BOOL) As DWord
+End Interface
+
+Type MULTI_QI
+	pIID As * /*Const*/ IID
+	pItf As IUnknown
+	hr As HRESULT
+End Type
+
+Dim IID_IMultiQI = [&h00000020, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IMultiQI
+	Inherits IUnknown
+
+	Function QueryMultipleInterfaces(
+		/* [in] */ cMQIs As DWord,
+		/* [out][in] */ pMQIs As *MULTI_QI) As HRESULT
+End Interface
+
+/* interface AsyncIMultiQI */
+/* [uuid][local][object] */
+
+
+Dim IID_AsyncIMultiQI = [&h000e0020, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface AsyncIMultiQI
+	Inherits IUnknown
+
+	Function Begin_QueryMultipleInterfaces(
+		/* [in] */ cMQIs As DWord,
+		/* [out][in] */ pMQIs As *MULTI_QI) As HRESULT
+	Function Finish_QueryMultipleInterfaces(
+		/* [out][in] */ pMQIs As *MULTI_QI) As HRESULT
+End Interface
+
+/* interface IInternalUnknown */
+/* [uuid][local][object] */
+Dim IID_IInternalUnknown = [&h00000021, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IInternalUnknown
+	Inherits IUnknown
+
+	Function QueryInternalInterface(
+		/* [in] */ ByRef riid As IID,
+		/* [out] */ ByRef ppv As Any) As HRESULT
+End Interface
+
+/* interface IEnumUnknown */
+/* [unique][uuid][object] */
+
+Dim IID_IEnumUnknown = [&h00000100, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IEnumUnknown
+	Inherits IUnknown
+
+	/* [local] */ Function Next(
+		/* [in] */ celt As DWord,
+		/* [out] */ rgelt As *IUnknown,
+		/* [out] */ ByRef celtFetched As DWord) As HRESULT
+	Function Skip(
+		/* [in] */ celt As DWord) As HRESULT
+	Function Reset() As HRESULT
+	Function Clone(
+		/* [out] */ ByRef enumUnk As IEnumUnknown) As HRESULT
+End Interface
+
+/* interface IBindCtx */
+/* [unique][uuid][object] */
+
+Type BIND_OPTS
+	cbStruct As DWord
+	grfFlags As DWord
+	grfMode As DWord
+	dwTickCountDeadline As DWord
+End Type
+
+Type BIND_OPTS2
+'	Inherits BIND_OPTS
+	cbStruct As DWord
+	grfFlags As DWord
+	grfMode As DWord
+	dwTickCountDeadline As DWord
+
+	dwTrackFlags As DWord
+	dwClassContext As DWord
+	locale As LCID
+	pServerInfo As *COSERVERINFO
+End Type
+
+Type BIND_OPTS3
+'	Inherits BIND_OPTS
+	cbStruct As DWord
+	grfFlags As DWord
+	grfMode As DWord
+	dwTickCountDeadline As DWord
+
+	dwTrackFlags As DWord
+	dwClassContext As DWord
+	locale As LCID
+	pServerInfo As *COSERVERINFO
+
+	hwnd As HWND
+End Type
+
+Const Enum BIND_FLAGS
+	BIND_MAYBOTHERUSER
+	BIND_JUSTTESTEXISTENCE
+End Enum
+
+Dim IID_IBindCtx = [&h0000000E, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IBindCtx
+	Inherits IUnknown
+
+	Function RegisterObjectBound(
+		/* [unique][in] */ punk As IUnknown) As HRESULT
+	Function RevokeObjectBound(
+		/* [unique][in] */ punk As IUnknown) As HRESULT
+	Function ReleaseBoundObjects() As HRESULT
+	/* [local] */ Function SetBindOptions(
+		/* [in] */ ByRef bindopts As BIND_OPTS) As HRESULT
+	/* [local] */ Function GetBindOptions(
+		/* [out][in] */ ByRef bindopts As BIND_OPTS) As HRESULT
+	Function GetRunningObjectTable(
+		/* [out] */ ByRef rot As IRunningObjectTable) As HRESULT
+	Function RegisterObjectParam(
+		/* [in] */ pszKey As LPOLESTR,
+		/* [unique][in] */ unk As IUnknown) As HRESULT
+	Function GetObjectParam(
+		/* [in] */ pszKey As LPOLESTR,
+		/* [out] */ ByRef unk As IUnknown) As HRESULT
+	Function EnumObjectParam(
+		/* [out] */ ByRef enumstr As IEnumString) As HRESULT
+	Function RevokeObjectParam(
+		/* [in] */ pszKey As LPOLESTR) As HRESULT
+End Interface
+
+/* interface IEnumMoniker */
+/* [unique][uuid][object] */
+
+Dim IID_IEnumMoniker = [&h00000102, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IEnumMoniker
+	Inherits IUnknown
+	/* [local] */ Function Next_(
+		/* [in] */ celt As DWord,
+		/* [length_is][size_is][out] */ rgelt As *IMoniker,
+		/* [out] */ ByRef celtFetched As DWord) As HRESULT
+	Function Skip(
+		/* [in] */ celt As DWord) As HRESULT
+	Function Reset() As HRESULT
+	Function Clone(
+		/* [out] */ enumMon As IEnumMoniker) As HRESULT
+End Interface
+
+/* interface IRunningObjectTable */
+/* [uuid][object] */
+
+Dim IID_IRunningObjectTable = [&h00000010, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IRunningObjectTable
+	Inherits IUnknown
+
+	Function Register(
+		/* [in] */ grfFlags As DWord,
+		/* [unique][in] */ unkObject As IUnknown,
+		/* [unique][in] */ mkObjectName As IMoniker,
+		/* [out] */ ByRef dwRegister As DWord) As HRESULT
+	Function Revoke(
+		/* [in] */ dwRegister As DWord) As HRESULT
+	Function IsRunning(
+		/* [unique][in] */ mkObjectName As IMoniker) As HRESULT
+	Function GetObject(
+		/* [unique][in] */ mkObjectName As IMoniker,
+		/* [out] */ ByRef unkObject As IUnknown) As HRESULT
+	Function NoteChangeTime(
+		/* [in] */ dwRegister As DWord,
+		/* [in] */ ByRef filetime As FILETIME) As HRESULT
+	Function GetTimeOfLastChange(
+		/* [unique][in] */ mkObjectName As IMoniker,
+		/* [in] */ ByRef filetime As FILETIME) As HRESULT
+	Function EnumRunning(
+		/* [out] */ ByRef enumMoniker As IEnumMoniker) As HRESULT
+End Interface
+
+Dim IID_IPersist = [&h0000010c, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IPersist
+	Inherits IUnknown
+
+	Function GetClassID(
+		/* [out] */ ByRef ClassID As CLSID) As HRESULT
+End Interface
+
+Dim IID_IPersistStream = [&h00000109, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IPersistStream
+	Inherits IPersist
+
+	Function IsDirty() As HRESULT
+
+	Function Load(
+		/* [unique][in] */ Stm As IStream) As HRESULT
+	Function Save(
+		/* [unique][in] */ Stm As IStream,
+		/* [in] */ fClearDirty As BOOL) As HRESULT
+	Function GetSizeMax(
+		/* [out] */ ByRef cbSize As ULARGE_INTEGER) As HRESULT
+End Interface
+
+/* interface IMoniker */
+/* [unique][uuid][object] */
+
+Const Enum MKSYS
+	MKSYS_NONE = 0
+	MKSYS_GENERICCOMPOSITE = 1
+	MKSYS_FILEMONIKER = 2
+	MKSYS_ANTIMONIKER = 3
+	MKSYS_ITEMMONIKER = 4
+	MKSYS_POINTERMONIKER = 5
+	MKSYS_CLASSMONIKER = 7
+	MKSYS_OBJREFMONIKER = 8
+	MKSYS_SESSIONMONIKER = 9
+	MKSYS_LUAMONIKER = 10
+End Enum
+
+/* [v1_enum] */ Const Enum MKREDUCE
+	MKRREDUCE_ONE = (3 << 16)
+	MKRREDUCE_TOUSER = (2 << 16)
+	MKRREDUCE_THROUGHUSER = (1 << 16)
+	MKRREDUCE_ALL = 0
+End Enum
+
+Dim IID_IMoniker = [&h0000000f, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IMoniker
+	Inherits IPersistStream
+
+	/* [local] */ Function BindToObject(
+		/* [unique][in] */ bc As IBindCtx,
+		/* [unique][in] */ mkToLeft As IMoniker,
+		/* [in] */ ByRef riidResult As IID,
+		/* [iid_is][out] */ ByRef Result As Any) As HRESULT
+	/* [local] */ Function BindToStorage(
+		/* [unique][in] */ bc As IBindCtx,
+		/* [unique][in] */ mkToLeft As IMoniker,
+		/* [in] */ ByRef riid As IID,
+		/* [iid_is][out] */ ByRef Obj As Any) As HRESULT
+	Function Reduce(
+		/* [unique][in] */ bc As IBindCtx,
+		/* [in] */ dwReduceHowFar As DWord,
+		/* [unique][out][in] */ ByRef mkToLeft As IMoniker,
+		/* [out] */ ByRef mkReduced As IMoniker) As HRESULT
+	Function ComposeWith(
+		/* [unique][in] */ ByRef mkRight As IMoniker,
+		/* [in] */ fOnlyIfNotGeneric As BOOL,
+		/* [out] */ ByRef mkComposite As IMoniker) As HRESULT
+	Function Enum_(
+		/* [in] */ fForward As BOOL,
+		/* [out] */ ByRef enumMoniker As IEnumMoniker) As HRESULT
+	Function IsEqual(
+		/* [unique][in] */ mkOtherMoniker As IMoniker) As HRESULT
+	Function Hash(
+		/* [out] */ ByRef dwHash As DWord) As HRESULT
+	Function IsRunning(
+		/* [unique][in] */ bc As IBindCtx,
+		/* [unique][in] */ mkToLeft As IMoniker,
+		/* [unique][in] */ mkNewlyRunning As IMoniker) As HRESULT
+	Function GetTimeOfLastChange(
+		/* [unique][in] */ bc As IBindCtx,
+		/* [unique][in] */ mkToLeft As IMoniker,
+		/* [out] */ ByRef FileTime As FILETIME) As HRESULT
+	Function Inverse(
+		/* [out] */ ByRef mk As IMoniker) As HRESULT
+	Function CommonPrefixWith(
+		/* [unique][in] */ mkOther As IMoniker,
+		/* [out] */ ByRef mkPrefix As IMoniker) As HRESULT
+	Function RelativePathTo(
+		/* [unique][in] */ mkOther As IMoniker,
+		/* [out] */ ByRef mkRelPath As IMoniker) As HRESULT
+	Function GetDisplayName(
+		/* [unique][in] */ bc As IBindCtx,
+		/* [unique][in] */ mkToLeft As IMoniker,
+		/* [out] */ ByRef pszDisplayName As LPOLESTR) As HRESULT
+	Function ParseDisplayName(
+		/* [unique][in] */ bc As IBindCtx,
+		/* [unique][in] */ mkToLeft As IMoniker,
+		/* [in] */  pszDisplayName As LPOLESTR,
+		/* [out] */ ByRef chEaten As DWord,
+		/* [out] */ ByRef mkOut As IMoniker) As HRESULT
+	Function IsSystemMoniker(
+		/* [out] */ ByRef dwMksys As DWord) As HRESULT
+End Interface
+
+/* interface IEnumString */
+/* [unique][uuid][object] */
+
+Dim IID_IEnumString = [&h00000101, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IEnumString
+	Inherits IUnknown
+
+	/* [local] */ Function Next_(
+		/* [in] */ celt As DWord,
+		/* [length_is][size_is][out] */ ByRef rgelt As LPOLESTR,
+		/* [out] */ ByRef celtFetched As DWord) As HRESULT
+	Function Skip(
+		/* [in] */ celt As DWord) As HRESULT
+	Function Reset() As HRESULT
+	Function Clone(
+		/* [out] */ ByRef enumstr As IEnumString) As HRESULT
+End Interface
+
+/* interface ISequentialStream */
+/* [unique][uuid][object] */
+
+Dim IID_ISequentialStream = [&h0c733a30, &h2a1c, &h11ce, [&had, &he5, &h00, &haa, &h00, &h44, &h77, &h3d]] As IID
+Interface ISequentialStream
+	Inherits IUnknown
+
+	Function Read(
+		/* [length_is][size_is][out] */ pv As VoidPtr,
+		/* [in] */ cb As DWord,
+		/* [out] */ ByRef cbRead As DWord) As HRESULT
+	Function Write(
+		/* [size_is][in] */ pv As VoidPtr,
+		/* [in] */ cb As DWord,
+		/* [out] */ ByRef cbWritten As DWord) As HRESULT
+End Interface
+
+/* interface IStream */
+/* [unique][uuid][object] */
+
+Type STATSTG
+	pwcsName As LPOLESTR
+	type_ As DWord
+	cbSize As ULARGE_INTEGER
+	mtime As FILETIME
+	ctime As FILETIME
+	atime As FILETIME
+	grfMode As DWord
+	grfLocksSupported As DWord
+	clsid As CLSID
+	grfStateBits As DWord
+	reserved As DWord
+End Type
+
+Enum STGTY
+	STGTY_STORAGE = 1
+	STGTY_STREAM = 2
+	STGTY_LOCKBYTES = 3
+	STGTY_PROPERTY = 4
+End Enum
+
+Enum STREAM_SEEK
+	STREAM_SEEK_SET = 0
+	STREAM_SEEK_CUR = 1
+	STREAM_SEEK_END = 2
+End Enum
+
+Enum LOCKTYPE
+	LOCK_WRITE = 1
+	LOCK_EXCLUSIVE = 2
+	LOCK_ONLYONCE = 4
+End Enum
+
+Dim IID_IStream = [&h0000000c, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IStream
+	Inherits ISequentialStream
+
+	/* [local] */ Function Seek(
+		/* [in] */ dlibMove As LARGE_INTEGER,
+		/* [in] */ dwOrigin As DWord,
+		/* [out] */ plibNewPosition As *ULARGE_INTEGER) As HRESULT
+	Function SetSize(
+		/* [in] */ libNewSize As ULARGE_INTEGER) As HRESULT
+	/* [local] */ Function CopyTo(
+		/* [unique][in] */ stm As IStream,
+		/* [in] */ cb As ULARGE_INTEGER,
+		/* [out] */ pcbRead As *ULARGE_INTEGER,
+		/* [out] */ pcbWritten As *ULARGE_INTEGER) As HRESULT
+	Function Commit(
+		/* [in] */ grfCommitFlags As DWord) As HRESULT
+	Function Revert() As HRESULT
+	Function LockRegion(
+		/* [in] */ libOffset As ULARGE_INTEGER,
+		/* [in] */ cb As ULARGE_INTEGER,
+		/* [in] */ dwLockType As DWord) As HRESULT
+	Function UnlockRegion(
+		/* [in] */ libOffset As ULARGE_INTEGER,
+		/* [in] */ cb As ULARGE_INTEGER,
+		/* [in] */ dwLockType As DWord) As HRESULT
+	Function Stat(
+		/* [out] */ pstatstg As *STATSTG,
+		/* [in] */ grfStatFlag As DWord) As HRESULT
+	Function Clone(
+		/* [out] */ ByRef stm As IStream) As HRESULT
+End Interface
+
+/* interface IEnumSTATSTG */
+/* [unique][uuid][object] */
+
+Dim IID_IEnumSTATSTG = [&h0000000d, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IEnumSTATSTG
+	Inherits IUnknown
+
+	/* [local] */ Function Next_(
+		/* [in] */ celt As DWord,
+		/* [length_is][size_is][out] */ rgelt As *STATSTG,
+		/* [out] */ ByRef celtFetched As DWord) As HRESULT
+	Function Skip(
+		/* [in] */ celt As DWord) As HRESULT
+	Function Reset() As HRESULT
+	Function Clone(
+		/* [out] */ ByRef enumStat As IEnumSTATSTG) As HRESULT
+End Interface
+
+/* interface IStorage */
+/* [unique][uuid][object] */
+
+Type RemSNB
+	ulCntStr As DWord
+	ulCntChar As DWord
+	rgString[ELM(1)] As OLECHAR
+End Type
+
+TypeDef wireSNB /* [unique] */ = *RemSNB
+
+TypeDef SNB = /* [wire_marshal] */ **OLECHAR
+
+Dim IID_IStorage = [&h0000000b, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IStorage
+	Inherits IUnknown
+
+	Function CreateStream(
+		/* [string][in] */ pwcsName As *OLECHAR,
+		/* [in] */ grfMode As DWord,
+		/* [in] */ reserved1 As DWord,
+		/* [in] */ reserved2 As DWord,
+		/* [out] */ ByRef stm As IStream) As HRESULT
+	/* [local] */ Function OpenStream(
+		/* [string][in] */ pwcsName As *OLECHAR,
+		/* [unique][in] */ reserved1 As VoidPtr,
+		/* [in] */ grfMode As DWord,
+		/* [in] */ reserved2 As DWord,
+		/* [out] */ ByRef stm As IStream) As HRESULT
+	Function CreateStorage(
+		/* [string][in] */ pwcsName As *OLECHAR,
+		/* [in] */ grfMode As DWord,
+		/* [in] */ reserved1 As DWord,
+		/* [in] */ reserved2 As DWord,
+		/* [out] */ ByRef stg As IStorage) As HRESULT
+	Function OpenStorage(
+		/* [string][unique][in] */ pwcsName As *OLECHAR,
+		/* [unique][in] */ pstgPriority As IStorage,
+		/* [in] */ grfMode As DWord,
+		/* [unique][in] */ snbExclude As SNB,
+		/* [in] */ reserved As DWord,
+		/* [out] */ ByRef stg As IStorage) As HRESULT
+	/* [local] */ Function CopyTo(
+		/* [in] */ ciidExclude As DWord,
+		/* [size_is][unique][in] */ rgiidExclude As * /*Const*/ IID,
+		/* [unique][in] */ snbExclude As SNB,
+		/* [unique][in] */ stgDest As IStorage) As HRESULT
+	Function MoveElementTo(
+		/* [string][in] */ pwcsName As *OLECHAR,
+		/* [unique][in] */ stgDest As IStorage,
+		/* [string][in] */ pwcsNewName As *OLECHAR,
+		/* [in] */ grfFlags As DWord) As HRESULT
+	Function Commit(
+		/* [in] */ grfCommitFlags As DWord) As HRESULT
+	Function Revert() As HRESULT
+	/* [local] */ Function EnumElements(
+		/* [in] */ reserved1 As DWord,
+		/* [size_is][unique][in] */ reserved2 As VoidPtr,
+		/* [in] */ reserved3 As DWord,
+		/* [out] */ ByRef enum_ As IEnumSTATSTG) As HRESULT
+	Function DestroyElement(
+		/* [string][in] */ pwcsName As *OLECHAR) As HRESULT
+	Function RenameElement(
+		/* [string][in] */ pwcsOldName As *OLECHAR,
+		/* [string][in] */ pwcsNewName As *OLECHAR) As HRESULT
+	Function SetElementTimes(
+		/* [string][unique][in] */ pwcsName As *OLECHAR,
+		/* [unique][in] */ ByRef ctime As /*Const*/ FILETIME,
+		/* [unique][in] */ ByRef atime As /*Const*/ FILETIME,
+		/* [unique][in] */ ByRef mtime As /*Const*/ FILETIME) As HRESULT
+	Function SetClass(
+		/* [in] */ ByRef clsid As CLSID) As HRESULT
+	Function SetStateBits(
+		/* [in] */ grfStateBits As DWord,
+		/* [in] */ grfMask As DWord) As HRESULT
+	Function Stat(
+		/* [out] */ ByRef statstg As STATSTG,
+		/* [in] */ grfStatFlag As DWord) As HRESULT
+End Interface
+
+/* interface IPersistFile */
+/* [unique][uuid][object] */
+
+Dim IID_IPersistFile = [&h0000010b, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IPersistFile
+	Inherits IPersist
+
+	Function IsDirty() As HRESULT
+	Function Load(
+		/* [in] */ pszFileName As LPCOLESTR,
+		/* [in] */ dwMode As DWord) As HRESULT
+	Function Save(
+		/* [unique][in] */ pszFileName As LPCOLESTR,
+		/* [in] */ fRemember As BOOL) As HRESULT
+	Function SaveCompleted(
+		/* [unique][in] */ pszFileName As LPCOLESTR) As HRESULT
+	Function GetCurFile(
+		/* [out] */ ByRef pszFileName As LPOLESTR) As HRESULT
+End Interface
+
+/* interface IPersistStorage */
+/* [unique][uuid][object] */
+
+Dim IID_IPersistStorage = [&h0000010a, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IPersistStorage
+	Inherits IPersist
+
+	Function IsDirty() As HRESULT
+	Function InitNew(
+		/* [unique][in] */ Stg As IStorage) As HRESULT
+	Function Load(
+		/* [unique][in] */ Stg As IStorage) As HRESULT
+	Function Save(
+		/* [unique][in] */ StgSave As IStorage,
+		/* [in] */ fSameAsLoad As BOOL) As HRESULT
+	Function SaveCompleted(
+		/* [unique][in] */ StgNew As IStorage) As HRESULT
+	Function HandsOffStorage() As HRESULT
+End Interface
+
+/* interface ILockBytes */
+/* [unique][uuid][object] */
+
+Dim IID_ILockBytes = [&h0000000a, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface ILockBytes
+	Inherits IUnknown
+
+	/* [local] */ Function ReadAt(
+		/* [in] */ ulOffset As ULARGE_INTEGER,
+		/* [length_is][size_is][out] */ pv As VoidPtr,
+		/* [in] */ cb As DWord,
+		/* [out] */ ByRef cbRead As DWord) As HRESULT
+	/* [local] */ Function WriteAt(
+		/* [in] */ ulOffset As ULARGE_INTEGER,
+		/* [size_is][in] */ pv As VoidPtr,
+		/* [in] */ cb As DWord,
+		/* [out] */ ByRef cbWritten As DWord) As HRESULT
+	Function Flush() As HRESULT
+	Function SetSize(
+	/* [in] */ cb As ULARGE_INTEGER) As HRESULT
+	Function LockRegion(
+		/* [in] */ libOffset As ULARGE_INTEGER,
+		/* [in] */ cb As ULARGE_INTEGER,
+		/* [in] */ dwLockType As DWord) As HRESULT
+	Function UnlockRegion(
+		/* [in] */ libOffset As ULARGE_INTEGER,
+		/* [in] */ cb As ULARGE_INTEGER,
+		/* [in] */ dwLockType As DWord) As HRESULT
+	Function Stat(
+		/* [out] */ ByRef statstg As STATSTG,
+		/* [in] */ grfStatFlag As DWord) As HRESULT
+End Interface
+
+Type DVTARGETDEVICE
+	tdSize As DWord
+	tdDriverNameOffset As Word
+	tdDeviceNameOffset As Word
+	tdPortNameOffset As Word
+	tdExtDevmodeOffset As Word
+	tdData[ELM(1)] As Byte
+End Type
+
+TypeDef LPCLIPFORMAT = *CLIPFORMAT
+
+Type FORMATETC
+	cfFormat As CLIPFORMAT
+	ptd As *DVTARGETDEVICE
+	dwAspect As DWord
+	lindex As Long
+	tymed As DWord
+End Type
+
+TypeDef LPFORMATETC = *FORMATETC
+
+Interface IEnumFORMATETC
+	Inherits IUnknown
+End Interface
+
+Interface IEnumSTATDATA
+	Inherits IUnknown
+End Interface
+
+/* interface IRootStorage */
+/* [unique][uuid][object] */
+
+Dim IID_IRootStorage = [&h00000012, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IRootStorage
+	Inherits IUnknown
+
+	Function SwitchToFile(
+		/* [in] */ pszFile As LPOLESTR) As HRESULT
+End Interface
+
+/* interface IAdviseSink */
+/* [unique][async_uuid][uuid][object] */
+
+Enum /*[transmit_as(long)]*/ TYMED
+	TYMED_HGLOBAL = 1
+	TYMED_FILE = 2
+	TYMED_ISTREAM = 4
+	TYMED_ISTORAGE = 8
+	TYMED_GDI = 16
+	TYMED_MFPICT = 32
+	TYMED_ENHMF = 64
+	TYMED_NULL = 0
+End Enum
+
+Type RemSTGMEDIUM
+	tymed As DWord
+	dwHandleType As DWord
+	pData As DWord
+	pUnkForRelease As DWord
+	cbData As DWord
+	data[ELM(1)] As Byte
+End Type
+
+/* [wire_marshal] */ Type STGMEDIUM
+	tymed As DWord
+	data As VoidPtr
+'	/* [switch_type(DWORD), switch_is((DWORD) tymed)] */
+'	Union
+'		/*[case(TYMED_GDI)]*/      hBitmap As HBITMAP
+'		/*[case(TYMED_MFPICT)]*/   hMetaFilePict As HMETAFILEPICT
+'		/*[case(TYMED_ENHMF)]*/    hEnhMetaFile As HENHMETAFILE
+'		/*[case(TYMED_HGLOBAL)]*/  hGlobal As HGLOBAL
+'		/*[case(TYMED_FILE)]*/     lpszFileName As LPWSTR
+'		/*[case(TYMED_ISTREAM)]*/  pstm As *IStream
+'		/*[case(TYMED_ISTORAGE)]*/ pstg As *IStorage
+'		/*[default]*/
+'	End Union
+	/*[unique]*/ pUnkForRelease As *IUnknown
+End Type
+
+Type GDI_OBJECT
+'	ObjectType As DWord
+'	/* [switch_type] */ u As Union
+'		hBitmap As wireHBITMAP
+'		hPalette As wireHPALETTE
+'		hGeneric As wireHGLOBAL
+'	End Union
+End Type
+
+Type userSTGMEDIUM
+'	tymed As DWord
+'	/* [switch_type] */ u As Union
+'		/* Empty union arm */
+'		hMetaFilePict As wireHMETAFILEPICT
+'		hHEnhMetaFile As wireHENHMETAFILE
+'		hGdiHandle As *GDI_OBJECT
+'		hGlobal As wireHGLOBAL
+'		lpszFileName As LPOLESTR
+'		pstm As *BYTE_BLOB
+'		pstg As BYTE_BLOB
+'	End Union
+'	pUnkForRelease As IUnknown
+End Type
+
+TypeDef wireSTGMEDIUM = /* [unique] */ *userSTGMEDIUM
+TypeDef ASYNC_STGMEDIUM = /* [unique] */ *userSTGMEDIUM
+TypeDef wireSTGMEDIUM = /* [wire_marshal] */ STGMEDIUM
+
+Type userFLAG_STGMEDIUM
+'	ContextFlags As Long
+'	fPassOwnership As Long
+'	Stgmed As userSTGMEDIUM
+End Type
+
+TypeDef wireFLAG_STGMEDIUM = /* [unique] */ *userFLAG_STGMEDIUM
+
+Type /* [wire_marshal] */ FLAG_STGMEDIUM
+	ContextFlags As Long
+	fPassOwnership As Long
+	Stgmed As STGMEDIUM
+End Type
+
+Dim IID_IAdviseSink = [&h0000010f, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IAdviseSink
+	Inherits IUnknown
+
+	/* [local] */ Sub OnDataChange(
+		/* [unique][in] */ ByRef Formatetc As FORMATETC,
+		/* [unique][in] */ ByRef Stgmed As STGMEDIUM)
+	/* [local] */ Sub OnViewChange(
+		/* [in] */ dwAspect As DWord,
+		/* [in] */ lindex As Long)
+	/* [local] */ Sub OnRename(
+		/* [in] */ mk As IMoniker)
+	/* [local] */ Sub OnSave()
+	/* [local] */ Sub OnClose()
+End Interface
+
+' AsyncIAdviseSink
+
+' IAdviseSink2
+
+' AsyncIAdviseSink2
+
+Dim IID_IDataObject = [&h0000010e, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IDataObject
+	Inherits IUnknown
+
+	Function /* [local] */ GetData(
+		/* [unique][in] */ ByRef rformatetcIn As FORMATETC,
+		/* [out] */ ByRef rmedium As STGMEDIUM) As HRESULT
+	Function /* [local] */ GetDataHere(
+		/* [unique][in] */ ByRef rformatetcIn As FORMATETC,
+		/* [out] */ ByRef pmedium As STGMEDIUM) As HRESULT
+	Function QueryGetData(
+		/* [unique][in] */ ByRef pformatetc As FORMATETC) As HRESULT
+	Function GetCanonicalFormatEtc(
+		/* [unique][in] */ ByRef pformatetcIn As FORMATETC,
+		/* [out] */ ByRef pmedium As STGMEDIUM) As HRESULT
+	Function /* [local] */ SetData(
+		/* [unique][in] */ pformatetcIn As *FORMATETC,
+		/* [out] */ pmedium As *STGMEDIUM,
+		/* [in] */ fRelease As BOOL) As HRESULT
+	Function EnumFormatEtc(
+		/* [in] */ dwDirection As DWord,
+		/* [out] */ ByRef rpenumFormatEtc As IEnumFORMATETC) As HRESULT
+	Function DAdvise(
+		/* [in] */ ByRef pformatetc As FORMATETC,
+		/* [in] */ advf As DWord,
+		/* [unique][in] */ pAdvSink As IAdviseSink,
+		/* [out] */ pdwConnection As *DWord) As HRESULT
+	Function DUnadvise(
+		/* [in] */ dwConnection As DWord) As HRESULT
+	Function EnumDAdvise(
+		/* [out] */ ByRef rpenumAdvise As IEnumSTATDATA) As HRESULT
+End Interface
+
+Interface IDataAdviseHolder
+	Inherits IUnknown
+End Interface
+
+Enum CALLTYPE
+	CALLTYPE_TOPLEVEL = 1
+	CALLTYPE_NESTED = 2
+	CALLTYPE_ASYNC = 3
+	CALLTYPE_TOPLEVEL_CALLPENDING = 4
+	CALLTYPE_ASYNC_CALLPENDING = 5
+End Enum
+
+Enum ERVERCALL
+	SERVERCALL_ISHANDLED = 0
+	SERVERCALL_REJECTED = 1
+	SERVERCALL_RETRYLATER = 2
+End Enum
+
+Enum PENDINGTYPE
+	PENDINGTYPE_TOPLEVEL = 1
+	PENDINGTYPE_NESTED = 2
+End Enum
+
+Enum PENDINGMSG
+	PENDINGMSG_CANCELCALL = 0
+	PENDINGMSG_WAITNOPROCESS = 1
+	PENDINGMSG_WAITDEFPROCESS = 2
+End Enum
+
+Type INTERFACEINFO
+	pUnk As *IUnknown
+	iid As IID
+	wMethod As Word
+End Type
+TypeDef LPINTERFACEINFO = *INTERFACEINFO
+
+Dim IID_IMessageFilter = [&h00000016, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IMessageFilter
+	Inherits IUnknown
+
+	Function HandleInComingCall(
+		/* [in] */ dwCallType As DWord,
+		/* [in] */ htaskCaller As HTASK,
+		/* [in] */ dwTickCount As DWord,
+		/* [in] */ lpInterfaceInfo As LPINTERFACEINFO) As DWord
+	Function RetryRejectedCall(
+		/* [in] */ htaskCallee As HTASK,
+		/* [in] */ dwTickCount As DWord,
+		/* [in] */ dwRejectType As DWord) As DWord
+	Function MessagePending(
+		/* [in] */ htaskCallee As HTASK,
+		/* [in] */ dwTickCount As DWord,
+		/* [in] */ dwPendingType As DWord) As DWord
+End Interface
+
+' IRpcChannelBuffer
+
+' IRpcChannelBuffer2
+
+' IAsyncRpcChannelBuffer
+
+' IRpcChannelBuffer3
+
+' IRpcSyntaxNegotiate
+
+' IRpcProxyBuffer
+
+' IRpcStubBuffer
+
+' IPSFactoryBuffer
+
+' IChannelHook
+
+' IClientSecurity
+
+' IServerSecurity
+
+' IClassActivator
+
+' IRpcOptions
+
+Interface IFillLockBytes
+	Inherits IUnknown
+End Interface
+
+' IProgressNotify
+
+' ILayoutStorage
+
+' IBlockingLock
+
+' ITimeAndNoticeControl
+
+' IOplockStorage
+
+' ISurrogate
+
+Dim IID_IGlobalInterfaceTable = [&h00000146, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IGlobalInterfaceTable
+	Inherits IUnknown
+
+	Function RegisterInterfaceInGlobal(
+		/* [in] */ unk As IUnknown,
+		/* [in] */ ByRef riid As IID,
+		/* [out] */ ByRef dwCookie As DWord) As HRESULT
+	Function RevokeInterfaceFromGlobal(
+		/* [in] */ dwCookie As DWord) As HRESULT
+	Function GetInterfaceFromGlobal(
+		/* [in] */ dwCookie As DWord,
+		/* [in] */ ByRef riid As IID,
+		/* [iid_is][out] */ ByRef ppv As Any) As HRESULT
+End Interface
+
+' IDirectWriterLock
+
+' ISynchronize
+
+' ISynchronizeHandle
+
+' ISynchronizeEvent
+
+' ISynchronizeContainer
+
+' ISynchronizeMutex
+
+' ICancelMethodCalls
+
+' IAsyncManager
+
+' ICallFactory
+
+' IRpcHelper
+
+' IReleaseMarshalBuffers
+
+' IWaitMultiple
+
+' IUrlMon
+
+' IForegroundTransfer
+
+' IAddrTrackingControl
+
+' IAddrExclusionControl
+
+' IPipeByte
+
+' AsyncIPipeByte
+
+' IPipeLong
+
+' AsyncIPipeLong
+
+' IPipeDouble
+
+' AsyncIPipeDouble
+
+' IThumbnailExtractor
+
+' IDummyHICONIncluder
+
+' IEnumContextProps
+
+' IContext
+
+' IObjContext
+
+' IProcessLock
+
+' ISurrogateService
+
+' IComThreadingInfo
+
+' IProcessInitControl
+
+' IInitializeSpy
Index: /trunk/ab5.0/ablib/src/ole2.ab
===================================================================
--- /trunk/ab5.0/ablib/src/ole2.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/ole2.ab	(revision 506)
@@ -0,0 +1,307 @@
+' 暫定措置
+
+#require <api_winerror.sbp>
+
+#require <objbase.sbp>
+#require <oleauto.ab>
+#ifdef __UNDEFINED '#165が解決するまでの暫定
+' View OBJECT Error Codes
+
+Const E_DRAW = VIEW_E_DRAW
+
+' IDataObject Error Codes
+Const DATA_E_FORMATETC = DV_E_FORMATETC
+
+' Common stuff gleamed from OLE.2,
+
+/* verbs */
+Const OLEIVERB_PRIMARY           = (0)
+Const OLEIVERB_SHOW              = (-1)
+Const OLEIVERB_OPEN              = (-2)
+Const OLEIVERB_HIDE              = (-3)
+Const OLEIVERB_UIACTIVATE        = (-4)
+Const OLEIVERB_INPLACEACTIVATE   = (-5)
+Const OLEIVERB_DISCARDUNDOSTATE  = (-6)
+
+' for OleCreateEmbeddingHelper flags; roles in low word; options in high word
+Const EMBDHLP_INPROC_HANDLER  = &h0000
+Const EMBDHLP_INPROC_SERVER   = &h0001
+Const EMBDHLP_CREATENOW   = &h00000000
+Const EMBDHLP_DELAYCREATE = &h00010000
+
+/* extended create function flags */
+Const OLECREATE_LEAVERUNNING = &h00000001
+
+/* pull in the MIDL generated header */
+
+#require <oleidl.ab>
+
+/****** DV APIs ***********************************************************/
+
+/*
+#if    !defined(ISOLATION_AWARE_ENABLED) \
+    || !ISOLATION_AWARE_ENABLED \
+    || !defined(_OBJBASE_H_) \
+    || !defined(CreateDataAdviseHolder)
+WINOLEAPI CreateDataAdviseHolder(OUT LPDATAADVISEHOLDER FAR* ppDAHolder);
+#endif
+*/
+
+/****** OLE API Prototypes ************************************************/
+
+Declare Function OleBuildVersion Lib "ole32.dll" () As DWord
+
+/* helper functions */
+Declare Function ReadClassStg Lib "ole32.dll" (/*IN*/ ByVal stg As IStorage, /*OUT*/ ByRef clsid As CLSID) As HRESULT
+Declare Function WriteClassStg Lib "ole32.dll" (/*IN*/ ByVal stg As IStorage, /*IN*/ ByRef clsid As CLSID) As HRESULT
+Declare Function ReadClassStm Lib "ole32.dll" (/*IN*/ ByVal stm As IStream, /*OUT*/ ByRef clsid As CLSID) As HRESULT
+Declare Function WriteClassStm Lib "ole32.dll" (/*IN*/ ByVal stm As IStream, /*IN*/ ByRef clsid As CLSID) As HRESULT
+Declare Function WriteFmtUserTypeStg Lib "ole32.dll" (/*IN*/ ByVal stg As IStorage, /*IN*/ ByVal cf As CLIPFORMAT, /*IN*/ ByVal pszUserType As *OLECHAR) As HRESULT
+Declare Function ReadFmtUserTypeStg Lib "ole32.dll" (/*IN*/ ByVal stg As IStorage, /*OUT*/ ByRef cf As CLIPFORMAT, /*OUT*/ ByRef rpszUserType As *OLECHAR) As HRESULT
+
+
+/* init/term */
+
+Declare Function OleInitialize Lib "ole32" (pvReserved As VoidPtr) As HRESULT
+Declare Sub OleUninitialize Lib "ole32" ()
+
+
+/* APIs to query whether (Embedded/Linked) object can be created from
+   the data object */
+
+Declare Function OleQueryLinkFromData Lib "ole32" (/*IN*/ ByVal srcDataObject As IDataObject) As HRESULT
+Declare Function OleQueryCreateFromData Lib "ole32.dll" (/*IN*/ ByVal srcDataObject As IDataObject) As HRESULT
+
+
+/* Object creation APIs */
+
+Declare Function OleCreate Lib "ole32.dll" (/*IN*/ ByRef rclsid As CLSID, /*IN*/ ByRef riid As IID, /*IN*/ ByVal renderopt As DWord,
+	/*IN*/ ByVal pFormatEtc As *FORMATETC, /*IN*/ ByVal clientSite As IOleClientSite,
+	/*IN*/ ByVal stg As IStorage, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateEx Lib "ole32.dll" (/*IN*/ ByRef rclsid As CLSID, /*IN*/ ByRef riid As IID, /*IN*/ ByVal dwFlags As DWord,
+	/*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal cFormats As DWord, /*IN*/ ByVal rgAdvf As *DWord,
+	/*IN*/ ByVal rgFormatEtc As *FORMATETC, /*IN*/ ByVal adviseSink As IAdviseSink,
+	/*OUT*/ ByVal rgdwConnection As *DWord, /*IN*/ ByVal clientSite As IOleClientSite,
+	/*IN*/ ByVal stg As IStorage, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateFromData Lib "ole32.dll" (/*IN*/ ByVal srcDataObj As IDataObject, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal pFormatEtc As *FORMATETC,
+	/*IN*/ ByVal clientSite As IOleClientSite, /*IN*/ ByVal stg As IStorage,
+	/*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateFromDataEx Lib "ole32.dll" (/*IN*/ ByVal srcDataObj As IDataObject, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal dwFlags As DWord, /*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal cFormats As DWord, /*IN*/ ByVal rgAdvf As *DWord,
+	/*IN*/ ByVal rgFormatEtc As *FORMATETC, /*IN*/ ByVal adviseSink As IAdviseSink,
+	/*OUT*/ ByVal rgdwConnection As *DWord, /*IN*/ ByVal clientSite As IOleClientSite,
+	/*IN*/ ByVal stg As IStorage, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateLinkFromData Lib "ole32.dll" (/*IN*/ ByVal srcDataObj As IDataObject, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal pFormatEtc As *FORMATETC,
+	/*IN*/ ByVal clientSite As IOleClientSite, /*IN*/ ByVal stg As IStorage,
+	/*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateLinkFromDataEx Lib "ole32.dll" (/*IN*/ ByVal srcDataObj As IDataObject, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal dwFlags As DWord, /*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal cFormats As DWord, /*IN*/ ByVal rgAdvf As *DWord,
+	/*IN*/ ByVal rgFormatEtc As *FORMATETC, /*IN*/ ByVal adviseSink As IAdviseSink,
+	/*OUT IN*/ ByVal rgdwConnection As *DWord, /*IN*/ ByVal clientSite As IOleClientSite,
+	/*IN*/ ByVal stg As IStorage, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateStaticFromData Lib "ole32.dll" (/*IN*/ ByVal srcDataObj As IDataObject, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal pFormatEtc As *FORMATETC,
+	/*IN*/ ByVal clientSite As IOleClientSite, /*IN*/ ByVal stg As IStorage,
+	/*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+
+Declare Function OleCreateLink Lib "ole32.dll" (/*IN*/ ByVal mkLinkSrc As IMoniker, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal pFormatEtc As *FORMATETC,
+	/*IN*/ ByVal clientSite As IOleClientSite, /*IN*/ ByVal dataObj As IDataObject, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateLinkEx Lib "ole32.dll" (/*IN*/ ByVal mkLinkSrc As IMoniker, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal dwFlags As DWord, /*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal cFormats As DWord, /*IN*/ ByVal rgAdvf As *DWord,
+	/*IN*/ ByVal rgFormatEtc As *FORMATETC, /*IN*/ ByVal adviseSink As IAdviseSink,
+	/*OUT*/ ByVal rgdwConnection As *DWord, /*IN*/ ByVal clientSite As IOleClientSite,
+	/*IN*/ ByVal dataObj As IDataObject, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateLinkToFile Lib "ole32.dll" (/*IN*/ ByVal lpszFileName As LPCOLESTR, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal pFormatEtc As *FORMATETC,
+	/*IN*/ ByVal clientSite As IOleClientSite, /*IN*/ ByValdataObj As IDataObject, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateLinkToFileEx Lib "ole32.dll" (/*IN*/ ByVal lpszFileName As LPCOLESTR, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal dwFlags As DWord, /*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal cFormats As DWord, /*IN*/ ByVal rgAdvf As *DWord,
+	/*IN*/ ByVal rgFormatEtc As *FORMATETC, /*IN*/ ByVal adviseSink As IAdviseSink,
+	/*OUT*/ ByVal rgdwConnection As *DWord, /*IN*/ ByVal clientSite As IOleClientSite,
+	/*IN*/ ByVal dataObj As IDataObject, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateFromFile Lib "ole32.dll" (/*IN*/ ByRef rclsid As CLSID, /*IN*/ ByVal lpszFileName As LPOLESTR, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal pFormatEtc As *FORMATETC,
+	/*IN*/ ByVal clientSite As IOleClientSite, /*IN*/ ByVal dataObj As IDataObject, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleCreateFromFileEx Lib "ole32.dll" (/*IN*/ ByRef rclsid As CLSID, /*IN*/ ByVal lpszFileName As LPOLESTR, /*IN*/ ByRef riid As IID,
+	/*IN*/ ByVal dwFlags As DWord, /*IN*/ ByVal renderopt As DWord, /*IN*/ ByVal cFormats As DWord, /*IN*/ ByVal rgAdvf As *DWord,
+	/*IN*/ ByVal rgFormatEtc As *FORMATETC, /*IN*/ ByVal adviseSink As IAdviseSink,
+	/*OUT*/ ByVal rgdwConnection As *DWord, /*IN*/ ByVal clientSite As IOleClientSite,
+	/*IN*/ ByVal dataObj As IDataObject, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleLoad Lib "ole32.dll" (/*IN*/ ByVal stg As IStorage, /*IN*/ ByRef riid As IID, /*IN*/ ByVal clientSite As IOleClientSite,
+	/*OUT*/ ByRef ppvObj As Any) As HRESULT
+
+Declare Function OleSave Lib "ole32.dll" (/*IN*/ ByVal ps As IPersistStorage, /*IN*/ ByVal stg As IStorage, /*IN*/ fSameAsLoad As BOOL) As HRESULT
+
+Declare Function OleLoadFromStream Lib "ole32.dll" ( /*IN*/ ByVal stm As IStream, /*IN*/ ByRef iidInterface As IID, /*OUT*/ ByRef ppvObj As Any) As HRESULT
+Declare Function OleSaveToStream Lib "ole32.dll" ( /*IN*/ ByVal pstm As IPersistStream, /*IN*/ ByVal stm As IStream) As HRESULT
+
+
+Declare Function OleSetContainedObject Lib "ole32.dll" (/*IN*/ ByVal unknown As IUnknown, /*IN*/ ByVal fContained As BOOL) As HRESULT
+Declare Function OleNoteObjectVisible Lib "ole32.dll" (/*IN*/ ByVal unknown As IUnknown, /*IN*/ ByVal fContained As BOOL) As HRESULT
+
+
+/* Drag/Drop APIs */
+
+Declare Function RegisterDragDrop Lib "ole32.dll" (/*IN*/ ByVal hwnd As HWND, /*IN*/ ByVal dropTarget As IDropTarget) As HRESULT
+Declare Function RevokeDragDrop Lib "ole32.dll" (/*IN*/ ByVal hwnd As HWND) As HRESULT
+Declare Function DoDragDrop Lib "ole32.dll" (/*IN*/ ByVal dataObj As IDataObject, /*IN*/ ByVal dropSource As IDropSource,
+	/*IN*/ ByVal dwOKEffects As DWord, /*OUT*/ ByRef dwEffect As DWord) As HRESULT
+
+/* Clipboard APIs */
+
+Declare Function OleSetClipboard Lib "ole32.dll" (/*IN*/ ByVal dataObj As IDataObject) As HRESULT
+Declare Function OleGetClipboard Lib "ole32.dll" (/*OUT*/ ByRef dataObj As IDataObject) As HRESULT
+Declare Function OleFlushClipboard Lib "ole32.dll" () As HRESULT
+Declare Function OleIsCurrentClipboard Lib "ole32.dll" (/*IN*/ ByVal dataObj As IDataObject) As HRESULT
+
+
+/* InPlace Editing APIs */
+
+TypeDef HOLEMENU = HGLOBAL ' oleidl.h
+Type OLEMENUGROUPWIDTHS ' oleidl.h
+	width[ELM(6)] As Long
+End Type
+Type OLEINPLACEFRAMEINFO ' oleidl.h
+	cb As DWord
+	fMDIApp As BOOL
+	hwndFrame As HWND
+	haccel As HACCEL
+	cAccelEntries As DWord
+End Type
+Declare Function OleCreateMenuDescriptor Lib "ole32.dll" (/*IN*/ ByVal hmenuCombined As HMENU,
+	/*IN*/ ByRef MenuWidths As OLEMENUGROUPWIDTHS) As HOLEMENU
+Declare Function OleSetMenuDescriptor Lib "ole32.dll" (/*IN*/ ByVal holemenu As HOLEMENU, /*IN*/ ByVal hwndFrame As HWND,
+	/*IN*/ ByVal hwndActiveObject As HWND,
+	/*IN*/ ByVal frame As IOleInPlaceFrame,
+	/*IN*/ ByVal activeObj As IOleInPlaceActiveObject) As HRESULT
+Declare Function OleDestroyMenuDescriptor Lib "ole32.dll" (/*IN*/ ByVal holemenu As HOLEMENU) As HRESULT
+
+Declare Function OleTranslateAccelerator Lib "ole32.dll" (/*IN*/ ByVal frame As IOleInPlaceFrame,
+	/*IN*/ ByRef FrameInfo As OLEINPLACEFRAMEINFO, /*IN*/ ByRef msg As MSG) As HRESULT
+
+
+/* Helper APIs */
+Declare Function OleDuplicateData Lib "ole32.dll" (/*IN*/ ByVal hSrc As HANDLE, /*IN*/ ByVal cfFormat As CLIPFORMAT,
+	/*IN*/ ByVal uiFlags As DWord) As HANDLE
+
+Declare Function OleDraw Lib "ole32.dll" (/*IN*/ ByVal unknown As IUnknown, /*IN*/ ByVal dwAspect As DWord, /*IN*/ ByVal hdcDraw As HDC,
+	/*IN*/ ByRef rcBounds As RECT) As HRESULT
+
+Declare Function OleRun Lib "ole32.dll" (/*IN*/ ByVal unknown As IUnknown) As HRESULT
+Declare Function OleIsRunning Lib "ole32.dll" (/*IN*/ ByVal object As IOleObject) As BOOL
+Declare Function OleLockRunning Lib "ole32.dll" (/*IN*/ ByVal unknown As IUnknown, /*IN*/ ByVal fLock As BOOL, /*IN*/ ByVal fLastUnlockCloses As BOOL) As HRESULT
+Declare Sub      ReleaseStgMedium Lib "ole32.dll" (/*IN*/ ByRef medium As STGMEDIUM)
+Declare Function CreateOleAdviseHolder Lib "ole32.dll" (/*OUT*/ ByRef oaHolder As IOleAdviseHolder) As HRESULT
+
+Declare Function OleCreateDefaultHandler Lib "ole32.dll" (/*IN*/ ByRef clsid As CLSID, /*IN*/ ByVal unkOuter As IUnknown,
+	/*IN*/ ByRef riid As IID, /*OUT*/ ByRef pObj As Any) As HRESULT
+
+Declare Function OleCreateEmbeddingHelper Lib "ole32.dll" (/*IN*/ ByRef clsid As CLSID, /*IN*/ ByVal ukOuter As IUnknown,
+	/*IN*/ ByVal flags As DWord, /*IN*/ ByVal cf As IClassFactory,
+	/*IN*/ ByRef riid As IID, /*OUT*/ ByRef pObj As Any) As HRESULT
+
+Declare Function IsAccelerator Lib "ole32.dll" (/*IN*/ ByVal hAccel As HACCEL, /*IN*/ ByVal cAccelEntries As Long, /*IN*/ ByRef msg As MSG,
+	/*OUT*/ ByVal pwCmd As *Word) As BOOL
+/* Icon extraction Helper APIs */
+
+Declare Function OleGetIconOfFile Lib "ole32.dll" (/*IN*/ ByVal lpszPath As LPOLESTR, /*IN*/ ByVal fUseFileAsLabel As BOOL) As HGLOBAL
+
+Declare Function OleGetIconOfClass Lib "ole32.dll" (/*IN*/ ByRef rclsid As CLSID, /*IN*/ ByVal lpszLabel As LPOLESTR,
+	/*IN*/ ByVal fUseTypeAsLabel As BOOL) As HGLOBAL
+
+Declare Function OleMetafilePictFromIconAndLabel Lib "ole32.dll" (/*IN*/ ByVal hIcon As HICON, /*IN*/ ByVal lpszLabel As LPOLESTR,
+	/*IN*/ ByVal lpszSourceFile As LPOLESTR, /*IN*/ ByVal iIconIndex As DWord) As HGLOBAL
+
+
+
+/* Registration Database Helper APIs */
+
+Declare Function OleRegGetUserType Lib "ole32.dll" (/*IN*/ ByRef rclsid As CLSID, /*IN*/ ByVal dwFormOfType As DWord,
+	/*OUT*/ ByVal pszUserType As LPOLESTR) As HRESULT
+
+Declare Function OleRegGetMiscStatus Lib "ole32.dll" (/*IN*/ ByRef rclsid As CLSID, /*IN*/ ByVal dwAspect As DWord,
+	/*OUT*/ ByRef dwStatus As DWord) As HRESULT
+
+Declare Function OleRegEnumFormatEtc Lib "ole32.dll" (/*IN*/ ByRef rclsid As CLSID, /*IN*/ ByVal dwDirection As DWord,
+	/*OUT*/ ByRef penum As *IEnumFORMATETC) As HRESULT
+
+Declare Function OleRegEnumVerbs Lib "ole32.dll" (/*IN*/ ByRef rclsid As CLSID, /*OUT*/ ByRef penum As *IEnumOLEVERB) As HRESULT
+
+/* OLE 1.0 conversion APIS */
+
+/***** OLE 1.0 OLESTREAM declarations *************************************/
+
+
+Interface OleStream
+	Function Get(p As VoidPtr, dw As DWord) As DWord
+	Function Put(p As VoidPtr, dw As DWord) As DWord
+End Interface
+TypeDef LPOLESTREAM = *OleStream
+
+
+Declare Function OleConvertOLESTREAMToIStorage Lib "ole32.dll" (
+	/*IN*/ ByVal lpolestream As LPOLESTREAM,
+	/*OUT*/ ByVal stg As IStorage,
+	/*IN*/ ByRef td As DVTARGETDEVICE) As HRESULT
+
+Declare Function OleConvertIStorageToOLESTREAM Lib "ole32.dll" (
+	/*IN*/ ByVal stg As IStorage,
+	/*OUT*/ ByVal lpolestream As LPOLESTREAM) As HRESULT
+
+
+/* Storage Utility APIs */
+Declare Function GetHGlobalFromILockBytes Lib "ole32.dll" (/*IN*/ ByVal plkbyt As *ILockBytes, /*OUT*/ ByRef hglobal As HGLOBAL) As HRESULT
+Declare Function CreateILockBytesOnHGlobal Lib "ole32.dll" (/*IN*/ ByVal hGlobal As HGLOBAL, /*IN*/ ByVal fDeleteOnRelease As BOOL,
+	/*OUT*/ ByRef lkbyt As ILockBytes) As HRESULT
+
+Declare Function GetHGlobalFromStream Lib "ole32.dll" (/*IN*/ ByVal pstm As *IStream, /*OUT*/ ByRef hglobal As HGLOBAL) As HRESULT
+Declare Function CreateStreamOnHGlobal Lib "ole32.dll" (/*IN*/ ByVal hGlobal As HGLOBAL, /*IN*/ ByVal fDeleteOnRelease As BOOL,
+	/*OUT*/ ByRef stm As IStream) As HRESULT
+
+
+/* ConvertTo APIS */
+
+Declare Function OleDoAutoConvert Lib "ole32.dll" (/*IN*/ ByRef stg As IStorage, /*OUT*/ ByRef ClsidNew As CLSID) As HRESULT
+Declare Function OleGetAutoConvert Lib "ole32.dll" (/*IN*/ ByRef clsidOld As CLSID, /*OUT*/ ByRef ClsidNew As CLSID) As HRESULT
+Declare Function OleSetAutoConvert Lib "ole32.dll" (/*IN*/ ByRef clsidOld As CLSID, /*IN*/ ByRef ClsidNew As CLSID) As HRESULT
+Declare Function GetConvertStg Lib "ole32.dll" (/*IN*/ ByVal stg As IStorage) As HRESULT
+Declare Function SetConvertStg Lib "ole32.dll" (/*IN*/ ByVal stg As IStorage, /*IN*/ fConvert As BOOL) As HRESULT
+
+
+Declare Function OleConvertIStorageToOLESTREAMEx Lib "ole32.dll" ( _
+	/*IN*/ ByVal stg As IStorage,       ' Presentation data to OLESTREAM
+	/*IN*/ ByVal cfFormat As CLIPFORMAT,  '       format
+	/*IN*/ ByVal lWidth As Long,          '       width
+	/*IN*/ ByVal lHeight As Long,         '       height
+	/*IN*/ ByVal dwSize As DWORD,         '       size in bytes
+	/*IN*/ ByRef medium As STGMEDIUM,     '       bits
+	/*OUT*/ ByVal polestm As LPOLESTREAM) As HRESULT
+
+Declare Function OleConvertOLESTREAMToIStorageEx Lib "ole32.dll" ( _
+	/*IN*/ ByVal polestm As LPOLESTREAM,
+	/*OUT*/ ByVal pstg As *IStorage,' Presentation data from OLESTREAM
+	/*OUT*/ ByRef pcfFormat As CLIPFORMAT, '       format
+	/*OUT*/ ByRef plwWidth As Long,        '       width
+	/*OUT*/ ByRef plHeight As Long,        '       height
+	/*OUT*/ ByRef pdwSize As DWord,        '       size in bytes
+	/*OUT*/ ByRef medium As STGMEDIUM) As HRESULT   '      bits
+
+' olectl.h
+Declare Function OleLoadPicture Lib "olepro32" (stream As IStream, lSize As Long, fRunmode As BOOL, ByRef riid As IID, ppvObj As VoidPtr) As HRESULT
+#endif '__UNDEFINED
Index: /trunk/ab5.0/ablib/src/oleidl.ab
===================================================================
--- /trunk/ab5.0/ablib/src/oleidl.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/oleidl.ab	(revision 506)
@@ -0,0 +1,320 @@
+'oleidl.ab
+
+#require <objidl.sbp>
+
+Dim IID_IOleAdviseHolder = [&h00000111, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IOleAdviseHolder
+	Inherits IUnknown
+
+	Function Advise(
+		/* [unique][in] */ Advise As IAdviseSink,
+		/* [out] */ ByRef dwConnection As DWord) As HRESULT
+	Function Unadvise(
+		/* [in] */ dwConnection As DWord) As HRESULT
+	Function EnumAdvise(
+		/* [out] */ ByRef enumAdvise As IEnumSTATDATA) As HRESULT
+	Function SendOnRename(
+		/* [unique][in] */ pmk As IMoniker) As HRESULT
+	Function SendOnSave() As HRESULT
+	Function SendOnClose() As HRESULT
+End Interface
+
+'IOleCache
+'IOleCache2
+'IOleCacheControl
+
+/* interface IParseDisplayName */
+/* [unique][uuid][object] */
+
+Dim IID_IParseDisplayName = [&h0000011a, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+
+Interface IParseDisplayName
+	Inherits IUnknown
+
+	Function ParseDisplayName(
+		/* [unique][in] */ bc As IBindCtx,
+		/* [in] */ pszDisplayName As LPOLESTR,
+		/* [out] */ ByRef chEaten As DWord,
+		/* [out] */ ByRef mkOut As IMoniker) As HRESULT
+End Interface
+
+/* interface IOleContainer */
+/* [unique][uuid][object] */
+
+Dim IID_IOleContainer = [&h0000011b, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IOleContainer
+	Inherits IParseDisplayName
+
+	Function EnumObjects(
+		/* [in] */ grfFlags As DWord,
+		/* [out] */ ByRef enumUnk As IEnumUnknown) As HRESULT
+	Function LockContainer(
+		/* [in] */ fLock As BOOL) As HRESULT
+End Interface
+
+Const Enum OLERENDER
+	OLERENDER_NONE = 0
+	OLERENDER_DRAW = 1
+	OLERENDER_FORMAT = 2
+	OLERENDER_ASIS = 3
+End Enum
+
+Dim IID_IOleClientSite = [&h00000118, &h0000, &h0000, [&hC0, &h00, &h00, &h00, &h00, &h00, &h00, &h46]] As IID
+Interface IOleClientSite
+	Inherits IUnknown
+
+	Function SaveObject() As HRESULT
+	Function GetMoniker(
+		/* [in] */ dwAssign As DWord,
+		/* [in] */ dwWhichMoniker As DWord,
+		/* [out] */ ByRef mk As IMoniker) As HRESULT
+	Function GetContainer(
+		/* [out] */ ByRef Container As IOleContainer) As HRESULT
+	Function ShowObject() As HRESULT
+	Function OnShowWindow(
+		fShow As BOOL) As HRESULT
+	Function RequestNewObjectLayout() As HRESULT
+End Interface
+
+/* interface IOleObject */
+/* [unique][uuid][object] */
+
+Const Enum  OLEGETMONIKER
+	OLEGETMONIKER_ONLYIFTHERE = 1
+	OLEGETMONIKER_FORCEASSIGN = 2
+	OLEGETMONIKER_UNASSIGN = 3
+	OLEGETMONIKER_TEMPFORUSER = 4
+End Enum
+
+Const Enum  OLEWHICHMK
+	OLEWHICHMK_CONTAINER = 1
+	OLEWHICHMK_OBJREL = 2
+	OLEWHICHMK_OBJFULL = 3
+End Enum
+
+Const Enum  USERCLASSTYPE
+	USERCLASSTYPE_FULL = 1
+	USERCLASSTYPE_SHORT = 2
+	USERCLASSTYPE_APPNAME = 3
+End Enum
+
+Const Enum  OLEMISC
+	OLEMISC_RECOMPOSEONRESIZE = &h1
+	OLEMISC_ONLYICONIC = &h2
+	OLEMISC_INSERTNOTREPLACE = &h4
+	OLEMISC_STATIC = &h8
+	OLEMISC_CANTLINKINSIDE = &h10
+	OLEMISC_CANLINKBYOLE1 = &h20
+	OLEMISC_ISLINKOBJECT = &h40
+	OLEMISC_INSIDEOUT = &h80
+	OLEMISC_ACTIVATEWHENVISIBLE = &h100
+	OLEMISC_RENDERINGISDEVICEINDEPENDENT = &h200
+	OLEMISC_INVISIBLEATRUNTIME = &h400
+	OLEMISC_ALWAYSRUN = &h800
+	OLEMISC_ACTSLIKEBUTTON = &h1000
+	OLEMISC_ACTSLIKELABEL = &h2000
+	OLEMISC_NOUIACTIVATE = &h4000
+	OLEMISC_ALIGNABLE = &h8000
+	OLEMISC_SIMPLEFRAME = &h10000
+	OLEMISC_SETCLIENTSITEFIRST = &h20000
+	OLEMISC_IMEMODE = &h40000
+	OLEMISC_IGNOREACTIVATEWHENVISIBLE = &h80000
+	OLEMISC_WANTSTOMENUMERGE = &h100000
+	OLEMISC_SUPPORTSMULTILEVELUNDO = &h200000
+End Enum
+
+Const Enum OLECLOSE
+	OLECLOSE_SAVEIFDIRTY = 0
+	OLECLOSE_NOSAVE = 1
+	OLECLOSE_PROMPTSAVE = 2
+End Enum
+
+Dim IID_IOleObject = [&h00000112, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IOleObject
+	Inherits IUnknown
+
+	Function SetClientSite(
+		/* [unique][in] */ ClientSite As IOleClientSite) As HRESULT
+	Function GetClientSite(
+		/* [out] */ ByRef ClientSite As IOleClientSite) As HRESULT
+	Function SetHostNames(
+		/* [in] */ szContainerApp As LPCOLESTR,
+		/* [unique][in] */ szContainerObj As LPCOLESTR) As HRESULT
+	Function Close(
+		/* [in] */ dwSaveOption As DWord) As HRESULT
+	Function SetMoniker(
+		/* [in] */ dwWhichMoniker As DWord,
+		/* [unique][in] */ mk As IMoniker) As HRESULT
+	Function GetMoniker(
+		/* [in] */ dwAssign As DWord,
+		/* [in] */ dwWhichMoniker As DWord,
+		/* [out] */ ByRef mk As IMoniker) As HRESULT
+	Function InitFromData(
+		/* [unique][in] */ DataObject As IDataObject,
+		/* [in] */ fCreation As BOOL,
+		/* [in] */ dwReserved As DWord) As HRESULT
+	Function GetClipboardData(
+		/* [in] */ dwReserved As DWord,
+		/* [out] */ ByRef DataObject As IDataObject) As HRESULT
+	Function DoVerb(
+		/* [in] */ iVerb As Long,
+		/* [unique][in] */ lpmsg As *MSG,
+		/* [unique][in] */ ActiveSite As IOleClientSite,
+		/* [in] */ lindex As Long,
+		/* [in] */ hwndParent As HWND,
+		/* [unique][in] */ lprcPosRect As *RECT /*LPCRECT*/) As HRESULT
+	Function EnumVerbs(
+		/* [out] */ ByRef EnumOleVerb As IUnknown /*IEnumOLEVERB*/) As HRESULT
+	Function Update() As HRESULT
+	Function IsUpToDate() As HRESULT
+	Function GetUserClassID(
+		/* [out] */ ByRef Clsid As CLSID) As HRESULT
+	Function GetUserType(
+		/* [in] */ dwFormOfType As DWord,
+		/* [out] */ ByRef pszUserType As LPOLESTR) As HRESULT
+	Function SetExtent(
+		/* [in] */ dwDrawAspect As DWord,
+		/* [in] */ ByRef sizel As SIZEL) As HRESULT
+	Function GetExtent(
+		/* [in] */ dwDrawAspect As DWord,
+		/* [out] */ ByRef sizel As SIZEL) As HRESULT
+	Function Advise(
+		/* [unique][in] */ AdvSink As IAdviseSink,
+		/* [out] */ ByRef dwConnection As DWord) As HRESULT
+	Function Unadvise(
+		/* [in] */ dwConnection As DWord) As HRESULT
+	Function EnumAdvise(
+		/* [out] */ ByRef penumAdvise As IEnumSTATDATA) As HRESULT
+	Function GetMiscStatus(
+		/* [in] */ dwAspect As DWord,
+		/* [out] */ ByRef dwStatus As DWord) As HRESULT
+	Function SetColorScheme(
+		/* [in] */ ByRef Logpal As LOGPALETTE) As HRESULT
+End Interface
+
+/* interface IOleWindow */
+/* [unique][uuid][object] */
+
+Dim IID_IOleWindow = [&h00000114, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IOleWindow
+	Inherits IUnknown
+
+	/* [input_sync] */ Function GetWindow(
+		/* [out] */ ByRef hwnd As HWND) As HRESULT
+	Function ContextSensitiveHelp(
+		/* [in] */ fEnterMode As BOOL) As HRESULT
+End Interface
+
+'IOleLink
+'IOleItemContainer
+'IOleInPlaceUIWindow
+'IOleInPlaceActiveObject
+Interface IOleInPlaceActiveObject
+	Inherits IOleWindow
+End Interface
+
+'IOleInPlaceFrame
+Interface IOleInPlaceFrame
+	Inherits IOleWindow
+End Interface
+
+'IOleInPlaceObject
+'IOleInPlaceSite
+'IContinue
+'IViewObject
+'IViewObject2
+
+/* interface IDropSource */
+/* [uuid][object][local] */
+
+Dim IID_IDropSource = [&h00000121, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+
+Interface IDropSource
+	Inherits IUnknown
+
+	Function QueryContinueDrag(
+		fEscapePressed As DWord,
+		grfKeyState As DWord) As HRESULT
+	Function GiveFeedback(
+		dwEffect As DWord) As HRESULT
+End Interface
+
+/* interface IDropTarget */
+/* [unique][uuid][object] */
+
+Const MK_ALT = &h20
+
+Const DROPEFFECT_NONE = 0
+Const DROPEFFECT_COPY = 1
+Const DROPEFFECT_MOVE = 2
+Const DROPEFFECT_LINK = 4
+Const DROPEFFECT_SCROLL = &h80000000
+
+Const DD_DEFSCROLLINSET = 11
+Const DD_DEFSCROLLDELAY = 50
+Const DD_DEFSCROLLINTERVAL = 50
+Const DD_DEFDRAGDELAY = 200
+Const DD_DEFDRAGMINDIST = 2
+
+Dim IID_IDropTarget = [&h00000122, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IDropTarget
+	Inherits IUnknown
+
+	Function DragEnter(
+		/* [unique][in] */ DataObj As IDataObject,
+		/* [in] */ grfKeyState As DWord,
+		/* [in] */ x As Long, y As Long,
+		/* [out][in] */ ByRef effect As DWord) As HRESULT
+	Function DragOver(
+		/* [in] */ grfKeyState As DWord,
+		/* [in] */ x As Long, y As Long,
+		/* [out][in] */ ByRef effect As DWord) As HRESULT
+	Function DragLeave() As HRESULT
+	Function Drop(
+		/* [unique][in] */ DataObj As IDataObject,
+		/* [in] */ grfKeyState As DWord,
+		/* [in] */ x As Long, y As Long,
+		/* [out][in] */ ByRef effect As DWord) As HRESULT
+End Interface
+
+/* interface IDropSourceNotify */
+/* [unique][uuid][object][local] */
+
+Dim IID_IDropSourceNotify = [&h0000012B, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IDropSourceNotify
+	Inherits IUnknown
+
+	Function DragEnterTarget(
+		/* [in] */ hwndTarget As HWND) As HRESULT
+	Function DragLeaveTarget() As HRESULT
+End Interface
+
+/* interface IEnumOLEVERB */
+/* [unique][uuid][object] */
+
+Type OLEVERB
+	lVerb As Long
+	lpszVerbName As LPOLESTR
+	fuFlags As DWord
+	grfAttribs As DWord
+End Type
+
+/* [v1_enum] */ Const Enum OLEVERBATTRIB
+	OLEVERBATTRIB_NEVERDIRTIES = 1
+	OLEVERBATTRIB_ONCONTAINERMENU = 2
+End Enum
+
+Dim IID_IEnumOLEVERB = [&h00000104, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
+Interface IEnumOLEVERB
+	Inherits IUnknown
+
+	/* [local] */ Function Next_(
+		/* [in] */ celt As DWord,
+		/* [length_is][size_is][out] */ rgelt As *OLEVERB,
+		/* [out] */ ByRef celtFetched As DWord) As HRESULT
+	Function Skip(
+		/* [in] */ celt As DWord) As HRESULT
+	Function Reset() As HRESULT
+	Function Clone(
+		/* [out] */ ByRef enumOleVerb As IEnumOLEVERB) As HRESULT
+End Interface
Index: /trunk/ab5.0/ablib/src/qos.ab
===================================================================
--- /trunk/ab5.0/ablib/src/qos.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/qos.ab	(revision 506)
@@ -0,0 +1,75 @@
+' qos.ab
+
+' Definitions for valued-based Service Type for each direction of data flow.
+
+TypeDef SERVICETYPE = DWord
+
+Const SERVICETYPE_NOTRAFFIC = &h00000000
+Const SERVICETYPE_BESTEFFORT = &h00000001
+Const SERVICETYPE_CONTROLLEDLOAD = &h00000002
+Const SERVICETYPE_GUARANTEED = &h00000003
+Const SERVICETYPE_NETWORK_UNAVAILABLE = &h00000004
+Const SERVICETYPE_GENERAL_INFORMATION = &h00000005
+Const SERVICETYPE_NOCHANGE = &h00000006
+Const SERVICETYPE_NONCONFORMING = &h00000009
+Const SERVICETYPE_NETWORK_CONTROL = &h0000000A
+Const SERVICETYPE_QUALITATIVE = &h0000000D
+' The usage of these is currently not supported.
+Const SERVICE_BESTEFFORT = &h80010000
+Const SERVICE_CONTROLLEDLOAD = &h80020000
+Const SERVICE_GUARANTEED = &h80040000
+Const SERVICE_QUALITATIVE = &h80200000
+
+' Flags to control the usage of RSVP on this flow.
+Const SERVICE_NO_TRAFFIC_CONTROL = &h81000000
+
+Const SERVICE_NO_QOS_SIGNALING = &h40000000
+
+' Flow Specifications for each direction of data flow.
+Type FLOWSPEC
+	TokenRate As DWord
+	TokenBucketSize As DWord
+	PeakBandwidth As DWord
+	Latency As DWord
+	DelayVariation As DWord
+	ServiceType As SERVICETYPE
+	MaxSduSize As DWord
+	MinimumPolicedSize As DWord
+End Type
+TypeDef PFLOWSPEC = *FLOWSPEC
+TypeDef LPFLOWSPEC = *FLOWSPEC
+
+Const QOS_NOT_SPECIFIED = &hFFFFFFFF
+
+Const POSITIVE_INFINITY_RAT = &hFFFFFFFE
+
+Type QOS_OBJECT_HDR
+	bjectType As DWord
+	bjectLength As DWord
+End Type
+TypeDef LPQOS_OBJECT_HDR = *QOS_OBJECT_HDR
+
+Const QOS_GENERAL_ID_BASE = 2000
+
+Const QOS_OBJECT_END_OF_LIST = (&h00000001 + QOS_GENERAL_ID_BASE)
+Const QOS_OBJECT_SD_MODE = (&h00000002 + QOS_GENERAL_ID_BASE)
+Const QOS_OBJECT_SHAPING_RATE = (&h00000003 + QOS_GENERAL_ID_BASE)
+Const QOS_OBJECT_DESTADDR = (&h00000004 + QOS_GENERAL_ID_BASE)
+
+
+Type QOS_SD_MODE
+	ObjectHdr As QOS_OBJECT_HDR
+	ShapeDiscardMode As DWord
+End Type
+TypeDef LPQOS_SD_MODE = QOS_SD_MODE
+
+Const TC_NONCONF_BORROW = 0
+Const TC_NONCONF_SHAPE = 1
+Const TC_NONCONF_DISCARD = 2
+Const TC_NONCONF_BORROW_PLUS = 3 ' Not supported currently
+
+Type QOS_SHAPING_RATE
+	ObjectHdr As QOS_OBJECT_HDR
+	ShapingRate As DWord
+End Type
+TypeDef LPQOS_SHAPING_RATE = *QOS_SHAPING_RATE
Index: /trunk/ab5.0/ablib/src/system/built_in.ab
===================================================================
--- /trunk/ab5.0/ablib/src/system/built_in.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/system/built_in.ab	(revision 506)
@@ -0,0 +1,22 @@
+
+#ifndef _WIN64
+Sub _allrem()
+End Sub
+Sub _aullrem()
+End Sub
+Sub _allmul()
+End Sub
+Sub _alldiv()
+End Sub
+Sub _aulldiv()
+End Sub
+Sub _allshl()
+End Sub
+Sub _allshr()
+End Sub
+Sub _aullshr()
+End Sub
+#endif
+
+Sub _System_InitStaticLocalVariables()
+End Sub
Index: /trunk/ab5.0/ablib/src/system/debug.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/system/debug.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/system/debug.sbp	(revision 506)
@@ -0,0 +1,95 @@
+'debug.sbp
+'このファイル内のコードはデバッグ コンパイル時のみ有効です（リリース コンパイルでは無視されます）。
+
+'Dim _DebugSys_dwThreadID[255] As DWord			- コンパイラが自動的に定義します
+'Dim _DebugSys_ProcNum[255] As DWord			- コンパイラが自動的に定義します
+'Dim _DebugSys_lplpObp[255] As *ULONG_PTR		- コンパイラが自動的に定義します
+'Dim _DebugSys_lplpSpBase[255] As *ULONG_PTR	- コンパイラが自動的に定義します
+
+Function _DebugSys_GetThread() As Long
+	Dim dwThreadID As DWord
+	Dim ThreadNum As Long
+
+	dwThreadID=GetCurrentThreadId()
+	ThreadNum=0
+	Do
+		If dwThreadID=_DebugSys_dwThreadID[ThreadNum] Then Exit Do
+		ThreadNum=ThreadNum+1
+		If ThreadNum>255 Then
+			ThreadNum=-1
+			Exit Do
+
+			/*debug
+			OutputDebugString(Ex"[GetThread]デバッグ情報が異常です。プロセスを終了します。\r\n")
+			ExitProcess(0)*/
+		End If
+	Loop
+
+	_DebugSys_GetThread=ThreadNum
+End Function
+
+/*!
+@brief デバッグ用Set_LONG_PTR。
+削除すると、ABプログラムが正常にデバッグ実行できなくなる。
+*/
+Sub _DebugSys_Set_LONG_PTR(pPtr As VoidPtr, lpData As LONG_PTR)
+#ifdef _WIN64
+	SetQWord(pPtr,lpData)
+#else
+	SetDWord(pPtr,lpData)
+#endif
+End Sub
+
+Sub _DebugSys_StartProc(lpSpBase As ULONG_PTR, lpObp As ULONG_PTR)
+	Dim i As Long
+
+	Dim ThreadNum As Long
+	ThreadNum=_DebugSys_GetThread()
+	If ThreadNum=-1 Then Exit Sub
+
+	If _DebugSys_lplpObp[ThreadNum] Then
+		i=(_DebugSys_ProcNum[ThreadNum]+2)*SizeOf(ULONG_PTR)
+		_DebugSys_lplpObp[ThreadNum]=HeapReAlloc(GetProcessHeap(),0,_DebugSys_lplpObp[ThreadNum],i)
+		_DebugSys_lplpSpBase[ThreadNum]=HeapReAlloc(GetProcessHeap(),0,_DebugSys_lplpSpBase[ThreadNum],i)
+	Else
+		_DebugSys_ProcNum[ThreadNum]=0
+		_DebugSys_lplpObp[ThreadNum]=HeapAlloc(GetProcessHeap(),0,SizeOf(ULONG_PTR)*2)
+		_DebugSys_lplpSpBase[ThreadNum]=HeapAlloc(GetProcessHeap(),0,SizeOf(ULONG_PTR)*2)
+	End If
+	_DebugSys_Set_LONG_PTR(_DebugSys_lplpObp[ThreadNum]+_DebugSys_ProcNum[ThreadNum]*SizeOf(ULONG_PTR),lpObp)
+	_DebugSys_Set_LONG_PTR(_DebugSys_lplpSpBase[ThreadNum]+_DebugSys_ProcNum[ThreadNum]*SizeOf(ULONG_PTR),lpSpBase)
+
+	_DebugSys_ProcNum[ThreadNum]=_DebugSys_ProcNum[ThreadNum]+1
+End Sub
+
+Sub _DebugSys_EndProc()
+	Dim ThreadNum As Long
+	ThreadNum=_DebugSys_GetThread()
+	If ThreadNum=-1 Then Exit Sub
+
+	_DebugSys_ProcNum[ThreadNum]=_DebugSys_ProcNum[ThreadNum]-1
+End Sub
+
+Sub _DebugSys_SaveContext(lpSpBase As ULONG_PTR, lpObp As ULONG_PTR)
+	Dim ThreadNum As Long
+	ThreadNum=_DebugSys_GetThread()
+	If ThreadNum=-1 Then Exit Sub
+
+	If _DebugSys_lplpObp[ThreadNum]=0 Then
+		_DebugSys_ProcNum[ThreadNum]=0
+		_DebugSys_lplpObp[ThreadNum]=HeapAlloc(GetProcessHeap(),0,SizeOf(ULONG_PTR)*2)
+		_DebugSys_lplpSpBase[ThreadNum]=HeapAlloc(GetProcessHeap(),0,SizeOf(ULONG_PTR)*2)
+	End If
+	_DebugSys_Set_LONG_PTR(_DebugSys_lplpObp[ThreadNum]+_DebugSys_ProcNum[ThreadNum]*SizeOf(ULONG_PTR), lpObp)
+	_DebugSys_Set_LONG_PTR(_DebugSys_lplpSpBase[ThreadNum]+_DebugSys_ProcNum[ThreadNum]*SizeOf(ULONG_PTR), lpSpBase)
+End Sub
+
+Sub _esp_error()
+	MessageBox( NULL, "esp is wrong value.", "debug check error", MB_OK or MB_ICONEXCLAMATION )
+End Sub
+
+Sub _System_DebugOnly_OutputDebugString(buffer As *Char)
+#ifdef _DEBUG
+	OutputDebugString(buffer)
+#endif
+End Sub
Index: /trunk/ab5.0/ablib/src/system/enum.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/system/enum.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/system/enum.sbp	(revision 506)
@@ -0,0 +1,77 @@
+Class EnumBase<T As EnumBase>
+Protected
+	value As Long
+	lpszName As LPTSTR
+Public
+	Sub EnumBase(value As Long,lpszName As LPTSTR)
+		This.value = value
+		This.lpszName = lpszName
+	End Sub
+
+	Sub EnumBase( enumBase As EnumBase )
+		This.value = enumBase.value
+		This.lpszName = enumBase.lpszName
+	End Sub
+
+	Sub ~EnumBase()
+	End Sub
+
+	Override Function ToString() As String
+		Return New String( lpszName )
+	End Function
+
+	Sub Copy(obj As EnumBase)
+		This.value = obj.value
+		This.lpszName = obj.lpszName
+	End Sub
+
+	Function Operator() As Int64
+		Return This.value
+	End Function
+	Function Operator() As Long
+		Return This.value
+	End Function
+	Function Operator() As DWord
+		Return This.value
+	End Function
+	Function Operator() As Boolean
+		Return ( This.value <> 0 )
+	End Function
+
+	Function Operator == (value As Long) As Boolean
+		Return ( This.value = value )
+	End Function
+
+	Function Operator == (enumObj As T) As Boolean
+		Return ( This.value = enumObj.value )
+	End Function
+
+	Function Operator <> (value As Long) As Boolean
+		Return Not( This = value)
+	End Function
+
+	Function Operator <> (enumObj As T) As Boolean
+		Return Not( This = enumObj)
+	End Function
+
+	Function Operator or (enumObj As T) As Boolean
+		Return ( This.value or enumObj.value ) <> 0
+	End Function
+
+	Function Operator and (enumObj As T) As Boolean
+		Return ( This.value and enumObj.value ) <> 0
+	End Function
+
+	Function Operator or (enumObj As T) As T
+		Return New EnumBase( This.value or enumObj.value, This.lpszName )
+	End Function
+
+	Function Operator and (enumObj As T) As T
+		Return New EnumBase( This.value and enumObj.value, This.lpszName )
+	End Function
+/*
+	Function Operator xor (enumBase As EnumBase) As EnumBase
+		Return New EnumBase(This.value Xor enumBase.value)
+	End Function
+*/
+End Class
Index: /trunk/ab5.0/ablib/src/system/exception.ab
===================================================================
--- /trunk/ab5.0/ablib/src/system/exception.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/system/exception.ab	(revision 506)
@@ -0,0 +1,202 @@
+'TODO: ローカルオブジェクト確保及び解放時にTryServiceに通知する必要がある。
+
+Class TryLayer
+Public
+	Const catchTable As *LONG_PTR
+	Const addressOfFinally As VoidPtr
+	Const basePtr As LONG_PTR
+	Const stackPtr As LONG_PTR
+
+	Const debugProcNum As DWord
+	
+	Sub TryLayer( catchTable As *LONG_PTR, addressOfFinally As VoidPtr, basePtr As LONG_PTR, stackPtr As LONG_PTR )
+		This.catchTable = catchTable
+		This.addressOfFinally = addressOfFinally
+		This.basePtr = basePtr
+		This.stackPtr = stackPtr
+
+#ifdef _DEBUG
+		Dim ThreadNum As Long
+		ThreadNum=_DebugSys_GetThread()
+		If ThreadNum <> -1 Then
+			debugProcNum = _DebugSys_ProcNum[ThreadNum]
+		End If
+#endif
+	End Sub
+	Sub ~TryLayer()
+	End Sub
+
+	Sub FinishFinally()
+		Imports System.Threading
+		If Thread.CurrentThread().__IsThrowing() Then
+			Throw Thread.CurrentThread().__GetThrowintParamObject()
+		End If
+	End Sub
+
+	Function ResolveCatchesOverload( ex As Object ) As LONG_PTR
+		OutputDebugString("ResolveCatchesOverload: ")
+		OutputDebugString(ToTCStr(ex.ToString))
+		OutputDebugString(Ex"\r\n")
+		Dim defaultCatchCodePos = 0 As LONG_PTR
+		Dim pos = 0 As Long
+		While catchTable[pos]
+			' パラメータのクラス名
+			Dim paramName = catchTable[pos] As *Char
+			pos ++
+
+			' コード位置
+			Dim codePos = catchTable[pos] As LONG_PTR
+			pos ++
+
+			If paramName[0] = 0 Then
+				' Default Catch
+				defaultCatchCodePos = codePos
+			End If
+
+			If Object.ReferenceEquals( ex, Nothing ) Then
+				' パラメータなしのとき
+				If paramName[0] = 0 Then
+					' マッチしたとき
+					Return codePos
+				End If
+			Else
+				If isCatchable(New String(paramName), ex.GetType()) Then
+'				If lstrcmp( paramName, ex.GetType().FullName ) = 0 Then
+					' マッチしたとき
+					Return codePos
+				End If
+			End If
+		Wend
+		Return defaultCatchCodePos
+	End Function
+Private
+	Function isCatchable(paramName As String, catchType As System.TypeInfo) As Boolean
+/*		If Not String.IsNullOrEmpty(paramName) Then
+			Dim paramType = _System_TypeBase_Search(paramName)
+			isCatchable = ActiveBasic.Detail.IsBaseOf(catchType, paramType)
+		Else
+			isCatchable = False
+		End If
+/*/
+		isCatchable = False
+		While Not ActiveBasic.IsNothing(catchType)
+			Dim catchTypeName = catchType.FullName
+			If paramName = catchTypeName Then
+				isCatchable = True
+				Exit Function
+			End If
+			catchType = catchType.BaseType
+		Wend
+'*/
+	End Function
+End Class
+
+Class ExceptionService
+	tryLayers As System.Collections.Generic.List<TryLayer>
+
+	Sub FreeLocalObjects()
+		'TODO: 破棄されていないローカルオブジェクトを破棄
+	End Sub
+Public
+
+	Sub ExceptionService()
+		tryLayers = New System.Collections.Generic.List<TryLayer>
+	End Sub
+	Sub ~ExceptionService()
+	End Sub
+
+	'Try
+	Function _BeginTryScope( catchTable As *LONG_PTR, addressOfFinally As VoidPtr, basePtr As LONG_PTR, stackPtr As LONG_PTR ) As TryLayer
+		Dim tryLayer = New TryLayer( catchTable, addressOfFinally, basePtr, stackPtr )
+		tryLayers.Add( tryLayer )
+
+		Return tryLayer
+	End Function
+
+	Static Function BeginTryScope( catchTable As *LONG_PTR, addressOfFinally As VoidPtr, basePtr As LONG_PTR, stackPtr As LONG_PTR ) As TryLayer
+		Return _System_pobj_AllThreads->GetCurrentException()._BeginTryScope( catchTable, addressOfFinally, basePtr, stackPtr )
+	End Function
+
+	'End Try
+	Sub EndTryScope()
+		tryLayers.RemoveAt( tryLayers.Count - 1 )
+	End Sub
+
+	'Throw
+	Sub _Throw( ex As Object )
+		If tryLayers.Count <= 0 then
+			'例外処理スコープ制御が無効なとき
+
+			'TODO: 適切なエラー処理
+			System.Diagnostics.Debug.WriteLine( Ex"Catchされていない例外があります\r\n" + ex.ToString )
+			MessageBox( NULL, ToTCStr(Ex"Catchされていない例外があります\r\n" + ex.ToString), NULL, MB_OK or MB_ICONEXCLAMATION )
+			Debug
+			Return
+		End If
+
+		' スレッドへThrow処理を開始したことを通知
+		Imports System.Threading
+		Thread.CurrentThread().__Throw( ex )
+
+		'未解放なローカルオブジェクトを解放する
+		FreeLocalObjects()
+
+		Dim tryLayer = tryLayers[tryLayers.Count - 1]
+
+		Dim addressOfCatch = tryLayer.ResolveCatchesOverload( ex ) As LONG_PTR
+		If addressOfCatch = NULL Then
+			' Catchが定義されていないときはFinallyへ誘導
+			addressOfCatch = tryLayer.addressOfFinally As LONG_PTR
+		End If
+
+
+		'--------------------------------------------------
+		' スレッドのコンテキストを設定（Catchへ遷移する）
+		'--------------------------------------------------
+
+		Dim context As CONTEXT
+		context.ContextFlags = CONTEXT_CONTROL or CONTEXT_INTEGER
+		If GetThreadContext( GetCurrentThread(), context ) = 0 Then
+			' TODO: エラー処理
+			debug
+		End If
+
+		'新しいip, sp, bpをセット
+#ifdef _WIN64
+		context.Rip = addressOfCatch As QWord
+		context.Rbp = tryLayer.basePtr
+		context.Rsp = tryLayer.stackPtr
+#else
+		context.Eip = addressOfCatch As DWord
+		context.Ebp = tryLayer.basePtr
+		context.Esp = tryLayer.stackPtr
+#endif
+
+#ifdef _DEBUG
+		Dim ThreadNum As Long
+		ThreadNum=_DebugSys_GetThread()
+		If ThreadNum <> -1 Then
+			_DebugSys_ProcNum[ThreadNum] = tryLayer.debugProcNum-1
+		End If
+#endif
+
+		If SetThreadContext( GetCurrentThread(), context ) = 0 Then
+			OutputDebugString(Ex"レジスタ情報の設定に失敗しました。\r\n")
+			Return
+		End If
+	End Sub
+
+	Sub _ThrowWithParam( ex As Object )
+		_Throw( ex )
+	End Sub
+
+	Sub _ThrowNoneParam()
+		_Throw( Nothing )
+	End Sub
+
+	Sub FinishFinally()
+		Dim tryLayer = tryLayers[tryLayers.Count - 1]
+		tryLayer.FinishFinally()
+	End Sub
+End Class
+
Index: /trunk/ab5.0/ablib/src/system/gc.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/system/gc.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/system/gc.sbp	(revision 506)
@@ -0,0 +1,830 @@
+/*!
+	@brief	このファイルでは、ABのガベージコレクションの実装を行います。
+*/
+
+
+/*
+※これらの変数はコンパイラが自動的に定義します。
+Dim _System_gc_StackRoot_StartPtr As VoidPtr
+*/
+
+Const _System_GC_FLAG_ATOMIC = 1
+Const _System_GC_FLAG_NEEDFREE = 2
+Const _System_GC_FLAG_INITZERO = 4
+Const _System_GC_FLAG_OBJECT = 8
+
+Type _System_GlobalRoot
+	ptr As *LONG_PTR
+	count As Long
+End Type
+
+Type _System_MemoryObject
+	ptr As VoidPtr
+	size As SIZE_T
+	flags As DWord
+	generationCount As Long
+End Type
+
+Class _System_CGarbageCollection
+
+	hHeap As HANDLE								' GC用のヒープ
+
+	pMemoryObjects As *_System_MemoryObject		' メモリオブジェクト
+	countOfMemoryObjects As Long				' 管理するメモリオブジェクトの個数
+
+	iAllSize As SIZE_T
+
+	isSweeping As Boolean	' スウィープ中かどうか
+
+	minPtr As ULONG_PTR
+	maxPtr As ULONG_PTR
+
+	' クリティカルセクション
+	CriticalSection As CRITICAL_SECTION
+
+	' メモリの上限値（この値を超えるとGCが発動します）
+	limitMemorySize As LONG_PTR		' バイト単位
+	limitMemoryObjectNum As Long	' メモリオブジェクトの個数単位
+
+	isFinish As Boolean		' GC管理が終了したかどうか
+
+
+	' Global Root
+	pGlobalRoots As *_System_GlobalRoot
+	globalRootNum As Long
+	Sub AddGlobalRootPtr( ptr As *LONG_PTR, count As Long )
+		pGlobalRoots = _System_realloc( pGlobalRoots, (globalRootNum + 1) * SizeOf(_System_GlobalRoot) )
+		pGlobalRoots[globalRootNum].ptr = ptr
+		pGlobalRoots[globalRootNum].count = count
+		globalRootNum++
+	End Sub
+
+	Sub RegisterGlobalRoots()
+		' このメソッドの実装はコンパイラが自動生成する
+
+		' AddGlobalRootPtr(...)
+		' ...
+	End Sub
+
+	' 特殊クラスのため、コンストラクタ・デストラクタは呼ばれません
+	Sub _System_CGarbageCollection()
+	End Sub
+	Sub ~_System_CGarbageCollection()
+	End Sub
+
+Public
+
+	/*!
+	@brief	環境変数にGCを登録する
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Static Sub Initialize()
+		Dim temporary[255] As Char
+		If GetEnvironmentVariable( "ActiveBasicGarbageCollection", temporary, 255 ) Then
+			' 既にGCがプロセスに存在するとき
+			_stscanf( temporary, "%08x", VarPtr( _System_pGC ) )
+			MessageBox(0,temporary,"GetEnvironmentVariable",0)
+		Else
+			_System_pGC = _System_calloc( SizeOf( _System_CGarbageCollection ) )
+			_System_pGC->Begin()
+
+			' GCをプロセスに登録する
+			_stprintf( temporary, "%08x", _System_pGC )
+			SetEnvironmentVariable( "ActiveBasicGarbageCollection", temporary )
+		End If
+	End Sub
+
+	/*!
+	@brief	メモリサイズの上限を指定する
+	@param	limitMemorySize メモリサイズの上限（単位はバイト）
+			limitMemoryObjectNum メモリ個数の上限
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub SetLimit( limitMemorySize As LONG_PTR, limitMemoryObjectNum As Long )
+		This.limitMemorySize = limitMemorySize
+		This.limitMemoryObjectNum = limitMemoryObjectNum
+	End Sub
+
+	/*!
+	@brief	初期化
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub Begin()
+		If pMemoryObjects Then Exit Sub
+
+		isFinish = False
+
+		'メモリの上限値（この値を超えるとGCが発動します）
+		SetLimit(
+			1024*1024,	' バイト単位
+			2000		' メモリオブジェクトの個数単位
+		)
+
+		hHeap = HeapCreate( 0, 0, 0 )
+
+		pMemoryObjects = _System_calloc( 1 )
+		countOfMemoryObjects=0
+
+		' Global Root
+		pGlobalRoots = _System_calloc( 1 )
+		globalRootNum = 0
+		RegisterGlobalRoots()
+
+		iAllSize=0
+
+		' スウィープ中かどうか
+		isSweeping = False
+
+		minPtr = &HFFFFFFFFFFFFFFFF As ULONG_PTR
+		maxPtr = 0
+
+		'クリティカルセッションを生成
+		InitializeCriticalSection(CriticalSection)
+
+
+		'---------------------------
+		' 開始時のスレッドを通知
+		'---------------------------
+		Dim hTargetThread As HANDLE
+		DuplicateHandle(GetCurrentProcess(),
+			GetCurrentThread(),
+			GetCurrentProcess(),
+			hTargetThread, 0, FALSE, DUPLICATE_SAME_ACCESS)		'カレントスレッドのハンドルを複製
+
+		' スレッド管理用オブジェクトを生成
+		_System_pobj_AllThreads = New System.Threading.Detail._System_CThreadCollection()
+
+		' 自身のThreadオブジェクトを生成
+		Dim thread = New System.Threading.Thread(hTargetThread, GetCurrentThreadId(), 0)
+		thread.Name = "main"
+
+		_System_pobj_AllThreads->BeginThread(thread, _System_gc_StackRoot_StartPtr As *LONG_PTR)
+
+	End Sub
+
+	/*!
+	@brief	終了処理
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub Finish()
+		If pMemoryObjects = NULL Then Exit Sub
+
+		isFinish = True
+
+		' スレッド管理用オブジェクトを破棄
+		Delete _System_pobj_AllThreads
+
+		' 自分以外のスレッドを一時停止
+		'_System_pobj_AllThreads->SuspendAnotherThread()
+
+		_System_DebugOnly_OutputDebugString( Ex"garbage colletion sweeping all memory objects!\r\n" )
+		DeleteAllGarbageMemories()
+
+		' 未解放のメモリオブジェクトをトレース
+		DumpMemoryLeaks()
+
+		' 自分以外のスレッドを再開
+		'_System_pobj_AllThreads->ResumeAnotherThread()
+
+		_System_free( pMemoryObjects )
+		pMemoryObjects = NULL
+
+		_System_free( pGlobalRoots )
+		pGlobalRoots = NULL
+
+		'クリティカルセッションを破棄
+		DeleteCriticalSection(CriticalSection)
+
+	End Sub
+
+	/*!
+	@brief	メモリオブジェクトからインデックスを取得する
+	@param	new_ptr メモリオブジェクトへのポインタ
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Function GetMemoryObjectPtr( ptr As VoidPtr ) As *_System_MemoryObject
+		' メモリオブジェクトの先頭部分からインデックスを取得する
+		Dim index = Get_LONG_PTR( ptr - SizeOf(LONG_PTR) ) As Long
+
+		If pMemoryObjects[index].ptr <> ptr Then
+			' メモリイメージが壊れている（先頭に存在するインデックスの整合性が取れない）
+			Dim temporary[1024] As Char
+#ifdef _WIN64
+			'wsprintfでは、Windows 2000以降でしか%pが使えない。
+			wsprintf( temporary, Ex"indexOfMemoryObjects: %d\r\npMemoryObjects[index].ptr: &H%p\r\nptr: &H%p\r\n",
+				index,
+				pMemoryObjects[index].ptr,
+				ptr )
+#else
+			wsprintf( temporary, Ex"indexOfMemoryObjects: %d\r\npMemoryObjects[index].ptr: &H%08x\r\nptr: &H%08x\r\n",
+				index,
+				pMemoryObjects[index].ptr,
+				ptr )
+#endif
+			_System_DebugOnly_OutputDebugString( temporary )
+			debug
+		End If
+
+		Return VarPtr( pMemoryObjects[index] )
+	End Function
+
+	/*!
+	@brief	メモリオブジェクトを追加する
+	@param	new_ptr メモリオブジェクトへのポインタ
+			size メモリオブジェクトのサイズ
+			flags メモリオブジェクトの属性
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub add(new_ptr As VoidPtr, size As SIZE_T, flags As DWord)
+		EnterCriticalSection(CriticalSection)
+			iAllSize+=size
+
+			' メモリオブジェクトインスタンスの先頭にインデックスをセットする
+			Set_LONG_PTR( new_ptr - SizeOf( LONG_PTR ), countOfMemoryObjects )
+
+			pMemoryObjects = _System_realloc( pMemoryObjects, (countOfMemoryObjects+1)*SizeOf(_System_MemoryObject) )
+			pMemoryObjects[countOfMemoryObjects].ptr = new_ptr
+			pMemoryObjects[countOfMemoryObjects].size = size
+			pMemoryObjects[countOfMemoryObjects].flags = flags
+			pMemoryObjects[countOfMemoryObjects].generationCount = 0
+
+			If minPtr > new_ptr As ULONG_PTR Then
+				minPtr = new_ptr As ULONG_PTR
+			End If
+			If maxPtr < ( new_ptr + size ) As ULONG_PTR Then
+				maxPtr = ( new_ptr + size ) As ULONG_PTR
+			End If
+
+			countOfMemoryObjects++
+		LeaveCriticalSection(CriticalSection)
+
+		/*
+		' デバッグ用
+		If countOfMemoryObjects = 1996 Then
+			debug
+		End If
+		*/
+	End Sub
+
+
+	/*!
+	@brief	メモリオブジェクトを確保する
+	@param	size メモリオブジェクトのサイズ
+			flags メモリオブジェクトの属性
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Function __malloc(size As SIZE_T,flags As Byte) As VoidPtr
+		Dim dwFlags As DWord
+		If flags and _System_GC_FLAG_INITZERO Then
+			dwFlags=HEAP_ZERO_MEMORY
+		Else
+			dwFlags=0
+		End If
+
+		' 実際のメモリバッファはインデックスの分だけ多めに確保する
+		__malloc = HeapAlloc( hHeap, dwFlags, size + SizeOf( LONG_PTR ) )
+		throwIfAllocationFailed( __malloc, size )
+		__malloc += SizeOf( LONG_PTR )
+
+		' 管理対象のメモリオブジェクトとして追加
+		add( __malloc, size, flags )
+	End Function
+
+	/*!
+	@brief	メモリオブジェクトを再確保する
+	@param	lpMem メモリオブジェクトへのポインタ
+			size メモリオブジェクトのサイズ
+			flags メモリオブジェクトの属性
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Function __realloc(lpMem As VoidPtr, size As SIZE_T) As VoidPtr
+		EnterCriticalSection(CriticalSection)
+
+			' メモリオブジェクトを取得
+			Dim pTempMemoryObject = GetMemoryObjectPtr( lpMem )
+
+			iAllSize += size - pTempMemoryObject->size
+
+			pTempMemoryObject->size = size
+			__realloc = HeapReAlloc( hHeap, HEAP_ZERO_MEMORY, pTempMemoryObject->ptr - SizeOf(LONG_PTR), size + SizeOf(LONG_PTR) )
+			If __realloc = 0 Then
+				LeaveCriticalSection(CriticalSection)
+				throwIfAllocationFailed(0, size)
+			End If
+			__realloc += SizeOf(LONG_PTR)
+			pTempMemoryObject->ptr = __realloc
+
+
+			If minPtr > pTempMemoryObject->ptr As ULONG_PTR Then
+				minPtr = pTempMemoryObject->ptr As ULONG_PTR
+			End If
+			If maxPtr < ( pTempMemoryObject->ptr + size ) As ULONG_PTR Then
+				maxPtr = ( pTempMemoryObject->ptr + size ) As ULONG_PTR
+			End If
+		LeaveCriticalSection(CriticalSection)
+	End Function
+
+	/*!
+	@brief	メモリ確保に失敗したか（NULLかどうか）を調べ、失敗していたら例外を投げる。
+	@param[in] p メモリへのポインタ
+	@param[in] size 確保しようとした大きさ
+	@exception OutOfMemoryException pがNULLだったとき
+	@author	Egtra
+	@date	2007/12/24
+	ただし、sizeがあまりにも小さい場合は、例外を投げず、即座に終了する。
+	*/
+	Sub throwIfAllocationFailed(p As VoidPtr, size As SIZE_T)
+		If p = 0 Then
+			If size < 256 Then
+				/*
+				　これだけのメモリも確保できない状況では、OutOfMemoryException
+				のインスタンスすら作成できないかもしれないし、例え作成できても、
+				その後、結局メモリ不足でろくなことを行えないはず。そのため、
+				ここですぐに終了することにする。
+				　なお、この値は特に根拠があって定められた値ではない。
+				*/
+				HeapDestroy(hHeap)
+				OutputDebugString("AB malloc: Out of memory.")
+				ExitProcess(-1)
+			End If
+			Dim s2 = Nothing As Object '#145
+			s2 = New System.UInt64(size)
+			Throw New System.OutOfMemoryException(ActiveBasic.Strings.SPrintf("malloc: Failed to allocate %zu (%&zx) byte(s) memory.", s2, s2))
+		End If
+	End Sub
+
+	/*!
+	@brief	メモリオブジェクトを解放する
+	@param	lpMem メモリオブジェクトへのポインタ
+			isSweeping スウィープ中にこのメソッドが呼ばれるときはTrue、それ以外はFalse
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub __free_ex(lpMem As VoidPtr, isSweeping As Boolean)
+		EnterCriticalSection(CriticalSection)
+
+			' メモリオブジェクトを取得
+			Dim pTempMemoryObject = GetMemoryObjectPtr( lpMem )
+
+			If (pTempMemoryObject->flags and _System_GC_FLAG_NEEDFREE)<>0 or isSweeping Then
+				iAllSize -= pTempMemoryObject->size
+
+				HeapFree( hHeap, 0, pTempMemoryObject->ptr - SizeOf(LONG_PTR) )
+				pTempMemoryObject->ptr = NULL
+				pTempMemoryObject->size = 0
+			Else
+				If isFinish = False Then
+					_System_DebugOnly_OutputDebugString( Ex"heap free missing!\r\n" )
+				End If
+			End If
+		LeaveCriticalSection(CriticalSection)
+	End Sub
+
+	/*!
+	@brief	メモリオブジェクトを解放する
+	@param	lpMem メモリオブジェクトへのポインタ
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub __free(lpMem As VoidPtr)
+		__free_ex( lpMem, False )
+	End Sub
+
+	/*!
+	@brief	必要であればスウィープする
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub TrySweep()
+		If isSweeping <> False or (iAllSize<limitMemorySize and countOfMemoryObjects<limitMemoryObjectNum) Then
+			'メモリ使用量が上限値を超えていないとき
+			Exit Sub
+		End If
+
+		Sweep()
+	End Sub
+
+	/*!
+	@brief	スウィープする
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub Sweep()
+		Dim hThread As HANDLE
+		Dim ThreadId As DWord
+		hThread=_beginthreadex(NULL,0,AddressOf(SweepOnOtherThread),VarPtr(This),0,ThreadId)
+		WaitForSingleObject(hThread,INFINITE)
+		CloseHandle(hThread)
+		isSweeping = False
+	End Sub
+
+Private
+
+	Static Function IsNull( object As Object ) As Boolean
+		Return Object.ReferenceEquals(object, Nothing)
+	End Function
+
+	/*!
+	@brief	メモリオブジェクトの生存検地
+	@param	pSample メモリオブジェクトへのポインタ
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Function HitTest(pSample As VoidPtr) As Long
+		If pSample = NULL Then
+			Return -1
+		End If
+		If not( minPtr <= pSample and pSample <= maxPtr ) Then
+			Return -1
+		End If
+
+		Dim i As Long
+		For i=0 To ELM(countOfMemoryObjects)
+			If (pMemoryObjects[i].ptr As LONG_PTR)<=(pSample As LONG_PTR) and (pSample As LONG_PTR)<=((pMemoryObjects[i].ptr As LONG_PTR)+pMemoryObjects[i].size) Then
+				Return i
+			End If
+		Next
+		Return -1
+	End Function
+
+	/*!
+	@brief	オブジェクトのスキャン
+	@param	pObject オブジェクトへのポインタ
+			pbMark マークリスト
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Function ScanObject( classTypeInfo As ActiveBasic.Core._System_TypeForClass, pObject As *Object, pbMark As *Byte) As Boolean
+		If IsNull( classTypeInfo ) Then
+			Return False
+		End If
+
+		' 基底クラスをスキャン
+		If Not IsNull( classTypeInfo.BaseType ) Then
+			Dim baseClassTypeInfo = Nothing As ActiveBasic.Core._System_TypeForClass
+			baseClassTypeInfo = classTypeInfo.BaseType As ActiveBasic.Core._System_TypeForClass
+			ScanObject( baseClassTypeInfo, pObject, pbMark )
+		End If
+
+		/*
+		_System_DebugOnly_OutputDebugString( "  (scanning object)" )
+		_System_DebugOnly_OutputDebugString( classTypeInfo.Name )
+		_System_DebugOnly_OutputDebugString( Ex"\r\n" )
+		*/
+
+		Dim i As Long
+		For i = 0 To ELM(classTypeInfo.numOfReference)
+			Scan( (pObject + classTypeInfo.referenceOffsets[i]) As *LONG_PTR, 1, pbMark )
+		Next
+
+		Return True
+	End Function
+	Function ScanObject(pObject As *Object, pbMark As *Byte) As Boolean
+		Dim classTypeInfo = Nothing As ActiveBasic.Core._System_TypeForClass
+		classTypeInfo = pObject->GetType() As ActiveBasic.Core._System_TypeForClass
+
+		If Object.ReferenceEquals( classTypeInfo, ActiveBasic.Core._System_TypeBase.selfTypeInfo ) Then
+			' TypeInfoクラスの場合はTypeBaseImplクラスとして扱う
+			classTypeInfo = _System_TypeBase_Search( "ActiveBasic.Core.TypeBaseImpl" ) As ActiveBasic.Core._System_TypeForClass
+		End If
+
+		Return ScanObject( classTypeInfo, pObject, pbMark )
+	End Function
+
+	/*!
+	@brief	メモリオブジェクトのスキャン
+	@param	pStartPtr メモリオブジェクトへのポインタ
+			maxNum スキャンするメモリオブジェクトの個数
+			pbMark マークリスト
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub Scan(pStartPtr As *LONG_PTR, maxNum As Long, pbMark As *Byte)
+		Dim i As Long, index As Long
+
+		For i=0 To ELM(maxNum)
+			index=HitTest(pStartPtr[i] As VoidPtr)
+			If index<>-1 Then
+				If pbMark[index]=0 Then
+					pbMark[index]=1
+
+					' ジェネレーションカウントを増やす
+					pMemoryObjects[index].generationCount ++
+
+					If pMemoryObjects[index].flags and _System_GC_FLAG_OBJECT Then
+						' オブジェクトの場合
+						If ScanObject( (pMemoryObjects[index].ptr + 4*SizeOf(LONG_PTR)) As *Object, pbMark) = False Then
+							Dim maxNum = (pMemoryObjects[index].size\SizeOf(LONG_PTR)) As Long
+							Scan(pMemoryObjects[index].ptr As *LONG_PTR, maxNum, pbMark)
+						End If
+
+					ElseIf (pMemoryObjects[index].flags and _System_GC_FLAG_ATOMIC)=0 Then
+						' ヒープ領域がポインタ値を含む可能性があるとき
+						If pMemoryObjects[index].ptr = NULL Then
+							'エラー
+
+						End If
+
+						Dim maxNum = (pMemoryObjects[index].size\SizeOf(LONG_PTR)) As Long
+						Scan(pMemoryObjects[index].ptr As *LONG_PTR, maxNum, pbMark)
+					End If
+				End If
+			End If
+		Next
+	End Sub
+
+	/*!
+	@brief	グローバル領域をルートに指定してスキャン
+	@param	pbMark マークリスト
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub GlobalScan( pbMark As *Byte )
+		Dim i As Long
+		For i = 0 To ELM( globalRootNum )
+			Scan( pGlobalRoots[i].ptr, pGlobalRoots[i].count, pbMark )
+		Next
+	End Sub
+
+	/*!
+	@brief	ローカル領域をルートに指定してスキャン
+	@param	pbMark マークリスト
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub LocalScan( pbMark As *Byte )
+		Dim Context As CONTEXT
+		Dim NowSp As *LONG_PTR
+		Dim size As LONG_PTR
+		Dim i As Long
+		For i=0 To ELM(_System_pobj_AllThreads->ThreadNum)
+			Dim thread = _System_pobj_AllThreads->collection[i].thread
+			If Not ActiveBasic.IsNothing(thread) Then
+				FillMemory(VarPtr(Context),SizeOf(CONTEXT),0)
+				Context.ContextFlags=CONTEXT_CONTROL
+				If thread.__GetContext(Context)=0 Then
+					_System_DebugOnly_OutputDebugString(Ex"レジスタ情報の取得に失敗しました。\r\n")
+				End If
+
+#ifdef _WIN64
+				NowSp=Context.Rsp As *LONG_PTR
+#else
+				NowSp=Context.Esp As *LONG_PTR
+#endif
+
+				Dim size=(_System_pobj_AllThreads->collection[i].stackBase As LONG_PTR)-(NowSp As LONG_PTR)
+				Dim maxNum = (size\SizeOf(LONG_PTR)) As Long
+
+				If NowSp = 0 Then
+					debug
+					Exit Sub
+				End If
+
+				/*
+				_System_DebugOnly_OutputDebugString( "(scanning thread local)" )
+				_System_DebugOnly_OutputDebugString( thread.Name )
+				_System_DebugOnly_OutputDebugString( Ex"\r\n" )
+				*/
+
+				Scan( NowSp, maxNum, pbMark )
+			End If
+		Next
+	End Sub
+
+	/*!
+	@brief	生存していないメモリオブジェクトを解放する
+	@param	pbMark マークリスト
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub DeleteGarbageMemories( pbMark As *Byte )
+
+		Dim isAllDelete = False
+		If pbMark = NULL Then
+			' すべてを破棄するとき
+			isAllDelete = True
+			pbMark = _System_calloc( countOfMemoryObjects )
+		End If
+
+		Dim i As Long
+		For i=0 To ELM(countOfMemoryObjects)
+			If pbMark[i]=0 and pMemoryObjects[i].ptr<>0 and (pMemoryObjects[i].flags and _System_GC_FLAG_NEEDFREE)=0 Then
+				If pMemoryObjects[i].ptr = NULL Then
+					If isAllDelete Then
+						Continue
+					Else
+						debug
+					End If
+				End If
+
+				Dim ptr = pMemoryObjects[i].ptr
+				Dim size = pMemoryObjects[i].size
+
+				If (pMemoryObjects[i].flags and _System_GC_FLAG_OBJECT) <> 0 Then
+					/*	・オブジェクトの個数
+						・オブジェクトのサイズ
+						・デストラクタの関数ポインタ
+						・リザーブ領域
+						を考慮	*/
+					_System_SweepingDelete (ptr + SizeOf( LONG_PTR ) * 4 )
+				Else
+					__free_ex( ptr, True )
+				End If
+			End If
+		Next
+
+		If isAllDelete Then
+			_System_free( pbMark )
+		End If
+
+	End Sub
+
+	/*!
+	@brief	GCが管理するすべてのメモリオブジェクトを解放する
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub DeleteAllGarbageMemories()
+		DeleteGarbageMemories( NULL )
+	End Sub
+
+	/*!
+	@brief	コンパクション
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub Compaction()
+		Dim i As Long, i2 = 0 As Long
+		For i=0 To ELM(countOfMemoryObjects)
+			pMemoryObjects[i2] = pMemoryObjects[i]
+
+			If pMemoryObjects[i2].ptr Then
+				' メモリオブジェクトの先頭部分にあるインデックスを書き換える
+				Set_LONG_PTR( pMemoryObjects[i2].ptr - SizeOf(LONG_PTR), i2 )
+
+				i2++
+			End If
+		Next
+		countOfMemoryObjects = i2
+	End Sub
+
+	/*!
+	@brief	スウィープ（新規スレッドで呼び出す必要あり）
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Function SweepOnOtherThread() As Long
+		Imports System.Threading.Detail
+		EnterCriticalSection(CriticalSection)
+
+		Dim startTime = GetTickCount()
+
+		_System_DebugOnly_OutputDebugString( Ex"garbage colletion sweep start!\r\n" )
+
+
+		'If isSweeping <> False or (iAllSize<limitMemorySize and countOfMemoryObjects<limitMemoryObjectNum) Then
+		'	ExitThread(0)
+		'End If
+		isSweeping = True
+
+		' すべてのスレッドを一時停止
+		_System_pobj_AllThreads->SuspendAllThread()
+
+		' マークリストを生成
+		Dim pbMark = _System_calloc(countOfMemoryObjects*SizeOf(Byte)) As *Byte
+
+		' グローバル領域をルートに指定してスキャン
+		GlobalScan( pbMark )
+
+		' ローカル領域をルートに指定してスキャン
+		LocalScan( pbMark )
+
+		' スウィープ前のメモリサイズを退避
+		Dim iBackAllSize = iAllSize
+
+		' スウィープ前のメモリオブジェクトの数
+		Dim iBeforeN = countOfMemoryObjects
+
+		'使われていないメモリを解放する
+		DeleteGarbageMemories(pbMark)
+
+		'コンパクション
+		Compaction()
+
+		'マークリストを解放
+		_System_free(pbMark)
+
+		If iBackAllSize <= iAllSize * 2 Then
+			If iAllSize > limitMemorySize Then
+				limitMemorySize = iAllSize
+			End If
+
+			'許容量を拡張する
+			limitMemorySize *= 2
+			limitMemoryObjectNum *= 2
+
+			_System_DebugOnly_OutputDebugString( Ex"memory size is extended for gc!\r\n" )
+		End If
+
+		Dim temp[100] As Char
+		wsprintf(temp,Ex"object items         ... %d -> %d  ( %d MB -> %d MB )\r\n",iBeforeN,countOfMemoryObjects, iBackAllSize\1024\1024, iAllSize\1024\1024)
+		_System_DebugOnly_OutputDebugString( temp )
+		wsprintf(temp,Ex"limit size of memory ... %d\r\n",limitMemorySize)
+		_System_DebugOnly_OutputDebugString( temp )
+		wsprintf(temp,Ex"garbage colletion sweep finish! (%d ms)\r\n\r\n", GetTickCount()-startTime)
+		_System_DebugOnly_OutputDebugString( temp )
+
+
+		'-------------------------------------
+		' すべてのスレッドを再開
+		'-------------------------------------
+		_System_pobj_AllThreads->ResumeAllThread()
+
+		LeaveCriticalSection(CriticalSection)
+	End Function
+
+	/*!
+	@brief	未解放のメモリオブジェクトをデバッグ出力する
+	@author	Daisuke Yamamoto
+	@date	2007/10/21
+	*/
+	Sub DumpMemoryLeaks()
+		Dim isLeak = False
+		Dim i As Long
+		For i=0 To ELM(countOfMemoryObjects)
+			If pMemoryObjects[i].ptr Then
+				If (pMemoryObjects[i].flags and _System_GC_FLAG_NEEDFREE)<>0 Then
+					If isLeak = False Then
+						_System_DebugOnly_OutputDebugString( Ex"Detected memory leaks!\r\n" )
+						isLeak = True
+					End If
+
+					Dim temp[100] As Char
+					_System_DebugOnly_OutputDebugString( Ex"heap free missing!\r\n" )
+#ifdef _WIN64
+					wsprintf(temp,Ex"{%d} normal block at &H%p, %d bytes long.\r\n", i, pMemoryObjects[i].ptr, pMemoryObjects[i].size)
+#else
+					wsprintf(temp,Ex"{%d} normal block at &H%08X, %d bytes long.\r\n", i, pMemoryObjects[i].ptr, pMemoryObjects[i].size)
+#endif
+					_System_DebugOnly_OutputDebugString( temp )
+				End If
+			End If
+		Next
+
+		If isLeak Then
+			_System_DebugOnly_OutputDebugString( Ex"Object dump complete.\r\n" )
+		End If
+
+	End Sub
+
+End Class
+
+'GC管理用の特殊なシステムオブジェクト（デストラクタは最終のタイミングで呼び出されます）
+Dim _System_pGC As *_System_CGarbageCollection
+
+
+
+Function GC_malloc(size As SIZE_T) As VoidPtr
+	' sweep
+	_System_pGC->TrySweep()
+
+	'allocate
+	Return _System_pGC->__malloc(size,0)
+End Function
+
+Function GC_malloc_atomic(size As SIZE_T) As VoidPtr
+	' sweep
+	_System_pGC->TrySweep()
+
+	'allocate
+	Return _System_pGC->__malloc(size,_System_GC_FLAG_ATOMIC)
+End Function
+
+Function _System_GC_malloc_ForObject(size As SIZE_T) As VoidPtr
+	' sweep
+	_System_pGC->TrySweep()
+
+	'allocate
+	Return _System_pGC->__malloc(size,_System_GC_FLAG_OBJECT or _System_GC_FLAG_INITZERO)
+End Function
+
+Function _System_GC_malloc_ForObjectPtr(size As SIZE_T) As VoidPtr
+	' sweep
+	_System_pGC->TrySweep()
+
+	'allocate
+	Return _System_pGC->__malloc(size,_System_GC_FLAG_OBJECT or _System_GC_FLAG_INITZERO or _System_GC_FLAG_NEEDFREE)
+End Function
+
+Sub _System_GC_free_for_SweepingDelete( ptr As *Object )
+	' free
+	_System_pGC->__free_ex( ptr, True )
+End Sub
Index: /trunk/ab5.0/ablib/src/system/interface.ab
===================================================================
--- /trunk/ab5.0/ablib/src/system/interface.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/system/interface.ab	(revision 506)
@@ -0,0 +1,12 @@
+Type InterfaceStructure
+	thisPtr As VoidPtr
+	vtblPtr As VoidPtr
+End Type
+
+Function CastToInterface( obj As Object, typeOfInterface As System.TypeInfo ) As InterfaceStructure
+	Dim interfaceStructure As InterfaceStructure
+
+	' TODO: 実装
+	'interfaceStructure.thisPtr = ObjPtr( obj )
+	'interfaceStructure.vtblPtr = obj.GetVtbl( typeOfInterface )
+End Function
Index: /trunk/ab5.0/ablib/src/system/string.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/system/string.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/system/string.sbp	(revision 506)
@@ -0,0 +1,321 @@
+'string.sbp
+'文字列変数の操作用
+
+Function StrPtr(s As String) As *Char
+	If Not ActiveBasic.IsNothing(s) Then
+		StrPtr = s.StrPtr
+	End If
+End Function
+'StringBuilder版はClasses/System/Text/StringBuilder.abに定義されている
+
+Function ZeroString(length As Long) As System.Text.StringBuilder
+	ZeroString = New System.Text.StringBuilder
+	ZeroString.Length = length
+End Function
+
+Function MakeStr(psz As PSTR) As String
+	Return New String(psz)
+End Function
+
+Function MakeStr(psz As PWSTR) As String
+	Return New String(psz)
+End Function
+
+Dim _System_AllocForConvertedString As *Function(size As SIZE_T) As VoidPtr
+_System_AllocForConvertedString = AddressOf (GC_malloc_atomic)
+
+Namespace Detail
+	Function GetWCStr(mbsSrc As PSTR, len As SIZE_T, ByRef wcsDst As PWSTR) As SIZE_T
+		Dim lenWCS = MultiByteToWideChar(CP_THREAD_ACP, 0, mbsSrc, (len As DWord) As Long, 0, 0)
+		wcsDst = _System_AllocForConvertedString(SizeOf (WCHAR) * (lenWCS + 1)) As PWSTR
+		GetWCStr = MultiByteToWideChar(CP_THREAD_ACP, 0, mbsSrc, (len As DWord) As Long, wcsDst, lenWCS)
+		wcsDst[GetWCStr] = 0
+	End Function
+
+	Function GetWCStr(wcsSrc As PWSTR, len As SIZE_T, ByRef wcsDst As PWSTR) As SIZE_T
+		wcsDst = wcsSrc
+		GetWCStr = len
+	End Function
+
+	Function GetMBStr(wcsSrc As PWSTR, len As SIZE_T, ByRef mbsDst As PSTR) As SIZE_T
+		Dim lenMBS = WideCharToMultiByte(CP_THREAD_ACP, 0, wcsSrc, (len As DWord) As Long, 0, 0, 0, 0)
+		mbsDst = _System_AllocForConvertedString(SizeOf (SByte) * (lenMBS + 1)) As PSTR
+		GetMBStr = WideCharToMultiByte(CP_THREAD_ACP, 0, wcsSrc, (wcsSrc As DWord) As Long, mbsDst, lenMBS, 0, 0) As SIZE_T
+		mbsDst[GetMBStr] = 0
+	End Function
+
+	Function GetMBStr(mbsSrc As PSTR, len As SIZE_T, ByRef mbsDst As PSTR) As SIZE_T
+		mbsDst = mbsSrc
+		GetMBStr = len
+	End Function
+End Namespace
+
+/*
+変換の組み合わせは、
+入力引数: wcsz, wcs + len, mbsz, mbs + len, str
+出力関数: wcs(z)出力GetStr, mbs(z)出力GetStr,
+          wcs(z)出力GetStrNT, mbs(z)出力GetStrNT,
+          GetWCStr, GetMBStr, GetTCStr,
+          ToWCStr, ToMBStr, ToTCStr,
+で、5 * 10 = 50通り。
+*/
+
+Function GetStr(mbszSrc As PSTR, ByRef wcsDst As PWSTR) As SIZE_T
+	If mbszSrc = 0 Then
+		wcsDst = 0
+		Return 0
+	Else
+		Return Detail.GetWCStr(mbszSrc, lstrlenA(mbszSrc) As SIZE_T, wcsDst)
+	End If
+End Function
+
+Function GetStr(mbsSrc As PSTR, len As SIZE_T, ByRef wcsDst As PWSTR) As SIZE_T
+	If mbsSrc = 0 Then
+		wcsDst = 0
+		Return 0
+	Else
+		Return Detail.GetWCStr(mbsSrc, len, wcsDst)
+	End If
+End Function
+
+Function GetStr(wcszSrc As PWSTR, ByRef wcsDst As PWSTR) As SIZE_T
+	If wcszSrc = 0 Then
+		wcsDst = 0
+		Return 0
+	Else
+		wcsDst = wcszSrc
+		Return lstrlenW(wcszSrc) As SIZE_T
+	End If
+End Function
+
+Function GetStr(wcsSrc As PWSTR, len As SIZE_T, ByRef wcsDst As PWSTR) As SIZE_T
+	If wcsSrc = 0 Then
+		wcsDst = 0
+		Return 0
+	Else
+		wcsDst = wcsSrc
+		Return len
+	End If
+End Function
+
+Function GetStr(wcszSrc As PWSTR, ByRef mbsDst As PSTR) As SIZE_T
+	If wcszSrc = 0 Then
+		mbsDst = 0
+		Return 0
+	Else
+		Return Detail.GetMBStr(wcszSrc, lstrlenW(wcszSrc) As SIZE_T, mbsDst)
+	End If
+End Function
+
+Function GetStr(wcsSrc As PWSTR, len As SIZE_T, ByRef mbsDst As PSTR) As SIZE_T
+	If wcsSrc = 0 Then
+		mbsDst = 0
+		Return 0
+	Else
+		Return Detail.GetMBStr(wcsSrc, len As SIZE_T, mbsDst)
+	End If
+End Function
+
+Function GetStr(mbszSrc As PSTR, ByRef mbsDst As PSTR) As SIZE_T
+	If mbszSrc = 0 Then
+		mbsDst = 0
+		Return 0
+	Else
+		mbsDst = mbszSrc
+		Return lstrlenA(mbszSrc) As SIZE_T
+	End If
+End Function
+
+Function GetStr(mbsSrc As PSTR, len As SIZE_T, ByRef mbsDst As PSTR) As SIZE_T
+	If mbsSrc = 0 Then
+		mbsDst = 0
+		Return len
+	Else
+		mbsDst = mbsSrc
+		Return 0
+	End If
+End Function
+
+Function GetStr(strSrc As String, ByRef wcsDst As PWSTR) As SIZE_T
+	If ActiveBasic.IsNothing(strSrc) Then
+		wcsDst = 0
+		Return 0
+	Else
+		Return Detail.GetWCStr(strSrc.StrPtr, strSrc.Length As SIZE_T, wcsDst)
+	End If
+End Function
+
+Function GetStr(strSrc As String, ByRef mbsDst As PSTR) As SIZE_T
+	If ActiveBasic.IsNothing(strSrc) Then
+		mbsDst = 0
+		Return 0
+	Else
+		Return Detail.GetMBStr(strSrc.StrPtr, strSrc.Length As SIZE_T, mbsDst)
+	End If
+End Function
+
+Sub GetStrNT(mbszSrc As PSTR, ByRef mbszDst As PSTR)
+	mbszDst = mbszSrc
+End Sub
+
+Sub GetStrNT(mbsSrc As PSTR, len As SIZE_T, ByRef mbszDst As PSTR)
+	mbszDst = mbsSrc
+End Sub
+
+Sub GetStrNT(mbszSrc As PSTR, ByRef wcszDst As PWSTR)
+	GetStr(mbszSrc, wcszDst)
+End Sub
+
+Sub GetStrNT(mbsSrc As PSTR, len As SIZE_T, ByRef wcszDst As PWSTR)
+	GetStr(mbsSrc, len, wcszDst)
+End Sub
+
+Sub GetStrNT(wcszSrc As PWSTR, ByRef mbszDst As PSTR)
+	GetStr(wcszSrc, mbszDst)
+End Sub
+
+Sub GetStrNT(wcsSrc As PWSTR, len As SIZE_T, ByRef mbszDst As PSTR)
+	GetStr(wcsSrc, len, mbszDst)
+End Sub
+
+Sub GetStrNT(wcszSrc As PWSTR, ByRef wcszDst As PWSTR)
+	wcszDst = wcszSrc
+End Sub
+
+Sub GetStrNT(wcsSrc As PWSTR, len As SIZE_T, ByRef wcszDst As PWSTR)
+	wcszDst = wcsSrc
+End Sub
+
+Sub GetStrNT(strSrc As String, ByRef mbszDst As PSTR)
+	GetStr(strSrc, mbszDst)
+End Sub
+
+Sub GetStrNT(strSrc As String, ByRef wcszDst As PWSTR)
+	GetStr(strSrc, wcszDst)
+End Sub
+
+Function GetWCStr(mbszSrc As PSTR, ByRef wcsDst As PWSTR) As SIZE_T
+	Return GetStr(mbszSrc, wcsDst)
+End Function
+
+Function GetWCStr(mbsSrc As PSTR, len As SIZE_T, ByRef wcsDst As PWSTR) As SIZE_T
+	Return GetStr(mbsSrc, len, wcsDst)
+End Function
+
+Function GetWCStr(wcszSrc As PWSTR, ByRef wcsDst As PWSTR) As SIZE_T
+	Return GetStr(wcszSrc, wcsDst)
+End Function
+
+Function GetWCStr(wcsSrc As PWSTR, len As SIZE_T, ByRef wcsDst As PWSTR) As SIZE_T
+	Return GetStr(wcsSrc, len, wcsDst)
+End Function
+
+Function GetWCStr(strSrc As String, ByRef wcsDst As PWSTR) As SIZE_T
+	Return GetStr(strSrc.StrPtr, strSrc.Length As SIZE_T, wcsDst)
+End Function
+
+Function GetMBStr(mbszSrc As PWSTR, ByRef mbsDst As PSTR) As SIZE_T
+	Return GetStr(mbszSrc, mbsDst)
+End Function
+
+Function GetMBStr(wcsSrc As PWSTR, len As SIZE_T, ByRef mbsDst As PSTR) As SIZE_T
+	Return GetStr(wcsSrc, len, mbsDst)
+End Function
+
+Function GetMBStr(mbszSrc As PSTR, ByRef mbsDst As PSTR) As SIZE_T
+	Return GetStr(mbszSrc, mbsDst)
+End Function
+
+Function GetMBStr(mbsSrc As PSTR, len As SIZE_T, ByRef mbsDst As PSTR) As SIZE_T
+	Return GetStr(mbsSrc, len, mbsDst)
+End Function
+
+Function GetMBStr(strSrc As String, ByRef mbsDst As PSTR) As SIZE_T
+	Return GetStr(strSrc.StrPtr, strSrc.Length As SIZE_T, mbsDst)
+End Function
+
+Function GetTCStr(mbszSrc As PSTR, ByRef tcsDst As PCTSTR) As SIZE_T
+	Return GetStr(mbszSrc, tcsDst)
+End Function
+
+Function GetTCStr(mbsSrc As PSTR, len As SIZE_T, ByRef tcsDst As PCTSTR) As SIZE_T
+	Return GetStr(mbsSrc, len, tcsDst)
+End Function
+
+Function GetTCStr(wcszSrc As PWSTR, ByRef tcsDst As PCTSTR) As SIZE_T
+	Return GetStr(wcszSrc, tcsDst)
+End Function
+
+Function GetTCStr(wcsSrc As PWSTR, len As SIZE_T, ByRef tcsDst As PCTSTR) As SIZE_T
+	Return GetStr(wcsSrc, len, tcsDst)
+End Function
+
+Function GetTCStr(strSrc As String, ByRef tcsDst As PCTSTR) As SIZE_T
+	Return GetStr(strSrc.StrPtr, strSrc.Length As SIZE_T, tcsDst)
+End Function
+
+Function ToWCStr(mbsz As PSTR) As PWSTR
+	GetStrNT(mbsz, ToWCStr)
+End Function
+
+Function ToWCStr(mbs As PSTR, len As SIZE_T) As PWSTR
+	GetStrNT(mbs, len, ToWCStr)
+End Function
+
+Function ToWCStr(wcsz As PWSTR) As PWSTR
+	ToWCStr = wcsz
+End Function
+
+Function ToWCStr(wcs As PWSTR, len As SIZE_T) As PWSTR
+	ToWCStr = wcs
+End Function
+
+Function ToWCStr(s As String) As PWSTR
+	GetStrNT(s, ToWCStr)
+End Function
+
+Function ToMBStr(mbsz As PSTR) As PSTR
+	ToMBStr = mbsz
+End Function
+
+Function ToMBStr(mbs As PSTR, len As SIZE_T) As PSTR
+	ToMBStr = mbs
+End Function
+
+Function ToMBStr(wcsz As PWSTR) As PSTR
+	GetStrNT(wcsz, ToMBStr)
+End Function
+
+Function ToMBStr(wcs As PWSTR, len As SIZE_T) As PSTR
+	GetStrNT(wcs, len, ToMBStr)
+End Function
+
+Function ToMBStr(s As String) As PSTR
+	GetStrNT(s, ToMBStr)
+End Function
+
+Function ToTCStr(mbsz As PSTR) As PCTSTR
+	GetStrNT(mbsz, ToTCStr)
+End Function
+
+Function ToTCStr(mbs As PSTR, len As SIZE_T) As PCTSTR
+	GetStrNT(mbs, len, ToTCStr)
+End Function
+
+Function ToTCStr(wcsz As PWSTR) As PCTSTR
+	GetStrNT(wcsz, ToTCStr)
+End Function
+
+Function ToTCStr(wcs As PWSTR, len As SIZE_T) As PCTSTR
+	GetStrNT(wcs, len, ToTCStr)
+End Function
+
+Function ToTCStr(s As String) As PCTSTR
+	GetStrNT(s, ToTCStr)
+End Function
+
+#ifndef UNICODE
+TypeDef BoxedStrChar = System.SByte
+#else
+TypeDef BoxedStrChar = System.UInt16
+#endif
Index: /trunk/ab5.0/ablib/src/unknwn.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/unknwn.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/unknwn.sbp	(revision 506)
@@ -0,0 +1,37 @@
+' unknwn.sbp
+' 本来はunknwn.idlから生成するのが正当ですが、これは手動で移植したものです。
+
+'-------------------
+' Unknown Interface
+'-------------------
+
+Dim IID_IUnknown = [&H00000000, &H0000, &H0000, [&HC0, &H00, &H00, &H00, &H00, &H00, &H00, &H46]] As IID
+
+Interface IUnknown
+	__COM
+	Function QueryInterface(ByRef riid As IID, ByRef pvObj As Any) As HRESULT
+	Function AddRef() As DWord
+	Function Release() As DWord
+End Interface
+
+Dim IID_AsyncIUnknown = [&H000e0000, &H0000, &H0000, [&HC0, &H00, &H00, &H00, &H00, &H00, &H00, &H46]] As IID
+Interface AsyncIUnknown
+	Inherits IUnknown
+
+	Function Begin_QueryInterface(
+		/* [in] */ ByRef riid As IID) As HRESULT
+	Function Finish_QueryInterface(
+		/* [out] */ ByRef ppvObject As Any) As HRESULT
+	Function Begin_AddRef() As HRESULT
+	Function Finish_AddRef() As DWord
+	Function Begin_Release() As HRESULT
+	Function Finish_Release() As DWord
+End Interface
+
+Dim IID_IClassFactory = [&H00000000, &H0000, &H0000, [&HC0, &H00, &H00, &H00, &H00, &H00, &H00, &H46]] As IID
+Interface IClassFactory
+	Inherits IUnknown
+
+	Function CreateInstance(ByVal unkOuter As IUnknown, ByRef riid As IID, ByRef ppvObject As Any) As HRESULT
+	Function LockServer(ByVal fLock As BOOL) As HRESULT
+End Interface
Index: /trunk/ab5.0/ablib/src/windef.ab
===================================================================
--- /trunk/ab5.0/ablib/src/windef.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/windef.ab	(revision 506)
@@ -0,0 +1,245 @@
+' windef.ab
+
+'#ifndef WINVER
+'#define WINVER &h0500
+'#endif
+
+'TypeDef ULONG = DWord
+'TypeDef PULONG = *ULONG
+'TypeDef USHORT = Word
+'TypeDef PUSHORT = *USHORT
+TypeDef UCHAR = Byte
+TypeDef PUCHAR = *UCHAR
+'TypeDef PSZ = *SByte
+
+Const MAX_PATH = 260
+
+Const NULL = 0 As VoidPtr
+
+Const FALSE = 0
+Const TRUE = 1
+
+TypeDef DWORD = DWord
+TypeDef BOOL = Long
+TypeDef BYTE = Byte
+TypeDef WORD = Word
+'TypeDef FLOAT = Single
+'TypeDef PFLOAT = *FLOAT
+'TypeDef PBOOL = *BOOL
+'TypeDef LPBOOL = *BOOL
+'TypeDef PBYTE = *Byte
+'TypeDef LPBYTE = *Byte
+'TypeDef PINT = *Long
+'TypeDef LPINT = *Long
+'TypeDef PWORD = *Word
+'TypeDef LPWORD = *Word
+'TypeDef LPLONG = *Long
+'TypeDef PDWORD = *DWord
+'TypeDef LPDWORD = *DWord
+TypeDef LPVOID = VoidPtr
+TypeDef LPCVOID = VoidPtr
+
+'TypeDef INT = Long
+'TypeDef UINT = DWord
+'TypeDef PUINT = *DWord
+
+#require <winnt.ab>
+
+'#require <specstrings.ab>
+
+TypeDef WPARAM = ULONG_PTR
+TypeDef LPARAM = LONG_PTR
+TypeDef LRESULT = LONG_PTR
+/*
+#ifndef NOMINMAX
+
+#ifndef max
+#endif
+
+#ifndef min
+#endif
+
+#endif
+*/
+
+Const MAKEWORD(l, h) = (((l As Word) And &HFF) Or (((h As Word) And &HFF) << 8)) As Word
+Const MAKELONG(l, h) = (((l As DWord) And &HFFFF) Or (((h As DWord) And &HFFFF) << 16)) As Long
+Const HIBYTE(w) = (((w As Word) >> 8) And &HFF) As Byte
+Const LOBYTE(w) = ((w As Word) And &HFF) As Byte
+Const HIWORD(dw) = (((dw As DWord) >> 16) And &HFFFF) As Word
+Const LOWORD(dw) = ((dw As DWord) And &HFFFF) As Word
+
+Type _System_DeclareHandle_HWND:unused As DWord:End Type
+TypeDef HWND = *_System_DeclareHandle_HWND
+Type _System_DeclareHandle_HHOOK:unused As DWord:End Type
+TypeDef HHOOK = *_System_DeclareHandle_HHOOK
+Type _System_DeclareHandle_HEVENT:unused As DWord:End Type
+TypeDef HEVENT = *_System_DeclareHandle_HEVENT
+
+TypeDef ATOM = Word
+TypeDef SPHANDLE = *HANDLE
+TypeDef LPHANDLE = *HANDLE
+TypeDef HGLOBAL = HANDLE
+TypeDef HLOCAL = HANDLE
+TypeDef GLOBALHANDLE = HANDLE
+TypeDef LOCALHANDLE = HANDLE
+
+TypeDef FARPROC = *Function() As LONG_PTR
+TypeDef NEARPROC = *Function() As LONG_PTR
+TypeDef PROC = *Function() As LONG_PTR
+
+TypeDef HGDIOBJ = VoidPtr
+
+Type _System_DeclareHandle_HKEY:unused As DWord:End Type
+TypeDef HKEY = *_System_DeclareHandle_HKEY
+TypeDef PHKEY = *HKEY
+
+Type _System_DeclareHandle_HACCEL:unused As DWord:End Type
+TypeDef HACCEL = *_System_DeclareHandle_HACCEL
+Type _System_DeclareHandle_HBITMAP:unused As DWord:End Type
+TypeDef HBITMAP = *_System_DeclareHandle_HBITMAP
+Type _System_DeclareHandle_HBRUSH:unused As DWord:End Type
+TypeDef HBRUSH = *_System_DeclareHandle_HBRUSH
+Type _System_DeclareHandle_HCOLORSPACE:unused As DWord:End Type
+TypeDef HCOLORSPACE = *_System_DeclareHandle_HCOLORSPACE
+Type _System_DeclareHandle_HDC:unused As DWord:End Type
+TypeDef HDC = *_System_DeclareHandle_HDC
+Type _System_DeclareHandle_HGLRC:unused As DWord:End Type
+TypeDef HGLRC = *_System_DeclareHandle_HGLRC
+Type _System_DeclareHandle_HDESK:unused As DWord:End Type
+TypeDef HDESK = *_System_DeclareHandle_HDESK
+Type _System_DeclareHandle_HENHMETAFILE:unused As DWord:End Type
+TypeDef HENHMETAFILE = *_System_DeclareHandle_HENHMETAFILE
+Type _System_DeclareHandle_HFONT:unused As DWord:End Type
+TypeDef HFONT = *_System_DeclareHandle_HFONT
+Type _System_DeclareHandle_HICON:unused As DWord:End Type
+TypeDef HICON = *_System_DeclareHandle_HICON
+Type _System_DeclareHandle_HMENU:unused As DWord:End Type
+TypeDef HMENU = *_System_DeclareHandle_HMENU
+Type _System_DeclareHandle_HMETAFILE:unused As DWord:End Type
+TypeDef HMETAFILE = *_System_DeclareHandle_HMETAFILE
+Type _System_DeclareHandle_HINSTANCE:unused As DWord:End Type
+TypeDef HINSTANCE = *_System_DeclareHandle_HINSTANCE
+TypeDef HMODULE = HINSTANCE
+Type _System_DeclareHandle_HPALETTE:unused As DWord:End Type
+TypeDef HPALETTE = *_System_DeclareHandle_HPALETTE
+Type _System_DeclareHandle_HPEN:unused As DWord:End Type
+TypeDef HPEN = *_System_DeclareHandle_HPEN
+Type _System_DeclareHandle_HRGN:unused As DWord:End Type
+TypeDef HRGN = *_System_DeclareHandle_HRGN
+Type _System_DeclareHandle_HRSRC:unused As DWord:End Type
+TypeDef HRSRC = *_System_DeclareHandle_HRSRC
+Type _System_DeclareHandle_HSPRITE:unused As DWord:End Type
+TypeDef HSPRITE = *_System_DeclareHandle_HSPRITE
+Type _System_DeclareHandle_HSTR:unused As DWord:End Type
+TypeDef HSTR = *_System_DeclareHandle_HSTR
+Type _System_DeclareHandle_HTASK:unused As DWord:End Type
+TypeDef HTASK = *_System_DeclareHandle_HTASK
+Type _System_DeclareHandle_HWINSTA:unused As DWord:End Type
+TypeDef HWINSTA = *_System_DeclareHandle_HWINSTA
+Type _System_DeclareHandle_HKL:unused As DWord:End Type
+TypeDef HKL = *_System_DeclareHandle_HKL
+
+Type _System_DeclareHandle_HWINEVENTHOOK:unused As DWord:End Type
+TypeDef HWINEVENTHOOK = *_System_DeclareHandle_HWINEVENTHOOK
+
+'#if(WINVER >= 0x0500)
+Type _System_DeclareHandle_HMONITOR:unused As DWord:End Type
+TypeDef HMONITOR = *_System_DeclareHandle_HMONITOR
+Type _System_DeclareHandle_HUMPD:unused As DWord:End Type
+TypeDef HUMPD = *_System_DeclareHandle_HUMPD
+'#endif
+
+TypeDef HFILE = Long
+TypeDef HCURSOR = HICON
+
+TypeDef COLORREF = DWord
+TypeDef LPCOLORREF = *DWord
+
+Const HFILE_ERROR = ((-1) As HFILE)
+
+Type RECT
+	left As Long
+	top As Long
+	right As Long
+	bottom As Long
+End Type
+
+TypeDef PRECT = *RECT
+TypeDef NPRECT = *RECT
+TypeDef LPRECT = *RECT
+TypeDef LPCRECT = *RECT
+
+TypeDef RECTL = RECT
+TypeDef PRECTL = *RECTL
+TypeDef LPRECTL = *RECTL
+TypeDef LPCRECTL = *RECTL
+
+Type POINTAPI
+	x As Long
+	y As Long
+End Type
+
+TypeDef PPOINT = *POINTAPI
+TypeDef NPPOINT = *POINTAPI
+TypeDef LPPOINT = *POINTAPI
+
+TypeDef POINTL = POINTAPI
+TypeDef PPOINTL = *POINTL
+
+Type SIZE
+	cx As Long
+	cy As Long
+End Type
+
+TypeDef PSIZE = *SIZE
+TypeDef LPSIZE = *SIZE
+
+TypeDef SIZEL = SIZE
+TypeDef PSIZEL = *SIZEL
+TypeDef LPSIZEL = *SIZEL
+
+Type POINTS
+	x As Integer
+	y As Integer
+End Type
+
+TypeDef PPOINTS = *POINTS
+TypeDef LPPOINTS = *POINTS
+
+Type FILETIME
+	dwLowDateTime As DWord
+	dwHighDateTime As DWord
+End Type
+
+TypeDef PFILETIME = *FILETIME
+TypeDef LPFILETIME = *FILETIME
+
+Const DM_UPDATE = 1
+Const DM_COPY = 2
+Const DM_PROMPT = 4
+Const DM_MODIFY = 8
+
+Const DM_IN_BUFFER = DM_MODIFY
+Const DM_IN_PROMPT = DM_PROMPT
+Const DM_OUT_BUFFER = DM_COPY
+Const DM_OUT_DEFAULT = DM_UPDATE
+
+Const DC_FIELDS = 1
+Const DC_PAPERS = 2
+Const DC_PAPERSIZE = 3
+Const DC_MINEXTENT = 4
+Const DC_MAXEXTENT = 5
+Const DC_BINS = 6
+Const DC_DUPLEX = 7
+Const DC_SIZE = 8
+Const DC_EXTRA = 9
+Const DC_VERSION = 10
+Const DC_DRIVER = 11
+Const DC_BINNAMES = 12
+Const DC_ENUMRESOLUTIONS = 13
+Const DC_FILEDEPENDENCIES = 14
+Const DC_TRUETYPE = 15
+Const DC_PAPERNAMES = 16
+Const DC_ORIENTATION = 17
+Const DC_COPIES = 18
Index: /trunk/ab5.0/ablib/src/windows.sbp
===================================================================
--- /trunk/ab5.0/ablib/src/windows.sbp	(revision 506)
+++ /trunk/ab5.0/ablib/src/windows.sbp	(revision 506)
@@ -0,0 +1,45 @@
+' Windows.sbp - declarations file for Windows API.
+
+TypeDef OLECHAR = WCHAR
+TypeDef LPOLESTR = *OLECHAR
+TypeDef LPCOLESTR = *OLECHAR
+
+TypeDef LANGID = Word
+TypeDef LCID = DWord
+TypeDef LCTYPE = DWord
+TypeDef LGRPID = DWord
+
+TypeDef PROPID = DWord
+
+#require <windef.ab>
+#require <api_winerror.sbp>
+#require <api_system.sbp>
+#require <api_gdi.sbp>
+#require <api_window.sbp>
+#require <api_shell.sbp>
+#require <api_msg.sbp>
+#require <api_windowstyles.sbp>
+#require <api_winspool.sbp>
+#require <api_console.sbp>
+#require <winver.ab>
+#require <api_reg.sbp>
+
+#ifndef WIN32_LEAN_AND_MEAN
+#require <api_mmsys.sbp>
+#require <ole2.ab>
+#require <api_commdlg.sbp>
+#endif
+
+#ifdef INC_OLE2
+#require <ole2.ab>
+#endif
+
+#ifndef NOIME
+#require <api_imm.sbp>
+#endif
+
+#require <api_commctrl.sbp>
+#require <api_winsock2.sbp>
+
+Const GET_X_LPARAM(lp) = ((LOWORD(lp) As Integer) As Long)
+Const GET_Y_LPARAM(lp) = ((HIWORD(lp) As Integer) As Long)
Index: /trunk/ab5.0/ablib/src/winver.ab
===================================================================
--- /trunk/ab5.0/ablib/src/winver.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/winver.ab	(revision 506)
@@ -0,0 +1,208 @@
+' Winver.ab
+
+#ifdef UNICODE
+Const _FuncName_VerFindFile = "VerFindFileW"
+Const _FuncName_VerInstallFile = "VerInstallFileW"
+Const _FuncName_GetFileVersionInfoSize = "GetFileVersionInfoSizeW"
+Const _FuncName_GetFileVersionInfo = "GetFileVersionInfoW"
+Const _FuncName_GetFileVersionInfoSizeEx = "GetFileVersionInfoSizeExW"
+Const _FuncName_GetFileVersionInfoEx = "GetFileVersionInfoExW"
+Const _FuncName_VerLanguageName = "VerLanguageNameW"
+Const _FuncName_VerQueryValue = "VerQueryValueW"
+#else
+Const _FuncName_VerFindFile = "VerFindFileA"
+Const _FuncName_VerInstallFile = "VerInstallFileA"
+Const _FuncName_GetFileVersionInfoSize = "GetFileVersionInfoSizeA"
+Const _FuncName_GetFileVersionInfo = "GetFileVersionInfoA"
+Const _FuncName_GetFileVersionInfoSizeEx = "GetFileVersionInfoSizeExA"
+Const _FuncName_GetFileVersionInfoEx = "GetFileVersionInfoExA"
+Const _FuncName_VerLanguageName = "VerLanguageNameA"
+Const _FuncName_VerQueryValue = "VerQueryValueA"
+#endif
+
+' Symbols
+Const VS_FILE_INFO = RT_VERSION
+Const VS_VERSION_INFO = 1
+Const VS_USER_DEFINED = 100
+
+' VS_VERSION.dwFileFlags
+Const VS_FFI_SIGNATURE = &hFEEF04BD
+Const VS_FFI_STRUCVERSION = &h00010000
+Const VS_FFI_FILEFLAGSMASK = &h0000003F
+
+' VS_VERSION.dwFileFlags
+Const VS_FF_DEBUG = &h00000001
+Const VS_FF_PRERELEASE = &h00000002
+Const VS_FF_PATCHED = &h00000004
+Const VS_FF_PRIVATEBUILD = &h00000008
+Const VS_FF_INFOINFERRED = &h00000010
+Const VS_FF_SPECIALBUILD = &h00000020
+
+' VS_VERSION.dwFileOS
+Const VOS_UNKNOWN = &h00000000
+Const VOS_DOS = &h00010000
+Const VOS_OS216 = &h00020000
+Const VOS_OS232 = &h00030000
+Const VOS_NT = &h00040000
+Const VOS_WINCE = &h00050000
+
+Const VOS__BASE = &h00000000
+Const VOS__WINDOWS16 = &h00000001
+Const VOS__PM16 = &h00000002
+Const VOS__PM32 = &h00000003
+Const VOS__WINDOWS32 = &h00000004
+
+Const VOS_DOS_WINDOWS16 = &h00010001
+Const VOS_DOS_WINDOWS32 = &h00010004
+Const VOS_OS216_PM16 = &h00020002
+Const VOS_OS232_PM32 = &h00030003
+Const VOS_NT_WINDOWS32 = &h00040004
+
+' VS_VERSION.dwFileType
+Const VFT_UNKNOWN = &h00000000
+Const VFT_APP = &h00000001
+Const VFT_DLL = &h00000002
+Const VFT_DRV = &h00000003
+Const VFT_FONT = &h00000004
+Const VFT_VXD = &h00000005
+Const VFT_STATIC_LIB = &h00000007
+
+' VS_VERSION.dwFileSubtype for VFT_WINDOWS_DRV
+Const VFT2_UNKNOWN = &h00000000
+Const VFT2_DRV_PRINTER = &h00000001
+Const VFT2_DRV_KEYBOARD = &h00000002
+Const VFT2_DRV_LANGUAGE = &h00000003
+Const VFT2_DRV_DISPLAY = &h00000004
+Const VFT2_DRV_MOUSE = &h00000005
+Const VFT2_DRV_NETWORK = &h00000006
+Const VFT2_DRV_SYSTEM = &h00000007
+Const VFT2_DRV_INSTALLABLE = &h00000008
+Const VFT2_DRV_SOUND = &h00000009
+Const VFT2_DRV_COMM = &h0000000A
+Const VFT2_DRV_INPUTMETHOD = &h0000000B
+Const VFT2_DRV_VERSIONED_PRINTER = &h0000000C
+
+' VS_VERSION.dwFileSubtype for VFT_WINDOWS_FONT
+Const VFT2_FONT_RASTER = &h00000001
+Const VFT2_FONT_VECTOR = &h00000002
+Const VFT2_FONT_TRUETYPE = &h00000003
+
+' VerFindFile() flags
+Const VFFF_ISSHAREDFILE = &h0001
+
+Const VFF_CURNEDEST = &h0001
+Const VFF_FILEINUSE = &h0002
+Const VFF_BUFFTOOSMALL = &h0004
+
+' VerInstallFile() flags
+Const VIFF_FORCEINSTALL = &h0001
+Const VIFF_DONTDELETEOLD = &h0002
+
+Const VIF_TEMPFILE = &h00000001
+Const VIF_MISMATCH = &h00000002
+Const VIF_SRCOLD = &h00000004
+
+Const VIF_DIFFLANG = &h00000008
+Const VIF_DIFFCODEPG = &h00000010
+Const VIF_DIFFTYPE = &h00000020
+
+Const VIF_WRITEPROT = &h00000040
+Const VIF_FILEINUSE = &h00000080
+Const VIF_OUTOFSPACE = &h00000100
+Const VIF_ACCESSVIOLATION = &h00000200
+Const VIF_SHARINGVIOLATION = &h00000400
+Const VIF_CANNOTCREATE = &h00000800
+Const VIF_CANNOTDELETE = &h00001000
+Const VIF_CANNOTRENAME = &h00002000
+Const VIF_CANNOTDELETECUR = &h00004000
+Const VIF_OUTOFMEMORY = &h00008000
+
+Const VIF_CANNOTREADSRC = &h00010000
+Const VIF_CANNOTREADDST = &h00020000
+
+Const VIF_BUFFTOOSMALL = &h00040000
+Const VIF_CANNOTLOADLZ32 = &h00080000
+Const VIF_CANNOTLOADCABINET = &h00100000
+
+Const FILE_VER_GET_LOCALISED = &h01
+Const FILE_VER_GET_NEUTRAL = &h02
+
+' Types and structures
+
+Type VS_FIXEDFILEINFO
+	dwSignature As DWord
+	dwStrucVersion As DWord
+	dwFileVersionMS As DWord
+	dwFileVersionLS As DWord
+	dwProductVersionMS As DWord
+	dwProductVersionLS As DWord
+	dwFileFlagsMask As DWord
+	dwFileFlags As DWord
+	dwFileOS As DWord
+	dwFileType As DWord
+	dwFileSubtype As DWord
+	dwFileDateMS As DWord
+	dwFileDateLS As DWord
+End Type
+
+' Function prototypes
+
+Declare Function VerFindFile Lib "version" Alias _FuncName_VerFindFile (
+	uFlags As DWord,
+	szFileName As LPCTSTR,
+	szWinDir As LPCTSTR,
+	szAppDir As LPCTSTR,
+	szCurDir As LPTSTR,
+	ByRef uCurDirLen As DWord,
+	szDestDir As LPTSTR,
+	ByRef uDestDirLen As DWord _
+) As DWord
+
+Declare Function VerInstallFile Lib "version" Alias _FuncName_VerInstallFile (
+	uFlags As DWord,
+	szSrcFileName As LPCTSTR,
+	szDestFileName As LPCTSTR,
+	szSrcDir As LPCTSTR,
+	szDestDir As LPCTSTR,
+	szTmpFile As LPTSTR,
+	ByRef uTmpFileLen As DWord _
+) As DWord
+
+Declare Function GetFileVersionInfoSize Lib "version" Alias _FuncName_GetFileVersionInfoSize (
+	lptstrFilename As LPCTSTR,
+	ByRef dwHandle As DWord _
+) As DWord
+
+Declare Function GetFileVersionInfo Lib "version" Alias _FuncName_GetFileVersionInfo (
+	lptstrFilename As LPCTSTR,
+	dwHandle As DWord,
+	dwLen As DWord,
+	lpData As VoidPtr _
+) As BOOL
+
+Declare Function GetFileVersionInfoSizeEx Lib "version" Alias _FuncName_GetFileVersionInfoSizeEx (
+	dwFlags As DWord,
+	lptstrFilename As LPCTSTR,
+	ByRef dwHandle As DWord _
+) As DWord
+
+Declare Function GetFileVersionInfoEx Lib "version" Alias _FuncName_GetFileVersionInfoEx (
+	dwFlags As DWord,
+	lptstrFilename As LPCTSTR,
+	dwHandle As DWord,
+	dwLen As DWord,
+	lpData As VoidPtr _
+) As BOOL
+
+Declare Function VerLanguageName Lib "version" Alias _FuncName_VerLanguageName (
+	wLang As DWord,
+	szLang As LPTSTR,
+	cchLang As DWord _
+) As DWord
+
+Declare Function VerQueryValue Lib "version" Alias _FuncName_VerQueryValue (
+	pBlock As VoidPtr,
+	lpSubBlock As LPCTSTR,
+	ByRef lpBuffer As VoidPtr,
+	ByRef uLen As DWord _
+) As BOOL
Index: /trunk/ab5.0/ablib/src/wtypes.ab
===================================================================
--- /trunk/ab5.0/ablib/src/wtypes.ab	(revision 506)
+++ /trunk/ab5.0/ablib/src/wtypes.ab	(revision 506)
@@ -0,0 +1,595 @@
+'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
