Commit 21d09ffb authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi/tests: Fix test failures on wow64.

parent d8b7a209
......@@ -32,6 +32,8 @@
static const char msifile[] = "winetest.msi";
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static INSTALLSTATE (WINAPI *pMsiGetComponentPathA)
(LPCSTR, LPCSTR, LPSTR, DWORD*);
......@@ -57,6 +59,7 @@ static void init_functionpointers(void)
{
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
#define GET_PROC(dll, func) \
p ## func = (void *)GetProcAddress(dll, #func); \
......@@ -74,6 +77,8 @@ static void init_functionpointers(void)
GET_PROC(hmsi, MsiGetPatchInfoExA)
GET_PROC(hadvapi32, ConvertSidToStringSidA)
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
#undef GET_PROC
}
......@@ -223,6 +228,13 @@ static void test_usefeature(void)
ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
}
static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
{
if (pRegDeleteKeyExA)
return pRegDeleteKeyExA( key, subkey, access, 0 );
return RegDeleteKeyA( key, subkey );
}
static void test_null(void)
{
MSIHANDLE hpkg;
......@@ -231,6 +243,11 @@ static void test_null(void)
DWORD dwType, cbData;
LPBYTE lpData = NULL;
INSTALLSTATE state;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
r = pMsiOpenPackageExW(NULL, 0, &hpkg);
ok( r == ERROR_INVALID_PARAMETER,"wrong error\n");
......@@ -257,7 +274,7 @@ static void test_null(void)
* necessary registry values */
/* empty product string */
r = RegOpenKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", &hkey);
r = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", 0, access, &hkey);
ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
r = RegQueryValueExA(hkey, NULL, 0, &dwType, lpData, &cbData);
......@@ -297,7 +314,8 @@ static void test_null(void)
ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
/* empty attribute */
r = RegCreateKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}", &hkey);
r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}",
0, NULL, 0, access, NULL, &hkey, NULL);
ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
r = RegSetValueA(hkey, NULL, REG_SZ, "test", strlen("test"));
......@@ -309,7 +327,8 @@ static void test_null(void)
r = RegCloseKey(hkey);
ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
r = RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}");
r = delete_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{F1C3AF50-8B56-4A69-A00C-00773FE42F30}",
access & KEY_WOW64_64KEY);
ok( r == ERROR_SUCCESS, "wrong error %d\n", r);
}
......@@ -543,10 +562,15 @@ static void test_MsiQueryProductState(void)
HKEY userkey, localkey, props;
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)
access |= KEY_WOW64_64KEY;
/* NULL prodcode */
state = MsiQueryProductStateA(NULL);
ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
......@@ -589,7 +613,7 @@ static void test_MsiQueryProductState(void)
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\");
lstrcatA(keypath, prodcode);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local uninstall key exists */
......@@ -605,21 +629,21 @@ static void test_MsiQueryProductState(void)
ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
RegDeleteValueA(localkey, "WindowsInstaller");
RegDeleteKeyA(localkey, "");
delete_key(localkey, "", access & KEY_WOW64_64KEY);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
lstrcatA(keypath, usersid);
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local product key exists */
state = MsiQueryProductStateA(prodcode);
ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
res = RegCreateKeyA(localkey, "InstallProperties", &props);
res = RegCreateKeyExA(localkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* install properties key exists */
......@@ -649,9 +673,9 @@ static void test_MsiQueryProductState(void)
ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
RegDeleteValueA(props, "WindowsInstaller");
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(localkey, "");
delete_key(localkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(localkey);
RegDeleteKeyA(userkey, "");
RegCloseKey(userkey);
......@@ -663,7 +687,7 @@ static void test_MsiQueryProductState(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryProductStateA(prodcode);
......@@ -675,14 +699,14 @@ static void test_MsiQueryProductState(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryProductStateA(prodcode);
ok(state == INSTALLSTATE_ADVERTISED,
"Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
res = RegCreateKeyA(localkey, "InstallProperties", &props);
res = RegCreateKeyExA(localkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryProductStateA(prodcode);
......@@ -698,11 +722,11 @@ static void test_MsiQueryProductState(void)
ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
RegDeleteValueA(props, "WindowsInstaller");
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(localkey, "");
delete_key(localkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(localkey);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
/* MSIINSTALLCONTEXT_MACHINE */
......@@ -710,7 +734,7 @@ static void test_MsiQueryProductState(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryProductStateA(prodcode);
......@@ -720,14 +744,14 @@ static void test_MsiQueryProductState(void)
lstrcatA(keypath, "S-1-5-18\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryProductStateA(prodcode);
ok(state == INSTALLSTATE_ADVERTISED,
"Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
res = RegCreateKeyA(localkey, "InstallProperties", &props);
res = RegCreateKeyExA(localkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryProductStateA(prodcode);
......@@ -743,11 +767,11 @@ static void test_MsiQueryProductState(void)
ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
RegDeleteValueA(props, "WindowsInstaller");
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(localkey, "");
delete_key(localkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(localkey);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
LocalFree(usersid);
......@@ -817,12 +841,17 @@ static void test_MsiQueryFeatureState(void)
INSTALLSTATE state;
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)
access |= KEY_WOW64_64KEY;
/* NULL prodcode */
state = MsiQueryFeatureStateA(NULL, "feature");
ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
......@@ -884,7 +913,7 @@ static void test_MsiQueryFeatureState(void)
lstrcatA(keypath, prod_squashed);
lstrcatA(keypath, "\\Features");
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* userdata features key exists */
......@@ -920,7 +949,7 @@ static void test_MsiQueryFeatureState(void)
lstrcatA(keypath, "\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
......@@ -928,7 +957,7 @@ static void test_MsiQueryFeatureState(void)
lstrcatA(keypath, "\\Components\\");
lstrcatA(keypath, comp_squashed2);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey2);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey2, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryFeatureStateA(prodcode, "feature");
......@@ -983,8 +1012,8 @@ static void test_MsiQueryFeatureState(void)
RegDeleteValueA(compkey, prod_squashed);
RegDeleteValueA(compkey2, prod_squashed);
RegDeleteKeyA(compkey, "");
RegDeleteKeyA(compkey2, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
delete_key(compkey2, "", access & KEY_WOW64_64KEY);
RegDeleteValueA(localkey, "feature");
RegDeleteValueA(userkey, "feature");
RegDeleteKeyA(userkey, "");
......@@ -1000,7 +1029,7 @@ static void test_MsiQueryFeatureState(void)
lstrcatA(keypath, "\\Installer\\Features\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* feature key exists */
......@@ -1020,7 +1049,7 @@ static void test_MsiQueryFeatureState(void)
lstrcatA(keypath, prod_squashed);
lstrcatA(keypath, "\\Features");
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* userdata features key exists */
......@@ -1056,7 +1085,7 @@ static void test_MsiQueryFeatureState(void)
lstrcatA(keypath, "\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
......@@ -1064,7 +1093,7 @@ static void test_MsiQueryFeatureState(void)
lstrcatA(keypath, "\\Components\\");
lstrcatA(keypath, comp_squashed2);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey2);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey2, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryFeatureStateA(prodcode, "feature");
......@@ -1090,11 +1119,11 @@ static void test_MsiQueryFeatureState(void)
RegDeleteValueA(compkey, prod_squashed);
RegDeleteValueA(compkey2, prod_squashed);
RegDeleteKeyA(compkey, "");
RegDeleteKeyA(compkey2, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
delete_key(compkey2, "", access & KEY_WOW64_64KEY);
RegDeleteValueA(localkey, "feature");
RegDeleteValueA(userkey, "feature");
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(compkey);
RegCloseKey(compkey2);
RegCloseKey(localkey);
......@@ -1105,7 +1134,7 @@ static void test_MsiQueryFeatureState(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Features\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* feature key exists */
......@@ -1124,7 +1153,7 @@ static void test_MsiQueryFeatureState(void)
lstrcatA(keypath, prod_squashed);
lstrcatA(keypath, "\\Features");
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* userdata features key exists */
......@@ -1159,14 +1188,14 @@ static void test_MsiQueryFeatureState(void)
lstrcatA(keypath, "S-1-5-18\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
lstrcatA(keypath, "S-1-5-18\\Components\\");
lstrcatA(keypath, comp_squashed2);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey2);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey2, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MsiQueryFeatureStateA(prodcode, "feature");
......@@ -1192,11 +1221,11 @@ static void test_MsiQueryFeatureState(void)
RegDeleteValueA(compkey, prod_squashed);
RegDeleteValueA(compkey2, prod_squashed);
RegDeleteKeyA(compkey, "");
RegDeleteKeyA(compkey2, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
delete_key(compkey2, "", access & KEY_WOW64_64KEY);
RegDeleteValueA(localkey, "feature");
RegDeleteValueA(userkey, "feature");
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(compkey);
RegCloseKey(compkey2);
RegCloseKey(localkey);
......@@ -1217,6 +1246,8 @@ static void test_MsiQueryComponentState(void)
LPSTR usersid;
LONG res;
UINT r;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
static const INSTALLSTATE MAGIC_ERROR = 0xdeadbeef;
......@@ -1230,6 +1261,9 @@ static void test_MsiQueryComponentState(void)
compose_base85_guid(component, comp_base85, comp_squashed);
get_user_sid(&usersid);
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
/* NULL szProductCode */
state = MAGIC_ERROR;
r = pMsiQueryComponentStateA(NULL, NULL, MSIINSTALLCONTEXT_MACHINE, component, &state);
......@@ -1274,7 +1308,7 @@ static void test_MsiQueryComponentState(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MAGIC_ERROR;
......@@ -1282,7 +1316,7 @@ static void test_MsiQueryComponentState(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);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
/* create local system product key */
......@@ -1290,7 +1324,7 @@ static void test_MsiQueryComponentState(void)
lstrcatA(keypath, prod_squashed);
lstrcatA(keypath, "\\InstallProperties");
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local system product key exists */
......@@ -1311,7 +1345,7 @@ static void test_MsiQueryComponentState(void)
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* component key exists */
......@@ -1382,9 +1416,9 @@ static void test_MsiQueryComponentState(void)
ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
RegDeleteValueA(prodkey, "LocalPackage");
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegDeleteValueA(compkey, prod_squashed);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
RegCloseKey(compkey);
......@@ -1415,7 +1449,7 @@ static void test_MsiQueryComponentState(void)
lstrcatA(keypath, prod_squashed);
lstrcatA(keypath, "\\InstallProperties");
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(prodkey, "LocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
......@@ -1433,7 +1467,7 @@ static void test_MsiQueryComponentState(void)
lstrcatA(keypath, "\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* component key exists */
......@@ -1486,7 +1520,7 @@ static void test_MsiQueryComponentState(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
state = MAGIC_ERROR;
......@@ -1494,7 +1528,7 @@ static void test_MsiQueryComponentState(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);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
......@@ -1503,7 +1537,7 @@ static void test_MsiQueryComponentState(void)
lstrcatA(keypath, prod_squashed);
lstrcatA(keypath, "\\InstallProperties");
res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(prodkey, "ManagedLocalPackage", 0, REG_SZ, (const BYTE *)"msitest.msi", 11);
......@@ -1516,9 +1550,9 @@ static void test_MsiQueryComponentState(void)
RegDeleteValueA(prodkey, "LocalPackage");
RegDeleteValueA(prodkey, "ManagedLocalPackage");
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegDeleteValueA(compkey, prod_squashed);
RegDeleteKeyA(compkey, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
RegCloseKey(compkey);
LocalFree(usersid);
......@@ -1537,12 +1571,17 @@ static void test_MsiGetComponentPath(void)
INSTALLSTATE state;
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)
access |= KEY_WOW64_64KEY;
/* NULL szProduct */
size = MAX_PATH;
state = MsiGetComponentPathA(NULL, component, path, &size);
......@@ -1597,7 +1636,7 @@ static void test_MsiGetComponentPath(void)
lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local system component key exists */
......@@ -1634,7 +1673,7 @@ static void test_MsiGetComponentPath(void)
lstrcatA(keypath, prod_squashed);
lstrcatA(keypath, "\\InstallProperties");
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &installprop, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
val = 1;
......@@ -1674,9 +1713,9 @@ static void test_MsiGetComponentPath(void)
ok(size == 10, "Expected 10, got %d\n", size);
RegDeleteValueA(compkey, prod_squashed);
RegDeleteKeyA(compkey, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
RegDeleteValueA(installprop, "WindowsInstaller");
RegDeleteKeyA(installprop, "");
delete_key(installprop, "", access & KEY_WOW64_64KEY);
RegCloseKey(compkey);
RegCloseKey(installprop);
DeleteFileA("C:\\imapath");
......@@ -1687,7 +1726,7 @@ static void test_MsiGetComponentPath(void)
lstrcatA(keypath, "\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user managed component key exists */
......@@ -1724,7 +1763,7 @@ static void test_MsiGetComponentPath(void)
lstrcatA(keypath, prod_squashed);
lstrcatA(keypath, "\\InstallProperties");
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &installprop, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
val = 1;
......@@ -1764,9 +1803,9 @@ static void test_MsiGetComponentPath(void)
ok(size == 10, "Expected 10, got %d\n", size);
RegDeleteValueA(compkey, prod_squashed);
RegDeleteKeyA(compkey, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
RegDeleteValueA(installprop, "WindowsInstaller");
RegDeleteKeyA(installprop, "");
delete_key(installprop, "", access & KEY_WOW64_64KEY);
RegCloseKey(compkey);
RegCloseKey(installprop);
DeleteFileA("C:\\imapath");
......@@ -1777,7 +1816,7 @@ static void test_MsiGetComponentPath(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user managed product key exists */
......@@ -1797,7 +1836,7 @@ static void test_MsiGetComponentPath(void)
lstrcatA(keypath, "\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user managed component key exists */
......@@ -1834,7 +1873,7 @@ static void test_MsiGetComponentPath(void)
lstrcatA(keypath, prod_squashed);
lstrcatA(keypath, "\\InstallProperties");
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &installprop);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &installprop, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
val = 1;
......@@ -1874,10 +1913,10 @@ static void test_MsiGetComponentPath(void)
ok(size == 10, "Expected 10, got %d\n", size);
RegDeleteValueA(compkey, prod_squashed);
RegDeleteKeyA(prodkey, "");
RegDeleteKeyA(compkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
delete_key(compkey, "", access & KEY_WOW64_64KEY);
RegDeleteValueA(installprop, "WindowsInstaller");
RegDeleteKeyA(installprop, "");
delete_key(installprop, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
RegCloseKey(compkey);
RegCloseKey(installprop);
......@@ -1906,7 +1945,7 @@ static void test_MsiGetComponentPath(void)
lstrcatA(keypath, "\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user unmanaged component key exists */
......@@ -1957,7 +1996,7 @@ static void test_MsiGetComponentPath(void)
RegDeleteValueA(compkey, prod_squashed);
RegDeleteKeyA(prodkey, "");
RegDeleteKeyA(compkey, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
RegCloseKey(compkey);
DeleteFileA("C:\\imapath");
......@@ -1965,7 +2004,7 @@ static void test_MsiGetComponentPath(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local classes product key exists */
......@@ -1983,7 +2022,7 @@ static void test_MsiGetComponentPath(void)
lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local user component key exists */
......@@ -2033,8 +2072,8 @@ static void test_MsiGetComponentPath(void)
ok(size == 10, "Expected 10, got %d\n", size);
RegDeleteValueA(compkey, prod_squashed);
RegDeleteKeyA(prodkey, "");
RegDeleteKeyA(compkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
delete_key(compkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
RegCloseKey(compkey);
DeleteFileA("C:\\imapath");
......@@ -2056,12 +2095,17 @@ static void test_MsiGetProductCode(void)
LPSTR usersid;
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)
access |= KEY_WOW64_64KEY;
/* szComponent is NULL */
lstrcpyA(product, "prod");
r = MsiGetProductCodeA(NULL, product);
......@@ -2110,7 +2154,7 @@ static void test_MsiGetProductCode(void)
lstrcatA(keypath, "\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user unmanaged component key exists */
......@@ -2137,7 +2181,7 @@ static void test_MsiGetProductCode(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user managed product key of first product exists */
......@@ -2146,7 +2190,7 @@ static void test_MsiGetProductCode(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
......@@ -2167,7 +2211,7 @@ static void test_MsiGetProductCode(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local classes product key exists */
......@@ -2176,7 +2220,7 @@ static void test_MsiGetProductCode(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
......@@ -2185,7 +2229,7 @@ static void test_MsiGetProductCode(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod2_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user managed product key of second product exists */
......@@ -2194,18 +2238,18 @@ static void test_MsiGetProductCode(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(product, prodcode2), "Expected %s, got %s\n", prodcode2, product);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
RegDeleteValueA(compkey, prod_squashed);
RegDeleteValueA(compkey, prod2_squashed);
RegDeleteKeyA(compkey, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(compkey);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local user component key exists */
......@@ -2232,7 +2276,7 @@ static void test_MsiGetProductCode(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user managed product key of first product exists */
......@@ -2241,7 +2285,7 @@ static void test_MsiGetProductCode(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
......@@ -2262,7 +2306,7 @@ static void test_MsiGetProductCode(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local classes product key exists */
......@@ -2271,7 +2315,7 @@ static void test_MsiGetProductCode(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(product, prodcode), "Expected %s, got %s\n", prodcode, product);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
......@@ -2280,7 +2324,7 @@ static void test_MsiGetProductCode(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod2_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user managed product key of second product exists */
......@@ -2289,11 +2333,11 @@ static void test_MsiGetProductCode(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(product, prodcode2), "Expected %s, got %s\n", prodcode2, product);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
RegDeleteValueA(compkey, prod_squashed);
RegDeleteValueA(compkey, prod2_squashed);
RegDeleteKeyA(compkey, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(compkey);
LocalFree(usersid);
}
......@@ -2313,12 +2357,17 @@ static void test_MsiEnumClients(void)
LPSTR usersid;
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)
access |= KEY_WOW64_64KEY;
/* NULL szComponent */
product[0] = '\0';
r = MsiEnumClientsA(NULL, 0, product);
......@@ -2347,7 +2396,7 @@ static void test_MsiEnumClients(void)
lstrcatA(keypath, "\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user unmanaged component key exists */
......@@ -2410,14 +2459,14 @@ static void test_MsiEnumClients(void)
RegDeleteValueA(compkey, prod_squashed);
RegDeleteValueA(compkey, prod2_squashed);
RegDeleteKeyA(compkey, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(compkey);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Components\\");
lstrcatA(keypath, comp_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &compkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &compkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user local component key exists */
......@@ -2480,7 +2529,7 @@ static void test_MsiEnumClients(void)
RegDeleteValueA(compkey, prod_squashed);
RegDeleteValueA(compkey, prod2_squashed);
RegDeleteKeyA(compkey, "");
delete_key(compkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(compkey);
LocalFree(usersid);
}
......@@ -2753,11 +2802,16 @@ static void test_MsiGetProductInfo(void)
CHAR keypath[MAX_PATH];
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)
access |= KEY_WOW64_64KEY;
/* NULL szProduct */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
......@@ -2856,7 +2910,7 @@ static void test_MsiGetProductInfo(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product code exists */
......@@ -2868,7 +2922,7 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\");
......@@ -2876,7 +2930,7 @@ static void test_MsiGetProductInfo(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local user product code exists */
......@@ -2893,7 +2947,7 @@ static void test_MsiGetProductInfo(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* both local and managed product code exist */
......@@ -2905,7 +2959,7 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
res = RegCreateKeyExA(localkey, "InstallProperties", 0, NULL, 0, access, NULL, &propkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -2974,9 +3028,9 @@ static void test_MsiGetProductInfo(void)
RegDeleteValueA(propkey, "IMadeThis");
RegDeleteValueA(propkey, "HelpLink");
RegDeleteKeyA(propkey, "");
RegDeleteKeyA(localkey, "");
RegDeleteKeyA(prodkey, "");
delete_key(propkey, "", access & KEY_WOW64_64KEY);
delete_key(localkey, "", access & KEY_WOW64_64KEY);
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(propkey);
RegCloseKey(localkey);
RegCloseKey(prodkey);
......@@ -3001,7 +3055,7 @@ static void test_MsiGetProductInfo(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local user product key exists */
......@@ -3013,7 +3067,7 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
res = RegCreateKeyExA(localkey, "InstallProperties", 0, NULL, 0, access, NULL, &propkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -3036,8 +3090,8 @@ static void test_MsiGetProductInfo(void)
ok(sz == 4, "Expected 4, got %d\n", sz);
RegDeleteValueA(propkey, "HelpLink");
RegDeleteKeyA(propkey, "");
RegDeleteKeyA(localkey, "");
delete_key(propkey, "", access & KEY_WOW64_64KEY);
delete_key(localkey, "", access & KEY_WOW64_64KEY);
RegDeleteKeyA(prodkey, "");
RegCloseKey(propkey);
RegCloseKey(localkey);
......@@ -3046,7 +3100,7 @@ static void test_MsiGetProductInfo(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* classes product key exists */
......@@ -3063,7 +3117,7 @@ static void test_MsiGetProductInfo(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local user product key exists */
......@@ -3075,7 +3129,7 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
res = RegCreateKeyExA(localkey, "InstallProperties", 0, NULL, 0, access, NULL, &propkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -3087,8 +3141,8 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
RegDeleteKeyA(propkey, "");
RegDeleteKeyA(localkey, "");
delete_key(propkey, "", access & KEY_WOW64_64KEY);
delete_key(localkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(propkey);
RegCloseKey(localkey);
......@@ -3096,7 +3150,7 @@ static void test_MsiGetProductInfo(void)
lstrcatA(keypath, "S-1-5-18\\\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Local System product key exists */
......@@ -3108,7 +3162,7 @@ static void test_MsiGetProductInfo(void)
ok(!lstrcmpA(buf, "apple"), "Expected \"apple\", got \"%s\"\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
res = RegCreateKeyExA(localkey, "InstallProperties", 0, NULL, 0, access, NULL, &propkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -3877,7 +3931,7 @@ static void test_MsiGetProductInfo(void)
"Expected buf to be unchanged, got \"%s\"\n", buf);
ok(sz == MAX_PATH, "Expected sz to be unchanged, got %d\n", sz);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists, but PackageName val does not exist */
......@@ -3994,8 +4048,8 @@ static void test_MsiGetProductInfo(void)
RegDeleteValueA(propkey, "Version");
RegDeleteValueA(propkey, "ProductIcon");
RegDeleteValueA(propkey, "AuthorizedLUAApp");
RegDeleteKeyA(propkey, "");
RegDeleteKeyA(localkey, "");
delete_key(propkey, "", access & KEY_WOW64_64KEY);
delete_key(localkey, "", access & KEY_WOW64_64KEY);
RegDeleteValueA(prodkey, "InstanceType");
RegDeleteValueA(prodkey, "Transforms");
RegDeleteValueA(prodkey, "Language");
......@@ -4006,8 +4060,8 @@ static void test_MsiGetProductInfo(void)
RegDeleteValueA(prodkey, "ProductIcon");
RegDeleteValueA(prodkey, "AuthorizedLUAApp");
RegDeleteValueA(source, "PackageName");
RegDeleteKeyA(source, "");
RegDeleteKeyA(prodkey, "");
delete_key(source, "", access & KEY_WOW64_64KEY);
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(propkey);
RegCloseKey(localkey);
RegCloseKey(source);
......@@ -4029,6 +4083,8 @@ static void test_MsiGetProductInfoEx(void)
CHAR keypath[MAX_PATH];
LPSTR usersid;
DWORD sz;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
if (!pMsiGetProductInfoExA)
{
......@@ -4040,6 +4096,9 @@ static void test_MsiGetProductInfoEx(void)
create_test_guid(packcode, pack_squashed);
get_user_sid(&usersid);
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
/* NULL szProductCode */
sz = MAX_PATH;
lstrcpyA(buf, "apple");
......@@ -4162,7 +4221,7 @@ static void test_MsiGetProductInfoEx(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local user product key exists */
......@@ -4176,7 +4235,7 @@ static void test_MsiGetProductInfoEx(void)
ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
res = RegCreateKeyExA(localkey, "InstallProperties", 0, NULL, 0, access, NULL, &propkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -4658,7 +4717,7 @@ static void test_MsiGetProductInfoEx(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user product key exists */
......@@ -5079,7 +5138,7 @@ static void test_MsiGetProductInfoEx(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local user product key exists */
......@@ -5093,7 +5152,7 @@ static void test_MsiGetProductInfoEx(void)
ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
res = RegCreateKeyExA(localkey, "InstallProperties", 0, NULL, 0, access, NULL, &propkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -5492,7 +5551,7 @@ static void test_MsiGetProductInfoEx(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user product key exists */
......@@ -5505,7 +5564,7 @@ static void test_MsiGetProductInfoEx(void)
ok(!lstrcmpA(buf, "1"), "Expected \"1\", got \"%s\"\n", buf);
ok(sz == 1, "Expected 1, got %d\n", sz);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(userkey);
lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
......@@ -5544,7 +5603,7 @@ static void test_MsiGetProductInfoEx(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(userkey, "HelpLink", 0, REG_SZ, (LPBYTE)"link", 5);
......@@ -5925,9 +5984,9 @@ static void test_MsiGetProductInfoEx(void)
RegDeleteValueA(userkey, "InstallDate");
RegDeleteValueA(userkey, "HelpTelephone");
RegDeleteValueA(userkey, "HelpLink");
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(userkey);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
/* MSIINSTALLCONTEXT_MACHINE */
......@@ -5946,7 +6005,7 @@ static void test_MsiGetProductInfoEx(void)
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local system product key exists */
......@@ -5960,7 +6019,7 @@ static void test_MsiGetProductInfoEx(void)
ok(!lstrcmpA(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
ok(sz == MAX_PATH, "Expected MAX_PATH, got %d\n", sz);
res = RegCreateKeyA(localkey, "InstallProperties", &propkey);
res = RegCreateKeyExA(localkey, "InstallProperties", 0, NULL, 0, access, NULL, &propkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -6349,15 +6408,15 @@ static void test_MsiGetProductInfoEx(void)
RegDeleteValueA(propkey, "HelpTelephone");
RegDeleteValueA(propkey, "HelpLink");
RegDeleteValueA(propkey, "LocalPackage");
RegDeleteKeyA(propkey, "");
delete_key(propkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(propkey);
RegDeleteKeyA(localkey, "");
delete_key(localkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(localkey);
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local classes product key exists */
......@@ -6748,7 +6807,7 @@ static void test_MsiGetProductInfoEx(void)
RegDeleteValueA(prodkey, "InstallDate");
RegDeleteValueA(prodkey, "HelpTelephone");
RegDeleteValueA(prodkey, "HelpLink");
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
LocalFree(usersid);
}
......@@ -6772,10 +6831,15 @@ static void test_MsiGetUserInfo(void)
HKEY prodkey, userprod, props;
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)
access |= KEY_WOW64_64KEY;
/* NULL szProduct */
INIT_USERINFO();
state = MsiGetUserInfoA(NULL, user, &usersz, org, &orgsz, serial, &serialsz);
......@@ -6942,7 +7006,7 @@ static void test_MsiGetUserInfo(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product key exists */
......@@ -6963,10 +7027,10 @@ static void test_MsiGetUserInfo(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userprod);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userprod, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyA(userprod, "InstallProperties", &props);
res = RegCreateKeyExA(userprod, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -7089,11 +7153,11 @@ static void test_MsiGetUserInfo(void)
RegDeleteValueA(props, "ProductID");
RegDeleteValueA(props, "RegCompany");
RegDeleteValueA(props, "RegOwner");
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(userprod, "");
delete_key(userprod, "", access & KEY_WOW64_64KEY);
RegCloseKey(userprod);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
/* MSIINSTALLCONTEXT_USERUNMANAGED */
......@@ -7123,10 +7187,10 @@ static void test_MsiGetUserInfo(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userprod);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userprod, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyA(userprod, "InstallProperties", &props);
res = RegCreateKeyExA(userprod, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -7207,9 +7271,9 @@ static void test_MsiGetUserInfo(void)
RegDeleteValueA(props, "ProductID");
RegDeleteValueA(props, "RegCompany");
RegDeleteValueA(props, "RegOwner");
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(userprod, "");
delete_key(userprod, "", access & KEY_WOW64_64KEY);
RegCloseKey(userprod);
RegDeleteKeyA(prodkey, "");
RegCloseKey(prodkey);
......@@ -7220,7 +7284,7 @@ static void test_MsiGetUserInfo(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* product key exists */
......@@ -7240,10 +7304,10 @@ static void test_MsiGetUserInfo(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userprod);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userprod, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyA(userprod, "InstallProperties", &props);
res = RegCreateKeyExA(userprod, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -7324,11 +7388,11 @@ static void test_MsiGetUserInfo(void)
RegDeleteValueA(props, "ProductID");
RegDeleteValueA(props, "RegCompany");
RegDeleteValueA(props, "RegOwner");
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(userprod, "");
delete_key(userprod, "", access & KEY_WOW64_64KEY);
RegCloseKey(userprod);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
LocalFree(usersid);
}
......@@ -7346,6 +7410,8 @@ static void test_MsiOpenProduct(void)
DWORD size;
LONG res;
UINT r;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
GetCurrentDirectoryA(MAX_PATH, path);
lstrcatA(path, "\\");
......@@ -7353,6 +7419,9 @@ static void test_MsiOpenProduct(void)
create_test_guid(prodcode, prod_squashed);
get_user_sid(&usersid);
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
hdb = create_package_db(prodcode);
MsiCloseHandle(hdb);
......@@ -7413,7 +7482,7 @@ static void test_MsiOpenProduct(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product key exists */
......@@ -7429,7 +7498,7 @@ static void test_MsiOpenProduct(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user product key exists */
......@@ -7439,7 +7508,7 @@ static void test_MsiOpenProduct(void)
"Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(hprod == 0xdeadbeef, "Expected hprod to be unchanged\n");
res = RegCreateKeyA(userkey, "InstallProperties", &props);
res = RegCreateKeyExA(userkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -7470,11 +7539,11 @@ static void test_MsiOpenProduct(void)
MsiCloseHandle(hprod);
RegDeleteValueA(props, "ManagedLocalPackage");
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(userkey);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
/* MSIINSTALLCONTEXT_USERUNMANAGED */
......@@ -7498,7 +7567,7 @@ static void test_MsiOpenProduct(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user product key exists */
......@@ -7508,7 +7577,7 @@ static void test_MsiOpenProduct(void)
"Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(hprod == 0xdeadbeef, "Expected hprod to be unchanged\n");
res = RegCreateKeyA(userkey, "InstallProperties", &props);
res = RegCreateKeyExA(userkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -7539,9 +7608,9 @@ static void test_MsiOpenProduct(void)
MsiCloseHandle(hprod);
RegDeleteValueA(props, "LocalPackage");
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(userkey);
RegDeleteKeyA(prodkey, "");
RegCloseKey(prodkey);
......@@ -7551,7 +7620,7 @@ static void test_MsiOpenProduct(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product key exists */
......@@ -7565,7 +7634,7 @@ static void test_MsiOpenProduct(void)
lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* user product key exists */
......@@ -7575,7 +7644,7 @@ static void test_MsiOpenProduct(void)
"Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
ok(hprod == 0xdeadbeef, "Expected hprod to be unchanged\n");
res = RegCreateKeyA(userkey, "InstallProperties", &props);
res = RegCreateKeyExA(userkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -7635,11 +7704,11 @@ static void test_MsiOpenProduct(void)
ok(hprod == 0xdeadbeef, "Expected hprod to be unchanged\n");
RegDeleteValueA(props, "LocalPackage");
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(userkey);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
DeleteFileA(msifile);
......@@ -7657,10 +7726,15 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid
DWORD size, data;
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)
access |= KEY_WOW64_64KEY;
/* MSIPATCHSTATE_APPLIED */
lstrcpyA(patchcode, "apple");
......@@ -7687,7 +7761,7 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product key exists */
......@@ -7710,7 +7784,7 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid
"Expected targetsid to be unchanged, got %s\n", targetsid);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(prodkey, "Patches", &patches);
res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &patches, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* patches key exists */
......@@ -8031,7 +8105,7 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udprod);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udprod, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* UserData product key exists */
......@@ -8054,7 +8128,7 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid
"Expected targetsid to be unchanged, got %s\n", targetsid);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(udprod, "Patches", &udpatch);
res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &udpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* UserData patches key exists */
......@@ -8077,7 +8151,7 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid
"Expected targetsid to be unchanged, got %s\n", targetsid);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(udpatch, patch_squashed, &hpatch);
res = RegCreateKeyExA(udpatch, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* specific UserData patch key exists */
......@@ -8221,16 +8295,16 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
RegDeleteValueA(hpatch, "State");
RegDeleteKeyA(hpatch, "");
delete_key(hpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(hpatch);
RegDeleteKeyA(udpatch, "");
delete_key(udpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(udpatch);
RegDeleteKeyA(udprod, "");
delete_key(udprod, "", access & KEY_WOW64_64KEY);
RegCloseKey(udprod);
RegDeleteValueA(patches, "Patches");
RegDeleteKeyA(patches, "");
delete_key(patches, "", access & KEY_WOW64_64KEY);
RegCloseKey(patches);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
}
......@@ -8246,10 +8320,15 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds
DWORD size, data;
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)
access |= KEY_WOW64_64KEY;
/* MSIPATCHSTATE_APPLIED */
lstrcpyA(patchcode, "apple");
......@@ -8430,7 +8509,7 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds
lstrcatA(keypath, "\\Patches\\");
lstrcatA(keypath, patch_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* userdata patch key exists */
......@@ -8480,7 +8559,7 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udprod);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udprod, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* UserData product key exists */
......@@ -8503,7 +8582,7 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds
"Expected targetsid to be unchanged, got %s\n", targetsid);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(udprod, "Patches", &udpatch);
res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &udpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* UserData patches key exists */
......@@ -8526,7 +8605,7 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds
"Expected targetsid to be unchanged, got %s\n", targetsid);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(udpatch, patch_squashed, &hpatch);
res = RegCreateKeyExA(udpatch, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* specific UserData patch key exists */
......@@ -8670,13 +8749,13 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
RegDeleteValueA(hpatch, "State");
RegDeleteKeyA(hpatch, "");
delete_key(hpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(hpatch);
RegDeleteKeyA(udpatch, "");
delete_key(udpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(udpatch);
RegDeleteKeyA(udprod, "");
delete_key(udprod, "", access & KEY_WOW64_64KEY);
RegCloseKey(udprod);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(userkey);
RegDeleteValueA(patches, patch_squashed);
RegDeleteValueA(patches, "Patches");
......@@ -8698,10 +8777,15 @@ static void test_MsiEnumPatchesEx_machine(void)
DWORD size, data;
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)
access |= KEY_WOW64_64KEY;
/* MSIPATCHSTATE_APPLIED */
lstrcpyA(patchcode, "apple");
......@@ -8726,7 +8810,7 @@ static void test_MsiEnumPatchesEx_machine(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local product key exists */
......@@ -8749,7 +8833,7 @@ static void test_MsiEnumPatchesEx_machine(void)
"Expected targetsid to be unchanged, got %s\n", targetsid);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(prodkey, "Patches", &patches);
res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &patches, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches key exists */
......@@ -8876,7 +8960,7 @@ static void test_MsiEnumPatchesEx_machine(void)
lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udprod);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udprod, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local UserData product key exists */
......@@ -8899,7 +8983,7 @@ static void test_MsiEnumPatchesEx_machine(void)
"Expected \"\", got \"%s\"\n", targetsid);
ok(size == 0, "Expected 0, got %d\n", size);
res = RegCreateKeyA(udprod, "Patches", &udpatch);
res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &udpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local UserData Patches key exists */
......@@ -8922,7 +9006,7 @@ static void test_MsiEnumPatchesEx_machine(void)
"Expected \"\", got \"%s\"\n", targetsid);
ok(size == 0, "Expected 0, got %d\n", size);
res = RegCreateKeyA(udpatch, patch_squashed, &hpatch);
res = RegCreateKeyExA(udpatch, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local UserData Product patch key exists */
......@@ -9106,16 +9190,16 @@ static void test_MsiEnumPatchesEx_machine(void)
RegDeleteValueA(patches, patch_squashed);
RegDeleteValueA(patches, "Patches");
RegDeleteKeyA(patches, "");
delete_key(patches, "", access & KEY_WOW64_64KEY);
RegCloseKey(patches);
RegDeleteValueA(hpatch, "State");
RegDeleteKeyA(hpatch, "");
delete_key(hpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(hpatch);
RegDeleteKeyA(udpatch, "");
delete_key(udpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(udpatch);
RegDeleteKeyA(udprod, "");
delete_key(udprod, "", access & KEY_WOW64_64KEY);
RegCloseKey(udprod);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
}
......@@ -9393,11 +9477,16 @@ static void test_MsiEnumPatches(void)
LPSTR usersid;
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)
access |= KEY_WOW64_64KEY;
/* NULL szProduct */
size = MAX_PATH;
lstrcpyA(patch, "apple");
......@@ -9498,7 +9587,7 @@ static void test_MsiEnumPatches(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product key exists */
......@@ -9513,7 +9602,7 @@ static void test_MsiEnumPatches(void)
"Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(prodkey, "Patches", &patches);
res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &patches, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* patches key exists */
......@@ -9672,9 +9761,9 @@ static void test_MsiEnumPatches(void)
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
RegDeleteValueA(patches, "Patches");
RegDeleteKeyA(patches, "");
delete_key(patches, "", access & KEY_WOW64_64KEY);
RegCloseKey(patches);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
/* MSIINSTALLCONTEXT_USERUNMANAGED */
......@@ -9808,7 +9897,7 @@ static void test_MsiEnumPatches(void)
lstrcatA(keypath, "\\Patches\\");
lstrcatA(keypath, patch_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* userdata patch key exists */
......@@ -9823,7 +9912,7 @@ static void test_MsiEnumPatches(void)
"Expected \"whatever\", got \"%s\"\n", transforms);
ok(size == 8 || size == MAX_PATH, "Expected 8 or MAX_PATH, got %d\n", size);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(userkey);
RegDeleteValueA(patches, patch_squashed);
RegDeleteValueA(patches, "Patches");
......@@ -9849,7 +9938,7 @@ static void test_MsiEnumPatches(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local product key exists */
......@@ -9864,7 +9953,7 @@ static void test_MsiEnumPatches(void)
"Expected lpTransformsBuf to be unchanged, got \"%s\"\n", transforms);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(prodkey, "Patches", &patches);
res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &patches, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches key exists */
......@@ -9958,7 +10047,7 @@ static void test_MsiEnumPatches(void)
lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udprod);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udprod, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local UserData product key exists */
......@@ -9973,7 +10062,7 @@ static void test_MsiEnumPatches(void)
"Expected \"whatever\", got \"%s\"\n", transforms);
ok(size == 8 || size == MAX_PATH, "Expected 8 or MAX_PATH, got %d\n", size);
res = RegCreateKeyA(udprod, "Patches", &udpatch);
res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &udpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local UserData Patches key exists */
......@@ -9988,7 +10077,7 @@ static void test_MsiEnumPatches(void)
"Expected \"whatever\", got \"%s\"\n", transforms);
ok(size == 8 || size == MAX_PATH, "Expected 8 or MAX_PATH, got %d\n", size);
res = RegCreateKeyA(udpatch, patch_squashed, &hpatch);
res = RegCreateKeyExA(udpatch, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local UserData Product patch key exists */
......@@ -10058,16 +10147,16 @@ static void test_MsiEnumPatches(void)
RegDeleteValueA(patches, patch_squashed);
RegDeleteValueA(patches, "Patches");
RegDeleteKeyA(patches, "");
delete_key(patches, "", access & KEY_WOW64_64KEY);
RegCloseKey(patches);
RegDeleteValueA(hpatch, "State");
RegDeleteKeyA(hpatch, "");
delete_key(hpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(hpatch);
RegDeleteKeyA(udpatch, "");
delete_key(udpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(udpatch);
RegDeleteKeyA(udprod, "");
delete_key(udprod, "", access & KEY_WOW64_64KEY);
RegCloseKey(udprod);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
LocalFree(usersid);
}
......@@ -10083,6 +10172,8 @@ static void test_MsiGetPatchInfoEx(void)
DWORD size;
LONG res;
UINT r;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
if (!pMsiGetPatchInfoExA)
{
......@@ -10094,6 +10185,9 @@ static void test_MsiGetPatchInfoEx(void)
create_test_guid(patchcode, patch_squashed);
get_user_sid(&usersid);
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
/* NULL szPatchCode */
lstrcpyA(val, "apple");
size = MAX_PATH;
......@@ -10335,7 +10429,7 @@ static void test_MsiGetPatchInfoEx(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udprod);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udprod, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local UserData product key exists */
......@@ -10350,7 +10444,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(udprod, "InstallProperties", &props);
res = RegCreateKeyExA(udprod, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -10364,7 +10458,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(udprod, "Patches", &patches);
res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &patches, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches key exists */
......@@ -10378,7 +10472,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(patches, patch_squashed, &hpatch);
res = RegCreateKeyExA(patches, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches key exists */
......@@ -10397,7 +10491,7 @@ static void test_MsiGetPatchInfoEx(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* managed product key exists */
......@@ -10411,7 +10505,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(prodkey, "Patches", &prodpatches);
res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &prodpatches, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches key exists */
......@@ -10445,7 +10539,7 @@ static void test_MsiGetPatchInfoEx(void)
lstrcatA(keypath, "\\Patches\\");
lstrcatA(keypath, patch_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udpatch);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* UserData Patches key exists */
......@@ -10631,9 +10725,9 @@ static void test_MsiGetPatchInfoEx(void)
ok(size == 16, "Expected 16, got %d\n", size);
RegDeleteValueA(prodpatches, patch_squashed);
RegDeleteKeyA(prodpatches, "");
delete_key(prodpatches, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodpatches);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
/* UserData is sufficient for all properties
......@@ -10666,15 +10760,15 @@ static void test_MsiGetPatchInfoEx(void)
RegDeleteValueA(hpatch, "Uninstallable");
RegDeleteValueA(hpatch, "Installed");
RegDeleteValueA(udpatch, "ManagedLocalPackage");
RegDeleteKeyA(udpatch, "");
delete_key(udpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(udpatch);
RegDeleteKeyA(hpatch, "");
delete_key(hpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(hpatch);
RegDeleteKeyA(patches, "");
delete_key(patches, "", access & KEY_WOW64_64KEY);
RegCloseKey(patches);
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(udprod, "");
delete_key(udprod, "", access & KEY_WOW64_64KEY);
RegCloseKey(udprod);
/* MSIINSTALLCONTEXT_USERUNMANAGED */
......@@ -10695,7 +10789,7 @@ static void test_MsiGetPatchInfoEx(void)
lstrcatA(keypath, "\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udprod);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udprod, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local UserData product key exists */
......@@ -10710,7 +10804,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(udprod, "InstallProperties", &props);
res = RegCreateKeyExA(udprod, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -10724,7 +10818,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(udprod, "Patches", &patches);
res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &patches, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches key exists */
......@@ -10738,7 +10832,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(patches, patch_squashed, &hpatch);
res = RegCreateKeyExA(patches, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches key exists */
......@@ -10803,7 +10897,7 @@ static void test_MsiGetPatchInfoEx(void)
lstrcatA(keypath, "\\Patches\\");
lstrcatA(keypath, patch_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udpatch);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* UserData Patches key exists */
......@@ -10840,7 +10934,7 @@ static void test_MsiGetPatchInfoEx(void)
ok(size == 10, "Expected 10, got %d\n", size);
RegDeleteValueA(prodpatches, patch_squashed);
RegDeleteKeyA(prodpatches, "");
delete_key(prodpatches, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodpatches);
RegDeleteKeyA(prodkey, "");
RegCloseKey(prodkey);
......@@ -10870,15 +10964,15 @@ static void test_MsiGetPatchInfoEx(void)
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
RegDeleteValueA(udpatch, "LocalPackage");
RegDeleteKeyA(udpatch, "");
delete_key(udpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(udpatch);
RegDeleteKeyA(hpatch, "");
delete_key(hpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(hpatch);
RegDeleteKeyA(patches, "");
delete_key(patches, "", access & KEY_WOW64_64KEY);
RegCloseKey(patches);
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(udprod, "");
delete_key(udprod, "", access & KEY_WOW64_64KEY);
RegCloseKey(udprod);
/* MSIINSTALLCONTEXT_MACHINE */
......@@ -10898,7 +10992,7 @@ static void test_MsiGetPatchInfoEx(void)
lstrcatA(keypath, "\\UserData\\S-1-5-18\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udprod);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udprod, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local UserData product key exists */
......@@ -10913,7 +11007,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(udprod, "InstallProperties", &props);
res = RegCreateKeyExA(udprod, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* InstallProperties key exists */
......@@ -10927,7 +11021,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(udprod, "Patches", &patches);
res = RegCreateKeyExA(udprod, "Patches", 0, NULL, 0, access, NULL, &patches, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches key exists */
......@@ -10941,7 +11035,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(patches, patch_squashed, &hpatch);
res = RegCreateKeyExA(patches, patch_squashed, 0, NULL, 0, access, NULL, &hpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches key exists */
......@@ -10958,7 +11052,7 @@ static void test_MsiGetPatchInfoEx(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* local product key exists */
......@@ -10972,7 +11066,7 @@ static void test_MsiGetPatchInfoEx(void)
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
res = RegCreateKeyA(prodkey, "Patches", &prodpatches);
res = RegCreateKeyExA(prodkey, "Patches", 0, NULL, 0, access, NULL, &prodpatches, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Patches key exists */
......@@ -11005,7 +11099,7 @@ static void test_MsiGetPatchInfoEx(void)
lstrcatA(keypath, "\\UserData\\S-1-5-18\\Patches\\");
lstrcatA(keypath, patch_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udpatch);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* UserData Patches key exists */
......@@ -11042,9 +11136,9 @@ static void test_MsiGetPatchInfoEx(void)
ok(size == 10, "Expected 10, got %d\n", size);
RegDeleteValueA(prodpatches, patch_squashed);
RegDeleteKeyA(prodpatches, "");
delete_key(prodpatches, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodpatches);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access & KEY_WOW64_64KEY);
RegCloseKey(prodkey);
/* UserData is sufficient for all properties
......@@ -11072,15 +11166,15 @@ static void test_MsiGetPatchInfoEx(void)
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
RegDeleteValueA(udpatch, "LocalPackage");
RegDeleteKeyA(udpatch, "");
delete_key(udpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(udpatch);
RegDeleteKeyA(hpatch, "");
delete_key(hpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(hpatch);
RegDeleteKeyA(patches, "");
delete_key(patches, "", access & KEY_WOW64_64KEY);
RegCloseKey(patches);
RegDeleteKeyA(props, "");
delete_key(props, "", access & KEY_WOW64_64KEY);
RegCloseKey(props);
RegDeleteKeyA(udprod, "");
delete_key(udprod, "", access & KEY_WOW64_64KEY);
RegCloseKey(udprod);
LocalFree(usersid);
}
......@@ -11095,11 +11189,16 @@ static void test_MsiGetPatchInfo(void)
HKEY hkey_udpatch, hkey_udpatches, hkey_udproductpatches, hkey_udproductpatch;
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)
access |= KEY_WOW64_64KEY;
r = MsiGetPatchInfoA(NULL, NULL, NULL, NULL);
ok(r == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", r);
......@@ -11119,7 +11218,7 @@ static void test_MsiGetPatchInfo(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey_product);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &hkey_product, NULL);
ok(res == ERROR_SUCCESS, "expected ERROR_SUCCESS got %d\n", res);
/* product key exists */
......@@ -11130,7 +11229,7 @@ static void test_MsiGetPatchInfo(void)
ok(!lstrcmpA(val, "apple"), "expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "expected size to be unchanged got %u\n", size);
res = RegCreateKeyA(hkey_product, "Patches", &hkey_patches);
res = RegCreateKeyExA(hkey_product, "Patches", 0, NULL, 0, access, NULL, &hkey_patches, NULL);
ok(res == ERROR_SUCCESS, "expected ERROR_SUCCESS got %d\n", res);
/* patches key exists */
......@@ -11141,7 +11240,7 @@ static void test_MsiGetPatchInfo(void)
ok(!lstrcmpA(val, "apple"), "expected val to be unchanged got \"%s\"\n", val);
ok(size == MAX_PATH, "expected size to be unchanged got %u\n", size);
res = RegCreateKeyA(hkey_patches, patch_squashed, &hkey_patch);
res = RegCreateKeyExA(hkey_patches, patch_squashed, 0, NULL, 0, access, NULL, &hkey_patch, NULL);
ok(res == ERROR_SUCCESS, "expected ERROR_SUCCESS got %d\n", res);
/* patch key exists */
......@@ -11156,7 +11255,7 @@ static void test_MsiGetPatchInfo(void)
lstrcatA(keypath, "\\UserData\\S-1-5-18\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey_udproduct);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &hkey_udproduct, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res);
/* UserData product key exists */
......@@ -11167,7 +11266,7 @@ static void test_MsiGetPatchInfo(void)
ok(!lstrcmpA(val, "apple"), "expected val to be unchanged got \"%s\"\n", val);
ok(size == MAX_PATH, "expected size to be unchanged got %u\n", size);
res = RegCreateKeyA(hkey_udproduct, "InstallProperties", &hkey_udprops);
res = RegCreateKeyExA(hkey_udproduct, "InstallProperties", 0, NULL, 0, access, NULL, &hkey_udprops, NULL);
ok(res == ERROR_SUCCESS, "expected ERROR_SUCCESS got %d\n", res);
/* InstallProperties key exists */
......@@ -11178,7 +11277,7 @@ static void test_MsiGetPatchInfo(void)
ok(!lstrcmpA(val, "apple"), "expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "expected size to be unchanged got %u\n", size);
res = RegCreateKeyA(hkey_udproduct, "Patches", &hkey_udpatches);
res = RegCreateKeyExA(hkey_udproduct, "Patches", 0, NULL, 0, access, NULL, &hkey_udpatches, NULL);
ok(res == ERROR_SUCCESS, "expected ERROR_SUCCESS got %d\n", res);
/* UserData Patches key exists */
......@@ -11189,10 +11288,10 @@ static void test_MsiGetPatchInfo(void)
ok(!lstrcmpA(val, "apple"), "expected val to be unchanged got \"%s\"\n", val);
ok(size == MAX_PATH, "expected size to be unchanged got %u\n", size);
res = RegCreateKeyA(hkey_udproduct, "Patches", &hkey_udproductpatches);
res = RegCreateKeyExA(hkey_udproduct, "Patches", 0, NULL, 0, access, NULL, &hkey_udproductpatches, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyA(hkey_udproductpatches, patch_squashed, &hkey_udproductpatch);
res = RegCreateKeyExA(hkey_udproductpatches, patch_squashed, 0, NULL, 0, access, NULL, &hkey_udproductpatch, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* UserData product patch key exists */
......@@ -11207,7 +11306,7 @@ static void test_MsiGetPatchInfo(void)
lstrcatA(keypath, "\\UserData\\S-1-5-18\\Patches\\");
lstrcatA(keypath, patch_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey_udpatch);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &hkey_udpatch, NULL);
ok(res == ERROR_SUCCESS, "expected ERROR_SUCCESS got %d\n", res);
res = RegSetValueExA(hkey_udpatch, "LocalPackage", 0, REG_SZ, (const BYTE *)"c:\\test.msp", 12);
......@@ -11242,23 +11341,23 @@ static void test_MsiGetPatchInfo(void)
ok(valW[0], "expected > 0 got %u\n", valW[0]);
ok(size == 11, "expected 11 got %u\n", size);
RegDeleteKeyA(hkey_udproductpatch, "");
delete_key(hkey_udproductpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(hkey_udproductpatch);
RegDeleteKeyA(hkey_udproductpatches, "");
delete_key(hkey_udproductpatches, "", access & KEY_WOW64_64KEY);
RegCloseKey(hkey_udproductpatches);
RegDeleteKeyA(hkey_udpatch, "");
delete_key(hkey_udpatch, "", access & KEY_WOW64_64KEY);
RegCloseKey(hkey_udpatch);
RegDeleteKeyA(hkey_patches, "");
delete_key(hkey_patches, "", access & KEY_WOW64_64KEY);
RegCloseKey(hkey_patches);
RegDeleteKeyA(hkey_product, "");
delete_key(hkey_product, "", access & KEY_WOW64_64KEY);
RegCloseKey(hkey_product);
RegDeleteKeyA(hkey_patch, "");
delete_key(hkey_patch, "", access & KEY_WOW64_64KEY);
RegCloseKey(hkey_patch);
RegDeleteKeyA(hkey_udpatches, "");
delete_key(hkey_udpatches, "", access & KEY_WOW64_64KEY);
RegCloseKey(hkey_udpatches);
RegDeleteKeyA(hkey_udprops, "");
delete_key(hkey_udprops, "", access & KEY_WOW64_64KEY);
RegCloseKey(hkey_udprops);
RegDeleteKeyA(hkey_udproduct, "");
delete_key(hkey_udproduct, "", access & KEY_WOW64_64KEY);
RegCloseKey(hkey_udproduct);
}
......@@ -11272,16 +11371,21 @@ static void test_MsiEnumProducts(void)
char keypath1[MAX_PATH], keypath2[MAX_PATH], keypath3[MAX_PATH];
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)
access |= KEY_WOW64_64KEY;
strcpy(keypath1, "Software\\Classes\\Installer\\Products\\");
strcat(keypath1, product_squashed1);
r = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath1, &key1);
r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath1, 0, NULL, 0, access, NULL, &key1, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
strcpy(keypath2, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
......@@ -11289,7 +11393,7 @@ static void test_MsiEnumProducts(void)
strcat(keypath2, "\\Installer\\Products\\");
strcat(keypath2, product_squashed2);
r = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath2, &key2);
r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath2, 0, NULL, 0, access, NULL, &key2, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
strcpy(keypath3, "Software\\Microsoft\\Installer\\Products\\");
......@@ -11326,8 +11430,8 @@ static void test_MsiEnumProducts(void)
ok(found2, "product2 not found\n");
ok(found3, "product3 not found\n");
RegDeleteKeyA(key1, "");
RegDeleteKeyA(key2, "");
delete_key(key1, "", access & KEY_WOW64_64KEY);
delete_key(key2, "", access & KEY_WOW64_64KEY);
RegDeleteKeyA(key3, "");
RegCloseKey(key1);
RegCloseKey(key2);
......
......@@ -36,6 +36,8 @@ char CURR_DIR[MAX_PATH];
static UINT (WINAPI *pMsiApplyMultiplePatchesA)(LPCSTR, LPCSTR, LPCSTR);
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
......@@ -44,6 +46,7 @@ static void init_functionpointers(void)
{
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
HMODULE hsrclient;
#define GET_PROC(mod, func) \
......@@ -52,6 +55,8 @@ static void init_functionpointers(void)
GET_PROC(hmsi, MsiApplyMultiplePatchesA);
GET_PROC(hadvapi32, ConvertSidToStringSidA);
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
hsrclient = LoadLibraryA("srclient.dll");
GET_PROC(hsrclient, SRRemoveRestorePoint);
......@@ -59,6 +64,12 @@ static void init_functionpointers(void)
#undef GET_PROC
}
static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
{
if (pRegDeleteKeyExA)
return pRegDeleteKeyExA( key, subkey, access, 0 );
return RegDeleteKeyA( key, subkey );
}
static LPSTR get_user_sid(LPSTR *usersid)
{
......@@ -11559,6 +11570,8 @@ static void test_MsiGetProductProperty(void)
LONG res;
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))
......@@ -11573,6 +11586,9 @@ static void test_MsiGetProductProperty(void)
create_test_guid(prodcode, prod_squashed);
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
......@@ -11611,14 +11627,14 @@ static void test_MsiGetProductProperty(void)
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res == ERROR_ACCESS_DENIED)
{
skip("Not enough rights to perform tests\n");
......@@ -11628,7 +11644,7 @@ static void test_MsiGetProductProperty(void)
}
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
res = RegCreateKeyA(userkey, "InstallProperties", &props);
res = RegCreateKeyExA(userkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
lstrcpyA(val, path);
......@@ -11763,11 +11779,11 @@ static void test_MsiGetProductProperty(void)
MsiCloseHandle(hprod);
RegDeleteValueA(props, "LocalPackage");
RegDeleteKeyA(props, "");
delete_key(props, "", access);
RegCloseKey(props);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
DeleteFileA(msifile);
}
......
......@@ -32,7 +32,10 @@
#include "wine/test.h"
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static UINT (WINAPI *pMsiSourceListAddMediaDiskA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPCSTR, LPCSTR);
static UINT (WINAPI *pMsiSourceListAddSourceExA)
......@@ -53,6 +56,7 @@ static void init_functionpointers(void)
{
HMODULE hmsi = GetModuleHandleA("msi.dll");
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
HMODULE hsecur32 = LoadLibraryA("secur32.dll");
#define GET_PROC(dll, func) \
......@@ -69,7 +73,8 @@ static void init_functionpointers(void)
GET_PROC(hmsi, MsiSourceListAddSourceA)
GET_PROC(hadvapi32, ConvertSidToStringSidA)
GET_PROC(hadvapi32, RegDeleteKeyExA)
GET_PROC(hkernel32, IsWow64Process)
GET_PROC(hsecur32, GetUserNameExA)
#undef GET_PROC
......@@ -626,6 +631,13 @@ static void test_MsiSourceListGetInfo(void)
LocalFree(usersid);
}
static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
{
if (pRegDeleteKeyExA)
return pRegDeleteKeyExA( key, subkey, access, 0 );
return RegDeleteKeyA( key, subkey );
}
static void test_MsiSourceListAddSourceEx(void)
{
CHAR prodcode[MAX_PATH];
......@@ -635,9 +647,10 @@ static void test_MsiSourceListAddSourceEx(void)
LPSTR usersid;
LONG res;
UINT r;
HKEY prodkey, userkey, hkey;
HKEY url, net;
HKEY prodkey, userkey, hkey, url, net;
DWORD size;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
if (!pMsiSourceListAddSourceExA)
{
......@@ -652,6 +665,9 @@ static void test_MsiSourceListAddSourceEx(void)
return;
}
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProductCodeOrPatchCode */
......@@ -895,7 +911,7 @@ static void test_MsiSourceListAddSourceEx(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -908,7 +924,7 @@ static void test_MsiSourceListAddSourceEx(void)
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &hkey);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &hkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
RegCloseKey(hkey);
......@@ -918,7 +934,7 @@ static void test_MsiSourceListAddSourceEx(void)
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
res = RegOpenKeyExA(prodkey, "SourceList\\URL", 0, access, &url);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = MAX_PATH;
......@@ -936,7 +952,7 @@ static void test_MsiSourceListAddSourceEx(void)
MSICODE_PRODUCT | MSISOURCETYPE_URL, "another", 0);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
res = RegOpenKeyExA(prodkey, "SourceList\\URL", 0, access, &url);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = MAX_PATH;
......@@ -971,7 +987,7 @@ machine_tests:
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -985,7 +1001,7 @@ machine_tests:
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &hkey);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &hkey, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
RegCloseKey(hkey);
......@@ -995,7 +1011,7 @@ machine_tests:
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
res = RegOpenKeyExA(prodkey, "SourceList\\URL", 0, access, &url);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
size = MAX_PATH;
......@@ -1021,6 +1037,8 @@ static void test_MsiSourceListEnumSources(void)
HKEY prodkey, userkey;
HKEY url, net, source;
DWORD size;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
if (!pMsiSourceListEnumSourcesA)
{
......@@ -1035,6 +1053,9 @@ static void test_MsiSourceListEnumSources(void)
return;
}
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProductCodeOrPatchCode */
......@@ -1367,7 +1388,7 @@ static void test_MsiSourceListEnumSources(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -1384,7 +1405,7 @@ static void test_MsiSourceListEnumSources(void)
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(userkey, "SourceList", &source);
res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
......@@ -1397,7 +1418,7 @@ static void test_MsiSourceListEnumSources(void)
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(source, "URL", &url);
res = RegCreateKeyExA(source, "URL", 0, NULL, 0, access, NULL, &url, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* URL key exists */
......@@ -1434,7 +1455,7 @@ static void test_MsiSourceListEnumSources(void)
ok(size == 5, "Expected 5, got %d\n", size);
RegDeleteValueA(url, "1");
RegDeleteKeyA(url, "");
delete_key(url, "", access);
RegCloseKey(url);
/* SourceList key exists */
......@@ -1447,7 +1468,7 @@ static void test_MsiSourceListEnumSources(void)
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(source, "Net", &net);
res = RegCreateKeyExA(source, "Net", 0, NULL, 0, access, NULL, &net, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Net key exists */
......@@ -1474,11 +1495,11 @@ static void test_MsiSourceListEnumSources(void)
ok(size == 5, "Expected 5, got %d\n", size);
RegDeleteValueA(net, "1");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
/* MSIINSTALLCONTEXT_MACHINE */
......@@ -1507,7 +1528,7 @@ machine_tests:
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -1525,7 +1546,7 @@ machine_tests:
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
......@@ -1538,7 +1559,7 @@ machine_tests:
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(source, "URL", &url);
res = RegCreateKeyExA(source, "URL", 0, NULL, 0, access, NULL, &url, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* URL key exists */
......@@ -1575,7 +1596,7 @@ machine_tests:
ok(size == 5, "Expected 5, got %d\n", size);
RegDeleteValueA(url, "1");
RegDeleteKeyA(url, "");
delete_key(url, "", access);
RegCloseKey(url);
/* SourceList key exists */
......@@ -1588,7 +1609,7 @@ machine_tests:
ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
res = RegCreateKeyA(source, "Net", &net);
res = RegCreateKeyExA(source, "Net", 0, NULL, 0, access, NULL, &net, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Net key exists */
......@@ -1615,11 +1636,11 @@ machine_tests:
ok(size == 5, "Expected 5, got %d\n", size);
RegDeleteValueA(net, "1");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
LocalFree(usersid);
}
......@@ -1634,6 +1655,8 @@ static void test_MsiSourceListSetInfo(void)
LPSTR usersid;
LONG res;
UINT r;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
if (!pMsiSourceListSetInfoA)
{
......@@ -1648,6 +1671,9 @@ static void test_MsiSourceListSetInfo(void)
return;
}
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProductCodeOrPatchCode */
......@@ -1957,7 +1983,7 @@ static void test_MsiSourceListSetInfo(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -1971,7 +1997,7 @@ static void test_MsiSourceListSetInfo(void)
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(userkey, "SourceList", &source);
res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists, no source type */
......@@ -1981,16 +2007,16 @@ static void test_MsiSourceListSetInfo(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Media key is created by MsiSourceListSetInfo */
res = RegOpenKeyA(source, "Media", &media);
res = RegOpenKeyExA(source, "Media", 0, access, &media);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(media, "MediaPackage", "path");
RegDeleteValueA(media, "MediaPackage");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
/* MSIINSTALLCONTEXT_MACHINE */
......@@ -1999,7 +2025,7 @@ machine_tests:
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -2014,7 +2040,7 @@ machine_tests:
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists, no source type */
......@@ -2024,7 +2050,7 @@ machine_tests:
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Media key is created by MsiSourceListSetInfo */
res = RegOpenKeyA(source, "Media", &media);
res = RegOpenKeyExA(source, "Media", 0, access, &media);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(media, "MediaPackage", "path");
......@@ -2036,11 +2062,11 @@ machine_tests:
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
RegDeleteValueA(media, "MediaPackage");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
LocalFree(usersid);
}
......@@ -2055,6 +2081,8 @@ static void test_MsiSourceListAddMediaDisk(void)
LPSTR usersid;
LONG res;
UINT r;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
if (!pMsiSourceListAddMediaDiskA)
{
......@@ -2069,6 +2097,9 @@ static void test_MsiSourceListAddMediaDisk(void)
return;
}
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProductCodeOrPatchCode */
......@@ -2263,7 +2294,7 @@ static void test_MsiSourceListAddMediaDisk(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -2277,7 +2308,7 @@ static void test_MsiSourceListAddMediaDisk(void)
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(userkey, "SourceList", &source);
res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
......@@ -2287,17 +2318,17 @@ static void test_MsiSourceListAddMediaDisk(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Media subkey is created by MsiSourceListAddMediaDisk */
res = RegOpenKeyA(source, "Media", &media);
res = RegOpenKeyExA(source, "Media", 0, access, &media);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(media, "1", "label;prompt");
RegDeleteValueA(media, "1");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
/* MSIINSTALLCONTEXT_MACHINE */
......@@ -2306,7 +2337,7 @@ machine_tests:
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -2321,7 +2352,7 @@ machine_tests:
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
......@@ -2331,7 +2362,7 @@ machine_tests:
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Media subkey is created by MsiSourceListAddMediaDisk */
res = RegOpenKeyA(source, "Media", &media);
res = RegOpenKeyExA(source, "Media", 0, access, &media);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(media, "1", "label;prompt");
......@@ -2344,11 +2375,11 @@ machine_tests:
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
RegDeleteValueA(media, "1");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
LocalFree(usersid);
}
......@@ -2360,14 +2391,13 @@ static void test_MsiSourceListEnumMediaDisks(void)
CHAR keypath[MAX_PATH*2];
CHAR label[MAX_PATH];
CHAR prompt[MAX_PATH];
HKEY prodkey, userkey;
HKEY media, source;
DWORD labelsz, promptsz;
HKEY prodkey, userkey, media, source;
DWORD labelsz, promptsz, val, id;
LPSTR usersid;
DWORD val;
DWORD id;
LONG res;
UINT r;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
if (!pMsiSourceListEnumMediaDisksA)
{
......@@ -2382,6 +2412,9 @@ static void test_MsiSourceListEnumMediaDisks(void)
return;
}
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProductCodeOrPatchCode */
......@@ -2978,7 +3011,7 @@ static void test_MsiSourceListEnumMediaDisks(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -2992,7 +3025,7 @@ static void test_MsiSourceListEnumMediaDisks(void)
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(userkey, "SourceList", &source);
res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
......@@ -3012,7 +3045,7 @@ static void test_MsiSourceListEnumMediaDisks(void)
ok(!lstrcmpA(prompt, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt);
ok(promptsz == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", promptsz);
res = RegCreateKeyA(source, "Media", &media);
res = RegCreateKeyExA(source, "Media", 0, NULL, 0, access, NULL, &media, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Media key exists */
......@@ -3052,11 +3085,11 @@ static void test_MsiSourceListEnumMediaDisks(void)
ok(promptsz == 6, "Expected 6, got %d\n", promptsz);
RegDeleteValueA(media, "2");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
/* MSIINSTALLCONTEXT_MACHINE */
......@@ -3065,7 +3098,7 @@ machine_tests:
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -3080,7 +3113,7 @@ machine_tests:
ok(r == ERROR_BAD_CONFIGURATION,
"Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
......@@ -3100,7 +3133,7 @@ machine_tests:
ok(!lstrcmpA(prompt, "bbb"), "Expected \"bbb\", got \"%s\"\n", prompt);
ok(promptsz == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", promptsz);
res = RegCreateKeyA(source, "Media", &media);
res = RegCreateKeyExA(source, "Media", 0, NULL, 0, access, NULL, &media, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* Media key exists */
......@@ -3157,11 +3190,11 @@ machine_tests:
ok(promptsz == MAX_PATH, "Expected MAX_PATH, got %d\n", promptsz);
RegDeleteValueA(media, "2");
RegDeleteKeyA(media, "");
delete_key(media, "", access);
RegCloseKey(media);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
LocalFree(usersid);
}
......@@ -3175,9 +3208,10 @@ static void test_MsiSourceListAddSource(void)
LPSTR usersid, ptr;
LONG res;
UINT r;
HKEY prodkey, userkey;
HKEY net, source;
HKEY prodkey, userkey, net, source;
DWORD size;
REGSAM access = KEY_ALL_ACCESS;
BOOL wow64;
if (!pMsiSourceListAddSourceA)
{
......@@ -3206,6 +3240,9 @@ static void test_MsiSourceListAddSource(void)
}
trace("username: %s\n", username);
if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
access |= KEY_WOW64_64KEY;
/* GetLastError is not set by the function */
/* NULL szProduct */
......@@ -3250,7 +3287,7 @@ static void test_MsiSourceListAddSource(void)
lstrcatA(keypath, "\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -3261,7 +3298,7 @@ static void test_MsiSourceListAddSource(void)
r = pMsiSourceListAddSourceA(prodcode, username, 0, "source");
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(userkey, "SourceList", &source);
res = RegCreateKeyExA(userkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
......@@ -3269,7 +3306,7 @@ static void test_MsiSourceListAddSource(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Net key is created */
res = RegOpenKeyA(source, "Net", &net);
res = RegOpenKeyExA(source, "Net", 0, access, &net);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* LastUsedSource does not exist and it is not created */
......@@ -3279,7 +3316,7 @@ static void test_MsiSourceListAddSource(void)
CHECK_REG_STR(net, "1", "source\\");
RegDeleteValueA(net, "1");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
res = RegSetValueExA(source, "LastUsedSource", 0, REG_SZ, (LPBYTE)"blah", 5);
......@@ -3290,14 +3327,14 @@ static void test_MsiSourceListAddSource(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Net key is created */
res = RegOpenKeyA(source, "Net", &net);
res = RegOpenKeyExA(source, "Net", 0, access, &net);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(source, "LastUsedSource", "blah");
CHECK_REG_STR(net, "1", "source\\");
RegDeleteValueA(net, "1");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
res = RegSetValueExA(source, "LastUsedSource", 0, REG_SZ, (LPBYTE)"5", 2);
......@@ -3308,7 +3345,7 @@ static void test_MsiSourceListAddSource(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Net key is created */
res = RegOpenKeyA(source, "Net", &net);
res = RegOpenKeyExA(source, "Net", 0, access, &net);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(source, "LastUsedSource", "5");
......@@ -3337,11 +3374,11 @@ static void test_MsiSourceListAddSource(void)
RegDeleteValueA(net, "1");
RegDeleteValueA(net, "2");
RegDeleteValueA(net, "3");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(userkey, "");
delete_key(userkey, "", access);
RegCloseKey(userkey);
/* MSIINSTALLCONTEXT_USERUNMANAGED */
......@@ -3394,7 +3431,7 @@ machine_tests:
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
lstrcatA(keypath, prod_squashed);
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
if (res != ERROR_SUCCESS)
{
skip("Product key creation failed with error code %u\n", res);
......@@ -3406,7 +3443,7 @@ machine_tests:
r = pMsiSourceListAddSourceA(prodcode, NULL, 0, "source");
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
res = RegCreateKeyA(prodkey, "SourceList", &source);
res = RegCreateKeyExA(prodkey, "SourceList", 0, NULL, 0, access, NULL, &source, NULL);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
/* SourceList key exists */
......@@ -3414,7 +3451,7 @@ machine_tests:
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* Net key is created */
res = RegOpenKeyA(source, "Net", &net);
res = RegOpenKeyExA(source, "Net", 0, access, &net);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
CHECK_REG_STR(net, "1", "source\\");
......@@ -3428,11 +3465,11 @@ machine_tests:
RegDeleteValueA(net, "2");
RegDeleteValueA(net, "1");
RegDeleteKeyA(net, "");
delete_key(net, "", access);
RegCloseKey(net);
RegDeleteKeyA(source, "");
delete_key(source, "", access);
RegCloseKey(source);
RegDeleteKeyA(prodkey, "");
delete_key(prodkey, "", access);
RegCloseKey(prodkey);
LocalFree(usersid);
}
......
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