dlls/shell32/shelllink.c
Ge van Geldorp
gvg at reactos.com
Wed Sep 22 00:47:56 CDT 2004
Changelog:
Martin Fuchs <martin-fuchs at gmx.net>
- Store absolute path in .lnk file
Index: dlls/shell32/shelllink.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shelllink.c,v
retrieving revision 1.75
diff -u -r1.75 shelllink.c
--- dlls/shell32/shelllink.c 22 Sep 2004 04:00:56 -0000 1.75
+++ dlls/shell32/shelllink.c 22 Sep 2004 05:42:50 -0000
@@ -1341,12 +1341,18 @@
static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA * iface, LPCSTR pszFile)
{
IShellLinkImpl *This = (IShellLinkImpl *)iface;
+ char buffer[MAX_PATH];
+ LPSTR fname;
TRACE("(%p)->(path=%s)\n",This, pszFile);
+ if (!GetFullPathNameA(pszFile, MAX_PATH, buffer, &fname))
+ return E_FAIL;
+
if (This->sPath)
HeapFree(GetProcessHeap(), 0, This->sPath);
- This->sPath = HEAP_strdupAtoW(GetProcessHeap(), 0, pszFile);
+
+ This->sPath = HEAP_strdupAtoW(GetProcessHeap(), 0, buffer);
if( !This->sPath )
return E_OUTOFMEMORY;
@@ -1758,17 +1764,23 @@
static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile)
{
_ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
+ WCHAR buffer[MAX_PATH];
+ LPWSTR fname;
TRACE("(%p)->(path=%s)\n",This, debugstr_w(pszFile));
+ if (!GetFullPathNameW(pszFile, MAX_PATH, buffer, &fname))
+ return E_FAIL;
+
if (This->sPath)
HeapFree(GetProcessHeap(), 0, This->sPath);
+
This->sPath = HeapAlloc( GetProcessHeap(), 0,
- (lstrlenW( pszFile )+1) * sizeof (WCHAR) );
- if ( !This->sPath )
+ (lstrlenW( buffer )+1) * sizeof (WCHAR) );
+ if (!This->sPath)
return E_OUTOFMEMORY;
- lstrcpyW( This->sPath, pszFile );
+ lstrcpyW(This->sPath, buffer);
This->bDirty = TRUE;
return S_OK;
More information about the wine-patches
mailing list