[MSI] Sync with Wine Staging 1.9.23. CORE-12409
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 22 Nov 2016 12:25:27 +0000 (12:25 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 22 Nov 2016 12:25:27 +0000 (12:25 +0000)
svn path=/trunk/; revision=73339

12 files changed:
reactos/dll/win32/msi/action.c
reactos/dll/win32/msi/automation.c
reactos/dll/win32/msi/database.c
reactos/dll/win32/msi/msi.c
reactos/dll/win32/msi/msipriv.h
reactos/dll/win32/msi/package.c
reactos/dll/win32/msi/record.c
reactos/dll/win32/msi/registry.c
reactos/dll/win32/msi/source.c
reactos/dll/win32/msi/table.c
reactos/dll/win32/msi/upgrade.c
reactos/media/doc/README.WINE

index 1eb1758..5459051 100644 (file)
@@ -129,6 +129,8 @@ static const WCHAR szUnpublishComponents[] =
     {'U','n','p','u','b','l','i','s','h', 'C','o','m','p','o','n','e','n','t','s',0};
 static const WCHAR szUnpublishFeatures[] =
     {'U','n','p','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0};
     {'U','n','p','u','b','l','i','s','h', 'C','o','m','p','o','n','e','n','t','s',0};
 static const WCHAR szUnpublishFeatures[] =
     {'U','n','p','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0};
+static const WCHAR szUnpublishProduct[] =
+    {'U','n','p','u','b','l','i','s','h','P','r','o','d','u','c','t',0};
 static const WCHAR szUnregisterComPlus[] =
     {'U','n','r','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0};
 static const WCHAR szUnregisterTypeLibraries[] =
 static const WCHAR szUnregisterComPlus[] =
     {'U','n','r','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0};
 static const WCHAR szUnregisterTypeLibraries[] =
@@ -3490,14 +3492,14 @@ static WCHAR *build_full_keypath( MSIPACKAGE *package, MSICOMPONENT *comp )
 
 static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
 {
 
 static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
 {
-    WCHAR squished_pc[GUID_SIZE], squished_cc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE], squashed_cc[SQUASHED_GUID_SIZE];
     UINT rc;
     MSICOMPONENT *comp;
     HKEY hkey;
 
     TRACE("\n");
 
     UINT rc;
     MSICOMPONENT *comp;
     HKEY hkey;
 
     TRACE("\n");
 
-    squash_guid(package->ProductCode,squished_pc);
+    squash_guid( package->ProductCode, squashed_pc );
     msi_set_sourcedir_props(package, FALSE);
 
     LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
     msi_set_sourcedir_props(package, FALSE);
 
     LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
@@ -3509,7 +3511,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
         if (!comp->ComponentId)
             continue;
 
         if (!comp->ComponentId)
             continue;
 
-        squash_guid( comp->ComponentId, squished_cc );
+        squash_guid( comp->ComponentId, squashed_cc );
         msi_free( comp->FullKeypath );
         comp->FullKeypath = build_full_keypath( package, comp );
 
         msi_free( comp->FullKeypath );
         comp->FullKeypath = build_full_keypath( package, comp );
 
@@ -3519,7 +3521,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
         else action = comp->ActionRequest;
 
         TRACE("Component %s (%s) Keypath=%s RefCount=%u Clients=%u Action=%u\n",
         else action = comp->ActionRequest;
 
         TRACE("Component %s (%s) Keypath=%s RefCount=%u Clients=%u Action=%u\n",
-                            debugstr_w(comp->Component), debugstr_w(squished_cc),
+                            debugstr_w(comp->Component), debugstr_w(squashed_cc),
                             debugstr_w(comp->FullKeypath), comp->RefCount, comp->num_clients, action);
 
         if (action == INSTALLSTATE_LOCAL || action == INSTALLSTATE_SOURCE)
                             debugstr_w(comp->FullKeypath), comp->RefCount, comp->num_clients, action);
 
         if (action == INSTALLSTATE_LOCAL || action == INSTALLSTATE_SOURCE)
@@ -3542,7 +3544,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
                 msi_reg_set_val_str(hkey, szPermKey, comp->FullKeypath);
             }
             if (action == INSTALLSTATE_LOCAL)
                 msi_reg_set_val_str(hkey, szPermKey, comp->FullKeypath);
             }
             if (action == INSTALLSTATE_LOCAL)
-                msi_reg_set_val_str(hkey, squished_pc, comp->FullKeypath);
+                msi_reg_set_val_str( hkey, squashed_pc, comp->FullKeypath );
             else
             {
                 MSIFILE *file;
             else
             {
                 MSIFILE *file;
@@ -3579,7 +3581,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
                 lstrcpyW(ptr2, ptr);
                 msi_free(sourcepath);
 
                 lstrcpyW(ptr2, ptr);
                 msi_free(sourcepath);
 
-                msi_reg_set_val_str(hkey, squished_pc, source);
+                msi_reg_set_val_str( hkey, squashed_pc, source );
             }
             RegCloseKey(hkey);
         }
             }
             RegCloseKey(hkey);
         }
@@ -3608,7 +3610,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
                     WARN( "failed to open component key %u\n", rc );
                     continue;
                 }
                     WARN( "failed to open component key %u\n", rc );
                     continue;
                 }
-                res = RegDeleteValueW( hkey, squished_pc );
+                res = RegDeleteValueW( hkey, squashed_pc );
                 RegCloseKey(hkey);
                 if (res) WARN( "failed to delete component value %d\n", res );
             }
                 RegCloseKey(hkey);
                 if (res) WARN( "failed to delete component value %d\n", res );
             }
@@ -4206,15 +4208,6 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey)
 
 static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey)
 {
 
 static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey)
 {
-    MSIHANDLE hdb, suminfo;
-    WCHAR guids[MAX_PATH];
-    WCHAR packcode[SQUISH_GUID_SIZE];
-    LPWSTR buffer;
-    LPWSTR ptr;
-    DWORD langid;
-    DWORD size;
-    UINT r;
-
     static const WCHAR szARPProductIcon[] =
         {'A','R','P','P','R','O','D','U','C','T','I','C','O','N',0};
     static const WCHAR szAssignment[] =
     static const WCHAR szARPProductIcon[] =
         {'A','R','P','P','R','O','D','U','C','T','I','C','O','N',0};
     static const WCHAR szAssignment[] =
@@ -4224,6 +4217,10 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey)
     static const WCHAR szClients[] =
         {'C','l','i','e','n','t','s',0};
     static const WCHAR szColon[] = {':',0};
     static const WCHAR szClients[] =
         {'C','l','i','e','n','t','s',0};
     static const WCHAR szColon[] = {':',0};
+    MSIHANDLE hdb, suminfo;
+    WCHAR *buffer, *ptr, guids[MAX_PATH], packcode[SQUASHED_GUID_SIZE];
+    DWORD langid, size;
+    UINT r;
 
     buffer = msi_dup_property(package->db, INSTALLPROPERTY_PRODUCTNAMEW);
     msi_reg_set_val_str(hkey, INSTALLPROPERTY_PRODUCTNAMEW, buffer);
 
     buffer = msi_dup_property(package->db, INSTALLPROPERTY_PRODUCTNAMEW);
     msi_reg_set_val_str(hkey, INSTALLPROPERTY_PRODUCTNAMEW, buffer);
@@ -4286,8 +4283,7 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package)
 {
     UINT r;
     HKEY hkey;
 {
     UINT r;
     HKEY hkey;
-    LPWSTR upgrade;
-    WCHAR squashed_pc[SQUISH_GUID_SIZE];
+    WCHAR *upgrade, squashed_pc[SQUASHED_GUID_SIZE];
 
     upgrade = msi_dup_property(package->db, szUpgradeCode);
     if (!upgrade)
 
     upgrade = msi_dup_property(package->db, szUpgradeCode);
     if (!upgrade)
@@ -5186,9 +5182,8 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey)
 
 static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
 {
 
 static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
 {
-    WCHAR squashed_pc[SQUISH_GUID_SIZE];
+    WCHAR *upgrade_code, squashed_pc[SQUASHED_GUID_SIZE];
     MSIRECORD *uirow;
     MSIRECORD *uirow;
-    LPWSTR upgrade_code;
     HKEY hkey, props, upgrade_key;
     UINT rc;
 
     HKEY hkey, props, upgrade_key;
     UINT rc;
 
@@ -5281,31 +5276,50 @@ static UINT msi_unpublish_icons( MSIPACKAGE *package )
     return ERROR_SUCCESS;
 }
 
     return ERROR_SUCCESS;
 }
 
-static UINT msi_unpublish_product( MSIPACKAGE *package, const WCHAR *remove )
+static void remove_product_upgrade_code( MSIPACKAGE *package )
 {
 {
-    static const WCHAR szUpgradeCode[] = {'U','p','g','r','a','d','e','C','o','d','e',0};
-    WCHAR *upgrade, **features;
-    BOOL full_uninstall = TRUE;
-    MSIFEATURE *feature;
-    MSIPATCHINFO *patch;
-    UINT i;
+    WCHAR *code, product[SQUASHED_GUID_SIZE];
+    HKEY hkey;
+    LONG res;
+    DWORD count;
 
 
-    LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
+    squash_guid( package->ProductCode, product );
+    if (!(code = msi_dup_property( package->db, szUpgradeCode )))
     {
     {
-        if (feature->Action == INSTALLSTATE_LOCAL) full_uninstall = FALSE;
+        WARN( "upgrade code not found\n" );
+        return;
     }
     }
-    features = msi_split_string( remove, ',' );
-    for (i = 0; features && features[i]; i++)
+    if (!MSIREG_OpenUpgradeCodesKey( code, &hkey, FALSE ))
     {
     {
-        if (!strcmpW( features[i], szAll )) full_uninstall = TRUE;
+        RegDeleteValueW( hkey, product );
+        res = RegQueryInfoKeyW( hkey, NULL, NULL, NULL, NULL, NULL, &count, NULL, NULL, NULL, NULL, NULL );
+        RegCloseKey( hkey );
+        if (!res && !count) MSIREG_DeleteUpgradeCodesKey( code );
+    }
+    if (!MSIREG_OpenUserUpgradeCodesKey( code, &hkey, FALSE ))
+    {
+        RegDeleteValueW( hkey, product );
+        res = RegQueryInfoKeyW( hkey, NULL, NULL, NULL, NULL, NULL, &count, NULL, NULL, NULL, NULL, NULL );
+        RegCloseKey( hkey );
+        if (!res && !count) MSIREG_DeleteUserUpgradeCodesKey( code );
+    }
+    if (!MSIREG_OpenClassesUpgradeCodesKey( code, &hkey, FALSE ))
+    {
+        RegDeleteValueW( hkey, product );
+        res = RegQueryInfoKeyW( hkey, NULL, NULL, NULL, NULL, NULL, &count, NULL, NULL, NULL, NULL, NULL );
+        RegCloseKey( hkey );
+        if (!res && !count) MSIREG_DeleteClassesUpgradeCodesKey( code );
     }
     }
-    msi_free(features);
 
 
-    if (!full_uninstall)
-        return ERROR_SUCCESS;
+    msi_free( code );
+}
+
+static UINT ACTION_UnpublishProduct(MSIPACKAGE *package)
+{
+    MSIPATCHINFO *patch;
 
     MSIREG_DeleteProductKey(package->ProductCode);
 
     MSIREG_DeleteProductKey(package->ProductCode);
-    MSIREG_DeleteUserDataProductKey(package->ProductCode);
+    MSIREG_DeleteUserDataProductKey(package->ProductCode, package->Context);
     MSIREG_DeleteUninstallKey(package->ProductCode, package->platform);
 
     MSIREG_DeleteLocalClassesProductKey(package->ProductCode);
     MSIREG_DeleteUninstallKey(package->ProductCode, package->platform);
 
     MSIREG_DeleteLocalClassesProductKey(package->ProductCode);
@@ -5313,13 +5327,7 @@ static UINT msi_unpublish_product( MSIPACKAGE *package, const WCHAR *remove )
     MSIREG_DeleteUserProductKey(package->ProductCode);
     MSIREG_DeleteUserFeaturesKey(package->ProductCode);
 
     MSIREG_DeleteUserProductKey(package->ProductCode);
     MSIREG_DeleteUserFeaturesKey(package->ProductCode);
 
-    upgrade = msi_dup_property(package->db, szUpgradeCode);
-    if (upgrade)
-    {
-        MSIREG_DeleteUserUpgradeCodesKey(upgrade);
-        MSIREG_DeleteClassesUpgradeCodesKey(upgrade);
-        msi_free(upgrade);
-    }
+    remove_product_upgrade_code( package );
 
     LIST_FOR_EACH_ENTRY(patch, &package->patches, MSIPATCHINFO, entry)
     {
 
     LIST_FOR_EACH_ENTRY(patch, &package->patches, MSIPATCHINFO, entry)
     {
@@ -5338,10 +5346,32 @@ static UINT msi_unpublish_product( MSIPACKAGE *package, const WCHAR *remove )
     return ERROR_SUCCESS;
 }
 
     return ERROR_SUCCESS;
 }
 
+static BOOL is_full_uninstall( MSIPACKAGE *package )
+{
+    WCHAR **features, *remove = msi_dup_property( package->db, szRemove );
+    MSIFEATURE *feature;
+    BOOL ret = TRUE;
+    UINT i;
+
+    LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
+    {
+        if (feature->Action == INSTALLSTATE_LOCAL) ret = FALSE;
+    }
+
+    features = msi_split_string( remove, ',' );
+    for (i = 0; features && features[i]; i++)
+    {
+        if (!strcmpW( features[i], szAll )) ret = TRUE;
+    }
+
+    msi_free(features);
+    msi_free(remove);
+    return ret;
+}
+
 static UINT ACTION_InstallFinalize(MSIPACKAGE *package)
 {
     UINT rc;
 static UINT ACTION_InstallFinalize(MSIPACKAGE *package)
 {
     UINT rc;
-    WCHAR *remove;
 
     /* first do the same as an InstallExecute */
     rc = execute_script(package, SCRIPT_INSTALL);
 
     /* first do the same as an InstallExecute */
     rc = execute_script(package, SCRIPT_INSTALL);
@@ -5353,9 +5383,9 @@ static UINT ACTION_InstallFinalize(MSIPACKAGE *package)
     if (rc != ERROR_SUCCESS)
         return rc;
 
     if (rc != ERROR_SUCCESS)
         return rc;
 
-    remove = msi_dup_property(package->db, szRemove);
-    rc = msi_unpublish_product(package, remove);
-    msi_free(remove);
+    if (is_full_uninstall(package))
+        rc = ACTION_UnpublishProduct(package);
+
     return rc;
 }
 
     return rc;
 }
 
@@ -5383,26 +5413,24 @@ UINT ACTION_ForceReboot(MSIPACKAGE *package)
     '/','I',' ','\"','%','s','\"',' ',
     'A','F','T','E','R','R','E','B','O','O','T','=','1',' ',
     'R','U','N','O','N','C','E','E','N','T','R','Y','=','\"','%','s','\"',0};
     '/','I',' ','\"','%','s','\"',' ',
     'A','F','T','E','R','R','E','B','O','O','T','=','1',' ',
     'R','U','N','O','N','C','E','E','N','T','R','Y','=','\"','%','s','\"',0};
-    WCHAR buffer[256], sysdir[MAX_PATH];
+    WCHAR buffer[256], sysdir[MAX_PATH], squashed_pc[SQUASHED_GUID_SIZE];
     HKEY hkey;
     HKEY hkey;
-    WCHAR squished_pc[100];
 
 
-    squash_guid(package->ProductCode,squished_pc);
+    squash_guid( package->ProductCode, squashed_pc );
 
     GetSystemDirectoryW(sysdir, sizeof(sysdir)/sizeof(sysdir[0]));
     RegCreateKeyW(HKEY_LOCAL_MACHINE,RunOnce,&hkey);
 
     GetSystemDirectoryW(sysdir, sizeof(sysdir)/sizeof(sysdir[0]));
     RegCreateKeyW(HKEY_LOCAL_MACHINE,RunOnce,&hkey);
-    snprintfW(buffer,sizeof(buffer)/sizeof(buffer[0]),msiexec_fmt,sysdir,
-     squished_pc);
+    snprintfW( buffer, sizeof(buffer)/sizeof(buffer[0]), msiexec_fmt, sysdir, squashed_pc );
 
 
-    msi_reg_set_val_str( hkey, squished_pc, buffer );
+    msi_reg_set_val_str( hkey, squashed_pc, buffer );
     RegCloseKey(hkey);
 
     TRACE("Reboot command %s\n",debugstr_w(buffer));
 
     RegCreateKeyW(HKEY_LOCAL_MACHINE,InstallRunOnce,&hkey);
     RegCloseKey(hkey);
 
     TRACE("Reboot command %s\n",debugstr_w(buffer));
 
     RegCreateKeyW(HKEY_LOCAL_MACHINE,InstallRunOnce,&hkey);
-    sprintfW(buffer,install_fmt,package->ProductCode,squished_pc);
+    sprintfW( buffer, install_fmt, package->ProductCode, squashed_pc );
 
 
-    msi_reg_set_val_str( hkey, squished_pc, buffer );
+    msi_reg_set_val_str( hkey, squashed_pc, buffer );
     RegCloseKey(hkey);
 
     return ERROR_INSTALL_SUSPEND;
     RegCloseKey(hkey);
 
     return ERROR_INSTALL_SUSPEND;
@@ -5524,7 +5552,7 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package)
 
     if (msi_check_unpublish(package))
     {
 
     if (msi_check_unpublish(package))
     {
-        MSIREG_DeleteUserDataProductKey(package->ProductCode);
+        MSIREG_DeleteUserDataProductKey(package->ProductCode, package->Context);
         goto end;
     }
 
         goto end;
     }
 
@@ -7391,7 +7419,8 @@ static UINT ACTION_SetODBCFolders( MSIPACKAGE *package )
 static UINT ITERATE_RemoveExistingProducts( MSIRECORD *rec, LPVOID param )
 {
     static const WCHAR fmtW[] =
 static UINT ITERATE_RemoveExistingProducts( MSIRECORD *rec, LPVOID param )
 {
     static const WCHAR fmtW[] =
-        {'m','s','i','e','x','e','c',' ','/','i',' ','%','s',' ','R','E','M','O','V','E','=','%','s',0};
+        {'m','s','i','e','x','e','c',' ','/','q','n',' ','/','i',' ','%','s',' ',
+         'R','E','M','O','V','E','=','%','s',0};
     MSIPACKAGE *package = param;
     const WCHAR *property = MSI_RecordGetString( rec, 7 );
     int attrs = MSI_RecordGetInteger( rec, 5 );
     MSIPACKAGE *package = param;
     const WCHAR *property = MSI_RecordGetString( rec, 7 );
     int attrs = MSI_RecordGetInteger( rec, 5 );
@@ -7672,7 +7701,7 @@ StandardActions[] =
     { szProcessComponents, ACTION_ProcessComponents, szProcessComponents },
     { szPublishComponents, ACTION_PublishComponents, szUnpublishComponents },
     { szPublishFeatures, ACTION_PublishFeatures, szUnpublishFeatures },
     { szProcessComponents, ACTION_ProcessComponents, szProcessComponents },
     { szPublishComponents, ACTION_PublishComponents, szUnpublishComponents },
     { szPublishFeatures, ACTION_PublishFeatures, szUnpublishFeatures },
-    { szPublishProduct, ACTION_PublishProduct, NULL },
+    { szPublishProduct, ACTION_PublishProduct, szUnpublishProduct },
     { szRegisterClassInfo, ACTION_RegisterClassInfo, szUnregisterClassInfo },
     { szRegisterComPlus, ACTION_RegisterComPlus, szUnregisterComPlus },
     { szRegisterExtensionInfo, ACTION_RegisterExtensionInfo, szUnregisterExtensionInfo },
     { szRegisterClassInfo, ACTION_RegisterClassInfo, szUnregisterClassInfo },
     { szRegisterComPlus, ACTION_RegisterComPlus, szUnregisterComPlus },
     { szRegisterExtensionInfo, ACTION_RegisterExtensionInfo, szUnregisterExtensionInfo },
@@ -7701,6 +7730,7 @@ StandardActions[] =
     { szStopServices, ACTION_StopServices, szStartServices },
     { szUnpublishComponents, ACTION_UnpublishComponents, szPublishComponents },
     { szUnpublishFeatures, ACTION_UnpublishFeatures, szPublishFeatures },
     { szStopServices, ACTION_StopServices, szStartServices },
     { szUnpublishComponents, ACTION_UnpublishComponents, szPublishComponents },
     { szUnpublishFeatures, ACTION_UnpublishFeatures, szPublishFeatures },
+    { szUnpublishProduct, ACTION_UnpublishProduct, NULL }, /* for rollback only */
     { szUnregisterClassInfo, ACTION_UnregisterClassInfo, szRegisterClassInfo },
     { szUnregisterComPlus, ACTION_UnregisterComPlus, szRegisterComPlus },
     { szUnregisterExtensionInfo, ACTION_UnregisterExtensionInfo, szRegisterExtensionInfo },
     { szUnregisterClassInfo, ACTION_UnregisterClassInfo, szRegisterClassInfo },
     { szUnregisterComPlus, ACTION_UnregisterComPlus, szRegisterComPlus },
     { szUnregisterExtensionInfo, ACTION_UnregisterExtensionInfo, szRegisterExtensionInfo },
index c46e178..cef4059 100644 (file)
@@ -273,7 +273,8 @@ static HRESULT WINAPI AutomationObject_GetIDsOfNames(
     ITypeInfo *ti;
     HRESULT hr;
 
     ITypeInfo *ti;
     HRESULT hr;
 
-    TRACE("(%p/%p)->(%p,%p,%d,%d,%p)\n", iface, This, riid, rgszNames, cNames, lcid, rgDispId);
+    TRACE("(%p/%p)->(%s, %p, %d, %d, %p)\n", iface, This,
+            debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
 
     if (!IsEqualGUID(riid, &IID_NULL)) return E_INVALIDARG;
 
 
     if (!IsEqualGUID(riid, &IID_NULL)) return E_INVALIDARG;
 
@@ -316,7 +317,9 @@ static HRESULT WINAPI AutomationObject_Invoke(
     BSTR bstrName = NULL;
     ITypeInfo *ti;
 
     BSTR bstrName = NULL;
     ITypeInfo *ti;
 
-    TRACE("(%p/%p)->(%d,%p,%d,%d,%p,%p,%p,%p)\n", iface, This, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+    TRACE("(%p/%p)->(%d, %s, %d, %d, %p, %p, %p, %p)\n", iface, This,
+            dispIdMember, debugstr_guid(riid), lcid, wFlags,
+            pDispParams, pVarResult, pExcepInfo, puArgErr);
 
     if (!IsEqualIID(riid, &IID_NULL))
     {
 
     if (!IsEqualIID(riid, &IID_NULL))
     {
@@ -1012,7 +1015,7 @@ static HRESULT list_invoke(
         EXCEPINFO* pExcepInfo,
         UINT* puArgErr)
 {
         EXCEPINFO* pExcepInfo,
         UINT* puArgErr)
 {
-    ListObject *list = (ListObject*)This;
+    ListObject *list = CONTAINING_RECORD(This, ListObject, autoobj);
     IUnknown *pUnk = NULL;
     HRESULT hr;
 
     IUnknown *pUnk = NULL;
     HRESULT hr;
 
@@ -1060,7 +1063,7 @@ static HRESULT list_invoke(
 
 static void list_free(AutomationObject *This)
 {
 
 static void list_free(AutomationObject *This)
 {
-    ListObject *list = (ListObject*)This;
+    ListObject *list = CONTAINING_RECORD(This, ListObject, autoobj);
     int i;
 
     for (i = 0; i < list->count; i++)
     int i;
 
     for (i = 0; i < list->count; i++)
@@ -1348,7 +1351,7 @@ static HRESULT session_invoke(
         EXCEPINFO* pExcepInfo,
         UINT* puArgErr)
 {
         EXCEPINFO* pExcepInfo,
         UINT* puArgErr)
 {
-    SessionObject *session = (SessionObject*)This;
+    SessionObject *session = CONTAINING_RECORD(This, SessionObject, autoobj);
     WCHAR *szString;
     DWORD dwLen = 0;
     MSIHANDLE msiHandle;
     WCHAR *szString;
     DWORD dwLen = 0;
     MSIHANDLE msiHandle;
index f120e31..b53762e 100644 (file)
@@ -549,7 +549,7 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D
 static LPWSTR msi_build_createsql_postlude(LPWSTR *primary_keys, DWORD num_keys)
 {
     LPWSTR postlude, keys, ptr;
 static LPWSTR msi_build_createsql_postlude(LPWSTR *primary_keys, DWORD num_keys)
 {
     LPWSTR postlude, keys, ptr;
-    DWORD size, key_size, i;
+    DWORD size, i;
 
     static const WCHAR key_fmt[] = {'`','%','s','`',',',' ',0};
     static const WCHAR postlude_fmt[] = {'P','R','I','M','A','R','Y',' ','K','E','Y',' ','%','s',')',0};
 
     static const WCHAR key_fmt[] = {'`','%','s','`',',',' ',0};
     static const WCHAR postlude_fmt[] = {'P','R','I','M','A','R','Y',' ','K','E','Y',' ','%','s',')',0};
@@ -563,9 +563,7 @@ static LPWSTR msi_build_createsql_postlude(LPWSTR *primary_keys, DWORD num_keys)
 
     for (i = 0, ptr = keys; i < num_keys; i++)
     {
 
     for (i = 0, ptr = keys; i < num_keys; i++)
     {
-        key_size = lstrlenW(key_fmt) + lstrlenW(primary_keys[i]) -2;
-        sprintfW(ptr, key_fmt, primary_keys[i]);
-        ptr += key_size;
+        ptr += sprintfW(ptr, key_fmt, primary_keys[i]);
     }
 
     /* remove final ', ' */
     }
 
     /* remove final ', ' */
index d29ffaf..4166350 100644 (file)
@@ -123,10 +123,10 @@ done:
 UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
 {
     MSIPACKAGE *package = NULL;
 UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
 {
     MSIPACKAGE *package = NULL;
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     UINT r;
 
     UINT r;
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (!phProduct)
         return ERROR_INVALID_PARAMETER;
 
     if (!phProduct)
@@ -987,16 +987,15 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
 {
     UINT rc, index;
     HKEY compkey, prodkey;
 {
     UINT rc, index;
     HKEY compkey, prodkey;
-    WCHAR squished_comp[GUID_SIZE];
-    WCHAR squished_prod[GUID_SIZE];
-    DWORD sz = GUID_SIZE;
+    WCHAR squashed_comp[SQUASHED_GUID_SIZE], squashed_prod[SQUASHED_GUID_SIZE];
+    DWORD sz = sizeof(squashed_prod)/sizeof(squashed_prod[0]);
 
     TRACE("%s %p\n", debugstr_w(szComponent), szBuffer);
 
     if (!szComponent || !*szComponent)
         return ERROR_INVALID_PARAMETER;
 
 
     TRACE("%s %p\n", debugstr_w(szComponent), szBuffer);
 
     if (!szComponent || !*szComponent)
         return ERROR_INVALID_PARAMETER;
 
-    if (!squash_guid(szComponent, squished_comp))
+    if (!squash_guid( szComponent, squashed_comp ))
         return ERROR_INVALID_PARAMETER;
 
     if (MSIREG_OpenUserDataComponentKey(szComponent, NULL, &compkey, FALSE) != ERROR_SUCCESS &&
         return ERROR_INVALID_PARAMETER;
 
     if (MSIREG_OpenUserDataComponentKey(szComponent, NULL, &compkey, FALSE) != ERROR_SUCCESS &&
@@ -1005,7 +1004,7 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
         return ERROR_UNKNOWN_COMPONENT;
     }
 
         return ERROR_UNKNOWN_COMPONENT;
     }
 
-    rc = RegEnumValueW(compkey, 0, squished_prod, &sz, NULL, NULL, NULL, NULL);
+    rc = RegEnumValueW( compkey, 0, squashed_prod, &sz, NULL, NULL, NULL, NULL );
     if (rc != ERROR_SUCCESS)
     {
         RegCloseKey(compkey);
     if (rc != ERROR_SUCCESS)
     {
         RegCloseKey(compkey);
@@ -1013,7 +1012,7 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
     }
 
     /* check simple case, only one product */
     }
 
     /* check simple case, only one product */
-    rc = RegEnumValueW(compkey, 1, squished_prod, &sz, NULL, NULL, NULL, NULL);
+    rc = RegEnumValueW( compkey, 1, squashed_prod, &sz, NULL, NULL, NULL, NULL );
     if (rc == ERROR_NO_MORE_ITEMS)
     {
         rc = ERROR_SUCCESS;
     if (rc == ERROR_NO_MORE_ITEMS)
     {
         rc = ERROR_SUCCESS;
@@ -1021,12 +1020,12 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
     }
 
     index = 0;
     }
 
     index = 0;
-    while ((rc = RegEnumValueW(compkey, index, squished_prod, &sz,
-           NULL, NULL, NULL, NULL)) != ERROR_NO_MORE_ITEMS)
+    while ((rc = RegEnumValueW( compkey, index, squashed_prod, &sz, NULL, NULL, NULL, NULL )) !=
+           ERROR_NO_MORE_ITEMS)
     {
         index++;
         sz = GUID_SIZE;
     {
         index++;
         sz = GUID_SIZE;
-        unsquash_guid(squished_prod, szBuffer);
+        unsquash_guid( squashed_prod, szBuffer );
 
         if (MSIREG_OpenProductKey(szBuffer, NULL,
                                   MSIINSTALLCONTEXT_USERMANAGED,
 
         if (MSIREG_OpenProductKey(szBuffer, NULL,
                                   MSIINSTALLCONTEXT_USERMANAGED,
@@ -1048,7 +1047,7 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
 
 done:
     RegCloseKey(compkey);
 
 done:
     RegCloseKey(compkey);
-    unsquash_guid(squished_prod, szBuffer);
+    unsquash_guid( squashed_prod, szBuffer );
     return rc;
 }
 
     return rc;
 }
 
@@ -1085,9 +1084,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
     MSIINSTALLCONTEXT context = MSIINSTALLCONTEXT_USERUNMANAGED;
     UINT r = ERROR_UNKNOWN_PROPERTY;
     HKEY prodkey, userdata, source;
     MSIINSTALLCONTEXT context = MSIINSTALLCONTEXT_USERUNMANAGED;
     UINT r = ERROR_UNKNOWN_PROPERTY;
     HKEY prodkey, userdata, source;
-    LPWSTR val = NULL;
-    WCHAR squished_pc[GUID_SIZE];
-    WCHAR packagecode[GUID_SIZE];
+    WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE], packagecode[SQUASHED_GUID_SIZE];
     BOOL badconfig = FALSE;
     LONG res;
     DWORD type = REG_NONE;
     BOOL badconfig = FALSE;
     LONG res;
     DWORD type = REG_NONE;
@@ -1098,7 +1095,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
     if ((szValue->str.w && !pcchValueBuf) || !szProduct || !szAttribute)
         return ERROR_INVALID_PARAMETER;
 
     if ((szValue->str.w && !pcchValueBuf) || !szProduct || !szAttribute)
         return ERROR_INVALID_PARAMETER;
 
-    if (!squash_guid(szProduct, squished_pc))
+    if (!squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if ((r = MSIREG_OpenProductKey(szProduct, NULL,
         return ERROR_INVALID_PARAMETER;
 
     if ((r = MSIREG_OpenProductKey(szProduct, NULL,
@@ -1197,7 +1194,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
         if (val != empty && type != REG_DWORD &&
             !strcmpW( szAttribute, INSTALLPROPERTY_PACKAGECODEW ))
         {
         if (val != empty && type != REG_DWORD &&
             !strcmpW( szAttribute, INSTALLPROPERTY_PACKAGECODEW ))
         {
-            if (lstrlenW(val) != SQUISH_GUID_SIZE - 1)
+            if (lstrlenW( val ) != SQUASHED_GUID_SIZE - 1)
                 badconfig = TRUE;
             else
             {
                 badconfig = TRUE;
             else
             {
@@ -1387,15 +1384,6 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
                                  MSIINSTALLCONTEXT dwContext, LPCWSTR szProperty,
                                  LPWSTR szValue, LPDWORD pcchValue)
 {
                                  MSIINSTALLCONTEXT dwContext, LPCWSTR szProperty,
                                  LPWSTR szValue, LPDWORD pcchValue)
 {
-    WCHAR squished_pc[GUID_SIZE];
-    LPWSTR val = NULL;
-    LPCWSTR package = NULL;
-    HKEY props = NULL, prod;
-    HKEY classes = NULL, managed;
-    HKEY hkey = NULL;
-    DWORD type;
-    UINT r = ERROR_UNKNOWN_PRODUCT;
-
     static const WCHAR five[] = {'5',0};
     static const WCHAR displayname[] = {
         'D','i','s','p','l','a','y','N','a','m','e',0};
     static const WCHAR five[] = {'5',0};
     static const WCHAR displayname[] = {
         'D','i','s','p','l','a','y','N','a','m','e',0};
@@ -1404,12 +1392,17 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
     static const WCHAR managed_local_package[] = {
         'M','a','n','a','g','e','d','L','o','c','a','l',
         'P','a','c','k','a','g','e',0};
     static const WCHAR managed_local_package[] = {
         'M','a','n','a','g','e','d','L','o','c','a','l',
         'P','a','c','k','a','g','e',0};
+    WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE];
+    LPCWSTR package = NULL;
+    HKEY props = NULL, prod, classes = NULL, managed, hkey = NULL;
+    DWORD type;
+    UINT r = ERROR_UNKNOWN_PRODUCT;
 
     TRACE("(%s, %s, %d, %s, %p, %p)\n", debugstr_w(szProductCode),
           debugstr_w(szUserSid), dwContext, debugstr_w(szProperty),
            szValue, pcchValue);
 
 
     TRACE("(%s, %s, %d, %s, %p, %p)\n", debugstr_w(szProductCode),
           debugstr_w(szUserSid), dwContext, debugstr_w(szProperty),
            szValue, pcchValue);
 
-    if (!szProductCode || !squash_guid(szProductCode, squished_pc))
+    if (!szProductCode || !squash_guid( szProductCode, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (szValue && !pcchValue)
         return ERROR_INVALID_PARAMETER;
 
     if (szValue && !pcchValue)
@@ -1649,28 +1642,25 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
                                LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext,
                                LPCWSTR szProperty, LPWSTR lpValue, DWORD *pcchValue)
 {
                                LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext,
                                LPCWSTR szProperty, LPWSTR lpValue, DWORD *pcchValue)
 {
-    WCHAR squished_pc[GUID_SIZE];
-    WCHAR squished_patch[GUID_SIZE];
+    static const WCHAR szManagedPackage[] =
+        {'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0};
+    WCHAR *val = NULL, squashed_pc[SQUASHED_GUID_SIZE], squashed_patch[SQUASHED_GUID_SIZE];
     HKEY udprod = 0, prod = 0, props = 0;
     HKEY patch = 0, patches = 0;
     HKEY udpatch = 0, datakey = 0;
     HKEY prodpatches = 0;
     HKEY udprod = 0, prod = 0, props = 0;
     HKEY patch = 0, patches = 0;
     HKEY udpatch = 0, datakey = 0;
     HKEY prodpatches = 0;
-    LPWSTR val = NULL;
     UINT r = ERROR_UNKNOWN_PRODUCT;
     DWORD len;
     LONG res;
 
     UINT r = ERROR_UNKNOWN_PRODUCT;
     DWORD len;
     LONG res;
 
-    static const WCHAR szManagedPackage[] = {'M','a','n','a','g','e','d',
-        'L','o','c','a','l','P','a','c','k','a','g','e',0};
-
     TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_w(szPatchCode),
           debugstr_w(szProductCode), debugstr_w(szUserSid), dwContext,
           debugstr_w(szProperty), lpValue, pcchValue);
 
     TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_w(szPatchCode),
           debugstr_w(szProductCode), debugstr_w(szUserSid), dwContext,
           debugstr_w(szProperty), lpValue, pcchValue);
 
-    if (!szProductCode || !squash_guid(szProductCode, squished_pc))
+    if (!szProductCode || !squash_guid( szProductCode, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
         return ERROR_INVALID_PARAMETER;
 
-    if (!szPatchCode || !squash_guid(szPatchCode, squished_patch))
+    if (!szPatchCode || !squash_guid( szPatchCode, squashed_patch ))
         return ERROR_INVALID_PARAMETER;
 
     if (!szProperty)
         return ERROR_INVALID_PARAMETER;
 
     if (!szProperty)
@@ -1704,7 +1694,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
     if (res != ERROR_SUCCESS)
         goto done;
 
     if (res != ERROR_SUCCESS)
         goto done;
 
-    res = RegOpenKeyExW(patches, squished_patch, 0, KEY_WOW64_64KEY|KEY_READ, &patch);
+    res = RegOpenKeyExW( patches, squashed_patch, 0, KEY_WOW64_64KEY|KEY_READ, &patch );
     if (res != ERROR_SUCCESS)
         goto done;
 
     if (res != ERROR_SUCCESS)
         goto done;
 
@@ -1719,7 +1709,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
             goto done;
 
         datakey = prodpatches;
             goto done;
 
         datakey = prodpatches;
-        szProperty = squished_patch;
+        szProperty = squashed_patch;
     }
     else
     {
     }
     else
     {
@@ -2115,7 +2105,7 @@ static BOOL msi_comp_find_package(LPCWSTR prodcode, MSIINSTALLCONTEXT context)
     return (res == ERROR_SUCCESS);
 }
 
     return (res == ERROR_SUCCESS);
 }
 
-static UINT msi_comp_find_prodcode(LPWSTR squished_pc,
+static UINT msi_comp_find_prodcode(WCHAR *squashed_pc,
                                    MSIINSTALLCONTEXT context,
                                    LPCWSTR comp, LPWSTR val, DWORD *sz)
 {
                                    MSIINSTALLCONTEXT context,
                                    LPCWSTR comp, LPWSTR val, DWORD *sz)
 {
@@ -2131,7 +2121,7 @@ static UINT msi_comp_find_prodcode(LPWSTR squished_pc,
     if (r != ERROR_SUCCESS)
         return r;
 
     if (r != ERROR_SUCCESS)
         return r;
 
-    res = RegQueryValueExW(hkey, squished_pc, NULL, NULL, (BYTE *)val, sz);
+    res = RegQueryValueExW( hkey, squashed_pc, NULL, NULL, (BYTE *)val, sz );
     if (res != ERROR_SUCCESS)
         return res;
 
     if (res != ERROR_SUCCESS)
         return res;
 
@@ -2143,7 +2133,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
                                     LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext,
                                     LPCWSTR szComponent, INSTALLSTATE *pdwState)
 {
                                     LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext,
                                     LPCWSTR szComponent, INSTALLSTATE *pdwState)
 {
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     BOOL found;
     DWORD sz;
 
     BOOL found;
     DWORD sz;
 
@@ -2156,7 +2146,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
     if (!szProductCode || !*szProductCode || lstrlenW(szProductCode) != GUID_SIZE - 1)
         return ERROR_INVALID_PARAMETER;
 
     if (!szProductCode || !*szProductCode || lstrlenW(szProductCode) != GUID_SIZE - 1)
         return ERROR_INVALID_PARAMETER;
 
-    if (!squash_guid(szProductCode, squished_pc))
+    if (!squash_guid( szProductCode, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     found = msi_comp_find_prod_key(szProductCode, dwContext);
         return ERROR_INVALID_PARAMETER;
 
     found = msi_comp_find_prod_key(szProductCode, dwContext);
@@ -2175,7 +2165,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
     *pdwState = INSTALLSTATE_UNKNOWN;
 
     sz = 0;
     *pdwState = INSTALLSTATE_UNKNOWN;
 
     sz = 0;
-    if (msi_comp_find_prodcode(squished_pc, dwContext, szComponent, NULL, &sz))
+    if (msi_comp_find_prodcode( squashed_pc, dwContext, szComponent, NULL, &sz ))
         return ERROR_UNKNOWN_COMPONENT;
 
     if (sz == 0)
         return ERROR_UNKNOWN_COMPONENT;
 
     if (sz == 0)
@@ -2186,7 +2176,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
         UINT r;
 
         if (!(val = msi_alloc( sz ))) return ERROR_OUTOFMEMORY;
         UINT r;
 
         if (!(val = msi_alloc( sz ))) return ERROR_OUTOFMEMORY;
-        if ((r = msi_comp_find_prodcode(squished_pc, dwContext, szComponent, val, &sz)))
+        if ((r = msi_comp_find_prodcode( squashed_pc, dwContext, szComponent, val, &sz )))
         {
             msi_free(val);
             return r;
         {
             msi_free(val);
             return r;
@@ -2519,7 +2509,7 @@ HRESULT WINAPI MsiGetFileSignatureInformationA( LPCSTR path, DWORD flags, PCCERT
 
     TRACE("%s %08x %p %p %p\n", debugstr_a(path), flags, cert, hash, hashlen);
 
 
     TRACE("%s %08x %p %p %p\n", debugstr_a(path), flags, cert, hash, hashlen);
 
-    if (path && !(pathW = strdupAtoW( path ))) return ERROR_OUTOFMEMORY;
+    if (path && !(pathW = strdupAtoW( path ))) return E_OUTOFMEMORY;
     r = MsiGetFileSignatureInformationW( pathW, flags, cert, hash, hashlen );
     msi_free( pathW );
     return r;
     r = MsiGetFileSignatureInformationW( pathW, flags, cert, hash, hashlen );
     msi_free( pathW );
     return r;
@@ -2769,10 +2759,8 @@ static INSTALLSTATE MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent,
 {
     static const WCHAR wininstaller[] =
         {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
 {
     static const WCHAR wininstaller[] =
         {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
-    WCHAR squished_pc[GUID_SIZE];
-    WCHAR squished_comp[GUID_SIZE];
+    WCHAR *path = NULL, squashed_pc[SQUASHED_GUID_SIZE], squashed_comp[SQUASHED_GUID_SIZE];
     HKEY hkey;
     HKEY hkey;
-    LPWSTR path = NULL;
     INSTALLSTATE state;
     DWORD version;
 
     INSTALLSTATE state;
     DWORD version;
 
@@ -2782,8 +2770,7 @@ static INSTALLSTATE MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent,
     if (lpPathBuf->str.w && !pcchBuf)
         return INSTALLSTATE_INVALIDARG;
 
     if (lpPathBuf->str.w && !pcchBuf)
         return INSTALLSTATE_INVALIDARG;
 
-    if (!squash_guid(szProduct, squished_pc) ||
-        !squash_guid(szComponent, squished_comp))
+    if (!squash_guid( szProduct, squashed_pc ) || !squash_guid( szComponent, squashed_comp ))
         return INSTALLSTATE_INVALIDARG;
 
     state = INSTALLSTATE_UNKNOWN;
         return INSTALLSTATE_INVALIDARG;
 
     state = INSTALLSTATE_UNKNOWN;
@@ -2791,7 +2778,7 @@ static INSTALLSTATE MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent,
     if (MSIREG_OpenUserDataComponentKey(szComponent, szLocalSid, &hkey, FALSE) == ERROR_SUCCESS ||
         MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkey, FALSE) == ERROR_SUCCESS)
     {
     if (MSIREG_OpenUserDataComponentKey(szComponent, szLocalSid, &hkey, FALSE) == ERROR_SUCCESS ||
         MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkey, FALSE) == ERROR_SUCCESS)
     {
-        path = msi_reg_get_val_str(hkey, squished_pc);
+        path = msi_reg_get_val_str( hkey, squashed_pc );
         RegCloseKey(hkey);
 
         state = INSTALLSTATE_ABSENT;
         RegCloseKey(hkey);
 
         state = INSTALLSTATE_ABSENT;
@@ -2821,7 +2808,7 @@ static INSTALLSTATE MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent,
             MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkey, FALSE) == ERROR_SUCCESS)
         {
             msi_free(path);
             MSIREG_OpenUserDataComponentKey(szComponent, NULL, &hkey, FALSE) == ERROR_SUCCESS)
         {
             msi_free(path);
-            path = msi_reg_get_val_str(hkey, squished_pc);
+            path = msi_reg_get_val_str( hkey, squashed_pc );
             RegCloseKey(hkey);
 
             state = INSTALLSTATE_ABSENT;
             RegCloseKey(hkey);
 
             state = INSTALLSTATE_ABSENT;
@@ -3339,6 +3326,26 @@ INSTALLSTATE WINAPI MsiUseFeatureA( LPCSTR szProduct, LPCSTR szFeature )
     return MsiUseFeatureExA(szProduct, szFeature, 0, 0);
 }
 
     return MsiUseFeatureExA(szProduct, szFeature, 0, 0);
 }
 
+WCHAR *reg_get_multisz( HKEY hkey, const WCHAR *name )
+{
+    WCHAR *ret;
+    DWORD len, type;
+    if (RegQueryValueExW( hkey, name, NULL, &type, NULL, &len ) || type != REG_MULTI_SZ) return NULL;
+    if ((ret = msi_alloc( len ))) RegQueryValueExW( hkey, name, NULL, NULL, (BYTE *)ret, &len );
+    return ret;
+}
+
+WCHAR *reg_get_sz( HKEY hkey, const WCHAR *name )
+{
+    WCHAR *ret;
+    DWORD len, type;
+    if (RegQueryValueExW( hkey, name, NULL, &type, NULL, &len ) || type != REG_SZ) return NULL;
+    if ((ret = msi_alloc( len ))) RegQueryValueExW( hkey, name, NULL, NULL, (BYTE *)ret, &len );
+    return ret;
+}
+
+#define BASE85_SIZE 20
+
 /***********************************************************************
  * MSI_ProvideQualifiedComponentEx [internal]
  */
 /***********************************************************************
  * MSI_ProvideQualifiedComponentEx [internal]
  */
@@ -3347,39 +3354,54 @@ static UINT MSI_ProvideQualifiedComponentEx(LPCWSTR szComponent,
                 DWORD Unused1, DWORD Unused2, awstring *lpPathBuf,
                 LPDWORD pcchPathBuf)
 {
                 DWORD Unused1, DWORD Unused2, awstring *lpPathBuf,
                 LPDWORD pcchPathBuf)
 {
-    WCHAR product[MAX_FEATURE_CHARS+1], component[MAX_FEATURE_CHARS+1],
-          feature[MAX_FEATURE_CHARS+1];
-    LPWSTR info;
+    WCHAR product[MAX_FEATURE_CHARS+1], comp[MAX_FEATURE_CHARS+1], feature[MAX_FEATURE_CHARS+1];
+    WCHAR *desc;
     HKEY hkey;
     HKEY hkey;
-    DWORD sz;
-    UINT rc;
+    DWORD size;
+    UINT ret;
     INSTALLSTATE state;
 
     INSTALLSTATE state;
 
-    rc = MSIREG_OpenUserComponentsKey(szComponent, &hkey, FALSE);
-    if (rc != ERROR_SUCCESS)
-        return ERROR_INDEX_ABSENT;
+    if (MSIREG_OpenUserComponentsKey( szComponent, &hkey, FALSE )) return ERROR_UNKNOWN_COMPONENT;
 
 
-    info = msi_reg_get_val_str( hkey, szQualifier );
+    desc = reg_get_multisz( hkey, szQualifier );
     RegCloseKey(hkey);
     RegCloseKey(hkey);
+    if (!desc) return ERROR_INDEX_ABSENT;
 
 
-    if (!info)
-        return ERROR_INDEX_ABSENT;
+    /* FIXME: handle multiple descriptors */
+    ret = MsiDecomposeDescriptorW( desc, product, feature, comp, &size );
+    msi_free( desc );
+    if (ret != ERROR_SUCCESS) return ret;
 
 
-    MsiDecomposeDescriptorW(info, product, feature, component, &sz);
-
-    if (!szProduct)
-        state = MSI_GetComponentPath(product, component, lpPathBuf, pcchPathBuf);
-    else
-        state = MSI_GetComponentPath(szProduct, component, lpPathBuf, pcchPathBuf);
+    if (!szProduct) szProduct = product;
+    if (!comp[0])
+    {
+        MSIINSTALLCONTEXT ctx;
+        WCHAR *components;
+        GUID guid;
 
 
-    msi_free( info );
+        /* use the first component of the feature if the descriptor component is empty */
+        if ((ret = msi_locate_product( szProduct, &ctx ))) return ret;
+        if ((ret = MSIREG_OpenUserDataFeaturesKey( szProduct, NULL, ctx, &hkey, FALSE )))
+        {
+            return ERROR_FILE_NOT_FOUND;
+        }
+        components = reg_get_sz( hkey, feature );
+        RegCloseKey( hkey );
+        if (!components) return ERROR_FILE_NOT_FOUND;
 
 
-    if (state == INSTALLSTATE_MOREDATA)
-        return ERROR_MORE_DATA;
+        if (strlenW( components ) < BASE85_SIZE || !decode_base85_guid( components, &guid ))
+        {
+            msi_free( components );
+            return ERROR_FILE_NOT_FOUND;
+        }
+        msi_free( components );
+        StringFromGUID2( &guid, comp, sizeof(comp)/sizeof(comp[0]) );
+    }
 
 
-    if (state != INSTALLSTATE_LOCAL)
-        return ERROR_FILE_NOT_FOUND;
+    state = MSI_GetComponentPath( szProduct, comp, lpPathBuf, pcchPathBuf );
 
 
+    if (state == INSTALLSTATE_MOREDATA) return ERROR_MORE_DATA;
+    if (state != INSTALLSTATE_LOCAL) return ERROR_FILE_NOT_FOUND;
     return ERROR_SUCCESS;
 }
 
     return ERROR_SUCCESS;
 }
 
@@ -3476,8 +3498,7 @@ static USERINFOSTATE MSI_GetUserInfo(LPCWSTR szProduct,
                 awstring *lpOrgNameBuf, LPDWORD pcchOrgNameBuf,
                 awstring *lpSerialBuf, LPDWORD pcchSerialBuf)
 {
                 awstring *lpOrgNameBuf, LPDWORD pcchOrgNameBuf,
                 awstring *lpSerialBuf, LPDWORD pcchSerialBuf)
 {
-    WCHAR squished_pc[SQUISH_GUID_SIZE];
-    LPWSTR user, org, serial;
+    WCHAR *user, *org, *serial, squashed_pc[SQUASHED_GUID_SIZE];
     USERINFOSTATE state;
     HKEY hkey, props;
     LPCWSTR orgptr;
     USERINFOSTATE state;
     HKEY hkey, props;
     LPCWSTR orgptr;
@@ -3487,7 +3508,7 @@ static USERINFOSTATE MSI_GetUserInfo(LPCWSTR szProduct,
           pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
           pcchSerialBuf);
 
           pcchUserNameBuf, lpOrgNameBuf, pcchOrgNameBuf, lpSerialBuf,
           pcchSerialBuf);
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return USERINFOSTATE_INVALIDARG;
 
     if (MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
         return USERINFOSTATE_INVALIDARG;
 
     if (MSIREG_OpenProductKey(szProduct, NULL, MSIINSTALLCONTEXT_USERMANAGED,
index 4d1aa3a..bb6fbd2 100644 (file)
@@ -727,7 +727,7 @@ typedef struct tagMSISCRIPT
 #define MSI_BUILDNUMBER 6001
 
 #define GUID_SIZE 39
 #define MSI_BUILDNUMBER 6001
 
 #define GUID_SIZE 39
-#define SQUISH_GUID_SIZE 33
+#define SQUASHED_GUID_SIZE 33
 
 #define MSIHANDLE_MAGIC 0x4d434923
 
 
 #define MSIHANDLE_MAGIC 0x4d434923
 
@@ -929,10 +929,11 @@ extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL cr
 extern UINT MSIREG_DeleteProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) DECLSPEC_HIDDEN;
-extern UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
+extern UINT MSIREG_DeleteUserDataProductKey(LPCWSTR, MSIINSTALLCONTEXT) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode) DECLSPEC_HIDDEN;
+extern UINT MSIREG_DeleteUpgradeCodesKey(const WCHAR *) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode) DECLSPEC_HIDDEN;
 extern UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode) DECLSPEC_HIDDEN;
 extern UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create) DECLSPEC_HIDDEN;
 extern UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode) DECLSPEC_HIDDEN;
@@ -969,7 +970,6 @@ extern INT msi_suminfo_get_int32( MSISUMMARYINFO *si, UINT uiProperty ) DECLSPEC
 extern LPWSTR msi_get_suminfo_product( IStorage *stg ) DECLSPEC_HIDDEN;
 extern UINT msi_add_suminfo( MSIDATABASE *db, LPWSTR **records, int num_records, int num_columns ) DECLSPEC_HIDDEN;
 extern UINT msi_export_suminfo( MSIDATABASE *db, HANDLE handle ) DECLSPEC_HIDDEN;
 extern LPWSTR msi_get_suminfo_product( IStorage *stg ) DECLSPEC_HIDDEN;
 extern UINT msi_add_suminfo( MSIDATABASE *db, LPWSTR **records, int num_records, int num_columns ) DECLSPEC_HIDDEN;
 extern UINT msi_export_suminfo( MSIDATABASE *db, HANDLE handle ) DECLSPEC_HIDDEN;
-extern enum platform parse_platform( const WCHAR *str ) DECLSPEC_HIDDEN;
 extern UINT msi_load_suminfo_properties( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
 
 /* undocumented functions */
 extern UINT msi_load_suminfo_properties( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
 
 /* undocumented functions */
index 5f35ec2..54b8033 100644 (file)
@@ -1170,7 +1170,7 @@ UINT msi_create_empty_local_file( LPWSTR path, LPCWSTR suffix )
     return ERROR_SUCCESS;
 }
 
     return ERROR_SUCCESS;
 }
 
-enum platform parse_platform( const WCHAR *str )
+static enum platform parse_platform( const WCHAR *str )
 {
     if (!str[0] || !strcmpW( str, szIntel )) return PLATFORM_INTEL;
     else if (!strcmpW( str, szIntel64 )) return PLATFORM_INTEL64;
 {
     if (!str[0] || !strcmpW( str, szIntel )) return PLATFORM_INTEL;
     else if (!strcmpW( str, szIntel64 )) return PLATFORM_INTEL64;
index 74a30b2..f73f1f5 100644 (file)
@@ -707,7 +707,8 @@ UINT MSI_RecordSetStream(MSIRECORD *rec, UINT iField, IStream *stream)
 UINT MSI_RecordSetStreamFromFileW(MSIRECORD *rec, UINT iField, LPCWSTR szFilename)
 {
     IStream *stm = NULL;
 UINT MSI_RecordSetStreamFromFileW(MSIRECORD *rec, UINT iField, LPCWSTR szFilename)
 {
     IStream *stm = NULL;
-    HRESULT r;
+    HRESULT hr;
+    UINT ret;
 
     if( (iField == 0) || (iField > rec->count) )
         return ERROR_INVALID_PARAMETER;
 
     if( (iField == 0) || (iField > rec->count) )
         return ERROR_INVALID_PARAMETER;
@@ -726,16 +727,16 @@ UINT MSI_RecordSetStreamFromFileW(MSIRECORD *rec, UINT iField, LPCWSTR szFilenam
             return ERROR_INVALID_FIELD;
 
         ofs.QuadPart = 0;
             return ERROR_INVALID_FIELD;
 
         ofs.QuadPart = 0;
-        r = IStream_Seek( stm, ofs, STREAM_SEEK_SET, &cur );
-        if( FAILED( r ) )
+        hr = IStream_Seek( stm, ofs, STREAM_SEEK_SET, &cur );
+        if (FAILED( hr ))
             return ERROR_FUNCTION_FAILED;
     }
     else
     {
         /* read the file into a stream and save the stream in the record */
             return ERROR_FUNCTION_FAILED;
     }
     else
     {
         /* read the file into a stream and save the stream in the record */
-        r = RECORD_StreamFromFile(szFilename, &stm);
-        if( r != ERROR_SUCCESS )
-            return r;
+        ret = RECORD_StreamFromFile(szFilename, &stm);
+        if (ret != ERROR_SUCCESS)
+            return ret;
 
         /* if all's good, store it in the record */
         MSI_RecordSetStream(rec, iField, stm);
 
         /* if all's good, store it in the record */
         MSI_RecordSetStream(rec, iField, stm);
index 9d0f93e..7414d2e 100644 (file)
@@ -475,24 +475,23 @@ UINT MSIREG_DeleteUninstallKey(const WCHAR *product, enum platform platform)
 
 UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT context, HKEY *key, BOOL create)
 {
 
 UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTEXT context, HKEY *key, BOOL create)
 {
-    LPWSTR usersid = NULL;
     HKEY root = HKEY_LOCAL_MACHINE;
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
     HKEY root = HKEY_LOCAL_MACHINE;
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE], keypath[MAX_PATH];
+    WCHAR *usersid = NULL, squashed_pc[SQUASHED_GUID_SIZE], keypath[MAX_PATH];
 
 
-    if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProduct), debugstr_w(squished_pc));
+    if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
 
     if (context == MSIINSTALLCONTEXT_MACHINE)
     {
         strcpyW(keypath, szInstaller_LocalClassesProd);
 
     if (context == MSIINSTALLCONTEXT_MACHINE)
     {
         strcpyW(keypath, szInstaller_LocalClassesProd);
-        strcatW(keypath, squished_pc);
+        strcatW( keypath, squashed_pc );
     }
     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
     {
         root = HKEY_CURRENT_USER;
         strcpyW(keypath, szUserProducts);
     }
     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
     {
         root = HKEY_CURRENT_USER;
         strcpyW(keypath, szUserProducts);
-        strcatW(keypath, squished_pc);
+        strcatW( keypath, squashed_pc );
     }
     else
     {
     }
     else
     {
@@ -505,7 +504,7 @@ UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTE
             }
             szUserSid = usersid;
         }
             }
             szUserSid = usersid;
         }
-        sprintfW(keypath, szInstaller_LocalManagedProd_fmt, szUserSid, squished_pc);
+        sprintfW( keypath, szInstaller_LocalManagedProd_fmt, szUserSid, squashed_pc );
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(root, keypath, 0, NULL, 0, access, NULL, key, NULL);
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(root, keypath, 0, NULL, 0, access, NULL, key, NULL);
@@ -514,25 +513,25 @@ UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTE
 
 UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct)
 {
 
 UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct)
 {
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProduct), debugstr_w(squished_pc));
+    if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
 
     strcpyW(keypath, szUserProducts);
 
     strcpyW(keypath, szUserProducts);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_pc );
     return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
 }
 
 UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create)
 {
     return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
 }
 
 UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create)
 {
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szPatch, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szPatch), debugstr_w(squished_pc));
+    if (!squash_guid( szPatch, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szPatch), debugstr_w(squashed_pc));
 
     strcpyW(keypath, szUserPatches);
 
     strcpyW(keypath, szUserPatches);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_pc );
 
     if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key);
     return RegOpenKeyW(HKEY_CURRENT_USER, keypath, key);
 
     if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key);
     return RegOpenKeyW(HKEY_CURRENT_USER, keypath, key);
@@ -543,21 +542,21 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONT
 {
     HKEY root = HKEY_LOCAL_MACHINE;
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 {
     HKEY root = HKEY_LOCAL_MACHINE;
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE], keypath[MAX_PATH], *usersid = NULL;
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE], keypath[MAX_PATH], *usersid = NULL;
 
 
-    if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProduct), debugstr_w(squished_pc));
+    if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
 
     if (context == MSIINSTALLCONTEXT_MACHINE)
     {
         strcpyW(keypath, szInstaller_LocalClassesFeat);
 
     if (context == MSIINSTALLCONTEXT_MACHINE)
     {
         strcpyW(keypath, szInstaller_LocalClassesFeat);
-        strcatW(keypath, squished_pc);
+        strcatW( keypath, squashed_pc );
     }
     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
     {
         root = HKEY_CURRENT_USER;
         strcpyW(keypath, szUserFeatures);
     }
     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
     {
         root = HKEY_CURRENT_USER;
         strcpyW(keypath, szUserFeatures);
-        strcatW(keypath, squished_pc);
+        strcatW( keypath, squashed_pc );
     }
     else
     {
     }
     else
     {
@@ -570,7 +569,7 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONT
             }
             szUserSid = usersid;
         }
             }
             szUserSid = usersid;
         }
-        sprintfW(keypath, szInstaller_LocalManagedFeat_fmt, szUserSid, squished_pc);
+        sprintfW( keypath, szInstaller_LocalManagedFeat_fmt, szUserSid, squashed_pc );
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(root, keypath, 0, NULL, 0, access, NULL, key, NULL);
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(root, keypath, 0, NULL, 0, access, NULL, key, NULL);
@@ -579,26 +578,26 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONT
 
 UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct)
 {
 
 UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct)
 {
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProduct), debugstr_w(squished_pc));
+    if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
 
     strcpyW(keypath, szUserFeatures);
 
     strcpyW(keypath, szUserFeatures);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_pc );
     return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
 }
 
 static UINT MSIREG_OpenInstallerFeaturesKey(LPCWSTR szProduct, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
     return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
 }
 
 static UINT MSIREG_OpenInstallerFeaturesKey(LPCWSTR szProduct, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProduct), debugstr_w(squished_pc));
+    if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
 
     strcpyW(keypath, szInstaller_Features);
 
     strcpyW(keypath, szInstaller_Features);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_pc );
 
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
 
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
@@ -608,14 +607,14 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS
                                     HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
                                     HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200], *usersid = NULL;
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200], *usersid = NULL;
 
 
-    if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProduct), debugstr_w(squished_pc));
+    if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
 
     if (context == MSIINSTALLCONTEXT_MACHINE)
     {
 
     if (context == MSIINSTALLCONTEXT_MACHINE)
     {
-        sprintfW(keypath, szUserDataFeatures_fmt, szLocalSid, squished_pc);
+        sprintfW( keypath, szUserDataFeatures_fmt, szLocalSid, squashed_pc );
     }
     else
     {
     }
     else
     {
@@ -628,7 +627,7 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS
             }
             szUserSid = usersid;
         }
             }
             szUserSid = usersid;
         }
-        sprintfW(keypath, szUserDataFeatures_fmt, szUserSid, squished_pc);
+        sprintfW( keypath, szUserDataFeatures_fmt, szUserSid, squashed_pc );
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
@@ -637,32 +636,31 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS
 
 UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create)
 {
 
 UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create)
 {
-    WCHAR squished_cc[GUID_SIZE], keypath[0x200];
+    WCHAR squashed_cc[SQUASHED_GUID_SIZE], keypath[0x200];
     UINT ret;
 
     UINT ret;
 
-    if (!squash_guid(szComponent, squished_cc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szComponent), debugstr_w(squished_cc));
+    if (!squash_guid( szComponent, squashed_cc)) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szComponent), debugstr_w(squashed_cc));
 
     strcpyW(keypath, szUserComponents);
 
     strcpyW(keypath, szUserComponents);
-    strcatW(keypath, squished_cc);
+    strcatW( keypath, squashed_cc );
 
     if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key);
     ret = RegOpenKeyW(HKEY_CURRENT_USER, keypath, key);
     if (ret != ERROR_FILE_NOT_FOUND) return ret;
 
     strcpyW(keypath, szInstaller_Components);
 
     if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key);
     ret = RegOpenKeyW(HKEY_CURRENT_USER, keypath, key);
     if (ret != ERROR_FILE_NOT_FOUND) return ret;
 
     strcpyW(keypath, szInstaller_Components);
-    strcatW(keypath, squished_cc);
+    strcatW( keypath, squashed_cc );
     return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
 }
 
 UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
     return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
 }
 
 UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR comp[GUID_SIZE], keypath[0x200];
-    LPWSTR usersid;
+    WCHAR *usersid, squashed_comp[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szComponent, comp)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szComponent), debugstr_w(comp));
+    if (!squash_guid( szComponent, squashed_comp )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szComponent), debugstr_w(squashed_comp));
 
     if (!szUserSid)
     {
 
     if (!szUserSid)
     {
@@ -671,11 +669,11 @@ UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKE
             ERR("Failed to retrieve user SID\n");
             return ERROR_FUNCTION_FAILED;
         }
             ERR("Failed to retrieve user SID\n");
             return ERROR_FUNCTION_FAILED;
         }
-        sprintfW(keypath, szUserDataComp_fmt, usersid, comp);
+        sprintfW( keypath, szUserDataComp_fmt, usersid, squashed_comp );
         LocalFree(usersid);
     }
     else
         LocalFree(usersid);
     }
     else
-        sprintfW(keypath, szUserDataComp_fmt, szUserSid, comp);
+        sprintfW( keypath, szUserDataComp_fmt, szUserSid, squashed_comp );
 
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
 
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
@@ -684,13 +682,12 @@ UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKE
 UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR comp[GUID_SIZE], keypath[0x200];
-    LPWSTR usersid;
+    WCHAR *usersid, squashed_comp[SQUASHED_GUID_SIZE], keypath[0x200];
     HKEY hkey;
     LONG r;
 
     HKEY hkey;
     LONG r;
 
-    if (!squash_guid(szComponent, comp)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szComponent), debugstr_w(comp));
+    if (!squash_guid( szComponent, squashed_comp )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szComponent), debugstr_w(squashed_comp));
 
     if (!szUserSid)
     {
 
     if (!szUserSid)
     {
@@ -706,7 +703,7 @@ UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid)
         sprintfW(keypath, szUserDataComponents_fmt, szUserSid);
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS;
         sprintfW(keypath, szUserDataComponents_fmt, szUserSid);
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS;
-    r = RegDeleteTreeW(hkey, comp);
+    r = RegDeleteTreeW( hkey, squashed_comp );
     RegCloseKey(hkey);
     return r;
 }
     RegCloseKey(hkey);
     return r;
 }
@@ -714,16 +711,15 @@ UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid)
 UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPCWSTR szUserSid, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPCWSTR szUserSid, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
-    LPWSTR usersid;
+    WCHAR *usersid, squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProduct), debugstr_w(squished_pc));
+    if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
 
     if (dwContext == MSIINSTALLCONTEXT_MACHINE)
 
     if (dwContext == MSIINSTALLCONTEXT_MACHINE)
-        sprintfW(keypath, szUserDataProd_fmt, szLocalSid, squished_pc);
+        sprintfW( keypath, szUserDataProd_fmt, szLocalSid, squashed_pc );
     else if (szUserSid)
     else if (szUserSid)
-        sprintfW(keypath, szUserDataProd_fmt, szUserSid, squished_pc);
+        sprintfW( keypath, szUserDataProd_fmt, szUserSid, squashed_pc );
     else
     {
         if (!(usersid = get_user_sid()))
     else
     {
         if (!(usersid = get_user_sid()))
@@ -731,7 +727,7 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex
             ERR("Failed to retrieve user SID\n");
             return ERROR_FUNCTION_FAILED;
         }
             ERR("Failed to retrieve user SID\n");
             return ERROR_FUNCTION_FAILED;
         }
-        sprintfW(keypath, szUserDataProd_fmt, usersid, squished_pc);
+        sprintfW( keypath, szUserDataProd_fmt, usersid, squashed_pc );
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
@@ -741,14 +737,13 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex
 UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_patch[GUID_SIZE], keypath[0x200];
-    LPWSTR usersid;
+    WCHAR *usersid, squashed_patch[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szPatch, squished_patch)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szPatch), debugstr_w(squished_patch));
+    if (!squash_guid( szPatch, squashed_patch )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szPatch), debugstr_w(squashed_patch));
 
     if (dwContext == MSIINSTALLCONTEXT_MACHINE)
 
     if (dwContext == MSIINSTALLCONTEXT_MACHINE)
-        sprintfW(keypath, szUserDataPatch_fmt, szLocalSid, squished_patch);
+        sprintfW( keypath, szUserDataPatch_fmt, szLocalSid, squashed_patch );
     else
     {
         if (!(usersid = get_user_sid()))
     else
     {
         if (!(usersid = get_user_sid()))
@@ -756,7 +751,7 @@ UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, H
             ERR("Failed to retrieve user SID\n");
             return ERROR_FUNCTION_FAILED;
         }
             ERR("Failed to retrieve user SID\n");
             return ERROR_FUNCTION_FAILED;
         }
-        sprintfW(keypath, szUserDataPatch_fmt, usersid, squished_patch);
+        sprintfW( keypath, szUserDataPatch_fmt, usersid, squashed_patch );
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
@@ -766,13 +761,12 @@ UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, H
 UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_patch[GUID_SIZE], keypath[0x200];
-    LPWSTR usersid;
+    WCHAR *usersid, squashed_patch[SQUASHED_GUID_SIZE], keypath[0x200];
     HKEY hkey;
     LONG r;
 
     HKEY hkey;
     LONG r;
 
-    if (!squash_guid(patch, squished_patch)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(patch), debugstr_w(squished_patch));
+    if (!squash_guid( patch, squashed_patch )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(patch), debugstr_w(squashed_patch));
 
     if (context == MSIINSTALLCONTEXT_MACHINE)
         sprintfW(keypath, szUserDataPatches_fmt, szLocalSid);
 
     if (context == MSIINSTALLCONTEXT_MACHINE)
         sprintfW(keypath, szUserDataPatches_fmt, szLocalSid);
@@ -787,7 +781,7 @@ UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context)
         LocalFree(usersid);
     }
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS;
         LocalFree(usersid);
     }
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS;
-    r = RegDeleteTreeW(hkey, squished_patch);
+    r = RegDeleteTreeW( hkey, squashed_patch );
     RegCloseKey(hkey);
     return r;
 }
     RegCloseKey(hkey);
     return r;
 }
@@ -795,14 +789,13 @@ UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context)
 UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT context, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT context, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_product[GUID_SIZE], keypath[0x200];
-    LPWSTR usersid;
+    WCHAR *usersid, squashed_product[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(product, squished_product)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(product), debugstr_w(squished_product));
+    if (!squash_guid( product, squashed_product )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(product), debugstr_w(squashed_product));
 
     if (context == MSIINSTALLCONTEXT_MACHINE)
 
     if (context == MSIINSTALLCONTEXT_MACHINE)
-        sprintfW(keypath, szUserDataProductPatches_fmt, szLocalSid, squished_product);
+        sprintfW( keypath, szUserDataProductPatches_fmt, szLocalSid, squashed_product );
     else
     {
         if (!(usersid = get_user_sid()))
     else
     {
         if (!(usersid = get_user_sid()))
@@ -810,7 +803,7 @@ UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT con
             ERR("Failed to retrieve user SID\n");
             return ERROR_FUNCTION_FAILED;
         }
             ERR("Failed to retrieve user SID\n");
             return ERROR_FUNCTION_FAILED;
         }
-        sprintfW(keypath, szUserDataProductPatches_fmt, usersid, squished_product);
+        sprintfW( keypath, szUserDataProductPatches_fmt, usersid, squashed_product );
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
@@ -819,17 +812,16 @@ UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT con
 
 UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPCWSTR szUserSid, HKEY *key, BOOL create)
 {
 
 UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPCWSTR szUserSid, HKEY *key, BOOL create)
 {
-    LPWSTR usersid;
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
+    WCHAR *usersid, squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProduct), debugstr_w(squished_pc));
+    if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
 
     if (dwContext == MSIINSTALLCONTEXT_MACHINE)
 
     if (dwContext == MSIINSTALLCONTEXT_MACHINE)
-        sprintfW(keypath, szInstallProperties_fmt, szLocalSid, squished_pc);
+        sprintfW( keypath, szInstallProperties_fmt, szLocalSid, squashed_pc );
     else if (szUserSid)
     else if (szUserSid)
-        sprintfW(keypath, szInstallProperties_fmt, szUserSid, squished_pc);
+        sprintfW( keypath, szInstallProperties_fmt, szUserSid, squashed_pc );
     else
     {
         if (!(usersid = get_user_sid()))
     else
     {
         if (!(usersid = get_user_sid()))
@@ -837,34 +829,38 @@ UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPC
             ERR("Failed to retrieve user SID\n");
             return ERROR_FUNCTION_FAILED;
         }
             ERR("Failed to retrieve user SID\n");
             return ERROR_FUNCTION_FAILED;
         }
-        sprintfW(keypath, szInstallProperties_fmt, usersid, squished_pc);
+        sprintfW( keypath, szInstallProperties_fmt, usersid, squashed_pc );
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
 }
 
         LocalFree(usersid);
     }
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
 }
 
-UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct)
+UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT context)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
-    LPWSTR usersid;
+    WCHAR *usersid, squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200];
     HKEY hkey;
     LONG r;
 
     HKEY hkey;
     LONG r;
 
-    if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProduct), debugstr_w(squished_pc));
+    if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
 
 
-    if (!(usersid = get_user_sid()))
+    if (context == MSIINSTALLCONTEXT_MACHINE)
+        sprintfW(keypath, szUserDataProducts_fmt, szLocalSid);
+    else
     {
     {
-        ERR("Failed to retrieve user SID\n");
-        return ERROR_FUNCTION_FAILED;
+        if (!(usersid = get_user_sid()))
+        {
+            ERR("Failed to retrieve user SID\n");
+            return ERROR_FUNCTION_FAILED;
+        }
+        sprintfW(keypath, szUserDataProducts_fmt, usersid);
+        LocalFree(usersid);
     }
     }
-    sprintfW(keypath, szUserDataProducts_fmt, usersid);
-    LocalFree(usersid);
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS;
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS;
-    r = RegDeleteTreeW(hkey, squished_pc);
+    r = RegDeleteTreeW( hkey, squashed_pc );
     RegCloseKey(hkey);
     return r;
 }
     RegCloseKey(hkey);
     return r;
 }
@@ -872,15 +868,15 @@ UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct)
 UINT MSIREG_DeleteProductKey(LPCWSTR szProduct)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_DeleteProductKey(LPCWSTR szProduct)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     HKEY hkey;
     LONG r;
 
     HKEY hkey;
     LONG r;
 
-    if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProduct), debugstr_w(squished_pc));
+    if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc));
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_Products, 0, access, &hkey)) return ERROR_SUCCESS;
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_Products, 0, access, &hkey)) return ERROR_SUCCESS;
-    r = RegDeleteTreeW(hkey, squished_pc);
+    r = RegDeleteTreeW( hkey, squashed_pc );
     RegCloseKey(hkey);
     return r;
 }
     RegCloseKey(hkey);
     return r;
 }
@@ -888,12 +884,12 @@ UINT MSIREG_DeleteProductKey(LPCWSTR szProduct)
 UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szPatch, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szPatch), debugstr_w(squished_pc));
+    if (!squash_guid( szPatch, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szPatch), debugstr_w(squashed_pc));
 
 
-    sprintfW(keypath, szInstaller_Patches, squished_pc);
+    sprintfW( keypath, szInstaller_Patches, squashed_pc );
 
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
 
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
@@ -902,13 +898,13 @@ UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create)
 UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
+    WCHAR squashed_uc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szUpgradeCode, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szUpgradeCode), debugstr_w(squished_pc));
+    if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc));
 
     strcpyW(keypath, szInstaller_UpgradeCodes);
 
     strcpyW(keypath, szInstaller_UpgradeCodes);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_uc );
 
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
 
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
@@ -916,42 +912,54 @@ UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL create)
 
 UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create)
 {
 
 UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create)
 {
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
+    WCHAR squashed_uc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szUpgradeCode, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szUpgradeCode), debugstr_w(squished_pc));
+    if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc));
 
     strcpyW(keypath, szInstaller_UserUpgradeCodes);
 
     strcpyW(keypath, szInstaller_UserUpgradeCodes);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_uc );
 
     if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key);
     return RegOpenKeyW(HKEY_CURRENT_USER, keypath, key);
 }
 
 
     if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key);
     return RegOpenKeyW(HKEY_CURRENT_USER, keypath, key);
 }
 
+UINT MSIREG_DeleteUpgradeCodesKey( const WCHAR *code )
+{
+    WCHAR squashed_code[SQUASHED_GUID_SIZE], keypath[0x200];
+
+    if (!squash_guid( code, squashed_code )) return ERROR_FUNCTION_FAILED;
+    TRACE( "%s squashed %s\n", debugstr_w(code), debugstr_w(squashed_code) );
+
+    strcpyW( keypath, szInstaller_UpgradeCodes );
+    strcatW( keypath, squashed_code );
+    return RegDeleteTreeW( HKEY_LOCAL_MACHINE, keypath );
+}
+
 UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode)
 {
 UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode)
 {
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
+    WCHAR squashed_uc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szUpgradeCode, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szUpgradeCode), debugstr_w(squished_pc));
+    if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc));
 
     strcpyW(keypath, szInstaller_UserUpgradeCodes);
 
     strcpyW(keypath, szInstaller_UserUpgradeCodes);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_uc );
     return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
 }
 
 UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
     return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
 }
 
 UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     HKEY hkey;
     LONG r;
 
     HKEY hkey;
     LONG r;
 
-    if (!squash_guid(szProductCode, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProductCode), debugstr_w(squished_pc));
+    if (!squash_guid( szProductCode, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProductCode), debugstr_w(squashed_pc));
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_LocalClassesProducts, 0, access, &hkey)) return ERROR_SUCCESS;
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_LocalClassesProducts, 0, access, &hkey)) return ERROR_SUCCESS;
-    r = RegDeleteTreeW(hkey, squished_pc);
+    r = RegDeleteTreeW( hkey, squashed_pc );
     RegCloseKey(hkey);
     return r;
 }
     RegCloseKey(hkey);
     return r;
 }
@@ -959,15 +967,15 @@ UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode)
 UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     HKEY hkey;
     LONG r;
 
     HKEY hkey;
     LONG r;
 
-    if (!squash_guid(szProductCode, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szProductCode), debugstr_w(squished_pc));
+    if (!squash_guid( szProductCode, squashed_pc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szProductCode), debugstr_w(squashed_pc));
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_LocalClassesFeatures, 0, access, &hkey)) return ERROR_SUCCESS;
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_LocalClassesFeatures, 0, access, &hkey)) return ERROR_SUCCESS;
-    r = RegDeleteTreeW(hkey, squished_pc);
+    r = RegDeleteTreeW( hkey, squashed_pc );
     RegCloseKey(hkey);
     return r;
 }
     RegCloseKey(hkey);
     return r;
 }
@@ -975,13 +983,13 @@ UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode)
 UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL create)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE], keypath[0x200];
+    WCHAR squashed_uc[SQUASHED_GUID_SIZE], keypath[0x200];
 
 
-    if (!squash_guid(szUpgradeCode, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szUpgradeCode), debugstr_w(squished_pc));
+    if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc));
 
     strcpyW(keypath, szInstaller_ClassesUpgradeCode);
 
     strcpyW(keypath, szInstaller_ClassesUpgradeCode);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_uc );
 
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
 
     if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL);
     return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key);
@@ -990,15 +998,15 @@ UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL cr
 UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
 UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode)
 {
     REGSAM access = KEY_WOW64_64KEY | KEY_ALL_ACCESS;
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_uc[SQUASHED_GUID_SIZE];
     HKEY hkey;
     LONG r;
 
     HKEY hkey;
     LONG r;
 
-    if (!squash_guid(szUpgradeCode, squished_pc)) return ERROR_FUNCTION_FAILED;
-    TRACE("%s squished %s\n", debugstr_w(szUpgradeCode), debugstr_w(squished_pc));
+    if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED;
+    TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc));
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_ClassesUpgradeCodes, 0, access, &hkey)) return ERROR_SUCCESS;
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szInstaller_ClassesUpgradeCodes, 0, access, &hkey)) return ERROR_SUCCESS;
-    r = RegDeleteTreeW(hkey, squished_pc);
+    r = RegDeleteTreeW( hkey, squashed_uc );
     RegCloseKey(hkey);
     return r;
 }
     RegCloseKey(hkey);
     return r;
 }
@@ -1008,7 +1016,8 @@ UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode)
  *
  * Decomposes an MSI descriptor into product, feature and component parts.
  * An MSI descriptor is a string of the form:
  *
  * Decomposes an MSI descriptor into product, feature and component parts.
  * An MSI descriptor is a string of the form:
- *   [base 85 guid] [feature code] '>' [base 85 guid]
+ *   [base 85 guid] [feature code] '>' [base 85 guid] or
+ *   [base 85 guid] [feature code] '<'
  *
  * PARAMS
  *   szDescriptor  [I]  the descriptor to decompose
  *
  * PARAMS
  *   szDescriptor  [I]  the descriptor to decompose
@@ -1025,21 +1034,21 @@ UINT MSIREG_DeleteClassesUpgradeCodesKey(LPCWSTR szUpgradeCode)
 UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR szDescriptor, LPWSTR szProduct,
                 LPWSTR szFeature, LPWSTR szComponent, LPDWORD pUsed )
 {
 UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR szDescriptor, LPWSTR szProduct,
                 LPWSTR szFeature, LPWSTR szComponent, LPDWORD pUsed )
 {
-    UINT r, len;
-    LPWSTR p;
+    UINT len;
+    const WCHAR *p;
     GUID product, component;
 
     TRACE("%s %p %p %p %p\n", debugstr_w(szDescriptor), szProduct,
           szFeature, szComponent, pUsed);
 
     GUID product, component;
 
     TRACE("%s %p %p %p %p\n", debugstr_w(szDescriptor), szProduct,
           szFeature, szComponent, pUsed);
 
-    r = decode_base85_guid( szDescriptor, &product );
-    if( !r )
+    if (!decode_base85_guid( szDescriptor, &product ))
         return ERROR_INVALID_PARAMETER;
 
     TRACE("product %s\n", debugstr_guid( &product ));
 
         return ERROR_INVALID_PARAMETER;
 
     TRACE("product %s\n", debugstr_guid( &product ));
 
-    p = strchrW(&szDescriptor[20],'>');
-    if( !p )
+    if (!(p = strchrW( &szDescriptor[20], '>' )))
+        p = strchrW( &szDescriptor[20], '<' );
+    if (!p)
         return ERROR_INVALID_PARAMETER;
 
     len = (p - &szDescriptor[20]);
         return ERROR_INVALID_PARAMETER;
 
     len = (p - &szDescriptor[20]);
@@ -1048,22 +1057,30 @@ UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR szDescriptor, LPWSTR szProduct,
 
     TRACE("feature %s\n", debugstr_wn( &szDescriptor[20], len ));
 
 
     TRACE("feature %s\n", debugstr_wn( &szDescriptor[20], len ));
 
-    r = decode_base85_guid( p+1, &component );
-    if( !r )
-        return ERROR_INVALID_PARAMETER;
-
-    TRACE("component %s\n", debugstr_guid( &component ));
+    if (*p == '>')
+    {
+        if (!decode_base85_guid( p+1, &component ))
+            return ERROR_INVALID_PARAMETER;
+        TRACE( "component %s\n", debugstr_guid(&component) );
+    }
 
     if (szProduct)
         StringFromGUID2( &product, szProduct, MAX_FEATURE_CHARS+1 );
     if (szComponent)
 
     if (szProduct)
         StringFromGUID2( &product, szProduct, MAX_FEATURE_CHARS+1 );
     if (szComponent)
-        StringFromGUID2( &component, szComponent, MAX_FEATURE_CHARS+1 );
+    {
+        if (*p == '>')
+            StringFromGUID2( &component, szComponent, MAX_FEATURE_CHARS+1 );
+        else
+            szComponent[0] = 0;
+    }
     if (szFeature)
     {
         memcpy( szFeature, &szDescriptor[20], len*sizeof(WCHAR) );
         szFeature[len] = 0;
     }
     if (szFeature)
     {
         memcpy( szFeature, &szDescriptor[20], len*sizeof(WCHAR) );
         szFeature[len] = 0;
     }
-    len = ( &p[21] - szDescriptor );
+
+    len = p - szDescriptor + 1;
+    if (*p == '>') len += 20;
 
     TRACE("length = %d\n", len);
     if (pUsed) *pUsed = len;
 
     TRACE("length = %d\n", len);
     if (pUsed) *pUsed = len;
@@ -1251,7 +1268,7 @@ static UINT fetch_machine_component( DWORD ctx, DWORD index, DWORD *idx, WCHAR g
          'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\',
          'S','-','1','-','5','-','1','8','\\','C','o','m','p','o','n','e','n','t','s',0};
     UINT r = ERROR_SUCCESS;
          'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a','\\',
          'S','-','1','-','5','-','1','8','\\','C','o','m','p','o','n','e','n','t','s',0};
     UINT r = ERROR_SUCCESS;
-    WCHAR component[GUID_SIZE];
+    WCHAR component[SQUASHED_GUID_SIZE];
     DWORD i = 0, len_component;
     REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY;
     HKEY key_components;
     DWORD i = 0, len_component;
     REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY;
     HKEY key_components;
@@ -1300,7 +1317,7 @@ static UINT fetch_user_component( const WCHAR *usersid, DWORD ctx, DWORD index,
          'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a',0};
     static const WCHAR componentsW[] = {'\\','C','o','m','p','o','n','e','n','t','s',0};
     UINT r = ERROR_SUCCESS;
          'I','n','s','t','a','l','l','e','r','\\','U','s','e','r','D','a','t','a',0};
     static const WCHAR componentsW[] = {'\\','C','o','m','p','o','n','e','n','t','s',0};
     UINT r = ERROR_SUCCESS;
-    WCHAR path[MAX_PATH], component[GUID_SIZE], user[128];
+    WCHAR path[MAX_PATH], component[SQUASHED_GUID_SIZE], user[128];
     DWORD i = 0, j = 0, len_component, len_user;
     REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY;
     HKEY key_users, key_components;
     DWORD i = 0, j = 0, len_component, len_user;
     REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY;
     HKEY key_users, key_components;
@@ -1461,7 +1478,7 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct)
 {
     HKEY hkeyComp = 0;
     DWORD r, sz;
 {
     HKEY hkeyComp = 0;
     DWORD r, sz;
-    WCHAR szValName[SQUISH_GUID_SIZE];
+    WCHAR szValName[SQUASHED_GUID_SIZE];
 
     TRACE("%s %d %p\n", debugstr_w(szComponent), index, szProduct);
 
 
     TRACE("%s %d %p\n", debugstr_w(szComponent), index, szProduct);
 
@@ -1473,7 +1490,7 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct)
         return ERROR_UNKNOWN_COMPONENT;
 
     /* see if there are any products at all */
         return ERROR_UNKNOWN_COMPONENT;
 
     /* see if there are any products at all */
-    sz = SQUISH_GUID_SIZE;
+    sz = SQUASHED_GUID_SIZE;
     r = RegEnumValueW(hkeyComp, 0, szValName, &sz, NULL, NULL, NULL, NULL);
     if (r != ERROR_SUCCESS)
     {
     r = RegEnumValueW(hkeyComp, 0, szValName, &sz, NULL, NULL, NULL, NULL);
     if (r != ERROR_SUCCESS)
     {
@@ -1485,7 +1502,7 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct)
         return ERROR_UNKNOWN_COMPONENT;
     }
 
         return ERROR_UNKNOWN_COMPONENT;
     }
 
-    sz = SQUISH_GUID_SIZE;
+    sz = SQUASHED_GUID_SIZE;
     r = RegEnumValueW(hkeyComp, index, szValName, &sz, NULL, NULL, NULL, NULL);
     if( r == ERROR_SUCCESS )
     {
     r = RegEnumValueW(hkeyComp, index, szValName, &sz, NULL, NULL, NULL, NULL);
     if( r == ERROR_SUCCESS )
     {
@@ -1670,8 +1687,8 @@ UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved,
 {
     UINT r;
     HKEY hkey;
 {
     UINT r;
     HKEY hkey;
-    DWORD dwSize = SQUISH_GUID_SIZE;
-    WCHAR szKeyName[SQUISH_GUID_SIZE];
+    WCHAR szKeyName[SQUASHED_GUID_SIZE];
+    DWORD dwSize = sizeof(szKeyName)/sizeof(szKeyName[0]);
 
     TRACE("%s %u %u %p\n", debugstr_w(szUpgradeCode), dwReserved,
           iProductIndex, lpProductBuf);
 
     TRACE("%s %u %u %p\n", debugstr_w(szUpgradeCode), dwReserved,
           iProductIndex, lpProductBuf);
@@ -2082,7 +2099,7 @@ UINT WINAPI MsiEnumPatchesExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
         LPWSTR szTargetProductCode, MSIINSTALLCONTEXT *pdwTargetProductContext,
         LPWSTR szTargetUserSid, LPDWORD pcchTargetUserSid)
 {
         LPWSTR szTargetProductCode, MSIINSTALLCONTEXT *pdwTargetProductContext,
         LPWSTR szTargetUserSid, LPDWORD pcchTargetUserSid)
 {
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     DWORD idx = 0;
     UINT r;
 
     DWORD idx = 0;
     UINT r;
 
@@ -2093,7 +2110,7 @@ UINT WINAPI MsiEnumPatchesExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
           dwIndex, szPatchCode, szTargetProductCode, pdwTargetProductContext,
           szTargetUserSid, pcchTargetUserSid);
 
           dwIndex, szPatchCode, szTargetProductCode, pdwTargetProductContext,
           szTargetUserSid, pcchTargetUserSid);
 
-    if (!szProductCode || !squash_guid(szProductCode, squished_pc))
+    if (!szProductCode || !squash_guid( szProductCode, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (szUserSid && !strcmpW( szUserSid, szLocalSid ))
         return ERROR_INVALID_PARAMETER;
 
     if (szUserSid && !strcmpW( szUserSid, szLocalSid ))
@@ -2189,8 +2206,7 @@ done:
 UINT WINAPI MsiEnumPatchesW(LPCWSTR szProduct, DWORD iPatchIndex,
         LPWSTR lpPatchBuf, LPWSTR lpTransformsBuf, LPDWORD pcchTransformsBuf)
 {
 UINT WINAPI MsiEnumPatchesW(LPCWSTR szProduct, DWORD iPatchIndex,
         LPWSTR lpPatchBuf, LPWSTR lpTransformsBuf, LPDWORD pcchTransformsBuf)
 {
-    WCHAR squished_pc[GUID_SIZE];
-    LPWSTR transforms = NULL;
+    WCHAR *transforms = NULL, squashed_pc[SQUASHED_GUID_SIZE];
     HKEY prod;
     DWORD idx = 0;
     UINT r;
     HKEY prod;
     DWORD idx = 0;
     UINT r;
@@ -2198,7 +2214,7 @@ UINT WINAPI MsiEnumPatchesW(LPCWSTR szProduct, DWORD iPatchIndex,
     TRACE("(%s %d %p %p %p)\n", debugstr_w(szProduct), iPatchIndex,
           lpPatchBuf, lpTransformsBuf, pcchTransformsBuf);
 
     TRACE("(%s %d %p %p %p)\n", debugstr_w(szProduct), iPatchIndex,
           lpPatchBuf, lpTransformsBuf, pcchTransformsBuf);
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (!lpPatchBuf || !lpTransformsBuf || !pcchTransformsBuf)
         return ERROR_INVALID_PARAMETER;
 
     if (!lpPatchBuf || !lpTransformsBuf || !pcchTransformsBuf)
@@ -2279,7 +2295,7 @@ static UINT fetch_machine_product( const WCHAR *match, DWORD index, DWORD *idx,
         {'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\',
          'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s',0};
     UINT r;
         {'S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s','\\',
          'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s',0};
     UINT r;
-    WCHAR product[GUID_SIZE];
+    WCHAR product[SQUASHED_GUID_SIZE];
     DWORD i = 0, len;
     REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY;
     HKEY key;
     DWORD i = 0, len;
     REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY;
     HKEY key;
@@ -2340,7 +2356,7 @@ static UINT fetch_user_product( const WCHAR *match, const WCHAR *usersid, DWORD
          'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s',0};
     UINT r;
     const WCHAR *subkey;
          'I','n','s','t','a','l','l','e','r','\\','P','r','o','d','u','c','t','s',0};
     UINT r;
     const WCHAR *subkey;
-    WCHAR path[MAX_PATH], product[GUID_SIZE], user[128];
+    WCHAR path[MAX_PATH], product[SQUASHED_GUID_SIZE], user[128];
     DWORD i = 0, j = 0, len_product, len_user;
     REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY;
     HKEY key_users, key_products;
     DWORD i = 0, j = 0, len_product, len_user;
     REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY;
     HKEY key_users, key_products;
index adb5a86..2d53649 100644 (file)
@@ -191,27 +191,20 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
                                          LPWSTR szVolumeLabel, LPDWORD pcchVolumeLabel,
                                          LPWSTR szDiskPrompt, LPDWORD pcchDiskPrompt)
 {
                                          LPWSTR szVolumeLabel, LPDWORD pcchVolumeLabel,
                                          LPWSTR szDiskPrompt, LPDWORD pcchDiskPrompt)
 {
-    WCHAR squished_pc[GUID_SIZE];
-    WCHAR convert[11];
-    LPWSTR value = NULL;
-    LPWSTR data = NULL;
-    LPWSTR ptr, ptr2;
+    static const WCHAR fmt[] = {'#','%','d',0};
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE], convert[11];
+    WCHAR *value = NULL, *data = NULL, *ptr, *ptr2;
     HKEY source, media;
     HKEY source, media;
-    DWORD valuesz, datasz = 0;
-    DWORD type;
-    DWORD numvals, size;
+    DWORD valuesz, datasz = 0, type, numvals, size;
     LONG res;
     UINT r;
     static DWORD index = 0;
 
     LONG res;
     UINT r;
     static DWORD index = 0;
 
-    static const WCHAR fmt[] = {'#','%','d',0};
-
     TRACE("(%s, %s, %d, %d, %d, %p, %p, %p, %p)\n", debugstr_w(szProductCodeOrPatchCode),
           debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szVolumeLabel,
           pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt);
 
     TRACE("(%s, %s, %d, %d, %d, %p, %p, %p, %p)\n", debugstr_w(szProductCodeOrPatchCode),
           debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szVolumeLabel,
           pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt);
 
-    if (!szProductCodeOrPatchCode ||
-        !squash_guid(szProductCodeOrPatchCode, squished_pc))
+    if (!szProductCodeOrPatchCode || !squash_guid( szProductCodeOrPatchCode, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
         return ERROR_INVALID_PARAMETER;
 
     if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
@@ -229,8 +222,7 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
     if (dwIndex != index)
         return ERROR_INVALID_PARAMETER;
 
     if (dwIndex != index)
         return ERROR_INVALID_PARAMETER;
 
-    r = OpenSourceKey(szProductCodeOrPatchCode, &source,
-                      dwOptions, dwContext, FALSE);
+    r = OpenSourceKey(szProductCodeOrPatchCode, &source, dwOptions, dwContext, FALSE);
     if (r != ERROR_SUCCESS)
         return r;
 
     if (r != ERROR_SUCCESS)
         return r;
 
@@ -403,23 +395,20 @@ UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR szProductCodeOrPatch, LPCWSTR szUs
                                       DWORD dwOptions, DWORD dwIndex,
                                       LPWSTR szSource, LPDWORD pcchSource)
 {
                                       DWORD dwOptions, DWORD dwIndex,
                                       LPWSTR szSource, LPDWORD pcchSource)
 {
-    WCHAR squished_pc[GUID_SIZE];
-    WCHAR name[32];
-    HKEY source = NULL;
-    HKEY subkey = NULL;
+    static const WCHAR format[] = {'%','d',0};
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE], name[32];
+    HKEY source = NULL, subkey = NULL;
     LONG res;
     UINT r = ERROR_INVALID_PARAMETER;
     static DWORD index = 0;
 
     LONG res;
     UINT r = ERROR_INVALID_PARAMETER;
     static DWORD index = 0;
 
-    static const WCHAR format[] = {'%','d',0};
-
     TRACE("(%s, %s, %d, %d, %d, %p, %p)\n", debugstr_w(szProductCodeOrPatch),
           debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szSource, pcchSource);
 
     if (dwIndex == 0)
         index = 0;
 
     TRACE("(%s, %s, %d, %d, %d, %p, %p)\n", debugstr_w(szProductCodeOrPatch),
           debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szSource, pcchSource);
 
     if (dwIndex == 0)
         index = 0;
 
-    if (!szProductCodeOrPatch || !squash_guid(szProductCodeOrPatch, squished_pc))
+    if (!szProductCodeOrPatch || !squash_guid( szProductCodeOrPatch, squashed_pc ))
         goto done;
 
     if (szSource && !pcchSource)
         goto done;
 
     if (szSource && !pcchSource)
@@ -437,8 +426,7 @@ UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR szProductCodeOrPatch, LPCWSTR szUs
     if (dwIndex != index)
         goto done;
 
     if (dwIndex != index)
         goto done;
 
-    r = OpenSourceKey(szProductCodeOrPatch, &source,
-                      dwOptions, dwContext, FALSE);
+    r = OpenSourceKey( szProductCodeOrPatch, &source, dwOptions, dwContext, FALSE );
     if (r != ERROR_SUCCESS)
         goto done;
 
     if (r != ERROR_SUCCESS)
         goto done;
 
@@ -534,18 +522,15 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
                                    LPCWSTR szProperty, LPWSTR szValue, 
                                    LPDWORD pcchValue) 
 {
                                    LPCWSTR szProperty, LPWSTR szValue, 
                                    LPDWORD pcchValue) 
 {
-    WCHAR squished_pc[GUID_SIZE];
+    static const WCHAR mediapack[] = {'M','e','d','i','a','P','a','c','k','a','g','e',0};
+    WCHAR *source, *ptr, squashed_pc[SQUASHED_GUID_SIZE];
     HKEY sourcekey, media;
     HKEY sourcekey, media;
-    LPWSTR source, ptr;
     DWORD size;
     UINT rc;
 
     DWORD size;
     UINT rc;
 
-    static const WCHAR mediapack[] = {
-        'M','e','d','i','a','P','a','c','k','a','g','e',0};
-
     TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szProperty));
 
     TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szProperty));
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (szValue && !pcchValue)
         return ERROR_INVALID_PARAMETER;
 
     if (szValue && !pcchValue)
@@ -761,19 +746,16 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
                                    MSIINSTALLCONTEXT dwContext, DWORD dwOptions,
                                    LPCWSTR szProperty, LPCWSTR szValue)
 {
                                    MSIINSTALLCONTEXT dwContext, DWORD dwOptions,
                                    LPCWSTR szProperty, LPCWSTR szValue)
 {
-    WCHAR squished_pc[GUID_SIZE];
+    static const WCHAR media_package[] = {'M','e','d','i','a','P','a','c','k','a','g','e',0};
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     HKEY sourcekey, media;
     LPCWSTR property;
     UINT rc;
 
     HKEY sourcekey, media;
     LPCWSTR property;
     UINT rc;
 
-    static const WCHAR media_package[] = {
-        'M','e','d','i','a','P','a','c','k','a','g','e',0
-    };
-
     TRACE("%s %s %x %x %s %s\n", debugstr_w(szProduct), debugstr_w(szUserSid),
             dwContext, dwOptions, debugstr_w(szProperty), debugstr_w(szValue));
 
     TRACE("%s %s %x %x %s %s\n", debugstr_w(szProduct), debugstr_w(szUserSid),
             dwContext, dwOptions, debugstr_w(szProperty), debugstr_w(szValue));
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (!szProperty)
         return ERROR_INVALID_PARAMETER;
 
     if (!szProperty)
@@ -845,12 +827,9 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
 UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName,
         DWORD dwReserved, LPCWSTR szSource)
 {
 UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName,
         DWORD dwReserved, LPCWSTR szSource)
 {
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR *sidstr = NULL, squashed_pc[SQUASHED_GUID_SIZE];
     INT ret;
     INT ret;
-    LPWSTR sidstr = NULL;
-    DWORD sidsize = 0;
-    DWORD domsize = 0;
-    DWORD context;
+    DWORD sidsize = 0, domsize = 0, context;
     HKEY hkey = 0;
     UINT r;
 
     HKEY hkey = 0;
     UINT r;
 
@@ -862,7 +841,7 @@ UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName,
     if (dwReserved != 0)
         return ERROR_INVALID_PARAMETER;
 
     if (dwReserved != 0)
         return ERROR_INVALID_PARAMETER;
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (!szUserName || !*szUserName)
         return ERROR_INVALID_PARAMETER;
 
     if (!szUserName || !*szUserName)
@@ -1056,24 +1035,19 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
         MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource, 
         DWORD dwIndex)
 {
         MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource, 
         DWORD dwIndex)
 {
-    HKEY sourcekey;
-    HKEY typekey;
+    static const WCHAR fmt[] = {'%','i',0};
+    HKEY sourcekey, typekey;
     UINT rc;
     struct list sourcelist;
     media_info *info;
     UINT rc;
     struct list sourcelist;
     media_info *info;
-    WCHAR squished_pc[GUID_SIZE];
-    WCHAR name[10];
-    LPWSTR source;
+    WCHAR *source, squashed_pc[SQUASHED_GUID_SIZE], name[10];
     LPCWSTR postfix;
     LPCWSTR postfix;
-    DWORD size, count;
-    DWORD index;
-
-    static const WCHAR fmt[] = {'%','i',0};
+    DWORD size, count, index;
 
     TRACE("%s %s %x %x %s %i\n", debugstr_w(szProduct), debugstr_w(szUserSid),
           dwContext, dwOptions, debugstr_w(szSource), dwIndex);
 
 
     TRACE("%s %s %x %x %s %i\n", debugstr_w(szProduct), debugstr_w(szUserSid),
           dwContext, dwOptions, debugstr_w(szSource), dwIndex);
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (!szSource || !*szSource)
         return ERROR_INVALID_PARAMETER;
 
     if (!szSource || !*szSource)
@@ -1215,21 +1189,17 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid,
         MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, 
         LPCWSTR szVolumeLabel, LPCWSTR szDiskPrompt)
 {
         MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId, 
         LPCWSTR szVolumeLabel, LPCWSTR szDiskPrompt)
 {
-    HKEY sourcekey;
-    HKEY mediakey;
+    static const WCHAR fmt[] = {'%','i',0};
+    HKEY sourcekey, mediakey;
     UINT rc;
     UINT rc;
-    WCHAR szIndex[10];
-    WCHAR squished_pc[GUID_SIZE];
-    LPWSTR buffer;
+    WCHAR *buffer, squashed_pc[SQUASHED_GUID_SIZE], szIndex[10];
     DWORD size;
 
     DWORD size;
 
-    static const WCHAR fmt[] = {'%','i',0};
-
     TRACE("%s %s %x %x %i %s %s\n", debugstr_w(szProduct),
             debugstr_w(szUserSid), dwContext, dwOptions, dwDiskId,
             debugstr_w(szVolumeLabel), debugstr_w(szDiskPrompt));
 
     TRACE("%s %s %x %x %i %s %s\n", debugstr_w(szProduct),
             debugstr_w(szUserSid), dwContext, dwOptions, dwDiskId,
             debugstr_w(szVolumeLabel), debugstr_w(szDiskPrompt));
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (dwOptions != MSICODE_PRODUCT && dwOptions != MSICODE_PATCH)
         return ERROR_INVALID_PARAMETER;
 
     if (dwOptions != MSICODE_PRODUCT && dwOptions != MSICODE_PATCH)
index 0b05142..af077db 100644 (file)
@@ -2721,7 +2721,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg )
     IEnumSTATSTG *stgenum = NULL;
     TRANSFORMDATA *transform;
     TRANSFORMDATA *tables = NULL, *columns = NULL;
     IEnumSTATSTG *stgenum = NULL;
     TRANSFORMDATA *transform;
     TRANSFORMDATA *tables = NULL, *columns = NULL;
-    HRESULT r;
+    HRESULT hr;
     STATSTG stat;
     string_table *strings;
     UINT ret = ERROR_FUNCTION_FAILED;
     STATSTG stat;
     string_table *strings;
     UINT ret = ERROR_FUNCTION_FAILED;
@@ -2734,8 +2734,8 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg )
     if( !strings )
         goto end;
 
     if( !strings )
         goto end;
 
-    r = IStorage_EnumElements( stg, 0, NULL, 0, &stgenum );
-    if( FAILED( r ) )
+    hr = IStorage_EnumElements( stg, 0, NULL, 0, &stgenum );
+    if (FAILED( hr ))
         goto end;
 
     list_init(&transforms);
         goto end;
 
     list_init(&transforms);
@@ -2746,8 +2746,8 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg )
         WCHAR name[0x40];
         ULONG count = 0;
 
         WCHAR name[0x40];
         ULONG count = 0;
 
-        r = IEnumSTATSTG_Next( stgenum, 1, &stat, &count );
-        if ( FAILED( r ) || !count )
+        hr = IEnumSTATSTG_Next( stgenum, 1, &stat, &count );
+        if (FAILED( hr ) || !count)
             break;
 
         decode_streamname( stat.pwcsName, name );
             break;
 
         decode_streamname( stat.pwcsName, name );
@@ -2777,12 +2777,10 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg )
         TRACE("transform contains stream %s\n", debugstr_w(name));
 
         /* load the table */
         TRACE("transform contains stream %s\n", debugstr_w(name));
 
         /* load the table */
-        r = TABLE_CreateView( db, transform->name, (MSIVIEW**) &tv );
-        if( r != ERROR_SUCCESS )
+        if (TABLE_CreateView( db, transform->name, (MSIVIEW**) &tv ) != ERROR_SUCCESS)
             continue;
 
             continue;
 
-        r = tv->view.ops->execute( &tv->view, NULL );
-        if( r != ERROR_SUCCESS )
+        if (tv->view.ops->execute( &tv->view, NULL ) != ERROR_SUCCESS)
         {
             tv->view.ops->delete( &tv->view );
             continue;
         {
             tv->view.ops->delete( &tv->view );
             continue;
index 445d33a..b178641 100644 (file)
@@ -92,10 +92,8 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property,
 static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)
 {
     MSIPACKAGE *package = param;
 static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)
 {
     MSIPACKAGE *package = param;
-    WCHAR product[GUID_SIZE];
-    DWORD index = 0;
-    DWORD attributes = 0;
-    DWORD sz = GUID_SIZE;
+    WCHAR product[SQUASHED_GUID_SIZE];
+    DWORD index = 0, attributes = 0, sz = sizeof(product)/sizeof(product[0]);
     LPCWSTR upgrade_code;
     HKEY hkey = 0;
     UINT rc = ERROR_SUCCESS;
     LPCWSTR upgrade_code;
     HKEY hkey = 0;
     UINT rc = ERROR_SUCCESS;
index 7b2a0c5..446fda2 100644 (file)
@@ -112,7 +112,7 @@ reactos/dll/win32/msg711.acm          # Synced to WineStaging-1.9.11
 reactos/dll/win32/msgsm32.acm         # Synced to WineStaging-1.9.11
 reactos/dll/win32/mshtml              # Synced to WineStaging-1.7.55
 reactos/dll/win32/mshtml.tlb          # Synced to WineStaging-1.7.55
 reactos/dll/win32/msgsm32.acm         # Synced to WineStaging-1.9.11
 reactos/dll/win32/mshtml              # Synced to WineStaging-1.7.55
 reactos/dll/win32/mshtml.tlb          # Synced to WineStaging-1.7.55
-reactos/dll/win32/msi                 # Synced to WineStaging-1.9.16
+reactos/dll/win32/msi                 # Synced to WineStaging-1.9.23
 reactos/dll/win32/msimg32             # Synced to WineStaging-1.9.11
 reactos/dll/win32/msimtf              # Synced to WineStaging-1.9.23
 reactos/dll/win32/msisip              # Synced to WineStaging-1.9.11
 reactos/dll/win32/msimg32             # Synced to WineStaging-1.9.11
 reactos/dll/win32/msimtf              # Synced to WineStaging-1.9.23
 reactos/dll/win32/msisip              # Synced to WineStaging-1.9.11