GetBlob() abstract private method

abstract private GetBlob ( int blobIndex ) : IKVM.Reflection.Reader.ByteReader
blobIndex int
return IKVM.Reflection.Reader.ByteReader
コード例 #1
0
ファイル: CustomAttributeData.cs プロジェクト: weeble/mono
        private void LazyParseArguments()
        {
            ByteReader br = module.GetBlob(module.CustomAttribute.records[customAttributeIndex].Value);

            if (br.Length == 0)
            {
                // it's legal to have an empty blob
                lazyConstructorArguments = Empty <CustomAttributeTypedArgument> .Array;
                lazyNamedArguments       = Empty <CustomAttributeNamedArgument> .Array;
            }
            else
            {
                if (br.ReadUInt16() != 1)
                {
                    throw new BadImageFormatException();
                }
                lazyConstructorArguments = ReadConstructorArguments(module.Assembly, br, Constructor);
                lazyNamedArguments       = ReadNamedArguments(module.Assembly, br, br.ReadUInt16(), Constructor.DeclaringType);
            }
        }
コード例 #2
0
ファイル: CustomAttributeData.cs プロジェクト: weeble/mono
        internal static void ReadDeclarativeSecurity(Module module, int index, List <CustomAttributeData> list)
        {
            Universe   u      = module.universe;
            Assembly   asm    = module.Assembly;
            int        action = module.DeclSecurity.records[index].Action;
            ByteReader br     = module.GetBlob(module.DeclSecurity.records[index].PermissionSet);

            if (br.PeekByte() == '.')
            {
                br.ReadByte();
                int count = br.ReadCompressedInt();
                for (int j = 0; j < count; j++)
                {
                    Type            type        = ReadType(asm, br);
                    ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
                    // LAMESPEC there is an additional length here (probably of the named argument list)
                    byte[] blob = br.ReadBytes(br.ReadCompressedInt());
                    list.Add(new CustomAttributeData(asm, constructor, action, blob, index));
                }
            }
            else
            {
                // .NET 1.x format (xml)
                char[] buf = new char[br.Length / 2];
                for (int i = 0; i < buf.Length; i++)
                {
                    buf[i] = br.ReadChar();
                }
                string          xml         = new String(buf);
                ConstructorInfo constructor = u.System_Security_Permissions_PermissionSetAttribute.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
                List <CustomAttributeNamedArgument> args = new List <CustomAttributeNamedArgument>();
                args.Add(new CustomAttributeNamedArgument(GetProperty(u.System_Security_Permissions_PermissionSetAttribute, "XML", u.System_String),
                                                          new CustomAttributeTypedArgument(u.System_String, xml)));
                list.Add(new CustomAttributeData(asm.ManifestModule, constructor, new object[] { action }, args));
            }
        }
コード例 #3
0
		internal static bool ReadFieldMarshal(Module module, int token, out FieldMarshal fm)
		{
			fm = new FieldMarshal();
			foreach (int i in module.FieldMarshal.Filter(token))
			{
				ByteReader blob = module.GetBlob(module.FieldMarshal.records[i].NativeType);
				fm.UnmanagedType = (UnmanagedType)blob.ReadCompressedUInt();
				if (fm.UnmanagedType == UnmanagedType.LPArray)
				{
					fm.ArraySubType = (UnmanagedType)blob.ReadCompressedUInt();
					if (fm.ArraySubType == NATIVE_TYPE_MAX)
					{
						fm.ArraySubType = null;
					}
					if (blob.Length != 0)
					{
						fm.SizeParamIndex = (short)blob.ReadCompressedUInt();
						if (blob.Length != 0)
						{
							fm.SizeConst = blob.ReadCompressedUInt();
							if (blob.Length != 0 && blob.ReadCompressedUInt() == 0)
							{
								fm.SizeParamIndex = null;
							}
						}
					}
				}
				else if (fm.UnmanagedType == UnmanagedType.SafeArray)
				{
					if (blob.Length != 0)
					{
						fm.SafeArraySubType = (VarEnum)blob.ReadCompressedUInt();
						if (blob.Length != 0)
						{
							fm.SafeArrayUserDefinedSubType = ReadType(module, blob);
						}
					}
				}
				else if (fm.UnmanagedType == UnmanagedType.ByValArray)
				{
					fm.SizeConst = blob.ReadCompressedUInt();
					if (blob.Length != 0)
					{
						fm.ArraySubType = (UnmanagedType)blob.ReadCompressedUInt();
					}
				}
				else if (fm.UnmanagedType == UnmanagedType.ByValTStr)
				{
					fm.SizeConst = blob.ReadCompressedUInt();
				}
				else if (fm.UnmanagedType == UnmanagedType.Interface
					|| fm.UnmanagedType == UnmanagedType.IDispatch
					|| fm.UnmanagedType == UnmanagedType.IUnknown)
				{
					if (blob.Length != 0)
					{
						fm.IidParameterIndex = blob.ReadCompressedUInt();
					}
				}
				else if (fm.UnmanagedType == UnmanagedType.CustomMarshaler)
				{
					blob.ReadCompressedUInt();
					blob.ReadCompressedUInt();
					fm.MarshalType = ReadString(blob);
					fm.MarshalCookie = ReadString(blob);

					TypeNameParser parser = TypeNameParser.Parse(fm.MarshalType, false);
					if (!parser.Error)
					{
						fm.MarshalTypeRef = parser.GetType(module.universe, module, false, fm.MarshalType, false, false);
					}
				}
				return true;
			}
			return false;
		}
コード例 #4
0
		internal static void ReadDeclarativeSecurity(Module module, int index, List<CustomAttributeData> list)
		{
			Universe u = module.universe;
			Assembly asm = module.Assembly;
			int action = module.DeclSecurity.records[index].Action;
			ByteReader br = module.GetBlob(module.DeclSecurity.records[index].PermissionSet);
			if (br.PeekByte() == '.')
			{
				br.ReadByte();
				int count = br.ReadCompressedUInt();
				for (int j = 0; j < count; j++)
				{
					Type type = ReadType(module, br);
					ConstructorInfo constructor = type.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
					// LAMESPEC there is an additional length here (probably of the named argument list)
					byte[] blob = br.ReadBytes(br.ReadCompressedUInt());
					list.Add(new CustomAttributeData(asm, constructor, action, blob, index));
				}
			}
			else
			{
				// .NET 1.x format (xml)
				char[] buf = new char[br.Length / 2];
				for (int i = 0; i < buf.Length; i++)
				{
					buf[i] = br.ReadChar();
				}
				string xml = new String(buf);
				ConstructorInfo constructor = u.System_Security_Permissions_PermissionSetAttribute.GetPseudoCustomAttributeConstructor(u.System_Security_Permissions_SecurityAction);
				List<CustomAttributeNamedArgument> args = new List<CustomAttributeNamedArgument>();
				args.Add(new CustomAttributeNamedArgument(GetProperty(null, u.System_Security_Permissions_PermissionSetAttribute, "XML", u.System_String),
					new CustomAttributeTypedArgument(u.System_String, xml)));
				list.Add(new CustomAttributeData(asm.ManifestModule, constructor, new object[] { action }, args));
			}
		}
コード例 #5
0
        internal static bool ReadFieldMarshal(Module module, int token, out FieldMarshal fm)
        {
            fm = new FieldMarshal();
            foreach (int i in module.FieldMarshal.Filter(token))
            {
                ByteReader blob = module.GetBlob(module.FieldMarshal.records[i].NativeType);
                fm.UnmanagedType = (UnmanagedType)blob.ReadCompressedInt();
                if (fm.UnmanagedType == UnmanagedType.LPArray)
                {
                    fm.ArraySubType = (UnmanagedType)blob.ReadCompressedInt();
                    if (fm.ArraySubType == NATIVE_TYPE_MAX)
                    {
                        fm.ArraySubType = null;
                    }
                    if (blob.Length != 0)
                    {
                        fm.SizeParamIndex = (short)blob.ReadCompressedInt();
                        if (blob.Length != 0)
                        {
                            fm.SizeConst = blob.ReadCompressedInt();
                            if (blob.Length != 0 && blob.ReadCompressedInt() == 0)
                            {
                                fm.SizeParamIndex = null;
                            }
                        }
                    }
                }
                else if (fm.UnmanagedType == UnmanagedType.SafeArray)
                {
                    if (blob.Length != 0)
                    {
                        fm.SafeArraySubType = (VarEnum)blob.ReadCompressedInt();
                        if (blob.Length != 0)
                        {
                            fm.SafeArrayUserDefinedSubType = ReadType(module, blob);
                        }
                    }
                }
                else if (fm.UnmanagedType == UnmanagedType.ByValArray)
                {
                    fm.SizeConst = blob.ReadCompressedInt();
                    if (blob.Length != 0)
                    {
                        fm.ArraySubType = (UnmanagedType)blob.ReadCompressedInt();
                    }
                }
                else if (fm.UnmanagedType == UnmanagedType.ByValTStr)
                {
                    fm.SizeConst = blob.ReadCompressedInt();
                }
                else if (fm.UnmanagedType == UnmanagedType.Interface ||
                         fm.UnmanagedType == UnmanagedType.IDispatch ||
                         fm.UnmanagedType == UnmanagedType.IUnknown)
                {
                    if (blob.Length != 0)
                    {
                        fm.IidParameterIndex = blob.ReadCompressedInt();
                    }
                }
                else if (fm.UnmanagedType == UnmanagedType.CustomMarshaler)
                {
                    blob.ReadCompressedInt();
                    blob.ReadCompressedInt();
                    fm.MarshalType   = ReadString(blob);
                    fm.MarshalCookie = ReadString(blob);

                    TypeNameParser parser = TypeNameParser.Parse(fm.MarshalType, false);
                    if (!parser.Error)
                    {
                        fm.MarshalTypeRef = parser.GetType(module.universe, module.Assembly, false, fm.MarshalType, false, false);
                    }
                }
                return(true);
            }
            return(false);
        }
コード例 #6
0
ファイル: MarshalSpec.cs プロジェクト: raj581/Marvin
        internal static CustomAttributeData GetMarshalAsAttribute(Module module, int token)
        {
            // TODO use binary search?
            for (int i = 0; i < module.FieldMarshal.records.Length; i++)
            {
                if (module.FieldMarshal.records[i].Parent == token)
                {
                    ByteReader    blob                        = module.GetBlob(module.FieldMarshal.records[i].NativeType);
                    UnmanagedType unmanagedType               = (UnmanagedType)blob.ReadCompressedInt();
                    UnmanagedType?arraySubType                = null;
                    short?        sizeParamIndex              = null;
                    int?          sizeConst                   = null;
                    VarEnum?      safeArraySubType            = null;
                    Type          safeArrayUserDefinedSubType = null;
                    int?          iidParameterIndex           = null;
                    string        marshalType                 = null;
                    string        marshalCookie               = null;
                    Type          marshalTypeRef              = null;
                    if (unmanagedType == UnmanagedType.LPArray)
                    {
                        arraySubType = (UnmanagedType)blob.ReadCompressedInt();
                        if (arraySubType == NATIVE_TYPE_MAX)
                        {
                            arraySubType = null;
                        }
                        if (blob.Length != 0)
                        {
                            sizeParamIndex = (short)blob.ReadCompressedInt();
                            if (blob.Length != 0)
                            {
                                sizeConst = blob.ReadCompressedInt();
                                if (blob.Length != 0 && blob.ReadCompressedInt() == 0)
                                {
                                    sizeParamIndex = null;
                                }
                            }
                        }
                    }
                    else if (unmanagedType == UnmanagedType.SafeArray)
                    {
                        if (blob.Length != 0)
                        {
                            safeArraySubType = (VarEnum)blob.ReadCompressedInt();
                            if (blob.Length != 0)
                            {
                                safeArrayUserDefinedSubType = ReadType(module, blob);
                            }
                        }
                    }
                    else if (unmanagedType == UnmanagedType.ByValArray)
                    {
                        sizeConst = blob.ReadCompressedInt();
                        if (blob.Length != 0)
                        {
                            arraySubType = (UnmanagedType)blob.ReadCompressedInt();
                        }
                    }
                    else if (unmanagedType == UnmanagedType.ByValTStr)
                    {
                        sizeConst = blob.ReadCompressedInt();
                    }
                    else if (unmanagedType == UnmanagedType.Interface ||
                             unmanagedType == UnmanagedType.IDispatch ||
                             unmanagedType == UnmanagedType.IUnknown)
                    {
                        if (blob.Length != 0)
                        {
                            iidParameterIndex = blob.ReadCompressedInt();
                        }
                    }
                    else if (unmanagedType == UnmanagedType.CustomMarshaler)
                    {
                        blob.ReadCompressedInt();
                        blob.ReadCompressedInt();
                        marshalType   = ReadString(blob);
                        marshalCookie = ReadString(blob);

                        TypeNameParser parser = TypeNameParser.Parse(marshalType, false);
                        if (!parser.Error)
                        {
                            marshalTypeRef = parser.GetType(module.universe, module.Assembly, false, marshalType, false);
                        }
                    }

                    Type typeofMarshalAs     = module.universe.System_Runtime_InteropServices_MarshalAsAttribute;
                    Type typeofUnmanagedType = module.universe.System_Runtime_InteropServices_UnmanagedType;
                    Type typeofVarEnum       = module.universe.System_Runtime_InteropServices_VarEnum;
                    Type typeofType          = module.universe.System_Type;
                    List <CustomAttributeNamedArgument> named = new List <CustomAttributeNamedArgument>();
                    if (arraySubType != null)
                    {
                        AddNamedArgument(named, typeofMarshalAs, "ArraySubType", typeofUnmanagedType, arraySubType.Value);
                    }
                    if (sizeParamIndex != null)
                    {
                        AddNamedArgument(named, typeofMarshalAs, "SizeParamIndex", module.universe.System_Int16, sizeParamIndex.Value);
                    }
                    if (sizeConst != null)
                    {
                        AddNamedArgument(named, typeofMarshalAs, "SizeConst", module.universe.System_Int32, sizeConst.Value);
                    }
                    if (safeArraySubType != null)
                    {
                        AddNamedArgument(named, typeofMarshalAs, "SafeArraySubType", typeofVarEnum, safeArraySubType.Value);
                    }
                    if (safeArrayUserDefinedSubType != null)
                    {
                        AddNamedArgument(named, typeofMarshalAs, "SafeArrayUserDefinedSubType", typeofType, safeArrayUserDefinedSubType);
                    }
                    if (iidParameterIndex != null)
                    {
                        AddNamedArgument(named, typeofMarshalAs, "IidParameterIndex", module.universe.System_Int32, iidParameterIndex.Value);
                    }
                    if (marshalType != null)
                    {
                        AddNamedArgument(named, typeofMarshalAs, "MarshalType", module.universe.System_String, marshalType);
                    }
                    if (marshalTypeRef != null)
                    {
                        AddNamedArgument(named, typeofMarshalAs, "MarshalTypeRef", module.universe.System_Type, marshalTypeRef);
                    }
                    if (marshalCookie != null)
                    {
                        AddNamedArgument(named, typeofMarshalAs, "MarshalCookie", module.universe.System_String, marshalCookie);
                    }
                    ConstructorInfo constructor = typeofMarshalAs.GetPseudoCustomAttributeConstructor(typeofUnmanagedType);
                    return(new CustomAttributeData(module, constructor, new object[] { unmanagedType }, named));
                }
            }
            throw new BadImageFormatException();
        }
コード例 #7
0
ファイル: MarshalSpec.cs プロジェクト: koush/mono
		internal static CustomAttributeData GetMarshalAsAttribute(Module module, int token)
		{
			// TODO use binary search?
			for (int i = 0; i < module.FieldMarshal.records.Length; i++)
			{
				if (module.FieldMarshal.records[i].Parent == token)
				{
					ByteReader blob = module.GetBlob(module.FieldMarshal.records[i].NativeType);
					UnmanagedType unmanagedType = (UnmanagedType)blob.ReadCompressedInt();
					UnmanagedType? arraySubType = null;
					short? sizeParamIndex = null;
					int? sizeConst = null;
					VarEnum? safeArraySubType = null;
					Type safeArrayUserDefinedSubType = null;
					int? iidParameterIndex = null;
					string marshalType = null;
					string marshalCookie = null;
					Type marshalTypeRef = null;
					if (unmanagedType == UnmanagedType.LPArray)
					{
						arraySubType = (UnmanagedType)blob.ReadCompressedInt();
						if (arraySubType == NATIVE_TYPE_MAX)
						{
							arraySubType = null;
						}
						if (blob.Length != 0)
						{
							sizeParamIndex = (short)blob.ReadCompressedInt();
							if (blob.Length != 0)
							{
								sizeConst = blob.ReadCompressedInt();
								if (blob.Length != 0 && blob.ReadCompressedInt() == 0)
								{
									sizeParamIndex = null;
								}
							}
						}
					}
					else if (unmanagedType == UnmanagedType.SafeArray)
					{
						if (blob.Length != 0)
						{
							safeArraySubType = (VarEnum)blob.ReadCompressedInt();
							if (blob.Length != 0)
							{
								safeArrayUserDefinedSubType = ReadType(module, blob);
							}
						}
					}
					else if (unmanagedType == UnmanagedType.ByValArray)
					{
						sizeConst = blob.ReadCompressedInt();
						if (blob.Length != 0)
						{
							arraySubType = (UnmanagedType)blob.ReadCompressedInt();
						}
					}
					else if (unmanagedType == UnmanagedType.ByValTStr)
					{
						sizeConst = blob.ReadCompressedInt();
					}
					else if (unmanagedType == UnmanagedType.Interface
						|| unmanagedType == UnmanagedType.IDispatch
						|| unmanagedType == UnmanagedType.IUnknown)
					{
						if (blob.Length != 0)
						{
							iidParameterIndex = blob.ReadCompressedInt();
						}
					}
					else if (unmanagedType == UnmanagedType.CustomMarshaler)
					{
						blob.ReadCompressedInt();
						blob.ReadCompressedInt();
						marshalType = ReadString(blob);
						marshalCookie = ReadString(blob);
						marshalTypeRef = module.Assembly.GetType(marshalType) ?? module.universe.GetType(marshalType);
					}

					Type typeofMarshalAs = module.universe.System_Runtime_InteropServices_MarshalAsAttribute;
					Type typeofUnmanagedType = module.universe.System_Runtime_InteropServices_UnmanagedType;
					Type typeofVarEnum = module.universe.System_Runtime_InteropServices_VarEnum;
					Type typeofType = module.universe.System_Type;
					List<CustomAttributeNamedArgument> named = new List<CustomAttributeNamedArgument>();
					if (arraySubType != null)
					{
						named.Add(new CustomAttributeNamedArgument(typeofMarshalAs.GetField("ArraySubType"), new CustomAttributeTypedArgument(typeofUnmanagedType, arraySubType.Value)));
					}
					if (sizeParamIndex != null)
					{
						named.Add(new CustomAttributeNamedArgument(typeofMarshalAs.GetField("SizeParamIndex"), new CustomAttributeTypedArgument(module.universe.System_Int16, sizeParamIndex.Value)));
					}
					if (sizeConst != null)
					{
						named.Add(new CustomAttributeNamedArgument(typeofMarshalAs.GetField("SizeConst"), new CustomAttributeTypedArgument(module.universe.System_Int32, sizeConst.Value)));
					}
					if (safeArraySubType != null)
					{
						named.Add(new CustomAttributeNamedArgument(typeofMarshalAs.GetField("SafeArraySubType"), new CustomAttributeTypedArgument(typeofVarEnum, safeArraySubType.Value)));
					}
					if (safeArrayUserDefinedSubType != null)
					{
						named.Add(new CustomAttributeNamedArgument(typeofMarshalAs.GetField("SafeArrayUserDefinedSubType"), new CustomAttributeTypedArgument(typeofType, safeArrayUserDefinedSubType)));
					}
					if (iidParameterIndex != null)
					{
						named.Add(new CustomAttributeNamedArgument(typeofMarshalAs.GetField("IidParameterIndex"), new CustomAttributeTypedArgument(module.universe.System_Int32, iidParameterIndex.Value)));
					}
					if (marshalType != null)
					{
						named.Add(new CustomAttributeNamedArgument(typeofMarshalAs.GetField("MarshalType"), new CustomAttributeTypedArgument(module.universe.System_String, marshalType)));
					}
					if (marshalTypeRef != null)
					{
						named.Add(new CustomAttributeNamedArgument(typeofMarshalAs.GetField("MarshalTypeRef"), new CustomAttributeTypedArgument(module.universe.System_Type, marshalTypeRef)));
					}
					if (marshalCookie != null)
					{
						named.Add(new CustomAttributeNamedArgument(typeofMarshalAs.GetField("MarshalCookie"), new CustomAttributeTypedArgument(module.universe.System_String, marshalCookie)));
					}
					ConstructorInfo constructor = typeofMarshalAs.GetConstructor(new Type[] { typeofUnmanagedType });
					return new CustomAttributeData(constructor, new object[] { unmanagedType }, named);
				}
			}
			throw new BadImageFormatException();
		}
コード例 #8
0
		internal static CustomAttributeData GetMarshalAsAttribute(Module module, int token)
		{
			foreach (int i in module.FieldMarshal.Filter(token))
			{
				ByteReader blob = module.GetBlob(module.FieldMarshal.records[i].NativeType);
				UnmanagedType unmanagedType = (UnmanagedType)blob.ReadCompressedInt();
				UnmanagedType? arraySubType = null;
				short? sizeParamIndex = null;
				int? sizeConst = null;
				VarEnum? safeArraySubType = null;
				Type safeArrayUserDefinedSubType = null;
				int? iidParameterIndex = null;
				string marshalType = null;
				string marshalCookie = null;
				Type marshalTypeRef = null;
				if (unmanagedType == UnmanagedType.LPArray)
				{
					arraySubType = (UnmanagedType)blob.ReadCompressedInt();
					if (arraySubType == NATIVE_TYPE_MAX)
					{
						arraySubType = null;
					}
					if (blob.Length != 0)
					{
						sizeParamIndex = (short)blob.ReadCompressedInt();
						if (blob.Length != 0)
						{
							sizeConst = blob.ReadCompressedInt();
							if (blob.Length != 0 && blob.ReadCompressedInt() == 0)
							{
								sizeParamIndex = null;
							}
						}
					}
				}
				else if (unmanagedType == UnmanagedType.SafeArray)
				{
					if (blob.Length != 0)
					{
						safeArraySubType = (VarEnum)blob.ReadCompressedInt();
						if (blob.Length != 0)
						{
							safeArrayUserDefinedSubType = ReadType(module, blob);
						}
					}
				}
				else if (unmanagedType == UnmanagedType.ByValArray)
				{
					sizeConst = blob.ReadCompressedInt();
					if (blob.Length != 0)
					{
						arraySubType = (UnmanagedType)blob.ReadCompressedInt();
					}
				}
				else if (unmanagedType == UnmanagedType.ByValTStr)
				{
					sizeConst = blob.ReadCompressedInt();
				}
				else if (unmanagedType == UnmanagedType.Interface
					|| unmanagedType == UnmanagedType.IDispatch
					|| unmanagedType == UnmanagedType.IUnknown)
				{
					if (blob.Length != 0)
					{
						iidParameterIndex = blob.ReadCompressedInt();
					}
				}
				else if (unmanagedType == UnmanagedType.CustomMarshaler)
				{
					blob.ReadCompressedInt();
					blob.ReadCompressedInt();
					marshalType = ReadString(blob);
					marshalCookie = ReadString(blob);

					TypeNameParser parser = TypeNameParser.Parse(marshalType, false);
					if (!parser.Error)
					{
						marshalTypeRef = parser.GetType(module.universe, module.Assembly, false, marshalType, false, false);
					}
				}

				Type typeofMarshalAs = module.universe.System_Runtime_InteropServices_MarshalAsAttribute;
				Type typeofUnmanagedType = module.universe.System_Runtime_InteropServices_UnmanagedType;
				Type typeofVarEnum = module.universe.System_Runtime_InteropServices_VarEnum;
				Type typeofType = module.universe.System_Type;
				List<CustomAttributeNamedArgument> named = new List<CustomAttributeNamedArgument>();
				if (arraySubType != null)
				{
					AddNamedArgument(named, typeofMarshalAs, "ArraySubType", typeofUnmanagedType, arraySubType.Value);
				}
				if (sizeParamIndex != null)
				{
					AddNamedArgument(named, typeofMarshalAs, "SizeParamIndex", module.universe.System_Int16, sizeParamIndex.Value);
				}
				if (sizeConst != null)
				{
					AddNamedArgument(named, typeofMarshalAs, "SizeConst", module.universe.System_Int32, sizeConst.Value);
				}
				if (safeArraySubType != null)
				{
					AddNamedArgument(named, typeofMarshalAs, "SafeArraySubType", typeofVarEnum, safeArraySubType.Value);
				}
				if (safeArrayUserDefinedSubType != null)
				{
					AddNamedArgument(named, typeofMarshalAs, "SafeArrayUserDefinedSubType", typeofType, safeArrayUserDefinedSubType);
				}
				if (iidParameterIndex != null)
				{
					AddNamedArgument(named, typeofMarshalAs, "IidParameterIndex", module.universe.System_Int32, iidParameterIndex.Value);
				}
				if (marshalType != null)
				{
					AddNamedArgument(named, typeofMarshalAs, "MarshalType", module.universe.System_String, marshalType);
				}
				if (marshalTypeRef != null)
				{
					AddNamedArgument(named, typeofMarshalAs, "MarshalTypeRef", module.universe.System_Type, marshalTypeRef);
				}
				if (marshalCookie != null)
				{
					AddNamedArgument(named, typeofMarshalAs, "MarshalCookie", module.universe.System_String, marshalCookie);
				}
				ConstructorInfo constructor = typeofMarshalAs.GetPseudoCustomAttributeConstructor(typeofUnmanagedType);
				return new CustomAttributeData(module, constructor, new object[] { unmanagedType }, named);
			}
			throw new BadImageFormatException();
		}