From: Hans Leidekker hans@codeweavers.com
Wine starts processes non-elevated since e92ba2de43d7afbe0704b11b29f7c30f44dfaeca which means that many tests are skipped now. --- dlls/msi/tests/action.c | 105 ++++++++++++++++++++++++---------- dlls/msi/tests/automation.c | 4 +- dlls/msi/tests/install.c | 111 +++++++++++++++--------------------- dlls/msi/tests/msi.c | 26 +++++---- dlls/msi/tests/package.c | 6 +- dlls/msi/tests/patch.c | 8 ++- dlls/msi/tests/source.c | 10 ++-- dlls/msi/tests/utils.h | 3 +- 8 files changed, 153 insertions(+), 120 deletions(-)
diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c index e5c862e206c..715555f5207 100644 --- a/dlls/msi/tests/action.c +++ b/dlls/msi/tests/action.c @@ -2669,7 +2669,7 @@ static void test_register_product(void) static const CHAR userugkey[] = "Software\Microsoft\Installer\UpgradeCodes" "\51AAE0C44620A5E4788506E91F249BD2";
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3052,7 +3052,7 @@ static void test_publish_product(void) BOOL old_installer = FALSE; REGSAM access = KEY_ALL_ACCESS;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3283,7 +3283,7 @@ static void test_publish_features(void) CHAR keypath[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3467,7 +3467,7 @@ static void test_register_user(void) "Software\Microsoft\Windows\CurrentVersion\Installer\" "UserData\%s\Products\84A88FD7F6998CE40A22FB59F6B9C2BB";
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3563,7 +3563,7 @@ static void test_process_components(void) CHAR program_files_maximus[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3700,7 +3700,7 @@ static void test_publish(void) win_skip("MsiQueryFeatureStateExA is not available\n"); return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4297,7 +4297,7 @@ static void test_publish_sourcelist(void) win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n"); return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4495,7 +4495,7 @@ static void test_remove_files(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4630,7 +4630,7 @@ static void test_move_files(void) UINT r; char props[4 * MAX_PATH + 74];
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4776,7 +4776,7 @@ static void test_duplicate_files(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4819,7 +4819,7 @@ static void test_write_registry_values(void) LONG res; UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4987,7 +4987,7 @@ static void test_envvar(void) HKEY env, env2; LONG res;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5102,7 +5102,7 @@ static void test_create_remove_folder(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5274,7 +5274,7 @@ static void test_delete_services(void) SC_HANDLE manager, service; DWORD error;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5348,7 +5348,7 @@ static void test_install_services(void) HKEY hKey; DWORD err_control, err_controlsize, err_controltype;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5424,7 +5424,7 @@ static void test_self_registration(void) HKEY key; UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5472,7 +5472,7 @@ static void test_register_font(void) UINT r; REGSAM access = KEY_ALL_ACCESS;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5523,7 +5523,7 @@ static void test_validate_product_id(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5577,7 +5577,7 @@ static void test_install_remove_odbc(void) WORD len; UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5660,7 +5660,7 @@ static void test_register_typelib(void) HRESULT hr; UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5710,7 +5710,7 @@ static void test_create_remove_shortcut(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5759,7 +5759,7 @@ static void test_publish_components(void) BYTE *data; DWORD size;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5843,7 +5843,7 @@ static void test_remove_duplicate_files(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5893,7 +5893,7 @@ static void test_find_related_products(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5937,7 +5937,7 @@ static void test_ini_values(void) HANDLE file; BOOL ret;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5998,7 +5998,7 @@ static void test_register_class_info(void) LONG res; HKEY hkey;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6063,7 +6063,7 @@ static void test_register_extension_info(void) LONG res; HKEY hkey;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6115,7 +6115,7 @@ static void test_register_progid_info(void) LONG res; HKEY hkey;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6241,7 +6241,7 @@ static void test_register_mime_info(void) LONG res; HKEY hkey;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6340,7 +6340,7 @@ static void test_publish_assemblies(void) const char *path; int access;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6504,7 +6504,7 @@ static void test_remove_existing_products(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6536,6 +6536,47 @@ error: DeleteFileA(msifile); }
+static HANDLE get_admin_token(void) +{ + TOKEN_ELEVATION_TYPE type; + TOKEN_LINKED_TOKEN linked; + DWORD size; + + if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenElevationType, &type, sizeof(type), &size) + || type == TokenElevationTypeFull) + return NULL; + + if (!GetTokenInformation(GetCurrentThreadEffectiveToken(), TokenLinkedToken, &linked, sizeof(linked), &size)) + return NULL; + return linked.LinkedToken; +} + +void restart_as_admin_elevated(void) +{ + HANDLE token; + PROCESS_INFORMATION pi; + STARTUPINFOW si; + + if (!(token = get_admin_token())) return; + + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + if (CreateProcessAsUserW(token, NULL, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) + { + DWORD exit_code; + + trace("restarting\n"); + WaitForSingleObject(pi.hProcess, INFINITE); + GetExitCodeProcess(pi.hProcess, &exit_code); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + ExitProcess(exit_code); + } + else trace("failed to restart as admin %lu\n", GetLastError()); + + CloseHandle(token); +} + START_TEST(action) { DWORD len; @@ -6543,6 +6584,8 @@ START_TEST(action) STATEMGRSTATUS status; BOOL ret = FALSE;
+ if (!is_process_elevated()) restart_as_admin_elevated(); + init_functionpointers(); subtest("custom");
diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c index 1139571f32a..2766933bcc5 100644 --- a/dlls/msi/tests/automation.c +++ b/dlls/msi/tests/automation.c @@ -2309,7 +2309,7 @@ static void test_Installer_InstallProduct(void) IDispatch *pStringList = NULL; REGSAM access = KEY_ALL_ACCESS;
- if (is_process_limited()) + if (!is_process_elevated()) { /* In fact InstallProduct would succeed but then Windows XP * would not allow us to clean up the registry! @@ -2626,6 +2626,8 @@ START_TEST(automation)
init_functionpointers();
+ if (!is_process_elevated()) restart_as_admin_elevated(); + if (pIsWow64Process) pIsWow64Process(GetCurrentProcess(), &is_wow64);
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index a7388a917d8..23b5a858ece 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -2251,40 +2251,17 @@ static void init_functionpointers(void) #undef GET_PROC }
-BOOL is_process_limited(void) +BOOL is_process_elevated(void) { - SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; - PSID Group = NULL; - BOOL IsInGroup; HANDLE token; + TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; + DWORD size; + BOOL ret;
- if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) || - !CheckTokenMembership(NULL, Group, &IsInGroup)) - { - trace("Could not check if the current user is an administrator\n"); - FreeSid(Group); - return FALSE; - } - FreeSid(Group); - - if (!IsInGroup) - { - /* Only administrators have enough privileges for these tests */ - return TRUE; - } - - if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) - { - BOOL ret; - TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; - DWORD size; - - ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); - CloseHandle(token); - return (ret && type == TokenElevationTypeLimited); - } - return FALSE; + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) return FALSE; + ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); + CloseHandle(token); + return (ret && type == TokenElevationTypeFull); }
static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val) @@ -2771,7 +2748,7 @@ static void test_MsiInstallProduct(void) DWORD num, size, type; REGSAM access = KEY_ALL_ACCESS;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3116,7 +3093,7 @@ static void test_continuouscabs(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3309,7 +3286,7 @@ static void test_mixedmedia(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3429,7 +3406,7 @@ static void test_readonlyfile(void) HANDLE file; CHAR path[MAX_PATH];
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3478,7 +3455,7 @@ static void test_readonlyfile_cab(void) CHAR path[MAX_PATH]; CHAR buf[16];
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3535,7 +3512,7 @@ static void test_setdirproperty(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3568,7 +3545,7 @@ static void test_cabisextracted(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3809,7 +3786,7 @@ static void test_transformprop(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3857,7 +3834,7 @@ static void test_currentworkingdir(void) CHAR drive[MAX_PATH], path[MAX_PATH + 12]; LPSTR ptr;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4015,7 +3992,7 @@ static void test_adminprops(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4066,7 +4043,7 @@ static void test_missingcab(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4136,7 +4113,7 @@ static void test_sourcefolder(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4239,7 +4216,7 @@ static void test_customaction51(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4272,7 +4249,7 @@ static void test_installstate(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4758,7 +4735,7 @@ static void test_missingcomponent(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4814,7 +4791,7 @@ static void test_sourcedirprop(void) UINT r; CHAR props[MAX_PATH + 18];
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4865,7 +4842,7 @@ static void test_adminimage(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4936,7 +4913,7 @@ static void test_propcase(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5042,7 +5019,7 @@ static void test_shortcut(void) UINT r; HRESULT hr;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5089,7 +5066,7 @@ static void test_preselected(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5145,7 +5122,7 @@ static void test_installed_prop(void) static const char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}"; UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5184,7 +5161,7 @@ static void test_allusers_prop(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5345,7 +5322,7 @@ static void test_file_in_use(void) HKEY hkey; char path[MAX_PATH];
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5404,7 +5381,7 @@ static void test_file_in_use_cab(void) HKEY hkey; char path[MAX_PATH];
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5465,7 +5442,7 @@ static void test_feature_override(void) UINT r; REGSAM access = KEY_ALL_ACCESS;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5545,7 +5522,7 @@ static void test_icon_table(void) CHAR path[MAX_PATH]; static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}";
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5623,7 +5600,7 @@ static void test_package_validation(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5814,7 +5791,7 @@ static void test_upgrade_code(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5850,7 +5827,7 @@ static void test_mixed_package(void) char value[MAX_PATH]; DWORD size;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -5999,7 +5976,7 @@ static void test_volume_props(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6025,7 +6002,7 @@ static void test_shared_component(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6074,7 +6051,7 @@ static void test_remove_upgrade_code(void) DWORD type, size; char buf[1];
- if (is_process_limited()) + if (!is_process_elevated()) { skip( "process is limited\n" ); return; @@ -6120,7 +6097,7 @@ static void test_feature_tree(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip( "process is limited\n" ); return; @@ -6197,7 +6174,7 @@ static void test_wow64(void) return; }
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -6250,7 +6227,7 @@ static void test_source_resolution(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip( "process is limited\n" ); return; @@ -6282,6 +6259,8 @@ START_TEST(install) STATEMGRSTATUS status; BOOL ret = FALSE;
+ if (!is_process_elevated()) restart_as_admin_elevated(); + init_functionpointers(); subtest("custom");
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index fcdcd60a9f8..d00b8b53fcc 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -3382,7 +3382,7 @@ static void test_MsiProvideComponent(void) DWORD len, len2; UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3472,7 +3472,7 @@ static void test_MsiProvideQualifiedComponentEx(void) HKEY hkey, hkey2, hkey3, hkey4, hkey5; LONG res;
- if (is_process_limited()) + if (!is_process_elevated()) { skip( "process is limited\n" ); return; @@ -13102,7 +13102,7 @@ static void test_MsiEnumProducts(void) HKEY key1, key2, key3; REGSAM access = KEY_ALL_ACCESS;
- if (is_process_limited()) + if (!is_process_elevated()) { skip( "process is limited\n" ); return; @@ -13417,7 +13417,7 @@ static void test_MsiEnumComponents(void) char *usersid = get_user_sid(); HKEY key1 = NULL, key2 = NULL;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -13496,7 +13496,7 @@ static void test_MsiEnumComponentsEx(void) win_skip( "MsiEnumComponentsExA not implemented\n" ); return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -13592,7 +13592,7 @@ static void test_MsiConfigureProductEx(void) CHAR keypath[MAX_PATH * 2], localpackage[MAX_PATH], packagename[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -13875,7 +13875,7 @@ static void test_MsiSetFeatureAttributes(void) char path[MAX_PATH]; MSIHANDLE package;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -13957,7 +13957,7 @@ static void test_MsiGetFeatureInfo(void) char title[32], help[32], path[MAX_PATH]; DWORD attrs, title_len, help_len;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -14254,7 +14254,7 @@ static void test_setpropertyfolder(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -14309,7 +14309,7 @@ static void test_sourcedir_props(void) { UINT r;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -14373,7 +14373,7 @@ static void test_concurrentinstall(void) UINT r; CHAR path[MAX_PATH];
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -14425,7 +14425,7 @@ static void test_command_line_parsing(void) UINT r; const char *cmd;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -14585,6 +14585,8 @@ START_TEST(msi) DWORD len; char temp_path[MAX_PATH], prev_path[MAX_PATH];
+ if (!is_process_elevated()) restart_as_admin_elevated(); + init_functionpointers();
if (pIsWow64Process) diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index adc85d54b18..8bb57be71e9 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -2995,7 +2995,7 @@ static void test_states(void) char value[MAX_PATH]; DWORD size;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -4055,7 +4055,7 @@ static void test_appsearch_complocator(void) if (!(usersid = get_user_sid())) return;
- if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -9564,6 +9564,8 @@ START_TEST(package) BOOL ret = FALSE; DWORD len;
+ if (!is_process_elevated()) restart_as_admin_elevated(); + init_functionpointers();
if (pIsWow64Process) diff --git a/dlls/msi/tests/patch.c b/dlls/msi/tests/patch.c index 0dbb8451ca3..a0dee596c15 100644 --- a/dlls/msi/tests/patch.c +++ b/dlls/msi/tests/patch.c @@ -696,7 +696,7 @@ static void test_simple_patch( void ) win_skip("MsiApplyPatchA is not available\n"); return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -1035,7 +1035,7 @@ static void test_system_tables( void ) win_skip("MsiApplyPatchA is not available\n"); return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -1225,7 +1225,7 @@ static void test_patch_registration( void ) win_skip("required functions not available\n"); return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -1322,6 +1322,8 @@ START_TEST(patch) DWORD len; char temp_path[MAX_PATH], prev_path[MAX_PATH];
+ if (!is_process_elevated()) restart_as_admin_elevated(); + init_function_pointers();
GetCurrentDirectoryA( MAX_PATH, prev_path ); diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c index 1e794caaf5a..df3134eb488 100644 --- a/dlls/msi/tests/source.c +++ b/dlls/msi/tests/source.c @@ -687,7 +687,7 @@ static void test_MsiSourceListAddSourceEx(void) win_skip("Skipping MsiSourceListAddSourceExA tests\n"); return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -1701,7 +1701,7 @@ static void test_MsiSourceListSetInfo(void) win_skip("MsiSourceListSetInfoA is not available\n"); return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -2137,7 +2137,7 @@ static void test_MsiSourceListAddMediaDisk(void) win_skip("MsiSourceListAddMediaDiskA is not available\n"); return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3293,7 +3293,7 @@ static void test_MsiSourceListAddSource(void) win_skip("Skipping MsiSourceListAddSourceA tests\n"); return; } - if (is_process_limited()) + if (!is_process_elevated()) { skip("process is limited\n"); return; @@ -3554,6 +3554,8 @@ done:
START_TEST(source) { + if (!is_process_elevated()) restart_as_admin_elevated(); + init_functionpointers();
if (pIsWow64Process) diff --git a/dlls/msi/tests/utils.h b/dlls/msi/tests/utils.h index 0880553863e..3bcc575f270 100644 --- a/dlls/msi/tests/utils.h +++ b/dlls/msi/tests/utils.h @@ -56,5 +56,6 @@ void delete_cab_files(void); BOOL delete_pf(const char *rel_path, BOOL is_file); BOOL file_exists(const char *file); BOOL pf_exists(const char *file); -BOOL is_process_limited(void); +BOOL is_process_elevated(void); UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query); +void restart_as_admin_elevated(void);