3 * Copyright 1997 Marcus Meissner
4 * Copyright 1998 Juergen Schmied
15 #include "interfaces.h"
24 #include "shell32_main.h"
26 /* IPersistFile Implementation */
27 static HRESULT WINAPI
IPersistFile_QueryInterface(LPPERSISTFILE
this, REFIID riid
, LPVOID
* ppvObj
);
28 static ULONG WINAPI
IPersistFile_AddRef(LPPERSISTFILE
this);
29 static ULONG WINAPI
IPersistFile_Release(LPPERSISTFILE
this);
31 static HRESULT WINAPI
IPersistFile_GetClassID (LPPERSISTFILE
this, CLSID
*pClassID
);
32 static HRESULT WINAPI
IPersistFile_IsDirty (LPPERSISTFILE
this);
33 static HRESULT WINAPI
IPersistFile_Load (LPPERSISTFILE
this, LPCOLESTR32 pszFileName
, DWORD dwMode
);
34 static HRESULT WINAPI
IPersistFile_Save (LPPERSISTFILE
this, LPCOLESTR32 pszFileName
, BOOL32 fRemember
);
35 static HRESULT WINAPI
IPersistFile_SaveCompleted (LPPERSISTFILE
this, LPCOLESTR32 pszFileName
);
36 static HRESULT WINAPI
IPersistFile_GetCurFile (LPPERSISTFILE
this, LPOLESTR32
*ppszFileName
);
38 static struct IPersistFile_VTable pfvt
=
39 { IPersistFile_QueryInterface
,
42 IPersistFile_GetClassID
,
46 IPersistFile_SaveCompleted
,
47 IPersistFile_GetCurFile
49 /**************************************************************************
50 * IPersistFile_Constructor
52 LPPERSISTFILE
IPersistFile_Constructor(void)
55 sl
= (LPPERSISTFILE
)HeapAlloc(GetProcessHeap(),0,sizeof(IPersistFile
));
59 TRACE(shell
,"(%p)->()\n",sl
);
63 /**************************************************************************
64 * IPersistFile_QueryInterface
66 static HRESULT WINAPI
IPersistFile_QueryInterface(
67 LPPERSISTFILE
this, REFIID riid
, LPVOID
*ppvObj
)
69 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
70 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
74 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
77 else if(IsEqualIID(riid
, &IID_IPersistFile
)) /*IPersistFile*/
78 { *ppvObj
= (LPPERSISTFILE
)this;
82 { (*(LPPERSISTFILE
*)ppvObj
)->lpvtbl
->fnAddRef(this);
83 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
86 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
89 /******************************************************************************
92 static ULONG WINAPI
IPersistFile_AddRef(LPPERSISTFILE
this)
93 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
96 /******************************************************************************
97 * IPersistFile_Release
99 static ULONG WINAPI
IPersistFile_Release(LPPERSISTFILE
this)
100 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
102 { TRACE(shell
,"-- destroying IPersistFile(%p)\n",this);
103 HeapFree(GetProcessHeap(),0,this);
109 static HRESULT WINAPI
IPersistFile_GetClassID (LPPERSISTFILE
this, CLSID
*pClassID
)
110 { FIXME(shell
,"(%p)\n",this);
113 static HRESULT WINAPI
IPersistFile_IsDirty (LPPERSISTFILE
this)
114 { FIXME(shell
,"(%p)\n",this);
117 static HRESULT WINAPI
IPersistFile_Load (LPPERSISTFILE
this, LPCOLESTR32 pszFileName
, DWORD dwMode
)
118 { FIXME(shell
,"(%p)\n",this);
121 static HRESULT WINAPI
IPersistFile_Save (LPPERSISTFILE
this, LPCOLESTR32 pszFileName
, BOOL32 fRemember
)
122 { FIXME(shell
,"(%p)\n",this);
125 static HRESULT WINAPI
IPersistFile_SaveCompleted (LPPERSISTFILE
this, LPCOLESTR32 pszFileName
)
126 { FIXME(shell
,"(%p)\n",this);
129 static HRESULT WINAPI
IPersistFile_GetCurFile (LPPERSISTFILE
this, LPOLESTR32
*ppszFileName
)
130 { FIXME(shell
,"(%p)\n",this);
135 /**************************************************************************
136 * IClassFactory Implementation
138 static HRESULT WINAPI
IShellLink_CF_QueryInterface(LPCLASSFACTORY
,REFIID
,LPVOID
*);
139 static ULONG WINAPI
IShellLink_CF_AddRef(LPCLASSFACTORY
);
140 static ULONG WINAPI
IShellLink_CF_Release(LPCLASSFACTORY
);
141 static HRESULT WINAPI
IShellLink_CF_CreateInstance(LPCLASSFACTORY
, LPUNKNOWN
, REFIID
, LPVOID
*);
142 static HRESULT WINAPI
IShellLink_CF_LockServer(LPCLASSFACTORY
, BOOL32
);
143 /**************************************************************************
144 * IShellLink_CF_VTable
146 static IClassFactory_VTable slcfvt
=
147 { IShellLink_CF_QueryInterface
,
148 IShellLink_CF_AddRef
,
149 IShellLink_CF_Release
,
150 IShellLink_CF_CreateInstance
,
151 IShellLink_CF_LockServer
154 /**************************************************************************
155 * IShellLink_CF_Constructor
158 LPCLASSFACTORY
IShellLink_CF_Constructor(void)
159 { LPCLASSFACTORY lpclf
;
161 lpclf
= (LPCLASSFACTORY
)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactory
));
163 lpclf
->lpvtbl
= &slcfvt
;
164 TRACE(shell
,"(%p)->()\n",lpclf
);
167 /**************************************************************************
168 * IShellLink_CF_QueryInterface
170 static HRESULT WINAPI
IShellLink_CF_QueryInterface(
171 LPCLASSFACTORY
this, REFIID riid
, LPVOID
*ppvObj
)
173 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
174 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
178 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
179 { *ppvObj
= (LPUNKNOWN
)this;
181 else if(IsEqualIID(riid
, &IID_IClassFactory
)) /*IClassFactory*/
182 { *ppvObj
= (LPCLASSFACTORY
)this;
186 { (*(LPCLASSFACTORY
*)ppvObj
)->lpvtbl
->fnAddRef(this);
187 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
190 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
191 return E_NOINTERFACE
;
193 /******************************************************************************
194 * IShellLink_CF_AddRef
196 static ULONG WINAPI
IShellLink_CF_AddRef(LPCLASSFACTORY
this)
197 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
198 return ++(this->ref
);
200 /******************************************************************************
201 * IShellLink_CF_Release
203 static ULONG WINAPI
IShellLink_CF_Release(LPCLASSFACTORY
this)
204 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
206 { TRACE(shell
,"-- destroying IClassFactory(%p)\n",this);
207 HeapFree(GetProcessHeap(),0,this);
212 /******************************************************************************
213 * IShellLink_CF_CreateInstance
215 static HRESULT WINAPI
IShellLink_CF_CreateInstance(
216 LPCLASSFACTORY
this, LPUNKNOWN pUnknown
, REFIID riid
, LPVOID
*ppObject
)
217 { IUnknown
*pObj
= NULL
;
221 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
222 TRACE(shell
,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown
,xriid
,ppObject
);
227 { return(CLASS_E_NOAGGREGATION
);
230 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IShellLink
))
231 { pObj
= (IUnknown
*)IShellLink_Constructor();
234 { ERR(shell
,"unknown IID requested\n\tIID:\t%s\n",xriid
);
235 return(E_NOINTERFACE
);
239 { return(E_OUTOFMEMORY
);
242 hres
= pObj
->lpvtbl
->fnQueryInterface(pObj
,riid
, ppObject
);
243 pObj
->lpvtbl
->fnRelease(pObj
);
244 TRACE(shell
,"-- Object created: (%p)->%p\n",this,*ppObject
);
248 /******************************************************************************
249 * IShellLink_CF_LockServer
251 static HRESULT WINAPI
IShellLink_CF_LockServer(LPCLASSFACTORY
this, BOOL32 fLock
)
252 { TRACE(shell
,"%p->(0x%x), not implemented\n",this, fLock
);
256 /* IShellLink Implementation */
257 static HRESULT WINAPI
IShellLink_QueryInterface(LPSHELLLINK
,REFIID
,LPVOID
*);
258 static ULONG WINAPI
IShellLink_AddRef(LPSHELLLINK
);
259 static ULONG WINAPI
IShellLink_Release(LPSHELLLINK
);
260 static HRESULT WINAPI
IShellLink_GetPath(LPSHELLLINK
, LPSTR
,INT32
, WIN32_FIND_DATA32A
*, DWORD
);
261 static HRESULT WINAPI
IShellLink_GetIDList(LPSHELLLINK
, LPITEMIDLIST
*);
262 static HRESULT WINAPI
IShellLink_SetIDList(LPSHELLLINK
, LPCITEMIDLIST
);
263 static HRESULT WINAPI
IShellLink_GetDescription(LPSHELLLINK
, LPSTR
,INT32
);
264 static HRESULT WINAPI
IShellLink_SetDescription(LPSHELLLINK
, LPCSTR
);
265 static HRESULT WINAPI
IShellLink_GetWorkingDirectory(LPSHELLLINK
, LPSTR
,INT32
);
266 static HRESULT WINAPI
IShellLink_SetWorkingDirectory(LPSHELLLINK
, LPCSTR
);
267 static HRESULT WINAPI
IShellLink_GetArguments(LPSHELLLINK
, LPSTR
,INT32
);
268 static HRESULT WINAPI
IShellLink_SetArguments(LPSHELLLINK
, LPCSTR
);
269 static HRESULT WINAPI
IShellLink_GetHotkey(LPSHELLLINK
, WORD
*);
270 static HRESULT WINAPI
IShellLink_SetHotkey(LPSHELLLINK
, WORD
);
271 static HRESULT WINAPI
IShellLink_GetShowCmd(LPSHELLLINK
, INT32
*);
272 static HRESULT WINAPI
IShellLink_SetShowCmd(LPSHELLLINK
, INT32
);
273 static HRESULT WINAPI
IShellLink_GetIconLocation(LPSHELLLINK
, LPSTR
,INT32
,INT32
*);
274 static HRESULT WINAPI
IShellLink_SetIconLocation(LPSHELLLINK
, LPCSTR
,INT32
);
275 static HRESULT WINAPI
IShellLink_SetRelativePath(LPSHELLLINK
, LPCSTR
, DWORD
);
276 static HRESULT WINAPI
IShellLink_Resolve(LPSHELLLINK
, HWND32
, DWORD
);
277 static HRESULT WINAPI
IShellLink_SetPath(LPSHELLLINK
, LPCSTR
);
279 /**************************************************************************
280 * IShellLink Implementation
283 static struct IShellLink_VTable slvt
=
284 { IShellLink_QueryInterface
,
288 IShellLink_GetIDList
,
289 IShellLink_SetIDList
,
290 IShellLink_GetDescription
,
291 IShellLink_SetDescription
,
292 IShellLink_GetWorkingDirectory
,
293 IShellLink_SetWorkingDirectory
,
294 IShellLink_GetArguments
,
295 IShellLink_SetArguments
,
296 IShellLink_GetHotkey
,
297 IShellLink_SetHotkey
,
298 IShellLink_GetShowCmd
,
299 IShellLink_SetShowCmd
,
300 IShellLink_GetIconLocation
,
301 IShellLink_SetIconLocation
,
302 IShellLink_SetRelativePath
,
307 /**************************************************************************
308 * IShellLink_Constructor
310 LPSHELLLINK
IShellLink_Constructor(void)
313 sl
= (LPSHELLLINK
)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLink
));
317 sl
->lppf
= IPersistFile_Constructor();
319 TRACE(shell
,"(%p)->()\n",sl
);
323 /**************************************************************************
324 * IShellLink::QueryInterface
326 static HRESULT WINAPI
IShellLink_QueryInterface(
327 LPSHELLLINK
this, REFIID riid
, LPVOID
*ppvObj
)
329 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
330 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
334 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
337 else if(IsEqualIID(riid
, &IID_IShellLink
)) /*IShellLink*/
338 { *ppvObj
= (LPSHELLLINK
)this;
340 else if(IsEqualIID(riid
, &IID_IPersistFile
)) /*IPersistFile*/
341 { *ppvObj
= (LPPERSISTFILE
)this->lppf
;
345 { (*(LPSHELLLINK
*)ppvObj
)->lpvtbl
->fnAddRef(this);
346 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
349 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
350 return E_NOINTERFACE
;
352 /******************************************************************************
355 static ULONG WINAPI
IShellLink_AddRef(LPSHELLLINK
this)
356 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
357 return ++(this->ref
);
359 /******************************************************************************
362 static ULONG WINAPI
IShellLink_Release(LPSHELLLINK
this)
363 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
365 { TRACE(shell
,"-- destroying IShellLink(%p)\n",this);
366 this->lppf
->lpvtbl
->fnRelease(this->lppf
); /* IPersistFile*/
367 HeapFree(GetProcessHeap(),0,this);
373 static HRESULT WINAPI
IShellLink_GetPath(LPSHELLLINK
this, LPSTR pszFile
,INT32 cchMaxPath
, WIN32_FIND_DATA32A
*pfd
, DWORD fFlags
)
374 { FIXME(shell
,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile
, cchMaxPath
, pfd
, fFlags
);
375 strncpy(pszFile
,"c:\\foo.bar", cchMaxPath
);
378 static HRESULT WINAPI
IShellLink_GetIDList(LPSHELLLINK
this, LPITEMIDLIST
* ppidl
)
379 { FIXME(shell
,"(%p)->(ppidl=%p)\n",this, ppidl
);
380 *ppidl
= _ILCreateDesktop();
383 static HRESULT WINAPI
IShellLink_SetIDList(LPSHELLLINK
this, LPCITEMIDLIST pidl
)
384 { FIXME(shell
,"(%p)->(pidl=%p)\n",this, pidl
);
387 static HRESULT WINAPI
IShellLink_GetDescription(LPSHELLLINK
this, LPSTR pszName
,INT32 cchMaxName
)
388 { FIXME(shell
,"(%p)->(%p len=%u)\n",this, pszName
, cchMaxName
);
389 strncpy(pszName
,"Description, FIXME",cchMaxName
);
392 static HRESULT WINAPI
IShellLink_SetDescription(LPSHELLLINK
this, LPCSTR pszName
)
393 { FIXME(shell
,"(%p)->(desc=%s)\n",this, pszName
);
396 static HRESULT WINAPI
IShellLink_GetWorkingDirectory(LPSHELLLINK
this, LPSTR pszDir
,INT32 cchMaxPath
)
397 { FIXME(shell
,"(%p)->()\n",this);
398 strncpy(pszDir
,"c:\\", cchMaxPath
);
401 static HRESULT WINAPI
IShellLink_SetWorkingDirectory(LPSHELLLINK
this, LPCSTR pszDir
)
402 { FIXME(shell
,"(%p)->(dir=%s)\n",this, pszDir
);
405 static HRESULT WINAPI
IShellLink_GetArguments(LPSHELLLINK
this, LPSTR pszArgs
,INT32 cchMaxPath
)
406 { FIXME(shell
,"(%p)->(%p len=%u)\n",this, pszArgs
, cchMaxPath
);
407 strncpy(pszArgs
, "", cchMaxPath
);
410 static HRESULT WINAPI
IShellLink_SetArguments(LPSHELLLINK
this, LPCSTR pszArgs
)
411 { FIXME(shell
,"(%p)->(args=%s)\n",this, pszArgs
);
414 static HRESULT WINAPI
IShellLink_GetHotkey(LPSHELLLINK
this, WORD
*pwHotkey
)
415 { FIXME(shell
,"(%p)->(%p)\n",this, pwHotkey
);
419 static HRESULT WINAPI
IShellLink_SetHotkey(LPSHELLLINK
this, WORD wHotkey
)
420 { FIXME(shell
,"(%p)->(hotkey=%x)\n",this, wHotkey
);
423 static HRESULT WINAPI
IShellLink_GetShowCmd(LPSHELLLINK
this, INT32
*piShowCmd
)
424 { FIXME(shell
,"(%p)->(%p)\n",this, piShowCmd
);
428 static HRESULT WINAPI
IShellLink_SetShowCmd(LPSHELLLINK
this, INT32 iShowCmd
)
429 { FIXME(shell
,"(%p)->(showcmd=%x)\n",this, iShowCmd
);
432 static HRESULT WINAPI
IShellLink_GetIconLocation(LPSHELLLINK
this, LPSTR pszIconPath
,INT32 cchIconPath
,INT32
*piIcon
)
433 { FIXME(shell
,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath
, cchIconPath
, piIcon
);
434 strncpy(pszIconPath
,"shell32.dll",cchIconPath
);
438 static HRESULT WINAPI
IShellLink_SetIconLocation(LPSHELLLINK
this, LPCSTR pszIconPath
,INT32 iIcon
)
439 { FIXME(shell
,"(%p)->(path=%s iicon=%u)\n",this, pszIconPath
, iIcon
);
442 static HRESULT WINAPI
IShellLink_SetRelativePath(LPSHELLLINK
this, LPCSTR pszPathRel
, DWORD dwReserved
)
443 { FIXME(shell
,"(%p)->(path=%s %lx)\n",this, pszPathRel
, dwReserved
);
446 static HRESULT WINAPI
IShellLink_Resolve(LPSHELLLINK
this, HWND32 hwnd
, DWORD fFlags
)
447 { FIXME(shell
,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd
, fFlags
);
450 static HRESULT WINAPI
IShellLink_SetPath(LPSHELLLINK
this, LPCSTR pszFile
)
451 { FIXME(shell
,"(%p)->(path=%s)\n",this, pszFile
);
455 /**************************************************************************
456 * IClassFactory for IShellLinkW
458 static HRESULT WINAPI
IShellLinkW_CF_QueryInterface(LPCLASSFACTORY
,REFIID
,LPVOID
*);
459 static ULONG WINAPI
IShellLinkW_CF_AddRef(LPCLASSFACTORY
);
460 static ULONG WINAPI
IShellLinkW_CF_Release(LPCLASSFACTORY
);
461 static HRESULT WINAPI
IShellLinkW_CF_CreateInstance(LPCLASSFACTORY
, LPUNKNOWN
, REFIID
, LPVOID
*);
462 static HRESULT WINAPI
IShellLinkW_CF_LockServer(LPCLASSFACTORY
, BOOL32
);
463 /**************************************************************************
464 * IShellLinkW_CF_VTable
466 static IClassFactory_VTable slwcfvt
=
467 { IShellLinkW_CF_QueryInterface
,
468 IShellLinkW_CF_AddRef
,
469 IShellLinkW_CF_Release
,
470 IShellLinkW_CF_CreateInstance
,
471 IShellLinkW_CF_LockServer
474 /**************************************************************************
475 * IShellLinkW_CF_Constructor
478 LPCLASSFACTORY
IShellLinkW_CF_Constructor(void)
479 { LPCLASSFACTORY lpclf
;
481 lpclf
= (LPCLASSFACTORY
)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactory
));
483 lpclf
->lpvtbl
= &slwcfvt
;
484 TRACE(shell
,"(%p)->()\n",lpclf
);
487 /**************************************************************************
488 * IShellLinkW_CF_QueryInterface
490 static HRESULT WINAPI
IShellLinkW_CF_QueryInterface(
491 LPCLASSFACTORY
this, REFIID riid
, LPVOID
*ppvObj
)
493 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
494 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
498 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
499 { *ppvObj
= (LPUNKNOWN
)this;
501 else if(IsEqualIID(riid
, &IID_IClassFactory
)) /*IClassFactory*/
502 { *ppvObj
= (LPCLASSFACTORY
)this;
506 { (*(LPCLASSFACTORY
*)ppvObj
)->lpvtbl
->fnAddRef(this);
507 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
510 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
511 return E_NOINTERFACE
;
513 /******************************************************************************
514 * IShellLinkW_CF_AddRef
516 static ULONG WINAPI
IShellLinkW_CF_AddRef(LPCLASSFACTORY
this)
517 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
518 return ++(this->ref
);
520 /******************************************************************************
521 * IShellLinkW_CF_Release
523 static ULONG WINAPI
IShellLinkW_CF_Release(LPCLASSFACTORY
this)
524 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
526 { TRACE(shell
,"-- destroying IClassFactory(%p)\n",this);
527 HeapFree(GetProcessHeap(),0,this);
532 /******************************************************************************
533 * IShellLinkW_CF_CreateInstance
535 static HRESULT WINAPI
IShellLinkW_CF_CreateInstance(
536 LPCLASSFACTORY
this, LPUNKNOWN pUnknown
, REFIID riid
, LPVOID
*ppObject
)
537 { IUnknown
*pObj
= NULL
;
541 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
542 TRACE(shell
,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown
,xriid
,ppObject
);
547 { return(CLASS_E_NOAGGREGATION
);
550 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IShellLinkW
))
551 { pObj
= (IUnknown
*)IShellLinkW_Constructor();
554 { ERR(shell
,"unknown IID requested\n\tIID:\t%s\n",xriid
);
555 return(E_NOINTERFACE
);
559 { return(E_OUTOFMEMORY
);
562 hres
= pObj
->lpvtbl
->fnQueryInterface(pObj
,riid
, ppObject
);
563 pObj
->lpvtbl
->fnRelease(pObj
);
564 TRACE(shell
,"-- Object created: (%p)->%p\n",this,*ppObject
);
568 /******************************************************************************
569 * IShellLinkW_CF_LockServer
572 static HRESULT WINAPI
IShellLinkW_CF_LockServer(LPCLASSFACTORY
this, BOOL32 fLock
)
573 { TRACE(shell
,"%p->(0x%x), not implemented\n",this, fLock
);
577 /* IShellLinkW Implementation */
578 static HRESULT WINAPI
IShellLinkW_QueryInterface(LPSHELLLINKW
,REFIID
,LPVOID
*);
579 static ULONG WINAPI
IShellLinkW_AddRef(LPSHELLLINKW
);
580 static ULONG WINAPI
IShellLinkW_Release(LPSHELLLINKW
);
581 static HRESULT WINAPI
IShellLinkW_GetPath(LPSHELLLINKW
, LPWSTR
,INT32
, WIN32_FIND_DATA32A
*, DWORD
);
582 static HRESULT WINAPI
IShellLinkW_GetIDList(LPSHELLLINKW
, LPITEMIDLIST
*);
583 static HRESULT WINAPI
IShellLinkW_SetIDList(LPSHELLLINKW
, LPCITEMIDLIST
);
584 static HRESULT WINAPI
IShellLinkW_GetDescription(LPSHELLLINKW
, LPWSTR
,INT32
);
585 static HRESULT WINAPI
IShellLinkW_SetDescription(LPSHELLLINKW
, LPCWSTR
);
586 static HRESULT WINAPI
IShellLinkW_GetWorkingDirectory(LPSHELLLINKW
, LPWSTR
,INT32
);
587 static HRESULT WINAPI
IShellLinkW_SetWorkingDirectory(LPSHELLLINKW
, LPCWSTR
);
588 static HRESULT WINAPI
IShellLinkW_GetArguments(LPSHELLLINKW
, LPWSTR
,INT32
);
589 static HRESULT WINAPI
IShellLinkW_SetArguments(LPSHELLLINKW
, LPCWSTR
);
590 static HRESULT WINAPI
IShellLinkW_GetHotkey(LPSHELLLINKW
, WORD
*);
591 static HRESULT WINAPI
IShellLinkW_SetHotkey(LPSHELLLINKW
, WORD
);
592 static HRESULT WINAPI
IShellLinkW_GetShowCmd(LPSHELLLINKW
, INT32
*);
593 static HRESULT WINAPI
IShellLinkW_SetShowCmd(LPSHELLLINKW
, INT32
);
594 static HRESULT WINAPI
IShellLinkW_GetIconLocation(LPSHELLLINKW
, LPWSTR
,INT32
,INT32
*);
595 static HRESULT WINAPI
IShellLinkW_SetIconLocation(LPSHELLLINKW
, LPCWSTR
,INT32
);
596 static HRESULT WINAPI
IShellLinkW_SetRelativePath(LPSHELLLINKW
, LPCWSTR
, DWORD
);
597 static HRESULT WINAPI
IShellLinkW_Resolve(LPSHELLLINKW
, HWND32
, DWORD
);
598 static HRESULT WINAPI
IShellLinkW_SetPath(LPSHELLLINKW
, LPCWSTR
);
600 /**************************************************************************
601 * IShellLinkW Implementation
604 static struct IShellLinkW_VTable slvtw
=
605 { IShellLinkW_QueryInterface
,
609 IShellLinkW_GetIDList
,
610 IShellLinkW_SetIDList
,
611 IShellLinkW_GetDescription
,
612 IShellLinkW_SetDescription
,
613 IShellLinkW_GetWorkingDirectory
,
614 IShellLinkW_SetWorkingDirectory
,
615 IShellLinkW_GetArguments
,
616 IShellLinkW_SetArguments
,
617 IShellLinkW_GetHotkey
,
618 IShellLinkW_SetHotkey
,
619 IShellLinkW_GetShowCmd
,
620 IShellLinkW_SetShowCmd
,
621 IShellLinkW_GetIconLocation
,
622 IShellLinkW_SetIconLocation
,
623 IShellLinkW_SetRelativePath
,
628 /**************************************************************************
629 * IShellLinkW_Constructor
631 LPSHELLLINKW
IShellLinkW_Constructor(void)
634 sl
= (LPSHELLLINKW
)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLinkW
));
638 sl
->lppf
= IPersistFile_Constructor();
640 TRACE(shell
,"(%p)->()\n",sl
);
644 /**************************************************************************
645 * IShellLinkW::QueryInterface
647 static HRESULT WINAPI
IShellLinkW_QueryInterface(
648 LPSHELLLINKW
this, REFIID riid
, LPVOID
*ppvObj
)
650 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
651 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
655 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
658 else if(IsEqualIID(riid
, &IID_IShellLinkW
)) /*IShellLinkW*/
659 { *ppvObj
= (LPSHELLLINKW
)this;
661 else if(IsEqualIID(riid
, &IID_IPersistFile
)) /*IPersistFile*/
662 { *ppvObj
= (LPPERSISTFILE
)this->lppf
;
666 { (*(LPSHELLLINKW
*)ppvObj
)->lpvtbl
->fnAddRef(this);
667 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
670 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
671 return E_NOINTERFACE
;
673 /******************************************************************************
676 static ULONG WINAPI
IShellLinkW_AddRef(LPSHELLLINKW
this)
677 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
678 return ++(this->ref
);
680 /******************************************************************************
681 * IClassFactory_Release
683 static ULONG WINAPI
IShellLinkW_Release(LPSHELLLINKW
this)
684 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
686 { TRACE(shell
,"-- destroying IShellLinkW(%p)\n",this);
687 this->lppf
->lpvtbl
->fnRelease(this->lppf
); /* IPersistFile*/
688 HeapFree(GetProcessHeap(),0,this);
694 static HRESULT WINAPI
IShellLinkW_GetPath(LPSHELLLINKW
this, LPWSTR pszFile
,INT32 cchMaxPath
, WIN32_FIND_DATA32A
*pfd
, DWORD fFlags
)
695 { FIXME(shell
,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile
, cchMaxPath
, pfd
, fFlags
);
696 lstrcpynAtoW(pszFile
,"c:\\foo.bar", cchMaxPath
);
699 static HRESULT WINAPI
IShellLinkW_GetIDList(LPSHELLLINKW
this, LPITEMIDLIST
* ppidl
)
700 { FIXME(shell
,"(%p)->(ppidl=%p)\n",this, ppidl
);
701 *ppidl
= _ILCreateDesktop();
704 static HRESULT WINAPI
IShellLinkW_SetIDList(LPSHELLLINKW
this, LPCITEMIDLIST pidl
)
705 { FIXME(shell
,"(%p)->(pidl=%p)\n",this, pidl
);
708 static HRESULT WINAPI
IShellLinkW_GetDescription(LPSHELLLINKW
this, LPWSTR pszName
,INT32 cchMaxName
)
709 { FIXME(shell
,"(%p)->(%p len=%u)\n",this, pszName
, cchMaxName
);
710 lstrcpynAtoW(pszName
,"Description, FIXME",cchMaxName
);
713 static HRESULT WINAPI
IShellLinkW_SetDescription(LPSHELLLINKW
this, LPCWSTR pszName
)
714 { FIXME(shell
,"(%p)->(desc=%s)\n",this, debugstr_w(pszName
));
717 static HRESULT WINAPI
IShellLinkW_GetWorkingDirectory(LPSHELLLINKW
this, LPWSTR pszDir
,INT32 cchMaxPath
)
718 { FIXME(shell
,"(%p)->()\n",this);
719 lstrcpynAtoW(pszDir
,"c:\\", cchMaxPath
);
722 static HRESULT WINAPI
IShellLinkW_SetWorkingDirectory(LPSHELLLINKW
this, LPCWSTR pszDir
)
723 { FIXME(shell
,"(%p)->(dir=%s)\n",this, debugstr_w(pszDir
));
726 static HRESULT WINAPI
IShellLinkW_GetArguments(LPSHELLLINKW
this, LPWSTR pszArgs
,INT32 cchMaxPath
)
727 { FIXME(shell
,"(%p)->(%p len=%u)\n",this, pszArgs
, cchMaxPath
);
728 lstrcpynAtoW(pszArgs
, "", cchMaxPath
);
731 static HRESULT WINAPI
IShellLinkW_SetArguments(LPSHELLLINKW
this, LPCWSTR pszArgs
)
732 { FIXME(shell
,"(%p)->(args=%s)\n",this, debugstr_w(pszArgs
));
735 static HRESULT WINAPI
IShellLinkW_GetHotkey(LPSHELLLINKW
this, WORD
*pwHotkey
)
736 { FIXME(shell
,"(%p)->(%p)\n",this, pwHotkey
);
740 static HRESULT WINAPI
IShellLinkW_SetHotkey(LPSHELLLINKW
this, WORD wHotkey
)
741 { FIXME(shell
,"(%p)->(hotkey=%x)\n",this, wHotkey
);
744 static HRESULT WINAPI
IShellLinkW_GetShowCmd(LPSHELLLINKW
this, INT32
*piShowCmd
)
745 { FIXME(shell
,"(%p)->(%p)\n",this, piShowCmd
);
749 static HRESULT WINAPI
IShellLinkW_SetShowCmd(LPSHELLLINKW
this, INT32 iShowCmd
)
750 { FIXME(shell
,"(%p)->(showcmd=%x)\n",this, iShowCmd
);
753 static HRESULT WINAPI
IShellLinkW_GetIconLocation(LPSHELLLINKW
this, LPWSTR pszIconPath
,INT32 cchIconPath
,INT32
*piIcon
)
754 { FIXME(shell
,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath
, cchIconPath
, piIcon
);
755 lstrcpynAtoW(pszIconPath
,"shell32.dll",cchIconPath
);
759 static HRESULT WINAPI
IShellLinkW_SetIconLocation(LPSHELLLINKW
this, LPCWSTR pszIconPath
,INT32 iIcon
)
760 { FIXME(shell
,"(%p)->(path=%s iicon=%u)\n",this, debugstr_w(pszIconPath
), iIcon
);
763 static HRESULT WINAPI
IShellLinkW_SetRelativePath(LPSHELLLINKW
this, LPCWSTR pszPathRel
, DWORD dwReserved
)
764 { FIXME(shell
,"(%p)->(path=%s %lx)\n",this, debugstr_w(pszPathRel
), dwReserved
);
767 static HRESULT WINAPI
IShellLinkW_Resolve(LPSHELLLINKW
this, HWND32 hwnd
, DWORD fFlags
)
768 { FIXME(shell
,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd
, fFlags
);
771 static HRESULT WINAPI
IShellLinkW_SetPath(LPSHELLLINKW
this, LPCWSTR pszFile
)
772 { FIXME(shell
,"(%p)->(path=%s)\n",this, debugstr_w(pszFile
));