mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-24 08:37:42 +00:00
fix(windows): sentrytool fails on mem realloc
Fixes #4002. We needed to reseat the pointers after the realloc as the base address changed; this only affected us occasionally but nasty when it did!
This commit is contained in:
parent
e571113b22
commit
023a70aadd
1 changed files with 6 additions and 0 deletions
|
|
@ -265,6 +265,9 @@ begin
|
|||
s.SetSize(SectionOffset + SectionRawSize);
|
||||
FillChar((PByte(s.Memory) + SectionOffset)^, SectionRawSize, 0);
|
||||
|
||||
nh32 := PImageNtHeaders(NativeUInt(nh32)-NativeUInt(dh)+NativeUInt(s.Memory));
|
||||
section := PImageSectionHeader(NativeUInt(section)-NativeUInt(dh)+NativeUInt(s.Memory));
|
||||
|
||||
// Increment the number of sections
|
||||
Inc(nh32.FileHeader.NumberOfSections);
|
||||
|
||||
|
|
@ -324,6 +327,9 @@ begin
|
|||
s.SetSize(SectionOffset + SectionRawSize);
|
||||
FillChar((PByte(s.Memory) + SectionOffset)^, SectionRawSize, 0);
|
||||
|
||||
nh64 := PImageNtHeaders64(NativeUInt(nh64)-NativeUInt(dh)+NativeUInt(s.Memory));
|
||||
section := PImageSectionHeader(NativeUInt(section)-NativeUInt(dh)+NativeUInt(s.Memory));
|
||||
|
||||
// Increment the number of sections
|
||||
Inc(nh64.FileHeader.NumberOfSections);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue