msi: cache package file to allow multi disc installs

Aric Stewart aric at codeweavers.com
Wed Jun 15 07:54:09 CDT 2005


Copy the msi file to a temp file when opening to prevent locking install 
media for a multi disc install.
-------------- next part --------------
Index: dlls//msi/msi.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/msi.c,v
retrieving revision 1.88
diff -u -r1.88 msi.c
--- dlls//msi/msi.c	13 Jun 2005 19:04:39 -0000	1.88
+++ dlls//msi/msi.c	15 Jun 2005 12:50:08 -0000
@@ -202,6 +202,9 @@
     MSIPACKAGE *package = NULL;
     UINT r;
     MSIHANDLE handle;
+    WCHAR path[MAX_PATH];
+    WCHAR filename[MAX_PATH];
+    static const WCHAR szMSI[] = {'M','S','I',0};
 
     FIXME("%s %s\n",debugstr_w(szPackagePath), debugstr_w(szCommandLine));
 
@@ -209,9 +212,21 @@
     if (r != ERROR_SUCCESS)
         return r;
 
-    r = MSI_OpenPackageW(szPackagePath,&package);
+    /* copy the msi file to a temp file to pervent locking a CD
+     * with a multi disc install 
+     */
+    GetTempPathW(MAX_PATH, path);
+    GetTempFileNameW(path, szMSI, 0, filename);
+
+    CopyFileW(szPackagePath, filename, FALSE);
+
+    TRACE("Opening relocated package %s\n",debugstr_w(filename));
+    r = MSI_OpenPackageW(filename, &package);
     if (r != ERROR_SUCCESS)
+    {
+        DeleteFileW(filename);
         return r;
+    }
 
     handle = alloc_msihandle( &package->hdr );
 
@@ -219,6 +234,8 @@
 
     MsiCloseHandle(handle);
     msiobj_release( &package->hdr );
+
+    DeleteFileW(filename);
     return r;
 }
 
Index: dlls/msi/package.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/package.c,v
retrieving revision 1.43
diff -u -r1.43 package.c
--- dlls/msi/package.c	6 Jun 2005 15:40:15 -0000	1.43
+++ dlls/msi/package.c	15 Jun 2005 12:50:09 -0000
@@ -454,18 +454,32 @@
 {
     MSIPACKAGE *package = NULL;
     UINT ret;
+    WCHAR path[MAX_PATH];
+    WCHAR filename[MAX_PATH];
+    static const WCHAR szMSI[] = {'M','S','I',0};
 
     TRACE("%s %08lx %p\n",debugstr_w(szPackage), dwOptions, phPackage);
 
+    /* copy the msi file to a temp file to pervent locking a CD
+     * with a multi disc install 
+     */ 
+    GetTempPathW(MAX_PATH, path);
+    GetTempFileNameW(path, szMSI, 0, filename);
+
+    CopyFileW(szPackage, filename, FALSE);
+
+    TRACE("Opening relocated package %s\n",debugstr_w(filename));
+    
     if( dwOptions )
         FIXME("dwOptions %08lx not supported\n", dwOptions);
 
-    ret = MSI_OpenPackageW( szPackage, &package);
+    ret = MSI_OpenPackageW( filename, &package);
     if( ret == ERROR_SUCCESS )
     {
         *phPackage = alloc_msihandle( &package->hdr );
         msiobj_release( &package->hdr );
     }
+    DeleteFileW(filename);
     return ret;
 }
 


More information about the wine-patches mailing list