Improve regular file detection on Windows. Based on a suggestion by Khaled Mardam-Bey.
diff --git a/lib/zip_source_file_win32_named.c b/lib/zip_source_file_win32_named.c index a2a44c8..1fe5591 100644 --- a/lib/zip_source_file_win32_named.c +++ b/lib/zip_source_file_win32_named.c
@@ -208,7 +208,14 @@ } st->exists = true; - st->regular_file = true; /* TODO: Is this always right? How to determine without a HANDLE? */ + st->regular_file = false; + + if (file_attributes.dwFileAttributes != INVALID_FILE_ATTRIBUTES) { + if ((file_attributes.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_REPARSE_POINT)) == 0) { + st->regular_file = true; + } + } + if (!_zip_filetime_to_time_t(file_attributes.ftLastWriteTime, &st->mtime)) { zip_error_set(&ctx->error, ZIP_ER_READ, ERANGE); return false;