shell32/tests: Initial directory tests for ShellExecuteEx
André Hentschel
nerv at dawncrow.de
Sun Jul 31 07:38:48 CDT 2011
---
dlls/shell32/tests/shlexec.c | 62 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index 252aed7..709ef6a 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -778,6 +778,26 @@ static DWORD get_long_path_name(const char* shortpath, char* longpath, DWORD lon
/***
*
+ * PathFindFileNameA equivalent that supports WinNT
+ *
+ ***/
+
+static LPSTR path_find_file_name(LPCSTR lpszPath)
+{
+ LPCSTR lastSlash = lpszPath;
+
+ while (lpszPath && *lpszPath)
+ {
+ if ((*lpszPath == '\\' || *lpszPath == '/' || *lpszPath == ':') &&
+ lpszPath[1] && lpszPath[1] != '\\' && lpszPath[1] != '/')
+ lastSlash = lpszPath + 1;
+ lpszPath = CharNext(lpszPath);
+ }
+ return (LPSTR)lastSlash;
+}
+
+/***
+ *
* Tests
*
***/
@@ -2179,6 +2199,47 @@ static void test_commandline(void)
}
}
+static void test_directory(void)
+{
+ char file[MAX_PATH], path[MAX_PATH], curdir[MAX_PATH], newdir[MAX_PATH];
+ char params[1024];
+ int rc;
+
+ sprintf(params, "shlexec \"%s\" Exec", child_file);
+ SetCurrentDirectory(tmpdir),
+
+ GetCurrentDirectory( MAX_PATH, curdir );
+ trace("curdir %s\n", curdir);
+ GetEnvironmentVariable( "PATH", file, MAX_PATH );
+ trace("PATH %s\n", file);
+ sprintf(file, "dir test file.shlexec");
+
+ rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI, NULL, path_find_file_name(argv0), params, NULL);
+ todo_wine ok(rc == SE_ERR_FNF, "%s returned %d\n", shell_call, rc);
+
+ GetCurrentDirectoryA( MAX_PATH, path );
+ ok(!StrCmpPath(curdir, path), "expected %s, got %s\n", curdir, path);
+
+ /* copy this executable to a new folder */
+ sprintf(newdir, "%s\\newfolder", tmpdir);
+ rc = CreateDirectoryA( newdir, NULL );
+ ok( rc, "failed to create %s err %u\n", path, GetLastError() );
+ sprintf(path, "%s\\%s", newdir, path_find_file_name(argv0));
+ CopyFileA(argv0, path, FALSE);
+
+ rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI, NULL, path_find_file_name(argv0), params, newdir);
+ ok(rc > 32, "%s returned %d\n", shell_call, rc);
+ okChildInt("argcA", 4);
+ okChildString("argvA3", "Exec");
+ DeleteFile(path);
+
+ GetCurrentDirectoryA( MAX_PATH, path );
+ ok(!StrCmpPath(curdir, path), "expected %s, got %s\n", curdir, path);
+
+ DeleteFile(path);
+ RemoveDirectoryA(newdir);
+}
+
START_TEST(shlexec)
{
@@ -2201,6 +2262,7 @@ START_TEST(shlexec)
test_dde();
test_dde_default_app();
test_commandline();
+ test_directory();
cleanup_test();
}
--
Best Regards, André Hentschel
More information about the wine-patches
mailing list