MSI: move file at reboot if it's being used

Mike McCormack mike at codeweavers.com
Sun Dec 5 20:06:31 CST 2004


ChangeLog:
<aric at codeweavers.com>
* if replacing a file in the InstallFiles step that is open, do a 
MoveFile pending on reboot.
-------------- next part --------------
Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.40
diff -u -r1.40 action.c
--- dlls/msi/action.c	3 Nov 2004 22:16:53 -0000	1.40
+++ dlls/msi/action.c	6 Dec 2004 02:45:27 -0000
@@ -2750,6 +2750,25 @@
                     DeleteFileW(file->SourcePath);
                     rc = 0;
                 }
+		else if (rc == ERROR_SHARING_VIOLATION && file->State == 2)
+		{
+		    const static WCHAR tmptag[] = 
+		    	{'.','x','x','x','.','r','e','b','o','o','t',0};
+		    WCHAR tmppath[MAX_PATH];
+		    strcpyW(tmppath,file->TargetPath);
+		    strcatW(tmppath,tmptag);
+		    if (!MoveFileW(file->SourcePath,tmppath))
+                    {
+                        ERR("Reboot file copy name colission\n");
+                    }
+                    else
+                    {
+                        MoveFileExW(tmppath, file->TargetPath, 
+		        	       MOVEFILE_DELAY_UNTIL_REBOOT);
+                        FIXME("Need to signal that a reboot in needed\n");
+                        rc = 0;
+                    }
+		}
                 else
                     break;
             }


More information about the wine-patches mailing list