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
60 L"%systemroot%\\system32\\%shell%", SLGP_SHORTPATH,
S_OK,
TRUE,
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
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
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
104 L"%USERPROFILE%\\Desktop\\%anyvar%", SLGP_SHORTPATH,
S_OK,
TRUE,
105 L"%USERPROFILE%\\Desktop\\%anyvar%", SLGP_RAWPATH,
S_OK,
TRUE
110 L"%anyvar%%comspec%", SLGP_RAWPATH,
S_OK,
FALSE
119 L"%systemroot%\\system32\\%shell%", SLGP_SHORTPATH,
S_OK,
TRUE,
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
134 L"%comspec%", SLGP_SHORTPATH,
S_OK,
TRUE,
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
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
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
164 CComPtr<IShellLinkW> psl;
170 CLSCTX_INPROC_SERVER,
172 ok(
hr ==
S_OK,
"CoCreateInstance, hr = 0x%lx\n",
hr);
175 skip(
"Could not instantiate CShellLink\n");
182 expectedPathOut =
NULL;
183 for (i1 = 0; i1 <= 1; i1++)
189 expectedPathOut = testDef->
pathOut1;
196 expectedPathOut = testDef->
pathOut2;
204 DPRINT(
"** %S **\n",evVar);
205 expectedPathOut = evVar;
210 "IShellLink::GetPath(%d), flags 0x%lx, got hr = 0x%lx, expected 0x%lx\n",
213 "IShellLink::GetPath(%d), flags 0x%lx, in %S, got %S, expected %S\n",
239 for (
i = 0;
i < TestListCnt; ++
i)
253 CComPtr<IShellLinkW> psl;
255 PCWSTR testDescription =
L"This is a test description";
260 CLSCTX_INPROC_SERVER,
262 ok(
hr ==
S_OK,
"CoCreateInstance, hr = 0x%lx\n",
hr);
265 skip(
"Could not instantiate CShellLink\n");
271 ok(
hr ==
S_OK,
"IShellLink::GetDescription returned hr = 0x%lx\n",
hr);
275 hr = psl->SetDescription(testDescription);
276 ok(
hr ==
S_OK,
"IShellLink::SetDescription returned hr = 0x%lx\n",
hr);
280 ok(
hr ==
S_OK,
"IShellLink::GetDescription returned hr = 0x%lx\n",
hr);
285 hr = psl->SetDescription(
NULL);
286 ok(
hr ==
S_OK,
"IShellLink::SetDescription returned hr = 0x%lx\n",
hr);
290 ok(
hr ==
S_OK,
"IShellLink::GetDescription returned hr = 0x%lx\n",
hr);
314 S_OK,
L"%SystemRoot%\\system32\\cmd.exe", GIL_NOTFILENAME | GIL_PERINSTANCE},
318 S_OK,
L"%SystemRoot%\\system32\\autochk.exe", GIL_NOTFILENAME | GIL_PERINSTANCE},
322 S_OK,
L"*", GIL_NOTFILENAME | GIL_PERCLASS},
326 S_OK,
L"*", GIL_NOTFILENAME | GIL_PERCLASS},
328 S_OK,
L"*", GIL_NOTFILENAME | GIL_PERCLASS},
336 CComPtr<IShellLinkW> psl;
337 CComPtr<IExtractIconW> pei;
340 PCWSTR pszExplorer =
L"%SystemRoot%\\explorer.exe";
346 CLSCTX_INPROC_SERVER,
348 ok(
hr ==
S_OK,
"CoCreateInstance, hr = 0x%lx\n",
hr);
351 skip(
"Could not instantiate CShellLink\n");
358 ok(
hr ==
S_OK,
"IShellLink::SetPath failed, hr = 0x%lx\n",
hr);
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);
373 ok(
hr ==
S_OK,
"IShellLink::QueryInterface(IExtractIconW)(%d) failed, hr = 0x%lx\n",
i,
hr);
376 win_skip(
"No IExtractIconW interface\n");
380 iIcon =
wFlags = 0xdeadbeef;
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);
387 iIcon =
wFlags = 0xdeadbeef;
390 ok(
hr == testDef->
hrForShrt,
"IExtractIcon::GetIconLocation(%d) returned hr = 0x%lx, expected 0x%lx\n",
i,
hr, testDef->
hrForShrt);
393 iIcon =
wFlags = 0xdeadbeef;
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);
403 ok(
_wcsicmp(szPath2,
szPath) == 0,
"IExtractIcon::GetIconLocation(%d) returned '%S', expected '%S'\n",
i,
szPath, szPath2);
415 hr = psl->SetIconLocation(pszExplorer, 1);
416 ok(
hr ==
S_OK,
"IShellLink::SetIconLocation(%d) failed, hr = 0x%lx\n",
i,
hr);
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);
433 iIcon =
wFlags = 0xdeadbeef;
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);
440 iIcon =
wFlags = 0xdeadbeef;
443 ok(
hr == testDef->
hrForShrt,
"IExtractIcon::GetIconLocation(%d) returned hr = 0x%lx, expected 0x%lx\n",
i,
hr, testDef->
hrForShrt);
446 iIcon =
wFlags = 0xdeadbeef;
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);
456 ok(
_wcsicmp(szPath2,
szPath) == 0,
"IExtractIcon::GetIconLocation(%d) returned '%S', expected '%S'\n",
i,
szPath, szPath2);
496 #define Test_SHGNLI(path, dir, rdir, rfile, rext, flags, ret, mustcopy) do \
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)); \
509 Test_SHGNLI(FullTarget, Dir, Dir, TargetFile,
L".lnk", 0, 1, 0);
525 #define SHGNLIFileName L"ROS_Test_Shell32"
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableW(IN LPCWSTR lpName, IN LPCWSTR lpValue)
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
void WINAPI PathRemoveExtensionW(WCHAR *path)
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
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
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
static TEST_SHELL_LINK_DEF linkTestList_Vista[]
#define Test_SHGNLI(path, dir, rdir, rfile, rext, flags, ret, mustcopy)
static TEST_SHELL_ICON ShIconTests[]
static TEST_SHELL_LINK_DEF linkTestList_WS03[]
static VOID TestShellLink(void)
static VOID TestIconLocation(void)
static VOID test_checklinkpath(UINT i, TEST_SHELL_LINK_DEF *testDef)
static VOID test_iconlocation(UINT i, TEST_SHELL_ICON *testDef)
static VOID TestDescription(void)
#define _WIN32_WINNT_WS03
#define _WIN32_WINNT_WIN7
static LPITEMIDLIST SHELL_SimpleIDListFromPath(LPCWSTR pszPath)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags