SetFileTime

  BOOL SetFileTime(hFile, lpftCreation, lpftLastAccess, lpftLastWrite)    
  HANDLE hFile; /* identifies the file */
  LPFILETIME lpftCreation; /* time the file was created */
  LPFILETIME lpftLastAccess; /* time the file was last accessed */
  LPFILETIME lpftLastWrite; /* time the file was last written */

The SetFileTime function sets the date and time that a file was created, last accessed or last modified.

Parameters

hFile

Specifies an open file handle. The file handle must have been created with GENERIC_WRITE access to the file.

lpftCreation

Points to a FILETIME structure that contains the date and time the file was created. This parameter can be NULL if the application does not wish to set this information. Some file systems do not support this time value, so this parameter may be ignored.

The FILETIME structure has the following format:

typedef struct _FILETIME { /* ft */

DWORD dwLowDateTime; /* low 32 bits */

DWORD dwHighDateTime; /* high 32-bits */

} FILETIME, *PFILETIME, *LPFILETIME;

lpftLastAccess

Points to a FILETIME structure that contains the date and time the file was last accessed. This parameter can be NULL if the application does not wish to set this information. Some file systems do not support this time value, so this parameter may be ignored.

lpftLastWrite

Points to a FILETIME structure that contains the date and time the file was last written to. This parameter can be NULL if the application does not wish to set this information. All file systems support this time value.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

See Also

GetFileTime, GetFileType, GetFileSize