Version resources cleanup.
[wine] / dlls / shell32 / tests / shelllink.c
1 /*
2  * Unit tests for shelllinks
3  *
4  * Copyright 2004 Mike McCormack
5  *
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.
10  *
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.
15  *
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).
22  *
23  */
24
25 #define COBJMACROS
26
27 #include <stdarg.h>
28 #include <stdio.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "shlguid.h"
32 #include "shobjidl.h"
33 #include "wine/test.h"
34
35 static void test_empty_shelllink()
36 {
37     HRESULT r;
38     IShellLinkW *sl;
39     WCHAR buffer[0x100];
40     IPersistFile *pf;
41
42     CoInitialize(NULL);
43
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");
48     if (r == S_OK)
49     {
50         static const WCHAR lnk[]= { 'C',':','\\','t','e','s','t','.','l','n','k',0 };
51
52         buffer[0]='x';
53         buffer[1]=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");
57
58         r = IShellLinkW_QueryInterface(sl, &IID_IPersistFile, (LPVOID*) &pf );
59         ok (r == S_OK, "no IPersistFile\n");
60         todo_wine
61         {
62         if (r == S_OK )
63         {
64             r = IPersistFile_Save(pf, lnk, TRUE);
65             ok (r == S_OK, "save failed\n");
66             IPersistFile_Release(pf);
67         }
68
69         IShellLinkW_Release(sl);
70
71         ok (DeleteFileW(lnk), "failed to delete link\n");
72         }
73     }
74 }
75
76 START_TEST(shelllink)
77 {
78     test_empty_shelllink();
79 }