[5/9] msi: Use exact size for squashed GUID buffers.

Hans Leidekker hans at codeweavers.com
Fri Nov 4 07:28:07 CDT 2016


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/msi/action.c   |  47 ++++------
 dlls/msi/msi.c      |  92 ++++++++----------
 dlls/msi/msipriv.h  |   2 +-
 dlls/msi/registry.c | 262 +++++++++++++++++++++++++---------------------------
 dlls/msi/source.c   |  88 ++++++------------
 dlls/msi/upgrade.c  |   6 +-
 6 files changed, 216 insertions(+), 281 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index a3b84af..ee53684 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -3506,14 +3506,14 @@ static WCHAR *build_full_keypath( MSIPACKAGE *package, MSICOMPONENT *comp )
 
 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");
 
-    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 )
@@ -3525,7 +3525,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
         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 );
 
@@ -3535,7 +3535,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
         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)
@@ -3558,7 +3558,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, squished_pc, comp->FullKeypath);
+                msi_reg_set_val_str( hkey, squashed_pc, comp->FullKeypath );
             else
             {
                 MSIFILE *file;
@@ -3595,7 +3595,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
                 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);
         }
@@ -3624,7 +3624,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
                     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 );
             }
@@ -4222,15 +4222,6 @@ static UINT msi_publish_sourcelist(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[] =
@@ -4240,6 +4231,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};
+    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);
@@ -4302,8 +4297,7 @@ static UINT msi_publish_upgrade_code(MSIPACKAGE *package)
 {
     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)
@@ -5195,9 +5189,8 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey)
 
 static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
 {
-    WCHAR squashed_pc[SQUISH_GUID_SIZE];
+    WCHAR *upgrade_code, squashed_pc[SQUASHED_GUID_SIZE];
     MSIRECORD *uirow;
-    LPWSTR upgrade_code;
     HKEY hkey, props, upgrade_key;
     UINT rc;
 
@@ -5392,26 +5385,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};
-    WCHAR buffer[256], sysdir[MAX_PATH];
+    WCHAR buffer[256], sysdir[MAX_PATH], squashed_pc[SQUASHED_GUID_SIZE];
     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);
-    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);
-    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;
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 2fe1538..518281d 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -147,10 +147,10 @@ done:
 UINT WINAPI MsiOpenProductW(LPCWSTR szProduct, MSIHANDLE *phProduct)
 {
     MSIPACKAGE *package = NULL;
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     UINT r;
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (!phProduct)
@@ -1011,16 +1011,15 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
 {
     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;
 
-    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 &&
@@ -1029,7 +1028,7 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
         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);
@@ -1037,7 +1036,7 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
     }
 
     /* 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;
@@ -1045,12 +1044,12 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
     }
 
     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;
-        unsquash_guid(squished_prod, szBuffer);
+        unsquash_guid( squashed_prod, szBuffer );
 
         if (MSIREG_OpenProductKey(szBuffer, NULL,
                                   MSIINSTALLCONTEXT_USERMANAGED,
@@ -1072,7 +1071,7 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
 
 done:
     RegCloseKey(compkey);
-    unsquash_guid(squished_prod, szBuffer);
+    unsquash_guid( squashed_prod, szBuffer );
     return rc;
 }
 
@@ -1109,9 +1108,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
     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;
@@ -1122,7 +1119,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
     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,
@@ -1221,7 +1218,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
         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
             {
@@ -1411,15 +1408,6 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
                                  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};
@@ -1428,12 +1416,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};
+    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);
 
-    if (!szProductCode || !squash_guid(szProductCode, squished_pc))
+    if (!szProductCode || !squash_guid( szProductCode, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (szValue && !pcchValue)
@@ -1673,28 +1666,25 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
                                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;
-    LPWSTR val = NULL;
     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);
 
-    if (!szProductCode || !squash_guid(szProductCode, squished_pc))
+    if (!szProductCode || !squash_guid( szProductCode, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
-    if (!szPatchCode || !squash_guid(szPatchCode, squished_patch))
+    if (!szPatchCode || !squash_guid( szPatchCode, squashed_patch ))
         return ERROR_INVALID_PARAMETER;
 
     if (!szProperty)
@@ -1728,7 +1718,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
     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;
 
@@ -1743,7 +1733,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
             goto done;
 
         datakey = prodpatches;
-        szProperty = squished_patch;
+        szProperty = squashed_patch;
     }
     else
     {
@@ -2139,7 +2129,7 @@ static BOOL msi_comp_find_package(LPCWSTR prodcode, MSIINSTALLCONTEXT context)
     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)
 {
@@ -2155,7 +2145,7 @@ static UINT msi_comp_find_prodcode(LPWSTR squished_pc,
     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;
 
@@ -2167,7 +2157,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
                                     LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext,
                                     LPCWSTR szComponent, INSTALLSTATE *pdwState)
 {
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     BOOL found;
     DWORD sz;
 
@@ -2180,7 +2170,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
     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);
@@ -2199,7 +2189,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
     *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)
@@ -2210,7 +2200,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
         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;
@@ -2793,10 +2783,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};
-    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;
-    LPWSTR path = NULL;
     INSTALLSTATE state;
     DWORD version;
 
@@ -2806,8 +2794,7 @@ static INSTALLSTATE MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent,
     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;
@@ -2815,7 +2802,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)
     {
-        path = msi_reg_get_val_str(hkey, squished_pc);
+        path = msi_reg_get_val_str( hkey, squashed_pc );
         RegCloseKey(hkey);
 
         state = INSTALLSTATE_ABSENT;
@@ -2845,7 +2832,7 @@ static INSTALLSTATE MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent,
             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;
@@ -3535,8 +3522,7 @@ static USERINFOSTATE MSI_GetUserInfo(LPCWSTR szProduct,
                 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;
@@ -3546,7 +3532,7 @@ static USERINFOSTATE MSI_GetUserInfo(LPCWSTR szProduct,
           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,
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 8e7b592..ce1eb6d 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -713,7 +713,7 @@ typedef struct tagMSISCRIPT
 #define MSI_BUILDNUMBER 6001
 
 #define GUID_SIZE 39
-#define SQUISH_GUID_SIZE 33
+#define SQUASHED_GUID_SIZE 33
 
 #define MSIHANDLE_MAGIC 0x4d434923
 
diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index 8e6f0a1..01d8ba7 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -491,24 +491,23 @@ UINT MSIREG_DeleteUninstallKey(const WCHAR *product, enum platform platform)
 
 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;
-    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);
-        strcatW(keypath, squished_pc);
+        strcatW( keypath, squashed_pc );
     }
     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
     {
         root = HKEY_CURRENT_USER;
         strcpyW(keypath, szUserProducts);
-        strcatW(keypath, squished_pc);
+        strcatW( keypath, squashed_pc );
     }
     else
     {
@@ -521,7 +520,7 @@ UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTE
             }
             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);
@@ -530,25 +529,25 @@ UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTE
 
 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);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_pc );
     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);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_pc );
 
     if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key);
     return RegOpenKeyW(HKEY_CURRENT_USER, keypath, key);
@@ -559,21 +558,21 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONT
 {
     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);
-        strcatW(keypath, squished_pc);
+        strcatW( keypath, squashed_pc );
     }
     else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
     {
         root = HKEY_CURRENT_USER;
         strcpyW(keypath, szUserFeatures);
-        strcatW(keypath, squished_pc);
+        strcatW( keypath, squashed_pc );
     }
     else
     {
@@ -586,7 +585,7 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONT
             }
             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);
@@ -595,26 +594,26 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONT
 
 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);
-    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;
-    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);
-    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);
@@ -624,14 +623,14 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS
                                     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)
     {
-        sprintfW(keypath, szUserDataFeatures_fmt, szLocalSid, squished_pc);
+        sprintfW( keypath, szUserDataFeatures_fmt, szLocalSid, squashed_pc );
     }
     else
     {
@@ -644,7 +643,7 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS
             }
             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);
@@ -653,32 +652,31 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS
 
 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;
 
-    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);
-    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);
-    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;
-    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)
     {
@@ -687,11 +685,11 @@ UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKE
             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
-        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);
@@ -700,13 +698,12 @@ UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKE
 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;
 
-    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)
     {
@@ -722,7 +719,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;
-    r = RegDeleteTreeW(hkey, comp);
+    r = RegDeleteTreeW( hkey, squashed_comp );
     RegCloseKey(hkey);
     return r;
 }
@@ -730,16 +727,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;
-    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)
-        sprintfW(keypath, szUserDataProd_fmt, szLocalSid, squished_pc);
+        sprintfW( keypath, szUserDataProd_fmt, szLocalSid, squashed_pc );
     else if (szUserSid)
-        sprintfW(keypath, szUserDataProd_fmt, szUserSid, squished_pc);
+        sprintfW( keypath, szUserDataProd_fmt, szUserSid, squashed_pc );
     else
     {
         if (!(usersid = get_user_sid()))
@@ -747,7 +743,7 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex
             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);
@@ -757,14 +753,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;
-    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)
-        sprintfW(keypath, szUserDataPatch_fmt, szLocalSid, squished_patch);
+        sprintfW( keypath, szUserDataPatch_fmt, szLocalSid, squashed_patch );
     else
     {
         if (!(usersid = get_user_sid()))
@@ -772,7 +767,7 @@ UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, H
             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);
@@ -782,13 +777,12 @@ UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, H
 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;
 
-    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);
@@ -803,7 +797,7 @@ UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context)
         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;
 }
@@ -811,14 +805,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;
-    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)
-        sprintfW(keypath, szUserDataProductPatches_fmt, szLocalSid, squished_product);
+        sprintfW( keypath, szUserDataProductPatches_fmt, szLocalSid, squashed_product );
     else
     {
         if (!(usersid = get_user_sid()))
@@ -826,7 +819,7 @@ UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT con
             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);
@@ -835,17 +828,16 @@ UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT con
 
 UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPCWSTR szUserSid, HKEY *key, BOOL create)
 {
-    LPWSTR usersid;
     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)
-        sprintfW(keypath, szInstallProperties_fmt, szLocalSid, squished_pc);
+        sprintfW( keypath, szInstallProperties_fmt, szLocalSid, squashed_pc );
     else if (szUserSid)
-        sprintfW(keypath, szInstallProperties_fmt, szUserSid, squished_pc);
+        sprintfW( keypath, szInstallProperties_fmt, szUserSid, squashed_pc );
     else
     {
         if (!(usersid = get_user_sid()))
@@ -853,7 +845,7 @@ UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPC
             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);
@@ -863,13 +855,12 @@ UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPC
 UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct)
 {
     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;
 
-    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()))
     {
@@ -880,7 +871,7 @@ UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct)
     LocalFree(usersid);
 
     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;
 }
@@ -888,15 +879,15 @@ UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct)
 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;
 
-    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;
-    r = RegDeleteTreeW(hkey, squished_pc);
+    r = RegDeleteTreeW( hkey, squashed_pc );
     RegCloseKey(hkey);
     return r;
 }
@@ -904,12 +895,12 @@ UINT MSIREG_DeleteProductKey(LPCWSTR szProduct)
 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);
@@ -918,13 +909,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;
-    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);
-    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);
@@ -932,13 +923,13 @@ UINT MSIREG_OpenUpgradeCodesKey(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);
-    strcatW(keypath, squished_pc);
+    strcatW( keypath, squashed_uc );
 
     if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key);
     return RegOpenKeyW(HKEY_CURRENT_USER, keypath, key);
@@ -946,28 +937,28 @@ UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL creat
 
 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);
-    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;
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     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;
-    r = RegDeleteTreeW(hkey, squished_pc);
+    r = RegDeleteTreeW( hkey, squashed_pc );
     RegCloseKey(hkey);
     return r;
 }
@@ -975,15 +966,15 @@ UINT MSIREG_DeleteLocalClassesProductKey(LPCWSTR szProductCode)
 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;
 
-    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;
-    r = RegDeleteTreeW(hkey, squished_pc);
+    r = RegDeleteTreeW( hkey, squashed_pc );
     RegCloseKey(hkey);
     return r;
 }
@@ -991,13 +982,13 @@ UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode)
 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);
-    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);
@@ -1006,15 +997,15 @@ UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL cr
 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;
 
-    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;
-    r = RegDeleteTreeW(hkey, squished_pc);
+    r = RegDeleteTreeW( hkey, squashed_uc );
     RegCloseKey(hkey);
     return r;
 }
@@ -1276,7 +1267,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;
-    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;
@@ -1325,7 +1316,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;
-    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;
@@ -1486,7 +1477,7 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct)
 {
     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);
 
@@ -1498,7 +1489,7 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct)
         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)
     {
@@ -1510,7 +1501,7 @@ UINT WINAPI MsiEnumClientsW(LPCWSTR szComponent, DWORD index, LPWSTR szProduct)
         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 )
     {
@@ -1695,8 +1686,8 @@ UINT WINAPI MsiEnumRelatedProductsW(LPCWSTR szUpgradeCode, DWORD dwReserved,
 {
     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);
@@ -2107,7 +2098,7 @@ UINT WINAPI MsiEnumPatchesExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
         LPWSTR szTargetProductCode, MSIINSTALLCONTEXT *pdwTargetProductContext,
         LPWSTR szTargetUserSid, LPDWORD pcchTargetUserSid)
 {
-    WCHAR squished_pc[GUID_SIZE];
+    WCHAR squashed_pc[SQUASHED_GUID_SIZE];
     DWORD idx = 0;
     UINT r;
 
@@ -2118,7 +2109,7 @@ UINT WINAPI MsiEnumPatchesExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
           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 ))
@@ -2214,8 +2205,7 @@ done:
 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;
@@ -2223,7 +2213,7 @@ UINT WINAPI MsiEnumPatchesW(LPCWSTR szProduct, DWORD iPatchIndex,
     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)
@@ -2304,7 +2294,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;
-    WCHAR product[GUID_SIZE];
+    WCHAR product[SQUASHED_GUID_SIZE];
     DWORD i = 0, len;
     REGSAM access = KEY_ENUMERATE_SUB_KEYS | KEY_WOW64_64KEY;
     HKEY key;
@@ -2365,7 +2355,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;
-    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;
diff --git a/dlls/msi/source.c b/dlls/msi/source.c
index 8f5d165..68bf9d0 100644
--- a/dlls/msi/source.c
+++ b/dlls/msi/source.c
@@ -208,27 +208,20 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
                                          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;
-    DWORD valuesz, datasz = 0;
-    DWORD type;
-    DWORD numvals, size;
+    DWORD valuesz, datasz = 0, type, numvals, size;
     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);
 
-    if (!szProductCodeOrPatchCode ||
-        !squash_guid(szProductCodeOrPatchCode, squished_pc))
+    if (!szProductCodeOrPatchCode || !squash_guid( szProductCodeOrPatchCode, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
@@ -246,8 +239,7 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
     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;
 
@@ -420,23 +412,20 @@ UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR szProductCodeOrPatch, LPCWSTR szUs
                                       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;
 
-    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;
 
-    if (!szProductCodeOrPatch || !squash_guid(szProductCodeOrPatch, squished_pc))
+    if (!szProductCodeOrPatch || !squash_guid( szProductCodeOrPatch, squashed_pc ))
         goto done;
 
     if (szSource && !pcchSource)
@@ -454,8 +443,7 @@ UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR szProductCodeOrPatch, LPCWSTR szUs
     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;
 
@@ -551,18 +539,15 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
                                    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;
-    LPWSTR source, ptr;
     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));
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (szValue && !pcchValue)
@@ -778,19 +763,16 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
                                    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;
 
-    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));
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (!szProperty)
@@ -862,12 +844,9 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
 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;
-    LPWSTR sidstr = NULL;
-    DWORD sidsize = 0;
-    DWORD domsize = 0;
-    DWORD context;
+    DWORD sidsize = 0, domsize = 0, context;
     HKEY hkey = 0;
     UINT r;
 
@@ -879,7 +858,7 @@ UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName,
     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)
@@ -1073,24 +1052,19 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
         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;
-    WCHAR squished_pc[GUID_SIZE];
-    WCHAR name[10];
-    LPWSTR source;
+    WCHAR *source, squashed_pc[SQUASHED_GUID_SIZE], name[10];
     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);
 
-    if (!szProduct || !squash_guid(szProduct, squished_pc))
+    if (!szProduct || !squash_guid( szProduct, squashed_pc ))
         return ERROR_INVALID_PARAMETER;
 
     if (!szSource || !*szSource)
@@ -1232,21 +1206,17 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid,
         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;
-    WCHAR szIndex[10];
-    WCHAR squished_pc[GUID_SIZE];
-    LPWSTR buffer;
+    WCHAR *buffer, squashed_pc[SQUASHED_GUID_SIZE], szIndex[10];
     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));
 
-    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)
diff --git a/dlls/msi/upgrade.c b/dlls/msi/upgrade.c
index cd0ec06..369e8f5 100644
--- a/dlls/msi/upgrade.c
+++ b/dlls/msi/upgrade.c
@@ -102,10 +102,8 @@ static void append_productcode(MSIPACKAGE* package, LPCWSTR action_property,
 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;
-- 
2.1.4




More information about the wine-patches mailing list