Exemplo n.º 1
0
        public void Read(Stream stream)
        {
            BinaryReader br = new BinaryReader(stream);

            Signature = br.ReadUInt32();

            byte[] array = new byte[sizeof(IMAGE_FILE_HEADER)];
            stream.Read(array, 0, array.Length);

            fixed(byte *pData = array)
            FileHeader = *(IMAGE_FILE_HEADER *)pData;

            array = new byte[sizeof(IMAGE_OPTIONAL_HEADER)];
            stream.Read(array, 0, array.Length);

            fixed(byte *pData = array)
            OptionalHeader = *(IMAGE_OPTIONAL_HEADER *)pData;
        }
Exemplo n.º 2
0
        public void Read(Stream stream)
        {
            BinaryReader br = new BinaryReader(stream);
            Signature = br.ReadUInt32();

            byte[] array = new byte[sizeof(IMAGE_FILE_HEADER)];
            stream.Read(array, 0, array.Length);
            fixed (byte* pData = array)
                FileHeader = *(IMAGE_FILE_HEADER*) pData;

            array = new byte[sizeof(IMAGE_OPTIONAL_HEADER)];
            stream.Read(array, 0, array.Length);
            fixed (byte* pData = array)
                OptionalHeader = *(IMAGE_OPTIONAL_HEADER*) pData;
        }