GetFileSizeEx is missing in Windows.pas

Noted by user 440bx at forum: The definition of GetFileSizeEx is missing in Windows.pas.

Possible definitions:

const
  kernel32 = 'kernel32';
 
{ missing definitions                                                         }
 
function GetFileSizeEx
           (
            InFileHandle : THANDLE;
            OutFileSize  : PLARGE_INTEGER
           )
         : BOOL; stdcall; external kernel32;   { no need to specify the name  }
 
 
function GetFileSizeEx
           (
            InFileHandle : THANDLE;
            OutFileSize  : pint64
           )
         : BOOL; stdcall; external kernel32; overload;

The first definition mirrors the MSDN definition exactly (except the parameter names which are of no relevance.) The second one would be a "nice to have" overload since FPC supports 64 bit integers without having to resort to the LARGE_INTEGER structure.

Two more overloads are possible using "var" to eliminate the need for pass a pointer to either function.

function is available in FPC 3.2.2 - attach JwaWinBase unit to uses section

that should not be necessary. GetFileSizeEx is documented and defined in kernel32 which is a "bread and butter" dll. For that reason it should not be necessary to include some other unit/file to access a very common API.

Edited by Alexey Torgashin