msi: SelfRegModules fix and feature registration fix

Aric Stewart aric at codeweavers.com
Wed May 18 11:23:40 CDT 2005


we cannot internally load the files in FileCost because that action may be skipped or not called. So do it in CostInitialize.
	
Quote the file path in SelfRegModules
	
Do not write squished null guids to the feature registration.

-------------- next part --------------
Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.116
diff -u -r1.116 action.c
--- dlls/msi/action.c	18 May 2005 13:23:52 -0000	1.116
+++ dlls/msi/action.c	18 May 2005 16:21:41 -0000
@@ -1763,67 +1763,6 @@
     msiobj_release(&view->hdr);
 }
 
-/*
- * I am not doing any of the costing functionality yet. 
- * Mostly looking at doing the Component and Feature loading
- *
- * The native MSI does A LOT of modification to tables here. Mostly adding
- * a lot of temporary columns to the Feature and Component tables. 
- *
- *    note: Native msi also tracks the short filename. But I am only going to
- *          track the long ones.  Also looking at this directory table
- *          it appears that the directory table does not get the parents
- *          resolved base on property only based on their entries in the 
- *          directory table.
- */
-static UINT ACTION_CostInitialize(MSIPACKAGE *package)
-{
-    MSIQUERY * view;
-    MSIRECORD * row;
-    UINT rc;
-    static const WCHAR Query_all[] =
-        {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
-         'F','e','a','t','u','r','e',0};
-    static const WCHAR szCosting[] =
-        {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 };
-    static const WCHAR szZero[] = { '0', 0 };
-    WCHAR buffer[3];
-    DWORD sz = 3;
-
-    MSI_GetPropertyW(package, szCosting, buffer, &sz);
-    if (buffer[0]=='1')
-        return ERROR_SUCCESS;
-    
-    MSI_SetPropertyW(package, szCosting, szZero);
-    MSI_SetPropertyW(package, cszRootDrive , c_colon);
-
-    rc = MSI_DatabaseOpenViewW(package->db,Query_all,&view);
-    if (rc != ERROR_SUCCESS)
-        return rc;
-    rc = MSI_ViewExecute(view,0);
-    if (rc != ERROR_SUCCESS)
-    {
-        MSI_ViewClose(view);
-        msiobj_release(&view->hdr);
-        return rc;
-    }
-    while (1)
-    {
-        DWORD rc;
-
-        rc = MSI_ViewFetch(view,&row);
-        if (rc != ERROR_SUCCESS)
-            break;
-       
-        load_feature(package,row); 
-        msiobj_release(&row->hdr);
-    }
-    MSI_ViewClose(view);
-    msiobj_release(&view->hdr);
-
-    return ERROR_SUCCESS;
-}
-
 static UINT load_file(MSIPACKAGE* package, MSIRECORD * row)
 {
     DWORD index = package->loaded_files;
@@ -1875,7 +1814,7 @@
     return ERROR_SUCCESS;
 }
 
-static UINT ACTION_FileCost(MSIPACKAGE *package)
+static UINT load_all_files(MSIPACKAGE *package)
 {
     MSIQUERY * view;
     MSIRECORD * row;
@@ -1917,6 +1856,76 @@
     return ERROR_SUCCESS;
 }
 
+
+/*
+ * I am not doing any of the costing functionality yet. 
+ * Mostly looking at doing the Component and Feature loading
+ *
+ * The native MSI does A LOT of modification to tables here. Mostly adding
+ * a lot of temporary columns to the Feature and Component tables. 
+ *
+ *    note: Native msi also tracks the short filename. But I am only going to
+ *          track the long ones.  Also looking at this directory table
+ *          it appears that the directory table does not get the parents
+ *          resolved base on property only based on their entries in the 
+ *          directory table.
+ */
+static UINT ACTION_CostInitialize(MSIPACKAGE *package)
+{
+    MSIQUERY * view;
+    MSIRECORD * row;
+    UINT rc;
+    static const WCHAR Query_all[] =
+        {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
+         'F','e','a','t','u','r','e',0};
+    static const WCHAR szCosting[] =
+        {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 };
+    static const WCHAR szZero[] = { '0', 0 };
+    WCHAR buffer[3];
+    DWORD sz = 3;
+
+    MSI_GetPropertyW(package, szCosting, buffer, &sz);
+    if (buffer[0]=='1')
+        return ERROR_SUCCESS;
+    
+    MSI_SetPropertyW(package, szCosting, szZero);
+    MSI_SetPropertyW(package, cszRootDrive , c_colon);
+
+    rc = MSI_DatabaseOpenViewW(package->db,Query_all,&view);
+    if (rc != ERROR_SUCCESS)
+        return rc;
+    rc = MSI_ViewExecute(view,0);
+    if (rc != ERROR_SUCCESS)
+    {
+        MSI_ViewClose(view);
+        msiobj_release(&view->hdr);
+        return rc;
+    }
+    while (1)
+    {
+        DWORD rc;
+
+        rc = MSI_ViewFetch(view,&row);
+        if (rc != ERROR_SUCCESS)
+            break;
+       
+        load_feature(package,row); 
+        msiobj_release(&row->hdr);
+    }
+    MSI_ViewClose(view);
+    msiobj_release(&view->hdr);
+
+    load_all_files(package);
+
+    return ERROR_SUCCESS;
+}
+
+static UINT ACTION_FileCost(MSIPACKAGE *package)
+{
+    return ERROR_SUCCESS;
+}
+
+
 static INT load_folder(MSIPACKAGE *package, const WCHAR* dir)
 {
     static const WCHAR Query[] =
@@ -4080,8 +4089,9 @@
             /* do the refcounting */
             ACTION_RefCountComponent( package, i);
 
-            TRACE("Component %s, Keypath=%s, RefCount=%i\n", 
-                            debugstr_w(package->components[i].Component), 
+            TRACE("Component %s (%s), Keypath=%s, RefCount=%i\n", 
+                            debugstr_w(package->components[i].Component),
+                            debugstr_w(squished_cc),
                             debugstr_w(package->components[i].FullKeypath), 
                             package->components[i].RefCount);
             /*
@@ -5498,7 +5508,8 @@
          'S','e','l','f','R','e','g',0};
 
     static const WCHAR ExeStr[] =
-        {'r','e','g','s','v','r','3','2','.','e','x','e',' ','/','s',' ',0};
+        {'r','e','g','s','v','r','3','2','.','e','x','e',' ','\"',0};
+    static const WCHAR close[] =  {'\"',0};
     STARTUPINFOW si;
     PROCESS_INFORMATION info;
     BOOL brc;
@@ -5552,6 +5563,7 @@
         filename = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
         strcpyW(filename,ExeStr);
         strcatW(filename,package->files[index].TargetPath);
+        strcatW(filename,close);
 
         TRACE("Registering %s\n",debugstr_w(filename));
         brc = CreateProcessW(NULL, filename, NULL, NULL, FALSE, 0, NULL,
@@ -5617,14 +5629,18 @@
         {
             WCHAR buf[21];
             memset(buf,0,sizeof(buf));
-            TRACE("From %s\n",debugstr_w(package->components
+            if (package->components
+                [package->features[i].Components[j]].ComponentId[0]!=0)
+            {
+                TRACE("From %s\n",debugstr_w(package->components
                             [package->features[i].Components[j]].ComponentId));
-            CLSIDFromString(package->components
+                CLSIDFromString(package->components
                             [package->features[i].Components[j]].ComponentId,
                             &clsid);
-            encode_base85_guid(&clsid,buf);
-            TRACE("to %s\n",debugstr_w(buf));
-            strcatW(data,buf);
+                encode_base85_guid(&clsid,buf);
+                TRACE("to %s\n",debugstr_w(buf));
+                strcatW(data,buf);
+            }
         }
         if (package->features[i].Feature_Parent[0])
         {


More information about the wine-patches mailing list