我正在上一堂装配课,并且在试图找出一个问题时度过了一段糟糕的时光。我们有以下内容:
在我的一生中,我一直在尝试用谷歌搜索来解决这个问题,但找不到太多,不幸的是,我们的文字中没有任何内容可以指导我。我希望有人能够指导我解决这个问题。
1)。.text 部分加载到内存后的大小是多少?2)。.data 部分加载到内存后的 RVA 是多少?3)。磁盘上 .data 部分的物理大小是多少?
如果您搜索过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
按原样转储,即加载到内存中时为 1 KB。PE 文件中的大小或部分保存在成员中。00100000
0x00001000
.data
.text
.SizeOfRawData