comctl32: Free the selection ranges (Coverity).
[wine] / dlls / shell32 / shfldr_netplaces.c
1 /*
2  *      Network Places (Neighbourhood) folder
3  *
4  *      Copyright 1997                  Marcus Meissner
5  *      Copyright 1998, 1999, 2002      Juergen Schmied
6  *      Copyright 2003                  Mike McCormack for CodeWeavers
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22
23 #include "config.h"
24 #include "wine/port.h"
25
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdarg.h>
29 #include <stdio.h>
30
31 #define COBJMACROS
32 #define NONAMELESSUNION
33 #define NONAMELESSSTRUCT
34
35 #include "winerror.h"
36 #include "windef.h"
37 #include "winbase.h"
38 #include "winreg.h"
39
40 #include "pidl.h"
41 #include "undocshell.h"
42 #include "shell32_main.h"
43 #include "shresdef.h"
44 #include "wine/debug.h"
45 #include "wine/unicode.h"
46 #include "debughlp.h"
47 #include "shfldr.h"
48
49 WINE_DEFAULT_DEBUG_CHANNEL (shell);
50
51 /***********************************************************************
52 *   IShellFolder implementation
53 */
54
55 typedef struct {
56     IShellFolder2   IShellFolder2_iface;
57     IPersistFolder2 IPersistFolder2_iface;
58     LONG            ref;
59
60     /* both paths are parsible from the desktop */
61     LPITEMIDLIST pidlRoot;      /* absolute pidl */
62 } IGenericSFImpl;
63
64 static const IShellFolder2Vtbl vt_ShellFolder2;
65 static const IPersistFolder2Vtbl vt_NP_PersistFolder2;
66
67 static inline IGenericSFImpl *impl_from_IShellFolder2(IShellFolder2 *iface)
68 {
69     return CONTAINING_RECORD(iface, IGenericSFImpl, IShellFolder2_iface);
70 }
71
72 static inline IGenericSFImpl *impl_from_IPersistFolder2(IPersistFolder2 *iface)
73 {
74     return CONTAINING_RECORD(iface, IGenericSFImpl, IPersistFolder2_iface);
75 }
76
77
78 static const shvheader networkplaces_header[] = {
79     {IDS_SHV_COLUMN1, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
80     {IDS_SHV_COLUMN9, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10}
81 };
82
83 #define NETWORKPLACESSHELLVIEWCOLUMNS sizeof(networkplaces_header)/sizeof(shvheader)
84
85 /**************************************************************************
86 *       ISF_NetworkPlaces_Constructor
87 */
88 HRESULT WINAPI ISF_NetworkPlaces_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
89 {
90     IGenericSFImpl *sf;
91
92     TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
93
94     if (!ppv)
95         return E_POINTER;
96     if (pUnkOuter)
97         return CLASS_E_NOAGGREGATION;
98
99     sf = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (IGenericSFImpl));
100     if (!sf)
101         return E_OUTOFMEMORY;
102
103     sf->ref = 0;
104     sf->IShellFolder2_iface.lpVtbl = &vt_ShellFolder2;
105     sf->IPersistFolder2_iface.lpVtbl = &vt_NP_PersistFolder2;
106     sf->pidlRoot = _ILCreateNetHood();  /* my qualified pidl */
107
108     if (FAILED (IShellFolder2_QueryInterface (&sf->IShellFolder2_iface, riid, ppv)))
109     {
110         IShellFolder2_Release (&sf->IShellFolder2_iface);
111         return E_NOINTERFACE;
112     }
113
114     TRACE ("--(%p)\n", sf);
115     return S_OK;
116 }
117
118 /**************************************************************************
119  *      ISF_NetworkPlaces_fnQueryInterface
120  *
121  * NOTE
122  *     supports not IPersist/IPersistFolder
123  */
124 static HRESULT WINAPI ISF_NetworkPlaces_fnQueryInterface (IShellFolder2 *iface, REFIID riid, LPVOID *ppvObj)
125 {
126     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
127
128     TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
129
130     *ppvObj = NULL;
131
132     if (IsEqualIID (riid, &IID_IUnknown) ||
133         IsEqualIID (riid, &IID_IShellFolder) ||
134         IsEqualIID (riid, &IID_IShellFolder2))
135     {
136         *ppvObj = This;
137     }
138     else if (IsEqualIID (riid, &IID_IPersist) ||
139              IsEqualIID (riid, &IID_IPersistFolder) ||
140              IsEqualIID (riid, &IID_IPersistFolder2))
141     {
142         *ppvObj = &This->IPersistFolder2_iface;
143     }
144
145     if (*ppvObj)
146     {
147         IUnknown_AddRef ((IUnknown *) (*ppvObj));
148         TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
149         return S_OK;
150     }
151     TRACE ("-- Interface: E_NOINTERFACE\n");
152     return E_NOINTERFACE;
153 }
154
155 static ULONG WINAPI ISF_NetworkPlaces_fnAddRef (IShellFolder2 * iface)
156 {
157     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
158     ULONG refCount = InterlockedIncrement(&This->ref);
159
160     TRACE ("(%p)->(count=%u)\n", This, refCount - 1);
161
162     return refCount;
163 }
164
165 static ULONG WINAPI ISF_NetworkPlaces_fnRelease (IShellFolder2 * iface)
166 {
167     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
168     ULONG refCount = InterlockedDecrement(&This->ref);
169
170     TRACE ("(%p)->(count=%u)\n", This, refCount + 1);
171
172     if (!refCount) {
173         TRACE ("-- destroying IShellFolder(%p)\n", This);
174         SHFree (This->pidlRoot);
175         HeapFree (GetProcessHeap(), 0, This);
176     }
177     return refCount;
178 }
179
180 /**************************************************************************
181 *       ISF_NetworkPlaces_fnParseDisplayName
182 */
183 static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * iface,
184                HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName,
185                DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
186 {
187     static const WCHAR wszEntireNetwork[] = {'E','n','t','i','r','e','N','e','t','w','o','r','k'}; /* not nul-terminated */
188     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
189     HRESULT hr = E_INVALIDARG;
190     LPCWSTR szNext = NULL;
191     WCHAR szElement[MAX_PATH];
192     LPITEMIDLIST pidlTemp = NULL;
193     int len;
194
195     TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", This,
196             hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName),
197             pchEaten, ppidl, pdwAttributes);
198
199     *ppidl = NULL;
200
201     szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
202     len = strlenW(szElement);
203     if (len == sizeof(wszEntireNetwork)/sizeof(wszEntireNetwork[0]) &&
204         !strncmpiW(szElement, wszEntireNetwork, sizeof(wszEntireNetwork)/sizeof(wszEntireNetwork[0])))
205     {
206         pidlTemp = _ILCreateEntireNetwork();
207         if (pidlTemp)
208             hr = S_OK;
209         else
210             hr = E_OUTOFMEMORY;
211     }
212     else
213         FIXME("not implemented for %s\n", debugstr_w(lpszDisplayName));
214
215     if (SUCCEEDED(hr) && pidlTemp)
216     {
217         if (szNext && *szNext)
218         {
219             hr = SHELL32_ParseNextElement(iface, hwndOwner, pbcReserved,
220                     &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
221         }
222         else
223         {
224             if (pdwAttributes && *pdwAttributes)
225                 hr = SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, pidlTemp,
226                         pdwAttributes);
227         }
228     }
229
230     if (SUCCEEDED(hr))
231         *ppidl = pidlTemp;
232     else
233         ILFree(pidlTemp);
234
235     TRACE ("(%p)->(-- ret=0x%08x)\n", This, hr);
236
237     return hr;
238 }
239
240 /**************************************************************************
241 *               ISF_NetworkPlaces_fnEnumObjects
242 */
243 static HRESULT WINAPI ISF_NetworkPlaces_fnEnumObjects (IShellFolder2 * iface,
244                HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
245 {
246     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
247     IEnumIDListImpl *list;
248
249     TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", This,
250             hwndOwner, dwFlags, ppEnumIDList);
251
252     if (!(list = IEnumIDList_Constructor()))
253         return E_OUTOFMEMORY;
254     *ppEnumIDList = &list->IEnumIDList_iface;
255
256     TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
257
258     return S_OK;
259 }
260
261 /**************************************************************************
262 *               ISF_NetworkPlaces_fnBindToObject
263 */
264 static HRESULT WINAPI ISF_NetworkPlaces_fnBindToObject (IShellFolder2 * iface,
265                LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
266 {
267     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
268
269     TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This,
270             pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
271
272     return SHELL32_BindToChild (This->pidlRoot, NULL, pidl, riid, ppvOut);
273 }
274
275 /**************************************************************************
276 *       ISF_NetworkPlaces_fnBindToStorage
277 */
278 static HRESULT WINAPI ISF_NetworkPlaces_fnBindToStorage (IShellFolder2 * iface,
279                LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
280 {
281     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
282
283     FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This,
284             pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
285
286     *ppvOut = NULL;
287     return E_NOTIMPL;
288 }
289
290 /**************************************************************************
291 *       ISF_NetworkPlaces_fnCompareIDs
292 */
293
294 static HRESULT WINAPI ISF_NetworkPlaces_fnCompareIDs (IShellFolder2 * iface,
295                LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
296 {
297     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
298     int nReturn;
299
300     TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
301     nReturn = SHELL32_CompareIDs ((IShellFolder *)&This->IShellFolder2_iface, lParam, pidl1, pidl2);
302     TRACE ("-- %i\n", nReturn);
303     return nReturn;
304 }
305
306 /**************************************************************************
307 *       ISF_NetworkPlaces_fnCreateViewObject
308 */
309 static HRESULT WINAPI ISF_NetworkPlaces_fnCreateViewObject (IShellFolder2 * iface,
310                HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
311 {
312     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
313     LPSHELLVIEW pShellView;
314     HRESULT hr = E_INVALIDARG;
315
316     TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This,
317            hwndOwner, shdebugstr_guid (riid), ppvOut);
318
319     if (!ppvOut)
320         return hr;
321
322     *ppvOut = NULL;
323
324     if (IsEqualIID (riid, &IID_IDropTarget))
325     {
326         WARN ("IDropTarget not implemented\n");
327         hr = E_NOTIMPL;
328     }
329     else if (IsEqualIID (riid, &IID_IContextMenu))
330     {
331         WARN ("IContextMenu not implemented\n");
332         hr = E_NOTIMPL;
333     }
334     else if (IsEqualIID (riid, &IID_IShellView))
335     {
336         pShellView = IShellView_Constructor ((IShellFolder *) iface);
337         if (pShellView)
338         {
339             hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
340             IShellView_Release (pShellView);
341         }
342     }
343     TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
344     return hr;
345 }
346
347 /**************************************************************************
348 *  ISF_NetworkPlaces_fnGetAttributesOf
349 */
350 static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface,
351                UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
352 {
353     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
354     HRESULT hr = S_OK;
355
356     TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", This,
357             cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
358
359     if (!rgfInOut)
360         return E_INVALIDARG;
361     if (cidl && !apidl)
362         return E_INVALIDARG;
363
364     if (*rgfInOut == 0)
365         *rgfInOut = ~0;
366
367     if (cidl == 0)
368     {
369         IShellFolder *psfParent = NULL;
370         LPCITEMIDLIST rpidl = NULL;
371
372         hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (void**)&psfParent, &rpidl);
373         if(SUCCEEDED(hr))
374         {
375             SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
376             IShellFolder_Release(psfParent);
377         }
378     }
379     else
380     {
381         while (cidl > 0 && *apidl)
382         {
383             pdump (*apidl);
384             SHELL32_GetItemAttributes ((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut);
385             apidl++;
386             cidl--;
387         }
388     }
389
390     /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
391     *rgfInOut &= ~SFGAO_VALIDATE;
392
393     TRACE ("-- result=0x%08x\n", *rgfInOut);
394     return hr;
395 }
396
397 /**************************************************************************
398 *       ISF_NetworkPlaces_fnGetUIObjectOf
399 *
400 * PARAMETERS
401 *  hwndOwner [in]  Parent window for any output
402 *  cidl      [in]  array size
403 *  apidl     [in]  simple pidl array
404 *  riid      [in]  Requested Interface
405 *  prgfInOut [   ] reserved
406 *  ppvObject [out] Resulting Interface
407 *
408 */
409 static HRESULT WINAPI ISF_NetworkPlaces_fnGetUIObjectOf (IShellFolder2 * iface,
410                HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid,
411                UINT * prgfInOut, LPVOID * ppvOut)
412 {
413     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
414
415     LPITEMIDLIST pidl;
416     IUnknown *pObj = NULL;
417     HRESULT hr = E_INVALIDARG;
418
419     TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", This,
420             hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
421
422     if (!ppvOut)
423         return hr;
424
425     *ppvOut = NULL;
426
427     if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1))
428     {
429         return ItemMenu_Constructor((IShellFolder*)iface, This->pidlRoot, apidl, cidl, riid, ppvOut);
430     }
431     else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
432     {
433         pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
434         hr = S_OK;
435     }
436     else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1))
437     {
438         pidl = ILCombine (This->pidlRoot, apidl[0]);
439         pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
440         SHFree (pidl);
441         hr = S_OK;
442     }
443     else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1))
444     {
445         pidl = ILCombine (This->pidlRoot, apidl[0]);
446         pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
447         SHFree (pidl);
448         hr = S_OK;
449     }
450     else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
451     {
452         hr = IShellFolder2_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
453     }
454     else
455         hr = E_NOINTERFACE;
456
457     if (SUCCEEDED(hr) && !pObj)
458         hr = E_OUTOFMEMORY;
459
460     *ppvOut = pObj;
461     TRACE ("(%p)->hr=0x%08x\n", This, hr);
462     return hr;
463 }
464
465 /**************************************************************************
466 *       ISF_NetworkPlaces_fnGetDisplayNameOf
467 *
468 */
469 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDisplayNameOf (IShellFolder2 * iface,
470                LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
471 {
472     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
473
474     FIXME ("(%p)->(pidl=%p,0x%08x,%p)\n", This, pidl, dwFlags, strRet);
475     pdump (pidl);
476
477     if (!strRet)
478         return E_INVALIDARG;
479
480     return E_NOTIMPL;
481 }
482
483 /**************************************************************************
484 *  ISF_NetworkPlaces_fnSetNameOf
485 *  Changes the name of a file object or subfolder, possibly changing its item
486 *  identifier in the process.
487 *
488 * PARAMETERS
489 *  hwndOwner [in]  Owner window for output
490 *  pidl      [in]  simple pidl of item to change
491 *  lpszName  [in]  the items new display name
492 *  dwFlags   [in]  SHGNO formatting flags
493 *  ppidlOut  [out] simple pidl returned
494 */
495 static HRESULT WINAPI ISF_NetworkPlaces_fnSetNameOf (IShellFolder2 * iface,
496                HWND hwndOwner, LPCITEMIDLIST pidl,      /*simple pidl */
497                LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
498 {
499     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
500
501     FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This,
502             hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
503     return E_FAIL;
504 }
505
506 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDefaultSearchGUID (
507                IShellFolder2 * iface, GUID * pguid)
508 {
509     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
510
511     FIXME ("(%p)\n", This);
512     return E_NOTIMPL;
513 }
514
515 static HRESULT WINAPI ISF_NetworkPlaces_fnEnumSearches (IShellFolder2 * iface,
516                IEnumExtraSearch ** ppenum)
517 {
518     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
519
520     FIXME ("(%p)\n", This);
521     return E_NOTIMPL;
522 }
523
524 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDefaultColumn (IShellFolder2 * iface,
525                DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
526 {
527     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
528
529     TRACE ("(%p)\n", This);
530
531     if (pSort)
532         *pSort = 0;
533     if (pDisplay)
534         *pDisplay = 0;
535
536     return S_OK;
537 }
538
539 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDefaultColumnState (
540                IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
541 {
542     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
543
544     TRACE ("(%p)->(%d %p)\n", This, iColumn, pcsFlags);
545
546     if (!pcsFlags || iColumn >= NETWORKPLACESSHELLVIEWCOLUMNS)
547         return E_INVALIDARG;
548
549     *pcsFlags = networkplaces_header[iColumn].pcsFlags;
550
551     return S_OK;
552 }
553
554 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDetailsEx (IShellFolder2 * iface,
555                LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
556 {
557     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
558
559     FIXME ("(%p)\n", This);
560     return E_NOTIMPL;
561 }
562
563 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDetailsOf (IShellFolder2 * iface,
564                LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
565 {
566     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
567
568     FIXME ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
569
570     return E_NOTIMPL;
571 }
572
573 static HRESULT WINAPI ISF_NetworkPlaces_fnMapColumnToSCID (IShellFolder2 * iface,
574                UINT column, SHCOLUMNID * pscid)
575 {
576     IGenericSFImpl *This = impl_from_IShellFolder2(iface);
577
578     FIXME ("(%p)\n", This);
579
580     return E_NOTIMPL;
581 }
582
583 static const IShellFolder2Vtbl vt_ShellFolder2 = {
584     ISF_NetworkPlaces_fnQueryInterface,
585     ISF_NetworkPlaces_fnAddRef,
586     ISF_NetworkPlaces_fnRelease,
587     ISF_NetworkPlaces_fnParseDisplayName,
588     ISF_NetworkPlaces_fnEnumObjects,
589     ISF_NetworkPlaces_fnBindToObject,
590     ISF_NetworkPlaces_fnBindToStorage,
591     ISF_NetworkPlaces_fnCompareIDs,
592     ISF_NetworkPlaces_fnCreateViewObject,
593     ISF_NetworkPlaces_fnGetAttributesOf,
594     ISF_NetworkPlaces_fnGetUIObjectOf,
595     ISF_NetworkPlaces_fnGetDisplayNameOf,
596     ISF_NetworkPlaces_fnSetNameOf,
597     /* ShellFolder2 */
598     ISF_NetworkPlaces_fnGetDefaultSearchGUID,
599     ISF_NetworkPlaces_fnEnumSearches,
600     ISF_NetworkPlaces_fnGetDefaultColumn,
601     ISF_NetworkPlaces_fnGetDefaultColumnState,
602     ISF_NetworkPlaces_fnGetDetailsEx,
603     ISF_NetworkPlaces_fnGetDetailsOf,
604     ISF_NetworkPlaces_fnMapColumnToSCID
605 };
606
607 /************************************************************************
608  *      INPFldr_PersistFolder2_QueryInterface
609  */
610 static HRESULT WINAPI INPFldr_PersistFolder2_QueryInterface (IPersistFolder2 * iface,
611                REFIID iid, LPVOID * ppvObj)
612 {
613     IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
614
615     TRACE ("(%p)\n", This);
616
617     return IShellFolder2_QueryInterface (&This->IShellFolder2_iface, iid, ppvObj);
618 }
619
620 /************************************************************************
621  *      INPFldr_PersistFolder2_AddRef
622  */
623 static ULONG WINAPI INPFldr_PersistFolder2_AddRef (IPersistFolder2 * iface)
624 {
625     IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
626
627     TRACE ("(%p)->(count=%u)\n", This, This->ref);
628
629     return IShellFolder2_AddRef (&This->IShellFolder2_iface);
630 }
631
632 /************************************************************************
633  *      ISFPersistFolder_Release
634  */
635 static ULONG WINAPI INPFldr_PersistFolder2_Release (IPersistFolder2 * iface)
636 {
637     IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
638
639     TRACE ("(%p)->(count=%u)\n", This, This->ref);
640
641     return IShellFolder2_Release (&This->IShellFolder2_iface);
642 }
643
644 /************************************************************************
645  *      INPFldr_PersistFolder2_GetClassID
646  */
647 static HRESULT WINAPI INPFldr_PersistFolder2_GetClassID (
648                IPersistFolder2 * iface, CLSID * lpClassId)
649 {
650     IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
651
652     TRACE ("(%p)\n", This);
653
654     if (!lpClassId)
655         return E_POINTER;
656
657     *lpClassId = CLSID_NetworkPlaces;
658
659     return S_OK;
660 }
661
662 /************************************************************************
663  *      INPFldr_PersistFolder2_Initialize
664  *
665  * NOTES: it makes no sense to change the pidl
666  */
667 static HRESULT WINAPI INPFldr_PersistFolder2_Initialize (
668                IPersistFolder2 * iface, LPCITEMIDLIST pidl)
669 {
670     IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
671
672     TRACE ("(%p)->(%p)\n", This, pidl);
673
674     return E_NOTIMPL;
675 }
676
677 /**************************************************************************
678  *      IPersistFolder2_fnGetCurFolder
679  */
680 static HRESULT WINAPI INPFldr_PersistFolder2_GetCurFolder (
681                IPersistFolder2 * iface, LPITEMIDLIST * pidl)
682 {
683     IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
684
685     TRACE ("(%p)->(%p)\n", This, pidl);
686
687     if (!pidl)
688         return E_POINTER;
689
690     *pidl = ILClone (This->pidlRoot);
691
692     return S_OK;
693 }
694
695 static const IPersistFolder2Vtbl vt_NP_PersistFolder2 =
696 {
697     INPFldr_PersistFolder2_QueryInterface,
698     INPFldr_PersistFolder2_AddRef,
699     INPFldr_PersistFolder2_Release,
700     INPFldr_PersistFolder2_GetClassID,
701     INPFldr_PersistFolder2_Initialize,
702     INPFldr_PersistFolder2_GetCurFolder
703 };