Commit 82517d6d authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Set the install context based on the ALLUSERS property.

parent 30c1b888
......@@ -3345,13 +3345,22 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
/* ok there is a lot more done here but i need to figure out what */
rc = MSIREG_OpenProductsKey(package->ProductCode,&hkey,TRUE);
if (rc != ERROR_SUCCESS)
goto end;
if (package->Context == MSIINSTALLCONTEXT_MACHINE)
{
rc = MSIREG_OpenLocalClassesProductKey(package->ProductCode, &hukey, TRUE);
if (rc != ERROR_SUCCESS)
goto end;
}
else
{
rc = MSIREG_OpenProductsKey(package->ProductCode,&hkey,TRUE);
if (rc != ERROR_SUCCESS)
goto end;
rc = MSIREG_OpenUserProductsKey(package->ProductCode,&hukey,TRUE);
if (rc != ERROR_SUCCESS)
goto end;
rc = MSIREG_OpenUserProductsKey(package->ProductCode,&hukey,TRUE);
if (rc != ERROR_SUCCESS)
goto end;
}
rc = RegCreateKeyW(hukey, szSourceList, &source);
if (rc != ERROR_SUCCESS)
......@@ -3400,19 +3409,19 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
buffer = strrchrW( package->PackagePath, '\\') + 1;
rc = MsiSourceListSetInfoW( package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
package->Context, MSICODE_PRODUCT,
INSTALLPROPERTY_PACKAGENAMEW, buffer );
if (rc != ERROR_SUCCESS)
goto end;
rc = MsiSourceListSetInfoW( package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
package->Context, MSICODE_PRODUCT,
INSTALLPROPERTY_MEDIAPACKAGEPATHW, szEmpty );
if (rc != ERROR_SUCCESS)
goto end;
rc = MsiSourceListSetInfoW( package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
package->Context, MSICODE_PRODUCT,
INSTALLPROPERTY_DISKPROMPTW, szEmpty );
if (rc != ERROR_SUCCESS)
goto end;
......@@ -4221,13 +4230,13 @@ static UINT ACTION_ResolveSource(MSIPACKAGE* package)
DWORD size = 0;
rc = MsiSourceListGetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
package->Context, MSICODE_PRODUCT,
INSTALLPROPERTY_DISKPROMPTW,NULL,&size);
if (rc == ERROR_MORE_DATA)
{
prompt = msi_alloc(size * sizeof(WCHAR));
MsiSourceListGetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
package->Context, MSICODE_PRODUCT,
INSTALLPROPERTY_DISKPROMPTW,prompt,&size);
}
else
......
......@@ -581,11 +581,11 @@ static UINT load_media_info(MSIPACKAGE *package, MSIFILE *file, struct media_inf
}
if (mi->type == DRIVE_CDROM || mi->type == DRIVE_REMOVABLE)
msi_package_add_media_disk(package, MSIINSTALLCONTEXT_USERUNMANAGED,
msi_package_add_media_disk(package, package->Context,
MSICODE_PRODUCT, mi->disk_id,
mi->volume_label, mi->disk_prompt);
msi_package_add_info(package, MSIINSTALLCONTEXT_USERUNMANAGED,
msi_package_add_info(package, package->Context,
options, INSTALLPROPERTY_LASTUSEDSOURCEW, source);
msi_free(source_dir);
......@@ -603,7 +603,7 @@ static UINT find_published_source(MSIPACKAGE *package, struct media_info *mi)
UINT r;
r = MsiSourceListGetInfoW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
package->Context, MSICODE_PRODUCT,
INSTALLPROPERTY_LASTUSEDSOURCEW, source, &size);
if (r != ERROR_SUCCESS)
return r;
......@@ -612,7 +612,7 @@ static UINT find_published_source(MSIPACKAGE *package, struct media_info *mi)
volumesz = MAX_PATH;
promptsz = MAX_PATH;
while (MsiSourceListEnumMediaDisksW(package->ProductCode, NULL,
MSIINSTALLCONTEXT_USERUNMANAGED,
package->Context,
MSICODE_PRODUCT, index++, &id,
volume, &volumesz, prompt, &promptsz) == ERROR_SUCCESS)
{
......
......@@ -307,6 +307,7 @@ typedef struct tagMSIPACKAGE
float center_y;
UINT WordCount;
UINT Context;
struct list subscriptions;
......
......@@ -416,7 +416,6 @@ static VOID set_installer_properties(MSIPACKAGE *package)
static const WCHAR szColorBits[] = {'C','o','l','o','r','B','i','t','s',0};
static const WCHAR szIntFormat[] = {'%','d',0};
static const WCHAR szIntel[] = { 'I','n','t','e','l',0 };
static const WCHAR szAllUsers[] = { 'A','L','L','U','S','E','R','S',0 };
static const WCHAR szUserInfo[] = {
'S','O','F','T','W','A','R','E','\\',
'M','i','c','r','o','s','o','f','t','\\',
......@@ -542,7 +541,6 @@ static VOID set_installer_properties(MSIPACKAGE *package)
/* in a wine environment the user is always admin and privileged */
MSI_SetPropertyW(package,szAdminUser,szOne);
MSI_SetPropertyW(package,szPriv,szOne);
MSI_SetPropertyW(package, szAllUsers, szOne);
/* set the os things */
OSVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
......@@ -762,6 +760,30 @@ static UINT msi_load_admin_properties(MSIPACKAGE *package)
return r;
}
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;
}
MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url )
{
static const WCHAR szLevel[] = { 'U','I','L','e','v','e','l',0 };
......@@ -801,6 +823,8 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPCWSTR base_url )
if (package->WordCount & MSIWORDCOUNT_ADMINISTRATIVE)
msi_load_admin_properties( package );
msi_set_context( package );
}
return package;
......
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