Bug fix for Windows backend from Michael Beck: It seems that Windows returns ERROR_PATH_NOT_FOUND for CreateFile() if the path component of a file path does not exists rather than ERROR_FILE_NOT_FOUND. Because libzip maps only the latter, generic ZIP_ER_READ was returned before.
diff --git a/lib/zip_source_win32handle.c b/lib/zip_source_win32handle.c index 35e2e67..7fe003d 100644 --- a/lib/zip_source_win32handle.c +++ b/lib/zip_source_win32handle.c
@@ -344,9 +344,12 @@ } else { h = ctx->ops->op_open(ctx); - if (h == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_NOT_FOUND) { - zip_error_set(&ctx->error, ZIP_ER_READ, ENOENT); - return -1; + if (h == INVALID_HANDLE_VALUE) { + win32err = GetLastError(); + if (win32err == ERROR_FILE_NOT_FOUND || win32err == ERROR_PATH_NOT_FOUND) { + zip_error_set(&ctx->error, ZIP_ER_READ, ENOENT); + return -1; + } } }