I'm having trouble using GetFileTime and SetFileTime when it comes to directories. In particular, I believe that my problem is that I am new to WinAPI, and I do not think that I am getting the Pen correctly.
There are 2 scenarios.
In the first, I just need a handle to get the file or directory timestamps (create, access, mod). I would like to make this handle safe and flexible. Do not want to be too generous in options.
In the second, I need a handle that allows me to change the file or timestamp directive. I would also like to create this descriptor with minimal rights, but in a flexible and reliable way.
Flexible, I mean, in both scenarios I need code to work both locally and in a network resource, as well as in a multi-threaded application. The multi-threaded part is not needed because my application will not create multiple / dir file descriptors, but it is possible that some other application is running in the background.
h1 = CreateFile(itemA, GENERIC_READ, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
if (h1 == INVALID_HANDLE_VALUE){
return 0;
}
hItemB = CreateFile(itemB, FILE_WRITE_ATTRIBUTES, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
if (hItemB == INVALID_HANDLE_VALUE){
return 0;
}
source
share