ReactOS 0.4.15-dev-8219-ge8b88cf
CAdminToolsFolder.cpp
Go to the documentation of this file.
1/*
2 * Virtual Admin Tools Folder
3 *
4 * Copyright 2008 Johannes Anderwald
5 * Copyright 2009 Andrew Hill
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <precomp.h>
23
25
27{
29}
30
32{
33 if(m_pidlInner)
35}
36
38 ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
39{
40 return m_pisfInner->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl, pdwAttributes);
41}
42
43HRESULT WINAPI CAdminToolsFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
44{
45 return m_pisfInner->EnumObjects(hwndOwner, dwFlags, ppEnumIDList);
46}
47
49{
50 return m_pisfInner->BindToObject(pidl, pbcReserved, riid, ppvOut);
51}
52
54{
55 return m_pisfInner->BindToStorage(pidl, pbcReserved, riid, ppvOut);
56}
57
59{
60 return m_pisfInner->CompareIDs(lParam, pidl1, pidl2);
61}
62
64{
65 return m_pisfInner->CreateViewObject(hwndOwner, riid, ppvOut);
66}
67
69{
70 static const DWORD dwAdminToolsAttributes =
71 SFGAO_STORAGE | SFGAO_STORAGEANCESTOR | SFGAO_FILESYSANCESTOR |
72 SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
73
74 if(cidl)
75 return m_pisfInner->GetAttributesOf(cidl, apidl, rgfInOut);
76
77 if (!rgfInOut || !apidl)
78 return E_INVALIDARG;
79
80 if (*rgfInOut == 0)
81 *rgfInOut = ~0;
82
83 *rgfInOut &= dwAdminToolsAttributes;
84
85 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
86 *rgfInOut &= ~SFGAO_VALIDATE;
87
88 return S_OK;
89}
90
92 REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
93{
94 return m_pisfInner->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppvOut);
95}
96
98{
99 if (!strRet || !pidl)
100 return E_INVALIDARG;
101
102 /* If we got an fs item just forward to the fs folder */
103 if (!_ILIsSpecialFolder(pidl))
104 return m_pisfInner->GetDisplayNameOf(pidl, dwFlags, strRet);
105
106 /* The caller wants our path. Let fs folder handle it */
109 {
110 /* Give an empty pidl to the fs folder to make it tell us its path */
111 if (pidl->mkid.cb)
112 pidl = ILGetNext(pidl);
113 return m_pisfInner->GetDisplayNameOf(pidl, dwFlags, strRet);
114 }
115
116 ERR("Got empty pidl without SHGDN_FORPARSING\n");
117 return E_INVALIDARG;
118}
119
121 LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
122{
123 return m_pisfInner->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
124}
125
127{
128 return m_pisfInner->GetDefaultSearchGUID(pguid);
129}
130
132{
133 return m_pisfInner->EnumSearches(ppenum);
134}
135
137{
138 return m_pisfInner->GetDefaultColumn(dwRes, pSort, pDisplay);
139}
140
142{
143 return m_pisfInner->GetDefaultColumnState(iColumn, pcsFlags);
144}
145
147{
148 return m_pisfInner->GetDetailsEx(pidl, pscid, pv);
149}
150
152{
153 return m_pisfInner->GetDetailsOf(pidl, iColumn, psd);
154}
155
157{
158 return m_pisfInner->MapColumnToSCID(column, pscid);
159}
160
162{
163 if (!lpClassId)
164 return E_POINTER;
165
166 memcpy(lpClassId, &CLSID_AdminFolderShortcut, sizeof(CLSID));
167
168 return S_OK;
169}
170
172{
173 m_pidlInner = ILClone(pidl);
174 if (!m_pidlInner)
175 return E_OUTOFMEMORY;
176
178 &CLSID_ShellFSFolder,
181}
182
184{
185 if (!pidl)
186 return E_POINTER;
187 *pidl = ILClone(m_pidlInner);
188 return S_OK;
189}
static HRESULT SHELL32_CoCreateInitSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidlChild, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: CFindFolder.cpp:13
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define ERR(fmt,...)
Definition: debug.h:113
STDMETHOD() BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
STDMETHOD() GetCurFolder(PIDLIST_ABSOLUTE *pidl) override
STDMETHOD() GetClassID(CLSID *lpClassId) override
STDMETHOD() GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
STDMETHOD() GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override
STDMETHOD() GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
STDMETHOD() SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override
STDMETHOD() EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
STDMETHOD() ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes) override
STDMETHOD() MapColumnToSCID(UINT column, SHCOLUMNID *pscid) override
STDMETHOD() GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
LPITEMIDLIST m_pidlInner
STDMETHOD() Initialize(PCIDLIST_ABSOLUTE pidl) override
STDMETHOD() GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags) override
STDMETHOD() EnumSearches(IEnumExtraSearch **ppenum) override
CComPtr< IShellFolder2 > m_pisfInner
STDMETHOD() CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
STDMETHOD() GetDefaultSearchGUID(GUID *pguid) override
STDMETHOD() GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
LPARAM lParam
Definition: combotst.c:139
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
#define GET_SHGDN_RELATION(dwFlags)
Definition: precomp.h:53
#define GET_SHGDN_FOR(dwFlags)
Definition: precomp.h:52
const GUID CLSID_AdminFolderShortcut
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static LPOLESTR
Definition: stg_prop.c:27
unsigned int UINT
Definition: ndis.h:50
interface IBindCtx * LPBC
Definition: objfwd.h:18
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:866
#define REFIID
Definition: guiddef.h:118
#define CSIDL_COMMON_ADMINTOOLS
Definition: shlobj.h:2212
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
uint32_t ULONG
Definition: typedefs.h:59
_In_ LPCSTR lpName
Definition: winbase.h:2789
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
LONG_PTR LPARAM
Definition: windef.h:208
#define WINAPI
Definition: msvc.h:6
#define E_POINTER
Definition: winerror.h:2365
#define IID_PPV_ARG(Itype, ppType)