Commit 3d33fb93 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi/tests: Determine Wow64 mode just once.

parent 2b6ab9eb
......@@ -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);
......
......@@ -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();
......
......@@ -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
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment