Fix bugs causing creation of new zip files to fail on Win32.
diff --git a/lib/zip_source_win32file.c b/lib/zip_source_win32file.c index 5212ef3..ee8319e 100644 --- a/lib/zip_source_win32file.c +++ b/lib/zip_source_win32file.c
@@ -119,7 +119,7 @@ HANDLE th; th = ops->op_open(ctx); - if (th != INVALID_HANDLE_VALUE && GetFileType(th) == FILE_TYPE_DISK) { + if (th == INVALID_HANDLE_VALUE || GetFileType(th) == FILE_TYPE_DISK) { ctx->supports = ZIP_SOURCE_SUPPORTS_WRITABLE; } if (th != INVALID_HANDLE_VALUE) { @@ -345,6 +345,10 @@ } 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; + } } success = _zip_stat_win32(h, st, ctx);