Пример #1
0
        public void PdbChecksum_Errors(byte[] blob)
        {
            var bytes = ImmutableArray.Create(blob);

            using (var block = new ByteArrayMemoryProvider(bytes).GetMemoryBlock(0, bytes.Length))
            {
                Assert.Throws <BadImageFormatException>(() => PEReader.DecodePdbChecksumDebugDirectoryData(block));
            }
        }
Пример #2
0
        public void PdbChecksum()
        {
            var bytes = ImmutableArray.Create(new byte[]
            {
                (byte)'A', (byte)'L', (byte)'G', 0, // AlgorithmName
                0x01, 0x02, 0x03, 0x04, 0x05        // checksum
            });

            using (var block = new ByteArrayMemoryProvider(bytes).GetMemoryBlock(0, bytes.Length))
            {
                var data = PEReader.DecodePdbChecksumDebugDirectoryData(block);
                Assert.Equal("ALG", data.AlgorithmName);
                AssertEx.Equal(new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05 }, data.Checksum);
            }
        }