ReactOS 0.4.16-dev-336-gb667d82
ShellExecCmdLine.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Test for ShellExecCmdLine
5 * PROGRAMMERS: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6 */
7#include "shelltest.h"
8#include <shlwapi.h>
9#include <strsafe.h>
10#include <versionhelpers.h>
11#include "shell32_apitest_sub.h"
12
13#define NDEBUG
14#include <debug.h>
15#include <stdio.h>
16
17#ifndef SECL_NO_UI
18 #define SECL_NO_UI 0x2
19 #define SECL_LOG_USAGE 0x8
20 #define SECL_USE_IDLIST 0x10
21 #define SECL_ALLOW_NONEXE 0x20
22 #define SECL_RUNAS 0x40
23#endif
24
25#define ShellExecCmdLine proxy_ShellExecCmdLine
26
27#define shell32_hInstance GetModuleHandle(NULL)
28#define IDS_FILE_NOT_FOUND (-1)
29
30static const WCHAR wszOpen[] = L"open";
31static const WCHAR wszExe[] = L".exe";
32static const WCHAR wszCom[] = L".com";
33
34static __inline void __SHCloneStrW(WCHAR **target, const WCHAR *source)
35{
36 *target = (WCHAR *)SHAlloc((lstrlenW(source) + 1) * sizeof(WCHAR) );
38}
39
40// NOTE: You have to sync the following code to dll/win32/shell32/shlexec.cpp.
41static LPCWSTR
42SplitParams(LPCWSTR psz, LPWSTR pszArg0, size_t cchArg0)
43{
45 size_t ich = 0;
46 if (*psz == L'"')
47 {
48 // 1st argument is quoted. the string in quotes is quoted 1st argument.
49 // [pch] --> [pszArg0+ich]
50 for (pch = psz + 1; *pch && ich + 1 < cchArg0; ++ich, ++pch)
51 {
52 if (*pch == L'"' && pch[1] == L'"')
53 {
54 // doubled double quotations found!
55 pszArg0[ich] = L'"';
56 }
57 else if (*pch == L'"')
58 {
59 // single double quotation found!
60 ++pch;
61 break;
62 }
63 else
64 {
65 // otherwise
66 pszArg0[ich] = *pch;
67 }
68 }
69 }
70 else
71 {
72 // 1st argument is unquoted. non-space sequence is 1st argument.
73 // [pch] --> [pszArg0+ich]
74 for (pch = psz; *pch && !iswspace(*pch) && ich + 1 < cchArg0; ++ich, ++pch)
75 {
76 pszArg0[ich] = *pch;
77 }
78 }
79 pszArg0[ich] = 0;
80
81 // skip space
82 while (iswspace(*pch))
83 ++pch;
84
85 return pch;
86}
87
89 HWND hwnd,
90 LPCWSTR pwszCommand,
91 LPCWSTR pwszStartDir,
92 int nShow,
93 LPVOID pUnused,
94 DWORD dwSeclFlags)
95{
98 LPCWSTR pszVerb = NULL;
99 WCHAR szFile[MAX_PATH], szFile2[MAX_PATH];
100 HRESULT hr;
101 LPCWSTR pchParams;
102 LPWSTR lpCommand = NULL;
103
104 if (pwszCommand == NULL)
106 1, (ULONG_PTR*)pwszCommand);
107
108 __SHCloneStrW(&lpCommand, pwszCommand);
109 StrTrimW(lpCommand, L" \t");
110
111 if (dwSeclFlags & SECL_NO_UI)
113 if (dwSeclFlags & SECL_LOG_USAGE)
115 if (dwSeclFlags & SECL_USE_IDLIST)
117
118 if (dwSeclFlags & SECL_RUNAS)
119 {
120 dwSize = 0;
121 hr = AssocQueryStringW(0, ASSOCSTR_COMMAND, lpCommand, L"RunAs", NULL, &dwSize);
122 if (SUCCEEDED(hr) && dwSize != 0)
123 {
124 pszVerb = L"runas";
125 }
126 }
127
128 if (UrlIsFileUrlW(lpCommand))
129 {
130 StringCchCopyW(szFile, _countof(szFile), lpCommand);
131 pchParams = NULL;
132 }
133 else
134 {
135 pchParams = SplitParams(lpCommand, szFile, _countof(szFile));
136 if (szFile[0] != UNICODE_NULL && szFile[1] == L':' &&
137 szFile[2] == UNICODE_NULL)
138 {
139 PathAddBackslashW(szFile);
140 }
141
142 WCHAR szCurDir[MAX_PATH];
143 GetCurrentDirectoryW(_countof(szCurDir), szCurDir);
144 if (pwszStartDir)
145 {
146 SetCurrentDirectoryW(pwszStartDir);
147 }
148
149 if (PathIsRelativeW(szFile) &&
150 GetFullPathNameW(szFile, _countof(szFile2), szFile2, NULL) &&
151 PathFileExistsW(szFile2))
152 {
153 StringCchCopyW(szFile, _countof(szFile), szFile2);
154 }
155 else if (SearchPathW(NULL, szFile, NULL, _countof(szFile2), szFile2, NULL) ||
156 SearchPathW(NULL, szFile, wszExe, _countof(szFile2), szFile2, NULL) ||
157 SearchPathW(NULL, szFile, wszCom, _countof(szFile2), szFile2, NULL) ||
158 SearchPathW(pwszStartDir, szFile, NULL, _countof(szFile2), szFile2, NULL) ||
159 SearchPathW(pwszStartDir, szFile, wszExe, _countof(szFile2), szFile2, NULL) ||
160 SearchPathW(pwszStartDir, szFile, wszCom, _countof(szFile2), szFile2, NULL))
161 {
162 StringCchCopyW(szFile, _countof(szFile), szFile2);
163 }
164 else if (SearchPathW(NULL, lpCommand, NULL, _countof(szFile2), szFile2, NULL) ||
165 SearchPathW(NULL, lpCommand, wszExe, _countof(szFile2), szFile2, NULL) ||
166 SearchPathW(NULL, lpCommand, wszCom, _countof(szFile2), szFile2, NULL) ||
167 SearchPathW(pwszStartDir, lpCommand, NULL, _countof(szFile2), szFile2, NULL) ||
168 SearchPathW(pwszStartDir, lpCommand, wszExe, _countof(szFile2), szFile2, NULL) ||
169 SearchPathW(pwszStartDir, lpCommand, wszCom, _countof(szFile2), szFile2, NULL))
170 {
171 StringCchCopyW(szFile, _countof(szFile), szFile2);
172 pchParams = NULL;
173 }
174
175 if (pwszStartDir)
176 {
177 SetCurrentDirectoryW(szCurDir);
178 }
179
180 if (!(dwSeclFlags & SECL_ALLOW_NONEXE))
181 {
182 if (!GetBinaryTypeW(szFile, &dwType))
183 {
184 SHFree(lpCommand);
185
186 if (!(dwSeclFlags & SECL_NO_UI))
187 {
188 WCHAR szText[128 + MAX_PATH], szFormat[128];
190 StringCchPrintfW(szText, _countof(szText), szFormat, szFile);
192 }
193 return CO_E_APPNOTFOUND;
194 }
195 }
196 else
197 {
199 {
200 SHFree(lpCommand);
201
202 if (!(dwSeclFlags & SECL_NO_UI))
203 {
204 WCHAR szText[128 + MAX_PATH], szFormat[128];
206 StringCchPrintfW(szText, _countof(szText), szFormat, szFile);
208 }
210 }
211 }
212 }
213
214 ZeroMemory(&info, sizeof(info));
215 info.cbSize = sizeof(info);
216 info.fMask = dwFlags;
217 info.hwnd = hwnd;
218 info.lpVerb = pszVerb;
219 info.lpFile = szFile;
220 info.lpParameters = (pchParams && *pchParams) ? pchParams : NULL;
221 info.lpDirectory = pwszStartDir;
222 info.nShow = nShow;
223 if (ShellExecuteExW(&info))
224 {
225 if (info.lpIDList)
226 CoTaskMemFree(info.lpIDList);
227
228 SHFree(lpCommand);
229
230 return S_OK;
231 }
232
233 dwError = GetLastError();
234
235 SHFree(lpCommand);
236
237 return HRESULT_FROM_WIN32(dwError);
238}
239
240#undef ShellExecCmdLine
241
244
245typedef struct TEST_ENTRY
246{
247 INT lineno;
253
258
259static const TEST_ENTRY s_entries_1[] =
260{
261 // NULL
262 { __LINE__, 0xBADFACE, FALSE, NULL, NULL },
263 { __LINE__, 0xBADFACE, FALSE, NULL, L"." },
264 { __LINE__, 0xBADFACE, FALSE, NULL, L"system32" },
265 { __LINE__, 0xBADFACE, FALSE, NULL, L"C:\\Program Files" },
266 { __LINE__, 0xBADFACE, TRUE, NULL, NULL },
267 { __LINE__, 0xBADFACE, TRUE, NULL, L"." },
268 { __LINE__, 0xBADFACE, TRUE, NULL, L"system32" },
269 { __LINE__, 0xBADFACE, TRUE, NULL, L"C:\\Program Files" },
270 // notepad
271 { __LINE__, TRUE, FALSE, L"notepad", NULL },
272 { __LINE__, TRUE, FALSE, L"notepad", L"." },
273 { __LINE__, TRUE, FALSE, L"notepad", L"system32" },
274 { __LINE__, TRUE, FALSE, L"notepad", L"C:\\Program Files" },
275 { __LINE__, TRUE, FALSE, L"notepad \"Test File.txt\"", NULL },
276 { __LINE__, TRUE, FALSE, L"notepad \"Test File.txt\"", L"." },
277 { __LINE__, TRUE, TRUE, L"notepad", NULL },
278 { __LINE__, TRUE, TRUE, L"notepad", L"." },
279 { __LINE__, TRUE, TRUE, L"notepad", L"system32" },
280 { __LINE__, TRUE, TRUE, L"notepad", L"C:\\Program Files" },
281 { __LINE__, TRUE, TRUE, L"notepad \"Test File.txt\"", NULL },
282 { __LINE__, TRUE, TRUE, L"notepad \"Test File.txt\"", L"." },
283 // notepad.exe
284 { __LINE__, TRUE, FALSE, L"notepad.exe", NULL },
285 { __LINE__, TRUE, FALSE, L"notepad.exe", L"." },
286 { __LINE__, TRUE, FALSE, L"notepad.exe", L"system32" },
287 { __LINE__, TRUE, FALSE, L"notepad.exe", L"C:\\Program Files" },
288 { __LINE__, TRUE, FALSE, L"notepad.exe \"Test File.txt\"", NULL },
289 { __LINE__, TRUE, FALSE, L"notepad.exe \"Test File.txt\"", L"." },
290 { __LINE__, TRUE, TRUE, L"notepad.exe", NULL },
291 { __LINE__, TRUE, TRUE, L"notepad.exe", L"." },
292 { __LINE__, TRUE, TRUE, L"notepad.exe", L"system32" },
293 { __LINE__, TRUE, TRUE, L"notepad.exe", L"C:\\Program Files" },
294 { __LINE__, TRUE, TRUE, L"notepad.exe \"Test File.txt\"", NULL },
295 { __LINE__, TRUE, TRUE, L"notepad.exe \"Test File.txt\"", L"." },
296 // C:\notepad.exe
297 { __LINE__, FALSE, FALSE, L"C:\\notepad.exe", NULL },
298 { __LINE__, FALSE, FALSE, L"C:\\notepad.exe", L"." },
299 { __LINE__, FALSE, FALSE, L"C:\\notepad.exe", L"system32" },
300 { __LINE__, FALSE, FALSE, L"C:\\notepad.exe", L"C:\\Program Files" },
301 { __LINE__, FALSE, FALSE, L"C:\\notepad.exe \"Test File.txt\"", NULL },
302 { __LINE__, FALSE, FALSE, L"C:\\notepad.exe \"Test File.txt\"", L"." },
303 { __LINE__, FALSE, TRUE, L"C:\\notepad.exe", NULL },
304 { __LINE__, FALSE, TRUE, L"C:\\notepad.exe", L"." },
305 { __LINE__, FALSE, TRUE, L"C:\\notepad.exe", L"system32" },
306 { __LINE__, FALSE, TRUE, L"C:\\notepad.exe", L"C:\\Program Files" },
307 { __LINE__, FALSE, TRUE, L"C:\\notepad.exe \"Test File.txt\"", NULL },
308 { __LINE__, FALSE, TRUE, L"C:\\notepad.exe \"Test File.txt\"", L"." },
309 // "notepad"
310 { __LINE__, TRUE, FALSE, L"\"notepad\"", NULL },
311 { __LINE__, TRUE, FALSE, L"\"notepad\"", L"." },
312 { __LINE__, TRUE, FALSE, L"\"notepad\"", L"system32" },
313 { __LINE__, TRUE, FALSE, L"\"notepad\"", L"C:\\Program Files" },
314 { __LINE__, TRUE, FALSE, L"\"notepad\" \"Test File.txt\"", NULL },
315 { __LINE__, TRUE, FALSE, L"\"notepad\" \"Test File.txt\"", L"." },
316 { __LINE__, TRUE, TRUE, L"\"notepad\"", NULL },
317 { __LINE__, TRUE, TRUE, L"\"notepad\"", L"." },
318 { __LINE__, TRUE, TRUE, L"\"notepad\"", L"system32" },
319 { __LINE__, TRUE, TRUE, L"\"notepad\"", L"C:\\Program Files" },
320 { __LINE__, TRUE, TRUE, L"\"notepad\" \"Test File.txt\"", NULL },
321 { __LINE__, TRUE, TRUE, L"\"notepad\" \"Test File.txt\"", L"." },
322 // "notepad.exe"
323 { __LINE__, TRUE, FALSE, L"\"notepad.exe\"", NULL },
324 { __LINE__, TRUE, FALSE, L"\"notepad.exe\"", L"." },
325 { __LINE__, TRUE, FALSE, L"\"notepad.exe\"", L"system32" },
326 { __LINE__, TRUE, FALSE, L"\"notepad.exe\"", L"C:\\Program Files" },
327 { __LINE__, TRUE, FALSE, L"\"notepad.exe\" \"Test File.txt\"", NULL },
328 { __LINE__, TRUE, FALSE, L"\"notepad.exe\" \"Test File.txt\"", L"." },
329 { __LINE__, TRUE, TRUE, L"\"notepad.exe\"", NULL },
330 { __LINE__, TRUE, TRUE, L"\"notepad.exe\"", L"." },
331 { __LINE__, TRUE, TRUE, L"\"notepad.exe\"", L"system32" },
332 { __LINE__, TRUE, TRUE, L"\"notepad.exe\"", L"C:\\Program Files" },
333 { __LINE__, TRUE, TRUE, L"\"notepad.exe\" \"Test File.txt\"", NULL },
334 { __LINE__, TRUE, TRUE, L"\"notepad.exe\" \"Test File.txt\"", L"." },
335 // test program
336 { __LINE__, FALSE, FALSE, L"test program", NULL },
337 { __LINE__, FALSE, FALSE, L"test program", L"." },
338 { __LINE__, FALSE, FALSE, L"test program", L"system32" },
339 { __LINE__, FALSE, FALSE, L"test program", L"C:\\Program Files" },
340 { __LINE__, FALSE, FALSE, L"test program \"Test File.txt\"", NULL },
341 { __LINE__, FALSE, FALSE, L"test program \"Test File.txt\"", L"." },
342 { __LINE__, FALSE, TRUE, L"test program", NULL },
343 { __LINE__, FALSE, TRUE, L"test program", L"." },
344 { __LINE__, FALSE, TRUE, L"test program", L"system32" },
345 { __LINE__, FALSE, TRUE, L"test program", L"C:\\Program Files" },
346 { __LINE__, FALSE, TRUE, L"test program \"Test File.txt\"", NULL },
347 { __LINE__, FALSE, TRUE, L"test program \"Test File.txt\"", L"." },
348 // test program.exe
349 { __LINE__, FALSE, FALSE, L"test program.exe", NULL },
350 { __LINE__, FALSE, FALSE, L"test program.exe", L"." },
351 { __LINE__, FALSE, FALSE, L"test program.exe", L"system32" },
352 { __LINE__, FALSE, FALSE, L"test program.exe", L"C:\\Program Files" },
353 { __LINE__, FALSE, FALSE, L"test program.exe \"Test File.txt\"", NULL },
354 { __LINE__, FALSE, FALSE, L"test program.exe \"Test File.txt\"", L"." },
355 { __LINE__, FALSE, TRUE, L"test program.exe", NULL },
356 { __LINE__, FALSE, TRUE, L"test program.exe", L"." },
357 { __LINE__, FALSE, TRUE, L"test program.exe", L"system32" },
358 { __LINE__, FALSE, TRUE, L"test program.exe", L"C:\\Program Files" },
359 { __LINE__, FALSE, TRUE, L"test program.exe \"Test File.txt\"", NULL },
360 { __LINE__, FALSE, TRUE, L"test program.exe \"Test File.txt\"", L"." },
361 // test program.bat
362 { __LINE__, FALSE, FALSE, L"test program.bat", NULL },
363 { __LINE__, FALSE, FALSE, L"test program.bat", L"." },
364 { __LINE__, FALSE, FALSE, L"test program.bat", L"system32" },
365 { __LINE__, FALSE, FALSE, L"test program.bat", L"C:\\Program Files" },
366 { __LINE__, FALSE, FALSE, L"test program.bat \"Test File.txt\"", NULL },
367 { __LINE__, FALSE, FALSE, L"test program.bat \"Test File.txt\"", L"." },
368 { __LINE__, FALSE, TRUE, L"test program.bat", NULL },
369 { __LINE__, FALSE, TRUE, L"test program.bat", L"." },
370 { __LINE__, FALSE, TRUE, L"test program.bat", L"system32" },
371 { __LINE__, FALSE, TRUE, L"test program.bat", L"C:\\Program Files" },
372 { __LINE__, FALSE, TRUE, L"test program.bat \"Test File.txt\"", NULL },
373 { __LINE__, FALSE, TRUE, L"test program.bat \"Test File.txt\"", L"." },
374 // "test program"
375 { __LINE__, FALSE, FALSE, L"\"test program\"", NULL },
376 { __LINE__, FALSE, FALSE, L"\"test program\"", L"." },
377 { __LINE__, FALSE, FALSE, L"\"test program\"", L"system32" },
378 { __LINE__, FALSE, FALSE, L"\"test program\"", L"C:\\Program Files" },
379 { __LINE__, FALSE, FALSE, L"\"test program\" \"Test File.txt\"", NULL },
380 { __LINE__, FALSE, FALSE, L"\"test program\" \"Test File.txt\"", L"." },
381 { __LINE__, FALSE, TRUE, L"\"test program\"", NULL },
382 { __LINE__, FALSE, TRUE, L"\"test program\"", L"." },
383 { __LINE__, FALSE, TRUE, L"\"test program\"", L"system32" },
384 { __LINE__, FALSE, TRUE, L"\"test program\"", L"C:\\Program Files" },
385 { __LINE__, FALSE, TRUE, L"\"test program\" \"Test File.txt\"", NULL },
386 { __LINE__, FALSE, TRUE, L"\"test program\" \"Test File.txt\"", L"." },
387 // "test program.exe"
388 { __LINE__, TRUE, FALSE, L"\"test program.exe\"", NULL },
389 { __LINE__, TRUE, FALSE, L"\"test program.exe\"", L"." },
390 { __LINE__, TRUE, FALSE, L"\"test program.exe\"", L"system32" },
391 { __LINE__, TRUE, FALSE, L"\"test program.exe\"", L"C:\\Program Files" },
392 { __LINE__, TRUE, FALSE, L"\"test program.exe\" \"Test File.txt\"", NULL },
393 { __LINE__, TRUE, FALSE, L"\"test program.exe\" \"Test File.txt\"", L"." },
394 { __LINE__, TRUE, TRUE, L"\"test program.exe\"", NULL },
395 { __LINE__, TRUE, TRUE, L"\"test program.exe\"", L"." },
396 { __LINE__, TRUE, TRUE, L"\"test program.exe\"", L"system32" },
397 { __LINE__, TRUE, TRUE, L"\"test program.exe\"", L"C:\\Program Files" },
398 { __LINE__, TRUE, TRUE, L"\"test program.exe\" \"Test File.txt\"", NULL },
399 { __LINE__, TRUE, TRUE, L"\"test program.exe\" \"Test File.txt\"", L"." },
400 // "test program.bat"
401 { __LINE__, FALSE, FALSE, L"\"test program.bat\"", NULL },
402 { __LINE__, FALSE, FALSE, L"\"test program.bat\"", L"." },
403 { __LINE__, FALSE, FALSE, L"\"test program.bat\"", L"system32" },
404 { __LINE__, FALSE, FALSE, L"\"test program.bat\"", L"C:\\Program Files" },
405 { __LINE__, FALSE, FALSE, L"\"test program.bat\" \"Test File.txt\"", NULL },
406 { __LINE__, FALSE, FALSE, L"\"test program.bat\" \"Test File.txt\"", L"." },
407 { __LINE__, FALSE, TRUE, L"\"test program.bat\"", NULL },
408 { __LINE__, FALSE, TRUE, L"\"test program.bat\"", L"." },
409 { __LINE__, FALSE, TRUE, L"\"test program.bat\"", L"system32" },
410 { __LINE__, FALSE, TRUE, L"\"test program.bat\"", L"C:\\Program Files" },
411 { __LINE__, FALSE, TRUE, L"\"test program.bat\" \"Test File.txt\"", NULL },
412 { __LINE__, FALSE, TRUE, L"\"test program.bat\" \"Test File.txt\"", L"." },
413 // invalid program
414 { __LINE__, FALSE, FALSE, L"invalid program", NULL },
415 { __LINE__, FALSE, FALSE, L"invalid program", L"." },
416 { __LINE__, FALSE, FALSE, L"invalid program", L"system32" },
417 { __LINE__, FALSE, FALSE, L"invalid program", L"C:\\Program Files" },
418 { __LINE__, FALSE, FALSE, L"invalid program \"Test File.txt\"", NULL },
419 { __LINE__, FALSE, FALSE, L"invalid program \"Test File.txt\"", L"." },
420 { __LINE__, FALSE, TRUE, L"invalid program", NULL },
421 { __LINE__, FALSE, TRUE, L"invalid program", L"." },
422 { __LINE__, FALSE, TRUE, L"invalid program", L"system32" },
423 { __LINE__, FALSE, TRUE, L"invalid program", L"C:\\Program Files" },
424 { __LINE__, FALSE, TRUE, L"invalid program \"Test File.txt\"", NULL },
425 { __LINE__, FALSE, TRUE, L"invalid program \"Test File.txt\"", L"." },
426 // \"invalid program.exe\"
427 { __LINE__, FALSE, FALSE, L"\"invalid program.exe\"", NULL },
428 { __LINE__, FALSE, FALSE, L"\"invalid program.exe\"", L"." },
429 { __LINE__, FALSE, FALSE, L"\"invalid program.exe\"", L"system32" },
430 { __LINE__, FALSE, FALSE, L"\"invalid program.exe\"", L"C:\\Program Files" },
431 { __LINE__, FALSE, FALSE, L"\"invalid program.exe\" \"Test File.txt\"", NULL },
432 { __LINE__, FALSE, FALSE, L"\"invalid program.exe\" \"Test File.txt\"", L"." },
433 { __LINE__, FALSE, TRUE, L"\"invalid program.exe\"", NULL },
434 { __LINE__, FALSE, TRUE, L"\"invalid program.exe\"", L"." },
435 { __LINE__, FALSE, TRUE, L"\"invalid program.exe\"", L"system32" },
436 { __LINE__, FALSE, TRUE, L"\"invalid program.exe\"", L"C:\\Program Files" },
437 { __LINE__, FALSE, TRUE, L"\"invalid program.exe\" \"Test File.txt\"", NULL },
438 { __LINE__, FALSE, TRUE, L"\"invalid program.exe\" \"Test File.txt\"", L"." },
439 // My Documents
440 { __LINE__, TRUE, TRUE, L"::{450d8fba-ad25-11d0-98a8-0800361b1103}", NULL },
441 { __LINE__, TRUE, TRUE, L"shell:::{450d8fba-ad25-11d0-98a8-0800361b1103}", NULL },
442 // shell:sendto
443 { __LINE__, TRUE, TRUE, L"shell:sendto", NULL },
444 // https://google.com
445 { __LINE__, TRUE, FALSE, L"https://google.com", NULL },
446 { __LINE__, TRUE, TRUE, L"https://google.com", NULL },
447 // Test File 1.txt
448 { __LINE__, FALSE, FALSE, L"Test File 1.txt", NULL },
449 { __LINE__, FALSE, FALSE, L"Test File 1.txt", L"." },
450 { __LINE__, FALSE, FALSE, L"Test File 1.txt", L"system32" },
451 { __LINE__, FALSE, FALSE, L"Test File 1.txt", s_cur_dir },
452 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", NULL },
453 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", L"." },
454 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", L"system32" },
455 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", s_cur_dir },
456 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", NULL },
457 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", L"." },
458 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", L"system32" },
459 { __LINE__, FALSE, TRUE, L"Test File 1.txt", NULL },
460 { __LINE__, TRUE, TRUE, L"Test File 1.txt", L"." },
461 { __LINE__, FALSE, TRUE, L"Test File 1.txt", L"system32" },
462 { __LINE__, TRUE, TRUE, L"Test File 1.txt", s_cur_dir },
463 { __LINE__, FALSE, TRUE, L"\"Test File 1.txt\"", NULL },
464 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", L"." },
465 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", L"system32" },
466 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", s_cur_dir },
467 { __LINE__, FALSE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", NULL },
468 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", L"." },
469 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", L"system32" },
470 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", s_cur_dir },
471 // Test File 2.bat
472 { __LINE__, FALSE, FALSE, L"Test File 2.bat", NULL },
473 { __LINE__, FALSE, FALSE, L"Test File 2.bat", L"." },
474 { __LINE__, FALSE, FALSE, L"Test File 2.bat", L"system32" },
475 { __LINE__, FALSE, FALSE, L"Test File 2.bat", s_cur_dir },
476 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", NULL },
477 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", L"." },
478 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", L"system32" },
479 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", s_cur_dir },
480 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", NULL },
481 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", L"." },
482 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", L"system32" },
483 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", s_cur_dir },
484 { __LINE__, FALSE, TRUE, L"Test File 2.bat", NULL },
485 { __LINE__, FALSE, TRUE, L"Test File 2.bat", L"." },
486 { __LINE__, FALSE, TRUE, L"Test File 2.bat", L"system32" },
487 { __LINE__, FALSE, TRUE, L"Test File 2.bat", s_cur_dir },
488 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", NULL },
489 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", L"." },
490 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", L"system32" },
491 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", s_cur_dir },
492 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", NULL },
493 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", L"." },
494 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", L"system32" },
495 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", s_cur_dir },
496};
497
498static const TEST_ENTRY s_entries_2[] =
499{
500 // Test File 1.txt (with setting path)
501 { __LINE__, FALSE, FALSE, L"Test File 1.txt", NULL },
502 { __LINE__, FALSE, FALSE, L"Test File 1.txt", L"." },
503 { __LINE__, FALSE, FALSE, L"Test File 1.txt", L"system32" },
504 { __LINE__, FALSE, FALSE, L"Test File 1.txt", s_cur_dir },
505 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", NULL },
506 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", L"." },
507 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", L"system32" },
508 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\"", s_cur_dir },
509 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", NULL },
510 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", L"." },
511 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", L"system32" },
512 { __LINE__, FALSE, FALSE, L"\"Test File 1.txt\" \"Test File.txt\"", s_cur_dir },
513 { __LINE__, FALSE, TRUE, L"Test File 1.txt", NULL },
514 { __LINE__, TRUE, TRUE, L"Test File 1.txt", L"." },
515 { __LINE__, FALSE, TRUE, L"Test File 1.txt", L"system32" },
516 { __LINE__, TRUE, TRUE, L"Test File 1.txt", s_cur_dir },
517 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", NULL },
518 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", L"." },
519 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", L"system32" },
520 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\"", s_cur_dir },
521 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", NULL },
522 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", L"." },
523 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", L"system32" },
524 { __LINE__, TRUE, TRUE, L"\"Test File 1.txt\" \"Test File.txt\"", s_cur_dir },
525 // Test File 2.bat (with setting path)
526 { __LINE__, FALSE, FALSE, L"Test File 2.bat", NULL },
527 { __LINE__, FALSE, FALSE, L"Test File 2.bat", L"." },
528 { __LINE__, FALSE, FALSE, L"Test File 2.bat", L"system32" },
529 { __LINE__, FALSE, FALSE, L"Test File 2.bat", s_cur_dir },
530 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", NULL },
531 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", L"." },
532 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", L"system32" },
533 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\"", s_cur_dir },
534 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", NULL },
535 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", L"." },
536 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", L"system32" },
537 { __LINE__, FALSE, FALSE, L"\"Test File 2.bat\" \"Test File.txt\"", s_cur_dir },
538 { __LINE__, FALSE, TRUE, L"Test File 2.bat", NULL },
539 { __LINE__, FALSE, TRUE, L"Test File 2.bat", L"." },
540 { __LINE__, FALSE, TRUE, L"Test File 2.bat", L"system32" },
541 { __LINE__, FALSE, TRUE, L"Test File 2.bat", s_cur_dir },
542 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", NULL },
543 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", L"." },
544 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", L"system32" },
545 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\"", s_cur_dir },
546 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", NULL },
547 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", L"." },
548 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", L"system32" },
549 { __LINE__, FALSE, TRUE, L"\"Test File 2.bat\" \"Test File.txt\"", s_cur_dir },
550};
551
552typedef struct OPENWNDS
553{
557
558static OPENWNDS s_wi0 = { 0 }, s_wi1 = { 0 };
559
561{
563 info->phwnd = (HWND *)realloc(info->phwnd, (info->count + 1) * sizeof(HWND));
564 if (!info->phwnd)
565 return FALSE;
566 info->phwnd[info->count] = hwnd;
567 ++(info->count);
568 return TRUE;
569}
570
572{
574 for (UINT i1 = 0; i1 < s_wi1.count; ++i1)
575 {
576 BOOL bFound = FALSE;
577 for (UINT i0 = 0; i0 < s_wi0.count; ++i0)
578 {
579 if (s_wi1.phwnd[i1] == s_wi0.phwnd[i0])
580 {
581 bFound = TRUE;
582 break;
583 }
584 }
585 if (!bFound)
586 PostMessageW(s_wi1.phwnd[i1], WM_CLOSE, 0, 0);
587 }
589 ZeroMemory(&s_wi1, sizeof(s_wi1));
590}
591
592static void DoEntry(const TEST_ENTRY *pEntry)
593{
594 HRESULT hr;
595 DWORD dwSeclFlags;
596 BOOL result;
597
598 if (pEntry->bAllowNonExe)
599 dwSeclFlags = SECL_NO_UI | SECL_ALLOW_NONEXE;
600 else
601 dwSeclFlags = SECL_NO_UI;
602
604 {
605 if (IsReactOS())
606 {
607 hr = proxy_ShellExecCmdLine(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
608 SW_SHOWNORMAL, NULL, dwSeclFlags);
609 }
610 else
611 {
612 hr = (*g_pShellExecCmdLine)(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
613 SW_SHOWNORMAL, NULL, dwSeclFlags);
614 }
615 }
617 {
618 hr = 0xBADFACE;
619 }
620 _SEH2_END;
621
622 if (hr == 0xBADFACE)
623 result = hr;
624 else
625 result = (hr == S_OK);
626
627 ok(result == pEntry->result, "Line %d: result expected %d, was %d\n",
628 pEntry->lineno, pEntry->result, result);
629
631}
632
634{
635 using namespace std;
636
637 if (!IsReactOS())
638 {
640 {
641 skip("ShellExecCmdLine is not available on this platform\n");
642 return;
643 }
644
645 HMODULE hShell32 = GetModuleHandleA("shell32");
648 {
649 skip("ShellExecCmdLine is not found\n");
650 return;
651 }
652 }
653
655 {
656 skip("shell32_apitest_sub.exe is not found\n");
657 return;
658 }
659
660 // record open windows
662 {
663 skip("EnumWindows failed\n");
665 return;
666 }
667
668 // s_win_test_exe
670 PathAppendW(s_win_test_exe, L"test program.exe");
672 if (!ret)
673 {
674 skip("Please retry with admin rights\n");
676 return;
677 }
678
679 FILE *fp;
680
681 // s_sys_bat_file
683 PathAppendW(s_sys_bat_file, L"test program.bat");
684 fp = _wfopen(s_sys_bat_file, L"wb");
685 fclose(fp);
687
688 // "Test File 1.txt"
689 fp = fopen("Test File 1.txt", "wb");
690 ok(fp != NULL, "failed to create a test file\n");
691 fclose(fp);
692 ok_int(PathFileExistsA("Test File 1.txt"), TRUE);
693
694 // "Test File 2.bat"
695 fp = fopen("Test File 2.bat", "wb");
696 ok(fp != NULL, "failed to create a test file\n");
697 fclose(fp);
698 ok_int(PathFileExistsA("Test File 2.bat"), TRUE);
699
700 // s_cur_dir
702
703 // do tests
704 for (size_t i = 0; i < _countof(s_entries_1); ++i)
705 {
707 }
709 for (size_t i = 0; i < _countof(s_entries_2); ++i)
710 {
712 }
713
714 Sleep(2000);
716
717 // clean up
718 ok(DeleteFileW(s_win_test_exe), "failed to delete the test file\n");
719 ok(DeleteFileW(s_sys_bat_file), "failed to delete the test file\n");
720 ok(DeleteFileA("Test File 1.txt"), "failed to delete the test file\n");
721 ok(DeleteFileA("Test File 2.bat"), "failed to delete the test file\n");
723
725 Sleep(100);
726}
static WCHAR s_sys_bat_file[MAX_PATH]
static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
#define SECL_USE_IDLIST
static WCHAR s_win_test_exe[MAX_PATH]
static const WCHAR wszCom[]
#define SECL_LOG_USAGE
#define IDS_FILE_NOT_FOUND
static LPCWSTR SplitParams(LPCWSTR psz, LPWSTR pszArg0, size_t cchArg0)
#define shell32_hInstance
HRESULT(WINAPI * SHELLEXECCMDLINE)(HWND, LPCWSTR, LPCWSTR, INT, LPVOID, DWORD)
#define SECL_ALLOW_NONEXE
#define SECL_RUNAS
static const TEST_ENTRY s_entries_1[]
static const WCHAR wszOpen[]
static WCHAR s_sub_program[MAX_PATH]
static void DoEntry(const TEST_ENTRY *pEntry)
static const TEST_ENTRY s_entries_2[]
static OPENWNDS s_wi1
struct TEST_ENTRY TEST_ENTRY
static void CleanupNewlyCreatedWindows(void)
#define ShellExecCmdLine
#define SECL_NO_UI
SHELLEXECCMDLINE g_pShellExecCmdLine
static __inline void __SHCloneStrW(WCHAR **target, const WCHAR *source)
static OPENWNDS s_wi0
static const WCHAR wszExe[]
static WCHAR s_cur_dir[MAX_PATH]
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_int(expression, result)
Definition: atltest.h:134
LPARAM lParam
Definition: combotst.c:139
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
HANDLE HWND
Definition: compat.h:19
#define GetProcAddress(x, y)
Definition: compat.h:753
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW(IN LPCWSTR lpName, IN LPCWSTR lpValue)
Definition: environ.c:259
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
Definition: except.c:700
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2249
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
BOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType)
Definition: vdm.c:1243
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:436
BOOL WINAPI PathFileExistsA(LPCSTR lpszPath)
Definition: path.c:1755
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1777
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1579
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1883
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
GLuint64EXT * result
Definition: glext.h:11304
GLenum target
Definition: glext.h:7315
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define iswspace(_c)
Definition: ctype.h:669
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
_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 EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define pch(ap)
Definition: match.c:418
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static HMODULE hShell32
Definition: string.c:34
Definition: features.h:417
unsigned int UINT
Definition: ndis.h:50
#define DWORD
Definition: nt_native.h:44
#define LPVOID
Definition: nt_native.h:45
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
#define PathAddBackslashW
Definition: pathcch.h:301
#define PathAppendW
Definition: pathcch.h:309
#define INT
Definition: polytest.cpp:20
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
static HWND DoWaitForWindow(LPCWSTR clsname, LPCWSTR text, BOOL bClosing, BOOL bForce)
static BOOL FindSubProgram(LPWSTR pszSubProgram, DWORD cchSubProgram)
#define SUB_CLASSNAME
#define SEE_MASK_FLAG_LOG_USAGE
Definition: shellapi.h:59
#define SEE_MASK_DOENVSUBST
Definition: shellapi.h:35
#define SEE_MASK_NOASYNC
Definition: shellapi.h:33
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
#define SEE_MASK_FLAG_NO_UI
Definition: shellapi.h:36
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2434
HRESULT hr
Definition: shlfolder.c:183
#define UrlIsFileUrlW(x)
Definition: shlwapi.h:1403
@ ASSOCSTR_COMMAND
Definition: shlwapi.h:603
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
Definition: cmd.c:13
LPCWSTR pwszCommand
LPCWSTR pwszStartDir
INT lineno
Definition: fc.c:16
BOOL bAllowNonExe
BOOL result
unsigned int count
Definition: notification.c:64
#define EXCEPTION_NONCONTINUABLE
Definition: stubs.h:23
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
int32_t INT_PTR
Definition: typedefs.h:64
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
VERSIONHELPERAPI IsWindowsVistaOrGreater()
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
int ret
#define ZeroMemory
Definition: winbase.h:1737
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define EXCEPTION_ACCESS_VIOLATION
Definition: winbase.h:337
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define CO_E_APPNOTFOUND
Definition: winerror.h:2808
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define SW_SHOWNORMAL
Definition: winuser.h:773
#define WM_CLOSE
Definition: winuser.h:1624
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:790
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185