dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.38k stars 4.75k forks source link

Unify decoding PE headers and reading other PE sections #17088

Open tmat opened 8 years ago

tmat commented 8 years ago

PEHeaders are currently decoded using (customized) BinaryReader while the rest of the PE file is read using blob readers. We should use blob readers everywhere to avoid doing things in two different ways. As a by-product reading PE headers from non-zero position in the stream would just work. Currently it's broken.

tmat commented 8 years ago

See skipped test PEReaderTests.SubStream.

karelz commented 8 years ago

Be warned: This is rather tricky. You have to be careful about allocation lifetime, memory mapping, etc.

danmoseley commented 7 years ago

@tmat I bulk edited disabled tests to 2.0. Does this one actually need fixing in 2.0? It sounds like an enhancement. Can you change milestone if appropraite?

steveharter commented 2 years ago

As a by-product reading PE headers from non-zero position in the stream would just work. Currently it's broken.

When would the position be non-zero?

This is a minor refactoring task that appears valid but low priority.