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
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <msidefs.h> #include <msidefs.h>
#include <msi.h> #include <msi.h>
#include <fci.h> #include <fci.h>
#include <srrestoreptapi.h>
#include <wtypes.h> #include <wtypes.h>
#include <shellapi.h> #include <shellapi.h>
#include <winsvc.h> #include <winsvc.h>
...@@ -40,23 +39,6 @@ ...@@ -40,23 +39,6 @@
#include "utils.h" #include "utils.h"
#include "typelib.h" #include "typelib.h"
static UINT (WINAPI *pMsiQueryComponentStateA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
static UINT (WINAPI *pMsiSourceListEnumSourcesA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
static UINT (WINAPI *pMsiSourceListGetInfoA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
static UINT (WINAPI *pMsiQueryFeatureStateExA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA *, STATEMGRSTATUS *);
static BOOL is_wow64; static BOOL is_wow64;
static const BOOL is_64bit = sizeof(void *) > sizeof(int); static const BOOL is_64bit = sizeof(void *) > sizeof(int);
...@@ -2372,33 +2354,6 @@ static const msi_table rep_tables[] = ...@@ -2372,33 +2354,6 @@ static const msi_table rep_tables[] =
/* make the max size large so there is only one cab file */ /* make the max size large so there is only one cab file */
#define MEDIA_SIZE 0x7FFFFFFF #define MEDIA_SIZE 0x7FFFFFFF
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, MsiSourceListGetInfoA);
GET_PROC(hmsi, MsiGetComponentPathExA);
GET_PROC(hmsi, MsiQueryFeatureStateExA);
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
GET_PROC(hsrclient, SRRemoveRestorePoint);
GET_PROC(hsrclient, SRSetRestorePointA);
#undef GET_PROC
}
static char *get_user_sid(void) static char *get_user_sid(void)
{ {
HANDLE token; HANDLE token;
...@@ -2454,34 +2409,6 @@ static void delete_test_files(void) ...@@ -2454,34 +2409,6 @@ static void delete_test_files(void)
RemoveDirectoryA("msitest"); RemoveDirectoryA("msitest");
} }
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 delete_pfmsitest_files(void) static void delete_pfmsitest_files(void)
{ {
SHFILEOPSTRUCTA shfl; SHFILEOPSTRUCTA shfl;
...@@ -3115,9 +3042,9 @@ static void test_publish_product(void) ...@@ -3115,9 +3042,9 @@ static void test_publish_product(void)
if (!res) if (!res)
CHECK_DEL_REG_STR(patches, "AllPatches", ""); CHECK_DEL_REG_STR(patches, "AllPatches", "");
delete_key(patches, "", access); RegDeleteKeyExA(patches, "", access, 0);
RegCloseKey(patches); RegCloseKey(patches);
delete_key(hkey, "", access); RegDeleteKeyExA(hkey, "", access, 0);
RegCloseKey(hkey); RegCloseKey(hkey);
currentuser: currentuser:
...@@ -3194,9 +3121,9 @@ currentuser: ...@@ -3194,9 +3121,9 @@ currentuser:
if (!res) if (!res)
CHECK_DEL_REG_STR(patches, "AllPatches", ""); CHECK_DEL_REG_STR(patches, "AllPatches", "");
delete_key(patches, "", access); RegDeleteKeyExA(patches, "", access, 0);
RegCloseKey(patches); RegCloseKey(patches);
delete_key(hkey, "", access); RegDeleteKeyExA(hkey, "", access, 0);
RegCloseKey(hkey); RegCloseKey(hkey);
machprod: machprod:
...@@ -3227,7 +3154,7 @@ machprod: ...@@ -3227,7 +3154,7 @@ machprod:
CHECK_DEL_REG_STR(net, "1", temp); CHECK_DEL_REG_STR(net, "1", temp);
res = delete_key(net, "", access); res = RegDeleteKeyExA(net, "", access, 0);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
RegCloseKey(net); RegCloseKey(net);
...@@ -3236,13 +3163,13 @@ machprod: ...@@ -3236,13 +3163,13 @@ machprod:
CHECK_DEL_REG_STR(media, "1", "DISK1;"); CHECK_DEL_REG_STR(media, "1", "DISK1;");
res = delete_key(media, "", access); res = RegDeleteKeyExA(media, "", access, 0);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
RegCloseKey(media); RegCloseKey(media);
res = delete_key(sourcelist, "", access); res = RegDeleteKeyExA(sourcelist, "", access, 0);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
RegCloseKey(sourcelist); RegCloseKey(sourcelist);
res = delete_key(hkey, "", access); res = RegDeleteKeyExA(hkey, "", access, 0);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
RegCloseKey(hkey); RegCloseKey(hkey);
...@@ -3251,7 +3178,7 @@ machprod: ...@@ -3251,7 +3178,7 @@ machprod:
CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", ""); CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", "");
res = delete_key(hkey, "", access); res = RegDeleteKeyExA(hkey, "", access, 0);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
RegCloseKey(hkey); RegCloseKey(hkey);
...@@ -3327,7 +3254,7 @@ static void test_publish_features(void) ...@@ -3327,7 +3254,7 @@ static void test_publish_features(void)
RegDeleteValueA(hkey, "feature"); RegDeleteValueA(hkey, "feature");
RegDeleteValueA(hkey, "montecristo"); RegDeleteValueA(hkey, "montecristo");
delete_key(hkey, "", access); RegDeleteKeyExA(hkey, "", access, 0);
RegCloseKey(hkey); RegCloseKey(hkey);
sprintf(keypath, udfeatpath, usersid); sprintf(keypath, udfeatpath, usersid);
...@@ -3339,10 +3266,10 @@ static void test_publish_features(void) ...@@ -3339,10 +3266,10 @@ static void test_publish_features(void)
RegDeleteValueA(hkey, "feature"); RegDeleteValueA(hkey, "feature");
RegDeleteValueA(hkey, "montecristo"); RegDeleteValueA(hkey, "montecristo");
delete_key(hkey, "", access); RegDeleteKeyExA(hkey, "", access, 0);
RegCloseKey(hkey); RegCloseKey(hkey);
sprintf(keypath, udpridpath, usersid); sprintf(keypath, udpridpath, usersid);
delete_key(HKEY_LOCAL_MACHINE, keypath, access); RegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath, access, 0);
/* PublishFeatures, machine */ /* PublishFeatures, machine */
r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1"); r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
...@@ -3363,7 +3290,7 @@ static void test_publish_features(void) ...@@ -3363,7 +3290,7 @@ static void test_publish_features(void)
RegDeleteValueA(hkey, "feature"); RegDeleteValueA(hkey, "feature");
RegDeleteValueA(hkey, "montecristo"); RegDeleteValueA(hkey, "montecristo");
delete_key(hkey, "", access); RegDeleteKeyExA(hkey, "", access, 0);
RegCloseKey(hkey); RegCloseKey(hkey);
sprintf(keypath, udfeatpath, "S-1-5-18"); sprintf(keypath, udfeatpath, "S-1-5-18");
...@@ -3375,10 +3302,10 @@ static void test_publish_features(void) ...@@ -3375,10 +3302,10 @@ static void test_publish_features(void)
RegDeleteValueA(hkey, "feature"); RegDeleteValueA(hkey, "feature");
RegDeleteValueA(hkey, "montecristo"); RegDeleteValueA(hkey, "montecristo");
delete_key(hkey, "", access); RegDeleteKeyExA(hkey, "", access, 0);
RegCloseKey(hkey); RegCloseKey(hkey);
sprintf(keypath, udpridpath, "S-1-5-18"); sprintf(keypath, udpridpath, "S-1-5-18");
delete_key(HKEY_LOCAL_MACHINE, keypath, access); RegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath, access, 0);
error: error:
DeleteFileA(msifile); DeleteFileA(msifile);
...@@ -3510,10 +3437,10 @@ static void test_register_user(void) ...@@ -3510,10 +3437,10 @@ static void test_register_user(void)
RegDeleteValueA(props, "ProductID"); RegDeleteValueA(props, "ProductID");
RegDeleteValueA(props, "RegCompany"); RegDeleteValueA(props, "RegCompany");
RegDeleteValueA(props, "RegOwner"); RegDeleteValueA(props, "RegOwner");
delete_key(props, "", access); RegDeleteKeyExA(props, "", access, 0);
RegCloseKey(props); RegCloseKey(props);
sprintf(keypath, keypridfmt, usersid); sprintf(keypath, keypridfmt, usersid);
delete_key(HKEY_LOCAL_MACHINE, keypath, access); RegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath, access, 0);
/* RegisterUser, machine */ /* RegisterUser, machine */
r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1"); r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
...@@ -3532,10 +3459,10 @@ static void test_register_user(void) ...@@ -3532,10 +3459,10 @@ static void test_register_user(void)
RegDeleteValueA(props, "ProductID"); RegDeleteValueA(props, "ProductID");
RegDeleteValueA(props, "RegCompany"); RegDeleteValueA(props, "RegCompany");
RegDeleteValueA(props, "RegOwner"); RegDeleteValueA(props, "RegOwner");
delete_key(props, "", access); RegDeleteKeyExA(props, "", access, 0);
RegCloseKey(props); RegCloseKey(props);
sprintf(keypath, keypridfmt, "S-1-5-18"); sprintf(keypath, keypridfmt, "S-1-5-18");
delete_key(HKEY_LOCAL_MACHINE, keypath, access); RegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath, access, 0);
error: error:
free(company); free(company);
...@@ -3612,7 +3539,7 @@ static void test_process_components(void) ...@@ -3612,7 +3539,7 @@ static void test_process_components(void)
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res); ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB"); RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
delete_key(comp, "", access); RegDeleteKeyExA(comp, "", access, 0);
RegCloseKey(comp); RegCloseKey(comp);
sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058"); sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
...@@ -3630,7 +3557,7 @@ static void test_process_components(void) ...@@ -3630,7 +3557,7 @@ static void test_process_components(void)
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res); ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB"); RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
delete_key(comp, "", access); RegDeleteKeyExA(comp, "", access, 0);
RegCloseKey(comp); RegCloseKey(comp);
/* ProcessComponents, machine */ /* ProcessComponents, machine */
...@@ -3654,7 +3581,7 @@ static void test_process_components(void) ...@@ -3654,7 +3581,7 @@ static void test_process_components(void)
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res); ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB"); RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
delete_key(comp, "", access); RegDeleteKeyExA(comp, "", access, 0);
RegCloseKey(comp); RegCloseKey(comp);
sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058"); sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
...@@ -3672,7 +3599,7 @@ static void test_process_components(void) ...@@ -3672,7 +3599,7 @@ static void test_process_components(void)
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res); ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB"); RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
delete_key(comp, "", access); RegDeleteKeyExA(comp, "", access, 0);
RegCloseKey(comp); RegCloseKey(comp);
error: error:
...@@ -3695,11 +3622,6 @@ static void test_publish(void) ...@@ -3695,11 +3622,6 @@ static void test_publish(void)
REGSAM access = KEY_ALL_ACCESS; REGSAM access = KEY_ALL_ACCESS;
DWORD error, type, size; DWORD error, type, size;
if (!pMsiQueryFeatureStateExA)
{
win_skip("MsiQueryFeatureStateExA is not available\n");
return;
}
if (!is_process_elevated()) if (!is_process_elevated())
{ {
skip("process is limited\n"); skip("process is limited\n");
...@@ -3736,7 +3658,7 @@ static void test_publish(void) ...@@ -3736,7 +3658,7 @@ static void test_publish(void)
state = 0xdead; state = 0xdead;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state); r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
error = GetLastError(); error = GetLastError();
ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
ok(state == 0xdead, "got %d\n", state); ok(state == 0xdead, "got %d\n", state);
...@@ -3744,7 +3666,7 @@ static void test_publish(void) ...@@ -3744,7 +3666,7 @@ static void test_publish(void)
state = 0xdead; state = 0xdead;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state); r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
error = GetLastError(); error = GetLastError();
ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
ok(state == 0xdead, "got %d\n", state); ok(state == 0xdead, "got %d\n", state);
...@@ -3752,7 +3674,7 @@ static void test_publish(void) ...@@ -3752,7 +3674,7 @@ static void test_publish(void)
state = 0xdead; state = 0xdead;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state); r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
error = GetLastError(); error = GetLastError();
ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
ok(state == 0xdead, "got %d\n", state); ok(state == 0xdead, "got %d\n", state);
...@@ -3764,7 +3686,7 @@ static void test_publish(void) ...@@ -3764,7 +3686,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
...@@ -3792,7 +3714,7 @@ static void test_publish(void) ...@@ -3792,7 +3714,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
...@@ -3815,7 +3737,7 @@ static void test_publish(void) ...@@ -3815,7 +3737,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r); ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
...@@ -3874,7 +3796,7 @@ static void test_publish(void) ...@@ -3874,7 +3796,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
...@@ -3896,7 +3818,7 @@ static void test_publish(void) ...@@ -3896,7 +3818,7 @@ static void test_publish(void)
state = 0xdead; state = 0xdead;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state); r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
error = GetLastError(); error = GetLastError();
ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
ok(state == 0xdead, "got %d\n", state); ok(state == 0xdead, "got %d\n", state);
...@@ -3904,7 +3826,7 @@ static void test_publish(void) ...@@ -3904,7 +3826,7 @@ static void test_publish(void)
state = 0xdead; state = 0xdead;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state); r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
error = GetLastError(); error = GetLastError();
ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
ok(state == 0xdead, "got %d\n", state); ok(state == 0xdead, "got %d\n", state);
...@@ -3912,7 +3834,7 @@ static void test_publish(void) ...@@ -3912,7 +3834,7 @@ static void test_publish(void)
state = 0xdead; state = 0xdead;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state); r = MsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
error = GetLastError(); error = GetLastError();
ok(r == ERROR_SUCCESS, "got %u\n", r); ok(r == ERROR_SUCCESS, "got %u\n", r);
ok(state == INSTALLSTATE_LOCAL, "got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "got %d\n", state);
...@@ -3921,7 +3843,7 @@ static void test_publish(void) ...@@ -3921,7 +3843,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
...@@ -3979,7 +3901,7 @@ static void test_publish(void) ...@@ -3979,7 +3901,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
...@@ -4002,7 +3924,7 @@ static void test_publish(void) ...@@ -4002,7 +3924,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
...@@ -4060,7 +3982,7 @@ static void test_publish(void) ...@@ -4060,7 +3982,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
...@@ -4118,7 +4040,7 @@ static void test_publish(void) ...@@ -4118,7 +4040,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
...@@ -4176,7 +4098,7 @@ static void test_publish(void) ...@@ -4176,7 +4098,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
...@@ -4199,7 +4121,7 @@ static void test_publish(void) ...@@ -4199,7 +4121,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
...@@ -4265,7 +4187,7 @@ static void test_publish(void) ...@@ -4265,7 +4187,7 @@ static void test_publish(void)
state = MsiQueryFeatureStateA(prodcode, "montecristo"); state = MsiQueryFeatureStateA(prodcode, "montecristo");
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state); "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
...@@ -4292,11 +4214,6 @@ static void test_publish_sourcelist(void) ...@@ -4292,11 +4214,6 @@ static void test_publish_sourcelist(void)
CHAR path[MAX_PATH]; CHAR path[MAX_PATH];
CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"; CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
{
win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
return;
}
if (!is_process_elevated()) if (!is_process_elevated())
{ {
skip("process is limited\n"); skip("process is limited\n");
...@@ -4323,16 +4240,16 @@ static void test_publish_sourcelist(void) ...@@ -4323,16 +4240,16 @@ static void test_publish_sourcelist(void)
/* nothing published */ /* nothing published */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == MAX_PATH, "got %lu\n", size); ok(size == MAX_PATH, "got %lu\n", size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == MAX_PATH, "got %lu\n", size); ok(size == MAX_PATH, "got %lu\n", size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
...@@ -4345,16 +4262,16 @@ static void test_publish_sourcelist(void) ...@@ -4345,16 +4262,16 @@ static void test_publish_sourcelist(void)
/* after RegisterProduct */ /* after RegisterProduct */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == MAX_PATH, "got %lu\n", size); ok(size == MAX_PATH, "got %lu\n", size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == MAX_PATH, "got %lu\n", size); ok(size == MAX_PATH, "got %lu\n", size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
...@@ -4367,16 +4284,16 @@ static void test_publish_sourcelist(void) ...@@ -4367,16 +4284,16 @@ static void test_publish_sourcelist(void)
/* after ProcessComponents */ /* after ProcessComponents */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == MAX_PATH, "got %lu\n", size); ok(size == MAX_PATH, "got %lu\n", size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == MAX_PATH, "got %lu\n", size); ok(size == MAX_PATH, "got %lu\n", size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
...@@ -4389,16 +4306,16 @@ static void test_publish_sourcelist(void) ...@@ -4389,16 +4306,16 @@ static void test_publish_sourcelist(void)
/* after PublishFeatures */ /* after PublishFeatures */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == MAX_PATH, "got %lu\n", size); ok(size == MAX_PATH, "got %lu\n", size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(size == MAX_PATH, "got %lu\n", size); ok(size == MAX_PATH, "got %lu\n", size);
ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value); ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
...@@ -4411,24 +4328,24 @@ static void test_publish_sourcelist(void) ...@@ -4411,24 +4328,24 @@ static void test_publish_sourcelist(void)
/* after PublishProduct */ /* after PublishProduct */
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size); MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value); ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
ok(size == 11, "Expected 11, got %lu\n", size); ok(size == 11, "Expected 11, got %lu\n", size);
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size); MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
ok(size == 0, "Expected 0, got %lu\n", size); ok(size == 0, "Expected 0, got %lu\n", size);
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size); MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value); ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
ok(size == 0, "Expected 0, got %lu\n", size); ok(size == 0, "Expected 0, got %lu\n", size);
...@@ -4438,40 +4355,40 @@ static void test_publish_sourcelist(void) ...@@ -4438,40 +4355,40 @@ static void test_publish_sourcelist(void)
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size); MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value); ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
ok(size == lstrlenA(path), "Expected %d, got %lu\n", lstrlenA(path), size); ok(size == lstrlenA(path), "Expected %d, got %lu\n", lstrlenA(path), size);
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size); MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value); ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
ok(size == 1, "Expected 1, got %lu\n", size); ok(size == 1, "Expected 1, got %lu\n", size);
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size); MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size);
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size); MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value); ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
ok(size == lstrlenA(path), "Expected %d, got %lu\n", lstrlenA(path), size); ok(size == lstrlenA(path), "Expected %d, got %lu\n", lstrlenA(path), size);
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(value, "aaa"); lstrcpyA(value, "aaa");
r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, r = MsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size); MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value); ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size); ok(size == MAX_PATH, "Expected MAX_PATH, got %lu\n", size);
...@@ -5810,10 +5727,7 @@ static void test_publish_components(void) ...@@ -5810,10 +5727,7 @@ static void test_publish_components(void)
"english.txt", INSTALLMODE_DEFAULT, NULL, &size); "english.txt", INSTALLMODE_DEFAULT, NULL, &size);
ok(r == ERROR_SUCCESS, "MsiProvideQualifiedComponent returned %d\n", r); ok(r == ERROR_SUCCESS, "MsiProvideQualifiedComponent returned %d\n", r);
if (pRegDeleteKeyExA) res = RegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath2, KEY_WOW64_64KEY, 0);
res = pRegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath2, KEY_WOW64_64KEY, 0);
else
res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, keypath2);
ok(res == ERROR_SUCCESS, "RegDeleteKey failed %ld\n", res); ok(res == ERROR_SUCCESS, "RegDeleteKey failed %ld\n", res);
res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &key); res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &key);
...@@ -6581,16 +6495,12 @@ START_TEST(action) ...@@ -6581,16 +6495,12 @@ START_TEST(action)
{ {
DWORD len; DWORD len;
char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH]; 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(); if (!is_process_elevated()) restart_as_admin_elevated();
init_functionpointers();
subtest("custom"); subtest("custom");
if (pIsWow64Process) IsWow64Process(GetCurrentProcess(), &is_wow64);
pIsWow64Process(GetCurrentProcess(), &is_wow64);
GetCurrentDirectoryA(MAX_PATH, prev_path); GetCurrentDirectoryA(MAX_PATH, prev_path);
GetTempPathA(MAX_PATH, temp_path); GetTempPathA(MAX_PATH, temp_path);
...@@ -6605,18 +6515,6 @@ START_TEST(action) ...@@ -6605,18 +6515,6 @@ START_TEST(action)
ok(get_system_dirs(), "failed to retrieve system dirs\n"); ok(get_system_dirs(), "failed to retrieve system dirs\n");
ok(get_user_dirs(), "failed to retrieve user 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 /* 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 * 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 * path otherwise we still end up with some extra logfiles as some tests
...@@ -6660,13 +6558,5 @@ START_TEST(action) ...@@ -6660,13 +6558,5 @@ START_TEST(action)
test_remove_existing_products(); test_remove_existing_products();
DeleteFileA(log_file); 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); SetCurrentDirectoryA(prev_path);
} }
...@@ -36,9 +36,6 @@ ...@@ -36,9 +36,6 @@
static BOOL is_wow64; 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); DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static const char *msifile = "winetest-automation.msi"; static const char *msifile = "winetest-automation.msi";
...@@ -191,29 +188,6 @@ static const msi_summary_info summary_info[] = ...@@ -191,29 +188,6 @@ static const msi_summary_info summary_info[] =
ADD_INFO_FILETIME(PID_LASTPRINTED, &systemtime) 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 * Database Helpers
*/ */
...@@ -2259,7 +2233,7 @@ static UINT delete_registry_key(HKEY hkeyParent, LPCSTR subkey, REGSAM access) ...@@ -2259,7 +2233,7 @@ static UINT delete_registry_key(HKEY hkeyParent, LPCSTR subkey, REGSAM access)
RegCloseKey(hkey); RegCloseKey(hkey);
free(string); free(string);
delete_key_portable(hkeyParent, subkey, access); RegDeleteKeyExA(hkeyParent, subkey, access, 0);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -2439,13 +2413,13 @@ static void test_Installer_InstallProduct(void) ...@@ -2439,13 +2413,13 @@ static void test_Installer_InstallProduct(void)
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
/* Remove registry keys written by RegisterProduct standard action */ /* 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}", "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); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
res = delete_key_portable(HKEY_LOCAL_MACHINE, res = RegDeleteKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\D8E760ECA1E276347B43E42BDBDA5656", access); "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\D8E760ECA1E276347B43E42BDBDA5656", access, 0);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
res = find_registry_key(HKEY_LOCAL_MACHINE, res = find_registry_key(HKEY_LOCAL_MACHINE,
...@@ -2456,8 +2430,8 @@ static void test_Installer_InstallProduct(void) ...@@ -2456,8 +2430,8 @@ static void test_Installer_InstallProduct(void)
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
RegCloseKey(hkey); RegCloseKey(hkey);
res = delete_key_portable(HKEY_LOCAL_MACHINE, res = RegDeleteKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products\\af054738b93a8cb43b12803b397f483b", access); "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products\\af054738b93a8cb43b12803b397f483b", access, 0);
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res); ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
/* Remove registry keys written by PublishProduct standard action */ /* Remove registry keys written by PublishProduct standard action */
...@@ -2624,12 +2598,9 @@ START_TEST(automation) ...@@ -2624,12 +2598,9 @@ START_TEST(automation)
CLSID clsid; CLSID clsid;
IUnknown *pUnk; IUnknown *pUnk;
init_functionpointers();
if (!is_process_elevated()) restart_as_admin_elevated(); if (!is_process_elevated()) restart_as_admin_elevated();
if (pIsWow64Process) IsWow64Process(GetCurrentProcess(), &is_wow64);
pIsWow64Process(GetCurrentProcess(), &is_wow64);
GetSystemTimeAsFileTime(&systemtime); GetSystemTimeAsFileTime(&systemtime);
...@@ -2666,6 +2637,5 @@ START_TEST(automation) ...@@ -2666,6 +2637,5 @@ START_TEST(automation)
} }
OleUninitialize(); OleUninitialize();
SetCurrentDirectoryA(prev_path); SetCurrentDirectoryA(prev_path);
} }
...@@ -1128,9 +1128,7 @@ static void test_invalid_functions(MSIHANDLE hinst) ...@@ -1128,9 +1128,7 @@ static void test_invalid_functions(MSIHANDLE hinst)
ok(hinst, r == ERROR_INVALID_HANDLE, "got %u\n", r); ok(hinst, r == ERROR_INVALID_HANDLE, "got %u\n", r);
r = MsiCreateTransformSummaryInfoA(db, db, "bogus.mst", 0, 0); r = MsiCreateTransformSummaryInfoA(db, db, "bogus.mst", 0, 0);
todo_wine ok(hinst, r == ERROR_INSTALL_PACKAGE_OPEN_FAILED || todo_wine ok(hinst, r == ERROR_INSTALL_PACKAGE_OPEN_FAILED, "got %u\n", r);
r == ERROR_INSTALL_PACKAGE_INVALID /* winxp */,
"got %u\n", r);
GetCurrentDirectoryA(sizeof(path), path); GetCurrentDirectoryA(sizeof(path), path);
r = MsiDatabaseExportA(db, "Test", path, "bogus.idt"); r = MsiDatabaseExportA(db, "Test", path, "bogus.idt");
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <msi.h> #include <msi.h>
#include <fci.h> #include <fci.h>
#include <objidl.h> #include <objidl.h>
#include <srrestoreptapi.h>
#include <shlobj.h> #include <shlobj.h>
#include <winsvc.h> #include <winsvc.h>
#include <shellapi.h> #include <shellapi.h>
...@@ -37,21 +36,6 @@ ...@@ -37,21 +36,6 @@
#include "wine/test.h" #include "wine/test.h"
#include "utils.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 BOOL is_wow64;
static const BOOL is_64bit = sizeof(void *) > sizeof(int); static const BOOL is_64bit = sizeof(void *) > sizeof(int);
...@@ -2224,33 +2208,6 @@ static int CDECL fci_delete(char *pszFile, int *err, void *pv) ...@@ -2224,33 +2208,6 @@ static int CDECL fci_delete(char *pszFile, int *err, void *pv)
return 0; 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) BOOL is_process_elevated(void)
{ {
HANDLE token; HANDLE token;
...@@ -2711,34 +2668,6 @@ void create_database_wordcount(const CHAR *name, const msi_table *tables, int nu ...@@ -2711,34 +2668,6 @@ void create_database_wordcount(const CHAR *name, const msi_table *tables, int nu
free( nameW ); 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) static void test_MsiInstallProduct(void)
{ {
UINT r; UINT r;
...@@ -2813,7 +2742,7 @@ static void test_MsiInstallProduct(void) ...@@ -2813,7 +2742,7 @@ static void test_MsiInstallProduct(void)
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path); 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 */ /* not published, reinstall */
r = MsiInstallProductA(msifile, NULL); r = MsiInstallProductA(msifile, NULL);
...@@ -5282,7 +5211,7 @@ static void process_pending_renames(HKEY hkey) ...@@ -5282,7 +5211,7 @@ static void process_pending_renames(HKEY hkey)
else else
{ {
fileret = DeleteFileA(src); 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) ...@@ -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\\preselected.txt", TRUE), "file not removed\n");
ok(!delete_pf("msitest", FALSE), "directory 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: error:
DeleteFileA("msitest\\override.txt"); DeleteFileA("msitest\\override.txt");
...@@ -5890,7 +5819,7 @@ static void test_mixed_package(void) ...@@ -5890,7 +5819,7 @@ static void test_mixed_package(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); 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); 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); 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"); ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
...@@ -5953,7 +5882,7 @@ static void test_mixed_package(void) ...@@ -5953,7 +5882,7 @@ static void test_mixed_package(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); 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); 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); 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"); ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
...@@ -6189,7 +6118,7 @@ static void test_wow64(void) ...@@ -6189,7 +6118,7 @@ static void test_wow64(void)
goto error; goto error;
} }
pWow64DisableWow64FsRedirection(&cookie); Wow64DisableWow64FsRedirection(&cookie);
ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n"); ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n"); ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
...@@ -6215,7 +6144,7 @@ static void test_wow64(void) ...@@ -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\\filename", TRUE), "File not installed\n");
ok(delete_pf_native("msitest", FALSE), "Directory not created\n"); ok(delete_pf_native("msitest", FALSE), "Directory not created\n");
pWow64RevertWow64FsRedirection(cookie); Wow64RevertWow64FsRedirection(cookie);
error: error:
delete_test_files(); delete_test_files();
...@@ -6256,16 +6185,12 @@ START_TEST(install) ...@@ -6256,16 +6185,12 @@ START_TEST(install)
{ {
DWORD len; DWORD len;
char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH]; 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(); if (!is_process_elevated()) restart_as_admin_elevated();
init_functionpointers();
subtest("custom"); subtest("custom");
if (pIsWow64Process) IsWow64Process(GetCurrentProcess(), &is_wow64);
pIsWow64Process(GetCurrentProcess(), &is_wow64);
GetCurrentDirectoryA(MAX_PATH, prev_path); GetCurrentDirectoryA(MAX_PATH, prev_path);
GetTempPathA(MAX_PATH, temp_path); GetTempPathA(MAX_PATH, temp_path);
...@@ -6280,18 +6205,6 @@ START_TEST(install) ...@@ -6280,18 +6205,6 @@ START_TEST(install)
ok(get_system_dirs(), "failed to retrieve system dirs\n"); ok(get_system_dirs(), "failed to retrieve system dirs\n");
ok(get_user_dirs(), "failed to retrieve user 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 /* 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 * 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 * path otherwise we still end up with some extra logfiles as some tests
...@@ -6301,8 +6214,7 @@ START_TEST(install) ...@@ -6301,8 +6214,7 @@ START_TEST(install)
lstrcatA(log_file, "\\msitest.log"); lstrcatA(log_file, "\\msitest.log");
MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0); MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */ test_MsiInstallProduct();
test_MsiInstallProduct();
test_MsiSetComponentState(); test_MsiSetComponentState();
test_packagecoltypes(); test_packagecoltypes();
test_continuouscabs(); test_continuouscabs();
...@@ -6349,15 +6261,6 @@ START_TEST(install) ...@@ -6349,15 +6261,6 @@ START_TEST(install)
test_source_resolution(); test_source_resolution();
DeleteFileA(customdll); DeleteFileA(customdll);
DeleteFileA(log_file); 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); 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; ...@@ -38,43 +38,6 @@ static BOOL is_wow64;
static const char msifile[] = "winetest-package.msi"; static const char msifile[] = "winetest-package.msi";
static const WCHAR msifileW[] = L"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) static char *get_user_sid(void)
{ {
HANDLE token; HANDLE token;
...@@ -138,12 +101,7 @@ static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM acce ...@@ -138,12 +101,7 @@ static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM acce
} }
if (lpszSubKey) if (lpszSubKey)
{ ret = RegDeleteKeyExW(hKey, lpszSubKey, access, 0);
if (pRegDeleteKeyExW)
ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
else
ret = RegDeleteKeyW(hKey, lpszSubKey);
}
else else
while (TRUE) while (TRUE)
{ {
...@@ -977,27 +935,6 @@ done: ...@@ -977,27 +935,6 @@ done:
return ret; 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) static BOOL is_root(const char *path)
{ {
return (isalpha(path[0]) && path[1] == ':' && path[2] == '\\' && !path[3]); return (isalpha(path[0]) && path[1] == ':' && path[2] == '\\' && !path[3]);
...@@ -2038,20 +1975,16 @@ static void test_condition(void) ...@@ -2038,20 +1975,16 @@ static void test_condition(void)
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r); ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<\"\xe5\""); r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<\"\xe5\"");
ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE), ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
"wrong return val (%d)\n", r);
r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\">\"\xe5\""); r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\">\"\xe5\"");
ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE), ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
"wrong return val (%d)\n", r);
r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<>\"\xe5\""); r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<>\"\xe5\"");
ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE), ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
"wrong return val (%d)\n", r);
r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"=\"\xe5\""); r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"=\"\xe5\"");
ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE), ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
"wrong return val (%d)\n", r);
MsiCloseHandle( hpkg ); MsiCloseHandle( hpkg );
DeleteFileA(msifile); DeleteFileA(msifile);
...@@ -2991,7 +2924,6 @@ static void test_states(void) ...@@ -2991,7 +2924,6 @@ static void test_states(void)
MSIHANDLE hpkg, hprod; MSIHANDLE hpkg, hprod;
UINT r; UINT r;
MSIHANDLE hdb; MSIHANDLE hdb;
BOOL is_broken;
char value[MAX_PATH]; char value[MAX_PATH];
DWORD size; DWORD size;
...@@ -3528,8 +3460,7 @@ static void test_states(void) ...@@ -3528,8 +3460,7 @@ static void test_states(void)
/* reinstall the product */ /* reinstall the product */
r = MsiInstallProductA(msifile3, "REINSTALL=ALL"); r = MsiInstallProductA(msifile3, "REINSTALL=ALL");
is_broken = (r == ERROR_INSTALL_FAILURE); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(r == ERROR_SUCCESS || broken(is_broken) /* win2k3 */, "Expected ERROR_SUCCESS, got %d\n", r);
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "five"); state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "five");
ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state); ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state);
...@@ -3701,8 +3632,7 @@ static void test_states(void) ...@@ -3701,8 +3632,7 @@ static void test_states(void)
MsiCloseHandle( hpkg ); MsiCloseHandle( hpkg );
r = MsiInstallProductA(msifile, ""); r = MsiInstallProductA(msifile, "");
ok(r == ERROR_SUCCESS || (is_broken && r == ERROR_INSTALL_FAILURE) /* win2k3 */, ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
"Expected ERROR_SUCCESS, got %d\n", r);
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "one"); state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "one");
ok(state == INSTALLSTATE_SOURCE, "state = %d\n", state); ok(state == INSTALLSTATE_SOURCE, "state = %d\n", state);
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "two"); state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "two");
...@@ -4040,8 +3970,8 @@ done: ...@@ -4040,8 +3970,8 @@ done:
MsiCloseHandle( hpkg ); MsiCloseHandle( hpkg );
DeleteFileA(msifile); DeleteFileA(msifile);
RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi"); RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi");
delete_key(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_32KEY); RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_32KEY, 0);
delete_key(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_64KEY); RegDeleteKeyExA(HKEY_LOCAL_MACHINE, "Software\\Winetest_msi", KEY_WOW64_64KEY, 0);
} }
static void test_appsearch_complocator(void) static void test_appsearch_complocator(void)
...@@ -4332,9 +4262,7 @@ static void test_appsearch_reglocator(void) ...@@ -4332,9 +4262,7 @@ static void test_appsearch_reglocator(void)
users = 0; users = 0;
res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users); res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
ok(res == ERROR_SUCCESS || ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
broken(res == ERROR_INVALID_PARAMETER),
"Expected ERROR_SUCCESS, got %ld\n", res);
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
{ {
...@@ -7955,6 +7883,7 @@ static void test_MsiGetProductProperty(void) ...@@ -7955,6 +7883,7 @@ static void test_MsiGetProductProperty(void)
skip("Not enough rights to perform tests\n"); skip("Not enough rights to perform tests\n");
RegDeleteKeyA(prodkey, ""); RegDeleteKeyA(prodkey, "");
RegCloseKey(prodkey); RegCloseKey(prodkey);
DeleteFileA(msifile);
return; return;
} }
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
...@@ -7965,12 +7894,16 @@ static void test_MsiGetProductProperty(void) ...@@ -7965,12 +7894,16 @@ static void test_MsiGetProductProperty(void)
lstrcpyA(val, path); lstrcpyA(val, path);
lstrcatA(val, "\\"); lstrcatA(val, "\\");
lstrcatA(val, msifile); lstrcatA(val, msifile);
res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ, res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ, (const BYTE *)val, lstrlenA(val) + 1);
(const BYTE *)val, lstrlenA(val) + 1);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
hprod = 0xdeadbeef; hprod = 0xdeadbeef;
r = MsiOpenProductA(prodcode, &hprod); 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(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n"); ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
...@@ -8191,13 +8124,13 @@ static void test_MsiGetProductProperty(void) ...@@ -8191,13 +8124,13 @@ static void test_MsiGetProductProperty(void)
"Expected %d, got %lu\n", lstrlenW(prodcodeW), size); "Expected %d, got %lu\n", lstrlenW(prodcodeW), size);
MsiCloseHandle(hprod); MsiCloseHandle(hprod);
done:
RegDeleteValueA(props, "LocalPackage"); RegDeleteValueA(props, "LocalPackage");
delete_key(props, "", access); RegDeleteKeyExA(props, "", access, 0);
RegCloseKey(props); RegCloseKey(props);
delete_key(userkey, "", access); RegDeleteKeyExA(userkey, "", access, 0);
RegCloseKey(userkey); RegCloseKey(userkey);
delete_key(prodkey, "", access); RegDeleteKeyExA(prodkey, "", access, 0);
RegCloseKey(prodkey); RegCloseKey(prodkey);
DeleteFileA(msifile); DeleteFileA(msifile);
} }
...@@ -9560,16 +9493,11 @@ static void test_top_level_action(void) ...@@ -9560,16 +9493,11 @@ static void test_top_level_action(void)
START_TEST(package) START_TEST(package)
{ {
char temp_path[MAX_PATH], prev_path[MAX_PATH]; char temp_path[MAX_PATH], prev_path[MAX_PATH];
STATEMGRSTATUS status;
BOOL ret = FALSE;
DWORD len; DWORD len;
if (!is_process_elevated()) restart_as_admin_elevated(); if (!is_process_elevated()) restart_as_admin_elevated();
init_functionpointers(); IsWow64Process(GetCurrentProcess(), &is_wow64);
if (pIsWow64Process)
pIsWow64Process(GetCurrentProcess(), &is_wow64);
GetCurrentDirectoryA(MAX_PATH, prev_path); GetCurrentDirectoryA(MAX_PATH, prev_path);
GetTempPathA(MAX_PATH, temp_path); GetTempPathA(MAX_PATH, temp_path);
...@@ -9581,18 +9509,6 @@ START_TEST(package) ...@@ -9581,18 +9509,6 @@ START_TEST(package)
if (len && (CURR_DIR[len - 1] == '\\')) if (len && (CURR_DIR[len - 1] == '\\'))
CURR_DIR[len - 1] = 0; 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_createpackage();
test_doaction(); test_doaction();
test_gettargetpath_bad(); test_gettargetpath_bad();
...@@ -9631,12 +9547,5 @@ START_TEST(package) ...@@ -9631,12 +9547,5 @@ START_TEST(package)
test_controlevent(); test_controlevent();
test_top_level_action(); 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); SetCurrentDirectoryA(prev_path);
} }
...@@ -32,12 +32,6 @@ ...@@ -32,12 +32,6 @@
#include "wine/test.h" #include "wine/test.h"
#include "utils.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 *msifile = "winetest-patch.msi";
static const char *mspfile = "winetest-patch.msp"; static const char *mspfile = "winetest-patch.msp";
static const WCHAR msifileW[] = L"winetest-patch.msi"; static const WCHAR msifileW[] = L"winetest-patch.msi";
...@@ -146,22 +140,6 @@ static const struct msi_table tables[] = ...@@ -146,22 +140,6 @@ static const struct msi_table tables[] =
ADD_TABLE( condition ) 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 ) static BOOL get_program_files_dir( char *buf, char *buf2 )
{ {
HKEY hkey; HKEY hkey;
...@@ -691,11 +669,6 @@ static void test_simple_patch( void ) ...@@ -691,11 +669,6 @@ static void test_simple_patch( void )
WCHAR pathW[MAX_PATH]; WCHAR pathW[MAX_PATH];
MSIHANDLE hpackage, hdb, hview, hrec; MSIHANDLE hpackage, hdb, hview, hrec;
if (!pMsiApplyPatchA)
{
win_skip("MsiApplyPatchA is not available\n");
return;
}
if (!is_process_elevated()) if (!is_process_elevated())
{ {
skip("process is limited\n"); skip("process is limited\n");
...@@ -774,14 +747,7 @@ static void test_simple_patch( void ) ...@@ -774,14 +747,7 @@ static void test_simple_patch( void )
MsiCloseHandle( hpackage ); MsiCloseHandle( hpackage );
r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL ); r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL );
ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */ ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
"expected ERROR_SUCCESS, got %u\n", r );
if (r == ERROR_PATCH_PACKAGE_INVALID)
{
win_skip("Windows Installer < 3.0 detected\n");
goto uninstall;
}
size = get_pf_file_size( "msitest\\patch.txt" ); size = get_pf_file_size( "msitest\\patch.txt" );
ok( size == 1002, "expected 1002, got %lu\n", size ); ok( size == 1002, "expected 1002, got %lu\n", size );
...@@ -857,7 +823,6 @@ static void test_simple_patch( void ) ...@@ -857,7 +823,6 @@ static void test_simple_patch( void )
MsiCloseHandle( hview ); MsiCloseHandle( hview );
MsiCloseHandle( hdb ); MsiCloseHandle( hdb );
uninstall:
size = sizeof(path); size = sizeof(path);
r = MsiGetProductInfoA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", r = MsiGetProductInfoA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
"InstallSource", path, &size ); "InstallSource", path, &size );
...@@ -1030,11 +995,6 @@ static void test_system_tables( void ) ...@@ -1030,11 +995,6 @@ static void test_system_tables( void )
const char *query; const char *query;
MSIHANDLE hproduct, hdb, hview, hrec; MSIHANDLE hproduct, hdb, hview, hrec;
if (!pMsiApplyPatchA)
{
win_skip("MsiApplyPatchA is not available\n");
return;
}
if (!is_process_elevated()) if (!is_process_elevated())
{ {
skip("process is limited\n"); skip("process is limited\n");
...@@ -1112,14 +1072,7 @@ static void test_system_tables( void ) ...@@ -1112,14 +1072,7 @@ static void test_system_tables( void )
MsiCloseHandle( hproduct ); MsiCloseHandle( hproduct );
r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL ); r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL );
ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */ ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
"expected ERROR_SUCCESS, got %u\n", r );
if (r == ERROR_PATCH_PACKAGE_INVALID)
{
win_skip("Windows Installer < 3.0 detected\n");
goto uninstall;
}
r = MsiOpenProductA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", &hproduct ); r = MsiOpenProductA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", &hproduct );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
...@@ -1203,7 +1156,6 @@ static void test_system_tables( void ) ...@@ -1203,7 +1156,6 @@ static void test_system_tables( void )
MsiCloseHandle( hdb ); MsiCloseHandle( hdb );
MsiCloseHandle( hproduct ); MsiCloseHandle( hproduct );
uninstall:
r = MsiInstallProductA( msifile, "REMOVE=ALL" ); r = MsiInstallProductA( msifile, "REMOVE=ALL" );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
...@@ -1220,11 +1172,6 @@ static void test_patch_registration( void ) ...@@ -1220,11 +1172,6 @@ static void test_patch_registration( void )
DWORD size; DWORD size;
char buffer[MAX_PATH], patch_code[39]; char buffer[MAX_PATH], patch_code[39];
if (!pMsiApplyPatchA || !pMsiGetPatchInfoExA || !pMsiEnumPatchesExA)
{
win_skip("required functions not available\n");
return;
}
if (!is_process_elevated()) if (!is_process_elevated())
{ {
skip("process is limited\n"); skip("process is limited\n");
...@@ -1247,67 +1194,59 @@ static void test_patch_registration( void ) ...@@ -1247,67 +1194,59 @@ static void test_patch_registration( void )
} }
r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL ); r = MsiApplyPatchA( mspfile, NULL, INSTALLTYPE_DEFAULT, NULL );
ok( r == ERROR_SUCCESS || broken( r == ERROR_PATCH_PACKAGE_INVALID ), /* version 2.0 */ ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
"expected ERROR_SUCCESS, got %u\n", r );
if (r == ERROR_PATCH_PACKAGE_INVALID)
{
win_skip("Windows Installer < 3.0 detected\n");
goto uninstall;
}
buffer[0] = 0; buffer[0] = 0;
size = sizeof(buffer); size = sizeof(buffer);
r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
"{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_USERUNMANAGED, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
ok( buffer[0], "buffer empty\n" ); ok( buffer[0], "buffer empty\n" );
buffer[0] = 0; buffer[0] = 0;
size = sizeof(buffer); size = sizeof(buffer);
r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
"{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_MACHINE, NULL, MSIINSTALLCONTEXT_MACHINE,
INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size );
ok( r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r ); ok( r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r );
buffer[0] = 0; buffer[0] = 0;
size = sizeof(buffer); size = sizeof(buffer);
r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
"{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_USERMANAGED, NULL, MSIINSTALLCONTEXT_USERMANAGED,
INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
ok( !buffer[0], "got %s\n", buffer ); 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, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, MSIPATCHSTATE_APPLIED,
0, patch_code, NULL, NULL, NULL, NULL ); 0, patch_code, NULL, NULL, NULL, NULL );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
ok( !strcmp( patch_code, "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}" ), "wrong patch code\n" ); 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, NULL, MSIINSTALLCONTEXT_MACHINE, MSIPATCHSTATE_APPLIED,
0, patch_code, NULL, NULL, NULL, NULL ); 0, patch_code, NULL, NULL, NULL, NULL );
ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r ); 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, NULL, MSIINSTALLCONTEXT_USERMANAGED, MSIPATCHSTATE_APPLIED,
0, patch_code, NULL, NULL, NULL, NULL ); 0, patch_code, NULL, NULL, NULL, NULL );
ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r ); ok( r == ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %u\n", r );
uninstall:
r = MsiInstallProductA( msifile, "REMOVE=ALL" ); r = MsiInstallProductA( msifile, "REMOVE=ALL" );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r ); ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
buffer[0] = 0; buffer[0] = 0;
size = sizeof(buffer); size = sizeof(buffer);
r = pMsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}", r = MsiGetPatchInfoExA( "{0F96CDC0-4CDF-4304-B283-7B9264889EF7}",
"{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}", "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
NULL, MSIINSTALLCONTEXT_USERUNMANAGED, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size ); INSTALLPROPERTY_LOCALPACKAGEA, buffer, &size );
ok( r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r ); ok( r == ERROR_UNKNOWN_PRODUCT, "expected ERROR_UNKNOWN_PRODUCT, got %u\n", r );
cleanup: cleanup:
...@@ -1324,8 +1263,6 @@ START_TEST(patch) ...@@ -1324,8 +1263,6 @@ START_TEST(patch)
if (!is_process_elevated()) restart_as_admin_elevated(); if (!is_process_elevated()) restart_as_admin_elevated();
init_function_pointers();
GetCurrentDirectoryA( MAX_PATH, prev_path ); GetCurrentDirectoryA( MAX_PATH, prev_path );
GetTempPathA( MAX_PATH, temp_path ); GetTempPathA( MAX_PATH, temp_path );
SetCurrentDirectoryA( temp_path ); SetCurrentDirectoryA( temp_path );
......
...@@ -349,7 +349,7 @@ static void test_msirecord(void) ...@@ -349,7 +349,7 @@ static void test_msirecord(void)
ok(r == ERROR_SUCCESS, "failed to add stream to record\n"); ok(r == ERROR_SUCCESS, "failed to add stream to record\n");
r = MsiRecordReadStream(h, 1, buf, NULL); r = MsiRecordReadStream(h, 1, buf, NULL);
ok(r == ERROR_INVALID_PARAMETER, "should return error\n"); 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); r = MsiRecordReadStream(h, 1, NULL, NULL);
ok(r == ERROR_INVALID_PARAMETER, "should return error\n"); ok(r == ERROR_INVALID_PARAMETER, "should return error\n");
sz = sizeof buf; 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 ...@@ -602,7 +602,7 @@ USERINFOSTATE WINAPI MsiGetUserInfoA(LPCSTR, LPSTR, LPDWORD, LPSTR, LPDWORD, LPS
USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR, LPWSTR, LPDWORD, LPWSTR, LPDWORD, LPWSTR, LPDWORD); USERINFOSTATE WINAPI MsiGetUserInfoW(LPCWSTR, LPWSTR, LPDWORD, LPWSTR, LPDWORD, LPWSTR, LPDWORD);
#define MsiGetUserInfo WINELIB_NAME_AW(MsiGetUserInfo) #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); UINT WINAPI MsiProvideComponentW(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPWSTR, LPDWORD);
#define MsiProvideComponent WINELIB_NAME_AW(MsiProvideComponent) #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