当前位置: 首页>>代码示例>>C#>>正文


C# IPEImage类代码示例

本文整理汇总了C#中IPEImage的典型用法代码示例。如果您正苦于以下问题:C# IPEImage类的具体用法?C# IPEImage怎么用?C# IPEImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IPEImage类属于命名空间,在下文中一共展示了IPEImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

 public static ImageCor20HeaderTreeNode Create(HexDocument doc, IPEImage peImage)
 {
     var dnDir = peImage.ImageNTHeaders.OptionalHeader.DataDirectories[14];
     if (dnDir.VirtualAddress != 0 && dnDir.Size >= 0x48)
         return new ImageCor20HeaderTreeNode(doc, (ulong)peImage.ToFileOffset(dnDir.VirtualAddress));
     return null;
 }
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:7,代码来源:ImageCor20HeaderTreeNode.cs

示例2: GetOrCreate

		public AsmEdHexDocument GetOrCreate(IPEImage peImage) {
			var filename = GetFullPath(peImage.FileName);

			lock (lockObj) {
				var doc = TryGet_NoLock(filename);
				if (doc != null)
					return doc;

				using (var stream = peImage.CreateFullStream()) {
					var data = stream.ReadAllBytes();
					doc = new AsmEdHexDocument(data, filename);
					filenameToDoc[filename] = new WeakReference(doc);
					return doc;
				}
			}
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:16,代码来源:HexDocumentManager.cs

示例3: Win32ResourcesPE

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="peImage">The PE image</param>
		/// <param name="rsrcReader">Reader for the whole Win32 resources section (usually
		/// the .rsrc section) or <c>null</c> if we should create one from the resource data
		/// directory in the optional header. This instance owns the reader.</param>
		public Win32ResourcesPE(IPEImage peImage, IBinaryReader rsrcReader) {
			this.rvaConverter = peImage;
			this.dataReader = peImage.CreateFullStream();
			if (rsrcReader != null)
				this.rsrcReader = rsrcReader;
			else {
				var dataDir = peImage.ImageNTHeaders.OptionalHeader.DataDirectories[2];
				if (dataDir.VirtualAddress != 0 && dataDir.Size != 0)
					this.rsrcReader = peImage.CreateStream(dataDir.VirtualAddress, dataDir.Size);
				else
					this.rsrcReader = MemoryImageStream.CreateEmpty();
			}
			Initialize();
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:21,代码来源:Win32Resources.cs

示例4: Load

		/// <summary>
		/// Create a <see cref="DotNetFile"/> instance
		/// </summary>
		/// <param name="peImage">The PE image</param>
		/// <param name="verify"><c>true</c> if we should verify that it's a .NET PE file</param>
		/// <returns>A new <see cref="DotNetFile"/> instance</returns>
		public static DotNetFile Load(IPEImage peImage, bool verify) {
			IImageStream cor20HeaderStream = null, mdHeaderStream = null;
			MetaData md = null;
			try {
				var dotNetDir = peImage.ImageNTHeaders.OptionalHeader.DataDirectories[14];
				if (dotNetDir.VirtualAddress == 0)
					throw new BadImageFormatException(".NET data directory RVA is 0");
				if (dotNetDir.Size < 0x48)
					throw new BadImageFormatException(".NET data directory size < 0x48");
				var cor20Header = new ImageCor20Header(cor20HeaderStream = peImage.CreateStream(dotNetDir.VirtualAddress, 0x48), verify);
				if (cor20Header.MetaData.VirtualAddress == 0)
					throw new BadImageFormatException(".NET MetaData RVA is 0");
				if (cor20Header.MetaData.Size < 16)
					throw new BadImageFormatException(".NET MetaData size is too small");
				var mdSize = cor20Header.MetaData.Size;
				var mdRva = cor20Header.MetaData.VirtualAddress;
				var mdHeader = new MetaDataHeader(mdHeaderStream = peImage.CreateStream(mdRva, mdSize), verify);
				if (verify) {
					foreach (var sh in mdHeader.StreamHeaders) {
						if (sh.Offset + sh.StreamSize < sh.Offset || sh.Offset + sh.StreamSize > mdSize)
							throw new BadImageFormatException("Invalid stream header");
					}
				}

				switch (GetMetaDataType(mdHeader.StreamHeaders)) {
				case MetaDataType.Compressed:
					md = new CompressedMetaData(peImage, cor20Header, mdHeader);
					break;

				case MetaDataType.ENC:
					md = new ENCMetaData(peImage, cor20Header, mdHeader);
					break;

				default:
					throw new BadImageFormatException("No #~ or #- stream found");
				}
				md.Initialize();

				return new DotNetFile(md);
			}
			catch {
				if (md != null)
					md.Dispose();
				throw;
			}
			finally {
				if (cor20HeaderStream != null)
					cor20HeaderStream.Dispose();
				if (mdHeaderStream != null)
					mdHeaderStream.Dispose();
			}
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:58,代码来源:DotNetFile.cs

示例5: DisableMemoryMappedIO

		static void DisableMemoryMappedIO(HashSet<string> filenames, IPEImage peImage) {
			if (peImage != null && filenames.Contains(peImage.FileName))
				peImage.UnsafeDisableMemoryMappedIO();
		}
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:4,代码来源:MmapDisabler.cs

示例6: UnpackNativeFile1

		// Old CS versions
		byte[] UnpackNativeFile1(IPEImage peImage) {
			const int dataDirNum = 6;	// debug dir
			const int dotNetDirNum = 14;

			var optHeader = peImage.ImageNTHeaders.OptionalHeader;
			if (optHeader.DataDirectories[dataDirNum].VirtualAddress == 0)
				return null;
			if (optHeader.DataDirectories[dataDirNum].Size != 0x48)
				return null;

			var fileData = peImage.GetImageAsByteArray();
			long dataDirBaseOffset = (long)optHeader.DataDirectories[0].StartOffset;
			int dataDir = (int)dataDirBaseOffset + dataDirNum * 8;
			int dotNetDir = (int)dataDirBaseOffset + dotNetDirNum * 8;
			WriteUInt32(fileData, dotNetDir, BitConverter.ToUInt32(fileData, dataDir));
			WriteUInt32(fileData, dotNetDir + 4, BitConverter.ToUInt32(fileData, dataDir + 4));
			WriteUInt32(fileData, dataDir, 0);
			WriteUInt32(fileData, dataDir + 4, 0);
			ModuleBytes = fileData;
			return fileData;
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:22,代码来源:Deobfuscator.cs

示例7: Load

 /// <summary>
 /// Creates a <see cref="ModuleDefMD"/> instance
 /// </summary>
 /// <param name="peImage">PE image</param>
 /// <param name="options">Module creation options or <c>null</c></param>
 /// <returns>A new <see cref="ModuleDefMD"/> instance</returns>
 public static ModuleDefMD Load(IPEImage peImage, ModuleCreationOptions options)
 {
     return Load(MetaDataCreator.Load(peImage), options);
 }
开发者ID:dmirmilshteyn,项目名称:dnlib,代码行数:10,代码来源:ModuleDefMD.cs

示例8: MyPEImage

		public MyPEImage(IPEImage peImage) {
			Initialize(peImage);
		}
开发者ID:GreenDamTan,项目名称:de4dot,代码行数:3,代码来源:MyPEImage.cs

示例9: CompressedMetaData

		/// <inheritdoc/>
		public CompressedMetaData(IPEImage peImage, ImageCor20Header cor20Header, MetaDataHeader mdHeader)
			: base(peImage, cor20Header, mdHeader) {
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:4,代码来源:CompressedMetaData.cs

示例10: UnpackNativeFile

		public override byte[] UnpackNativeFile(IPEImage peImage) {
			var data = new NativeImageUnpacker(peImage).Unpack();
			if (data == null)
				return null;

			unpackedNativeFile = true;
			ModuleBytes = data;
			return data;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:9,代码来源:Deobfuscator.cs

示例11: MetaData

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="peImage">The PE image</param>
 /// <param name="cor20Header">The .NET header</param>
 /// <param name="mdHeader">The MD header</param>
 protected MetaData(IPEImage peImage, ImageCor20Header cor20Header, MetaDataHeader mdHeader)
 {
     try {
         this.allStreams = ThreadSafeListCreator.Create<DotNetStream>();
         this.peImage = peImage;
         this.cor20Header = cor20Header;
         this.mdHeader = mdHeader;
     }
     catch {
         if (peImage != null)
             peImage.Dispose();
         throw;
     }
 }
开发者ID:NSentinel,项目名称:dnlib,代码行数:20,代码来源:MetaData.cs

示例12: IsExe

 static bool IsExe(IPEImage peImage)
 {
     return peImage != null && (peImage.ImageNTHeaders.FileHeader.Characteristics & Characteristics.Dll) == 0;
 }
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:4,代码来源:NodePrinter.cs

示例13: PECLIModel

		public PECLIModel(IPEImage image, ImageCor20Header header) {
			Image = image;
			CLIHeader = header;
		}
开发者ID:mamingxiu,项目名称:dnExplorer,代码行数:4,代码来源:PECLIModel.cs

示例14: Initialize

		void Initialize(IPEImage peImage) {
			this.peImage = peImage;
			this.peStream = peImage.CreateFullStream();
		}
开发者ID:GreenDamTan,项目名称:de4dot,代码行数:4,代码来源:MyPEImage.cs

示例15: InitializeExeFieldsFrom

		void InitializeExeFieldsFrom(IPEImage peImage) {
			isExe = (peImage.ImageNTHeaders.FileHeader.Characteristics & Characteristics.Dll) == 0;
			timestamp = peImage.ImageNTHeaders.FileHeader.TimeDateStamp;

			using (var mod = ModuleDefMD.Load(peImage)) {
				var asm = mod.Assembly;
				version = asm == null ? null : asm.Version;
			}
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:9,代码来源:ModuleVM.cs


注:本文中的IPEImage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。