示例#1
0
        public bool ProcessDebugHeader(ImageDebugDirectory directory, byte [] header)
        {
            if (image == module.Image)
                return true;

            if (header.Length < 24)
                return false;

            var magic = ReadInt32 (header, 0);
            if (magic != 0x53445352)
                return false;

            var buffer = new byte [16];
            Buffer.BlockCopy (header, 4, buffer, 0, 16);

            var module_guid = new Guid (buffer);

            Buffer.BlockCopy (image.PdbHeap.Id, 0, buffer, 0, 16);

            var pdb_guid = new Guid (buffer);

            return module_guid == pdb_guid;
        }
示例#2
0
		public bool ProcessDebugHeader (ImageDebugDirectory directory, byte [] header)
		{
			return true;
		}
 public bool GetDebugHeader(out ImageDebugDirectory directory, out byte [] header)
 {
     directory = new ImageDebugDirectory ();
     header = empty_header;
     return false;
 }
示例#4
0
文件: Image.cs 项目: qq1792/LSharp
        public ImageDebugDirectory GetDebugHeader(out byte[] header)
        {
            var section = GetSectionAtVirtualAddress(Debug.VirtualAddress);
            var buffer = new ByteBuffer(section.Data);
            buffer.position = (int)(Debug.VirtualAddress - section.VirtualAddress);

            var directory = new ImageDebugDirectory
            {
                Characteristics = buffer.ReadInt32(),
                TimeDateStamp = buffer.ReadInt32(),
                MajorVersion = buffer.ReadInt16(),
                MinorVersion = buffer.ReadInt16(),
                Type = buffer.ReadInt32(),
                SizeOfData = buffer.ReadInt32(),
                AddressOfRawData = buffer.ReadInt32(),
                PointerToRawData = buffer.ReadInt32(),
            };

            buffer.position = (int)(directory.PointerToRawData - section.PointerToRawData);

            header = new byte[directory.SizeOfData];
            Buffer.BlockCopy(buffer.buffer, buffer.position, header, 0, header.Length);

            return directory;
        }
示例#5
0
		public bool ProcessDebugHeader (ImageDebugDirectory directory, byte [] header)
		{
			return symbol_file.Guid == module.Mvid;
		}
示例#6
0
        public bool GetDebugHeader(out ImageDebugDirectory directory, out byte [] header)
        {
            if (IsEmbedded) {
                directory = new ImageDebugDirectory ();
                header = Empty<byte>.Array;
                return false;
            }

            directory = new ImageDebugDirectory () {
                MajorVersion = 256,
                MinorVersion = 20577,
                Type = 2,
            };

            var buffer = new ByteBuffer ();
            // RSDS
            buffer.WriteUInt32 (0x53445352);
            // Module ID
            buffer.WriteBytes (module.Mvid.ToByteArray ());
            // PDB Age
            buffer.WriteUInt32 (1);
            // PDB Path
            buffer.WriteBytes (System.Text.Encoding.UTF8.GetBytes (writer.BaseStream.GetFileName ()));
            buffer.WriteByte (0);

            header = new byte [buffer.length];
            Buffer.BlockCopy (buffer.buffer, 0, header, 0, buffer.length);
            directory.SizeOfData = header.Length;
            return true;
        }
示例#7
0
 public bool GetDebugHeader(out ImageDebugDirectory directory, out byte [] header)
 {
     directory = new ImageDebugDirectory ();
     header = Empty<byte>.Array;
     return false;
 }
示例#8
0
		public ImageDebugDirectory GetDebugHeader (out byte [] header)
		{
			var reader = GetReaderAt (Debug.VirtualAddress);

			var directory = new ImageDebugDirectory {
				Characteristics = reader.ReadInt32 (),
				TimeDateStamp = reader.ReadInt32 (),
				MajorVersion = reader.ReadInt16 (),
				MinorVersion = reader.ReadInt16 (),
				Type = reader.ReadInt32 (),
				SizeOfData = reader.ReadInt32 (),
				AddressOfRawData = reader.ReadInt32 (),
				PointerToRawData = reader.ReadInt32 (),
			};

			reader = GetReaderAt ((uint) directory.AddressOfRawData);
			header = reader.ReadBytes (directory.SizeOfData);
			return directory;
		}
示例#9
0
 public ImageDebugHeaderEntry(ImageDebugDirectory directory, byte [] data)
 {
     this.directory = directory;
     this.data      = data ?? Empty <byte> .Array;
 }