1bfcbda22SKatayama Hirofumi MZ /*
2bfcbda22SKatayama Hirofumi MZ  * PROJECT:         ReactOS API tests
3bfcbda22SKatayama Hirofumi MZ  * LICENSE:         LGPLv2.1+ - See COPYING.LIB in the top level directory
4bfcbda22SKatayama Hirofumi MZ  * PURPOSE:         Test for ShellExecCmdLine
5bfcbda22SKatayama Hirofumi MZ  * PROGRAMMERS:     Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6bfcbda22SKatayama Hirofumi MZ  */
7bfcbda22SKatayama Hirofumi MZ #include "shelltest.h"
8bfcbda22SKatayama Hirofumi MZ #include <shlwapi.h>
9bfcbda22SKatayama Hirofumi MZ #include <strsafe.h>
10465745b6STimo Kreuzer #include <versionhelpers.h>
1160b89da3SKatayama Hirofumi MZ #include "shell32_apitest_sub.h"
12bfcbda22SKatayama Hirofumi MZ 
13bfcbda22SKatayama Hirofumi MZ #define NDEBUG
14bfcbda22SKatayama Hirofumi MZ #include <debug.h>
15bfcbda22SKatayama Hirofumi MZ #include <stdio.h>
16bfcbda22SKatayama Hirofumi MZ 
17bfcbda22SKatayama Hirofumi MZ #ifndef SECL_NO_UI
18bfcbda22SKatayama Hirofumi MZ     #define SECL_NO_UI          0x2
19bfcbda22SKatayama Hirofumi MZ     #define SECL_LOG_USAGE      0x8
20bfcbda22SKatayama Hirofumi MZ     #define SECL_USE_IDLIST     0x10
21bfcbda22SKatayama Hirofumi MZ     #define SECL_ALLOW_NONEXE   0x20
22bfcbda22SKatayama Hirofumi MZ     #define SECL_RUNAS          0x40
23bfcbda22SKatayama Hirofumi MZ #endif
24bfcbda22SKatayama Hirofumi MZ 
2578edea81SKatayama Hirofumi MZ #define ShellExecCmdLine proxy_ShellExecCmdLine
26bfcbda22SKatayama Hirofumi MZ 
27bfcbda22SKatayama Hirofumi MZ #define shell32_hInstance   GetModuleHandle(NULL)
28bfcbda22SKatayama Hirofumi MZ #define IDS_FILE_NOT_FOUND  (-1)
29bfcbda22SKatayama Hirofumi MZ 
30bfcbda22SKatayama Hirofumi MZ static const WCHAR wszOpen[] = L"open";
31bfcbda22SKatayama Hirofumi MZ static const WCHAR wszExe[] = L".exe";
32bfcbda22SKatayama Hirofumi MZ static const WCHAR wszCom[] = L".com";
33bfcbda22SKatayama Hirofumi MZ 
34bfcbda22SKatayama Hirofumi MZ static __inline void __SHCloneStrW(WCHAR **target, const WCHAR *source)
35bfcbda22SKatayama Hirofumi MZ {
36bfcbda22SKatayama Hirofumi MZ     *target = (WCHAR *)SHAlloc((lstrlenW(source) + 1) * sizeof(WCHAR) );
37bfcbda22SKatayama Hirofumi MZ     lstrcpyW(*target, source);
38bfcbda22SKatayama Hirofumi MZ }
39bfcbda22SKatayama Hirofumi MZ 
4078edea81SKatayama Hirofumi MZ // NOTE: You have to sync the following code to dll/win32/shell32/shlexec.cpp.
41bfcbda22SKatayama Hirofumi MZ static LPCWSTR
42bfcbda22SKatayama Hirofumi MZ SplitParams(LPCWSTR psz, LPWSTR pszArg0, size_t cchArg0)
43bfcbda22SKatayama Hirofumi MZ {
44bfcbda22SKatayama Hirofumi MZ     LPCWSTR pch;
45bfcbda22SKatayama Hirofumi MZ     size_t ich = 0;
46bfcbda22SKatayama Hirofumi MZ     if (*psz == L'"')
47bfcbda22SKatayama Hirofumi MZ     {
48bfcbda22SKatayama Hirofumi MZ         // 1st argument is quoted. the string in quotes is quoted 1st argument.
49bfcbda22SKatayama Hirofumi MZ         // [pch] --> [pszArg0+ich]
50bfcbda22SKatayama Hirofumi MZ         for (pch = psz + 1; *pch && ich + 1 < cchArg0; ++ich, ++pch)
51bfcbda22SKatayama Hirofumi MZ         {
52bfcbda22SKatayama Hirofumi MZ             if (*pch == L'"' && pch[1] == L'"')
53bfcbda22SKatayama Hirofumi MZ             {
54bfcbda22SKatayama Hirofumi MZ                 // doubled double quotations found!
55bfcbda22SKatayama Hirofumi MZ                 pszArg0[ich] = L'"';
56bfcbda22SKatayama Hirofumi MZ             }
57bfcbda22SKatayama Hirofumi MZ             else if (*pch == L'"')
58bfcbda22SKatayama Hirofumi MZ             {
59bfcbda22SKatayama Hirofumi MZ                 // single double quotation found!
60bfcbda22SKatayama Hirofumi MZ                 ++pch;
61bfcbda22SKatayama Hirofumi MZ                 break;
62bfcbda22SKatayama Hirofumi MZ             }
63bfcbda22SKatayama Hirofumi MZ             else
64bfcbda22SKatayama Hirofumi MZ             {
65bfcbda22SKatayama Hirofumi MZ                 // otherwise
66bfcbda22SKatayama Hirofumi MZ                 pszArg0[ich] = *pch;
67bfcbda22SKatayama Hirofumi MZ             }
68bfcbda22SKatayama Hirofumi MZ         }
69bfcbda22SKatayama Hirofumi MZ     }
70bfcbda22SKatayama Hirofumi MZ     else
71bfcbda22SKatayama Hirofumi MZ     {
72bfcbda22SKatayama Hirofumi MZ         // 1st argument is unquoted. non-space sequence is 1st argument.
73bfcbda22SKatayama Hirofumi MZ         // [pch] --> [pszArg0+ich]
74bfcbda22SKatayama Hirofumi MZ         for (pch = psz; *pch && !iswspace(*pch) && ich + 1 < cchArg0; ++ich, ++pch)
75bfcbda22SKatayama Hirofumi MZ         {
76bfcbda22SKatayama Hirofumi MZ             pszArg0[ich] = *pch;
77bfcbda22SKatayama Hirofumi MZ         }
78bfcbda22SKatayama Hirofumi MZ     }
79bfcbda22SKatayama Hirofumi MZ     pszArg0[ich] = 0;
80bfcbda22SKatayama Hirofumi MZ 
81bfcbda22SKatayama Hirofumi MZ     // skip space
82bfcbda22SKatayama Hirofumi MZ     while (iswspace(*pch))
83bfcbda22SKatayama Hirofumi MZ         ++pch;
84bfcbda22SKatayama Hirofumi MZ 
85bfcbda22SKatayama Hirofumi MZ     return pch;
86bfcbda22SKatayama Hirofumi MZ }
87bfcbda22SKatayama Hirofumi MZ 
88bfcbda22SKatayama Hirofumi MZ HRESULT WINAPI ShellExecCmdLine(
89bfcbda22SKatayama Hirofumi MZ     HWND hwnd,
90bfcbda22SKatayama Hirofumi MZ     LPCWSTR pwszCommand,
91bfcbda22SKatayama Hirofumi MZ     LPCWSTR pwszStartDir,
92bfcbda22SKatayama Hirofumi MZ     int nShow,
93bfcbda22SKatayama Hirofumi MZ     LPVOID pUnused,
94bfcbda22SKatayama Hirofumi MZ     DWORD dwSeclFlags)
95bfcbda22SKatayama Hirofumi MZ {
96bfcbda22SKatayama Hirofumi MZ     SHELLEXECUTEINFOW info;
97bfcbda22SKatayama Hirofumi MZ     DWORD dwSize, dwError, dwType, dwFlags = SEE_MASK_DOENVSUBST | SEE_MASK_NOASYNC;
98bfcbda22SKatayama Hirofumi MZ     LPCWSTR pszVerb = NULL;
99bfcbda22SKatayama Hirofumi MZ     WCHAR szFile[MAX_PATH], szFile2[MAX_PATH];
100bfcbda22SKatayama Hirofumi MZ     HRESULT hr;
101bfcbda22SKatayama Hirofumi MZ     LPCWSTR pchParams;
102bfcbda22SKatayama Hirofumi MZ     LPWSTR lpCommand = NULL;
103bfcbda22SKatayama Hirofumi MZ 
104bfcbda22SKatayama Hirofumi MZ     if (pwszCommand == NULL)
105bfcbda22SKatayama Hirofumi MZ         RaiseException(EXCEPTION_ACCESS_VIOLATION, EXCEPTION_NONCONTINUABLE,
106bfcbda22SKatayama Hirofumi MZ                        1, (ULONG_PTR*)pwszCommand);
107bfcbda22SKatayama Hirofumi MZ 
108bfcbda22SKatayama Hirofumi MZ     __SHCloneStrW(&lpCommand, pwszCommand);
109bfcbda22SKatayama Hirofumi MZ     StrTrimW(lpCommand, L" \t");
110bfcbda22SKatayama Hirofumi MZ 
111bfcbda22SKatayama Hirofumi MZ     if (dwSeclFlags & SECL_NO_UI)
112bfcbda22SKatayama Hirofumi MZ         dwFlags |= SEE_MASK_FLAG_NO_UI;
113bfcbda22SKatayama Hirofumi MZ     if (dwSeclFlags & SECL_LOG_USAGE)
114bfcbda22SKatayama Hirofumi MZ         dwFlags |= SEE_MASK_FLAG_LOG_USAGE;
115bfcbda22SKatayama Hirofumi MZ     if (dwSeclFlags & SECL_USE_IDLIST)
116bfcbda22SKatayama Hirofumi MZ         dwFlags |= SEE_MASK_INVOKEIDLIST;
117bfcbda22SKatayama Hirofumi MZ 
118bfcbda22SKatayama Hirofumi MZ     if (dwSeclFlags & SECL_RUNAS)
119bfcbda22SKatayama Hirofumi MZ     {
120bfcbda22SKatayama Hirofumi MZ         dwSize = 0;
121bfcbda22SKatayama Hirofumi MZ         hr = AssocQueryStringW(0, ASSOCSTR_COMMAND, lpCommand, L"RunAs", NULL, &dwSize);
122bfcbda22SKatayama Hirofumi MZ         if (SUCCEEDED(hr) && dwSize != 0)
123bfcbda22SKatayama Hirofumi MZ         {
124bfcbda22SKatayama Hirofumi MZ             pszVerb = L"runas";
125bfcbda22SKatayama Hirofumi MZ         }
126bfcbda22SKatayama Hirofumi MZ     }
127bfcbda22SKatayama Hirofumi MZ 
128bfcbda22SKatayama Hirofumi MZ     if (UrlIsFileUrlW(lpCommand))
129bfcbda22SKatayama Hirofumi MZ     {
130bfcbda22SKatayama Hirofumi MZ         StringCchCopyW(szFile, _countof(szFile), lpCommand);
131bfcbda22SKatayama Hirofumi MZ         pchParams = NULL;
132bfcbda22SKatayama Hirofumi MZ     }
133bfcbda22SKatayama Hirofumi MZ     else
134bfcbda22SKatayama Hirofumi MZ     {
135bfcbda22SKatayama Hirofumi MZ         pchParams = SplitParams(lpCommand, szFile, _countof(szFile));
136fc11cf78SKatayama Hirofumi MZ         if (szFile[0] != UNICODE_NULL && szFile[1] == L':' &&
137fc11cf78SKatayama Hirofumi MZ             szFile[2] == UNICODE_NULL)
138fc11cf78SKatayama Hirofumi MZ         {
139fc11cf78SKatayama Hirofumi MZ             PathAddBackslashW(szFile);
140fc11cf78SKatayama Hirofumi MZ         }
141fc11cf78SKatayama Hirofumi MZ 
142fc11cf78SKatayama Hirofumi MZ         WCHAR szCurDir[MAX_PATH];
143fc11cf78SKatayama Hirofumi MZ         GetCurrentDirectoryW(_countof(szCurDir), szCurDir);
144fc11cf78SKatayama Hirofumi MZ         if (pwszStartDir)
145fc11cf78SKatayama Hirofumi MZ         {
146fc11cf78SKatayama Hirofumi MZ             SetCurrentDirectoryW(pwszStartDir);
147fc11cf78SKatayama Hirofumi MZ         }
148fc11cf78SKatayama Hirofumi MZ 
149fc11cf78SKatayama Hirofumi MZ         if (PathIsRelativeW(szFile) &&
150fc11cf78SKatayama Hirofumi MZ             GetFullPathNameW(szFile, _countof(szFile2), szFile2, NULL) &&
151fc11cf78SKatayama Hirofumi MZ             PathFileExistsW(szFile2))
152fc11cf78SKatayama Hirofumi MZ         {
153fc11cf78SKatayama Hirofumi MZ             StringCchCopyW(szFile, _countof(szFile), szFile2);
154fc11cf78SKatayama Hirofumi MZ         }
155fc11cf78SKatayama Hirofumi MZ         else if (SearchPathW(NULL, szFile, NULL, _countof(szFile2), szFile2, NULL) ||
156bfcbda22SKatayama Hirofumi MZ                  SearchPathW(NULL, szFile, wszExe, _countof(szFile2), szFile2, NULL) ||
157bfcbda22SKatayama Hirofumi MZ                  SearchPathW(NULL, szFile, wszCom, _countof(szFile2), szFile2, NULL) ||
158bfcbda22SKatayama Hirofumi MZ                  SearchPathW(pwszStartDir, szFile, NULL, _countof(szFile2), szFile2, NULL) ||
159bfcbda22SKatayama Hirofumi MZ                  SearchPathW(pwszStartDir, szFile, wszExe, _countof(szFile2), szFile2, NULL) ||
160bfcbda22SKatayama Hirofumi MZ                  SearchPathW(pwszStartDir, szFile, wszCom, _countof(szFile2), szFile2, NULL))
161bfcbda22SKatayama Hirofumi MZ         {
162bfcbda22SKatayama Hirofumi MZ             StringCchCopyW(szFile, _countof(szFile), szFile2);
163bfcbda22SKatayama Hirofumi MZ         }
164bfcbda22SKatayama Hirofumi MZ         else if (SearchPathW(NULL, lpCommand, NULL, _countof(szFile2), szFile2, NULL) ||
165bfcbda22SKatayama Hirofumi MZ                  SearchPathW(NULL, lpCommand, wszExe, _countof(szFile2), szFile2, NULL) ||
166bfcbda22SKatayama Hirofumi MZ                  SearchPathW(NULL, lpCommand, wszCom, _countof(szFile2), szFile2, NULL) ||
167bfcbda22SKatayama Hirofumi MZ                  SearchPathW(pwszStartDir, lpCommand, NULL, _countof(szFile2), szFile2, NULL) ||
168bfcbda22SKatayama Hirofumi MZ                  SearchPathW(pwszStartDir, lpCommand, wszExe, _countof(szFile2), szFile2, NULL) ||
169bfcbda22SKatayama Hirofumi MZ                  SearchPathW(pwszStartDir, lpCommand, wszCom, _countof(szFile2), szFile2, NULL))
170bfcbda22SKatayama Hirofumi MZ         {
171bfcbda22SKatayama Hirofumi MZ             StringCchCopyW(szFile, _countof(szFile), szFile2);
172bfcbda22SKatayama Hirofumi MZ             pchParams = NULL;
173bfcbda22SKatayama Hirofumi MZ         }
174bfcbda22SKatayama Hirofumi MZ 
175fc11cf78SKatayama Hirofumi MZ         if (pwszStartDir)
176fc11cf78SKatayama Hirofumi MZ         {
177fc11cf78SKatayama Hirofumi MZ             SetCurrentDirectoryW(szCurDir);
178fc11cf78SKatayama Hirofumi MZ         }
179fc11cf78SKatayama Hirofumi MZ 
180bfcbda22SKatayama Hirofumi MZ         if (!(dwSeclFlags & SECL_ALLOW_NONEXE))
181bfcbda22SKatayama Hirofumi MZ         {
182bfcbda22SKatayama Hirofumi MZ             if (!GetBinaryTypeW(szFile, &dwType))
183bfcbda22SKatayama Hirofumi MZ             {
184bfcbda22SKatayama Hirofumi MZ                 SHFree(lpCommand);
185bfcbda22SKatayama Hirofumi MZ 
186bfcbda22SKatayama Hirofumi MZ                 if (!(dwSeclFlags & SECL_NO_UI))
187bfcbda22SKatayama Hirofumi MZ                 {
188bfcbda22SKatayama Hirofumi MZ                     WCHAR szText[128 + MAX_PATH], szFormat[128];
189bfcbda22SKatayama Hirofumi MZ                     LoadStringW(shell32_hInstance, IDS_FILE_NOT_FOUND, szFormat, _countof(szFormat));
190bfcbda22SKatayama Hirofumi MZ                     StringCchPrintfW(szText, _countof(szText), szFormat, szFile);
191bfcbda22SKatayama Hirofumi MZ                     MessageBoxW(hwnd, szText, NULL, MB_ICONERROR);
192bfcbda22SKatayama Hirofumi MZ                 }
193bfcbda22SKatayama Hirofumi MZ                 return CO_E_APPNOTFOUND;
194bfcbda22SKatayama Hirofumi MZ             }
195bfcbda22SKatayama Hirofumi MZ         }
196bfcbda22SKatayama Hirofumi MZ         else
197bfcbda22SKatayama Hirofumi MZ         {
198bfcbda22SKatayama Hirofumi MZ             if (GetFileAttributesW(szFile) == INVALID_FILE_ATTRIBUTES)
199bfcbda22SKatayama Hirofumi MZ             {
200bfcbda22SKatayama Hirofumi MZ                 SHFree(lpCommand);
201bfcbda22SKatayama Hirofumi MZ 
202bfcbda22SKatayama Hirofumi MZ                 if (!(dwSeclFlags & SECL_NO_UI))
203bfcbda22SKatayama Hirofumi MZ                 {
204bfcbda22SKatayama Hirofumi MZ                     WCHAR szText[128 + MAX_PATH], szFormat[128];
205bfcbda22SKatayama Hirofumi MZ                     LoadStringW(shell32_hInstance, IDS_FILE_NOT_FOUND, szFormat, _countof(szFormat));
206bfcbda22SKatayama Hirofumi MZ                     StringCchPrintfW(szText, _countof(szText), szFormat, szFile);
207bfcbda22SKatayama Hirofumi MZ                     MessageBoxW(hwnd, szText, NULL, MB_ICONERROR);
208bfcbda22SKatayama Hirofumi MZ                 }
209bfcbda22SKatayama Hirofumi MZ                 return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
210bfcbda22SKatayama Hirofumi MZ             }
211bfcbda22SKatayama Hirofumi MZ         }
212bfcbda22SKatayama Hirofumi MZ     }
213bfcbda22SKatayama Hirofumi MZ 
214bfcbda22SKatayama Hirofumi MZ     ZeroMemory(&info, sizeof(info));
215bfcbda22SKatayama Hirofumi MZ     info.cbSize = sizeof(info);
216bfcbda22SKatayama Hirofumi MZ     info.fMask = dwFlags;
217bfcbda22SKatayama Hirofumi MZ     info.hwnd = hwnd;
218bfcbda22SKatayama Hirofumi MZ     info.lpVerb = pszVerb;
219bfcbda22SKatayama Hirofumi MZ     info.lpFile = szFile;
220bfcbda22SKatayama Hirofumi MZ     info.lpParameters = (pchParams && *pchParams) ? pchParams : NULL;
221bfcbda22SKatayama Hirofumi MZ     info.lpDirectory = pwszStartDir;
222bfcbda22SKatayama Hirofumi MZ     info.nShow = nShow;
223bfcbda22SKatayama Hirofumi MZ     if (ShellExecuteExW(&info))
224bfcbda22SKatayama Hirofumi MZ     {
225bfcbda22SKatayama Hirofumi MZ         if (info.lpIDList)
226bfcbda22SKatayama Hirofumi MZ             CoTaskMemFree(info.lpIDList);
227bfcbda22SKatayama Hirofumi MZ 
228bfcbda22SKatayama Hirofumi MZ         SHFree(lpCommand);
229bfcbda22SKatayama Hirofumi MZ 
230bfcbda22SKatayama Hirofumi MZ         return S_OK;
231bfcbda22SKatayama Hirofumi MZ     }
232bfcbda22SKatayama Hirofumi MZ 
233bfcbda22SKatayama Hirofumi MZ     dwError = GetLastError();
234bfcbda22SKatayama Hirofumi MZ 
235bfcbda22SKatayama Hirofumi MZ     SHFree(lpCommand);
236bfcbda22SKatayama Hirofumi MZ 
237bfcbda22SKatayama Hirofumi MZ     return HRESULT_FROM_WIN32(dwError);
238bfcbda22SKatayama Hirofumi MZ }
23978edea81SKatayama Hirofumi MZ 
24078edea81SKatayama Hirofumi MZ #undef ShellExecCmdLine
24178edea81SKatayama Hirofumi MZ 
242bfcbda22SKatayama Hirofumi MZ typedef HRESULT (WINAPI *SHELLEXECCMDLINE)(HWND, LPCWSTR, LPCWSTR, INT, LPVOID, DWORD);
243bfcbda22SKatayama Hirofumi MZ SHELLEXECCMDLINE g_pShellExecCmdLine = NULL;
244bfcbda22SKatayama Hirofumi MZ 
245bfcbda22SKatayama Hirofumi MZ typedef struct TEST_ENTRY
246bfcbda22SKatayama Hirofumi MZ {
247bfcbda22SKatayama Hirofumi MZ     INT lineno;
248afd349a9SKatayama Hirofumi MZ     BOOL result;
249bfcbda22SKatayama Hirofumi MZ     BOOL bAllowNonExe;
250bfcbda22SKatayama Hirofumi MZ     LPCWSTR pwszCommand;
251bfcbda22SKatayama Hirofumi MZ     LPCWSTR pwszStartDir;
252bfcbda22SKatayama Hirofumi MZ } TEST_ENTRY;
253bfcbda22SKatayama Hirofumi MZ 
254afd349a9SKatayama Hirofumi MZ static WCHAR s_sub_program[MAX_PATH];
255afd349a9SKatayama Hirofumi MZ static WCHAR s_win_test_exe[MAX_PATH];
256afd349a9SKatayama Hirofumi MZ static WCHAR s_sys_bat_file[MAX_PATH];
257afd349a9SKatayama Hirofumi MZ static WCHAR s_cur_dir[MAX_PATH];
258bfcbda22SKatayama Hirofumi MZ 
259afd349a9SKatayama Hirofumi MZ static BOOL
260afd349a9SKatayama Hirofumi MZ GetSubProgramPath(void)
261afd349a9SKatayama Hirofumi MZ {
262afd349a9SKatayama Hirofumi MZ     GetModuleFileNameW(NULL, s_sub_program, _countof(s_sub_program));
263afd349a9SKatayama Hirofumi MZ     PathRemoveFileSpecW(s_sub_program);
264afd349a9SKatayama Hirofumi MZ     PathAppendW(s_sub_program, L"shell32_apitest_sub.exe");
265afd349a9SKatayama Hirofumi MZ 
266afd349a9SKatayama Hirofumi MZ     if (!PathFileExistsW(s_sub_program))
267afd349a9SKatayama Hirofumi MZ     {
268afd349a9SKatayama Hirofumi MZ         PathRemoveFileSpecW(s_sub_program);
269afd349a9SKatayama Hirofumi MZ         PathAppendW(s_sub_program, L"testdata\\shell32_apitest_sub.exe");
270afd349a9SKatayama Hirofumi MZ 
271afd349a9SKatayama Hirofumi MZ         if (!PathFileExistsW(s_sub_program))
272afd349a9SKatayama Hirofumi MZ         {
273afd349a9SKatayama Hirofumi MZ             return FALSE;
274afd349a9SKatayama Hirofumi MZ         }
275afd349a9SKatayama Hirofumi MZ     }
276afd349a9SKatayama Hirofumi MZ 
277afd349a9SKatayama Hirofumi MZ     return TRUE;
278afd349a9SKatayama Hirofumi MZ }
279afd349a9SKatayama Hirofumi MZ 
280afd349a9SKatayama Hirofumi MZ static const TEST_ENTRY s_entries_1[] =
281bfcbda22SKatayama Hirofumi MZ {
282bfcbda22SKatayama Hirofumi MZ     // NULL
283afd349a9SKatayama Hirofumi MZ     { __LINE__, 0xBADFACE, FALSE, NULL, NULL },
284afd349a9SKatayama Hirofumi MZ     { __LINE__, 0xBADFACE, FALSE, NULL, L"." },
285afd349a9SKatayama Hirofumi MZ     { __LINE__, 0xBADFACE, FALSE, NULL, L"system32" },
286afd349a9SKatayama Hirofumi MZ     { __LINE__, 0xBADFACE, FALSE, NULL, L"C:\\Program Files" },
287afd349a9SKatayama Hirofumi MZ     { __LINE__, 0xBADFACE, TRUE, NULL, NULL },
288afd349a9SKatayama Hirofumi MZ     { __LINE__, 0xBADFACE, TRUE, NULL, L"." },
289afd349a9SKatayama Hirofumi MZ     { __LINE__, 0xBADFACE, TRUE, NULL, L"system32" },
290afd349a9SKatayama Hirofumi MZ     { __LINE__, 0xBADFACE, TRUE, NULL, L"C:\\Program Files" },
291bfcbda22SKatayama Hirofumi MZ     // notepad
292afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad", NULL },
293afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad", L"." },
294afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad", L"system32" },
295afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad", L"C:\\Program Files" },
296afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad \"Test File.txt\"", NULL },
297afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad \"Test File.txt\"", L"." },
298afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad", NULL },
299afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad", L"." },
300afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad", L"system32" },
301afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad", L"C:\\Program Files" },
302afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad \"Test File.txt\"", NULL },
303afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad \"Test File.txt\"", L"." },
304bfcbda22SKatayama Hirofumi MZ     // notepad.exe
305afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad.exe", NULL },
306afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad.exe", L"." },
307afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad.exe", L"system32" },
308afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad.exe", L"C:\\Program Files" },
309afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad.exe \"Test File.txt\"", NULL },
310afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"notepad.exe \"Test File.txt\"", L"." },
311afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad.exe", NULL },
312afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad.exe", L"." },
313afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad.exe", L"system32" },
314afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad.exe", L"C:\\Program Files" },
315afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad.exe \"Test File.txt\"", NULL },
316afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"notepad.exe \"Test File.txt\"", L"." },
317bfcbda22SKatayama Hirofumi MZ     // C:\notepad.exe
318afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"C:\\notepad.exe", NULL },
319afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"C:\\notepad.exe", L"." },
320afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"C:\\notepad.exe", L"system32" },
321afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"C:\\notepad.exe", L"C:\\Program Files" },
322afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"C:\\notepad.exe \"Test File.txt\"", NULL },
323afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"C:\\notepad.exe \"Test File.txt\"", L"." },
324afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"C:\\notepad.exe", NULL },
325afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"C:\\notepad.exe", L"." },
326afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"C:\\notepad.exe", L"system32" },
327afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"C:\\notepad.exe", L"C:\\Program Files" },
328afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"C:\\notepad.exe \"Test File.txt\"", NULL },
329afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"C:\\notepad.exe \"Test File.txt\"", L"." },
330bfcbda22SKatayama Hirofumi MZ     // "notepad"
331afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad\"", NULL },
332afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad\"", L"." },
333afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad\"", L"system32" },
334afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad\"", L"C:\\Program Files" },
335afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad\" \"Test File.txt\"", NULL },
336afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad\" \"Test File.txt\"", L"." },
337afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad\"", NULL },
338afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad\"", L"." },
339afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad\"", L"system32" },
340afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad\"", L"C:\\Program Files" },
341afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad\" \"Test File.txt\"", NULL },
342afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad\" \"Test File.txt\"", L"." },
343bfcbda22SKatayama Hirofumi MZ     // "notepad.exe"
344afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad.exe\"", NULL },
345afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad.exe\"", L"." },
346afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad.exe\"", L"system32" },
347afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad.exe\"", L"C:\\Program Files" },
348afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad.exe\" \"Test File.txt\"", NULL },
349afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"notepad.exe\" \"Test File.txt\"", L"." },
350afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad.exe\"", NULL },
351afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad.exe\"", L"." },
352afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad.exe\"", L"system32" },
353afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad.exe\"", L"C:\\Program Files" },
354afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad.exe\" \"Test File.txt\"", NULL },
355afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"notepad.exe\" \"Test File.txt\"", L"." },
356afd349a9SKatayama Hirofumi MZ     // test program
357afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program", NULL },
358afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program", L"." },
359afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program", L"system32" },
360afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program", L"C:\\Program Files" },
361afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program \"Test File.txt\"", NULL },
362afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program \"Test File.txt\"", L"." },
363afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program", NULL },
364afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program", L"." },
365afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program", L"system32" },
366afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program", L"C:\\Program Files" },
367afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program \"Test File.txt\"", NULL },
368afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program \"Test File.txt\"", L"." },
369bfcbda22SKatayama Hirofumi MZ     // test program.exe
370afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.exe", NULL },
371afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.exe", L"." },
372afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.exe", L"system32" },
373afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.exe", L"C:\\Program Files" },
374afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.exe \"Test File.txt\"", NULL },
375afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.exe \"Test File.txt\"", L"." },
376afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.exe", NULL },
377afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.exe", L"." },
378afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.exe", L"system32" },
379afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.exe", L"C:\\Program Files" },
380afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.exe \"Test File.txt\"", NULL },
381afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.exe \"Test File.txt\"", L"." },
382afd349a9SKatayama Hirofumi MZ     // test program.bat
383afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.bat", NULL },
384afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.bat", L"." },
385afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.bat", L"system32" },
386afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.bat", L"C:\\Program Files" },
387afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.bat \"Test File.txt\"", NULL },
388afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"test program.bat \"Test File.txt\"", L"." },
389afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.bat", NULL },
390afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.bat", L"." },
391afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.bat", L"system32" },
392afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.bat", L"C:\\Program Files" },
393afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.bat \"Test File.txt\"", NULL },
394afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"test program.bat \"Test File.txt\"", L"." },
395bfcbda22SKatayama Hirofumi MZ     // "test program"
396afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program\"", NULL },
397afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program\"", L"." },
398afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program\"", L"system32" },
399afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program\"", L"C:\\Program Files" },
400afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program\" \"Test File.txt\"", NULL },
401afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program\" \"Test File.txt\"", L"." },
402afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program\"", NULL },
403afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program\"", L"." },
404afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program\"", L"system32" },
405afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program\"", L"C:\\Program Files" },
406afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program\" \"Test File.txt\"", NULL },
407afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program\" \"Test File.txt\"", L"." },
408bfcbda22SKatayama Hirofumi MZ     // "test program.exe"
409afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"test program.exe\"", NULL },
410afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"test program.exe\"", L"." },
411afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"test program.exe\"", L"system32" },
412afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"test program.exe\"", L"C:\\Program Files" },
413afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"test program.exe\" \"Test File.txt\"", NULL },
414afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"\"test program.exe\" \"Test File.txt\"", L"." },
415afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"test program.exe\"", NULL },
416afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"test program.exe\"", L"." },
417afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"test program.exe\"", L"system32" },
418afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"test program.exe\"", L"C:\\Program Files" },
419afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"test program.exe\" \"Test File.txt\"", NULL },
420afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"test program.exe\" \"Test File.txt\"", L"." },
421afd349a9SKatayama Hirofumi MZ     // "test program.bat"
422afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program.bat\"", NULL },
423afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program.bat\"", L"." },
424afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program.bat\"", L"system32" },
425afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program.bat\"", L"C:\\Program Files" },
426afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program.bat\" \"Test File.txt\"", NULL },
427afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"test program.bat\" \"Test File.txt\"", L"." },
428afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program.bat\"", NULL },
429afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program.bat\"", L"." },
430afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program.bat\"", L"system32" },
431afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program.bat\"", L"C:\\Program Files" },
432afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program.bat\" \"Test File.txt\"", NULL },
433afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"test program.bat\" \"Test File.txt\"", L"." },
434bfcbda22SKatayama Hirofumi MZ     // invalid program
435afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"invalid program", NULL },
436afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"invalid program", L"." },
437afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"invalid program", L"system32" },
438afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"invalid program", L"C:\\Program Files" },
439afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"invalid program \"Test File.txt\"", NULL },
440afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"invalid program \"Test File.txt\"", L"." },
441afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"invalid program", NULL },
442afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"invalid program", L"." },
443afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"invalid program", L"system32" },
444afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"invalid program", L"C:\\Program Files" },
445afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"invalid program \"Test File.txt\"", NULL },
446afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"invalid program \"Test File.txt\"", L"." },
447bfcbda22SKatayama Hirofumi MZ     // \"invalid program.exe\"
448afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"invalid program.exe\"", NULL },
449afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"invalid program.exe\"", L"." },
450afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"invalid program.exe\"", L"system32" },
451afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"invalid program.exe\"", L"C:\\Program Files" },
452afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"invalid program.exe\" \"Test File.txt\"", NULL },
453afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"invalid program.exe\" \"Test File.txt\"", L"." },
454afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"invalid program.exe\"", NULL },
455afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"invalid program.exe\"", L"." },
456afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"invalid program.exe\"", L"system32" },
457afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"invalid program.exe\"", L"C:\\Program Files" },
458afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"invalid program.exe\" \"Test File.txt\"", NULL },
459afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"invalid program.exe\" \"Test File.txt\"", L"." },
46078edea81SKatayama Hirofumi MZ     // My Documents
461afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"::{450d8fba-ad25-11d0-98a8-0800361b1103}", NULL },
462afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"shell:::{450d8fba-ad25-11d0-98a8-0800361b1103}", NULL },
46355345930SKatayama Hirofumi MZ     // shell:sendto
464afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"shell:sendto", NULL },
465afd349a9SKatayama Hirofumi MZ     // iexplore.exe
466afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"iexplore", NULL },
467afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"iexplore.exe", NULL },
468afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"iexplore", NULL },
469afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"iexplore.exe", NULL },
470afd349a9SKatayama Hirofumi MZ     // https://google.com
471afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, FALSE, L"https://google.com", NULL },
472afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"https://google.com", NULL },
473afd349a9SKatayama Hirofumi MZ     // Test File 1.txt
474afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 1.txt", NULL },
475afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 1.txt", L"." },
476afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 1.txt", L"system32" },
477afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 1.txt", s_cur_dir },
478afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", NULL },
479afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", L"." },
480afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", L"system32" },
481afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", s_cur_dir },
482afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", NULL },
483afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", L"." },
484afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", L"system32" },
485afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 1.txt", NULL },
486afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"Test File 1.txt", L"." },
487afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 1.txt", L"system32" },
488afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"Test File 1.txt", s_cur_dir },
489afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 1.txt\"", NULL },
490afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", L"." },
491afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", L"system32" },
492afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", s_cur_dir },
493afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", NULL },
494afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", L"." },
495afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", L"system32" },
496afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", s_cur_dir },
497afd349a9SKatayama Hirofumi MZ     // Test File 2.bat
498afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 2.bat", NULL },
499afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 2.bat", L"." },
500afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 2.bat", L"system32" },
501afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 2.bat", s_cur_dir },
502afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", NULL },
503afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", L"." },
504afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", L"system32" },
505afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", s_cur_dir },
506afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", NULL },
507afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", L"." },
508afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", L"system32" },
509afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", s_cur_dir },
510afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 2.bat", NULL },
511afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 2.bat", L"." },
512afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 2.bat", L"system32" },
513afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 2.bat", s_cur_dir },
514afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", NULL },
515afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", L"." },
516afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", L"system32" },
517afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", s_cur_dir },
518afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", NULL },
519afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", L"." },
520afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", L"system32" },
521afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", s_cur_dir },
522bfcbda22SKatayama Hirofumi MZ };
523bfcbda22SKatayama Hirofumi MZ 
524afd349a9SKatayama Hirofumi MZ static const TEST_ENTRY s_entries_2[] =
525f37b94baSKatayama Hirofumi MZ {
526afd349a9SKatayama Hirofumi MZ     // Test File 1.txt (with setting path)
527afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 1.txt", NULL },
528afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 1.txt", L"." },
529afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 1.txt", L"system32" },
530afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 1.txt", s_cur_dir },
531afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", NULL },
532afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", L"." },
533afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", L"system32" },
534afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", s_cur_dir },
535afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", NULL },
536afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", L"." },
537afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", L"system32" },
538afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", s_cur_dir },
539afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 1.txt", NULL },
540afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"Test File 1.txt", L"." },
541afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 1.txt", L"system32" },
542afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"Test File 1.txt", s_cur_dir },
543afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", NULL },
544afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", L"." },
545afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", L"system32" },
546afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", s_cur_dir },
547afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", NULL },
548afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", L"." },
549afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", L"system32" },
550afd349a9SKatayama Hirofumi MZ     { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", s_cur_dir },
551afd349a9SKatayama Hirofumi MZ     // Test File 2.bat (with setting path)
552afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 2.bat", NULL },
553afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 2.bat", L"." },
554afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 2.bat", L"system32" },
555afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"Test File 2.bat", s_cur_dir },
556afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", NULL },
557afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", L"." },
558afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", L"system32" },
559afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", s_cur_dir },
560afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", NULL },
561afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", L"." },
562afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", L"system32" },
563afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", s_cur_dir },
564afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 2.bat", NULL },
565afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 2.bat", L"." },
566afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 2.bat", L"system32" },
567afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"Test File 2.bat", s_cur_dir },
568afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", NULL },
569afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", L"." },
570afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", L"system32" },
571afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", s_cur_dir },
572afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", NULL },
573afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", L"." },
574afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", L"system32" },
575afd349a9SKatayama Hirofumi MZ     { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", s_cur_dir },
576afd349a9SKatayama Hirofumi MZ };
577afd349a9SKatayama Hirofumi MZ 
578afd349a9SKatayama Hirofumi MZ typedef struct OPENWNDS
579f37b94baSKatayama Hirofumi MZ {
580afd349a9SKatayama Hirofumi MZ     UINT count;
581afd349a9SKatayama Hirofumi MZ     HWND *phwnd;
582afd349a9SKatayama Hirofumi MZ } OPENWNDS;
583afd349a9SKatayama Hirofumi MZ 
584afd349a9SKatayama Hirofumi MZ static OPENWNDS s_wi0 = { 0 }, s_wi1 = { 0 };
585afd349a9SKatayama Hirofumi MZ 
586afd349a9SKatayama Hirofumi MZ static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
587f37b94baSKatayama Hirofumi MZ {
588afd349a9SKatayama Hirofumi MZ     OPENWNDS *info = (OPENWNDS *)lParam;
589afd349a9SKatayama Hirofumi MZ     info->phwnd = (HWND *)realloc(info->phwnd, (info->count + 1) * sizeof(HWND));
590afd349a9SKatayama Hirofumi MZ     if (!info->phwnd)
591afd349a9SKatayama Hirofumi MZ         return FALSE;
592afd349a9SKatayama Hirofumi MZ     info->phwnd[info->count] = hwnd;
593afd349a9SKatayama Hirofumi MZ     ++(info->count);
594afd349a9SKatayama Hirofumi MZ     return TRUE;
595f37b94baSKatayama Hirofumi MZ }
596f37b94baSKatayama Hirofumi MZ 
597418edcd2SKatayama Hirofumi MZ static void CleanupNewlyCreatedWindows(void)
598418edcd2SKatayama Hirofumi MZ {
599418edcd2SKatayama Hirofumi MZ     EnumWindows(EnumWindowsProc, (LPARAM)&s_wi1);
600418edcd2SKatayama Hirofumi MZ     for (UINT i1 = 0; i1 < s_wi1.count; ++i1)
601418edcd2SKatayama Hirofumi MZ     {
602418edcd2SKatayama Hirofumi MZ         BOOL bFound = FALSE;
603418edcd2SKatayama Hirofumi MZ         for (UINT i0 = 0; i0 < s_wi0.count; ++i0)
604418edcd2SKatayama Hirofumi MZ         {
605418edcd2SKatayama Hirofumi MZ             if (s_wi1.phwnd[i1] == s_wi0.phwnd[i0])
606418edcd2SKatayama Hirofumi MZ             {
607418edcd2SKatayama Hirofumi MZ                 bFound = TRUE;
608418edcd2SKatayama Hirofumi MZ                 break;
609418edcd2SKatayama Hirofumi MZ             }
610418edcd2SKatayama Hirofumi MZ         }
611418edcd2SKatayama Hirofumi MZ         if (!bFound)
612*4bf32102SHermès Bélusca-Maïto             PostMessageW(s_wi1.phwnd[i1], WM_CLOSE, 0, 0);
613418edcd2SKatayama Hirofumi MZ     }
614418edcd2SKatayama Hirofumi MZ     free(s_wi1.phwnd);
615418edcd2SKatayama Hirofumi MZ     ZeroMemory(&s_wi1, sizeof(s_wi1));
616418edcd2SKatayama Hirofumi MZ }
617418edcd2SKatayama Hirofumi MZ 
618bfcbda22SKatayama Hirofumi MZ static void DoEntry(const TEST_ENTRY *pEntry)
619bfcbda22SKatayama Hirofumi MZ {
620bfcbda22SKatayama Hirofumi MZ     HRESULT hr;
621bfcbda22SKatayama Hirofumi MZ     DWORD dwSeclFlags;
622afd349a9SKatayama Hirofumi MZ     BOOL result;
623bfcbda22SKatayama Hirofumi MZ 
624bfcbda22SKatayama Hirofumi MZ     if (pEntry->bAllowNonExe)
625bfcbda22SKatayama Hirofumi MZ         dwSeclFlags = SECL_NO_UI | SECL_ALLOW_NONEXE;
626bfcbda22SKatayama Hirofumi MZ     else
627bfcbda22SKatayama Hirofumi MZ         dwSeclFlags = SECL_NO_UI;
628bfcbda22SKatayama Hirofumi MZ 
629bfcbda22SKatayama Hirofumi MZ     _SEH2_TRY
630bfcbda22SKatayama Hirofumi MZ     {
63178edea81SKatayama Hirofumi MZ         if (IsReactOS())
63278edea81SKatayama Hirofumi MZ         {
63378edea81SKatayama Hirofumi MZ             hr = proxy_ShellExecCmdLine(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
634bfcbda22SKatayama Hirofumi MZ                                         SW_SHOWNORMAL, NULL, dwSeclFlags);
63578edea81SKatayama Hirofumi MZ         }
63678edea81SKatayama Hirofumi MZ         else
63778edea81SKatayama Hirofumi MZ         {
638bfcbda22SKatayama Hirofumi MZ             hr = (*g_pShellExecCmdLine)(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
639bfcbda22SKatayama Hirofumi MZ                                         SW_SHOWNORMAL, NULL, dwSeclFlags);
64078edea81SKatayama Hirofumi MZ         }
641bfcbda22SKatayama Hirofumi MZ     }
642bfcbda22SKatayama Hirofumi MZ     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
643bfcbda22SKatayama Hirofumi MZ     {
644afd349a9SKatayama Hirofumi MZ         hr = 0xBADFACE;
645bfcbda22SKatayama Hirofumi MZ     }
646bfcbda22SKatayama Hirofumi MZ     _SEH2_END;
647bfcbda22SKatayama Hirofumi MZ 
648afd349a9SKatayama Hirofumi MZ     if (hr == 0xBADFACE)
649afd349a9SKatayama Hirofumi MZ         result = hr;
650afd349a9SKatayama Hirofumi MZ     else
651afd349a9SKatayama Hirofumi MZ         result = (hr == S_OK);
652bfcbda22SKatayama Hirofumi MZ 
653afd349a9SKatayama Hirofumi MZ     ok(result == pEntry->result, "Line %d: result expected %d, was %d\n",
654afd349a9SKatayama Hirofumi MZ        pEntry->lineno, pEntry->result, result);
655afd349a9SKatayama Hirofumi MZ 
656418edcd2SKatayama Hirofumi MZ     CleanupNewlyCreatedWindows();
657afd349a9SKatayama Hirofumi MZ }
658bfcbda22SKatayama Hirofumi MZ 
659bfcbda22SKatayama Hirofumi MZ START_TEST(ShellExecCmdLine)
660bfcbda22SKatayama Hirofumi MZ {
661bfcbda22SKatayama Hirofumi MZ     using namespace std;
662bfcbda22SKatayama Hirofumi MZ 
66378edea81SKatayama Hirofumi MZ     if (!IsReactOS())
66478edea81SKatayama Hirofumi MZ     {
665465745b6STimo Kreuzer         if (!IsWindowsVistaOrGreater())
666465745b6STimo Kreuzer         {
667465745b6STimo Kreuzer             skip("ShellExecCmdLine is not available on this platform\n");
668465745b6STimo Kreuzer             return;
669465745b6STimo Kreuzer         }
670465745b6STimo Kreuzer 
671bfcbda22SKatayama Hirofumi MZ         HMODULE hShell32 = GetModuleHandleA("shell32");
672bfcbda22SKatayama Hirofumi MZ         g_pShellExecCmdLine = (SHELLEXECCMDLINE)GetProcAddress(hShell32, (LPCSTR)(INT_PTR)265);
673bfcbda22SKatayama Hirofumi MZ         if (!g_pShellExecCmdLine)
674bfcbda22SKatayama Hirofumi MZ         {
675bfcbda22SKatayama Hirofumi MZ             skip("ShellExecCmdLine is not found\n");
676bfcbda22SKatayama Hirofumi MZ             return;
677bfcbda22SKatayama Hirofumi MZ         }
67878edea81SKatayama Hirofumi MZ     }
679bfcbda22SKatayama Hirofumi MZ 
680afd349a9SKatayama Hirofumi MZ     if (!GetSubProgramPath())
681afd349a9SKatayama Hirofumi MZ     {
682afd349a9SKatayama Hirofumi MZ         skip("shell32_apitest_sub.exe is not found\n");
683afd349a9SKatayama Hirofumi MZ         return;
684afd349a9SKatayama Hirofumi MZ     }
685f37b94baSKatayama Hirofumi MZ 
686afd349a9SKatayama Hirofumi MZ     // record open windows
687afd349a9SKatayama Hirofumi MZ     if (!EnumWindows(EnumWindowsProc, (LPARAM)&s_wi0))
688afd349a9SKatayama Hirofumi MZ     {
689afd349a9SKatayama Hirofumi MZ         skip("EnumWindows failed\n");
690afd349a9SKatayama Hirofumi MZ         free(s_wi0.phwnd);
691afd349a9SKatayama Hirofumi MZ         return;
692afd349a9SKatayama Hirofumi MZ     }
693afd349a9SKatayama Hirofumi MZ 
694afd349a9SKatayama Hirofumi MZ     // s_win_test_exe
695afd349a9SKatayama Hirofumi MZ     GetWindowsDirectoryW(s_win_test_exe, _countof(s_win_test_exe));
696afd349a9SKatayama Hirofumi MZ     PathAppendW(s_win_test_exe, L"test program.exe");
697afd349a9SKatayama Hirofumi MZ     BOOL ret = CopyFileW(s_sub_program, s_win_test_exe, FALSE);
698afd349a9SKatayama Hirofumi MZ     if (!ret)
699afd349a9SKatayama Hirofumi MZ     {
700afd349a9SKatayama Hirofumi MZ         skip("Please retry with admin rights\n");
701afd349a9SKatayama Hirofumi MZ         free(s_wi0.phwnd);
702afd349a9SKatayama Hirofumi MZ         return;
703afd349a9SKatayama Hirofumi MZ     }
704afd349a9SKatayama Hirofumi MZ 
705afd349a9SKatayama Hirofumi MZ     FILE *fp;
706afd349a9SKatayama Hirofumi MZ 
707afd349a9SKatayama Hirofumi MZ     // s_sys_bat_file
708afd349a9SKatayama Hirofumi MZ     GetSystemDirectoryW(s_sys_bat_file, _countof(s_sys_bat_file));
709afd349a9SKatayama Hirofumi MZ     PathAppendW(s_sys_bat_file, L"test program.bat");
710afd349a9SKatayama Hirofumi MZ     fp = _wfopen(s_sys_bat_file, L"wb");
711afd349a9SKatayama Hirofumi MZ     fclose(fp);
712afd349a9SKatayama Hirofumi MZ     ok_int(PathFileExistsW(s_sys_bat_file), TRUE);
713afd349a9SKatayama Hirofumi MZ 
714afd349a9SKatayama Hirofumi MZ     // "Test File 1.txt"
715afd349a9SKatayama Hirofumi MZ     fp = fopen("Test File 1.txt", "wb");
716bfcbda22SKatayama Hirofumi MZ     ok(fp != NULL, "failed to create a test file\n");
717bfcbda22SKatayama Hirofumi MZ     fclose(fp);
718afd349a9SKatayama Hirofumi MZ     ok_int(PathFileExistsA("Test File 1.txt"), TRUE);
719bfcbda22SKatayama Hirofumi MZ 
720afd349a9SKatayama Hirofumi MZ     // "Test File 2.bat"
721afd349a9SKatayama Hirofumi MZ     fp = fopen("Test File 2.bat", "wb");
722bfcbda22SKatayama Hirofumi MZ     ok(fp != NULL, "failed to create a test file\n");
723bfcbda22SKatayama Hirofumi MZ     fclose(fp);
724afd349a9SKatayama Hirofumi MZ     ok_int(PathFileExistsA("Test File 2.bat"), TRUE);
725bfcbda22SKatayama Hirofumi MZ 
726afd349a9SKatayama Hirofumi MZ     // s_cur_dir
727afd349a9SKatayama Hirofumi MZ     GetCurrentDirectoryW(_countof(s_cur_dir), s_cur_dir);
728afd349a9SKatayama Hirofumi MZ 
729afd349a9SKatayama Hirofumi MZ     // do tests
730afd349a9SKatayama Hirofumi MZ     for (size_t i = 0; i < _countof(s_entries_1); ++i)
731bfcbda22SKatayama Hirofumi MZ     {
732afd349a9SKatayama Hirofumi MZ         DoEntry(&s_entries_1[i]);
733bfcbda22SKatayama Hirofumi MZ     }
734afd349a9SKatayama Hirofumi MZ     SetEnvironmentVariableW(L"PATH", s_cur_dir);
735afd349a9SKatayama Hirofumi MZ     for (size_t i = 0; i < _countof(s_entries_2); ++i)
736bfcbda22SKatayama Hirofumi MZ     {
737afd349a9SKatayama Hirofumi MZ         DoEntry(&s_entries_2[i]);
738bfcbda22SKatayama Hirofumi MZ     }
739bfcbda22SKatayama Hirofumi MZ 
740418edcd2SKatayama Hirofumi MZ     Sleep(2000);
741418edcd2SKatayama Hirofumi MZ     CleanupNewlyCreatedWindows();
742418edcd2SKatayama Hirofumi MZ 
743bfcbda22SKatayama Hirofumi MZ     // clean up
744afd349a9SKatayama Hirofumi MZ     ok(DeleteFileW(s_win_test_exe), "failed to delete the test file\n");
745afd349a9SKatayama Hirofumi MZ     ok(DeleteFileW(s_sys_bat_file), "failed to delete the test file\n");
746afd349a9SKatayama Hirofumi MZ     ok(DeleteFileA("Test File 1.txt"), "failed to delete the test file\n");
747afd349a9SKatayama Hirofumi MZ     ok(DeleteFileA("Test File 2.bat"), "failed to delete the test file\n");
748afd349a9SKatayama Hirofumi MZ     free(s_wi0.phwnd);
74960b89da3SKatayama Hirofumi MZ 
75060b89da3SKatayama Hirofumi MZ     DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE);
75160b89da3SKatayama Hirofumi MZ     Sleep(100);
752bfcbda22SKatayama Hirofumi MZ }
753