3 * Copyright 1997 Marcus Meissner
4 * Copyright 1998 Juergen Schmied
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifdef HAVE_SYS_WAIT_H
30 # include <sys/wait.h>
32 #include "wine/debug.h"
33 #include "wine/port.h"
40 #include "undocshell.h"
41 #include "bitmaps/wine.xpm"
45 #include "shell32_main.h"
48 WINE_DEFAULT_DEBUG_CHANNEL(shell);
50 /* link file formats */
54 /* flag1: lnk elements: simple link has 0x0B */
62 #define MAXIMIZED 0x03
63 #define MINIMIZED 0x07
65 typedef struct _LINK_HEADER
66 { DWORD MagicStr; /* 0x00 'L','\0','\0','\0' */
67 GUID MagicGuid; /* 0x04 is CLSID_ShellLink */
68 DWORD Flag1; /* 0x14 describes elements following */
69 DWORD Flag2; /* 0x18 */
70 FILETIME Time1; /* 0x1c */
71 FILETIME Time2; /* 0x24 */
72 FILETIME Time3; /* 0x2c */
73 DWORD Unknown1; /* 0x34 */
74 DWORD Unknown2; /* 0x38 icon number */
75 DWORD fStartup; /* 0x3c startup type */
76 DWORD wHotKey; /* 0x40 hotkey */
77 DWORD Unknown5; /* 0x44 */
78 DWORD Unknown6; /* 0x48 */
79 USHORT PidlSize; /* 0x4c */
80 ITEMIDLIST Pidl; /* 0x4e */
81 } LINK_HEADER, * PLINK_HEADER;
83 #define LINK_HEADER_SIZE (sizeof(LINK_HEADER)-sizeof(ITEMIDLIST))
102 GRPICONDIRENTRY idEntries[1];
133 static ICOM_VTABLE(IShellLinkA) slvt;
134 static ICOM_VTABLE(IShellLinkW) slvtw;
135 static ICOM_VTABLE(IPersistFile) pfvt;
136 static ICOM_VTABLE(IPersistStream) psvt;
138 /* IShellLink Implementation */
142 ICOM_VFIELD(IShellLinkA);
145 ICOM_VTABLE(IShellLinkW)* lpvtblw;
146 ICOM_VTABLE(IPersistFile)* lpvtblPersistFile;
147 ICOM_VTABLE(IPersistStream)* lpvtblPersistStream;
149 /* internal stream of the IPersistFile interface */
150 IStream* lpFileStream;
152 /* data structures according to the informations in the lnk */
167 #define _IShellLinkW_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblw)))
168 #define _ICOM_THIS_From_IShellLinkW(class, name) class* This = (class*)(((char*)name)-_IShellLinkW_Offset);
170 #define _IPersistFile_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblPersistFile)))
171 #define _ICOM_THIS_From_IPersistFile(class, name) class* This = (class*)(((char*)name)-_IPersistFile_Offset);
173 #define _IPersistStream_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblPersistStream)))
174 #define _ICOM_THIS_From_IPersistStream(class, name) class* This = (class*)(((char*)name)-_IPersistStream_Offset);
175 #define _IPersistStream_From_ICOM_THIS(class, name) class* StreamThis = (class*)(((char*)name)+_IPersistStream_Offset);
178 /* strdup on the process heap */
179 inline static LPSTR heap_strdup( LPCSTR str )
181 INT len = strlen(str) + 1;
182 LPSTR p = HeapAlloc( GetProcessHeap(), 0, len );
183 if (p) memcpy( p, str, len );
188 /**************************************************************************
189 * IPersistFile_QueryInterface
191 static HRESULT WINAPI IPersistFile_fnQueryInterface(
196 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
198 TRACE("(%p)\n",This);
200 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj);
203 /******************************************************************************
204 * IPersistFile_AddRef
206 static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile* iface)
208 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
210 TRACE("(%p)->(count=%lu)\n",This,This->ref);
212 return IShellLinkA_AddRef((IShellLinkA*)This);
214 /******************************************************************************
215 * IPersistFile_Release
217 static ULONG WINAPI IPersistFile_fnRelease(IPersistFile* iface)
219 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
221 TRACE("(%p)->(count=%lu)\n",This,This->ref);
223 return IShellLinkA_Release((IShellLinkA*)This);
226 static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile* iface, CLSID *pClassID)
228 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
229 FIXME("(%p)\n",This);
232 static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface)
234 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
235 FIXME("(%p)\n",This);
238 static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
240 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)
241 _IPersistStream_From_ICOM_THIS(IPersistStream, This)
243 LPSTR sFile = HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName);
244 HRESULT hRet = E_FAIL;
246 TRACE("(%p, %s)\n",This, sFile);
249 if (This->lpFileStream)
250 IStream_Release(This->lpFileStream);
252 if SUCCEEDED(CreateStreamOnFile(sFile, &(This->lpFileStream)))
254 if SUCCEEDED (IPersistStream_Load(StreamThis, This->lpFileStream))
264 /* Icon extraction routines
266 * FIXME: should use PrivateExtractIcons and friends
267 * FIXME: should not use stdio
270 static BOOL SaveIconResAsXPM(const BITMAPINFO *pIcon, const char *szXPMFileName)
280 BOOL aColorUsed[256] = {0};
284 if (!((pIcon->bmiHeader.biBitCount == 4) || (pIcon->bmiHeader.biBitCount == 8)))
287 if (!(fXPMFile = fopen(szXPMFileName, "w")))
290 nHeight = pIcon->bmiHeader.biHeight / 2;
291 nXORWidthBytes = 4 * ((pIcon->bmiHeader.biWidth * pIcon->bmiHeader.biBitCount / 32)
292 + ((pIcon->bmiHeader.biWidth * pIcon->bmiHeader.biBitCount % 32) > 0));
293 nANDWidthBytes = 4 * ((pIcon->bmiHeader.biWidth / 32)
294 + ((pIcon->bmiHeader.biWidth % 32) > 0));
295 b8BitColors = pIcon->bmiHeader.biBitCount == 8;
296 nColors = pIcon->bmiHeader.biClrUsed ? pIcon->bmiHeader.biClrUsed
297 : 1 << pIcon->bmiHeader.biBitCount;
298 pXOR = (BYTE*) pIcon + sizeof (BITMAPINFOHEADER) + (nColors * sizeof (RGBQUAD));
299 pAND = pXOR + nHeight * nXORWidthBytes;
301 #define MASK(x,y) (pAND[(x) / 8 + (nHeight - (y) - 1) * nANDWidthBytes] & (1 << (7 - (x) % 8)))
302 #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)
304 for (i = 0; i < nHeight; i++)
305 for (j = 0; j < pIcon->bmiHeader.biWidth; j++)
306 if (!aColorUsed[COLOR(j,i)] && !MASK(j,i))
308 aColorUsed[COLOR(j,i)] = TRUE;
312 if (fprintf(fXPMFile, "/* XPM */\nstatic char *icon[] = {\n") <= 0)
314 if (fprintf(fXPMFile, "\"%d %d %d %d\",\n",
315 (int) pIcon->bmiHeader.biWidth, nHeight, nColorsUsed + 1, 2) <=0)
318 for (i = 0; i < nColors; i++)
320 if (fprintf(fXPMFile, "\"%.2X c #%.2X%.2X%.2X\",\n", i, pIcon->bmiColors[i].rgbRed,
321 pIcon->bmiColors[i].rgbGreen, pIcon->bmiColors[i].rgbBlue) <= 0)
323 if (fprintf(fXPMFile, "\" c None\"") <= 0)
326 for (i = 0; i < nHeight; i++)
328 if (fprintf(fXPMFile, ",\n\"") <= 0)
330 for (j = 0; j < pIcon->bmiHeader.biWidth; j++)
334 if (fprintf(fXPMFile, " ") <= 0)
338 if (fprintf(fXPMFile, "%.2X", COLOR(j,i)) <= 0)
341 if (fprintf(fXPMFile, "\"") <= 0)
344 if (fprintf(fXPMFile, "};\n") <= 0)
355 unlink( szXPMFileName );
359 static BOOL CALLBACK EnumResNameProc(HANDLE hModule, const char *lpszType, char *lpszName, LONG lParam)
361 ENUMRESSTRUCT *sEnumRes = (ENUMRESSTRUCT *) lParam;
363 if (!sEnumRes->nIndex--)
365 *sEnumRes->pResInfo = FindResourceA(hModule, lpszName, RT_GROUP_ICONA);
372 static int ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *szXPMFileName)
378 GRPICONDIR *pIconDir;
380 ENUMRESSTRUCT sEnumRes;
385 if (!(hModule = LoadLibraryExA(szFileName, 0, LOAD_LIBRARY_AS_DATAFILE)))
387 TRACE("LoadLibraryExA (%s) failed, error %ld\n", szFileName, GetLastError());
393 hResInfo = FindResourceA(hModule, MAKEINTRESOURCEA(-nIndex), RT_GROUP_ICONA);
394 TRACE("FindResourceA (%s) called, return 0x%x, error %ld\n", szFileName, hResInfo, GetLastError());
398 sEnumRes.pResInfo = &hResInfo;
399 sEnumRes.nIndex = nIndex;
400 if (EnumResourceNamesA(hModule, RT_GROUP_ICONA, &EnumResNameProc, (LONG) &sEnumRes))
402 TRACE("EnumResourceNamesA failed, error %ld\n", GetLastError());
409 TRACE("ExtractFromEXEDLL failed, error %ld\n", GetLastError());
413 if (!(hResData = LoadResource(hModule, hResInfo)))
415 TRACE("LoadResource failed, error %ld\n", GetLastError());
418 if (!(pIconDir = LockResource(hResData)))
420 TRACE("LockResource failed, error %ld\n", GetLastError());
424 for (i = 0; i < pIconDir->idCount; i++)
425 if ((pIconDir->idEntries[i].wBitCount >= nMaxBits) && (pIconDir->idEntries[i].wBitCount <= 8))
427 if (pIconDir->idEntries[i].wBitCount > nMaxBits)
429 nMaxBits = pIconDir->idEntries[i].wBitCount;
432 if ((pIconDir->idEntries[i].bHeight * pIconDir->idEntries[i].bWidth) > nMax)
434 lpName = MAKEINTRESOURCEA(pIconDir->idEntries[i].nID);
435 nMax = pIconDir->idEntries[i].bHeight * pIconDir->idEntries[i].bWidth;
439 FreeResource(hResData);
441 if (!(hResInfo = FindResourceA(hModule, lpName, RT_ICONA)))
443 TRACE("Second FindResourceA failed, error %ld\n", GetLastError());
446 if (!(hResData = LoadResource(hModule, hResInfo)))
448 TRACE("Second LoadResource failed, error %ld\n", GetLastError());
451 if (!(pIcon = LockResource(hResData)))
453 TRACE("Second LockResource failed, error %ld\n", GetLastError());
457 if(!SaveIconResAsXPM(pIcon, szXPMFileName))
459 TRACE("Failed saving icon as XPM, error %ld\n", GetLastError());
463 FreeResource(hResData);
464 FreeLibrary(hModule);
469 FreeResource(hResData);
471 FreeLibrary(hModule);
476 /* get the Unix file name for a given path, allocating the string */
477 inline static char *get_unix_file_name( const char *dos )
479 char buffer[MAX_PATH];
481 if (!wine_get_unix_file_name( dos, buffer, sizeof(buffer) )) return NULL;
482 return heap_strdup( buffer );
485 static int ExtractFromICO(const char *szFileName, const char *szXPMFileName)
489 ICONDIRENTRY *pIconDirEntry;
496 filename = get_unix_file_name(szFileName);
497 if (!(fICOFile = fopen(filename, "r")))
500 if (fread(&iconDir, sizeof (ICONDIR), 1, fICOFile) != 1)
502 if ((iconDir.idReserved != 0) || (iconDir.idType != 1))
505 if ((pIconDirEntry = malloc(iconDir.idCount * sizeof (ICONDIRENTRY))) == NULL)
507 if (fread(pIconDirEntry, sizeof (ICONDIRENTRY), iconDir.idCount, fICOFile) != iconDir.idCount)
510 for (i = 0; i < iconDir.idCount; i++)
511 if ((pIconDirEntry[i].bHeight * pIconDirEntry[i].bWidth) > nMax)
514 nMax = pIconDirEntry[i].bHeight * pIconDirEntry[i].bWidth;
516 if ((pIcon = malloc(pIconDirEntry[nIndex].dwBytesInRes)) == NULL)
518 if (fseek(fICOFile, pIconDirEntry[nIndex].dwImageOffset, SEEK_SET))
520 if (fread(pIcon, pIconDirEntry[nIndex].dwBytesInRes, 1, fICOFile) != 1)
523 if(!SaveIconResAsXPM(pIcon, szXPMFileName))
539 HeapFree(GetProcessHeap(), 0, filename);
543 static BOOL create_default_icon( const char *filename )
548 if (!(fXPM = fopen(filename, "w"))) return FALSE;
549 fprintf(fXPM, "/* XPM */\nstatic char * icon[] = {");
550 for (i = 0; i < sizeof(wine_xpm)/sizeof(wine_xpm[0]); i++)
551 fprintf( fXPM, "\n\"%s\",", wine_xpm[i]);
552 fprintf( fXPM, "};\n" );
557 /* extract an icon from an exe or icon file; helper for IPersistFile_fnSave */
558 static char *extract_icon( const char *path, int index)
560 int fd, nodefault = 1;
561 char *filename, tmpfn[25];
563 strcpy(tmpfn,"/tmp/icon.XXXXXX");
564 fd = mkstemp( tmpfn );
567 filename = heap_strdup( tmpfn );
568 close(fd); /* not needed */
570 /* If icon path begins with a '*' then this is a deferred call */
576 if (ExtractFromEXEDLL( path, index, filename )) return filename;
577 if (ExtractFromICO( path, filename )) return filename;
579 if (create_default_icon( filename )) return filename;
580 HeapFree( GetProcessHeap(), 0, filename );
585 static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember)
587 HRESULT ret = NOERROR;
589 char buffer[MAX_PATH], buff2[MAX_PATH], ascii_filename[MAX_PATH];
590 char *filename, *link_name, *p;
591 char *shell_link_app = NULL;
592 char *icon_name = NULL;
593 char *work_dir = NULL;
597 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
599 TRACE("(%p)->(%s)\n",This,debugstr_w(pszFileName));
601 if (!pszFileName || !This->sPath)
602 return ERROR_UNKNOWN;
604 /* check for .exe extension */
605 if (!(p = strrchr( This->sPath, '.' ))) return NOERROR;
606 if (strchr( p, '\\' ) || strchr( p, '/' )) return NOERROR;
607 if (strcasecmp( p, ".exe" )) return NOERROR;
609 /* check if ShellLinker configured */
611 if (!RegOpenKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine",
612 0, KEY_ALL_ACCESS, &hkey ))
614 DWORD type, count = sizeof(buffer);
615 if (RegQueryValueExA( hkey, "ShellLinker", 0, &type, buffer, &count )) buffer[0] = 0;
618 if (!*buffer) return NOERROR;
619 shell_link_app = heap_strdup( buffer );
621 if (!WideCharToMultiByte( CP_ACP, 0, pszFileName, -1, ascii_filename, sizeof(ascii_filename), NULL, NULL))
622 return ERROR_UNKNOWN;
623 GetFullPathNameA( ascii_filename, sizeof(buff2), buff2, NULL );
624 filename = heap_strdup( buff2 );
626 if (SHGetSpecialFolderPathA( 0, buffer, CSIDL_STARTUP, FALSE ))
628 /* ignore startup for now */
629 if (!strncasecmp( filename, buffer, strlen(buffer) )) goto done;
631 if (SHGetSpecialFolderPathA( 0, buffer, CSIDL_DESKTOPDIRECTORY, FALSE ))
633 if (!strncasecmp( filename, buffer, strlen(buffer) ))
635 link_name = filename + strlen(buffer);
640 if (SHGetSpecialFolderPathA( 0, buffer, CSIDL_STARTMENU, FALSE ))
642 if (!strncasecmp( filename, buffer, strlen(buffer) ))
644 link_name = filename + strlen(buffer);
652 /* make link name a Unix name */
653 for (p = link_name; *p; p++) if (*p == '\\') *p = '/';
654 /* strip leading slashes */
655 while (*link_name == '/') link_name++;
656 /* remove extension */
657 if ((p = strrchr( link_name, '.' ))) *p = 0;
659 /* convert app working dir */
660 if (This->sWorkDir) work_dir = get_unix_file_name( This->sWorkDir );
662 /* extract the icon */
663 if (!(icon_name = extract_icon( This->sIcoPath && strlen(This->sIcoPath) ?
664 This->sIcoPath : This->sPath,
667 /* Couldn't extract icon -- defer this menu entry to runonce. */
671 TRACE("Deferring icon creation to reboot.\n");
672 if (RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce", 0,
673 NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hRunOnce, NULL) != ERROR_SUCCESS)
678 buffer = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * 3 + (This->sArgs ? strlen(This->sArgs) : 0) +
679 (This->sDescription ? strlen(This->sDescription) : 0) + 200);
680 sprintf(buffer, "link:%s\xff*%s\xff%d\xff%s\xff%s\xff%s", This->sPath, This->sIcoPath, This->iIcoNdx,
681 This->sArgs ? This->sArgs : "", This->sDescription ? This->sDescription : "",
682 This->sWorkDir ? This->sWorkDir : "");
683 if (RegSetValueExA(hRunOnce, ascii_filename, 0, REG_SZ, buffer, strlen(buffer) + 1) != ERROR_SUCCESS)
685 HeapFree(GetProcessHeap(), 0, buffer);
686 RegCloseKey(hRunOnce);
690 HeapFree(GetProcessHeap(), 0, buffer);
691 RegCloseKey(hRunOnce);
695 TRACE("linker app='%s' link='%s' mode=%s path='%s' args='%s' icon='%s' workdir='%s' descr='%s'\n",
696 shell_link_app, link_name, bDesktop ? "desktop" : "menu", This->sPath,
697 This->sArgs ? This->sArgs : "", icon_name, work_dir ? work_dir : "",
698 This->sDescription ? This->sDescription : "" );
700 if ((pid = fork()) == -1) goto done;
705 argv[pos++] = shell_link_app;
706 argv[pos++] = "--link";
707 argv[pos++] = link_name;
708 argv[pos++] = "--path";
709 argv[pos++] = This->sPath;
710 argv[pos++] = bDesktop ? "--desktop" : "--menu";
711 if (This->sArgs && strlen(This->sArgs))
713 argv[pos++] = "--args";
714 argv[pos++] = This->sArgs;
718 argv[pos++] = "--icon";
719 argv[pos++] = icon_name;
721 if (This->sWorkDir && strlen(This->sWorkDir))
723 argv[pos++] = "--workdir";
724 argv[pos++] = This->sWorkDir;
726 if (This->sDescription && strlen(This->sDescription))
728 argv[pos++] = "--descr";
729 argv[pos++] = This->sDescription;
732 execvp( shell_link_app, argv );
736 while (waitpid( pid, &status, 0 ) == -1)
744 if (status) ret = E_ACCESSDENIED;
747 if (icon_name) unlink( icon_name );
748 HeapFree( GetProcessHeap(), 0, shell_link_app );
749 HeapFree( GetProcessHeap(), 0, filename );
750 HeapFree( GetProcessHeap(), 0, icon_name );
751 HeapFree( GetProcessHeap(), 0, work_dir );
755 static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLESTR pszFileName)
757 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
758 FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName));
761 static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *ppszFileName)
763 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
764 FIXME("(%p)\n",This);
768 static ICOM_VTABLE(IPersistFile) pfvt =
770 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
771 IPersistFile_fnQueryInterface,
772 IPersistFile_fnAddRef,
773 IPersistFile_fnRelease,
774 IPersistFile_fnGetClassID,
775 IPersistFile_fnIsDirty,
778 IPersistFile_fnSaveCompleted,
779 IPersistFile_fnGetCurFile
782 /************************************************************************
783 * IPersistStream_QueryInterface
785 static HRESULT WINAPI IPersistStream_fnQueryInterface(
786 IPersistStream* iface,
790 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
792 TRACE("(%p)\n",This);
794 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvoid);
797 /************************************************************************
798 * IPersistStream_Release
800 static ULONG WINAPI IPersistStream_fnRelease(
801 IPersistStream* iface)
803 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
805 TRACE("(%p)\n",This);
807 return IShellLinkA_Release((IShellLinkA*)This);
810 /************************************************************************
811 * IPersistStream_AddRef
813 static ULONG WINAPI IPersistStream_fnAddRef(
814 IPersistStream* iface)
816 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
818 TRACE("(%p)\n",This);
820 return IShellLinkA_AddRef((IShellLinkA*)This);
823 /************************************************************************
824 * IPersistStream_GetClassID
827 static HRESULT WINAPI IPersistStream_fnGetClassID(
828 IPersistStream* iface,
831 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
833 TRACE("(%p)\n", This);
838 /* memcpy(pClassID, &CLSID_???, sizeof(CLSID_???)); */
843 /************************************************************************
844 * IPersistStream_IsDirty (IPersistStream)
846 static HRESULT WINAPI IPersistStream_fnIsDirty(
847 IPersistStream* iface)
849 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
851 TRACE("(%p)\n", This);
855 /************************************************************************
856 * IPersistStream_Load (IPersistStream)
859 static HRESULT WINAPI IPersistStream_fnLoad(
860 IPersistStream* iface,
861 IStream* pLoadStream)
863 PLINK_HEADER lpLinkHeader = HeapAlloc(GetProcessHeap(), 0, LINK_HEADER_SIZE);
866 char sTemp[MAX_PATH];
868 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
870 TRACE("(%p)(%p)\n", This, pLoadStream);
874 return STG_E_INVALIDPOINTER;
877 IStream_AddRef (pLoadStream);
882 if (!(SUCCEEDED(IStream_Read(pLoadStream, lpLinkHeader, LINK_HEADER_SIZE, &dwBytesRead))))
885 if (dwBytesRead != LINK_HEADER_SIZE)
888 if ( (lpLinkHeader->MagicStr != 0x0000004CL) || !IsEqualIID(&lpLinkHeader->MagicGuid, &CLSID_ShellLink) )
891 if(lpLinkHeader->PidlSize)
893 lpLinkHeader = HeapReAlloc(GetProcessHeap(), 0, lpLinkHeader, LINK_HEADER_SIZE+lpLinkHeader->PidlSize);
897 if (!(SUCCEEDED(IStream_Read(pLoadStream, &(lpLinkHeader->Pidl), lpLinkHeader->PidlSize, &dwBytesRead))))
899 if(dwBytesRead != lpLinkHeader->PidlSize)
902 if (pcheck (&lpLinkHeader->Pidl))
904 This->pPidl = ILClone (&lpLinkHeader->Pidl);
906 SHGetPathFromIDListA(&lpLinkHeader->Pidl, sTemp);
907 This->sPath = heap_strdup( sTemp );
910 This->wHotKey = lpLinkHeader->wHotKey;
911 FileTimeToSystemTime (&lpLinkHeader->Time1, &This->time1);
912 FileTimeToSystemTime (&lpLinkHeader->Time2, &This->time2);
913 FileTimeToSystemTime (&lpLinkHeader->Time3, &This->time3);
915 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time1, NULL, sTemp, 256);
916 TRACE("-- time1: %s\n", sTemp);
917 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time2, NULL, sTemp, 256);
918 TRACE("-- time1: %s\n", sTemp);
919 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time3, NULL, sTemp, 256);
920 TRACE("-- time1: %s\n", sTemp);
926 IStream_Release (pLoadStream);
930 HeapFree(GetProcessHeap(), 0, lpLinkHeader);
935 /************************************************************************
936 * IPersistStream_Save (IPersistStream)
938 static HRESULT WINAPI IPersistStream_fnSave(
939 IPersistStream* iface,
943 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
945 TRACE("(%p) %p %x\n", This, pOutStream, fClearDirty);
950 /************************************************************************
951 * IPersistStream_GetSizeMax (IPersistStream)
953 static HRESULT WINAPI IPersistStream_fnGetSizeMax(
954 IPersistStream* iface,
955 ULARGE_INTEGER* pcbSize)
957 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
959 TRACE("(%p)\n", This);
964 static ICOM_VTABLE(IPersistStream) psvt =
966 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
967 IPersistStream_fnQueryInterface,
968 IPersistStream_fnAddRef,
969 IPersistStream_fnRelease,
970 IPersistStream_fnGetClassID,
971 IPersistStream_fnIsDirty,
972 IPersistStream_fnLoad,
973 IPersistStream_fnSave,
974 IPersistStream_fnGetSizeMax
977 /**************************************************************************
978 * IShellLink_Constructor
980 HRESULT WINAPI IShellLink_Constructor (
981 IUnknown * pUnkOuter,
987 TRACE("unkOut=%p riid=%s\n",pUnkOuter, debugstr_guid(riid));
991 if(pUnkOuter) return CLASS_E_NOAGGREGATION;
992 sl = (IShellLinkImpl *) LocalAlloc(GMEM_ZEROINIT,sizeof(IShellLinkImpl));
993 if (!sl) return E_OUTOFMEMORY;
996 ICOM_VTBL(sl) = &slvt;
997 sl->lpvtblw = &slvtw;
998 sl->lpvtblPersistFile = &pfvt;
999 sl->lpvtblPersistStream = &psvt;
1001 TRACE("(%p)->()\n",sl);
1003 if (IsEqualIID(riid, &IID_IUnknown) ||
1004 IsEqualIID(riid, &IID_IShellLinkA))
1006 else if (IsEqualIID(riid, &IID_IShellLinkW))
1007 *ppv = &(sl->lpvtblw);
1009 LocalFree((HLOCAL)sl);
1010 ERR("E_NOINTERFACE\n");
1011 return E_NOINTERFACE;
1017 /**************************************************************************
1018 * IShellLinkA_QueryInterface
1020 static HRESULT WINAPI IShellLinkA_fnQueryInterface( IShellLinkA * iface, REFIID riid, LPVOID *ppvObj)
1022 ICOM_THIS(IShellLinkImpl, iface);
1024 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid));
1028 if(IsEqualIID(riid, &IID_IUnknown) ||
1029 IsEqualIID(riid, &IID_IShellLinkA))
1033 else if(IsEqualIID(riid, &IID_IShellLinkW))
1035 *ppvObj = (IShellLinkW *)&(This->lpvtblw);
1037 else if(IsEqualIID(riid, &IID_IPersistFile))
1039 *ppvObj = (IPersistFile *)&(This->lpvtblPersistFile);
1041 else if(IsEqualIID(riid, &IID_IPersistStream))
1043 *ppvObj = (IPersistStream *)&(This->lpvtblPersistStream);
1048 IUnknown_AddRef((IUnknown*)(*ppvObj));
1049 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1052 TRACE("-- Interface: E_NOINTERFACE\n");
1053 return E_NOINTERFACE;
1055 /******************************************************************************
1056 * IShellLinkA_AddRef
1058 static ULONG WINAPI IShellLinkA_fnAddRef(IShellLinkA * iface)
1060 ICOM_THIS(IShellLinkImpl, iface);
1062 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1064 return ++(This->ref);
1066 /******************************************************************************
1067 * IShellLinkA_Release
1069 static ULONG WINAPI IShellLinkA_fnRelease(IShellLinkA * iface)
1071 ICOM_THIS(IShellLinkImpl, iface);
1073 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1076 { TRACE("-- destroying IShellLink(%p)\n",This);
1079 HeapFree(GetProcessHeap(), 0, This->sIcoPath);
1082 HeapFree(GetProcessHeap(), 0, This->sArgs);
1085 HeapFree(GetProcessHeap(), 0, This->sWorkDir);
1087 if (This->sDescription)
1088 HeapFree(GetProcessHeap(), 0, This->sDescription);
1091 HeapFree(GetProcessHeap(),0,This->sPath);
1094 SHFree(This->pPidl);
1096 if (This->lpFileStream)
1097 IStream_Release(This->lpFileStream);
1101 LocalFree((HANDLE)This);
1107 static HRESULT WINAPI IShellLinkA_fnGetPath(IShellLinkA * iface, LPSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags)
1109 ICOM_THIS(IShellLinkImpl, iface);
1111 TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)(%s)\n",This, pszFile, cchMaxPath, pfd, fFlags, debugstr_a(This->sPath));
1114 lstrcpynA(pszFile,This->sPath, cchMaxPath);
1120 static HRESULT WINAPI IShellLinkA_fnGetIDList(IShellLinkA * iface, LPITEMIDLIST * ppidl)
1122 ICOM_THIS(IShellLinkImpl, iface);
1124 TRACE("(%p)->(ppidl=%p)\n",This, ppidl);
1126 *ppidl = ILClone(This->pPidl);
1129 static HRESULT WINAPI IShellLinkA_fnSetIDList(IShellLinkA * iface, LPCITEMIDLIST pidl)
1131 ICOM_THIS(IShellLinkImpl, iface);
1133 TRACE("(%p)->(pidl=%p)\n",This, pidl);
1136 SHFree(This->pPidl);
1137 This->pPidl = ILClone (pidl);
1140 static HRESULT WINAPI IShellLinkA_fnGetDescription(IShellLinkA * iface, LPSTR pszName,INT cchMaxName)
1142 ICOM_THIS(IShellLinkImpl, iface);
1144 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName);
1145 lstrcpynA(pszName,"Description, FIXME",cchMaxName);
1148 static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA * iface, LPCSTR pszName)
1150 ICOM_THIS(IShellLinkImpl, iface);
1152 TRACE("(%p)->(pName=%s)\n", This, pszName);
1154 if (This->sDescription)
1155 HeapFree(GetProcessHeap(), 0, This->sDescription);
1156 if (!(This->sDescription = heap_strdup(pszName)))
1157 return E_OUTOFMEMORY;
1161 static HRESULT WINAPI IShellLinkA_fnGetWorkingDirectory(IShellLinkA * iface, LPSTR pszDir,INT cchMaxPath)
1163 ICOM_THIS(IShellLinkImpl, iface);
1165 TRACE("(%p)->(%p len=%u)\n", This, pszDir, cchMaxPath);
1167 lstrcpynA( pszDir, This->sWorkDir ? This->sWorkDir : "", cchMaxPath );
1171 static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA * iface, LPCSTR pszDir)
1173 ICOM_THIS(IShellLinkImpl, iface);
1175 TRACE("(%p)->(dir=%s)\n",This, pszDir);
1178 HeapFree(GetProcessHeap(), 0, This->sWorkDir);
1179 if (!(This->sWorkDir = heap_strdup(pszDir)))
1180 return E_OUTOFMEMORY;
1184 static HRESULT WINAPI IShellLinkA_fnGetArguments(IShellLinkA * iface, LPSTR pszArgs,INT cchMaxPath)
1186 ICOM_THIS(IShellLinkImpl, iface);
1188 TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath);
1190 lstrcpynA( pszArgs, This->sArgs ? This->sArgs : "", cchMaxPath );
1194 static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA * iface, LPCSTR pszArgs)
1196 ICOM_THIS(IShellLinkImpl, iface);
1198 TRACE("(%p)->(args=%s)\n",This, pszArgs);
1201 HeapFree(GetProcessHeap(), 0, This->sArgs);
1202 if (!(This->sArgs = heap_strdup(pszArgs)))
1203 return E_OUTOFMEMORY;
1207 static HRESULT WINAPI IShellLinkA_fnGetHotkey(IShellLinkA * iface, WORD *pwHotkey)
1209 ICOM_THIS(IShellLinkImpl, iface);
1211 TRACE("(%p)->(%p)(0x%08x)\n",This, pwHotkey, This->wHotKey);
1213 *pwHotkey = This->wHotKey;
1217 static HRESULT WINAPI IShellLinkA_fnSetHotkey(IShellLinkA * iface, WORD wHotkey)
1219 ICOM_THIS(IShellLinkImpl, iface);
1221 TRACE("(%p)->(hotkey=%x)\n",This, wHotkey);
1223 This->wHotKey = wHotkey;
1227 static HRESULT WINAPI IShellLinkA_fnGetShowCmd(IShellLinkA * iface, INT *piShowCmd)
1229 ICOM_THIS(IShellLinkImpl, iface);
1231 FIXME("(%p)->(%p)\n",This, piShowCmd);
1235 static HRESULT WINAPI IShellLinkA_fnSetShowCmd(IShellLinkA * iface, INT iShowCmd)
1237 ICOM_THIS(IShellLinkImpl, iface);
1239 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd);
1242 static HRESULT WINAPI IShellLinkA_fnGetIconLocation(IShellLinkA * iface, LPSTR pszIconPath,INT cchIconPath,INT *piIcon)
1244 ICOM_THIS(IShellLinkImpl, iface);
1246 TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon);
1248 lstrcpynA( pszIconPath, This->sIcoPath ? This->sIcoPath : "", cchIconPath );
1249 *piIcon = This->iIcoNdx;
1253 static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA * iface, LPCSTR pszIconPath,INT iIcon)
1255 ICOM_THIS(IShellLinkImpl, iface);
1257 TRACE("(%p)->(path=%s iicon=%u)\n",This, pszIconPath, iIcon);
1260 HeapFree(GetProcessHeap(), 0, This->sIcoPath);
1261 if (!(This->sIcoPath = heap_strdup(pszIconPath)))
1262 return E_OUTOFMEMORY;
1263 This->iIcoNdx = iIcon;
1267 static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA * iface, LPCSTR pszPathRel, DWORD dwReserved)
1269 ICOM_THIS(IShellLinkImpl, iface);
1271 FIXME("(%p)->(path=%s %lx)\n",This, pszPathRel, dwReserved);
1274 static HRESULT WINAPI IShellLinkA_fnResolve(IShellLinkA * iface, HWND hwnd, DWORD fFlags)
1276 ICOM_THIS(IShellLinkImpl, iface);
1278 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags);
1281 static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA * iface, LPCSTR pszFile)
1283 ICOM_THIS(IShellLinkImpl, iface);
1285 TRACE("(%p)->(path=%s)\n",This, pszFile);
1288 HeapFree(GetProcessHeap(), 0, This->sPath);
1289 if (!(This->sPath = heap_strdup(pszFile)))
1290 return E_OUTOFMEMORY;
1295 /**************************************************************************
1296 * IShellLink Implementation
1299 static ICOM_VTABLE(IShellLinkA) slvt =
1301 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1302 IShellLinkA_fnQueryInterface,
1303 IShellLinkA_fnAddRef,
1304 IShellLinkA_fnRelease,
1305 IShellLinkA_fnGetPath,
1306 IShellLinkA_fnGetIDList,
1307 IShellLinkA_fnSetIDList,
1308 IShellLinkA_fnGetDescription,
1309 IShellLinkA_fnSetDescription,
1310 IShellLinkA_fnGetWorkingDirectory,
1311 IShellLinkA_fnSetWorkingDirectory,
1312 IShellLinkA_fnGetArguments,
1313 IShellLinkA_fnSetArguments,
1314 IShellLinkA_fnGetHotkey,
1315 IShellLinkA_fnSetHotkey,
1316 IShellLinkA_fnGetShowCmd,
1317 IShellLinkA_fnSetShowCmd,
1318 IShellLinkA_fnGetIconLocation,
1319 IShellLinkA_fnSetIconLocation,
1320 IShellLinkA_fnSetRelativePath,
1321 IShellLinkA_fnResolve,
1322 IShellLinkA_fnSetPath
1326 /**************************************************************************
1327 * IShellLinkW_fnQueryInterface
1329 static HRESULT WINAPI IShellLinkW_fnQueryInterface(
1330 IShellLinkW * iface, REFIID riid, LPVOID *ppvObj)
1332 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1334 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj);
1337 /******************************************************************************
1338 * IShellLinkW_fnAddRef
1340 static ULONG WINAPI IShellLinkW_fnAddRef(IShellLinkW * iface)
1342 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1344 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1346 return IShellLinkA_AddRef((IShellLinkA*)This);
1348 /******************************************************************************
1349 * IShellLinkW_fnRelease
1352 static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface)
1354 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1356 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1358 return IShellLinkA_Release((IShellLinkA*)This);
1361 static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags)
1363 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1365 FIXME("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",This, pszFile, cchMaxPath, pfd, fFlags);
1366 MultiByteToWideChar( CP_ACP, 0, "c:\\foo.bar", -1, pszFile, cchMaxPath );
1370 static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST * ppidl)
1372 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1374 FIXME("(%p)->(ppidl=%p)\n",This, ppidl);
1375 *ppidl = _ILCreateDesktop();
1379 static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST pidl)
1381 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1383 FIXME("(%p)->(pidl=%p)\n",This, pidl);
1387 static HRESULT WINAPI IShellLinkW_fnGetDescription(IShellLinkW * iface, LPWSTR pszName,INT cchMaxName)
1389 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1391 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName);
1392 MultiByteToWideChar( CP_ACP, 0, "Description, FIXME", -1, pszName, cchMaxName );
1396 static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR pszName)
1398 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1400 TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName));
1402 if (This->sDescription)
1403 HeapFree(GetProcessHeap(), 0, This->sDescription);
1404 if (!(This->sDescription = HEAP_strdupWtoA(GetProcessHeap(), 0, pszName)))
1405 return E_OUTOFMEMORY;
1410 static HRESULT WINAPI IShellLinkW_fnGetWorkingDirectory(IShellLinkW * iface, LPWSTR pszDir,INT cchMaxPath)
1412 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1414 TRACE("(%p)->(%p len %u)\n", This, pszDir, cchMaxPath);
1416 MultiByteToWideChar( CP_ACP, 0, This->sWorkDir ? This->sWorkDir : "", -1, pszDir, cchMaxPath );
1421 static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPCWSTR pszDir)
1423 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1425 TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir));
1428 HeapFree(GetProcessHeap(), 0, This->sWorkDir);
1429 if (!(This->sWorkDir = HEAP_strdupWtoA(GetProcessHeap(), 0, pszDir)))
1430 return E_OUTOFMEMORY;
1435 static HRESULT WINAPI IShellLinkW_fnGetArguments(IShellLinkW * iface, LPWSTR pszArgs,INT cchMaxPath)
1437 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1439 TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath);
1441 MultiByteToWideChar( CP_ACP, 0, This->sArgs ? This->sArgs : "", -1, pszArgs, cchMaxPath );
1446 static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR pszArgs)
1448 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1450 TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs));
1453 HeapFree(GetProcessHeap(), 0, This->sArgs);
1454 if (!(This->sArgs = HEAP_strdupWtoA(GetProcessHeap(), 0, pszArgs)))
1455 return E_OUTOFMEMORY;
1460 static HRESULT WINAPI IShellLinkW_fnGetHotkey(IShellLinkW * iface, WORD *pwHotkey)
1462 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1464 FIXME("(%p)->(%p)\n",This, pwHotkey);
1469 static HRESULT WINAPI IShellLinkW_fnSetHotkey(IShellLinkW * iface, WORD wHotkey)
1471 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1473 FIXME("(%p)->(hotkey=%x)\n",This, wHotkey);
1477 static HRESULT WINAPI IShellLinkW_fnGetShowCmd(IShellLinkW * iface, INT *piShowCmd)
1479 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1481 FIXME("(%p)->(%p)\n",This, piShowCmd);
1486 static HRESULT WINAPI IShellLinkW_fnSetShowCmd(IShellLinkW * iface, INT iShowCmd)
1488 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1490 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd);
1494 static HRESULT WINAPI IShellLinkW_fnGetIconLocation(IShellLinkW * iface, LPWSTR pszIconPath,INT cchIconPath,INT *piIcon)
1496 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1498 TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon);
1500 MultiByteToWideChar( CP_ACP, 0, This->sIcoPath ? This->sIcoPath : "", -1, pszIconPath, cchIconPath );
1501 *piIcon = This->iIcoNdx;
1506 static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, LPCWSTR pszIconPath,INT iIcon)
1508 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1510 TRACE("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon);
1513 HeapFree(GetProcessHeap(), 0, This->sIcoPath);
1514 if (!(This->sIcoPath = HEAP_strdupWtoA(GetProcessHeap(), 0, pszIconPath)))
1515 return E_OUTOFMEMORY;
1516 This->iIcoNdx = iIcon;
1521 static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR pszPathRel, DWORD dwReserved)
1523 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1525 FIXME("(%p)->(path=%s %lx)\n",This, debugstr_w(pszPathRel), dwReserved);
1529 static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWORD fFlags)
1531 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1533 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags);
1537 static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile)
1539 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
1541 TRACE("(%p)->(path=%s)\n",This, debugstr_w(pszFile));
1544 HeapFree(GetProcessHeap(), 0, This->sPath);
1545 if (!(This->sPath = HEAP_strdupWtoA(GetProcessHeap(), 0, pszFile)))
1546 return E_OUTOFMEMORY;
1551 /**************************************************************************
1552 * IShellLinkW Implementation
1555 static ICOM_VTABLE(IShellLinkW) slvtw =
1557 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1558 IShellLinkW_fnQueryInterface,
1559 IShellLinkW_fnAddRef,
1560 IShellLinkW_fnRelease,
1561 IShellLinkW_fnGetPath,
1562 IShellLinkW_fnGetIDList,
1563 IShellLinkW_fnSetIDList,
1564 IShellLinkW_fnGetDescription,
1565 IShellLinkW_fnSetDescription,
1566 IShellLinkW_fnGetWorkingDirectory,
1567 IShellLinkW_fnSetWorkingDirectory,
1568 IShellLinkW_fnGetArguments,
1569 IShellLinkW_fnSetArguments,
1570 IShellLinkW_fnGetHotkey,
1571 IShellLinkW_fnSetHotkey,
1572 IShellLinkW_fnGetShowCmd,
1573 IShellLinkW_fnSetShowCmd,
1574 IShellLinkW_fnGetIconLocation,
1575 IShellLinkW_fnSetIconLocation,
1576 IShellLinkW_fnSetRelativePath,
1577 IShellLinkW_fnResolve,
1578 IShellLinkW_fnSetPath