3 * Copyright 1997 Marcus Meissner
4 * Copyright 1998 Juergen Schmied
13 #include "wine/obj_base.h"
14 #include "wine/obj_storage.h"
17 #include "shell32_main.h"
20 /* IPersistFile Implementation */
21 typedef struct _IPersistFile {
23 ICOM_VTABLE(IPersistFile)* lpvtbl;
27 static struct ICOM_VTABLE(IPersistFile) pfvt;
30 /**************************************************************************
31 * IPersistFile_Constructor
33 LPPERSISTFILE IPersistFile_Constructor(void)
37 sl = (_IPersistFile*)HeapAlloc(GetProcessHeap(),0,sizeof(_IPersistFile));
41 TRACE(shell,"(%p)->()\n",sl);
43 return (LPPERSISTFILE)sl;
46 /**************************************************************************
47 * IPersistFile_QueryInterface
49 static HRESULT WINAPI IPersistFile_fnQueryInterface(
50 LPUNKNOWN iface, REFIID riid, LPVOID *ppvObj)
52 ICOM_THIS(IPersistFile,iface);
54 WINE_StringFromCLSID((LPCLSID)riid,xriid);
55 TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
59 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
62 else if(IsEqualIID(riid, &IID_IPersistFile)) /*IPersistFile*/
63 { *ppvObj = (LPPERSISTFILE)this;
67 { IPersistFile_AddRef((IPersistFile*)*ppvObj);
68 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
71 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
74 /******************************************************************************
77 static ULONG WINAPI IPersistFile_fnAddRef(LPUNKNOWN iface)
79 ICOM_THIS(IPersistFile,iface);
80 TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
85 /******************************************************************************
86 * IPersistFile_Release
88 static ULONG WINAPI IPersistFile_fnRelease(LPUNKNOWN iface)
90 ICOM_THIS(IPersistFile,iface);
91 TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
96 { TRACE(shell,"-- destroying IPersistFile(%p)\n",this);
97 HeapFree(GetProcessHeap(),0,this);
103 static HRESULT WINAPI IPersistFile_fnGetClassID(const IPersist* iface, CLSID *pClassID)
105 ICOM_CTHIS(IPersistFile,iface);
106 FIXME(shell,"(%p)\n",this);
109 static HRESULT WINAPI IPersistFile_fnIsDirty(const IPersistFile* iface)
111 ICOM_CTHIS(IPersistFile,iface);
112 FIXME(shell,"(%p)\n",this);
115 static HRESULT WINAPI IPersistFile_fnLoad(LPPERSISTFILE iface, LPCOLESTR32 pszFileName, DWORD dwMode)
117 ICOM_THIS(IPersistFile,iface);
118 FIXME(shell,"(%p)->(%s)\n",this,debugstr_w(pszFileName));
121 static HRESULT WINAPI IPersistFile_fnSave(LPPERSISTFILE iface, LPCOLESTR32 pszFileName, BOOL32 fRemember)
123 ICOM_THIS(IPersistFile,iface);
124 FIXME(shell,"(%p)->(%s)\n",this,debugstr_w(pszFileName));
127 static HRESULT WINAPI IPersistFile_fnSaveCompleted(LPPERSISTFILE iface, LPCOLESTR32 pszFileName)
129 ICOM_THIS(IPersistFile,iface);
130 FIXME(shell,"(%p)->(%s)\n",this,debugstr_w(pszFileName));
133 static HRESULT WINAPI IPersistFile_fnGetCurFile(const IPersistFile* iface, LPOLESTR32 *ppszFileName)
135 ICOM_CTHIS(IPersistFile,iface);
136 FIXME(shell,"(%p)\n",this);
140 static struct ICOM_VTABLE(IPersistFile) pfvt =
144 IPersistFile_fnQueryInterface,
145 IPersistFile_fnAddRef,
146 IPersistFile_fnRelease
148 IPersistFile_fnGetClassID
150 IPersistFile_fnIsDirty,
153 IPersistFile_fnSaveCompleted,
154 IPersistFile_fnGetCurFile
158 /**************************************************************************
159 * IShellLink's IClassFactory implementation
162 static ICOM_VTABLE(IClassFactory) slcfvt;
164 /**************************************************************************
165 * IShellLink_CF_Constructor
168 LPCLASSFACTORY IShellLink_CF_Constructor(void)
170 _IClassFactory* lpclf;
172 lpclf= (_IClassFactory*)HeapAlloc(GetProcessHeap(),0,sizeof(_IClassFactory));
174 lpclf->lpvtbl = &slcfvt;
175 TRACE(shell,"(%p)->()\n",lpclf);
177 return (LPCLASSFACTORY)lpclf;
179 /**************************************************************************
180 * IShellLink_CF_QueryInterface
182 static HRESULT WINAPI IShellLink_CF_QueryInterface(
183 LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
185 ICOM_THIS(IClassFactory,iface);
187 WINE_StringFromCLSID((LPCLSID)riid,xriid);
188 TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
192 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
193 { *ppvObj = (LPUNKNOWN)this;
195 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/
196 { *ppvObj = (LPCLASSFACTORY)this;
200 { IUnknown_AddRef((IUnknown*)*ppvObj);
201 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
204 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
205 return E_NOINTERFACE;
207 /******************************************************************************
208 * IShellLink_CF_AddRef
210 static ULONG WINAPI IShellLink_CF_AddRef(LPCLASSFACTORY iface)
212 ICOM_THIS(IClassFactory,iface);
213 TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
216 return ++(this->ref);
218 /******************************************************************************
219 * IShellLink_CF_Release
221 static ULONG WINAPI IShellLink_CF_Release(LPCLASSFACTORY iface)
223 ICOM_THIS(IClassFactory,iface);
224 TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
228 { TRACE(shell,"-- destroying IClassFactory(%p)\n",this);
229 HeapFree(GetProcessHeap(),0,this);
234 /******************************************************************************
235 * IShellLink_CF_CreateInstance
237 static HRESULT WINAPI IShellLink_CF_CreateInstance(
238 LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
240 ICOM_THIS(IClassFactory,iface);
241 IUnknown *pObj = NULL;
245 WINE_StringFromCLSID((LPCLSID)riid,xriid);
246 TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown,xriid,ppObject);
251 { return(CLASS_E_NOAGGREGATION);
254 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IShellLink))
255 { pObj = (IUnknown *)IShellLink_Constructor();
258 { ERR(shell,"unknown IID requested\n\tIID:\t%s\n",xriid);
259 return(E_NOINTERFACE);
263 { return(E_OUTOFMEMORY);
266 hres = IUnknown_QueryInterface(pObj,riid, ppObject);
267 IUnknown_Release(pObj);
268 TRACE(shell,"-- Object created: (%p)->%p\n",this,*ppObject);
272 /******************************************************************************
273 * IShellLink_CF_LockServer
275 static HRESULT WINAPI IShellLink_CF_LockServer(LPCLASSFACTORY iface, BOOL32 fLock)
277 ICOM_THIS(IClassFactory,iface);
278 TRACE(shell,"%p->(0x%x), not implemented\n",this, fLock);
281 static ICOM_VTABLE(IClassFactory) slcfvt =
283 IShellLink_CF_QueryInterface,
284 IShellLink_CF_AddRef,
285 IShellLink_CF_Release,
286 IShellLink_CF_CreateInstance,
287 IShellLink_CF_LockServer
290 /* IShellLink Implementation */
291 static HRESULT WINAPI IShellLink_QueryInterface(LPSHELLLINK,REFIID,LPVOID*);
292 static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK);
293 static ULONG WINAPI IShellLink_Release(LPSHELLLINK);
294 static HRESULT WINAPI IShellLink_GetPath(LPSHELLLINK, LPSTR,INT32, WIN32_FIND_DATA32A *, DWORD);
295 static HRESULT WINAPI IShellLink_GetIDList(LPSHELLLINK, LPITEMIDLIST *);
296 static HRESULT WINAPI IShellLink_SetIDList(LPSHELLLINK, LPCITEMIDLIST);
297 static HRESULT WINAPI IShellLink_GetDescription(LPSHELLLINK, LPSTR,INT32);
298 static HRESULT WINAPI IShellLink_SetDescription(LPSHELLLINK, LPCSTR);
299 static HRESULT WINAPI IShellLink_GetWorkingDirectory(LPSHELLLINK, LPSTR,INT32);
300 static HRESULT WINAPI IShellLink_SetWorkingDirectory(LPSHELLLINK, LPCSTR);
301 static HRESULT WINAPI IShellLink_GetArguments(LPSHELLLINK, LPSTR,INT32);
302 static HRESULT WINAPI IShellLink_SetArguments(LPSHELLLINK, LPCSTR);
303 static HRESULT WINAPI IShellLink_GetHotkey(LPSHELLLINK, WORD *);
304 static HRESULT WINAPI IShellLink_SetHotkey(LPSHELLLINK, WORD);
305 static HRESULT WINAPI IShellLink_GetShowCmd(LPSHELLLINK, INT32 *);
306 static HRESULT WINAPI IShellLink_SetShowCmd(LPSHELLLINK, INT32);
307 static HRESULT WINAPI IShellLink_GetIconLocation(LPSHELLLINK, LPSTR,INT32,INT32 *);
308 static HRESULT WINAPI IShellLink_SetIconLocation(LPSHELLLINK, LPCSTR,INT32);
309 static HRESULT WINAPI IShellLink_SetRelativePath(LPSHELLLINK, LPCSTR, DWORD);
310 static HRESULT WINAPI IShellLink_Resolve(LPSHELLLINK, HWND32, DWORD);
311 static HRESULT WINAPI IShellLink_SetPath(LPSHELLLINK, LPCSTR);
313 /**************************************************************************
314 * IShellLink Implementation
318 static struct IShellLink_VTable slvt =
319 { IShellLink_QueryInterface,
323 IShellLink_GetIDList,
324 IShellLink_SetIDList,
325 IShellLink_GetDescription,
326 IShellLink_SetDescription,
327 IShellLink_GetWorkingDirectory,
328 IShellLink_SetWorkingDirectory,
329 IShellLink_GetArguments,
330 IShellLink_SetArguments,
331 IShellLink_GetHotkey,
332 IShellLink_SetHotkey,
333 IShellLink_GetShowCmd,
334 IShellLink_SetShowCmd,
335 IShellLink_GetIconLocation,
336 IShellLink_SetIconLocation,
337 IShellLink_SetRelativePath,
342 /**************************************************************************
343 * IShellLink_Constructor
345 LPSHELLLINK IShellLink_Constructor(void)
348 sl = (LPSHELLLINK)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLink));
352 sl->lppf = IPersistFile_Constructor();
354 TRACE(shell,"(%p)->()\n",sl);
359 /**************************************************************************
360 * IShellLink::QueryInterface
362 static HRESULT WINAPI IShellLink_QueryInterface(
363 LPSHELLLINK this, REFIID riid, LPVOID *ppvObj)
365 WINE_StringFromCLSID((LPCLSID)riid,xriid);
366 TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
370 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
373 else if(IsEqualIID(riid, &IID_IShellLink)) /*IShellLink*/
374 { *ppvObj = (LPSHELLLINK)this;
376 else if(IsEqualIID(riid, &IID_IPersistFile)) /*IPersistFile*/
377 { *ppvObj = (LPPERSISTFILE)this->lppf;
381 { (*(LPSHELLLINK*)ppvObj)->lpvtbl->fnAddRef(this);
382 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
385 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
386 return E_NOINTERFACE;
388 /******************************************************************************
391 static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK this)
392 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
395 return ++(this->ref);
397 /******************************************************************************
400 static ULONG WINAPI IShellLink_Release(LPSHELLLINK this)
401 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
405 { TRACE(shell,"-- destroying IShellLink(%p)\n",this);
406 IPersistFile_Release(this->lppf); /* IPersistFile*/
407 HeapFree(GetProcessHeap(),0,this);
413 static HRESULT WINAPI IShellLink_GetPath(LPSHELLLINK this, LPSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags)
414 { FIXME(shell,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile, cchMaxPath, pfd, fFlags);
415 strncpy(pszFile,"c:\\foo.bar", cchMaxPath);
418 static HRESULT WINAPI IShellLink_GetIDList(LPSHELLLINK this, LPITEMIDLIST * ppidl)
419 { FIXME(shell,"(%p)->(ppidl=%p)\n",this, ppidl);
420 *ppidl = _ILCreateDesktop();
423 static HRESULT WINAPI IShellLink_SetIDList(LPSHELLLINK this, LPCITEMIDLIST pidl)
424 { FIXME(shell,"(%p)->(pidl=%p)\n",this, pidl);
427 static HRESULT WINAPI IShellLink_GetDescription(LPSHELLLINK this, LPSTR pszName,INT32 cchMaxName)
428 { FIXME(shell,"(%p)->(%p len=%u)\n",this, pszName, cchMaxName);
429 strncpy(pszName,"Description, FIXME",cchMaxName);
432 static HRESULT WINAPI IShellLink_SetDescription(LPSHELLLINK this, LPCSTR pszName)
433 { FIXME(shell,"(%p)->(desc=%s)\n",this, pszName);
436 static HRESULT WINAPI IShellLink_GetWorkingDirectory(LPSHELLLINK this, LPSTR pszDir,INT32 cchMaxPath)
437 { FIXME(shell,"(%p)->()\n",this);
438 strncpy(pszDir,"c:\\", cchMaxPath);
441 static HRESULT WINAPI IShellLink_SetWorkingDirectory(LPSHELLLINK this, LPCSTR pszDir)
442 { FIXME(shell,"(%p)->(dir=%s)\n",this, pszDir);
445 static HRESULT WINAPI IShellLink_GetArguments(LPSHELLLINK this, LPSTR pszArgs,INT32 cchMaxPath)
446 { FIXME(shell,"(%p)->(%p len=%u)\n",this, pszArgs, cchMaxPath);
447 strncpy(pszArgs, "", cchMaxPath);
450 static HRESULT WINAPI IShellLink_SetArguments(LPSHELLLINK this, LPCSTR pszArgs)
451 { FIXME(shell,"(%p)->(args=%s)\n",this, pszArgs);
454 static HRESULT WINAPI IShellLink_GetHotkey(LPSHELLLINK this, WORD *pwHotkey)
455 { FIXME(shell,"(%p)->(%p)\n",this, pwHotkey);
459 static HRESULT WINAPI IShellLink_SetHotkey(LPSHELLLINK this, WORD wHotkey)
460 { FIXME(shell,"(%p)->(hotkey=%x)\n",this, wHotkey);
463 static HRESULT WINAPI IShellLink_GetShowCmd(LPSHELLLINK this, INT32 *piShowCmd)
464 { FIXME(shell,"(%p)->(%p)\n",this, piShowCmd);
468 static HRESULT WINAPI IShellLink_SetShowCmd(LPSHELLLINK this, INT32 iShowCmd)
469 { FIXME(shell,"(%p)->(showcmd=%x)\n",this, iShowCmd);
472 static HRESULT WINAPI IShellLink_GetIconLocation(LPSHELLLINK this, LPSTR pszIconPath,INT32 cchIconPath,INT32 *piIcon)
473 { FIXME(shell,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath, cchIconPath, piIcon);
474 strncpy(pszIconPath,"shell32.dll",cchIconPath);
478 static HRESULT WINAPI IShellLink_SetIconLocation(LPSHELLLINK this, LPCSTR pszIconPath,INT32 iIcon)
479 { FIXME(shell,"(%p)->(path=%s iicon=%u)\n",this, pszIconPath, iIcon);
482 static HRESULT WINAPI IShellLink_SetRelativePath(LPSHELLLINK this, LPCSTR pszPathRel, DWORD dwReserved)
483 { FIXME(shell,"(%p)->(path=%s %lx)\n",this, pszPathRel, dwReserved);
486 static HRESULT WINAPI IShellLink_Resolve(LPSHELLLINK this, HWND32 hwnd, DWORD fFlags)
487 { FIXME(shell,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd, fFlags);
490 static HRESULT WINAPI IShellLink_SetPath(LPSHELLLINK this, LPCSTR pszFile)
491 { FIXME(shell,"(%p)->(path=%s)\n",this, pszFile);
495 /**************************************************************************
496 * IShellLink's IClassFactory implementation
499 static ICOM_VTABLE(IClassFactory) slwcfvt;
501 /**************************************************************************
502 * IShellLinkW_CF_Constructor
505 LPCLASSFACTORY IShellLinkW_CF_Constructor(void)
507 _IClassFactory* lpclf;
509 lpclf= (_IClassFactory*)HeapAlloc(GetProcessHeap(),0,sizeof(_IClassFactory));
511 lpclf->lpvtbl = &slwcfvt;
512 TRACE(shell,"(%p)->()\n",lpclf);
514 return (LPCLASSFACTORY)lpclf;
516 /**************************************************************************
517 * IShellLinkW_CF_QueryInterface
519 static HRESULT WINAPI IShellLinkW_CF_QueryInterface(
520 LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
522 ICOM_THIS(IClassFactory,iface);
524 WINE_StringFromCLSID((LPCLSID)riid,xriid);
525 TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
529 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
530 { *ppvObj = (LPUNKNOWN)this;
532 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/
533 { *ppvObj = (LPCLASSFACTORY)this;
537 IUnknown_AddRef((IUnknown*)*ppvObj);
538 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
541 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
542 return E_NOINTERFACE;
544 /******************************************************************************
545 * IShellLinkW_CF_AddRef
547 static ULONG WINAPI IShellLinkW_CF_AddRef(LPCLASSFACTORY iface)
549 ICOM_THIS(IClassFactory,iface);
550 TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
553 return ++(this->ref);
555 /******************************************************************************
556 * IShellLinkW_CF_Release
558 static ULONG WINAPI IShellLinkW_CF_Release(LPCLASSFACTORY iface)
560 ICOM_THIS(IClassFactory,iface);
561 TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
565 { TRACE(shell,"-- destroying IClassFactory(%p)\n",this);
566 HeapFree(GetProcessHeap(),0,this);
571 /******************************************************************************
572 * IShellLinkW_CF_CreateInstance
574 static HRESULT WINAPI IShellLinkW_CF_CreateInstance(
575 LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
577 ICOM_THIS(IClassFactory,iface);
578 IUnknown *pObj = NULL;
582 WINE_StringFromCLSID((LPCLSID)riid,xriid);
583 TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown,xriid,ppObject);
588 { return(CLASS_E_NOAGGREGATION);
591 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IShellLinkW))
592 { pObj = (IUnknown *)IShellLinkW_Constructor();
595 { ERR(shell,"unknown IID requested\n\tIID:\t%s\n",xriid);
596 return(E_NOINTERFACE);
600 { return(E_OUTOFMEMORY);
603 hres = pObj->lpvtbl->fnQueryInterface(pObj,riid, ppObject);
604 pObj->lpvtbl->fnRelease(pObj);
605 TRACE(shell,"-- Object created: (%p)->%p\n",this,*ppObject);
609 /******************************************************************************
610 * IShellLinkW_CF_LockServer
613 static HRESULT WINAPI IShellLinkW_CF_LockServer(LPCLASSFACTORY iface, BOOL32 fLock)
615 ICOM_THIS(IClassFactory,iface);
616 TRACE(shell,"%p->(0x%x), not implemented\n",this, fLock);
620 static ICOM_VTABLE(IClassFactory) slwcfvt =
622 IShellLinkW_CF_QueryInterface,
623 IShellLinkW_CF_AddRef,
624 IShellLinkW_CF_Release,
625 IShellLinkW_CF_CreateInstance,
626 IShellLinkW_CF_LockServer
629 /* IShellLinkW Implementation */
630 static HRESULT WINAPI IShellLinkW_QueryInterface(LPSHELLLINKW,REFIID,LPVOID*);
631 static ULONG WINAPI IShellLinkW_AddRef(LPSHELLLINKW);
632 static ULONG WINAPI IShellLinkW_Release(LPSHELLLINKW);
633 static HRESULT WINAPI IShellLinkW_GetPath(LPSHELLLINKW, LPWSTR,INT32, WIN32_FIND_DATA32A *, DWORD);
634 static HRESULT WINAPI IShellLinkW_GetIDList(LPSHELLLINKW, LPITEMIDLIST *);
635 static HRESULT WINAPI IShellLinkW_SetIDList(LPSHELLLINKW, LPCITEMIDLIST);
636 static HRESULT WINAPI IShellLinkW_GetDescription(LPSHELLLINKW, LPWSTR,INT32);
637 static HRESULT WINAPI IShellLinkW_SetDescription(LPSHELLLINKW, LPCWSTR);
638 static HRESULT WINAPI IShellLinkW_GetWorkingDirectory(LPSHELLLINKW, LPWSTR,INT32);
639 static HRESULT WINAPI IShellLinkW_SetWorkingDirectory(LPSHELLLINKW, LPCWSTR);
640 static HRESULT WINAPI IShellLinkW_GetArguments(LPSHELLLINKW, LPWSTR,INT32);
641 static HRESULT WINAPI IShellLinkW_SetArguments(LPSHELLLINKW, LPCWSTR);
642 static HRESULT WINAPI IShellLinkW_GetHotkey(LPSHELLLINKW, WORD *);
643 static HRESULT WINAPI IShellLinkW_SetHotkey(LPSHELLLINKW, WORD);
644 static HRESULT WINAPI IShellLinkW_GetShowCmd(LPSHELLLINKW, INT32 *);
645 static HRESULT WINAPI IShellLinkW_SetShowCmd(LPSHELLLINKW, INT32);
646 static HRESULT WINAPI IShellLinkW_GetIconLocation(LPSHELLLINKW, LPWSTR,INT32,INT32 *);
647 static HRESULT WINAPI IShellLinkW_SetIconLocation(LPSHELLLINKW, LPCWSTR,INT32);
648 static HRESULT WINAPI IShellLinkW_SetRelativePath(LPSHELLLINKW, LPCWSTR, DWORD);
649 static HRESULT WINAPI IShellLinkW_Resolve(LPSHELLLINKW, HWND32, DWORD);
650 static HRESULT WINAPI IShellLinkW_SetPath(LPSHELLLINKW, LPCWSTR);
652 /**************************************************************************
653 * IShellLinkW Implementation
656 static struct IShellLinkW_VTable slvtw =
657 { IShellLinkW_QueryInterface,
661 IShellLinkW_GetIDList,
662 IShellLinkW_SetIDList,
663 IShellLinkW_GetDescription,
664 IShellLinkW_SetDescription,
665 IShellLinkW_GetWorkingDirectory,
666 IShellLinkW_SetWorkingDirectory,
667 IShellLinkW_GetArguments,
668 IShellLinkW_SetArguments,
669 IShellLinkW_GetHotkey,
670 IShellLinkW_SetHotkey,
671 IShellLinkW_GetShowCmd,
672 IShellLinkW_SetShowCmd,
673 IShellLinkW_GetIconLocation,
674 IShellLinkW_SetIconLocation,
675 IShellLinkW_SetRelativePath,
680 /**************************************************************************
681 * IShellLinkW_Constructor
683 LPSHELLLINKW IShellLinkW_Constructor(void)
686 sl = (LPSHELLLINKW)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLinkW));
690 sl->lppf = IPersistFile_Constructor();
692 TRACE(shell,"(%p)->()\n",sl);
697 /**************************************************************************
698 * IShellLinkW::QueryInterface
700 static HRESULT WINAPI IShellLinkW_QueryInterface(
701 LPSHELLLINKW this, REFIID riid, LPVOID *ppvObj)
703 WINE_StringFromCLSID((LPCLSID)riid,xriid);
704 TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
708 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
711 else if(IsEqualIID(riid, &IID_IShellLinkW)) /*IShellLinkW*/
712 { *ppvObj = (LPSHELLLINKW)this;
714 else if(IsEqualIID(riid, &IID_IPersistFile)) /*IPersistFile*/
715 { *ppvObj = (LPPERSISTFILE)this->lppf;
719 { (*(LPSHELLLINKW*)ppvObj)->lpvtbl->fnAddRef(this);
720 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
723 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
724 return E_NOINTERFACE;
726 /******************************************************************************
729 static ULONG WINAPI IShellLinkW_AddRef(LPSHELLLINKW this)
730 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
733 return ++(this->ref);
735 /******************************************************************************
736 * IClassFactory_Release
738 static ULONG WINAPI IShellLinkW_Release(LPSHELLLINKW this)
739 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
743 { TRACE(shell,"-- destroying IShellLinkW(%p)\n",this);
744 IPersistFile_Release(this->lppf); /* IPersistFile*/
745 HeapFree(GetProcessHeap(),0,this);
751 static HRESULT WINAPI IShellLinkW_GetPath(LPSHELLLINKW this, LPWSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags)
752 { FIXME(shell,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile, cchMaxPath, pfd, fFlags);
753 lstrcpynAtoW(pszFile,"c:\\foo.bar", cchMaxPath);
756 static HRESULT WINAPI IShellLinkW_GetIDList(LPSHELLLINKW this, LPITEMIDLIST * ppidl)
757 { FIXME(shell,"(%p)->(ppidl=%p)\n",this, ppidl);
758 *ppidl = _ILCreateDesktop();
761 static HRESULT WINAPI IShellLinkW_SetIDList(LPSHELLLINKW this, LPCITEMIDLIST pidl)
762 { FIXME(shell,"(%p)->(pidl=%p)\n",this, pidl);
765 static HRESULT WINAPI IShellLinkW_GetDescription(LPSHELLLINKW this, LPWSTR pszName,INT32 cchMaxName)
766 { FIXME(shell,"(%p)->(%p len=%u)\n",this, pszName, cchMaxName);
767 lstrcpynAtoW(pszName,"Description, FIXME",cchMaxName);
770 static HRESULT WINAPI IShellLinkW_SetDescription(LPSHELLLINKW this, LPCWSTR pszName)
771 { FIXME(shell,"(%p)->(desc=%s)\n",this, debugstr_w(pszName));
774 static HRESULT WINAPI IShellLinkW_GetWorkingDirectory(LPSHELLLINKW this, LPWSTR pszDir,INT32 cchMaxPath)
775 { FIXME(shell,"(%p)->()\n",this);
776 lstrcpynAtoW(pszDir,"c:\\", cchMaxPath);
779 static HRESULT WINAPI IShellLinkW_SetWorkingDirectory(LPSHELLLINKW this, LPCWSTR pszDir)
780 { FIXME(shell,"(%p)->(dir=%s)\n",this, debugstr_w(pszDir));
783 static HRESULT WINAPI IShellLinkW_GetArguments(LPSHELLLINKW this, LPWSTR pszArgs,INT32 cchMaxPath)
784 { FIXME(shell,"(%p)->(%p len=%u)\n",this, pszArgs, cchMaxPath);
785 lstrcpynAtoW(pszArgs, "", cchMaxPath);
788 static HRESULT WINAPI IShellLinkW_SetArguments(LPSHELLLINKW this, LPCWSTR pszArgs)
789 { FIXME(shell,"(%p)->(args=%s)\n",this, debugstr_w(pszArgs));
792 static HRESULT WINAPI IShellLinkW_GetHotkey(LPSHELLLINKW this, WORD *pwHotkey)
793 { FIXME(shell,"(%p)->(%p)\n",this, pwHotkey);
797 static HRESULT WINAPI IShellLinkW_SetHotkey(LPSHELLLINKW this, WORD wHotkey)
798 { FIXME(shell,"(%p)->(hotkey=%x)\n",this, wHotkey);
801 static HRESULT WINAPI IShellLinkW_GetShowCmd(LPSHELLLINKW this, INT32 *piShowCmd)
802 { FIXME(shell,"(%p)->(%p)\n",this, piShowCmd);
806 static HRESULT WINAPI IShellLinkW_SetShowCmd(LPSHELLLINKW this, INT32 iShowCmd)
807 { FIXME(shell,"(%p)->(showcmd=%x)\n",this, iShowCmd);
810 static HRESULT WINAPI IShellLinkW_GetIconLocation(LPSHELLLINKW this, LPWSTR pszIconPath,INT32 cchIconPath,INT32 *piIcon)
811 { FIXME(shell,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath, cchIconPath, piIcon);
812 lstrcpynAtoW(pszIconPath,"shell32.dll",cchIconPath);
816 static HRESULT WINAPI IShellLinkW_SetIconLocation(LPSHELLLINKW this, LPCWSTR pszIconPath,INT32 iIcon)
817 { FIXME(shell,"(%p)->(path=%s iicon=%u)\n",this, debugstr_w(pszIconPath), iIcon);
820 static HRESULT WINAPI IShellLinkW_SetRelativePath(LPSHELLLINKW this, LPCWSTR pszPathRel, DWORD dwReserved)
821 { FIXME(shell,"(%p)->(path=%s %lx)\n",this, debugstr_w(pszPathRel), dwReserved);
824 static HRESULT WINAPI IShellLinkW_Resolve(LPSHELLLINKW this, HWND32 hwnd, DWORD fFlags)
825 { FIXME(shell,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd, fFlags);
828 static HRESULT WINAPI IShellLinkW_SetPath(LPSHELLLINKW this, LPCWSTR pszFile)
829 { FIXME(shell,"(%p)->(path=%s)\n",this, debugstr_w(pszFile));