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

Last change on this file since 2013 was 1215, checked in by sandervl, 26 years ago

Added $Id$

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