* win64 has always SetThreadStackGuarantee

This commit is contained in:
florian 2024-01-26 21:42:26 +01:00
parent a774075f2f
commit acb6c7f36b
3 changed files with 9 additions and 3 deletions

View File

@ -273,8 +273,14 @@ type
function GetModuleHandle(p : PAnsiChar) : THandle;
stdcall;external KernelDLL name 'GetModuleHandleA';
{$ifdef win64}
{ all win64 versions have this function, including 64 bit XP }
function SetThreadStackGuarantee(StackSizeInBytes : PPtrUint) : BOOL;
stdcall;external KernelDLL name 'SetThreadStackGuarantee';
{$else win64}
var
SetThreadStackGuarantee: function(StackSizeInBytes : PPtrUint) : BOOL; stdcall;
{$endif win64}
{$else WINCE}
{ module functions }

View File

@ -230,7 +230,9 @@ var
begin
InitThread(ti.stklen);
{$ifndef wince}
{$ifdef win32}
if Assigned(SetThreadStackGuarantee) then
{$endif win32}
SetThreadStackGuarantee(@StackMargin);
{$endif wince}
end;

View File

@ -478,9 +478,7 @@ initialization
{ pass dummy value }
StackLength := CheckInitialStkLen($1000000);
StackBottom := StackTop - StackLength;
CodePointer(SetThreadStackGuarantee) := WinGetProcAddress(WinGetModuleHandleW(KernelDLL), 'SetThreadStackGuarantee');
if Assigned(SetThreadStackGuarantee) then
SetThreadStackGuarantee(@StackMargin);
SetThreadStackGuarantee(@StackMargin);
{ get some helpful informations }
GetStartupInfo(@startupinfo);