Commit 6e63953b authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Also check the LocalPackage install property when searching for the product package.

parent d500dc4f
...@@ -372,6 +372,53 @@ done: ...@@ -372,6 +372,53 @@ done:
return r; return r;
} }
static UINT msi_open_package(LPCWSTR product, MSIINSTALLCONTEXT context,
MSIPACKAGE **package)
{
UINT r;
DWORD sz;
HKEY props;
LPWSTR localpack;
WCHAR sourcepath[MAX_PATH];
WCHAR filename[MAX_PATH];
static const WCHAR szLocalPackage[] = {
'L','o','c','a','l','P','a','c','k','a','g','e',0};
if (context == MSIINSTALLCONTEXT_MACHINE)
r = MSIREG_OpenLocalSystemInstallProps(product, &props, FALSE);
else
r = MSIREG_OpenCurrentUserInstallProps(product, &props, FALSE);
if (r != ERROR_SUCCESS)
return ERROR_BAD_CONFIGURATION;
localpack = msi_reg_get_val_str(props, szLocalPackage);
if (localpack)
{
lstrcpyW(sourcepath, localpack);
msi_free(localpack);
}
if (!localpack || GetFileAttributesW(sourcepath) == INVALID_FILE_ATTRIBUTES)
{
sz = sizeof(sourcepath);
MsiSourceListGetInfoW(product, NULL, context, MSICODE_PRODUCT,
INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath, &sz);
sz = sizeof(filename);
MsiSourceListGetInfoW(product, NULL, context, MSICODE_PRODUCT,
INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
lstrcatW(sourcepath, filename);
}
if (GetFileAttributesW(sourcepath) == INVALID_FILE_ATTRIBUTES)
return ERROR_INSTALL_SOURCE_ABSENT;
return MSI_OpenPackageW(sourcepath, package);
}
UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
INSTALLSTATE eInstallState, LPCWSTR szCommandLine) INSTALLSTATE eInstallState, LPCWSTR szCommandLine)
{ {
...@@ -380,7 +427,6 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, ...@@ -380,7 +427,6 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
UINT r; UINT r;
DWORD sz; DWORD sz;
WCHAR sourcepath[MAX_PATH]; WCHAR sourcepath[MAX_PATH];
WCHAR filename[MAX_PATH];
LPWSTR commandline; LPWSTR commandline;
static const WCHAR szInstalled[] = { static const WCHAR szInstalled[] = {
...@@ -407,16 +453,7 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, ...@@ -407,16 +453,7 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return r; return r;
sz = sizeof(sourcepath); r = msi_open_package(szProduct, context, &package);
MsiSourceListGetInfoW(szProduct, NULL, context, MSICODE_PRODUCT,
INSTALLPROPERTY_LASTUSEDSOURCEW, sourcepath, &sz);
sz = sizeof(filename);
MsiSourceListGetInfoW(szProduct, NULL, context, MSICODE_PRODUCT,
INSTALLPROPERTY_PACKAGENAMEW, filename, &sz);
lstrcatW(sourcepath, filename);
r = MSI_OpenPackageW(sourcepath, &package);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return r; return r;
......
...@@ -5118,9 +5118,9 @@ static void test_MsiConfigureProductEx(void) ...@@ -5118,9 +5118,9 @@ static void test_MsiConfigureProductEx(void)
r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT, INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
"PROPVAR=42"); "PROPVAR=42");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
todo_wine todo_wine
{ {
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n"); ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n"); ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n"); ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
...@@ -5154,11 +5154,8 @@ static void test_MsiConfigureProductEx(void) ...@@ -5154,11 +5154,8 @@ static void test_MsiConfigureProductEx(void)
r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT, INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
"PROPVAR=42"); "PROPVAR=42");
todo_wine ok(r == ERROR_INSTALL_SOURCE_ABSENT,
{ "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
ok(r == ERROR_INSTALL_SOURCE_ABSENT,
"Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
}
ok(pf_exists("msitest\\hydrogen"), "File not installed\n"); ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
ok(pf_exists("msitest\\helium"), "File not installed\n"); ok(pf_exists("msitest\\helium"), "File not installed\n");
ok(pf_exists("msitest\\lithium"), "File not installed\n"); ok(pf_exists("msitest\\lithium"), "File not installed\n");
...@@ -5219,11 +5216,8 @@ static void test_MsiConfigureProductEx(void) ...@@ -5219,11 +5216,8 @@ static void test_MsiConfigureProductEx(void)
r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT, INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
"PROPVAR=42"); "PROPVAR=42");
todo_wine ok(r == ERROR_INSTALL_SOURCE_ABSENT,
{ "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
ok(r == ERROR_INSTALL_SOURCE_ABSENT,
"Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
}
ok(pf_exists("msitest\\hydrogen"), "File not installed\n"); ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
ok(pf_exists("msitest\\helium"), "File not installed\n"); ok(pf_exists("msitest\\helium"), "File not installed\n");
ok(pf_exists("msitest\\lithium"), "File not installed\n"); ok(pf_exists("msitest\\lithium"), "File not installed\n");
......
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