ReactOS  0.4.15-dev-5496-g599ba9c
PathResolve.cpp
Go to the documentation of this file.
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 <stdio.h>
11 #include <assert.h>
12 
13 /*
14  * NOTE: "App Paths" registry key and PATHEXT environment variable
15  * have no effect for PathResolve.
16  */
17 
18 /* PathResolve */
20 
21 /* IsLFNDriveW */
23 
33 static LPWSTR s_Dirs[2] = { s_TestDir, NULL };
35 
36 /* PathResolve flags */
37 #ifndef PRF_VERIFYEXISTS
38  #define PRF_VERIFYEXISTS 0x01
39  #define PRF_EXECUTABLE 0x02
40  #define PRF_TRYPROGRAMEXTENSIONS (PRF_EXECUTABLE | PRF_VERIFYEXISTS)
41  #define PRF_FIRSTDIRDEF 0x04
42  #define PRF_DONTFINDLNK 0x08
43 #endif
44 #ifndef PRF_REQUIREABSOLUTE
45  #define PRF_REQUIREABSOLUTE 0x10
46 #endif
47 
48 /* Abstraction of PathResolve flags to manage the test entries */
49 #define FLAGS0 0
50 #define FLAGS1 PRF_VERIFYEXISTS
51 #define FLAGS2 PRF_EXECUTABLE
52 #define FLAGS3 PRF_TRYPROGRAMEXTENSIONS
53 #define FLAGS4 (PRF_FIRSTDIRDEF | PRF_VERIFYEXISTS)
54 #define FLAGS5 (PRF_FIRSTDIRDEF | PRF_EXECUTABLE)
55 #define FLAGS6 (PRF_FIRSTDIRDEF | PRF_TRYPROGRAMEXTENSIONS)
56 #define FLAGS7 (PRF_REQUIREABSOLUTE | PRF_VERIFYEXISTS)
57 #define FLAGS8 (PRF_REQUIREABSOLUTE | PRF_EXECUTABLE)
58 #define FLAGS9 (PRF_REQUIREABSOLUTE | PRF_TRYPROGRAMEXTENSIONS)
59 #define FLAGS10 (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_VERIFYEXISTS)
60 #define FLAGS11 (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_EXECUTABLE)
61 #define FLAGS12 (PRF_REQUIREABSOLUTE | PRF_FIRSTDIRDEF | PRF_TRYPROGRAMEXTENSIONS)
62 #define FLAGS13 0xFFFFFFFF
63 
64 /* The test entry structure */
65 typedef struct tagTEST_ENTRY
66 {
67  INT LineNumber; /* # */
76 
77 /* Flags for TEST_ENTRY */
78 #define EF_FULLPATH 0x01
79 #define EF_TESTDATA 0x02
80 #define EF_TYPE_MASK 0x0F
81 #define EF_NAME_ONLY 0x10
82 #define EF_APP_PATH 0x20
83 
84 #define RET_IGNORE 0x00BEF00D
85 
86 /* Special error codes */
87 #define ERR_NO_CHANGE 0xBEEF /* Error Code 48879 */
88 #define ERR_DEAD 0xDEAD /* Error Code 57005 */
89 #define ERR_IGNORE 0x7F7F7F7F /* Ignore Error Code */
90 #define RAISED 9999 /* exception raised */
91 
92 /* The test entries for long file name (LFN) */
93 static const TEST_ENTRY s_LFNEntries[] =
94 {
95  /* null path */
96  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS0 },
97  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS1 },
98  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS2 },
99  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS3 },
100  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS4 },
101  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS5 },
102  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS6 },
103  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS7 },
104  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS8 },
105  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS9 },
106  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS10 },
107  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS11 },
108  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS12 },
109  { __LINE__, RAISED, ERR_DEAD, EF_FULLPATH, NULL, NULL, FLAGS13 },
110  /* empty path */
111  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"", NULL, FLAGS0 },
112  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS1 },
113  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS2 },
114  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS3 },
115  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS4 },
116  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS5 },
117  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS6 },
118  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS7 },
119  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS8 },
120  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS9 },
121  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS10 },
122  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS11 },
123  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS12 },
124  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"", NULL, FLAGS13 },
125  /* invalid name */
126  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS0 },
127  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS1 },
128  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS2 },
129  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS3 },
130  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS4 },
131  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS5 },
132  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS6 },
133  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS7 },
134  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS8 },
135  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS9 },
136  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS10 },
137  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS11 },
138  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS12 },
139  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"invalid name", L"invalid name", FLAGS13 },
140  /* testdir/2PRONG (path) */
141  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS0 },
142  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS1 },
143  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS2 },
144  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS3 },
145  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS4 },
146  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS5 },
147  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS6 },
148  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS7 },
149  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS8 },
150  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS9 },
151  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS10 },
152  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS11 },
153  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS12 },
154  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG", L"2PRONG", FLAGS13 },
155  /* testdir/2PRONG (name only) */
156  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS0 },
157  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS1 },
158  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS2 },
159  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS3 },
160  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS4 },
161  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS5 },
162  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS6 },
163  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS7 },
164  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS8 },
165  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS9 },
166  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS10 },
167  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS11 },
168  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS12 },
169  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS13 },
170  /* testdir/2PRONG with dirs (name only) */
171  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS0, s_Dirs },
172  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS1, s_Dirs },
173  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS2, s_Dirs },
174  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS3, s_Dirs },
175  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS4, s_Dirs },
176  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS5, s_Dirs },
177  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS6, s_Dirs },
178  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS7, s_Dirs },
179  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS8, s_Dirs },
180  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS9, s_Dirs },
181  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS10, s_Dirs },
182  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS11, s_Dirs },
183  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS12, s_Dirs },
184  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG", NULL, FLAGS13, s_Dirs },
185  /* testdir/2PRONG (name only, app path) */
186  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS0 },
187  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS1 },
188  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS2 },
189  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS3 },
190  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS4 },
191  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS5 },
192  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS6 },
193  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS7 },
194  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS8 },
195  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS9 },
196  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS10 },
197  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS11 },
198  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS12 },
199  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"2PRONG", L"2PRONG", FLAGS13 },
200  /* 2PRONG.txt */
201  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS0 },
202  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS1 },
203  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS2 },
204  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS3 },
205  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS4 },
206  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS5 },
207  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS6 },
208  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS7 },
209  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS8 },
210  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS9 },
211  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS10 },
212  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS11 },
213  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS12 },
214  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS13 },
215  /* 2PRONG.txt with dirs */
216  { __LINE__, 1, ERR_IGNORE, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS0, s_Dirs },
217  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS1, s_Dirs },
218  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS2, s_Dirs },
219  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS3, s_Dirs },
220  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS4, s_Dirs },
221  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS5, s_Dirs },
222  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS6, s_Dirs },
223  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS7, s_Dirs },
224  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS8, s_Dirs },
225  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS9, s_Dirs },
226  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS10, s_Dirs },
227  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS11, s_Dirs },
228  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS12, s_Dirs },
229  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"2PRONG.txt", L"2PRONG.txt", FLAGS13, s_Dirs },
230  /* 2PRONG.txt with dirs (path) */
231  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS0, s_Dirs },
232  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS1, s_Dirs },
233  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS2, s_Dirs },
234  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS3, s_Dirs },
235  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS4, s_Dirs },
236  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS5, s_Dirs },
237  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS6, s_Dirs },
238  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS7, s_Dirs },
239  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS8, s_Dirs },
240  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS9, s_Dirs },
241  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS10, s_Dirs },
242  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS11, s_Dirs },
243  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS12, s_Dirs },
244  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS13, s_Dirs },
245  /* 2PRONG.txt (with a trailing backslash) */
260  /* 2PRONG.txt with dirs (with a trailing backslash) */
275  /* 2PRONG.txt with dirs (with a trailing backslash) */
276  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS0, s_Dirs },
277  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS1, s_Dirs },
278  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS2, s_Dirs },
279  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS3, s_Dirs },
280  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS4, s_Dirs },
281  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS5, s_Dirs },
282  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS6, s_Dirs },
283  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS7, s_Dirs },
284  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS8, s_Dirs },
285  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS9, s_Dirs },
286  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS10, s_Dirs },
287  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS11, s_Dirs },
288  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS12, s_Dirs },
289  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"2PRONG.txt", s_LinkTarget, FLAGS13, s_Dirs },
290  /* 2PRONG.txt with dirs (with a trailing backslash) (s_DirsWithBackslash) */
305  /* 2PRONG.txt (double backslash) */
320  /* 2PRONG.txt with dirs (double backslash) */
335  /* 2PRONG.txt (name only) */
336  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS0 },
337  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS1 },
338  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS2 },
339  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS3 },
340  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS4 },
341  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS5 },
342  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS6 },
343  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS7 },
344  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS8 },
345  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS9 },
346  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS10 },
347  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS11 },
348  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS12 },
349  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", NULL, FLAGS13 },
350  /* .\2PRONG.txt with dirs (path) */
351  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L".\\2PRONG.txt", NULL, FLAGS0, s_Dirs },
352  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\2PRONG.txt", NULL, FLAGS1, s_Dirs },
353  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L".\\2PRONG.txt", NULL, FLAGS2, s_Dirs },
354  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\2PRONG.txt", NULL, FLAGS3, s_Dirs },
355  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\2PRONG.txt", s_LinkTarget, FLAGS4, s_Dirs },
356  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L".\\2PRONG.txt", NULL, FLAGS5, s_Dirs },
357  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\2PRONG.txt", NULL, FLAGS6, s_Dirs },
358  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\2PRONG.txt", NULL, FLAGS7, s_Dirs },
359  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L".\\2PRONG.txt", NULL, FLAGS8, s_Dirs },
360  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\2PRONG.txt", NULL, FLAGS9, s_Dirs },
361  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\2PRONG.txt", s_LinkTarget, FLAGS10, s_Dirs },
362  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L".\\2PRONG.txt", NULL, FLAGS11, s_Dirs },
363  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\2PRONG.txt", s_LinkTarget, FLAGS12, s_Dirs },
364  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\2PRONG.txt", s_LinkTarget, FLAGS13, s_Dirs },
365  /* .\\2PRONG.txt with dirs (path) */
366  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L".\\\\2PRONG.txt", NULL, FLAGS0, s_Dirs },
367  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\\\2PRONG.txt", NULL, FLAGS1, s_Dirs },
368  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L".\\\\2PRONG.txt", NULL, FLAGS2, s_Dirs },
369  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\\\2PRONG.txt", NULL, FLAGS3, s_Dirs },
370  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\\\2PRONG.txt", s_LinkTarget, FLAGS4, s_Dirs },
371  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L".\\\\2PRONG.txt", NULL, FLAGS5, s_Dirs },
372  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\\\2PRONG.txt", NULL, FLAGS6, s_Dirs },
373  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\\\2PRONG.txt", NULL, FLAGS7, s_Dirs },
374  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L".\\\\2PRONG.txt", NULL, FLAGS8, s_Dirs },
375  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\\\2PRONG.txt", NULL, FLAGS9, s_Dirs },
376  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\\\2PRONG.txt", s_LinkTarget, FLAGS10, s_Dirs },
377  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L".\\\\2PRONG.txt", NULL, FLAGS11, s_Dirs },
378  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\\\2PRONG.txt", s_LinkTarget, FLAGS12, s_Dirs },
379  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L".\\\\2PRONG.txt", s_LinkTarget, FLAGS13, s_Dirs },
380  /* .\..\.\testdir\..\testdir\2PRONG.txt with dirs */
381  { __LINE__, 1, ERR_IGNORE, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS0, s_Dirs },
382  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS1, s_Dirs },
383  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS2, s_Dirs },
384  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS3, s_Dirs },
385  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS4, s_Dirs },
386  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS5, s_Dirs },
387  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS6, s_Dirs },
388  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS7, s_Dirs },
389  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS8, s_Dirs },
390  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS9, s_Dirs },
391  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS10, s_Dirs },
392  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS11, s_Dirs },
393  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS12, s_Dirs },
394  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L".\\..\\.\\testdir\\..\\testdir\\2PRONG.txt", L"2PRONG.txt", FLAGS13, s_Dirs },
395  /* ..\testdir\.\..\testdir\.\.\2PRONG.txt with dirs (path) */
396  { __LINE__, 1, ERR_IGNORE, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", NULL, FLAGS0, s_Dirs },
397  { __LINE__, RET_IGNORE, ERR_IGNORE, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", NULL, FLAGS1, s_Dirs },
398  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", NULL, FLAGS2, s_Dirs },
399  { __LINE__, RET_IGNORE, ERR_IGNORE, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", NULL, FLAGS3, s_Dirs },
400  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", s_LinkTarget, FLAGS4, s_Dirs },
401  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", s_LinkTarget, FLAGS5, s_Dirs },
402  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", s_LinkTarget, FLAGS6, s_Dirs },
403  { __LINE__, RET_IGNORE, ERR_IGNORE, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", NULL, FLAGS7, s_Dirs },
404  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", NULL, FLAGS8, s_Dirs },
405  { __LINE__, RET_IGNORE, ERR_IGNORE, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", NULL, FLAGS9, s_Dirs },
406  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", s_LinkTarget, FLAGS10, s_Dirs },
407  { __LINE__, 1, ERR_NO_CHANGE, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", s_LinkTarget, FLAGS11, s_Dirs },
408  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", s_LinkTarget, FLAGS12, s_Dirs },
409  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_FULLPATH, L"..\\testdir\\.\\..\\testdir\\.\\.\\2PRONG.txt", s_LinkTarget, FLAGS13, s_Dirs },
410  /* 2PRONG.txt with dirs (name only) */
411  { __LINE__, 1, ERR_IGNORE, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS0, s_Dirs },
412  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS1, s_Dirs },
413  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS2, s_Dirs },
414  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS3, s_Dirs },
415  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS4, s_Dirs },
416  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS5, s_Dirs },
417  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS6, s_Dirs },
418  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS7, s_Dirs },
419  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS8, s_Dirs },
420  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS9, s_Dirs },
421  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS10, s_Dirs },
422  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS11, s_Dirs },
423  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS12, s_Dirs },
424  { __LINE__, 1, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"2PRONG.txt", L"2PRONG.txt", FLAGS13, s_Dirs },
425  /* testdir/CmdLineUtils (path) */
426  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS0 },
427  { __LINE__, 1, ERR_IGNORE, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils.lnk", FLAGS1 },
428  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS2 },
429  { __LINE__, 1, ERR_IGNORE, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils.lnk", FLAGS3 },
430  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS4 },
431  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS5 },
432  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS6 },
433  { __LINE__, 1, ERR_IGNORE, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils.lnk", FLAGS7 },
434  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS8 },
435  { __LINE__, 1, ERR_IGNORE, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils.lnk", FLAGS9 },
436  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS10 },
437  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS11 },
438  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS12 },
439  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS13 },
440  /* testdir/CmdLineUtils with PRF_DONTFINDLNK (path) */
441  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS0 | PRF_DONTFINDLNK },
442  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS1 | PRF_DONTFINDLNK },
443  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS2 | PRF_DONTFINDLNK },
444  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS3 | PRF_DONTFINDLNK },
445  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS4 | PRF_DONTFINDLNK },
446  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS5 | PRF_DONTFINDLNK },
447  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS6 | PRF_DONTFINDLNK },
448  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS7 | PRF_DONTFINDLNK },
449  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS8 | PRF_DONTFINDLNK },
450  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS9 | PRF_DONTFINDLNK },
451  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS10 | PRF_DONTFINDLNK },
452  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS11 | PRF_DONTFINDLNK },
453  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS12 | PRF_DONTFINDLNK },
454  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils", L"CmdLineUtils", FLAGS13 | PRF_DONTFINDLNK },
455  /* testdir/CmdLineUtils (name only) */
456  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS0 },
457  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS1 },
458  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS2 },
459  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS3 },
460  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS4 },
461  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS5 },
462  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS6 },
463  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS7 },
464  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS8 },
465  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS9 },
466  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS10 },
467  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS11 },
468  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS12 },
469  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils", NULL, FLAGS13 },
470  /* testdir/CmdLineUtils.exe (path) */
471  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS0 },
472  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS1 },
473  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS2 },
474  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS3 },
475  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS4 },
476  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS5 },
477  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS6 },
478  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS7 },
479  { __LINE__, 1, ERR_NO_CHANGE, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS8 },
480  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS9 },
481  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS10 },
482  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS11 },
483  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS12 },
484  { __LINE__, RAISED, ERR_DEAD, EF_TESTDATA, L"CmdLineUtils.exe", L"CmdLineUtils.exe", FLAGS13 },
485  /* testdir/CmdLineUtils.exe (name only) */
486  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS0 },
487  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS1 },
488  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS2 },
489  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS3 },
490  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS4 },
491  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS5 },
492  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS6 },
493  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS7 },
494  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS8 },
495  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS9 },
496  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS10 },
497  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS11 },
498  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS12 },
499  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS13 },
500  /* testdir/CmdLineUtils.exe with dirs (name only) */
501  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS0, s_Dirs },
502  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS1, s_Dirs },
503  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS2, s_Dirs },
504  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS3, s_Dirs },
505  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS4, s_Dirs },
506  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS5, s_Dirs },
507  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS6, s_Dirs },
508  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS7, s_Dirs },
509  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS8, s_Dirs },
510  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS9, s_Dirs },
511  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS10, s_Dirs },
512  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS11, s_Dirs },
513  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS12, s_Dirs },
514  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS13, s_Dirs },
515  /* testdir/CmdLineUtils.exe with dirs (name only) */
516  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS0, s_Dirs },
517  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS1, s_Dirs },
518  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS2, s_Dirs },
519  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS3, s_Dirs },
520  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS4, s_Dirs },
521  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS5, s_Dirs },
522  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS6, s_Dirs },
523  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS7, s_Dirs },
524  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS8, s_Dirs },
525  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS9, s_Dirs },
526  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS10, s_Dirs },
527  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS11, s_Dirs },
528  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS12, s_Dirs },
529  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY, L"CmdLineUtils.exe", NULL, FLAGS13, s_Dirs },
530  /* GhostProgram.exe -> testdir/CmdLineUtils.exe (name only, app path) */
531  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS0 },
532  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS1 },
533  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS2 },
534  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS3 },
535  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS4 },
536  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS5 },
537  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS6 },
538  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS7 },
539  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS8 },
540  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS9 },
541  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS10 },
542  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS11 },
543  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS12 },
544  { __LINE__, 0, ERROR_FILE_NOT_FOUND, EF_TESTDATA | EF_NAME_ONLY | EF_APP_PATH, L"GhostProgram.exe", L"CmdLineUtils.exe", FLAGS13 },
545  /* CmdLineUtils.lnk */
560  /* CmdLineUtils.lnk (with PRF_DONTFINDLNK) */
575 };
576 
577 static BOOL
578 CreateShortcut(LPCWSTR pszLnkFileName,
579  LPCWSTR pszTargetPathName)
580 {
581  IPersistFile *ppf;
582  IShellLinkW* psl;
583  HRESULT hres;
584 
586  if (SUCCEEDED(hres))
587  {
588  hres = CoCreateInstance(CLSID_ShellLink, NULL,
589  CLSCTX_INPROC_SERVER, IID_IShellLinkW, (LPVOID*)&psl);
590  if (SUCCEEDED(hres))
591  {
592  psl->SetPath(pszTargetPathName);
593  hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
594  if (SUCCEEDED(hres))
595  {
596  hres = ppf->Save(pszLnkFileName, TRUE);
597  ppf->Release();
598  }
599  psl->Release();
600  }
601  CoUninitialize();
602  }
604 
605  return SUCCEEDED(hres);
606 }
607 
608 static BOOL
609 CreateRegAppPath(INT SectionNumber, INT LineNumber, const WCHAR* Name, const WCHAR* Value)
610 {
611  HKEY RegistryKey;
612  LONG Result;
613  WCHAR Buffer[1024];
615 
616  wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
617  wcscat(Buffer, Name);
619  0, KEY_WRITE, NULL, &RegistryKey, &Disposition);
620  if (Result != ERROR_SUCCESS)
621  {
622  trace("Section %d, Line %d: Could not create test key. Status: %lu\n",
623  SectionNumber, LineNumber, Result);
624  return FALSE;
625  }
626  Result = RegSetValueW(RegistryKey, NULL, REG_SZ, Value, 0);
627  if (Result != ERROR_SUCCESS)
628  {
629  trace("Section %d, Line %d: Could not set value of the test key. Status: %lu\n",
630  SectionNumber, LineNumber, Result);
631  RegCloseKey(RegistryKey);
632  return FALSE;
633  }
634  RegCloseKey(RegistryKey);
635  return TRUE;
636 }
637 
638 static BOOL
639 DeleteRegAppPath(INT SectionNumber, INT LineNumber, const WCHAR* Name)
640 {
641  LONG Result;
642  WCHAR Buffer[1024];
643  wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
644  wcscat(Buffer, Name);
646  if (Result != ERROR_SUCCESS)
647  {
648  trace("Section %d, Line %d: Could not remove the test key. Status: %lu\n",
649  SectionNumber, LineNumber, Result);
650  return FALSE;
651  }
652  return TRUE;
653 }
654 
655 static void DoEntry(INT SectionNumber, INT LineNumber, const TEST_ENTRY *pEntry)
656 {
657  WCHAR Path[MAX_PATH], PathExpected[MAX_PATH];
658  INT Ret;
659  DWORD Error;
660 
661  ZeroMemory(Path, sizeof(Path));
662  ZeroMemory(PathExpected, sizeof(PathExpected));
663 
664  if (pEntry->NameBefore == NULL)
665  {
666  assert(pEntry->NameExpected == NULL);
667  }
668 
669  switch (pEntry->EF_ & EF_TYPE_MASK)
670  {
671  case EF_FULLPATH:
672  if (pEntry->NameBefore)
673  {
674  lstrcpyW(Path, pEntry->NameBefore);
675  }
676  if (pEntry->NameExpected)
677  {
678  lstrcpyW(PathExpected, pEntry->NameExpected);
679  }
680  break;
681 
682  case EF_TESTDATA:
683  if (pEntry->EF_ & EF_NAME_ONLY)
684  {
685  lstrcpyW(Path, pEntry->NameBefore);
686  }
687  else
688  {
690  lstrcatW(Path, L"\\");
691  lstrcatW(Path, pEntry->NameBefore);
692  }
693 
694  if (pEntry->NameExpected)
695  {
696  lstrcpyW(PathExpected, s_TestDir);
697  lstrcatW(PathExpected, L"\\");
698  lstrcatW(PathExpected, pEntry->NameExpected);
699  }
700  break;
701 
702  default:
703  assert(0);
704  break;
705  }
706 
707  if (pEntry->EF_ & EF_APP_PATH)
708  {
709  if (!CreateRegAppPath(SectionNumber, LineNumber, pEntry->NameBefore, PathExpected))
710  {
711  skip("Section %d, Line %d: CreateRegAppPath failure\n", SectionNumber, LineNumber);
712  return;
713  }
714  }
715 
716  _SEH2_TRY
717  {
719  if (pEntry->NameBefore)
720  {
721  Ret = (*s_pPathResolve)(Path, pEntry->Dirs, pEntry->Flags);
722  }
723  else
724  {
725  Ret = (*s_pPathResolve)(NULL, pEntry->Dirs, pEntry->Flags);
726  }
727  Error = GetLastError();
728  }
730  {
731  Ret = RAISED;
732  Error = ERR_DEAD;
733  }
734  _SEH2_END;
735 
736  if (pEntry->EF_ & EF_APP_PATH)
737  {
738  ok(DeleteRegAppPath(SectionNumber, LineNumber, pEntry->NameBefore),
739  "Section %d, Line %d: DeleteRegAppPath failed\n", SectionNumber, LineNumber);
740  }
741 
742  if (pEntry->Ret != RET_IGNORE)
743  {
744  ok(Ret == pEntry->Ret, "Section %d, Line %d: Ret expected %d, was %d.\n",
745  SectionNumber, LineNumber, pEntry->Ret, Ret);
746  }
747 
748  if (pEntry->Error != ERR_IGNORE)
749  {
750  ok(Error == pEntry->Error, "Section %d, Line %d: last error expected %ld, was %ld.\n",
751  SectionNumber, LineNumber, pEntry->Error, Error);
752  }
753 
754  if (pEntry->NameExpected && !(pEntry->EF_ & EF_APP_PATH))
755  {
756  char expected[MAX_PATH];
757  char path[MAX_PATH];
758 
761 
762  ok(lstrcmpW(Path, PathExpected) == 0, "Section %d, Line %d: Path expected %s, was %s.\n",
763  SectionNumber, LineNumber, expected, path);
764  }
765 }
766 
767 static void TestMain_PathResolve(void)
768 {
769  UINT i, cEntries;
770  const TEST_ENTRY *pEntries;
771  WCHAR Saved[128], *pPathExtSaved;
772 
773  pEntries = s_LFNEntries;
775 
776  /* save PATHEXT */
777  if (GetEnvironmentVariableW(L"PATHEXT", Saved, _countof(Saved)))
778  pPathExtSaved = Saved;
779  else
780  pPathExtSaved = NULL;
781 
782  /* Section 1 */
783  for (i = 0; i < cEntries; ++i)
784  {
785  DoEntry(1, pEntries[i].LineNumber, &pEntries[i]);
786  }
787 
788  /* Section 2: reset PATHEXT */
789  if (SetEnvironmentVariableW(L"PATHEXT", NULL))
790  {
791  for (i = 0; i < cEntries; ++i)
792  {
793  DoEntry(2, pEntries[i].LineNumber, &pEntries[i]);
794  }
795  }
796  else
797  {
798  skip("SetEnvironmentVariableW failed\n");
799  }
800 
801  /* Section 3: set PATHEXT to ".COM;.EXE;.BAT" */
802  if (SetEnvironmentVariableW(L"PATHEXT", L".COM;.EXE;.BAT"))
803  {
804  for (i = 0; i < cEntries; ++i)
805  {
806  DoEntry(3, pEntries[i].LineNumber, &pEntries[i]);
807  }
808  }
809  else
810  {
811  skip("SetEnvironmentVariableW failed\n");
812  }
813 
814  /* Section 4: set PATHEXT to ".TXT" */
815  if (SetEnvironmentVariableW(L"PATHEXT", L".TXT"))
816  {
817  for (i = 0; i < cEntries; ++i)
818  {
819  DoEntry(4, pEntries[i].LineNumber, &pEntries[i]);
820  }
821  }
822  else
823  {
824  skip("SetEnvironmentVariableW failed\n");
825  }
826 
827  /* restore PATHEXT */
828  SetEnvironmentVariableW(L"PATHEXT", pPathExtSaved);
829 }
830 
831 START_TEST(PathResolve)
832 {
833  LPWSTR pch;
834  WCHAR szRoot[MAX_PATH];
835 
836  /* Get this program's path */
838 
839  /* Add '\testdir' to the path */
840  pch = wcsrchr(s_TestDir, L'\\');
841  if (pch == NULL)
842  {
843  skip("GetModuleFileName and/or wcsrchr are insane.\n");
844  return;
845  }
846  lstrcpyW(pch, L"\\testdir");
847 
848  /* Create the testdir directory */
851  {
852  skip("testdir is not found.\n");
853  return;
854  }
855 
856  /* Build s_TestDirWithBackslash path */
859 
860  /* Build s_LinkTarget path */
862  lstrcatW(s_LinkTarget, L"\\");
863  lstrcatW(s_LinkTarget, L"2PRONG.txt");
864 
865  /* Create the file */
866  fclose(_wfopen(s_LinkTarget, L"wb"));
867  ok(GetFileAttributesW(s_LinkTarget) != INVALID_FILE_ATTRIBUTES, "s_LinkTarget not found\n");
868 
869  /* Build s_LinkTargetWithBackslash path */
872  lstrcatW(s_LinkTargetWithBackslash, L"2PRONG.txt");
874 
875  /* Build s_LinkTargetDoubleBackslash path */
878  lstrcatW(s_LinkTargetDoubleBackslash, L"2PRONG.txt");
879 
880  /* Build s_ShortcutLongName path */
883  lstrcatW(s_ShortcutLongName, L"CmdLineUtils.lnk"); /* in Long File Name */
884 
885  /* Create s_ShortcutLongName shortcut file */
887  "CreateShortcut(%s, %s) failed.\n",
889 
890  /* Load shell32.dll */
891  s_hShell32 = LoadLibraryA("shell32");
892  if (s_hShell32 == NULL)
893  {
894  skip("Unable to load shell32.\n");
895  goto Cleanup;
896  }
897 
898  /* Get PathResolve procedure */
900  if (s_pPathResolve == NULL)
901  {
902  skip("Unable to get PathResolve address.\n");
903  goto Cleanup;
904  }
905 
906  /* Get IsLFNDriveW procedure */
908  if (s_pIsLFNDriveW == NULL)
909  {
910  skip("Unable to get IsLFNDriveW address.\n");
911  goto Cleanup;
912  }
913 
914  /* Is LFN supported? */
915  lstrcpyW(szRoot, s_TestDir);
916  PathStripToRootW(szRoot);
917  if (!s_pIsLFNDriveW(szRoot))
918  {
919  skip("LFN is not supported in this drive %s.\n", wine_dbgstr_w(szRoot));
920  goto Cleanup;
921  }
922 
923  /* Do tests */
925 
926  /* Clean up */
927 Cleanup:
932 }
#define FLAGS7
Definition: PathResolve.cpp:56
_SEH2_TRY
Definition: create.c:4226
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
#define FLAGS8
Definition: PathResolve.cpp:57
static WCHAR s_TestDirWithBackslash[MAX_PATH]
Definition: PathResolve.cpp:28
static WCHAR s_TestDir[MAX_PATH]
Definition: PathResolve.cpp:27
static LPWSTR s_DirsWithBackslash[2]
Definition: PathResolve.cpp:34
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FLAGS11
Definition: PathResolve.cpp:60
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
INT LineNumber
Definition: PathResolve.cpp:67
#define TRUE
Definition: types.h:120
struct tagTEST_ENTRY TEST_ENTRY
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
static void TestMain_PathResolve(void)
#define PRF_DONTFINDLNK
Definition: PathResolve.cpp:42
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static WCHAR s_LinkTargetWithBackslash[MAX_PATH]
Definition: PathResolve.cpp:31
static const TEST_ENTRY s_LFNEntries[]
Definition: PathResolve.cpp:93
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
LONG WINAPI RegSetValueW(HKEY hKeyOriginal, LPCWSTR lpSubKey, DWORD dwType, LPCWSTR lpData, DWORD cbData)
Definition: reg.c:5017
INT Ret
Definition: PathResolve.cpp:68
#define assert(x)
Definition: debug.h:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1670
static WCHAR s_LinkTarget[MAX_PATH]
Definition: PathResolve.cpp:30
LPCWSTR NameBefore
Definition: PathResolve.cpp:71
static LPWSTR s_Dirs[2]
Definition: PathResolve.cpp:33
#define FLAGS3
Definition: PathResolve.cpp:52
_SEH2_END
Definition: create.c:4400
static void DoEntry(INT SectionNumber, INT LineNumber, const TEST_ENTRY *pEntry)
int32_t INT_PTR
Definition: typedefs.h:64
static BOOL DeleteRegAppPath(INT SectionNumber, INT LineNumber, const WCHAR *Name)
int(WINAPI * PATHRESOLVE)(LPWSTR, LPWSTR *, UINT)
Definition: PathResolve.cpp:19
static PATHRESOLVE s_pPathResolve
Definition: PathResolve.cpp:25
#define BOOL
Definition: nt_native.h:43
BOOL(WINAPI * ISLFNDRIVEW)(LPCWSTR)
Definition: PathResolve.cpp:22
int32_t INT
Definition: typedefs.h:58
#define ERR_NO_CHANGE
Definition: PathResolve.cpp:87
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
#define pch(ap)
Definition: match.c:418
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LPWSTR * Dirs
Definition: PathResolve.cpp:74
#define EF_NAME_ONLY
Definition: PathResolve.cpp:81
#define RET_IGNORE
Definition: PathResolve.cpp:84
UINT EF_
Definition: PathResolve.cpp:70
#define ERR_IGNORE
Definition: PathResolve.cpp:89
#define L(x)
Definition: ntvdm.h:50
#define RAISED
Definition: PathResolve.cpp:90
#define FLAGS10
Definition: PathResolve.cpp:59
static HINSTANCE s_hShell32
Definition: PathResolve.cpp:24
#define FALSE
Definition: types.h:117
BOOL WINAPI PathStripToRootW(LPWSTR lpszPath)
Definition: path.c:733
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
if SUCCEEDED(hr)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define FLAGS2
Definition: PathResolve.cpp:51
UINT Flags
Definition: PathResolve.cpp:73
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
#define EF_FULLPATH
Definition: PathResolve.cpp:78
static WCHAR s_LinkTargetDoubleBackslash[MAX_PATH]
Definition: PathResolve.cpp:32
static WCHAR s_ShortcutLongName[MAX_PATH]
Definition: PathResolve.cpp:29
const char * LPCSTR
Definition: xmlstorage.h:183
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
#define KEY_WRITE
Definition: nt_native.h:1031
#define FreeLibrary(x)
Definition: compat.h:748
HRESULT hres
Definition: protocol.c:465
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
static ISLFNDRIVEW s_pIsLFNDriveW
Definition: PathResolve.cpp:26
LONG HRESULT
Definition: typedefs.h:79
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
#define FLAGS1
Definition: PathResolve.cpp:50
#define EF_APP_PATH
Definition: PathResolve.cpp:82
nsrefcnt Release()
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FLAGS12
Definition: PathResolve.cpp:61
BOOL Error
Definition: chkdsk.c:66
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW(IN LPCWSTR lpName, IN LPCWSTR lpValue)
Definition: environ.c:259
_In_ UINT _In_ UINT cEntries
Definition: wingdi.h:3620
#define EF_TYPE_MASK
Definition: PathResolve.cpp:80
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
Definition: cmd.c:12
#define FLAGS13
Definition: PathResolve.cpp:62
#define ERR_DEAD
Definition: PathResolve.cpp:88
static BOOL CreateShortcut(LPCWSTR pszLnkFileName, LPCWSTR pszTargetPathName)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
#define wcsrchr
Definition: compat.h:16
static const WCHAR Cleanup[]
Definition: register.c:80
struct tagTEST_ENTRY * PTEST_ENTRY
DWORD Error
Definition: PathResolve.cpp:69
#define FLAGS5
Definition: PathResolve.cpp:54
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
PRTL_UNICODE_STRING_BUFFER Path
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1220
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
#define lstrcpyW
Definition: compat.h:749
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define ok(value,...)
Definition: atltest.h:57
#define FLAGS6
Definition: PathResolve.cpp:55
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define lstrcpynA
Definition: compat.h:751
#define FLAGS0
Definition: PathResolve.cpp:49
#define skip(...)
Definition: atltest.h:64
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
const GUID IID_IPersistFile
static BOOL CreateRegAppPath(INT SectionNumber, INT LineNumber, const WCHAR *Name, const WCHAR *Value)
#define EF_TESTDATA
Definition: PathResolve.cpp:79
#define GetProcAddress(x, y)
Definition: compat.h:753
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define FLAGS9
Definition: PathResolve.cpp:58
START_TEST(PathResolve)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
nsresult QueryInterface(nsIIDRef riid, void **result)
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define RegCloseKey(hKey)
Definition: registry.h:47
BOOL expected
Definition: store.c:2063
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define FLAGS4
Definition: PathResolve.cpp:53
#define REG_SZ
Definition: layer.c:22
LPCWSTR NameExpected
Definition: PathResolve.cpp:72