source: trunk/src/shell32/shelllink.cpp@ 3831

Last change on this file since 3831 was 3243, checked in by cbratschi, 25 years ago

merged with Corel WINE 20000324

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