ReactOS  0.4.14-dev-833-g5f692ed
CRegFolderEnum Class Reference
Inheritance diagram for CRegFolderEnum:
Collaboration diagram for CRegFolderEnum:

Public Member Functions

 CRegFolderEnum ()
 
 ~CRegFolderEnum ()
 
HRESULT Initialize (LPCWSTR lpszEnumKeyName, DWORD dwFlags)
 
HRESULT AddItemsFromKey (HKEY hkey_root, LPCWSTR szRepPath)
 
- 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 203 of file CRegFolder.cpp.

Constructor & Destructor Documentation

◆ CRegFolderEnum()

CRegFolderEnum::CRegFolderEnum ( )

Definition at line 217 of file CRegFolder.cpp.

218 {
219 }

◆ ~CRegFolderEnum()

CRegFolderEnum::~CRegFolderEnum ( )

Definition at line 221 of file CRegFolder.cpp.

222 {
223 }

Member Function Documentation

◆ AddItemsFromKey()

HRESULT CRegFolderEnum::AddItemsFromKey ( HKEY  hkey_root,
LPCWSTR  szRepPath 
)

Definition at line 243 of file CRegFolder.cpp.

244 {
246  HKEY hkey;
247 
248  if (RegOpenKeyW(hkey_root, szRepPath, &hkey) != ERROR_SUCCESS)
249  return S_FALSE;
250 
251  for (int idx = 0; ; idx++)
252  {
253  if (RegEnumKeyW(hkey, idx, name, MAX_PATH) != ERROR_SUCCESS)
254  break;
255 
256  /* If the name of the key is not a guid try to get the default value of the key */
257  if (name[0] != L'{')
258  {
259  DWORD dwSize = sizeof(name);
261  }
262 
263  if (*name == '{')
264  {
266 
267  if (pidl)
268  AddToEnumList(pidl);
269  }
270  }
271 
272  RegCloseKey(hkey);
273 
274  return S_OK;
275 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL AddToEnumList(LPITEMIDLIST pidl)
#define RRF_RT_REG_SZ
Definition: driver.c:575
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
unsigned int idx
Definition: utils.c:41
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
LPITEMIDLIST _ILCreateGuidFromStrW(LPCWSTR szGUID)
Definition: pidl.c:1711
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2416
#define S_OK
Definition: intsafe.h:59
Definition: name.c:38
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by Initialize().

◆ Initialize()

HRESULT CRegFolderEnum::Initialize ( LPCWSTR  lpszEnumKeyName,
DWORD  dwFlags 
)

Definition at line 225 of file CRegFolder.cpp.

226 {
228  static const WCHAR KeyNameFormat[] = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\%s\\Namespace";
229 
230  if (!(dwFlags & SHCONTF_FOLDERS))
231  return S_OK;
232 
233  HRESULT hr = StringCchPrintfW(KeyName, MAX_PATH, KeyNameFormat, lpszEnumKeyName);
234  if (FAILED_UNEXPECTEDLY(hr))
235  return hr;
236 
239 
240  return S_OK;
241 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
HRESULT hr
Definition: shlfolder.c:183
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HRESULT AddItemsFromKey(HKEY hkey_root, LPCWSTR szRepPath)
Definition: CRegFolder.cpp:243
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:59
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

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