3 * Copyright 1997 Marcus Meissner
4 * Copyright 1998 Juergen Schmied
15 #include "wine/obj_base.h"
16 #include "wine/obj_storage.h"
24 #include "shell32_main.h"
26 /* IPersistFile Implementation */
27 typedef struct _IPersistFile
{
29 ICOM_VTABLE(IPersistFile
)* lpvtbl
;
33 static struct ICOM_VTABLE(IPersistFile
) pfvt
;
36 /**************************************************************************
37 * IPersistFile_Constructor
39 LPPERSISTFILE
IPersistFile_Constructor(void)
43 sl
= (_IPersistFile
*)HeapAlloc(GetProcessHeap(),0,sizeof(_IPersistFile
));
47 TRACE(shell
,"(%p)->()\n",sl
);
48 return (LPPERSISTFILE
)sl
;
51 /**************************************************************************
52 * IPersistFile_QueryInterface
54 static HRESULT WINAPI
IPersistFile_fnQueryInterface(
55 LPUNKNOWN iface
, REFIID riid
, LPVOID
*ppvObj
)
57 ICOM_THIS(IPersistFile
,iface
);
59 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
60 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
64 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
67 else if(IsEqualIID(riid
, &IID_IPersistFile
)) /*IPersistFile*/
68 { *ppvObj
= (LPPERSISTFILE
)this;
72 { IPersistFile_AddRef((IPersistFile
*)*ppvObj
);
73 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
76 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
79 /******************************************************************************
82 static ULONG WINAPI
IPersistFile_fnAddRef(LPUNKNOWN iface
)
84 ICOM_THIS(IPersistFile
,iface
);
85 TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
88 /******************************************************************************
89 * IPersistFile_Release
91 static ULONG WINAPI
IPersistFile_fnRelease(LPUNKNOWN iface
)
93 ICOM_THIS(IPersistFile
,iface
);
94 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
);
176 return (LPCLASSFACTORY
)lpclf
;
178 /**************************************************************************
179 * IShellLink_CF_QueryInterface
181 static HRESULT WINAPI
IShellLink_CF_QueryInterface(
182 LPUNKNOWN iface
, REFIID riid
, LPVOID
*ppvObj
)
184 ICOM_THIS(IClassFactory
,iface
);
186 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
187 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
191 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
192 { *ppvObj
= (LPUNKNOWN
)this;
194 else if(IsEqualIID(riid
, &IID_IClassFactory
)) /*IClassFactory*/
195 { *ppvObj
= (LPCLASSFACTORY
)this;
199 { IUnknown_AddRef((IUnknown
*)*ppvObj
);
200 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
203 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
204 return E_NOINTERFACE
;
206 /******************************************************************************
207 * IShellLink_CF_AddRef
209 static ULONG WINAPI
IShellLink_CF_AddRef(LPUNKNOWN iface
)
211 ICOM_THIS(IClassFactory
,iface
);
212 TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
213 return ++(this->ref
);
215 /******************************************************************************
216 * IShellLink_CF_Release
218 static ULONG WINAPI
IShellLink_CF_Release(LPUNKNOWN iface
)
220 ICOM_THIS(IClassFactory
,iface
);
221 TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
223 { TRACE(shell
,"-- destroying IClassFactory(%p)\n",this);
224 HeapFree(GetProcessHeap(),0,this);
229 /******************************************************************************
230 * IShellLink_CF_CreateInstance
232 static HRESULT WINAPI
IShellLink_CF_CreateInstance(
233 LPCLASSFACTORY iface
, LPUNKNOWN pUnknown
, REFIID riid
, LPVOID
*ppObject
)
235 ICOM_THIS(IClassFactory
,iface
);
236 IUnknown
*pObj
= NULL
;
240 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
241 TRACE(shell
,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown
,xriid
,ppObject
);
246 { return(CLASS_E_NOAGGREGATION
);
249 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IShellLink
))
250 { pObj
= (IUnknown
*)IShellLink_Constructor();
253 { ERR(shell
,"unknown IID requested\n\tIID:\t%s\n",xriid
);
254 return(E_NOINTERFACE
);
258 { return(E_OUTOFMEMORY
);
261 hres
= IUnknown_QueryInterface(pObj
,riid
, ppObject
);
262 IUnknown_Release(pObj
);
263 TRACE(shell
,"-- Object created: (%p)->%p\n",this,*ppObject
);
267 /******************************************************************************
268 * IShellLink_CF_LockServer
270 static HRESULT WINAPI
IShellLink_CF_LockServer(LPCLASSFACTORY iface
, BOOL32 fLock
)
272 ICOM_THIS(IClassFactory
,iface
);
273 TRACE(shell
,"%p->(0x%x), not implemented\n",this, fLock
);
276 static ICOM_VTABLE(IClassFactory
) slcfvt
=
279 IShellLink_CF_QueryInterface
,
280 IShellLink_CF_AddRef
,
281 IShellLink_CF_Release
283 IShellLink_CF_CreateInstance
,
284 IShellLink_CF_LockServer
287 /* IShellLink Implementation */
288 static HRESULT WINAPI
IShellLink_QueryInterface(LPSHELLLINK
,REFIID
,LPVOID
*);
289 static ULONG WINAPI
IShellLink_AddRef(LPSHELLLINK
);
290 static ULONG WINAPI
IShellLink_Release(LPSHELLLINK
);
291 static HRESULT WINAPI
IShellLink_GetPath(LPSHELLLINK
, LPSTR
,INT32
, WIN32_FIND_DATA32A
*, DWORD
);
292 static HRESULT WINAPI
IShellLink_GetIDList(LPSHELLLINK
, LPITEMIDLIST
*);
293 static HRESULT WINAPI
IShellLink_SetIDList(LPSHELLLINK
, LPCITEMIDLIST
);
294 static HRESULT WINAPI
IShellLink_GetDescription(LPSHELLLINK
, LPSTR
,INT32
);
295 static HRESULT WINAPI
IShellLink_SetDescription(LPSHELLLINK
, LPCSTR
);
296 static HRESULT WINAPI
IShellLink_GetWorkingDirectory(LPSHELLLINK
, LPSTR
,INT32
);
297 static HRESULT WINAPI
IShellLink_SetWorkingDirectory(LPSHELLLINK
, LPCSTR
);
298 static HRESULT WINAPI
IShellLink_GetArguments(LPSHELLLINK
, LPSTR
,INT32
);
299 static HRESULT WINAPI
IShellLink_SetArguments(LPSHELLLINK
, LPCSTR
);
300 static HRESULT WINAPI
IShellLink_GetHotkey(LPSHELLLINK
, WORD
*);
301 static HRESULT WINAPI
IShellLink_SetHotkey(LPSHELLLINK
, WORD
);
302 static HRESULT WINAPI
IShellLink_GetShowCmd(LPSHELLLINK
, INT32
*);
303 static HRESULT WINAPI
IShellLink_SetShowCmd(LPSHELLLINK
, INT32
);
304 static HRESULT WINAPI
IShellLink_GetIconLocation(LPSHELLLINK
, LPSTR
,INT32
,INT32
*);
305 static HRESULT WINAPI
IShellLink_SetIconLocation(LPSHELLLINK
, LPCSTR
,INT32
);
306 static HRESULT WINAPI
IShellLink_SetRelativePath(LPSHELLLINK
, LPCSTR
, DWORD
);
307 static HRESULT WINAPI
IShellLink_Resolve(LPSHELLLINK
, HWND32
, DWORD
);
308 static HRESULT WINAPI
IShellLink_SetPath(LPSHELLLINK
, LPCSTR
);
310 /**************************************************************************
311 * IShellLink Implementation
315 static struct IShellLink_VTable slvt
=
316 { IShellLink_QueryInterface
,
320 IShellLink_GetIDList
,
321 IShellLink_SetIDList
,
322 IShellLink_GetDescription
,
323 IShellLink_SetDescription
,
324 IShellLink_GetWorkingDirectory
,
325 IShellLink_SetWorkingDirectory
,
326 IShellLink_GetArguments
,
327 IShellLink_SetArguments
,
328 IShellLink_GetHotkey
,
329 IShellLink_SetHotkey
,
330 IShellLink_GetShowCmd
,
331 IShellLink_SetShowCmd
,
332 IShellLink_GetIconLocation
,
333 IShellLink_SetIconLocation
,
334 IShellLink_SetRelativePath
,
339 /**************************************************************************
340 * IShellLink_Constructor
342 LPSHELLLINK
IShellLink_Constructor(void)
345 sl
= (LPSHELLLINK
)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLink
));
349 sl
->lppf
= IPersistFile_Constructor();
351 TRACE(shell
,"(%p)->()\n",sl
);
355 /**************************************************************************
356 * IShellLink::QueryInterface
358 static HRESULT WINAPI
IShellLink_QueryInterface(
359 LPSHELLLINK
this, REFIID riid
, LPVOID
*ppvObj
)
361 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
362 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
366 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
369 else if(IsEqualIID(riid
, &IID_IShellLink
)) /*IShellLink*/
370 { *ppvObj
= (LPSHELLLINK
)this;
372 else if(IsEqualIID(riid
, &IID_IPersistFile
)) /*IPersistFile*/
373 { *ppvObj
= (LPPERSISTFILE
)this->lppf
;
377 { (*(LPSHELLLINK
*)ppvObj
)->lpvtbl
->fnAddRef(this);
378 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
381 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
382 return E_NOINTERFACE
;
384 /******************************************************************************
387 static ULONG WINAPI
IShellLink_AddRef(LPSHELLLINK
this)
388 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
389 return ++(this->ref
);
391 /******************************************************************************
394 static ULONG WINAPI
IShellLink_Release(LPSHELLLINK
this)
395 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
397 { TRACE(shell
,"-- destroying IShellLink(%p)\n",this);
398 IPersistFile_Release(this->lppf
); /* IPersistFile*/
399 HeapFree(GetProcessHeap(),0,this);
405 static HRESULT WINAPI
IShellLink_GetPath(LPSHELLLINK
this, LPSTR pszFile
,INT32 cchMaxPath
, WIN32_FIND_DATA32A
*pfd
, DWORD fFlags
)
406 { FIXME(shell
,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile
, cchMaxPath
, pfd
, fFlags
);
407 strncpy(pszFile
,"c:\\foo.bar", cchMaxPath
);
410 static HRESULT WINAPI
IShellLink_GetIDList(LPSHELLLINK
this, LPITEMIDLIST
* ppidl
)
411 { FIXME(shell
,"(%p)->(ppidl=%p)\n",this, ppidl
);
412 *ppidl
= _ILCreateDesktop();
415 static HRESULT WINAPI
IShellLink_SetIDList(LPSHELLLINK
this, LPCITEMIDLIST pidl
)
416 { FIXME(shell
,"(%p)->(pidl=%p)\n",this, pidl
);
419 static HRESULT WINAPI
IShellLink_GetDescription(LPSHELLLINK
this, LPSTR pszName
,INT32 cchMaxName
)
420 { FIXME(shell
,"(%p)->(%p len=%u)\n",this, pszName
, cchMaxName
);
421 strncpy(pszName
,"Description, FIXME",cchMaxName
);
424 static HRESULT WINAPI
IShellLink_SetDescription(LPSHELLLINK
this, LPCSTR pszName
)
425 { FIXME(shell
,"(%p)->(desc=%s)\n",this, pszName
);
428 static HRESULT WINAPI
IShellLink_GetWorkingDirectory(LPSHELLLINK
this, LPSTR pszDir
,INT32 cchMaxPath
)
429 { FIXME(shell
,"(%p)->()\n",this);
430 strncpy(pszDir
,"c:\\", cchMaxPath
);
433 static HRESULT WINAPI
IShellLink_SetWorkingDirectory(LPSHELLLINK
this, LPCSTR pszDir
)
434 { FIXME(shell
,"(%p)->(dir=%s)\n",this, pszDir
);
437 static HRESULT WINAPI
IShellLink_GetArguments(LPSHELLLINK
this, LPSTR pszArgs
,INT32 cchMaxPath
)
438 { FIXME(shell
,"(%p)->(%p len=%u)\n",this, pszArgs
, cchMaxPath
);
439 strncpy(pszArgs
, "", cchMaxPath
);
442 static HRESULT WINAPI
IShellLink_SetArguments(LPSHELLLINK
this, LPCSTR pszArgs
)
443 { FIXME(shell
,"(%p)->(args=%s)\n",this, pszArgs
);
446 static HRESULT WINAPI
IShellLink_GetHotkey(LPSHELLLINK
this, WORD
*pwHotkey
)
447 { FIXME(shell
,"(%p)->(%p)\n",this, pwHotkey
);
451 static HRESULT WINAPI
IShellLink_SetHotkey(LPSHELLLINK
this, WORD wHotkey
)
452 { FIXME(shell
,"(%p)->(hotkey=%x)\n",this, wHotkey
);
455 static HRESULT WINAPI
IShellLink_GetShowCmd(LPSHELLLINK
this, INT32
*piShowCmd
)
456 { FIXME(shell
,"(%p)->(%p)\n",this, piShowCmd
);
460 static HRESULT WINAPI
IShellLink_SetShowCmd(LPSHELLLINK
this, INT32 iShowCmd
)
461 { FIXME(shell
,"(%p)->(showcmd=%x)\n",this, iShowCmd
);
464 static HRESULT WINAPI
IShellLink_GetIconLocation(LPSHELLLINK
this, LPSTR pszIconPath
,INT32 cchIconPath
,INT32
*piIcon
)
465 { FIXME(shell
,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath
, cchIconPath
, piIcon
);
466 strncpy(pszIconPath
,"shell32.dll",cchIconPath
);
470 static HRESULT WINAPI
IShellLink_SetIconLocation(LPSHELLLINK
this, LPCSTR pszIconPath
,INT32 iIcon
)
471 { FIXME(shell
,"(%p)->(path=%s iicon=%u)\n",this, pszIconPath
, iIcon
);
474 static HRESULT WINAPI
IShellLink_SetRelativePath(LPSHELLLINK
this, LPCSTR pszPathRel
, DWORD dwReserved
)
475 { FIXME(shell
,"(%p)->(path=%s %lx)\n",this, pszPathRel
, dwReserved
);
478 static HRESULT WINAPI
IShellLink_Resolve(LPSHELLLINK
this, HWND32 hwnd
, DWORD fFlags
)
479 { FIXME(shell
,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd
, fFlags
);
482 static HRESULT WINAPI
IShellLink_SetPath(LPSHELLLINK
this, LPCSTR pszFile
)
483 { FIXME(shell
,"(%p)->(path=%s)\n",this, pszFile
);
487 /**************************************************************************
488 * IShellLink's IClassFactory implementation
491 static ICOM_VTABLE(IClassFactory
) slwcfvt
;
493 /**************************************************************************
494 * IShellLinkW_CF_Constructor
497 LPCLASSFACTORY
IShellLinkW_CF_Constructor(void)
499 _IClassFactory
* lpclf
;
501 lpclf
= (_IClassFactory
*)HeapAlloc(GetProcessHeap(),0,sizeof(_IClassFactory
));
503 lpclf
->lpvtbl
= &slwcfvt
;
504 TRACE(shell
,"(%p)->()\n",lpclf
);
505 return (LPCLASSFACTORY
)lpclf
;
507 /**************************************************************************
508 * IShellLinkW_CF_QueryInterface
510 static HRESULT WINAPI
IShellLinkW_CF_QueryInterface(
511 LPUNKNOWN iface
, REFIID riid
, LPVOID
*ppvObj
)
513 ICOM_THIS(IClassFactory
,iface
);
515 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
516 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
520 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
521 { *ppvObj
= (LPUNKNOWN
)this;
523 else if(IsEqualIID(riid
, &IID_IClassFactory
)) /*IClassFactory*/
524 { *ppvObj
= (LPCLASSFACTORY
)this;
528 IUnknown_AddRef((IUnknown
*)*ppvObj
);
529 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
532 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
533 return E_NOINTERFACE
;
535 /******************************************************************************
536 * IShellLinkW_CF_AddRef
538 static ULONG WINAPI
IShellLinkW_CF_AddRef(LPUNKNOWN iface
)
540 ICOM_THIS(IClassFactory
,iface
);
541 TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
542 return ++(this->ref
);
544 /******************************************************************************
545 * IShellLinkW_CF_Release
547 static ULONG WINAPI
IShellLinkW_CF_Release(LPUNKNOWN iface
)
549 ICOM_THIS(IClassFactory
,iface
);
550 TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
552 { TRACE(shell
,"-- destroying IClassFactory(%p)\n",this);
553 HeapFree(GetProcessHeap(),0,this);
558 /******************************************************************************
559 * IShellLinkW_CF_CreateInstance
561 static HRESULT WINAPI
IShellLinkW_CF_CreateInstance(
562 LPCLASSFACTORY iface
, LPUNKNOWN pUnknown
, REFIID riid
, LPVOID
*ppObject
)
564 ICOM_THIS(IClassFactory
,iface
);
565 IUnknown
*pObj
= NULL
;
569 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
570 TRACE(shell
,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown
,xriid
,ppObject
);
575 { return(CLASS_E_NOAGGREGATION
);
578 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IShellLinkW
))
579 { pObj
= (IUnknown
*)IShellLinkW_Constructor();
582 { ERR(shell
,"unknown IID requested\n\tIID:\t%s\n",xriid
);
583 return(E_NOINTERFACE
);
587 { return(E_OUTOFMEMORY
);
590 hres
= pObj
->lpvtbl
->fnQueryInterface(pObj
,riid
, ppObject
);
591 pObj
->lpvtbl
->fnRelease(pObj
);
592 TRACE(shell
,"-- Object created: (%p)->%p\n",this,*ppObject
);
596 /******************************************************************************
597 * IShellLinkW_CF_LockServer
600 static HRESULT WINAPI
IShellLinkW_CF_LockServer(LPCLASSFACTORY iface
, BOOL32 fLock
)
602 ICOM_THIS(IClassFactory
,iface
);
603 TRACE(shell
,"%p->(0x%x), not implemented\n",this, fLock
);
607 static ICOM_VTABLE(IClassFactory
) slwcfvt
=
610 IShellLinkW_CF_QueryInterface
,
611 IShellLinkW_CF_AddRef
,
612 IShellLinkW_CF_Release
614 IShellLinkW_CF_CreateInstance
,
615 IShellLinkW_CF_LockServer
618 /* IShellLinkW Implementation */
619 static HRESULT WINAPI
IShellLinkW_QueryInterface(LPSHELLLINKW
,REFIID
,LPVOID
*);
620 static ULONG WINAPI
IShellLinkW_AddRef(LPSHELLLINKW
);
621 static ULONG WINAPI
IShellLinkW_Release(LPSHELLLINKW
);
622 static HRESULT WINAPI
IShellLinkW_GetPath(LPSHELLLINKW
, LPWSTR
,INT32
, WIN32_FIND_DATA32A
*, DWORD
);
623 static HRESULT WINAPI
IShellLinkW_GetIDList(LPSHELLLINKW
, LPITEMIDLIST
*);
624 static HRESULT WINAPI
IShellLinkW_SetIDList(LPSHELLLINKW
, LPCITEMIDLIST
);
625 static HRESULT WINAPI
IShellLinkW_GetDescription(LPSHELLLINKW
, LPWSTR
,INT32
);
626 static HRESULT WINAPI
IShellLinkW_SetDescription(LPSHELLLINKW
, LPCWSTR
);
627 static HRESULT WINAPI
IShellLinkW_GetWorkingDirectory(LPSHELLLINKW
, LPWSTR
,INT32
);
628 static HRESULT WINAPI
IShellLinkW_SetWorkingDirectory(LPSHELLLINKW
, LPCWSTR
);
629 static HRESULT WINAPI
IShellLinkW_GetArguments(LPSHELLLINKW
, LPWSTR
,INT32
);
630 static HRESULT WINAPI
IShellLinkW_SetArguments(LPSHELLLINKW
, LPCWSTR
);
631 static HRESULT WINAPI
IShellLinkW_GetHotkey(LPSHELLLINKW
, WORD
*);
632 static HRESULT WINAPI
IShellLinkW_SetHotkey(LPSHELLLINKW
, WORD
);
633 static HRESULT WINAPI
IShellLinkW_GetShowCmd(LPSHELLLINKW
, INT32
*);
634 static HRESULT WINAPI
IShellLinkW_SetShowCmd(LPSHELLLINKW
, INT32
);
635 static HRESULT WINAPI
IShellLinkW_GetIconLocation(LPSHELLLINKW
, LPWSTR
,INT32
,INT32
*);
636 static HRESULT WINAPI
IShellLinkW_SetIconLocation(LPSHELLLINKW
, LPCWSTR
,INT32
);
637 static HRESULT WINAPI
IShellLinkW_SetRelativePath(LPSHELLLINKW
, LPCWSTR
, DWORD
);
638 static HRESULT WINAPI
IShellLinkW_Resolve(LPSHELLLINKW
, HWND32
, DWORD
);
639 static HRESULT WINAPI
IShellLinkW_SetPath(LPSHELLLINKW
, LPCWSTR
);
641 /**************************************************************************
642 * IShellLinkW Implementation
645 static struct IShellLinkW_VTable slvtw
=
646 { IShellLinkW_QueryInterface
,
650 IShellLinkW_GetIDList
,
651 IShellLinkW_SetIDList
,
652 IShellLinkW_GetDescription
,
653 IShellLinkW_SetDescription
,
654 IShellLinkW_GetWorkingDirectory
,
655 IShellLinkW_SetWorkingDirectory
,
656 IShellLinkW_GetArguments
,
657 IShellLinkW_SetArguments
,
658 IShellLinkW_GetHotkey
,
659 IShellLinkW_SetHotkey
,
660 IShellLinkW_GetShowCmd
,
661 IShellLinkW_SetShowCmd
,
662 IShellLinkW_GetIconLocation
,
663 IShellLinkW_SetIconLocation
,
664 IShellLinkW_SetRelativePath
,
669 /**************************************************************************
670 * IShellLinkW_Constructor
672 LPSHELLLINKW
IShellLinkW_Constructor(void)
675 sl
= (LPSHELLLINKW
)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLinkW
));
679 sl
->lppf
= IPersistFile_Constructor();
681 TRACE(shell
,"(%p)->()\n",sl
);
685 /**************************************************************************
686 * IShellLinkW::QueryInterface
688 static HRESULT WINAPI
IShellLinkW_QueryInterface(
689 LPSHELLLINKW
this, REFIID riid
, LPVOID
*ppvObj
)
691 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
692 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
696 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
699 else if(IsEqualIID(riid
, &IID_IShellLinkW
)) /*IShellLinkW*/
700 { *ppvObj
= (LPSHELLLINKW
)this;
702 else if(IsEqualIID(riid
, &IID_IPersistFile
)) /*IPersistFile*/
703 { *ppvObj
= (LPPERSISTFILE
)this->lppf
;
707 { (*(LPSHELLLINKW
*)ppvObj
)->lpvtbl
->fnAddRef(this);
708 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
711 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
712 return E_NOINTERFACE
;
714 /******************************************************************************
717 static ULONG WINAPI
IShellLinkW_AddRef(LPSHELLLINKW
this)
718 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
719 return ++(this->ref
);
721 /******************************************************************************
722 * IClassFactory_Release
724 static ULONG WINAPI
IShellLinkW_Release(LPSHELLLINKW
this)
725 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
727 { TRACE(shell
,"-- destroying IShellLinkW(%p)\n",this);
728 IPersistFile_Release(this->lppf
); /* IPersistFile*/
729 HeapFree(GetProcessHeap(),0,this);
735 static HRESULT WINAPI
IShellLinkW_GetPath(LPSHELLLINKW
this, LPWSTR pszFile
,INT32 cchMaxPath
, WIN32_FIND_DATA32A
*pfd
, DWORD fFlags
)
736 { FIXME(shell
,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile
, cchMaxPath
, pfd
, fFlags
);
737 lstrcpynAtoW(pszFile
,"c:\\foo.bar", cchMaxPath
);
740 static HRESULT WINAPI
IShellLinkW_GetIDList(LPSHELLLINKW
this, LPITEMIDLIST
* ppidl
)
741 { FIXME(shell
,"(%p)->(ppidl=%p)\n",this, ppidl
);
742 *ppidl
= _ILCreateDesktop();
745 static HRESULT WINAPI
IShellLinkW_SetIDList(LPSHELLLINKW
this, LPCITEMIDLIST pidl
)
746 { FIXME(shell
,"(%p)->(pidl=%p)\n",this, pidl
);
749 static HRESULT WINAPI
IShellLinkW_GetDescription(LPSHELLLINKW
this, LPWSTR pszName
,INT32 cchMaxName
)
750 { FIXME(shell
,"(%p)->(%p len=%u)\n",this, pszName
, cchMaxName
);
751 lstrcpynAtoW(pszName
,"Description, FIXME",cchMaxName
);
754 static HRESULT WINAPI
IShellLinkW_SetDescription(LPSHELLLINKW
this, LPCWSTR pszName
)
755 { FIXME(shell
,"(%p)->(desc=%s)\n",this, debugstr_w(pszName
));
758 static HRESULT WINAPI
IShellLinkW_GetWorkingDirectory(LPSHELLLINKW
this, LPWSTR pszDir
,INT32 cchMaxPath
)
759 { FIXME(shell
,"(%p)->()\n",this);
760 lstrcpynAtoW(pszDir
,"c:\\", cchMaxPath
);
763 static HRESULT WINAPI
IShellLinkW_SetWorkingDirectory(LPSHELLLINKW
this, LPCWSTR pszDir
)
764 { FIXME(shell
,"(%p)->(dir=%s)\n",this, debugstr_w(pszDir
));
767 static HRESULT WINAPI
IShellLinkW_GetArguments(LPSHELLLINKW
this, LPWSTR pszArgs
,INT32 cchMaxPath
)
768 { FIXME(shell
,"(%p)->(%p len=%u)\n",this, pszArgs
, cchMaxPath
);
769 lstrcpynAtoW(pszArgs
, "", cchMaxPath
);
772 static HRESULT WINAPI
IShellLinkW_SetArguments(LPSHELLLINKW
this, LPCWSTR pszArgs
)
773 { FIXME(shell
,"(%p)->(args=%s)\n",this, debugstr_w(pszArgs
));
776 static HRESULT WINAPI
IShellLinkW_GetHotkey(LPSHELLLINKW
this, WORD
*pwHotkey
)
777 { FIXME(shell
,"(%p)->(%p)\n",this, pwHotkey
);
781 static HRESULT WINAPI
IShellLinkW_SetHotkey(LPSHELLLINKW
this, WORD wHotkey
)
782 { FIXME(shell
,"(%p)->(hotkey=%x)\n",this, wHotkey
);
785 static HRESULT WINAPI
IShellLinkW_GetShowCmd(LPSHELLLINKW
this, INT32
*piShowCmd
)
786 { FIXME(shell
,"(%p)->(%p)\n",this, piShowCmd
);
790 static HRESULT WINAPI
IShellLinkW_SetShowCmd(LPSHELLLINKW
this, INT32 iShowCmd
)
791 { FIXME(shell
,"(%p)->(showcmd=%x)\n",this, iShowCmd
);
794 static HRESULT WINAPI
IShellLinkW_GetIconLocation(LPSHELLLINKW
this, LPWSTR pszIconPath
,INT32 cchIconPath
,INT32
*piIcon
)
795 { FIXME(shell
,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath
, cchIconPath
, piIcon
);
796 lstrcpynAtoW(pszIconPath
,"shell32.dll",cchIconPath
);
800 static HRESULT WINAPI
IShellLinkW_SetIconLocation(LPSHELLLINKW
this, LPCWSTR pszIconPath
,INT32 iIcon
)
801 { FIXME(shell
,"(%p)->(path=%s iicon=%u)\n",this, debugstr_w(pszIconPath
), iIcon
);
804 static HRESULT WINAPI
IShellLinkW_SetRelativePath(LPSHELLLINKW
this, LPCWSTR pszPathRel
, DWORD dwReserved
)
805 { FIXME(shell
,"(%p)->(path=%s %lx)\n",this, debugstr_w(pszPathRel
), dwReserved
);
808 static HRESULT WINAPI
IShellLinkW_Resolve(LPSHELLLINKW
this, HWND32 hwnd
, DWORD fFlags
)
809 { FIXME(shell
,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd
, fFlags
);
812 static HRESULT WINAPI
IShellLinkW_SetPath(LPSHELLLINKW
this, LPCWSTR pszFile
)
813 { FIXME(shell
,"(%p)->(path=%s)\n",this, debugstr_w(pszFile
));