Here the code where I'm trying to set last-accessed attribute of the file to some value.
hFile = CreateFile(szDestName.GetBuffer(255), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
GetFileTime(hFile,&createTime,&accessTime,&writeTime);
writeTime.dwHighDateTime -= 1000L;
accessTime = writeTime;
SetFileTime(hFile,&createTime,&accessTime,&writeTime);
// at this point access and write(modified) times are equal
CloseHandle(hFile);
// at this point access time is changed to the current system time
I suppose I didn't set the correct attributes in CreateFile function.
Does anybody knows how to do this correctly?