On Wednesday 26 March 2025 15:52:17 Martin Storsjö wrote: > On Thu, 20 Mar 2025, Pali Rohár wrote: > > > These functions are available since msvcr70.dll. > > > For older msvcrt versions provide emulation via _fstat32(), _stat32() > > and _wstat32() functions. These functions have only truncated 32-bit > > file size and timestamp support. Real 64-bit non-truncated file size and > > timestamp information is retrieved via the WinAPI calls. For _stat64() > > and _wstat64() use FindFirstFile() call and for _fstat64() use > > GetFileInformationByHandle() call. > > It took me a couple of reads through this to understand exactly what you > mean here, but I don't have any suggestions for how to write it more > understandably.
Well, if anybody has idea how to improve commit message, fell free to do it. I'm fine if anybody modify my commit messages to make make them better. > It looks to me from MS docs, that GetFileInformationByHandle only is > available since XP. Is this a problem for us? (I don't mind it.) MS has incorrect information on web. I checked that function GetFileInformationByHandle (non-Ex version) is available in kernel32.dll library in all Windows versions, yes really all, for NT line since first Windows NT 3.1 (so not only XP+), also in Windows 9x (since 95), and also in Win32s on WfW. In current MS documentation is written: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfileinformationbyhandle Minimum supported client: Windows XP [desktop apps only] Minimum supported server: Windows Server 2003 [desktop apps only] But in archived documentation is written: https://web.archive.org/web/20060620190203/http://msdn.microsoft.com/library/en-us/fileio/fs/getfileinformationbyhandle.asp Client: Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95. Server: Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT Server. Also older msvcrt10/20/40 versions are using GetFileInformationByHandle in their exported 32-bit fstat symbol function, so it should be really safe to use. It looks like that MS intentionally removed pre-XP stuff from lot of their documentation resources. > > Same thing is doing msvcrt DLL library for other stat functions. > > This sentences is unnecessarily cryptic. "The msvcrt DLL library does the > same for other stat functions" is understandable. Is that what you mean > here? Yes. > > > > Functions _fstat64() and _stat64() are already used by mingw-w64 crt, so > > ensure that they are present in every CRT import library. > > Where are they used? I only see _fstat64 used in the _fstat64i32 wrapper. > But _stat64() is used in the stat() wrapper already, so I guess that stat() > didn't work at all on the older CRTs so far? And _fstat64i32 is used in header file via '#define _fstat _fstat64i32' So it means that both _fstat64 and _stat64 are used in some manner by mingw-w64. And yes, the stat() did not work with older CRTs. > Then again I see that these functions do exist in msvcrt.dll since Windows > 2000, so the number of people targeting older versions and/or using older > numbered CRTs is very low, so that's probably why this hasn't been a big > issue so far. Yes, this is mostly for older numbered CRTs. > Other than that, I think this patch looks ok. > > // Martin _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
