Commit 2b0d2ec5 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Use exact size for squashed GUID buffers.

parent 6eae0877
......@@ -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;
......
......@@ -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
......
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment