Commit 738ec828 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi/tests: Get rid of workarounds for old Windows versions.

parent a6eb51f0
......@@ -36,9 +36,6 @@
static BOOL is_wow64;
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static const char *msifile = "winetest-automation.msi";
......@@ -191,29 +188,6 @@ static const msi_summary_info summary_info[] =
ADD_INFO_FILETIME(PID_LASTPRINTED, &systemtime)
};
static void init_functionpointers(void)
{
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
#define GET_PROC(dll, func) \
p ## func = (void *)GetProcAddress(dll, #func); \
if(!p ## func) \
trace("GetProcAddress(%s) failed\n", #func);
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
#undef GET_PROC
}
static LONG delete_key_portable( HKEY key, LPCSTR subkey, REGSAM access )
{
if (pRegDeleteKeyExA)
return pRegDeleteKeyExA( key, subkey, access, 0 );
return RegDeleteKeyA( key, subkey );
}
/*
* Database Helpers
*/
......@@ -2259,7 +2233,7 @@ static UINT delete_registry_key(HKEY hkeyParent, LPCSTR subkey, REGSAM access)
RegCloseKey(hkey);
free(string);
delete_key_portable(hkeyParent, subkey, access);
RegDeleteKeyExA(hkeyParent, subkey, access, 0);
return ERROR_SUCCESS;
}
......@@ -2439,13 +2413,13 @@ static void test_Installer_InstallProduct(void)
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
/* Remove registry keys written by RegisterProduct standard action */
res = delete_key_portable(HKEY_LOCAL_MACHINE,
res = RegDeleteKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{837450fa-a39b-4bc8-b321-08b393f784b3}",
KEY_WOW64_32KEY);
KEY_WOW64_32KEY, 0);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
res = delete_key_portable(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\D8E760ECA1E276347B43E42BDBDA5656", access);
res = RegDeleteKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\D8E760ECA1E276347B43E42BDBDA5656", access, 0);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
res = find_registry_key(HKEY_LOCAL_MACHINE,
......@@ -2456,8 +2430,8 @@ static void test_Installer_InstallProduct(void)
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
RegCloseKey(hkey);
res = delete_key_portable(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products\\af054738b93a8cb43b12803b397f483b", access);
res = RegDeleteKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products\\af054738b93a8cb43b12803b397f483b", access, 0);
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
/* Remove registry keys written by PublishProduct standard action */
......@@ -2624,12 +2598,9 @@ START_TEST(automation)
CLSID clsid;
IUnknown *pUnk;
init_functionpointers();
if (!is_process_elevated()) restart_as_admin_elevated();
if (pIsWow64Process)
pIsWow64Process(GetCurrentProcess(), &is_wow64);
IsWow64Process(GetCurrentProcess(), &is_wow64);
GetSystemTimeAsFileTime(&systemtime);
......@@ -2666,6 +2637,5 @@ START_TEST(automation)
}
OleUninitialize();
SetCurrentDirectoryA(prev_path);
}
......@@ -1128,9 +1128,7 @@ static void test_invalid_functions(MSIHANDLE hinst)
ok(hinst, r == ERROR_INVALID_HANDLE, "got %u\n", r);
r = MsiCreateTransformSummaryInfoA(db, db, "bogus.mst", 0, 0);
todo_wine ok(hinst, r == ERROR_INSTALL_PACKAGE_OPEN_FAILED ||
r == ERROR_INSTALL_PACKAGE_INVALID /* winxp */,
"got %u\n", r);
todo_wine ok(hinst, r == ERROR_INSTALL_PACKAGE_OPEN_FAILED, "got %u\n", r);
GetCurrentDirectoryA(sizeof(path), path);
r = MsiDatabaseExportA(db, "Test", path, "bogus.idt");
......
......@@ -29,7 +29,6 @@
#include <msi.h>
#include <fci.h>
#include <objidl.h>
#include <srrestoreptapi.h>
#include <shlobj.h>
#include <winsvc.h>
#include <shellapi.h>
......@@ -37,21 +36,6 @@
#include "wine/test.h"
#include "utils.h"
static UINT (WINAPI *pMsiQueryComponentStateA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
static UINT (WINAPI *pMsiSourceListEnumSourcesA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static BOOL (WINAPI *pWow64DisableWow64FsRedirection)(void **);
static BOOL (WINAPI *pWow64RevertWow64FsRedirection)(void *);
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
static BOOL is_wow64;
static const BOOL is_64bit = sizeof(void *) > sizeof(int);
......@@ -2224,33 +2208,6 @@ static int CDECL fci_delete(char *pszFile, int *err, void *pv)
return 0;
}
static void init_functionpointers(void)
{
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
HMODULE hsrclient = LoadLibraryA("srclient.dll");
#define GET_PROC(mod, func) \
p ## func = (void*)GetProcAddress(mod, #func); \
if(!p ## func) \
trace("GetProcAddress(%s) failed\n", #func);
GET_PROC(hmsi, MsiQueryComponentStateA);
GET_PROC(hmsi, MsiSourceListEnumSourcesA);
GET_PROC(hmsi, MsiGetComponentPathExA);
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
GET_PROC(hkernel32, Wow64DisableWow64FsRedirection);
GET_PROC(hkernel32, Wow64RevertWow64FsRedirection);
GET_PROC(hsrclient, SRRemoveRestorePoint);
GET_PROC(hsrclient, SRSetRestorePointA);
#undef GET_PROC
}
BOOL is_process_elevated(void)
{
HANDLE token;
......@@ -2711,34 +2668,6 @@ void create_database_wordcount(const CHAR *name, const msi_table *tables, int nu
free( nameW );
}
static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
{
RESTOREPOINTINFOA spec;
spec.dwEventType = event_type;
spec.dwRestorePtType = APPLICATION_INSTALL;
spec.llSequenceNumber = status->llSequenceNumber;
lstrcpyA(spec.szDescription, "msitest restore point");
return pSRSetRestorePointA(&spec, status);
}
static void remove_restore_point(DWORD seq_number)
{
DWORD res;
res = pSRRemoveRestorePoint(seq_number);
if (res != ERROR_SUCCESS)
trace("Failed to remove the restore point: %#lx\n", res);
}
static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
{
if (pRegDeleteKeyExA)
return pRegDeleteKeyExA( key, subkey, access, 0 );
return RegDeleteKeyA( key, subkey );
}
static void test_MsiInstallProduct(void)
{
UINT r;
......@@ -2813,7 +2742,7 @@ static void test_MsiInstallProduct(void)
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access);
RegDeleteKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access, 0);
/* not published, reinstall */
r = MsiInstallProductA(msifile, NULL);
......@@ -5282,7 +5211,7 @@ static void process_pending_renames(HKEY hkey)
else
{
fileret = DeleteFileA(src);
ok(fileret || broken(!fileret) /* win2k3 */, "Failed to delete file %s (%lu)\n", src, GetLastError());
ok(fileret, "Failed to delete file %s (%lu)\n", src, GetLastError());
}
}
......@@ -5504,7 +5433,7 @@ static void test_feature_override(void)
ok(!delete_pf("msitest\\preselected.txt", TRUE), "file not removed\n");
ok(!delete_pf("msitest", FALSE), "directory not removed\n");
delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access);
RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access, 0);
error:
DeleteFileA("msitest\\override.txt");
......@@ -5890,7 +5819,7 @@ static void test_mixed_package(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
ok(res == ERROR_FILE_NOT_FOUND, "32-bit component key not removed\n");
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
......@@ -5953,7 +5882,7 @@ static void test_mixed_package(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
ok(res == ERROR_FILE_NOT_FOUND, "32-bit component key not removed\n");
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
......@@ -6189,7 +6118,7 @@ static void test_wow64(void)
goto error;
}
pWow64DisableWow64FsRedirection(&cookie);
Wow64DisableWow64FsRedirection(&cookie);
ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
......@@ -6215,7 +6144,7 @@ static void test_wow64(void)
ok(delete_pf_native("msitest\\filename", TRUE), "File not installed\n");
ok(delete_pf_native("msitest", FALSE), "Directory not created\n");
pWow64RevertWow64FsRedirection(cookie);
Wow64RevertWow64FsRedirection(cookie);
error:
delete_test_files();
......@@ -6256,16 +6185,12 @@ START_TEST(install)
{
DWORD len;
char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
STATEMGRSTATUS status;
BOOL ret = FALSE;
if (!is_process_elevated()) restart_as_admin_elevated();
init_functionpointers();
subtest("custom");
if (pIsWow64Process)
pIsWow64Process(GetCurrentProcess(), &is_wow64);
IsWow64Process(GetCurrentProcess(), &is_wow64);
GetCurrentDirectoryA(MAX_PATH, prev_path);
GetTempPathA(MAX_PATH, temp_path);
......@@ -6280,18 +6205,6 @@ START_TEST(install)
ok(get_system_dirs(), "failed to retrieve system dirs\n");
ok(get_user_dirs(), "failed to retrieve user dirs\n");
/* Create a restore point ourselves so we circumvent the multitude of restore points
* that would have been created by all the installation and removal tests.
*
* This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
* creation of restore points.
*/
if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
{
memset(&status, 0, sizeof(status));
ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
}
/* Create only one log file and don't append. We have to pass something
* for the log mode for this to work. The logfile needs to have an absolute
* path otherwise we still end up with some extra logfiles as some tests
......@@ -6301,7 +6214,6 @@ START_TEST(install)
lstrcatA(log_file, "\\msitest.log");
MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
test_MsiInstallProduct();
test_MsiSetComponentState();
test_packagecoltypes();
......@@ -6349,15 +6261,6 @@ START_TEST(install)
test_source_resolution();
DeleteFileA(customdll);
DeleteFileA(log_file);
if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
{
ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
if (ret)
remove_restore_point(status.llSequenceNumber);
}
SetCurrentDirectoryA(prev_path);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -38,43 +38,6 @@ static BOOL is_wow64;
static const char msifile[] = "winetest-package.msi";
static const WCHAR msifileW[] = L"winetest-package.msi";
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static LONG (WINAPI *pRegDeleteKeyExW)(HKEY, LPCWSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
static void init_functionpointers(void)
{
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
HMODULE hsrclient = LoadLibraryA("srclient.dll");
#define GET_PROC(mod, func) \
p ## func = (void*)GetProcAddress(mod, #func);
GET_PROC(hmsi, MsiGetComponentPathExA);
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hadvapi32, RegDeleteKeyExW)
GET_PROC(hkernel32, IsWow64Process)
GET_PROC(hsrclient, SRRemoveRestorePoint);
GET_PROC(hsrclient, SRSetRestorePointA);
#undef GET_PROC
}
static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
{
if (pRegDeleteKeyExA)
return pRegDeleteKeyExA( key, subkey, access, 0 );
return RegDeleteKeyA( key, subkey );
}
static char *get_user_sid(void)
{
HANDLE token;
......@@ -138,12 +101,7 @@ static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM acce
}
if (lpszSubKey)
{
if (pRegDeleteKeyExW)
ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
else
ret = RegDeleteKeyW(hKey, lpszSubKey);
}
ret = RegDeleteKeyExW(hKey, lpszSubKey, access, 0);
else
while (TRUE)
{
......@@ -977,27 +935,6 @@ done:
return ret;
}
static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
{
RESTOREPOINTINFOA spec;
spec.dwEventType = event_type;
spec.dwRestorePtType = APPLICATION_INSTALL;
spec.llSequenceNumber = status->llSequenceNumber;
lstrcpyA(spec.szDescription, "msitest restore point");
return pSRSetRestorePointA(&spec, status);
}
static void remove_restore_point(DWORD seq_number)
{
DWORD res;
res = pSRRemoveRestorePoint(seq_number);
if (res != ERROR_SUCCESS)
trace("Failed to remove the restore point: %#lx\n", res);
}
static BOOL is_root(const char *path)
{
return (isalpha(path[0]) && path[1] == ':' && path[2] == '\\' && !path[3]);
......@@ -2038,20 +1975,16 @@ static void test_condition(void)
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<\"\xe5\"");
ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE),
"wrong return val (%d)\n", r);
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\">\"\xe5\"");
ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE),
"wrong return val (%d)\n", r);
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<>\"\xe5\"");
ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE),
"wrong return val (%d)\n", r);
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"=\"\xe5\"");
ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE),
"wrong return val (%d)\n", r);
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
MsiCloseHandle( hpkg );
DeleteFileA(msifile);
......@@ -2991,7 +2924,6 @@ static void test_states(void)
MSIHANDLE hpkg, hprod;
UINT r;
MSIHANDLE hdb;
BOOL is_broken;
char value[MAX_PATH];
DWORD size;
......@@ -3528,8 +3460,7 @@ static void test_states(void)
/* reinstall the product */
r = MsiInstallProductA(msifile3, "REINSTALL=ALL");
is_broken = (r == ERROR_INSTALL_FAILURE);
ok(r == ERROR_SUCCESS || broken(is_broken) /* win2k3 */, "Expected ERROR_SUCCESS, got %d\n", r);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "five");
ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state);
......@@ -3701,8 +3632,7 @@ static void test_states(void)
MsiCloseHandle( hpkg );
r = MsiInstallProductA(msifile, "");
ok(r == ERROR_SUCCESS || (is_broken && r == ERROR_INSTALL_FAILURE) /* win2k3 */,
"Expected ERROR_SUCCESS, got %d\n", r);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "one");
ok(state == INSTALLSTATE_SOURCE, "state = %d\n", state);
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "two");
......@@ -4040,8 +3970,8 @@ done:
MsiCloseHandle( hpkg );
DeleteFileA(msifile);
RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi");
delete_key(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_32KEY);
delete_key(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_64KEY);
RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_32KEY, 0);
RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_64KEY, 0);
}
static void test_appsearch_complocator(void)
......@@ -4332,9 +4262,7 @@ static void test_appsearch_reglocator(void)
users = 0;
res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
ok(res == ERROR_SUCCESS ||
broken(res == ERROR_INVALID_PARAMETER),
"Expected ERROR_SUCCESS, got %ld\n", res);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
if (res == ERROR_SUCCESS)
{
......@@ -7955,6 +7883,7 @@ static void test_MsiGetProductProperty(void)
skip("Not enough rights to perform tests\n");
RegDeleteKeyA(prodkey, "");
RegCloseKey(prodkey);
DeleteFileA(msifile);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
......@@ -7965,12 +7894,16 @@ static void test_MsiGetProductProperty(void)
lstrcpyA(val, path);
lstrcatA(val, "\\");
lstrcatA(val, msifile);
res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
(const BYTE *)val, lstrlenA(val) + 1);
res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ, (const BYTE *)val, lstrlenA(val) + 1);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
hprod = 0xdeadbeef;
r = MsiOpenProductA(prodcode, &hprod);
if (r == ERROR_UNKNOWN_PRODUCT)
{
win_skip("broken result, skipping tests\n");
goto done;
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
......@@ -8191,13 +8124,13 @@ static void test_MsiGetProductProperty(void)
"Expected %d, got %lu\n", lstrlenW(prodcodeW), size);
MsiCloseHandle(hprod);
done:
RegDeleteValueA(props, "LocalPackage");
delete_key(props, "", access);
RegDeleteKeyExA(props, "", access, 0);
RegCloseKey(props);
delete_key(userkey, "", access);
RegDeleteKeyExA(userkey, "", access, 0);
RegCloseKey(userkey);
delete_key(prodkey, "", access);
RegDeleteKeyExA(prodkey, "", access, 0);
RegCloseKey(prodkey);
DeleteFileA(msifile);
}
......@@ -9560,16 +9493,11 @@ static void test_top_level_action(void)
START_TEST(package)
{
char temp_path[MAX_PATH], prev_path[MAX_PATH];
STATEMGRSTATUS status;
BOOL ret = FALSE;
DWORD len;
if (!is_process_elevated()) restart_as_admin_elevated();
init_functionpointers();
if (pIsWow64Process)
pIsWow64Process(GetCurrentProcess(), &is_wow64);
IsWow64Process(GetCurrentProcess(), &is_wow64);
GetCurrentDirectoryA(MAX_PATH, prev_path);
GetTempPathA(MAX_PATH, temp_path);
......@@ -9581,18 +9509,6 @@ START_TEST(package)
if (len && (CURR_DIR[len - 1] == '\\'))
CURR_DIR[len - 1] = 0;
/* Create a restore point ourselves so we circumvent the multitude of restore points
* that would have been created by all the installation and removal tests.
*
* This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
* creation of restore points.
*/
if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
{
memset(&status, 0, sizeof(status));
ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
}
test_createpackage();
test_doaction();
test_gettargetpath_bad();
......@@ -9631,12 +9547,5 @@ START_TEST(package)
test_controlevent();
test_top_level_action();
if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
{
ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
if (ret)
remove_restore_point(status.llSequenceNumber);
}
SetCurrentDirectoryA(prev_path);
}
......@@ -32,12 +32,6 @@
#include "wine/test.h"
#include "utils.h"
static UINT (WINAPI *pMsiApplyPatchA)( LPCSTR, LPCSTR, INSTALLTYPE, LPCSTR );
static UINT (WINAPI *pMsiGetPatchInfoExA)( LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT,
LPCSTR, LPSTR, DWORD * );
static UINT (WINAPI *pMsiEnumPatchesExA)( LPCSTR, LPCSTR, DWORD, DWORD, DWORD, LPSTR,
LPSTR, MSIINSTALLCONTEXT *, LPSTR, LPDWORD );
static const char *msifile = "winetest-patch.msi";
static const char *mspfile = "winetest-patch.msp";
static const WCHAR msifileW[] = L"winetest-patch.msi";
......@@ -146,22 +140,6 @@ static const struct msi_table tables[] =
ADD_TABLE( condition )
};
static void init_function_pointers( void )
{
HMODULE hmsi = GetModuleHandleA( "msi.dll" );
#define GET_PROC( mod, func ) \
p ## func = (void *)GetProcAddress( mod, #func ); \
if (!p ## func) \
trace( "GetProcAddress(%s) failed\n", #func );
GET_PROC( hmsi, MsiApplyPatchA );
GET_PROC( hmsi, MsiGetPatchInfoExA );
GET_PROC( hmsi, MsiEnumPatchesExA );
#undef GET_PROC
}
static BOOL get_program_files_dir( char *buf, char *buf2 )
{
HKEY hkey;
......@@ -691,11 +669,6 @@ static void test_simple_patch( void )
WCHAR pathW[MAX_PATH];
MSIHANDLE hpackage, hdb, hview, hrec;
if (!pMsiApplyPatchA)
{
win_skip("MsiApplyPatchA is not available\n");
return;
}
if (!is_process_elevated())
{
skip("process is limited\n");
......@@ -774,14 +747,7 @@ static void test_simple_patch( void )
MsiCloseHandle( hpackage );
r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL );
ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */
"expected ERROR_SUCCESS, got %u\n", r );
if (r == ERROR_PATCH_PACKAGE_INVALID)
{
win_skip("Windows Installer < 3.0 detected\n");
goto uninstall;
}
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
size = get_pf_file_size( "msitest\\patch.txt" );
ok( size == 1002, "expected 1002, got %lu\n", size );
......@@ -857,7 +823,6 @@ static void test_simple_patch( void )
MsiCloseHandle( hview );
MsiCloseHandle( hdb );
uninstall:
size = sizeof(path);
r = MsiGetProductInfoA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
"InstallSource", path, &size );
......@@ -1030,11 +995,6 @@ static void test_system_tables( void )
const char *query;
MSIHANDLE hproduct, hdb, hview, hrec;
if (!pMsiApplyPatchA)
{
win_skip("MsiApplyPatchA is not available\n");
return;
}
if (!is_process_elevated())
{
skip("process is limited\n");
......@@ -1112,14 +1072,7 @@ static void test_system_tables( void )
MsiCloseHandle( hproduct );
r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL );
ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */
"expected ERROR_SUCCESS, got %u\n", r );
if (r == ERROR_PATCH_PACKAGE_INVALID)
{
win_skip("Windows Installer < 3.0 detected\n");
goto uninstall;
}
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
r = MsiOpenProductA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", &hproduct );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
......@@ -1203,7 +1156,6 @@ static void test_system_tables( void )
MsiCloseHandle( hdb );
MsiCloseHandle( hproduct );
uninstall:
r = MsiInstallProductA( msifile, "REMOVE=ALL" );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
......@@ -1220,11 +1172,6 @@ static void test_patch_registration( void )
DWORD size;
char buffer[MAX_PATH], patch_code[39];
if (!pMsiApplyPatchA || !pMsiGetPatchInfoExA || !pMsiEnumPatchesExA)
{
win_skip("required functions not available\n");
return;
}
if (!is_process_elevated())
{
skip("process is limited\n");
......@@ -1247,18 +1194,11 @@ static void test_patch_registration( void )
}
r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL );
ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */
"expected ERROR_SUCCESS, got %u\n", r );
if (r == ERROR_PATCH_PACKAGE_INVALID)
{
win_skip("Windows Installer < 3.0 detected\n");
goto uninstall;
}
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
buffer[0] = 0;
size = sizeof(buffer);
r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
"{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size );
......@@ -1267,7 +1207,7 @@ static void test_patch_registration( void )
buffer[0] = 0;
size = sizeof(buffer);
r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
"{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_MACHINE,
INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size );
......@@ -1275,36 +1215,35 @@ static void test_patch_registration( void )
buffer[0] = 0;
size = sizeof(buffer);
r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
"{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_USERMANAGED,
INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
ok( !buffer[0], "got %s\n", buffer );
r = pMsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
r = MsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED,
0, patch_code, NULL, NULL, NULL, NULL );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
ok( !strcmp( patch_code, "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}" ), "wrong patch code\n" );
r = pMsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
r = MsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED,
0, patch_code, NULL, NULL, NULL, NULL );
ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r );
r = pMsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
r = MsiEnumPatchesExA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED,
0, patch_code, NULL, NULL, NULL, NULL );
ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r );
uninstall:
r = MsiInstallProductA( msifile, "REMOVE=ALL" );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
buffer[0] = 0;
size = sizeof(buffer);
r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
"{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size );
......@@ -1324,8 +1263,6 @@ START_TEST(patch)
if (!is_process_elevated()) restart_as_admin_elevated();
init_function_pointers();
GetCurrentDirectoryA( MAX_PATH, prev_path );
GetTempPathA( MAX_PATH, temp_path );
SetCurrentDirectoryA( temp_path );
......
......@@ -349,7 +349,7 @@ static void test_msirecord(void)
ok(r == ERROR_SUCCESS, "failed to add stream to record\n");
r = MsiRecordReadStream(h, 1, buf, NULL);
ok(r == ERROR_INVALID_PARAMETER, "should return error\n");
DeleteFileA(filename); /* Windows 98 doesn't like this at all, so don't check return. */
DeleteFileA(filename);
r = MsiRecordReadStream(h, 1, NULL, NULL);
ok(r == ERROR_INVALID_PARAMETER, "should return error\n");
sz = sizeof buf;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -602,7 +602,7 @@ USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR, LPSTR, LPDWORD, LPSTR, LPDWORD, LPS
USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR, LPWSTR, LPDWORD, LPWSTR, LPDWORD, LPWSTR, LPDWORD);
#define MsiGetUserInfo WINELIB_NAME_AW(MsiGetUserInfo)
UINT WINAPI MsiProvidedComponentA(LPCSTR, LPCSTR, LPCSTR, DWORD, LPSTR, LPDWORD);
UINT WINAPI MsiProvideComponentA(LPCSTR, LPCSTR, LPCSTR, DWORD, LPSTR, LPDWORD);
UINT WINAPI MsiProvideComponentW(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPWSTR, LPDWORD);
#define MsiProvideComponent WINELIB_NAME_AW(MsiProvideComponent)
......
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