Author: gadamopoulos
Date: Sat Jul 15 09:18:06 2017
New Revision: 75350
URL:
http://svn.reactos.org/svn/reactos?rev=75350&view=rev
Log:
[SHELL32]
- CDesktopFolder: Create the enumerators of the internal fs folders and add their items in
its own list instead of calling CreateFolderEnumList which enumerates ... files.
- Remove CEnumIDListBase::CreateFolderEnumList and move its code to
CFileSysEnum::Initialize.
Modified:
trunk/reactos/dll/win32/shell32/CEnumIDListBase.cpp
trunk/reactos/dll/win32/shell32/CEnumIDListBase.h
trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp
trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp
Modified: trunk/reactos/dll/win32/shell32/CEnumIDListBase.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CEnumIDL…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CEnumIDListBase.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CEnumIDListBase.cpp [iso-8859-1] Sat Jul 15 09:18:06
2017
@@ -123,73 +123,6 @@
return FALSE;
}
-
-/**************************************************************************
- * CreateFolderEnumList()
- */
-BOOL CEnumIDListBase::CreateFolderEnumList(
- LPCWSTR lpszPath,
- DWORD dwFlags)
-{
- WIN32_FIND_DATAW stffile;
- HANDLE hFile;
- WCHAR szPath[MAX_PATH];
- BOOL succeeded = TRUE;
- static const WCHAR stars[] = { '*','.','*',0 };
- static const WCHAR dot[] = { '.',0 };
- static const WCHAR dotdot[] = { '.','.',0 };
-
- TRACE("(%p)->(path=%s flags=0x%08x)\n", this, debugstr_w(lpszPath),
dwFlags);
-
- if(!lpszPath || !lpszPath[0]) return FALSE;
-
- wcscpy(szPath, lpszPath);
- PathAddBackslashW(szPath);
- wcscat(szPath,stars);
-
- hFile = FindFirstFileW(szPath,&stffile);
- if ( hFile != INVALID_HANDLE_VALUE )
- {
- BOOL findFinished = FALSE;
-
- do
- {
- if ( !(stffile.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
- || (dwFlags & SHCONTF_INCLUDEHIDDEN) )
- {
- LPITEMIDLIST pidl = NULL;
-
- if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
&&
- dwFlags & SHCONTF_FOLDERS &&
- strcmpW(stffile.cFileName, dot) && strcmpW(stffile.cFileName,
dotdot))
- {
- pidl = _ILCreateFromFindDataW(&stffile);
- succeeded = succeeded && AddToEnumList(pidl);
- }
- else if (!(stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- && dwFlags & SHCONTF_NONFOLDERS)
- {
- pidl = _ILCreateFromFindDataW(&stffile);
- succeeded = succeeded && AddToEnumList(pidl);
- }
- }
- if (succeeded)
- {
- if (!FindNextFileW(hFile, &stffile))
- {
- if (GetLastError() == ERROR_NO_MORE_FILES)
- findFinished = TRUE;
- else
- succeeded = FALSE;
- }
- }
- } while (succeeded && !findFinished);
- FindClose(hFile);
- }
-
- return succeeded;
-}
-
/**************************************************************************
* IEnumIDList_fnNext
*/
Modified: trunk/reactos/dll/win32/shell32/CEnumIDListBase.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CEnumIDL…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CEnumIDListBase.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CEnumIDListBase.h [iso-8859-1] Sat Jul 15 09:18:06
2017
@@ -37,7 +37,6 @@
BOOL AddToEnumList(LPITEMIDLIST pidl);
BOOL DeleteList();
BOOL HasItemWithCLSID(LPITEMIDLIST pidl);
- BOOL CreateFolderEnumList(LPCWSTR lpszPath, DWORD dwFlags);
// *** IEnumIDList methods ***
virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG
*pceltFetched);
Modified: trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp [iso-8859-1] Sat Jul 15
09:18:06 2017
@@ -53,7 +53,7 @@
public:
CDesktopFolderEnum();
~CDesktopFolderEnum();
- HRESULT WINAPI Initialize(CDesktopFolder *desktopFolder, HWND hwndOwner, DWORD
dwFlags);
+ HRESULT WINAPI Initialize(HWND hwndOwner, DWORD dwFlags, IEnumIDList
*pDesktopEnumerator, IEnumIDList *pCommonDesktopEnumerator);
BEGIN_COM_MAP(CDesktopFolderEnum)
COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
@@ -119,10 +119,10 @@
* CreateDesktopEnumList()
*/
-HRESULT WINAPI CDesktopFolderEnum::Initialize(CDesktopFolder *desktopFolder, HWND
hwndOwner, DWORD dwFlags)
+HRESULT WINAPI CDesktopFolderEnum::Initialize(HWND hwndOwner, DWORD dwFlags, IEnumIDList
*pDesktopEnumerator, IEnumIDList *pCommonDesktopEnumerator)
{
BOOL ret = TRUE;
- WCHAR szPath[MAX_PATH];
+ LPITEMIDLIST pidl;
static const WCHAR MyDocumentsClassString[] =
L"{450D8FBA-AD25-11D0-98A8-0800361B1103}";
static const WCHAR Desktop_NameSpaceW[] =
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace";
@@ -153,7 +153,6 @@
if (dwResult == ERROR_SUCCESS)
{
WCHAR iid[50];
- LPITEMIDLIST pidl;
int i = 0;
while (ret)
@@ -213,7 +212,7 @@
{
if (Val == 0 && dwType == REG_DWORD)
{
- LPITEMIDLIST pidl = _ILCreateGuidFromStrW(iid);
+ pidl = _ILCreateGuidFromStrW(iid);
if (pidl != NULL)
{
if (!HasItemWithCLSID(pidl))
@@ -238,12 +237,20 @@
}
}
- /* enumerate the elements in %windir%\desktop */
- ret = ret && SHGetSpecialFolderPathW(0, szPath, CSIDL_DESKTOPDIRECTORY,
FALSE);
- ret = ret && CreateFolderEnumList(szPath, dwFlags);
-
- ret = ret && SHGetSpecialFolderPathW(0, szPath,
CSIDL_COMMON_DESKTOPDIRECTORY, FALSE);
- ret = ret && CreateFolderEnumList(szPath, dwFlags);
+ DWORD dwFetched;
+
+ /* Enumerate the items in the two fs folders */
+ if (pDesktopEnumerator)
+ {
+ while((S_OK == pDesktopEnumerator->Next(1, &pidl, &dwFetched))
&& dwFetched)
+ AddToEnumList(pidl);
+ }
+
+ if (pCommonDesktopEnumerator)
+ {
+ while((S_OK == pCommonDesktopEnumerator->Next(1, &pidl, &dwFetched))
&& dwFetched)
+ AddToEnumList(pidl);
+ }
return ret ? S_OK : E_FAIL;
}
@@ -439,7 +446,19 @@
*/
HRESULT WINAPI CDesktopFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST
*ppEnumIDList)
{
- return ShellObjectCreatorInit<CDesktopFolderEnum>(this, hwndOwner, dwFlags,
IID_PPV_ARG(IEnumIDList, ppEnumIDList));
+ CComPtr<IEnumIDList> pDesktopEnumerator;
+ CComPtr<IEnumIDList> pCommonDesktopEnumerator;
+ HRESULT hr;
+
+ hr = m_DesktopFSFolder->EnumObjects(hwndOwner, dwFlags, &pDesktopEnumerator);
+ if (FAILED(hr))
+ ERR("EnumObjects for desktop fs folder failed\n");
+
+ hr = m_SharedDesktopFSFolder->EnumObjects(hwndOwner, dwFlags,
&pCommonDesktopEnumerator);
+ if (FAILED(hr))
+ ERR("EnumObjects for shared desktop fs folder failed\n");
+
+ return ShellObjectCreatorInit<CDesktopFolderEnum>(hwndOwner, dwFlags,
pDesktopEnumerator, pCommonDesktopEnumerator, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
}
/**************************************************************************
Modified: trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp [iso-8859-1] Sat Jul 15 09:18:06
2017
@@ -57,9 +57,65 @@
{
}
-HRESULT WINAPI CFileSysEnum::Initialize(LPWSTR sPathTarget, DWORD dwFlags)
-{
- return CreateFolderEnumList(sPathTarget, dwFlags);
+HRESULT WINAPI CFileSysEnum::Initialize(LPWSTR lpszPath, DWORD dwFlags)
+{
+ WIN32_FIND_DATAW stffile;
+ HANDLE hFile;
+ WCHAR szPath[MAX_PATH];
+ BOOL succeeded = TRUE;
+ static const WCHAR stars[] = { '*','.','*',0 };
+ static const WCHAR dot[] = { '.',0 };
+ static const WCHAR dotdot[] = { '.','.',0 };
+
+ TRACE("(%p)->(path=%s flags=0x%08x)\n", this, debugstr_w(lpszPath),
dwFlags);
+
+ if(!lpszPath || !lpszPath[0]) return FALSE;
+
+ wcscpy(szPath, lpszPath);
+ PathAddBackslashW(szPath);
+ wcscat(szPath,stars);
+
+ hFile = FindFirstFileW(szPath,&stffile);
+ if ( hFile != INVALID_HANDLE_VALUE )
+ {
+ BOOL findFinished = FALSE;
+
+ do
+ {
+ if ( !(stffile.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
+ || (dwFlags & SHCONTF_INCLUDEHIDDEN) )
+ {
+ LPITEMIDLIST pidl = NULL;
+
+ if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
&&
+ dwFlags & SHCONTF_FOLDERS &&
+ strcmpW(stffile.cFileName, dot) && strcmpW(stffile.cFileName,
dotdot))
+ {
+ pidl = _ILCreateFromFindDataW(&stffile);
+ succeeded = succeeded && AddToEnumList(pidl);
+ }
+ else if (!(stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ && dwFlags & SHCONTF_NONFOLDERS)
+ {
+ pidl = _ILCreateFromFindDataW(&stffile);
+ succeeded = succeeded && AddToEnumList(pidl);
+ }
+ }
+ if (succeeded)
+ {
+ if (!FindNextFileW(hFile, &stffile))
+ {
+ if (GetLastError() == ERROR_NO_MORE_FILES)
+ findFinished = TRUE;
+ else
+ succeeded = FALSE;
+ }
+ }
+ } while (succeeded && !findFinished);
+ FindClose(hFile);
+ }
+
+ return succeeded;
}
CFSFolder::CFSFolder()