msi: first pass on CurVer key

Aric Stewart aric at codeweavers.com
Thu May 26 10:23:14 CDT 2005


First pass at writing out CurVer keys for ProgIds. Also print a message for the actions we skip. Lines up with native MSI output logs for ease of comparison.

-------------- next part --------------
Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.122
diff -u -r1.122 action.c
--- dlls/msi/action.c	26 May 2005 12:24:28 -0000	1.122
+++ dlls/msi/action.c	26 May 2005 15:22:20 -0000
@@ -1334,6 +1334,16 @@
                 break;
             }
 
+            sz=0x100;
+            rc =  MSI_RecordGetStringW(row,1,buffer,&sz);
+            if (rc != ERROR_SUCCESS)
+            {
+                ERR("Error is %x\n",rc);
+                msiobj_release(&row->hdr);
+                break;
+            }
+
+
             /* check conditions */
             if (!MSI_RecordIsNull(row,2))
             {
@@ -1348,6 +1358,8 @@
                     {
                         HeapFree(GetProcessHeap(),0,cond);
                         msiobj_release(&row->hdr);
+                        TRACE("Skipping action: %s (condition is false)\n",
+                                    debugstr_w(buffer));
                         continue; 
                     }
                     else
@@ -1355,15 +1367,6 @@
                 }
             }
 
-            sz=0x100;
-            rc =  MSI_RecordGetStringW(row,1,buffer,&sz);
-            if (rc != ERROR_SUCCESS)
-            {
-                ERR("Error is %x\n",rc);
-                msiobj_release(&row->hdr);
-                break;
-            }
-
             rc = ACTION_PerformUIAction(package,buffer);
 
             if (rc == ERROR_FUNCTION_NOT_CALLED)
@@ -4602,6 +4605,20 @@
         HeapFree(GetProcessHeap(),0,buffer);
     }
 
+    package->progids[index].CurVerIndex = -1;
+
+    /* if we have a parent then we may be that parents CurVer */
+    if (package->progids[index].ParentIndex >= 0)
+    {
+        int pindex = package->progids[index].ParentIndex;
+        while (package->progids[pindex].ParentIndex>= 0)
+            pindex = package->progids[pindex].ParentIndex;
+
+        FIXME("BAD BAD need to determing if we are really the CurVer\n");
+
+        package->progids[index].CurVerIndex = pindex;
+    }
+    
     return index;
 }
 
@@ -5655,6 +5672,8 @@
         static const WCHAR szCLSID[] = { 'C','L','S','I','D',0 };
         static const WCHAR szDefaultIcon[] =
             {'D','e','f','a','u','l','t','I','c','o','n',0};
+        static const WCHAR szCurVer[] =
+            {'C','u','r','V','e','r',0};
 
         /* check if already registered */
         RegCreateKeyExW(HKEY_CLASSES_ROOT, progid->ProgID, 0, NULL, 0,
@@ -5691,6 +5710,17 @@
             RegCreateKeyW(hkey,szDefaultIcon,&hkey2);
             RegSetValueExW(hkey2,NULL,0,REG_SZ,(LPVOID)progid->IconPath,
                            (strlenW(progid->IconPath)+1) * sizeof(WCHAR));
+            RegCloseKey(hkey2);
+        }
+
+        /* write out the current version */
+        if (progid->CurVerIndex >= 0)
+        {
+            RegCreateKeyW(hkey,szCurVer,&hkey2);
+            RegSetValueExW(hkey2,NULL,0,REG_SZ,
+                (LPVOID)package->progids[progid->CurVerIndex].ProgID,
+                (strlenW(package->progids[progid->CurVerIndex].ProgID)+1) * 
+                sizeof(WCHAR));
             RegCloseKey(hkey2);
         }
 
Index: dlls/msi/action.h
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.h,v
retrieving revision 1.8
diff -u -r1.8 action.h
--- dlls/msi/action.h	26 May 2005 12:24:28 -0000	1.8
+++ dlls/msi/action.h	26 May 2005 15:22:20 -0000
@@ -146,6 +146,7 @@
     LPWSTR IconPath;
     /* not in the table, set during instalation */
     BOOL InstallMe;
+    INT CurVerIndex;
 } MSIPROGID;
 
 typedef struct tagMSIVERB


More information about the wine-patches mailing list