ReactOS  0.4.14-dev-815-ge410a12
CEnumRegRoot Class Reference
Inheritance diagram for CEnumRegRoot:
Collaboration diagram for CEnumRegRoot:

Public Member Functions

 CEnumRegRoot ()
 
 ~CEnumRegRoot ()
 
HRESULT EnumerateNext (LPITEMIDLIST *ppidl)
 
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 ()
 

Private Attributes

UINT m_idx
 

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 195 of file ntobjenum.cpp.

Constructor & Destructor Documentation

◆ CEnumRegRoot()

CEnumRegRoot::CEnumRegRoot ( )
inline

Definition at line 202 of file ntobjenum.cpp.

203  : m_idx(0)
204  {
205  }

◆ ~CEnumRegRoot()

CEnumRegRoot::~CEnumRegRoot ( )
inline

Definition at line 207 of file ntobjenum.cpp.

208  {
209  }

Member Function Documentation

◆ Clone()

virtual HRESULT STDMETHODCALLTYPE CEnumRegRoot::Clone ( IEnumIDList **  ppenum)
inlinevirtual

Implements IEnumIDList.

Definition at line 296 of file ntobjenum.cpp.

297  {
298  return E_NOTIMPL;
299  }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumerateNext()

HRESULT CEnumRegRoot::EnumerateNext ( LPITEMIDLIST ppidl)
inline

Definition at line 211 of file ntobjenum.cpp.

212  {
213  if (m_idx >= _countof(RootKeys))
214  return S_FALSE;
215 
217 
218  PCWSTR name = key.keyName;
220 
222 
223  DWORD entryBufferLength = FIELD_OFFSET(RegPidlEntry, entryName) + sizeof(WCHAR) + cchName * sizeof(WCHAR);
224 
225  // allocate space for the terminator
226  entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
227 
228  RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
229  if (!entry)
230  return E_OUTOFMEMORY;
231 
232  memset(entry, 0, entryBufferLength);
233 
234  entry->cb = FIELD_OFFSET(RegPidlEntry, entryName);
235  entry->magic = REGISTRY_PIDL_MAGIC;
236  entry->entryType = otype;
237  entry->rootKey = key.key;
238 
239  if (cchName > 0)
240  {
241  entry->entryNameLength = cchName * sizeof(WCHAR);
242  StringCbCopyNW(entry->entryName, entryBufferLength, name, entry->entryNameLength);
243  entry->cb += entry->entryNameLength + sizeof(WCHAR);
244  }
245  else
246  {
247  entry->entryNameLength = 0;
248  entry->entryName[0] = 0;
249  entry->cb += sizeof(WCHAR);
250  }
251 
252  if (ppidl)
253  *ppidl = (LPITEMIDLIST) entry;
254  return S_OK;
255  }
const uint16_t * PCWSTR
Definition: typedefs.h:55
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
Definition: strsafe.h:255
#define _countof(array)
Definition: fontsub.cpp:30
#define REGISTRY_PIDL_MAGIC
Definition: ntobjenum.h:36
REG_ENTRY_TYPE
Definition: ntobjenum.h:60
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2723
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_FALSE
Definition: winerror.h:2357
static struct RootKeyEntry RootKeys[]
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
Definition: name.c:38
#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:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
Definition: path.c:41

Referenced by Next(), CEnumRegKey::Next(), CEnumNTDirectory::Next(), Skip(), CEnumRegKey::Skip(), and CEnumNTDirectory::Skip().

◆ Next()

virtual HRESULT STDMETHODCALLTYPE CEnumRegRoot::Next ( ULONG  celt,
LPITEMIDLIST rgelt,
ULONG pceltFetched 
)
inlinevirtual

Definition at line 257 of file ntobjenum.cpp.

258  {
259  if (pceltFetched)
260  *pceltFetched = 0;
261 
262  while (celt-- > 0)
263  {
264  HRESULT hr = EnumerateNext(rgelt);
265  if (hr != S_OK)
266  return hr;
267 
268  if (pceltFetched)
269  (*pceltFetched)++;
270  if (rgelt)
271  rgelt++;
272  }
273 
274  return S_OK;
275  }
HRESULT hr
Definition: shlfolder.c:183
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
HRESULT EnumerateNext(LPITEMIDLIST *ppidl)
Definition: ntobjenum.cpp:211

◆ Reset()

virtual HRESULT STDMETHODCALLTYPE CEnumRegRoot::Reset ( void  )
inlinevirtual

Implements IEnumIDList.

Definition at line 291 of file ntobjenum.cpp.

292  {
293  return E_NOTIMPL;
294  }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Skip()

virtual HRESULT STDMETHODCALLTYPE CEnumRegRoot::Skip ( ULONG  celt)
inlinevirtual

Implements IEnumIDList.

Definition at line 277 of file ntobjenum.cpp.

278  {
279  while (celt > 0)
280  {
282  if (FAILED(hr))
283  return hr;
284  if (hr != S_OK)
285  break;
286  }
287 
288  return S_OK;
289  }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
HRESULT EnumerateNext(LPITEMIDLIST *ppidl)
Definition: ntobjenum.cpp:211

Member Data Documentation

◆ m_idx

UINT CEnumRegRoot::m_idx
private

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