ReactOS 0.4.15-dev-6056-gb29b268
ShellExecuteEx.cpp File Reference
#include "shelltest.h"
#include <shlwapi.h>
#include <stdio.h>
#include "shell32_apitest_sub.h"
Include dependency graph for ShellExecuteEx.cpp:

Go to the source code of this file.

Classes

struct  TEST_ENTRY
 
struct  OPENWNDS
 

Macros

#define ok_ShellExecuteEx   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : TestShellExecuteEx
 
#define DONT_CARE   0x0BADF00D
 

Typedefs

typedef struct TEST_ENTRY TEST_ENTRY
 
typedef struct OPENWNDS OPENWNDS
 

Functions

static BOOL CreateAppPathRegKey (const WCHAR *Name)
 
static VOID DeleteAppPathRegKey (const WCHAR *Name)
 
static VOID TestShellExecuteEx (const WCHAR *Name, BOOL ExpectedResult)
 
static void DoAppPathTest (void)
 
static BOOL CALLBACK EnumWindowsProc (HWND hwnd, LPARAM lParam)
 
static void CleanupNewlyCreatedWindows (void)
 
static VOID DoTestEntry (const TEST_ENTRY *pEntry)
 
static BOOL GetSubProgramPath (void)
 
static void DoTestEntries (void)
 
BOOL CALLBACK EnumProc (_In_ HWND hwnd, _In_ LPARAM lParam)
 
BOOL WaitAndCloseWindow ()
 
static void test_properties ()
 
 START_TEST (ShellExecuteEx)
 

Variables

static char s_sub_program [MAX_PATH]
 
static char s_win_test_exe [MAX_PATH]
 
static char s_sys_test_exe [MAX_PATH]
 
static char s_win_bat_file [MAX_PATH]
 
static char s_sys_bat_file [MAX_PATH]
 
static char s_win_txt_file [MAX_PATH]
 
static char s_sys_txt_file [MAX_PATH]
 
static const TEST_ENTRY s_entries_1 []
 
static const TEST_ENTRY s_entries_2 []
 
static OPENWNDS s_wi0 = { 0 }
 
static OPENWNDS s_wi1 = { 0 }
 
WCHARExeName = NULL
 

Macro Definition Documentation

◆ DONT_CARE

#define DONT_CARE   0x0BADF00D

Definition at line 128 of file ShellExecuteEx.cpp.

◆ ok_ShellExecuteEx

#define ok_ShellExecuteEx   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : TestShellExecuteEx

Definition at line 14 of file ShellExecuteEx.cpp.

Typedef Documentation

◆ OPENWNDS

◆ TEST_ENTRY

Function Documentation

◆ CleanupNewlyCreatedWindows()

static void CleanupNewlyCreatedWindows ( void  )
static

Definition at line 214 of file ShellExecuteEx.cpp.

215{
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 }
232 ZeroMemory(&s_wi1, sizeof(s_wi1));
233}
static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
static OPENWNDS s_wi1
static OPENWNDS s_wi0
#define free
Definition: debug_ros.c:5
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned int UINT
Definition: ndis.h:50
#define ZeroMemory
Definition: winbase.h:1670
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_CLOSE
Definition: winuser.h:1611
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)

Referenced by DoTestEntry().

◆ CreateAppPathRegKey()

static BOOL CreateAppPathRegKey ( const WCHAR Name)
static

Definition at line 18 of file ShellExecuteEx.cpp.

19{
20 HKEY RegistryKey;
22 WCHAR Buffer[1024];
23 WCHAR KeyValue[1024];
24 DWORD Length = sizeof(KeyValue);
26
27 wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
28 wcscat(Buffer, L"IEXPLORE.EXE");
30 if (Result != ERROR_SUCCESS) trace("Could not open iexplore.exe key. Status: %lu\n", Result);
31 if (Result) goto end;
32 Result = RegQueryValueExW(RegistryKey, NULL, NULL, NULL, (LPBYTE)KeyValue, &Length);
33 if (Result != ERROR_SUCCESS) trace("Could not read iexplore.exe key. Status: %lu\n", Result);
34 if (Result) goto end;
35 RegCloseKey(RegistryKey);
36
37 wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
40 0, KEY_WRITE, NULL, &RegistryKey, &Disposition);
41 if (Result != ERROR_SUCCESS) trace("Could not create test key. Status: %lu\n", Result);
42 if (Result) goto end;
43 Result = RegSetValueW(RegistryKey, NULL, REG_SZ, KeyValue, 0);
44 if (Result != ERROR_SUCCESS) trace("Could not set value of the test key. Status: %lu\n", Result);
45 if (Result) goto end;
46 RegCloseKey(RegistryKey);
47end:
48 if (RegistryKey) RegCloseKey(RegistryKey);
49 return Result == ERROR_SUCCESS;
50}
#define trace
Definition: atltest.h:70
#define RegCloseKey(hKey)
Definition: registry.h:47
Definition: bufpool.h:45
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3353
LONG WINAPI RegSetValueW(HKEY hKeyOriginal, LPCWSTR lpSubKey, DWORD dwType, LPCWSTR lpData, DWORD cbData)
Definition: reg.c:5015
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4118
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint end
Definition: gl.h:1545
#define REG_SZ
Definition: layer.c:22
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:56
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by DoAppPathTest().

◆ DeleteAppPathRegKey()

static VOID DeleteAppPathRegKey ( const WCHAR Name)
static

Definition at line 54 of file ShellExecuteEx.cpp.

55{
57 WCHAR Buffer[1024];
58 wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
61 if (Result != ERROR_SUCCESS) trace("Could not remove the test key. Status: %lu\n", Result);
62}
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1234

Referenced by DoAppPathTest().

◆ DoAppPathTest()

static void DoAppPathTest ( void  )
static

Definition at line 90 of file ShellExecuteEx.cpp.

91{
92 ok_ShellExecuteEx(L"iexplore", TRUE);
93 ok_ShellExecuteEx(L"iexplore.exe", TRUE);
94
95 if (CreateAppPathRegKey(L"iexplore.bat"))
96 {
97 ok_ShellExecuteEx(L"iexplore.bat", TRUE);
98 ok_ShellExecuteEx(L"iexplore.bat.exe", FALSE);
99 DeleteAppPathRegKey(L"iexplore.bat");
100 }
101
102 if (CreateAppPathRegKey(L"iexplore.bat.exe"))
103 {
104 ok_ShellExecuteEx(L"iexplore.bat", FALSE);
105 ok_ShellExecuteEx(L"iexplore.bat.exe", TRUE);
106 DeleteAppPathRegKey(L"iexplore.bat.exe");
107 }
108}
static VOID DeleteAppPathRegKey(const WCHAR *Name)
static BOOL CreateAppPathRegKey(const WCHAR *Name)
#define ok_ShellExecuteEx

Referenced by START_TEST().

◆ DoTestEntries()

static void DoTestEntries ( void  )
static

Definition at line 295 of file ShellExecuteEx.cpp.

296{
297 if (!GetSubProgramPath())
298 {
299 skip("shell32_apitest_sub.exe is not found\n");
300 return;
301 }
302
303 // s_win_test_exe
305 PathAppendA(s_win_test_exe, "test program.exe");
307 if (!ret)
308 {
309 skip("Please retry with admin rights\n");
310 return;
311 }
312
313 // record open windows
315 {
316 skip("EnumWindows failed\n");
319 return;
320 }
321
322 // s_sys_test_exe
324 PathAppendA(s_sys_test_exe, "test program.exe");
326
327 // s_win_bat_file
329 PathAppendA(s_win_bat_file, "test program.bat");
330 FILE *fp = fopen(s_win_bat_file, "wb");
331 fprintf(fp, "exit /b 3");
332 fclose(fp);
334
335 // s_sys_bat_file
337 PathAppendA(s_sys_bat_file, "test program.bat");
338 fp = fopen(s_sys_bat_file, "wb");
339 fprintf(fp, "exit /b 4");
340 fclose(fp);
342
343 // s_win_txt_file
345 PathAppendA(s_win_txt_file, "test_file.txt");
346 fp = fopen(s_win_txt_file, "wb");
347 fclose(fp);
349
350 // s_sys_txt_file
352 PathAppendA(s_sys_txt_file, "test_file.txt");
353 fp = fopen(s_sys_txt_file, "wb");
354 fclose(fp);
356
357 for (UINT iTest = 0; iTest < _countof(s_entries_1); ++iTest)
358 {
359 DoTestEntry(&s_entries_1[iTest]);
360 }
361
364
365 for (UINT iTest = 0; iTest < _countof(s_entries_2); ++iTest)
366 {
367 DoTestEntry(&s_entries_2[iTest]);
368 }
369
374
376}
static char s_win_txt_file[MAX_PATH]
static char s_sub_program[MAX_PATH]
static char s_win_bat_file[MAX_PATH]
static char s_win_test_exe[MAX_PATH]
static char s_sys_bat_file[MAX_PATH]
static const TEST_ENTRY s_entries_1[]
static const TEST_ENTRY s_entries_2[]
static char s_sys_txt_file[MAX_PATH]
static char s_sys_test_exe[MAX_PATH]
static VOID DoTestEntry(const TEST_ENTRY *pEntry)
static BOOL GetSubProgramPath(void)
#define skip(...)
Definition: atltest.h:64
#define ok_int(expression, result)
Definition: atltest.h:134
BOOL WINAPI CopyFileA(IN LPCSTR lpExistingFileName, IN LPCSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:404
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2283
BOOL WINAPI PathFileExistsA(LPCSTR lpszPath)
Definition: path.c:1755
BOOL WINAPI PathAppendA(LPSTR lpszPath, LPCSTR lpszAppend)
Definition: path.c:106
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
#define _countof(array)
Definition: sndvol32.h:68
int ret

Referenced by START_TEST().

◆ DoTestEntry()

static VOID DoTestEntry ( const TEST_ENTRY pEntry)
static

Definition at line 235 of file ShellExecuteEx.cpp.

236{
237 SHELLEXECUTEINFOA info = { sizeof(info) };
239 info.nShow = SW_SHOWNORMAL;
240 info.lpFile = pEntry->file;
241 info.lpParameters = pEntry->params;
242 info.lpDirectory = pEntry->curdir;
244 ok(ret == pEntry->ret, "Line %u: ret expected %d, got %d\n",
245 pEntry->lineno, pEntry->ret, ret);
246 if (!pEntry->ret)
247 return;
248
249 if ((UINT)pEntry->bProcessHandle != DONT_CARE)
250 {
251 if (pEntry->bProcessHandle)
252 {
253 ok(!!info.hProcess, "Line %u: hProcess expected non-NULL\n", pEntry->lineno);
254 }
255 else
256 {
257 ok(!info.hProcess, "Line %u: hProcess expected NULL\n", pEntry->lineno);
258 return;
259 }
260 }
261
262 WaitForInputIdle(info.hProcess, INFINITE);
263
265
266 if (WaitForSingleObject(info.hProcess, 10 * 1000) == WAIT_TIMEOUT)
267 {
268 TerminateProcess(info.hProcess, 11);
269 ok(0, "Process %s did not quit!\n", pEntry->file);
270 }
271 CloseHandle(info.hProcess);
272}
static void CleanupNewlyCreatedWindows(void)
#define DONT_CARE
#define ok(value,...)
Definition: atltest.h:57
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
#define INFINITE
Definition: serial.h:102
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
#define SEE_MASK_NOCLOSEPROCESS
Definition: shellapi.h:31
#define SEE_MASK_FLAG_NO_UI
Definition: shellapi.h:36
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExA(LPSHELLEXECUTEINFOA sei)
Definition: shlexec.cpp:2285
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define SW_SHOWNORMAL
Definition: winuser.h:764
DWORD WINAPI WaitForInputIdle(_In_ HANDLE, _In_ DWORD)

Referenced by DoTestEntries().

◆ EnumProc()

BOOL CALLBACK EnumProc ( _In_ HWND  hwnd,
_In_ LPARAM  lParam 
)

Definition at line 380 of file ShellExecuteEx.cpp.

381{
382 DWORD pid = 0;
384 if (pid == GetCurrentProcessId() &&
386 {
387 WCHAR Buffer[512] = {0};
388
390 if (Buffer[0] && StrStrIW(Buffer, ExeName))
391 {
392 HWND* pHwnd = (HWND*)lParam;
393 *pHwnd = hwnd;
394 return FALSE;
395 }
396 }
397 return TRUE;
398}
WCHAR * ExeName
LPARAM lParam
Definition: combotst.c:139
LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
Definition: string.c:384
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
BOOL WINAPI IsWindowVisible(_In_ HWND)

Referenced by IntEnumFontFamilies(), LdrEnumerateLoadedModules(), SndMixerEnumConnections(), SndMixerEnumLines(), SndMixerEnumProducts(), WaitAndCloseWindow(), WrapEnumFontFamiliesA(), WrapEnumFontFamiliesExA(), WrapEnumFontFamiliesExW(), and WrapEnumFontFamiliesW().

◆ EnumWindowsProc()

static BOOL CALLBACK EnumWindowsProc ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 203 of file ShellExecuteEx.cpp.

204{
206 info->phwnd = (HWND *)realloc(info->phwnd, (info->count + 1) * sizeof(HWND));
207 if (!info->phwnd)
208 return FALSE;
209 info->phwnd[info->count] = hwnd;
210 ++(info->count);
211 return TRUE;
212}
#define realloc
Definition: debug_ros.c:6
HANDLE HWND
Definition: compat.h:19
unsigned int count
Definition: notification.c:64

Referenced by CleanupNewlyCreatedWindows(), and DoTestEntries().

◆ GetSubProgramPath()

static BOOL GetSubProgramPath ( void  )
static

Definition at line 275 of file ShellExecuteEx.cpp.

276{
279 PathAppendA(s_sub_program, "shell32_apitest_sub.exe");
280
282 {
284 PathAppendA(s_sub_program, "testdata\\shell32_apitest_sub.exe");
285
287 {
288 return FALSE;
289 }
290 }
291
292 return TRUE;
293}
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath)
Definition: path.c:586

Referenced by DoTestEntries().

◆ START_TEST()

START_TEST ( ShellExecuteEx  )

Definition at line 470 of file ShellExecuteEx.cpp.

471{
475
477 Sleep(100);
478}
static void DoTestEntries(void)
static void test_properties()
static void DoAppPathTest(void)
static HWND DoWaitForWindow(LPCWSTR clsname, LPCWSTR text, BOOL bClosing, BOOL bForce)
#define CLASSNAME
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790

◆ test_properties()

static void test_properties ( void  )
static

Definition at line 419 of file ShellExecuteEx.cpp.

420{
421 WCHAR Buffer[MAX_PATH * 4];
422
424
426 SHELLEXECUTEINFOW info = { 0 };
427
428 info.cbSize = sizeof(SHELLEXECUTEINFOW);
430 info.lpVerb = L"properties";
431 info.lpFile = Buffer;
432 info.lpParameters = L"";
433 info.nShow = SW_SHOW;
434
435 BOOL bRet = ShellExecuteExW(&info);
436 ok(bRet, "Failed! (GetLastError(): %d)\n", (int)GetLastError());
437 ok_ptr(info.hInstApp, (HINSTANCE)42);
438
441 if (Extension)
442 {
443 // The inclusion of this depends on the file display settings!
445 }
446
447 if (bRet)
448 {
449 ok(WaitAndCloseWindow(), "Could not find properties window!\n");
450 }
451
452 // Now retry it with the extension cut off
453 bRet = ShellExecuteExW(&info);
454 ok(bRet, "Failed! (GetLastError(): %d)\n", (int)GetLastError());
455 ok_ptr(info.hInstApp, (HINSTANCE)42);
456
457 if (bRet)
458 {
459 ok(WaitAndCloseWindow(), "Could not find properties window!\n");
460 }
461
462 info.lpFile = L"complete garbage, cannot run this!";
463
464 // Now retry it with complete garabage
465 bRet = ShellExecuteExW(&info);
466 ok(bRet == 0, "Succeeded!\n");
467 ok_ptr(info.hInstApp, (HINSTANCE)2);
468}
BOOL WaitAndCloseWindow()
#define ok_ptr(expression, result)
Definition: atltest.h:108
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092
#define UNICODE_NULL
struct _SHELLEXECUTEINFOW SHELLEXECUTEINFOW
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2335
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define SW_SHOW
Definition: winuser.h:769

Referenced by START_TEST().

◆ TestShellExecuteEx()

static VOID TestShellExecuteEx ( const WCHAR Name,
BOOL  ExpectedResult 
)
static

Definition at line 66 of file ShellExecuteEx.cpp.

67{
68 SHELLEXECUTEINFOW ShellExecInfo;
70
71 ZeroMemory(&ShellExecInfo, sizeof(ShellExecInfo));
72 ShellExecInfo.cbSize = sizeof(ShellExecInfo);
74 ShellExecInfo.hwnd = NULL;
75 ShellExecInfo.nShow = SW_SHOWNORMAL;
76 ShellExecInfo.lpFile = Name;
77 ShellExecInfo.lpDirectory = NULL;
78
79 Result = ShellExecuteExW(&ShellExecInfo);
80 ok(Result == ExpectedResult, "ShellExecuteEx lpFile %s failed. Error: %lu\n", wine_dbgstr_w(Name), GetLastError());
81 if (ShellExecInfo.hProcess)
82 {
83 Result = TerminateProcess(ShellExecInfo.hProcess, 0);
84 if (!Result) trace("Terminate process failed. Error: %lu\n", GetLastError());
86 CloseHandle(ShellExecInfo.hProcess);
87 }
88}
struct NameRec_ * Name
Definition: cdprocs.h:460
#define wine_dbgstr_w
Definition: kernel32.h:34
LPCWSTR lpDirectory
Definition: shellapi.h:331

◆ WaitAndCloseWindow()

BOOL WaitAndCloseWindow ( )

Definition at line 400 of file ShellExecuteEx.cpp.

401{
402 HWND hWnd = NULL;
403 for (int n = 0; n < 100; ++n)
404 {
405 Sleep(50);
406
408
409 if (hWnd)
410 {
412 return TRUE;
413 break;
414 }
415 }
416 return FALSE;
417}
BOOL CALLBACK EnumProc(_In_ HWND hwnd, _In_ LPARAM lParam)
HWND hWnd
Definition: settings.c:17
GLdouble n
Definition: glext.h:7729
#define WM_SYSCOMMAND
Definition: winuser.h:1731
#define SC_CLOSE
Definition: winuser.h:2582
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_properties().

Variable Documentation

◆ ExeName

◆ s_entries_1

const TEST_ENTRY s_entries_1[]
static

Definition at line 130 of file ShellExecuteEx.cpp.

Referenced by DoTestEntries().

◆ s_entries_2

const TEST_ENTRY s_entries_2[]
static
Initial value:
=
{
{ __LINE__, TRUE, TRUE, "test program" },
{ __LINE__, TRUE, TRUE, "test program", "TEST" },
{ __LINE__, TRUE, TRUE, "\"test program\"" },
{ __LINE__, TRUE, TRUE, s_win_test_exe },
{ __LINE__, TRUE, TRUE, s_sys_test_exe },
{ __LINE__, FALSE, FALSE, s_win_bat_file },
{ __LINE__, FALSE, FALSE, s_sys_bat_file },
{ __LINE__, FALSE, FALSE, s_win_bat_file, "TEST" },
{ __LINE__, FALSE, FALSE, s_sys_bat_file, "TEST" },
}

Definition at line 182 of file ShellExecuteEx.cpp.

Referenced by DoTestEntries().

◆ s_sub_program

char s_sub_program[MAX_PATH]
static

Definition at line 120 of file ShellExecuteEx.cpp.

Referenced by DoTestEntries(), and GetSubProgramPath().

◆ s_sys_bat_file

char s_sys_bat_file[MAX_PATH]
static

Definition at line 124 of file ShellExecuteEx.cpp.

Referenced by DoTestEntries().

◆ s_sys_test_exe

char s_sys_test_exe[MAX_PATH]
static

Definition at line 122 of file ShellExecuteEx.cpp.

Referenced by DoTestEntries().

◆ s_sys_txt_file

char s_sys_txt_file[MAX_PATH]
static

Definition at line 126 of file ShellExecuteEx.cpp.

Referenced by DoTestEntries().

◆ s_wi0

OPENWNDS s_wi0 = { 0 }
static

Definition at line 201 of file ShellExecuteEx.cpp.

Referenced by CleanupNewlyCreatedWindows(), and DoTestEntries().

◆ s_wi1

OPENWNDS s_wi1 = { 0 }
static

Definition at line 201 of file ShellExecuteEx.cpp.

Referenced by CleanupNewlyCreatedWindows().

◆ s_win_bat_file

char s_win_bat_file[MAX_PATH]
static

Definition at line 123 of file ShellExecuteEx.cpp.

Referenced by DoTestEntries().

◆ s_win_test_exe

char s_win_test_exe[MAX_PATH]
static

Definition at line 121 of file ShellExecuteEx.cpp.

Referenced by DoTestEntries().

◆ s_win_txt_file

char s_win_txt_file[MAX_PATH]
static

Definition at line 125 of file ShellExecuteEx.cpp.

Referenced by DoTestEntries().