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.

124 lines
3.0 KiB

  1. #ifndef __FSLOCK_H_
  2. #define __FSLOCK_H_
  3. #include <fhcache.h>
  4. // ------------------------------------------------------------------------
  5. //
  6. // class CParseLockTokenHeader
  7. //
  8. // Takes in a Lock-Token header (you need to fetch the header & pre-check
  9. // that it's not NULL) and provides parsing & iteration routines.
  10. //
  11. // Can also be instantiated over a If-[None-]State-Match header to
  12. // do the state-token checking required.
  13. //
  14. // Implemented in lockutil.cpp
  15. //
  16. class CParseLockTokenHeader
  17. {
  18. // The big stuff
  19. //
  20. LPMETHUTIL m_pmu;
  21. HDRITER_W m_hdr;
  22. LPCSTR m_pszCurrent;
  23. // State bits
  24. BOOL m_fPathsSet : 1;
  25. BOOL m_fTokensChecked : 1;
  26. // Data for paths
  27. UINT m_cwchPath;
  28. auto_heap_ptr<WCHAR> m_pwszPath;
  29. UINT m_cwchDest;
  30. auto_heap_ptr<WCHAR> m_pwszDest;
  31. // Count of locktokens provided
  32. ULONG m_cTokens;
  33. // Quick-access to single-locktoken data
  34. LPCSTR m_pszToken;
  35. // Data for multiple tokens
  36. struct PATH_TOKEN
  37. {
  38. __int64 i64LockId;
  39. BOOL fFetched; // TRUE = path & dwords below have been filled in.
  40. LPCWSTR pwszPath;
  41. DWORD dwLockType;
  42. DWORD dwAccess;
  43. };
  44. auto_heap_ptr<PATH_TOKEN> m_pargPathTokens;
  45. // m_cTokens tells how many valid structures we have.
  46. // Fetch info about this lockid from the lock cache.
  47. HRESULT HrFetchPathInfo (__int64 i64LockId, PATH_TOKEN * pPT);
  48. // NOT IMPLEMENTED
  49. //
  50. CParseLockTokenHeader( const CParseLockTokenHeader& );
  51. CParseLockTokenHeader& operator=( const CParseLockTokenHeader& );
  52. public:
  53. CParseLockTokenHeader (LPMETHUTIL pmu, LPCWSTR pwszHeader) :
  54. m_pmu(pmu),
  55. m_hdr(pwszHeader),
  56. m_pszCurrent(NULL),
  57. m_fPathsSet(FALSE),
  58. m_fTokensChecked(FALSE),
  59. m_cwchPath(0),
  60. m_cwchDest(0),
  61. m_cTokens(0),
  62. m_pszToken(NULL)
  63. {
  64. Assert(m_pmu);
  65. Assert(pwszHeader);
  66. }
  67. ~CParseLockTokenHeader() {}
  68. // Special test -- F if not EXACTLY ONE item in the header.
  69. //
  70. BOOL FOneToken();
  71. // Feed the relevant paths to this lock token parser.
  72. //
  73. HRESULT SetPaths (LPCWSTR pwszPath, LPCWSTR pwszDest);
  74. // Get the token string for a path WITH a certain kind of access.
  75. //
  76. HRESULT HrGetLockIdForPath (LPCWSTR pwszPath,
  77. DWORD dwAccess,
  78. LARGE_INTEGER * pliLockID,
  79. BOOL fPathLookup = FALSE);
  80. };
  81. BOOL FLockViolation (LPMETHUTIL pmu,
  82. HRESULT hr,
  83. LPCWSTR pwszPath,
  84. DWORD dwAccess);
  85. BOOL FDeleteLock (LPMETHUTIL pmu, __int64 i64LockId);
  86. HRESULT HrCheckStateHeaders (LPMETHUTIL pmu,
  87. LPCWSTR pwszPath,
  88. BOOL fGetMeth);
  89. HRESULT HrLockIdFromString (LPMETHUTIL pmu,
  90. LPCWSTR pwszToken,
  91. LARGE_INTEGER * pliLockID);
  92. SCODE ScLockDiscoveryFromSNewLockData(LPMETHUTIL pmu,
  93. CXMLEmitter& emitter,
  94. CEmitterNode& en,
  95. SNewLockData * pnld,
  96. LPCWSTR pwszLockToken);
  97. HRESULT HrGetLockProp (LPMETHUTIL pmu,
  98. LPCWSTR wszPropName,
  99. LPCWSTR wszResource,
  100. RESOURCE_TYPE rtResource,
  101. CXMLEmitter& emitter,
  102. CEmitterNode& enParent);
  103. #endif // __FSLOCK_H_ endif