内存部分定义
我正在参加装配课程并且在试图找出问题时度过了一段糟糕的时光。我们有以下几点:
在我的一生中,我一直试图通过谷歌来解决这个问题,但没有找到太多东西,不幸的是,我们的文字中没有任何内容可以指导我。我希望有人能够指导我解决这个问题。
1)。.text 部分加载到内存后的大小是多少?2)。.data 部分加载到内存后的 RVA 是多少?3)。磁盘上 .data 部分的物理大小是多少?
回答
如果您在 google 上搜索COFF 规范,它会带您到Section Table (Section Headers)。
转储显然包含三个 COFF 部分标题。如果你更喜欢他们在assembly 中的描述,你在这里:
COFF_SECTION_HEADER STRUC
.Name DB 8*BYTE ; Section name, NULL padded.
.VirtualSize DD ; Total aligned section size when loaded in memory.
.VirtualAddress DD ; RVA of section relative to ImageBase when loaded.
.SizeOfRawData DD ; Section size in the file (before loaded).
.PointerToRawData DD ; File pointer to section data.
.PointerToRelocations DD ; File pointer to relocations. NULL if no relocations.
.PointerToLinenumbers DD ; File pointer to line-number entries or NULL.
.NumberOfRelocations DW ; Number of relocation entries for this section.
.NumberOfLinenumbers DW ; Number of line-number entries for this section.
.Characteristics DD ; Section properties.
ENDSTRUC
继续记住,在LittleEndian的DWORD值有不太显著字节(逆转)开始,例如.VirtualSize的 .text部分,这是作为倾倒00100000,其实0x00001000,也就是1 KB加载到内存中时。PE 文件中的大小.data或.text部分保存在成员中.SizeOfRawData。