@@ -67,13 +67,15 @@ TestShellExecuteEx(const WCHAR* Name, BOOL ExpectedResult)
67
67
{
68
68
SHELLEXECUTEINFOW ShellExecInfo;
69
69
BOOL Result;
70
+
70
71
ZeroMemory (&ShellExecInfo, sizeof (ShellExecInfo));
71
72
ShellExecInfo.cbSize = sizeof (ShellExecInfo);
72
73
ShellExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
73
74
ShellExecInfo.hwnd = NULL ;
74
75
ShellExecInfo.nShow = SW_SHOWNORMAL;
75
76
ShellExecInfo.lpFile = Name;
76
77
ShellExecInfo.lpDirectory = NULL ;
78
+
77
79
Result = ShellExecuteExW (&ShellExecInfo);
78
80
ok (Result == ExpectedResult, " ShellExecuteEx lpFile %s failed. Error: %lu\n " , wine_dbgstr_w (Name), GetLastError ());
79
81
if (ShellExecInfo.hProcess )
@@ -209,6 +211,27 @@ static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
209
211
return TRUE ;
210
212
}
211
213
214
+ static void CleanupNewlyCreatedWindows (void )
215
+ {
216
+ EnumWindows (EnumWindowsProc, (LPARAM)&s_wi1);
217
+ for (UINT i1 = 0 ; i1 < s_wi1.count ; ++i1)
218
+ {
219
+ BOOL bFound = FALSE ;
220
+ for (UINT i0 = 0 ; i0 < s_wi0.count ; ++i0)
221
+ {
222
+ if (s_wi1.phwnd [i1] == s_wi0.phwnd [i0])
223
+ {
224
+ bFound = TRUE ;
225
+ break ;
226
+ }
227
+ }
228
+ if (!bFound)
229
+ PostMessageW (s_wi1.phwnd [i1], WM_CLOSE, 0 , 0 );
230
+ }
231
+ free (s_wi1.phwnd );
232
+ ZeroMemory (&s_wi1, sizeof (s_wi1));
233
+ }
234
+
212
235
static VOID DoTestEntry (const TEST_ENTRY *pEntry)
213
236
{
214
237
SHELLEXECUTEINFOA info = { sizeof (info) };
@@ -238,24 +261,7 @@ static VOID DoTestEntry(const TEST_ENTRY *pEntry)
238
261
239
262
WaitForInputIdle (info.hProcess , INFINITE);
240
263
241
- // close newly opened windows
242
- EnumWindows (EnumWindowsProc, (LPARAM)&s_wi1);
243
- for (UINT i1 = 0 ; i1 < s_wi1.count ; ++i1)
244
- {
245
- BOOL bFound = FALSE ;
246
- for (UINT i0 = 0 ; i0 < s_wi0.count ; ++i0)
247
- {
248
- if (s_wi1.phwnd [i1] == s_wi0.phwnd [i0])
249
- {
250
- bFound = TRUE ;
251
- break ;
252
- }
253
- }
254
- if (!bFound)
255
- PostMessageW (s_wi1.phwnd [i1], WM_CLOSE, 0 , 0 );
256
- }
257
- free (s_wi1.phwnd );
258
- ZeroMemory (&s_wi1, sizeof (s_wi1));
264
+ CleanupNewlyCreatedWindows ();
259
265
260
266
if (WaitForSingleObject (info.hProcess , 10 * 1000 ) == WAIT_TIMEOUT)
261
267
{
0 commit comments