Search code examples
headerbyteportable-executablesections

What's the maximum number of sections a PE can have?


I'm writing a program in C# where I read a PE's bytes. But in order to get the RVA I need to use the sections headers. I'd like to know what the maximum number of sections headers is?

I tried Google and I've looked here but I haven't found anything that could point me in the right direction

Thanks.


Solution

  • Since the number of sections is stored in a 16bit integer, the most sections there could ever possibly be is 65535. On XP, programs with more than 96 sections will not run. On Vista and W7, you can use all 65535 sections and the program will still run. Other limits may exist on other operating systems.