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.

214 lines
5.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997.
  5. //
  6. // File: statprop.hxx
  7. //
  8. // Contents: CStatPropertyStorage
  9. //
  10. //----------------------------------------------------------------------------
  11. #pragma once
  12. //+---------------------------------------------------------------------------
  13. //
  14. // Class: CStatPropertyStorage
  15. //
  16. // Purpose: IPropertyStorage derivative that provides read-only access to
  17. // the stat properties of a document.
  18. //
  19. //----------------------------------------------------------------------------
  20. class CStatPropertyStorage : public IPropertyStorage
  21. {
  22. public:
  23. //
  24. // Constructor and Destructor
  25. //
  26. CStatPropertyStorage( THIS_ HANDLE FileHandle, unsigned cPathLength = MAX_PATH );
  27. //
  28. // IUnknown methods.
  29. //
  30. STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppiuk );
  31. STDMETHOD_(ULONG, AddRef) (THIS);
  32. STDMETHOD_(ULONG, Release) (THIS);
  33. //
  34. // IPropertyStorage methods.
  35. //
  36. STDMETHOD(ReadMultiple) ( THIS_ ULONG cpspec,
  37. const PROPSPEC __RPC_FAR rgpspec[ ],
  38. PROPVARIANT __RPC_FAR rgpropvar[ ] );
  39. STDMETHOD(WriteMultiple) ( THIS_ ULONG cpspec,
  40. const PROPSPEC __RPC_FAR rgpspec[ ],
  41. const PROPVARIANT __RPC_FAR rgpropvar[ ],
  42. PROPID propidNameFirst )
  43. { return E_NOTIMPL; }
  44. STDMETHOD(DeleteMultiple) ( THIS_ ULONG cpspec,
  45. const PROPSPEC __RPC_FAR rgpspec[ ] )
  46. { return E_NOTIMPL; }
  47. STDMETHOD(ReadPropertyNames) ( THIS_ ULONG cpropid,
  48. const PROPID __RPC_FAR rgpropid[ ],
  49. LPOLESTR __RPC_FAR rglpwstrName[ ] )
  50. { return E_NOTIMPL; }
  51. STDMETHOD(WritePropertyNames) ( THIS_ ULONG cpropid,
  52. const PROPID __RPC_FAR rgpropid[ ],
  53. const LPOLESTR __RPC_FAR rglpwstrName[ ] )
  54. { return E_NOTIMPL; }
  55. STDMETHOD(DeletePropertyNames) ( THIS_ ULONG cpropid,
  56. const PROPID __RPC_FAR rgpropid[ ] )
  57. { return E_NOTIMPL; }
  58. STDMETHOD(Commit) ( THIS_ DWORD grfCommitFlags )
  59. { return E_NOTIMPL; }
  60. STDMETHOD(Revert) ( THIS )
  61. { return E_NOTIMPL; }
  62. STDMETHOD(Enum) ( THIS_ IEnumSTATPROPSTG __RPC_FAR *__RPC_FAR *ppenum );
  63. STDMETHOD(SetTimes) ( THIS_ const FILETIME __RPC_FAR *pctime,
  64. const FILETIME __RPC_FAR *patime,
  65. const FILETIME __RPC_FAR *pmtime )
  66. { return E_NOTIMPL; }
  67. STDMETHOD(SetClass) ( THIS_ REFCLSID clsid )
  68. { return E_NOTIMPL; }
  69. STDMETHOD(Stat) ( THIS_ STATPROPSETSTG __RPC_FAR *pstatpsstg)
  70. { return E_NOTIMPL; }
  71. protected:
  72. //
  73. // Hidden destructor so that only we can delete the instance
  74. // based on IUnknown control
  75. //
  76. virtual ~CStatPropertyStorage() { };
  77. private:
  78. //
  79. // Buffer containing Basic Info
  80. //
  81. FILE_ALL_INFORMATION & GetInfo()
  82. {
  83. return * (FILE_ALL_INFORMATION *) _xBuf.Get();
  84. //return _infobuf;
  85. }
  86. BOOL IsNTFS()
  87. {
  88. return (0 != GetInfo().BasicInformation.ChangeTime.QuadPart);
  89. }
  90. XGrowable<LONGLONG> _xBuf;
  91. //
  92. // IUnknown reference count.
  93. //
  94. LONG _RefCount;
  95. //
  96. // File name pointer into above buffer
  97. //
  98. LPWSTR _FileName;
  99. };
  100. //+---------------------------------------------------------------------------
  101. //
  102. // Class: CStatPropertyEnum
  103. //
  104. // Purpose: IEnumSTATPROPSTG enumerator
  105. //
  106. //----------------------------------------------------------------------------
  107. class CStatPropertyEnum : public IEnumSTATPROPSTG
  108. {
  109. public:
  110. //
  111. // Constructor and Destructor
  112. //
  113. CStatPropertyEnum( BOOL fNTFS )
  114. : _RefCount( 1 ),
  115. _Index( fNTFS ? 0 : 1 )
  116. {};
  117. //
  118. // IUnknown methods.
  119. //
  120. STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppiuk );
  121. STDMETHOD_(ULONG, AddRef) (THIS);
  122. STDMETHOD_(ULONG, Release) (THIS);
  123. //
  124. // IEnumSTATPROPSTG methods.
  125. //
  126. STDMETHOD(Next) ( THIS_ ULONG celt,
  127. STATPROPSTG __RPC_FAR *rgelt,
  128. ULONG __RPC_FAR *pceltFetched );
  129. STDMETHOD(Skip) ( THIS_ ULONG celt )
  130. { _Index += celt; return S_OK; }
  131. STDMETHOD(Reset) ( THIS )
  132. { _Index = 0; return S_OK; }
  133. STDMETHOD(Clone) ( IEnumSTATPROPSTG __RPC_FAR *__RPC_FAR *ppenum )
  134. { return E_NOTIMPL; }
  135. protected:
  136. //
  137. // Hidden destructor so that only we can delete the instance
  138. // based on IUnknown control
  139. //
  140. virtual ~CStatPropertyEnum() { }
  141. private:
  142. //
  143. // IUnknown reference count.
  144. //
  145. LONG _RefCount;
  146. //
  147. // Index in state table of property retrieval.
  148. //
  149. LONG _Index;
  150. };