3 * Copyright 1997 Marcus Meissner
4 * Copyright 1998 Juergen Schmied
9 #include "debugtools.h"
12 #include "wine/obj_base.h"
13 #include "wine/obj_storage.h"
14 #include "wine/obj_shelllink.h"
19 #include "shell32_main.h"
22 DEFAULT_DEBUG_CHANNEL(shell)
24 /* link file formats */
28 /* lnk elements: simple link has 0x0B */
34 #define MAXIMIZED 0x03
35 #define MINIMIZED 0x07
37 typedef struct _LINK_HEADER
38 { DWORD MagicStr; /* 0x00 'L','\0','\0','\0' */
39 GUID MagicGuid; /* 0x04 is CLSID_ShellLink */
40 DWORD Flag1; /* 0x14 describes elements following */
41 DWORD Flag2; /* 0x18 */
42 FILETIME Time1; /* 0x1c */
43 FILETIME Time2; /* 0x24 */
44 FILETIME Time3; /* 0x2c */
45 DWORD Unknown1; /* 0x34 */
46 DWORD Unknown2; /* 0x38 icon number */
47 DWORD Flag3; /* 0x3c startup type */
48 DWORD Unknown4; /* 0x40 hotkey */
49 DWORD Unknown5; /* 0x44 */
50 DWORD Unknown6; /* 0x48 */
51 USHORT PidlSize; /* 0x4c */
52 ITEMIDLIST Pidl; /* 0x4e */
53 } LINK_HEADER, * PLINK_HEADER;
57 /* IPersistFile Implementation */
61 ICOM_VTABLE(IPersistFile)* lpvtbl;
68 static struct ICOM_VTABLE(IPersistFile) pfvt;
71 /**************************************************************************
72 * IPersistFile_Constructor
74 IPersistFileImpl * IPersistFile_Constructor(void)
78 sl = (IPersistFileImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IPersistFileImpl));
84 TRACE("(%p)->()\n",sl);
89 /**************************************************************************
90 * IPersistFile_QueryInterface
92 static HRESULT WINAPI IPersistFile_fnQueryInterface(
93 IPersistFile* iface, REFIID riid, LPVOID *ppvObj)
95 ICOM_THIS(IPersistFileImpl,iface);
98 WINE_StringFromCLSID((LPCLSID)riid,xriid);
99 TRACE("(%p)->(\n\tIID:\t%s)\n",This,xriid);
103 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
106 else if(IsEqualIID(riid, &IID_IPersistFile)) /*IPersistFile*/
107 { *ppvObj = (LPPERSISTFILE)This;
111 { IPersistFile_AddRef((IPersistFile*)*ppvObj);
112 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
115 TRACE("-- Interface: E_NOINTERFACE\n");
116 return E_NOINTERFACE;
118 /******************************************************************************
119 * IPersistFile_AddRef
121 static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile* iface)
123 ICOM_THIS(IPersistFileImpl,iface);
125 TRACE("(%p)->(count=%lu)\n",This,This->ref);
128 return ++(This->ref);
130 /******************************************************************************
131 * IPersistFile_Release
133 static ULONG WINAPI IPersistFile_fnRelease(IPersistFile* iface)
135 ICOM_THIS(IPersistFileImpl,iface);
137 TRACE("(%p)->(count=%lu)\n",This,This->ref);
142 { TRACE("-- destroying IPersistFile(%p)\n",This);
144 HeapFree(GetProcessHeap(),0,This->sPath);
147 HeapFree(GetProcessHeap(),0,This);
153 static HRESULT WINAPI IPersistFile_fnGetClassID(const IPersistFile* iface, CLSID *pClassID)
155 ICOM_CTHIS(IPersistFile,iface);
156 FIXME("(%p)\n",This);
159 static HRESULT WINAPI IPersistFile_fnIsDirty(const IPersistFile* iface)
161 ICOM_CTHIS(IPersistFile,iface);
162 FIXME("(%p)\n",This);
165 static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
167 ICOM_THIS(IPersistFileImpl,iface);
170 LPSTR sFile = HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName);
171 HFILE hFile = OpenFile( sFile, &ofs, OF_READ );
174 HRESULT hRet = E_FAIL;
177 TRACE("(%p)->(%s)\n",This,sFile);
179 HeapFree(GetProcessHeap(),0,sFile);
181 if ( !(hMapping = CreateFileMappingA(hFile,NULL,PAGE_READONLY|SEC_COMMIT,0,0,NULL)))
182 { WARN("failed to create filemap.\n");
186 if ( !(pImage = (PLINK_HEADER) MapViewOfFile(hMapping,FILE_MAP_READ,0,0,0)))
187 { WARN("failed to mmap filemap.\n");
191 if (!( (pImage->MagicStr == 0x0000004CL) && IsEqualIID(&pImage->MagicGuid, &CLSID_ShellLink)))
192 { TRACE("file isn't a lnk\n");
196 { /* for debugging */
198 FileTimeToSystemTime (&pImage->Time1, &time);
199 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&time, NULL, sTemp, 256);
200 TRACE("-- time1: %s\n", sTemp);
202 FileTimeToSystemTime (&pImage->Time2, &time);
203 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&time, NULL, sTemp, 256);
204 TRACE("-- time2: %s\n", sTemp);
206 FileTimeToSystemTime (&pImage->Time3, &time);
207 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&time, NULL, sTemp, 256);
208 TRACE("-- time3: %s\n", sTemp);
209 pdump (&pImage->Pidl);
212 if (!pcheck (&pImage->Pidl))
215 This->pPidl = ILClone (&pImage->Pidl);
217 _ILGetPidlPath(&pImage->Pidl, sTemp, 512);
218 This->sPath = HEAP_strdupA ( GetProcessHeap(), 0, sTemp);
221 end_3: UnmapViewOfFile(pImage);
222 end_2: CloseHandle(hMapping);
223 end_1: _lclose( hFile);
228 static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember)
230 ICOM_THIS(IPersistFileImpl,iface);
231 FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName));
234 static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLESTR pszFileName)
236 ICOM_THIS(IPersistFileImpl,iface);
237 FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName));
240 static HRESULT WINAPI IPersistFile_fnGetCurFile(const IPersistFile* iface, LPOLESTR *ppszFileName)
242 ICOM_CTHIS(IPersistFileImpl,iface);
243 FIXME("(%p)\n",This);
247 static struct ICOM_VTABLE(IPersistFile) pfvt =
249 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
250 IPersistFile_fnQueryInterface,
251 IPersistFile_fnAddRef,
252 IPersistFile_fnRelease,
253 IPersistFile_fnGetClassID,
254 IPersistFile_fnIsDirty,
257 IPersistFile_fnSaveCompleted,
258 IPersistFile_fnGetCurFile
262 /**************************************************************************
263 * IShellLink's IClassFactory implementation
267 /* IUnknown fields */
268 ICOM_VTABLE(IClassFactory)* lpvtbl;
272 static ICOM_VTABLE(IClassFactory) slcfvt;
274 /**************************************************************************
275 * IShellLink_CF_Constructor
278 LPCLASSFACTORY IShellLink_CF_Constructor(void)
280 IClassFactoryImpl* lpclf;
282 lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl));
284 lpclf->lpvtbl = &slcfvt;
285 TRACE("(%p)->()\n",lpclf);
287 return (LPCLASSFACTORY)lpclf;
289 /**************************************************************************
290 * IShellLink_CF_QueryInterface
292 static HRESULT WINAPI IShellLink_CF_QueryInterface(
293 IClassFactory* iface, REFIID riid, LPVOID *ppvObj)
295 ICOM_THIS(IClassFactoryImpl,iface);
297 WINE_StringFromCLSID((LPCLSID)riid,xriid);
298 TRACE("(%p)->(\n\tIID:\t%s)\n",This,xriid);
302 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
303 { *ppvObj = (LPUNKNOWN)This;
305 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/
306 { *ppvObj = (LPCLASSFACTORY)This;
310 { IUnknown_AddRef((IUnknown*)*ppvObj);
311 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
314 TRACE("-- Interface: E_NOINTERFACE\n");
315 return E_NOINTERFACE;
317 /******************************************************************************
318 * IShellLink_CF_AddRef
320 static ULONG WINAPI IShellLink_CF_AddRef(IClassFactory* iface)
322 ICOM_THIS(IClassFactoryImpl,iface);
323 TRACE("(%p)->(count=%lu)\n",This,This->ref);
326 return ++(This->ref);
328 /******************************************************************************
329 * IShellLink_CF_Release
331 static ULONG WINAPI IShellLink_CF_Release(IClassFactory* iface)
333 ICOM_THIS(IClassFactoryImpl,iface);
334 TRACE("(%p)->(count=%lu)\n",This,This->ref);
338 { TRACE("-- destroying IClassFactory(%p)\n",This);
339 HeapFree(GetProcessHeap(),0,This);
344 /******************************************************************************
345 * IShellLink_CF_CreateInstance
347 static HRESULT WINAPI IShellLink_CF_CreateInstance(
348 IClassFactory* iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
350 ICOM_THIS(IClassFactoryImpl,iface);
351 IUnknown *pObj = NULL;
355 WINE_StringFromCLSID((LPCLSID)riid,xriid);
356 TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,xriid,ppObject);
361 { return(CLASS_E_NOAGGREGATION);
364 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IShellLink))
365 { pObj = (IUnknown *)IShellLink_Constructor();
368 { ERR("unknown IID requested\n\tIID:\t%s\n",xriid);
369 return(E_NOINTERFACE);
373 { return(E_OUTOFMEMORY);
376 hres = IUnknown_QueryInterface(pObj,riid, ppObject);
377 IUnknown_Release(pObj);
378 TRACE("-- Object created: (%p)->%p\n",This,*ppObject);
382 /******************************************************************************
383 * IShellLink_CF_LockServer
385 static HRESULT WINAPI IShellLink_CF_LockServer(IClassFactory* iface, BOOL fLock)
387 ICOM_THIS(IClassFactoryImpl,iface);
388 TRACE("%p->(0x%x), not implemented\n",This, fLock);
391 static ICOM_VTABLE(IClassFactory) slcfvt =
393 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
394 IShellLink_CF_QueryInterface,
395 IShellLink_CF_AddRef,
396 IShellLink_CF_Release,
397 IShellLink_CF_CreateInstance,
398 IShellLink_CF_LockServer
401 /**************************************************************************
402 * IShellLink Implementation
407 ICOM_VTABLE(IShellLink)* lpvtbl;
409 IPersistFileImpl* lppf;
413 static ICOM_VTABLE(IShellLink) slvt;
415 /**************************************************************************
416 * IShellLink_Constructor
418 IShellLink * IShellLink_Constructor(void)
419 { IShellLinkImpl * sl;
421 sl = (IShellLinkImpl *)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLinkImpl));
425 sl->lppf = IPersistFile_Constructor();
427 TRACE("(%p)->()\n",sl);
429 return (IShellLink *)sl;
432 /**************************************************************************
433 * IShellLink::QueryInterface
435 static HRESULT WINAPI IShellLink_fnQueryInterface( IShellLink * iface, REFIID riid, LPVOID *ppvObj)
437 ICOM_THIS(IShellLinkImpl, iface);
440 WINE_StringFromCLSID((LPCLSID)riid,xriid);
441 TRACE("(%p)->(\n\tIID:\t%s)\n",This,xriid);
445 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
448 else if(IsEqualIID(riid, &IID_IShellLink)) /*IShellLink*/
449 { *ppvObj = (IShellLink *)This;
451 else if(IsEqualIID(riid, &IID_IPersistFile)) /*IPersistFile*/
452 { *ppvObj = (IPersistFile *)This->lppf;
456 { IShellLink_AddRef((IShellLink*)*ppvObj);
457 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
460 TRACE("-- Interface: E_NOINTERFACE\n");
461 return E_NOINTERFACE;
463 /******************************************************************************
466 static ULONG WINAPI IShellLink_fnAddRef(IShellLink * iface)
468 ICOM_THIS(IShellLinkImpl, iface);
470 TRACE("(%p)->(count=%lu)\n",This,This->ref);
473 return ++(This->ref);
475 /******************************************************************************
478 static ULONG WINAPI IShellLink_fnRelease(IShellLink * iface)
480 ICOM_THIS(IShellLinkImpl, iface);
482 TRACE("(%p)->(count=%lu)\n",This,This->ref);
486 { TRACE("-- destroying IShellLink(%p)\n",This);
487 IPersistFile_Release((IPersistFile*) This->lppf); /* IPersistFile*/
488 HeapFree(GetProcessHeap(),0,This);
494 static HRESULT WINAPI IShellLink_fnGetPath(IShellLink * iface, LPSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags)
496 ICOM_THIS(IShellLinkImpl, iface);
498 TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",This, pszFile, cchMaxPath, pfd, fFlags);
500 strncpy(pszFile,This->lppf->sPath, cchMaxPath);
503 static HRESULT WINAPI IShellLink_fnGetIDList(IShellLink * iface, LPITEMIDLIST * ppidl)
505 ICOM_THIS(IShellLinkImpl, iface);
507 TRACE("(%p)->(ppidl=%p)\n",This, ppidl);
509 *ppidl = ILClone(This->lppf->pPidl);
512 static HRESULT WINAPI IShellLink_fnSetIDList(IShellLink * iface, LPCITEMIDLIST pidl)
514 ICOM_THIS(IShellLinkImpl, iface);
516 TRACE("(%p)->(pidl=%p)\n",This, pidl);
518 if (This->lppf->pPidl)
519 SHFree(This->lppf->pPidl);
520 This->lppf->pPidl = ILClone (pidl);
523 static HRESULT WINAPI IShellLink_fnGetDescription(IShellLink * iface, LPSTR pszName,INT cchMaxName)
525 ICOM_THIS(IShellLinkImpl, iface);
527 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName);
528 strncpy(pszName,"Description, FIXME",cchMaxName);
531 static HRESULT WINAPI IShellLink_fnSetDescription(IShellLink * iface, LPCSTR pszName)
533 ICOM_THIS(IShellLinkImpl, iface);
535 FIXME("(%p)->(desc=%s)\n",This, pszName);
538 static HRESULT WINAPI IShellLink_fnGetWorkingDirectory(IShellLink * iface, LPSTR pszDir,INT cchMaxPath)
540 ICOM_THIS(IShellLinkImpl, iface);
542 FIXME("(%p)->()\n",This);
543 strncpy(pszDir,"c:\\", cchMaxPath);
546 static HRESULT WINAPI IShellLink_fnSetWorkingDirectory(IShellLink * iface, LPCSTR pszDir)
548 ICOM_THIS(IShellLinkImpl, iface);
550 FIXME("(%p)->(dir=%s)\n",This, pszDir);
553 static HRESULT WINAPI IShellLink_fnGetArguments(IShellLink * iface, LPSTR pszArgs,INT cchMaxPath)
555 ICOM_THIS(IShellLinkImpl, iface);
557 FIXME("(%p)->(%p len=%u)\n",This, pszArgs, cchMaxPath);
558 strncpy(pszArgs, "", cchMaxPath);
561 static HRESULT WINAPI IShellLink_fnSetArguments(IShellLink * iface, LPCSTR pszArgs)
563 ICOM_THIS(IShellLinkImpl, iface);
565 FIXME("(%p)->(args=%s)\n",This, pszArgs);
568 static HRESULT WINAPI IShellLink_fnGetHotkey(IShellLink * iface, WORD *pwHotkey)
570 ICOM_THIS(IShellLinkImpl, iface);
572 FIXME("(%p)->(%p) returning 0\n",This, pwHotkey);
576 static HRESULT WINAPI IShellLink_fnSetHotkey(IShellLink * iface, WORD wHotkey)
578 ICOM_THIS(IShellLinkImpl, iface);
580 FIXME("(%p)->(hotkey=%x)\n",This, wHotkey);
583 static HRESULT WINAPI IShellLink_fnGetShowCmd(IShellLink * iface, INT *piShowCmd)
585 ICOM_THIS(IShellLinkImpl, iface);
587 FIXME("(%p)->(%p)\n",This, piShowCmd);
591 static HRESULT WINAPI IShellLink_fnSetShowCmd(IShellLink * iface, INT iShowCmd)
593 ICOM_THIS(IShellLinkImpl, iface);
595 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd);
598 static HRESULT WINAPI IShellLink_fnGetIconLocation(IShellLink * iface, LPSTR pszIconPath,INT cchIconPath,INT *piIcon)
600 ICOM_THIS(IShellLinkImpl, iface);
602 FIXME("(%p)->(%p len=%u iicon=%p)\n",This, pszIconPath, cchIconPath, piIcon);
603 strncpy(pszIconPath,"shell32.dll",cchIconPath);
607 static HRESULT WINAPI IShellLink_fnSetIconLocation(IShellLink * iface, LPCSTR pszIconPath,INT iIcon)
609 ICOM_THIS(IShellLinkImpl, iface);
611 FIXME("(%p)->(path=%s iicon=%u)\n",This, pszIconPath, iIcon);
614 static HRESULT WINAPI IShellLink_fnSetRelativePath(IShellLink * iface, LPCSTR pszPathRel, DWORD dwReserved)
616 ICOM_THIS(IShellLinkImpl, iface);
618 FIXME("(%p)->(path=%s %lx)\n",This, pszPathRel, dwReserved);
621 static HRESULT WINAPI IShellLink_fnResolve(IShellLink * iface, HWND hwnd, DWORD fFlags)
623 ICOM_THIS(IShellLinkImpl, iface);
625 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags);
628 static HRESULT WINAPI IShellLink_fnSetPath(IShellLink * iface, LPCSTR pszFile)
630 ICOM_THIS(IShellLinkImpl, iface);
632 FIXME("(%p)->(path=%s)\n",This, pszFile);
636 /**************************************************************************
637 * IShellLink Implementation
640 static ICOM_VTABLE(IShellLink) slvt =
642 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
643 IShellLink_fnQueryInterface,
645 IShellLink_fnRelease,
646 IShellLink_fnGetPath,
647 IShellLink_fnGetIDList,
648 IShellLink_fnSetIDList,
649 IShellLink_fnGetDescription,
650 IShellLink_fnSetDescription,
651 IShellLink_fnGetWorkingDirectory,
652 IShellLink_fnSetWorkingDirectory,
653 IShellLink_fnGetArguments,
654 IShellLink_fnSetArguments,
655 IShellLink_fnGetHotkey,
656 IShellLink_fnSetHotkey,
657 IShellLink_fnGetShowCmd,
658 IShellLink_fnSetShowCmd,
659 IShellLink_fnGetIconLocation,
660 IShellLink_fnSetIconLocation,
661 IShellLink_fnSetRelativePath,
662 IShellLink_fnResolve,
666 /**************************************************************************
667 * IShellLink's IClassFactory implementation
670 static ICOM_VTABLE(IClassFactory) slwcfvt;
672 /**************************************************************************
673 * IShellLinkW_CF_Constructor
676 LPCLASSFACTORY IShellLinkW_CF_Constructor(void)
678 IClassFactoryImpl* lpclf;
680 lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl));
682 lpclf->lpvtbl = &slwcfvt;
683 TRACE("(%p)->()\n",lpclf);
685 return (LPCLASSFACTORY)lpclf;
687 /**************************************************************************
688 * IShellLinkW_CF_QueryInterface
690 static HRESULT WINAPI IShellLinkW_CF_QueryInterface(
691 LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
693 ICOM_THIS(IClassFactoryImpl,iface);
695 WINE_StringFromCLSID((LPCLSID)riid,xriid);
696 TRACE("(%p)->(\n\tIID:\t%s)\n",This,xriid);
700 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
701 { *ppvObj = (LPUNKNOWN)This;
703 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/
704 { *ppvObj = (LPCLASSFACTORY)This;
708 IUnknown_AddRef((IUnknown*)*ppvObj);
709 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
712 TRACE("-- Interface: E_NOINTERFACE\n");
713 return E_NOINTERFACE;
715 /******************************************************************************
716 * IShellLinkW_CF_AddRef
718 static ULONG WINAPI IShellLinkW_CF_AddRef(LPCLASSFACTORY iface)
720 ICOM_THIS(IClassFactoryImpl,iface);
721 TRACE("(%p)->(count=%lu)\n",This,This->ref);
724 return ++(This->ref);
726 /******************************************************************************
727 * IShellLinkW_CF_Release
729 static ULONG WINAPI IShellLinkW_CF_Release(LPCLASSFACTORY iface)
731 ICOM_THIS(IClassFactoryImpl,iface);
732 TRACE("(%p)->(count=%lu)\n",This,This->ref);
736 { TRACE("-- destroying IClassFactory(%p)\n",This);
737 HeapFree(GetProcessHeap(),0,This);
742 /******************************************************************************
743 * IShellLinkW_CF_CreateInstance
745 static HRESULT WINAPI IShellLinkW_CF_CreateInstance(
746 LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
748 ICOM_THIS(IClassFactoryImpl,iface);
749 IUnknown *pObj = NULL;
753 WINE_StringFromCLSID((LPCLSID)riid,xriid);
754 TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,xriid,ppObject);
759 { return(CLASS_E_NOAGGREGATION);
762 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IShellLinkW))
763 { pObj = (IUnknown *)IShellLinkW_Constructor();
766 { ERR("unknown IID requested\n\tIID:\t%s\n",xriid);
767 return(E_NOINTERFACE);
771 { return(E_OUTOFMEMORY);
774 hres = pObj->lpvtbl->fnQueryInterface(pObj,riid, ppObject);
775 pObj->lpvtbl->fnRelease(pObj);
776 TRACE("-- Object created: (%p)->%p\n",This,*ppObject);
780 /******************************************************************************
781 * IShellLinkW_CF_LockServer
784 static HRESULT WINAPI IShellLinkW_CF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
786 ICOM_THIS(IClassFactoryImpl,iface);
787 TRACE("%p->(0x%x), not implemented\n",This, fLock);
791 static ICOM_VTABLE(IClassFactory) slwcfvt =
793 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
794 IShellLinkW_CF_QueryInterface,
795 IShellLinkW_CF_AddRef,
796 IShellLinkW_CF_Release,
797 IShellLinkW_CF_CreateInstance,
798 IShellLinkW_CF_LockServer
802 /**************************************************************************
803 * IShellLink Implementation
808 ICOM_VTABLE(IShellLinkW)* lpvtbl;
810 IPersistFileImpl* lppf;
814 static ICOM_VTABLE(IShellLinkW) slvtw;
816 /**************************************************************************
817 * IShellLinkW_fnConstructor
819 IShellLinkW * IShellLinkW_Constructor(void)
820 { IShellLinkWImpl* sl;
822 sl = (IShellLinkWImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLinkWImpl));
826 sl->lppf = IPersistFile_Constructor();
828 TRACE("(%p)->()\n",sl);
830 return (IShellLinkW*)sl;
833 /**************************************************************************
834 * IShellLinkW_fnQueryInterface
836 static HRESULT WINAPI IShellLinkW_fnQueryInterface(
837 IShellLinkW * iface, REFIID riid, LPVOID *ppvObj)
839 ICOM_THIS(IShellLinkWImpl, iface);
842 WINE_StringFromCLSID((LPCLSID)riid,xriid);
843 TRACE("(%p)->(\n\tIID:\t%s)\n",This,xriid);
847 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
850 else if(IsEqualIID(riid, &IID_IShellLinkW)) /*IShellLinkW*/
851 { *ppvObj = (IShellLinkW *)This;
853 else if(IsEqualIID(riid, &IID_IPersistFile)) /*IPersistFile*/
854 { *ppvObj = (IPersistFile *)This->lppf;
858 { IShellLink_AddRef((IShellLinkW*)*ppvObj);
859 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
863 TRACE("-- Interface: E_NOINTERFACE\n");
865 return E_NOINTERFACE;
867 /******************************************************************************
868 * IShellLinkW_fnAddRef
870 static ULONG WINAPI IShellLinkW_fnAddRef(IShellLinkW * iface)
872 ICOM_THIS(IShellLinkWImpl, iface);
874 TRACE("(%p)->(count=%lu)\n",This,This->ref);
877 return ++(This->ref);
879 /******************************************************************************
880 * IShellLinkW_fnRelease
883 static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface)
885 ICOM_THIS(IShellLinkWImpl, iface);
887 TRACE("(%p)->(count=%lu)\n",This,This->ref);
891 { TRACE("-- destroying IShellLinkW(%p)\n",This);
892 IPersistFile_Release((IPersistFile*)This->lppf); /* IPersistFile*/
893 HeapFree(GetProcessHeap(),0,This);
899 static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags)
901 ICOM_THIS(IShellLinkWImpl, iface);
903 FIXME("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",This, pszFile, cchMaxPath, pfd, fFlags);
904 lstrcpynAtoW(pszFile,"c:\\foo.bar", cchMaxPath);
908 static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST * ppidl)
910 ICOM_THIS(IShellLinkWImpl, iface);
912 FIXME("(%p)->(ppidl=%p)\n",This, ppidl);
913 *ppidl = _ILCreateDesktop();
917 static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST pidl)
919 ICOM_THIS(IShellLinkWImpl, iface);
921 FIXME("(%p)->(pidl=%p)\n",This, pidl);
925 static HRESULT WINAPI IShellLinkW_fnGetDescription(IShellLinkW * iface, LPWSTR pszName,INT cchMaxName)
927 ICOM_THIS(IShellLinkWImpl, iface);
929 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName);
930 lstrcpynAtoW(pszName,"Description, FIXME",cchMaxName);
934 static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR pszName)
936 ICOM_THIS(IShellLinkWImpl, iface);
938 FIXME("(%p)->(desc=%s)\n",This, debugstr_w(pszName));
942 static HRESULT WINAPI IShellLinkW_fnGetWorkingDirectory(IShellLinkW * iface, LPWSTR pszDir,INT cchMaxPath)
944 ICOM_THIS(IShellLinkWImpl, iface);
946 FIXME("(%p)->()\n",This);
947 lstrcpynAtoW(pszDir,"c:\\", cchMaxPath);
951 static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPCWSTR pszDir)
953 ICOM_THIS(IShellLinkWImpl, iface);
955 FIXME("(%p)->(dir=%s)\n",This, debugstr_w(pszDir));
959 static HRESULT WINAPI IShellLinkW_fnGetArguments(IShellLinkW * iface, LPWSTR pszArgs,INT cchMaxPath)
961 ICOM_THIS(IShellLinkWImpl, iface);
963 FIXME("(%p)->(%p len=%u)\n",This, pszArgs, cchMaxPath);
964 lstrcpynAtoW(pszArgs, "", cchMaxPath);
968 static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR pszArgs)
970 ICOM_THIS(IShellLinkWImpl, iface);
972 FIXME("(%p)->(args=%s)\n",This, debugstr_w(pszArgs));
976 static HRESULT WINAPI IShellLinkW_fnGetHotkey(IShellLinkW * iface, WORD *pwHotkey)
978 ICOM_THIS(IShellLinkWImpl, iface);
980 FIXME("(%p)->(%p)\n",This, pwHotkey);
985 static HRESULT WINAPI IShellLinkW_fnSetHotkey(IShellLinkW * iface, WORD wHotkey)
987 ICOM_THIS(IShellLinkWImpl, iface);
989 FIXME("(%p)->(hotkey=%x)\n",This, wHotkey);
993 static HRESULT WINAPI IShellLinkW_fnGetShowCmd(IShellLinkW * iface, INT *piShowCmd)
995 ICOM_THIS(IShellLinkWImpl, iface);
997 FIXME("(%p)->(%p)\n",This, piShowCmd);
1002 static HRESULT WINAPI IShellLinkW_fnSetShowCmd(IShellLinkW * iface, INT iShowCmd)
1004 ICOM_THIS(IShellLinkWImpl, iface);
1006 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd);
1010 static HRESULT WINAPI IShellLinkW_fnGetIconLocation(IShellLinkW * iface, LPWSTR pszIconPath,INT cchIconPath,INT *piIcon)
1012 ICOM_THIS(IShellLinkWImpl, iface);
1014 FIXME("(%p)->(%p len=%u iicon=%p)\n",This, pszIconPath, cchIconPath, piIcon);
1015 lstrcpynAtoW(pszIconPath,"shell32.dll",cchIconPath);
1020 static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, LPCWSTR pszIconPath,INT iIcon)
1022 ICOM_THIS(IShellLinkWImpl, iface);
1024 FIXME("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon);
1028 static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR pszPathRel, DWORD dwReserved)
1030 ICOM_THIS(IShellLinkWImpl, iface);
1032 FIXME("(%p)->(path=%s %lx)\n",This, debugstr_w(pszPathRel), dwReserved);
1036 static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWORD fFlags)
1038 ICOM_THIS(IShellLinkWImpl, iface);
1040 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags);
1044 static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile)
1046 ICOM_THIS(IShellLinkWImpl, iface);
1048 FIXME("(%p)->(path=%s)\n",This, debugstr_w(pszFile));
1052 /**************************************************************************
1053 * IShellLinkW Implementation
1056 static ICOM_VTABLE(IShellLinkW) slvtw =
1058 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1059 IShellLinkW_fnQueryInterface,
1060 IShellLinkW_fnAddRef,
1061 IShellLinkW_fnRelease,
1062 IShellLinkW_fnGetPath,
1063 IShellLinkW_fnGetIDList,
1064 IShellLinkW_fnSetIDList,
1065 IShellLinkW_fnGetDescription,
1066 IShellLinkW_fnSetDescription,
1067 IShellLinkW_fnGetWorkingDirectory,
1068 IShellLinkW_fnSetWorkingDirectory,
1069 IShellLinkW_fnGetArguments,
1070 IShellLinkW_fnSetArguments,
1071 IShellLinkW_fnGetHotkey,
1072 IShellLinkW_fnSetHotkey,
1073 IShellLinkW_fnGetShowCmd,
1074 IShellLinkW_fnSetShowCmd,
1075 IShellLinkW_fnGetIconLocation,
1076 IShellLinkW_fnSetIconLocation,
1077 IShellLinkW_fnSetRelativePath,
1078 IShellLinkW_fnResolve,
1079 IShellLinkW_fnSetPath