Skip to content

Commit 742877d

Browse files
winesynclearn-more
authored andcommitted
[WINESYNC] msi/tests: Simplify key access flags in test_register_product().
Signed-off-by: Zebediah Figura <[email protected]> Signed-off-by: Hans Leidekker <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 8d72829a874810c788bddbd46cee98366165fdb0 by Zebediah Figura <[email protected]>
1 parent c6f0b6c commit 742877d

File tree

1 file changed

+35
-45
lines changed

1 file changed

+35
-45
lines changed

modules/rostests/winetests/msi/action.c

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,12 +2633,9 @@ static void test_register_product(void)
26332633
LPSTR usersid;
26342634
char date[MAX_PATH], temp[MAX_PATH], keypath[MAX_PATH], path[MAX_PATH];
26352635
DWORD size, type;
2636-
REGSAM access = KEY_ALL_ACCESS;
26372636

26382637
static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
26392638
"\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2640-
static const CHAR uninstall_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion"
2641-
"\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
26422639
static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
26432640
"\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
26442641
static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
@@ -2663,9 +2660,6 @@ static void test_register_product(void)
26632660

26642661
create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
26652662

2666-
if (is_wow64)
2667-
access |= KEY_WOW64_64KEY;
2668-
26692663
MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
26702664

26712665
/* RegisterProduct */
@@ -2682,16 +2676,8 @@ static void test_register_product(void)
26822676
res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
26832677
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
26842678

2685-
if (is_64bit)
2686-
{
2687-
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2688-
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2689-
}
2690-
else
2691-
{
2692-
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2693-
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2694-
}
2679+
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_READ | KEY_WOW64_32KEY, &hkey);
2680+
ok(!res, "got %d\n", res);
26952681

26962682
CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
26972683
CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
@@ -2718,14 +2704,15 @@ static void test_register_product(void)
27182704
todo_wine
27192705
CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", get_estimated_size());
27202706

2721-
delete_key(hkey, "", access);
2707+
res = RegDeleteKeyA(hkey, "");
2708+
ok(!res, "got %d\n", res);
27222709
RegCloseKey(hkey);
27232710

27242711
sprintf(keypath, userdata, usersid);
2725-
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2712+
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, KEY_ALL_ACCESS | KEY_WOW64_64KEY, &hkey);
27262713
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
27272714

2728-
res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2715+
res = RegOpenKeyExA(hkey, "InstallProperties", 0, KEY_READ, &props);
27292716
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
27302717

27312718
size = sizeof(path);
@@ -2758,26 +2745,31 @@ static void test_register_product(void)
27582745
todo_wine
27592746
CHECK_DEL_REG_DWORD(props, "EstimatedSize", get_estimated_size());
27602747

2761-
delete_key(props, "", access);
2748+
res = RegDeleteKeyA(props, "");
2749+
ok(!res, "got %d\n", res);
27622750
RegCloseKey(props);
27632751

2764-
res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2752+
res = RegOpenKeyExA(hkey, "Usage", 0, KEY_READ, &usage);
27652753
todo_wine
27662754
{
27672755
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
27682756
}
27692757

2770-
delete_key(usage, "", access);
2758+
res = RegDeleteKeyA(usage, "");
2759+
todo_wine
2760+
ok(!res, "got %d\n", res);
27712761
RegCloseKey(usage);
2772-
delete_key(hkey, "", access);
2762+
res = RegDeleteKeyA(hkey, "");
2763+
ok(!res, "got %d\n", res);
27732764
RegCloseKey(hkey);
27742765

2775-
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
2766+
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, KEY_READ | KEY_WOW64_64KEY, &hkey);
27762767
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
27772768

27782769
CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
27792770

2780-
delete_key(hkey, "", access);
2771+
res = RegDeleteKeyA(hkey, "");
2772+
ok(!res, "got %d\n", res);
27812773
RegCloseKey(hkey);
27822774

27832775
/* RegisterProduct, machine */
@@ -2786,19 +2778,11 @@ static void test_register_product(void)
27862778
ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
27872779
ok(delete_pf("msitest", FALSE), "Directory not created\n");
27882780

2789-
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, userugkey, 0, access, &hkey);
2781+
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, userugkey, 0, KEY_READ | KEY_WOW64_64KEY, &hkey);
27902782
ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
27912783

2792-
if (is_64bit)
2793-
{
2794-
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2795-
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2796-
}
2797-
else
2798-
{
2799-
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2800-
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2801-
}
2784+
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_READ | KEY_WOW64_32KEY, &hkey);
2785+
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
28022786

28032787
CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
28042788
CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
@@ -2825,14 +2809,15 @@ static void test_register_product(void)
28252809
todo_wine
28262810
CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", get_estimated_size());
28272811

2828-
delete_key(hkey, "", access);
2812+
res = RegDeleteKeyA(hkey, "");
2813+
ok(!res, "got %d\n", res);
28292814
RegCloseKey(hkey);
28302815

28312816
sprintf(keypath, userdata, "S-1-5-18");
2832-
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2817+
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, KEY_READ | KEY_WOW64_64KEY, &hkey);
28332818
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
28342819

2835-
res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2820+
res = RegOpenKeyExA(hkey, "InstallProperties", 0, KEY_READ, &props);
28362821
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
28372822

28382823
size = sizeof(path);
@@ -2865,26 +2850,31 @@ static void test_register_product(void)
28652850
todo_wine
28662851
CHECK_DEL_REG_DWORD(props, "EstimatedSize", get_estimated_size());
28672852

2868-
delete_key(props, "", access);
2853+
res = RegDeleteKeyA(props, "");
2854+
ok(!res, "got %d\n", res);
28692855
RegCloseKey(props);
28702856

2871-
res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2857+
res = RegOpenKeyExA(hkey, "Usage", 0, KEY_READ, &usage);
28722858
todo_wine
28732859
{
28742860
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
28752861
}
28762862

2877-
delete_key(usage, "", access);
2863+
res = RegDeleteKeyA(usage, "");
2864+
todo_wine
2865+
ok(!res, "got %d\n", res);
28782866
RegCloseKey(usage);
2879-
delete_key(hkey, "", access);
2867+
res = RegDeleteKeyA(hkey, "");
2868+
ok(!res, "got %d\n", res);
28802869
RegCloseKey(hkey);
28812870

2882-
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
2871+
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, KEY_READ | KEY_WOW64_64KEY, &hkey);
28832872
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
28842873

28852874
CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
28862875

2887-
delete_key(hkey, "", access);
2876+
res = RegDeleteKeyA(hkey, "");
2877+
ok(!res, "got %d\n", res);
28882878
RegCloseKey(hkey);
28892879

28902880
error:

0 commit comments

Comments
 (0)