flat assembler
Message board for the users of flat assembler.

Index > Windows > How to calculate the SizeOfImage of a PE executable????

Author
Thread Post new topic Reply to topic
jhonny6721



Joined: 07 Aug 2014
Posts: 26
jhonny6721
Hello. How I can calculate SizeOfImage of a PE Executable properly??? I'm adding a section to a PE executable. But the SizeOfImage is corrupted if I increase its value. How I can do it??

I have tried with the following formule:

Code:
SizeOfImage = Virtual address + Virtual size (values of the last section)
    


I have followed this calculation using my computer,
But the result of that do not match with the Original SizeOfImage

Can somebody tell how to calcuolate the SizeOfImage???

_________________
Мне нравится программирование.
Post 01 Sep 2014, 19:31
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
Go through all the sections, and compute the maximum (IMAGE_SECTION_HEADER.VirtualAddress+IMAGE_SECTION_HEADER.VirtualSize). That value is your new SizeOfImage.
Post 01 Sep 2014, 20:03
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
jhonny6721



Joined: 07 Aug 2014
Posts: 26
jhonny6721
Thanks, comrade.
Post 03 Sep 2014, 00:05
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
Не зачто, брат.
Post 03 Sep 2014, 08:57
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.