source: trunk/src/shell32/shlfolder.cpp@ 2016

Last change on this file since 2016 was 1695, checked in by phaller, 26 years ago

Add: updated to WINE19991108

File size: 52.1 KB
Line 
1/* $Id: shlfolder.cpp,v 1.4 1999-11-10 22:13:09 phaller Exp $ */
2/*
3 * Shell Folder stuff
4 *
5 * Copyright 1997 Marcus Meissner
6 * Copyright 1998, 1999 Juergen Schmied
7 *
8 * IShellFolder with IDropTarget, IPersistFolder
9 *
10 */
11
12#include <stdlib.h>
13#include <string.h>
14#include <odin.h>
15
16#define ICOM_CINTERFACE 1
17#define CINTERFACE 1
18
19#include "debugtools.h"
20#include "winerror.h"
21
22#include "oleidl.h"
23#include "shlguid.h"
24
25#include "pidl.h"
26#include "wine/obj_base.h"
27#include "wine/obj_dragdrop.h"
28#include "wine/obj_shellfolder.h"
29#include "wine/undocshell.h"
30#include "shell32_main.h"
31
32#include <heapstring.h>
33#include <misc.h>
34
35DEFAULT_DEBUG_CHANNEL(shell)
36
37#define MEM_DEBUG 1
38
39/***************************************************************************
40 * GetNextElement (internal function)
41 *
42 * gets a part of a string till the first backslash
43 *
44 * PARAMETERS
45 * pszNext [IN] string to get the element from
46 * pszOut [IN] pointer to buffer whitch receives string
47 * dwOut [IN] length of pszOut
48 *
49 * RETURNS
50 * LPSTR pointer to first, not yet parsed char
51 */
52
53static LPCWSTR GetNextElementW(LPCWSTR pszNext,LPWSTR pszOut,DWORD dwOut)
54{ LPCWSTR pszTail = pszNext;
55 DWORD dwCopy;
56 TRACE("(%s %p 0x%08lx)\n",debugstr_w(pszNext),pszOut,dwOut);
57
58 *pszOut=0x0000;
59
60 if(!pszNext || !*pszNext)
61 return NULL;
62
63 while(*pszTail && (*pszTail != (WCHAR)'\\'))
64 pszTail++;
65
66 dwCopy = (WCHAR*)pszTail - (WCHAR*)pszNext + 1;
67 lstrcpynW(pszOut, pszNext, (dwOut<dwCopy)? dwOut : dwCopy);
68
69 if(*pszTail)
70 pszTail++;
71 else
72 pszTail = NULL;
73
74 TRACE("--(%s %s 0x%08lx %p)\n",debugstr_w(pszNext),debugstr_w(pszOut),dwOut,pszTail);
75 return pszTail;
76}
77
78static HRESULT SHELL32_ParseNextElement(
79 HWND hwndOwner,
80 IShellFolder2 * psf,
81 LPITEMIDLIST * pidlInOut,
82 LPOLESTR szNext,
83 DWORD *pEaten,
84 DWORD *pdwAttributes)
85{
86 HRESULT hr = E_OUTOFMEMORY;
87 LPITEMIDLIST pidlOut, pidlTemp = NULL;
88 IShellFolder *psfChild;
89
90 TRACE("(%p %p %s)\n",psf, pidlInOut? *pidlInOut: NULL, debugstr_w(szNext));
91
92
93 /* get the shellfolder for the child pidl and let it analyse further */
94 hr = IShellFolder_BindToObject(psf, *pidlInOut, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
95
96 if (psfChild)
97 {
98 hr = IShellFolder_ParseDisplayName(psfChild, hwndOwner, NULL, szNext, pEaten, &pidlOut, pdwAttributes);
99 IShellFolder_Release(psfChild);
100
101 pidlTemp = ILCombine(*pidlInOut, pidlOut);
102
103 if (pidlOut)
104 ILFree(pidlOut);
105 }
106
107 ILFree(*pidlInOut);
108 *pidlInOut = pidlTemp;
109
110 TRACE("-- pidl=%p ret=0x%08lx\n", pidlInOut? *pidlInOut: NULL, hr);
111 return hr;
112}
113
114/***********************************************************************
115 * SHELL32_CoCreateInitSF
116 *
117 * creates a initialized shell folder
118 */
119static HRESULT SHELL32_CoCreateInitSF (
120 LPITEMIDLIST pidlRoot,
121 LPITEMIDLIST pidlChild,
122 REFCLSID clsid,
123 REFIID iid,
124 LPVOID * ppvOut)
125{
126 HRESULT hr;
127 LPITEMIDLIST absPidl;
128 IShellFolder2 *pShellFolder;
129 IPersistFolder *pPersistFolder;
130
131 TRACE("%p %p\n", pidlRoot, pidlChild);
132
133 *ppvOut = NULL;
134
135 /* we have to ask first for IPersistFolder, some special folders are expecting this */
136 hr = SHCoCreateInstance(NULL, clsid, NULL, &IID_IPersistFolder, (LPVOID*)&pPersistFolder);
137 if (SUCCEEDED(hr))
138 {
139 hr = IPersistFolder_QueryInterface(pPersistFolder, iid, (LPVOID*)&pShellFolder);
140 if (SUCCEEDED(hr))
141 {
142 absPidl = ILCombine (pidlRoot, pidlChild);
143 hr = IPersistFolder_Initialize(pPersistFolder, absPidl);
144 IPersistFolder_Release(pPersistFolder);
145 SHFree(absPidl);
146 *ppvOut = pShellFolder;
147 }
148 }
149
150 TRACE("-- ret=0x%08lx\n", hr);
151 return hr;
152}
153
154static HRESULT SHELL32_GetDisplayNameOfChild(
155 IShellFolder2 * psf,
156 LPCITEMIDLIST pidl,
157 DWORD dwFlags,
158 LPSTR szOut,
159 DWORD dwOutLen)
160{
161 LPITEMIDLIST pidlFirst, pidlNext;
162 IShellFolder2 * psfChild;
163 HRESULT hr = E_OUTOFMEMORY;
164 STRRET strTemp;
165
166 TRACE("(%p)->(pidl=%p 0x%08lx %p 0x%08lx)\n",psf,pidl,dwFlags,szOut, dwOutLen);
167 pdump(pidl);
168
169 if ((pidlFirst = ILCloneFirst(pidl)))
170 {
171 hr = IShellFolder_BindToObject(psf, pidlFirst, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
172 if (SUCCEEDED(hr))
173 {
174 pidlNext = ILGetNext(pidl);
175
176 hr = IShellFolder_GetDisplayNameOf(psfChild, pidlNext, dwFlags | SHGDN_INFOLDER, &strTemp);
177 if (SUCCEEDED(hr))
178 {
179 hr = StrRetToStrNA(szOut, dwOutLen, &strTemp, pidlNext);
180 }
181
182 IShellFolder_Release(psfChild);
183 }
184 ILFree(pidlFirst);
185 }
186
187 TRACE("-- ret=0x%08lx %s\n", hr, szOut);
188
189 return hr;
190}
191
192/***********************************************************************
193* IShellFolder implementation
194*/
195
196typedef struct
197{
198 ICOM_VTABLE(IShellFolder2)* lpvtbl;
199 DWORD ref;
200
201 ICOM_VTABLE(IPersistFolder)* lpvtblPersistFolder;
202 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget;
203
204 CLSID* pclsid;
205
206 LPSTR sMyPath;
207 LPITEMIDLIST absPidl; /* complete pidl */
208
209 UINT cfShellIDList; /* clipboardformat for IDropTarget */
210 BOOL fAcceptFmt; /* flag for pending Drop */
211} IGenericSFImpl;
212
213extern struct ICOM_VTABLE(IShellFolder2) sfvt;
214extern struct ICOM_VTABLE(IPersistFolder) psfvt;
215extern struct ICOM_VTABLE(IDropTarget) dt2vt;
216
217static IShellFolder * ISF_MyComputer_Constructor(void);
218
219#define _IPersistFolder_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder)))
220#define _ICOM_THIS_From_IPersistFolder(class, name) class* This = (class*)(((char*)name)-_IPersistFolder_Offset);
221
222#define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget)))
223#define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset);
224
225/**************************************************************************
226* registers clipboardformat once
227*/
228static void SF_RegisterClipFmt (IShellFolder2 * iface)
229{
230 ICOM_THIS(IGenericSFImpl, iface);
231
232 TRACE("(%p)\n", This);
233
234 if (!This->cfShellIDList)
235 {
236 This->cfShellIDList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST);
237 }
238}
239
240/**************************************************************************
241* IShellFolder_Constructor
242*
243*/
244
245static IShellFolder * IShellFolder_Constructor(
246 IShellFolder * psf,
247 LPITEMIDLIST pidl)
248{
249 IGenericSFImpl * sf;
250 IGenericSFImpl * sfParent = (IGenericSFImpl*) psf;
251 DWORD dwSize=0;
252
253 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));
254 sf->ref=1;
255
256 sf->lpvtbl=&sfvt;
257 sf->lpvtblPersistFolder=&psfvt;
258 sf->lpvtblDropTarget=&dt2vt;
259 sf->pclsid = (CLSID*)&CLSID_SFFile;
260 sf->cfShellIDList=0;
261 sf->fAcceptFmt=FALSE;
262
263 TRACE("(%p)->(parent=%p, pidl=%p)\n",sf,sfParent, pidl);
264 pdump(pidl);
265
266 if(pidl) /* do we have a pidl? */
267 {
268 int len;
269
270 sf->absPidl = ILCombine(sfParent->absPidl, pidl); /* build a absolute pidl */
271
272 if (!_ILIsSpecialFolder(pidl)) /* only file system paths */
273 {
274 if(sfParent->sMyPath) /* get the size of the parents path */
275 {
276 dwSize += strlen(sfParent->sMyPath) ;
277 TRACE("-- (%p)->(parent's path=%s)\n",sf, debugstr_a(sfParent->sMyPath));
278 }
279
280 dwSize += _ILSimpleGetText(pidl,NULL,0); /* add the size of our name*/
281 sf->sMyPath = (char*)SHAlloc(dwSize + 2); /* '\0' and backslash */
282
283 if(!sf->sMyPath) return NULL;
284 *(sf->sMyPath)=0x00;
285
286 if(sfParent->sMyPath) /* if the parent has a path, get it*/
287 {
288 strcpy(sf->sMyPath, sfParent->sMyPath);
289 PathAddBackslashA (sf->sMyPath);
290 }
291
292 len = strlen(sf->sMyPath);
293 _ILSimpleGetText(pidl, sf->sMyPath + len, dwSize - len + 1);
294 }
295
296 TRACE("-- (%p)->(my pidl=%p, my path=%s)\n",sf, sf->absPidl,debugstr_a(sf->sMyPath));
297
298 pdump (sf->absPidl);
299 }
300
301 shell32_ObjCount++;
302 return (IShellFolder *)sf;
303}
304/**************************************************************************
305 * IShellFolder_fnQueryInterface
306 *
307 * PARAMETERS
308 * REFIID riid [in ] Requested InterfaceID
309 * LPVOID* ppvObject [out] Interface* to hold the result
310 */
311static HRESULT WINAPI IShellFolder_fnQueryInterface(
312 IShellFolder2 * iface,
313 REFIID riid,
314 LPVOID *ppvObj)
315{
316 ICOM_THIS(IGenericSFImpl, iface);
317
318 char xriid[50];
319 WINE_StringFromCLSID((LPCLSID)riid,xriid);
320 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
321
322 *ppvObj = NULL;
323
324 if(IsEqualIID(riid, &IID_IUnknown))
325 { *ppvObj = This;
326 }
327 else if(IsEqualIID(riid, &IID_IShellFolder))
328 {
329 *ppvObj = (IShellFolder*)This;
330 }
331 else if(IsEqualIID(riid, &IID_IShellFolder2))
332 {
333 *ppvObj = (IShellFolder2*)This;
334 }
335 else if(IsEqualIID(riid, &IID_IPersist))
336 {
337 *ppvObj = (IPersistFolder*)&(This->lpvtblPersistFolder);
338 }
339 else if(IsEqualIID(riid, &IID_IPersistFolder))
340 {
341 *ppvObj = (IPersistFolder*)&(This->lpvtblPersistFolder);
342 }
343 else if(IsEqualIID(riid, &IID_IDropTarget))
344 {
345 *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget);
346 SF_RegisterClipFmt((IShellFolder2*)This);
347 }
348
349 if(*ppvObj)
350 {
351 IUnknown_AddRef((IUnknown*)(*ppvObj));
352 TRACE("-- Interface = %p\n", *ppvObj);
353 return S_OK;
354 }
355 TRACE("-- Interface: E_NOINTERFACE\n");
356 return E_NOINTERFACE;
357}
358
359/**************************************************************************
360* IShellFolder_AddRef
361*/
362
363static ULONG WINAPI IShellFolder_fnAddRef(IShellFolder2 * iface)
364{
365 ICOM_THIS(IGenericSFImpl, iface);
366
367#ifdef MEM_DEBUG
368 TRACE("called from: 0x%08x\n", *( ((UINT*)&iface)-1 ));
369#endif
370 TRACE("(%p)->(count=%lu)\n",This,This->ref);
371
372 shell32_ObjCount++;
373 return ++(This->ref);
374}
375
376/**************************************************************************
377 * IShellFolder_fnRelease
378 */
379static ULONG WINAPI IShellFolder_fnRelease(IShellFolder2 * iface)
380{
381 ICOM_THIS(IGenericSFImpl, iface);
382
383#ifdef MEM_DEBUG
384 TRACE("called from: 0x%08x\n", *( ((UINT*)&iface)-1 ));
385#endif
386 TRACE("(%p)->(count=%lu)\n",This,This->ref);
387
388 shell32_ObjCount--;
389 if (!--(This->ref))
390 { TRACE("-- destroying IShellFolder(%p)\n",This);
391
392 if (pdesktopfolder == (IShellFolder*)iface)
393 { pdesktopfolder=NULL;
394 TRACE("-- destroyed IShellFolder(%p) was Desktopfolder\n",This);
395 }
396 if(This->absPidl)
397 { SHFree(This->absPidl);
398 }
399 if(This->sMyPath)
400 { SHFree(This->sMyPath);
401 }
402
403 HeapFree(GetProcessHeap(),0,This);
404
405 return 0;
406 }
407 return This->ref;
408}
409/**************************************************************************
410* IShellFolder_fnParseDisplayName
411* PARAMETERS
412* HWND hwndOwner, //[in ] Parent window for any message's
413* LPBC pbc, //[in ] reserved
414* LPOLESTR lpszDisplayName,//[in ] "Unicode" displayname.
415* ULONG* pchEaten, //[out] (unicode) characters processed
416* LPITEMIDLIST* ppidl, //[out] complex pidl to item
417* ULONG* pdwAttributes //[out] items attributes
418*
419* NOTES
420* every folder trys to parse only it's own (the leftmost) pidl and creates a
421* subfolder to evaluate the remaining parts
422* now we can parse into namespaces implemented by shell extensions
423*
424* behaviour on win98: lpszDisplayName=NULL -> chrash
425* lpszDisplayName="" -> returns mycoputer-pidl
426*
427* FIXME:
428* pdwAttributes: not set
429* pchEaten: not set like in windows
430*/
431static HRESULT WINAPI IShellFolder_fnParseDisplayName(
432 IShellFolder2 * iface,
433 HWND hwndOwner,
434 LPBC pbcReserved,
435 LPOLESTR lpszDisplayName,
436 DWORD *pchEaten,
437 LPITEMIDLIST *ppidl,
438 DWORD *pdwAttributes)
439{
440 ICOM_THIS(IGenericSFImpl, iface);
441
442 HRESULT hr = E_OUTOFMEMORY;
443 LPCWSTR szNext=NULL;
444 WCHAR szElement[MAX_PATH];
445 CHAR szTempA[MAX_PATH], szPath[MAX_PATH];
446 LPITEMIDLIST pidlTemp=NULL;
447
448 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
449 This,hwndOwner,pbcReserved,lpszDisplayName,
450 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
451
452 if (!lpszDisplayName || !ppidl) return E_INVALIDARG;
453
454 if (pchEaten) *pchEaten = 0; /* strange but like the original */
455
456 if (*lpszDisplayName)
457 {
458 /* get the next element */
459 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH);
460
461 /* build the full pathname to the element */
462 WideCharToLocal(szTempA, szElement, lstrlenW(szElement) + 1);
463 strcpy(szPath, This->sMyPath);
464 PathAddBackslashA(szPath);
465 strcat(szPath, szTempA);
466
467 /* get the pidl */
468 pidlTemp = SHSimpleIDListFromPathA(szPath);
469
470 if (pidlTemp)
471 {
472 /* try to analyse the next element */
473 if (szNext && *szNext)
474 {
475 hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder2*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);
476 }
477 else
478 {
479 hr = S_OK;
480 }
481 }
482 }
483
484 *ppidl = pidlTemp;
485
486 TRACE("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl? *ppidl:0, hr);
487
488 return hr;
489}
490
491/**************************************************************************
492* IShellFolder_fnEnumObjects
493* PARAMETERS
494* HWND hwndOwner, //[in ] Parent Window
495* DWORD grfFlags, //[in ] SHCONTF enumeration mask
496* LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
497*/
498static HRESULT WINAPI IShellFolder_fnEnumObjects(
499 IShellFolder2 * iface,
500 HWND hwndOwner,
501 DWORD dwFlags,
502 LPENUMIDLIST* ppEnumIDList)
503{
504 ICOM_THIS(IGenericSFImpl, iface);
505
506 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);
507
508 *ppEnumIDList = NULL;
509 *ppEnumIDList = IEnumIDList_Constructor (This->sMyPath, dwFlags, EIDL_FILE);
510
511 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);
512
513 if(!*ppEnumIDList) return E_OUTOFMEMORY;
514
515 return S_OK;
516}
517
518/**************************************************************************
519* IShellFolder_fnBindToObject
520* PARAMETERS
521* LPCITEMIDLIST pidl, //[in ] relative pidl to open
522* LPBC pbc, //[in ] reserved
523* REFIID riid, //[in ] Initial Interface
524* LPVOID* ppvObject //[out] Interface*
525*/
526static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl,
527 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
528{
529 ICOM_THIS(IGenericSFImpl, iface);
530 GUID const * iid;
531 char xriid[50];
532 IShellFolder *pShellFolder, *pSubFolder;
533 IPersistFolder *pPersistFolder;
534 LPITEMIDLIST absPidl;
535
536 WINE_StringFromCLSID(riid,xriid);
537
538 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut);
539
540 if(!pidl || !ppvOut) return E_INVALIDARG;
541
542 *ppvOut = NULL;
543
544 if ((iid=_ILGetGUIDPointer(pidl)))
545 {
546 /* we have to create a alien folder */
547 if ( SUCCEEDED(SHCoCreateInstance(NULL, iid, NULL, riid, (LPVOID*)&pShellFolder))
548 && SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&pPersistFolder)))
549 {
550 absPidl = ILCombine (This->absPidl, pidl);
551 IPersistFolder_Initialize(pPersistFolder, absPidl);
552 IPersistFolder_Release(pPersistFolder);
553 SHFree(absPidl);
554 }
555 else
556 {
557 return E_FAIL;
558 }
559 }
560 else
561 {
562 LPITEMIDLIST pidltemp = ILCloneFirst(pidl);
563 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp);
564 ILFree(pidltemp);
565 }
566
567 if (_ILIsPidlSimple(pidl))
568 {
569 *ppvOut = pShellFolder;
570 }
571 else
572 {
573 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID*)&pSubFolder);
574 IShellFolder_Release(pShellFolder);
575 *ppvOut = pSubFolder;
576 }
577
578 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);
579
580 return S_OK;
581}
582
583/**************************************************************************
584* IShellFolder_fnBindToStorage
585* PARAMETERS
586* LPCITEMIDLIST pidl, //[in ] complex pidl to store
587* LPBC pbc, //[in ] reserved
588* REFIID riid, //[in ] Initial storage interface
589* LPVOID* ppvObject //[out] Interface* returned
590*/
591static HRESULT WINAPI IShellFolder_fnBindToStorage(
592 IShellFolder2 * iface,
593 LPCITEMIDLIST pidl,
594 LPBC pbcReserved,
595 REFIID riid,
596 LPVOID *ppvOut)
597{
598 ICOM_THIS(IGenericSFImpl, iface);
599
600 char xriid[50];
601 WINE_StringFromCLSID(riid,xriid);
602
603 FIXME("(%p)->(pidl=%p,%p,\n\tIID:%s,%p) stub\n",This,pidl,pbcReserved,xriid,ppvOut);
604
605 *ppvOut = NULL;
606 return E_NOTIMPL;
607}
608
609/**************************************************************************
610* IShellFolder_fnCompareIDs
611*
612* PARMETERS
613* LPARAM lParam, //[in ] Column?
614* LPCITEMIDLIST pidl1, //[in ] simple pidl
615* LPCITEMIDLIST pidl2) //[in ] simple pidl
616*
617* NOTES
618* Special case - If one of the items is a Path and the other is a File,
619* always make the Path come before the File.
620*
621* NOTES
622* use SCODE_CODE() on the return value to get the result
623*/
624
625static HRESULT WINAPI IShellFolder_fnCompareIDs(
626 IShellFolder2 * iface,
627 LPARAM lParam,
628 LPCITEMIDLIST pidl1,
629 LPCITEMIDLIST pidl2)
630{
631 ICOM_THIS(IGenericSFImpl, iface);
632
633 CHAR szTemp1[MAX_PATH];
634 CHAR szTemp2[MAX_PATH];
635 int nReturn;
636 IShellFolder * psf;
637 HRESULT hr = E_OUTOFMEMORY;
638 LPCITEMIDLIST pidlTemp;
639 PIDLTYPE pt1, pt2;
640
641 TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n",This,lParam,pidl1,pidl2);
642 pdump (pidl1);
643 pdump (pidl2);
644
645 if (!pidl1 && !pidl2)
646 {
647 hr = ResultFromShort(0);
648 }
649 else if (!pidl1)
650 {
651 hr = ResultFromShort(-1);
652 }
653 else if (!pidl2)
654 {
655 hr = ResultFromShort(1);
656 }
657 else
658 {
659 LPPIDLDATA pd1, pd2;
660 pd1 = _ILGetDataPointer(pidl1);
661 pd2 = _ILGetDataPointer(pidl2);
662
663 /* compate the types. sort order is the PT_* constant */
664 pt1 = ( pd1 ? pd1->type: PT_DESKTOP);
665 pt2 = ( pd2 ? pd2->type: PT_DESKTOP);
666
667 if (pt1 != pt2)
668 {
669 hr = ResultFromShort(pt1-pt2);
670 }
671 else /* same type of pidl */
672 {
673 _ILSimpleGetText(pidl1, szTemp1, MAX_PATH);
674 _ILSimpleGetText(pidl2, szTemp2, MAX_PATH);
675 nReturn = strcmp(szTemp1, szTemp2);
676
677 if (nReturn == 0) /* first pidl different ? */
678 {
679 pidl1 = ILGetNext(pidl1);
680
681 if (pidl1 && pidl1->mkid.cb) /* go deeper? */
682 {
683 pidlTemp = ILCloneFirst(pidl1);
684 pidl2 = ILGetNext(pidl2);
685
686 hr = IShellFolder_BindToObject((IShellFolder*)This, pidlTemp, NULL, &IID_IShellFolder, (LPVOID*)&psf);
687 if (SUCCEEDED(hr))
688 {
689 nReturn = IShellFolder_CompareIDs(psf, 0, pidl1, pidl2);
690 IShellFolder_Release(psf);
691 hr = ResultFromShort(nReturn);
692 }
693 ILFree(pidlTemp);
694 }
695 else
696 {
697 hr = ResultFromShort(nReturn); /* two equal simple pidls */
698 }
699 }
700 else
701 {
702 hr = ResultFromShort(nReturn); /* two different simple pidls */
703 }
704 }
705 }
706
707 TRACE("-- res=0x%08lx\n", hr);
708 return hr;
709}
710
711/**************************************************************************
712* IShellFolder_fnCreateViewObject
713*/
714static HRESULT WINAPI IShellFolder_fnCreateViewObject( IShellFolder2 * iface,
715 HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
716{
717 ICOM_THIS(IGenericSFImpl, iface);
718
719 LPSHELLVIEW pShellView;
720 char xriid[50];
721 HRESULT hr = E_INVALIDARG;
722
723 WINE_StringFromCLSID(riid,xriid);
724 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,xriid,ppvOut);
725
726 if(ppvOut)
727 {
728 *ppvOut = NULL;
729
730 if(IsEqualIID(riid, &IID_IDropTarget))
731 {
732 hr = IShellFolder_QueryInterface((IShellFolder*)This, &IID_IDropTarget, ppvOut);
733 }
734 else if(IsEqualIID(riid, &IID_IContextMenu))
735 {
736 FIXME("IContextMenu not implemented\n");
737 hr = E_NOTIMPL;
738 }
739 else if(IsEqualIID(riid, &IID_IShellView))
740 {
741 pShellView = IShellView_Constructor((IShellFolder *) This);
742 if(pShellView)
743 {
744 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
745 IShellView_Release(pShellView);
746 }
747 }
748 }
749 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);
750 return hr;
751}
752
753/**************************************************************************
754* IShellFolder_fnGetAttributesOf
755*
756* PARAMETERS
757* UINT cidl, //[in ] num elements in pidl array
758* LPCITEMIDLIST* apidl, //[in ] simple pidl array
759* ULONG* rgfInOut) //[out] result array
760*
761*/
762static HRESULT WINAPI IShellFolder_fnGetAttributesOf(IShellFolder2 * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut)
763{
764 ICOM_THIS(IGenericSFImpl, iface);
765
766 HRESULT hr = S_OK;
767
768 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut);
769
770 if ( (!cidl) || (!apidl) || (!rgfInOut))
771 return E_INVALIDARG;
772
773 while (cidl > 0 && *apidl)
774 {
775 pdump (*apidl);
776 if (_ILIsFolder( *apidl))
777 {
778 *rgfInOut &= 0xe0000177;
779 goto next;
780 }
781 else if (_ILIsValue( *apidl))
782 {
783 *rgfInOut &= 0x40000177;
784 goto next;
785 }
786 hr = E_INVALIDARG;
787
788next: apidl++;
789 cidl--;
790 }
791
792 TRACE("-- result=0x%08lx\n",*rgfInOut);
793
794 return hr;
795}
796/**************************************************************************
797* IShellFolder_fnGetUIObjectOf
798*
799* PARAMETERS
800* HWND hwndOwner, //[in ] Parent window for any output
801* UINT cidl, //[in ] array size
802* LPCITEMIDLIST* apidl, //[in ] simple pidl array
803* REFIID riid, //[in ] Requested Interface
804* UINT* prgfInOut, //[ ] reserved
805* LPVOID* ppvObject) //[out] Resulting Interface
806*
807* NOTES
808* This function gets asked to return "view objects" for one or more (multiple select)
809* items:
810* The viewobject typically is an COM object with one of the following interfaces:
811* IExtractIcon,IDataObject,IContextMenu
812* In order to support icon positions in the default Listview your DataObject
813* must implement the SetData method (in addition to GetData :) - the shell passes
814* a barely documented "Icon positions" structure to SetData when the drag starts,
815* and GetData's it if the drop is in another explorer window that needs the positions.
816*/
817static HRESULT WINAPI IShellFolder_fnGetUIObjectOf(
818 IShellFolder2 * iface,
819 HWND hwndOwner,
820 UINT cidl,
821 LPCITEMIDLIST * apidl,
822 REFIID riid,
823 UINT * prgfInOut,
824 LPVOID * ppvOut)
825{
826 ICOM_THIS(IGenericSFImpl, iface);
827
828 char xclsid[50];
829 LPITEMIDLIST pidl;
830 IUnknown* pObj = NULL;
831 HRESULT hr = E_INVALIDARG;
832
833 WINE_StringFromCLSID(riid,xclsid);
834
835 TRACE("(%p)->(%u,%u,apidl=%p,\n\tIID:%s,%p,%p)\n",
836 This,hwndOwner,cidl,apidl,xclsid,prgfInOut,ppvOut);
837
838 if (ppvOut)
839 {
840 *ppvOut = NULL;
841
842 if(IsEqualIID(riid, &IID_IContextMenu) && (cidl >= 1))
843 {
844 pObj = (LPUNKNOWN)IContextMenu_Constructor((IShellFolder *)This, This->absPidl, apidl, cidl);
845 hr = S_OK;
846 }
847 else if (IsEqualIID(riid, &IID_IDataObject) &&(cidl >= 1))
848 {
849 pObj = (LPUNKNOWN)IDataObject_Constructor (hwndOwner, This->absPidl, apidl, cidl);
850 hr = S_OK;
851 }
852 else if (IsEqualIID(riid, &IID_IExtractIconA) && (cidl == 1))
853 {
854 pidl = ILCombine(This->absPidl,apidl[0]);
855 pObj = (LPUNKNOWN)IExtractIconA_Constructor( pidl );
856 SHFree(pidl);
857 hr = S_OK;
858 }
859 else if (IsEqualIID(riid, &IID_IDropTarget) && (cidl >= 1))
860 {
861 hr = IShellFolder_QueryInterface((IShellFolder*)This, &IID_IDropTarget, (LPVOID*)&pObj);
862 }
863 else
864 {
865 hr = E_NOINTERFACE;
866 }
867
868 if(!pObj)
869 hr = E_OUTOFMEMORY;
870
871 *ppvOut = pObj;
872 }
873 TRACE("(%p)->hr=0x%08lx\n",This, hr);
874 return hr;
875}
876
877/**************************************************************************
878* IShellFolder_fnGetDisplayNameOf
879* Retrieves the display name for the specified file object or subfolder
880*
881* PARAMETERS
882* LPCITEMIDLIST pidl, //[in ] complex pidl to item
883* DWORD dwFlags, //[in ] SHGNO formatting flags
884* LPSTRRET lpName) //[out] Returned display name
885*
886* FIXME
887* if the name is in the pidl the ret value should be a STRRET_OFFSET
888*/
889#define GET_SHGDN_FOR(dwFlags) ((DWORD)dwFlags & (DWORD)0x0000FF00)
890#define GET_SHGDN_RELATION(dwFlags) ((DWORD)dwFlags & (DWORD)0x000000FF)
891
892static HRESULT WINAPI IShellFolder_fnGetDisplayNameOf(
893 IShellFolder2 * iface,
894 LPCITEMIDLIST pidl,
895 DWORD dwFlags,
896 LPSTRRET strRet)
897{
898 ICOM_THIS(IGenericSFImpl, iface);
899
900 CHAR szPath[MAX_PATH]= "";
901 int len = 0;
902 BOOL bSimplePidl;
903
904 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);
905 pdump(pidl);
906
907 if(!pidl || !strRet) return E_INVALIDARG;
908
909 bSimplePidl = _ILIsPidlSimple(pidl);
910
911 /* take names of special folders only if its only this folder */
912 if (_ILIsSpecialFolder(pidl))
913 {
914 if ( bSimplePidl)
915 {
916 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */
917 }
918 }
919 else
920 {
921 if (!(dwFlags & SHGDN_INFOLDER) && (dwFlags & SHGDN_FORPARSING) && This->sMyPath)
922 {
923 strcpy (szPath, This->sMyPath); /* get path to root*/
924 PathAddBackslashA(szPath);
925 len = strlen(szPath);
926 }
927 _ILSimpleGetText(pidl, szPath + len, MAX_PATH - len); /* append my own path */
928 }
929
930 if ( (dwFlags & SHGDN_FORPARSING) && !bSimplePidl) /* go deeper if needed */
931 {
932 PathAddBackslashA(szPath);
933 len = strlen(szPath);
934
935 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder2*)This, pidl, dwFlags, szPath + len, MAX_PATH - len)))
936 return E_OUTOFMEMORY;
937 }
938 strRet->uType = STRRET_CSTRA;
939 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);
940
941 TRACE("-- (%p)->(%s)\n", This, szPath);
942 return S_OK;
943}
944
945/**************************************************************************
946* IShellFolder_fnSetNameOf
947* Changes the name of a file object or subfolder, possibly changing its item
948* identifier in the process.
949*
950* PARAMETERS
951* HWND hwndOwner, //[in ] Owner window for output
952* LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
953* LPCOLESTR lpszName, //[in ] the items new display name
954* DWORD dwFlags, //[in ] SHGNO formatting flags
955* LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
956*/
957static HRESULT WINAPI IShellFolder_fnSetNameOf(
958 IShellFolder2 * iface,
959 HWND hwndOwner,
960 LPCITEMIDLIST pidl, /*simple pidl*/
961 LPCOLESTR lpName,
962 DWORD dw,
963 LPITEMIDLIST *pPidlOut)
964{
965 ICOM_THIS(IGenericSFImpl, iface);
966
967 FIXME("(%p)->(%u,pidl=%p,%s,%lu,%p),stub!\n",
968 This,hwndOwner,pidl,debugstr_w(lpName),dw,pPidlOut);
969
970 return E_NOTIMPL;
971}
972
973/**************************************************************************
974* IShellFolder_fnGetFolderPath
975*/
976static HRESULT WINAPI IShellFolder_fnGetFolderPath(IShellFolder2 * iface, LPSTR lpszOut, DWORD dwOutSize)
977{
978 ICOM_THIS(IGenericSFImpl, iface);
979
980 TRACE("(%p)->(%p %lu)\n",This, lpszOut, dwOutSize);
981
982 if (!lpszOut) return FALSE;
983
984 *lpszOut=0;
985
986 if (! This->sMyPath) return FALSE;
987
988 lstrcpynA(lpszOut, This->sMyPath, dwOutSize);
989
990 TRACE("-- (%p)->(return=%s)\n",This, lpszOut);
991 return TRUE;
992}
993
994static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID(
995 IShellFolder2 * iface,
996 GUID *pguid)
997{
998 ICOM_THIS(IGenericSFImpl, iface);
999 TRACE("(%p)\n",This);
1000 return E_NOTIMPL;
1001}
1002static HRESULT WINAPI IShellFolder_fnEnumSearches(
1003 IShellFolder2 * iface,
1004 IEnumExtraSearch **ppenum)
1005{
1006 ICOM_THIS(IGenericSFImpl, iface);
1007 TRACE("(%p)\n",This);
1008 return E_NOTIMPL;
1009}
1010static HRESULT WINAPI IShellFolder_fnGetDefaultColumn(
1011 IShellFolder2 * iface,
1012 DWORD dwRes,
1013 ULONG *pSort,
1014 ULONG *pDisplay)
1015{
1016 ICOM_THIS(IGenericSFImpl, iface);
1017 TRACE("(%p)\n",This);
1018 return E_NOTIMPL;
1019}
1020static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState(
1021 IShellFolder2 * iface,
1022 UINT iColumn,
1023 DWORD *pcsFlags)
1024{
1025 ICOM_THIS(IGenericSFImpl, iface);
1026 TRACE("(%p)\n",This);
1027 return E_NOTIMPL;
1028}
1029static HRESULT WINAPI IShellFolder_fnGetDetailsEx(
1030 IShellFolder2 * iface,
1031 LPCITEMIDLIST pidl,
1032 const SHCOLUMNID *pscid,
1033 VARIANT *pv)
1034{
1035 ICOM_THIS(IGenericSFImpl, iface);
1036 TRACE("(%p)\n",This);
1037 return E_NOTIMPL;
1038}
1039static HRESULT WINAPI IShellFolder_fnGetDetailsOf(
1040 IShellFolder2 * iface,
1041 LPCITEMIDLIST pidl,
1042 UINT iColumn,
1043 SHELLDETAILS *psd)
1044{
1045 ICOM_THIS(IGenericSFImpl, iface);
1046 TRACE("(%p)\n",This);
1047 return E_NOTIMPL;
1048}
1049static HRESULT WINAPI IShellFolder_fnMapNameToSCID(
1050 IShellFolder2 * iface,
1051 LPCWSTR pwszName,
1052 SHCOLUMNID *pscid)
1053{
1054 ICOM_THIS(IGenericSFImpl, iface);
1055 TRACE("(%p)\n",This);
1056 return E_NOTIMPL;
1057}
1058
1059
1060
1061ICOM_VTABLE(IShellFolder2) sfvt =
1062{
1063 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1064 IShellFolder_fnQueryInterface,
1065 IShellFolder_fnAddRef,
1066 IShellFolder_fnRelease,
1067 IShellFolder_fnParseDisplayName,
1068 IShellFolder_fnEnumObjects,
1069 IShellFolder_fnBindToObject,
1070 IShellFolder_fnBindToStorage,
1071 IShellFolder_fnCompareIDs,
1072 IShellFolder_fnCreateViewObject,
1073 IShellFolder_fnGetAttributesOf,
1074 IShellFolder_fnGetUIObjectOf,
1075 IShellFolder_fnGetDisplayNameOf,
1076 IShellFolder_fnSetNameOf,
1077
1078 /* ShellFolder2 */
1079 IShellFolder_fnGetDefaultSearchGUID,
1080 IShellFolder_fnEnumSearches,
1081 IShellFolder_fnGetDefaultColumn,
1082 IShellFolder_fnGetDefaultColumnState,
1083 IShellFolder_fnGetDetailsEx,
1084 IShellFolder_fnGetDetailsOf,
1085 IShellFolder_fnMapNameToSCID
1086};
1087
1088/***********************************************************************
1089* [Desktopfolder] IShellFolder implementation
1090*/
1091extern struct ICOM_VTABLE(IShellFolder2) sfdvt;
1092
1093/**************************************************************************
1094* ISF_Desktop_Constructor
1095*
1096*/
1097IShellFolder * ISF_Desktop_Constructor()
1098{
1099 IGenericSFImpl * sf;
1100
1101 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));
1102 sf->ref=1;
1103 sf->lpvtbl=&sfdvt;
1104 sf->absPidl=_ILCreateDesktop(); /* my qualified pidl */
1105
1106 TRACE("(%p)\n",sf);
1107
1108 shell32_ObjCount++;
1109 return (IShellFolder *)sf;
1110}
1111
1112/**************************************************************************
1113 * ISF_Desktop_fnQueryInterface
1114 *
1115 * NOTES supports not IPersist/IPersistFolder
1116 */
1117static HRESULT WINAPI ISF_Desktop_fnQueryInterface(
1118 IShellFolder2 * iface,
1119 REFIID riid,
1120 LPVOID *ppvObj)
1121{
1122 ICOM_THIS(IGenericSFImpl, iface);
1123
1124 char xriid[50];
1125 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1126 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1127
1128 *ppvObj = NULL;
1129
1130 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
1131 { *ppvObj = This;
1132 }
1133 else if(IsEqualIID(riid, &IID_IShellFolder)) /*IShellFolder*/
1134 { *ppvObj = (IShellFolder*)This;
1135 }
1136 else if(IsEqualIID(riid, &IID_IShellFolder2)) /*IShellFolder2*/
1137 { *ppvObj = (IShellFolder2*)This;
1138 }
1139
1140 if(*ppvObj)
1141 {
1142 IUnknown_AddRef((IUnknown*)(*ppvObj));
1143 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1144 return S_OK;
1145 }
1146 TRACE("-- Interface: E_NOINTERFACE\n");
1147 return E_NOINTERFACE;
1148}
1149
1150/**************************************************************************
1151* ISF_Desktop_fnParseDisplayName
1152*
1153* NOTES
1154* "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds
1155* to MyComputer
1156*/
1157static HRESULT WINAPI ISF_Desktop_fnParseDisplayName(
1158 IShellFolder2 * iface,
1159 HWND hwndOwner,
1160 LPBC pbcReserved,
1161 LPOLESTR lpszDisplayName,
1162 DWORD *pchEaten,
1163 LPITEMIDLIST *ppidl,
1164 DWORD *pdwAttributes)
1165{
1166 ICOM_THIS(IGenericSFImpl, iface);
1167
1168 LPCWSTR szNext=NULL;
1169 LPITEMIDLIST pidlTemp=NULL;
1170 HRESULT hr=E_OUTOFMEMORY;
1171
1172 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
1173 This,hwndOwner,pbcReserved,lpszDisplayName,
1174 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
1175
1176 *ppidl = 0;
1177 if (pchEaten) *pchEaten = 0; /* strange but like the original */
1178
1179 /* fixme no real parsing implemented */
1180 pidlTemp = _ILCreateMyComputer();
1181 szNext = lpszDisplayName;
1182
1183 if (szNext && *szNext)
1184 {
1185 hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder2*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);
1186 }
1187 else
1188 {
1189 hr = S_OK;
1190 }
1191
1192 *ppidl = pidlTemp;
1193
1194 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr);
1195
1196 return hr;
1197}
1198
1199/**************************************************************************
1200* ISF_Desktop_fnEnumObjects
1201*/
1202static HRESULT WINAPI ISF_Desktop_fnEnumObjects(
1203 IShellFolder2 * iface,
1204 HWND hwndOwner,
1205 DWORD dwFlags,
1206 LPENUMIDLIST* ppEnumIDList)
1207{
1208 ICOM_THIS(IGenericSFImpl, iface);
1209
1210 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);
1211
1212 *ppEnumIDList = NULL;
1213 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK);
1214
1215 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);
1216
1217 if(!*ppEnumIDList) return E_OUTOFMEMORY;
1218
1219 return S_OK;
1220}
1221
1222/**************************************************************************
1223* ISF_Desktop_fnBindToObject
1224*/
1225static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl,
1226 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
1227{
1228 ICOM_THIS(IGenericSFImpl, iface);
1229 GUID const * clsid;
1230 char xriid[50];
1231 IShellFolder *pShellFolder, *pSubFolder;
1232
1233 WINE_StringFromCLSID(riid,xriid);
1234
1235 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut);
1236
1237 *ppvOut = NULL;
1238
1239 if ((clsid=_ILGetGUIDPointer(pidl)))
1240 {
1241 if ( IsEqualIID(clsid, &IID_MyComputer))
1242 {
1243 pShellFolder = ISF_MyComputer_Constructor();
1244 }
1245 else
1246 {
1247 /* shell extension */
1248 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder)))
1249 {
1250 return E_INVALIDARG;
1251 }
1252 }
1253 }
1254 else
1255 {
1256 /* file system folder on the desktop */
1257 LPITEMIDLIST pidltemp = ILCloneFirst(pidl);
1258 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp);
1259 ILFree(pidltemp);
1260 }
1261
1262 if (_ILIsPidlSimple(pidl)) /* no sub folders */
1263 {
1264 *ppvOut = pShellFolder;
1265 }
1266 else /* go deeper */
1267 {
1268 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, riid, (LPVOID*)&pSubFolder);
1269 IShellFolder_Release(pShellFolder);
1270 *ppvOut = pSubFolder;
1271 }
1272
1273 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);
1274
1275 return S_OK;
1276}
1277
1278/**************************************************************************
1279* ISF_Desktop_fnCreateViewObject
1280*/
1281static HRESULT WINAPI ISF_Desktop_fnCreateViewObject( IShellFolder2 * iface,
1282 HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
1283{
1284 ICOM_THIS(IGenericSFImpl, iface);
1285
1286 LPSHELLVIEW pShellView;
1287 char xriid[50];
1288 HRESULT hr = E_INVALIDARG;
1289
1290 WINE_StringFromCLSID(riid,xriid);
1291 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,xriid,ppvOut);
1292
1293 if(ppvOut)
1294 {
1295 *ppvOut = NULL;
1296
1297 if(IsEqualIID(riid, &IID_IDropTarget))
1298 {
1299 FIXME("IDropTarget not implemented\n");
1300 hr = E_NOTIMPL;
1301 }
1302 else if(IsEqualIID(riid, &IID_IContextMenu))
1303 {
1304 FIXME("IContextMenu not implemented\n");
1305 hr = E_NOTIMPL;
1306 }
1307 else if(IsEqualIID(riid, &IID_IShellView))
1308 {
1309 pShellView = IShellView_Constructor((IShellFolder *) This);
1310 if(pShellView)
1311 {
1312 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
1313 IShellView_Release(pShellView);
1314 }
1315 }
1316 }
1317 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);
1318 return hr;
1319}
1320
1321/**************************************************************************
1322* ISF_Desktop_fnGetAttributesOf
1323*/
1324static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf(IShellFolder2 * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut)
1325{
1326 ICOM_THIS(IGenericSFImpl, iface);
1327
1328 GUID const * clsid;
1329 DWORD attributes;
1330 HRESULT hr = S_OK;
1331
1332 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl, *rgfInOut);
1333
1334 if ( (!cidl) || (!apidl) || (!rgfInOut))
1335 return E_INVALIDARG;
1336
1337 while (cidl > 0 && *apidl)
1338 {
1339 pdump (*apidl);
1340
1341 if ((clsid=_ILGetGUIDPointer(*apidl)))
1342 {
1343 if (IsEqualIID(clsid, &IID_MyComputer))
1344 {
1345 *rgfInOut &= 0xb0000154;
1346 goto next;
1347 }
1348 else if (HCR_GetFolderAttributes(clsid, &attributes))
1349 {
1350 *rgfInOut &= attributes;
1351 goto next;
1352 }
1353 else
1354 { /* some shell-extension */
1355 *rgfInOut &= 0xb0000154;
1356 }
1357 }
1358 else if (_ILIsFolder( *apidl))
1359 {
1360 *rgfInOut &= 0xe0000177;
1361 goto next;
1362 }
1363 else if (_ILIsValue( *apidl))
1364 {
1365 *rgfInOut &= 0x40000177;
1366 goto next;
1367 }
1368 hr = E_INVALIDARG;
1369
1370next: apidl++;
1371 cidl--;
1372 }
1373
1374 TRACE("-- result=0x%08lx\n",*rgfInOut);
1375
1376 return hr;
1377}
1378
1379/**************************************************************************
1380* ISF_Desktop_fnGetDisplayNameOf
1381*
1382* NOTES
1383* special case: pidl = null gives desktop-name back
1384*/
1385static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf(
1386 IShellFolder2 * iface,
1387 LPCITEMIDLIST pidl,
1388 DWORD dwFlags,
1389 LPSTRRET strRet)
1390{
1391 ICOM_THIS(IGenericSFImpl, iface);
1392
1393 CHAR szPath[MAX_PATH]= "";
1394
1395 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);
1396 pdump(pidl);
1397
1398 if(!strRet) return E_INVALIDARG;
1399
1400 if(!pidl)
1401 {
1402 HCR_GetClassName(&CLSID_ShellDesktop, szPath, MAX_PATH);
1403 }
1404 else if ( _ILIsPidlSimple(pidl) )
1405 {
1406 _ILSimpleGetText(pidl, szPath, MAX_PATH);
1407 }
1408 else
1409 {
1410 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder2*)This, pidl, dwFlags, szPath, MAX_PATH)))
1411 return E_OUTOFMEMORY;
1412 }
1413 strRet->uType = STRRET_CSTRA;
1414 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);
1415
1416
1417 TRACE("-- (%p)->(%s)\n", This, szPath);
1418 return S_OK;
1419}
1420
1421ICOM_VTABLE(IShellFolder2) sfdvt =
1422{
1423 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1424 ISF_Desktop_fnQueryInterface,
1425 IShellFolder_fnAddRef,
1426 IShellFolder_fnRelease,
1427 ISF_Desktop_fnParseDisplayName,
1428 ISF_Desktop_fnEnumObjects,
1429 ISF_Desktop_fnBindToObject,
1430 IShellFolder_fnBindToStorage,
1431 IShellFolder_fnCompareIDs,
1432 ISF_Desktop_fnCreateViewObject,
1433 ISF_Desktop_fnGetAttributesOf,
1434 IShellFolder_fnGetUIObjectOf,
1435 ISF_Desktop_fnGetDisplayNameOf,
1436 IShellFolder_fnSetNameOf,
1437
1438 /* ShellFolder2 */
1439 IShellFolder_fnGetDefaultSearchGUID,
1440 IShellFolder_fnEnumSearches,
1441 IShellFolder_fnGetDefaultColumn,
1442 IShellFolder_fnGetDefaultColumnState,
1443 IShellFolder_fnGetDetailsEx,
1444 IShellFolder_fnGetDetailsOf,
1445 IShellFolder_fnMapNameToSCID
1446};
1447
1448
1449/***********************************************************************
1450* IShellFolder [MyComputer] implementation
1451*/
1452
1453extern struct ICOM_VTABLE(IShellFolder2) sfmcvt;
1454
1455/**************************************************************************
1456* ISF_MyComputer_Constructor
1457*/
1458static IShellFolder * ISF_MyComputer_Constructor(void)
1459{
1460 IGenericSFImpl * sf;
1461
1462 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));
1463 sf->ref=1;
1464
1465 sf->lpvtbl = &sfmcvt;
1466 sf->lpvtblPersistFolder = &psfvt;
1467 sf->pclsid = (CLSID*)&CLSID_SFMyComp;
1468 sf->absPidl=_ILCreateMyComputer(); /* my qualified pidl */
1469
1470 TRACE("(%p)\n",sf);
1471
1472 shell32_ObjCount++;
1473 return (IShellFolder *)sf;
1474}
1475
1476/**************************************************************************
1477* ISF_MyComputer_fnParseDisplayName
1478*/
1479static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName(
1480 IShellFolder2 * iface,
1481 HWND hwndOwner,
1482 LPBC pbcReserved,
1483 LPOLESTR lpszDisplayName,
1484 DWORD *pchEaten,
1485 LPITEMIDLIST *ppidl,
1486 DWORD *pdwAttributes)
1487{
1488 ICOM_THIS(IGenericSFImpl, iface);
1489
1490 HRESULT hr = E_OUTOFMEMORY;
1491 LPCWSTR szNext=NULL;
1492 WCHAR szElement[MAX_PATH];
1493 CHAR szTempA[MAX_PATH];
1494 LPITEMIDLIST pidlTemp;
1495
1496 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
1497 This,hwndOwner,pbcReserved,lpszDisplayName,
1498 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
1499
1500 *ppidl = 0;
1501 if (pchEaten) *pchEaten = 0; /* strange but like the original */
1502
1503 if (PathIsRootW(lpszDisplayName))
1504 {
1505 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH);
1506 WideCharToLocal(szTempA, szElement, lstrlenW(szElement) + 1);
1507 pidlTemp = _ILCreateDrive(szTempA);
1508
1509 if (szNext && *szNext)
1510 {
1511 hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder2*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);
1512 }
1513 else
1514 {
1515 hr = S_OK;
1516 }
1517 *ppidl = pidlTemp;
1518 }
1519
1520 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr);
1521
1522 return hr;
1523}
1524
1525/**************************************************************************
1526* ISF_MyComputer_fnEnumObjects
1527*/
1528static HRESULT WINAPI ISF_MyComputer_fnEnumObjects(
1529 IShellFolder2 * iface,
1530 HWND hwndOwner,
1531 DWORD dwFlags,
1532 LPENUMIDLIST* ppEnumIDList)
1533{
1534 ICOM_THIS(IGenericSFImpl, iface);
1535
1536 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);
1537
1538 *ppEnumIDList = NULL;
1539 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_MYCOMP);
1540
1541 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);
1542
1543 if(!*ppEnumIDList) return E_OUTOFMEMORY;
1544
1545 return S_OK;
1546}
1547
1548/**************************************************************************
1549* ISF_MyComputer_fnBindToObject
1550*/
1551static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl,
1552 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
1553{
1554 ICOM_THIS(IGenericSFImpl, iface);
1555 GUID const * clsid;
1556 char xriid[50];
1557 IShellFolder *pShellFolder, *pSubFolder;
1558 LPITEMIDLIST pidltemp;
1559
1560 WINE_StringFromCLSID(riid,xriid);
1561
1562 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut);
1563
1564 if(!pidl || !ppvOut) return E_INVALIDARG;
1565
1566 *ppvOut = NULL;
1567
1568 if ((clsid=_ILGetGUIDPointer(pidl)) && !IsEqualIID(clsid, &IID_MyComputer))
1569 {
1570 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder)))
1571 {
1572 return E_FAIL;
1573 }
1574 }
1575 else
1576 {
1577 if (!_ILIsDrive(pidl)) return E_INVALIDARG;
1578
1579 pidltemp = ILCloneFirst(pidl);
1580 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp);
1581 ILFree(pidltemp);
1582 }
1583
1584 if (_ILIsPidlSimple(pidl)) /* no sub folders */
1585 {
1586 *ppvOut = pShellFolder;
1587 }
1588 else /* go deeper */
1589 {
1590 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID*)&pSubFolder);
1591 IShellFolder_Release(pShellFolder);
1592 *ppvOut = pSubFolder;
1593 }
1594
1595 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);
1596
1597 return S_OK;
1598}
1599
1600/**************************************************************************
1601* ISF_MyComputer_fnCreateViewObject
1602*/
1603static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject( IShellFolder2 * iface,
1604 HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
1605{
1606 ICOM_THIS(IGenericSFImpl, iface);
1607
1608 LPSHELLVIEW pShellView;
1609 char xriid[50];
1610 HRESULT hr = E_INVALIDARG;
1611
1612 WINE_StringFromCLSID(riid,xriid);
1613 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,xriid,ppvOut);
1614
1615 if(ppvOut)
1616 {
1617 *ppvOut = NULL;
1618
1619 if(IsEqualIID(riid, &IID_IDropTarget))
1620 {
1621 FIXME("IDropTarget not implemented\n");
1622 hr = E_NOTIMPL;
1623 }
1624 else if(IsEqualIID(riid, &IID_IContextMenu))
1625 {
1626 FIXME("IContextMenu not implemented\n");
1627 hr = E_NOTIMPL;
1628 }
1629 else if(IsEqualIID(riid, &IID_IShellView))
1630 {
1631 pShellView = IShellView_Constructor((IShellFolder *) This);
1632 if(pShellView)
1633 {
1634 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
1635 IShellView_Release(pShellView);
1636 }
1637 }
1638 }
1639 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);
1640 return hr;
1641}
1642
1643/**************************************************************************
1644* ISF_MyComputer_fnGetAttributesOf
1645*/
1646static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf(IShellFolder2 * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut)
1647{
1648 ICOM_THIS(IGenericSFImpl, iface);
1649
1650 GUID const * clsid;
1651 DWORD attributes;
1652 HRESULT hr = S_OK;
1653
1654 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut);
1655
1656 if ( (!cidl) || (!apidl) || (!rgfInOut))
1657 return E_INVALIDARG;
1658
1659 *rgfInOut = 0xffffffff;
1660
1661 while (cidl > 0 && *apidl)
1662 {
1663 pdump (*apidl);
1664
1665 if (_ILIsDrive(*apidl))
1666 {
1667 *rgfInOut &= 0xf0000144;
1668 goto next;
1669 }
1670 else if ((clsid=_ILGetGUIDPointer(*apidl)))
1671 {
1672 if (HCR_GetFolderAttributes(clsid, &attributes))
1673 {
1674 *rgfInOut &= attributes;
1675 goto next;
1676 }
1677 }
1678 hr = E_INVALIDARG;
1679
1680next: apidl++;
1681 cidl--;
1682 }
1683
1684 TRACE("-- result=0x%08lx\n",*rgfInOut);
1685 return hr;
1686}
1687
1688/**************************************************************************
1689* ISF_MyComputer_fnGetDisplayNameOf
1690*
1691* NOTES
1692* The desktopfolder creates only complete paths (SHGDN_FORPARSING).
1693* SHGDN_INFOLDER makes no sense.
1694*/
1695static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf(
1696 IShellFolder2 * iface,
1697 LPCITEMIDLIST pidl,
1698 DWORD dwFlags,
1699 LPSTRRET strRet)
1700{
1701 ICOM_THIS(IGenericSFImpl, iface);
1702
1703 char szPath[MAX_PATH], szDrive[18];
1704 int len = 0;
1705 BOOL bSimplePidl;
1706
1707 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);
1708 pdump(pidl);
1709
1710 if(!strRet) return E_INVALIDARG;
1711
1712 szPath[0]=0x00; szDrive[0]=0x00;
1713
1714
1715 bSimplePidl = _ILIsPidlSimple(pidl);
1716
1717 if (_ILIsSpecialFolder(pidl))
1718 {
1719 /* take names of special folders only if its only this folder */
1720 if ( bSimplePidl )
1721 {
1722 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */
1723 }
1724 }
1725 else
1726 {
1727 if (!_ILIsDrive(pidl))
1728 {
1729 ERR("Wrong pidl type\n");
1730 return E_INVALIDARG;
1731 }
1732
1733 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */
1734
1735 /* long view "lw_name (C:)" */
1736 if ( bSimplePidl && !(dwFlags & SHGDN_FORPARSING))
1737 {
1738 DWORD dwVolumeSerialNumber,dwMaximumComponetLength,dwFileSystemFlags;
1739
1740 GetVolumeInformationA(szPath,szDrive,12,&dwVolumeSerialNumber,&dwMaximumComponetLength,&dwFileSystemFlags,NULL,0);
1741 strcat (szDrive," (");
1742 strncat (szDrive, szPath, 2);
1743 strcat (szDrive,")");
1744 strcpy (szPath, szDrive);
1745 }
1746 }
1747
1748 if (!bSimplePidl) /* go deeper if needed */
1749 {
1750 PathAddBackslashA(szPath);
1751 len = strlen(szPath);
1752
1753 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder2*)This, pidl, dwFlags | SHGDN_FORPARSING, szPath + len, MAX_PATH - len)))
1754 return E_OUTOFMEMORY;
1755 }
1756 strRet->uType = STRRET_CSTRA;
1757 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);
1758
1759
1760 TRACE("-- (%p)->(%s)\n", This, szPath);
1761 return S_OK;
1762}
1763
1764ICOM_VTABLE(IShellFolder2) sfmcvt =
1765{
1766 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1767 IShellFolder_fnQueryInterface,
1768 IShellFolder_fnAddRef,
1769 IShellFolder_fnRelease,
1770 ISF_MyComputer_fnParseDisplayName,
1771 ISF_MyComputer_fnEnumObjects,
1772 ISF_MyComputer_fnBindToObject,
1773 IShellFolder_fnBindToStorage,
1774 IShellFolder_fnCompareIDs,
1775 ISF_MyComputer_fnCreateViewObject,
1776 ISF_MyComputer_fnGetAttributesOf,
1777 IShellFolder_fnGetUIObjectOf,
1778 ISF_MyComputer_fnGetDisplayNameOf,
1779 IShellFolder_fnSetNameOf,
1780
1781 /* ShellFolder2 */
1782 IShellFolder_fnGetDefaultSearchGUID,
1783 IShellFolder_fnEnumSearches,
1784 IShellFolder_fnGetDefaultColumn,
1785 IShellFolder_fnGetDefaultColumnState,
1786 IShellFolder_fnGetDetailsEx,
1787 IShellFolder_fnGetDetailsOf,
1788 IShellFolder_fnMapNameToSCID
1789};
1790
1791
1792/************************************************************************
1793 * ISFPersistFolder_QueryInterface (IUnknown)
1794 *
1795 */
1796static HRESULT WINAPI ISFPersistFolder_QueryInterface(
1797 IPersistFolder * iface,
1798 REFIID iid,
1799 LPVOID* ppvObj)
1800{
1801 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
1802
1803 TRACE("(%p)\n", This);
1804
1805 return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj);
1806}
1807
1808/************************************************************************
1809 * ISFPersistFolder_AddRef (IUnknown)
1810 *
1811 */
1812static ULONG WINAPI ISFPersistFolder_AddRef(
1813 IPersistFolder * iface)
1814{
1815 _ICOM_THIS_From_IPersistFolder(IShellFolder, iface);
1816
1817 TRACE("(%p)\n", This);
1818
1819 return IShellFolder_AddRef((IShellFolder*)This);
1820}
1821
1822/************************************************************************
1823 * ISFPersistFolder_Release (IUnknown)
1824 *
1825 */
1826static ULONG WINAPI ISFPersistFolder_Release(
1827 IPersistFolder * iface)
1828{
1829 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
1830
1831 TRACE("(%p)\n", This);
1832
1833 return IShellFolder_Release((IShellFolder*)This);
1834}
1835
1836/************************************************************************
1837 * ISFPersistFolder_GetClassID (IPersist)
1838 */
1839static HRESULT WINAPI ISFPersistFolder_GetClassID(
1840 IPersistFolder * iface,
1841 CLSID * lpClassId)
1842{
1843 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
1844
1845 TRACE("(%p)\n", This);
1846
1847 if (!lpClassId) return E_POINTER;
1848 *lpClassId = *This->pclsid;
1849
1850 return S_OK;
1851}
1852
1853/************************************************************************
1854 * ISFPersistFolder_Initialize (IPersistFolder)
1855 *
1856 * NOTES
1857 * sMyPath is not set. Don't know how to handle in a non rooted environment.
1858 */
1859static HRESULT WINAPI ISFPersistFolder_Initialize(
1860 IPersistFolder * iface,
1861 LPCITEMIDLIST pidl)
1862{
1863 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface);
1864
1865 TRACE("(%p)\n", This);
1866
1867 if(This->absPidl)
1868 {
1869 SHFree(This->absPidl);
1870 This->absPidl = NULL;
1871 }
1872 This->absPidl = ILClone(pidl);
1873 return S_OK;
1874}
1875
1876ICOM_VTABLE(IPersistFolder) psfvt =
1877{
1878 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1879 ISFPersistFolder_QueryInterface,
1880 ISFPersistFolder_AddRef,
1881 ISFPersistFolder_Release,
1882 ISFPersistFolder_GetClassID,
1883 ISFPersistFolder_Initialize
1884};
1885
1886/****************************************************************************
1887 * ISFDropTarget implementation
1888 */
1889static BOOL ISFDropTarget_QueryDrop(
1890 IDropTarget *iface,
1891 DWORD dwKeyState,
1892 LPDWORD pdwEffect)
1893{
1894 DWORD dwEffect = *pdwEffect;
1895
1896 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1897
1898 *pdwEffect = DROPEFFECT_NONE;
1899
1900 if (This->fAcceptFmt)
1901 { /* Does our interpretation of the keystate ... */
1902 *pdwEffect = KeyStateToDropEffect(dwKeyState);
1903
1904 /* ... matches the desired effect ? */
1905 if (dwEffect & *pdwEffect)
1906 {
1907 return TRUE;
1908 }
1909 }
1910 return FALSE;
1911}
1912
1913static HRESULT WINAPI ISFDropTarget_QueryInterface(
1914 IDropTarget *iface,
1915 REFIID riid,
1916 LPVOID *ppvObj)
1917{
1918 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1919
1920 TRACE("(%p)\n", This);
1921
1922 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);
1923}
1924
1925static ULONG WINAPI ISFDropTarget_AddRef( IDropTarget *iface)
1926{
1927 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1928
1929 TRACE("(%p)\n", This);
1930
1931 return IShellFolder_AddRef((IShellFolder*)This);
1932}
1933
1934static ULONG WINAPI ISFDropTarget_Release( IDropTarget *iface)
1935{
1936 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1937
1938 TRACE("(%p)\n", This);
1939
1940 return IShellFolder_Release((IShellFolder*)This);
1941}
1942
1943static HRESULT WINAPI ISFDropTarget_DragEnter(
1944 IDropTarget *iface,
1945 IDataObject *pDataObject,
1946 DWORD dwKeyState,
1947 POINTL pt,
1948 DWORD *pdwEffect)
1949{
1950 FORMATETC fmt;
1951
1952 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1953
1954 TRACE("(%p)->(DataObject=%p)\n",This,pDataObject);
1955
1956 InitFormatEtc(fmt, This->cfShellIDList, TYMED_HGLOBAL);
1957
1958 This->fAcceptFmt = (S_OK == IDataObject_QueryGetData(pDataObject, &fmt)) ? TRUE : FALSE;
1959
1960 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect);
1961
1962 return S_OK;
1963}
1964
1965static HRESULT WINAPI ISFDropTarget_DragOver(
1966 IDropTarget *iface,
1967 DWORD dwKeyState,
1968 POINTL pt,
1969 DWORD *pdwEffect)
1970{
1971 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1972
1973 TRACE("(%p)\n",This);
1974
1975 if(!pdwEffect) return E_INVALIDARG;
1976
1977 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect);
1978
1979 return S_OK;
1980}
1981
1982static HRESULT WINAPI ISFDropTarget_DragLeave(
1983 IDropTarget *iface)
1984{
1985 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
1986
1987 TRACE("(%p)\n",This);
1988
1989 This->fAcceptFmt = FALSE;
1990
1991 return S_OK;
1992}
1993
1994static HRESULT WINAPI ISFDropTarget_Drop(
1995 IDropTarget *iface,
1996 IDataObject* pDataObject,
1997 DWORD dwKeyState,
1998 POINTL pt,
1999 DWORD *pdwEffect)
2000{
2001 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);
2002
2003 FIXME("(%p) object dropped\n",This);
2004
2005 return E_NOTIMPL;
2006}
2007
2008struct ICOM_VTABLE(IDropTarget) dt2vt =
2009{
2010 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
2011 ISFDropTarget_QueryInterface,
2012 ISFDropTarget_AddRef,
2013 ISFDropTarget_Release,
2014 ISFDropTarget_DragEnter,
2015 ISFDropTarget_DragOver,
2016 ISFDropTarget_DragLeave,
2017 ISFDropTarget_Drop
2018};
2019
Note: See TracBrowser for help on using the repository browser.