winpr/clipboard: Also save lastWriteTime for FILEDESCRIPTORW
Currently, when a local uri-list is converted into a FILEDESCRIPTORW list, WinPR doesn't submit the last write time for each file. The result of this is that the last write time of each file on the other peer will have the current time and not the actual last write time that is present on the peer, where the files were copied from. Fix this by also writing the last write time in addition to the FD_WRITESTIME flag.
This commit is contained in:
parent
e96ef524c5
commit
9ba614a1e3
@ -22,6 +22,7 @@
|
||||
#endif
|
||||
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#define WIN32_FILETIME_TO_UNIX_EPOCH UINT64_C(11644473600)
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
@ -52,6 +53,7 @@ struct posix_file
|
||||
char* local_name;
|
||||
WCHAR* remote_name;
|
||||
BOOL is_directory;
|
||||
UINT64 last_write_time;
|
||||
|
||||
int fd;
|
||||
INT64 offset;
|
||||
@ -83,6 +85,7 @@ static struct posix_file* make_posix_file(const char* local_name, const WCHAR* r
|
||||
}
|
||||
|
||||
file->is_directory = S_ISDIR(statbuf.st_mode);
|
||||
file->last_write_time = (statbuf.st_mtime + WIN32_FILETIME_TO_UNIX_EPOCH) * 10 * 1000 * 1000;
|
||||
file->size = statbuf.st_size;
|
||||
return file;
|
||||
error:
|
||||
@ -499,7 +502,7 @@ static BOOL convert_local_file_to_filedescriptor(const struct posix_file* file,
|
||||
FILEDESCRIPTORW* descriptor)
|
||||
{
|
||||
size_t remote_len = 0;
|
||||
descriptor->dwFlags = FD_ATTRIBUTES | FD_FILESIZE | FD_PROGRESSUI;
|
||||
descriptor->dwFlags = FD_ATTRIBUTES | FD_FILESIZE | FD_WRITESTIME | FD_PROGRESSUI;
|
||||
|
||||
if (file->is_directory)
|
||||
{
|
||||
@ -514,6 +517,9 @@ static BOOL convert_local_file_to_filedescriptor(const struct posix_file* file,
|
||||
descriptor->nFileSizeHigh = (file->size >> 32) & 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
descriptor->ftLastWriteTime.dwLowDateTime = (file->last_write_time >> 0) & 0xFFFFFFFF;
|
||||
descriptor->ftLastWriteTime.dwHighDateTime = (file->last_write_time >> 32) & 0xFFFFFFFF;
|
||||
|
||||
remote_len = _wcslen(file->remote_name);
|
||||
|
||||
if (remote_len + 1 > ARRAYSIZE(descriptor->cFileName))
|
||||
|
Loading…
Reference in New Issue
Block a user