Пример #1
0
		void Initialize(ModuleDefMD module) {
			var info = module.MetaData.ImageCor20Header.VTableFixups;
			if (info.VirtualAddress == 0 || info.Size == 0) {
				this.vtables = ThreadSafeListCreator.Create<VTable>();
				return;
			}
			this.rva = info.VirtualAddress;
			this.vtables = ThreadSafeListCreator.Create<VTable>((int)info.Size / 8);

			var peImage = module.MetaData.PEImage;
			using (var reader = peImage.CreateFullStream()) {
				reader.Position = (long)peImage.ToFileOffset(info.VirtualAddress);
				long endPos = reader.Position + info.Size;
				while (reader.Position + 8 <= endPos && reader.CanRead(8)) {
					RVA tableRva = (RVA)reader.ReadUInt32();
					int numSlots = reader.ReadUInt16();
					var flags = (VTableFlags)reader.ReadUInt16();
					var vtable = new VTable(tableRva, flags, numSlots);
					vtables.Add(vtable);

					var pos = reader.Position;
					reader.Position = (long)peImage.ToFileOffset(tableRva);
					int slotSize = vtable.Is64Bit ? 8 : 4;
					while (numSlots-- > 0 && reader.CanRead(slotSize)) {
						vtable.Methods.Add(module.ResolveToken(reader.ReadUInt32()) as IMethod);
						if (slotSize == 8)
							reader.ReadUInt32();
					}
					reader.Position = pos;
				}
			}
		}
        private static void AddIfExists(ThreadSafe.IList <string> paths, string basePath, string extraPath)
        {
            var path = Path.Combine(basePath, extraPath);

            if (Directory.Exists(path))
            {
                paths.Add(path);
            }
        }
Пример #3
0
        void Add(Dictionary <uint, CorMethodDef> dict, ThreadSafe.IList <MethodDef> methods, uint token)
        {
            var cmd = Lookup(dict, token);

            if (cmd == null || methods.Contains(cmd))
            {
                return;
            }
            methods.Add(cmd);
        }
Пример #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="symDoc">A <see cref="SymbolDocument"/> instance</param>
 public PdbDocument(SymbolDocument symDoc)
 {
     if (symDoc == null)
     {
         throw new ArgumentNullException("symDoc");
     }
     this.Url                 = symDoc.URL;
     this.Language            = symDoc.Language;
     this.LanguageVendor      = symDoc.LanguageVendor;
     this.DocumentType        = symDoc.DocumentType;
     this.CheckSumAlgorithmId = symDoc.CheckSumAlgorithmId;
     this.CheckSum            = symDoc.CheckSum;
     foreach (var cdi in symDoc.CustomDebugInfos)
     {
         customDebugInfos.Add(cdi);
     }
 }