ReactOS 0.4.16-dev-188-g678aa63
CControlPanelFolder.cpp File Reference
#include <precomp.h>
Include dependency graph for CControlPanelFolder.cpp:

Go to the source code of this file.

Classes

class  CControlPanelEnum
 

Enumerations

enum  controlpanel_columns { CONTROLPANEL_COL_NAME , CONTROLPANEL_COL_COMMENT , CONTROLPANEL_COL_COUNT }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static LPITEMIDLIST _ILCreateCPanelApplet (LPCWSTR pszName, LPCWSTR pszDisplayName, LPCWSTR pszComment, int iIconIdx)
 
static PIDLCPanelStruct_ILGetCPanelPointer (LPCITEMIDLIST pidl)
 
HRESULT CCPLExtractIcon_CreateInstance (IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
 
EXTERN_C void WINAPI Control_RunDLLW (HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow)
 
static HRESULT GetParsingName (PCIDLIST_ABSOLUTE pidl, PWSTR *Name)
 
static HRESULT CreateCplAbsoluteParsingPath (LPCWSTR Prefix, LPCWSTR InFolderParse, PWSTR Buf, UINT cchBuf)
 
static HRESULT FindExeCplClass (LPCWSTR Canonical, HKEY hKey, BOOL Wow64, LPWSTR clsid)
 
static HRESULT FindExeCplClass (LPCWSTR Canonical, LPWSTR clsid)
 

Variables

static const REGFOLDERINFO g_RegFolderInfo
 
static const shvheader ControlPanelSFHeader []
 

Enumeration Type Documentation

◆ controlpanel_columns

Enumerator
CONTROLPANEL_COL_NAME 
CONTROLPANEL_COL_COMMENT 
CONTROLPANEL_COL_COUNT 

Definition at line 64 of file CControlPanelFolder.cpp.

Function Documentation

◆ _ILCreateCPanelApplet()

static LPITEMIDLIST _ILCreateCPanelApplet ( LPCWSTR  pszName,
LPCWSTR  pszDisplayName,
LPCWSTR  pszComment,
int  iIconIdx 
)
static

Definition at line 87 of file CControlPanelFolder.cpp.

88{
90 LPITEMIDLIST pidl;
92 int cchName, cchDisplayName, cchComment, cbData;
93
94 /* Calculate lengths of given strings */
95 cchName = wcslen(pszName);
96 cchDisplayName = wcslen(pszDisplayName);
97 cchComment = wcslen(pszComment);
98
99 /* Allocate PIDL */
100 cbData = sizeof(pidl->mkid.cb) + sizeof(pData->type) + sizeof(pData->u.cpanel) - sizeof(pData->u.cpanel.szName)
101 + (cchName + cchDisplayName + cchComment + 3) * sizeof(WCHAR);
102 pidl = (LPITEMIDLIST)SHAlloc(cbData + sizeof(WORD));
103 if (!pidl)
104 return NULL;
105
106 /* Copy data to allocated memory */
107 pidl->mkid.cb = cbData;
108 pData = (PIDLDATA *)pidl->mkid.abID;
109 pData->type = PT_CPLAPPLET;
110
111 pCP = &pData->u.cpanel;
112 pCP->dummy = 0;
113 pCP->iconIdx = iIconIdx;
114 wcscpy(pCP->szName, pszName);
115 pCP->offsDispName = cchName + 1;
116 wcscpy(pCP->szName + pCP->offsDispName, pszDisplayName);
117 pCP->offsComment = pCP->offsDispName + cchDisplayName + 1;
118 wcscpy(pCP->szName + pCP->offsComment, pszComment);
119
120 /* Add PIDL NULL terminator */
121 *(WORD*)(pCP->szName + pCP->offsComment + cchComment + 1) = 0;
122
123 pcheck(pidl);
124
125 return pidl;
126}
BOOL pcheck(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:349
#define NULL
Definition: types.h:112
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
unsigned short WORD
Definition: ntddk_ex.h:93
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define PT_CPLAPPLET
Definition: pidl.h:86
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
WORD offsComment
Definition: pidl.h:127
WCHAR szName[1]
Definition: pidl.h:128
WORD offsDispName
Definition: pidl.h:126
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR _Inout_ LPDWORD cchDisplayName
Definition: winbase.h:2791
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2767
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CControlPanelEnum::RegisterCPanelApp().

◆ _ILGetCPanelPointer()

static PIDLCPanelStruct * _ILGetCPanelPointer ( LPCITEMIDLIST  pidl)
static

Definition at line 132 of file CControlPanelFolder.cpp.

133{
135
136 if (pdata && pdata->type == PT_CPLAPPLET)
137 return (PIDLCPanelStruct *) & (pdata->u.cpanel);
138
139 return NULL;
140}
static PROTOCOLDATA * pdata
Definition: protocol.c:158
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2160

Referenced by CCPLExtractIcon_CreateInstance(), CControlPanelFolder::CompareIDs(), CControlPanelFolder::GetDetailsOf(), CControlPanelFolder::GetDisplayNameOf(), CControlPanelFolder::GetUIObjectOf(), and CCPLItemMenu::InvokeCommand().

◆ CCPLExtractIcon_CreateInstance()

HRESULT CCPLExtractIcon_CreateInstance ( IShellFolder psf,
LPCITEMIDLIST  pidl,
REFIID  riid,
LPVOID ppvOut 
)

Definition at line 142 of file CControlPanelFolder.cpp.

143{
145 if (!pData)
146 return E_FAIL;
147
148 CComPtr<IDefaultExtractIconInit> initIcon;
151 return hr;
152
153 initIcon->SetNormalIcon(pData->szName, (int)pData->iconIdx != -1 ? pData->iconIdx : 0);
154
155 return initIcon->QueryInterface(riid, ppvOut);
156}
static PIDLCPanelStruct * _ILGetCPanelPointer(LPCITEMIDLIST pidl)
HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
#define E_FAIL
Definition: ddrawi.h:102
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
REFIID riid
Definition: atlbase.h:39
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)

Referenced by CControlPanelFolder::GetUIObjectOf().

◆ Control_RunDLLW()

EXTERN_C void WINAPI Control_RunDLLW ( HWND  hWnd,
HINSTANCE  hInst,
LPCWSTR  cmd,
DWORD  nCmdShow 
)

Definition at line 1173 of file control.c.

1174{
1175 CPanel panel;
1176
1177 TRACE("(%p, %p, %s, 0x%08x)\n",
1178 hWnd, hInst, debugstr_w(cmd), nCmdShow);
1179
1180#ifndef __REACTOS__
1181 memset(&panel, 0, sizeof(panel));
1182 list_init( &panel.applets );
1183#endif
1184
1185 if (!cmd || !*cmd) {
1186 Control_DoWindow(&panel, hWnd, hInst);
1187 } else {
1188 Control_DoLaunch(&panel, hWnd, cmd);
1189 }
1190}
HWND hWnd
Definition: settings.c:17
static void list_init(struct list_entry *head)
Definition: list.h:51
static void Control_DoWindow(CPanel *panel, HWND hWnd, HINSTANCE hInst)
Definition: control.c:703
static void Control_DoLaunch(CPanel *panel, HWND hWnd, LPCWSTR wszCmd)
Definition: control.c:867
HINSTANCE hInst
Definition: dxdiag.c:13
#define debugstr_w
Definition: kernel32.h:32
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cpanel.h:56
struct list applets
Definition: cpanel.h:57
Definition: ftp_var.h:139

◆ CreateCplAbsoluteParsingPath()

static HRESULT CreateCplAbsoluteParsingPath ( LPCWSTR  Prefix,
LPCWSTR  InFolderParse,
PWSTR  Buf,
UINT  cchBuf 
)
static

Definition at line 803 of file CControlPanelFolder.cpp.

804{
805 PWSTR cpfolder;
807 if (SUCCEEDED(hr))
808 {
809 hr = StringCchPrintfW(Buf, cchBuf, L"%s\\%s%s", cpfolder, Prefix, InFolderParse);
810 SHFree(cpfolder);
811 }
812 return hr;
813}
static HRESULT GetParsingName(PCIDLIST_ABSOLUTE pidl, PWSTR *Name)
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define L(x)
Definition: ntvdm.h:50
#define CSIDL_CONTROLS
Definition: shlobj.h:2176
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
uint16_t * PWSTR
Definition: typedefs.h:56
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1644

Referenced by COpenControlPanel::GetPath(), and COpenControlPanel::Open().

◆ FindExeCplClass() [1/2]

static HRESULT FindExeCplClass ( LPCWSTR  Canonical,
HKEY  hKey,
BOOL  Wow64,
LPWSTR  clsid 
)
static

Definition at line 815 of file CControlPanelFolder.cpp.

816{
818 HKEY hNSKey;
820 wsprintfW(key, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\%s\\NameSpace",
821 Wow64 ? L"ControlPanelWOW64" : L"ControlPanel");
822 LSTATUS error = RegOpenKeyExW(hKey, key, 0, KEY_READ, &hNSKey);
823 if (error)
825 for (DWORD i = 0; RegEnumKeyW(hNSKey, i, key, _countof(key)) == ERROR_SUCCESS; ++i)
826 {
829 {
830 wsprintfW(buf, L"CLSID\\%s", key);
831 DWORD cb = sizeof(buf);
832 if (RegGetValueW(HKEY_CLASSES_ROOT, buf, L"System.ApplicationName",
834 {
835 if (!lstrcmpiW(buf, Canonical))
836 {
838 hr = S_OK;
839 }
840 }
841 }
842 }
843 RegCloseKey(hNSKey);
844 return hr;
845}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2393
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:749
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4262
HRESULT WINAPI IIDFromString(LPCOLESTR s, IID *iid)
Definition: compobj.c:2374
#define RRF_RT_REG_SZ
Definition: driver.c:575
static FRESULT validate(void *obj)
Definition: ff.c:2372
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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
#define S_OK
Definition: intsafe.h:52
#define error(str)
Definition: mkdosfs.c:1605
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
REFCLSID clsid
Definition: msctf.c:82
#define KEY_READ
Definition: nt_native.h:1023
#define _countof(array)
Definition: sndvol32.h:70
Definition: copy.c:22
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_NOT_FOUND
Definition: winerror.h:690
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by FindExeCplClass(), COpenControlPanel::GetPath(), and COpenControlPanel::Open().

◆ FindExeCplClass() [2/2]

static HRESULT FindExeCplClass ( LPCWSTR  Canonical,
LPWSTR  clsid 
)
static

Definition at line 847 of file CControlPanelFolder.cpp.

848{
849 HRESULT hr = E_FAIL;
850 if (FAILED(hr))
852 if (FAILED(hr))
854 if (FAILED(hr))
856 if (FAILED(hr))
858 return hr;
859}
static HRESULT FindExeCplClass(LPCWSTR Canonical, HKEY hKey, BOOL Wow64, LPWSTR clsid)
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FAILED(hr)
Definition: intsafe.h:51
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11

◆ GetParsingName()

static HRESULT GetParsingName ( PCIDLIST_ABSOLUTE  pidl,
PWSTR Name 
)
static

Definition at line 788 of file CControlPanelFolder.cpp.

789{
790 PIDLIST_ABSOLUTE pidlFree = NULL;
791 if (IS_INTRESOURCE(pidl))
792 {
793 HRESULT hr = SHGetSpecialFolderLocation(NULL, (UINT)(SIZE_T)pidl, &pidlFree);
794 if (FAILED(hr))
795 return hr;
796 pidl = pidlFree;
797 }
798 HRESULT hr = SHGetNameFromIDList(pidl, SIGDN_DESKTOPABSOLUTEPARSING, Name);
799 ILFree(pidlFree);
800 return hr;
801}
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3257
unsigned int UINT
Definition: ndis.h:50
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:946
HRESULT WINAPI SHGetNameFromIDList(PCIDLIST_ABSOLUTE pidl, SIGDN sigdnName, PWSTR *ppszName)
Definition: pidl.c:1462
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IS_INTRESOURCE(i)
Definition: winuser.h:580

Referenced by CreateCplAbsoluteParsingPath(), and COpenControlPanel::GetPath().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ ControlPanelSFHeader

const shvheader ControlPanelSFHeader[]
static
Initial value:
= {
}
#define IDS_SHV_COLUMN_NAME
Definition: resource.h:74
#define LVCFMT_LEFT
Definition: commctrl.h:2603
#define IDS_SHV_COLUMN_COMMENTS
Definition: shresdef.h:67
@ SHCOLSTATE_TYPE_STR
Definition: shtypes.idl:121
@ SHCOLSTATE_ONBYDEFAULT
Definition: shtypes.idl:125

Definition at line 59 of file CControlPanelFolder.cpp.

Referenced by CControlPanelFolder::GetDefaultColumnState(), and CControlPanelFolder::GetDetailsOf().

◆ g_RegFolderInfo

const REGFOLDERINFO g_RegFolderInfo
static
Initial value:
=
{
PT_CONTROLS_NEWREGITEM,
0, NULL,
CLSID_ControlPanel,
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}",
L"ControlPanel",
}

Definition at line 26 of file CControlPanelFolder.cpp.

Referenced by CDesktopFolder::FinalConstruct(), CDrivesFolder::FinalConstruct(), and CControlPanelFolder::Initialize().