예제 #1
0
		public void LoadData(CLIFile pFile)
		{
			int token = 0;
			if (pFile.FieldTable.Length > HasConstantTypeMax16BitRows ||
				pFile.ParamTable.Length > HasConstantTypeMax16BitRows ||
				pFile.PropertyTable.Length > HasConstantTypeMax16BitRows) token = pFile.ReadInt32();
			else token = pFile.ReadUInt16();
			Type = (HasConstantType)(token & HasConstantTypeMask);
			token = (token >> HasConstantTypeBits) - 1;
			if (token >= 0)
			{
				switch (Type)
				{
					case HasConstantType.Field: Field = pFile.FieldTable[token]; break;
					case HasConstantType.Param: Param = pFile.ParamTable[token]; break;
					case HasConstantType.Property: Property = pFile.PropertyTable[token]; break;
					default: throw new BadImageFormatException("HasConstant Type");
				}
			}
		}
예제 #2
0
		public void LoadData(CLIFile pFile)
		{
			int token = 0;
			if (pFile.ModuleTable.Length > ResolutionScopeTypeMax16BitRows ||
				pFile.ModuleRefTable.Length > ResolutionScopeTypeMax16BitRows ||
				pFile.AssemblyRefTable.Length > ResolutionScopeTypeMax16BitRows ||
				pFile.TypeRefTable.Length > ResolutionScopeTypeMax16BitRows) token = pFile.ReadInt32();
			else token = pFile.ReadUInt16();
			Type = (ResolutionScopeType)(token & ResolutionScopeTypeMask);
			token = (token >> ResolutionScopeTypeBits) - 1;
			if (token >= 0)
			{
				switch (Type)
				{
					case ResolutionScopeType.Module: Module = pFile.ModuleTable[token]; break;
					case ResolutionScopeType.ModuleRef: ModuleRef = pFile.ModuleRefTable[token]; break;
					case ResolutionScopeType.AssemblyRef: AssemblyRef = pFile.AssemblyRefTable[token]; break;
					case ResolutionScopeType.TypeRef: TypeRef = pFile.TypeRefTable[token]; break;
					default: throw new BadImageFormatException("ResolutionScope Type");
				}
			}
		}
예제 #3
0
		public void LoadData(CLIFile pFile)
		{
			int token = 0;
			if (pFile.MethodDefTable.Length > MethodDefOrRefTypeMax16BitRows ||
				pFile.MemberRefTable.Length > MethodDefOrRefTypeMax16BitRows) token = pFile.ReadInt32();
			else token = pFile.ReadUInt16();
			Type = (MethodDefOrRefType)(token & MethodDefOrRefTypeMask);
			token = (token >> MethodDefOrRefTypeBits) - 1;
			if (token >= 0)
			{
				switch (Type)
				{
					case MethodDefOrRefType.MethodDef: MethodDef = pFile.MethodDefTable[token]; break;
					case MethodDefOrRefType.MemberRef: MemberRef = pFile.MemberRefTable[token]; break;
					default: throw new BadImageFormatException("MethodDefOrRef Type");
				}
			}
		}
예제 #4
0
		public void LoadData(CLIFile pFile)
		{
			int token = 0;
			if (pFile.FileTable.Length > ImplementationTypeMax16BitRows ||
				pFile.AssemblyRefTable.Length > ImplementationTypeMax16BitRows ||
				pFile.ExportedTypeTable.Length > ImplementationTypeMax16BitRows) token = pFile.ReadInt32();
			else token = pFile.ReadUInt16();
			Type = (ImplementationType)(token & ImplementationTypeMask);
			token = (token >> ImplementationTypeBits) - 1;
			if (token >= 0)
			{
				switch (Type)
				{
					case ImplementationType.File: File = pFile.FileTable[token]; break;
					case ImplementationType.AssemblyRef: AssemblyRef = pFile.AssemblyRefTable[token]; break;
					case ImplementationType.ExportedType: ExportedType = pFile.ExportedTypeTable[token]; break;
					default: throw new BadImageFormatException("Implementation Type");
				}
			}
		}
예제 #5
0
		public void LoadData(CLIFile pFile)
		{
			int token = 0;
			if (pFile.TypeDefTable.Length > TypeDefRefOrSpecTypeMax16BitRows ||
				pFile.TypeRefTable.Length > TypeDefRefOrSpecTypeMax16BitRows ||
				pFile.TypeSpecTable.Length > TypeDefRefOrSpecTypeMax16BitRows) token = pFile.ReadInt32();
			else token = pFile.ReadUInt16();
			Type = (TypeDefRefOrSpecType)(token & TypeDefRefOrSpecTypeMask);
			token = (token >> TypeDefRefOrSpecTypeBits) - 1;
			if (token >= 0)
			{
				switch (Type)
				{
					case TypeDefRefOrSpecType.TypeDef: TypeDef = pFile.TypeDefTable[token]; break;
					case TypeDefRefOrSpecType.TypeRef: TypeRef = pFile.TypeRefTable[token]; break;
					case TypeDefRefOrSpecType.TypeSpec: TypeSpec = pFile.TypeSpecTable[token]; break;
					default: throw new BadImageFormatException("TypeDefRefOrSpec Type");
				}
			}
		}
예제 #6
0
		public void LoadData(CLIFile pFile)
		{
			int token = 0;
			if (pFile.TypeDefTable.Length > HasDeclSecurityTypeMax16BitRows ||
				pFile.MethodDefTable.Length > HasDeclSecurityTypeMax16BitRows ||
				pFile.AssemblyTable.Length > HasDeclSecurityTypeMax16BitRows) token = pFile.ReadInt32();
			else token = pFile.ReadUInt16();
			Type = (HasDeclSecurityType)(token & HasDeclSecurityTypeMask);
			token = (token >> HasDeclSecurityTypeBits) - 1;
			if (token >= 0)
			{
				switch (Type)
				{
					case HasDeclSecurityType.TypeDef: TypeDef = pFile.TypeDefTable[token]; break;
					case HasDeclSecurityType.MethodDef: MethodDef = pFile.MethodDefTable[token]; break;
					case HasDeclSecurityType.Assembly: Assembly = pFile.AssemblyTable[token]; break;
					default: throw new BadImageFormatException("HasDeclSecurity Type");
				}
			}
		}
예제 #7
0
		public void LoadData(CLIFile pFile)
		{
			int token = 0;
			if (pFile.MethodDefTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.FieldTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.TypeRefTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.TypeDefTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.ParamTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.InterfaceImplTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.MemberRefTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.ModuleTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.DeclSecurityTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.PropertyTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.EventTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.StandAloneSigTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.ModuleRefTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.TypeSpecTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.AssemblyTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.AssemblyRefTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.FileTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.ExportedTypeTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.ManifestResourceTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.GenericParamTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.GenericParamConstraintTable.Length > HasCustomAttributeTypeMax16BitRows ||
				pFile.MethodSpecTable.Length > HasCustomAttributeTypeMax16BitRows) token = pFile.ReadInt32();
			else token = pFile.ReadUInt16();
			Type = (HasCustomAttributeType)(token & HasCustomAttributeTypeMask);
			token = (token >> HasCustomAttributeTypeBits) - 1;
			if (token >= 0)
			{
				switch (Type)
				{
					case HasCustomAttributeType.MethodDef: MethodDef = pFile.MethodDefTable[token]; break;
					case HasCustomAttributeType.Field: Field = pFile.FieldTable[token]; break;
					case HasCustomAttributeType.TypeRef: TypeRef = pFile.TypeRefTable[token]; break;
					case HasCustomAttributeType.TypeDef: TypeDef = pFile.TypeDefTable[token]; break;
					case HasCustomAttributeType.Param: Param = pFile.ParamTable[token]; break;
					case HasCustomAttributeType.InterfaceImpl: InterfaceImpl = pFile.InterfaceImplTable[token]; break;
					case HasCustomAttributeType.MemberRef: MemberRef = pFile.MemberRefTable[token]; break;
					case HasCustomAttributeType.Module: Module = pFile.ModuleTable[token]; break;
					case HasCustomAttributeType.DeclSecurity: DeclSecurity = pFile.DeclSecurityTable[token]; break;
					case HasCustomAttributeType.Property: Property = pFile.PropertyTable[token]; break;
					case HasCustomAttributeType.Event: Event = pFile.EventTable[token]; break;
					case HasCustomAttributeType.StandAloneSig: StandAloneSig = pFile.StandAloneSigTable[token]; break;
					case HasCustomAttributeType.ModuleRef: ModuleRef = pFile.ModuleRefTable[token]; break;
					case HasCustomAttributeType.TypeSpec: TypeSpec = pFile.TypeSpecTable[token]; break;
					case HasCustomAttributeType.Assembly: Assembly = pFile.AssemblyTable[token]; break;
					case HasCustomAttributeType.AssemblyRef: AssemblyRef = pFile.AssemblyRefTable[token]; break;
					case HasCustomAttributeType.File: File = pFile.FileTable[token]; break;
					case HasCustomAttributeType.ExportedType: ExportedType = pFile.ExportedTypeTable[token]; break;
					case HasCustomAttributeType.ManifestResource: ManifestResource = pFile.ManifestResourceTable[token]; break;
					case HasCustomAttributeType.GenericParam: GenericParam = pFile.GenericParamTable[token]; break;
					case HasCustomAttributeType.GenericParamConstraint: GenericParamConstraint = pFile.GenericParamConstraintTable[token]; break;
					case HasCustomAttributeType.MethodSpec: MethodSpec = pFile.MethodSpecTable[token]; break;
					default: throw new BadImageFormatException("HasCustomAttribute Type");
				}
			}
		}