Alignment is a rounded value. The size of these partitions is rounded for efficiency, because the OS moves things around in chunks anyway.
File alignment is typically 512 bytes, which correspond to the block size of most file systems.
Partition alignment is typically 4096 bytes, which correspond to the size of the memory page.
So, if you have a PE file with a section (for example, " .text ") that contains 513 bytes of data:
- The
.text section will be rounded to 1024 bytes in the file. - The
.text section will be rounded to 4096 bytes in memory.
Pay attention to the amount of free space both in the file and in memory.
I'm not sure why you want to "convert from one alignment to another." The recipe you received leaves the goal of the exercise a secret. If your goal is to manipulate PE files, then all you need to consider is file alignment. The Windows boot loader will process the partition alignment material when it issues it to memory, so you don’t have to think about it at all.
Read more about PE here .
source share