changes to fix PE header corruption when inserting exception stack tr…#190
Conversation
…ace info into executable
- JclDebug: rename CheckHeadersSpace -> AdjustHeadersSpace (it now adjusts SizeOfHeaders through a var parameter) - JclDebug: wrap the MovePointerToRawData loop body in begin/end so the zero-raw-section comment and guard are clearly inside the loop - JclDebug: add blank lines before the SizeOfHeaders and checksum comment blocks - JclPeImage: add the mandatory blank line before InsertHeaderSpace - JclPeImage: factor the duplicated 32/64-bit header-grow blocks into a single nested helper EnsureSectionHeaderSpace. The section table is at the same file offset for both targets, so the 32-bit mapping helpers locate it for both; only the per-target SizeOfHeaders bump stays in the caller. No behavior change. Verified compiling under dcc32/dcc64, and that the grow path still yields signtool-acceptable 32- and 64-bit images (a faithful pre-fix image is still rejected with 0x800700C1). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
an updated commit has been pushed. |
|
Is there something more I need to look at to make the pull request pass? I can't work it out here; there's "1 requested change" above but it doesn't display anything useful to me. |
One of the change requests made by @obones has not been marked as resolved. |
|
The remaining change requested appears to have been done even if Github does not display it properly. And please remember, this is a volunteer based effort there, so delays are expected. |
|
This looks good now. |
|
I've tried rebasing, git tells me everything up-to-date. above it says "No conflicts with base branch Changes can be cleanly merged.". Googled for other instructions, not sure where to go from here. :( |
Why rebase? The merged commit will normally be placed on top of the current master. So you should get a normal Git history. |
Because I prefer having branches not crossing each other. While I prefer this: I'm really missing the "rebase" button that I get with Gitlab, and the "rebase and merge" option here at Github is misleading, it's doing "rebase and fastforward" thus not creating the merge commit that I'd want. |




Fix JCLDEBUG insertion producing a PE that signtool rejects (0x800700C1)
When the header area lacks room for the new JCLDEBUG section header,
InsertDebugDataIntoExecutableFile grows it but never updated
OptionalHeader.SizeOfHeaders, and gave .bss/.tls a bogus PointerToRawData.
The loader tolerates this; signtool rejects it with ERROR_BAD_EXE_FORMAT.
from both the 32-bit and 64-bit paths (32-bit had no header room check);
MovePointerToRawData skips zero-raw sections; recompute PE checksum.
InsertHeaderSpace helper.
Co-Authored-By: Claude Opus 4.8 (1M context)