Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OptionalHeader.SizeOfInitializedData remains unchanged after new section is added. #28

Open
AlexWhiter opened this issue Apr 5, 2018 · 2 comments

Comments

@AlexWhiter
Copy link
Contributor

Since the debug section is marked as IMAGE_SCN_CNT_INITIALIZED_DATA, OptionalHeader.SizeOfInitializedData should be adjusted accordingly when this section is added.
If a debug section was already present in the file, its flags should probably be checked to make sure SizeOfInitializedData is set to a correct value.

I'm not sure if this is a real problem. The EXEs and DLLs with unadjusted SizeOfInitializedData work just fine.
It's just a matter of consistency.

@rainers
Copy link
Owner

rainers commented Apr 7, 2018

Seems reasonable, but optlink (the DigitalMars linker that generates the usual executables processed with cv2pdb) doesn't write anything sensible to SizeOfInitializedData to begin with.

Checking some random Microsoft files, the sum of the section values also doesn't add up to SizeOfInitializedData so it really doesn't seem to be very important.

A patch should recalculate it from scratch.

@AlexWhiter
Copy link
Contributor Author

This seems to depend on Windows version. The files I've checked in WIndoows XP, contained a correct value of SizeOfInitializedData.
And, for example, explorer.exe in Win10 build 16299 has wrong physical size in .data section (0x1000 instead of 0x3e00). Corrected physical sizes of the initialized sections sum up to the same value as specified in SizeOfInitializedData.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants