ReactOS 0.4.15-dev-7924-g5949c20
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 shvheader ControlPanelSFHeader []
 

Enumeration Type Documentation

◆ controlpanel_columns

Enumerator
CONTROLPANEL_COL_NAME 
CONTROLPANEL_COL_COMMENT 
CONTROLPANEL_COL_COUNT 

Definition at line 55 of file CControlPanelFolder.cpp.

Function Documentation

◆ _ILCreateCPanelApplet()

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

Definition at line 78 of file CControlPanelFolder.cpp.

79{
81 LPITEMIDLIST pidl;
83 int cchName, cchDisplayName, cchComment, cbData;
84
85 /* Calculate lengths of given strings */
86 cchName = wcslen(pszName);
87 cchDisplayName = wcslen(pszDisplayName);
88 cchComment = wcslen(pszComment);
89
90 /* Allocate PIDL */
91 cbData = sizeof(pidl->mkid.cb) + sizeof(pData->type) + sizeof(pData->u.cpanel) - sizeof(pData->u.cpanel.szName)
92 + (cchName + cchDisplayName + cchComment + 3) * sizeof(WCHAR);
93 pidl = (LPITEMIDLIST)SHAlloc(cbData + sizeof(WORD));
94 if (!pidl)
95 return NULL;
96
97 /* Copy data to allocated memory */
98 pidl->mkid.cb = cbData;
99 pData = (PIDLDATA *)pidl->mkid.abID;
100 pData->type = PT_CPLAPPLET;
101
102 pCP = &pData->u.cpanel;
103 pCP->dummy = 0;
104 pCP->iconIdx = iIconIdx;
105 wcscpy(pCP->szName, pszName);
106 pCP->offsDispName = cchName + 1;
107 wcscpy(pCP->szName + pCP->offsDispName, pszDisplayName);
108 pCP->offsComment = pCP->offsDispName + cchDisplayName + 1;
109 wcscpy(pCP->szName + pCP->offsComment, pszComment);
110
111 /* Add PIDL NULL terminator */
112 *(WORD*)(pCP->szName + pCP->offsComment + cchComment + 1) = 0;
113
114 pcheck(pidl);
115
116 return pidl;
117}
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:115
WCHAR szName[1]
Definition: pidl.h:116
WORD offsDispName
Definition: pidl.h:114
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 123 of file CControlPanelFolder.cpp.

124{
126
127 if (pdata && pdata->type == PT_CPLAPPLET)
128 return (PIDLCPanelStruct *) & (pdata->u.cpanel);
129
130 return NULL;
131}
static PROTOCOLDATA * pdata
Definition: protocol.c:158
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2231

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

134{
136 if (!pData)
137 return E_FAIL;
138
139 CComPtr<IDefaultExtractIconInit> initIcon;
142 return hr;
143
144 initIcon->SetNormalIcon(pData->szName, (int)pData->iconIdx != -1 ? pData->iconIdx : 0);
145
146 return initIcon->QueryInterface(riid, ppvOut);
147}
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 1043 of file control.c.

1044{
1045 CPanel panel;
1046
1047 TRACE("(%p, %p, %s, 0x%08x)\n",
1048 hWnd, hInst, debugstr_w(cmd), nCmdShow);
1049
1050#ifndef __REACTOS__
1051 memset(&panel, 0, sizeof(panel));
1052 list_init( &panel.applets );
1053#endif
1054
1055 if (!cmd || !*cmd) {
1056 Control_DoWindow(&panel, hWnd, hInst);
1057 } else {
1058 Control_DoLaunch(&panel, hWnd, cmd);
1059 }
1060}
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:866
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 795 of file CControlPanelFolder.cpp.

796{
797 PWSTR cpfolder;
799 if (SUCCEEDED(hr))
800 {
801 hr = StringCchPrintfW(Buf, cchBuf, L"%s\\%s%s", cpfolder, Prefix, InFolderParse);
802 SHFree(cpfolder);
803 }
804 return hr;
805}
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:2161
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:1630

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

808{
810 HKEY hNSKey;
812 wsprintfW(key, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\%s\\NameSpace",
813 Wow64 ? L"ControlPanelWOW64" : L"ControlPanel");
814 LSTATUS error = RegOpenKeyExW(hKey, key, 0, KEY_READ, &hNSKey);
815 if (error)
817 for (DWORD i = 0; RegEnumKeyW(hNSKey, i, key, _countof(key)) == ERROR_SUCCESS; ++i)
818 {
821 {
822 wsprintfW(buf, L"CLSID\\%s", key);
823 DWORD cb = sizeof(buf);
824 if (RegGetValueW(HKEY_CLASSES_ROOT, buf, L"System.ApplicationName",
826 {
827 if (!lstrcmpiW(buf, Canonical))
828 {
830 hr = S_OK;
831 }
832 }
833 }
834 }
835 RegCloseKey(hNSKey);
836 return hr;
837}
#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
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
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#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:68
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 839 of file CControlPanelFolder.cpp.

840{
841 HRESULT hr = E_FAIL;
842 if (FAILED(hr))
844 if (FAILED(hr))
846 if (FAILED(hr))
848 if (FAILED(hr))
850 return hr;
851}
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 780 of file CControlPanelFolder.cpp.

781{
782 PIDLIST_ABSOLUTE pidlFree = NULL;
783 if (IS_INTRESOURCE(pidl))
784 {
785 HRESULT hr = SHGetSpecialFolderLocation(NULL, (UINT)(SIZE_T)pidl, &pidlFree);
786 if (FAILED(hr))
787 return hr;
788 pidl = pidlFree;
789 }
790 HRESULT hr = SHGetNameFromIDList(pidl, SIGDN_DESKTOPABSOLUTEPARSING, Name);
791 ILFree(pidlFree);
792 return hr;
793}
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3225
unsigned int UINT
Definition: ndis.h:50
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:938
HRESULT WINAPI SHGetNameFromIDList(PCIDLIST_ABSOLUTE pidl, SIGDN sigdnName, PWSTR *ppszName)
Definition: pidl.c:1467
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:2598
#define IDS_SHV_COLUMN_COMMENTS
Definition: shresdef.h:69
@ SHCOLSTATE_TYPE_STR
Definition: shtypes.idl:121
@ SHCOLSTATE_ONBYDEFAULT
Definition: shtypes.idl:125

Definition at line 50 of file CControlPanelFolder.cpp.

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