ReactOS 0.4.16-dev-1040-g85afe48
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 const CLSIDIsRegItem (LPCITEMIDLIST pidl)
 
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 95 of file CControlPanelFolder.cpp.

96{
98 LPITEMIDLIST pidl;
100 int cchName, cchDisplayName, cchComment, cbData;
101
102 /* Calculate lengths of given strings */
103 cchName = wcslen(pszName);
104 cchDisplayName = wcslen(pszDisplayName);
105 cchComment = wcslen(pszComment);
106
107 /* Allocate PIDL */
108 cbData = sizeof(pidl->mkid.cb) + sizeof(pData->type) + sizeof(pData->u.cpanel) - sizeof(pData->u.cpanel.szName)
109 + (cchName + cchDisplayName + cchComment + 3) * sizeof(WCHAR);
110 pidl = (LPITEMIDLIST)SHAlloc(cbData + sizeof(WORD));
111 if (!pidl)
112 return NULL;
113
114 /* Copy data to allocated memory */
115 pidl->mkid.cb = cbData;
116 pData = (PIDLDATA *)pidl->mkid.abID;
117 pData->type = PT_CPLAPPLET;
118
119 pCP = &pData->u.cpanel;
120 pCP->dummy = 0;
121 pCP->iconIdx = iIconIdx;
122 wcscpy(pCP->szName, pszName);
123 pCP->offsDispName = cchName + 1;
124 wcscpy(pCP->szName + pCP->offsDispName, pszDisplayName);
125 pCP->offsComment = pCP->offsDispName + cchDisplayName + 1;
126 wcscpy(pCP->szName + pCP->offsComment, pszComment);
127
128 /* Add PIDL NULL terminator */
129 *(WORD*)(pCP->szName + pCP->offsComment + cchComment + 1) = 0;
130
131 pcheck(pidl);
132
133 return pidl;
134}
wcscpy
BOOL pcheck(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:360
#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
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
WORD offsComment
Definition: pidl.h:143
WCHAR szName[1]
Definition: pidl.h:144
WORD offsDispName
Definition: pidl.h:142
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:2822
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2798
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CControlPanelEnum::RegisterCPanelApp().

◆ _ILGetCPanelPointer()

static PIDLCPanelStruct * _ILGetCPanelPointer ( LPCITEMIDLIST  pidl)
static

Definition at line 140 of file CControlPanelFolder.cpp.

141{
143
144 if (pdata && pdata->type == PT_CPLAPPLET)
145 return (PIDLCPanelStruct *) & (pdata->u.cpanel);
146
147 return NULL;
148}
static PROTOCOLDATA * pdata
Definition: protocol.c:158
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2271

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 150 of file CControlPanelFolder.cpp.

151{
153 if (!pData)
154 return E_FAIL;
155
156 CComPtr<IDefaultExtractIconInit> initIcon;
159 return hr;
160
161 initIcon->SetNormalIcon(pData->szName, (int)pData->iconIdx != -1 ? pData->iconIdx : 0);
162
163 return initIcon->QueryInterface(riid, ppvOut);
164}
static PIDLCPanelStruct * _ILGetCPanelPointer(LPCITEMIDLIST pidl)
HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
#define E_FAIL
Definition: ddrawi.h:102
#define FAILED_UNEXPECTEDLY(hr)
Definition: debug.h:83
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 816 of file CControlPanelFolder.cpp.

817{
818 PWSTR cpfolder;
820 if (SUCCEEDED(hr))
821 {
822 hr = StringCchPrintfW(Buf, cchBuf, L"%s\\%s%s", cpfolder, Prefix, InFolderParse);
823 SHFree(cpfolder);
824 }
825 return hr;
826}
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:2184
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:1647

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 828 of file CControlPanelFolder.cpp.

829{
831 HKEY hNSKey;
833 wsprintfW(key, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\%s\\NameSpace",
834 Wow64 ? L"ControlPanelWOW64" : L"ControlPanel");
835 LSTATUS error = RegOpenKeyExW(hKey, key, 0, KEY_READ, &hNSKey);
836 if (error)
838 for (DWORD i = 0; RegEnumKeyW(hNSKey, i, key, _countof(key)) == ERROR_SUCCESS; ++i)
839 {
842 {
843 wsprintfW(buf, L"CLSID\\%s", key);
844 DWORD cb = sizeof(buf);
845 if (RegGetValueW(HKEY_CLASSES_ROOT, buf, L"System.ApplicationName",
847 {
848 if (!lstrcmpiW(buf, Canonical))
849 {
851 hr = S_OK;
852 }
853 }
854 }
855 }
856 RegCloseKey(hNSKey);
857 return hr;
858}
#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 860 of file CControlPanelFolder.cpp.

861{
862 HRESULT hr = E_FAIL;
863 if (FAILED(hr))
865 if (FAILED(hr))
867 if (FAILED(hr))
869 if (FAILED(hr))
871 return hr;
872}
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 801 of file CControlPanelFolder.cpp.

802{
803 PIDLIST_ABSOLUTE pidlFree = NULL;
804 if (IS_INTRESOURCE(pidl))
805 {
806 HRESULT hr = SHGetSpecialFolderLocation(NULL, (UINT)(SIZE_T)pidl, &pidlFree);
807 if (FAILED(hr))
808 return hr;
809 pidl = pidlFree;
810 }
811 HRESULT hr = SHGetNameFromIDList(pidl, SIGDN_DESKTOPABSOLUTEPARSING, Name);
812 ILFree(pidlFree);
813 return hr;
814}
LPWSTR Name
Definition: desk.c:124
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3408
unsigned int UINT
Definition: ndis.h:50
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1044
HRESULT WINAPI SHGetNameFromIDList(PCIDLIST_ABSOLUTE pidl, SIGDN sigdnName, PWSTR *ppszName)
Definition: pidl.c:1603
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IS_INTRESOURCE(i)
Definition: winuser.h:580

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

◆ IsRegItem()

static const CLSID * IsRegItem ( LPCITEMIDLIST  pidl)
static

Definition at line 87 of file CControlPanelFolder.cpp.

88{
89 BYTE type = _ILGetType(pidl);
90 if (type == PT_CONTROLS_OLDREGITEM || type == PT_CONTROLS_NEWREGITEM)
91 return (CLSID*)((BYTE*)pidl + (pidl->mkid.cb - sizeof(CLSID)));
92 return NULL;
93}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static BYTE _ILGetType(LPCITEMIDLIST pidl)
Definition: pidl.h:124
unsigned char BYTE
Definition: xxhash.c:193

Referenced by CDesktopFolder::_GetSFFromPidl(), CDesktopFolder::GetAttributesOf(), CDrivesFolder::GetAttributesOf(), CControlPanelFolder::GetDetailsEx(), CDrivesFolder::GetDetailsEx(), CDesktopFolderViewCB::ShouldShow(), and CDrivesFolder::ShouldShow().

◆ 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:77
#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().