msi/tests: Clean up local packages.

This commit is contained in:
Hans Leidekker 2011-08-23 14:42:38 +02:00 committed by Alexandre Julliard
parent eb7ae99ddb
commit fabfc5da78
2 changed files with 30 additions and 7 deletions

View File

@ -47,6 +47,7 @@ static const WCHAR szUpgradeCode[] = { '{','C','E','0','6','7','E','8','D','-','
static const WCHAR szProductInfoException[] = { 'P','r','o','d','u','c','t','I','n','f','o',',','P','r','o','d','u','c','t',',','A','t','t','r','i','b','u','t','e',0 };
static const WCHAR WINE_INSTALLPROPERTY_PACKAGENAMEW[] = {'P','a','c','k','a','g','e','N','a','m','e',0};
static const WCHAR WINE_INSTALLPROPERTY_PRODUCTNAMEW[] = {'P','r','o','d','u','c','t','N','a','m','e',0};
static const WCHAR WINE_INSTALLPROPERTY_LOCALPACKAGEW[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
static FILETIME systemtime;
static CHAR CURR_DIR[MAX_PATH];
static EXCEPINFO excepinfo;
@ -2485,6 +2486,10 @@ static void test_Installer_InstallProduct(void)
IDispatch_Release(pStringList);
}
hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_LOCALPACKAGEW, szString);
ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
DeleteFileW( szString );
/* Check & clean up installed files & registry keys */
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
@ -2563,7 +2568,7 @@ static void test_Installer_InstallProduct(void)
RegCloseKey(hkey);
/* Delete installation files we installed */
/* Delete installation files we created */
delete_test_files();
}

View File

@ -4754,7 +4754,7 @@ static void test_MsiConfigureProductEx(void)
LONG res;
DWORD type, size;
HKEY props, source;
CHAR keypath[MAX_PATH * 2], localpack[MAX_PATH];
CHAR keypath[MAX_PATH * 2], localpackage[MAX_PATH], packagename[MAX_PATH];
REGSAM access = KEY_ALL_ACCESS;
if (is_process_limited())
@ -4886,7 +4886,7 @@ static void test_MsiConfigureProductEx(void)
DeleteFileA(msifile);
/* local msifile is removed */
/* msifile is removed */
r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
"PROPVAR=42");
@ -4915,6 +4915,12 @@ static void test_MsiConfigureProductEx(void)
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
type = REG_SZ;
size = MAX_PATH;
res = RegQueryValueExA(props, "LocalPackage", NULL, &type,
(LPBYTE)localpackage, &size);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
(const BYTE *)"C:\\idontexist.msi", 18);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -4933,7 +4939,7 @@ static void test_MsiConfigureProductEx(void)
RegCloseKey(props);
create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
/* LastUsedSource (local msi package) can be used as a last resort */
/* LastUsedSource can be used as a last resort */
r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
"PROPVAR=42");
@ -4942,6 +4948,7 @@ static void test_MsiConfigureProductEx(void)
ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
DeleteFileA( localpackage );
/* install the product, machine */
r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
@ -4958,6 +4965,12 @@ static void test_MsiConfigureProductEx(void)
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
type = REG_SZ;
size = MAX_PATH;
res = RegQueryValueExA(props, "LocalPackage", NULL, &type,
(LPBYTE)localpackage, &size);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
(const BYTE *)"C:\\idontexist.msi", 18);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -4971,7 +4984,7 @@ static void test_MsiConfigureProductEx(void)
type = REG_SZ;
size = MAX_PATH;
res = RegQueryValueExA(source, "PackageName", NULL, &type,
(LPBYTE)localpack, &size);
(LPBYTE)packagename, &size);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
@ -4989,9 +5002,14 @@ static void test_MsiConfigureProductEx(void)
ok(pf_exists("msitest\\lithium"), "File not installed\n");
ok(pf_exists("msitest"), "File not installed\n");
/* restore the SourceList */
/* restore PackageName */
res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
(const BYTE *)localpack, lstrlenA(localpack) + 1);
(const BYTE *)packagename, lstrlenA(packagename) + 1);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* restore LocalPackage */
res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
(const BYTE *)localpackage, lstrlenA(localpackage) + 1);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* finally remove the product */