public static void Link(CLIFile pFile) { for (int index = 0; index < pFile.CustomAttributeTable.Length; ++index) { pFile.CustomAttributeTable[index].LinkData(pFile); } }
public static void Load(CLIFile pFile) { for (int index = 0; index < pFile.AssemblyRefOSTable.Length; ++index) { pFile.AssemblyRefOSTable[index].LoadData(pFile); } }
public void LoadData(CLIFile pFile) { int token = 0; if (pFile.EventTable.Length > HasSemanticsTypeMax16BitRows || pFile.PropertyTable.Length > HasSemanticsTypeMax16BitRows) { token = pFile.ReadInt32(); } else { token = pFile.ReadUInt16(); } Type = (HasSemanticsType)(token & HasSemanticsTypeMask); token = (token >> HasSemanticsTypeBits) - 1; if (token >= 0) { switch (Type) { case HasSemanticsType.Event: Event = pFile.EventTable[token]; break; case HasSemanticsType.Property: Property = pFile.PropertyTable[token]; break; default: throw new BadImageFormatException("HasSemantics Type"); } } }
public void LoadData(CLIFile pFile) { int token = 0; if (pFile.FieldTable.Length > HasFieldMarshalTypeMax16BitRows || pFile.ParamTable.Length > HasFieldMarshalTypeMax16BitRows) { token = pFile.ReadInt32(); } else { token = pFile.ReadUInt16(); } Type = (HasFieldMarshalType)(token & HasFieldMarshalTypeMask); token = (token >> HasFieldMarshalTypeBits) - 1; if (token >= 0) { switch (Type) { case HasFieldMarshalType.Field: Field = pFile.FieldTable[token]; break; case HasFieldMarshalType.Param: Param = pFile.ParamTable[token]; break; default: throw new BadImageFormatException("HasFieldMarshal 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 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"); } } }
private void LinkData(CLIFile pFile) { int cursor = 0; if (Signature[0] == 0x06) ExpandedFieldSignature = new FieldSig(pFile, Signature, ref cursor); else if (Signature[0] == 0x07) ExpandedLocalVarSignature = new LocalVarSig(pFile, Signature, ref cursor); else ExpandedMethodSignature = new MethodSig(pFile, Signature, ref cursor); }
private void LoadData(CLIFile pFile) { Number = pFile.ReadUInt16(); Flags = (GenericParamAttributes)pFile.ReadUInt16(); Owner.LoadData(pFile); Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(HeapOffsetSizes.Strings32Bit)); }
public static void Link(CLIFile pFile) { for (int index = 0; index < pFile.AssemblyProcessorTable.Length; ++index) { pFile.AssemblyProcessorTable[index].LinkData(pFile); } }
public static void Link(CLIFile pFile) { for (int index = 0; index < pFile.DeclSecurityTable.Length; ++index) { pFile.DeclSecurityTable[index].LinkData(pFile); } }
private void LoadData(CLIFile pFile) { Number = pFile.ReadUInt16(); Flags = pFile.ReadUInt16(); Owner.LoadData(pFile); Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit)); }
public SigRetType(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required || pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional) { Mods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor)); } if (pSignature[pCursor] == (byte)SigElementType.TypedByReference) { TypedByRef = true; ++pCursor; return; } if (pSignature[pCursor] == (byte)SigElementType.Void) { Void = true; ++pCursor; return; } if (pSignature[pCursor] == (byte)SigElementType.ByReference) { ByRef = true; ++pCursor; } Type = new SigType(CLIFile, pSignature, ref pCursor); }
private void LoadData(CLIFile pFile) { Offset = pFile.ReadUInt32(); Flags = pFile.ReadUInt32(); Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit)); Implementation.LoadData(pFile); }
public SigLocalVar(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; if (pSignature[pCursor] == (byte)SigElementType.TypedByReference) { TypedByRef = true; ++pCursor; } else { while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required || pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional) { Mods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor)); } if (pSignature[pCursor] == (byte)SigElementType.Pinned) { IsPinned = true; ++pCursor; } if (pSignature[pCursor] == (byte)SigElementType.ByReference) { ByRef = true; ++pCursor; } Type = new SigType(CLIFile, pSignature, ref pCursor); } }
public static void Load(CLIFile pFile) { for (int index = 0; index < pFile.GenericParamTable.Length; ++index) { pFile.GenericParamTable[index].LoadData(pFile); } }
public SigLocalVar(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; if (pSignature[pCursor] == (byte)SigElementType.TypedByReference) { TypedByRef = true; ++pCursor; } else { while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required || pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional) { Mods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor)); } if (pSignature[pCursor] == (byte)SigElementType.Pinned) { IsPinned = true; ++pCursor; } if (pSignature[pCursor] == (byte)SigElementType.ByReference) { ByRef = true; ++pCursor; } Type = new SigType(CLIFile, pSignature, ref pCursor); } }
private void LoadData(CLIFile pFile) { Number = pFile.ReadUInt16(); Flags = pFile.ReadUInt16(); Owner.LoadData(pFile); Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit)); }
public static void Link(CLIFile pFile) { for (int index = 0; index < pFile.FieldMarshalTable.Length; ++index) { pFile.FieldMarshalTable[index].LinkData(pFile); } }
private void LoadData(CLIFile pFile) { Offset = pFile.ReadUInt32(); Flags = pFile.ReadUInt32(); Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit)); Implementation.LoadData(pFile); }
public static void Link(CLIFile pFile) { for (int index = 0; index < pFile.TypeDefTable.Length; ++index) { pFile.TypeDefTable[index].LinkData(pFile); } }
public static void Load(CLIFile pFile) { for (int index = 0; index < pFile.ModuleTable.Length; ++index) { pFile.ModuleTable[index].LoadData(pFile); } }
private void LoadData(CLIFile pFile) { Offset = pFile.ReadUInt32(); Flags = (ManifestResourceAttributes)pFile.ReadUInt32(); Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(HeapOffsetSizes.Strings32Bit)); Implementation.LoadData(pFile); }
public void TrackCallsTest() { MethodTableCursor cur = CLIFile.FindMethod(typeof(GenericsUnitTest).GetMethod("ExpressionInput")); CLIFileRW.MethodBody cb = cur.MethodBody; LocalsVarSig locals = cb.LocalsSignature; CLIType[] vars = locals.GetVariables().ToArray <CLIType>(); CLIType[] args = cur.GetMethodSignature().GetParameters(cur.FindCLIType()).ToArray <CLIType>(); ILCursor ilc = cb.ILInstructions; ilc.TrackStack(args, vars, cb.MaxStack); while (ilc.Next()) { ILInstruction instr = ilc.Instr; object o = instr.ResolveParameter(f); if (ilc.IsCall) { Target[] cargs = ilc.CallLoadArguments(); MethodDesc m = (MethodDesc)o; System.Diagnostics.Debug.WriteLine(string.Format("{0} to {1} at offset {2:X4}", ilc.Instr.op, m.Name, ilc.Position)); for (int i = 0; i < cargs.Length; i++) { System.Diagnostics.Debug.WriteLine(string.Format("\tPar {0} at offset {1:X4}", i, cargs[i].Position)); } } } }
public MscorlibRegressionTest() { Type objectType = typeof(Object); asm = objectType.Assembly; reader = CLIFile.Open(asm.Location); }
public SigCustomMod(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; Optional = pSignature[pCursor++] == (byte)SigElementType.CustomModifier_Optional; TypeDefOrRefOrSpecToken = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); }
public MethodSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; byte callingConvention = pSignature[pCursor++]; HasThis = (callingConvention & CallingConvention.HasThis) != 0; ExplicitThis = (callingConvention & CallingConvention.ExplicitThis) != 0; if ((callingConvention & CallingConvention.HasThis) != 0) callingConvention ^= CallingConvention.HasThis; if ((callingConvention & CallingConvention.ExplicitThis) != 0) callingConvention ^= CallingConvention.ExplicitThis; Default = callingConvention == CallingConvention.Default; CCall = callingConvention == CallingConvention.CCall; STDCall = callingConvention == CallingConvention.STDCall; ThisCall = callingConvention == CallingConvention.ThisCall; FastCall = callingConvention == CallingConvention.FastCall; VarArg = callingConvention == CallingConvention.VarArgs; Generic = callingConvention == CallingConvention.Generic; if (Generic) GenParamCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); uint paramCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); Params = new List<SigParam>((int)paramCount); RetType = new SigRetType(CLIFile, pSignature, ref pCursor); if (paramCount > 0) { for (uint paramIndex = 0; paramIndex < paramCount; ++paramIndex) { if (pSignature[pCursor] == (byte)SigElementType.Sentinel) { HasSentinel = true; SentinelIndex = paramIndex; ++pCursor; } Params.Add(new SigParam(CLIFile, pSignature, ref pCursor)); } } }
public static void Link(CLIFile pFile) { for (int index = 0; index < pFile.ManifestResourceTable.Length; ++index) { pFile.ManifestResourceTable[index].LinkData(pFile); } }
public static void Link(CLIFile pFile) { for (int index = 0; index < pFile.GenericParamConstraintTable.Length; ++index) { pFile.GenericParamConstraintTable[index].LinkData(pFile); } }
private void LoadData(CLIFile pFile) { Type = (SigElementType)pFile.ReadByte(); pFile.ReadByte(); Parent.LoadData(pFile); Value = pFile.ReadBlobHeap(pFile.ReadHeapIndex(HeapOffsetSizes.Blob32Bit)); }
/// <summary> /// Return the Reflection type associated with the type subtree. /// </summary> /// <param name="f">Reader to be used for resolving tokens.</param> /// <param name="typepars"> /// Generic instantiation of enclosing generic type arguments if any /// (null otherwise) /// </param> /// <param name="methodpars"> /// Generic instantiation of enclosing generic method arguments if any /// (null otherwise) /// </param> /// <returns>The Reflection type associated with the type subtree.</returns> public override Type GetReflectionType(CLIFile f, Type[] typepars, Type[] methodpars) { if (typepars == null) { throw new Exception("Type parameters of type instantiation are required to resolve type!"); } return(typepars[num]); }
private void LoadData(CLIFile pFile) { Offset = pFile.ReadUInt32(); int fieldIndex = 0; if (pFile.FieldTable.Length >= 0xFFFF) fieldIndex = pFile.ReadInt32() - 1; else fieldIndex = pFile.ReadUInt16() - 1; if (fieldIndex >= 0) Field = pFile.FieldTable[fieldIndex]; }
private void LoadData(CLIFile pFile) { Generation = pFile.ReadUInt16(); Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit)); Mvid = pFile.ReadGUIDHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.GUID32Bit)); EncId = pFile.ReadGUIDHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.GUID32Bit)); EncBaseId = pFile.ReadGUIDHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.GUID32Bit)); }
private void LoadData(CLIFile pFile) { int typeDefIndex = 0; if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1; else typeDefIndex = pFile.ReadUInt16() - 1; if (typeDefIndex >= 0) Class = pFile.TypeDefTable[typeDefIndex]; Interface.LoadData(pFile); }
private void LoadData(CLIFile pFile) { Generation = pFile.ReadUInt16(); Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.Strings32Bit)); Mvid = pFile.ReadGUIDHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.GUID32Bit)); EncId = pFile.ReadGUIDHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.GUID32Bit)); EncBaseId = pFile.ReadGUIDHeap(pFile.ReadHeapIndex(CLIHeapOffsetSize.GUID32Bit)); }
private void LoadData(CLIFile pFile) { Processor = pFile.ReadUInt32(); int assemblyRefIndex = 0; if (pFile.AssemblyRefTable.Length >= 0xFFFF) assemblyRefIndex = pFile.ReadInt32() - 1; else assemblyRefIndex = pFile.ReadUInt16() - 1; if (assemblyRefIndex >= 0) AssemblyRef = pFile.AssemblyRefTable[assemblyRefIndex]; }
private void LoadData(CLIFile pFile) { int genericParamIndex = 0; if (pFile.GenericParamTable.Length >= 0xFFFF) genericParamIndex = pFile.ReadInt32() - 1; else genericParamIndex = pFile.ReadUInt16() - 1; if (genericParamIndex >= 0) Owner = pFile.GenericParamTable[genericParamIndex]; Constraint.LoadData(pFile); }
public LocalVarSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; ++pCursor; uint localVarCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); LocalVars = new List<SigLocalVar>((int)localVarCount); for (uint localVarIndex = 0; localVarIndex < localVarCount; ++localVarIndex) LocalVars.Add(new SigLocalVar(CLIFile, pSignature, ref pCursor)); }
private void LinkData(CLIFile pFile) { int paramListCount = pFile.ParamTable.Length - ParamListIndex; if (TableIndex < (pFile.MethodDefTable.Length - 1)) paramListCount = pFile.MethodDefTable[TableIndex + 1].ParamListIndex - ParamListIndex; for (int index = 0; index < paramListCount; ++index) { ParamList.Add(pFile.ParamTable[ParamListIndex + index]); pFile.ParamTable[ParamListIndex + index].ParentMethodDef = this; } int cursor = 0; ExpandedSignature = new MethodSig(pFile, Signature, ref cursor); }
public MethodSpecSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; ++pCursor; uint genArgsCount = CLIFile.ReadCompressedUnsigned(pSignature, ref pCursor); GenArgs = new List<SigType>((int)genArgsCount); for (uint genArgsIndex = 0; genArgsIndex < genArgsCount; ++genArgsIndex) GenArgs.Add(new SigType(CLIFile, pSignature, ref pCursor)); }
private void LoadData(CLIFile pFile) { Semantics = pFile.ReadUInt16(); int methodDefIndex = 0; if (pFile.MethodDefTable.Length >= 0xFFFF) methodDefIndex = pFile.ReadInt32() - 1; else methodDefIndex = pFile.ReadUInt16() - 1; if (methodDefIndex >= 0) Method = pFile.MethodDefTable[methodDefIndex]; Association.LoadData(pFile); }
private void LoadData(CLIFile pFile) { PackingSize = pFile.ReadUInt16(); ClassSize = pFile.ReadUInt32(); int typeDefIndex = 0; if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1; else typeDefIndex = pFile.ReadUInt16() - 1; if (typeDefIndex >= 0) Parent = pFile.TypeDefTable[typeDefIndex]; }
private void LoadData(CLIFile pFile) { int typeDefIndex = 0; if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1; else typeDefIndex = pFile.ReadUInt16() - 1; if (typeDefIndex >= 0) Class = pFile.TypeDefTable[typeDefIndex]; MethodBody.LoadData(pFile); MethodDeclaration.LoadData(pFile); }
public static void Initialize(CLIFile pFile) { if ((pFile.CLIMetadataTables.PresentTables & (1ul << MetadataTables.PropertyMap)) != 0) { pFile.PropertyMapTable = new PropertyMapData[pFile.ReadInt32()]; for (int index = 0; index < pFile.PropertyMapTable.Length; ++index) pFile.PropertyMapTable[index] = new PropertyMapData() { CLIFile = pFile, TableIndex = index }; } else pFile.PropertyMapTable = new PropertyMapData[0]; }
public static void Initialize(CLIFile pFile) { if ((pFile.CLIMetadataTablesHeader.PresentTables & (1ul << CLIMetadataTables.GenericParam)) != 0) { pFile.GenericParamTable = new GenericParamData[pFile.ReadInt32()]; for (int index = 0; index < pFile.GenericParamTable.Length; ++index) pFile.GenericParamTable[index] = new GenericParamData() { CLIFile = pFile, TableIndex = index }; } else pFile.GenericParamTable = new GenericParamData[0]; }
private void LoadData(CLIFile pFile) { int typeDefIndex = 0; if (pFile.TypeDefTable.Length >= 0xFFFF) typeDefIndex = pFile.ReadInt32() - 1; else typeDefIndex = pFile.ReadUInt16() - 1; if (typeDefIndex >= 0) Parent = pFile.TypeDefTable[typeDefIndex]; if (pFile.PropertyTable.Length >= 0xFFFF) PropertyListIndex = pFile.ReadInt32() - 1; else PropertyListIndex = pFile.ReadUInt16() - 1; }
public static void Initialize(CLIFile pFile) { if ((pFile.CLIMetadataTablesHeader.PresentTables & (1ul << CLIMetadataTables.ManifestResource)) != 0) { pFile.ManifestResourceTable = new ManifestResourceData[pFile.ReadInt32()]; for (int index = 0; index < pFile.ManifestResourceTable.Length; ++index) pFile.ManifestResourceTable[index] = new ManifestResourceData() { CLIFile = pFile, TableIndex = index }; } else pFile.ManifestResourceTable = new ManifestResourceData[0]; }
private void LinkData(CLIFile pFile) { int fieldListCount = pFile.FieldTable.Length - FieldListIndex; if (TableIndex < (pFile.TypeDefTable.Length - 1)) fieldListCount = pFile.TypeDefTable[TableIndex + 1].FieldListIndex - FieldListIndex; for (int index = 0; index < fieldListCount; ++index) { FieldList.Add(pFile.FieldTable[FieldListIndex + index]); pFile.FieldTable[FieldListIndex + index].ParentTypeDef = this; } int methodListCount = pFile.MethodDefTable.Length - MethodListIndex; if (TableIndex < (pFile.TypeDefTable.Length - 1)) methodListCount = pFile.TypeDefTable[TableIndex + 1].MethodListIndex - MethodListIndex; for (int index = 0; index < methodListCount; ++index) { MethodList.Add(pFile.MethodDefTable[MethodListIndex + index]); pFile.MethodDefTable[MethodListIndex + index].ParentTypeDef = this; } }
public static void Initialize(CLIFile pFile) { if ((pFile.CLIMetadataTablesHeader.PresentTables & (1ul << CLIMetadataTables.File)) != 0) { pFile.FileTable = new FileData[pFile.ReadInt32()]; for (int index = 0; index < pFile.FileTable.Length; ++index) pFile.FileTable[index] = new FileData() { CLIFile = pFile, TableIndex = index }; } else pFile.FileTable = new FileData[0]; }
public static void Initialize(CLIFile pFile) { if ((pFile.CLIMetadataTablesHeader.PresentTables & (1ul << CLIMetadataTables.AssemblyProcessor)) != 0) { pFile.AssemblyProcessorTable = new AssemblyProcessorData[pFile.ReadInt32()]; for (int index = 0; index < pFile.AssemblyProcessorTable.Length; ++index) pFile.AssemblyProcessorTable[index] = new AssemblyProcessorData() { CLIFile = pFile, TableIndex = index }; } else pFile.AssemblyProcessorTable = new AssemblyProcessorData[0]; }
private void LoadData(CLIFile pFile) { InitialValueOffset = pFile.ReadUInt32(); CLIFile.SectionHeader sectionHeader = pFile.GetSection(InitialValueOffset); InitialValueOffset = sectionHeader.PointerToRawData + (InitialValueOffset - sectionHeader.VirtualAddress); int fieldIndex = 0; if (pFile.FieldTable.Length >= 0xFFFF) fieldIndex = pFile.ReadInt32() - 1; else fieldIndex = pFile.ReadUInt16() - 1; if (fieldIndex >= 0) Field = pFile.FieldTable[fieldIndex]; }
public static tAsyncCall *EnsureAssemblyLoaded(tJITCallNative *pCallNative, byte *pThis_, byte *pParams, byte *pReturnValue) { byte *assemblyName = stackalloc byte[256]; DotNetStringToCString(assemblyName, 256, ((tSystemString **)pParams)[0]); CLIFile.GetMetaDataForAssembly(assemblyName); *(/*HEAP_PTR*/ byte **)pReturnValue = null; return(null); }
private void LoadData(CLIFile pFile) { OSPlatformId = pFile.ReadUInt32(); OSMajorVersion = pFile.ReadUInt32(); OSMinorVersion = pFile.ReadUInt32(); int assemblyRefIndex = 0; if (pFile.AssemblyRefTable.Length >= 0xFFFF) assemblyRefIndex = pFile.ReadInt32() - 1; else assemblyRefIndex = pFile.ReadUInt16() - 1; if (assemblyRefIndex >= 0) AssemblyRef = pFile.AssemblyRefTable[assemblyRefIndex]; }
public IRAssembly LoadEntryAssembly(CLIFile pFile) { IRAssembly assembly = CreateAssembly(pFile); Assemblies.ForEach(a => a.LoadStage1()); Assemblies.ForEach(a => a.LoadStage2()); Assemblies.ForEach(a => a.LoadStage3()); Assemblies.ForEach(a => a.LoadStage4()); return(assembly); }
private void LoadData(CLIFile pFile) { MappingFlags = (PInvokeAttributes)pFile.ReadUInt16(); MemberForwarded.LoadData(pFile); ImportName = pFile.ReadStringHeap(pFile.ReadHeapIndex(HeapOffsetSizes.Strings32Bit)); int moduleRefIndex = 0; if (pFile.ModuleRefTable.Length >= 0xFFFF) moduleRefIndex = pFile.ReadInt32() - 1; else moduleRefIndex = pFile.ReadUInt16() - 1; if (moduleRefIndex >= 0) ImportScope = pFile.ModuleRefTable[moduleRefIndex]; }
public void StandAloneSigTest() { CLIFile f = CLIFile.Open(typeof(object).Assembly.Location); Table t = f[TableNames.StandAloneSig]; StandAloneSigTableCursor cur = t.GetCursor() as StandAloneSigTableCursor; while (cur.Next()) { Assert.IsTrue(cur.Signature < f.Blob.Size, "Wrong index into the blob heap!"); } }
/// <summary> /// Return the Reflection type associated with the type subtree. /// </summary> /// <param name="f">Reader to be used for resolving tokens.</param> /// <param name="typepars"> /// Generic instantiation of enclosing generic type arguments if any /// (null otherwise) /// </param> /// <param name="methodpars"> /// Generic instantiation of enclosing generic method arguments if any /// (null otherwise) /// </param> /// <returns>The Reflection type associated with the type subtree.</returns> public override Type GetReflectionType(CLIFile f, Type[] typepars, Type[] methodpars) { Type ret = f.Assembly.ManifestModule.ResolveType((((int)Type) << 24) | Row); if (args != null) { Type[] ts = Array.ConvertAll <CLIType, Type>(args, delegate(CLIType tt) { return(tt.GetReflectionType(typepars, methodpars)); }); ret = ret.MakeGenericType(ts); } return(ret); }
public FieldSig(CLIFile pCLIFile, byte[] pSignature, ref int pCursor) { CLIFile = pCLIFile; ++pCursor; while (pSignature[pCursor] == (byte)SigElementType.CustomModifier_Required || pSignature[pCursor] == (byte)SigElementType.CustomModifier_Optional) { Mods.Add(new SigCustomMod(CLIFile, pSignature, ref pCursor)); } Type = new SigType(CLIFile, pSignature, ref pCursor); }