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.

99 lines
2.0 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. IN INT cchOldPathBuf // 585682-2002/04/12-JonN
  41. );
  42. VOID
  43. Refresh(
  44. VOID
  45. );
  46. HRESULT
  47. ConstructList(
  48. IN PCWSTR pszPath,
  49. IN OUT CShareInfo* pShareList,
  50. OUT ULONG* pcShares
  51. );
  52. HRESULT
  53. ConstructParentWarnList(
  54. IN PCWSTR pszPath,
  55. OUT CShareInfo** ppShareList
  56. );
  57. private:
  58. VOID
  59. Delete(
  60. VOID
  61. );
  62. VOID
  63. RefreshNoCritSec(
  64. VOID
  65. );
  66. BOOL
  67. CacheOK(
  68. VOID
  69. );
  70. UINT m_cShares;
  71. LPBYTE m_pBufShares;
  72. CStrHashTable* m_pHash;
  73. CRITICAL_SECTION m_csBuf; // last for debugging ease
  74. };
  75. //////////////////////////////////////////////////////////////////////////////
  76. extern CShareCache g_ShareCache; // the main share cache
  77. //////////////////////////////////////////////////////////////////////////////
  78. #endif // __CACHE_HXX__