@@ -1759,6 +1759,22 @@ GetFileAttributesExW(
17591759 FILEUnixTimeToFileTime ( stat_data.st_mtime ,
17601760 ST_MTIME_NSEC (&stat_data) );
17611761
1762+ /* if Unix mtime is greater than atime, return mtime
1763+ as the last access time */
1764+ if (CompareFileTime (&attr_data->ftLastAccessTime ,
1765+ &attr_data->ftLastWriteTime ) < 0 )
1766+ {
1767+ attr_data->ftLastAccessTime = attr_data->ftLastWriteTime ;
1768+ }
1769+
1770+ /* if Unix ctime is greater than mtime, return mtime
1771+ as the create time */
1772+ if (CompareFileTime (&attr_data->ftLastWriteTime ,
1773+ &attr_data->ftCreationTime ) < 0 )
1774+ {
1775+ attr_data->ftCreationTime = attr_data->ftLastWriteTime ;
1776+ }
1777+
17621778 /* Get the file size. GetFileSize is not used because it gets the
17631779 size of an already-open file */
17641780 attr_data->nFileSizeLow = (DWORD) stat_data.st_size ;
@@ -4451,6 +4467,22 @@ GetFileInformationByHandle(
44514467 FILEUnixTimeToFileTime ( stat_data.st_mtime ,
44524468 ST_MTIME_NSEC (&stat_data) );
44534469
4470+ /* if Unix mtime is greater than atime, return mtime
4471+ as the last access time */
4472+ if (CompareFileTime (&lpFileInformation->ftLastAccessTime ,
4473+ &lpFileInformation->ftLastWriteTime ) < 0 )
4474+ {
4475+ lpFileInformation->ftLastAccessTime = lpFileInformation->ftLastWriteTime ;
4476+ }
4477+
4478+ /* if Unix ctime is greater than mtime, return mtime
4479+ as the create time */
4480+ if (CompareFileTime (&lpFileInformation->ftLastWriteTime ,
4481+ &lpFileInformation->ftCreationTime ) < 0 )
4482+ {
4483+ lpFileInformation->ftCreationTime = lpFileInformation->ftLastWriteTime ;
4484+ }
4485+
44544486 lpFileInformation->dwVolumeSerialNumber = stat_data.st_dev ;
44554487
44564488 /* Get the file size. GetFileSize is not used because it gets the
0 commit comments