ReactOS  0.4.15-dev-1384-g878186b
CControlPanelEnum Class Reference
Inheritance diagram for CControlPanelEnum:
Collaboration diagram for CControlPanelEnum:

Public Member Functions

 CControlPanelEnum ()
 
 ~CControlPanelEnum ()
 
HRESULT WINAPI Initialize (DWORD dwFlags, IEnumIDList *pRegEnumerator)
 
BOOL RegisterCPanelApp (LPCWSTR path)
 
int RegisterRegistryCPanelApps (HKEY hkey_root, LPCWSTR szRepPath)
 
BOOL CreateCPanelEnumList (DWORD dwFlags)
 
- 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 30 of file CControlPanelFolder.cpp.

Constructor & Destructor Documentation

◆ CControlPanelEnum()

CControlPanelEnum::CControlPanelEnum ( )

Definition at line 57 of file CControlPanelFolder.cpp.

58 {
59 }

◆ ~CControlPanelEnum()

CControlPanelEnum::~CControlPanelEnum ( )

Definition at line 61 of file CControlPanelFolder.cpp.

62 {
63 }

Member Function Documentation

◆ CreateCPanelEnumList()

BOOL CControlPanelEnum::CreateCPanelEnumList ( DWORD  dwFlags)

Definition at line 209 of file CControlPanelFolder.cpp.

210 {
212  WIN32_FIND_DATAW wfd;
213  HANDLE hFile;
214 
215  TRACE("(%p)->(flags=0x%08x)\n", this, dwFlags);
216 
217  /* enumerate the control panel applets */
218  if (dwFlags & SHCONTF_NONFOLDERS)
219  {
220  LPWSTR p;
221 
224  wcscpy(p, L"*.cpl");
225 
226  hFile = FindFirstFileW(szPath, &wfd);
227 
229  {
230  do
231  {
232  if (!(dwFlags & SHCONTF_INCLUDEHIDDEN) && (wfd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
233  continue;
234 
235  if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
236  wcscpy(p, wfd.cFileName);
237  if (wcscmp(wfd.cFileName, L"ncpa.cpl"))
239  }
240  } while(FindNextFileW(hFile, &wfd));
241  FindClose(hFile);
242  }
243 
244  RegisterRegistryCPanelApps(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls");
245  RegisterRegistryCPanelApps(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls");
246  }
247  return TRUE;
248 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ HANDLE hFile
Definition: mswsock.h:90
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
LPCWSTR szPath
Definition: env.c:35
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2312
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL RegisterCPanelApp(LPCWSTR path)
int RegisterRegistryCPanelApps(HKEY hkey_root, LPCWSTR szRepPath)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by Initialize().

◆ Initialize()

HRESULT WINAPI CControlPanelEnum::Initialize ( DWORD  dwFlags,
IEnumIDList pRegEnumerator 
)

Definition at line 65 of file CControlPanelFolder.cpp.

66 {
68  return E_FAIL;
69  AppendItemsFromEnumerator(pRegEnumerator);
70  return S_OK;
71 }
#define E_FAIL
Definition: ddrawi.h:102
#define FALSE
Definition: types.h:117
HRESULT AppendItemsFromEnumerator(IEnumIDList *pEnum)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:51
BOOL CreateCPanelEnumList(DWORD dwFlags)

◆ RegisterCPanelApp()

BOOL CControlPanelEnum::RegisterCPanelApp ( LPCWSTR  path)

Definition at line 144 of file CControlPanelFolder.cpp.

145 {
146  CPlApplet* applet = Control_LoadApplet(0, wpath, NULL);
147  int iconIdx;
148 
149  if (applet)
150  {
151  for (UINT i = 0; i < applet->count; ++i)
152  {
153  if (applet->info[i].idIcon > 0)
154  iconIdx = -applet->info[i].idIcon; /* negative icon index instead of icon number */
155  else
156  iconIdx = 0;
157 
158  LPITEMIDLIST pidl = _ILCreateCPanelApplet(wpath,
159  applet->info[i].name,
160  applet->info[i].info,
161  iconIdx);
162 
163  if (pidl)
164  AddToEnumList(pidl);
165  }
166  Control_UnloadApplet(applet);
167  }
168  return TRUE;
169 }
struct applet_info info[1]
Definition: cpanel.h:52
#define TRUE
Definition: types.h:120
BOOL AddToEnumList(LPITEMIDLIST pidl)
static LPITEMIDLIST _ILCreateCPanelApplet(LPCWSTR pszName, LPCWSTR pszDisplayName, LPCWSTR pszComment, int iIconIdx)
unsigned count
Definition: cpanel.h:49
void Control_UnloadApplet(CPlApplet *applet)
Definition: control.c:40
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
CPlApplet * Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel *panel)
Definition: control.c:56
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by CreateCPanelEnumList(), and RegisterRegistryCPanelApps().

◆ RegisterRegistryCPanelApps()

int CControlPanelEnum::RegisterRegistryCPanelApps ( HKEY  hkey_root,
LPCWSTR  szRepPath 
)

Definition at line 171 of file CControlPanelFolder.cpp.

172 {
175  HKEY hkey;
176 
177  int cnt = 0;
178 
179  if (RegOpenKeyW(hkey_root, szRepPath, &hkey) == ERROR_SUCCESS)
180  {
181  int idx = 0;
182 
183  for(; ; idx++)
184  {
185  DWORD nameLen = MAX_PATH;
186  DWORD valueLen = MAX_PATH;
188 
189  if (RegEnumValueW(hkey, idx, name, &nameLen, NULL, NULL, (LPBYTE)&value, &valueLen) != ERROR_SUCCESS)
190  break;
191 
193  {
194  wcscpy(value, buffer);
195  }
196 
198  ++cnt;
199  }
200  RegCloseKey(hkey);
201  }
202 
203  return cnt;
204 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint buffer
Definition: glext.h:5915
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
unsigned int idx
Definition: utils.c:41
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define NULL
Definition: types.h:112
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
Definition: name.c:38
BOOL RegisterCPanelApp(LPCWSTR path)

Referenced by CreateCPanelEnumList().


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