msi/tests: Skip tests if UAC is enabled and the process is not running elevated.
This commit is contained in:
parent
deb1c552d6
commit
33b6ad7f73
|
@ -44,6 +44,8 @@ static UINT (WINAPI *pMsiSourceListGetInfoA)
|
|||
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
|
||||
|
||||
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
|
||||
static BOOL (WINAPI *pGetTokenInformation)( HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD );
|
||||
static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
|
||||
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
|
||||
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
||||
|
||||
|
@ -3226,6 +3228,8 @@ static void init_functionpointers(void)
|
|||
GET_PROC(hmsi, MsiSourceListGetInfoA);
|
||||
|
||||
GET_PROC(hadvapi32, ConvertSidToStringSidA);
|
||||
GET_PROC(hadvapi32, GetTokenInformation);
|
||||
GET_PROC(hadvapi32, OpenProcessToken);
|
||||
GET_PROC(hadvapi32, RegDeleteKeyExA)
|
||||
GET_PROC(hkernel32, IsWow64Process)
|
||||
|
||||
|
@ -3236,6 +3240,25 @@ static void init_functionpointers(void)
|
|||
#undef GET_PROC
|
||||
}
|
||||
|
||||
static BOOL is_process_limited(void)
|
||||
{
|
||||
HANDLE token;
|
||||
|
||||
if (!pOpenProcessToken || !pGetTokenInformation) return FALSE;
|
||||
|
||||
if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
{
|
||||
BOOL ret;
|
||||
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
|
||||
DWORD size;
|
||||
|
||||
ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
|
||||
CloseHandle(token);
|
||||
return (ret && type == TokenElevationTypeLimited);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL check_win9x(void)
|
||||
{
|
||||
SC_HANDLE scm;
|
||||
|
@ -3659,6 +3682,11 @@ static void test_MsiInstallProduct(void)
|
|||
win_skip("Services are not implemented on Win9x and WinMe\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
|
||||
access |= KEY_WOW64_64KEY;
|
||||
|
@ -4106,6 +4134,12 @@ static void test_continuouscabs(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_cc_test_files();
|
||||
create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
|
||||
|
||||
|
@ -4237,6 +4271,12 @@ static void test_mixedmedia(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\maximus", 500);
|
||||
create_file("msitest\\augustus", 500);
|
||||
|
@ -4339,6 +4379,12 @@ static void test_readonlyfile(void)
|
|||
HANDLE file;
|
||||
CHAR path[MAX_PATH];
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\maximus", 500);
|
||||
create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
|
||||
|
@ -4382,6 +4428,12 @@ static void test_readonlyfile_cab(void)
|
|||
CHAR path[MAX_PATH];
|
||||
CHAR buf[16];
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("maximus", 500);
|
||||
create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
|
||||
|
@ -4603,6 +4655,12 @@ static void test_setdirproperty(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\maximus", 500);
|
||||
create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
|
||||
|
@ -4630,6 +4688,12 @@ static void test_cabisextracted(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\gaius", 500);
|
||||
create_file("maximus", 500);
|
||||
|
@ -4673,6 +4737,12 @@ static void test_concurrentinstall(void)
|
|||
UINT r;
|
||||
CHAR path[MAX_PATH];
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
CreateDirectoryA("msitest\\msitest", NULL);
|
||||
create_file("msitest\\maximus", 500);
|
||||
|
@ -4721,6 +4791,12 @@ static void test_setpropertyfolder(void)
|
|||
CHAR path[MAX_PATH];
|
||||
DWORD attr;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
lstrcpyA(path, PROG_FILES_DIR);
|
||||
lstrcatA(path, "\\msitest\\added");
|
||||
|
||||
|
@ -4943,6 +5019,12 @@ static void test_publish_registerproduct(void)
|
|||
static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
|
||||
"\\51AAE0C44620A5E4788506E91F249BD2";
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!get_user_sid(&usersid))
|
||||
return;
|
||||
|
||||
|
@ -5195,6 +5277,12 @@ static void test_publish_publishproduct(void)
|
|||
static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
|
||||
static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!get_user_sid(&usersid))
|
||||
return;
|
||||
|
||||
|
@ -5418,6 +5506,12 @@ static void test_publish_publishfeatures(void)
|
|||
static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
|
||||
"\\84A88FD7F6998CE40A22FB59F6B9C2BB";
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!get_user_sid(&usersid))
|
||||
return;
|
||||
|
||||
|
@ -5592,6 +5686,12 @@ static void test_publish_registeruser(void)
|
|||
"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
|
||||
"UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!get_user_sid(&usersid))
|
||||
return;
|
||||
|
||||
|
@ -5681,6 +5781,12 @@ static void test_publish_processcomponents(void)
|
|||
static const CHAR compkey[] =
|
||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!get_user_sid(&usersid))
|
||||
return;
|
||||
|
||||
|
@ -5812,6 +5918,11 @@ static void test_publish(void)
|
|||
win_skip("MsiQueryComponentStateA is not available\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
get_date_str(date);
|
||||
GetTempPath(MAX_PATH, temp);
|
||||
|
@ -6300,6 +6411,11 @@ static void test_publishsourcelist(void)
|
|||
win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\maximus", 500);
|
||||
|
@ -6652,6 +6768,12 @@ static void test_transformprop(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\augustus", 500);
|
||||
|
||||
|
@ -6694,6 +6816,12 @@ static void test_currentworkingdir(void)
|
|||
CHAR drive[MAX_PATH], path[MAX_PATH];
|
||||
LPSTR ptr;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\augustus", 500);
|
||||
|
||||
|
@ -6850,6 +6978,12 @@ static void test_adminprops(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\augustus", 500);
|
||||
|
||||
|
@ -6895,6 +7029,12 @@ static void test_removefiles(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\hydrogen", 500);
|
||||
create_file("msitest\\helium", 500);
|
||||
|
@ -7024,6 +7164,12 @@ static void test_movefiles(void)
|
|||
UINT r;
|
||||
char props[MAX_PATH];
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\augustus", 100);
|
||||
create_file("cameroon", 100);
|
||||
|
@ -7164,6 +7310,12 @@ static void test_missingcab(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\augustus", 500);
|
||||
create_file("maximus", 500);
|
||||
|
@ -7224,6 +7376,12 @@ static void test_duplicatefiles(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\maximus", 500);
|
||||
create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
|
||||
|
@ -7263,6 +7421,12 @@ static void test_writeregistryvalues(void)
|
|||
REGSAM access = KEY_ALL_ACCESS;
|
||||
BOOL wow64;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\augustus", 500);
|
||||
|
||||
|
@ -7308,6 +7472,12 @@ static void test_sourcefolder(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("augustus", 500);
|
||||
|
||||
|
@ -7349,6 +7519,12 @@ static void test_customaction51(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\augustus", 500);
|
||||
|
||||
|
@ -7376,6 +7552,12 @@ static void test_installstate(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\alpha", 500);
|
||||
create_file("msitest\\beta", 500);
|
||||
|
@ -7867,6 +8049,11 @@ static void test_MsiConfigureProductEx(void)
|
|||
win_skip("Different registry keys on Win9x and WinMe\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\hydrogen", 500);
|
||||
|
@ -8124,6 +8311,12 @@ static void test_missingcomponent(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\hydrogen", 500);
|
||||
create_file("msitest\\helium", 500);
|
||||
|
@ -8169,6 +8362,12 @@ static void test_sourcedirprop(void)
|
|||
UINT r;
|
||||
CHAR props[MAX_PATH];
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\augustus", 500);
|
||||
|
||||
|
@ -8214,6 +8413,12 @@ static void test_adminimage(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
CreateDirectoryA("msitest\\first", NULL);
|
||||
CreateDirectoryA("msitest\\second", NULL);
|
||||
|
@ -8272,6 +8477,12 @@ static void test_propcase(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA("msitest", NULL);
|
||||
create_file("msitest\\augustus", 500);
|
||||
|
||||
|
@ -8360,6 +8571,12 @@ static void test_shortcut(void)
|
|||
UINT r;
|
||||
HRESULT hr;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
|
||||
|
||||
|
@ -8420,6 +8637,11 @@ static void test_envvar(void)
|
|||
win_skip("Environment variables are handled differently on Win9x and WinMe\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
|
||||
|
@ -8532,6 +8754,12 @@ static void test_preselected(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
|
||||
|
||||
|
@ -8582,6 +8810,12 @@ static void test_installed_prop(void)
|
|||
static char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
|
||||
|
||||
|
@ -8626,6 +8860,12 @@ static void test_allusers_prop(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
|
||||
|
||||
|
@ -8851,6 +9091,11 @@ static void test_file_in_use(void)
|
|||
win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
|
||||
|
||||
|
@ -8910,6 +9155,11 @@ static void test_file_in_use_cab(void)
|
|||
win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
|
||||
|
||||
|
@ -9045,6 +9295,12 @@ static void test_feature_override(void)
|
|||
REGSAM access = KEY_ALL_ACCESS;
|
||||
BOOL wow64;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\override.txt", 1000);
|
||||
create_file("msitest\\preselected.txt", 1000);
|
||||
|
@ -9309,6 +9565,11 @@ static void test_delete_services(void)
|
|||
win_skip("Services are not implemented on Win9x and WinMe\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
|
||||
|
@ -9348,6 +9609,12 @@ static void test_self_registration(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
|
||||
|
||||
|
@ -9389,6 +9656,12 @@ static void test_register_font(void)
|
|||
REGSAM access = KEY_ALL_ACCESS;
|
||||
BOOL wow64;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\font.ttf", 1000);
|
||||
create_database(msifile, font_tables, sizeof(font_tables) / sizeof(msi_table));
|
||||
|
@ -9434,6 +9707,12 @@ static void test_validate_product_id(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_database(msifile, vp_tables, sizeof(vp_tables) / sizeof(msi_table));
|
||||
|
||||
|
@ -9478,6 +9757,12 @@ static void test_install_remove_odbc(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\ODBCdriver.dll", 1000);
|
||||
create_file("msitest\\ODBCdriver2.dll", 1000);
|
||||
|
@ -9526,6 +9811,12 @@ static void test_register_typelib(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\typelib.dll", 1000);
|
||||
create_database(msifile, tl_tables, sizeof(tl_tables) / sizeof(msi_table));
|
||||
|
@ -9559,6 +9850,12 @@ static void test_create_remove_shortcut(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\target.txt", 1000);
|
||||
create_database(msifile, crs_tables, sizeof(crs_tables) / sizeof(msi_table));
|
||||
|
@ -9598,6 +9895,12 @@ static void test_publish_components(void)
|
|||
LONG res;
|
||||
HKEY key;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\english.txt", 1000);
|
||||
create_database(msifile, pub_tables, sizeof(pub_tables) / sizeof(msi_table));
|
||||
|
@ -9638,6 +9941,12 @@ static void test_remove_duplicate_files(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\original.txt", 1000);
|
||||
create_file("msitest\\original2.txt", 1000);
|
||||
|
@ -9686,6 +9995,12 @@ static void test_remove_registry_values(void)
|
|||
REGSAM access = KEY_ALL_ACCESS;
|
||||
BOOL wow64;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\registry.txt", 1000);
|
||||
create_database(msifile, rrv_tables, sizeof(rrv_tables) / sizeof(msi_table));
|
||||
|
@ -9772,6 +10087,12 @@ static void test_find_related_products(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\product.txt", 1000);
|
||||
create_database(msifile, frp_tables, sizeof(frp_tables) / sizeof(msi_table));
|
||||
|
@ -9810,6 +10131,12 @@ static void test_remove_ini_values(void)
|
|||
HANDLE file;
|
||||
BOOL ret;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\inifile.txt", 1000);
|
||||
create_database(msifile, riv_tables, sizeof(riv_tables) / sizeof(msi_table));
|
||||
|
@ -9875,6 +10202,11 @@ static void test_remove_env_strings(void)
|
|||
win_skip("Environment variables are handled differently on win9x and winme\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\envvar.txt", 1000);
|
||||
|
@ -10001,6 +10333,12 @@ static void test_register_class_info(void)
|
|||
LONG res;
|
||||
HKEY hkey;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\class.txt", 1000);
|
||||
create_database(msifile, rci_tables, sizeof(rci_tables) / sizeof(msi_table));
|
||||
|
@ -10054,6 +10392,12 @@ static void test_register_extension_info(void)
|
|||
LONG res;
|
||||
HKEY hkey;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\extension.txt", 1000);
|
||||
create_database(msifile, rei_tables, sizeof(rei_tables) / sizeof(msi_table));
|
||||
|
@ -10100,6 +10444,12 @@ static void test_register_mime_info(void)
|
|||
LONG res;
|
||||
HKEY hkey;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\mime.txt", 1000);
|
||||
create_database(msifile, rmi_tables, sizeof(rmi_tables) / sizeof(msi_table));
|
||||
|
@ -10141,6 +10491,12 @@ static void test_icon_table(void)
|
|||
CHAR path[MAX_PATH], win9xpath[MAX_PATH];
|
||||
static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}";
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_database(msifile, icon_base_tables, sizeof(icon_base_tables) / sizeof(msi_table));
|
||||
|
||||
res = MsiOpenDatabase(msifile, MSIDBOPEN_TRANSACT, &hdb);
|
||||
|
@ -10217,6 +10573,12 @@ static void test_sourcedir_props(void)
|
|||
{
|
||||
UINT r;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_files();
|
||||
create_file("msitest\\sourcedir.txt", 1000);
|
||||
create_database(msifile, sd_tables, sizeof(sd_tables) / sizeof(msi_table));
|
||||
|
|
|
@ -36,6 +36,8 @@ char CURR_DIR[MAX_PATH];
|
|||
static UINT (WINAPI *pMsiApplyMultiplePatchesA)(LPCSTR, LPCSTR, LPCSTR);
|
||||
|
||||
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
|
||||
static BOOL (WINAPI *pGetTokenInformation)( HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD );
|
||||
static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
|
||||
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
|
||||
static LONG (WINAPI *pRegDeleteKeyExW)(HKEY, LPCWSTR, REGSAM, DWORD);
|
||||
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
||||
|
@ -56,6 +58,8 @@ static void init_functionpointers(void)
|
|||
GET_PROC(hmsi, MsiApplyMultiplePatchesA);
|
||||
|
||||
GET_PROC(hadvapi32, ConvertSidToStringSidA);
|
||||
GET_PROC(hadvapi32, GetTokenInformation);
|
||||
GET_PROC(hadvapi32, OpenProcessToken);
|
||||
GET_PROC(hadvapi32, RegDeleteKeyExA)
|
||||
GET_PROC(hadvapi32, RegDeleteKeyExW)
|
||||
GET_PROC(hkernel32, IsWow64Process)
|
||||
|
@ -66,6 +70,25 @@ static void init_functionpointers(void)
|
|||
#undef GET_PROC
|
||||
}
|
||||
|
||||
static BOOL is_process_limited(void)
|
||||
{
|
||||
HANDLE token;
|
||||
|
||||
if (!pOpenProcessToken || !pGetTokenInformation) return FALSE;
|
||||
|
||||
if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
{
|
||||
BOOL ret;
|
||||
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
|
||||
DWORD size;
|
||||
|
||||
ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
|
||||
CloseHandle(token);
|
||||
return (ret && type == TokenElevationTypeLimited);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
|
||||
{
|
||||
if (pRegDeleteKeyExA)
|
||||
|
@ -2440,6 +2463,12 @@ static void test_states(void)
|
|||
static const CHAR msifile3[] = "winetest3-package.msi";
|
||||
static const CHAR msifile4[] = "winetest4-package.msi";
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hdb = create_package_db();
|
||||
ok ( hdb, "failed to create package database\n" );
|
||||
|
||||
|
@ -7538,6 +7567,12 @@ static void test_appsearch_complocator(void)
|
|||
if (!get_user_sid(&usersid))
|
||||
return;
|
||||
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_file("FileName1");
|
||||
create_test_file("FileName4");
|
||||
set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
|
||||
|
|
|
@ -35,6 +35,8 @@ static UINT (WINAPI *pMsiGetPatchInfoExA)( LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCON
|
|||
LPCSTR, LPSTR, DWORD * );
|
||||
static UINT (WINAPI *pMsiEnumPatchesExA)( LPCSTR, LPCSTR, DWORD, DWORD, DWORD, LPSTR,
|
||||
LPSTR, MSIINSTALLCONTEXT *, LPSTR, LPDWORD );
|
||||
static BOOL (WINAPI *pGetTokenInformation)( HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD );
|
||||
static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
|
||||
|
||||
static const char *msifile = "winetest-patch.msi";
|
||||
static const char *mspfile = "winetest-patch.msp";
|
||||
|
@ -138,6 +140,7 @@ static const struct msi_table tables[] =
|
|||
static void init_function_pointers( void )
|
||||
{
|
||||
HMODULE hmsi = GetModuleHandleA( "msi.dll" );
|
||||
HMODULE hadvapi32 = GetModuleHandleA( "advapi32.dll" );
|
||||
|
||||
#define GET_PROC( mod, func ) \
|
||||
p ## func = (void *)GetProcAddress( mod, #func ); \
|
||||
|
@ -147,9 +150,31 @@ static void init_function_pointers( void )
|
|||
GET_PROC( hmsi, MsiApplyPatchA );
|
||||
GET_PROC( hmsi, MsiGetPatchInfoExA );
|
||||
GET_PROC( hmsi, MsiEnumPatchesExA );
|
||||
|
||||
GET_PROC( hadvapi32, GetTokenInformation );
|
||||
GET_PROC( hadvapi32, OpenProcessToken );
|
||||
#undef GET_PROC
|
||||
}
|
||||
|
||||
static BOOL is_process_limited(void)
|
||||
{
|
||||
HANDLE token;
|
||||
|
||||
if (!pOpenProcessToken || !pGetTokenInformation) return FALSE;
|
||||
|
||||
if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
||||
{
|
||||
BOOL ret;
|
||||
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
|
||||
DWORD size;
|
||||
|
||||
ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
|
||||
CloseHandle(token);
|
||||
return (ret && type == TokenElevationTypeLimited);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL get_program_files_dir( char *buf, char *buf2 )
|
||||
{
|
||||
HKEY hkey;
|
||||
|
@ -690,6 +715,11 @@ static void test_simple_patch( void )
|
|||
win_skip("MsiApplyPatchA is not available\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA( "msitest", NULL );
|
||||
create_file( "msitest\\patch.txt", 1000 );
|
||||
|
@ -937,6 +967,11 @@ static void test_system_tables( void )
|
|||
win_skip("MsiApplyPatchA is not available\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA( "msitest", NULL );
|
||||
create_file( "msitest\\patch.txt", 1000 );
|
||||
|
@ -1097,6 +1132,11 @@ static void test_patch_registration( void )
|
|||
win_skip("required functions not available\n");
|
||||
return;
|
||||
}
|
||||
if (is_process_limited())
|
||||
{
|
||||
skip("process is limited\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDirectoryA( "msitest", NULL );
|
||||
create_file( "msitest\\patch.txt", 1000 );
|
||||
|
|
Loading…
Reference in New Issue