* GetModuleByAddr: Prevent returning a name of the current executable for invalid addresses such as pointer(-1) on Windows.

git-svn-id: trunk@43364 -
This commit is contained in:
yury 2019-11-02 14:54:25 +00:00
parent 6f80223b64
commit 4ade471488

View File

@ -98,6 +98,8 @@ uses
begin
baseaddr:=Tmm.AllocationBase;
TST[0]:= #0;
if baseaddr <> nil then
begin
GetModuleFileName(THandle(Tmm.AllocationBase), TST, Length(TST));
{$ifdef FPC_OS_UNICODE}
filename:= String(PWideChar(@TST));
@ -106,6 +108,7 @@ uses
{$endif FPC_OS_UNICODE}
end;
end;
end;
{$elseif defined(morphos) or defined(aros) or defined(amigaos4)}