[PATCH 08/12] shell32/tests: Make it possible to test ShellExecuteEx() with class keys.

Francois Gouget fgouget at codeweavers.com
Wed Jan 6 03:15:38 CST 2016


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 dlls/shell32/tests/shlexec.c | 54 +++++++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 26 deletions(-)

diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index e6525d0..146f3b8 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -162,7 +162,7 @@ static INT_PTR shell_execute(LPCSTR verb, LPCSTR file, LPCSTR parameters, LPCSTR
 
 static INT_PTR shell_execute_ex(DWORD mask, LPCSTR verb, LPCSTR file,
                                 LPCSTR parameters, LPCSTR directory,
-                                LPCSTR class)
+                                LPCSTR classname, HKEY classkey)
 {
     SHELLEXECUTEINFOA sei;
     BOOL success;
@@ -179,7 +179,9 @@ static INT_PTR shell_execute_ex(DWORD mask, LPCSTR verb, LPCSTR file,
     strcat_param(shell_call, "file", file);
     strcat_param(shell_call, "params", parameters);
     strcat_param(shell_call, "dir", directory);
-    strcat_param(shell_call, "class", class);
+    strcat_param(shell_call, "class", classname);
+    if (classkey)
+        strcat_param(shell_call, "classkey", "used");
     strcat(shell_call, ")");
     if (winetest_debug > 1)
         trace("%s\n", shell_call);
@@ -194,8 +196,8 @@ static INT_PTR shell_execute_ex(DWORD mask, LPCSTR verb, LPCSTR file,
     sei.nShow=SW_SHOWNORMAL;
     sei.hInstApp=NULL; /* Out */
     sei.lpIDList=NULL;
-    sei.lpClass=class;
-    sei.hkeyClass=NULL;
+    sei.lpClass=classname;
+    sei.hkeyClass=classkey;
     sei.dwHotKey=0;
     U(sei).hIcon=NULL;
     sei.hProcess=(HANDLE)0xdeadbeef; /* Out */
@@ -996,12 +998,12 @@ static void test_lpFile_parsed(void)
 
     /* test SEE_MASK_DOENVSUBST works */
     rc=shell_execute_ex(SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI,
-                        NULL, "%TMPDIR%\\simple.shlexec", NULL, NULL, NULL);
+                        NULL, "%TMPDIR%\\simple.shlexec", NULL, NULL, NULL, NULL);
     ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc);
 
     /* quoted lpFile does not work on real win95 and nt4 */
     rc=shell_execute_ex(SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI,
-                        NULL, "\"%TMPDIR%\\simple.shlexec\"", NULL, NULL, NULL);
+                        NULL, "\"%TMPDIR%\\simple.shlexec\"", NULL, NULL, NULL, NULL);
     ok(rc > 32 || broken(rc == SE_ERR_FNF) /* Win95/NT4 */,
        "%s failed: rc=%lu\n", shell_call, rc);
 }
@@ -1465,7 +1467,7 @@ static void test_argify(void)
         bad = test->broken.cmd ? &test->broken : &test->cmd;
 
         /* trace("***** verb='%s' params='%s'\n", test->verb, test->params); */
-        rc = shell_execute_ex(SEE_MASK_DOENVSUBST, test->verb, fileA, test->params, NULL, NULL);
+        rc = shell_execute_ex(SEE_MASK_DOENVSUBST, test->verb, fileA, test->params, NULL, NULL, NULL);
         ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc);
 
         count = 0;
@@ -1515,7 +1517,7 @@ static void test_argify(void)
     sprintf(params, "shlexec \"%s\" %s", child_file, fileA);
 
     /* We need NOZONECHECKS on Win2003 to block a dialog */
-    rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, argv0, params, NULL, NULL);
+    rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, argv0, params, NULL, NULL, NULL);
     ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc);
     okChildInt("argcA", 4);
     okChildString("argvA3", fileA);
@@ -1878,7 +1880,7 @@ static void test_urls(void)
 
     /* Environment variables are expanded in URLs (but not in file URLs!) */
     rc = shell_execute_ex(SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI,
-                          NULL, "shlproto://%TMPDIR%/bar", NULL, NULL, NULL);
+                          NULL, "shlproto://%TMPDIR%/bar", NULL, NULL, NULL, NULL);
     ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc);
     if (rc > 32)
     {
@@ -2075,7 +2077,7 @@ static void test_lnks(void)
     {
         /* Should open through our association */
         sprintf(filename, "%s\\test_shortcut_shlexec.lnk", tmpdir);
-        rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL, NULL);
+        rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL, NULL, NULL);
         ok(rc > 32, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError());
         okChildInt("argcA", 5);
         okChildString("argvA3", "Open");
@@ -2083,7 +2085,7 @@ static void test_lnks(void)
         get_long_path_name(params, filename, sizeof(filename));
         okChildPath("argvA4", filename);
 
-        todo_wait rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_DOENVSUBST, NULL, "%TMPDIR%\\test_shortcut_shlexec.lnk", NULL, NULL, NULL);
+        todo_wait rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_DOENVSUBST, NULL, "%TMPDIR%\\test_shortcut_shlexec.lnk", NULL, NULL, NULL, NULL);
         ok(rc > 32, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError());
         okChildInt("argcA", 5);
         todo_wine okChildString("argvA3", "Open");
@@ -2094,13 +2096,13 @@ static void test_lnks(void)
 
     /* Should just run our executable */
     sprintf(filename, "%s\\test_shortcut_exe.lnk", tmpdir);
-    rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL, NULL);
+    rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL, NULL, NULL);
     ok(rc > 32, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError());
     okChildInt("argcA", 4);
     okChildString("argvA3", "Lnk");
 
     /* An explicit class overrides lnk's ContextMenuHandler */
-    rc=shell_execute_ex(SEE_MASK_CLASSNAME | SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL, "shlexec.shlexec");
+    rc=shell_execute_ex(SEE_MASK_CLASSNAME | SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL, "shlexec.shlexec", NULL);
     ok(rc > 32, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError());
     okChildInt("argcA", 5);
     okChildString("argvA3", "Open");
@@ -2120,7 +2122,7 @@ static void test_lnks(void)
                 *c='/';
             c++;
         }
-        rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL, NULL);
+        rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL, NULL, NULL);
         ok(rc > 32, "%s failed: rc=%lu err=%u\n", shell_call, rc,
            GetLastError());
         okChildInt("argcA", 4);
@@ -2135,7 +2137,7 @@ static void test_lnks(void)
         sprintf(params+1, test->basename, tmpdir);
         strcat(params,"\"");
         rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, params,
-                            NULL, NULL);
+                            NULL, NULL, NULL);
         if (rc > 32)
             rc=33;
         if ((test->todo & 0x1)==0)
@@ -2191,7 +2193,7 @@ static void test_exes(void)
 
     /* We need NOZONECHECKS on Win2003 to block a dialog */
     rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, argv0, params,
-                        NULL, NULL);
+                        NULL, NULL, NULL);
     ok(rc > 32, "%s returned %lu\n", shell_call, rc);
     okChildInt("argcA", 4);
     okChildString("argvA3", "Exec");
@@ -2222,11 +2224,11 @@ static void test_exes(void)
     ok(rc == SE_ERR_FNF, "%s returned %lu\n", shell_call, rc);
 
     /* Verbs and classes override the normal handling of executables */
-    todo_wait rc = shell_execute_ex(SEE_MASK_FLAG_NO_UI, "notaverb", argv0, NULL, NULL, NULL);
+    todo_wait rc = shell_execute_ex(SEE_MASK_FLAG_NO_UI, "notaverb", argv0, NULL, NULL, NULL, NULL);
     todo_wine ok(rc == SE_ERR_NOASSOC, "%s returned %lu\n", shell_call, rc);
 
     /* FIXME SEE_MASK_FLAG_NO_UI is only needed due to Wine's bug */
-    todo_wait rc = shell_execute_ex(SEE_MASK_CLASSNAME | SEE_MASK_FLAG_NO_UI, NULL, argv0, NULL, NULL, ".shlexec");
+    todo_wait rc = shell_execute_ex(SEE_MASK_CLASSNAME | SEE_MASK_FLAG_NO_UI, NULL, argv0, NULL, NULL, ".shlexec", NULL);
     todo_wine ok(rc > 32, "%s returned %lu\n", shell_call, rc);
     okChildInt("argcA", 5);
     todo_wine okChildString("argvA3", "Open");
@@ -2388,7 +2390,7 @@ static void test_dde(void)
         ddeExec[0] = 0;
 
         dde_ready_event = CreateEventA(NULL, FALSE, FALSE, "winetest_shlexec_dde_ready");
-        rc = shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, NULL);
+        rc = shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, NULL, NULL);
         CloseHandle(dde_ready_event);
         ok(32 < rc, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError());
 
@@ -2477,7 +2479,7 @@ static DWORD CALLBACK ddeThread(LPVOID arg)
     assert(info && info->filename);
     PostThreadMessageA(info->threadIdParent,
                        WM_QUIT,
-                       shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, info->filename, NULL, NULL, NULL),
+                       shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, info->filename, NULL, NULL, NULL, NULL),
                        0);
     ExitThread(0);
 }
@@ -2755,7 +2757,7 @@ static void test_directory(void)
     GetCurrentDirectoryA(sizeof(curdir), curdir);
     SetCurrentDirectoryA(tmpdir);
     rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI,
-                        NULL, "test2.exe", params, NULL, NULL);
+                        NULL, "test2.exe", params, NULL, NULL, NULL);
     ok(rc > 32, "%s returned %lu\n", shell_call, rc);
     okChildInt("argcA", 4);
     okChildString("argvA3", "Exec");
@@ -2763,12 +2765,12 @@ static void test_directory(void)
     SetCurrentDirectoryA(curdir);
 
     rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI,
-                        NULL, "test2.exe", params, NULL, NULL);
+                        NULL, "test2.exe", params, NULL, NULL, NULL);
     ok(rc == SE_ERR_FNF, "%s returned %lu\n", shell_call, rc);
 
     /* Explicitly specify the directory to use */
     rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI,
-                        NULL, "test2.exe", params, tmpdir, NULL);
+                        NULL, "test2.exe", params, tmpdir, NULL, NULL);
     ok(rc > 32, "%s returned %lu\n", shell_call, rc);
     okChildInt("argcA", 4);
     okChildString("argvA3", "Exec");
@@ -2776,11 +2778,11 @@ static void test_directory(void)
 
     /* Specify it through an environment variable */
     rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI,
-                        NULL, "test2.exe", params, "%TMPDIR%", NULL);
+                        NULL, "test2.exe", params, "%TMPDIR%", NULL, NULL);
     todo_wine ok(rc == SE_ERR_FNF, "%s returned %lu\n", shell_call, rc);
 
     rc=shell_execute_ex(SEE_MASK_DOENVSUBST|SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI,
-                        NULL, "test2.exe", params, "%TMPDIR%", NULL);
+                        NULL, "test2.exe", params, "%TMPDIR%", NULL, NULL);
     ok(rc > 32, "%s returned %lu\n", shell_call, rc);
     okChildInt("argcA", 4);
     okChildString("argvA3", "Exec");
@@ -2789,7 +2791,7 @@ static void test_directory(void)
     /* Not a colon-separated directory list */
     sprintf(dirpath, "%s:%s", curdir, tmpdir);
     rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI,
-                        NULL, "test2.exe", params, dirpath, NULL);
+                        NULL, "test2.exe", params, dirpath, NULL, NULL);
     ok(rc == SE_ERR_FNF, "%s returned %lu\n", shell_call, rc);
 }
 
-- 
2.6.4




More information about the wine-patches mailing list