mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:12:56 +00:00
[SHELL32] -SHChangeNotifyRegister: Don't call CreateFileW with something that is not a filesystem path as this will obviously fail like when we are browsing My Computer.
svn path=/trunk/; revision=75713
This commit is contained in:
parent
a051cd5754
commit
f89672624d
1 changed files with 18 additions and 5 deletions
|
@ -647,19 +647,25 @@ _AddDirectoryProc(ULONG_PTR arg)
|
||||||
BOOL _OpenDirectory(LPNOTIFYREGISTER item)
|
BOOL _OpenDirectory(LPNOTIFYREGISTER item)
|
||||||
{
|
{
|
||||||
STRRET strFile;
|
STRRET strFile;
|
||||||
IShellFolder *psfDesktop;
|
IShellFolder *psf;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
LPCITEMIDLIST child;
|
||||||
|
ULONG ulAttrs;
|
||||||
|
|
||||||
// Makes function idempotent
|
// Makes function idempotent
|
||||||
if (item->hDirectory && !(item->hDirectory == INVALID_HANDLE_VALUE))
|
if (item->hDirectory && !(item->hDirectory == INVALID_HANDLE_VALUE))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
hr = SHGetDesktopFolder(&psfDesktop);
|
hr = SHBindToParent(item->pidl, &IID_IShellFolder, (LPVOID*)&psf, &child);
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
return FALSE;
|
return hr;
|
||||||
|
|
||||||
hr = IShellFolder_GetDisplayNameOf(psfDesktop, item->pidl, SHGDN_FORPARSING, &strFile);
|
ulAttrs = SFGAO_FILESYSTEM | SFGAO_FOLDER;
|
||||||
IShellFolder_Release(psfDesktop);
|
hr = IShellFolder_GetAttributesOf(psf, 1, (LPCITEMIDLIST*)&child, &ulAttrs);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
hr = IShellFolder_GetDisplayNameOf(psf, child, SHGDN_FORPARSING, &strFile);
|
||||||
|
|
||||||
|
IShellFolder_Release(psf);
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -667,6 +673,13 @@ BOOL _OpenDirectory(LPNOTIFYREGISTER item)
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if ((ulAttrs & (SFGAO_FILESYSTEM | SFGAO_FOLDER)) != (SFGAO_FILESYSTEM | SFGAO_FOLDER))
|
||||||
|
{
|
||||||
|
TRACE("_OpenDirectory ignoring %s\n", debugstr_w(item->wstrDirectory));
|
||||||
|
item->hDirectory = INVALID_HANDLE_VALUE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("_OpenDirectory %s\n", debugstr_w(item->wstrDirectory));
|
TRACE("_OpenDirectory %s\n", debugstr_w(item->wstrDirectory));
|
||||||
|
|
||||||
item->hDirectory = CreateFileW(item->wstrDirectory, // pointer to the file name
|
item->hDirectory = CreateFileW(item->wstrDirectory, // pointer to the file name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue