Merge pull request #141 from tschabo/master

Removing FILE_ATTRIBUTE_TEMPORARY before Moving the tmp file under Win…
diff --git a/lib/zip_source_win32a.c b/lib/zip_source_win32a.c
index 79bb2e8..60f61a5 100644
--- a/lib/zip_source_win32a.c
+++ b/lib/zip_source_win32a.c
@@ -107,8 +107,19 @@
 
 static int
 _win32_rename_temp_a(_zip_source_win32_read_file_t *ctx) {
+    DWORD attributes = GetFileAttributesA(ctx->tmpname);
+    if (INVALID_FILE_ATTRIBUTES == attributes)
+	return -1;
+
+    if (FILE_ATTRIBUTE_TEMPORARY & attributes) {
+	if (!SetFileAttributesA(ctx->tmpname, attributes & ~FILE_ATTRIBUTE_TEMPORARY))
+	    return -1;
+    }
+
     if (!MoveFileExA(ctx->tmpname, ctx->fname, MOVEFILE_REPLACE_EXISTING))
 	return -1;
+
+    
     return 0;
 }
 
diff --git a/lib/zip_source_win32w.c b/lib/zip_source_win32w.c
index 6a433fb..731a222 100644
--- a/lib/zip_source_win32w.c
+++ b/lib/zip_source_win32w.c
@@ -131,8 +131,18 @@
 
 static int
 _win32_rename_temp_w(_zip_source_win32_read_file_t *ctx) {
+    DWORD attributes = GetFileAttributesW(ctx->tmpname);
+    if (INVALID_FILE_ATTRIBUTES == attributes)
+	return -1;
+
+    if (FILE_ATTRIBUTE_TEMPORARY & attributes) {
+	if (!SetFileAttributesW(ctx->tmpname, attributes & ~FILE_ATTRIBUTE_TEMPORARY))
+	    return -1;
+    }
+
     if (!MoveFileExW(ctx->tmpname, ctx->fname, MOVEFILE_REPLACE_EXISTING))
 	return -1;
+
     return 0;
 }