3 * Copyright 1997 Marcus Meissner
4 * Copyright 1998 Juergen Schmied
15 #ifdef HAVE_SYS_WAIT_H
16 # include <sys/wait.h>
18 #include "debugtools.h"
25 #include "wine/undocshell.h"
26 #include "bitmaps/wine.xpm"
30 #include "shell32_main.h"
33 DEFAULT_DEBUG_CHANNEL(shell
);
35 /* link file formats */
39 /* flag1: lnk elements: simple link has 0x0B */
47 #define MAXIMIZED 0x03
48 #define MINIMIZED 0x07
50 typedef 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
;
68 #define LINK_HEADER_SIZE (sizeof(LINK_HEADER)-sizeof(ITEMIDLIST))
87 GRPICONDIRENTRY idEntries
[1];
113 static ICOM_VTABLE(IShellLinkA
) slvt
;
114 static ICOM_VTABLE(IShellLinkW
) slvtw
;
115 static ICOM_VTABLE(IPersistFile
) pfvt
;
116 static ICOM_VTABLE(IPersistStream
) psvt
;
118 /* IShellLink Implementation */
122 ICOM_VFIELD(IShellLinkA
);
125 ICOM_VTABLE(IShellLinkW
)* lpvtblw
;
126 ICOM_VTABLE(IPersistFile
)* lpvtblPersistFile
;
127 ICOM_VTABLE(IPersistStream
)* lpvtblPersistStream
;
129 /* internal stream of the IPersistFile interface */
130 IStream
* lpFileStream
;
132 /* data structures according to the informations in the lnk */
147 #define _IShellLinkW_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblw)))
148 #define _ICOM_THIS_From_IShellLinkW(class, name) class* This = (class*)(((char*)name)-_IShellLinkW_Offset);
150 #define _IPersistFile_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblPersistFile)))
151 #define _ICOM_THIS_From_IPersistFile(class, name) class* This = (class*)(((char*)name)-_IPersistFile_Offset);
153 #define _IPersistStream_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblPersistStream)))
154 #define _ICOM_THIS_From_IPersistStream(class, name) class* This = (class*)(((char*)name)-_IPersistStream_Offset);
155 #define _IPersistStream_From_ICOM_THIS(class, name) class* StreamThis = (class*)(((char*)name)+_IPersistStream_Offset);
157 /**************************************************************************
158 * IPersistFile_QueryInterface
160 static HRESULT WINAPI
IPersistFile_fnQueryInterface(
165 _ICOM_THIS_From_IPersistFile(IShellLinkImpl
, iface
)
167 TRACE("(%p)\n",This
);
169 return IShellLinkA_QueryInterface((IShellLinkA
*)This
, riid
, ppvObj
);
172 /******************************************************************************
173 * IPersistFile_AddRef
175 static ULONG WINAPI
IPersistFile_fnAddRef(IPersistFile
* iface
)
177 _ICOM_THIS_From_IPersistFile(IShellLinkImpl
, iface
)
179 TRACE("(%p)->(count=%lu)\n",This
,This
->ref
);
181 return IShellLinkA_AddRef((IShellLinkA
*)This
);
183 /******************************************************************************
184 * IPersistFile_Release
186 static ULONG WINAPI
IPersistFile_fnRelease(IPersistFile
* iface
)
188 _ICOM_THIS_From_IPersistFile(IShellLinkImpl
, iface
)
190 TRACE("(%p)->(count=%lu)\n",This
,This
->ref
);
192 return IShellLinkA_Release((IShellLinkA
*)This
);
195 static HRESULT WINAPI
IPersistFile_fnGetClassID(IPersistFile
* iface
, CLSID
*pClassID
)
197 _ICOM_THIS_From_IPersistFile(IShellLinkImpl
, iface
)
198 FIXME("(%p)\n",This
);
201 static HRESULT WINAPI
IPersistFile_fnIsDirty(IPersistFile
* iface
)
203 _ICOM_THIS_From_IPersistFile(IShellLinkImpl
, iface
)
204 FIXME("(%p)\n",This
);
207 static HRESULT WINAPI
IPersistFile_fnLoad(IPersistFile
* iface
, LPCOLESTR pszFileName
, DWORD dwMode
)
209 _ICOM_THIS_From_IPersistFile(IShellLinkImpl
, iface
)
210 _IPersistStream_From_ICOM_THIS(IPersistStream
, This
)
212 LPSTR sFile
= HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName
);
213 HRESULT hRet
= E_FAIL
;
215 TRACE("(%p, %s)\n",This
, sFile
);
218 if (This
->lpFileStream
)
219 IStream_Release(This
->lpFileStream
);
221 if SUCCEEDED(CreateStreamOnFile(sFile
, &(This
->lpFileStream
)))
223 if SUCCEEDED (IPersistStream_Load(StreamThis
, This
->lpFileStream
))
233 /* Icon extraction routines
235 * FIXME: should use PrivateExtractIcons and friends
236 * FIXME: should not use stdio
239 static BOOL
SaveIconResAsXPM(const BITMAPINFO
*pIcon
, const char *szXPMFileName
)
249 BOOL aColorUsed
[256] = {0};
253 if (!((pIcon
->bmiHeader
.biBitCount
== 4) || (pIcon
->bmiHeader
.biBitCount
== 8)))
256 if (!(fXPMFile
= fopen(szXPMFileName
, "w")))
259 nHeight
= pIcon
->bmiHeader
.biHeight
/ 2;
260 nXORWidthBytes
= 4 * ((pIcon
->bmiHeader
.biWidth
* pIcon
->bmiHeader
.biBitCount
/ 32)
261 + ((pIcon
->bmiHeader
.biWidth
* pIcon
->bmiHeader
.biBitCount
% 32) > 0));
262 nANDWidthBytes
= 4 * ((pIcon
->bmiHeader
.biWidth
/ 32)
263 + ((pIcon
->bmiHeader
.biWidth
% 32) > 0));
264 b8BitColors
= pIcon
->bmiHeader
.biBitCount
== 8;
265 nColors
= pIcon
->bmiHeader
.biClrUsed
? pIcon
->bmiHeader
.biClrUsed
266 : 1 << pIcon
->bmiHeader
.biBitCount
;
267 pXOR
= (BYTE
*) pIcon
+ sizeof (BITMAPINFOHEADER
) + (nColors
* sizeof (RGBQUAD
));
268 pAND
= pXOR
+ nHeight
* nXORWidthBytes
;
270 #define MASK(x,y) (pAND[(x) / 8 + (nHeight - (y) - 1) * nANDWidthBytes] & (1 << (7 - (x) % 8)))
271 #define COLOR(x,y) (b8BitColors ? pXOR[(x) + (nHeight - (y) - 1) * nXORWidthBytes] : (x) % 2 ? pXOR[(x) / 2 + (nHeight - (y) - 1) * nXORWidthBytes] & 0xF : (pXOR[(x) / 2 + (nHeight - (y) - 1) * nXORWidthBytes] & 0xF0) >> 4)
273 for (i
= 0; i
< nHeight
; i
++)
274 for (j
= 0; j
< pIcon
->bmiHeader
.biWidth
; j
++)
275 if (!aColorUsed
[COLOR(j
,i
)] && !MASK(j
,i
))
277 aColorUsed
[COLOR(j
,i
)] = TRUE
;
281 if (fprintf(fXPMFile
, "/* XPM */\nstatic char *icon[] = {\n") <= 0)
283 if (fprintf(fXPMFile
, "\"%d %d %d %d\",\n",
284 (int) pIcon
->bmiHeader
.biWidth
, nHeight
, nColorsUsed
+ 1, 2) <=0)
287 for (i
= 0; i
< nColors
; i
++)
289 if (fprintf(fXPMFile
, "\"%.2X c #%.2X%.2X%.2X\",\n", i
, pIcon
->bmiColors
[i
].rgbRed
,
290 pIcon
->bmiColors
[i
].rgbGreen
, pIcon
->bmiColors
[i
].rgbBlue
) <= 0)
292 if (fprintf(fXPMFile
, "\" c None\"") <= 0)
295 for (i
= 0; i
< nHeight
; i
++)
297 if (fprintf(fXPMFile
, ",\n\"") <= 0)
299 for (j
= 0; j
< pIcon
->bmiHeader
.biWidth
; j
++)
303 if (fprintf(fXPMFile
, " ") <= 0)
307 if (fprintf(fXPMFile
, "%.2X", COLOR(j
,i
)) <= 0)
310 if (fprintf(fXPMFile
, "\"") <= 0)
313 if (fprintf(fXPMFile
, "};\n") <= 0)
324 unlink( szXPMFileName
);
328 static BOOL CALLBACK
EnumResNameProc(HANDLE hModule
, const char *lpszType
, char *lpszName
, LONG lParam
)
330 *(HRSRC
*) lParam
= FindResourceA(hModule
, lpszName
, RT_GROUP_ICONA
);
334 static int ExtractFromEXEDLL(const char *szFileName
, int nIndex
, const char *szXPMFileName
)
340 GRPICONDIR
*pIconDir
;
345 if (!(hModule
= LoadLibraryExA(szFileName
, 0, LOAD_LIBRARY_AS_DATAFILE
)))
347 TRACE("LoadLibraryExA (%s) failed, error %ld\n", szFileName
, GetLastError());
353 hResInfo
= FindResourceA(hModule
, MAKEINTRESOURCEA(nIndex
), RT_GROUP_ICONA
);
354 TRACE("FindResourceA (%s) called, return 0x%x, error %ld\n", szFileName
, hResInfo
, GetLastError());
357 if (EnumResourceNamesA(hModule
, RT_GROUP_ICONA
, &EnumResNameProc
, (LONG
) &hResInfo
))
359 TRACE("EnumResourceNamesA failed, error %ld\n", GetLastError());
365 TRACE("ExtractFromEXEDLL failed, error %ld\n", GetLastError());
369 if (!(hResData
= LoadResource(hModule
, hResInfo
)))
371 TRACE("LoadResource failed, error %ld\n", GetLastError());
374 if (!(pIconDir
= LockResource(hResData
)))
376 TRACE("LockResource failed, error %ld\n", GetLastError());
380 for (i
= 0; i
< pIconDir
->idCount
; i
++)
381 if ((pIconDir
->idEntries
[i
].bHeight
* pIconDir
->idEntries
[i
].bWidth
) > nMax
)
383 lpName
= MAKEINTRESOURCEA(pIconDir
->idEntries
[i
].nID
);
384 nMax
= pIconDir
->idEntries
[i
].bHeight
* pIconDir
->idEntries
[i
].bWidth
;
387 FreeResource(hResData
);
389 if (!(hResInfo
= FindResourceA(hModule
, lpName
, RT_ICONA
)))
391 TRACE("Second FindResourceA failed, error %ld\n", GetLastError());
394 if (!(hResData
= LoadResource(hModule
, hResInfo
)))
396 TRACE("Second LoadResource failed, error %ld\n", GetLastError());
399 if (!(pIcon
= LockResource(hResData
)))
401 TRACE("Second LockResource failed, error %ld\n", GetLastError());
405 if(!SaveIconResAsXPM(pIcon
, szXPMFileName
))
407 TRACE("Failed saving icon as XPM, error %ld\n", GetLastError());
411 FreeResource(hResData
);
412 FreeLibrary(hModule
);
417 FreeResource(hResData
);
419 FreeLibrary(hModule
);
424 static int ExtractFromICO(const char *szFileName
, const char *szXPMFileName
)
428 ICONDIRENTRY
*pIconDirEntry
;
434 if (!(fICOFile
= fopen(szFileName
, "r")))
437 if (fread(&iconDir
, sizeof (ICONDIR
), 1, fICOFile
) != 1)
439 if ((iconDir
.idReserved
!= 0) || (iconDir
.idType
!= 1))
442 if ((pIconDirEntry
= malloc(iconDir
.idCount
* sizeof (ICONDIRENTRY
))) == NULL
)
444 if (fread(pIconDirEntry
, sizeof (ICONDIRENTRY
), iconDir
.idCount
, fICOFile
) != iconDir
.idCount
)
447 for (i
= 0; i
< iconDir
.idCount
; i
++)
448 if ((pIconDirEntry
[i
].bHeight
* pIconDirEntry
[i
].bWidth
) > nMax
)
451 nMax
= pIconDirEntry
[i
].bHeight
* pIconDirEntry
[i
].bWidth
;
453 if ((pIcon
= malloc(pIconDirEntry
[nIndex
].dwBytesInRes
)) == NULL
)
455 if (fseek(fICOFile
, pIconDirEntry
[nIndex
].dwImageOffset
, SEEK_SET
))
457 if (fread(pIcon
, pIconDirEntry
[nIndex
].dwBytesInRes
, 1, fICOFile
) != 1)
460 if(!SaveIconResAsXPM(pIcon
, szXPMFileName
))
479 /* get the Unix file name for a given path, allocating the string */
480 inline static char *get_unix_file_name( const char *dos
)
482 char buffer
[MAX_PATH
];
484 if (!wine_get_unix_file_name( dos
, buffer
, sizeof(buffer
) )) return NULL
;
485 return HEAP_strdupA( GetProcessHeap(), 0, buffer
);
488 static BOOL
create_default_icon( const char *filename
)
493 if (!(fXPM
= fopen(filename
, "w"))) return FALSE
;
494 fprintf(fXPM
, "/* XPM */\nstatic char * icon[] = {");
495 for (i
= 0; i
< sizeof(wine_xpm
)/sizeof(wine_xpm
[0]); i
++)
496 fprintf( fXPM
, "\n\"%s\",", wine_xpm
[i
]);
497 fprintf( fXPM
, "};\n" );
502 /* extract an icon from an exe or icon file; helper for IPersistFile_fnSave */
503 static char *extract_icon( const char *path
, int index
)
505 char *filename
= HEAP_strdupA( GetProcessHeap(), 0, tmpnam(NULL
) );
506 if (ExtractFromEXEDLL( path
, index
, filename
)) return filename
;
507 if (ExtractFromICO( path
, filename
)) return filename
;
508 if (create_default_icon( filename
)) return filename
;
509 HeapFree( GetProcessHeap(), 0, filename
);
514 static HRESULT WINAPI
IPersistFile_fnSave(IPersistFile
* iface
, LPCOLESTR pszFileName
, BOOL fRemember
)
516 HRESULT ret
= NOERROR
;
518 char buffer
[MAX_PATH
], buff2
[MAX_PATH
];
519 char *filename
, *link_name
, *p
;
520 char *shell_link_app
= NULL
;
521 char *icon_name
= NULL
;
522 char *path_name
= NULL
;
523 char *work_dir
= NULL
;
527 _ICOM_THIS_From_IPersistFile(IShellLinkImpl
, iface
);
529 TRACE("(%p)->(%s)\n",This
,debugstr_w(pszFileName
));
531 if (!pszFileName
|| !This
->sPath
)
532 return ERROR_UNKNOWN
;
534 /* check for .exe extension */
535 if (!(p
= strrchr( This
->sPath
, '.' ))) return NOERROR
;
536 if (strchr( p
, '\\' ) || strchr( p
, '/' )) return NOERROR
;
537 if (strcasecmp( p
, ".exe" )) return NOERROR
;
539 /* check if ShellLinker configured */
541 if (!RegOpenKeyExA( HKEY_LOCAL_MACHINE
, "Software\\Wine\\Wine\\Config\\Wine",
542 0, KEY_ALL_ACCESS
, &hkey
))
544 DWORD type
, count
= sizeof(buffer
);
545 if (RegQueryValueExA( hkey
, "ShellLinker", 0, &type
, buffer
, &count
)) buffer
[0] = 0;
548 if (!*buffer
) return NOERROR
;
549 shell_link_app
= HEAP_strdupA( GetProcessHeap(), 0, buffer
);
551 if (!WideCharToMultiByte( CP_ACP
, 0, pszFileName
, -1, buffer
, sizeof(buffer
), NULL
, NULL
))
552 return ERROR_UNKNOWN
;
553 GetFullPathNameA( buffer
, sizeof(buff2
), buff2
, NULL
);
554 filename
= HEAP_strdupA( GetProcessHeap(), 0, buff2
);
556 if (SHGetSpecialFolderPathA( 0, buffer
, CSIDL_STARTUP
, FALSE
))
558 /* ignore startup for now */
559 if (!strncasecmp( filename
, buffer
, strlen(buffer
) )) goto done
;
561 if (SHGetSpecialFolderPathA( 0, buffer
, CSIDL_DESKTOPDIRECTORY
, FALSE
))
563 if (!strncasecmp( filename
, buffer
, strlen(buffer
) ))
565 link_name
= filename
+ strlen(buffer
);
570 if (SHGetSpecialFolderPathA( 0, buffer
, CSIDL_STARTMENU
, FALSE
))
572 if (!strncasecmp( filename
, buffer
, strlen(buffer
) ))
574 link_name
= filename
+ strlen(buffer
);
582 /* make link name a Unix name */
583 for (p
= link_name
; *p
; p
++) if (*p
== '\\') *p
= '/';
584 /* strip leading slashes */
585 while (*link_name
== '/') link_name
++;
586 /* remove extension */
587 if ((p
= strrchr( link_name
, '.' ))) *p
= 0;
589 /* convert app path name */
590 path_name
= get_unix_file_name( This
->sPath
);
592 /* convert app working dir */
593 if (This
->sWorkDir
) work_dir
= get_unix_file_name( This
->sWorkDir
);
595 /* extract the icon */
596 if (!(icon_name
= extract_icon( This
->sIcoPath
&& strlen(This
->sIcoPath
) ?
597 This
->sIcoPath
: This
->sPath
,
598 This
->iIcoNdx
))) goto done
;
601 TRACE("linker app='%s' link='%s' mode=%s path='%s' args='%s' icon='%s' workdir='%s' descr='%s'\n",
602 shell_link_app
, link_name
, bDesktop
? "desktop" : "menu", path_name
,
603 This
->sArgs
? This
->sArgs
: "", icon_name
, work_dir
? work_dir
: "",
604 This
->sDescription
? This
->sDescription
: "" );
606 if ((pid
= fork()) == -1) goto done
;
611 argv
[pos
++] = shell_link_app
;
612 argv
[pos
++] = "--link";
613 argv
[pos
++] = link_name
;
614 argv
[pos
++] = "--path";
615 argv
[pos
++] = path_name
;
616 argv
[pos
++] = bDesktop
? "--desktop" : "--menu";
617 if (This
->sArgs
&& strlen(This
->sArgs
))
619 argv
[pos
++] = "--args";
620 argv
[pos
++] = This
->sArgs
;
624 argv
[pos
++] = "--icon";
625 argv
[pos
++] = icon_name
;
627 if (This
->sWorkDir
&& strlen(This
->sWorkDir
))
629 argv
[pos
++] = "--workdir";
630 argv
[pos
++] = This
->sWorkDir
;
632 if (This
->sDescription
&& strlen(This
->sDescription
))
634 argv
[pos
++] = "--descr";
635 argv
[pos
++] = This
->sDescription
;
638 execvp( shell_link_app
, argv
);
642 while (waitpid( pid
, &status
, 0 ) == -1)
650 if (status
) ret
= E_ACCESSDENIED
;
653 if (icon_name
) unlink( icon_name
);
654 HeapFree( GetProcessHeap(), 0, shell_link_app
);
655 HeapFree( GetProcessHeap(), 0, filename
);
656 HeapFree( GetProcessHeap(), 0, icon_name
);
657 HeapFree( GetProcessHeap(), 0, path_name
);
658 HeapFree( GetProcessHeap(), 0, work_dir
);
662 static HRESULT WINAPI
IPersistFile_fnSaveCompleted(IPersistFile
* iface
, LPCOLESTR pszFileName
)
664 _ICOM_THIS_From_IPersistFile(IShellLinkImpl
, iface
);
665 FIXME("(%p)->(%s)\n",This
,debugstr_w(pszFileName
));
668 static HRESULT WINAPI
IPersistFile_fnGetCurFile(IPersistFile
* iface
, LPOLESTR
*ppszFileName
)
670 _ICOM_THIS_From_IPersistFile(IShellLinkImpl
, iface
);
671 FIXME("(%p)\n",This
);
675 static ICOM_VTABLE(IPersistFile
) pfvt
=
677 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
678 IPersistFile_fnQueryInterface
,
679 IPersistFile_fnAddRef
,
680 IPersistFile_fnRelease
,
681 IPersistFile_fnGetClassID
,
682 IPersistFile_fnIsDirty
,
685 IPersistFile_fnSaveCompleted
,
686 IPersistFile_fnGetCurFile
689 /************************************************************************
690 * IPersistStream_QueryInterface
692 static HRESULT WINAPI
IPersistStream_fnQueryInterface(
693 IPersistStream
* iface
,
697 _ICOM_THIS_From_IPersistStream(IShellLinkImpl
, iface
);
699 TRACE("(%p)\n",This
);
701 return IShellLinkA_QueryInterface((IShellLinkA
*)This
, riid
, ppvoid
);
704 /************************************************************************
705 * IPersistStream_Release
707 static ULONG WINAPI
IPersistStream_fnRelease(
708 IPersistStream
* iface
)
710 _ICOM_THIS_From_IPersistStream(IShellLinkImpl
, iface
);
712 TRACE("(%p)\n",This
);
714 return IShellLinkA_Release((IShellLinkA
*)This
);
717 /************************************************************************
718 * IPersistStream_AddRef
720 static ULONG WINAPI
IPersistStream_fnAddRef(
721 IPersistStream
* iface
)
723 _ICOM_THIS_From_IPersistStream(IShellLinkImpl
, iface
);
725 TRACE("(%p)\n",This
);
727 return IShellLinkA_AddRef((IShellLinkA
*)This
);
730 /************************************************************************
731 * IPersistStream_GetClassID
734 static HRESULT WINAPI
IPersistStream_fnGetClassID(
735 IPersistStream
* iface
,
738 _ICOM_THIS_From_IPersistStream(IShellLinkImpl
, iface
);
740 TRACE("(%p)\n", This
);
745 /* memcpy(pClassID, &CLSID_???, sizeof(CLSID_???)); */
750 /************************************************************************
751 * IPersistStream_IsDirty (IPersistStream)
753 static HRESULT WINAPI
IPersistStream_fnIsDirty(
754 IPersistStream
* iface
)
756 _ICOM_THIS_From_IPersistStream(IShellLinkImpl
, iface
);
758 TRACE("(%p)\n", This
);
762 /************************************************************************
763 * IPersistStream_Load (IPersistStream)
766 static HRESULT WINAPI
IPersistStream_fnLoad(
767 IPersistStream
* iface
,
768 IStream
* pLoadStream
)
770 PLINK_HEADER lpLinkHeader
= HeapAlloc(GetProcessHeap(), 0, LINK_HEADER_SIZE
);
773 char sTemp
[MAX_PATH
];
775 _ICOM_THIS_From_IPersistStream(IShellLinkImpl
, iface
);
777 TRACE("(%p)(%p)\n", This
, pLoadStream
);
781 return STG_E_INVALIDPOINTER
;
784 IStream_AddRef (pLoadStream
);
787 if (SUCCEEDED(IStream_Read(pLoadStream
, lpLinkHeader
, LINK_HEADER_SIZE
, &dwBytesRead
)))
789 if ((lpLinkHeader
->MagicStr
== 0x0000004CL
) && IsEqualIID(&lpLinkHeader
->MagicGuid
, &CLSID_ShellLink
))
791 lpLinkHeader
= HeapReAlloc(GetProcessHeap(), 0, lpLinkHeader
, LINK_HEADER_SIZE
+lpLinkHeader
->PidlSize
);
794 if (SUCCEEDED(IStream_Read(pLoadStream
, &(lpLinkHeader
->Pidl
), lpLinkHeader
->PidlSize
, &dwBytesRead
)))
796 if (pcheck (&lpLinkHeader
->Pidl
))
798 This
->pPidl
= ILClone (&lpLinkHeader
->Pidl
);
800 SHGetPathFromIDListA(&lpLinkHeader
->Pidl
, sTemp
);
801 This
->sPath
= HEAP_strdupA ( GetProcessHeap(), 0, sTemp
);
803 This
->wHotKey
= lpLinkHeader
->wHotKey
;
804 FileTimeToSystemTime (&lpLinkHeader
->Time1
, &This
->time1
);
805 FileTimeToSystemTime (&lpLinkHeader
->Time2
, &This
->time2
);
806 FileTimeToSystemTime (&lpLinkHeader
->Time3
, &This
->time3
);
808 GetDateFormatA(LOCALE_USER_DEFAULT
,DATE_SHORTDATE
,&This
->time1
, NULL
, sTemp
, 256);
809 TRACE("-- time1: %s\n", sTemp
);
810 GetDateFormatA(LOCALE_USER_DEFAULT
,DATE_SHORTDATE
,&This
->time2
, NULL
, sTemp
, 256);
811 TRACE("-- time1: %s\n", sTemp
);
812 GetDateFormatA(LOCALE_USER_DEFAULT
,DATE_SHORTDATE
,&This
->time3
, NULL
, sTemp
, 256);
813 TRACE("-- time1: %s\n", sTemp
);
822 WARN("stream contains no link!\n");
827 IStream_Release (pLoadStream
);
831 HeapFree(GetProcessHeap(), 0, lpLinkHeader
);
836 /************************************************************************
837 * IPersistStream_Save (IPersistStream)
839 static HRESULT WINAPI
IPersistStream_fnSave(
840 IPersistStream
* iface
,
844 _ICOM_THIS_From_IPersistStream(IShellLinkImpl
, iface
);
846 TRACE("(%p) %p %x\n", This
, pOutStream
, fClearDirty
);
851 /************************************************************************
852 * IPersistStream_GetSizeMax (IPersistStream)
854 static HRESULT WINAPI
IPersistStream_fnGetSizeMax(
855 IPersistStream
* iface
,
856 ULARGE_INTEGER
* pcbSize
)
858 _ICOM_THIS_From_IPersistStream(IShellLinkImpl
, iface
);
860 TRACE("(%p)\n", This
);
865 static ICOM_VTABLE(IPersistStream
) psvt
=
867 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
868 IPersistStream_fnQueryInterface
,
869 IPersistStream_fnAddRef
,
870 IPersistStream_fnRelease
,
871 IPersistStream_fnGetClassID
,
872 IPersistStream_fnIsDirty
,
873 IPersistStream_fnLoad
,
874 IPersistStream_fnSave
,
875 IPersistStream_fnGetSizeMax
878 /**************************************************************************
879 * IShellLink_Constructor
881 IShellLinkA
* IShellLink_Constructor(BOOL bUnicode
)
882 { IShellLinkImpl
* sl
;
884 sl
= (IShellLinkImpl
*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IShellLinkImpl
));
886 ICOM_VTBL(sl
) = &slvt
;
887 sl
->lpvtblw
= &slvtw
;
888 sl
->lpvtblPersistFile
= &pfvt
;
889 sl
->lpvtblPersistStream
= &psvt
;
891 TRACE("(%p)->()\n",sl
);
893 return bUnicode
? (IShellLinkA
*) &(sl
->lpvtblw
) : (IShellLinkA
*)sl
;
896 /**************************************************************************
897 * IShellLinkA_QueryInterface
899 static HRESULT WINAPI
IShellLinkA_fnQueryInterface( IShellLinkA
* iface
, REFIID riid
, LPVOID
*ppvObj
)
901 ICOM_THIS(IShellLinkImpl
, iface
);
903 TRACE("(%p)->(\n\tIID:\t%s)\n",This
,debugstr_guid(riid
));
907 if(IsEqualIID(riid
, &IID_IUnknown
) ||
908 IsEqualIID(riid
, &IID_IShellLinkA
))
912 else if(IsEqualIID(riid
, &IID_IShellLinkW
))
914 *ppvObj
= (IShellLinkW
*)&(This
->lpvtblw
);
916 else if(IsEqualIID(riid
, &IID_IPersistFile
))
918 *ppvObj
= (IPersistFile
*)&(This
->lpvtblPersistFile
);
920 else if(IsEqualIID(riid
, &IID_IPersistStream
))
922 *ppvObj
= (IPersistStream
*)&(This
->lpvtblPersistStream
);
927 IUnknown_AddRef((IUnknown
*)(*ppvObj
));
928 TRACE("-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
931 TRACE("-- Interface: E_NOINTERFACE\n");
932 return E_NOINTERFACE
;
934 /******************************************************************************
937 static ULONG WINAPI
IShellLinkA_fnAddRef(IShellLinkA
* iface
)
939 ICOM_THIS(IShellLinkImpl
, iface
);
941 TRACE("(%p)->(count=%lu)\n",This
,This
->ref
);
944 return ++(This
->ref
);
946 /******************************************************************************
947 * IShellLinkA_Release
949 static ULONG WINAPI
IShellLinkA_fnRelease(IShellLinkA
* iface
)
951 ICOM_THIS(IShellLinkImpl
, iface
);
953 TRACE("(%p)->(count=%lu)\n",This
,This
->ref
);
957 { TRACE("-- destroying IShellLink(%p)\n",This
);
960 HeapFree(GetProcessHeap(), 0, This
->sIcoPath
);
963 HeapFree(GetProcessHeap(), 0, This
->sArgs
);
966 HeapFree(GetProcessHeap(), 0, This
->sWorkDir
);
968 if (This
->sDescription
)
969 HeapFree(GetProcessHeap(), 0, This
->sDescription
);
972 HeapFree(GetProcessHeap(),0,This
->sPath
);
977 if (This
->lpFileStream
)
978 IStream_Release(This
->lpFileStream
);
982 HeapFree(GetProcessHeap(),0,This
);
988 static HRESULT WINAPI
IShellLinkA_fnGetPath(IShellLinkA
* iface
, LPSTR pszFile
,INT cchMaxPath
, WIN32_FIND_DATAA
*pfd
, DWORD fFlags
)
990 ICOM_THIS(IShellLinkImpl
, iface
);
992 TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)(%s)\n",This
, pszFile
, cchMaxPath
, pfd
, fFlags
, debugstr_a(This
->sPath
));
995 lstrcpynA(pszFile
,This
->sPath
, cchMaxPath
);
1001 static HRESULT WINAPI
IShellLinkA_fnGetIDList(IShellLinkA
* iface
, LPITEMIDLIST
* ppidl
)
1003 ICOM_THIS(IShellLinkImpl
, iface
);
1005 TRACE("(%p)->(ppidl=%p)\n",This
, ppidl
);
1007 *ppidl
= ILClone(This
->pPidl
);
1010 static HRESULT WINAPI
IShellLinkA_fnSetIDList(IShellLinkA
* iface
, LPCITEMIDLIST pidl
)
1012 ICOM_THIS(IShellLinkImpl
, iface
);
1014 TRACE("(%p)->(pidl=%p)\n",This
, pidl
);
1017 SHFree(This
->pPidl
);
1018 This
->pPidl
= ILClone (pidl
);
1021 static HRESULT WINAPI
IShellLinkA_fnGetDescription(IShellLinkA
* iface
, LPSTR pszName
,INT cchMaxName
)
1023 ICOM_THIS(IShellLinkImpl
, iface
);
1025 FIXME("(%p)->(%p len=%u)\n",This
, pszName
, cchMaxName
);
1026 lstrcpynA(pszName
,"Description, FIXME",cchMaxName
);
1029 static HRESULT WINAPI
IShellLinkA_fnSetDescription(IShellLinkA
* iface
, LPCSTR pszName
)
1031 ICOM_THIS(IShellLinkImpl
, iface
);
1033 TRACE("(%p)->(pName=%s)\n", This
, pszName
);
1035 if (This
->sDescription
)
1036 HeapFree(GetProcessHeap(), 0, This
->sDescription
);
1037 if (!(This
->sDescription
= HEAP_strdupA(GetProcessHeap(), 0, pszName
)))
1038 return E_OUTOFMEMORY
;
1042 static HRESULT WINAPI
IShellLinkA_fnGetWorkingDirectory(IShellLinkA
* iface
, LPSTR pszDir
,INT cchMaxPath
)
1044 ICOM_THIS(IShellLinkImpl
, iface
);
1046 TRACE("(%p)->(%p len=%u)\n", This
, pszDir
, cchMaxPath
);
1048 lstrcpynA( pszDir
, This
->sWorkDir
? This
->sWorkDir
: "", cchMaxPath
);
1052 static HRESULT WINAPI
IShellLinkA_fnSetWorkingDirectory(IShellLinkA
* iface
, LPCSTR pszDir
)
1054 ICOM_THIS(IShellLinkImpl
, iface
);
1056 TRACE("(%p)->(dir=%s)\n",This
, pszDir
);
1059 HeapFree(GetProcessHeap(), 0, This
->sWorkDir
);
1060 if (!(This
->sWorkDir
= HEAP_strdupA(GetProcessHeap(), 0, pszDir
)))
1061 return E_OUTOFMEMORY
;
1065 static HRESULT WINAPI
IShellLinkA_fnGetArguments(IShellLinkA
* iface
, LPSTR pszArgs
,INT cchMaxPath
)
1067 ICOM_THIS(IShellLinkImpl
, iface
);
1069 TRACE("(%p)->(%p len=%u)\n", This
, pszArgs
, cchMaxPath
);
1071 lstrcpynA( pszArgs
, This
->sArgs
? This
->sArgs
: "", cchMaxPath
);
1075 static HRESULT WINAPI
IShellLinkA_fnSetArguments(IShellLinkA
* iface
, LPCSTR pszArgs
)
1077 ICOM_THIS(IShellLinkImpl
, iface
);
1079 TRACE("(%p)->(args=%s)\n",This
, pszArgs
);
1082 HeapFree(GetProcessHeap(), 0, This
->sArgs
);
1083 if (!(This
->sArgs
= HEAP_strdupA(GetProcessHeap(), 0, pszArgs
)))
1084 return E_OUTOFMEMORY
;
1088 static HRESULT WINAPI
IShellLinkA_fnGetHotkey(IShellLinkA
* iface
, WORD
*pwHotkey
)
1090 ICOM_THIS(IShellLinkImpl
, iface
);
1092 TRACE("(%p)->(%p)(0x%08x)\n",This
, pwHotkey
, This
->wHotKey
);
1094 *pwHotkey
= This
->wHotKey
;
1098 static HRESULT WINAPI
IShellLinkA_fnSetHotkey(IShellLinkA
* iface
, WORD wHotkey
)
1100 ICOM_THIS(IShellLinkImpl
, iface
);
1102 TRACE("(%p)->(hotkey=%x)\n",This
, wHotkey
);
1104 This
->wHotKey
= wHotkey
;
1108 static HRESULT WINAPI
IShellLinkA_fnGetShowCmd(IShellLinkA
* iface
, INT
*piShowCmd
)
1110 ICOM_THIS(IShellLinkImpl
, iface
);
1112 FIXME("(%p)->(%p)\n",This
, piShowCmd
);
1116 static HRESULT WINAPI
IShellLinkA_fnSetShowCmd(IShellLinkA
* iface
, INT iShowCmd
)
1118 ICOM_THIS(IShellLinkImpl
, iface
);
1120 FIXME("(%p)->(showcmd=%x)\n",This
, iShowCmd
);
1123 static HRESULT WINAPI
IShellLinkA_fnGetIconLocation(IShellLinkA
* iface
, LPSTR pszIconPath
,INT cchIconPath
,INT
*piIcon
)
1125 ICOM_THIS(IShellLinkImpl
, iface
);
1127 TRACE("(%p)->(%p len=%u iicon=%p)\n", This
, pszIconPath
, cchIconPath
, piIcon
);
1129 lstrcpynA( pszIconPath
, This
->sIcoPath
? This
->sIcoPath
: "", cchIconPath
);
1130 *piIcon
= This
->iIcoNdx
;
1134 static HRESULT WINAPI
IShellLinkA_fnSetIconLocation(IShellLinkA
* iface
, LPCSTR pszIconPath
,INT iIcon
)
1136 ICOM_THIS(IShellLinkImpl
, iface
);
1138 TRACE("(%p)->(path=%s iicon=%u)\n",This
, pszIconPath
, iIcon
);
1141 HeapFree(GetProcessHeap(), 0, This
->sIcoPath
);
1142 if (!(This
->sIcoPath
= HEAP_strdupA(GetProcessHeap(), 0, pszIconPath
)))
1143 return E_OUTOFMEMORY
;
1144 This
->iIcoNdx
= iIcon
;
1148 static HRESULT WINAPI
IShellLinkA_fnSetRelativePath(IShellLinkA
* iface
, LPCSTR pszPathRel
, DWORD dwReserved
)
1150 ICOM_THIS(IShellLinkImpl
, iface
);
1152 FIXME("(%p)->(path=%s %lx)\n",This
, pszPathRel
, dwReserved
);
1155 static HRESULT WINAPI
IShellLinkA_fnResolve(IShellLinkA
* iface
, HWND hwnd
, DWORD fFlags
)
1157 ICOM_THIS(IShellLinkImpl
, iface
);
1159 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This
, hwnd
, fFlags
);
1162 static HRESULT WINAPI
IShellLinkA_fnSetPath(IShellLinkA
* iface
, LPCSTR pszFile
)
1164 ICOM_THIS(IShellLinkImpl
, iface
);
1166 TRACE("(%p)->(path=%s)\n",This
, pszFile
);
1169 HeapFree(GetProcessHeap(), 0, This
->sPath
);
1170 if (!(This
->sPath
= HEAP_strdupA(GetProcessHeap(), 0, pszFile
)))
1171 return E_OUTOFMEMORY
;
1176 /**************************************************************************
1177 * IShellLink Implementation
1180 static ICOM_VTABLE(IShellLinkA
) slvt
=
1182 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1183 IShellLinkA_fnQueryInterface
,
1184 IShellLinkA_fnAddRef
,
1185 IShellLinkA_fnRelease
,
1186 IShellLinkA_fnGetPath
,
1187 IShellLinkA_fnGetIDList
,
1188 IShellLinkA_fnSetIDList
,
1189 IShellLinkA_fnGetDescription
,
1190 IShellLinkA_fnSetDescription
,
1191 IShellLinkA_fnGetWorkingDirectory
,
1192 IShellLinkA_fnSetWorkingDirectory
,
1193 IShellLinkA_fnGetArguments
,
1194 IShellLinkA_fnSetArguments
,
1195 IShellLinkA_fnGetHotkey
,
1196 IShellLinkA_fnSetHotkey
,
1197 IShellLinkA_fnGetShowCmd
,
1198 IShellLinkA_fnSetShowCmd
,
1199 IShellLinkA_fnGetIconLocation
,
1200 IShellLinkA_fnSetIconLocation
,
1201 IShellLinkA_fnSetRelativePath
,
1202 IShellLinkA_fnResolve
,
1203 IShellLinkA_fnSetPath
1207 /**************************************************************************
1208 * IShellLinkW_fnQueryInterface
1210 static HRESULT WINAPI
IShellLinkW_fnQueryInterface(
1211 IShellLinkW
* iface
, REFIID riid
, LPVOID
*ppvObj
)
1213 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1215 return IShellLinkA_QueryInterface((IShellLinkA
*)This
, riid
, ppvObj
);
1218 /******************************************************************************
1219 * IShellLinkW_fnAddRef
1221 static ULONG WINAPI
IShellLinkW_fnAddRef(IShellLinkW
* iface
)
1223 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1225 TRACE("(%p)->(count=%lu)\n",This
,This
->ref
);
1227 return IShellLinkA_AddRef((IShellLinkA
*)This
);
1229 /******************************************************************************
1230 * IShellLinkW_fnRelease
1233 static ULONG WINAPI
IShellLinkW_fnRelease(IShellLinkW
* iface
)
1235 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1237 TRACE("(%p)->(count=%lu)\n",This
,This
->ref
);
1239 return IShellLinkA_Release((IShellLinkA
*)This
);
1242 static HRESULT WINAPI
IShellLinkW_fnGetPath(IShellLinkW
* iface
, LPWSTR pszFile
,INT cchMaxPath
, WIN32_FIND_DATAA
*pfd
, DWORD fFlags
)
1244 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1246 FIXME("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",This
, pszFile
, cchMaxPath
, pfd
, fFlags
);
1247 MultiByteToWideChar( CP_ACP
, 0, "c:\\foo.bar", -1, pszFile
, cchMaxPath
);
1251 static HRESULT WINAPI
IShellLinkW_fnGetIDList(IShellLinkW
* iface
, LPITEMIDLIST
* ppidl
)
1253 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1255 FIXME("(%p)->(ppidl=%p)\n",This
, ppidl
);
1256 *ppidl
= _ILCreateDesktop();
1260 static HRESULT WINAPI
IShellLinkW_fnSetIDList(IShellLinkW
* iface
, LPCITEMIDLIST pidl
)
1262 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1264 FIXME("(%p)->(pidl=%p)\n",This
, pidl
);
1268 static HRESULT WINAPI
IShellLinkW_fnGetDescription(IShellLinkW
* iface
, LPWSTR pszName
,INT cchMaxName
)
1270 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1272 FIXME("(%p)->(%p len=%u)\n",This
, pszName
, cchMaxName
);
1273 MultiByteToWideChar( CP_ACP
, 0, "Description, FIXME", -1, pszName
, cchMaxName
);
1277 static HRESULT WINAPI
IShellLinkW_fnSetDescription(IShellLinkW
* iface
, LPCWSTR pszName
)
1279 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1281 TRACE("(%p)->(desc=%s)\n",This
, debugstr_w(pszName
));
1283 if (This
->sDescription
)
1284 HeapFree(GetProcessHeap(), 0, This
->sDescription
);
1285 if (!(This
->sDescription
= HEAP_strdupWtoA(GetProcessHeap(), 0, pszName
)))
1286 return E_OUTOFMEMORY
;
1291 static HRESULT WINAPI
IShellLinkW_fnGetWorkingDirectory(IShellLinkW
* iface
, LPWSTR pszDir
,INT cchMaxPath
)
1293 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1295 TRACE("(%p)->(%p len %u)\n", This
, pszDir
, cchMaxPath
);
1297 MultiByteToWideChar( CP_ACP
, 0, This
->sWorkDir
? This
->sWorkDir
: "", -1, pszDir
, cchMaxPath
);
1302 static HRESULT WINAPI
IShellLinkW_fnSetWorkingDirectory(IShellLinkW
* iface
, LPCWSTR pszDir
)
1304 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1306 TRACE("(%p)->(dir=%s)\n",This
, debugstr_w(pszDir
));
1309 HeapFree(GetProcessHeap(), 0, This
->sWorkDir
);
1310 if (!(This
->sWorkDir
= HEAP_strdupWtoA(GetProcessHeap(), 0, pszDir
)))
1311 return E_OUTOFMEMORY
;
1316 static HRESULT WINAPI
IShellLinkW_fnGetArguments(IShellLinkW
* iface
, LPWSTR pszArgs
,INT cchMaxPath
)
1318 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1320 TRACE("(%p)->(%p len=%u)\n", This
, pszArgs
, cchMaxPath
);
1322 MultiByteToWideChar( CP_ACP
, 0, This
->sArgs
? This
->sArgs
: "", -1, pszArgs
, cchMaxPath
);
1327 static HRESULT WINAPI
IShellLinkW_fnSetArguments(IShellLinkW
* iface
, LPCWSTR pszArgs
)
1329 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1331 TRACE("(%p)->(args=%s)\n",This
, debugstr_w(pszArgs
));
1334 HeapFree(GetProcessHeap(), 0, This
->sArgs
);
1335 if (!(This
->sArgs
= HEAP_strdupWtoA(GetProcessHeap(), 0, pszArgs
)))
1336 return E_OUTOFMEMORY
;
1341 static HRESULT WINAPI
IShellLinkW_fnGetHotkey(IShellLinkW
* iface
, WORD
*pwHotkey
)
1343 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1345 FIXME("(%p)->(%p)\n",This
, pwHotkey
);
1350 static HRESULT WINAPI
IShellLinkW_fnSetHotkey(IShellLinkW
* iface
, WORD wHotkey
)
1352 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1354 FIXME("(%p)->(hotkey=%x)\n",This
, wHotkey
);
1358 static HRESULT WINAPI
IShellLinkW_fnGetShowCmd(IShellLinkW
* iface
, INT
*piShowCmd
)
1360 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1362 FIXME("(%p)->(%p)\n",This
, piShowCmd
);
1367 static HRESULT WINAPI
IShellLinkW_fnSetShowCmd(IShellLinkW
* iface
, INT iShowCmd
)
1369 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1371 FIXME("(%p)->(showcmd=%x)\n",This
, iShowCmd
);
1375 static HRESULT WINAPI
IShellLinkW_fnGetIconLocation(IShellLinkW
* iface
, LPWSTR pszIconPath
,INT cchIconPath
,INT
*piIcon
)
1377 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1379 TRACE("(%p)->(%p len=%u iicon=%p)\n", This
, pszIconPath
, cchIconPath
, piIcon
);
1381 MultiByteToWideChar( CP_ACP
, 0, This
->sIcoPath
? This
->sIcoPath
: "", -1, pszIconPath
, cchIconPath
);
1382 *piIcon
= This
->iIcoNdx
;
1387 static HRESULT WINAPI
IShellLinkW_fnSetIconLocation(IShellLinkW
* iface
, LPCWSTR pszIconPath
,INT iIcon
)
1389 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1391 TRACE("(%p)->(path=%s iicon=%u)\n",This
, debugstr_w(pszIconPath
), iIcon
);
1394 HeapFree(GetProcessHeap(), 0, This
->sIcoPath
);
1395 if (!(This
->sIcoPath
= HEAP_strdupWtoA(GetProcessHeap(), 0, pszIconPath
)))
1396 return E_OUTOFMEMORY
;
1397 This
->iIcoNdx
= iIcon
;
1402 static HRESULT WINAPI
IShellLinkW_fnSetRelativePath(IShellLinkW
* iface
, LPCWSTR pszPathRel
, DWORD dwReserved
)
1404 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1406 FIXME("(%p)->(path=%s %lx)\n",This
, debugstr_w(pszPathRel
), dwReserved
);
1410 static HRESULT WINAPI
IShellLinkW_fnResolve(IShellLinkW
* iface
, HWND hwnd
, DWORD fFlags
)
1412 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1414 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This
, hwnd
, fFlags
);
1418 static HRESULT WINAPI
IShellLinkW_fnSetPath(IShellLinkW
* iface
, LPCWSTR pszFile
)
1420 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl
, iface
);
1422 TRACE("(%p)->(path=%s)\n",This
, debugstr_w(pszFile
));
1425 HeapFree(GetProcessHeap(), 0, This
->sPath
);
1426 if (!(This
->sPath
= HEAP_strdupWtoA(GetProcessHeap(), 0, pszFile
)))
1427 return E_OUTOFMEMORY
;
1432 /**************************************************************************
1433 * IShellLinkW Implementation
1436 static ICOM_VTABLE(IShellLinkW
) slvtw
=
1438 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1439 IShellLinkW_fnQueryInterface
,
1440 IShellLinkW_fnAddRef
,
1441 IShellLinkW_fnRelease
,
1442 IShellLinkW_fnGetPath
,
1443 IShellLinkW_fnGetIDList
,
1444 IShellLinkW_fnSetIDList
,
1445 IShellLinkW_fnGetDescription
,
1446 IShellLinkW_fnSetDescription
,
1447 IShellLinkW_fnGetWorkingDirectory
,
1448 IShellLinkW_fnSetWorkingDirectory
,
1449 IShellLinkW_fnGetArguments
,
1450 IShellLinkW_fnSetArguments
,
1451 IShellLinkW_fnGetHotkey
,
1452 IShellLinkW_fnSetHotkey
,
1453 IShellLinkW_fnGetShowCmd
,
1454 IShellLinkW_fnSetShowCmd
,
1455 IShellLinkW_fnGetIconLocation
,
1456 IShellLinkW_fnSetIconLocation
,
1457 IShellLinkW_fnSetRelativePath
,
1458 IShellLinkW_fnResolve
,
1459 IShellLinkW_fnSetPath