Beispiel #1
0
        /// <summary>
        /// Gets the 32 bit optional header by specifing a 32 bit assembly.
        /// </summary>
        /// <param name="assembly">The assembly to read the optional header</param>
        /// <returns></returns>
        public static OptionalHeader32 FromAssembly(LWin32 assembly)
        {
            OptionalHeader32 a = new OptionalHeader32();

            a.assembly = assembly;
            a.header   = assembly._headerReader;
            return(a);
        }
Beispiel #2
0
        private void ReadOptionalHeader()
        {
            optionalheaderoffset = image.Stream.Position;
            optionalheadersig    = image.Reader.ReadUInt16();
            image.Stream.Seek(-2, SeekOrigin.Current);

            if (optionalheadersig == 0x10b)
            {
                optionalHeader32 = image.ReadStructure <Structures.IMAGE_OPTIONAL_HEADER32>();
                optionalHeader   = OptionalHeader32.FromAssembly(assembly);
            }
            else
            {
                optionalHeader64 = image.ReadStructure <Structures.IMAGE_OPTIONAL_HEADER64>();
                optionalHeader   = OptionalHeader64.FromAssembly(assembly);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Gets the 32 bit optional header by specifing a 32 bit assembly.
 /// </summary>
 /// <param name="assembly">The assembly to read the optional header</param>
 /// <returns></returns>
 public static OptionalHeader32 FromAssembly(LWin32 assembly)
 {
     OptionalHeader32 a = new OptionalHeader32();
     a.assembly = assembly;
     a.header = assembly._headerReader;
     return a;
 }