Microsoft KB Archive/306587

= PRB: FtpFindFirstFile and InternetFindNextFile May Return Incorrect Date =

Article ID: 306587

Article Last Modified on 7/27/2004

-

APPLIES TO


 * Microsoft Windows CE 2.12 for the Handheld PC
 * Microsoft Windows CE 2.11 for the Handheld PC
 * Microsoft Windows CE 2.0 for the Handheld PC
 * Microsoft Windows CE 1.0
 * Microsoft Windows CE 3.0 for the Handheld PC

-



This article was previously published under Q306587



SYMPTOMS
When you are using the WinInet API to access File Transfer Protocol (FTP) servers, the FtpFindFirstFile and InternetFindNextFile functions may return file dates that are in the future.



CAUSE
Some UNIX FTP servers (or Microsoft Internet Information Services FTP servers that are configured to run in UNIX folder listing style mode) omit the year part of the date that is sent along with a directory listing if the date is recent. In such cases, WinInet assumes the missing year is the current year and this is reflected in the WIN32_FIND_DATA structure that is returned. However, depending on how the FTP server was configured, in early months of the year WinInet may incorrectly assume the current year for a previous year's date. For example, if the file on the FTP server was created December 15, 2000, and an application that uses WinInet is executed on January 15, 2001, the WIN32_FIND_DATA information will contain a file creation date for the file of December 15, 2001.



RESOLUTION
One way to work around this problem would be to check if the returned date is in the future. If so, subtract &quot;1&quot; from the year, but keep in mind situations where the date could actually be in the future such as could arise from differences in time zones.

