return ERROR_SUCCESS;
}
+static UINT msi_set_context(MSIPACKAGE *package)
+{
+ WCHAR val[10];
+ DWORD sz = 10;
+ DWORD num;
+ UINT r;
+
+ static const WCHAR szOne[] = {'1',0};
+ static const WCHAR szAllUsers[] = {'A','L','L','U','S','E','R','S',0};
+
+ package->Context = MSIINSTALLCONTEXT_USERUNMANAGED;
+
+ r = MSI_GetPropertyW(package, szAllUsers, val, &sz);
+ if (r == ERROR_SUCCESS)
+ {
+ num = atolW(val);
+ if (num == 1 || num == 2)
+ package->Context = MSIINSTALLCONTEXT_MACHINE;
+ }
+
+ MSI_SetPropertyW(package, szAllUsers, szOne);
+ return ERROR_SUCCESS;
+}
+
/****************************************************
* TOP level entry points
*****************************************************/
/* properties may have been added by a transform */
msi_clone_properties( package );
+ msi_set_context( package );
if ( (msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) >= INSTALLUILEVEL_REDUCED )
{
file->IsCompressed = package->WordCount & MSIWORDCOUNT_COMPRESSED;
}
+ if (!file->IsCompressed)
+ {
+ LPWSTR p, path;
+
+ p = resolve_folder(package, file->Component->Directory,
+ TRUE, FALSE, TRUE, NULL);
+ path = build_directory_name(2, p, file->ShortName);
+
+ if (file->LongName &&
+ GetFileAttributesW(path) == INVALID_FILE_ATTRIBUTES)
+ {
+ msi_free(path);
+ path = build_directory_name(2, p, file->LongName);
+ }
+
+ file->SourcePath = path;
+ msi_free(p);
+ }
+
load_file_hash(package, file);
TRACE("File Loaded (%s)\n",debugstr_w(file->File));
MSI_SetPropertyW(package, szCosting, szZero);
MSI_SetPropertyW(package, cszRootDrive, c_colon);
+ load_all_folders( package );
load_all_components( package );
load_all_features( package );
load_all_files( package );
- load_all_folders( package );
return ERROR_SUCCESS;
}
* 9) FILEADDLOCAL
* 10) FILEADDSOURCE
* 11) FILEADDDEFAULT
- * I have confirmed that if ADDLOCAL is stated then the INSTALLLEVEL is
- * ignored for all the features. seems strange, especially since it is not
- * documented anywhere, but it is how it works.
*
* I am still ignoring a lot of these. But that is ok for now, ADDLOCAL and
* REMOVE are the big ones, since we don't handle administrative installs
{
ComponentList *cl;
- TRACE("Examining Feature %s (Installed %i, Action %i)\n",
- debugstr_w(feature->Feature), feature->Installed, feature->Action);
+ TRACE("Examining Feature %s (Level %i, Installed %i, Action %i)\n",
+ debugstr_w(feature->Feature), feature->Level, feature->Installed, feature->Action);
+
+ if (!feature->Level)
+ continue;
/* features with components that have compressed files are made local */
LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
{
static const WCHAR name_fmt[] =
{'%','u','.','%','u','.','%','u','.','%','u',0};
- static WCHAR name[] = {'\\',0};
+ static const WCHAR name[] = {'\\',0};
VS_FIXEDFILEINFO *lpVer;
WCHAR filever[0x100];
LPVOID version;
WCHAR squished_cc[GUID_SIZE];
UINT rc;
MSICOMPONENT *comp;
- HKEY hkey=0,hkey2=0;
+ HKEY hkey;
TRACE("\n");
- /* writes the Component and Features values to the registry */
-
- rc = MSIREG_OpenComponents(&hkey);
- if (rc != ERROR_SUCCESS)
- return rc;
+ /* writes the Component values to the registry */
squash_guid(package->ProductCode,squished_pc);
ui_progress(package,1,COMPONENT_PROGRESS_VALUE,1,0);
*/
if (ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL))
{
- rc = RegCreateKeyW(hkey,squished_cc,&hkey2);
- if (rc != ERROR_SUCCESS)
- continue;
-
if (!comp->FullKeypath)
continue;
- msi_reg_set_val_str( hkey2, squished_pc, comp->FullKeypath );
+ if (package->Context == MSIINSTALLCONTEXT_MACHINE)
+ rc = MSIREG_OpenLocalUserDataComponentKey(comp->ComponentId, &hkey, TRUE);
+ else
+ rc = MSIREG_OpenUserDataComponentKey(comp->ComponentId, &hkey, TRUE);
+
+ if (rc != ERROR_SUCCESS)
+ continue;
if (comp->Attributes & msidbComponentAttributesPermanent)
{
'0','0','0','0','0','0','0','0','0','0','0','0',
'0','0','0','0','0','0','0','0',0 };
- msi_reg_set_val_str( hkey2, szPermKey, comp->FullKeypath );
+ msi_reg_set_val_str(hkey, szPermKey, comp->FullKeypath);
}
- RegCloseKey(hkey2);
-
- rc = MSIREG_OpenUserDataComponentKey(comp->ComponentId, &hkey2, TRUE);
- if (rc != ERROR_SUCCESS)
- continue;
-
- msi_reg_set_val_str(hkey2, squished_pc, comp->FullKeypath);
- RegCloseKey(hkey2);
+ msi_reg_set_val_str(hkey, squished_pc, comp->FullKeypath);
+ RegCloseKey(hkey);
}
- else if (ACTION_VerifyComponentForAction( comp, INSTALLSTATE_ABSENT))
+ else if (ACTION_VerifyComponentForAction(comp, INSTALLSTATE_ABSENT))
{
- DWORD res;
-
- rc = RegOpenKeyW(hkey,squished_cc,&hkey2);
- if (rc != ERROR_SUCCESS)
- continue;
-
- RegDeleteValueW(hkey2,squished_pc);
-
- /* if the key is empty delete it */
- res = RegEnumKeyExW(hkey2,0,NULL,0,0,NULL,0,NULL);
- RegCloseKey(hkey2);
- if (res == ERROR_NO_MORE_ITEMS)
- RegDeleteKeyW(hkey,squished_cc);
-
- MSIREG_DeleteUserDataComponentKey(comp->ComponentId);
+ if (package->Context == MSIINSTALLCONTEXT_MACHINE)
+ MSIREG_DeleteLocalUserDataComponentKey(comp->ComponentId);
+ else
+ MSIREG_DeleteUserDataComponentKey(comp->ComponentId);
}
/* UI stuff */
ui_actiondata(package,szProcessComponents,uirow);
msiobj_release( &uirow->hdr );
}
- RegCloseKey(hkey);
- return rc;
+
+ return ERROR_SUCCESS;
}
typedef struct {
return rc;
}
-static UINT ITERATE_PublishProduct(MSIRECORD *row, LPVOID param)
+static UINT ITERATE_PublishIcon(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE* package = (MSIPACKAGE*)param;
HANDLE the_file;
return ERROR_SUCCESS;
}
+static UINT msi_publish_icons(MSIPACKAGE *package)
+{
+ UINT r;
+ MSIQUERY *view;
+
+ static const WCHAR query[]= {
+ 'S','E','L','E','C','T',' ','*',' ',
+ 'F','R','O','M',' ','`','I','c','o','n','`',0};
+
+ r = MSI_DatabaseOpenViewW(package->db, query, &view);
+ if (r == ERROR_SUCCESS)
+ {
+ MSI_IterateRecords(view, NULL, ITERATE_PublishIcon, package);
+ msiobj_release(&view->hdr);
+ }
+
+ return ERROR_SUCCESS;
+}
+
+static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey)
+{
+ UINT r;
+ HKEY source;
+ LPWSTR buffer;
+ MSIMEDIADISK *disk;
+ MSISOURCELISTINFO *info;
+
+ static const WCHAR szEmpty[] = {0};
+ static const WCHAR szSourceList[] = {'S','o','u','r','c','e','L','i','s','t',0};
+
+ r = RegCreateKeyW(hkey, szSourceList, &source);
+ if (r != ERROR_SUCCESS)
+ return r;
+
+ RegCloseKey(source);
+
+ buffer = strrchrW(package->PackagePath, '\\') + 1;
+ r = MsiSourceListSetInfoW(package->ProductCode, NULL,
+ package->Context, MSICODE_PRODUCT,
+ INSTALLPROPERTY_PACKAGENAMEW, buffer);
+ if (r != ERROR_SUCCESS)
+ return r;
+
+ r = MsiSourceListSetInfoW(package->ProductCode, NULL,
+ package->Context, MSICODE_PRODUCT,
+ INSTALLPROPERTY_MEDIAPACKAGEPATHW, szEmpty);
+ if (r != ERROR_SUCCESS)
+ return r;
+
+ r = MsiSourceListSetInfoW(package->ProductCode, NULL,
+ package->Context, MSICODE_PRODUCT,
+ INSTALLPROPERTY_DISKPROMPTW, szEmpty);
+ if (r != ERROR_SUCCESS)
+ return r;
+
+ LIST_FOR_EACH_ENTRY(info, &package->sourcelist_info, MSISOURCELISTINFO, entry)
+ {
+ if (!lstrcmpW(info->property, INSTALLPROPERTY_LASTUSEDSOURCEW))
+ msi_set_last_used_source(package->ProductCode, NULL, info->context,
+ info->options, info->value);
+ else
+ MsiSourceListSetInfoW(package->ProductCode, NULL,
+ info->context, info->options,
+ info->property, info->value);
+ }
+
+ LIST_FOR_EACH_ENTRY(disk, &package->sourcelist_media, MSIMEDIADISK, entry)
+ {
+ MsiSourceListAddMediaDiskW(package->ProductCode, NULL,
+ disk->context, disk->options,
+ disk->disk_id, disk->volume_label, disk->disk_prompt);
+ }
+
+ return ERROR_SUCCESS;
+}
+
+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 szProductLanguage[] =
+ {'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0};
+ static const WCHAR szARPProductIcon[] =
+ {'A','R','P','P','R','O','D','U','C','T','I','C','O','N',0};
+ static const WCHAR szProductVersion[] =
+ {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0};
+ static const WCHAR szAssignment[] =
+ {'A','s','s','i','g','n','m','e','n','t',0};
+ static const WCHAR szAdvertiseFlags[] =
+ {'A','d','v','e','r','t','i','s','e','F','l','a','g','s',0};
+ static const WCHAR szClients[] =
+ {'C','l','i','e','n','t','s',0};
+ static const WCHAR szColon[] = {':',0};
+
+ buffer = msi_dup_property(package, INSTALLPROPERTY_PRODUCTNAMEW);
+ msi_reg_set_val_str(hkey, INSTALLPROPERTY_PRODUCTNAMEW, buffer);
+ msi_free(buffer);
+
+ langid = msi_get_property_int(package, szProductLanguage, 0);
+ msi_reg_set_val_dword(hkey, INSTALLPROPERTY_LANGUAGEW, langid);
+
+ ptr = strrchrW(package->PackagePath, '\\' ) + 1;
+ msi_reg_set_val_str(hkey, INSTALLPROPERTY_PACKAGENAMEW, ptr);
+
+ /* FIXME */
+ msi_reg_set_val_dword(hkey, INSTALLPROPERTY_AUTHORIZED_LUA_APPW, 0);
+
+ buffer = msi_dup_property(package, szARPProductIcon);
+ if (buffer)
+ {
+ LPWSTR path = build_icon_path(package,buffer);
+ msi_reg_set_val_str(hkey, INSTALLPROPERTY_PRODUCTICONW, path);
+ msi_free(path);
+ msi_free(buffer);
+ }
+
+ buffer = msi_dup_property(package, szProductVersion);
+ if (buffer)
+ {
+ DWORD verdword = msi_version_str_to_dword(buffer);
+ msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONW, verdword);
+ msi_free(buffer);
+ }
+
+ msi_reg_set_val_dword(hkey, szAssignment, 0);
+ msi_reg_set_val_dword(hkey, szAdvertiseFlags, 0x184);
+ msi_reg_set_val_dword(hkey, INSTALLPROPERTY_INSTANCETYPEW, 0);
+ msi_reg_set_val_str(hkey, szClients, szColon);
+
+ hdb = alloc_msihandle(&package->db->hdr);
+ if (!hdb)
+ return ERROR_NOT_ENOUGH_MEMORY;
+
+ r = MsiGetSummaryInformationW(hdb, NULL, 0, &suminfo);
+ MsiCloseHandle(hdb);
+ if (r != ERROR_SUCCESS)
+ goto done;
+
+ size = MAX_PATH;
+ r = MsiSummaryInfoGetPropertyW(suminfo, PID_REVNUMBER, NULL, NULL,
+ NULL, guids, &size);
+ if (r != ERROR_SUCCESS)
+ goto done;
+
+ ptr = strchrW(guids, ';');
+ if (ptr) *ptr = 0;
+ squash_guid(guids, packcode);
+ msi_reg_set_val_str(hkey, INSTALLPROPERTY_PACKAGECODEW, packcode);
+
+done:
+ MsiCloseHandle(suminfo);
+ return ERROR_SUCCESS;
+}
+
+static UINT msi_publish_upgrade_code(MSIPACKAGE *package)
+{
+ UINT r;
+ HKEY hkey;
+ LPWSTR upgrade;
+ WCHAR squashed_pc[SQUISH_GUID_SIZE];
+
+ static const WCHAR szUpgradeCode[] =
+ {'U','p','g','r','a','d','e','C','o','d','e',0};
+
+ upgrade = msi_dup_property(package, szUpgradeCode);
+ if (!upgrade)
+ return ERROR_SUCCESS;
+
+ if (package->Context == MSIINSTALLCONTEXT_MACHINE)
+ {
+ r = MSIREG_OpenClassesUpgradeCodesKey(upgrade, &hkey, TRUE);
+ if (r != ERROR_SUCCESS)
+ goto done;
+ }
+ else
+ {
+ r = MSIREG_OpenUserUpgradeCodesKey(upgrade, &hkey, TRUE);
+ if (r != ERROR_SUCCESS)
+ goto done;
+ }
+
+ squash_guid(package->ProductCode, squashed_pc);
+ msi_reg_set_val_str(hkey, squashed_pc, NULL);
+
+ RegCloseKey(hkey);
+
+done:
+ msi_free(upgrade);
+ return r;
+}
+
static BOOL msi_check_publish(MSIPACKAGE *package)
{
MSIFEATURE *feature;
return FALSE;
}
+static BOOL msi_check_unpublish(MSIPACKAGE *package)
+{
+ MSIFEATURE *feature;
+
+ LIST_FOR_EACH_ENTRY(feature, &package->features, MSIFEATURE, entry)
+ {
+ if (feature->ActionRequest != INSTALLSTATE_ABSENT)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/*
* 99% of the work done here is only done for
* advertised installs. However this is where the
static UINT ACTION_PublishProduct(MSIPACKAGE *package)
{
UINT rc;
- LPWSTR packname;
- MSIQUERY * view;
- MSISOURCELISTINFO *info;
- MSIMEDIADISK *disk;
- static const WCHAR Query[]=
- {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
- '`','I','c','o','n','`',0};
- /* for registry stuff */
- HKEY hkey=0;
HKEY hukey=0;
- HKEY hudkey=0, props=0;
- HKEY source;
- static const WCHAR szProductLanguage[] =
- {'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0};
- static const WCHAR szARPProductIcon[] =
- {'A','R','P','P','R','O','D','U','C','T','I','C','O','N',0};
- static const WCHAR szProductVersion[] =
- {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0};
- static const WCHAR szSourceList[] =
- {'S','o','u','r','c','e','L','i','s','t',0};
- static const WCHAR szEmpty[] = {0};
- DWORD langid;
- LPWSTR buffer;
- DWORD size;
- MSIHANDLE hDb, hSumInfo;
+ HKEY hudkey=0;
/* FIXME: also need to publish if the product is in advertise mode */
if (!msi_check_publish(package))
return ERROR_SUCCESS;
- /* write out icon files */
-
- rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
- if (rc == ERROR_SUCCESS)
- {
- MSI_IterateRecords(view, NULL, ITERATE_PublishProduct, package);
- msiobj_release(&view->hdr);
- }
-
- /* ok there is a lot more done here but i need to figure out what */
-
if (package->Context == MSIINSTALLCONTEXT_MACHINE)
{
rc = MSIREG_OpenLocalClassesProductKey(package->ProductCode, &hukey, TRUE);
if (rc != ERROR_SUCCESS)
goto end;
- rc = MSIREG_OpenLocalSystemInstallProps(package->ProductCode, &props, TRUE);
+ rc = MSIREG_OpenLocalUserDataProductKey(package->ProductCode, &hudkey, TRUE);
if (rc != ERROR_SUCCESS)
goto end;
}
else
{
- rc = MSIREG_OpenProductsKey(package->ProductCode,&hkey,TRUE);
+ rc = MSIREG_OpenUserProductsKey(package->ProductCode, &hukey, TRUE);
if (rc != ERROR_SUCCESS)
goto end;
- rc = MSIREG_OpenUserProductsKey(package->ProductCode,&hukey,TRUE);
+ rc = MSIREG_OpenUserDataProductKey(package->ProductCode, &hudkey, TRUE);
if (rc != ERROR_SUCCESS)
goto end;
-
- rc = MSIREG_OpenCurrentUserInstallProps(package->ProductCode, &props, TRUE);
- if (rc != ERROR_SUCCESS)
- goto end;
- }
-
- rc = RegCreateKeyW(hukey, szSourceList, &source);
- if (rc != ERROR_SUCCESS)
- goto end;
-
- RegCloseKey(source);
-
- rc = MSIREG_OpenUserDataProductKey(package->ProductCode,&hudkey,TRUE);
- if (rc != ERROR_SUCCESS)
- goto end;
-
- buffer = msi_dup_property( package, INSTALLPROPERTY_PRODUCTNAMEW );
- msi_reg_set_val_str( hukey, INSTALLPROPERTY_PRODUCTNAMEW, buffer );
- msi_free(buffer);
-
- langid = msi_get_property_int( package, szProductLanguage, 0 );
- msi_reg_set_val_dword( hukey, INSTALLPROPERTY_LANGUAGEW, langid );
-
- packname = strrchrW( package->PackagePath, '\\' ) + 1;
- msi_reg_set_val_str( hukey, INSTALLPROPERTY_PACKAGENAMEW, packname );
-
- /* FIXME */
- msi_reg_set_val_dword( hukey, INSTALLPROPERTY_AUTHORIZED_LUA_APPW, 0 );
- msi_reg_set_val_dword( props, INSTALLPROPERTY_INSTANCETYPEW, 0 );
-
- buffer = msi_dup_property( package, szARPProductIcon );
- if (buffer)
- {
- LPWSTR path = build_icon_path(package,buffer);
- msi_reg_set_val_str( hukey, INSTALLPROPERTY_PRODUCTICONW, path );
- msi_free( path );
- }
- msi_free(buffer);
-
- buffer = msi_dup_property( package, szProductVersion );
- if (buffer)
- {
- DWORD verdword = msi_version_str_to_dword(buffer);
- msi_reg_set_val_dword( hukey, INSTALLPROPERTY_VERSIONW, verdword );
}
- msi_free(buffer);
- buffer = strrchrW( package->PackagePath, '\\') + 1;
- rc = MsiSourceListSetInfoW( package->ProductCode, NULL,
- package->Context, MSICODE_PRODUCT,
- INSTALLPROPERTY_PACKAGENAMEW, buffer );
+ rc = msi_publish_upgrade_code(package);
if (rc != ERROR_SUCCESS)
goto end;
- rc = MsiSourceListSetInfoW( package->ProductCode, NULL,
- package->Context, MSICODE_PRODUCT,
- INSTALLPROPERTY_MEDIAPACKAGEPATHW, szEmpty );
+ rc = msi_publish_product_properties(package, hukey);
if (rc != ERROR_SUCCESS)
goto end;
- rc = MsiSourceListSetInfoW( package->ProductCode, NULL,
- package->Context, MSICODE_PRODUCT,
- INSTALLPROPERTY_DISKPROMPTW, szEmpty );
+ rc = msi_publish_sourcelist(package, hukey);
if (rc != ERROR_SUCCESS)
goto end;
- /* FIXME: Need to write more keys to the user registry */
-
- hDb= alloc_msihandle( &package->db->hdr );
- if (!hDb) {
- rc = ERROR_NOT_ENOUGH_MEMORY;
- goto end;
- }
- rc = MsiGetSummaryInformationW(hDb, NULL, 0, &hSumInfo);
- MsiCloseHandle(hDb);
- if (rc == ERROR_SUCCESS)
- {
- WCHAR guidbuffer[0x200];
- size = 0x200;
- rc = MsiSummaryInfoGetPropertyW(hSumInfo, 9, NULL, NULL, NULL,
- guidbuffer, &size);
- if (rc == ERROR_SUCCESS)
- {
- /* for now we only care about the first guid */
- LPWSTR ptr = strchrW(guidbuffer,';');
- if (ptr) *ptr = 0;
- msi_reg_set_val_str( hukey, INSTALLPROPERTY_PACKAGECODEW, guidbuffer );
- }
- else
- {
- ERR("Unable to query Revision_Number...\n");
- rc = ERROR_SUCCESS;
- }
- MsiCloseHandle(hSumInfo);
- }
- else
- {
- ERR("Unable to open Summary Information\n");
- rc = ERROR_SUCCESS;
- }
-
- /* publish the SourceList info */
- LIST_FOR_EACH_ENTRY(info, &package->sourcelist_info, MSISOURCELISTINFO, entry)
- {
- if (!lstrcmpW(info->property, INSTALLPROPERTY_LASTUSEDSOURCEW))
- msi_set_last_used_source(package->ProductCode, NULL, info->context,
- info->options, info->value);
- else
- MsiSourceListSetInfoW(package->ProductCode, NULL,
- info->context, info->options,
- info->property, info->value);
- }
-
- LIST_FOR_EACH_ENTRY(disk, &package->sourcelist_media, MSIMEDIADISK, entry)
- {
- MsiSourceListAddMediaDiskW(package->ProductCode, NULL,
- disk->context, disk->options,
- disk->disk_id, disk->volume_label, disk->disk_prompt);
- }
+ rc = msi_publish_icons(package);
end:
- RegCloseKey(hkey);
RegCloseKey(hukey);
RegCloseKey(hudkey);
- RegCloseKey(props);
return rc;
}
{
MSIFEATURE *feature;
UINT rc;
- HKEY hkey=0;
- HKEY hukey=0;
- HKEY userdata=0;
+ HKEY hkey;
+ HKEY userdata;
if (!msi_check_publish(package))
return ERROR_SUCCESS;
- rc = MSIREG_OpenFeaturesKey(package->ProductCode,&hkey,TRUE);
- if (rc != ERROR_SUCCESS)
- goto end;
+ if (package->Context == MSIINSTALLCONTEXT_MACHINE)
+ {
+ rc = MSIREG_OpenLocalClassesFeaturesKey(package->ProductCode,
+ &hkey, TRUE);
+ if (rc != ERROR_SUCCESS)
+ goto end;
- rc = MSIREG_OpenUserFeaturesKey(package->ProductCode,&hukey,TRUE);
- if (rc != ERROR_SUCCESS)
- goto end;
+ rc = MSIREG_OpenLocalUserDataFeaturesKey(package->ProductCode,
+ &userdata, TRUE);
+ if (rc != ERROR_SUCCESS)
+ goto end;
+ }
+ else
+ {
+ rc = MSIREG_OpenUserFeaturesKey(package->ProductCode, &hkey, TRUE);
+ if (rc != ERROR_SUCCESS)
+ goto end;
- rc = MSIREG_OpenUserDataFeaturesKey(package->ProductCode, &userdata, TRUE);
- if (rc != ERROR_SUCCESS)
- goto end;
+ rc = MSIREG_OpenUserDataFeaturesKey(package->ProductCode,
+ &userdata, TRUE);
+ if (rc != ERROR_SUCCESS)
+ goto end;
+ }
/* here the guids are base 85 encoded */
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
strcatW(data,feature->Feature_Parent);
}
- msi_reg_set_val_str( hkey, feature->Feature, data );
msi_reg_set_val_str( userdata, feature->Feature, data );
msi_free(data);
{
static const WCHAR emptyW[] = {0};
size += sizeof(WCHAR);
- RegSetValueExW(hukey,feature->Feature,0,REG_SZ,
+ RegSetValueExW(hkey,feature->Feature,0,REG_SZ,
(LPBYTE)(feature->Feature_Parent ? feature->Feature_Parent : emptyW),size);
}
else
data[1] = 0;
if (feature->Feature_Parent)
strcpyW( &data[1], feature->Feature_Parent );
- RegSetValueExW(hukey,feature->Feature,0,REG_SZ,
+ RegSetValueExW(hkey,feature->Feature,0,REG_SZ,
(LPBYTE)data,size);
msi_free(data);
}
end:
RegCloseKey(hkey);
- RegCloseKey(hukey);
+ RegCloseKey(userdata);
return rc;
}
return ERROR_SUCCESS;
}
-static BOOL msi_check_unpublish(MSIPACKAGE *package)
-{
- MSIFEATURE *feature;
-
- LIST_FOR_EACH_ENTRY(feature, &package->features, MSIFEATURE, entry)
- {
- if (feature->ActionRequest != INSTALLSTATE_ABSENT)
- return FALSE;
- }
-
- return TRUE;
-}
-
static UINT ACTION_UnpublishFeatures(MSIPACKAGE *package)
{
MSIFEATURE *feature;
static UINT msi_make_package_local( MSIPACKAGE *package, HKEY hkey )
{
WCHAR packagefile[MAX_PATH];
- HKEY props;
UINT r;
r = msi_get_local_package_name( packagefile );
msi_reg_set_val_str( hkey, INSTALLPROPERTY_LOCALPACKAGEW, packagefile );
- r = MSIREG_OpenCurrentUserInstallProps(package->ProductCode, &props, TRUE);
- if (r != ERROR_SUCCESS)
- return r;
-
- msi_reg_set_val_str(props, INSTALLPROPERTY_LOCALPACKAGEW, packagefile);
- RegCloseKey(props);
return ERROR_SUCCESS;
}
-static UINT msi_write_uninstall_property_vals( MSIPACKAGE *package, HKEY hkey )
+static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey)
{
LPWSTR prop, val, key;
+ SYSTEMTIME systime;
+ DWORD size, langid;
+ WCHAR date[9];
+ LPWSTR buffer;
+
+ static const WCHAR date_fmt[] = {'%','i','%','0','2','i','%','0','2','i',0};
+ static const WCHAR szWindowsInstaller[] =
+ {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
+ static const WCHAR modpath_fmt[] =
+ {'M','s','i','E','x','e','c','.','e','x','e',' ',
+ '/','I','[','P','r','o','d','u','c','t','C','o','d','e',']',0};
+ static const WCHAR szModifyPath[] =
+ {'M','o','d','i','f','y','P','a','t','h',0};
+ static const WCHAR szUninstallString[] =
+ {'U','n','i','n','s','t','a','l','l','S','t','r','i','n','g',0};
+ static const WCHAR szEstimatedSize[] =
+ {'E','s','t','i','m','a','t','e','d','S','i','z','e',0};
+ static const WCHAR szProductLanguage[] =
+ {'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0};
+ static const WCHAR szProductVersion[] =
+ {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0};
+ static const WCHAR szProductName[] =
+ {'P','r','o','d','u','c','t','N','a','m','e',0};
+ static const WCHAR szDisplayName[] =
+ {'D','i','s','p','l','a','y','N','a','m','e',0};
+ static const WCHAR szDisplayVersion[] =
+ {'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0};
+ static const WCHAR szManufacturer[] =
+ {'M','a','n','u','f','a','c','t','u','r','e','r',0};
+
static const LPCSTR propval[] = {
"ARPAUTHORIZEDCDFPREFIX", "AuthorizedCDFPrefix",
"ARPCONTACT", "Contact",
};
const LPCSTR *p = propval;
- while( *p )
+ while (*p)
{
- prop = strdupAtoW( *p++ );
- key = strdupAtoW( *p++ );
- val = msi_dup_property( package, prop );
- msi_reg_set_val_str( hkey, key, val );
+ prop = strdupAtoW(*p++);
+ key = strdupAtoW(*p++);
+ val = msi_dup_property(package, prop);
+ msi_reg_set_val_str(hkey, key, val);
msi_free(val);
msi_free(key);
msi_free(prop);
}
+
+ msi_reg_set_val_dword(hkey, szWindowsInstaller, 1);
+
+ size = deformat_string(package, modpath_fmt, &buffer);
+ RegSetValueExW(hkey, szModifyPath, 0, REG_EXPAND_SZ, (LPBYTE)buffer, size);
+ RegSetValueExW(hkey, szUninstallString, 0, REG_EXPAND_SZ, (LPBYTE)buffer, size);
+ msi_free(buffer);
+
+ /* FIXME: Write real Estimated Size when we have it */
+ msi_reg_set_val_dword(hkey, szEstimatedSize, 0);
+
+ buffer = msi_dup_property(package, szProductName);
+ msi_reg_set_val_str(hkey, szDisplayName, buffer);
+ msi_free(buffer);
+
+ buffer = msi_dup_property(package, cszSourceDir);
+ msi_reg_set_val_str(hkey, INSTALLPROPERTY_INSTALLSOURCEW, buffer);
+ msi_free(buffer);
+
+ buffer = msi_dup_property(package, szManufacturer);
+ msi_reg_set_val_str(hkey, INSTALLPROPERTY_PUBLISHERW, buffer);
+ msi_free(buffer);
+
+ GetLocalTime(&systime);
+ sprintfW(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
+ msi_reg_set_val_str(hkey, INSTALLPROPERTY_INSTALLDATEW, date);
+
+ langid = msi_get_property_int(package, szProductLanguage, 0);
+ msi_reg_set_val_dword(hkey, INSTALLPROPERTY_LANGUAGEW, langid);
+
+ buffer = msi_dup_property(package, szProductVersion);
+ msi_reg_set_val_str(hkey, szDisplayVersion, buffer);
+ if (buffer)
+ {
+ DWORD verdword = msi_version_str_to_dword(buffer);
+
+ msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONW, verdword);
+ msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONMAJORW, verdword >> 24);
+ msi_reg_set_val_dword(hkey, INSTALLPROPERTY_VERSIONMINORW, (verdword >> 16) & 0xFF);
+ msi_free(buffer);
+ }
+
return ERROR_SUCCESS;
}
static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
{
- HKEY hkey=0;
- HKEY hudkey=0, props=0;
- LPWSTR buffer = NULL;
+ WCHAR squashed_pc[SQUISH_GUID_SIZE];
+ LPWSTR upgrade_code;
+ HKEY hkey, props;
+ HKEY upgrade;
UINT rc;
- DWORD size, langid;
- static const WCHAR szWindowsInstaller[] =
- {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
- static const WCHAR szUpgradeCode[] =
- {'U','p','g','r','a','d','e','C','o','d','e',0};
- static const WCHAR modpath_fmt[] =
- {'M','s','i','E','x','e','c','.','e','x','e',' ',
- '/','I','[','P','r','o','d','u','c','t','C','o','d','e',']',0};
- static const WCHAR szModifyPath[] =
- {'M','o','d','i','f','y','P','a','t','h',0};
- static const WCHAR szUninstallString[] =
- {'U','n','i','n','s','t','a','l','l','S','t','r','i','n','g',0};
- static const WCHAR szEstimatedSize[] =
- {'E','s','t','i','m','a','t','e','d','S','i','z','e',0};
- static const WCHAR szProductLanguage[] =
- {'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0};
- static const WCHAR szProductVersion[] =
- {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0};
- static const WCHAR szProductName[] =
- {'P','r','o','d','u','c','t','N','a','m','e',0};
- static const WCHAR szDisplayName[] =
- {'D','i','s','p','l','a','y','N','a','m','e',0};
- static const WCHAR szDisplayVersion[] =
- {'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0};
- static const WCHAR szManufacturer[] =
- {'M','a','n','u','f','a','c','t','u','r','e','r',0};
- SYSTEMTIME systime;
- static const WCHAR date_fmt[] = {'%','i','%','0','2','i','%','0','2','i',0};
- LPWSTR upgrade_code;
- WCHAR szDate[9];
+ static const WCHAR szUpgradeCode[] = {
+ 'U','p','g','r','a','d','e','C','o','d','e',0};
/* FIXME: also need to publish if the product is in advertise mode */
if (!msi_check_publish(package))
return ERROR_SUCCESS;
- rc = MSIREG_OpenUninstallKey(package->ProductCode,&hkey,TRUE);
+ rc = MSIREG_OpenUninstallKey(package->ProductCode, &hkey, TRUE);
if (rc != ERROR_SUCCESS)
return rc;
{
rc = MSIREG_OpenLocalSystemInstallProps(package->ProductCode, &props, TRUE);
if (rc != ERROR_SUCCESS)
- return rc;
+ goto done;
}
else
{
rc = MSIREG_OpenCurrentUserInstallProps(package->ProductCode, &props, TRUE);
if (rc != ERROR_SUCCESS)
- return rc;
+ goto done;
}
- /* dump all the info i can grab */
- /* FIXME: Flesh out more information */
-
- msi_write_uninstall_property_vals( package, hkey );
+ msi_make_package_local(package, props);
- msi_reg_set_val_dword( hkey, szWindowsInstaller, 1 );
-
- msi_make_package_local( package, hkey );
-
- /* do ModifyPath and UninstallString */
- size = deformat_string(package,modpath_fmt,&buffer);
- RegSetValueExW(hkey,szModifyPath,0,REG_EXPAND_SZ,(LPBYTE)buffer,size);
- RegSetValueExW(hkey,szUninstallString,0,REG_EXPAND_SZ,(LPBYTE)buffer,size);
- msi_free(buffer);
-
- /* FIXME: Write real Estimated Size when we have it */
- msi_reg_set_val_dword( hkey, szEstimatedSize, 0 );
-
- buffer = msi_dup_property( package, szProductName );
- msi_reg_set_val_str( props, szDisplayName, buffer );
- msi_free(buffer);
-
- buffer = msi_dup_property( package, cszSourceDir );
- msi_reg_set_val_str( props, INSTALLPROPERTY_INSTALLSOURCEW, buffer);
- msi_free(buffer);
+ rc = msi_publish_install_properties(package, hkey);
+ if (rc != ERROR_SUCCESS)
+ goto done;
- buffer = msi_dup_property( package, szManufacturer );
- msi_reg_set_val_str( props, INSTALLPROPERTY_PUBLISHERW, buffer);
- msi_free(buffer);
-
- GetLocalTime(&systime);
- sprintfW(szDate,date_fmt,systime.wYear,systime.wMonth,systime.wDay);
- msi_reg_set_val_str( hkey, INSTALLPROPERTY_INSTALLDATEW, szDate );
- msi_reg_set_val_str( props, INSTALLPROPERTY_INSTALLDATEW, szDate );
-
- langid = msi_get_property_int( package, szProductLanguage, 0 );
- msi_reg_set_val_dword( hkey, INSTALLPROPERTY_LANGUAGEW, langid );
-
- buffer = msi_dup_property( package, szProductVersion );
- msi_reg_set_val_str( props, szDisplayVersion, buffer );
- if (buffer)
- {
- DWORD verdword = msi_version_str_to_dword(buffer);
+ rc = msi_publish_install_properties(package, props);
+ if (rc != ERROR_SUCCESS)
+ goto done;
- msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONW, verdword );
- msi_reg_set_val_dword( props, INSTALLPROPERTY_VERSIONW, verdword );
- msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONMAJORW, verdword>>24 );
- msi_reg_set_val_dword( props, INSTALLPROPERTY_VERSIONMAJORW, verdword>>24 );
- msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONMINORW, (verdword>>16)&0x00FF );
- msi_reg_set_val_dword( props, INSTALLPROPERTY_VERSIONMINORW, (verdword>>16)&0x00FF );
- }
- msi_free(buffer);
-
- /* Handle Upgrade Codes */
- upgrade_code = msi_dup_property( package, szUpgradeCode );
+ upgrade_code = msi_dup_property(package, szUpgradeCode);
if (upgrade_code)
{
- HKEY hkey2;
- WCHAR squashed[33];
- MSIREG_OpenUpgradeCodesKey(upgrade_code, &hkey2, TRUE);
- squash_guid(package->ProductCode,squashed);
- msi_reg_set_val_str( hkey2, squashed, NULL );
- RegCloseKey(hkey2);
- MSIREG_OpenUserUpgradeCodesKey(upgrade_code, &hkey2, TRUE);
- squash_guid(package->ProductCode,squashed);
- msi_reg_set_val_str( hkey2, squashed, NULL );
- RegCloseKey(hkey2);
-
+ MSIREG_OpenUpgradeCodesKey(upgrade_code, &upgrade, TRUE);
+ squash_guid(package->ProductCode, squashed_pc);
+ msi_reg_set_val_str(upgrade, squashed_pc, NULL);
+ RegCloseKey(upgrade);
msi_free(upgrade_code);
}
+done:
RegCloseKey(hkey);
- rc = MSIREG_OpenUserDataProductKey(package->ProductCode, &hudkey, TRUE);
- if (rc != ERROR_SUCCESS)
- return rc;
-
- RegCloseKey(hudkey);
-
- msi_reg_set_val_dword( props, szWindowsInstaller, 1 );
- RegCloseKey(props);
-
return ERROR_SUCCESS;
}
static UINT msi_unpublish_product(MSIPACKAGE *package)
{
+ LPWSTR upgrade;
LPWSTR remove = NULL;
LPWSTR *features = NULL;
BOOL full_uninstall = TRUE;
static const WCHAR szRemove[] = {'R','E','M','O','V','E',0};
static const WCHAR szAll[] = {'A','L','L',0};
+ static const WCHAR szUpgradeCode[] =
+ {'U','p','g','r','a','d','e','C','o','d','e',0};
remove = msi_dup_property(package, szRemove);
if (!remove)
MSIREG_DeleteUserFeaturesKey(package->ProductCode);
MSIREG_DeleteUninstallKey(package->ProductCode);
+ upgrade = msi_dup_property(package, szUpgradeCode);
+ if (upgrade)
+ {
+ MSIREG_DeleteUserUpgradeCodesKey(upgrade);
+ msi_free(upgrade);
+ }
+
done:
msi_free(remove);
msi_free(features);
if (!productid)
return ERROR_SUCCESS;
- rc = MSIREG_OpenCurrentUserInstallProps(package->ProductCode, &hkey, TRUE);
+ if (package->Context == MSIINSTALLCONTEXT_MACHINE)
+ rc = MSIREG_OpenLocalSystemInstallProps(package->ProductCode, &hkey, TRUE);
+ else
+ rc = MSIREG_OpenCurrentUserInstallProps(package->ProductCode, &hkey, TRUE);
+
if (rc != ERROR_SUCCESS)
goto end;
/* FIXME: extract all files belonging to this component */
file = msi_find_file(package, comp->KeyPath);
+ if (!file)
+ {
+ ERR("File %s not found\n", debugstr_w(comp->KeyPath));
+ return ERROR_FUNCTION_FAILED;
+ }
GetTempPathW(MAX_PATH, path);
'I','n','s','t','a','l','l','e','r','\\',
'P','r','o','d','u','c','t','s','\\','%','s',0};
+static const WCHAR szInstaller_LocalClassesFeat_fmt[] = {
+'S','o','f','t','w','a','r','e','\\',
+'C','l','a','s','s','e','s','\\',
+'I','n','s','t','a','l','l','e','r','\\',
+'F','e','a','t','u','r','e','s','\\','%','s',0};
+
static const WCHAR szInstaller_LocalManagedProd_fmt[] = {
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
'I','n','s','t','a','l','l','e','r','\\',
'P','r','o','d','u','c','t','s','\\','%','s',0};
+static const WCHAR szInstaller_LocalManagedFeat_fmt[] = {
+'S','o','f','t','w','a','r','e','\\',
+'M','i','c','r','o','s','o','f','t','\\',
+'W','i','n','d','o','w','s','\\',
+'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
+'I','n','s','t','a','l','l','e','r','\\',
+'M','a','n','a','g','e','d','\\','%','s','\\',
+'I','n','s','t','a','l','l','e','r','\\',
+'F','e','a','t','u','r','e','s','\\','%','s',0};
+
+static const WCHAR szInstaller_ClassesUpgrade_fmt[] = {
+'I','n','s','t','a','l','l','e','r','\\',
+'U','p','g','r','a','d','e','C','o','d','e','s','\\',
+'%','s',0};
+
+static const WCHAR localsid[] = {'S','-','1','-','5','-','1','8',0};
+
BOOL unsquash_guid(LPCWSTR in, LPWSTR out)
{
DWORD i,n=0;
return rc;
}
-UINT MSIREG_OpenComponents(HKEY* key)
+UINT MSIREG_OpenLocalUserDataFeaturesKey(LPCWSTR szProduct, HKEY *key, BOOL create)
{
- return RegCreateKeyW(HKEY_LOCAL_MACHINE,szInstaller_Components,key);
+ WCHAR squished_pc[GUID_SIZE];
+ WCHAR keypath[0x200];
+
+ TRACE("%s\n", debugstr_w(szProduct));
+ if (!squash_guid(szProduct, squished_pc))
+ return ERROR_FUNCTION_FAILED;
+ TRACE("squished (%s)\n", debugstr_w(squished_pc));
+
+ sprintfW(keypath, szUserDataFeatures_fmt, localsid, squished_pc);
+
+ if (create)
+ return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+
+ return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
}
UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create)
return rc;
}
+UINT MSIREG_OpenLocalUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create)
+{
+ WCHAR comp[GUID_SIZE];
+ WCHAR keypath[0x200];
+
+ TRACE("%s\n", debugstr_w(szComponent));
+ if (!squash_guid(szComponent, comp))
+ return ERROR_FUNCTION_FAILED;
+ TRACE("squished (%s)\n", debugstr_w(comp));
+
+ sprintfW(keypath, szUserDataComp_fmt, localsid, comp);
+
+ if (create)
+ return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+
+ return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+}
+
+UINT MSIREG_DeleteLocalUserDataComponentKey(LPCWSTR szComponent)
+{
+ WCHAR comp[GUID_SIZE];
+ WCHAR keypath[0x200];
+
+ TRACE("%s\n", debugstr_w(szComponent));
+ if (!squash_guid(szComponent, comp))
+ return ERROR_FUNCTION_FAILED;
+ TRACE("squished (%s)\n", debugstr_w(comp));
+
+ sprintfW(keypath, szUserDataComp_fmt, localsid, comp);
+ return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath);
+}
+
UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, HKEY *key, BOOL create)
{
UINT rc;
return rc;
}
+UINT MSIREG_OpenLocalUserDataProductKey(LPCWSTR szProduct, HKEY *key, BOOL create)
+{
+ WCHAR squished_pc[GUID_SIZE];
+ WCHAR keypath[0x200];
+
+ TRACE("%s\n", debugstr_w(szProduct));
+ if (!squash_guid(szProduct, squished_pc))
+ return ERROR_FUNCTION_FAILED;
+ TRACE("squished (%s)\n", debugstr_w(squished_pc));
+
+ sprintfW(keypath, szUserDataProd_fmt, localsid, squished_pc);
+
+ if (create)
+ return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+
+ return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+}
+
static UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID,
HKEY *key, BOOL create)
{
UINT MSIREG_OpenLocalSystemInstallProps(LPCWSTR szProduct, HKEY *key,
BOOL create)
{
- static const WCHAR localsid[] = {'S','-','1','-','5','-','1','8',0};
-
return MSIREG_OpenInstallProps(szProduct, localsid, key, create);
}
return rc;
}
+UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode)
+{
+ WCHAR squished_pc[GUID_SIZE];
+ WCHAR keypath[0x200];
+
+ TRACE("%s\n",debugstr_w(szUpgradeCode));
+ if (!squash_guid(szUpgradeCode,squished_pc))
+ return ERROR_FUNCTION_FAILED;
+ TRACE("squished (%s)\n", debugstr_w(squished_pc));
+
+ sprintfW(keypath,szInstaller_UserUpgradeCodes_fmt,squished_pc);
+
+ return RegDeleteTreeW(HKEY_CURRENT_USER, keypath);
+}
+
UINT MSIREG_OpenLocalSystemProductKey(LPCWSTR szProductCode, HKEY *key, BOOL create)
{
WCHAR squished_pc[GUID_SIZE];
return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
}
+UINT MSIREG_OpenLocalClassesFeaturesKey(LPCWSTR szProductCode, HKEY *key, BOOL create)
+{
+ WCHAR squished_pc[GUID_SIZE];
+ WCHAR keypath[0x200];
+
+ TRACE("%s\n", debugstr_w(szProductCode));
+
+ if (!squash_guid(szProductCode, squished_pc))
+ return ERROR_FUNCTION_FAILED;
+
+ TRACE("squished (%s)\n", debugstr_w(squished_pc));
+
+ sprintfW(keypath, szInstaller_LocalClassesFeat_fmt, squished_pc);
+
+ if (create)
+ return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+
+ return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+}
+
UINT MSIREG_OpenLocalManagedProductKey(LPCWSTR szProductCode, HKEY *key, BOOL create)
{
WCHAR squished_pc[GUID_SIZE];
return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
}
+UINT MSIREG_OpenManagedFeaturesKey(LPCWSTR szProductCode, HKEY *key, BOOL create)
+{
+ WCHAR squished_pc[GUID_SIZE];
+ WCHAR keypath[0x200];
+ LPWSTR usersid;
+ UINT r;
+
+ TRACE("%s\n", debugstr_w(szProductCode));
+
+ if (!squash_guid(szProductCode, squished_pc))
+ return ERROR_FUNCTION_FAILED;
+
+ TRACE("squished (%s)\n", debugstr_w(squished_pc));
+
+ r = get_user_sid(&usersid);
+ if (r != ERROR_SUCCESS || !usersid)
+ {
+ ERR("Failed to retrieve user SID: %d\n", r);
+ return r;
+ }
+
+ sprintfW(keypath, szInstaller_LocalManagedFeat_fmt, usersid, squished_pc);
+ LocalFree(usersid);
+
+ if (create)
+ return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+
+ return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
+}
+
+UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create)
+{
+ WCHAR squished_pc[GUID_SIZE];
+ WCHAR keypath[0x200];
+
+ TRACE("%s\n", debugstr_w(szUpgradeCode));
+ if (!squash_guid(szUpgradeCode, squished_pc))
+ return ERROR_FUNCTION_FAILED;
+ TRACE("squished (%s)\n", debugstr_w(squished_pc));
+
+ sprintfW(keypath, szInstaller_ClassesUpgrade_fmt, squished_pc);
+
+ if (create)
+ return RegCreateKeyW(HKEY_CLASSES_ROOT, keypath, key);
+
+ return RegOpenKeyW(HKEY_CLASSES_ROOT, keypath, key);
+}
+
/*************************************************************************
* MsiDecomposeDescriptorW [MSI.@]
*
TRACE("%d %p\n", index, lpguid);
- r = MSIREG_OpenComponents(&hkeyComponents);
+ r = RegCreateKeyW(HKEY_LOCAL_MACHINE, szInstaller_Components, &hkeyComponents);
if( r != ERROR_SUCCESS )
return ERROR_NO_MORE_ITEMS;