ReactOS 0.4.15-dev-5666-gc548b97
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)
 
HRESULT Skip ([in] ULONG celt)
 
HRESULT Reset ()
 
HRESULT Clone ([out] IEnumIDList **ppenum)
 
- 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}
BOOL EnumerateRec(LPNETRESOURCE lpNet)
Definition: CNetFolder.cpp:130
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

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}
LPITEMIDLIST ILCreateFromNetworkPlaceW(LPCWSTR lpNetworkPlace)
Definition: CNetFolder.cpp:31
#define ERR(fmt,...)
Definition: debug.h:110
BOOL AddToEnumList(LPITEMIDLIST pidl)
#define FALSE
Definition: types.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define memset(x, y, z)
Definition: compat.h:39
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPSTR lpProvider
Definition: winnetwk.h:174
LPSTR lpRemoteName
Definition: winnetwk.h:172
DWORD dwUsage
Definition: winnetwk.h:170
#define RESOURCETYPE_DISK
Definition: winnetwk.h:64
#define WN_MORE_DATA
Definition: winnetwk.h:117
#define WN_SUCCESS
Definition: winnetwk.h:111
#define WNetEnumResource
Definition: winnetwk.h:599
#define WNetOpenEnum
Definition: winnetwk.h:598
NETRESOURCEA * LPNETRESOURCE
Definition: winnetwk.h:593
#define RESOURCEUSAGE_CONTAINER
Definition: winnetwk.h:69
#define WN_NO_MORE_ENTRIES
Definition: winnetwk.h:146
#define RESOURCE_GLOBALNET
Definition: winnetwk.h:59
DWORD WINAPI WNetCloseEnum(HANDLE hEnum)
Definition: wnet.c:1760

Referenced by CreateMyCompEnumList(), and EnumerateRec().

◆ 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}
BOOL CreateMyCompEnumList(DWORD dwFlags)
Definition: CNetFolder.cpp:204
#define E_FAIL
Definition: ddrawi.h:102
#define S_OK
Definition: intsafe.h:52

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