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

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

.

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