MSI: Upgrade Codes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

MSI: Upgrade Codes

Aric Stewart
Write out UpgradeCodes to the Registry to allow for future upgrades


Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.137
diff -u -r1.137 action.c
--- dlls/msi/action.c 7 Jun 2005 21:34:05 -0000 1.137
+++ dlls/msi/action.c 8 Jun 2005 16:33:57 -0000
@@ -6458,6 +6458,9 @@
     '%','x','.','m','s','i',0};
     static const WCHAR szLocalPackage[]=
          {'L','o','c','a','l','P','a','c','k','a','g','e',0};
+    static const WCHAR szUpgradeCode[] =
+        {'U','p','g','r','a','d','e','C','o','d','e',0};
+    LPWSTR upgrade_code;
     WCHAR windir[MAX_PATH], path[MAX_PATH], packagefile[MAX_PATH];
     INT num,start;
 
@@ -6523,6 +6526,24 @@
             GetLastError());
     size = strlenW(packagefile)*sizeof(WCHAR);
     RegSetValueExW(hkey,szLocalPackage,0,REG_SZ,(LPSTR)packagefile,size);
+
+    /* Handle Upgrade Codes */
+    upgrade_code = load_dynamic_property(package,szUpgradeCode, NULL);
+    if (upgrade_code)
+    {
+        HKEY hkey2;
+        WCHAR squashed[33];
+        MSIREG_OpenUpgradeCodesKey(upgrade_code, &hkey2, TRUE);
+        squash_guid(productcode,squashed);
+        RegSetValueExW(hkey2, squashed, 0,REG_SZ,NULL,0);
+        RegCloseKey(hkey2);
+        MSIREG_OpenUserUpgradeCodesKey(upgrade_code, &hkey2, TRUE);
+        squash_guid(productcode,squashed);
+        RegSetValueExW(hkey2, squashed, 0,REG_SZ,NULL,0);
+        RegCloseKey(hkey2);
+
+        HeapFree(GetProcessHeap(),0,upgrade_code);
+    }
     
 end:
     HeapFree(GetProcessHeap(),0,productcode);