Commit 0e44e090 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Set the WindowsInstaller value in RegisterProduct instead of PublishProduct.

parent a2df31ae
......@@ -3279,10 +3279,6 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
{'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 szInstallProperties[] =
{'I','n','s','t','a','l','l','P','r','o','p','e','r','t','i','e','s',0};
static const WCHAR szWindowsInstaller[] =
{'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
DWORD langid;
LPWSTR buffer;
DWORD size;
......@@ -3315,12 +3311,10 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
if (rc != ERROR_SUCCESS)
goto end;
rc = RegCreateKeyW(hudkey, szInstallProperties, &props);
rc = MSIREG_OpenInstallPropertiesKey(package->ProductCode,&props,TRUE);
if (rc != ERROR_SUCCESS)
goto end;
msi_reg_set_val_dword( props, szWindowsInstaller, 1 );
buffer = msi_dup_property( package, INSTALLPROPERTY_PRODUCTNAMEW );
msi_reg_set_val_str( hukey, INSTALLPROPERTY_PRODUCTNAMEW, buffer );
msi_free(buffer);
......@@ -3806,6 +3800,7 @@ static UINT msi_write_uninstall_property_vals( MSIPACKAGE *package, HKEY hkey )
static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
{
HKEY hkey=0;
HKEY hudkey=0, props=0;
LPWSTR buffer = NULL;
UINT rc;
DWORD size, langid;
......@@ -3830,7 +3825,11 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
SYSTEMTIME systime;
static const WCHAR date_fmt[] = {'%','i','%','i','%','i',0};
LPWSTR upgrade_code;
WCHAR szDate[9];
WCHAR szDate[9];
/* 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);
if (rc != ERROR_SUCCESS)
......@@ -3892,7 +3891,18 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
RegCloseKey(hkey);
/* FIXME: call ui_actiondata */
rc = MSIREG_OpenUserDataProductKey(package->ProductCode, &hudkey, TRUE);
if (rc != ERROR_SUCCESS)
return rc;
RegCloseKey(hudkey);
rc = MSIREG_OpenInstallPropertiesKey(package->ProductCode, &props, TRUE);
if (rc != ERROR_SUCCESS)
return rc;
msi_reg_set_val_dword( props, szWindowsInstaller, 1 );
RegCloseKey(props);
return ERROR_SUCCESS;
}
......
......@@ -709,6 +709,7 @@ extern UINT MSIREG_OpenComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create
extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create);
extern UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, HKEY* key, BOOL create);
extern UINT MSIREG_OpenInstallPropertiesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create);
extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
......
......@@ -166,6 +166,16 @@ static const WCHAR szUserDataProd_fmt[] = {
'U','s','e','r','D','a','t','a','\\',
'%','s','\\','P','r','o','d','u','c','t','s','\\','%','s',0};
static const WCHAR szInstallProperties_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','\\',
'U','s','e','r','D','a','t','a','\\',
'%','s','\\','P','r','o','d','u','c','t','s','\\','%','s','\\',
'I','n','s','t','a','l','l','P','r','o','p','e','r','t','i','e','s',0};
#define SQUISH_GUID_SIZE 33
......@@ -611,6 +621,35 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, HKEY *key, BOOL create)
return rc;
}
UINT MSIREG_OpenInstallPropertiesKey(LPCWSTR szProduct, HKEY *key, BOOL create)
{
UINT rc;
WCHAR squished_pc[GUID_SIZE];
WCHAR keypath[0x200];
LPWSTR usersid;
TRACE("%s\n", debugstr_w(szProduct));
squash_guid(szProduct, squished_pc);
TRACE("squished (%s)\n", debugstr_w(squished_pc));
rc = get_user_sid(&usersid);
if (rc != ERROR_SUCCESS || !usersid)
{
ERR("Failed to retrieve user SID: %d\n", rc);
return rc;
}
sprintfW(keypath, szInstallProperties_fmt, usersid, squished_pc);
if (create)
rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key);
else
rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key);
msi_free(usersid);
return rc;
}
UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct)
{
UINT rc;
......
......@@ -1683,10 +1683,7 @@ static void test_publish(void)
ok(pf_exists("msitest"), "File not installed\n");
state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
todo_wine
{
ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
}
ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
......
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