mirror of
https://github.com/reactos/reactos.git
synced 2026-05-31 08:17:09 +08:00
[SHELL32] Watch for common desktop and SHCNE_CREATE for IShellLink::Save (#2515)
- On desktop view, we have to watch both the common desktop and the private desktop. - In Windows, IShellLink::Save (shortcut creation) sends SHCNE_CREATE or SHCNE_UPDATEITEM notification. - Simplify CChangeNotify::ShouldNotify. CORE-10391
This commit is contained in:
committed by
GitHub
parent
0d187f7d56
commit
1c706d7483
@@ -344,11 +344,16 @@ HRESULT STDMETHODCALLTYPE CShellLink::Load(LPCOLESTR pszFileName, DWORD dwMode)
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CShellLink::Save(LPCOLESTR pszFileName, BOOL fRemember)
|
||||
{
|
||||
BOOL bAlreadyExists;
|
||||
WCHAR szFullPath[MAX_PATH];
|
||||
|
||||
TRACE("(%p)->(%s)\n", this, debugstr_w(pszFileName));
|
||||
|
||||
if (!pszFileName)
|
||||
return E_FAIL;
|
||||
|
||||
bAlreadyExists = PathFileExistsW(pszFileName);
|
||||
|
||||
CComPtr<IStream> stm;
|
||||
HRESULT hr = SHCreateStreamOnFileW(pszFileName, STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE, &stm);
|
||||
if (SUCCEEDED(hr))
|
||||
@@ -357,6 +362,12 @@ HRESULT STDMETHODCALLTYPE CShellLink::Save(LPCOLESTR pszFileName, BOOL fRemember
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
GetFullPathNameW(pszFileName, _countof(szFullPath), szFullPath, NULL);
|
||||
if (bAlreadyExists)
|
||||
SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATHW, szFullPath, NULL);
|
||||
else
|
||||
SHChangeNotify(SHCNE_CREATE, SHCNF_PATHW, szFullPath, NULL);
|
||||
|
||||
if (m_sLinkPath)
|
||||
HeapFree(GetProcessHeap(), 0, m_sLinkPath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user