diff options
Diffstat (limited to 'src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs')
-rw-r--r-- | src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs | 188 |
1 files changed, 13 insertions, 175 deletions
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs b/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs index b5bde22057..ccba51e840 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs @@ -4,33 +4,14 @@ //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -namespace System.Runtime.InteropServices{ - using System; - using System.Reflection; - using System.Diagnostics; - using System.Diagnostics.Contracts; - - [AttributeUsage(AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] - public sealed class UnmanagedFunctionPointerAttribute : Attribute - { - CallingConvention m_callingConvention; - - public UnmanagedFunctionPointerAttribute(CallingConvention callingConvention) { m_callingConvention = callingConvention; } - - public CallingConvention CallingConvention { get { return m_callingConvention; } } - - public CharSet CharSet; - public bool BestFitMapping; - public bool ThrowOnUnmappableChar; - - // This field is ignored and marshaling behaves as if it was true (for historical reasons). - public bool SetLastError; - - // P/Invoke via delegate always preserves signature, HRESULT swapping is not supported. - //public bool PreserveSig; - } +using System; +using System.Reflection; +using System.Diagnostics; +using System.Diagnostics.Contracts; +namespace System.Runtime.InteropServices +{ [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] public sealed class TypeIdentifierAttribute : Attribute { @@ -118,7 +99,6 @@ namespace System.Runtime.InteropServices{ public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType) { _val = classInterfaceType; - } public ClassInterfaceAttribute(short classInterfaceType) { @@ -127,17 +107,6 @@ namespace System.Runtime.InteropServices{ public ClassInterfaceType Value { get { return _val; } } } - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Property, Inherited = false)] - public sealed class ComVisibleAttribute : Attribute - { - internal bool _val; - public ComVisibleAttribute(bool visibility) - { - _val = visibility; - } - public bool Value { get { return _val; } } - } - [AttributeUsage(AttributeTargets.Method, Inherited = false)] public sealed class LCIDConversionAttribute : Attribute { @@ -146,7 +115,7 @@ namespace System.Runtime.InteropServices{ { _val = lcid; } - public int Value { get {return _val;} } + public int Value { get { return _val; } } } [AttributeUsage(AttributeTargets.Class, Inherited = false)] @@ -157,10 +126,10 @@ namespace System.Runtime.InteropServices{ { _val = progId; } - public String Value { get {return _val;} } + public String Value { get { return _val; } } } - [AttributeUsage(AttributeTargets.Class, Inherited = true)] + [AttributeUsage(AttributeTargets.Class, Inherited = true)] public sealed class ComSourceInterfacesAttribute : Attribute { internal String _val; @@ -184,137 +153,7 @@ namespace System.Runtime.InteropServices{ { _val = sourceInterface1.FullName + "\0" + sourceInterface2.FullName + "\0" + sourceInterface3.FullName + "\0" + sourceInterface4.FullName; } - public String Value { get {return _val;} } - } - - [Serializable] - public enum VarEnum - { - 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_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_VECTOR = 0x1000, - VT_ARRAY = 0x2000, - VT_BYREF = 0x4000 - } - - [Serializable] - // Note that this enum should remain in-sync with the CorNativeType enum in corhdr.h - public enum UnmanagedType - { - Bool = 0x2, // 4 byte boolean value (true != 0, false == 0) - - I1 = 0x3, // 1 byte signed value - - U1 = 0x4, // 1 byte unsigned value - - I2 = 0x5, // 2 byte signed value - - U2 = 0x6, // 2 byte unsigned value - - I4 = 0x7, // 4 byte signed value - - U4 = 0x8, // 4 byte unsigned value - - I8 = 0x9, // 8 byte signed value - - U8 = 0xa, // 8 byte unsigned value - - R4 = 0xb, // 4 byte floating point - - R8 = 0xc, // 8 byte floating point - - Currency = 0xf, // A currency - - BStr = 0x13, // OLE Unicode BSTR - - LPStr = 0x14, // Ptr to SBCS string - - LPWStr = 0x15, // Ptr to Unicode string - - LPTStr = 0x16, // Ptr to OS preferred (SBCS/Unicode) string - - ByValTStr = 0x17, // OS preferred (SBCS/Unicode) inline string (only valid in structs) - - IUnknown = 0x19, // COM IUnknown pointer. - - IDispatch = 0x1a, // COM IDispatch pointer - - Struct = 0x1b, // Structure - - Interface = 0x1c, // COM interface - - SafeArray = 0x1d, // OLE SafeArray - - ByValArray = 0x1e, // Array of fixed size (only valid in structs) - - SysInt = 0x1f, // Hardware natural sized signed integer - - SysUInt = 0x20, - - VBByRefStr = 0x22, - - AnsiBStr = 0x23, // OLE BSTR containing SBCS characters - - TBStr = 0x24, // Ptr to OS preferred (SBCS/Unicode) BSTR - - VariantBool = 0x25, // OLE defined BOOLEAN (2 bytes, true == -1, false == 0) - - FunctionPtr = 0x26, // Function pointer - - AsAny = 0x28, // Paired with Object type and does runtime marshalling determination - - LPArray = 0x2a, // C style array - - LPStruct = 0x2b, // Pointer to a structure - - CustomMarshaler = 0x2c, - - Error = 0x2d, - - IInspectable = 0x2e, - - HString = 0x2f, // Windows Runtime HSTRING - - LPUTF8Str = 0x30, // UTF8 string + public String Value { get { return _val; } } } [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.ReturnValue, Inherited = false)] @@ -403,11 +242,11 @@ namespace System.Runtime.InteropServices{ public UnmanagedType Value { get { return _val; } } // Fields used with SubType = SafeArray. - public VarEnum SafeArraySubType; - public Type SafeArrayUserDefinedSubType; + public VarEnum SafeArraySubType; + public Type SafeArrayUserDefinedSubType; // Field used with iid_is attribute (interface pointers). - public int IidParameterIndex; + public int IidParameterIndex; // Fields used with SubType = ByValArray and LPArray. // Array size = parameter(PI) * PM + C @@ -639,7 +478,6 @@ namespace System.Runtime.InteropServices{ public CallingConvention CallingConvention; public bool BestFitMapping; public bool ThrowOnUnmappableChar; - } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false)] |