msi:custom.c save custome dlls to own tempfile

Aric Stewart aric at codeweavers.com
Tue Feb 8 05:26:21 CST 2005


This makes a temp file for each dll saved for custom actions. This 
prevents name collisions from causing custom actions to fail. Since we 
register all the new files they will get cleaned up when the install 
finishes.
-------------- next part --------------
Index: dlls/msi/custom.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/custom.c,v
retrieving revision 1.4
diff -u -u -r1.4 custom.c
--- dlls/msi/custom.c	1 Feb 2005 18:46:26 -0000	1.4
+++ dlls/msi/custom.c	8 Feb 2005 11:26:23 -0000
@@ -232,17 +232,17 @@
                                 LPWSTR tmp_file)
 {
     DWORD sz=MAX_PATH;
+    static const WCHAR f1[] = {'m','s','i',0};
+    WCHAR fmt[MAX_PATH];
 
-    if (MSI_GetPropertyW(package, cszTempFolder, tmp_file, &sz) 
+    if (MSI_GetPropertyW(package, cszTempFolder, fmt, &sz) 
         != ERROR_SUCCESS)
-        GetTempPathW(MAX_PATH,tmp_file);
+        GetTempPathW(MAX_PATH,fmt);
 
-    strcatW(tmp_file,source);
-
-    if (GetFileAttributesW(tmp_file) != INVALID_FILE_ATTRIBUTES)
+    if (GetTempFileNameW(fmt,f1,0,tmp_file) == 0)
     {
-        TRACE("File already exists\n");
-        return ERROR_SUCCESS;
+        TRACE("Unable to create file\n");
+        return ERROR_FUNCTION_FAILED;
     }
     else
     {


More information about the wine-patches mailing list