Source code of Windows XP (NT5)
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.

98 lines
1.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1995.
  5. //
  6. // File: cache.hxx
  7. //
  8. // Contents: Functions to manage a cache of shares
  9. //
  10. // History: 11-Apr-95 BruceFo Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #ifndef __CACHE_HXX__
  14. #define __CACHE_HXX__
  15. // The CShareCache class encapsulates a cache of network shares. The cache
  16. // is thread-safe; all access is protected by a critical section.
  17. class CStrHashTable;
  18. class CShareInfo;
  19. class CShareCache
  20. {
  21. public:
  22. CShareCache(
  23. VOID
  24. );
  25. ~CShareCache();
  26. BOOL
  27. IsPathShared(
  28. LPCTSTR lpPath,
  29. BOOL fRefresh
  30. );
  31. BOOL
  32. IsShareNameUsed(
  33. IN PWSTR pszShareName
  34. );
  35. BOOL
  36. IsExistingShare(
  37. IN PCWSTR pszShareName,
  38. IN PCWSTR pszPath,
  39. OUT PWSTR pszOldPath
  40. );
  41. VOID
  42. Refresh(
  43. VOID
  44. );
  45. HRESULT
  46. ConstructList(
  47. IN PCWSTR pszPath,
  48. IN OUT CShareInfo* pShareList,
  49. OUT ULONG* pcShares
  50. );
  51. HRESULT
  52. ConstructParentWarnList(
  53. IN PCWSTR pszPath,
  54. OUT CShareInfo** ppShareList
  55. );
  56. private:
  57. VOID
  58. Delete(
  59. VOID
  60. );
  61. VOID
  62. RefreshNoCritSec(
  63. VOID
  64. );
  65. BOOL
  66. CacheOK(
  67. VOID
  68. );
  69. UINT m_cShares;
  70. LPBYTE m_pBufShares;
  71. CStrHashTable* m_pHash;
  72. CRITICAL_SECTION m_csBuf; // last for debugging ease
  73. };
  74. //////////////////////////////////////////////////////////////////////////////
  75. extern CShareCache g_ShareCache; // the main share cache
  76. //////////////////////////////////////////////////////////////////////////////
  77. #endif // __CACHE_HXX__