mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
Francois Gouget <fgouget@free.fr>
- Make Unicode const strings static so they are not copied to the stack each time we enter the function. Aric Stewart <aric@codeweavers.com> - In IPersistFile_Save if the exe file is not found, trust the path we are given and allow creation of the link. - Make sure exePath contains the path since it is used later in the function as well. Ge van Geldorp <gvg@reactos.com> - Match whitespace to winehq svn path=/trunk/; revision=10950
This commit is contained in:
parent
093f4a09c5
commit
822b8e1a47
1 changed files with 27 additions and 31 deletions
|
@ -248,7 +248,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile
|
|||
|
||||
static BOOL StartLinkProcessor( LPCOLESTR szLink )
|
||||
{
|
||||
const WCHAR szFormat[] = {'w','i','n','e','m','e','n','u','b','u','i','l','d','e','r','.','e','x','e',
|
||||
static const WCHAR szFormat[] = {'w','i','n','e','m','e','n','u','b','u','i','l','d','e','r','.','e','x','e',
|
||||
' ','-','r',' ','"','%','s','"',0 };
|
||||
LONG len;
|
||||
LPWSTR buffer;
|
||||
|
@ -538,7 +538,7 @@ static HRESULT WINAPI IPersistStream_fnLoad(
|
|||
if( !IsEqualIID(&hdr.MagicGuid, &CLSID_ShellLink) )
|
||||
return E_FAIL;
|
||||
|
||||
if( hdr.dwFlags & SCF_PIDL )
|
||||
/* if( hdr.dwFlags & SCF_PIDL ) */ /* FIXME: seems to always have a PIDL */
|
||||
{
|
||||
r = ILLoadFromStream( stm, &This->pPidl );
|
||||
if( FAILED( r ) )
|
||||
|
@ -676,16 +676,18 @@ static HRESULT WINAPI IPersistStream_fnSave(
|
|||
*exePath = '\0';
|
||||
|
||||
if (This->sPath)
|
||||
{
|
||||
SHELL_FindExecutable(NULL, This->sPath, wOpen, exePath, MAX_PATH, NULL, NULL, NULL, NULL);
|
||||
/*
|
||||
* windows can create lnk files to executables that do not exist yet
|
||||
* so if the executable does not exist the just trust the path they
|
||||
* gave us
|
||||
*/
|
||||
if( !*exePath ) strcpyW(exePath,This->sPath);
|
||||
}
|
||||
|
||||
/* if there's no PIDL, generate one */
|
||||
if( ! This->pPidl )
|
||||
{
|
||||
if( !*exePath )
|
||||
return E_FAIL;
|
||||
|
||||
This->pPidl = ILCreateFromPathW(exePath);
|
||||
}
|
||||
if( ! This->pPidl ) This->pPidl = ILCreateFromPathW(exePath);
|
||||
|
||||
memset(&header, 0, sizeof(header));
|
||||
header.dwSize = sizeof(header);
|
||||
|
@ -820,6 +822,7 @@ HRESULT WINAPI IShellLink_Constructor (
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
static BOOL SHELL_ExistsFileW(LPCWSTR path)
|
||||
{
|
||||
HANDLE hfile = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
@ -971,7 +974,6 @@ static HRESULT WINAPI IShellLinkA_fnQueryInterface( IShellLinkA * iface, REFIID
|
|||
TRACE("-- Interface: E_NOINTERFACE\n");
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* IShellLinkA_AddRef
|
||||
*/
|
||||
|
@ -983,7 +985,6 @@ static ULONG WINAPI IShellLinkA_fnAddRef(IShellLinkA * iface)
|
|||
|
||||
return ++(This->ref);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* IShellLinkA_Release
|
||||
*/
|
||||
|
@ -1063,7 +1064,6 @@ static HRESULT WINAPI IShellLinkA_fnSetIDList(IShellLinkA * iface, LPCITEMIDLIST
|
|||
|
||||
if (This->pPidl)
|
||||
ILFree(This->pPidl);
|
||||
|
||||
This->pPidl = ILClone (pidl);
|
||||
This->bDirty = TRUE;
|
||||
|
||||
|
@ -1306,7 +1306,6 @@ static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA * iface, LPCSTR
|
|||
|
||||
if (This->sPathRel)
|
||||
HeapFree(GetProcessHeap(), 0, This->sPathRel);
|
||||
|
||||
This->sPathRel = HEAP_strdupAtoW(GetProcessHeap(), 0, pszPathRel);
|
||||
This->bDirty = TRUE;
|
||||
|
||||
|
@ -1553,7 +1552,6 @@ static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPC
|
|||
(lstrlenW( pszDir )+1)*sizeof (WCHAR) );
|
||||
if ( !This->sWorkDir )
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
lstrcpyW( This->sWorkDir, pszDir );
|
||||
This->bDirty = TRUE;
|
||||
|
||||
|
@ -1586,7 +1584,6 @@ static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR ps
|
|||
(lstrlenW( pszArgs )+1)*sizeof (WCHAR) );
|
||||
if ( !This->sArgs )
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
lstrcpyW( This->sArgs, pszArgs );
|
||||
This->bDirty = TRUE;
|
||||
|
||||
|
@ -1740,7 +1737,6 @@ static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR
|
|||
(lstrlenW( pszPathRel )+1) * sizeof (WCHAR) );
|
||||
if ( !This->sPathRel )
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
lstrcpyW( This->sPathRel, pszPathRel );
|
||||
This->bDirty = TRUE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue