shell32: Avoid casts when creating item menu.
[wine/multimedia.git] / dlls / shell32 / shfldr_netplaces.c
blob39f748be182d880c6052d257912949df00ee2adb
1 /*
2 * Network Places (Neighbourhood) folder
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998, 1999, 2002 Juergen Schmied
6 * Copyright 2003 Mike McCormack for CodeWeavers
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.
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.
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
23 #include "config.h"
24 #include "wine/port.h"
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdarg.h>
29 #include <stdio.h>
31 #define COBJMACROS
32 #define NONAMELESSUNION
33 #define NONAMELESSSTRUCT
35 #include "winerror.h"
36 #include "windef.h"
37 #include "winbase.h"
38 #include "winreg.h"
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"
49 WINE_DEFAULT_DEBUG_CHANNEL (shell);
51 /***********************************************************************
52 * IShellFolder implementation
55 typedef struct {
56 IShellFolder2 IShellFolder2_iface;
57 IPersistFolder2 IPersistFolder2_iface;
58 LONG ref;
60 /* both paths are parsible from the desktop */
61 LPITEMIDLIST pidlRoot; /* absolute pidl */
62 } IGenericSFImpl;
64 static const IShellFolder2Vtbl vt_ShellFolder2;
65 static const IPersistFolder2Vtbl vt_NP_PersistFolder2;
67 static inline IGenericSFImpl *impl_from_IShellFolder2(IShellFolder2 *iface)
69 return CONTAINING_RECORD(iface, IGenericSFImpl, IShellFolder2_iface);
72 static inline IGenericSFImpl *impl_from_IPersistFolder2(IPersistFolder2 *iface)
74 return CONTAINING_RECORD(iface, IGenericSFImpl, IPersistFolder2_iface);
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}
83 #define NETWORKPLACESSHELLVIEWCOLUMNS sizeof(networkplaces_header)/sizeof(shvheader)
85 /**************************************************************************
86 * ISF_NetworkPlaces_Constructor
88 HRESULT WINAPI ISF_NetworkPlaces_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
90 IGenericSFImpl *sf;
92 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
94 if (!ppv)
95 return E_POINTER;
96 if (pUnkOuter)
97 return CLASS_E_NOAGGREGATION;
99 sf = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (IGenericSFImpl));
100 if (!sf)
101 return E_OUTOFMEMORY;
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 */
108 if (FAILED (IShellFolder2_QueryInterface (&sf->IShellFolder2_iface, riid, ppv)))
110 IShellFolder2_Release (&sf->IShellFolder2_iface);
111 return E_NOINTERFACE;
114 TRACE ("--(%p)\n", sf);
115 return S_OK;
118 /**************************************************************************
119 * ISF_NetworkPlaces_fnQueryInterface
121 * NOTE
122 * supports not IPersist/IPersistFolder
124 static HRESULT WINAPI ISF_NetworkPlaces_fnQueryInterface (IShellFolder2 *iface, REFIID riid, LPVOID *ppvObj)
126 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
128 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
130 *ppvObj = NULL;
132 if (IsEqualIID (riid, &IID_IUnknown) ||
133 IsEqualIID (riid, &IID_IShellFolder) ||
134 IsEqualIID (riid, &IID_IShellFolder2))
136 *ppvObj = This;
138 else if (IsEqualIID (riid, &IID_IPersist) ||
139 IsEqualIID (riid, &IID_IPersistFolder) ||
140 IsEqualIID (riid, &IID_IPersistFolder2))
142 *ppvObj = &This->IPersistFolder2_iface;
145 if (*ppvObj)
147 IUnknown_AddRef ((IUnknown *) (*ppvObj));
148 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
149 return S_OK;
151 TRACE ("-- Interface: E_NOINTERFACE\n");
152 return E_NOINTERFACE;
155 static ULONG WINAPI ISF_NetworkPlaces_fnAddRef (IShellFolder2 * iface)
157 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
158 ULONG refCount = InterlockedIncrement(&This->ref);
160 TRACE ("(%p)->(count=%u)\n", This, refCount - 1);
162 return refCount;
165 static ULONG WINAPI ISF_NetworkPlaces_fnRelease (IShellFolder2 * iface)
167 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
168 ULONG refCount = InterlockedDecrement(&This->ref);
170 TRACE ("(%p)->(count=%u)\n", This, refCount + 1);
172 if (!refCount) {
173 TRACE ("-- destroying IShellFolder(%p)\n", This);
174 SHFree (This->pidlRoot);
175 HeapFree (GetProcessHeap(), 0, This);
177 return refCount;
180 /**************************************************************************
181 * ISF_NetworkPlaces_fnParseDisplayName
183 static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * iface,
184 HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName,
185 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
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;
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);
199 *ppidl = NULL;
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])))
206 pidlTemp = _ILCreateEntireNetwork();
207 if (pidlTemp)
208 hr = S_OK;
209 else
210 hr = E_OUTOFMEMORY;
212 else
213 FIXME("not implemented for %s\n", debugstr_w(lpszDisplayName));
215 if (SUCCEEDED(hr) && pidlTemp)
217 if (szNext && *szNext)
219 hr = SHELL32_ParseNextElement(iface, hwndOwner, pbcReserved,
220 &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
222 else
224 if (pdwAttributes && *pdwAttributes)
225 hr = SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, pidlTemp,
226 pdwAttributes);
230 if (SUCCEEDED(hr))
231 *ppidl = pidlTemp;
232 else
233 ILFree(pidlTemp);
235 TRACE ("(%p)->(-- ret=0x%08x)\n", This, hr);
237 return hr;
240 /**************************************************************************
241 * ISF_NetworkPlaces_fnEnumObjects
243 static HRESULT WINAPI ISF_NetworkPlaces_fnEnumObjects (IShellFolder2 * iface,
244 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
246 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
247 IEnumIDListImpl *list;
249 TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", This,
250 hwndOwner, dwFlags, ppEnumIDList);
252 if (!(list = IEnumIDList_Constructor()))
253 return E_OUTOFMEMORY;
254 *ppEnumIDList = &list->IEnumIDList_iface;
256 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
258 return S_OK;
261 /**************************************************************************
262 * ISF_NetworkPlaces_fnBindToObject
264 static HRESULT WINAPI ISF_NetworkPlaces_fnBindToObject (IShellFolder2 * iface,
265 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
267 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
269 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This,
270 pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
272 return SHELL32_BindToChild (This->pidlRoot, NULL, pidl, riid, ppvOut);
275 /**************************************************************************
276 * ISF_NetworkPlaces_fnBindToStorage
278 static HRESULT WINAPI ISF_NetworkPlaces_fnBindToStorage (IShellFolder2 * iface,
279 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
281 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
283 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This,
284 pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
286 *ppvOut = NULL;
287 return E_NOTIMPL;
290 /**************************************************************************
291 * ISF_NetworkPlaces_fnCompareIDs
294 static HRESULT WINAPI ISF_NetworkPlaces_fnCompareIDs (IShellFolder2 * iface,
295 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
297 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
298 int nReturn;
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;
306 /**************************************************************************
307 * ISF_NetworkPlaces_fnCreateViewObject
309 static HRESULT WINAPI ISF_NetworkPlaces_fnCreateViewObject (IShellFolder2 * iface,
310 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
312 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
313 LPSHELLVIEW pShellView;
314 HRESULT hr = E_INVALIDARG;
316 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This,
317 hwndOwner, shdebugstr_guid (riid), ppvOut);
319 if (!ppvOut)
320 return hr;
322 *ppvOut = NULL;
324 if (IsEqualIID (riid, &IID_IDropTarget))
326 WARN ("IDropTarget not implemented\n");
327 hr = E_NOTIMPL;
329 else if (IsEqualIID (riid, &IID_IContextMenu))
331 WARN ("IContextMenu not implemented\n");
332 hr = E_NOTIMPL;
334 else if (IsEqualIID (riid, &IID_IShellView))
336 pShellView = IShellView_Constructor ((IShellFolder *) iface);
337 if (pShellView)
339 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
340 IShellView_Release (pShellView);
343 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
344 return hr;
347 /**************************************************************************
348 * ISF_NetworkPlaces_fnGetAttributesOf
350 static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface,
351 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
353 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
354 HRESULT hr = S_OK;
356 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", This,
357 cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
359 if (!rgfInOut)
360 return E_INVALIDARG;
361 if (cidl && !apidl)
362 return E_INVALIDARG;
364 if (*rgfInOut == 0)
365 *rgfInOut = ~0;
367 if (cidl == 0)
369 IShellFolder *psfParent = NULL;
370 LPCITEMIDLIST rpidl = NULL;
372 hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (void**)&psfParent, &rpidl);
373 if(SUCCEEDED(hr))
375 SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
376 IShellFolder_Release(psfParent);
379 else
381 while (cidl > 0 && *apidl)
383 pdump (*apidl);
384 SHELL32_GetItemAttributes ((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut);
385 apidl++;
386 cidl--;
390 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
391 *rgfInOut &= ~SFGAO_VALIDATE;
393 TRACE ("-- result=0x%08x\n", *rgfInOut);
394 return hr;
397 /**************************************************************************
398 * ISF_NetworkPlaces_fnGetUIObjectOf
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
409 static HRESULT WINAPI ISF_NetworkPlaces_fnGetUIObjectOf (IShellFolder2 * iface,
410 HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid,
411 UINT * prgfInOut, LPVOID * ppvOut)
413 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
415 LPITEMIDLIST pidl;
416 IUnknown *pObj = NULL;
417 HRESULT hr = E_INVALIDARG;
419 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", This,
420 hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
422 if (!ppvOut)
423 return hr;
425 *ppvOut = NULL;
427 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1))
429 return ItemMenu_Constructor((IShellFolder*)iface, This->pidlRoot, apidl, cidl, riid, ppvOut);
431 else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
433 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
434 hr = S_OK;
436 else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1))
438 pidl = ILCombine (This->pidlRoot, apidl[0]);
439 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
440 SHFree (pidl);
441 hr = S_OK;
443 else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1))
445 pidl = ILCombine (This->pidlRoot, apidl[0]);
446 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
447 SHFree (pidl);
448 hr = S_OK;
450 else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
452 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
454 else
455 hr = E_NOINTERFACE;
457 if (SUCCEEDED(hr) && !pObj)
458 hr = E_OUTOFMEMORY;
460 *ppvOut = pObj;
461 TRACE ("(%p)->hr=0x%08x\n", This, hr);
462 return hr;
465 /**************************************************************************
466 * ISF_NetworkPlaces_fnGetDisplayNameOf
469 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDisplayNameOf (IShellFolder2 * iface,
470 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
472 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
474 FIXME ("(%p)->(pidl=%p,0x%08x,%p)\n", This, pidl, dwFlags, strRet);
475 pdump (pidl);
477 if (!strRet)
478 return E_INVALIDARG;
480 return E_NOTIMPL;
483 /**************************************************************************
484 * ISF_NetworkPlaces_fnSetNameOf
485 * Changes the name of a file object or subfolder, possibly changing its item
486 * identifier in the process.
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
495 static HRESULT WINAPI ISF_NetworkPlaces_fnSetNameOf (IShellFolder2 * iface,
496 HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
497 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
499 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
501 FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This,
502 hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
503 return E_FAIL;
506 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDefaultSearchGUID (
507 IShellFolder2 * iface, GUID * pguid)
509 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
511 FIXME ("(%p)\n", This);
512 return E_NOTIMPL;
515 static HRESULT WINAPI ISF_NetworkPlaces_fnEnumSearches (IShellFolder2 * iface,
516 IEnumExtraSearch ** ppenum)
518 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
520 FIXME ("(%p)\n", This);
521 return E_NOTIMPL;
524 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDefaultColumn (IShellFolder2 * iface,
525 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
527 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
529 TRACE ("(%p)\n", This);
531 if (pSort)
532 *pSort = 0;
533 if (pDisplay)
534 *pDisplay = 0;
536 return S_OK;
539 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDefaultColumnState (
540 IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
542 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
544 TRACE ("(%p)->(%d %p)\n", This, iColumn, pcsFlags);
546 if (!pcsFlags || iColumn >= NETWORKPLACESSHELLVIEWCOLUMNS)
547 return E_INVALIDARG;
549 *pcsFlags = networkplaces_header[iColumn].pcsFlags;
551 return S_OK;
554 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDetailsEx (IShellFolder2 * iface,
555 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
557 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
559 FIXME ("(%p)\n", This);
560 return E_NOTIMPL;
563 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDetailsOf (IShellFolder2 * iface,
564 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
566 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
568 FIXME ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
570 return E_NOTIMPL;
573 static HRESULT WINAPI ISF_NetworkPlaces_fnMapColumnToSCID (IShellFolder2 * iface,
574 UINT column, SHCOLUMNID * pscid)
576 IGenericSFImpl *This = impl_from_IShellFolder2(iface);
578 FIXME ("(%p)\n", This);
580 return E_NOTIMPL;
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
607 /************************************************************************
608 * INPFldr_PersistFolder2_QueryInterface
610 static HRESULT WINAPI INPFldr_PersistFolder2_QueryInterface (IPersistFolder2 * iface,
611 REFIID iid, LPVOID * ppvObj)
613 IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
615 TRACE ("(%p)\n", This);
617 return IShellFolder2_QueryInterface (&This->IShellFolder2_iface, iid, ppvObj);
620 /************************************************************************
621 * INPFldr_PersistFolder2_AddRef
623 static ULONG WINAPI INPFldr_PersistFolder2_AddRef (IPersistFolder2 * iface)
625 IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
627 TRACE ("(%p)->(count=%u)\n", This, This->ref);
629 return IShellFolder2_AddRef (&This->IShellFolder2_iface);
632 /************************************************************************
633 * ISFPersistFolder_Release
635 static ULONG WINAPI INPFldr_PersistFolder2_Release (IPersistFolder2 * iface)
637 IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
639 TRACE ("(%p)->(count=%u)\n", This, This->ref);
641 return IShellFolder2_Release (&This->IShellFolder2_iface);
644 /************************************************************************
645 * INPFldr_PersistFolder2_GetClassID
647 static HRESULT WINAPI INPFldr_PersistFolder2_GetClassID (
648 IPersistFolder2 * iface, CLSID * lpClassId)
650 IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
652 TRACE ("(%p)\n", This);
654 if (!lpClassId)
655 return E_POINTER;
657 *lpClassId = CLSID_NetworkPlaces;
659 return S_OK;
662 /************************************************************************
663 * INPFldr_PersistFolder2_Initialize
665 * NOTES: it makes no sense to change the pidl
667 static HRESULT WINAPI INPFldr_PersistFolder2_Initialize (
668 IPersistFolder2 * iface, LPCITEMIDLIST pidl)
670 IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
672 TRACE ("(%p)->(%p)\n", This, pidl);
674 return E_NOTIMPL;
677 /**************************************************************************
678 * IPersistFolder2_fnGetCurFolder
680 static HRESULT WINAPI INPFldr_PersistFolder2_GetCurFolder (
681 IPersistFolder2 * iface, LPITEMIDLIST * pidl)
683 IGenericSFImpl *This = impl_from_IPersistFolder2(iface);
685 TRACE ("(%p)->(%p)\n", This, pidl);
687 if (!pidl)
688 return E_POINTER;
690 *pidl = ILClone (This->pidlRoot);
692 return S_OK;
695 static const IPersistFolder2Vtbl vt_NP_PersistFolder2 =
697 INPFldr_PersistFolder2_QueryInterface,
698 INPFldr_PersistFolder2_AddRef,
699 INPFldr_PersistFolder2_Release,
700 INPFldr_PersistFolder2_GetClassID,
701 INPFldr_PersistFolder2_Initialize,
702 INPFldr_PersistFolder2_GetCurFolder