mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[SHELL32_APITEST] ShellExecuteEx: Introduce a CleanupNewlyCreatedWindows() helper similar to the one of the ShellExecCmdLine test.
This commit is contained in:
parent
55c117c4c9
commit
307ce1a503
1 changed files with 24 additions and 18 deletions
|
@ -67,6 +67,7 @@ TestShellExecuteEx(const WCHAR* Name, BOOL ExpectedResult)
|
||||||
{
|
{
|
||||||
SHELLEXECUTEINFOW ShellExecInfo;
|
SHELLEXECUTEINFOW ShellExecInfo;
|
||||||
BOOL Result;
|
BOOL Result;
|
||||||
|
|
||||||
ZeroMemory(&ShellExecInfo, sizeof(ShellExecInfo));
|
ZeroMemory(&ShellExecInfo, sizeof(ShellExecInfo));
|
||||||
ShellExecInfo.cbSize = sizeof(ShellExecInfo);
|
ShellExecInfo.cbSize = sizeof(ShellExecInfo);
|
||||||
ShellExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
|
ShellExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
|
||||||
|
@ -74,6 +75,7 @@ TestShellExecuteEx(const WCHAR* Name, BOOL ExpectedResult)
|
||||||
ShellExecInfo.nShow = SW_SHOWNORMAL;
|
ShellExecInfo.nShow = SW_SHOWNORMAL;
|
||||||
ShellExecInfo.lpFile = Name;
|
ShellExecInfo.lpFile = Name;
|
||||||
ShellExecInfo.lpDirectory = NULL;
|
ShellExecInfo.lpDirectory = NULL;
|
||||||
|
|
||||||
Result = ShellExecuteExW(&ShellExecInfo);
|
Result = ShellExecuteExW(&ShellExecInfo);
|
||||||
ok(Result == ExpectedResult, "ShellExecuteEx lpFile %s failed. Error: %lu\n", wine_dbgstr_w(Name), GetLastError());
|
ok(Result == ExpectedResult, "ShellExecuteEx lpFile %s failed. Error: %lu\n", wine_dbgstr_w(Name), GetLastError());
|
||||||
if (ShellExecInfo.hProcess)
|
if (ShellExecInfo.hProcess)
|
||||||
|
@ -209,6 +211,27 @@ static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CleanupNewlyCreatedWindows(void)
|
||||||
|
{
|
||||||
|
EnumWindows(EnumWindowsProc, (LPARAM)&s_wi1);
|
||||||
|
for (UINT i1 = 0; i1 < s_wi1.count; ++i1)
|
||||||
|
{
|
||||||
|
BOOL bFound = FALSE;
|
||||||
|
for (UINT i0 = 0; i0 < s_wi0.count; ++i0)
|
||||||
|
{
|
||||||
|
if (s_wi1.phwnd[i1] == s_wi0.phwnd[i0])
|
||||||
|
{
|
||||||
|
bFound = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!bFound)
|
||||||
|
PostMessageW(s_wi1.phwnd[i1], WM_CLOSE, 0, 0);
|
||||||
|
}
|
||||||
|
free(s_wi1.phwnd);
|
||||||
|
ZeroMemory(&s_wi1, sizeof(s_wi1));
|
||||||
|
}
|
||||||
|
|
||||||
static VOID DoTestEntry(const TEST_ENTRY *pEntry)
|
static VOID DoTestEntry(const TEST_ENTRY *pEntry)
|
||||||
{
|
{
|
||||||
SHELLEXECUTEINFOA info = { sizeof(info) };
|
SHELLEXECUTEINFOA info = { sizeof(info) };
|
||||||
|
@ -238,24 +261,7 @@ static VOID DoTestEntry(const TEST_ENTRY *pEntry)
|
||||||
|
|
||||||
WaitForInputIdle(info.hProcess, INFINITE);
|
WaitForInputIdle(info.hProcess, INFINITE);
|
||||||
|
|
||||||
// close newly opened windows
|
CleanupNewlyCreatedWindows();
|
||||||
EnumWindows(EnumWindowsProc, (LPARAM)&s_wi1);
|
|
||||||
for (UINT i1 = 0; i1 < s_wi1.count; ++i1)
|
|
||||||
{
|
|
||||||
BOOL bFound = FALSE;
|
|
||||||
for (UINT i0 = 0; i0 < s_wi0.count; ++i0)
|
|
||||||
{
|
|
||||||
if (s_wi1.phwnd[i1] == s_wi0.phwnd[i0])
|
|
||||||
{
|
|
||||||
bFound = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!bFound)
|
|
||||||
PostMessageW(s_wi1.phwnd[i1], WM_CLOSE, 0, 0);
|
|
||||||
}
|
|
||||||
free(s_wi1.phwnd);
|
|
||||||
ZeroMemory(&s_wi1, sizeof(s_wi1));
|
|
||||||
|
|
||||||
if (WaitForSingleObject(info.hProcess, 10 * 1000) == WAIT_TIMEOUT)
|
if (WaitForSingleObject(info.hProcess, 10 * 1000) == WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue