1 /*
2  * PROJECT:         ReactOS api tests
3  * LICENSE:         GPLv2+ - See COPYING in the top level directory
4  * PURPOSE:         Tests for PathResolve
5  * PROGRAMMER:      Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6  */
7 
8 #include "shelltest.h"
9 
10 #include <assert.h>
11 
12 /*
13  * NOTE: "App Paths" registry key and PATHEXT environment variable
14  *       have no effect for PathResolve.
15  */
16 
17 /* PathResolve */
18 typedef int (WINAPI *PATHRESOLVE)(LPWSTR, LPWSTR *, UINT);
19 
20 static HINSTANCE    s_hShell32 = NULL;
21 static PATHRESOLVE  s_pPathResolve = NULL;
22 static WCHAR        s_TestDataPath[MAX_PATH];
23 static WCHAR        s_LinkFilePath[MAX_PATH];
24 static WCHAR        s_LinkTargetPath[MAX_PATH];
25 static LPWSTR       s_Dirs[2];
26 
27 /* PathResolve flags */
28 #ifndef PRF_VERIFYEXISTS
29     #define PRF_VERIFYEXISTS         0x01
30     #define PRF_EXECUTABLE           0x02
31     #define PRF_TRYPROGRAMEXTENSIONS (PRF_EXECUTABLE | PRF_VERIFYEXISTS)
32     #define PRF_FIRSTDIRDEF          0x04
33     #define PRF_DONTFINDLNK          0x08
34 #endif
35 #ifndef PRF_REQUIREABSOLUTE
36     #define PRF_REQUIREABSOLUTE      0x10
37 #endif
38 
39 #define FLAGS0      0
40 #define FLAGS1      PRF_VERIFYEXISTS
41 #define FLAGS2      PRF_EXECUTABLE
42 #define FLAGS3      PRF_TRYPROGRAMEXTENSIONS
43 #define FLAGS4      (PRF_FIRSTDIRDEF | PRF_VERIFYEXISTS)
44 #define FLAGS5      (PRF_FIRSTDIRDEF | PRF_EXECUTABLE)
45 #define FLAGS6      (PRF_FIRSTDIRDEF | PRF_TRYPROGRAMEXTENSIONS)
46 #define FLAGS7      (PRF_REQUIREABSOLUTE | PRF_VERIFYEXISTS)
47 #define FLAGS8      (PRF_REQUIREABSOLUTE | PRF_EXECUTABLE)
48 #define FLAGS9      (PRF_REQUIREABSOLUTE | PRF_TRYPROGRAMEXTENSIONS)
49 #define FLAGS10     (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_VERIFYEXISTS)
50 #define FLAGS11     (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_EXECUTABLE)
51 #define FLAGS12     (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_TRYPROGRAMEXTENSIONS)
52 #define FLAGS13     0xFFFFFFFF
53 
54 #define EF_FULLPATH     1
55 #define EF_TESTDATA     2
56 #define EF_WINDOWS_DIR  4
57 #define EF_SYSTEM_DIR   8
58 #define EF_TYPE_MASK    0xF
59 
60 #define EF_NAME_ONLY    16
61 #define EF_APP_PATH     32
62 
63 typedef struct ENTRY
64 {
65     INT         EntryNumber;    /* # */
66     INT         Ret;
67     DWORD       Error;
68     UINT        EF_;
69     LPCWSTR     NameBefore;
70     LPCWSTR     NameExpected;
71     UINT        Flags;
72     LPWSTR     *Dirs;
73 } ENTRY;
74 
75 #define BEEF        0xBEEF      /* Error Code 48879 */
76 #define DEAD        0xDEAD      /* Error Code 57005 */
77 #define IGNORE_ERR  0x7F7F7F7F  /* Ignore Error Code */
78 #define RAISED      9999        /* exception raised */
79 
80 static const ENTRY s_Entries[] =
81 {
82     /* null path */
83     { 0, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS0 },
84     { 1, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS1 },
85     { 2, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS2 },
86     { 3, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS3 },
87     { 4, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS4 },
88     { 5, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS5 },
89     { 6, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS6 },
90     { 7, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS7 },
91     { 8, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS8 },
92     { 9, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS9 },
93     { 10, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS10 },
94     { 11, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS11 },
95     { 12, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS12 },
96     { 13, RAISED, DEAD, EF_FULLPATH, NULL, NULL, FLAGS13 },
97     /* empty path */
98     { 14, 1, BEEF, EF_FULLPATH, L"", NULL, FLAGS0 },
99     { 15, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS1 },
100     { 16, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS2 },
101     { 17, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS3 },
102     { 18, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS4 },
103     { 19, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS5 },
104     { 20, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS6 },
105     { 21, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS7 },
106     { 22, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS8 },
107     { 23, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS9 },
108     { 24, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS10 },
109     { 25, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS11 },
110     { 26, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS12 },
111     { 27, 1, ERROR_NO_MORE_FILES, EF_FULLPATH, L"", NULL, FLAGS13 },
112     /* Fonts folder (path) */
113     { 28, 1, IGNORE_ERR, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS0 },
114     { 29, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS1 },
115     { 30, 1, BEEF, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS2 },
116     { 31, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS3 },
117     { 32, RAISED, DEAD, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS4 },
118     { 33, RAISED, DEAD, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS5 },
119     { 34, RAISED, DEAD, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS6 },
120     { 35, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS7 },
121     { 36, 1, BEEF, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS8 },
122     { 37, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS9 },
123     { 38, RAISED, DEAD, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS10 },
124     { 39, RAISED, DEAD, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS11 },
125     { 40, RAISED, DEAD, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS12 },
126     { 41, RAISED, DEAD, EF_WINDOWS_DIR, L"Fonts", L"Fonts", FLAGS13 },
127     /* Fonts folder (name only) */
128     { 42, 1, ERROR_FILE_NOT_FOUND, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS0 },
129     { 43, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS1 },
130     { 44, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS2 },
131     { 45, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS3 },
132     { 46, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS4 },
133     { 47, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS5 },
134     { 48, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS6 },
135     { 49, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS7 },
136     { 50, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS8 },
137     { 51, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS9 },
138     { 52, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS10 },
139     { 53, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS11 },
140     { 54, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS12 },
141     { 55, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS13 },
142     /* Fonts folder with dirs (name only) */
143     { 56, 1, ERROR_FILE_NOT_FOUND, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS0, s_Dirs },
144     { 57, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS1, s_Dirs },
145     { 58, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS2, s_Dirs },
146     { 59, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS3, s_Dirs },
147     { 60, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS4, s_Dirs },
148     { 61, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS5, s_Dirs },
149     { 62, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS6, s_Dirs },
150     { 63, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS7, s_Dirs },
151     { 64, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS8, s_Dirs },
152     { 65, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS9, s_Dirs },
153     { 66, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS10, s_Dirs },
154     { 67, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS11, s_Dirs },
155     { 68, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS12, s_Dirs },
156     { 69, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"Fonts", L"Fonts", FLAGS13, s_Dirs },
157     /* system32 folder (path) */
158     { 70, 1, BEEF, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS0 },
159     { 71, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS1 },
160     { 72, 1, BEEF, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS2 },
161     { 73, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS3 },
162     { 74, RAISED, DEAD, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS4 },
163     { 75, RAISED, DEAD, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS5 },
164     { 76, RAISED, DEAD, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS6 },
165     { 77, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS7 },
166     { 78, 1, BEEF, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS8 },
167     { 79, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS9 },
168     { 80, RAISED, DEAD, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS10 },
169     { 81, RAISED, DEAD, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS11 },
170     { 82, RAISED, DEAD, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS12 },
171     { 83, RAISED, DEAD, EF_WINDOWS_DIR, L"system32", L"system32", FLAGS13 },
172     /* system32 folder (name only) */
173     { 84, 1, ERROR_FILE_NOT_FOUND, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS0 },
174     { 85, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS1 },
175     { 86, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS2 },
176     { 87, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS3 },
177     { 88, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS4 },
178     { 89, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS5 },
179     { 90, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS6 },
180     { 91, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS7 },
181     { 92, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS8 },
182     { 93, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS9 },
183     { 94, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS10 },
184     { 95, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS11 },
185     { 96, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS12 },
186     { 97, 1, ERROR_NO_MORE_FILES, EF_WINDOWS_DIR | EF_NAME_ONLY, L"system32", L"system32", FLAGS13 },
187     /* notepad (path) */
188     { 98, 1, BEEF, EF_SYSTEM_DIR, L"notepad", L"notepad", FLAGS0 },
189     { 99, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR, L"notepad", L"notepad.exe", FLAGS1 },
190     { 100, 1, BEEF, EF_SYSTEM_DIR, L"notepad", L"notepad", FLAGS2 },
191     { 101, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR, L"notepad", L"notepad.exe", FLAGS3 },
192     { 102, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad", L"notepad", FLAGS4 },
193     { 103, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad", L"notepad", FLAGS5 },
194     { 104, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad", L"notepad", FLAGS6 },
195     { 105, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR, L"notepad", L"notepad.exe", FLAGS7 },
196     { 106, 1, BEEF, EF_SYSTEM_DIR, L"notepad", L"notepad", FLAGS8 },
197     { 107, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR, L"notepad", L"notepad.exe", FLAGS9 },
198     { 108, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad", L"notepad", FLAGS10 },
199     { 109, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad", L"notepad", FLAGS11 },
200     { 110, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad", L"notepad", FLAGS12 },
201     { 111, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad", L"notepad", FLAGS13 },
202     /* notepad (name only) */
203     { 112, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS0 },
204     { 113, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS1 },
205     { 114, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS2 },
206     { 115, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS3 },
207     { 116, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS4 },
208     { 117, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS5 },
209     { 118, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS6 },
210     { 119, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS7 },
211     { 120, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS8 },
212     { 121, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS9 },
213     { 122, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS10 },
214     { 123, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS11 },
215     { 124, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS12 },
216     { 125, 1, ERROR_NO_MORE_FILES, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad", NULL, FLAGS13 },
217     /* notepad.exe (path) */
218     { 126, 1, BEEF, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS0 },
219     { 127, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS1 },
220     { 128, 1, BEEF, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS2 },
221     { 129, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS3 },
222     { 130, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS4 },
223     { 131, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS5 },
224     { 132, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS6 },
225     { 133, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS7 },
226     { 134, 1, BEEF, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS8 },
227     { 135, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS9 },
228     { 136, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS10 },
229     { 137, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS11 },
230     { 138, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS12 },
231     { 139, RAISED, DEAD, EF_SYSTEM_DIR, L"notepad.exe", L"notepad.exe", FLAGS13 },
232     /* notepad.exe (name only) */
233     { 140, 1, BEEF, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS0 },
234     { 141, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS1 },
235     { 142, 1, BEEF, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS2 },
236     { 143, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS3 },
237     { 144, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS4 },
238     { 145, 1, BEEF, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS5 },
239     { 146, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS6 },
240     { 147, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS7 },
241     { 148, 1, BEEF, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS8 },
242     { 149, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS9 },
243     { 150, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS10 },
244     { 151, 1, BEEF, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS11 },
245     { 152, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS12 },
246     { 153, 1, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.exe", L"notepad.exe", FLAGS13 },
247     /* notepad.com (name only) */
248     { 154, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS0 },
249     { 155, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS1 },
250     { 156, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS2 },
251     { 157, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS3 },
252     { 158, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS4 },
253     { 159, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS5 },
254     { 160, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS6 },
255     { 161, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS7 },
256     { 162, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS8 },
257     { 163, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS9 },
258     { 164, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS10 },
259     { 165, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS11 },
260     { 166, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS12 },
261     { 167, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY, L"notepad.com", NULL, FLAGS13 },
262     /* GhostProgram.exe -> notepad.exe (name only, app path) */
263     { 168, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS0 },
264     { 169, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS1 },
265     { 170, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS2 },
266     { 171, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS3 },
267     { 172, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS4 },
268     { 173, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS5 },
269     { 174, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS6 },
270     { 175, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS7 },
271     { 176, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS8 },
272     { 177, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS9 },
273     { 178, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS10 },
274     { 179, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS11 },
275     { 180, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS12 },
276     { 181, 0, ERROR_FILE_NOT_FOUND, EF_SYSTEM_DIR | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"notepad.exe", FLAGS13 },
277     /* invalid name */
278     { 182, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS0 },
279     { 183, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS1 },
280     { 184, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS2 },
281     { 185, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS3 },
282     { 186, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS4 },
283     { 187, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS5 },
284     { 188, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS6 },
285     { 189, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS7 },
286     { 190, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS8 },
287     { 191, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS9 },
288     { 192, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS10 },
289     { 193, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS11 },
290     { 194, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS12 },
291     { 195, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS13 },
292     /* testdata/2PRONG (path) */
293     { 196, 1, BEEF, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS0 },
294     { 197, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS1 },
295     { 198, 1, BEEF, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS2 },
296     { 199, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS3 },
297     { 200, RAISED, DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS4 },
298     { 201, RAISED, DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS5 },
299     { 202, RAISED, DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS6 },
300     { 203, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS7 },
301     { 204, 1, BEEF, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS8 },
302     { 205, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS9 },
303     { 206, RAISED, DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS10 },
304     { 207, RAISED, DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS11 },
305     { 208, RAISED, DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS12 },
306     { 209, RAISED, DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS13 },
307     /* testdata/2PRONG (name only) */
308     { 210, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS0 },
309     { 211, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS1 },
310     { 212, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS2 },
311     { 213, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS3 },
312     { 214, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS4 },
313     { 215, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS5 },
314     { 216, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS6 },
315     { 217, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS7 },
316     { 218, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS8 },
317     { 219, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS9 },
318     { 220, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS10 },
319     { 221, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS11 },
320     { 222, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS12 },
321     { 223, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS13 },
322     /* testdata/2PRONG with dirs (name only) */
323     { 224, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS0, s_Dirs },
324     { 225, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS1, s_Dirs },
325     { 226, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS2, s_Dirs },
326     { 227, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS3, s_Dirs },
327     { 228, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS4, s_Dirs },
328     { 229, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS5, s_Dirs },
329     { 230, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS6, s_Dirs },
330     { 231, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS7, s_Dirs },
331     { 232, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS8, s_Dirs },
332     { 233, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS9, s_Dirs },
333     { 234, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS10, s_Dirs },
334     { 235, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS11, s_Dirs },
335     { 236, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS12, s_Dirs },
336     { 237, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS13, s_Dirs },
337     /* testdata/2PRONG (name only, app path) */
338     { 238, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS0 },
339     { 239, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS1 },
340     { 240, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS2 },
341     { 241, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS3 },
342     { 242, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS4 },
343     { 243, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS5 },
344     { 244, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS6 },
345     { 245, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS7 },
346     { 246, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS8 },
347     { 247, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS9 },
348     { 248, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS10 },
349     { 249, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS11 },
350     { 250, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS12 },
351     { 251, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS13 },
352     /* testdata/2PRONG.txt (path) */
353     { 252, 1, BEEF, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS0 },
354     { 253, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS1 },
355     { 254, 1, BEEF, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS2 },
356     { 255, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS3 },
357     { 256, RAISED, DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS4 },
358     { 257, RAISED, DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS5 },
359     { 258, RAISED, DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS6 },
360     { 259, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS7 },
361     { 260, 1, BEEF, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS8 },
362     { 261, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS9 },
363     { 262, RAISED, DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS10 },
364     { 263, RAISED, DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS11 },
365     { 264, RAISED, DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS12 },
366     { 265, RAISED, DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS13 },
367     /* 2PRONG.txt (name only) */
368     { 266, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS0 },
369     { 267, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS1 },
370     { 268, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS2 },
371     { 269, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS3 },
372     { 270, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS4 },
373     { 271, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS5 },
374     { 272, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS6 },
375     { 273, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS7 },
376     { 274, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS8 },
377     { 275, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS9 },
378     { 276, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS10 },
379     { 277, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS11 },
380     { 278, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS12 },
381     { 279, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS13 },
382     /* 2PRONG.txt with dirs (name only) */
383     { 280, 1, BEEF, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS0, s_Dirs },
384     { 281, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS1, s_Dirs },
385     { 282, 1, BEEF, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS2, s_Dirs },
386     { 283, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS3, s_Dirs },
387     { 284, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS4, s_Dirs },
388     { 285, 1, BEEF, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS5, s_Dirs },
389     { 286, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS6, s_Dirs },
390     { 287, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS7, s_Dirs },
391     { 288, 1, BEEF, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS8, s_Dirs },
392     { 289, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS9, s_Dirs },
393     { 290, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS10, s_Dirs },
394     { 291, 1, BEEF, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS11, s_Dirs },
395     { 292, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS12, s_Dirs },
396     { 293, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS13, s_Dirs },
397     /* testdata/CmdLineUtils (path) */
398     { 294, 1, BEEF, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS0 },
399     { 295, 1, ERROR_NO_MORE_FILES, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils.lnk", FLAGS1 },
400     { 296, 1, BEEF, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS2 },
401     { 297, 1, ERROR_NO_MORE_FILES, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils.lnk", FLAGS3 },
402     { 298, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS4 },
403     { 299, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS5 },
404     { 300, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS6 },
405     { 301, 1, ERROR_NO_MORE_FILES, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils.lnk", FLAGS7 },
406     { 302, 1, BEEF, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS8 },
407     { 303, 1, ERROR_NO_MORE_FILES, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils.lnk", FLAGS9 },
408     { 304, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS10 },
409     { 305, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS11 },
410     { 306, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS12 },
411     { 307, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS13 },
412     /* testdata/CmdLineUtils with PRF_DONTFINDLNK (path) */
413     { 308, 1, BEEF, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS0 | PRF_DONTFINDLNK },
414     { 309, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS1 | PRF_DONTFINDLNK },
415     { 310, 1, BEEF, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS2 | PRF_DONTFINDLNK },
416     { 311, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS3 | PRF_DONTFINDLNK },
417     { 312, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS4 | PRF_DONTFINDLNK },
418     { 313, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS5 | PRF_DONTFINDLNK },
419     { 314, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS6 | PRF_DONTFINDLNK },
420     { 315, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS7 | PRF_DONTFINDLNK },
421     { 316, 1, BEEF, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS8 | PRF_DONTFINDLNK },
422     { 317, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS9 | PRF_DONTFINDLNK },
423     { 318, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS10 | PRF_DONTFINDLNK },
424     { 319, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS11 | PRF_DONTFINDLNK },
425     { 320, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS12 | PRF_DONTFINDLNK },
426     { 321, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS13 | PRF_DONTFINDLNK },
427     /* testdata/CmdLineUtils (name only) */
428     { 222, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS0 },
429     { 323, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS1 },
430     { 324, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS2 },
431     { 325, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS3 },
432     { 326, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS4 },
433     { 327, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS5 },
434     { 328, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS6 },
435     { 329, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS7 },
436     { 330, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS8 },
437     { 331, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS9 },
438     { 332, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS10 },
439     { 333, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS11 },
440     { 334, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS12 },
441     { 335, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS13 },
442     /* testdata/CmdLineUtils.exe (path) */
443     { 336, 1, BEEF, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS0 },
444     { 337, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS1 },
445     { 338, 1, BEEF, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS2 },
446     { 339, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS3 },
447     { 340, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS4 },
448     { 341, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS5 },
449     { 342, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS6 },
450     { 343, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS7 },
451     { 344, 1, BEEF, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS8 },
452     { 345, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS9 },
453     { 346, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS10 },
454     { 347, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS11 },
455     { 348, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS12 },
456     { 349, RAISED, DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS13 },
457     /* testdata/CmdLineUtils.exe (name only) */
458     { 350, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS0 },
459     { 351, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS1 },
460     { 352, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS2 },
461     { 353, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS3 },
462     { 354, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS4 },
463     { 355, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS5 },
464     { 356, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS6 },
465     { 357, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS7 },
466     { 358, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS8 },
467     { 359, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS9 },
468     { 360, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS10 },
469     { 361, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS11 },
470     { 362, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS12 },
471     { 363, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS13 },
472     /* testdata/CmdLineUtils.exe with dirs (name only) */
473     { 364, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS0, s_Dirs },
474     { 365, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS1, s_Dirs },
475     { 366, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS2, s_Dirs },
476     { 367, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS3, s_Dirs },
477     { 368, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS4, s_Dirs },
478     { 369, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS5, s_Dirs },
479     { 370, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS6, s_Dirs },
480     { 371, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS7, s_Dirs },
481     { 372, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS8, s_Dirs },
482     { 373, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS9, s_Dirs },
483     { 374, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS10, s_Dirs },
484     { 375, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS11, s_Dirs },
485     { 376, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS12, s_Dirs },
486     { 377, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS13, s_Dirs },
487     /* testdata/CmdLineUtils.exe with dirs (name only) */
488     { 378, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS0, s_Dirs },
489     { 379, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS1, s_Dirs },
490     { 380, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS2, s_Dirs },
491     { 381, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS3, s_Dirs },
492     { 382, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS4, s_Dirs },
493     { 383, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS5, s_Dirs },
494     { 384, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS6, s_Dirs },
495     { 385, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS7, s_Dirs },
496     { 386, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS8, s_Dirs },
497     { 387, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS9, s_Dirs },
498     { 388, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS10, s_Dirs },
499     { 389, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS11, s_Dirs },
500     { 390, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS12, s_Dirs },
501     { 391, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS13, s_Dirs },
502     /* GhostProgram.exe -> testdata/CmdLineUtils.exe (name only, app path) */
503     { 392, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS0 },
504     { 393, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS1 },
505     { 394, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS2 },
506     { 395, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS3 },
507     { 396, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS4 },
508     { 397, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS5 },
509     { 398, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS6 },
510     { 399, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS7 },
511     { 400, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS8 },
512     { 401, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS9 },
513     { 402, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS10 },
514     { 403, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS11 },
515     { 404, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS12 },
516     { 405, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS13 },
517     /* C:\ */
518     { 406, 1, BEEF, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS0 },
519     { 407, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS1 },
520     { 408, 1, BEEF, EF_FULLPATH, L"C:\\", NULL, FLAGS2 },
521     { 409, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS3 },
522     { 410, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS4 },
523     { 411, 1, BEEF, EF_FULLPATH, L"C:\\", NULL, FLAGS5 },
524     { 412, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS6 },
525     { 413, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS7 },
526     { 414, 1, BEEF, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS8 },
527     { 415, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS9 },
528     { 416, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS10 },
529     { 417, 1, BEEF, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS11 },
530     { 418, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS12 },
531     { 419, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"C:\\", L"C:\\", FLAGS13 },
532     /* CmdLineUtils.lnk */
533     { 420, 1, BEEF, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS0 },
534     { 421, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS1 },
535     { 422, 1, BEEF, EF_FULLPATH, s_LinkFilePath, NULL, FLAGS2 },
536     { 423, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS3 },
537     { 424, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS4 },
538     { 425, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS5 },
539     { 426, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS6 },
540     { 427, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS7 },
541     { 428, 1, BEEF, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS8 },
542     { 429, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS9 },
543     { 430, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS10 },
544     { 431, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS11 },
545     { 432, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS12 },
546     { 433, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS13 },
547     /* CmdLineUtils.lnk (with PRF_DONTFINDLNK) */
548     { 434, 1, BEEF, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS0 | PRF_DONTFINDLNK },
549     { 435, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS1 | PRF_DONTFINDLNK },
550     { 436, 1, BEEF, EF_FULLPATH, s_LinkFilePath, NULL, FLAGS2 | PRF_DONTFINDLNK },
551     { 437, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS3 | PRF_DONTFINDLNK },
552     { 438, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS4 | PRF_DONTFINDLNK },
553     { 439, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS5 | PRF_DONTFINDLNK },
554     { 440, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS6 | PRF_DONTFINDLNK },
555     { 441, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS7 | PRF_DONTFINDLNK },
556     { 442, 1, BEEF, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS8 | PRF_DONTFINDLNK },
557     { 443, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS9 | PRF_DONTFINDLNK },
558     { 444, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS10 | PRF_DONTFINDLNK },
559     { 445, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS11 | PRF_DONTFINDLNK },
560     { 446, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS12 | PRF_DONTFINDLNK },
561     { 447, RAISED, DEAD, EF_FULLPATH, s_LinkFilePath, s_LinkFilePath, FLAGS13 | PRF_DONTFINDLNK },
562 };
563 
564 static BOOL
565 CreateShortcut(LPCWSTR pszLnkFileName,
566                LPCWSTR pszTargetPathName)
567 {
568     IPersistFile *ppf;
569     IShellLinkW* psl;
570     HRESULT hres;
571 
572     hres = CoInitialize(NULL);
573     if (SUCCEEDED(hres))
574     {
575         hres = CoCreateInstance(CLSID_ShellLink, NULL,
576             CLSCTX_INPROC_SERVER, IID_IShellLinkW, (LPVOID*)&psl);
577         if (SUCCEEDED(hres))
578         {
579             psl->SetPath(pszTargetPathName);
580             hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
581             if (SUCCEEDED(hres))
582             {
583                 hres = ppf->Save(pszLnkFileName, TRUE);
584                 ppf->Release();
585             }
586             psl->Release();
587         }
588         CoUninitialize();
589     }
590     SetLastError(hres);
591 
592     return SUCCEEDED(hres);
593 }
594 
595 static BOOL
596 CreateRegAppPath(INT EntryNumber, const WCHAR* Name, const WCHAR* Value)
597 {
598     HKEY RegistryKey;
599     LONG Result;
600     WCHAR Buffer[1024];
601     DWORD Disposition;
602 
603     wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
604     wcscat(Buffer, Name);
605     Result = RegCreateKeyExW(HKEY_LOCAL_MACHINE, Buffer, 0, NULL,
606         0, KEY_WRITE, NULL, &RegistryKey, &Disposition);
607     if (Result != ERROR_SUCCESS)
608     {
609         trace("#%d: Could not create test key. Status: %lu\n", EntryNumber, Result);
610         return FALSE;
611     }
612     Result = RegSetValueW(RegistryKey, NULL, REG_SZ, Value, 0);
613     if (Result != ERROR_SUCCESS)
614     {
615         trace("#%d: Could not set value of the test key. Status: %lu\n", EntryNumber, Result);
616         RegCloseKey(RegistryKey);
617         return FALSE;
618     }
619     RegCloseKey(RegistryKey);
620     return TRUE;
621 }
622 
623 static BOOL
624 DeleteRegAppPath(INT EntryNumber, const WCHAR* Name)
625 {
626     LONG Result;
627     WCHAR Buffer[1024];
628     wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
629     wcscat(Buffer, Name);
630     Result = RegDeleteKeyW(HKEY_LOCAL_MACHINE, Buffer);
631     if (Result != ERROR_SUCCESS)
632     {
633         trace("#%d: Could not remove the test key. Status: %lu\n", EntryNumber, Result);
634         return FALSE;
635     }
636     return TRUE;
637 }
638 
639 static void DoEntry(INT EntryNumber, const ENTRY *pEntry)
640 {
641     WCHAR Path[MAX_PATH], PathExpected[MAX_PATH];
642     INT Ret;
643     DWORD Error;
644 
645     if (pEntry->NameBefore == NULL)
646     {
647         assert(pEntry->NameExpected == NULL);
648     }
649 
650     switch (pEntry->EF_ & EF_TYPE_MASK)
651     {
652     case EF_FULLPATH:
653         if (pEntry->NameBefore)
654         {
655             lstrcpyW(Path, pEntry->NameBefore);
656         }
657         if (pEntry->NameExpected)
658         {
659             lstrcpyW(PathExpected, pEntry->NameExpected);
660         }
661         break;
662 
663     case EF_TESTDATA:
664         if (pEntry->EF_ & EF_NAME_ONLY)
665         {
666             lstrcpyW(Path, pEntry->NameBefore);
667         }
668         else
669         {
670             lstrcpyW(Path, s_TestDataPath);
671             lstrcatW(Path, L"\\");
672             lstrcatW(Path, pEntry->NameBefore);
673         }
674 
675         if (pEntry->NameExpected)
676         {
677             lstrcpyW(PathExpected, s_TestDataPath);
678             lstrcatW(PathExpected, L"\\");
679             lstrcatW(PathExpected, pEntry->NameExpected);
680         }
681         break;
682 
683     case EF_WINDOWS_DIR:
684         if (pEntry->EF_ & EF_NAME_ONLY)
685         {
686             lstrcpyW(Path, pEntry->NameBefore);
687         }
688         else
689         {
690             GetWindowsDirectoryW(Path, _countof(Path));
691             lstrcatW(Path, L"\\");
692             lstrcatW(Path, pEntry->NameBefore);
693         }
694 
695         if (pEntry->NameExpected)
696         {
697             GetWindowsDirectoryW(PathExpected, _countof(PathExpected));
698             lstrcatW(PathExpected, L"\\");
699             lstrcatW(PathExpected, pEntry->NameExpected);
700         }
701         break;
702 
703     case EF_SYSTEM_DIR:
704         if (pEntry->EF_ & EF_NAME_ONLY)
705         {
706             lstrcpyW(Path, pEntry->NameBefore);
707         }
708         else
709         {
710             GetSystemDirectoryW(Path, _countof(Path));
711             lstrcatW(Path, L"\\");
712             lstrcatW(Path, pEntry->NameBefore);
713         }
714 
715         if (pEntry->NameExpected)
716         {
717             GetSystemDirectoryW(PathExpected, _countof(PathExpected));
718             lstrcatW(PathExpected, L"\\");
719             lstrcatW(PathExpected, pEntry->NameExpected);
720         }
721         break;
722     }
723 
724     if (pEntry->EF_ & EF_APP_PATH)
725     {
726         if (!CreateRegAppPath(EntryNumber, pEntry->NameBefore, PathExpected))
727         {
728             skip("#%d: CreateRegAppPath failure\n", EntryNumber);
729             return;
730         }
731     }
732 
733     _SEH2_TRY
734     {
735         SetLastError(BEEF);
736         if (pEntry->NameBefore)
737         {
738             Ret = (*s_pPathResolve)(Path, pEntry->Dirs, pEntry->Flags);
739         }
740         else
741         {
742             Ret = (*s_pPathResolve)(NULL, pEntry->Dirs, pEntry->Flags);
743         }
744         Error = GetLastError();
745     }
746     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
747     {
748         Ret = RAISED;
749         Error = DEAD;
750     }
751     _SEH2_END;
752 
753     if (pEntry->EF_ & EF_APP_PATH)
754     {
755         ok(DeleteRegAppPath(EntryNumber, pEntry->NameBefore),
756            "#%d: DeleteRegAppPath failed\n", EntryNumber);
757     }
758 
759     ok(Ret == pEntry->Ret, "#%d: Ret expected %d, was %d.\n",
760        EntryNumber, pEntry->Ret, Ret);
761     if (pEntry->Error != IGNORE_ERR)
762     {
763         ok(Error == pEntry->Error, "#%d: last error expected %ld, was %ld.\n",
764            EntryNumber, pEntry->Error, Error);
765     }
766 
767     if (pEntry->NameExpected && !(pEntry->EF_ & EF_APP_PATH))
768     {
769         ok(lstrcmpW(Path, PathExpected) == 0, "#%d: Path expected %s, was %s.\n",
770            EntryNumber, wine_dbgstr_w(PathExpected), wine_dbgstr_w(Path));
771     }
772 }
773 
774 static void TestMain_PathResolve(void)
775 {
776     UINT i;
777     WCHAR Saved[128], *pPathExtSaved;
778 
779     /* save PATHEXT */
780     if (GetEnvironmentVariableW(L"PATHEXT", Saved, _countof(Saved)))
781     {
782         pPathExtSaved = Saved;
783     }
784     else
785     {
786         pPathExtSaved = NULL;
787     }
788 
789     /* normal */
790     for (i = 0; i < _countof(s_Entries); ++i)
791     {
792         DoEntry(s_Entries[i].EntryNumber, &s_Entries[i]);
793     }
794 
795     /* +#1000: reset PATHEXT */
796     if (SetEnvironmentVariableW(L"PATHEXT", NULL))
797     {
798         for (i = 0; i < _countof(s_Entries); ++i)
799         {
800             DoEntry(s_Entries[i].EntryNumber + 1000, &s_Entries[i]);
801         }
802     }
803     else
804     {
805         skip("SetEnvironmentVariableW failed\n");
806     }
807 
808     /* +#2000: set PATHEXT to ".COM;.EXE;.BAT" */
809     if (SetEnvironmentVariableW(L"PATHEXT", L".COM;.EXE;.BAT"))
810     {
811         for (i = 0; i < _countof(s_Entries); ++i)
812         {
813             DoEntry(s_Entries[i].EntryNumber + 2000, &s_Entries[i]);
814         }
815     }
816     else
817     {
818         skip("SetEnvironmentVariableW failed\n");
819     }
820 
821     /* +#3000: set PATHEXT to ".TXT" */
822     if (SetEnvironmentVariableW(L"PATHEXT", L".TXT"))
823     {
824         for (i = 0; i < _countof(s_Entries); ++i)
825         {
826             DoEntry(s_Entries[i].EntryNumber + 3000, &s_Entries[i]);
827         }
828     }
829     else
830     {
831         skip("SetEnvironmentVariableW failed\n");
832     }
833 
834     /* restore PATHEXT */
835     SetEnvironmentVariableW(L"PATHEXT", pPathExtSaved);
836 }
837 
838 START_TEST(PathResolve)
839 {
840     LPWSTR pch;
841 
842     GetModuleFileNameW(NULL, s_TestDataPath, _countof(s_TestDataPath));
843     pch = wcsrchr(s_TestDataPath, L'\\');
844     if (pch == NULL)
845         pch = wcsrchr(s_TestDataPath, L'/');
846     if (pch == NULL)
847     {
848         skip("GetModuleFileName and/or wcsrchr are insane.\n");
849         return;
850     }
851     lstrcpyW(pch, L"\\testdata");
852     if (GetFileAttributesW(s_TestDataPath) == INVALID_FILE_ATTRIBUTES)
853     {
854         skip("testdata is not found.\n");
855         return;
856     }
857 
858     s_Dirs[0] = s_TestDataPath;
859     s_Dirs[1] = NULL;
860 
861     lstrcpyW(s_LinkFilePath, s_TestDataPath);
862     lstrcatW(s_LinkFilePath, L"\\");
863     lstrcatW(s_LinkFilePath, L"CmdLineUtils.lnk");
864 
865     lstrcpyW(s_LinkTargetPath, s_TestDataPath);
866     lstrcatW(s_LinkTargetPath, L"\\");
867     lstrcatW(s_LinkTargetPath, L"2PRONG.txt");
868 
869     ok(CreateShortcut(s_LinkFilePath, s_LinkTargetPath),
870        "CreateShortcut(%s, %s) failed.\n",
871        wine_dbgstr_w(s_LinkFilePath), wine_dbgstr_w(s_LinkTargetPath));
872 
873     s_hShell32 = LoadLibraryA("shell32");
874     if (s_hShell32 == NULL)
875     {
876         skip("Unable to load shell32.\n");
877         return;
878     }
879 
880     s_pPathResolve = (PATHRESOLVE)GetProcAddress(s_hShell32, "PathResolve");
881     if (s_pPathResolve == NULL)
882     {
883         skip("Unable to get PathResolve address.\n");
884         return;
885     }
886 
887     TestMain_PathResolve();
888 
889     ok(DeleteFileW(s_LinkFilePath), "DeleteFileW(%s) failed\n",
890        wine_dbgstr_w(s_LinkFilePath));
891 
892     FreeLibrary(s_hShell32);
893     s_hShell32 = NULL;
894     s_pPathResolve = NULL;
895 }
896