ReactOS 0.4.17-dev-1190-g4c812f4
CShellLink.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Test for CShellLink
5 * PROGRAMMER: Andreas Maier
6 */
7
8#include "shelltest.h"
9
10#define NDEBUG
11#include <debug.h>
12#include <stdio.h>
13#include <shellapi.h>
14#include <versionhelpers.h>
15#include <shellutils.h>
16
17/* Test IShellLink::SetPath with environment-variables, existing, non-existing, ...*/
18typedef struct
19{
22
23 /* Test 1 - hrGetPathX = IShellLink::GetPath(pathOutX, ... , flagsX); */
28
29 /* Test 2 */
35
37{
38 {
39 L"%comspec%", S_OK,
40 L"%comspec%", SLGP_SHORTPATH, S_OK, TRUE,
41 L"%comspec%", SLGP_RAWPATH, S_OK, FALSE
42 },
43 {
44 L"%anyvar%", E_INVALIDARG,
45 L"", SLGP_SHORTPATH, S_FALSE, FALSE,
46 L"", SLGP_RAWPATH, S_FALSE, FALSE
47 },
48 {
49 L"%anyvar%%comspec%", S_OK,
50 L"c:\\%anyvar%%comspec%", SLGP_SHORTPATH, S_OK, TRUE,
51 L"%anyvar%%comspec%", SLGP_RAWPATH, S_OK, FALSE
52 },
53 {
54 L"%temp%", S_OK,
55 L"%temp%", SLGP_SHORTPATH, S_OK, TRUE,
56 L"%temp%", SLGP_RAWPATH, S_OK, FALSE
57 },
58 {
59 L"%shell%", S_OK,
60 L"%systemroot%\\system32\\%shell%", SLGP_SHORTPATH, S_OK, TRUE,
61 L"%shell%", SLGP_RAWPATH, S_OK, FALSE
62 },
63 {
64 L"u:\\anypath\\%anyvar%", S_OK,
65 L"u:\\anypath\\%anyvar%", SLGP_SHORTPATH, S_OK, TRUE,
66 L"u:\\anypath\\%anyvar%", SLGP_RAWPATH, S_OK, FALSE
67 },
68 {
69 L"c:\\temp", S_OK,
70 L"c:\\temp", SLGP_SHORTPATH, S_OK, FALSE,
71 L"c:\\temp", SLGP_RAWPATH, S_OK, FALSE
72 },
73 {
74 L"cmd.exe", S_OK,
75 L"%comspec%", SLGP_SHORTPATH, S_OK, TRUE,
76 L"%comspec%", SLGP_RAWPATH, S_OK, TRUE
77 },
78 {
79 L"%systemroot%\\non-existent-file", S_OK,
80 L"%systemroot%\\non-existent-file", SLGP_SHORTPATH, S_OK, TRUE,
81 L"%systemroot%\\non-existent-file", SLGP_RAWPATH, S_OK, FALSE
82 },
83 {
84 L"c:\\non-existent-path\\non-existent-file", S_OK,
85 L"c:\\non-existent-path\\non-existent-file", SLGP_SHORTPATH, S_OK, FALSE,
86 L"c:\\non-existent-path\\non-existent-file", SLGP_RAWPATH, S_OK, FALSE
87 },
88 {
89 L"non-existent-file", E_INVALIDARG,
90 L"", SLGP_SHORTPATH, S_FALSE, FALSE,
91 L"", SLGP_RAWPATH, S_FALSE, FALSE
92 },
93};
94
96{
97 {
98 L"%comspec%", S_OK,
99 L"%comspec%", SLGP_SHORTPATH, S_OK, TRUE,
100 L"%comspec%", SLGP_RAWPATH, S_OK, FALSE
101 },
102 {
103 L"%anyvar%", S_OK,
104 L"%USERPROFILE%\\Desktop\\%anyvar%", SLGP_SHORTPATH, S_OK, TRUE,
105 L"%USERPROFILE%\\Desktop\\%anyvar%", SLGP_RAWPATH, S_OK, TRUE
106 },
107 {
108 L"%anyvar%%comspec%", E_INVALIDARG,
109 L"", SLGP_SHORTPATH, S_FALSE, TRUE,
110 L"%anyvar%%comspec%", SLGP_RAWPATH, S_OK, FALSE
111 },
112 {
113 L"%temp%", S_OK,
114 L"%temp%", SLGP_SHORTPATH, S_OK, TRUE,
115 L"%temp%", SLGP_RAWPATH, S_OK, FALSE
116 },
117 {
118 L"%shell%", S_OK,
119 L"%systemroot%\\system32\\%shell%", SLGP_SHORTPATH, S_OK, TRUE,
120 L"%shell%", SLGP_RAWPATH, S_OK, FALSE
121 },
122 {
123 L"u:\\anypath\\%anyvar%", S_OK,
124 L"u:\\anypath\\%anyvar%", SLGP_SHORTPATH, S_OK, TRUE,
125 L"u:\\anypath\\%anyvar%", SLGP_RAWPATH, S_OK, FALSE
126 },
127 {
128 L"c:\\temp", S_OK,
129 L"c:\\temp", SLGP_SHORTPATH, S_OK, FALSE,
130 L"c:\\temp", SLGP_RAWPATH, S_OK, FALSE
131 },
132 {
133 L"cmd.exe", S_OK,
134 L"%comspec%", SLGP_SHORTPATH, S_OK, TRUE,
135 L"%comspec%", SLGP_RAWPATH, S_OK, TRUE
136 },
137 {
138 L"%systemroot%\\non-existent-file", S_OK,
139 L"%systemroot%\\non-existent-file", SLGP_SHORTPATH, S_OK, TRUE,
140 L"%systemroot%\\non-existent-file", SLGP_RAWPATH, S_OK, FALSE
141 },
142 {
143 L"c:\\non-existent-path\\non-existent-file", S_OK,
144 L"c:\\non-existent-path\\non-existent-file", SLGP_SHORTPATH, S_OK, FALSE,
145 L"c:\\non-existent-path\\non-existent-file", SLGP_RAWPATH, S_OK, FALSE
146 },
147 {
148 L"non-existent-file", S_OK,
149 L"%USERPROFILE%\\Desktop\\non-existent-file", SLGP_SHORTPATH, S_OK, TRUE,
150 L"%USERPROFILE%\\Desktop\\non-existent-file", SLGP_RAWPATH, S_OK, TRUE
151 },
152};
153
154static
155VOID
157{
158static WCHAR evVar[MAX_PATH];
159
160 HRESULT hr, expectedHr;
161 WCHAR wPathOut[MAX_PATH];
162 BOOL expandPathOut;
163 PCWSTR expectedPathOut;
164 CComPtr<IShellLinkW> psl;
165 UINT i1;
166 DWORD flags;
167
168 hr = CoCreateInstance(CLSID_ShellLink,
169 NULL,
170 CLSCTX_INPROC_SERVER,
171 IID_PPV_ARG(IShellLinkW, &psl));
172 ok(hr == S_OK, "CoCreateInstance, hr = 0x%lx\n", hr);
173 if (FAILED(hr))
174 {
175 skip("Could not instantiate CShellLink\n");
176 return;
177 }
178
179 hr = psl->SetPath(testDef->pathIn);
180 ok(hr == testDef->hrSetPath, "IShellLink::SetPath(%d), got hr = 0x%lx, expected 0x%lx\n", i, hr, testDef->hrSetPath);
181
182 expectedPathOut = NULL;
183 for (i1 = 0; i1 <= 1; i1++)
184 {
185 if (i1 == 0) /* Usually SLGP_SHORTPATH */
186 {
187 flags = testDef->flags1;
188 expandPathOut = testDef->expandPathOut1;
189 expectedPathOut = testDef->pathOut1;
190 expectedHr = testDef->hrGetPath1;
191 }
192 else // if (i1 == 1) /* Usually SLGP_RAWPATH */
193 {
194 flags = testDef->flags2;
195 expandPathOut = testDef->expandPathOut2;
196 expectedPathOut = testDef->pathOut2;
197 expectedHr = testDef->hrGetPath2;
198 }
199
200 /* Patch some variables */
201 if (expandPathOut)
202 {
203 ExpandEnvironmentStringsW(expectedPathOut, evVar, _countof(evVar));
204 DPRINT("** %S **\n",evVar);
205 expectedPathOut = evVar;
206 }
207
208 hr = psl->GetPath(wPathOut, _countof(wPathOut), NULL, flags);
209 ok(hr == expectedHr,
210 "IShellLink::GetPath(%d), flags 0x%lx, got hr = 0x%lx, expected 0x%lx\n",
211 i, flags, hr, expectedHr);
212 ok(_wcsicmp(wPathOut, expectedPathOut) == 0,
213 "IShellLink::GetPath(%d), flags 0x%lx, in %S, got %S, expected %S\n",
214 i, flags, testDef->pathIn, wPathOut, expectedPathOut);
215 }
216}
217
218static
219VOID
221{
222 UINT i, TestListCnt;
224
225 /* Needed for test */
226 SetEnvironmentVariableW(L"shell", L"cmd.exe");
227
229 {
231 TestListCnt = _countof(linkTestList_WS03);
232 }
233 else
234 {
236 TestListCnt = _countof(linkTestList_Vista);
237 }
238
239 for (i = 0; i < TestListCnt; ++i)
240 {
241 DPRINT("IShellLink-Test(%d): %S\n", i, Test[i].pathIn);
243 }
244
246}
247
248static
249VOID
251{
252 HRESULT hr;
253 CComPtr<IShellLinkW> psl;
254 WCHAR buffer[64];
255 PCWSTR testDescription = L"This is a test description";
256
257 /* Test SetDescription */
258 hr = CoCreateInstance(CLSID_ShellLink,
259 NULL,
260 CLSCTX_INPROC_SERVER,
261 IID_PPV_ARG(IShellLinkW, &psl));
262 ok(hr == S_OK, "CoCreateInstance, hr = 0x%lx\n", hr);
263 if (FAILED(hr))
264 {
265 skip("Could not instantiate CShellLink\n");
266 return;
267 }
268
269 memset(buffer, 0x55, sizeof(buffer));
270 hr = psl->GetDescription(buffer, RTL_NUMBER_OF(buffer));
271 ok(hr == S_OK, "IShellLink::GetDescription returned hr = 0x%lx\n", hr);
272 ok(buffer[0] == 0, "buffer[0] = %x\n", buffer[0]);
273 ok(buffer[1] == 0x5555, "buffer[1] = %x\n", buffer[1]);
274
275 hr = psl->SetDescription(testDescription);
276 ok(hr == S_OK, "IShellLink::SetDescription returned hr = 0x%lx\n", hr);
277
278 memset(buffer, 0x55, sizeof(buffer));
279 hr = psl->GetDescription(buffer, RTL_NUMBER_OF(buffer));
280 ok(hr == S_OK, "IShellLink::GetDescription returned hr = 0x%lx\n", hr);
281 ok(buffer[wcslen(testDescription)] == 0, "buffer[n] = %x\n", buffer[wcslen(testDescription)]);
282 ok(buffer[wcslen(testDescription) + 1] == 0x5555, "buffer[n+1] = %x\n", buffer[wcslen(testDescription) + 1]);
283 ok(!wcscmp(buffer, testDescription), "buffer = '%ls'\n", buffer);
284
285 hr = psl->SetDescription(NULL);
286 ok(hr == S_OK, "IShellLink::SetDescription returned hr = 0x%lx\n", hr);
287
288 memset(buffer, 0x55, sizeof(buffer));
289 hr = psl->GetDescription(buffer, RTL_NUMBER_OF(buffer));
290 ok(hr == S_OK, "IShellLink::GetDescription returned hr = 0x%lx\n", hr);
291 ok(buffer[0] == 0, "buffer[0] = %x\n", buffer[0]);
292 ok(buffer[1] == 0x5555, "buffer[1] = %x\n", buffer[1]);
293}
294
295
296/* Test IShellLink::Get/SetIconLocation and IExtractIcon::GetIconLocation */
297typedef struct
298{
300
301 /* Expected results */
302 HRESULT hrDefIcon; // Return value for GIL_DEFAULTICON
303 HRESULT hrForShrt; // Return value for GIL_FORSHORTCUT
304 /* Return values for GIL_FORSHELL */
309
311{
312 /* Executable with icons */
313 {L"%SystemRoot%\\system32\\cmd.exe", S_FALSE, E_INVALIDARG,
314 S_OK, L"%SystemRoot%\\system32\\cmd.exe", GIL_NOTFILENAME | GIL_PERINSTANCE},
315
316 /* Executable without icon */
317 {L"%SystemRoot%\\system32\\autochk.exe", S_FALSE, E_INVALIDARG,
318 S_OK, L"%SystemRoot%\\system32\\autochk.exe", GIL_NOTFILENAME | GIL_PERINSTANCE},
319
320 /* Existing file */
321 {L"%SystemRoot%\\system32\\shell32.dll", S_FALSE, E_INVALIDARG,
322 S_OK, L"*", GIL_NOTFILENAME | GIL_PERCLASS},
323
324 /* Non-existing files */
325 {L"%SystemRoot%\\non-existent-file.sdf", S_FALSE, E_INVALIDARG,
326 S_OK, L"*", GIL_NOTFILENAME | GIL_PERCLASS},
327 {L"c:\\non-existent-path\\non-existent-file.sdf", S_FALSE, E_INVALIDARG,
328 S_OK, L"*", GIL_NOTFILENAME | GIL_PERCLASS},
329};
330
331static
332VOID
334{
335 HRESULT hr;
336 CComPtr<IShellLinkW> psl;
337 CComPtr<IExtractIconW> pei;
338 INT iIcon;
339 UINT wFlags;
340 PCWSTR pszExplorer = L"%SystemRoot%\\explorer.exe";
342 WCHAR szPath2[MAX_PATH];
343
344 hr = CoCreateInstance(CLSID_ShellLink,
345 NULL,
346 CLSCTX_INPROC_SERVER,
347 IID_PPV_ARG(IShellLinkW, &psl));
348 ok(hr == S_OK, "CoCreateInstance, hr = 0x%lx\n", hr);
349 if (FAILED(hr))
350 {
351 skip("Could not instantiate CShellLink\n");
352 return;
353 }
354
355 /* Set the path to a file */
357 hr = psl->SetPath(szPath);
358 ok(hr == S_OK, "IShellLink::SetPath failed, hr = 0x%lx\n", hr);
359
360 /*
361 * This test shows that this does not imply that the icon is automatically
362 * set and be retrieved naively by a call to IShellLink::GetIconLocation.
363 */
364 iIcon = 0xdeadbeef;
365 wcscpy(szPath, L"garbage");
366 hr = psl->GetIconLocation(szPath, _countof(szPath), &iIcon);
367 ok(hr == S_OK, "IShellLink::GetIconLocation(%d) failed, hr = 0x%lx\n", i, hr);
368 ok(*szPath == L'\0', "IShellLink::GetIconLocation(%d) returned '%S'\n", i, szPath);
369 ok(iIcon == 0, "IShellLink::GetIconLocation(%d) returned %d, expected %d\n", i, iIcon, 0);
370
371 /* Try to grab the IExtractIconW interface */
373 ok(hr == S_OK, "IShellLink::QueryInterface(IExtractIconW)(%d) failed, hr = 0x%lx\n", i, hr);
374 if (!pei)
375 {
376 win_skip("No IExtractIconW interface\n");
377 return;
378 }
379
380 iIcon = wFlags = 0xdeadbeef;
381 wcscpy(szPath, L"garbage");
382 hr = pei->GetIconLocation(GIL_DEFAULTICON, szPath, _countof(szPath), &iIcon, &wFlags);
383 ok(hr == testDef->hrDefIcon, "IExtractIcon::GetIconLocation(%d) returned hr = 0x%lx, expected 0x%lx\n", i, hr, testDef->hrDefIcon);
384 ok(*szPath == L'\0', "IExtractIcon::GetIconLocation(%d) returned '%S'\n", i, szPath);
385 // ok(iIcon == 0, "IExtractIcon::GetIconLocation(%d) returned %d\n", i, iIcon);
386
387 iIcon = wFlags = 0xdeadbeef;
388 wcscpy(szPath, L"garbage");
389 hr = pei->GetIconLocation(GIL_FORSHORTCUT, szPath, _countof(szPath), &iIcon, &wFlags);
390 ok(hr == testDef->hrForShrt, "IExtractIcon::GetIconLocation(%d) returned hr = 0x%lx, expected 0x%lx\n", i, hr, testDef->hrForShrt);
391 // Here, both szPath and iIcon are untouched...
392
393 iIcon = wFlags = 0xdeadbeef;
394 wcscpy(szPath, L"garbage");
395 hr = pei->GetIconLocation(GIL_FORSHELL, szPath, _countof(szPath), &iIcon, &wFlags);
396 ok(hr == testDef->hrForShell, "IExtractIcon::GetIconLocation(%d) returned hr = 0x%lx, expected 0x%lx\n", i, hr, testDef->hrForShell);
397 ok(wFlags == testDef->Flags, "IExtractIcon::GetIconLocation(%d) returned wFlags = 0x%x, expected 0x%x\n", i, wFlags, testDef->Flags);
398 /*
399 * Actually, even if wFlags specifies GIL_NOTFILENAME, a correct file name is returned
400 * for executables only (at least...), otherwise we can get an asterix '*'.
401 */
402 ExpandEnvironmentStringsW(testDef->IconPath, szPath2, _countof(szPath2));
403 ok(_wcsicmp(szPath2, szPath) == 0, "IExtractIcon::GetIconLocation(%d) returned '%S', expected '%S'\n", i, szPath, szPath2);
404
405 // ok(*szPath == L'\0', "IExtractIcon::GetIconLocation returned '%S'\n", szPath);
406 // ok(iIcon == 0, "IExtractIcon::GetIconLocation returned %d\n", iIcon);
407 // ok(FALSE, "hr = 0x%lx, szPath = '%S', iIcon = %d, wFlags = %d\n", hr, szPath, iIcon, wFlags);
408
409
410 /*
411 * Now we test what happens when we explicitly set an icon to the shortcut.
412 * Note that actually, SetIconLocation() does not verify whether the file
413 * really exists.
414 */
415 hr = psl->SetIconLocation(pszExplorer, 1);
416 ok(hr == S_OK, "IShellLink::SetIconLocation(%d) failed, hr = 0x%lx\n", i, hr);
417
418 /*
419 * First, we call IShellLink::GetIconLocation. We retrieve
420 * exactly what we specified with SetIconLocation.
421 */
422 iIcon = 0xdeadbeef;
423 wcscpy(szPath, L"garbage");
424 hr = psl->GetIconLocation(szPath, _countof(szPath), &iIcon);
425 ok(hr == S_OK, "IShellLink::GetIconLocation(%d) failed, hr = 0x%lx\n", i, hr);
426 ok(wcscmp(szPath, pszExplorer) == 0, "IShellLink::GetIconLocation(%d) returned '%S', expected '%S'\n", i, szPath, pszExplorer);
427 ok(iIcon == 1, "IShellLink::GetIconLocation(%d) returned %d, expected %d\n", i, iIcon, 1);
428
429 /*
430 * Now we test what happens with IExtractIcon::GetIconLocation.
431 * We see that it retrieves the icon of the shortcut's underlying file.
432 */
433 iIcon = wFlags = 0xdeadbeef;
434 wcscpy(szPath, L"garbage");
435 hr = pei->GetIconLocation(GIL_DEFAULTICON, szPath, _countof(szPath), &iIcon, &wFlags);
436 ok(hr == testDef->hrDefIcon, "IExtractIcon::GetIconLocation(%d) returned hr = 0x%lx, expected 0x%lx\n", i, hr, testDef->hrDefIcon);
437 ok(*szPath == L'\0', "IExtractIcon::GetIconLocation(%d) returned '%S'\n", i, szPath);
438 // ok(iIcon == 0, "IExtractIcon::GetIconLocation(%d) returned %d\n", i, iIcon);
439
440 iIcon = wFlags = 0xdeadbeef;
441 wcscpy(szPath, L"garbage");
442 hr = pei->GetIconLocation(GIL_FORSHORTCUT, szPath, _countof(szPath), &iIcon, &wFlags);
443 ok(hr == testDef->hrForShrt, "IExtractIcon::GetIconLocation(%d) returned hr = 0x%lx, expected 0x%lx\n", i, hr, testDef->hrForShrt);
444 // Here, both szPath and iIcon are untouched...
445
446 iIcon = wFlags = 0xdeadbeef;
447 wcscpy(szPath, L"garbage");
448 hr = pei->GetIconLocation(GIL_FORSHELL, szPath, _countof(szPath), &iIcon, &wFlags);
449 ok(hr == testDef->hrForShell, "IExtractIcon::GetIconLocation(%d) returned hr = 0x%lx, expected 0x%lx\n", i, hr, testDef->hrForShell);
450 ok(wFlags == testDef->Flags, "IExtractIcon::GetIconLocation(%d) returned wFlags = 0x%x, expected 0x%x\n", i, wFlags, testDef->Flags);
451 /*
452 * Actually, even if wFlags specifies GIL_NOTFILENAME, a correct file name is returned
453 * for executables only (at least...), otherwise we can get an asterix '*'.
454 */
455 ExpandEnvironmentStringsW(testDef->IconPath, szPath2, _countof(szPath2));
456 ok(_wcsicmp(szPath2, szPath) == 0, "IExtractIcon::GetIconLocation(%d) returned '%S', expected '%S'\n", i, szPath, szPath2);
457
458 // ok(*szPath == L'\0', "IExtractIcon::GetIconLocation returned '%S'\n", szPath);
459 // ok(iIcon == 0, "IExtractIcon::GetIconLocation returned %d\n", iIcon);
460 // ok(FALSE, "hr = 0x%lx, szPath = '%S', iIcon = %d, wFlags = %d\n", hr, szPath, iIcon, wFlags);
461}
462
463static
464VOID
466{
467 UINT i;
468
469 for (i = 0; i < _countof(ShIconTests); ++i)
470 {
472 }
473}
474
475
477{
478 CCoInit ComInit;
479
483}
484
486{
487 CCoInit ComInit;
488 LPCWSTR DotUrlOn7 = IsReactOS() || GetNTVersion() >= _WIN32_WINNT_WIN7 ? L".url" : L".lnk";
489 WCHAR FullTarget[MAX_PATH], Dir[MAX_PATH];
490
492
493 GetModuleFileNameW(GetModuleHandleW(L"KERNEL32"), FullTarget, _countof(FullTarget));
494 LPWSTR TargetFile = PathFindFileNameW(FullTarget);
495
496 #define Test_SHGNLI(path, dir, rdir, rfile, rext, flags, ret, mustcopy) do \
497 { \
498 WCHAR Result[MAX_PATH], Buf[MAX_PATH]; \
499 BOOL MustCopy, Success = SHGetNewLinkInfoW((path), (dir), lstrcpyW(Result, L"?"), &MustCopy, (flags)); \
500 ok(Success == (ret), "Return (%#x)\n", UINT(flags)); \
501 ok(MustCopy == (mustcopy), "MustCopy (%#x)\n", UINT(flags)); \
502 lstrcpyW(Buf, (rdir)); \
503 if (*Buf) PathAddBackslashW(Buf); \
504 lstrcatW(Buf, (rfile)); \
505 lstrcatW(Buf, (rext)); \
506 ok((!(ret) && !Success) || !_wcsicmp(Result, Buf), "%ls should be %ls (%#x)\n", Result, Buf, UINT(flags)); \
507 } while(0)
508
509 Test_SHGNLI(FullTarget, Dir, Dir, TargetFile, L".lnk", 0, 1, 0);
510
511 CComHeapPtr<ITEMIDLIST> pidl(SHELL_SimpleIDListFromPath(FullTarget));
512 Test_SHGNLI((LPWSTR)(LPITEMIDLIST)pidl, Dir, Dir, TargetFile, L".lnk", SHGNLI_PIDL, 1, 0);
513
514 Test_SHGNLI(FullTarget, Dir, L"", TargetFile, L".lnk", SHGNLI_NOUNIQUE, 1, 0);
515
516 Test_SHGNLI(FullTarget, Dir, Dir, TargetFile, L"", SHGNLI_NOLNK, 1, 0);
517 Test_SHGNLI(FullTarget, Dir, L"", TargetFile, L"", SHGNLI_NOLNK | SHGNLI_NOUNIQUE, 1, 0);
518 Test_SHGNLI(FullTarget, Dir, Dir, TargetFile, L"", SHGNLI_NOLNK | SHGNLI_USEURLEXT, 1, 0);
519
520 Test_SHGNLI(FullTarget, Dir, Dir, TargetFile, DotUrlOn7, SHGNLI_USEURLEXT, 1, 0);
521
522 PathRemoveExtensionW(FullTarget);
523 Test_SHGNLI(FullTarget, Dir, L"", L"", L"", 0, 0, 0); // Target does not exist
524
525 #define SHGNLIFileName L"ROS_Test_Shell32"
526 PathAppendW(lstrcpyW(FullTarget, Dir), SHGNLIFileName L".lnk");
527 CloseHandle(CreateFileW(FullTarget, 0, 7, NULL, OPEN_ALWAYS, 0, NULL));
528 Test_SHGNLI(FullTarget, Dir, Dir, SHGNLIFileName L" (2)", L".lnk", 0, 1, 1);
529 Test_SHGNLI(FullTarget, Dir, L"", SHGNLIFileName, L".lnk", SHGNLI_NOUNIQUE, 1, 1);
530 Test_SHGNLI(FullTarget, Dir, Dir, SHGNLIFileName L" (2)", L".lnk", SHGNLI_NOLNK, 1, 1); // SFGAO_LINK ignores SHGNLI_NOLNK
531 DeleteFileW(FullTarget);
532}
#define IID_PPV_ARG(Itype, ppType)
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define GetNTVersion()
Definition: apitest.h:17
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define CloseHandle
Definition: compat.h:739
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define lstrcpyW
Definition: compat.h:749
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW(IN LPCWSTR lpName, IN LPCWSTR lpValue)
Definition: environ.c:232
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
void WINAPI PathRemoveExtensionW(WCHAR *path)
Definition: path.c:1922
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1677
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:4394
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint buffer
Definition: glext.h:5915
GLbitfield flags
Definition: glext.h:7161
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
unsigned int UINT
Definition: sysinfo.c:13
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define win_skip
Definition: minitest.h:67
#define OPEN_ALWAYS
Definition: disk.h:70
LPCWSTR szPath
Definition: env.c:37
#define PathAppendW
Definition: pathcch.h:310
short WCHAR
Definition: pedump.c:58
wcscpy
#define memset(x, y, z)
Definition: compat.h:39
#define _WIN32_WINNT_WS03
Definition: sdkddkver.h:23
#define _WIN32_WINNT_WIN7
Definition: sdkddkver.h:28
#define SHGNLI_NOUNIQUE
Definition: shellapi.h:602
#define SHGNLI_NOLNK
Definition: shellapi.h:603
#define SHGNLI_USEURLEXT
Definition: shellapi.h:605
#define SHGNLI_PIDL
Definition: shellapi.h:600
#define SHGetNewLinkInfo
Definition: shellapi.h:756
static LPITEMIDLIST SHELL_SimpleIDListFromPath(LPCWSTR pszPath)
Definition: shelltest.h:22
#define CSIDL_PROFILE
Definition: shlobj.h:2259
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define DPRINT
Definition: sndvol32.h:73
#define _countof(array)
Definition: sndvol32.h:70
HRESULT hrForShell
Definition: CShellLink.cpp:305
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint16_t * LPWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337
#define S_FALSE
Definition: winerror.h:3451