source: trunk/src/shell32/new/shelllink.cpp@ 791

Last change on this file since 791 was 791, checked in by phaller, 26 years ago

Add: shell32/new - a direct port of WINE's Shell32 implmentation

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