msi/tests: Skip tests when the current user has insufficient rights.

This commit is contained in:
Hans Leidekker 2010-07-22 11:48:28 +02:00 committed by Alexandre Julliard
parent dad50e3aa0
commit 10a32a0b7a
6 changed files with 851 additions and 38 deletions

View File

@ -733,6 +733,12 @@ static void test_dispatch(void)
V_VT(&vararg[0]) = VT_BSTR;
V_BSTR(&vararg[0]) = SysAllocString(path);
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
if (hr == DISP_E_EXCEPTION)
{
skip("OpenPackage failed, insufficient rights?\n");
DeleteFileW(path);
return;
}
ok(hr == S_OK, "IDispatch::Invoke returned 0x%08x\n", hr);
VariantClear(&vararg[0]);
VariantClear(&varresult);
@ -2405,7 +2411,7 @@ static void test_Installer_InstallProduct(void)
hr = Installer_InstallProduct(szMsifile, NULL);
if (hr == DISP_E_EXCEPTION)
{
skip("Installer object not supported.\n");
skip("InstallProduct failed, insufficient rights?\n");
delete_test_files();
return;
}
@ -2610,6 +2616,12 @@ static void test_Installer(void)
/* Installer::OpenPackage */
hr = Installer_OpenPackage(szPath, 0, &pSession);
if (hr == DISP_E_EXCEPTION)
{
skip("OpenPackage failed, insufficient rights?\n");
DeleteFileW(szPath);
return;
}
ok(hr == S_OK, "Installer_OpenPackage failed, hresult 0x%08x\n", hr);
if (hr == S_OK)
{

View File

@ -3122,6 +3122,11 @@ static void test_try_transform(void)
/* check that the property was added */
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
goto error;
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
sz = MAX_PATH;
@ -3130,8 +3135,9 @@ static void test_try_transform(void)
ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
MsiCloseHandle(hpkg);
MsiCloseHandle(hdb);
error:
MsiCloseHandle(hdb);
DeleteFile(msifile);
DeleteFile(mstfile);
}
@ -7176,8 +7182,7 @@ static void test_storages_table(void)
static void test_dbtopackage(void)
{
MSIHANDLE hdb, hpkg;
CHAR package[10];
CHAR buf[MAX_PATH];
CHAR package[12], buf[MAX_PATH];
DWORD size;
UINT r;
@ -7196,8 +7201,13 @@ static void test_dbtopackage(void)
r = add_custom_action_entry(hdb, "'SetProp', 51, 'MYPROP', 'grape'");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
sprintf(package, "#%i", hdb);
sprintf(package, "#%u", hdb);
r = MsiOpenPackage(package, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
goto error;
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* property is not set yet */
@ -7255,7 +7265,7 @@ static void test_dbtopackage(void)
r = add_custom_action_entry(hdb, "'SetProp', 51, 'MYPROP', 'grape'");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
sprintf(package, "#%i", hdb);
sprintf(package, "#%u", hdb);
r = MsiOpenPackage(package, &hpkg);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
@ -7296,8 +7306,10 @@ static void test_dbtopackage(void)
ok(size == 0, "Expected 0, got %d\n", size);
}
MsiCloseHandle(hdb);
MsiCloseHandle(hpkg);
error:
MsiCloseHandle(hdb);
DeleteFileA(msifile);
}

View File

@ -201,15 +201,20 @@ static MSIHANDLE create_package_db(void)
DeleteFile(msifile);
/* create an empty database */
res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
ok( res == ERROR_SUCCESS , "Failed to create database\n" );
res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATEDIRECT, &hdb );
ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
if( res != ERROR_SUCCESS )
return hdb;
return 0;
res = MsiDatabaseCommit( hdb );
ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
if( res != ERROR_SUCCESS )
return 0;
res = set_summary_info(hdb);
ok( res == ERROR_SUCCESS , "Failed to set summary info %u\n", res );
if( res != ERROR_SUCCESS )
return 0;
res = run_query( hdb,
"CREATE TABLE `Directory` ( "
@ -217,7 +222,7 @@ static MSIHANDLE create_package_db(void)
"`Directory_Parent` CHAR(255), "
"`DefaultDir` CHAR(255) NOT NULL "
"PRIMARY KEY `Directory`)" );
ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
ok( res == ERROR_SUCCESS , "Failed to create directory table %u\n", res );
return hdb;
}
@ -264,11 +269,13 @@ static UINT helper_createpackage( const char *szName, MSIHANDLE *handle )
DeleteFile(szName);
/* create an empty database */
res = MsiOpenDatabase(szName, MSIDBOPEN_CREATE, &hdb );
ok( res == ERROR_SUCCESS , "Failed to create database\n" );
res = MsiOpenDatabase(szName, MSIDBOPEN_CREATEDIRECT, &hdb );
ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
if (res != ERROR_SUCCESS)
return res;
res = MsiDatabaseCommit( hdb );
ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
ok( res == ERROR_SUCCESS , "Failed to commit database %u\n", res );
/* build summary info */
res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
@ -307,9 +314,13 @@ static UINT helper_createpackage( const char *szName, MSIHANDLE *handle )
ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
res = package_from_db( hdb, &hPackage );
ok( res == ERROR_SUCCESS, "failed to create package %u\n", res );
MsiCloseHandle(hdb);
if (res != ERROR_SUCCESS)
DeleteFileA( szName );
else
*handle = hPackage;
return res;
}
@ -319,6 +330,11 @@ static void test_createpackage(void)
UINT res;
res = helper_createpackage( msifile, &hPackage );
if (res == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
return;
}
ok( res == ERROR_SUCCESS, "Failed to create package %u\n", res );
res = MsiCloseHandle( hPackage );
@ -1626,6 +1642,11 @@ static void test_formatrecord_package(void)
DWORD sz=100;
r = helper_createpackage( msifile, &package );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
return;
}
ok( r == ERROR_SUCCESS, "Unable to create package %u\n", r );
hrec = MsiCreateRecord(12);
@ -2198,6 +2219,13 @@ static void test_formatrecord_tables(void)
ok( r == ERROR_SUCCESS, "cannt add custom action: %d\n", r);
r = package_from_db( hdb, &hpkg );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
MsiCloseHandle( hdb );
DeleteFile( msifile );
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
MsiCloseHandle( hdb );
@ -2385,6 +2413,11 @@ static void test_processmessage(void)
UINT r;
r = helper_createpackage( msifile, &package );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
return;
}
ok( r == ERROR_SUCCESS, "Unable to create package %u\n", r );
hrec = MsiCreateRecord(3);

File diff suppressed because it is too large Load Diff

View File

@ -275,6 +275,11 @@ static void test_null(void)
/* empty product string */
r = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", 0, access, &hkey);
if (r == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
return;
}
ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
r = RegQueryValueExA(hkey, NULL, 0, &dwType, lpData, &cbData);
@ -614,6 +619,13 @@ static void test_MsiQueryProductState(void)
lstrcatA(keypath, prodcode);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
RegDeleteKeyA(userkey, "");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local uninstall key exists */
@ -914,6 +926,14 @@ static void test_MsiQueryFeatureState(void)
lstrcatA(keypath, "\\Features");
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
RegDeleteKeyA(userkey, "");
RegCloseKey(userkey);
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* userdata features key exists */
@ -1309,6 +1329,12 @@ static void test_MsiQueryComponentState(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MAGIC_ERROR;
@ -1637,6 +1663,12 @@ static void test_MsiGetComponentPath(void)
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local system component key exists */
@ -2155,6 +2187,12 @@ static void test_MsiGetProductCode(void)
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user unmanaged component key exists */
@ -2397,6 +2435,12 @@ static void test_MsiEnumClients(void)
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user unmanaged component key exists */
@ -2911,6 +2955,12 @@ static void test_MsiGetProductInfo(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product code exists */
@ -4222,6 +4272,12 @@ static void test_MsiGetProductInfoEx(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local user product key exists */
@ -7007,6 +7063,12 @@ static void test_MsiGetUserInfo(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product key exists */
@ -7483,6 +7545,12 @@ static void test_MsiOpenProduct(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product key exists */
@ -7745,6 +7813,11 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid
r = pMsiEnumPatchesExA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED,
MSIPATCHSTATE_APPLIED, 0, patchcode, targetprod,
&context, targetsid, &size);
if (r == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
return;
}
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
ok(!lstrcmpA(patchcode, "apple"),
"Expected patchcode to be unchanged, got %s\n", patchcode);
@ -7762,6 +7835,11 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product key exists */
@ -8510,6 +8588,11 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds
lstrcatA(keypath, patch_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
goto error;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* userdata patch key exists */
@ -8759,6 +8842,8 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds
RegCloseKey(userkey);
RegDeleteValueA(patches, patch_squashed);
RegDeleteValueA(patches, "Patches");
error:
RegDeleteKeyA(patches, "");
RegCloseKey(patches);
RegDeleteKeyA(prodkey, "");
@ -8811,6 +8896,11 @@ static void test_MsiEnumPatchesEx_machine(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local product key exists */
@ -9588,6 +9678,12 @@ static void test_MsiEnumPatches(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product key exists */
@ -10430,6 +10526,12 @@ static void test_MsiGetPatchInfoEx(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udprod, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local UserData product key exists */
@ -11219,6 +11321,11 @@ static void test_MsiGetPatchInfo(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &hkey_product, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
return;
}
ok(res == ERROR_SUCCESS, "expected ERROR_SUCCESS got %d\n", res);
/* product key exists */
@ -11386,6 +11493,12 @@ static void test_MsiEnumProducts(void)
strcat(keypath1, product_squashed1);
r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath1, 0, NULL, 0, access, NULL, &key1, NULL);
if (r == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
LocalFree(usersid);
return;
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
strcpy(keypath2, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");

View File

@ -681,7 +681,7 @@ static MSIHANDLE create_package_db(void)
/* create an empty database */
res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
ok( res == ERROR_SUCCESS , "Failed to create database\n" );
ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
if( res != ERROR_SUCCESS )
return hdb;
@ -710,7 +710,10 @@ static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
sprintf(szPackage, "#%u", hdb);
res = MsiOpenPackage(szPackage, &hPackage);
if (res != ERROR_SUCCESS)
{
MsiCloseHandle(hdb);
return res;
}
res = MsiCloseHandle(hdb);
if (res != ERROR_SUCCESS)
@ -825,6 +828,12 @@ static void test_createpackage(void)
UINT res;
res = package_from_db(create_package_db(), &hPackage);
if (res == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( res == ERROR_SUCCESS, " Failed to create package %u\n", res );
res = MsiCloseHandle( hPackage);
@ -841,6 +850,12 @@ static void test_doaction( void )
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
r = package_from_db(create_package_db(), &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
r = MsiDoAction(hpkg, NULL);
@ -867,6 +882,12 @@ static void test_gettargetpath_bad(void)
UINT r;
r = package_from_db(create_package_db(), &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
r = MsiGetTargetPath( 0, NULL, NULL, NULL );
@ -987,6 +1008,12 @@ static void test_settargetpath(void)
ok( r == S_OK, "cannot add file to the File table: %d\n", r );
r = package_from_db( hdb, &hpkg );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
r = MsiDoAction( hpkg, "CostInitialize");
@ -1079,6 +1106,12 @@ static void test_condition(void)
MSIHANDLE hpkg;
r = package_from_db(create_package_db(), &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
r = MsiEvaluateCondition(0, NULL);
@ -1826,6 +1859,12 @@ static void test_props(void)
ok( r == ERROR_SUCCESS , "Failed\n" );
r = package_from_db( hdb, &hpkg );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
/* test invalid values */
@ -2030,6 +2069,12 @@ static void test_property_table(void)
ok( hdb, "failed to create package\n");
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
MsiCloseHandle(hdb);
@ -2205,6 +2250,11 @@ static void test_msipackage(void)
/* empty szPackagePath */
r = MsiOpenPackage("", &hpack);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
return;
}
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
@ -2290,6 +2340,12 @@ static void test_formatrecord2(void)
UINT r;
r = package_from_db(create_package_db(), &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
r = MsiSetProperty(hpkg, "Manufacturer", " " );
@ -2712,6 +2768,12 @@ static void test_states(void)
ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
r = package_from_db( hdb, &hpkg );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
MsiCloseHandle(hdb);
@ -7202,6 +7264,12 @@ static void test_getproperty(void)
UINT r;
r = package_from_db(create_package_db(), &hPackage);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "Failed to create package %u\n", r );
/* set the property */
@ -7323,6 +7391,12 @@ static void test_removefiles(void)
ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
r = package_from_db( hdb, &hpkg );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
MsiCloseHandle( hdb );
@ -7411,6 +7485,12 @@ static void test_appsearch(void)
ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
r = package_from_db( hdb, &hpkg );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
MsiCloseHandle( hdb );
@ -7603,6 +7683,11 @@ static void test_appsearch_complocator(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
goto error;
}
ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
@ -7701,6 +7786,9 @@ static void test_appsearch_complocator(void)
delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
MSIINSTALLCONTEXT_MACHINE, NULL);
MsiCloseHandle(hpkg);
error:
DeleteFileA("FileName1");
DeleteFileA("FileName2");
DeleteFileA("FileName3");
@ -7711,7 +7799,6 @@ static void test_appsearch_complocator(void)
DeleteFileA("FileName8.dll");
DeleteFileA("FileName9.dll");
DeleteFileA("FileName10.dll");
MsiCloseHandle(hpkg);
DeleteFileA(msifile);
LocalFree(usersid);
}
@ -7740,6 +7827,11 @@ static void test_appsearch_reglocator(void)
DeleteFileA("test.dll");
res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
@ -8570,6 +8662,11 @@ static void test_appsearch_inilocator(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
goto error;
}
ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
r = MsiDoAction(hpkg, "AppSearch");
@ -8647,12 +8744,14 @@ static void test_appsearch_inilocator(void)
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
}
MsiCloseHandle(hpkg);
error:
delete_win_ini("IniFile.ini");
DeleteFileA("FileName1");
DeleteFileA("FileName2.dll");
DeleteFileA("FileName3.dll");
DeleteFileA("FileName4.dll");
MsiCloseHandle(hpkg);
DeleteFileA(msifile);
}
@ -8866,6 +8965,11 @@ static void test_appsearch_drlocator(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
goto error;
}
ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
r = MsiDoAction(hpkg, "AppSearch");
@ -8942,6 +9046,9 @@ static void test_appsearch_drlocator(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!prop[0], "Expected \"\", got \"%s\"\n", prop);
MsiCloseHandle(hpkg);
error:
DeleteFileA("FileName1");
DeleteFileA("FileName3.dll");
DeleteFileA("FileName4.dll");
@ -8951,7 +9058,6 @@ static void test_appsearch_drlocator(void)
RemoveDirectoryA("one\\two");
RemoveDirectoryA("one");
RemoveDirectoryA("another");
MsiCloseHandle(hpkg);
DeleteFileA(msifile);
}
@ -9128,6 +9234,12 @@ static void test_featureparents(void)
ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
r = package_from_db( hdb, &hpkg );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
MsiCloseHandle( hdb );
@ -9380,6 +9492,12 @@ static void test_installprops(void)
ok( hdb, "failed to create database\n");
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
MsiCloseHandle(hdb);
@ -9501,6 +9619,12 @@ static void test_launchconditions(void)
ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
r = package_from_db( hdb, &hpkg );
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
MsiCloseHandle( hdb );
@ -9560,6 +9684,12 @@ static void test_ccpsearch(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
MsiCloseHandle(hdb);
@ -9716,6 +9846,12 @@ static void test_complocator(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
MsiCloseHandle(hdb);
@ -9947,6 +10083,12 @@ static void test_MsiGetSourcePath(void)
ok(r == ERROR_SUCCESS , "Failed to commit database\n");
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
MsiCloseHandle(hdb);
@ -10637,6 +10779,12 @@ static void test_shortlongsource(void)
MsiDatabaseCommit(hdb);
r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
MsiCloseHandle(hdb);
@ -10918,7 +11066,7 @@ static void test_shortlongsource(void)
static void test_sourcedir(void)
{
MSIHANDLE hdb, hpkg;
CHAR package[10];
CHAR package[12];
CHAR path[MAX_PATH];
CHAR cwd[MAX_PATH];
CHAR subsrc[MAX_PATH];
@ -10938,8 +11086,13 @@ static void test_sourcedir(void)
r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
ok(r == S_OK, "failed\n");
sprintf(package, "#%i", hdb);
sprintf(package, "#%u", hdb);
r = MsiOpenPackage(package, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
goto error;
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* properties only */
@ -11243,8 +11396,10 @@ static void test_sourcedir(void)
"Expected path to be unchanged, got \"%s\"\n", path);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
MsiCloseHandle(hdb);
MsiCloseHandle(hpkg);
error:
MsiCloseHandle(hdb);
DeleteFileA(msifile);
}
@ -11410,6 +11565,11 @@ static void test_emptypackage(void)
UINT r;
r = MsiOpenPackageA("", &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
return;
}
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
@ -11632,6 +11792,12 @@ static void test_MsiGetProductProperty(void)
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
@ -11801,6 +11967,12 @@ static void test_MsiSetProperty(void)
UINT r;
r = package_from_db(create_package_db(), &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
DeleteFile(msifile);
return;
}
ok(r == ERROR_SUCCESS, "Expected a valid package %u\n", r);
/* invalid hInstall */