James Hawkins : msi: Search existing published sources if the media cannot be found.

Alexandre Julliard julliard at winehq.org
Tue Feb 26 05:45:16 CST 2008


Module: wine
Branch: master
Commit: bdbb7a0348c558c4ecd93f089aacf3b335d8f9d5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bdbb7a0348c558c4ecd93f089aacf3b335d8f9d5

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Tue Feb 26 01:55:56 2008 -0600

msi: Search existing published sources if the media cannot be found.

---

 dlls/msi/files.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/dlls/msi/files.c b/dlls/msi/files.c
index 2b8ae6f..33a3a5a 100644
--- a/dlls/msi/files.c
+++ b/dlls/msi/files.c
@@ -589,6 +589,49 @@ static UINT load_media_info(MSIPACKAGE *package, MSIFILE *file, struct media_inf
     return ERROR_SUCCESS;
 }
 
+/* FIXME: search NETWORK and URL sources as well */
+static UINT find_published_source(MSIPACKAGE *package, struct media_info *mi)
+{
+    WCHAR source[MAX_PATH];
+    WCHAR volume[MAX_PATH];
+    WCHAR prompt[MAX_PATH];
+    DWORD volumesz, promptsz;
+    DWORD index, size;
+    WORD id;
+    UINT r;
+
+    r = MsiSourceListGetInfoW(package->ProductCode, NULL,
+                              MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
+                              INSTALLPROPERTY_LASTUSEDSOURCEW, source, &size);
+    if (r != ERROR_SUCCESS)
+        return r;
+
+    index = 0;
+    volumesz = MAX_PATH;
+    promptsz = MAX_PATH;
+    while (MsiSourceListEnumMediaDisksW(package->ProductCode, NULL,
+                                        MSIINSTALLCONTEXT_USERUNMANAGED,
+                                        MSICODE_PRODUCT, index++, &id,
+                                        volume, &volumesz, prompt, &promptsz) == ERROR_SUCCESS)
+    {
+        mi->disk_id = id;
+        mi->volume_label = msi_realloc(mi->volume_label, ++volumesz * sizeof(WCHAR));
+        lstrcpyW(mi->volume_label, volume);
+        mi->disk_prompt = msi_realloc(mi->disk_prompt, ++promptsz * sizeof(WCHAR));
+        lstrcpyW(mi->disk_prompt, prompt);
+
+        if (source_matches_volume(mi, source))
+        {
+            /* FIXME: what about SourceDir */
+            lstrcpyW(mi->source, source);
+            lstrcatW(mi->source, mi->cabinet);
+            return ERROR_SUCCESS;
+        }
+    }
+
+    return ERROR_FUNCTION_FAILED;
+}
+
 static UINT ready_media(MSIPACKAGE *package, MSIFILE *file, struct media_info *mi)
 {
     UINT rc = ERROR_SUCCESS;
@@ -641,8 +684,13 @@ static UINT ready_media(MSIPACKAGE *package, MSIFILE *file, struct media_info *m
     if (file->IsCompressed &&
         GetFileAttributesW(mi->source) == INVALID_FILE_ATTRIBUTES)
     {
-        ERR("Cabinet not found: %s\n", debugstr_w(mi->source));
-        return ERROR_INSTALL_FAILURE;
+        /* FIXME: this might be done earlier in the install process */
+        rc = find_published_source(package, mi);
+        if (rc != ERROR_SUCCESS)
+        {
+            ERR("Cabinet not found: %s\n", debugstr_w(mi->source));
+            return ERROR_INSTALL_FAILURE;
+        }
     }
 
     return ERROR_SUCCESS;




More information about the wine-cvs mailing list