ReactOS  0.4.15-dev-499-g1f31905
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 
12 #define NDEBUG
13 #include <debug.h>
14 #include <stdio.h>
15 
16 //#define ShellExecCmdLine ShellExecCmdLine
17 
18 #ifndef SECL_NO_UI
19  #define SECL_NO_UI 0x2
20  #define SECL_LOG_USAGE 0x8
21  #define SECL_USE_IDLIST 0x10
22  #define SECL_ALLOW_NONEXE 0x20
23  #define SECL_RUNAS 0x40
24 #endif
25 
26 #ifdef ShellExecCmdLine
27 
28 #define shell32_hInstance GetModuleHandle(NULL)
29 #define IDS_FILE_NOT_FOUND (-1)
30 
31 static const WCHAR wszOpen[] = L"open";
32 static const WCHAR wszExe[] = L".exe";
33 static const WCHAR wszCom[] = L".com";
34 
35 static __inline void __SHCloneStrW(WCHAR **target, const WCHAR *source)
36 {
37  *target = (WCHAR *)SHAlloc((lstrlenW(source) + 1) * sizeof(WCHAR) );
39 }
40 
41 static LPCWSTR
42 SplitParams(LPCWSTR psz, LPWSTR pszArg0, size_t cchArg0)
43 {
44  LPCWSTR pch;
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 #else
242 #endif
243 
244 typedef struct TEST_ENTRY
245 {
246  INT lineno;
252 } TEST_ENTRY;
253 
254 static const char s_testfile1[] = "Test File.txt";
255 static const char s_testfile2[] = "Test File.bat";
256 static char s_notepad[] = "notepad.exe";
257 
258 static const TEST_ENTRY s_entries[] =
259 {
260  // NULL
261  { __LINE__, (HRESULT)0xDEADFACE, FALSE, NULL, NULL, NULL },
262  { __LINE__, (HRESULT)0xDEADFACE, FALSE, NULL, NULL, L"." },
263  { __LINE__, (HRESULT)0xDEADFACE, FALSE, NULL, NULL, L"system32" },
264  { __LINE__, (HRESULT)0xDEADFACE, FALSE, NULL, NULL, L"C:\\Program Files" },
265  { __LINE__, (HRESULT)0xDEADFACE, TRUE, NULL, NULL, NULL },
266  { __LINE__, (HRESULT)0xDEADFACE, TRUE, NULL, NULL, L"." },
267  { __LINE__, (HRESULT)0xDEADFACE, TRUE, NULL, NULL, L"system32" },
268  { __LINE__, (HRESULT)0xDEADFACE, TRUE, NULL, NULL, L"C:\\Program Files" },
269  // notepad
270  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad", NULL },
271  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad", L"." },
272  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad", L"system32" },
273  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad", L"C:\\Program Files" },
274  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad \"Test File.txt\"", NULL },
275  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad \"Test File.txt\"", L"." },
276  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad", NULL },
277  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad", L"." },
278  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad", L"system32" },
279  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad", L"C:\\Program Files" },
280  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad \"Test File.txt\"", NULL },
281  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad \"Test File.txt\"", L"." },
282  // notepad.exe
283  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad.exe", NULL },
284  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad.exe", L"." },
285  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad.exe", L"system32" },
286  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad.exe", L"C:\\Program Files" },
287  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad.exe \"Test File.txt\"", NULL },
288  { __LINE__, S_OK, FALSE, L"Notepad", L"notepad.exe \"Test File.txt\"", L"." },
289  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad.exe", NULL },
290  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad.exe", L"." },
291  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad.exe", L"system32" },
292  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad.exe", L"C:\\Program Files" },
293  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad.exe \"Test File.txt\"", NULL },
294  { __LINE__, S_OK, TRUE, L"Notepad", L"notepad.exe \"Test File.txt\"", L"." },
295  // C:\notepad.exe
296  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"C:\\notepad.exe", NULL },
297  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"C:\\notepad.exe", L"." },
298  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"C:\\notepad.exe", L"system32" },
299  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"C:\\notepad.exe", L"C:\\Program Files" },
300  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"C:\\notepad.exe \"Test File.txt\"", NULL },
301  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"C:\\notepad.exe \"Test File.txt\"", L"." },
302  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"C:\\notepad.exe", NULL },
303  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"C:\\notepad.exe", L"." },
304  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"C:\\notepad.exe", L"system32" },
305  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"C:\\notepad.exe", L"C:\\Program Files" },
306  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"C:\\notepad.exe \"Test File.txt\"", NULL },
307  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"C:\\notepad.exe \"Test File.txt\"", L"." },
308  // "notepad"
309  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad\"", NULL },
310  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad\"", L"." },
311  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad\"", L"system32" },
312  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad\"", L"C:\\Program Files" },
313  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad\" \"Test File.txt\"", NULL },
314  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad\" \"Test File.txt\"", L"." },
315  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad\"", NULL },
316  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad\"", L"." },
317  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad\"", L"system32" },
318  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad\"", L"C:\\Program Files" },
319  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad\" \"Test File.txt\"", NULL },
320  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad\" \"Test File.txt\"", L"." },
321  // "notepad.exe"
322  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad.exe\"", NULL },
323  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad.exe\"", L"." },
324  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad.exe\"", L"system32" },
325  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad.exe\"", L"C:\\Program Files" },
326  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad.exe\" \"Test File.txt\"", NULL },
327  { __LINE__, S_OK, FALSE, L"Notepad", L"\"notepad.exe\" \"Test File.txt\"", L"." },
328  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad.exe\"", NULL },
329  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad.exe\"", L"." },
330  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad.exe\"", L"system32" },
331  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad.exe\"", L"C:\\Program Files" },
332  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad.exe\" \"Test File.txt\"", NULL },
333  { __LINE__, S_OK, TRUE, L"Notepad", L"\"notepad.exe\" \"Test File.txt\"", L"." },
334  // test program.exe
335  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"test program.exe", NULL },
336  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"test program.exe", L"." },
337  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"test program.exe", L"system32" },
338  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"test program.exe", L"C:\\Program Files" },
339  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"test program.exe \"Test File.txt\"", NULL },
340  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"test program.exe \"Test File.txt\"", L"." },
341  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"test program.exe", NULL },
342  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"test program.exe", L"." },
343  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"test program.exe", L"system32" },
344  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"test program.exe", L"C:\\Program Files" },
345  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"test program.exe \"Test File.txt\"", NULL },
346  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"test program.exe \"Test File.txt\"", L"." },
347  // "test program"
348  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program\"", NULL },
349  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program\"", L"." },
350  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program\"", L"system32" },
351  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program\"", L"C:\\Program Files" },
352  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program\" \"Test File.txt\"", NULL },
353  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program\" \"Test File.txt\"", L"." },
354  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program\"", NULL },
355  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program\"", L"." },
356  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program\"", L"system32" },
357  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program\"", L"C:\\Program Files" },
358  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program\" \"Test File.txt\"", NULL },
359  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program\" \"Test File.txt\"", L"." },
360  // "test program.exe"
361  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program.exe\"", NULL },
362  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program.exe\"", L"." },
363  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program.exe\"", L"system32" },
364  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program.exe\"", L"C:\\Program Files" },
365  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program.exe\" \"Test File.txt\"", NULL },
366  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"test program.exe\" \"Test File.txt\"", L"." },
367  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program.exe\"", NULL },
368  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program.exe\"", L"." },
369  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program.exe\"", L"system32" },
370  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program.exe\"", L"C:\\Program Files" },
371  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program.exe\" \"Test File.txt\"", NULL },
372  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"test program.exe\" \"Test File.txt\"", L"." },
373  // invalid program
374  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"invalid program", NULL },
375  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"invalid program", L"." },
376  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"invalid program", L"system32" },
377  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"invalid program", L"C:\\Program Files" },
378  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"invalid program \"Test File.txt\"", NULL },
379  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"invalid program \"Test File.txt\"", L"." },
380  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"invalid program", NULL },
381  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"invalid program", L"." },
382  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"invalid program", L"system32" },
383  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"invalid program", L"C:\\Program Files" },
384  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"invalid program \"Test File.txt\"", NULL },
385  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"invalid program \"Test File.txt\"", L"." },
386  // \"invalid program.exe\"
387  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"invalid program.exe\"", NULL },
388  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"invalid program.exe\"", L"." },
389  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"invalid program.exe\"", L"system32" },
390  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"invalid program.exe\"", L"C:\\Program Files" },
391  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"invalid program.exe\" \"Test File.txt\"", NULL },
392  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", L"\"invalid program.exe\" \"Test File.txt\"", L"." },
393  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"invalid program.exe\"", NULL },
394  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"invalid program.exe\"", L"." },
395  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"invalid program.exe\"", L"system32" },
396  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"invalid program.exe\"", L"C:\\Program Files" },
397  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"invalid program.exe\" \"Test File.txt\"", NULL },
398  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", L"\"invalid program.exe\" \"Test File.txt\"", L"." },
399 };
400 
401 static void DoEntry(const TEST_ENTRY *pEntry)
402 {
403  HRESULT hr;
404  DWORD dwSeclFlags;
405 
406  if (pEntry->bAllowNonExe)
407  dwSeclFlags = SECL_NO_UI | SECL_ALLOW_NONEXE;
408  else
409  dwSeclFlags = SECL_NO_UI;
410 
411  _SEH2_TRY
412  {
413 #ifdef ShellExecCmdLine
414  hr = ShellExecCmdLine(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
415  SW_SHOWNORMAL, NULL, dwSeclFlags);
416 #else
417  hr = (*g_pShellExecCmdLine)(NULL, pEntry->pwszCommand, pEntry->pwszStartDir,
418  SW_SHOWNORMAL, NULL, dwSeclFlags);
419 #endif
420  }
422  {
423  hr = 0xDEADFACE;
424  }
425  _SEH2_END;
426 
427  ok(hr == pEntry->hr, "Line %d: hr expected 0x%lX, was 0x%lX\n", pEntry->lineno, pEntry->hr, hr);
428 
429 #define RETRY_COUNT 5
430 #define RETRY_INTERVAL 250
431  if (SUCCEEDED(hr) && pEntry->pwszWindowClass)
432  {
433  BOOL bFound = FALSE;
434  Sleep(RETRY_INTERVAL / 2);
435  for (int i = 0; i < RETRY_COUNT; ++i)
436  {
438  if (hwnd)
439  {
440  bFound = TRUE;
441  SendMessage(hwnd, WM_CLOSE, 0, 0);
443  break;
444  }
446  }
447  ok(bFound, "Line %d: The window not found\n", pEntry->lineno);
448  }
449 #undef RETRY_COUNT
450 #undef RETRY_INTERVAL
451 }
452 
454 {
455  using namespace std;
456 
457 #ifndef ShellExecCmdLine
458  // CHECKME
460  {
461  skip("ShellExecCmdLine is not available on this platform\n");
462  return;
463  }
464 
465  HMODULE hShell32 = GetModuleHandleA("shell32");
467  if (!g_pShellExecCmdLine)
468  {
469  skip("ShellExecCmdLine is not found\n");
470  return;
471  }
472 #endif
473 
474  // s_testfile1
475  FILE *fp = fopen(s_testfile1, "wb");
476  ok(fp != NULL, "failed to create a test file\n");
477  fclose(fp);
478 
479  // s_testfile2
480  fp = fopen(s_testfile2, "wb");
481  ok(fp != NULL, "failed to create a test file\n");
482  if (fp)
483  {
484  fprintf(fp, "echo OK\n");
485  }
486  fclose(fp);
487 
488  for (size_t i = 0; i < _countof(s_entries); ++i)
489  {
490  DoEntry(&s_entries[i]);
491  }
492 
493  WCHAR buf0[MAX_PATH];
494  WCHAR buf1[MAX_PATH];
495  WCHAR buf2[MAX_PATH];
496  TEST_ENTRY additionals[] =
497  {
498  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", buf0, NULL },
499  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", buf0, L"." },
500  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", buf0, L"system32" },
501  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", buf1, NULL },
502  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", buf1, L"." },
503  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", buf1, L"system32" },
504  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", buf2, NULL },
505  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", buf2, L"." },
506  { __LINE__, CO_E_APPNOTFOUND, FALSE, L"Notepad", buf2, L"system32" },
507  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", buf0, NULL }, // FIXME
508  { __LINE__, S_OK, TRUE, L"Notepad", buf0, L"." },
509  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", buf0, L"system32" }, // FIXME
510  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", buf1, NULL }, // FIXME
511  { __LINE__, S_OK, TRUE, L"Notepad", buf1, L"." },
512  { __LINE__, S_OK, TRUE, L"Notepad", buf1, L"system32" },
513  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, L"Notepad", buf2, NULL }, // FIXME
514  { __LINE__, S_OK, TRUE, L"Notepad", buf2, L"." },
515  { __LINE__, S_OK, TRUE, L"Notepad", buf2, L"system32" },
516  };
517 
518  wsprintfW(buf0, L"%hs", s_testfile1);
519  wsprintfW(buf1, L"\"%hs\"", s_testfile1);
520  wsprintfW(buf2, L"\"%hs\" \"Test File.txt\"", s_testfile1);
521  for (size_t i = 0; i < _countof(additionals); ++i)
522  {
523  DoEntry(&additionals[i]);
524  }
525 
526  TEST_ENTRY additionals2[] =
527  {
528  { __LINE__, CO_E_APPNOTFOUND, FALSE, NULL, buf0, NULL },
529  { __LINE__, CO_E_APPNOTFOUND, FALSE, NULL, buf0, L"." },
530  { __LINE__, CO_E_APPNOTFOUND, FALSE, NULL, buf0, L"system32" },
531  { __LINE__, CO_E_APPNOTFOUND, FALSE, NULL, buf1, NULL },
532  { __LINE__, CO_E_APPNOTFOUND, FALSE, NULL, buf1, L"." },
533  { __LINE__, CO_E_APPNOTFOUND, FALSE, NULL, buf1, L"system32" },
534  { __LINE__, CO_E_APPNOTFOUND, FALSE, NULL, buf2, NULL },
535  { __LINE__, CO_E_APPNOTFOUND, FALSE, NULL, buf2, L"." },
536  { __LINE__, CO_E_APPNOTFOUND, FALSE, NULL, buf2, L"system32" },
537  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, NULL, buf0, NULL }, // FIXME
538  { __LINE__, S_OK, TRUE, NULL, buf0, L"." },
539  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, NULL, buf0, L"system32" }, // FIXME
540  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, NULL, buf1, NULL }, // FIXME
541  { __LINE__, S_OK, TRUE, NULL, buf1, L"." },
542  { __LINE__, S_OK, TRUE, NULL, buf1, L"system32" },
543  { __LINE__, HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), TRUE, NULL, buf2, NULL }, // FIXME
544  { __LINE__, S_OK, TRUE, NULL, buf2, L"." },
545  { __LINE__, S_OK, TRUE, NULL, buf2, L"system32" },
546  };
547 
548  wsprintfW(buf0, L"%hs", s_testfile2);
549  wsprintfW(buf1, L"\"%hs\"", s_testfile2);
550  wsprintfW(buf2, L"\"%hs\" \"Test File.txt\"", s_testfile2);
551  for (size_t i = 0; i < _countof(additionals2); ++i)
552  {
553  DoEntry(&additionals2[i]);
554  }
555 
556  char path[MAX_PATH];
557  ok((INT_PTR)FindExecutableA("notepad.exe", NULL, s_notepad) >= 32, "FindExecutableA failed\n");
558  ok(GetModuleFileNameA(NULL, path, _countof(path)), "GetModuleFileNameA failed\n");
559  char *pch = strrchr(path, '\\');
560 
561  if (pch == NULL)
562  {
563  skip("pch == NULL\n");
564  }
565  else
566  {
567  // create "My Directory"
568  strcpy(pch, "\\My Directory");
570  ok(CreateDirectoryA(path, NULL), "CreateDirectoryA failed\n");
571 
572  // create "My Directory\\Notepad.exe" as clone of Notepad.exe
573  strcpy(pch, "\\My Directory\\Notepad.exe");
574  ok(CopyFileA(s_notepad, path, FALSE), "CopyFileA failed\n");
575 
576  wsprintfW(buf0, L"%hs", path);
577  wsprintfW(buf1, L"\"%hs\"", path);
578  wsprintfW(buf2, L"\"%hs\" \"Test File.txt\"", path);
579  TEST_ENTRY additionals3[] =
580  {
581  { __LINE__, S_OK, FALSE, NULL, buf0, NULL },
582  { __LINE__, S_OK, FALSE, NULL, buf0, L"." },
583  { __LINE__, S_OK, FALSE, NULL, buf0, L"system32" },
584  { __LINE__, S_OK, FALSE, NULL, buf1, NULL },
585  { __LINE__, S_OK, FALSE, NULL, buf1, L"." },
586  { __LINE__, S_OK, FALSE, NULL, buf1, L"system32" },
587  { __LINE__, S_OK, FALSE, NULL, buf2, NULL },
588  { __LINE__, S_OK, FALSE, NULL, buf2, L"." },
589  { __LINE__, S_OK, FALSE, NULL, buf2, L"system32" },
590  { __LINE__, S_OK, TRUE, NULL, buf0, NULL },
591  { __LINE__, S_OK, TRUE, NULL, buf0, L"." },
592  { __LINE__, S_OK, TRUE, NULL, buf0, L"system32" },
593  { __LINE__, S_OK, TRUE, NULL, buf1, NULL },
594  { __LINE__, S_OK, TRUE, NULL, buf1, L"." },
595  { __LINE__, S_OK, TRUE, NULL, buf1, L"system32" },
596  { __LINE__, S_OK, TRUE, NULL, buf2, NULL },
597  { __LINE__, S_OK, TRUE, NULL, buf2, L"." },
598  { __LINE__, S_OK, TRUE, NULL, buf2, L"system32" },
599  };
600  for (size_t i = 0; i < _countof(additionals3); ++i)
601  {
602  DoEntry(&additionals3[i]);
603  }
604 
605  DeleteFileA(path);
606 
607  strcpy(pch, "\\My Directory");
609  }
610 
611  // clean up
612  ok(DeleteFileA(s_testfile1), "failed to delete the test file\n");
613  ok(DeleteFileA(s_testfile2), "failed to delete the test file\n");
614 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
struct TEST_ENTRY TEST_ENTRY
#define HRESULT
Definition: msvc.h:7
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1558
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
static const char s_testfile2[]
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
HRESULT hr
Definition: shlfolder.c:183
LPCWSTR pwszStartDir
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPCWSTR pwszCommand
#define SECL_USE_IDLIST
HRESULT(WINAPI * SHELLEXECCMDLINE)(HWND, LPCWSTR, LPCWSTR, INT, LPVOID, DWORD)
#define EXCEPTION_ACCESS_VIOLATION
Definition: winbase.h:308
#define SECL_NO_UI
#define RemoveDirectory
Definition: winbase.h:3735
#define INT
Definition: polytest.cpp:20
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:422
#define EXCEPTION_NONCONTINUABLE
Definition: rtltypes.h:150
HANDLE HWND
Definition: compat.h:13
#define SECL_RUNAS
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1648
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
static LPCWSTR SplitParams(LPCWSTR psz, LPWSTR pszArg0, size_t cchArg0)
Definition: shlexec.cpp:2369
BOOL WINAPI CopyFileA(IN LPCSTR lpExistingFileName, IN LPCSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:404
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
int32_t INT_PTR
Definition: typedefs.h:63
Definition: features.h:417
#define lstrlenW
Definition: compat.h:416
BOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName, LPDWORD lpBinaryType)
Definition: vdm.c:1235
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:57
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
#define pch(ap)
Definition: match.c:418
_SEH2_TRY
Definition: create.c:4226
struct _test_info info[]
Definition: SetCursorPos.c:19
uint32_t ULONG_PTR
Definition: typedefs.h:64
static __inline void __SHCloneStrW(WCHAR **target, const WCHAR *source)
Definition: shell32_main.h:154
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
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
#define UNICODE_NULL
static const WCHAR szText[]
Definition: dialog.c:139
#define RETRY_INTERVAL
START_TEST(ShellExecCmdLine)
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
unsigned int BOOL
Definition: ntddk_ex.h:94
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:802
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:416
#define SEE_MASK_NOASYNC
Definition: shellapi.h:33
#define SEE_MASK_FLAG_NO_UI
Definition: shellapi.h:36
#define SECL_LOG_USAGE
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define SECL_ALLOW_NONEXE
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2263
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1756
INT lineno
Definition: DPtoLP.c:34
VERSIONHELPERAPI IsWindowsVistaOrGreater()
const char * LPCSTR
Definition: xmlstorage.h:183
HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:427
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const WCHAR wszCom[]
Definition: shlexec.cpp:30
static const char s_testfile1[]
SHELLEXECCMDLINE g_pShellExecCmdLine
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
HWND WINAPI FindWindowW(_In_opt_ LPCWSTR, _In_opt_ LPCWSTR)
LONG HRESULT
Definition: typedefs.h:78
#define _countof(array)
Definition: sndvol32.h:68
LPCWSTR pwszWindowClass
#define WM_CLOSE
Definition: winuser.h:1603
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:6
#define SEE_MASK_DOENVSUBST
Definition: shellapi.h:35
BOOL bAllowNonExe
static const WCHAR wszExe[]
Definition: shlexec.cpp:29
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI ShellExecCmdLine(HWND hwnd, LPCWSTR pwszCommand, LPCWSTR pwszStartDir, int nShow, LPVOID pUnused, DWORD dwSeclFlags)
Definition: shlexec.cpp:2415
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define LPVOID
Definition: nt_native.h:45
static const TEST_ENTRY s_entries[]
#define iswspace(_c)
Definition: ctype.h:669
HINSTANCE WINAPI FindExecutableA(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult)
Definition: shlexec.cpp:1223
Definition: cmd.c:12
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define MB_ICONERROR
Definition: winuser.h:781
#define IDS_FILE_NOT_FOUND
Definition: shresdef.h:298
HRESULT hr
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
#define UrlIsFileUrlW(x)
Definition: shlwapi.h:1377
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:1297
static const WCHAR wszOpen[]
Definition: shlexec.cpp:28
#define S_OK
Definition: intsafe.h:59
#define SW_SHOWNORMAL
Definition: winuser.h:764
_SEH2_END
Definition: create.c:4400
VOID WINAPI RaiseException(IN DWORD dwExceptionCode, IN DWORD dwExceptionFlags, IN DWORD nNumberOfArguments, IN CONST ULONG_PTR *lpArguments OPTIONAL)
Definition: except.c:693
#define lstrcpyW
Definition: compat.h:415
#define SEE_MASK_FLAG_LOG_USAGE
Definition: shellapi.h:57
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248
#define ok(value,...)
Definition: atltest.h:57
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
static void DoEntry(const TEST_ENTRY *pEntry)
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
#define skip(...)
Definition: atltest.h:64
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
static char s_notepad[]
#define SendMessage
Definition: winuser.h:5818
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
GLenum target
Definition: glext.h:7315
#define RETRY_COUNT
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
#define GetProcAddress(x, y)
Definition: compat.h:419
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define CO_E_APPNOTFOUND
Definition: winerror.h:2808
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static HMODULE hShell32
Definition: string.c:34
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define SUCCEEDED(hr)
Definition: intsafe.h:57