[SHELL32][SHELL32_APITEST] ShellExecute should accept invalid directory (#7150)

Implement parsing SHELLEXECUTEINFO.lpDirectory.
Enhance ShellExecuteEx testcase for invalid directory.
This commit is contained in:
Katayama Hirofumi MZ 2024-07-19 17:40:36 +09:00 committed by GitHub
parent 466a19817f
commit 089788a52a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 62 additions and 18 deletions

View file

@ -14,6 +14,7 @@
#include <stdio.h>
#include <strsafe.h>
#include <versionhelpers.h>
#include "shell32_apitest_sub.h"
static WCHAR s_win_dir[MAX_PATH];
static WCHAR s_sys_dir[MAX_PATH];
@ -440,6 +441,31 @@ static void TEST_AppPath(void)
}
}
static void test_DoInvalidDir(void)
{
WCHAR szSubProgram[MAX_PATH];
if (!FindSubProgram(szSubProgram, _countof(szSubProgram)))
{
skip("shell32_apitest_sub.exe not found\n");
return;
}
DWORD dwExitCode;
SHELLEXECUTEINFOW sei = { sizeof(sei), SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS };
sei.lpFile = szSubProgram;
sei.lpParameters = L"TEST";
sei.nShow = SW_SHOWNORMAL;
// Test invalid path on sei.lpDirectory
WCHAR szInvalidPath[MAX_PATH] = L"M:\\This is an invalid path\n";
sei.lpDirectory = szInvalidPath;
ok_int(ShellExecuteExW(&sei), TRUE);
WaitForSingleObject(sei.hProcess, 20 * 1000);
GetExitCodeProcess(sei.hProcess, &dwExitCode);
ok_long(dwExitCode, 0);
CloseHandle(sei.hProcess);
}
START_TEST(ShellExecuteEx)
{
#ifdef _WIN64
@ -454,6 +480,7 @@ START_TEST(ShellExecuteEx)
TEST_DoTestEntries();
test_properties();
test_sei_lpIDList();
test_DoInvalidDir();
TEST_End();
}