partial dbghelp wine sync
[reactos.git] / reactos / dll / win32 / 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 <precomp.h>
24
25 WINE_DEFAULT_DEBUG_CHANNEL (shell);
26
27 /***********************************************************************
28 * IShellFolder implementation
29 */
30
31 typedef struct {
32 const IShellFolder2Vtbl *lpVtbl;
33 LONG ref;
34 const IPersistFolder2Vtbl *lpVtblPersistFolder2;
35
36 /* both paths are parsible from the desktop */
37 LPITEMIDLIST pidlRoot; /* absolute pidl */
38 } IGenericSFImpl;
39
40 static const IShellFolder2Vtbl vt_ShellFolder2;
41 static const IPersistFolder2Vtbl vt_NP_PersistFolder2;
42
43
44 #define _IPersistFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpVtblPersistFolder2)))
45 #define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder2_Offset);
46
47 #define _IUnknown_(This) ((IUnknown*)&(This)->lpVtbl)
48 #define _IShellFolder_(This) ((IShellFolder*)&(This)->lpVtbl)
49 #define _IPersistFolder2_(This) (&(This)->lpVtblPersistFolder2)
50
51 static shvheader NetworkPlacesSFHeader[] = {
52 {IDS_SHV_COLUMN8, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
53 {IDS_SHV_COLUMN13, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
54 {IDS_SHV_COLUMN_WORKGROUP, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
55 {IDS_SHV_NETWORKLOCATION, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15}
56 };
57
58 #define COLUMN_NAME 0
59 #define COLUMN_CATEGORY 1
60 #define COLUMN_WORKGROUP 2
61 #define COLUMN_NETLOCATION 3
62
63 #define NETWORKPLACESSHELLVIEWCOLUMNS 4
64
65 /**************************************************************************
66 * ISF_NetworkPlaces_Constructor
67 */
68 HRESULT WINAPI ISF_NetworkPlaces_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
69 {
70 IGenericSFImpl *sf;
71
72 TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
73
74 if (!ppv)
75 return E_POINTER;
76 if (pUnkOuter)
77 return CLASS_E_NOAGGREGATION;
78
79 sf = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (IGenericSFImpl));
80 if (!sf)
81 return E_OUTOFMEMORY;
82
83 sf->ref = 0;
84 sf->lpVtbl = &vt_ShellFolder2;
85 sf->lpVtblPersistFolder2 = &vt_NP_PersistFolder2;
86 sf->pidlRoot = _ILCreateNetHood(); /* my qualified pidl */
87
88 if (FAILED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv)))
89 {
90 IUnknown_Release (_IUnknown_ (sf));
91 return E_NOINTERFACE;
92 }
93
94 TRACE ("--(%p)\n", sf);
95 return S_OK;
96 }
97
98 /**************************************************************************
99 * ISF_NetworkPlaces_fnQueryInterface
100 *
101 * NOTE
102 * supports not IPersist/IPersistFolder
103 */
104 static HRESULT WINAPI ISF_NetworkPlaces_fnQueryInterface (IShellFolder2 *iface, REFIID riid, LPVOID *ppvObj)
105 {
106 IGenericSFImpl *This = (IGenericSFImpl *)iface;
107
108 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
109
110 *ppvObj = NULL;
111
112 if (IsEqualIID (riid, &IID_IUnknown) ||
113 IsEqualIID (riid, &IID_IShellFolder) ||
114 IsEqualIID (riid, &IID_IShellFolder2))
115 {
116 *ppvObj = This;
117 }
118 else if (IsEqualIID (riid, &IID_IPersist) ||
119 IsEqualIID (riid, &IID_IPersistFolder) ||
120 IsEqualIID (riid, &IID_IPersistFolder2))
121 {
122 *ppvObj = _IPersistFolder2_ (This);
123 }
124
125 if (*ppvObj)
126 {
127 IUnknown_AddRef ((IUnknown *) (*ppvObj));
128 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
129 return S_OK;
130 }
131 TRACE ("-- Interface: E_NOINTERFACE\n");
132 return E_NOINTERFACE;
133 }
134
135 static ULONG WINAPI ISF_NetworkPlaces_fnAddRef (IShellFolder2 * iface)
136 {
137 IGenericSFImpl *This = (IGenericSFImpl *)iface;
138 ULONG refCount = InterlockedIncrement(&This->ref);
139
140 TRACE ("(%p)->(count=%u)\n", This, refCount - 1);
141
142 return refCount;
143 }
144
145 static ULONG WINAPI ISF_NetworkPlaces_fnRelease (IShellFolder2 * iface)
146 {
147 IGenericSFImpl *This = (IGenericSFImpl *)iface;
148 ULONG refCount = InterlockedDecrement(&This->ref);
149
150 TRACE ("(%p)->(count=%u)\n", This, refCount + 1);
151
152 if (!refCount) {
153 TRACE ("-- destroying IShellFolder(%p)\n", This);
154 SHFree (This->pidlRoot);
155 HeapFree (GetProcessHeap(), 0, This);
156 }
157 return refCount;
158 }
159
160 /**************************************************************************
161 * ISF_NetworkPlaces_fnParseDisplayName
162 */
163 static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * iface,
164 HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName,
165 DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
166 {
167 IGenericSFImpl *This = (IGenericSFImpl *)iface;
168
169 HRESULT hr = E_UNEXPECTED;
170
171 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", This,
172 hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName),
173 pchEaten, ppidl, pdwAttributes);
174
175 *ppidl = 0;
176 if (pchEaten)
177 *pchEaten = 0; /* strange but like the original */
178
179 TRACE ("(%p)->(-- ret=0x%08x)\n", This, hr);
180
181 return hr;
182 }
183
184 /**************************************************************************
185 * ISF_NetworkPlaces_fnEnumObjects
186 */
187 static HRESULT WINAPI ISF_NetworkPlaces_fnEnumObjects (IShellFolder2 * iface,
188 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList)
189 {
190 IGenericSFImpl *This = (IGenericSFImpl *)iface;
191
192 TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", This,
193 hwndOwner, dwFlags, ppEnumIDList);
194
195 *ppEnumIDList = NULL; //IEnumIDList_Constructor();
196
197 TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
198 return S_FALSE;
199 // return (*ppEnumIDList) ? S_OK : E_OUTOFMEMORY;
200 }
201
202 /**************************************************************************
203 * ISF_NetworkPlaces_fnBindToObject
204 */
205 static HRESULT WINAPI ISF_NetworkPlaces_fnBindToObject (IShellFolder2 * iface,
206 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
207 {
208 IGenericSFImpl *This = (IGenericSFImpl *)iface;
209
210 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", This,
211 pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
212
213 return SHELL32_BindToChild (This->pidlRoot, NULL, pidl, riid, ppvOut);
214 }
215
216 /**************************************************************************
217 * ISF_NetworkPlaces_fnBindToStorage
218 */
219 static HRESULT WINAPI ISF_NetworkPlaces_fnBindToStorage (IShellFolder2 * iface,
220 LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
221 {
222 IGenericSFImpl *This = (IGenericSFImpl *)iface;
223
224 FIXME ("(%p)->(pidl=%p,%p,%s,%p) stub\n", This,
225 pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
226
227 *ppvOut = NULL;
228 return E_NOTIMPL;
229 }
230
231 /**************************************************************************
232 * ISF_NetworkPlaces_fnCompareIDs
233 */
234
235 static HRESULT WINAPI ISF_NetworkPlaces_fnCompareIDs (IShellFolder2 * iface,
236 LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
237 {
238 IGenericSFImpl *This = (IGenericSFImpl *)iface;
239 int nReturn;
240
241 TRACE ("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
242 nReturn = SHELL32_CompareIDs (_IShellFolder_ (This), lParam, pidl1, pidl2);
243 TRACE ("-- %i\n", nReturn);
244 return nReturn;
245 }
246
247 /**************************************************************************
248 * ISF_NetworkPlaces_fnCreateViewObject
249 */
250 static HRESULT WINAPI ISF_NetworkPlaces_fnCreateViewObject (IShellFolder2 * iface,
251 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
252 {
253 IGenericSFImpl *This = (IGenericSFImpl *)iface;
254 LPSHELLVIEW pShellView;
255 HRESULT hr = E_INVALIDARG;
256
257 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", This,
258 hwndOwner, shdebugstr_guid (riid), ppvOut);
259
260 if (!ppvOut)
261 return hr;
262
263 *ppvOut = NULL;
264
265 if (IsEqualIID (riid, &IID_IDropTarget))
266 {
267 WARN ("IDropTarget not implemented\n");
268 hr = E_NOTIMPL;
269 }
270 else if (IsEqualIID (riid, &IID_IContextMenu))
271 {
272 WARN ("IContextMenu not implemented\n");
273 hr = E_NOTIMPL;
274 }
275 else if (IsEqualIID (riid, &IID_IShellView))
276 {
277 pShellView = IShellView_Constructor ((IShellFolder *) iface);
278 if (pShellView)
279 {
280 hr = IShellView_QueryInterface (pShellView, riid, ppvOut);
281 IShellView_Release (pShellView);
282 }
283 }
284 TRACE ("-- (%p)->(interface=%p)\n", This, ppvOut);
285 return hr;
286 }
287
288 /**************************************************************************
289 * ISF_NetworkPlaces_fnGetAttributesOf
290 */
291 static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface,
292 UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
293 {
294 IGenericSFImpl *This = (IGenericSFImpl *)iface;
295 static const DWORD dwNethoodAttributes =
296 SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
297 SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER | SFGAO_CANRENAME | SFGAO_CANDELETE;
298 HRESULT hr = S_OK;
299
300 TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", This,
301 cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
302
303 if (!rgfInOut)
304 return E_INVALIDARG;
305 if (cidl && !apidl)
306 return E_INVALIDARG;
307
308 if (*rgfInOut == 0)
309 *rgfInOut = ~0;
310
311 if(cidl == 0) {
312 *rgfInOut = dwNethoodAttributes;
313 }
314 else
315 {
316 while (cidl > 0 && *apidl)
317 {
318 pdump (*apidl);
319 SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
320 apidl++;
321 cidl--;
322 }
323 }
324
325 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
326 *rgfInOut &= ~SFGAO_VALIDATE;
327
328 TRACE ("-- result=0x%08x\n", *rgfInOut);
329 return hr;
330 }
331
332 /**************************************************************************
333 * ISF_NetworkPlaces_fnGetUIObjectOf
334 *
335 * PARAMETERS
336 * hwndOwner [in] Parent window for any output
337 * cidl [in] array size
338 * apidl [in] simple pidl array
339 * riid [in] Requested Interface
340 * prgfInOut [ ] reserved
341 * ppvObject [out] Resulting Interface
342 *
343 */
344 static HRESULT WINAPI ISF_NetworkPlaces_fnGetUIObjectOf (IShellFolder2 * iface,
345 HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid,
346 UINT * prgfInOut, LPVOID * ppvOut)
347 {
348 IGenericSFImpl *This = (IGenericSFImpl *)iface;
349
350 LPITEMIDLIST pidl;
351 IUnknown *pObj = NULL;
352 HRESULT hr = E_INVALIDARG;
353
354 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", This,
355 hwndOwner, cidl, apidl, shdebugstr_guid (riid), prgfInOut, ppvOut);
356
357 if (!ppvOut)
358 return hr;
359
360 *ppvOut = NULL;
361
362 if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1))
363 {
364 hr = CDefFolderMenu_Create2(This->pidlRoot, hwndOwner, cidl, apidl, (IShellFolder*)iface, NULL, 0, NULL, (IContextMenu**)&pObj);
365 }
366 else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1))
367 {
368 pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, apidl, cidl);
369 hr = S_OK;
370 }
371 else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1))
372 {
373 pidl = ILCombine (This->pidlRoot, apidl[0]);
374 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
375 SHFree (pidl);
376 hr = S_OK;
377 }
378 else if (IsEqualIID (riid, &IID_IExtractIconW) && (cidl == 1))
379 {
380 pidl = ILCombine (This->pidlRoot, apidl[0]);
381 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl);
382 SHFree (pidl);
383 hr = S_OK;
384 }
385 else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
386 {
387 hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
388 }
389 else
390 hr = E_NOINTERFACE;
391
392 if (SUCCEEDED(hr) && !pObj)
393 hr = E_OUTOFMEMORY;
394
395 *ppvOut = pObj;
396 TRACE ("(%p)->hr=0x%08x\n", This, hr);
397 return hr;
398 }
399
400 /**************************************************************************
401 * ISF_NetworkPlaces_fnGetDisplayNameOf
402 *
403 */
404 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDisplayNameOf (IShellFolder2 * iface,
405 LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
406 {
407 IGenericSFImpl *This = (IGenericSFImpl *)iface;
408
409 FIXME ("(%p)->(pidl=%p,0x%08x,%p)\n", This, pidl, dwFlags, strRet);
410 pdump (pidl);
411
412 if (!strRet)
413 return E_INVALIDARG;
414
415 return E_NOTIMPL;
416 }
417
418 /**************************************************************************
419 * ISF_NetworkPlaces_fnSetNameOf
420 * Changes the name of a file object or subfolder, possibly changing its item
421 * identifier in the process.
422 *
423 * PARAMETERS
424 * hwndOwner [in] Owner window for output
425 * pidl [in] simple pidl of item to change
426 * lpszName [in] the items new display name
427 * dwFlags [in] SHGNO formatting flags
428 * ppidlOut [out] simple pidl returned
429 */
430 static HRESULT WINAPI ISF_NetworkPlaces_fnSetNameOf (IShellFolder2 * iface,
431 HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */
432 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut)
433 {
434 IGenericSFImpl *This = (IGenericSFImpl *)iface;
435 FIXME ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This,
436 hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
437 return E_FAIL;
438 }
439
440 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDefaultSearchGUID (
441 IShellFolder2 * iface, GUID * pguid)
442 {
443 IGenericSFImpl *This = (IGenericSFImpl *)iface;
444 FIXME ("(%p)\n", This);
445 return E_NOTIMPL;
446 }
447
448 static HRESULT WINAPI ISF_NetworkPlaces_fnEnumSearches (IShellFolder2 * iface,
449 IEnumExtraSearch ** ppenum)
450 {
451 IGenericSFImpl *This = (IGenericSFImpl *)iface;
452 FIXME ("(%p)\n", This);
453 return E_NOTIMPL;
454 }
455
456 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDefaultColumn (IShellFolder2 * iface,
457 DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
458 {
459 IGenericSFImpl *This = (IGenericSFImpl *)iface;
460
461 TRACE ("(%p)\n", This);
462
463 if (pSort)
464 *pSort = 0;
465 if (pDisplay)
466 *pDisplay = 0;
467
468 return S_OK;
469 }
470
471 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDefaultColumnState (
472 IShellFolder2 * iface, UINT iColumn, DWORD * pcsFlags)
473 {
474 IGenericSFImpl *This = (IGenericSFImpl *)iface;
475
476 TRACE ("(%p)\n", This);
477
478 if (!pcsFlags || iColumn >= NETWORKPLACESSHELLVIEWCOLUMNS)
479 return E_INVALIDARG;
480 *pcsFlags = NetworkPlacesSFHeader[iColumn].pcsFlags;
481 return S_OK;
482 }
483
484 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDetailsEx (IShellFolder2 * iface,
485 LPCITEMIDLIST pidl, const SHCOLUMNID * pscid, VARIANT * pv)
486 {
487 IGenericSFImpl *This = (IGenericSFImpl *)iface;
488 FIXME ("(%p)\n", This);
489 return E_NOTIMPL;
490 }
491
492 static HRESULT WINAPI ISF_NetworkPlaces_fnGetDetailsOf (IShellFolder2 * iface,
493 LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS * psd)
494 {
495 IGenericSFImpl *This = (IGenericSFImpl *)iface;
496 WCHAR buffer[MAX_PATH] = {0};
497 HRESULT hr = E_FAIL;
498
499 if (iColumn >= NETWORKPLACESSHELLVIEWCOLUMNS)
500 return E_FAIL;
501
502 psd->fmt = NetworkPlacesSFHeader[iColumn].fmt;
503 psd->cxChar = NetworkPlacesSFHeader[iColumn].cxChar;
504 if (pidl == NULL)
505 {
506 psd->str.uType = STRRET_WSTR;
507 if (LoadStringW(shell32_hInstance, NetworkPlacesSFHeader[iColumn].colnameid, buffer, MAX_PATH))
508 hr = SHStrDupW(buffer, &psd->str.u.pOleStr);
509
510 return hr;
511 }
512
513 if (iColumn == COLUMN_NAME)
514 return IShellFolder2_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL, &psd->str);
515
516 FIXME ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
517
518 return E_NOTIMPL;
519 }
520
521 static HRESULT WINAPI ISF_NetworkPlaces_fnMapColumnToSCID (IShellFolder2 * iface,
522 UINT column, SHCOLUMNID * pscid)
523 {
524 IGenericSFImpl *This = (IGenericSFImpl *)iface;
525
526 FIXME ("(%p)\n", This);
527
528 return E_NOTIMPL;
529 }
530
531 static const IShellFolder2Vtbl vt_ShellFolder2 = {
532 ISF_NetworkPlaces_fnQueryInterface,
533 ISF_NetworkPlaces_fnAddRef,
534 ISF_NetworkPlaces_fnRelease,
535 ISF_NetworkPlaces_fnParseDisplayName,
536 ISF_NetworkPlaces_fnEnumObjects,
537 ISF_NetworkPlaces_fnBindToObject,
538 ISF_NetworkPlaces_fnBindToStorage,
539 ISF_NetworkPlaces_fnCompareIDs,
540 ISF_NetworkPlaces_fnCreateViewObject,
541 ISF_NetworkPlaces_fnGetAttributesOf,
542 ISF_NetworkPlaces_fnGetUIObjectOf,
543 ISF_NetworkPlaces_fnGetDisplayNameOf,
544 ISF_NetworkPlaces_fnSetNameOf,
545 /* ShellFolder2 */
546 ISF_NetworkPlaces_fnGetDefaultSearchGUID,
547 ISF_NetworkPlaces_fnEnumSearches,
548 ISF_NetworkPlaces_fnGetDefaultColumn,
549 ISF_NetworkPlaces_fnGetDefaultColumnState,
550 ISF_NetworkPlaces_fnGetDetailsEx,
551 ISF_NetworkPlaces_fnGetDetailsOf,
552 ISF_NetworkPlaces_fnMapColumnToSCID
553 };
554
555 /************************************************************************
556 * INPFldr_PersistFolder2_QueryInterface
557 */
558 static HRESULT WINAPI INPFldr_PersistFolder2_QueryInterface (IPersistFolder2 * iface,
559 REFIID iid, LPVOID * ppvObj)
560 {
561 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
562
563 TRACE ("(%p)\n", This);
564
565 return IUnknown_QueryInterface (_IUnknown_ (This), iid, ppvObj);
566 }
567
568 /************************************************************************
569 * INPFldr_PersistFolder2_AddRef
570 */
571 static ULONG WINAPI INPFldr_PersistFolder2_AddRef (IPersistFolder2 * iface)
572 {
573 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
574
575 TRACE ("(%p)->(count=%u)\n", This, This->ref);
576
577 return IUnknown_AddRef (_IUnknown_ (This));
578 }
579
580 /************************************************************************
581 * ISFPersistFolder_Release
582 */
583 static ULONG WINAPI INPFldr_PersistFolder2_Release (IPersistFolder2 * iface)
584 {
585 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
586
587 TRACE ("(%p)->(count=%u)\n", This, This->ref);
588
589 return IUnknown_Release (_IUnknown_ (This));
590 }
591
592 /************************************************************************
593 * INPFldr_PersistFolder2_GetClassID
594 */
595 static HRESULT WINAPI INPFldr_PersistFolder2_GetClassID (
596 IPersistFolder2 * iface, CLSID * lpClassId)
597 {
598 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
599
600 TRACE ("(%p)\n", This);
601
602 if (!lpClassId)
603 return E_POINTER;
604
605 *lpClassId = CLSID_NetworkPlaces;
606
607 return S_OK;
608 }
609
610 /************************************************************************
611 * INPFldr_PersistFolder2_Initialize
612 *
613 * NOTES: it makes no sense to change the pidl
614 */
615 static HRESULT WINAPI INPFldr_PersistFolder2_Initialize (
616 IPersistFolder2 * iface, LPCITEMIDLIST pidl)
617 {
618 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
619
620 TRACE ("(%p)->(%p)\n", This, pidl);
621
622 return E_NOTIMPL;
623 }
624
625 /**************************************************************************
626 * IPersistFolder2_fnGetCurFolder
627 */
628 static HRESULT WINAPI INPFldr_PersistFolder2_GetCurFolder (
629 IPersistFolder2 * iface, LPITEMIDLIST * pidl)
630 {
631 _ICOM_THIS_From_IPersistFolder2 (IGenericSFImpl, iface);
632
633 TRACE ("(%p)->(%p)\n", This, pidl);
634
635 if (!pidl)
636 return E_POINTER;
637
638 *pidl = ILClone (This->pidlRoot);
639
640 return S_OK;
641 }
642
643 static const IPersistFolder2Vtbl vt_NP_PersistFolder2 =
644 {
645 INPFldr_PersistFolder2_QueryInterface,
646 INPFldr_PersistFolder2_AddRef,
647 INPFldr_PersistFolder2_Release,
648 INPFldr_PersistFolder2_GetClassID,
649 INPFldr_PersistFolder2_Initialize,
650 INPFldr_PersistFolder2_GetCurFolder
651 };