mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 10:59:18 +02:00
* 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:
parent
6f80223b64
commit
4ade471488
@ -98,12 +98,15 @@ uses
|
|||||||
begin
|
begin
|
||||||
baseaddr:=Tmm.AllocationBase;
|
baseaddr:=Tmm.AllocationBase;
|
||||||
TST[0]:= #0;
|
TST[0]:= #0;
|
||||||
GetModuleFileName(THandle(Tmm.AllocationBase), TST, Length(TST));
|
if baseaddr <> nil then
|
||||||
|
begin
|
||||||
|
GetModuleFileName(THandle(Tmm.AllocationBase), TST, Length(TST));
|
||||||
{$ifdef FPC_OS_UNICODE}
|
{$ifdef FPC_OS_UNICODE}
|
||||||
filename:= String(PWideChar(@TST));
|
filename:= String(PWideChar(@TST));
|
||||||
{$else}
|
{$else}
|
||||||
filename:= String(PChar(@TST));
|
filename:= String(PChar(@TST));
|
||||||
{$endif FPC_OS_UNICODE}
|
{$endif FPC_OS_UNICODE}
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user