2 * Unit tests for shelllinks
4 * Copyright 2004 Mike McCormack
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * This is a test program for the SHGet{Special}Folder{Path|Location} functions
20 * of shell32, that get either a filesytem path or a LPITEMIDLIST (shell
21 * namespace) path for a given folder (CSIDL value).
33 #include "wine/test.h"
35 static void test_empty_shelllink()
44 /* empty shelllink ? */
45 r = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
46 &IID_IShellLinkW, (LPVOID*)&sl );
47 ok (r == S_OK, "no shelllink\n");
50 static const WCHAR lnk[]= { 'C',':','\\','t','e','s','t','.','l','n','k',0 };
54 r = IShellLinkW_GetPath(sl, buffer, 0x100, NULL, SLGP_RAWPATH );
55 ok (r == S_OK, "GetPath failed\n");
56 ok (buffer[0]==0, "path wrong\n");
58 r = IShellLinkW_QueryInterface(sl, &IID_IPersistFile, (LPVOID*) &pf );
59 ok (r == S_OK, "no IPersistFile\n");
64 r = IPersistFile_Save(pf, lnk, TRUE);
65 ok (r == S_OK, "save failed\n");
66 IPersistFile_Release(pf);
69 IShellLinkW_Release(sl);
71 ok (DeleteFileW(lnk), "failed to delete link\n");
78 test_empty_shelllink();