mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 07:28:26 +02:00
win rtl: load GetTimeZoneInformationForYear dynamically. Issue #38192
git-svn-id: trunk@47817 -
This commit is contained in:
parent
3f7d3e17cd
commit
3f605a5b50
@ -917,6 +917,12 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
type
|
||||
TGetTimeZoneInformationForYear = function(wYear: USHORT; lpDynamicTimeZoneInformation: PDynamicTimeZoneInformation;
|
||||
var lpTimeZoneInformation: TTimeZoneInformation): BOOL;stdcall;
|
||||
var
|
||||
GetTimeZoneInformationForYear:TGetTimeZoneInformationForYear=nil;
|
||||
|
||||
function GetLocalTimeOffset(const DateTime: TDateTime; const InputIsUTC: Boolean; out Offset: Integer): Boolean;
|
||||
var
|
||||
Year: Integer;
|
||||
@ -961,10 +967,11 @@ var
|
||||
DSTStart, DSTEnd: TDateTime;
|
||||
|
||||
begin
|
||||
if not Assigned(GetTimeZoneInformationForYear) then
|
||||
Exit(False);
|
||||
Year := YearOf(DateTime);
|
||||
TZInfo := Default(TTimeZoneInformation);
|
||||
// GetTimeZoneInformationForYear is supported only on Vista and newer
|
||||
if not ((Win32MajorVersion>=6) and GetTimeZoneInformationForYear(Year, nil, TZInfo)) then
|
||||
if not GetTimeZoneInformationForYear(Year, nil, TZInfo) then
|
||||
Exit(False);
|
||||
|
||||
if (TZInfo.StandardDate.Month>0) and (TZInfo.DaylightDate.Month>0) then
|
||||
@ -1590,6 +1597,9 @@ begin
|
||||
FindExInfoDefaults := FindExInfoStandard; // also searches SFNs. XP only.
|
||||
if (Win32MajorVersion>=6) and (Win32MinorVersion>=1) then
|
||||
FindFirstAdditionalFlags := FIND_FIRST_EX_LARGE_FETCH; // win7 and 2008R2+
|
||||
// GetTimeZoneInformationForYear is supported only on Vista and newer
|
||||
if (kernel32dll<>0) and (Win32MajorVersion>=6) then
|
||||
GetTimeZoneInformationForYear:=TGetTimeZoneInformationForYear(GetProcAddress(kernel32dll,'GetTimeZoneInformationForYear'));
|
||||
end;
|
||||
|
||||
Function GetAppConfigDir(Global : Boolean) : String;
|
||||
|
@ -623,8 +623,8 @@ function GetThreadPriorityBoost(hThread: THandle; var DisablePriorityBoost: Bool
|
||||
function GetThreadSelectorEntry(hThread: THandle; dwSelector: DWORD; var lpSelectorEntry: TLDTEntry): BOOL; external 'kernel32' name 'GetThreadSelectorEntry';
|
||||
function GetThreadTimes(hThread: THandle; var lpCreationTime, lpExitTime, lpKernelTime, lpUserTime: TFileTime): BOOL; external 'kernel32' name 'GetThreadTimes';
|
||||
function GetTimeZoneInformation(var lpTimeZoneInformation: TTimeZoneInformation): DWORD; external 'kernel32' name 'GetTimeZoneInformation';
|
||||
function GetTimeZoneInformationForYear(wYear: USHORT; lpDynamicTimeZoneInformation: PDynamicTimeZoneInformation;
|
||||
var lpTimeZoneInformation: TTimeZoneInformation): BOOL; external 'kernel32' name 'GetTimeZoneInformationForYear';
|
||||
//function GetTimeZoneInformationForYear(wYear: USHORT; lpDynamicTimeZoneInformation: PDynamicTimeZoneInformation;
|
||||
// var lpTimeZoneInformation: TTimeZoneInformation): BOOL; external 'kernel32' name 'GetTimeZoneInformationForYear';
|
||||
//function GetTitleBarInfo(hwnd: HWND; var pti: TTitleBarInfo): BOOL;external 'user32' name 'GetTitleBarInfo';
|
||||
function GetTokenInformation(TokenHandle: THandle; TokenInformationClass: TTokenInformationClass; TokenInformation: Pointer; TokenInformationLength: DWORD; var ReturnLength: DWORD): BOOL; external 'advapi32' name 'GetTokenInformation';
|
||||
function GetUpdateRect(hWnd: HWND; var lpRect: TRect; bErase: BOOL): BOOL; external 'user32' name 'GetUpdateRect';
|
||||
|
Loading…
Reference in New Issue
Block a user