www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD generated exes' size differ from PE headers

reply bobef <aasd.aasdasd.asd.ad.ad.as.d.a asdasdas.das.da.d.ad.sa.d> writes:
I'm walking the PE header sections to find out the file size. I find the
maximum PointerToRawData and add SizeOfRawData of the section to find where the
exe ends. It works with the files I've tested. When compiling exe file with DMD
1.055 and -g there are additional four bytes after the last section. Why is
that? Is SizeOfRawData wrong or there is something else at the end?

Thanks
Jan 26 2010
next sibling parent Walter Bright <newshound1 digitalmars.com> writes:
bobef wrote:
 I'm walking the PE header sections to find out the file size. I find
 the maximum PointerToRawData and add SizeOfRawData of the section to
 find where the exe ends. It works with the files I've tested. When
 compiling exe file with DMD 1.055 and -g there are additional four
 bytes after the last section. Why is that? Is SizeOfRawData wrong or
 there is something else at the end?

I don't know. Could be alignment padding.
Jan 26 2010
prev sibling parent reply BCS <none anon.com> writes:
Hello bobef,

 I'm walking the PE header sections to find out the file size. I find
 the maximum PointerToRawData and add SizeOfRawData of the section to
 find where the exe ends. It works with the files I've tested. When
 compiling exe file with DMD 1.055 and -g there are additional four
 bytes after the last section. Why is that? Is SizeOfRawData wrong or
 there is something else at the end?
 

What are the 4 bytes? Can you change what they are by tweaking things? -- <IXOYE><
Jan 26 2010
parent bobef <aasd.aasdasd.asd.ad.ad.as.d.a asdasdas.das.da.d.ad.sa.d> writes:
BCS Wrote:

 Hello bobef,
 
 I'm walking the PE header sections to find out the file size. I find
 the maximum PointerToRawData and add SizeOfRawData of the section to
 find where the exe ends. It works with the files I've tested. When
 compiling exe file with DMD 1.055 and -g there are additional four
 bytes after the last section. Why is that? Is SizeOfRawData wrong or
 there is something else at the end?
 

What are the 4 bytes? Can you change what they are by tweaking things? -- <IXOYE><

Yep, they seem to change.
Jan 27 2010