source: trunk/src/shell32/shelllink.c@ 4329

Last change on this file since 4329 was 4121, checked in by sandervl, 25 years ago

complete merge with shell32 from wine 20000801

File size: 23.7 KB
Line 
1/* $Id: shelllink.c,v 1.1 2000-08-30 13:52:55 sandervl Exp $ */
2/*
3 *
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998 Juergen Schmied
6 *
7 */
8#ifdef __WIN32OS2__
9#define ICOM_CINTERFACE 1
10#include <odin.h>
11#endif
12
13#include <string.h>
14#include "debugtools.h"
15#include "winerror.h"
16
17#include "wine/obj_base.h"
18#include "wine/obj_storage.h"
19#include "wine/obj_shelllink.h"
20#include "wine/undocshell.h"
21
22#include "heap.h"
23#include "winnls.h"
24#include "pidl.h"
25#include "shell32_main.h"
26#include "shlguid.h"
27
28DEFAULT_DEBUG_CHANNEL(shell);
29
30/* link file formats */
31
32#include "pshpack1.h"
33
34/* flag1: lnk elements: simple link has 0x0B */
35#define WORKDIR 0x10
36#define ARGUMENT 0x20
37#define ICON 0x40
38#define UNC 0x80
39
40/* fStartup */
41#define NORMAL 0x01
42#define MAXIMIZED 0x03
43#define MINIMIZED 0x07
44
45typedef struct _LINK_HEADER
46{ DWORD MagicStr; /* 0x00 'L','\0','\0','\0' */
47 GUID MagicGuid; /* 0x04 is CLSID_ShellLink */
48 DWORD Flag1; /* 0x14 describes elements following */
49 DWORD Flag2; /* 0x18 */
50 FILETIME Time1; /* 0x1c */
51 FILETIME Time2; /* 0x24 */
52 FILETIME Time3; /* 0x2c */
53 DWORD Unknown1; /* 0x34 */
54 DWORD Unknown2; /* 0x38 icon number */
55 DWORD fStartup; /* 0x3c startup type */
56 DWORD wHotKey; /* 0x40 hotkey */
57 DWORD Unknown5; /* 0x44 */
58 DWORD Unknown6; /* 0x48 */
59 USHORT PidlSize; /* 0x4c */
60 ITEMIDLIST Pidl; /* 0x4e */
61} LINK_HEADER, * PLINK_HEADER;
62
63#define LINK_HEADER_SIZE (sizeof(LINK_HEADER)-sizeof(ITEMIDLIST))
64
65#include "poppack.h"
66
67static ICOM_VTABLE(IShellLinkA) slvt;
68static ICOM_VTABLE(IShellLinkW) slvtw;
69static ICOM_VTABLE(IPersistFile) pfvt;
70static ICOM_VTABLE(IPersistStream) psvt;
71
72/* IShellLink Implementation */
73
74typedef struct
75{
76 ICOM_VFIELD(IShellLinkA);
77 DWORD ref;
78
79 ICOM_VTABLE(IShellLinkW)* lpvtblw;
80 ICOM_VTABLE(IPersistFile)* lpvtblPersistFile;
81 ICOM_VTABLE(IPersistStream)* lpvtblPersistStream;
82
83 /* internal stream of the IPersistFile interface */
84 IStream* lpFileStream;
85
86 /* data structures according to the informations in the lnk */
87 LPSTR sPath;
88 LPITEMIDLIST pPidl;
89 WORD wHotKey;
90 SYSTEMTIME time1;
91 SYSTEMTIME time2;
92 SYSTEMTIME time3;
93
94} IShellLinkImpl;
95
96#define _IShellLinkW_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblw)))
97#define _ICOM_THIS_From_IShellLinkW(class, name) class* This = (class*)(((char*)name)-_IShellLinkW_Offset);
98
99#define _IPersistFile_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblPersistFile)))
100#define _ICOM_THIS_From_IPersistFile(class, name) class* This = (class*)(((char*)name)-_IPersistFile_Offset);
101
102#define _IPersistStream_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblPersistStream)))
103#define _ICOM_THIS_From_IPersistStream(class, name) class* This = (class*)(((char*)name)-_IPersistStream_Offset);
104#define _IPersistStream_From_ICOM_THIS(class, name) class* StreamThis = (class*)(((char*)name)+_IPersistStream_Offset);
105
106/**************************************************************************
107 * IPersistFile_QueryInterface
108 */
109static HRESULT WINAPI IPersistFile_fnQueryInterface(
110 IPersistFile* iface,
111 REFIID riid,
112 LPVOID *ppvObj)
113{
114 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
115
116 TRACE("(%p)\n",This);
117
118 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj);
119}
120
121/******************************************************************************
122 * IPersistFile_AddRef
123 */
124static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile* iface)
125{
126 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
127
128 TRACE("(%p)->(count=%lu)\n",This,This->ref);
129
130 return IShellLinkA_AddRef((IShellLinkA*)This);
131}
132/******************************************************************************
133 * IPersistFile_Release
134 */
135static ULONG WINAPI IPersistFile_fnRelease(IPersistFile* iface)
136{
137 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
138
139 TRACE("(%p)->(count=%lu)\n",This,This->ref);
140
141 return IShellLinkA_Release((IShellLinkA*)This);
142}
143
144static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile* iface, CLSID *pClassID)
145{
146 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
147 FIXME("(%p)\n",This);
148 return NOERROR;
149}
150static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface)
151{
152 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
153 FIXME("(%p)\n",This);
154 return NOERROR;
155}
156static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
157{
158 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
159 _IPersistStream_From_ICOM_THIS(IPersistStream, This)
160
161 LPSTR sFile = HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName);
162 HRESULT hRet = E_FAIL;
163
164 TRACE("(%p, %s)\n",This, sFile);
165
166
167 if (This->lpFileStream)
168 IStream_Release(This->lpFileStream);
169
170 if SUCCEEDED(CreateStreamOnFile(sFile, &(This->lpFileStream)))
171 {
172 if SUCCEEDED (IPersistStream_Load(StreamThis, This->lpFileStream))
173 {
174 return NOERROR;
175 }
176 }
177
178 return hRet;
179}
180
181static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember)
182{
183 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
184 FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName));
185 return NOERROR;
186}
187static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLESTR pszFileName)
188{
189 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
190 FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName));
191 return NOERROR;
192}
193static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *ppszFileName)
194{
195 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
196 FIXME("(%p)\n",This);
197 return NOERROR;
198}
199
200static ICOM_VTABLE(IPersistFile) pfvt =
201{
202 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
203 IPersistFile_fnQueryInterface,
204 IPersistFile_fnAddRef,
205 IPersistFile_fnRelease,
206 IPersistFile_fnGetClassID,
207 IPersistFile_fnIsDirty,
208 IPersistFile_fnLoad,
209 IPersistFile_fnSave,
210 IPersistFile_fnSaveCompleted,
211 IPersistFile_fnGetCurFile
212};
213
214/************************************************************************
215 * IPersistStream_QueryInterface
216 */
217static HRESULT WINAPI IPersistStream_fnQueryInterface(
218 IPersistStream* iface,
219 REFIID riid,
220 VOID** ppvoid)
221{
222 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
223
224 TRACE("(%p)\n",This);
225
226 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvoid);
227}
228
229/************************************************************************
230 * IPersistStream_Release
231 */
232static ULONG WINAPI IPersistStream_fnRelease(
233 IPersistStream* iface)
234{
235 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
236
237 TRACE("(%p)\n",This);
238
239 return IShellLinkA_Release((IShellLinkA*)This);
240}
241
242/************************************************************************
243 * IPersistStream_AddRef
244 */
245static ULONG WINAPI IPersistStream_fnAddRef(
246 IPersistStream* iface)
247{
248 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
249
250 TRACE("(%p)\n",This);
251
252 return IShellLinkA_AddRef((IShellLinkA*)This);
253}
254
255/************************************************************************
256 * IPersistStream_GetClassID
257 *
258 */
259static HRESULT WINAPI IPersistStream_fnGetClassID(
260 IPersistStream* iface,
261 CLSID* pClassID)
262{
263 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
264
265 TRACE("(%p)\n", This);
266
267 if (pClassID==0)
268 return E_POINTER;
269
270/* memcpy(pClassID, &CLSID_???, sizeof(CLSID_???)); */
271
272 return S_OK;
273}
274
275/************************************************************************
276 * IPersistStream_IsDirty (IPersistStream)
277 */
278static HRESULT WINAPI IPersistStream_fnIsDirty(
279 IPersistStream* iface)
280{
281 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
282
283 TRACE("(%p)\n", This);
284
285 return S_OK;
286}
287/************************************************************************
288 * IPersistStream_Load (IPersistStream)
289 */
290
291static HRESULT WINAPI IPersistStream_fnLoad(
292 IPersistStream* iface,
293 IStream* pLoadStream)
294{
295 PLINK_HEADER lpLinkHeader = HeapAlloc(GetProcessHeap(), 0, LINK_HEADER_SIZE);
296 ULONG dwBytesRead;
297 DWORD ret = E_FAIL;
298 char sTemp[MAX_PATH];
299
300 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
301
302 TRACE("(%p)(%p)\n", This, pLoadStream);
303
304 if ( ! pLoadStream)
305 {
306 return STG_E_INVALIDPOINTER;
307 }
308
309 IStream_AddRef (pLoadStream);
310 if(lpLinkHeader)
311 {
312 if (SUCCEEDED(IStream_Read(pLoadStream, lpLinkHeader, LINK_HEADER_SIZE, &dwBytesRead)))
313 {
314 if ((lpLinkHeader->MagicStr == 0x0000004CL) && IsEqualIID(&lpLinkHeader->MagicGuid, &CLSID_ShellLink))
315 {
316 lpLinkHeader = HeapReAlloc(GetProcessHeap(), 0, lpLinkHeader, LINK_HEADER_SIZE+lpLinkHeader->PidlSize);
317 if (lpLinkHeader)
318 {
319 if (SUCCEEDED(IStream_Read(pLoadStream, &(lpLinkHeader->Pidl), lpLinkHeader->PidlSize, &dwBytesRead)))
320 {
321 if (pcheck (&lpLinkHeader->Pidl))
322 {
323 This->pPidl = ILClone (&lpLinkHeader->Pidl);
324
325 SHGetPathFromIDListA(&lpLinkHeader->Pidl, sTemp);
326 This->sPath = HEAP_strdupA ( GetProcessHeap(), 0, sTemp);
327 }
328 This->wHotKey = lpLinkHeader->wHotKey;
329 FileTimeToSystemTime (&lpLinkHeader->Time1, &This->time1);
330 FileTimeToSystemTime (&lpLinkHeader->Time2, &This->time2);
331 FileTimeToSystemTime (&lpLinkHeader->Time3, &This->time3);
332#if 1
333 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time1, NULL, sTemp, 256);
334 TRACE("-- time1: %s\n", sTemp);
335 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time2, NULL, sTemp, 256);
336 TRACE("-- time1: %s\n", sTemp);
337 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time3, NULL, sTemp, 256);
338 TRACE("-- time1: %s\n", sTemp);
339 pdump (This->pPidl);
340#endif
341 ret = S_OK;
342 }
343 }
344 }
345 else
346 {
347 WARN("stream contains no link!\n");
348 }
349 }
350 }
351
352 IStream_Release (pLoadStream);
353
354 pdump(This->pPidl);
355
356 HeapFree(GetProcessHeap(), 0, lpLinkHeader);
357
358 return ret;
359}
360
361/************************************************************************
362 * IPersistStream_Save (IPersistStream)
363 */
364static HRESULT WINAPI IPersistStream_fnSave(
365 IPersistStream* iface,
366 IStream* pOutStream,
367 BOOL fClearDirty)
368{
369 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
370
371 TRACE("(%p) %p %x\n", This, pOutStream, fClearDirty);
372
373 return E_NOTIMPL;
374}
375
376/************************************************************************
377 * IPersistStream_GetSizeMax (IPersistStream)
378 */
379static HRESULT WINAPI IPersistStream_fnGetSizeMax(
380 IPersistStream* iface,
381 ULARGE_INTEGER* pcbSize)
382{
383 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
384
385 TRACE("(%p)\n", This);
386
387 return E_NOTIMPL;
388}
389
390static ICOM_VTABLE(IPersistStream) psvt =
391{
392 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
393 IPersistStream_fnQueryInterface,
394 IPersistStream_fnAddRef,
395 IPersistStream_fnRelease,
396 IPersistStream_fnGetClassID,
397 IPersistStream_fnIsDirty,
398 IPersistStream_fnLoad,
399 IPersistStream_fnSave,
400 IPersistStream_fnGetSizeMax
401};
402
403/**************************************************************************
404 * IShellLink_Constructor
405 */
406IShellLinkA * IShellLink_Constructor(BOOL bUnicode)
407{ IShellLinkImpl * sl;
408
409 sl = (IShellLinkImpl *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellLinkImpl));
410 sl->ref = 1;
411 ICOM_VTBL(sl) = &slvt;
412 sl->lpvtblw = &slvtw;
413 sl->lpvtblPersistFile = &pfvt;
414 sl->lpvtblPersistStream = &psvt;
415
416 TRACE("(%p)->()\n",sl);
417 shell32_ObjCount++;
418 return bUnicode ? (IShellLinkA *) &(sl->lpvtblw) : (IShellLinkA *)sl;
419}
420
421/**************************************************************************
422 * IShellLinkA_QueryInterface
423 */
424static HRESULT WINAPI IShellLinkA_fnQueryInterface( IShellLinkA * iface, REFIID riid, LPVOID *ppvObj)
425{
426 ICOM_THIS(IShellLinkImpl, iface);
427
428 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid));
429
430 *ppvObj = NULL;
431
432 if(IsEqualIID(riid, &IID_IUnknown) ||
433 IsEqualIID(riid, &IID_IShellLinkA))
434 {
435 *ppvObj = This;
436 }
437 else if(IsEqualIID(riid, &IID_IShellLinkW))
438 {
439 *ppvObj = (IShellLinkW *)&(This->lpvtblw);
440 }
441 else if(IsEqualIID(riid, &IID_IPersistFile))
442 {
443 *ppvObj = (IPersistFile *)&(This->lpvtblPersistFile);
444 }
445 else if(IsEqualIID(riid, &IID_IPersistStream))
446 {
447 *ppvObj = (IPersistStream *)&(This->lpvtblPersistStream);
448 }
449
450 if(*ppvObj)
451 {
452 IUnknown_AddRef((IUnknown*)(*ppvObj));
453 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
454 return S_OK;
455 }
456 TRACE("-- Interface: E_NOINTERFACE\n");
457 return E_NOINTERFACE;
458}
459/******************************************************************************
460 * IShellLinkA_AddRef
461 */
462static ULONG WINAPI IShellLinkA_fnAddRef(IShellLinkA * iface)
463{
464 ICOM_THIS(IShellLinkImpl, iface);
465
466 TRACE("(%p)->(count=%lu)\n",This,This->ref);
467
468 shell32_ObjCount++;
469 return ++(This->ref);
470}
471/******************************************************************************
472 * IShellLinkA_Release
473 */
474static ULONG WINAPI IShellLinkA_fnRelease(IShellLinkA * iface)
475{
476 ICOM_THIS(IShellLinkImpl, iface);
477
478 TRACE("(%p)->(count=%lu)\n",This,This->ref);
479
480 shell32_ObjCount--;
481 if (!--(This->ref))
482 { TRACE("-- destroying IShellLink(%p)\n",This);
483
484 if (This->sPath)
485 HeapFree(GetProcessHeap(),0,This->sPath);
486
487 if (This->pPidl)
488 SHFree(This->pPidl);
489
490 if (This->lpFileStream)
491 IStream_Release(This->lpFileStream);
492
493 HeapFree(GetProcessHeap(),0,This);
494 return 0;
495 }
496 return This->ref;
497}
498
499static HRESULT WINAPI IShellLinkA_fnGetPath(IShellLinkA * iface, LPSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags)
500{
501 ICOM_THIS(IShellLinkImpl, iface);
502
503 TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)(%s)\n",This, pszFile, cchMaxPath, pfd, fFlags, debugstr_a(This->sPath));
504
505 if (This->sPath)
506 lstrcpynA(pszFile,This->sPath, cchMaxPath);
507 else
508 return E_FAIL;
509
510 return NOERROR;
511}
512static HRESULT WINAPI IShellLinkA_fnGetIDList(IShellLinkA * iface, LPITEMIDLIST * ppidl)
513{
514 ICOM_THIS(IShellLinkImpl, iface);
515
516 TRACE("(%p)->(ppidl=%p)\n",This, ppidl);
517
518 *ppidl = ILClone(This->pPidl);
519 return NOERROR;
520}
521static HRESULT WINAPI IShellLinkA_fnSetIDList(IShellLinkA * iface, LPCITEMIDLIST pidl)
522{
523 ICOM_THIS(IShellLinkImpl, iface);
524
525 TRACE("(%p)->(pidl=%p)\n",This, pidl);
526
527 if (This->pPidl)
528 SHFree(This->pPidl);
529 This->pPidl = ILClone (pidl);
530 return NOERROR;
531}
532static HRESULT WINAPI IShellLinkA_fnGetDescription(IShellLinkA * iface, LPSTR pszName,INT cchMaxName)
533{
534 ICOM_THIS(IShellLinkImpl, iface);
535
536 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName);
537 lstrcpynA(pszName,"Description, FIXME",cchMaxName);
538 return NOERROR;
539}
540static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA * iface, LPCSTR pszName)
541{
542 ICOM_THIS(IShellLinkImpl, iface);
543
544 FIXME("(%p)->(desc=%s)\n",This, pszName);
545 return NOERROR;
546}
547static HRESULT WINAPI IShellLinkA_fnGetWorkingDirectory(IShellLinkA * iface, LPSTR pszDir,INT cchMaxPath)
548{
549 ICOM_THIS(IShellLinkImpl, iface);
550
551 FIXME("(%p)->()\n",This);
552 lstrcpynA(pszDir,"c:\\", cchMaxPath);
553 return NOERROR;
554}
555static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA * iface, LPCSTR pszDir)
556{
557 ICOM_THIS(IShellLinkImpl, iface);
558
559 FIXME("(%p)->(dir=%s)\n",This, pszDir);
560 return NOERROR;
561}
562static HRESULT WINAPI IShellLinkA_fnGetArguments(IShellLinkA * iface, LPSTR pszArgs,INT cchMaxPath)
563{
564 ICOM_THIS(IShellLinkImpl, iface);
565
566 FIXME("(%p)->(%p len=%u)\n",This, pszArgs, cchMaxPath);
567 lstrcpynA(pszArgs, "", cchMaxPath);
568 return NOERROR;
569}
570static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA * iface, LPCSTR pszArgs)
571{
572 ICOM_THIS(IShellLinkImpl, iface);
573
574 FIXME("(%p)->(args=%s)\n",This, pszArgs);
575
576 return NOERROR;
577}
578static HRESULT WINAPI IShellLinkA_fnGetHotkey(IShellLinkA * iface, WORD *pwHotkey)
579{
580 ICOM_THIS(IShellLinkImpl, iface);
581
582 TRACE("(%p)->(%p)(0x%08x)\n",This, pwHotkey, This->wHotKey);
583
584 *pwHotkey = This->wHotKey;
585
586 return NOERROR;
587}
588static HRESULT WINAPI IShellLinkA_fnSetHotkey(IShellLinkA * iface, WORD wHotkey)
589{
590 ICOM_THIS(IShellLinkImpl, iface);
591
592 TRACE("(%p)->(hotkey=%x)\n",This, wHotkey);
593
594 This->wHotKey = wHotkey;
595
596 return NOERROR;
597}
598static HRESULT WINAPI IShellLinkA_fnGetShowCmd(IShellLinkA * iface, INT *piShowCmd)
599{
600 ICOM_THIS(IShellLinkImpl, iface);
601
602 FIXME("(%p)->(%p)\n",This, piShowCmd);
603 *piShowCmd=0;
604 return NOERROR;
605}
606static HRESULT WINAPI IShellLinkA_fnSetShowCmd(IShellLinkA * iface, INT iShowCmd)
607{
608 ICOM_THIS(IShellLinkImpl, iface);
609
610 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd);
611 return NOERROR;
612}
613static HRESULT WINAPI IShellLinkA_fnGetIconLocation(IShellLinkA * iface, LPSTR pszIconPath,INT cchIconPath,INT *piIcon)
614{
615 ICOM_THIS(IShellLinkImpl, iface);
616
617 FIXME("(%p)->(%p len=%u iicon=%p)\n",This, pszIconPath, cchIconPath, piIcon);
618 lstrcpynA(pszIconPath,"shell32.dll",cchIconPath);
619 *piIcon=1;
620 return NOERROR;
621}
622static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA * iface, LPCSTR pszIconPath,INT iIcon)
623{
624 ICOM_THIS(IShellLinkImpl, iface);
625
626 FIXME("(%p)->(path=%s iicon=%u)\n",This, pszIconPath, iIcon);
627 return NOERROR;
628}
629static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA * iface, LPCSTR pszPathRel, DWORD dwReserved)
630{
631 ICOM_THIS(IShellLinkImpl, iface);
632
633 FIXME("(%p)->(path=%s %lx)\n",This, pszPathRel, dwReserved);
634 return NOERROR;
635}
636static HRESULT WINAPI IShellLinkA_fnResolve(IShellLinkA * iface, HWND hwnd, DWORD fFlags)
637{
638 ICOM_THIS(IShellLinkImpl, iface);
639
640 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags);
641 return NOERROR;
642}
643static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA * iface, LPCSTR pszFile)
644{
645 ICOM_THIS(IShellLinkImpl, iface);
646
647 FIXME("(%p)->(path=%s)\n",This, pszFile);
648 return NOERROR;
649}
650
651/**************************************************************************
652* IShellLink Implementation
653*/
654
655static ICOM_VTABLE(IShellLinkA) slvt =
656{
657 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
658 IShellLinkA_fnQueryInterface,
659 IShellLinkA_fnAddRef,
660 IShellLinkA_fnRelease,
661 IShellLinkA_fnGetPath,
662 IShellLinkA_fnGetIDList,
663 IShellLinkA_fnSetIDList,
664 IShellLinkA_fnGetDescription,
665 IShellLinkA_fnSetDescription,
666 IShellLinkA_fnGetWorkingDirectory,
667 IShellLinkA_fnSetWorkingDirectory,
668 IShellLinkA_fnGetArguments,
669 IShellLinkA_fnSetArguments,
670 IShellLinkA_fnGetHotkey,
671 IShellLinkA_fnSetHotkey,
672 IShellLinkA_fnGetShowCmd,
673 IShellLinkA_fnSetShowCmd,
674 IShellLinkA_fnGetIconLocation,
675 IShellLinkA_fnSetIconLocation,
676 IShellLinkA_fnSetRelativePath,
677 IShellLinkA_fnResolve,
678 IShellLinkA_fnSetPath
679};
680
681
682/**************************************************************************
683 * IShellLinkW_fnQueryInterface
684 */
685static HRESULT WINAPI IShellLinkW_fnQueryInterface(
686 IShellLinkW * iface, REFIID riid, LPVOID *ppvObj)
687{
688 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
689
690 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj);
691}
692
693/******************************************************************************
694 * IShellLinkW_fnAddRef
695 */
696static ULONG WINAPI IShellLinkW_fnAddRef(IShellLinkW * iface)
697{
698 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
699
700 TRACE("(%p)->(count=%lu)\n",This,This->ref);
701
702 return IShellLinkA_AddRef((IShellLinkA*)This);
703}
704/******************************************************************************
705 * IShellLinkW_fnRelease
706 */
707
708static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface)
709{
710 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
711
712 TRACE("(%p)->(count=%lu)\n",This,This->ref);
713
714 return IShellLinkA_Release((IShellLinkA*)This);
715}
716
717static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags)
718{
719 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
720
721 FIXME("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",This, pszFile, cchMaxPath, pfd, fFlags);
722 lstrcpynAtoW(pszFile,"c:\\foo.bar", cchMaxPath);
723 return NOERROR;
724}
725
726static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST * ppidl)
727{
728 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
729
730 FIXME("(%p)->(ppidl=%p)\n",This, ppidl);
731 *ppidl = _ILCreateDesktop();
732 return NOERROR;
733}
734
735static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST pidl)
736{
737 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
738
739 FIXME("(%p)->(pidl=%p)\n",This, pidl);
740 return NOERROR;
741}
742
743static HRESULT WINAPI IShellLinkW_fnGetDescription(IShellLinkW * iface, LPWSTR pszName,INT cchMaxName)
744{
745 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
746
747 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName);
748 lstrcpynAtoW(pszName,"Description, FIXME",cchMaxName);
749 return NOERROR;
750}
751
752static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR pszName)
753{
754 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
755
756 FIXME("(%p)->(desc=%s)\n",This, debugstr_w(pszName));
757 return NOERROR;
758}
759
760static HRESULT WINAPI IShellLinkW_fnGetWorkingDirectory(IShellLinkW * iface, LPWSTR pszDir,INT cchMaxPath)
761{
762 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
763
764 FIXME("(%p)->()\n",This);
765 lstrcpynAtoW(pszDir,"c:\\", cchMaxPath);
766 return NOERROR;
767}
768
769static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPCWSTR pszDir)
770{
771 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
772
773 FIXME("(%p)->(dir=%s)\n",This, debugstr_w(pszDir));
774 return NOERROR;
775}
776
777static HRESULT WINAPI IShellLinkW_fnGetArguments(IShellLinkW * iface, LPWSTR pszArgs,INT cchMaxPath)
778{
779 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
780
781 FIXME("(%p)->(%p len=%u)\n",This, pszArgs, cchMaxPath);
782 lstrcpynAtoW(pszArgs, "", cchMaxPath);
783 return NOERROR;
784}
785
786static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR pszArgs)
787{
788 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
789
790 FIXME("(%p)->(args=%s)\n",This, debugstr_w(pszArgs));
791 return NOERROR;
792}
793
794static HRESULT WINAPI IShellLinkW_fnGetHotkey(IShellLinkW * iface, WORD *pwHotkey)
795{
796 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
797
798 FIXME("(%p)->(%p)\n",This, pwHotkey);
799 *pwHotkey=0x0;
800 return NOERROR;
801}
802
803static HRESULT WINAPI IShellLinkW_fnSetHotkey(IShellLinkW * iface, WORD wHotkey)
804{
805 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
806
807 FIXME("(%p)->(hotkey=%x)\n",This, wHotkey);
808 return NOERROR;
809}
810
811static HRESULT WINAPI IShellLinkW_fnGetShowCmd(IShellLinkW * iface, INT *piShowCmd)
812{
813 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
814
815 FIXME("(%p)->(%p)\n",This, piShowCmd);
816 *piShowCmd=0;
817 return NOERROR;
818}
819
820static HRESULT WINAPI IShellLinkW_fnSetShowCmd(IShellLinkW * iface, INT iShowCmd)
821{
822 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
823
824 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd);
825 return NOERROR;
826}
827
828static HRESULT WINAPI IShellLinkW_fnGetIconLocation(IShellLinkW * iface, LPWSTR pszIconPath,INT cchIconPath,INT *piIcon)
829{
830 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
831
832 FIXME("(%p)->(%p len=%u iicon=%p)\n",This, pszIconPath, cchIconPath, piIcon);
833 lstrcpynAtoW(pszIconPath,"shell32.dll",cchIconPath);
834 *piIcon=1;
835 return NOERROR;
836}
837
838static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, LPCWSTR pszIconPath,INT iIcon)
839{
840 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
841
842 FIXME("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon);
843 return NOERROR;
844}
845
846static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR pszPathRel, DWORD dwReserved)
847{
848 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
849
850 FIXME("(%p)->(path=%s %lx)\n",This, debugstr_w(pszPathRel), dwReserved);
851 return NOERROR;
852}
853
854static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWORD fFlags)
855{
856 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
857
858 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags);
859 return NOERROR;
860}
861
862static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile)
863{
864 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
865
866 FIXME("(%p)->(path=%s)\n",This, debugstr_w(pszFile));
867 return NOERROR;
868}
869
870/**************************************************************************
871* IShellLinkW Implementation
872*/
873
874static ICOM_VTABLE(IShellLinkW) slvtw =
875{
876 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
877 IShellLinkW_fnQueryInterface,
878 IShellLinkW_fnAddRef,
879 IShellLinkW_fnRelease,
880 IShellLinkW_fnGetPath,
881 IShellLinkW_fnGetIDList,
882 IShellLinkW_fnSetIDList,
883 IShellLinkW_fnGetDescription,
884 IShellLinkW_fnSetDescription,
885 IShellLinkW_fnGetWorkingDirectory,
886 IShellLinkW_fnSetWorkingDirectory,
887 IShellLinkW_fnGetArguments,
888 IShellLinkW_fnSetArguments,
889 IShellLinkW_fnGetHotkey,
890 IShellLinkW_fnSetHotkey,
891 IShellLinkW_fnGetShowCmd,
892 IShellLinkW_fnSetShowCmd,
893 IShellLinkW_fnGetIconLocation,
894 IShellLinkW_fnSetIconLocation,
895 IShellLinkW_fnSetRelativePath,
896 IShellLinkW_fnResolve,
897 IShellLinkW_fnSetPath
898};
899
Note: See TracBrowser for help on using the repository browser.