title: How to determine the size of an PE executable file from headers and or footers
body: <p>Assuming you have a stream of data or a block of bytes you want to carve, how can you determine the size of the executables?</p>
  
  <p>There are numerous headers inside the PE executable format, but what header sections do I use to determine (if possible) the total length of the executable?</p>
  
  <p>Here is a picture of the file format.</p>
  
  <p><a href="https://i.stack.imgur.com/0DdKh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0DdKh.png" alt="PE File Format"></a></p>