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 LPUNKNOWN 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(LPUNKNOWN 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(LPUNKNOWN 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 =
284 IShellLink_CF_QueryInterface,
285 IShellLink_CF_AddRef,
286 IShellLink_CF_Release
288 IShellLink_CF_CreateInstance,
289 IShellLink_CF_LockServer
292 /* IShellLink Implementation */
293 static HRESULT WINAPI IShellLink_QueryInterface(LPSHELLLINK,REFIID,LPVOID*);
294 static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK);
295 static ULONG WINAPI IShellLink_Release(LPSHELLLINK);
296 static HRESULT WINAPI IShellLink_GetPath(LPSHELLLINK, LPSTR,INT32, WIN32_FIND_DATA32A *, DWORD);
297 static HRESULT WINAPI IShellLink_GetIDList(LPSHELLLINK, LPITEMIDLIST *);
298 static HRESULT WINAPI IShellLink_SetIDList(LPSHELLLINK, LPCITEMIDLIST);
299 static HRESULT WINAPI IShellLink_GetDescription(LPSHELLLINK, LPSTR,INT32);
300 static HRESULT WINAPI IShellLink_SetDescription(LPSHELLLINK, LPCSTR);
301 static HRESULT WINAPI IShellLink_GetWorkingDirectory(LPSHELLLINK, LPSTR,INT32);
302 static HRESULT WINAPI IShellLink_SetWorkingDirectory(LPSHELLLINK, LPCSTR);
303 static HRESULT WINAPI IShellLink_GetArguments(LPSHELLLINK, LPSTR,INT32);
304 static HRESULT WINAPI IShellLink_SetArguments(LPSHELLLINK, LPCSTR);
305 static HRESULT WINAPI IShellLink_GetHotkey(LPSHELLLINK, WORD *);
306 static HRESULT WINAPI IShellLink_SetHotkey(LPSHELLLINK, WORD);
307 static HRESULT WINAPI IShellLink_GetShowCmd(LPSHELLLINK, INT32 *);
308 static HRESULT WINAPI IShellLink_SetShowCmd(LPSHELLLINK, INT32);
309 static HRESULT WINAPI IShellLink_GetIconLocation(LPSHELLLINK, LPSTR,INT32,INT32 *);
310 static HRESULT WINAPI IShellLink_SetIconLocation(LPSHELLLINK, LPCSTR,INT32);
311 static HRESULT WINAPI IShellLink_SetRelativePath(LPSHELLLINK, LPCSTR, DWORD);
312 static HRESULT WINAPI IShellLink_Resolve(LPSHELLLINK, HWND32, DWORD);
313 static HRESULT WINAPI IShellLink_SetPath(LPSHELLLINK, LPCSTR);
315 /**************************************************************************
316 * IShellLink Implementation
320 static struct IShellLink_VTable slvt =
321 { IShellLink_QueryInterface,
325 IShellLink_GetIDList,
326 IShellLink_SetIDList,
327 IShellLink_GetDescription,
328 IShellLink_SetDescription,
329 IShellLink_GetWorkingDirectory,
330 IShellLink_SetWorkingDirectory,
331 IShellLink_GetArguments,
332 IShellLink_SetArguments,
333 IShellLink_GetHotkey,
334 IShellLink_SetHotkey,
335 IShellLink_GetShowCmd,
336 IShellLink_SetShowCmd,
337 IShellLink_GetIconLocation,
338 IShellLink_SetIconLocation,
339 IShellLink_SetRelativePath,
344 /**************************************************************************
345 * IShellLink_Constructor
347 LPSHELLLINK IShellLink_Constructor(void)
350 sl = (LPSHELLLINK)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLink));
354 sl->lppf = IPersistFile_Constructor();
356 TRACE(shell,"(%p)->()\n",sl);
361 /**************************************************************************
362 * IShellLink::QueryInterface
364 static HRESULT WINAPI IShellLink_QueryInterface(
365 LPSHELLLINK this, REFIID riid, LPVOID *ppvObj)
367 WINE_StringFromCLSID((LPCLSID)riid,xriid);
368 TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
372 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
375 else if(IsEqualIID(riid, &IID_IShellLink)) /*IShellLink*/
376 { *ppvObj = (LPSHELLLINK)this;
378 else if(IsEqualIID(riid, &IID_IPersistFile)) /*IPersistFile*/
379 { *ppvObj = (LPPERSISTFILE)this->lppf;
383 { (*(LPSHELLLINK*)ppvObj)->lpvtbl->fnAddRef(this);
384 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
387 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
388 return E_NOINTERFACE;
390 /******************************************************************************
393 static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK this)
394 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
397 return ++(this->ref);
399 /******************************************************************************
402 static ULONG WINAPI IShellLink_Release(LPSHELLLINK this)
403 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
407 { TRACE(shell,"-- destroying IShellLink(%p)\n",this);
408 IPersistFile_Release(this->lppf); /* IPersistFile*/
409 HeapFree(GetProcessHeap(),0,this);
415 static HRESULT WINAPI IShellLink_GetPath(LPSHELLLINK this, LPSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags)
416 { FIXME(shell,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile, cchMaxPath, pfd, fFlags);
417 strncpy(pszFile,"c:\\foo.bar", cchMaxPath);
420 static HRESULT WINAPI IShellLink_GetIDList(LPSHELLLINK this, LPITEMIDLIST * ppidl)
421 { FIXME(shell,"(%p)->(ppidl=%p)\n",this, ppidl);
422 *ppidl = _ILCreateDesktop();
425 static HRESULT WINAPI IShellLink_SetIDList(LPSHELLLINK this, LPCITEMIDLIST pidl)
426 { FIXME(shell,"(%p)->(pidl=%p)\n",this, pidl);
429 static HRESULT WINAPI IShellLink_GetDescription(LPSHELLLINK this, LPSTR pszName,INT32 cchMaxName)
430 { FIXME(shell,"(%p)->(%p len=%u)\n",this, pszName, cchMaxName);
431 strncpy(pszName,"Description, FIXME",cchMaxName);
434 static HRESULT WINAPI IShellLink_SetDescription(LPSHELLLINK this, LPCSTR pszName)
435 { FIXME(shell,"(%p)->(desc=%s)\n",this, pszName);
438 static HRESULT WINAPI IShellLink_GetWorkingDirectory(LPSHELLLINK this, LPSTR pszDir,INT32 cchMaxPath)
439 { FIXME(shell,"(%p)->()\n",this);
440 strncpy(pszDir,"c:\\", cchMaxPath);
443 static HRESULT WINAPI IShellLink_SetWorkingDirectory(LPSHELLLINK this, LPCSTR pszDir)
444 { FIXME(shell,"(%p)->(dir=%s)\n",this, pszDir);
447 static HRESULT WINAPI IShellLink_GetArguments(LPSHELLLINK this, LPSTR pszArgs,INT32 cchMaxPath)
448 { FIXME(shell,"(%p)->(%p len=%u)\n",this, pszArgs, cchMaxPath);
449 strncpy(pszArgs, "", cchMaxPath);
452 static HRESULT WINAPI IShellLink_SetArguments(LPSHELLLINK this, LPCSTR pszArgs)
453 { FIXME(shell,"(%p)->(args=%s)\n",this, pszArgs);
456 static HRESULT WINAPI IShellLink_GetHotkey(LPSHELLLINK this, WORD *pwHotkey)
457 { FIXME(shell,"(%p)->(%p)\n",this, pwHotkey);
461 static HRESULT WINAPI IShellLink_SetHotkey(LPSHELLLINK this, WORD wHotkey)
462 { FIXME(shell,"(%p)->(hotkey=%x)\n",this, wHotkey);
465 static HRESULT WINAPI IShellLink_GetShowCmd(LPSHELLLINK this, INT32 *piShowCmd)
466 { FIXME(shell,"(%p)->(%p)\n",this, piShowCmd);
470 static HRESULT WINAPI IShellLink_SetShowCmd(LPSHELLLINK this, INT32 iShowCmd)
471 { FIXME(shell,"(%p)->(showcmd=%x)\n",this, iShowCmd);
474 static HRESULT WINAPI IShellLink_GetIconLocation(LPSHELLLINK this, LPSTR pszIconPath,INT32 cchIconPath,INT32 *piIcon)
475 { FIXME(shell,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath, cchIconPath, piIcon);
476 strncpy(pszIconPath,"shell32.dll",cchIconPath);
480 static HRESULT WINAPI IShellLink_SetIconLocation(LPSHELLLINK this, LPCSTR pszIconPath,INT32 iIcon)
481 { FIXME(shell,"(%p)->(path=%s iicon=%u)\n",this, pszIconPath, iIcon);
484 static HRESULT WINAPI IShellLink_SetRelativePath(LPSHELLLINK this, LPCSTR pszPathRel, DWORD dwReserved)
485 { FIXME(shell,"(%p)->(path=%s %lx)\n",this, pszPathRel, dwReserved);
488 static HRESULT WINAPI IShellLink_Resolve(LPSHELLLINK this, HWND32 hwnd, DWORD fFlags)
489 { FIXME(shell,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd, fFlags);
492 static HRESULT WINAPI IShellLink_SetPath(LPSHELLLINK this, LPCSTR pszFile)
493 { FIXME(shell,"(%p)->(path=%s)\n",this, pszFile);
497 /**************************************************************************
498 * IShellLink's IClassFactory implementation
501 static ICOM_VTABLE(IClassFactory) slwcfvt;
503 /**************************************************************************
504 * IShellLinkW_CF_Constructor
507 LPCLASSFACTORY IShellLinkW_CF_Constructor(void)
509 _IClassFactory* lpclf;
511 lpclf= (_IClassFactory*)HeapAlloc(GetProcessHeap(),0,sizeof(_IClassFactory));
513 lpclf->lpvtbl = &slwcfvt;
514 TRACE(shell,"(%p)->()\n",lpclf);
516 return (LPCLASSFACTORY)lpclf;
518 /**************************************************************************
519 * IShellLinkW_CF_QueryInterface
521 static HRESULT WINAPI IShellLinkW_CF_QueryInterface(
522 LPUNKNOWN iface, REFIID riid, LPVOID *ppvObj)
524 ICOM_THIS(IClassFactory,iface);
526 WINE_StringFromCLSID((LPCLSID)riid,xriid);
527 TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
531 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
532 { *ppvObj = (LPUNKNOWN)this;
534 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/
535 { *ppvObj = (LPCLASSFACTORY)this;
539 IUnknown_AddRef((IUnknown*)*ppvObj);
540 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
543 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
544 return E_NOINTERFACE;
546 /******************************************************************************
547 * IShellLinkW_CF_AddRef
549 static ULONG WINAPI IShellLinkW_CF_AddRef(LPUNKNOWN iface)
551 ICOM_THIS(IClassFactory,iface);
552 TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
555 return ++(this->ref);
557 /******************************************************************************
558 * IShellLinkW_CF_Release
560 static ULONG WINAPI IShellLinkW_CF_Release(LPUNKNOWN iface)
562 ICOM_THIS(IClassFactory,iface);
563 TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
567 { TRACE(shell,"-- destroying IClassFactory(%p)\n",this);
568 HeapFree(GetProcessHeap(),0,this);
573 /******************************************************************************
574 * IShellLinkW_CF_CreateInstance
576 static HRESULT WINAPI IShellLinkW_CF_CreateInstance(
577 LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
579 ICOM_THIS(IClassFactory,iface);
580 IUnknown *pObj = NULL;
584 WINE_StringFromCLSID((LPCLSID)riid,xriid);
585 TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown,xriid,ppObject);
590 { return(CLASS_E_NOAGGREGATION);
593 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IShellLinkW))
594 { pObj = (IUnknown *)IShellLinkW_Constructor();
597 { ERR(shell,"unknown IID requested\n\tIID:\t%s\n",xriid);
598 return(E_NOINTERFACE);
602 { return(E_OUTOFMEMORY);
605 hres = pObj->lpvtbl->fnQueryInterface(pObj,riid, ppObject);
606 pObj->lpvtbl->fnRelease(pObj);
607 TRACE(shell,"-- Object created: (%p)->%p\n",this,*ppObject);
611 /******************************************************************************
612 * IShellLinkW_CF_LockServer
615 static HRESULT WINAPI IShellLinkW_CF_LockServer(LPCLASSFACTORY iface, BOOL32 fLock)
617 ICOM_THIS(IClassFactory,iface);
618 TRACE(shell,"%p->(0x%x), not implemented\n",this, fLock);
622 static ICOM_VTABLE(IClassFactory) slwcfvt =
625 IShellLinkW_CF_QueryInterface,
626 IShellLinkW_CF_AddRef,
627 IShellLinkW_CF_Release
629 IShellLinkW_CF_CreateInstance,
630 IShellLinkW_CF_LockServer
633 /* IShellLinkW Implementation */
634 static HRESULT WINAPI IShellLinkW_QueryInterface(LPSHELLLINKW,REFIID,LPVOID*);
635 static ULONG WINAPI IShellLinkW_AddRef(LPSHELLLINKW);
636 static ULONG WINAPI IShellLinkW_Release(LPSHELLLINKW);
637 static HRESULT WINAPI IShellLinkW_GetPath(LPSHELLLINKW, LPWSTR,INT32, WIN32_FIND_DATA32A *, DWORD);
638 static HRESULT WINAPI IShellLinkW_GetIDList(LPSHELLLINKW, LPITEMIDLIST *);
639 static HRESULT WINAPI IShellLinkW_SetIDList(LPSHELLLINKW, LPCITEMIDLIST);
640 static HRESULT WINAPI IShellLinkW_GetDescription(LPSHELLLINKW, LPWSTR,INT32);
641 static HRESULT WINAPI IShellLinkW_SetDescription(LPSHELLLINKW, LPCWSTR);
642 static HRESULT WINAPI IShellLinkW_GetWorkingDirectory(LPSHELLLINKW, LPWSTR,INT32);
643 static HRESULT WINAPI IShellLinkW_SetWorkingDirectory(LPSHELLLINKW, LPCWSTR);
644 static HRESULT WINAPI IShellLinkW_GetArguments(LPSHELLLINKW, LPWSTR,INT32);
645 static HRESULT WINAPI IShellLinkW_SetArguments(LPSHELLLINKW, LPCWSTR);
646 static HRESULT WINAPI IShellLinkW_GetHotkey(LPSHELLLINKW, WORD *);
647 static HRESULT WINAPI IShellLinkW_SetHotkey(LPSHELLLINKW, WORD);
648 static HRESULT WINAPI IShellLinkW_GetShowCmd(LPSHELLLINKW, INT32 *);
649 static HRESULT WINAPI IShellLinkW_SetShowCmd(LPSHELLLINKW, INT32);
650 static HRESULT WINAPI IShellLinkW_GetIconLocation(LPSHELLLINKW, LPWSTR,INT32,INT32 *);
651 static HRESULT WINAPI IShellLinkW_SetIconLocation(LPSHELLLINKW, LPCWSTR,INT32);
652 static HRESULT WINAPI IShellLinkW_SetRelativePath(LPSHELLLINKW, LPCWSTR, DWORD);
653 static HRESULT WINAPI IShellLinkW_Resolve(LPSHELLLINKW, HWND32, DWORD);
654 static HRESULT WINAPI IShellLinkW_SetPath(LPSHELLLINKW, LPCWSTR);
656 /**************************************************************************
657 * IShellLinkW Implementation
660 static struct IShellLinkW_VTable slvtw =
661 { IShellLinkW_QueryInterface,
665 IShellLinkW_GetIDList,
666 IShellLinkW_SetIDList,
667 IShellLinkW_GetDescription,
668 IShellLinkW_SetDescription,
669 IShellLinkW_GetWorkingDirectory,
670 IShellLinkW_SetWorkingDirectory,
671 IShellLinkW_GetArguments,
672 IShellLinkW_SetArguments,
673 IShellLinkW_GetHotkey,
674 IShellLinkW_SetHotkey,
675 IShellLinkW_GetShowCmd,
676 IShellLinkW_SetShowCmd,
677 IShellLinkW_GetIconLocation,
678 IShellLinkW_SetIconLocation,
679 IShellLinkW_SetRelativePath,
684 /**************************************************************************
685 * IShellLinkW_Constructor
687 LPSHELLLINKW IShellLinkW_Constructor(void)
690 sl = (LPSHELLLINKW)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLinkW));
694 sl->lppf = IPersistFile_Constructor();
696 TRACE(shell,"(%p)->()\n",sl);
701 /**************************************************************************
702 * IShellLinkW::QueryInterface
704 static HRESULT WINAPI IShellLinkW_QueryInterface(
705 LPSHELLLINKW this, REFIID riid, LPVOID *ppvObj)
707 WINE_StringFromCLSID((LPCLSID)riid,xriid);
708 TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
712 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
715 else if(IsEqualIID(riid, &IID_IShellLinkW)) /*IShellLinkW*/
716 { *ppvObj = (LPSHELLLINKW)this;
718 else if(IsEqualIID(riid, &IID_IPersistFile)) /*IPersistFile*/
719 { *ppvObj = (LPPERSISTFILE)this->lppf;
723 { (*(LPSHELLLINKW*)ppvObj)->lpvtbl->fnAddRef(this);
724 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
727 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
728 return E_NOINTERFACE;
730 /******************************************************************************
733 static ULONG WINAPI IShellLinkW_AddRef(LPSHELLLINKW this)
734 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
737 return ++(this->ref);
739 /******************************************************************************
740 * IClassFactory_Release
742 static ULONG WINAPI IShellLinkW_Release(LPSHELLLINKW this)
743 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
747 { TRACE(shell,"-- destroying IShellLinkW(%p)\n",this);
748 IPersistFile_Release(this->lppf); /* IPersistFile*/
749 HeapFree(GetProcessHeap(),0,this);
755 static HRESULT WINAPI IShellLinkW_GetPath(LPSHELLLINKW this, LPWSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags)
756 { FIXME(shell,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile, cchMaxPath, pfd, fFlags);
757 lstrcpynAtoW(pszFile,"c:\\foo.bar", cchMaxPath);
760 static HRESULT WINAPI IShellLinkW_GetIDList(LPSHELLLINKW this, LPITEMIDLIST * ppidl)
761 { FIXME(shell,"(%p)->(ppidl=%p)\n",this, ppidl);
762 *ppidl = _ILCreateDesktop();
765 static HRESULT WINAPI IShellLinkW_SetIDList(LPSHELLLINKW this, LPCITEMIDLIST pidl)
766 { FIXME(shell,"(%p)->(pidl=%p)\n",this, pidl);
769 static HRESULT WINAPI IShellLinkW_GetDescription(LPSHELLLINKW this, LPWSTR pszName,INT32 cchMaxName)
770 { FIXME(shell,"(%p)->(%p len=%u)\n",this, pszName, cchMaxName);
771 lstrcpynAtoW(pszName,"Description, FIXME",cchMaxName);
774 static HRESULT WINAPI IShellLinkW_SetDescription(LPSHELLLINKW this, LPCWSTR pszName)
775 { FIXME(shell,"(%p)->(desc=%s)\n",this, debugstr_w(pszName));
778 static HRESULT WINAPI IShellLinkW_GetWorkingDirectory(LPSHELLLINKW this, LPWSTR pszDir,INT32 cchMaxPath)
779 { FIXME(shell,"(%p)->()\n",this);
780 lstrcpynAtoW(pszDir,"c:\\", cchMaxPath);
783 static HRESULT WINAPI IShellLinkW_SetWorkingDirectory(LPSHELLLINKW this, LPCWSTR pszDir)
784 { FIXME(shell,"(%p)->(dir=%s)\n",this, debugstr_w(pszDir));
787 static HRESULT WINAPI IShellLinkW_GetArguments(LPSHELLLINKW this, LPWSTR pszArgs,INT32 cchMaxPath)
788 { FIXME(shell,"(%p)->(%p len=%u)\n",this, pszArgs, cchMaxPath);
789 lstrcpynAtoW(pszArgs, "", cchMaxPath);
792 static HRESULT WINAPI IShellLinkW_SetArguments(LPSHELLLINKW this, LPCWSTR pszArgs)
793 { FIXME(shell,"(%p)->(args=%s)\n",this, debugstr_w(pszArgs));
796 static HRESULT WINAPI IShellLinkW_GetHotkey(LPSHELLLINKW this, WORD *pwHotkey)
797 { FIXME(shell,"(%p)->(%p)\n",this, pwHotkey);
801 static HRESULT WINAPI IShellLinkW_SetHotkey(LPSHELLLINKW this, WORD wHotkey)
802 { FIXME(shell,"(%p)->(hotkey=%x)\n",this, wHotkey);
805 static HRESULT WINAPI IShellLinkW_GetShowCmd(LPSHELLLINKW this, INT32 *piShowCmd)
806 { FIXME(shell,"(%p)->(%p)\n",this, piShowCmd);
810 static HRESULT WINAPI IShellLinkW_SetShowCmd(LPSHELLLINKW this, INT32 iShowCmd)
811 { FIXME(shell,"(%p)->(showcmd=%x)\n",this, iShowCmd);
814 static HRESULT WINAPI IShellLinkW_GetIconLocation(LPSHELLLINKW this, LPWSTR pszIconPath,INT32 cchIconPath,INT32 *piIcon)
815 { FIXME(shell,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath, cchIconPath, piIcon);
816 lstrcpynAtoW(pszIconPath,"shell32.dll",cchIconPath);
820 static HRESULT WINAPI IShellLinkW_SetIconLocation(LPSHELLLINKW this, LPCWSTR pszIconPath,INT32 iIcon)
821 { FIXME(shell,"(%p)->(path=%s iicon=%u)\n",this, debugstr_w(pszIconPath), iIcon);
824 static HRESULT WINAPI IShellLinkW_SetRelativePath(LPSHELLLINKW this, LPCWSTR pszPathRel, DWORD dwReserved)
825 { FIXME(shell,"(%p)->(path=%s %lx)\n",this, debugstr_w(pszPathRel), dwReserved);
828 static HRESULT WINAPI IShellLinkW_Resolve(LPSHELLLINKW this, HWND32 hwnd, DWORD fFlags)
829 { FIXME(shell,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd, fFlags);
832 static HRESULT WINAPI IShellLinkW_SetPath(LPSHELLLINKW this, LPCWSTR pszFile)
833 { FIXME(shell,"(%p)->(path=%s)\n",this, debugstr_w(pszFile));