ReactOS 0.4.15-dev-8231-g29a56f3
CMruLongList Class Reference
Inheritance diagram for CMruLongList:
Collaboration diagram for CMruLongList:

Public Member Functions

 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

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

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 585 of file mrulist.cpp.

Constructor & Destructor Documentation

◆ CMruLongList()

CMruLongList::CMruLongList ( )
inline

Definition at line 601 of file mrulist.cpp.

602 {
603 }

◆ ~CMruLongList()

CMruLongList::~CMruLongList ( )
inlineoverride

Definition at line 605 of file mrulist.cpp.

606 {
608 }
UINT * m_puSlotData
Definition: mrulist.cpp:589
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
unsigned int UINT
Definition: ndis.h:50

Member Function Documentation

◆ _GetSlot()

HRESULT CMruLongList::_GetSlot ( UINT  iSlot,
UINT puSlot 
)
overrideprotectedvirtual

Implements CMruBase.

Definition at line 674 of file mrulist.cpp.

675{
676 if (iSlot >= m_cSlots)
677 return E_FAIL;
678
679 UINT uSlotData = m_puSlotData[iSlot];
680 if (uSlotData >= m_cSlotRooms)
681 return E_FAIL;
682
683 *puSlot = uSlotData;
684 m_pSlots[uSlotData].dwFlags |= SLOT_SET;
685 return S_OK;
686}
DWORD m_cSlots
Definition: mrulist.cpp:101
SLOTITEMDATA * m_pSlots
Definition: mrulist.cpp:103
DWORD m_cSlotRooms
Definition: mrulist.cpp:100
#define E_FAIL
Definition: ddrawi.h:102
#define S_OK
Definition: intsafe.h:52
#define SLOT_SET
Definition: mrulist.cpp:53

Referenced by _RemoveSlot(), CMruNode::Clear(), and CMruNode::RemoveLeast().

◆ _ImportShortList()

void CMruLongList::_ImportShortList ( )
protected

Definition at line 702 of file mrulist.cpp.

703{
704 CMruShortList *pShortList = new CMruShortList();
705 if (!pShortList)
706 return;
707
708 HRESULT hr = pShortList->InitData(m_cSlotRooms, 0, m_hKey, NULL, NULL);
709 if (SUCCEEDED(hr))
710 {
711 for (;;)
712 {
713 UINT iSlot;
714 hr = pShortList->_GetSlot(m_cSlots, &iSlot);
715 if (FAILED(hr))
716 break;
717
718 SLOTITEMDATA *pItem;
719 hr = pShortList->_GetSlotItem(iSlot, &pItem);
720 if (FAILED(hr))
721 break;
722
723 _AddItem(iSlot, pItem->pvData, pItem->cbData);
724 pShortList->_DeleteItem(iSlot);
725
726 m_puSlotData[m_cSlots++] = iSlot;
727 }
728
730 }
731
732 SHDeleteValueW(m_hKey, NULL, L"MRUList");
733 pShortList->Release();
734}
HKEY m_hKey
Definition: mrulist.cpp:99
void _DeleteItem(UINT iSlot)
Definition: mrulist.cpp:255
BOOL m_bNeedSave
Definition: mrulist.cpp:97
HRESULT _GetSlotItem(UINT iSlot, SLOTITEMDATA **ppItem)
Definition: mrulist.cpp:234
STDMETHODIMP InitData(UINT cCapacity, UINT flags, HKEY hKey, LPCWSTR pszSubKey OPTIONAL, SLOTCOMPARE fnCompare OPTIONAL) override
Definition: mrulist.cpp:300
HRESULT _AddItem(UINT iSlot, LPCVOID pvData, DWORD cbData)
Definition: mrulist.cpp:274
HRESULT _GetSlot(UINT iSlot, UINT *puSlot) override
Definition: mrulist.cpp:557
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
DWORD WINAPI SHDeleteValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue)
Definition: reg.c:1762
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define L(x)
Definition: ntvdm.h:50
HRESULT hr
Definition: shlfolder.c:183

Referenced by _InitSlots().

◆ _InitSlots()

HRESULT CMruLongList::_InitSlots ( )
overrideprotectedvirtual

Implements CMruBase.

Definition at line 611 of file mrulist.cpp.

612{
613 DWORD cbData = (m_cSlotRooms + 1) * sizeof(UINT);
614 m_puSlotData = (UINT*)LocalAlloc(LPTR, cbData);
615 if (!m_puSlotData)
616 return E_OUTOFMEMORY;
617
618 if (SHGetValueW(m_hKey, NULL, L"MRUListEx", NULL, m_puSlotData, &cbData) == ERROR_SUCCESS)
619 m_cSlots = (cbData / sizeof(UINT)) - 1;
620 else
622
624 return S_OK;
625}
void _ImportShortList()
Definition: mrulist.cpp:702
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#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
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
#define MAXDWORD
#define LPTR
Definition: winbase.h:381

◆ _RemoveSlot()

HRESULT CMruLongList::_RemoveSlot ( UINT  iSlot,
UINT puSlot 
)
overrideprotectedvirtual

Implements CMruBase.

Definition at line 688 of file mrulist.cpp.

689{
690 HRESULT hr = _GetSlot(iSlot, puSlot);
691 if (FAILED(hr))
692 return hr;
693
694 MoveMemory(&m_puSlotData[iSlot], &m_puSlotData[iSlot + 1], (m_cSlots - iSlot) * sizeof(UINT));
695 --m_cSlots;
696 m_pSlots[0].dwFlags &= ~SLOT_SET;
698
699 return hr;
700}
HRESULT _GetSlot(UINT iSlot, UINT *puSlot) override
Definition: mrulist.cpp:674
#define MoveMemory
Definition: winbase.h:1709

◆ _SaveSlots()

void CMruLongList::_SaveSlots ( )
overrideprotectedvirtual

Implements CMruBase.

Definition at line 627 of file mrulist.cpp.

628{
629 if (m_bNeedSave)
630 {
632 (m_cSlots + 1) * sizeof(UINT));
634 }
635}
#define FALSE
Definition: types.h:117
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
#define REG_BINARY
Definition: nt_native.h:1496

Referenced by CMruNode::GetNode().

◆ _SlotString()

void CMruLongList::_SlotString ( UINT  iSlot,
LPWSTR  psz,
DWORD  cch 
)
overrideprotectedvirtual

Implements CMruBase.

Definition at line 669 of file mrulist.cpp.

670{
671 StringCchPrintfW(psz, cch, L"%d", iSlot);
672}
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530

Referenced by CMruNode::_CreateNode().

◆ _UpdateSlots()

UINT CMruLongList::_UpdateSlots ( UINT  iSlot)
overrideprotectedvirtual

Implements CMruBase.

Definition at line 637 of file mrulist.cpp.

638{
639 UINT cSlotsToMove, uSlotData;
640
641 cSlotsToMove = iSlot;
642 if (iSlot == m_cSlots)
643 {
644 if (SUCCEEDED(_UseEmptySlot(&uSlotData)))
645 {
646 ++cSlotsToMove;
647 }
648 else
649 {
650 uSlotData = m_puSlotData[m_cSlots - 1];
651 --cSlotsToMove;
652 }
653 }
654 else
655 {
656 uSlotData = m_puSlotData[iSlot];
657 }
658
659 if (cSlotsToMove > 0)
660 {
661 MoveMemory(m_puSlotData + 1, m_puSlotData, cSlotsToMove * sizeof(UINT));
662 m_puSlotData[0] = uSlotData;
664 }
665
666 return uSlotData;
667}
HRESULT _UseEmptySlot(UINT *piSlot)
Definition: mrulist.cpp:444

Referenced by CMruNode::_GetPidlSlot().

Member Data Documentation

◆ m_puSlotData

UINT* CMruLongList::m_puSlotData = NULL
protected

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