Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.218
diff -u -p -r1.218 file.inc
--- includes/file.inc	7 Jul 2010 01:10:35 -0000	1.218
+++ includes/file.inc	22 Aug 2010 05:25:46 -0000
@@ -1030,7 +1030,13 @@ function file_unmanaged_delete($path) {
     return FALSE;
   }
   if (is_file($path)) {
-    return unlink($path);
+    // On Windows, we must alter the permissions first to ensure successful
+    // file deletion.
+    if (!($result = unlink($path)) && substr(PHP_OS, 0, 3) == 'WIN') {
+      drupal_chmod($path, 0664);
+      return unlink($path);
+    }
+    return $result;
   }
   // Return TRUE for non-existent file, but log that nothing was actually
   // deleted, as the current state is the intended result.
