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.AddressOfRawData - section.VirtualAddress); header = new byte [directory.SizeOfData]; Buffer.BlockCopy(buffer.buffer, buffer.position, header, 0, header.Length); return(directory); }
public ImageDebugDirectory GetDebugHeader(out byte[] header) { Section sectionAtVirtualAddress = this.GetSectionAtVirtualAddress(this.Debug.VirtualAddress); ByteBuffer byteBuffer = new ByteBuffer(sectionAtVirtualAddress.Data) { position = (int)(this.Debug.VirtualAddress - sectionAtVirtualAddress.VirtualAddress) }; ImageDebugDirectory imageDebugDirectory = new ImageDebugDirectory() { Characteristics = byteBuffer.ReadInt32(), TimeDateStamp = byteBuffer.ReadInt32(), MajorVersion = byteBuffer.ReadInt16(), MinorVersion = byteBuffer.ReadInt16(), Type = byteBuffer.ReadInt32(), SizeOfData = byteBuffer.ReadInt32(), AddressOfRawData = byteBuffer.ReadInt32(), PointerToRawData = byteBuffer.ReadInt32() }; ImageDebugDirectory imageDebugDirectory1 = imageDebugDirectory; if (imageDebugDirectory1.SizeOfData == 0 || imageDebugDirectory1.PointerToRawData == 0) { header = Empty <byte> .Array; return(imageDebugDirectory1); } byteBuffer.position = (int)((long)imageDebugDirectory1.PointerToRawData - (ulong)sectionAtVirtualAddress.PointerToRawData); header = new byte[imageDebugDirectory1.SizeOfData]; Buffer.BlockCopy(byteBuffer.buffer, byteBuffer.position, header, 0, (int)header.Length); return(imageDebugDirectory1); }
public ImageDebugDirectory GetDebugHeader(out byte[] header) { Section sectionAtVirtualAddress = this.GetSectionAtVirtualAddress(this.Debug.VirtualAddress); ByteBuffer buffer = new ByteBuffer(sectionAtVirtualAddress.Data) { position = (int)(this.Debug.VirtualAddress - sectionAtVirtualAddress.VirtualAddress) }; ImageDebugDirectory 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() }; if ((directory.SizeOfData == 0) || (directory.PointerToRawData == 0)) { header = Empty <byte> .Array; return(directory); } buffer.position = directory.PointerToRawData - ((int)sectionAtVirtualAddress.PointerToRawData); header = new byte[directory.SizeOfData]; Buffer.BlockCopy(buffer.buffer, buffer.position, header, 0, header.Length); return(directory); }
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; }