GetFileSizeEx function missing lazarus / 67-Windows ---------------------------------------------------------------------- 440bx · 2024-11-06 09:13 Hello, The definition of GetFileSizeEx is missing in Windows.pas. Possible definitions:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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. ETA: forgot to mention, this applies to FPC v3.2.2.  I don't know if the definition has already been added in an upcoming version. ---------------------------------------------------------------------- paweld · 2024-11-06 09:28 function is available in FPC 3.2.2 - attach JwaWinBase unit to uses section ---------------------------------------------------------------------- Thaddy · 2024-11-06 10:15 Or simply jwaWindows which solves more than that problem. And yes, It can be replaced with var, but you have to convince Marcov and I did not succeed in doing that in the past odd 20 years or so. Just that the API can not express var. The - OLD - Delphi developers were a bit more analytic about those calls and made them safe from the start. ---------------------------------------------------------------------- 440bx · 2024-11-06 10:15 Quote from: paweld on November 06, 2024, 10:28:29 amfunction is available in FPC 3.2.2 - attach JwaWinBase unit to uses section I know that but, 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. ---------------------------------------------------------------------- Thaddy · 2024-11-06 10:18 Posts crossed, was editting... (Marcov did provide a compat unit, btw, so I do not blame him for everything) ---------------------------------------------------------------------- 440bx · 2024-11-06 10:27 Quote from: Thaddy on November 06, 2024, 11:18:30 am(Marcov did provide a compat unit, btw, so I do not blame him for everything) Just for the record, I'm not blaming anybody for anything. I would just like to see that function included in the Windows unit because it is a common, documented and often used function.  That's all, no more, no less. ---------------------------------------------------------------------- AlexTP · 2024-11-06 10:33 I posted the bugreport https://gitlab.com/freepascal.org/fpc/source/-/issues/40996 ---------------------------------------------------------------------- Thaddy · 2024-11-06 10:36 It was a light harted remark that Marcov understands. ---------------------------------------------------------------------- 440bx · 2024-11-06 10:37 Thank you Alex. I was going to wait for @marcov's view on the matter but, as you have probably noticed, I do believe it should be included in the Windows unit. @Thaddy, ok, no harm done. ---------------------------------------------------------------------- Thaddy · 2024-11-06 13:56 Knowing Marcov a bit he possibly add it to the compat unit. ---------------------------------------------------------------------- marcov · 2024-11-06 15:52 Done. redef.inc  with special overloads is just an include file, not an unit btw. 440bx probably knows since he is a regular submitter of windows unit issues. Note that recommending jwa* should be clearly marked as temporary solution. I'm not sure how 64-bit ready the JWA* units  are. ---------------------------------------------------------------------- 440bx · 2024-11-06 16:14 Quote from: marcov on November 06, 2024, 04:52:33 pmDone. Thank you Marco. Quote from: marcov on November 06, 2024, 04:52:33 pmNote that recommending jwa* should be clearly marked as temporary solution. I'm not sure how 64-bit ready the JWA* units  are. and in addition to that, I've seen a few errors in the definitions of ntdll functions.  I should have reported those but, I was focused on something else then forgot and now I don't remember which functions.  I do remember that a fair number of them were in definitions of functions in ntdll (some documented, some not.)  The same for internal Windows structures, a fair number of them have not been updated to reflect more recent versions of Windows. Personally, I'd recommend leaving the Jwa* definitions alone.  They were probably fine at one time but, I think that now they are outdated and, as a result, a bit risky to use. ---------------------------------------------------------------------- Thaddy · 2024-11-06 16:34 Tnx Marco, also for the fix.