Implementation of IPersistFile::IsDirty().
This commit is contained in:
parent
18a0045ac5
commit
df23d95476
|
@ -143,6 +143,8 @@ typedef struct
|
||||||
LPWSTR sWorkDir;
|
LPWSTR sWorkDir;
|
||||||
LPWSTR sDescription;
|
LPWSTR sDescription;
|
||||||
LPWSTR sPathRel;
|
LPWSTR sPathRel;
|
||||||
|
|
||||||
|
BOOL bDirty;
|
||||||
} IShellLinkImpl;
|
} IShellLinkImpl;
|
||||||
|
|
||||||
#define _IShellLinkW_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblw)))
|
#define _IShellLinkW_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblw)))
|
||||||
|
@ -216,8 +218,13 @@ static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile* iface, CLSID *pCla
|
||||||
static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface)
|
static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface)
|
||||||
{
|
{
|
||||||
_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
|
_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
|
||||||
FIXME("(%p)\n",This);
|
|
||||||
return NOERROR;
|
TRACE("(%p)\n",This);
|
||||||
|
|
||||||
|
if (This->bDirty)
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
|
static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
|
||||||
{
|
{
|
||||||
|
@ -234,6 +241,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile
|
||||||
r = IPersistStream_Load(StreamThis, stm);
|
r = IPersistStream_Load(StreamThis, stm);
|
||||||
ShellLink_UpdatePath(This->sPathRel, pszFileName, This->sWorkDir, &This->sPath);
|
ShellLink_UpdatePath(This->sPathRel, pszFileName, This->sWorkDir, &This->sPath);
|
||||||
IStream_Release( stm );
|
IStream_Release( stm );
|
||||||
|
This->bDirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@ -290,8 +298,12 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
|
||||||
IStream_Release( stm );
|
IStream_Release( stm );
|
||||||
|
|
||||||
if( SUCCEEDED( r ) )
|
if( SUCCEEDED( r ) )
|
||||||
|
{
|
||||||
StartLinkProcessor( pszFileName );
|
StartLinkProcessor( pszFileName );
|
||||||
else
|
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
DeleteFileW( pszFileName );
|
DeleteFileW( pszFileName );
|
||||||
WARN("Failed to create shortcut %s\n", debugstr_w(pszFileName) );
|
WARN("Failed to create shortcut %s\n", debugstr_w(pszFileName) );
|
||||||
|
@ -787,6 +799,7 @@ HRESULT WINAPI IShellLink_Constructor (
|
||||||
sl->lpvtblPersistFile = &pfvt;
|
sl->lpvtblPersistFile = &pfvt;
|
||||||
sl->lpvtblPersistStream = &psvt;
|
sl->lpvtblPersistStream = &psvt;
|
||||||
sl->iShowCmd = SW_SHOWNORMAL;
|
sl->iShowCmd = SW_SHOWNORMAL;
|
||||||
|
sl->bDirty = FALSE;
|
||||||
|
|
||||||
TRACE("(%p)->()\n",sl);
|
TRACE("(%p)->()\n",sl);
|
||||||
|
|
||||||
|
@ -1025,13 +1038,14 @@ static HRESULT WINAPI IShellLinkA_fnGetIDList(IShellLinkA * iface, LPITEMIDLIST
|
||||||
|
|
||||||
static HRESULT WINAPI IShellLinkA_fnSetIDList(IShellLinkA * iface, LPCITEMIDLIST pidl)
|
static HRESULT WINAPI IShellLinkA_fnSetIDList(IShellLinkA * iface, LPCITEMIDLIST pidl)
|
||||||
{
|
{
|
||||||
ICOM_THIS(IShellLinkImpl, iface);
|
ICOM_THIS(IShellLinkImpl, iface);
|
||||||
|
|
||||||
TRACE("(%p)->(pidl=%p)\n",This, pidl);
|
TRACE("(%p)->(pidl=%p)\n",This, pidl);
|
||||||
|
|
||||||
if (This->pPidl)
|
if (This->pPidl)
|
||||||
ILFree(This->pPidl);
|
ILFree(This->pPidl);
|
||||||
This->pPidl = ILClone (pidl);
|
This->pPidl = ILClone (pidl);
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1062,6 +1076,8 @@ static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA * iface, LPCSTR p
|
||||||
if ( !This->sDescription )
|
if ( !This->sDescription )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1092,6 +1108,8 @@ static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA * iface, LPC
|
||||||
if ( !This->sWorkDir )
|
if ( !This->sWorkDir )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1122,6 +1140,8 @@ static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA * iface, LPCSTR psz
|
||||||
if( !This->sArgs )
|
if( !This->sArgs )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1143,6 +1163,7 @@ static HRESULT WINAPI IShellLinkA_fnSetHotkey(IShellLinkA * iface, WORD wHotkey)
|
||||||
TRACE("(%p)->(hotkey=%x)\n",This, wHotkey);
|
TRACE("(%p)->(hotkey=%x)\n",This, wHotkey);
|
||||||
|
|
||||||
This->wHotKey = wHotkey;
|
This->wHotKey = wHotkey;
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1163,6 +1184,7 @@ static HRESULT WINAPI IShellLinkA_fnSetShowCmd(IShellLinkA * iface, INT iShowCmd
|
||||||
TRACE("(%p) %d\n",This, iShowCmd);
|
TRACE("(%p) %d\n",This, iShowCmd);
|
||||||
|
|
||||||
This->iShowCmd = iShowCmd;
|
This->iShowCmd = iShowCmd;
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return NOERROR;
|
return NOERROR;
|
||||||
}
|
}
|
||||||
|
@ -1194,7 +1216,9 @@ static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA * iface, LPCSTR
|
||||||
This->sIcoPath = HEAP_strdupAtoW(GetProcessHeap(), 0, pszIconPath);
|
This->sIcoPath = HEAP_strdupAtoW(GetProcessHeap(), 0, pszIconPath);
|
||||||
if ( !This->sIcoPath )
|
if ( !This->sIcoPath )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
This->iIcoNdx = iIcon;
|
This->iIcoNdx = iIcon;
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1208,6 +1232,7 @@ static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA * iface, LPCSTR
|
||||||
if (This->sPathRel)
|
if (This->sPathRel)
|
||||||
HeapFree(GetProcessHeap(), 0, This->sPathRel);
|
HeapFree(GetProcessHeap(), 0, This->sPathRel);
|
||||||
This->sPathRel = HEAP_strdupAtoW(GetProcessHeap(), 0, pszPathRel);
|
This->sPathRel = HEAP_strdupAtoW(GetProcessHeap(), 0, pszPathRel);
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1232,6 +1257,8 @@ static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA * iface, LPCSTR pszFile)
|
||||||
if( !This->sPath )
|
if( !This->sPath )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1340,6 +1367,8 @@ static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST
|
||||||
if( !This->pPidl )
|
if( !This->pPidl )
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1369,7 +1398,9 @@ static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR
|
||||||
(lstrlenW( pszName )+1)*sizeof(WCHAR) );
|
(lstrlenW( pszName )+1)*sizeof(WCHAR) );
|
||||||
if ( !This->sDescription )
|
if ( !This->sDescription )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
lstrcpyW( This->sDescription, pszName );
|
lstrcpyW( This->sDescription, pszName );
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1401,6 +1432,7 @@ static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPC
|
||||||
if ( !This->sWorkDir )
|
if ( !This->sWorkDir )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
lstrcpyW( This->sWorkDir, pszDir );
|
lstrcpyW( This->sWorkDir, pszDir );
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1432,6 +1464,7 @@ static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR ps
|
||||||
if ( !This->sArgs )
|
if ( !This->sArgs )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
lstrcpyW( This->sArgs, pszArgs );
|
lstrcpyW( This->sArgs, pszArgs );
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1454,6 +1487,7 @@ static HRESULT WINAPI IShellLinkW_fnSetHotkey(IShellLinkW * iface, WORD wHotkey)
|
||||||
TRACE("(%p)->(hotkey=%x)\n",This, wHotkey);
|
TRACE("(%p)->(hotkey=%x)\n",This, wHotkey);
|
||||||
|
|
||||||
This->wHotKey = wHotkey;
|
This->wHotKey = wHotkey;
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1474,6 +1508,7 @@ static HRESULT WINAPI IShellLinkW_fnSetShowCmd(IShellLinkW * iface, INT iShowCmd
|
||||||
_ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
|
_ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
|
||||||
|
|
||||||
This->iShowCmd = iShowCmd;
|
This->iShowCmd = iShowCmd;
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1508,6 +1543,7 @@ static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, LPCWSTR
|
||||||
lstrcpyW( This->sIcoPath, pszIconPath );
|
lstrcpyW( This->sIcoPath, pszIconPath );
|
||||||
|
|
||||||
This->iIcoNdx = iIcon;
|
This->iIcoNdx = iIcon;
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1525,6 +1561,7 @@ static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR
|
||||||
if ( !This->sPathRel )
|
if ( !This->sPathRel )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
lstrcpyW( This->sPathRel, pszPathRel );
|
lstrcpyW( This->sPathRel, pszPathRel );
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -1550,7 +1587,9 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
|
||||||
(lstrlenW( pszFile )+1) * sizeof (WCHAR) );
|
(lstrlenW( pszFile )+1) * sizeof (WCHAR) );
|
||||||
if ( !This->sPath )
|
if ( !This->sPath )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
lstrcpyW( This->sPath, pszFile );
|
lstrcpyW( This->sPath, pszFile );
|
||||||
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue