From 3d33fb93cc8508b494604a13dd77a8ffa30025d3 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Mon, 11 Oct 2010 12:09:11 +0200 Subject: [PATCH] msi/tests: Determine Wow64 mode just once. --- dlls/msi/tests/automation.c | 9 ++++- dlls/msi/tests/install.c | 74 ++++++++++++++++--------------------- dlls/msi/tests/msi.c | 58 +++++++++++------------------ dlls/msi/tests/package.c | 18 ++++----- dlls/msi/tests/source.c | 23 ++++++------ 5 files changed, 80 insertions(+), 102 deletions(-) diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c index 07760d974cb..31009064018 100644 --- a/dlls/msi/tests/automation.c +++ b/dlls/msi/tests/automation.c @@ -32,6 +32,8 @@ #include "wine/test.h" +static BOOL is_wow64; + static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); @@ -2427,9 +2429,8 @@ static void test_Installer_InstallProduct(void) int iValue, iCount; IDispatch *pStringList = NULL; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; create_test_files(); @@ -2731,6 +2732,10 @@ START_TEST(automation) IUnknown *pUnk; init_functionpointers(); + + if (pIsWow64Process) + pIsWow64Process(GetCurrentProcess(), &is_wow64); + GetSystemTimeAsFileTime(&systemtime); GetCurrentDirectoryA(MAX_PATH, prev_path); diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 71dd168bc23..8875bb896fa 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -54,6 +54,7 @@ static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD); static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*); static BOOL on_win9x = FALSE; +static BOOL is_wow64; static const BOOL is_64bit = sizeof(void *) > sizeof(int); static const char *msifile = "msitest.msi"; @@ -3726,7 +3727,6 @@ static void test_MsiInstallProduct(void) HKEY hkey; DWORD num, size, type; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (on_win9x) { @@ -3739,7 +3739,7 @@ static void test_MsiInstallProduct(void) return; } - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* szPackagePath is NULL */ @@ -5059,7 +5059,6 @@ static void test_publish_registerproduct(void) char temp[MAX_PATH]; char keypath[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64 = FALSE; static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion" "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"; @@ -5089,7 +5088,7 @@ static void test_publish_registerproduct(void) create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table)); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); @@ -5108,7 +5107,7 @@ static void test_publish_registerproduct(void) res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey); ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -5215,7 +5214,7 @@ static void test_publish_registerproduct(void) res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, userugkey, 0, access, &hkey); ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -5330,7 +5329,7 @@ static void test_publish_publishproduct(void) CHAR keypath[MAX_PATH]; CHAR temp[MAX_PATH]; CHAR path[MAX_PATH]; - BOOL wow64, old_installer = FALSE; + BOOL old_installer = FALSE; REGSAM access = KEY_ALL_ACCESS; static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion" @@ -5362,7 +5361,7 @@ static void test_publish_publishproduct(void) create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table)); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); @@ -5563,7 +5562,6 @@ static void test_publish_publishfeatures(void) LPSTR usersid; CHAR keypath[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features" "\\84A88FD7F6998CE40A22FB59F6B9C2BB"; @@ -5589,7 +5587,7 @@ static void test_publish_publishfeatures(void) create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table)); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); @@ -5699,11 +5697,10 @@ static void get_owner_company(LPSTR *owner, LPSTR *company) LONG res; HKEY hkey; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; *owner = *company = NULL; - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; res = RegOpenKeyA(HKEY_CURRENT_USER, @@ -5749,7 +5746,6 @@ static void test_publish_registeruser(void) LPSTR owner, company; CHAR keypath[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; static const CHAR keyfmt[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\" @@ -5771,7 +5767,7 @@ static void test_publish_registeruser(void) create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table)); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); @@ -5842,7 +5838,6 @@ static void test_publish_processcomponents(void) CHAR keypath[MAX_PATH]; CHAR program_files_maximus[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; static const CHAR keyfmt[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\" @@ -5864,7 +5859,7 @@ static void test_publish_processcomponents(void) create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table)); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); @@ -5978,7 +5973,6 @@ static void test_publish(void) CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"; char date[MAX_PATH], temp[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64 = FALSE; static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; static const CHAR subkey_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; @@ -5997,7 +5991,7 @@ static void test_publish(void) get_date_str(date); GetTempPath(MAX_PATH, temp); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, KEY_ALL_ACCESS, &uninstall); @@ -6081,7 +6075,7 @@ static void test_publish(void) ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -6163,7 +6157,7 @@ static void test_publish(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -6246,7 +6240,7 @@ static void test_publish(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -6306,7 +6300,7 @@ static void test_publish(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -6366,7 +6360,7 @@ static void test_publish(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -6449,7 +6443,7 @@ static void test_publish(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); @@ -7544,7 +7538,6 @@ static void test_writeregistryvalues(void) DWORD type, size; CHAR path[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (is_process_limited()) { @@ -7557,7 +7550,7 @@ static void test_writeregistryvalues(void) create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table)); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); @@ -8166,7 +8159,6 @@ static void test_MsiConfigureProductEx(void) HKEY props, source; CHAR keypath[MAX_PATH * 2], localpack[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (on_win9x) { @@ -8186,7 +8178,7 @@ static void test_MsiConfigureProductEx(void) create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table)); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); @@ -9412,7 +9404,6 @@ static void test_feature_override(void) { UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (is_process_limited()) { @@ -9426,7 +9417,7 @@ static void test_feature_override(void) create_file("msitest\\notpreselected.txt", 1000); create_database(msifile, fo_tables, sizeof(fo_tables) / sizeof(msi_table)); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; r = MsiInstallProductA(msifile, "ADDLOCAL=override"); @@ -9773,7 +9764,6 @@ static void test_register_font(void) HKEY key; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (is_process_limited()) { @@ -9785,7 +9775,7 @@ static void test_register_font(void) create_file("msitest\\font.ttf", 1000); create_database(msifile, font_tables, sizeof(font_tables) / sizeof(msi_table)); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); @@ -10112,7 +10102,6 @@ static void test_remove_registry_values(void) LONG res; HKEY key; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (is_process_limited()) { @@ -10124,7 +10113,7 @@ static void test_remove_registry_values(void) create_file("msitest\\registry.txt", 1000); create_database(msifile, rrv_tables, sizeof(rrv_tables) / sizeof(msi_table)); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); @@ -10160,7 +10149,7 @@ static void test_remove_registry_values(void) ok(res == ERROR_SUCCESS, "key removed\n"); RegCloseKey(key); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key2", 0, KEY_ALL_ACCESS, &key); ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); @@ -10178,7 +10167,7 @@ static void test_remove_registry_values(void) r = MsiInstallProductA(msifile, "REMOVE=ALL"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key1", 0, KEY_ALL_ACCESS, &key); ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); @@ -10197,7 +10186,7 @@ static void test_remove_registry_values(void) ok(res == ERROR_SUCCESS, "key removed\n"); RegCloseKey(key); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key); ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); @@ -10782,7 +10771,6 @@ static void test_sourcedir_props(void) static void test_package_validation(void) { UINT r; - BOOL wow64 = FALSE; if (is_process_limited()) { @@ -10790,9 +10778,6 @@ static void test_package_validation(void) return; } - if (pIsWow64Process) - pIsWow64Process(GetCurrentProcess(), &wow64); - CreateDirectoryA("msitest", NULL); create_file("msitest\\maximus", 500); create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1033"); @@ -10825,7 +10810,7 @@ static void test_package_validation(void) ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n"); ok(!delete_pf("msitest", FALSE), "directory exists\n"); - if (is_64bit && !wow64) + if (is_64bit && !is_wow64) { DeleteFile(msifile); create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0"); @@ -10851,7 +10836,7 @@ static void test_package_validation(void) ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n"); ok(delete_pf("msitest", FALSE), "directory does not exist\n"); } - else if (wow64) + else if (is_wow64) { DeleteFile(msifile); create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0"); @@ -10922,6 +10907,9 @@ START_TEST(install) on_win9x = check_win9x(); + if (pIsWow64Process) + pIsWow64Process(GetCurrentProcess(), &is_wow64); + GetCurrentDirectoryA(MAX_PATH, prev_path); GetTempPath(MAX_PATH, temp_path); SetCurrentDirectoryA(temp_path); diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index e4da57685d8..d660a81c788 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -29,6 +29,7 @@ #include "wine/test.h" +static BOOL is_wow64; static const char msifile[] = "winetest.msi"; static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*); @@ -244,9 +245,8 @@ static void test_null(void) LPBYTE lpData = NULL; INSTALLSTATE state; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; r = pMsiOpenPackageExW(NULL, 0, &hpkg); @@ -575,12 +575,11 @@ static void test_MsiQueryProductState(void) HKEY prodkey; DWORD data; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(prodcode, prod_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* NULL prodcode */ @@ -861,14 +860,13 @@ static void test_MsiQueryFeatureState(void) LPSTR usersid; LONG res; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(prodcode, prod_squashed); compose_base85_guid(component, comp_base85, comp_squashed); compose_base85_guid(component, comp_base85 + 20, comp_squashed2); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* NULL prodcode */ @@ -1274,7 +1272,6 @@ static void test_MsiQueryComponentState(void) LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; static const INSTALLSTATE MAGIC_ERROR = 0xdeadbeef; @@ -1288,7 +1285,7 @@ static void test_MsiQueryComponentState(void) compose_base85_guid(component, comp_base85, comp_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* NULL szProductCode */ @@ -1605,14 +1602,13 @@ static void test_MsiGetComponentPath(void) LPSTR usersid; DWORD size, val; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; LONG res; create_test_guid(prodcode, prod_squashed); compose_base85_guid(component, comp_base85, comp_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* NULL szProduct */ @@ -2135,14 +2131,13 @@ static void test_MsiGetProductCode(void) LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(prodcode, prod_squashed); create_test_guid(prodcode2, prod2_squashed); compose_base85_guid(component, comp_base85, comp_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* szComponent is NULL */ @@ -2403,14 +2398,13 @@ static void test_MsiEnumClients(void) LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(prodcode, prod_squashed); create_test_guid(prodcode2, prod2_squashed); compose_base85_guid(component, comp_base85, comp_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* NULL szComponent */ @@ -2854,13 +2848,12 @@ static void test_MsiGetProductInfo(void) LPSTR usersid; DWORD sz, val = 42; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(prodcode, prod_squashed); create_test_guid(packcode, pack_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* NULL szProduct */ @@ -4141,7 +4134,6 @@ static void test_MsiGetProductInfoEx(void) LPSTR usersid; DWORD sz; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (!pMsiGetProductInfoExA) { @@ -4153,7 +4145,7 @@ static void test_MsiGetProductInfoEx(void) create_test_guid(packcode, pack_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* NULL szProductCode */ @@ -6895,12 +6887,11 @@ static void test_MsiGetUserInfo(void) LPSTR usersid; LONG res; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(prodcode, prod_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* NULL szProduct */ @@ -7480,7 +7471,6 @@ static void test_MsiOpenProduct(void) LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; GetCurrentDirectoryA(MAX_PATH, path); lstrcatA(path, "\\"); @@ -7488,7 +7478,7 @@ static void test_MsiOpenProduct(void) create_test_guid(prodcode, prod_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; hdb = create_package_db(prodcode); @@ -7802,12 +7792,11 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(prodcode, prod_squashed); create_test_guid(patch, patch_squashed); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* MSIPATCHSTATE_APPLIED */ @@ -8406,12 +8395,11 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(prodcode, prod_squashed); create_test_guid(patch, patch_squashed); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* MSIPATCHSTATE_APPLIED */ @@ -8870,12 +8858,11 @@ static void test_MsiEnumPatchesEx_machine(void) LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(prodcode, prod_squashed); create_test_guid(patch, patch_squashed); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* MSIPATCHSTATE_APPLIED */ @@ -9575,13 +9562,12 @@ static void test_MsiEnumPatches(void) LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(prodcode, prod_squashed); create_test_guid(patchcode, patch_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* NULL szProduct */ @@ -10276,7 +10262,6 @@ static void test_MsiGetPatchInfoEx(void) LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (!pMsiGetPatchInfoExA) { @@ -10288,7 +10273,7 @@ static void test_MsiGetPatchInfoEx(void) create_test_guid(patchcode, patch_squashed); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* NULL szPatchCode */ @@ -11299,13 +11284,12 @@ static void test_MsiGetPatchInfo(void) DWORD size; LONG res; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(patch_code, patch_squashed); create_test_guid(prod_code, prod_squashed); MultiByteToWideChar(CP_ACP, 0, patch_code, -1, patch_codeW, MAX_PATH); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; r = MsiGetPatchInfoA(NULL, NULL, NULL, NULL); @@ -11486,14 +11470,13 @@ static void test_MsiEnumProducts(void) char *usersid; HKEY key1, key2, key3; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; create_test_guid(product1, product_squashed1); create_test_guid(product2, product_squashed2); create_test_guid(product3, product_squashed3); get_user_sid(&usersid); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; strcpy(keypath1, "Software\\Classes\\Installer\\Products\\"); @@ -11563,6 +11546,9 @@ START_TEST(msi) { init_functionpointers(); + if (pIsWow64Process) + pIsWow64Process(GetCurrentProcess(), &is_wow64); + test_usefeature(); test_null(); test_getcomponentpath(); diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index 953e8c9de7b..7e688c8614a 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -31,6 +31,7 @@ #include "wine/test.h" +static BOOL is_wow64; static const char msifile[] = "winetest-package.msi"; static char CURR_DIR[MAX_PATH]; @@ -260,9 +261,8 @@ static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context, LPCSTR prod = NULL; HKEY hkey; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH); @@ -324,9 +324,8 @@ static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR CHAR comppath[MAX_PATH]; CHAR prodpath[MAX_PATH]; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH); @@ -9867,10 +9866,9 @@ static void test_installprops(void) int res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64 = FALSE; SYSTEM_INFO si; - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; GetCurrentDirectory(MAX_PATH, path); @@ -10052,7 +10050,7 @@ static void test_installprops(void) } else if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) { - if (!wow64) + if (!is_wow64) { buf[0] = 0; size = MAX_PATH; @@ -12371,7 +12369,6 @@ static void test_MsiGetProductProperty(void) UINT r; SC_HANDLE scm; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; scm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT); if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) @@ -12386,7 +12383,7 @@ static void test_MsiGetProductProperty(void) create_test_guid(prodcode, prod_squashed); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); @@ -12796,6 +12793,9 @@ START_TEST(package) init_functionpointers(); + if (pIsWow64Process) + pIsWow64Process(GetCurrentProcess(), &is_wow64); + GetCurrentDirectoryA(MAX_PATH, CURR_DIR); /* Create a restore point ourselves so we circumvent the multitude of restore points diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c index 0b8dc664744..b95dd128e78 100644 --- a/dlls/msi/tests/source.c +++ b/dlls/msi/tests/source.c @@ -31,6 +31,8 @@ #include "wine/test.h" +static BOOL is_wow64; + static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); static BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG); @@ -650,7 +652,6 @@ static void test_MsiSourceListAddSourceEx(void) HKEY prodkey, userkey, hkey, url, net; DWORD size; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (!pMsiSourceListAddSourceExA) { @@ -665,7 +666,7 @@ static void test_MsiSourceListAddSourceEx(void) return; } - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* GetLastError is not set by the function */ @@ -1038,7 +1039,6 @@ static void test_MsiSourceListEnumSources(void) HKEY url, net, source; DWORD size; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (!pMsiSourceListEnumSourcesA) { @@ -1053,7 +1053,7 @@ static void test_MsiSourceListEnumSources(void) return; } - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* GetLastError is not set by the function */ @@ -1656,7 +1656,6 @@ static void test_MsiSourceListSetInfo(void) LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (!pMsiSourceListSetInfoA) { @@ -1671,7 +1670,7 @@ static void test_MsiSourceListSetInfo(void) return; } - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* GetLastError is not set by the function */ @@ -2082,7 +2081,6 @@ static void test_MsiSourceListAddMediaDisk(void) LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (!pMsiSourceListAddMediaDiskA) { @@ -2097,7 +2095,7 @@ static void test_MsiSourceListAddMediaDisk(void) return; } - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* GetLastError is not set by the function */ @@ -2397,7 +2395,6 @@ static void test_MsiSourceListEnumMediaDisks(void) LONG res; UINT r; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (!pMsiSourceListEnumMediaDisksA) { @@ -2412,7 +2409,7 @@ static void test_MsiSourceListEnumMediaDisks(void) return; } - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* GetLastError is not set by the function */ @@ -3211,7 +3208,6 @@ static void test_MsiSourceListAddSource(void) HKEY prodkey, userkey, net, source; DWORD size; REGSAM access = KEY_ALL_ACCESS; - BOOL wow64; if (!pMsiSourceListAddSourceA) { @@ -3240,7 +3236,7 @@ static void test_MsiSourceListAddSource(void) } trace("username: %s\n", username); - if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64) + if (is_wow64) access |= KEY_WOW64_64KEY; /* GetLastError is not set by the function */ @@ -3478,6 +3474,9 @@ START_TEST(source) { init_functionpointers(); + if (pIsWow64Process) + pIsWow64Process(GetCurrentProcess(), &is_wow64); + test_MsiSourceListGetInfo(); test_MsiSourceListAddSourceEx(); test_MsiSourceListEnumSources();