- implement encoding and decoding of enumerated types, unsigned
[wine] / dlls / shell32 / tests / shlfolder.c
1 /*
2  * Unit test of the IShellFolder functions.
3  *
4  * Copyright 2004 Vitaliy Margolen
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  */
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wtypes.h"
29 #include "shellapi.h"
30
31
32 #include "shlguid.h"
33 #include "shlobj.h"
34 #include "shobjidl.h"
35 #include "shlwapi.h"
36
37
38 #include "wine/unicode.h"
39 #include "wine/test.h"
40
41
42 static IMalloc *ppM;
43
44 /* creates a file with the specified name for tests */
45 static void CreateTestFile(const CHAR *name)
46 {
47     HANDLE file;
48     DWORD written;
49
50     file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
51     if (file != INVALID_HANDLE_VALUE)
52     {
53         WriteFile(file, name, strlen(name), &written, NULL);
54         WriteFile(file, "\n", strlen("\n"), &written, NULL);
55         CloseHandle(file);
56     }
57 }
58
59
60 /* initializes the tests */
61 static void CreateFilesFolders(void)
62 {
63     CreateDirectoryA(".\\testdir", NULL);
64     CreateDirectoryA(".\\testdir\\test.txt", NULL);
65     CreateTestFile  (".\\testdir\\test1.txt ");
66     CreateTestFile  (".\\testdir\\test2.txt ");
67     CreateTestFile  (".\\testdir\\test3.txt ");
68     CreateDirectoryA(".\\testdir\\testdir2 ", NULL);
69     CreateDirectoryA(".\\testdir\\testdir2\\subdir", NULL);
70 }
71
72 /* cleans after tests */
73 static void Cleanup(void)
74 {
75     DeleteFileA(".\\testdir\\test1.txt");
76     DeleteFileA(".\\testdir\\test2.txt");
77     DeleteFileA(".\\testdir\\test3.txt");
78     RemoveDirectoryA(".\\testdir\\test.txt");
79     RemoveDirectoryA(".\\testdir\\testdir2\\subdir");
80     RemoveDirectoryA(".\\testdir\\testdir2");
81     RemoveDirectoryA(".\\testdir");
82 }
83
84
85 /* perform test */
86 static void test_EnumObjects(IShellFolder *iFolder)
87 {
88     IEnumIDList *iEnumList;
89     ITEMIDLIST *newPIDL, *(idlArr [5]);
90     ULONG NumPIDLs;
91     int i=0, j;
92     HRESULT hr;
93
94     static const WORD iResults [5][5] =
95     {
96         { 0,-1,-1,-1,-1},
97         { 1, 0,-1,-1,-1},
98         { 1, 1, 0,-1,-1},
99         { 1, 1, 1, 0,-1},
100         { 1, 1, 1, 1, 0}
101     };
102
103     /* Just test SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR for now */
104     static const ULONG attrs[5] =
105     {
106         SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR,
107         SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR,
108         SFGAO_FILESYSTEM,
109         SFGAO_FILESYSTEM,
110         SFGAO_FILESYSTEM,
111     };
112
113     hr = IShellFolder_EnumObjects(iFolder, NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &iEnumList);
114     ok(hr == S_OK, "EnumObjects failed %08lx\n", hr);
115
116     while (IEnumIDList_Next(iEnumList, 1, &newPIDL, &NumPIDLs) == S_OK)
117     {
118         idlArr[i++] = newPIDL;
119     }
120
121     hr = IEnumIDList_Release(iEnumList);
122     ok(hr == S_OK, "IEnumIDList_Release failed %08lx\n", hr);
123     
124     /* Sort them first in case of wrong order from system */
125     for (i=0;i<5;i++) for (j=0;j<5;j++)
126         if ((SHORT)IShellFolder_CompareIDs(iFolder, 0, idlArr[i], idlArr[j]) < 0)
127         {
128             newPIDL = idlArr[i];
129             idlArr[i] = idlArr[j];
130             idlArr[j] = newPIDL;
131         }
132             
133     for (i=0;i<5;i++) for (j=0;j<5;j++)
134     {
135         hr = IShellFolder_CompareIDs(iFolder, 0, idlArr[i], idlArr[j]);
136         ok(hr == iResults[i][j], "Got %lx expected [%d]-[%d]=%x\n", hr, i, j, iResults[i][j]);
137     }
138
139
140     for (i = 0; i < 5; i++)
141     {
142         SFGAOF flags;
143         flags = SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR;
144         hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags);
145         flags &= SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR;
146         ok(hr == S_OK, "GetAttributesOf returns %08lx\n", hr);
147         ok(flags == attrs[i], "GetAttributesOf gets attrs %08lx, expects %08lx\n", flags, attrs[i]);
148     }
149
150     for (i=0;i<5;i++)
151         IMalloc_Free(ppM, idlArr[i]);
152 }
153
154 static void test_BindToObject(void)
155 {
156     HRESULT hr;
157     UINT cChars;
158     IShellFolder *psfDesktop, *psfChild, *psfMyComputer, *psfSystemDir;
159     SHITEMID emptyitem = { 0, { 0 } };
160     LPITEMIDLIST pidlMyComputer, pidlSystemDir, pidlEmpty = (LPITEMIDLIST)&emptyitem;
161     WCHAR wszSystemDir[MAX_PATH];
162     WCHAR wszMyComputer[] = { 
163         ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-',
164         'A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0 };
165
166     /* The following tests shows that BindToObject should fail with E_INVALIDARG if called
167      * with an empty pidl. This is tested for Desktop, MyComputer and the FS ShellFolder
168      */
169     hr = SHGetDesktopFolder(&psfDesktop);
170     ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08lx\n", hr);
171     if (FAILED(hr)) return;
172     
173     hr = IShellFolder_BindToObject(psfDesktop, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
174     ok (hr == E_INVALIDARG, "Desktop's BindToObject should fail, when called with empty pidl! hr = %08lx\n", hr);
175
176     hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL);
177     ok (SUCCEEDED(hr), "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08lx\n", hr);
178     if (FAILED(hr)) {
179         IShellFolder_Release(psfDesktop);
180         return;
181     }
182     
183     hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer);
184     ok (SUCCEEDED(hr), "Desktop failed to bind to MyComputer object! hr = %08lx\n", hr);
185     IShellFolder_Release(psfDesktop);
186     ILFree(pidlMyComputer);
187     if (FAILED(hr)) return;
188
189     hr = IShellFolder_BindToObject(psfMyComputer, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
190     ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with empty pidl! hr = %08lx\n", hr);
191
192     cChars = GetSystemDirectoryW(wszSystemDir, MAX_PATH);
193     ok (cChars > 0 && cChars < MAX_PATH, "GetSystemDirectoryW failed! LastError: %08lx\n", GetLastError());
194     if (cChars == 0 || cChars >= MAX_PATH) {
195         IShellFolder_Release(psfMyComputer);
196         return;
197     }
198     
199     hr = IShellFolder_ParseDisplayName(psfMyComputer, NULL, NULL, wszSystemDir, NULL, &pidlSystemDir, NULL);
200     ok (SUCCEEDED(hr), "MyComputers's ParseDisplayName failed to parse the SystemDirectory! hr = %08lx\n", hr);
201     if (FAILED(hr)) {
202         IShellFolder_Release(psfMyComputer);
203         return;
204     }
205
206     hr = IShellFolder_BindToObject(psfMyComputer, pidlSystemDir, NULL, &IID_IShellFolder, (LPVOID*)&psfSystemDir);
207     ok (SUCCEEDED(hr), "MyComputer failed to bind to a FileSystem ShellFolder! hr = %08lx\n", hr);
208     IShellFolder_Release(psfMyComputer);
209     ILFree(pidlSystemDir);
210     if (FAILED(hr)) return;
211
212     hr = IShellFolder_BindToObject(psfSystemDir, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
213     ok (hr == E_INVALIDARG, 
214         "FileSystem ShellFolder's BindToObject should fail, when called with empty pidl! hr = %08lx\n", hr);
215     
216     IShellFolder_Release(psfSystemDir);
217 }
218   
219 static void test_GetDisplayName(void)
220 {
221     BOOL result;
222     HRESULT hr;
223     HANDLE hTestFile;
224     WCHAR wszTestFile[MAX_PATH], wszTestFile2[MAX_PATH], wszTestDir[MAX_PATH];
225     STRRET strret;
226     LPSHELLFOLDER psfDesktop, psfPersonal;
227     IUnknown *psfFile;
228     LPITEMIDLIST pidlTestFile;
229     LPCITEMIDLIST pidlLast;
230     static const WCHAR wszFileName[] = { 'w','i','n','e','t','e','s','t','.','f','o','o',0 };
231     static const WCHAR wszDirName[] = { 'w','i','n','e','t','e','s','t',0 };
232
233     /* I'm trying to figure if there is a functional difference between calling
234      * SHGetPathFromIDList and calling GetDisplayNameOf(SHGDN_FORPARSING) after
235      * binding to the shellfolder. One thing I thought of was that perhaps 
236      * SHGetPathFromIDList would be able to get the path to a file, which does
237      * not exist anymore, while the other method would'nt. It turns out there's
238      * no functional difference in this respect.
239      */
240
241     /* First creating a directory in MyDocuments and a file in this directory. */
242     result = SHGetSpecialFolderPathW(NULL, wszTestDir, CSIDL_PERSONAL, FALSE);
243     ok(result, "SHGetSpecialFolderPathW failed! Last error: %08lx\n", GetLastError());
244     if (!result) return;
245
246     PathAddBackslashW(wszTestDir);
247     lstrcatW(wszTestDir, wszDirName);
248     result = CreateDirectoryW(wszTestDir, NULL);
249     ok(result, "CreateDirectoryW failed! Last error: %08lx\n", GetLastError());
250     if (!result) return;
251
252     lstrcpyW(wszTestFile, wszTestDir);
253     PathAddBackslashW(wszTestFile);
254     lstrcatW(wszTestFile, wszFileName);
255
256     hTestFile = CreateFileW(wszTestFile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
257     ok(hTestFile != INVALID_HANDLE_VALUE, "CreateFileW failed! Last error: %08lx\n", GetLastError());
258     if (hTestFile == INVALID_HANDLE_VALUE) return;
259     CloseHandle(hTestFile);
260
261     /* Getting a itemidlist for the file. */
262     hr = SHGetDesktopFolder(&psfDesktop);
263     ok(SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08lx\n", hr);
264     if (FAILED(hr)) return;
265
266     hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszTestFile, NULL, &pidlTestFile, NULL);
267     ok(SUCCEEDED(hr), "Desktop->ParseDisplayName failed! hr = %08lx\n", hr);
268     if (FAILED(hr)) {
269         IShellFolder_Release(psfDesktop);
270         return;
271     }
272
273     /* It seems as if we can not bind to regular files on windows, but only directories. 
274      */
275     hr = IShellFolder_BindToObject(psfDesktop, pidlTestFile, NULL, &IID_IUnknown, (VOID**)&psfFile);
276     todo_wine { ok (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hr = %08lx\n", hr); }
277     if (SUCCEEDED(hr)) {
278         IShellFolder_Release(psfFile);
279     }
280     
281     /* Deleting the file and the directory */
282     DeleteFileW(wszTestFile);
283     RemoveDirectoryW(wszTestDir);
284
285     /* SHGetPathFromIDListW still works, although the file is not present anymore. */
286     result = SHGetPathFromIDListW(pidlTestFile, wszTestFile2);
287     ok (result, "SHGetPathFromIDListW failed! Last error: %08lx\n", GetLastError());
288     ok (!lstrcmpiW(wszTestFile, wszTestFile2), "SHGetPathFromIDListW returns incorrect path!\n");
289
290     /* Binding to the folder and querying the display name of the file also works. */
291     hr = SHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast); 
292     ok (SUCCEEDED(hr), "SHBindToParent failed! hr = %08lx\n", hr);
293     if (FAILED(hr)) {
294         IShellFolder_Release(psfDesktop);
295         return;
296     }
297
298     hr = IShellFolder_GetDisplayNameOf(psfPersonal, pidlLast, SHGDN_FORPARSING, &strret);
299     ok (SUCCEEDED(hr), "Personal->GetDisplayNameOf failed! hr = %08lx\n", hr);
300     if (FAILED(hr)) {
301         IShellFolder_Release(psfDesktop);
302         IShellFolder_Release(psfPersonal);
303         return;
304     }
305     
306     hr = StrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
307     ok (SUCCEEDED(hr), "StrRetToBufW failed! hr = %08lx\n", hr);
308     ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
309     
310     IShellFolder_Release(psfDesktop);
311     IShellFolder_Release(psfPersonal);
312 }
313
314 static void test_GetAttributesOf(void) 
315 {
316     HRESULT hr;
317     LPSHELLFOLDER psfDesktop, psfMyComputer;
318     SHITEMID emptyitem = { 0, { 0 } };
319     LPCITEMIDLIST pidlEmpty = (LPCITEMIDLIST)&emptyitem;
320     LPITEMIDLIST pidlMyComputer;
321     DWORD dwFlags;
322     const static DWORD dwDesktopFlags = /* As observed on WinXP SP2 */
323         SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGE_ANCESTOR |
324         SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
325     const static DWORD dwMyComputerFlags = /* As observed on WinXP SP2 */
326         SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET |
327         SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
328     WCHAR wszMyComputer[] = { 
329         ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-',
330         'A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0 };
331
332     hr = SHGetDesktopFolder(&psfDesktop);
333     ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08lx\n", hr);
334     if (FAILED(hr)) return;
335
336     /* The Desktop attributes can be queried with a single empty itemidlist, .. */
337     dwFlags = 0xffffffff;
338     hr = IShellFolder_GetAttributesOf(psfDesktop, 1, &pidlEmpty, &dwFlags);
339     ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(empty pidl) failed! hr = %08lx\n", hr);
340     ok (dwFlags == dwDesktopFlags, "Wrong Desktop attributes: %08lx, expected: %08lx\n", 
341         dwFlags, dwDesktopFlags);
342
343     /* .. or with no itemidlist at all. */
344     dwFlags = 0xffffffff;
345     hr = IShellFolder_GetAttributesOf(psfDesktop, 0, NULL, &dwFlags);
346     ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(NULL) failed! hr = %08lx\n", hr);
347     ok (dwFlags == dwDesktopFlags, "Wrong Desktop attributes: %08lx, expected: %08lx\n", 
348         dwFlags, dwDesktopFlags);
349    
350     /* Testing the attributes of the MyComputer shellfolder */
351     hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL);
352     ok (SUCCEEDED(hr), "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08lx\n", hr);
353     if (FAILED(hr)) {
354         IShellFolder_Release(psfDesktop);
355         return;
356     }
357
358     /* WinXP SP2 sets the SFGAO_CANLINK flag, when MyComputer is queried via the Desktop 
359      * folder object. It doesn't do this, if MyComputer is queried directly (see below).
360      * SFGAO_CANLINK is the same as DROPEFFECT_LINK, which MSDN says means: "Drag source
361      * should create a link to the original data". You can't create links on MyComputer on
362      * Windows, so this flag shouldn't be set. Seems like a bug in Windows. As long as nobody
363      * depends on this bug, we probably shouldn't imitate it.
364      */
365     dwFlags = 0xffffffff;
366     hr = IShellFolder_GetAttributesOf(psfDesktop, 1, (LPCITEMIDLIST*)&pidlMyComputer, &dwFlags);
367     ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(MyComputer) failed! hr = %08lx\n", hr);
368     todo_wine { ok ((dwFlags & ~(DWORD)SFGAO_CANLINK) == dwMyComputerFlags, 
369                     "Wrong MyComputer attributes: %08lx, expected: %08lx\n", dwFlags, dwMyComputerFlags); }
370
371     hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer);
372     ok (SUCCEEDED(hr), "Desktop failed to bind to MyComputer object! hr = %08lx\n", hr);
373     IShellFolder_Release(psfDesktop);
374     ILFree(pidlMyComputer);
375     if (FAILED(hr)) return;
376
377     hr = IShellFolder_GetAttributesOf(psfMyComputer, 1, &pidlEmpty, &dwFlags);
378     todo_wine {ok (hr == E_INVALIDARG, "MyComputer->GetAttributesOf(emtpy pidl) should fail! hr = %08lx\n", hr); }
379
380     dwFlags = 0xffffffff;
381     hr = IShellFolder_GetAttributesOf(psfMyComputer, 0, NULL, &dwFlags);
382     ok (SUCCEEDED(hr), "MyComputer->GetAttributesOf(NULL) failed! hr = %08lx\n", hr); 
383     todo_wine { ok (dwFlags == dwMyComputerFlags, 
384                     "Wrong MyComputer attributes: %08lx, expected: %08lx\n", dwFlags, dwMyComputerFlags); }
385
386     IShellFolder_Release(psfMyComputer);
387 }    
388
389 static void test_SHGetPathFromIDList(void)
390 {
391     SHITEMID emptyitem = { 0, { 0 } };
392     LPCITEMIDLIST pidlEmpty = (LPCITEMIDLIST)&emptyitem;
393     LPITEMIDLIST pidlMyComputer;
394     WCHAR wszPath[MAX_PATH], wszDesktop[MAX_PATH];
395     BOOL result;
396     HRESULT hr;
397     LPSHELLFOLDER psfDesktop;
398     WCHAR wszMyComputer[] = { 
399         ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-',
400         'A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0 };
401
402     /* Calling SHGetPathFromIDList with an empty pidl should return the desktop folder's path. */
403     result = SHGetSpecialFolderPathW(NULL, wszDesktop, CSIDL_DESKTOP, FALSE);
404     ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOP) failed! Last error: %08lx\n", GetLastError());
405     if (!result) return;
406     
407     result = SHGetPathFromIDListW(pidlEmpty, wszPath);
408     ok(result, "SHGetPathFromIDListW failed! Last error: %08lx\n", GetLastError());
409     if (!result) return;
410     ok(!lstrcmpiW(wszDesktop, wszPath), "SHGetPathFromIDList didn't return desktop path for empty pidl!\n");
411
412     /* MyComputer does not map to a filesystem path. SHGetPathFromIDList should fail. */
413     hr = SHGetDesktopFolder(&psfDesktop);
414     ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08lx\n", hr);
415     if (FAILED(hr)) return;
416
417     hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL);
418     ok (SUCCEEDED(hr), "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08lx\n", hr);
419     IShellFolder_Release(psfDesktop);
420     if (FAILED(hr)) return;
421
422     SetLastError(0xdeadbeef);
423     result = SHGetPathFromIDListW(pidlMyComputer, wszPath);
424     ok (!result, "SHGetPathFromIDList succeeded where it shouldn't!\n");
425     ok (GetLastError()==0xdeadbeef, "SHGetPathFromIDList shouldn't set last error! Last error: %08lx\n", GetLastError());
426
427     ILFree(pidlMyComputer);
428 }
429
430 START_TEST(shlfolder)
431 {
432     ITEMIDLIST *newPIDL;
433     IShellFolder *IDesktopFolder, *testIShellFolder;
434     char  cCurrDirA [MAX_PATH] = {0};
435     WCHAR cCurrDirW [MAX_PATH];
436     static const WCHAR cTestDirW[] = {'\\','t','e','s','t','d','i','r',0};
437     HRESULT hr;
438     
439     GetCurrentDirectoryA(MAX_PATH, cCurrDirA);
440     MultiByteToWideChar(CP_ACP, 0, cCurrDirA, -1, cCurrDirW, MAX_PATH);
441     strcatW(cCurrDirW, cTestDirW);
442
443     OleInitialize(NULL);
444
445     hr = SHGetMalloc(&ppM);
446     ok(hr == S_OK, "SHGetMalloc failed %08lx\n", hr);
447
448     CreateFilesFolders();
449     
450     hr = SHGetDesktopFolder(&IDesktopFolder);
451     ok(hr == S_OK, "SHGetDesktopfolder failed %08lx\n", hr);
452
453     hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL, cCurrDirW, NULL, &newPIDL, 0);
454     ok(hr == S_OK, "ParseDisplayName failed %08lx\n", hr);
455
456     hr = IShellFolder_BindToObject(IDesktopFolder, newPIDL, NULL, (REFIID)&IID_IShellFolder, (LPVOID *)&testIShellFolder);
457     ok(hr == S_OK, "BindToObject failed %08lx\n", hr);
458         
459     test_EnumObjects(testIShellFolder);
460     test_BindToObject();
461     test_GetDisplayName();
462     test_GetAttributesOf();
463     test_SHGetPathFromIDList();
464
465     hr = IShellFolder_Release(testIShellFolder);
466     ok(hr == S_OK, "IShellFolder_Release failed %08lx\n", hr);
467
468     IMalloc_Free(ppM, newPIDL);
469
470     Cleanup();
471 }