Commit a2df31ae authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Only publish the product if at least one feature is to be installed.

parent 624bbbe7
...@@ -3241,6 +3241,19 @@ static UINT ITERATE_PublishProduct(MSIRECORD *row, LPVOID param) ...@@ -3241,6 +3241,19 @@ static UINT ITERATE_PublishProduct(MSIRECORD *row, LPVOID param)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static BOOL msi_check_publish(MSIPACKAGE *package)
{
MSIFEATURE *feature;
LIST_FOR_EACH_ENTRY(feature, &package->features, MSIFEATURE, entry)
{
if (feature->ActionRequest == INSTALLSTATE_LOCAL)
return TRUE;
}
return FALSE;
}
/* /*
* 99% of the work done here is only done for * 99% of the work done here is only done for
* advertised installs. However this is where the * advertised installs. However this is where the
...@@ -3275,6 +3288,10 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) ...@@ -3275,6 +3288,10 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
DWORD size; DWORD size;
MSIHANDLE hDb, hSumInfo; MSIHANDLE hDb, hSumInfo;
/* FIXME: also need to publish if the product is in advertise mode */
if (!msi_check_publish(package))
return ERROR_SUCCESS;
/* write out icon files */ /* write out icon files */
rc = MSI_DatabaseOpenViewW(package->db, Query, &view); rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
......
...@@ -1594,6 +1594,9 @@ static void test_publish(void) ...@@ -1594,6 +1594,9 @@ static void test_publish(void)
MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"); state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
if (state != INSTALLSTATE_UNKNOWN) if (state != INSTALLSTATE_UNKNOWN)
{ {
skip("Install database not in a clean state\n"); skip("Install database not in a clean state\n");
...@@ -1602,9 +1605,6 @@ static void test_publish(void) ...@@ -1602,9 +1605,6 @@ static void test_publish(void)
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo"); state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
...@@ -1775,10 +1775,7 @@ static void test_publish(void) ...@@ -1775,10 +1775,7 @@ static void test_publish(void)
ok(pf_exists("msitest"), "File deleted\n"); ok(pf_exists("msitest"), "File deleted\n");
state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"); state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
todo_wine ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
{
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
}
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature"); state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
todo_wine todo_wine
...@@ -1827,10 +1824,7 @@ static void test_publish(void) ...@@ -1827,10 +1824,7 @@ static void test_publish(void)
ok(pf_exists("msitest"), "File deleted\n"); ok(pf_exists("msitest"), "File deleted\n");
state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"); state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
todo_wine ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
{
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
}
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature"); state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
todo_wine todo_wine
...@@ -1859,10 +1853,7 @@ static void test_publish(void) ...@@ -1859,10 +1853,7 @@ static void test_publish(void)
ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature"); state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
todo_wine ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
{
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
}
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo"); state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
todo_wine todo_wine
...@@ -1888,10 +1879,7 @@ static void test_publish(void) ...@@ -1888,10 +1879,7 @@ static void test_publish(void)
} }
state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"); state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
todo_wine ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
{
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
}
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");\ state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");\
todo_wine todo_wine
...@@ -1920,10 +1908,7 @@ static void test_publish(void) ...@@ -1920,10 +1908,7 @@ static void test_publish(void)
ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature"); state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
todo_wine ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
{
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
}
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo"); state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
todo_wine todo_wine
...@@ -2108,10 +2093,7 @@ static void test_publish(void) ...@@ -2108,10 +2093,7 @@ static void test_publish(void)
} }
state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"); state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
todo_wine ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
{
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
}
state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature"); state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
todo_wine todo_wine
...@@ -2161,11 +2143,8 @@ static void test_publishsourcelist(void) ...@@ -2161,11 +2143,8 @@ static void test_publishsourcelist(void)
size = 0xdeadbeef; size = 0xdeadbeef;
r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size); MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
todo_wine ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
{ ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
}
r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1"); r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
...@@ -2176,11 +2155,8 @@ static void test_publishsourcelist(void) ...@@ -2176,11 +2155,8 @@ static void test_publishsourcelist(void)
size = 0xdeadbeef; size = 0xdeadbeef;
r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size); MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
todo_wine ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
{ ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
}
r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1"); r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
...@@ -2191,11 +2167,8 @@ static void test_publishsourcelist(void) ...@@ -2191,11 +2167,8 @@ static void test_publishsourcelist(void)
size = 0xdeadbeef; size = 0xdeadbeef;
r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size); MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
todo_wine ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
{ ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
}
r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1"); r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
...@@ -2206,11 +2179,8 @@ static void test_publishsourcelist(void) ...@@ -2206,11 +2179,8 @@ static void test_publishsourcelist(void)
size = 0xdeadbeef; size = 0xdeadbeef;
r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size); MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
todo_wine ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
{ ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
}
r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1"); r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
......
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