[SHELL32] Big fix for change notification (#3048)

- Reduced the failures of SHChangeNotify testcase.
- Simplified change notification mechanism.
- Realized PIDL aliasing.
CORE-13950
This commit is contained in:
Katayama Hirofumi MZ
2020-09-03 13:36:31 +09:00
committed by GitHub
parent 7ffb6a09c3
commit 7c134e4d14
7 changed files with 244 additions and 151 deletions

View File

@@ -1166,39 +1166,14 @@ LRESULT CDefView::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl
SetShellWindowEx(hwndSB, m_ListView);
}
INT nRegCount;
SHChangeNotifyEntry ntreg[3];
PIDLIST_ABSOLUTE pidls[3];
if (_ILIsDesktop(m_pidlParent))
{
nRegCount = 3;
SHGetSpecialFolderLocation(m_hWnd, CSIDL_DESKTOPDIRECTORY, &pidls[0]);
SHGetSpecialFolderLocation(m_hWnd, CSIDL_COMMON_DESKTOPDIRECTORY, &pidls[1]);
SHGetSpecialFolderLocation(m_hWnd, CSIDL_BITBUCKET, &pidls[2]);
ntreg[0].fRecursive = FALSE;
ntreg[0].pidl = pidls[0];
ntreg[1].fRecursive = FALSE;
ntreg[1].pidl = pidls[1];
ntreg[2].fRecursive = FALSE;
ntreg[2].pidl = pidls[2];
}
else
{
nRegCount = 1;
ntreg[0].fRecursive = FALSE;
ntreg[0].pidl = m_pidlParent;
}
SHChangeNotifyEntry ntreg[1];
ntreg[0].fRecursive = FALSE;
ntreg[0].pidl = m_pidlParent;
m_hNotify = SHChangeNotifyRegister(m_hWnd,
SHCNRF_InterruptLevel | SHCNRF_ShellLevel |
SHCNRF_NewDelivery,
SHCNE_ALLEVENTS, SHV_CHANGE_NOTIFY,
nRegCount, ntreg);
if (nRegCount == 3)
{
ILFree(pidls[0]);
ILFree(pidls[1]);
ILFree(pidls[2]);
}
1, ntreg);
/* _DoFolderViewCB(SFVM_GETNOTIFY, ?? ??) */