|
@@ -269,6 +269,7 @@ interface
|
|
function FindStackSegment: TMZExeUnifiedLogicalSegment;
|
|
function FindStackSegment: TMZExeUnifiedLogicalSegment;
|
|
procedure FillLoadableImageSize;
|
|
procedure FillLoadableImageSize;
|
|
procedure FillMinExtraParagraphs;
|
|
procedure FillMinExtraParagraphs;
|
|
|
|
+ procedure FillMaxExtraParagraphs;
|
|
procedure FillStartAddress;
|
|
procedure FillStartAddress;
|
|
procedure FillStackAddress;
|
|
procedure FillStackAddress;
|
|
procedure FillHeaderData;
|
|
procedure FillHeaderData;
|
|
@@ -2200,6 +2201,22 @@ implementation
|
|
Header.MinExtraParagraphs:=(align(ExeSec.Size,16)-align(Header.LoadableImageSize,16)) div 16;
|
|
Header.MinExtraParagraphs:=(align(ExeSec.Size,16)-align(Header.LoadableImageSize,16)) div 16;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ procedure TMZExeOutput.FillMaxExtraParagraphs;
|
|
|
|
+ var
|
|
|
|
+ heapmin_paragraphs: Integer;
|
|
|
|
+ heapmax_paragraphs: Integer;
|
|
|
|
+ begin
|
|
|
|
+ if current_settings.x86memorymodel in x86_far_data_models then
|
|
|
|
+ begin
|
|
|
|
+ { calculate the additional number of paragraphs needed }
|
|
|
|
+ heapmin_paragraphs:=(heapsize + 15) div 16;
|
|
|
|
+ heapmax_paragraphs:=(maxheapsize + 15) div 16;
|
|
|
|
+ Header.MaxExtraParagraphs:=min(Header.MinExtraParagraphs-heapmin_paragraphs+heapmax_paragraphs,$FFFF);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ Header.MaxExtraParagraphs:=$FFFF;
|
|
|
|
+ end;
|
|
|
|
+
|
|
procedure TMZExeOutput.FillStartAddress;
|
|
procedure TMZExeOutput.FillStartAddress;
|
|
var
|
|
var
|
|
EntryMemPos: qword;
|
|
EntryMemPos: qword;
|
|
@@ -2236,6 +2253,7 @@ implementation
|
|
Header.MaxExtraParagraphs:=$FFFF;
|
|
Header.MaxExtraParagraphs:=$FFFF;
|
|
FillLoadableImageSize;
|
|
FillLoadableImageSize;
|
|
FillMinExtraParagraphs;
|
|
FillMinExtraParagraphs;
|
|
|
|
+ FillMaxExtraParagraphs;
|
|
FillStartAddress;
|
|
FillStartAddress;
|
|
FillStackAddress;
|
|
FillStackAddress;
|
|
if assigned(exemap) then
|
|
if assigned(exemap) then
|