ReactOS  0.4.15-dev-499-g1f31905
CNetFolderEnum Class Reference
Inheritance diagram for CNetFolderEnum:
Collaboration diagram for CNetFolderEnum:

Public Member Functions

 CNetFolderEnum ()
 
 ~CNetFolderEnum ()
 
HRESULT WINAPI Initialize (HWND hwndOwner, DWORD dwFlags)
 
BOOL CreateMyCompEnumList (DWORD dwFlags)
 
BOOL EnumerateRec (LPNETRESOURCE lpNet)
 
- Public Member Functions inherited from CEnumIDListBase
 CEnumIDListBase ()
 
virtual ~CEnumIDListBase ()
 
BOOL AddToEnumList (LPITEMIDLIST pidl)
 
BOOL DeleteList ()
 
BOOL HasItemWithCLSID (LPITEMIDLIST pidl)
 
HRESULT AppendItemsFromEnumerator (IEnumIDList *pEnum)
 
virtual HRESULT STDMETHODCALLTYPE Next (ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
 
virtual HRESULT STDMETHODCALLTYPE Skip (ULONG celt)
 
virtual HRESULT STDMETHODCALLTYPE Reset ()
 
virtual HRESULT STDMETHODCALLTYPE Clone (IEnumIDList **ppenum)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from IEnumIDList
HRESULT Next ([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] PITEMID_CHILD *rgelt, [out] ULONG *pceltFetched)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Additional Inherited Members

- Public Types inherited from IEnumIDList
typedef IEnumIDListLPENUMIDLIST
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 81 of file CNetFolder.cpp.

Constructor & Destructor Documentation

◆ CNetFolderEnum()

CNetFolderEnum::CNetFolderEnum ( )

Definition at line 110 of file CNetFolder.cpp.

111 {
112 }

◆ ~CNetFolderEnum()

CNetFolderEnum::~CNetFolderEnum ( )

Definition at line 114 of file CNetFolder.cpp.

115 {
116 }

Member Function Documentation

◆ CreateMyCompEnumList()

BOOL CNetFolderEnum::CreateMyCompEnumList ( DWORD  dwFlags)

Definition at line 204 of file CNetFolder.cpp.

205 {
206  BOOL bRet = TRUE;
207 
208  TRACE("(%p)->(flags=0x%08x)\n", this, dwFlags);
209 
210  /* enumerate the folders */
211  if (dwFlags & SHCONTF_FOLDERS)
212  {
213  bRet = EnumerateRec(NULL);
214  }
215 
216  return bRet;
217 }
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL EnumerateRec(LPNETRESOURCE lpNet)
Definition: CNetFolder.cpp:130

Referenced by Initialize().

◆ EnumerateRec()

BOOL CNetFolderEnum::EnumerateRec ( LPNETRESOURCE  lpNet)

Definition at line 130 of file CNetFolder.cpp.

131 {
132  BOOL bRet = TRUE;
133  DWORD dRet;
134  HANDLE hEnum;
135  LPNETRESOURCE lpRes;
136  DWORD dSize = 0x1000;
137  DWORD dCount = -1;
138  LPNETRESOURCE lpCur;
139 
140  dRet = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK, 0, lpNet, &hEnum);
141  if (dRet != WN_SUCCESS)
142  {
143  ERR("WNetOpenEnum() failed: %x\n", dRet);
144  return FALSE;
145  }
146 
147  lpRes = (LPNETRESOURCE)CoTaskMemAlloc(dSize);
148  if (!lpRes)
149  {
150  ERR("CoTaskMemAlloc() failed\n");
151  WNetCloseEnum(hEnum);
152  return FALSE;
153  }
154 
155  do
156  {
157  dSize = 0x1000;
158  dCount = -1;
159 
160  memset(lpRes, 0, dSize);
161  dRet = WNetEnumResource(hEnum, &dCount, lpRes, &dSize);
162  if (dRet == WN_SUCCESS || dRet == WN_MORE_DATA)
163  {
164  lpCur = lpRes;
165  for (; dCount; dCount--)
166  {
167  TRACE("lpRemoteName: %S\n", lpCur->lpRemoteName);
168 
170  {
171  TRACE("Found provider: %S\n", lpCur->lpProvider);
172  EnumerateRec(lpCur);
173  }
174  else
175  {
176  LPITEMIDLIST pidl;
177 
178 #ifdef HACKY_UNC_PATHS
180 #endif
181  if (pidl != NULL)
182  bRet = AddToEnumList(pidl);
183  else
184  {
185  ERR("ILCreateFromPathW() failed\n");
186  bRet = FALSE;
187  break;
188  }
189  }
190 
191  lpCur++;
192  }
193  }
194  } while (dRet != WN_NO_MORE_ENTRIES);
195 
196  CoTaskMemFree(lpRes);
197  WNetCloseEnum(hEnum);
198 
199  TRACE("Done: %u\n", bRet);
200 
201  return bRet;
202 }
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define WN_SUCCESS
Definition: winnetwk.h:111
BOOL AddToEnumList(LPITEMIDLIST pidl)
LPITEMIDLIST ILCreateFromNetworkPlaceW(LPCWSTR lpNetworkPlace)
Definition: CNetFolder.cpp:31
#define RESOURCEUSAGE_CONTAINER
Definition: winnetwk.h:69
#define RESOURCE_GLOBALNET
Definition: winnetwk.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
NETRESOURCEA * LPNETRESOURCE
Definition: winnetwk.h:593
LPSTR lpProvider
Definition: winnetwk.h:174
#define WNetOpenEnum
Definition: winnetwk.h:598
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwUsage
Definition: winnetwk.h:170
DWORD WINAPI WNetCloseEnum(HANDLE hEnum)
Definition: wnet.c:1760
BOOL EnumerateRec(LPNETRESOURCE lpNet)
Definition: CNetFolder.cpp:130
#define WNetEnumResource
Definition: winnetwk.h:599
#define RESOURCETYPE_DISK
Definition: winnetwk.h:64
#define ERR(fmt,...)
Definition: debug.h:110
#define WN_NO_MORE_ENTRIES
Definition: winnetwk.h:146
LPSTR lpRemoteName
Definition: winnetwk.h:172
#define WN_MORE_DATA
Definition: winnetwk.h:117
#define memset(x, y, z)
Definition: compat.h:39
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426

Referenced by CreateMyCompEnumList().

◆ Initialize()

HRESULT WINAPI CNetFolderEnum::Initialize ( HWND  hwndOwner,
DWORD  dwFlags 
)

Definition at line 118 of file CNetFolder.cpp.

119 {
121  return E_FAIL;
122 
123  return S_OK;
124 }
#define E_FAIL
Definition: ddrawi.h:102
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:59
BOOL CreateMyCompEnumList(DWORD dwFlags)
Definition: CNetFolder.cpp:204

The documentation for this class was generated from the following file: