Author: dquintana
Date: Sun Feb 22 18:26:58 2015
New Revision: 66414
URL:
http://svn.reactos.org/svn/reactos?rev=66414&view=rev
Log:
[RSHELL]
[NBTSHELL]
[NTOBJSHEX]
* Fix prototypes of GetAttributesOf and GetUIObjectOf to conform with the specialized
IDLIST subtypes.
[PSDK]
* Fix the declaration of PCITEMID_CHILD to make the "const" attribute affect the
contents, and not the pointers themselves.
In preparation for whenever CORE-8441 happens.
Modified:
trunk/reactos/base/shell/rshell/CMergedFolder.cpp
trunk/reactos/base/shell/rshell/CMergedFolder.h
trunk/reactos/dll/shellext/netshell/shfldr_netconnect.cpp
trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp
trunk/reactos/dll/shellext/ntobjshex/ntobjns.h
trunk/reactos/include/psdk/shtypes.idl
Modified: trunk/reactos/base/shell/rshell/CMergedFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMergedF…
==============================================================================
--- trunk/reactos/base/shell/rshell/CMergedFolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/rshell/CMergedFolder.cpp [iso-8859-1] Sun Feb 22 18:26:58
2015
@@ -595,7 +595,7 @@
HRESULT STDMETHODCALLTYPE CMergedFolder::GetAttributesOf(
UINT cidl,
- LPCITEMIDLIST *apidl,
+ PCUITEMID_CHILD_ARRAY apidl,
SFGAOF *rgfInOut)
{
LocalPidlInfo info;
@@ -627,7 +627,7 @@
HRESULT STDMETHODCALLTYPE CMergedFolder::GetUIObjectOf(
HWND hwndOwner,
UINT cidl,
- LPCITEMIDLIST *apidl,
+ PCUITEMID_CHILD_ARRAY apidl,
REFIID riid,
UINT *prgfInOut,
void **ppvOut)
Modified: trunk/reactos/base/shell/rshell/CMergedFolder.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMergedF…
==============================================================================
--- trunk/reactos/base/shell/rshell/CMergedFolder.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/rshell/CMergedFolder.h [iso-8859-1] Sun Feb 22 18:26:58 2015
@@ -132,13 +132,13 @@
virtual HRESULT STDMETHODCALLTYPE GetAttributesOf(
UINT cidl,
- LPCITEMIDLIST *apidl,
+ PCUITEMID_CHILD_ARRAY apidl,
SFGAOF *rgfInOut);
virtual HRESULT STDMETHODCALLTYPE GetUIObjectOf(
HWND hwndOwner,
UINT cidl,
- LPCITEMIDLIST *apidl,
+ PCUITEMID_CHILD_ARRAY apidl,
REFIID riid,
UINT *prgfInOut,
void **ppvOut);
Modified: trunk/reactos/dll/shellext/netshell/shfldr_netconnect.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/netshell/shfl…
==============================================================================
--- trunk/reactos/dll/shellext/netshell/shfldr_netconnect.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/netshell/shfldr_netconnect.cpp [iso-8859-1] Sun Feb 22
18:26:58 2015
@@ -46,8 +46,8 @@
virtual HRESULT WINAPI BindToStorage(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID
riid, LPVOID *ppvOut);
virtual HRESULT WINAPI CompareIDs(LPARAM lParam, LPCITEMIDLIST pidl1,
LPCITEMIDLIST pidl2);
virtual HRESULT WINAPI CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID
*ppvOut);
- virtual HRESULT WINAPI GetAttributesOf (UINT cidl, LPCITEMIDLIST *apidl, DWORD
*rgfInOut);
- virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl, LPCITEMIDLIST
*apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
+ virtual HRESULT WINAPI GetAttributesOf (UINT cidl, PCUITEMID_CHILD_ARRAY apidl,
DWORD *rgfInOut);
+ virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl,
PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
virtual HRESULT WINAPI GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD dwFlags,
LPSTRRET strRet);
virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, LPCITEMIDLIST pidl, LPCOLESTR
lpName, DWORD dwFlags, LPITEMIDLIST *pPidlOut);
@@ -356,7 +356,7 @@
* ISF_NetConnect_fnGetAttributesOf
*/
HRESULT WINAPI CNetworkConnections::GetAttributesOf(
- UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
+ UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD * rgfInOut)
{
//IGenericSFImpl *This = (IGenericSFImpl *)iface;
HRESULT hr = S_OK;
@@ -412,7 +412,7 @@
}
HRESULT WINAPI CNetworkConnections::GetUIObjectOf(
- HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl, REFIID riid,
+ HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid,
UINT * prgfInOut, LPVOID * ppvOut)
{
IUnknown *pObj = NULL;
Modified: trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/nto…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp [iso-8859-1] Sun Feb 22 18:26:58
2015
@@ -54,7 +54,7 @@
return S_OK;
}
-static HRESULT GetFullName(LPCITEMIDLIST pidl, DWORD uFlags, PWSTR strName, DWORD
cchName)
+static HRESULT GetFullName(PCIDLIST_ABSOLUTE pidl, DWORD uFlags, PWSTR strName, DWORD
cchName)
{
CComPtr<IShellFolder> psfDesktop;
STRRET str;
@@ -75,42 +75,42 @@
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IContextMenu
{
- LPCITEMIDLIST pcidlFolder;
- LPCITEMIDLIST pcidlChild;
- UINT idFirst;
+ PCIDLIST_ABSOLUTE m_pcidlFolder;
+ PCITEMID_CHILD m_pcidlChild;
+ UINT m_idFirst;
public:
CNtObjectFolderContextMenu() :
- pcidlFolder(NULL),
- pcidlChild(NULL),
- idFirst(0)
+ m_pcidlFolder(NULL),
+ m_pcidlChild(NULL),
+ m_idFirst(0)
{
}
virtual ~CNtObjectFolderContextMenu()
{
- if (pcidlFolder)
- ILFree((LPITEMIDLIST) pcidlFolder);
- if (pcidlChild)
- ILFree((LPITEMIDLIST) pcidlChild);
- }
-
- HRESULT Initialize(LPITEMIDLIST parent, UINT cidl, LPCITEMIDLIST *apidl)
- {
- pcidlFolder = ILClone(parent);
+ if (m_pcidlFolder)
+ ILFree((LPITEMIDLIST) m_pcidlFolder);
+ if (m_pcidlChild)
+ ILFree((LPITEMIDLIST) m_pcidlChild);
+ }
+
+ HRESULT Initialize(PCIDLIST_ABSOLUTE parent, UINT cidl, PCUITEMID_CHILD_ARRAY apidl)
+ {
+ m_pcidlFolder = ILClone(parent);
if (cidl != 1)
- return E_FAIL;
- pcidlChild = ILClone(apidl[0]);
+ return E_INVALIDARG;
+ m_pcidlChild = ILClone(apidl[0]);
return S_OK;
}
// IContextMenu
virtual HRESULT WINAPI QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst,
UINT idCmdLast, UINT uFlags)
{
- idFirst = idCmdFirst;
-
- const NtPidlEntry * entry = (NtPidlEntry *) pcidlChild;
+ m_idFirst = idCmdFirst;
+
+ const NtPidlEntry * entry = (NtPidlEntry *) m_pcidlChild;
if ((entry->objectType == DIRECTORY_OBJECT) ||
(entry->objectType == SYMBOLICLINK_OBJECT))
@@ -146,14 +146,14 @@
}
}
- return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmdFirst - idFirst);
+ return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmdFirst - m_idFirst);
}
virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
{
- if (LOWORD(lpici->lpVerb) == idFirst || !lpici->lpVerb)
- {
- LPITEMIDLIST fullPidl = ILCombine(pcidlFolder, pcidlChild);
+ if (LOWORD(lpici->lpVerb) == m_idFirst || !lpici->lpVerb)
+ {
+ LPITEMIDLIST fullPidl = ILCombine(m_pcidlFolder, m_pcidlChild);
SHELLEXECUTEINFO sei = { 0 };
sei.cbSize = sizeof(sei);
@@ -169,9 +169,9 @@
return bRes ? S_OK : HRESULT_FROM_WIN32(GetLastError());
}
- else if (LOWORD(lpici->lpVerb) == (idFirst + 1))
- {
- LPITEMIDLIST fullPidl = ILCombine(pcidlFolder, pcidlChild);
+ else if (LOWORD(lpici->lpVerb) == (m_idFirst + 1))
+ {
+ LPITEMIDLIST fullPidl = ILCombine(m_pcidlFolder, m_pcidlChild);
SHELLEXECUTEINFO sei = { 0 };
sei.cbSize = sizeof(sei);
@@ -192,7 +192,7 @@
virtual HRESULT WINAPI GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved,
LPSTR pszName, UINT cchMax)
{
- if (idCmd == idFirst)
+ if (idCmd == m_idFirst)
{
if (uType == GCS_VERBW)
{
@@ -200,7 +200,7 @@
return S_OK;
}
}
- else if (idCmd == (idFirst + 1))
+ else if (idCmd == (m_idFirst + 1))
{
if (uType == GCS_VERBW)
{
@@ -224,31 +224,31 @@
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IExtractIconW
{
- LPCITEMIDLIST pcidlFolder;
- LPCITEMIDLIST pcidlChild;
+ PCIDLIST_ABSOLUTE m_pcidlFolder;
+ PCITEMID_CHILD m_pcidlChild;
public:
CNtObjectFolderExtractIcon() :
- pcidlFolder(NULL),
- pcidlChild(NULL)
+ m_pcidlFolder(NULL),
+ m_pcidlChild(NULL)
{
}
virtual ~CNtObjectFolderExtractIcon()
{
- if (pcidlFolder)
- ILFree((LPITEMIDLIST) pcidlFolder);
- if (pcidlChild)
- ILFree((LPITEMIDLIST) pcidlChild);
- }
-
- HRESULT Initialize(LPITEMIDLIST parent, UINT cidl, LPCITEMIDLIST *apidl)
- {
- pcidlFolder = ILClone(parent);
+ if (m_pcidlFolder)
+ ILFree((LPITEMIDLIST) m_pcidlFolder);
+ if (m_pcidlChild)
+ ILFree((LPITEMIDLIST) m_pcidlChild);
+ }
+
+ HRESULT Initialize(PCIDLIST_ABSOLUTE parent, UINT cidl, PCUITEMID_CHILD_ARRAY apidl)
+ {
+ m_pcidlFolder = ILClone(parent);
if (cidl != 1)
return E_FAIL;
- pcidlChild = ILClone(apidl[0]);
+ m_pcidlChild = ILClone(apidl[0]);
return S_OK;
}
@@ -259,9 +259,16 @@
INT *piIndex,
UINT *pwFlags)
{
- const NtPidlEntry * entry = (NtPidlEntry *) pcidlChild;
+ const NtPidlEntry * entry = (NtPidlEntry *) m_pcidlChild;
if (entry->magic != NT_OBJECT_PIDL_MAGIC)
return E_FAIL;
+
+ UINT flags = 0;
+
+#define GIL_CHECKSHIELD 0x0200
+#define GIL_SHIELD 0x0200
+ if (uFlags & GIL_CHECKSHIELD &&
!(entry->objectInformation.GrantedAccess & STANDARD_RIGHTS_READ))
+ flags |= GIL_SHIELD;
switch (entry->objectType)
{
@@ -269,22 +276,22 @@
case SYMBOLICLINK_OBJECT:
GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
*piIndex = -((uFlags & GIL_OPENICON) ? IDI_NTOBJECTDIROPEN :
IDI_NTOBJECTDIR);
- *pwFlags = 0;
+ *pwFlags = flags;
return S_OK;
case DEVICE_OBJECT:
GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
*piIndex = -IDI_NTOBJECTDEVICE;
- *pwFlags = 0;
+ *pwFlags = flags;
return S_OK;
case PORT_OBJECT:
GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
*piIndex = -IDI_NTOBJECTPORT;
- *pwFlags = 0;
+ *pwFlags = flags;
return S_OK;
default:
GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
*piIndex = -IDI_NTOBJECTITEM;
- *pwFlags = 0;
+ *pwFlags = flags;
return S_OK;
}
}
@@ -358,7 +365,7 @@
return S_OK;
}
- HRESULT FindPidlInList(LPCITEMIDLIST pcidl, NtPidlEntry ** pinfo)
+ HRESULT FindPidlInList(PCUITEMID_CHILD pcidl, NtPidlEntry ** pinfo)
{
HRESULT hr;
@@ -522,15 +529,15 @@
return CompareIDs(lParam, first, pcidl2);
}
- ULONG ConvertAttributes(OBJECT_TYPE Type, ULONG Attributes, PULONG inMask)
+ ULONG ConvertAttributes(NtPidlEntry * entry, PULONG inMask)
{
ULONG mask = inMask ? *inMask : 0xFFFFFFFF;
- ULONG flags = 0;
-
- if (Type == DIRECTORY_OBJECT)
+ ULONG flags = SFGAO_HASPROPSHEET | SFGAO_CANLINK;
+
+ if (entry->objectType == DIRECTORY_OBJECT)
flags |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
- if (Type == SYMBOLICLINK_OBJECT)
+ if (entry->objectType == SYMBOLICLINK_OBJECT)
flags |= SFGAO_LINK | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
return flags & mask;
@@ -707,7 +714,7 @@
*pchEaten = lstrlenW(info->entryName);
if (pdwAttributes)
- *pdwAttributes = m_PidlManager->ConvertAttributes(info->objectType,
info->objectInformation.Attributes, pdwAttributes);
+ *pdwAttributes = m_PidlManager->ConvertAttributes(info, pdwAttributes);
return S_OK;
}
@@ -808,7 +815,7 @@
HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetAttributesOf(
UINT cidl,
- LPCITEMIDLIST *apidl,
+ PCUITEMID_CHILD_ARRAY apidl,
SFGAOF *rgfInOut)
{
NtPidlEntry * info;
@@ -824,35 +831,23 @@
for (int i = 0; i < (int) cidl; i++)
{
- LPCITEMIDLIST pidl = apidl[i];
+ PCUITEMID_CHILD pidl = apidl[i];
hr = m_PidlManager->FindPidlInList(pidl, &info);
if (FAILED_UNEXPECTEDLY(hr))
return hr;
// Update attributes.
- *rgfInOut = m_PidlManager->ConvertAttributes(info->objectType,
info->objectInformation.Attributes, rgfInOut);
+ *rgfInOut = m_PidlManager->ConvertAttributes(info, rgfInOut);
}
return S_OK;
-}
-
-HRESULT CALLBACK ContextMenuCallback(
- _In_opt_ IShellFolder *psf,
- _In_opt_ HWND hwnd,
- _In_opt_ IDataObject *pdtobj,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam
- )
-{
- return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetUIObjectOf(
HWND hwndOwner,
UINT cidl,
- LPCITEMIDLIST *apidl,
+ PCUITEMID_CHILD_ARRAY apidl,
REFIID riid,
UINT *prgfInOut,
void **ppvOut)
Modified: trunk/reactos/dll/shellext/ntobjshex/ntobjns.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/nto…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/ntobjns.h [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/ntobjns.h [iso-8859-1] Sun Feb 22 18:26:58 2015
@@ -69,13 +69,13 @@
virtual HRESULT STDMETHODCALLTYPE GetAttributesOf(
UINT cidl,
- LPCITEMIDLIST *apidl,
+ PCUITEMID_CHILD_ARRAY apidl,
SFGAOF *rgfInOut);
virtual HRESULT STDMETHODCALLTYPE GetUIObjectOf(
HWND hwndOwner,
UINT cidl,
- LPCITEMIDLIST *apidl,
+ PCUITEMID_CHILD_ARRAY apidl,
REFIID riid,
UINT *prgfInOut,
void **ppvOut);
Modified: trunk/reactos/include/psdk/shtypes.idl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/shtypes.idl?r…
==============================================================================
--- trunk/reactos/include/psdk/shtypes.idl [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/shtypes.idl [iso-8859-1] Sun Feb 22 18:26:58 2015
@@ -35,7 +35,7 @@
} ITEMIDLIST,*LPITEMIDLIST;
typedef const ITEMIDLIST *LPCITEMIDLIST;
typedef LPITEMIDLIST PITEMID_CHILD;
-typedef const PITEMID_CHILD PCITEMID_CHILD;
+typedef LPCITEMIDLIST PCITEMID_CHILD;
typedef LPCITEMIDLIST PCUITEMID_CHILD;
typedef LPCITEMIDLIST *PCUITEMID_CHILD_ARRAY;
typedef LPITEMIDLIST PIDLIST_RELATIVE;