ReactOS 0.4.16-dev-1946-g52006dd
RealShellExecuteEx.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Test for RealShellExecuteExA/W
5 * COPYRIGHT: Copyright 2024 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6 */
7
8#include "shelltest.h"
9#include "closewnd.h"
10#include <versionhelpers.h>
11
13{
14 return IsWindowsVersionOrGreater(5, 2, 2);
15}
16
19 _In_opt_ LPCSTR lpOperation,
20 _In_opt_ LPCSTR lpFile,
21 _In_opt_ LPCSTR lpParameters,
23 _In_opt_ LPSTR lpReturn,
26 _In_ INT nCmdShow,
27 _Out_opt_ PHANDLE lphProcess,
29
32 _In_opt_ LPCWSTR lpOperation,
33 _In_opt_ LPCWSTR lpFile,
34 _In_opt_ LPCWSTR lpParameters,
36 _In_opt_ LPWSTR lpReturn,
39 _In_ INT nCmdShow,
40 _Out_opt_ PHANDLE lphProcess,
42
46
48
49static void TEST_Start(void)
50{
52}
53
54static void TEST_End(void)
55{
56 // Execution can be asynchronous; you have to wait for it to finish.
57 Sleep(2000);
58
59 // Close newly-opened window(s)
64}
65
66static void TEST_RealShellExecuteExA(void)
67{
69
71 NULL,
72 NULL,
73 "notepad.exe",
74 NULL,
75 NULL,
76 NULL,
77 NULL,
78 NULL,
80 NULL,
81 0);
83 ok_long((LONG)ret, 42);
84 else
85 ok_long((LONG)ret, 2);
86}
87
88static void TEST_RealShellExecuteExW(void)
89{
91
93 NULL,
94 NULL,
95 L"notepad.exe",
96 NULL,
97 NULL,
98 NULL,
99 NULL,
100 NULL,
102 NULL,
103 0);
104 ok_long((LONG)ret, 42);
105}
106
107START_TEST(RealShellExecuteEx)
108{
110 {
111 skip("Vista+\n");
112 return;
113 }
114
115 s_hSHELL32 = LoadLibraryW(L"shell32.dll");
116
119
121 {
122 skip("RealShellExecuteExA/W not found: %p, %p\n",
124 return;
125 }
126
127 TEST_Start();
128
131
132 TEST_End();
133
135}
static WINDOW_LIST s_List2
static void TEST_RealShellExecuteExW(void)
static void TEST_Start(void)
static FN_RealShellExecuteExA s_fnRealShellExecuteExA
static WINDOW_LIST s_List1
BOOL IsWindowsServer2003SP2OrGreater(void)
HINSTANCE(WINAPI * FN_RealShellExecuteExA)(_In_opt_ HWND hwnd, _In_opt_ LPCSTR lpOperation, _In_opt_ LPCSTR lpFile, _In_opt_ LPCSTR lpParameters, _In_opt_ LPCSTR lpDirectory, _In_opt_ LPSTR lpReturn, _In_opt_ LPCSTR lpTitle, _In_opt_ LPVOID lpReserved, _In_ INT nCmdShow, _Out_opt_ PHANDLE lphProcess, _In_ DWORD dwFlags)
static void TEST_End(void)
static FN_RealShellExecuteExW s_fnRealShellExecuteExW
HINSTANCE(WINAPI * FN_RealShellExecuteExW)(_In_opt_ HWND hwnd, _In_opt_ LPCWSTR lpOperation, _In_opt_ LPCWSTR lpFile, _In_opt_ LPCWSTR lpParameters, _In_opt_ LPCWSTR lpDirectory, _In_opt_ LPWSTR lpReturn, _In_opt_ LPCWSTR lpTitle, _In_opt_ LPVOID lpReserved, _In_ INT nCmdShow, _Out_opt_ PHANDLE lphProcess, _In_ DWORD dwFlags)
static HINSTANCE s_hSHELL32
static void TEST_RealShellExecuteExA(void)
#define ok_long(expression, result)
Definition: atltest.h:133
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
static VOID FreeWindowList(PWINDOW_LIST pList)
Definition: closewnd.h:20
static VOID CloseNewWindows(PWINDOW_LIST pExisting, PWINDOW_LIST pNew)
Definition: closewnd.h:78
static VOID GetWindowList(PWINDOW_LIST pList)
Definition: closewnd.h:42
TCHAR lpTitle[80]
Definition: ctm.c:69
#define NULL
Definition: types.h:112
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define _Out_opt_
Definition: no_sal2.h:214
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
long LONG
Definition: pedump.c:60
_In_opt_ LPCSTR lpDirectory
Definition: shellapi.h:496
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
HANDLE HINSTANCE
Definition: typedefs.h:77
int32_t INT_PTR
Definition: typedefs.h:64
int32_t INT
Definition: typedefs.h:58
VERSIONHELPERAPI IsWindowsVistaOrGreater()
VERSIONHELPERAPI IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
_In_ DWORD _In_ int _In_ int _In_opt_ LPNLSVERSIONINFO _In_opt_ LPVOID lpReserved
Definition: winnls.h:1268
#define SW_SHOWDEFAULT
Definition: winuser.h:791
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char * LPSTR
Definition: xmlstorage.h:182