mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 21:33:17 +02:00
Use GetProcAddress to set GetFinalPathNameByHandle function pointer
This commit is contained in:
parent
6ab2cd3ce9
commit
f510e6f59b
@ -646,7 +646,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetFinalPathNameByHandle(aHandle : THandle; Buf : LPSTR; BufSize : DWord; Flags : DWord) : DWORD; external 'kernel32' name 'GetFinalPathNameByHandleA';
|
type
|
||||||
|
TGetFinalPathNameByHandle = function(aHandle : THandle; Buf : LPSTR; BufSize : DWord; Flags : DWord) : DWORD;
|
||||||
|
var
|
||||||
|
GetFinalPathNameByHandle:TGetFinalPathNameByHandle=nil;
|
||||||
|
|
||||||
Const
|
Const
|
||||||
VOLUME_NAME_NT = $2;
|
VOLUME_NAME_NT = $2;
|
||||||
@ -664,7 +667,7 @@ begin
|
|||||||
FillChar(Buf,MAX_PATH+1,0);
|
FillChar(Buf,MAX_PATH+1,0);
|
||||||
if Not FileExists(aLink,False) then
|
if Not FileExists(aLink,False) then
|
||||||
exit;
|
exit;
|
||||||
if not CheckWin32Version(6, 0) then
|
if not CheckWin32Version(6, 0) or not(assigned(GetFinalPathNameByHandle)) then
|
||||||
exit;
|
exit;
|
||||||
Attrs:=GetFileAttributes(PAnsiChar(aLink));
|
Attrs:=GetFileAttributes(PAnsiChar(aLink));
|
||||||
if (Attrs=INVALID_FILE_ATTRIBUTES) or ((Attrs and faSymLink)=0) then
|
if (Attrs=INVALID_FILE_ATTRIBUTES) or ((Attrs and faSymLink)=0) then
|
||||||
@ -1718,6 +1721,8 @@ begin
|
|||||||
// GetTimeZoneInformationForYear is supported only on Vista and newer
|
// GetTimeZoneInformationForYear is supported only on Vista and newer
|
||||||
if (kernel32dll<>0) and (Win32MajorVersion>=6) then
|
if (kernel32dll<>0) and (Win32MajorVersion>=6) then
|
||||||
GetTimeZoneInformationForYear:=TGetTimeZoneInformationForYear(GetProcAddress(kernel32dll,'GetTimeZoneInformationForYear'));
|
GetTimeZoneInformationForYear:=TGetTimeZoneInformationForYear(GetProcAddress(kernel32dll,'GetTimeZoneInformationForYear'));
|
||||||
|
if (kernel32dll<>0) then
|
||||||
|
GetFinalPathNameByHandle:=TGetFinalPathNameByHandle(GetProcAddress(kernel32dll,'GetFinalPathNameByHandleA'));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function GetAppConfigDir(Global : Boolean) : String;
|
Function GetAppConfigDir(Global : Boolean) : String;
|
||||||
|
Loading…
Reference in New Issue
Block a user