internal IRAssembly(IRAppDomain pAppDomain, CLIFile pCLIFile, bool pCORLibrary, bool pRuntimeLibrary) { AppDomain = pAppDomain; File = pCLIFile; CORLibrary = pCORLibrary; RuntimeLibrary = pRuntimeLibrary; }
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"); } } }
public void Read(CLIFile pFile) { Offset = pFile.ReadUInt32(); Size = pFile.ReadUInt32(); Name = pFile.ReadString(); uint headerSize = (uint)(sizeof(uint) * 2 + (Name.Length + 1)); if ((headerSize & 0x03) != 0) pFile.mCursor += (int)(4 - (headerSize & 0x03)); }
public void Read(CLIFile pFile) { SizeOfHeader = pFile.ReadUInt32(); MajorRuntimeVersion = pFile.ReadUInt16(); MinorRuntimeVersion = pFile.ReadUInt16(); Metadata.Read(pFile); Flags = pFile.ReadUInt32(); EntryPointToken = pFile.ReadUInt32(); EntryPointRVA = pFile.ReadUInt16(); Resources.Read(pFile); StrongNameSignature.Read(pFile); CodeManagerTable.Read(pFile); VTableFixups.Read(pFile); ExportAddressTableJumps.Read(pFile); ManagedNativeHeader.Read(pFile); }
public void Read(CLIFile pFile) { Name = pFile.ReadString(8); PhysicalAddress = VirtualSize = pFile.ReadUInt32(); VirtualAddress = pFile.ReadUInt32(); SizeOfRawData = pFile.ReadUInt32(); PointerToRawData = pFile.ReadUInt32(); PointerToRelocations = pFile.ReadUInt32(); PointerToLineNumbers = pFile.ReadUInt32(); NumberOfRelocations = pFile.ReadUInt16(); NumberOfLineNumbers = pFile.ReadUInt16(); Characteristics = pFile.ReadUInt32(); }
public bool Read(CLIFile pFile) { Magic = pFile.ReadUInt16(); MajorLinkerVersion = pFile.ReadByte(); MinorLinkerVersion = pFile.ReadByte(); SizeOfCode = pFile.ReadUInt32(); SizeOfInitializedData = pFile.ReadUInt32(); SizeOfUninitializedData = pFile.ReadUInt32(); AddressOfEntryPoint = pFile.ReadUInt32(); BaseOfCode = pFile.ReadUInt32(); BaseOfData = pFile.ReadUInt32(); ImageBase = pFile.ReadUInt32(); SectionAlignment = pFile.ReadUInt32(); FileAlignment = pFile.ReadUInt32(); MajorOperatingSystemVersion = pFile.ReadUInt16(); MinorOperatingSystemVersion = pFile.ReadUInt16(); MajorImageVersion = pFile.ReadUInt16(); MinorImageVersion = pFile.ReadUInt16(); MajorSubsystemVersion = pFile.ReadUInt16(); MinorSubsystemVersion = pFile.ReadUInt16(); Reserved = pFile.ReadUInt32(); SizeOfImage = pFile.ReadUInt32(); SizeOfHeaders = pFile.ReadUInt32(); Checksum = pFile.ReadUInt32(); Subsystem = pFile.ReadUInt16(); DllCharacteristics = pFile.ReadUInt16(); SizeOfStackReserve = pFile.ReadUInt32(); SizeOfStackCommit = pFile.ReadUInt32(); SizeOfHeapReserve = pFile.ReadUInt32(); SizeOfHeapCommit = pFile.ReadUInt32(); LoaderFlags = pFile.ReadUInt32(); NumberOfRVAAndSizes = pFile.ReadUInt32(); for (int index = 0; index < DataDirectories.Length; ++index) { DataDirectories[index] = new DataDirectory(); DataDirectories[index].Read(pFile); } return true; }
public void Read(CLIFile pFile) { VirtualAddress = pFile.ReadUInt32(); Size = pFile.ReadUInt32(); }
public void Read(CLIFile pFile) { Signature = pFile.ReadUInt32(); Machine = pFile.ReadUInt16(); NumberOfSections = pFile.ReadUInt16(); Timestamp = pFile.ReadUInt32(); PointerToSymbolTable = pFile.ReadUInt32(); NumberOfSymbols = pFile.ReadUInt32(); SizeOfOptionalHeader = pFile.ReadUInt16(); Characteristics = pFile.ReadUInt16(); }
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"); } } }
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"); } } }
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"); } } }
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"); } } }
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"); } } }
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"); } } }
public bool Read(CLIFile pFile) { Signature = pFile.ReadUInt32(); MajorVersion = pFile.ReadUInt16(); MinorVersion = pFile.ReadUInt16(); Reserved = pFile.ReadUInt32(); VersionLength = pFile.ReadUInt32(); Version = pFile.ReadBytes((int)VersionLength); Flags = pFile.ReadUInt16(); StreamCount = pFile.ReadUInt16(); Streams = new CLIMetadataStreamHeader[StreamCount]; for (int index = 0; index < Streams.Length; ++index) { Streams[index] = new CLIMetadataStreamHeader(); Streams[index].Read(pFile); } return true; }
public void Read(CLIFile pFile) { ReservedA = pFile.ReadUInt32(); MajorVersion = pFile.ReadByte(); MinorVersion = pFile.ReadByte(); HeapOffsetSizes = pFile.ReadByte(); ReservedB = pFile.ReadByte(); PresentTables = pFile.ReadUInt64(); SortedTables = pFile.ReadUInt64(); }
public void Read(CLIFile pFile) { Signature = pFile.ReadUInt16(); LastPageByteCount = pFile.ReadUInt16(); PageCount = pFile.ReadUInt16(); RelocationCount = pFile.ReadUInt16(); HeaderParagraphCount = pFile.ReadUInt16(); MinimumParagraphCount = pFile.ReadUInt16(); MaximumParagraphCount = pFile.ReadUInt16(); RegisterSS = pFile.ReadUInt16(); RegisterSP = pFile.ReadUInt16(); Checksum = pFile.ReadUInt16(); RegisterIP = pFile.ReadUInt16(); RegisterCS = pFile.ReadUInt16(); RelocationOffset = pFile.ReadUInt16(); Overlay = pFile.ReadUInt16(); for (int index = 0; index < ReservedA.Length; ++index) ReservedA[index] = pFile.ReadUInt16(); OEMIdentifier = pFile.ReadUInt16(); OEMInformation = pFile.ReadUInt16(); for (int index = 0; index < ReservedB.Length; ++index) ReservedB[index] = pFile.ReadUInt16(); NextHeaderOffset = pFile.ReadUInt32(); }