Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.5 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Copyright (C) 1993-1998 Microsoft Corporation. All Rights Reserved.
  3. //
  4. // MODULE: mru.h
  5. //
  6. // PURPOSE:
  7. //
  8. #pragma once
  9. class CMRUList;
  10. /////////////////////////////////////////////////////////////////////////////
  11. // Types
  12. // Flags
  13. #define MRU_CACHEWRITE 0x0002
  14. #define MRU_ANSI 0x0004
  15. #define MRU_ORDERDIRTY 0x0008
  16. #define MRU_LAZY 0x8000
  17. /////////////////////////////////////////////////////////////////////////////
  18. // class MRU List definition
  19. //
  20. class CMRUList
  21. {
  22. public:
  23. /////////////////////////////////////////////////////////////////////////
  24. // Construction and Initialization
  25. //
  26. CMRUList();
  27. ~CMRUList();
  28. /////////////////////////////////////////////////////////////////////////
  29. // public MRU List functions
  30. //
  31. BOOL CreateList(UINT uMaxEntries, UINT fFlags, LPCSTR pszSubKey);
  32. void FreeList(void);
  33. int AddString(LPCSTR psz);
  34. int RemoveString(LPCSTR psz);
  35. int EnumList(int nItem, LPTSTR psz, UINT uLen);
  36. int AddData(const void *pData, UINT cbData);
  37. int FindData(const void *pData, UINT cbData, LPINT piSlot);
  38. BOOL CreateListLazy(UINT uMaxEntries, UINT fFlags, LPCSTR pszSubKey, const void *pData, UINT cbData, LPINT piSlot);
  39. private:
  40. /////////////////////////////////////////////////////////////////////////
  41. // Utility Functions
  42. //
  43. void _GetIndexStrFromIndex(DWORD dwIndex, LPTSTR pszIndexStr, DWORD cchIndexStrSize)
  44. {
  45. wnsprintf(pszIndexStr, cchIndexStrSize, TEXT("%d"), dwIndex);
  46. }
  47. int CDECL _IMemCmp(const void *pBuf1, const void *pBuf2, size_t cb);
  48. BOOL _IsSameData(BYTE FAR *pVal, const void FAR *pData, UINT cbData);
  49. LPDWORD _GetMRUValue(HKEY hkeySubKey, LPCTSTR pszRegValue);
  50. HRESULT _SetMRUValue(HKEY hkeySubKey, LPCTSTR pszRegValue, LPDWORD pData);
  51. BOOL _SetPtr(LPSTR * ppszCurrent, LPCSTR pszNew);
  52. private:
  53. /////////////////////////////////////////////////////////////////////////
  54. // Class data
  55. //
  56. UINT m_uMax; // Maxiumum number of entries in the MRU list
  57. UINT m_fFlags; // Flags
  58. HKEY m_hKey; // Reg key where we write
  59. LPSTR m_pszSubKey; // Sub key where the MRU data is stashed
  60. LPTSTR *m_rgpszMRU; // List of entries
  61. LPTSTR m_pszOrder; // Order array
  62. };