ReactOS 0.4.15-dev-8241-g63935f8
CMruNode Class Reference
Inheritance diagram for CMruNode:
Collaboration diagram for CMruNode:

Public Member Functions

 CMruNode ()
 
 CMruNode (CMruNode *pParent, UINT iSlot)
 
 ~CMruNode () override
 
CMruNodeGetParent ()
 
HRESULT BindToSlot (UINT iSlot, IShellFolder **ppSF)
 
HRESULT GetNode (BOOL bAdd, LPCITEMIDLIST pidl, CMruNode **pNewNode)
 
HRESULT GetNodeSlot (UINT *pnNodeSlot)
 
HRESULT SetNodeSlot (UINT nNodeSlot)
 
HRESULT RemoveLeast (UINT *pnNodeSlot)
 
HRESULT Clear (CMruPidlList *pList)
 
- Public Member Functions inherited from CMruLongList
 CMruLongList ()
 
 ~CMruLongList () override
 
- Public Member Functions inherited from CMruBase
 CMruBase ()
 
virtual ~CMruBase ()
 
STDMETHODIMP QueryInterface (REFIID riid, void **ppvObj) override
 
 STDMETHODIMP_ (ULONG) AddRef() override
 
 STDMETHODIMP_ (ULONG) Release() override
 
STDMETHODIMP InitData (UINT cCapacity, UINT flags, HKEY hKey, LPCWSTR pszSubKey OPTIONAL, SLOTCOMPARE fnCompare OPTIONAL) override
 
STDMETHODIMP AddData (LPCVOID pvData, DWORD cbData, UINT *piSlot) override
 
STDMETHODIMP FindData (LPCVOID pvData, DWORD cbData, UINT *piSlot) override
 
STDMETHODIMP GetData (UINT iSlot, LPVOID pvData, DWORD cbData) override
 
STDMETHODIMP QueryInfo (UINT iSlot, UINT *piGotSlot, DWORD *pcbData) override
 
STDMETHODIMP Delete (UINT iSlot) override
 
virtual BOOL _IsEqual (const SLOTITEMDATA *pItem, LPCVOID pvData, UINT cbData) const
 
virtual DWORD _DeleteValue (LPCWSTR pszValue)
 
virtual HRESULT _InitSlots ()=0
 
virtual void _SaveSlots ()=0
 
virtual UINT _UpdateSlots (UINT iSlot)=0
 
virtual void _SlotString (UINT iSlot, LPWSTR psz, DWORD cch)=0
 
virtual HRESULT _GetSlot (UINT iSlot, UINT *puSlot)=0
 
virtual HRESULT _RemoveSlot (UINT iSlot, UINT *puSlot)=0
 

Protected Member Functions

BOOL _InitLate ()
 
BOOL _IsEqual (SLOTITEMDATA *pItem, LPCVOID pvData, UINT cbData)
 
DWORD _DeleteValue (LPCWSTR pszValue) override
 
HRESULT _CreateNode (UINT iSlot, CMruNode **ppNewNode)
 
HRESULT _AddPidl (UINT iSlot, LPCITEMIDLIST pidl)
 
HRESULT _FindPidl (LPCITEMIDLIST pidl, UINT *piSlot)
 
HRESULT _GetPidlSlot (LPCITEMIDLIST pidl, BOOL bAdd, UINT *piSlot)
 
- Protected Member Functions inherited from CMruLongList
void _ImportShortList ()
 
HRESULT _InitSlots () override
 
void _SaveSlots () override
 
UINT _UpdateSlots (UINT iSlot) override
 
void _SlotString (UINT iSlot, LPWSTR psz, DWORD cch) override
 
HRESULT _GetSlot (UINT iSlot, UINT *puSlot) override
 
HRESULT _RemoveSlot (UINT iSlot, UINT *puSlot) override
 
- Protected Member Functions inherited from CMruBase
HRESULT _LoadItem (UINT iSlot)
 
HRESULT _AddItem (UINT iSlot, LPCVOID pvData, DWORD cbData)
 
HRESULT _GetItem (UINT iSlot, SLOTITEMDATA **ppItem)
 
void _DeleteItem (UINT iSlot)
 
HRESULT _GetSlotItem (UINT iSlot, SLOTITEMDATA **ppItem)
 
void _CheckUsedSlots ()
 
HRESULT _UseEmptySlot (UINT *piSlot)
 

Protected Attributes

UINT m_iSlot = 0
 
CMruNodem_pParent = NULL
 
IShellFolderm_pShellFolder = NULL
 
- Protected Attributes inherited from CMruLongList
UINTm_puSlotData = NULL
 
- Protected Attributes inherited from CMruBase
LONG m_cRefs = 1
 
DWORD m_dwFlags = 0
 
BOOL m_bNeedSave = FALSE
 
BOOL m_bChecked = FALSE
 
HKEY m_hKey = NULL
 
DWORD m_cSlotRooms = 0
 
DWORD m_cSlots = 0
 
SLOTCOMPARE m_fnCompare = NULL
 
SLOTITEMDATAm_pSlots = NULL
 

Additional Inherited Members

- Static Public Member Functions inherited from CMruBase
static voidoperator new (size_t size)
 
static void operator delete (void *ptr)
 

Detailed Description

Definition at line 754 of file mrulist.cpp.

Constructor & Destructor Documentation

◆ CMruNode() [1/2]

CMruNode::CMruNode ( )
inline

Definition at line 772 of file mrulist.cpp.

772{ }

Referenced by _CreateNode().

◆ CMruNode() [2/2]

CMruNode::CMruNode ( CMruNode pParent,
UINT  iSlot 
)

Definition at line 787 of file mrulist.cpp.

788{
789 m_iSlot = iSlot;
791 pParent->AddRef();
792}
CMruNode * m_pParent
Definition: mrulist.cpp:759
UINT m_iSlot
Definition: mrulist.cpp:758
ULONG __inline AddRef(__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
Definition: fxobject.hpp:826
FxObject * pParent
Definition: fxdpcapi.cpp:86

◆ ~CMruNode()

CMruNode::~CMruNode ( )
override

Definition at line 794 of file mrulist.cpp.

795{
796 if (m_pParent)
797 {
798 m_pParent->Release();
799 m_pParent = NULL;
800 }
801
802 if (m_pShellFolder)
803 {
806 }
807}
IShellFolder * m_pShellFolder
Definition: mrulist.cpp:760
#define NULL
Definition: types.h:112
ULONG Release()

Member Function Documentation

◆ _AddPidl()

HRESULT CMruNode::_AddPidl ( UINT  iSlot,
LPCITEMIDLIST  pidl 
)
protected

Definition at line 923 of file mrulist.cpp.

924{
925 return CMruBase::_AddItem(iSlot, pidl, sizeof(WORD) + pidl->mkid.cb);
926}
HRESULT _AddItem(UINT iSlot, LPCVOID pvData, DWORD cbData)
Definition: mrulist.cpp:274
unsigned short WORD
Definition: ntddk_ex.h:93

Referenced by _GetPidlSlot().

◆ _CreateNode()

HRESULT CMruNode::_CreateNode ( UINT  iSlot,
CMruNode **  ppNewNode 
)
protected

Definition at line 816 of file mrulist.cpp.

817{
818 CMruNode *pNewNode = new CMruNode(this, iSlot);
819 if (!pNewNode)
820 return E_OUTOFMEMORY;
821
822 WCHAR szSubKey[12];
823 _SlotString(iSlot, szSubKey, _countof(szSubKey));
824
825 HRESULT hr = pNewNode->InitData(m_cSlotRooms, 0, m_hKey, szSubKey, NULL);
826 if (FAILED(hr))
827 pNewNode->Release();
828 else
829 *ppNewNode = pNewNode;
830
831 return hr;
832}
HKEY m_hKey
Definition: mrulist.cpp:99
STDMETHODIMP InitData(UINT cCapacity, UINT flags, HKEY hKey, LPCWSTR pszSubKey OPTIONAL, SLOTCOMPARE fnCompare OPTIONAL) override
Definition: mrulist.cpp:300
DWORD m_cSlotRooms
Definition: mrulist.cpp:100
void _SlotString(UINT iSlot, LPWSTR psz, DWORD cch) override
Definition: mrulist.cpp:669
CMruNode()
Definition: mrulist.cpp:772
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by Clear(), GetNode(), and RemoveLeast().

◆ _DeleteValue()

DWORD CMruNode::_DeleteValue ( LPCWSTR  pszValue)
overrideprotectedvirtual

Reimplemented from CMruBase.

Definition at line 928 of file mrulist.cpp.

929{
930 CMruBase::_DeleteValue(pszValue);
931 return SHDeleteKeyW(m_hKey, pszValue);
932}
virtual DWORD _DeleteValue(LPCWSTR pszValue)
Definition: mrulist.cpp:439
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1546

◆ _FindPidl()

HRESULT CMruNode::_FindPidl ( LPCITEMIDLIST  pidl,
UINT piSlot 
)
protected

Definition at line 934 of file mrulist.cpp.

935{
936 return FindData(pidl, sizeof(WORD) + pidl->mkid.cb, piSlot);
937}
STDMETHODIMP FindData(LPCVOID pvData, DWORD cbData, UINT *piSlot) override
Definition: mrulist.cpp:349

Referenced by _GetPidlSlot().

◆ _GetPidlSlot()

HRESULT CMruNode::_GetPidlSlot ( LPCITEMIDLIST  pidl,
BOOL  bAdd,
UINT piSlot 
)
protected

Definition at line 939 of file mrulist.cpp.

940{
941 LPITEMIDLIST pidlFirst = ILCloneFirst(pidl);
942 if (!pidlFirst)
943 return E_OUTOFMEMORY;
944
945 UINT iSlot;
946 HRESULT hr = _FindPidl(pidlFirst, &iSlot);
947 if (SUCCEEDED(hr))
948 {
949 *piSlot = _UpdateSlots(iSlot);
950 hr = S_OK;
951 }
952 else if (bAdd)
953 {
954 *piSlot = _UpdateSlots(m_cSlots);
955 hr = _AddPidl(*piSlot, pidlFirst);
956 }
957
958 ILFree(pidlFirst);
959 return hr;
960}
DWORD m_cSlots
Definition: mrulist.cpp:101
UINT _UpdateSlots(UINT iSlot) override
Definition: mrulist.cpp:637
HRESULT _AddPidl(UINT iSlot, LPCITEMIDLIST pidl)
Definition: mrulist.cpp:923
HRESULT _FindPidl(LPCITEMIDLIST pidl, UINT *piSlot)
Definition: mrulist.cpp:934
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
unsigned int UINT
Definition: ndis.h:50
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
Definition: pidl.c:262
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by GetNode().

◆ _InitLate()

BOOL CMruNode::_InitLate ( )
protected

Definition at line 886 of file mrulist.cpp.

887{
888 if (!m_pShellFolder)
889 {
890 if (m_pParent)
892 else
894 }
895 return !!m_pShellFolder;
896}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
HRESULT BindToSlot(UINT iSlot, IShellFolder **ppSF)
Definition: mrulist.cpp:873

Referenced by GetNode().

◆ _IsEqual()

BOOL CMruNode::_IsEqual ( SLOTITEMDATA pItem,
LPCVOID  pvData,
UINT  cbData 
)
protected

Definition at line 898 of file mrulist.cpp.

899{
900 return m_pShellFolder->CompareIDs(0x10000000,
901 (LPITEMIDLIST)pItem->pvData,
902 (LPCITEMIDLIST)pvData) == 0;
903}
HRESULT CompareIDs([in] LPARAM lParam, [in] PCUIDLIST_RELATIVE pidl1, [in] PCUIDLIST_RELATIVE pidl2)
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3749

◆ BindToSlot()

HRESULT CMruNode::BindToSlot ( UINT  iSlot,
IShellFolder **  ppSF 
)

Definition at line 873 of file mrulist.cpp.

874{
875 SLOTITEMDATA *pItem;
876 HRESULT hr = _GetSlotItem(iSlot, &pItem);
877 if (FAILED(hr))
878 return hr;
879
881 NULL,
882 IID_IShellFolder,
883 (void **)ppSF);
884}
HRESULT _GetSlotItem(UINT iSlot, SLOTITEMDATA **ppItem)
Definition: mrulist.cpp:234
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)

Referenced by _InitLate().

◆ Clear()

HRESULT CMruNode::Clear ( CMruPidlList pList)

Definition at line 1292 of file mrulist.cpp.

1293{
1294 UINT uSlot, nNodeSlot;
1295 HRESULT hr;
1296
1297 while (SUCCEEDED(_GetSlot(0, &uSlot)))
1298 {
1299 CMruNode *pNode;
1300 hr = _CreateNode(uSlot, &pNode);
1301 if (SUCCEEDED(hr))
1302 {
1303 hr = pNode->GetNodeSlot(&nNodeSlot);
1304 if (SUCCEEDED(hr))
1305 pList->EmptyNodeSlot(nNodeSlot);
1306
1307 pNode->Clear(pList);
1308 pNode->Release();
1309 }
1310 Delete(0);
1311 }
1312
1313 return S_OK;
1314}
STDMETHODIMP Delete(UINT iSlot) override
Definition: mrulist.cpp:401
HRESULT _GetSlot(UINT iSlot, UINT *puSlot) override
Definition: mrulist.cpp:674
HRESULT Clear(CMruPidlList *pList)
Definition: mrulist.cpp:1292
HRESULT _CreateNode(UINT iSlot, CMruNode **ppNewNode)
Definition: mrulist.cpp:816
HRESULT GetNodeSlot(UINT *pnNodeSlot)
Definition: mrulist.cpp:905
FxChildList * pList

Referenced by Clear(), and CMruPidlList::PruneKids().

◆ GetNode()

HRESULT CMruNode::GetNode ( BOOL  bAdd,
LPCITEMIDLIST  pidl,
CMruNode **  pNewNode 
)

Definition at line 834 of file mrulist.cpp.

835{
836 if (!pidl || !pidl->mkid.cb)
837 {
838 *ppNewNode = this;
839 AddRef();
840 return S_OK;
841 }
842
843 if (!_InitLate())
844 return E_FAIL;
845
846 UINT iSlot;
847 HRESULT hr = _GetPidlSlot(pidl, bAdd, &iSlot);
848 if (FAILED(hr))
849 {
850 if (!bAdd)
851 {
852 *ppNewNode = this;
853 AddRef();
854 return S_FALSE;
855 }
856 return hr;
857 }
858
859 CMruNode *pNewNode;
860 hr = _CreateNode(iSlot, &pNewNode);
861 if (SUCCEEDED(hr))
862 {
863 _SaveSlots();
864
865 LPCITEMIDLIST pidl2 = (LPCITEMIDLIST)((LPBYTE)pidl + pidl->mkid.cb);
866 pNewNode->GetNode(bAdd, pidl2, ppNewNode);
867 pNewNode->Release();
868 }
869
870 return hr;
871}
void _SaveSlots() override
Definition: mrulist.cpp:627
HRESULT _GetPidlSlot(LPCITEMIDLIST pidl, BOOL bAdd, UINT *piSlot)
Definition: mrulist.cpp:939
BOOL _InitLate()
Definition: mrulist.cpp:886
HRESULT GetNode(BOOL bAdd, LPCITEMIDLIST pidl, CMruNode **pNewNode)
Definition: mrulist.cpp:834
#define E_FAIL
Definition: ddrawi.h:102
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
unsigned char * LPBYTE
Definition: typedefs.h:53
#define S_FALSE
Definition: winerror.h:2357

Referenced by GetNode(), CMruPidlList::PruneKids(), CMruPidlList::QueryPidl(), and CMruPidlList::UsePidl().

◆ GetNodeSlot()

HRESULT CMruNode::GetNodeSlot ( UINT pnNodeSlot)

Definition at line 905 of file mrulist.cpp.

906{
907 DWORD dwData, cbData = sizeof(dwData);
908 DWORD error = SHGetValueW(m_hKey, NULL, L"NodeSlot", NULL, &dwData, (pnNodeSlot ? &cbData : NULL));
909 if (error != ERROR_SUCCESS)
910 return E_FAIL;
911 *pnNodeSlot = (UINT)dwData;
912 return S_OK;
913}
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
unsigned long DWORD
Definition: ntddk_ex.h:95
#define error(str)
Definition: mkdosfs.c:1605
static HANDLE ULONG_PTR dwData
Definition: file.c:35
#define L(x)
Definition: ntvdm.h:50

Referenced by Clear(), CMruPidlList::QueryPidl(), RemoveLeast(), and CMruPidlList::UsePidl().

◆ GetParent()

CMruNode * CMruNode::GetParent ( )

Definition at line 809 of file mrulist.cpp.

810{
811 if (m_pParent)
812 m_pParent->AddRef();
813 return m_pParent;
814}

Referenced by CMruPidlList::QueryPidl().

◆ RemoveLeast()

HRESULT CMruNode::RemoveLeast ( UINT pnNodeSlot)

Definition at line 962 of file mrulist.cpp.

963{
964 if (!m_cSlots)
965 {
966 GetNodeSlot(pnNodeSlot);
967 return S_FALSE;
968 }
969
970 UINT uSlot;
971 HRESULT hr = _GetSlot(m_cSlots - 1, &uSlot);
972 if (FAILED(hr))
973 return hr;
974
975 CMruNode *pNode;
976 hr = _CreateNode(uSlot, &pNode);
977 if (SUCCEEDED(hr))
978 {
979 hr = pNode->RemoveLeast(pnNodeSlot);
980 pNode->Release();
981 }
982
983 if (hr == S_FALSE)
984 {
985 Delete(m_cSlots - 1);
986 if (m_cSlots || SUCCEEDED(GetNodeSlot(0)))
987 return S_OK;
988 }
989
990 return hr;
991}
HRESULT RemoveLeast(UINT *pnNodeSlot)
Definition: mrulist.cpp:962

Referenced by CMruPidlList::GetEmptySlot(), and RemoveLeast().

◆ SetNodeSlot()

HRESULT CMruNode::SetNodeSlot ( UINT  nNodeSlot)

Definition at line 915 of file mrulist.cpp.

916{
917 DWORD dwData = nNodeSlot;
918 if (SHSetValueW(m_hKey, NULL, L"NodeSlot", REG_DWORD, &dwData, sizeof(dwData)) != ERROR_SUCCESS)
919 return E_FAIL;
920 return S_OK;
921}
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by CMruPidlList::UsePidl().

Member Data Documentation

◆ m_iSlot

UINT CMruNode::m_iSlot = 0
protected

Definition at line 758 of file mrulist.cpp.

Referenced by _InitLate(), and CMruNode().

◆ m_pParent

CMruNode* CMruNode::m_pParent = NULL
protected

Definition at line 759 of file mrulist.cpp.

Referenced by _InitLate(), CMruNode(), GetParent(), and ~CMruNode().

◆ m_pShellFolder

IShellFolder* CMruNode::m_pShellFolder = NULL
protected

Definition at line 760 of file mrulist.cpp.

Referenced by _InitLate(), _IsEqual(), BindToSlot(), and ~CMruNode().


The documentation for this class was generated from the following file: