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.

260 lines
6.5 KiB

  1. //+--------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1992.
  5. //
  6. // File: entry.hxx
  7. //
  8. // Contents: Entry management classes
  9. //
  10. // Classes: PBasicEntry
  11. // PTimeEntry
  12. // CTransactedBasicEntry
  13. // CTransactedTimeEntry
  14. //
  15. // History: 27-Jul-92 DrewB Created
  16. // 10-Apr-95 HenryLee Added global LUID optimization
  17. // 20-Jan-98 HenryLee remove virtual functions
  18. //
  19. //---------------------------------------------------------------
  20. #ifndef __ENTRY_HXX__
  21. #define __ENTRY_HXX__
  22. #include <msf.hxx>
  23. #if WIN32 >= 100
  24. #include <df32.hxx>
  25. #endif
  26. #define CDOCFILE_SIG LONGSIG('C', 'D', 'F', 'L')
  27. #define CDOCFILE_SIGDEL LONGSIG('C', 'd', 'F', 'l')
  28. #define CWRAPPEDDOCFILE_SIG LONGSIG('W', 'D', 'F', 'L')
  29. #define CWRAPPEDDOCFILE_SIGDEL LONGSIG('W', 'd', 'F', 'l')
  30. #define CDIRECTSTREAM_SIG LONGSIG('D', 'S', 'T', 'R')
  31. #define CDIRECTSTREAM_SIGDEL LONGSIG('D', 's', 'T', 'r')
  32. #define CTRANSACTEDSTREAM_SIG LONGSIG('T', 'S', 'T', 'R')
  33. #define CTRANSACTEDSTREAM_SIGDEL LONGSIG('T', 's', 'T', 'r')
  34. //+--------------------------------------------------------------
  35. //
  36. // Class: PBasicEntry (en)
  37. //
  38. // Purpose: Entry management
  39. //
  40. // Interface: See below
  41. //
  42. // Notes: This and all derived classes cannot have virtual methods
  43. //
  44. // History: 27-Jul-92 DrewB Created
  45. //
  46. //---------------------------------------------------------------
  47. #define ROOT_LUID 1
  48. #define MINISTREAM_LUID 2
  49. #define ITERATOR_LUID 3
  50. #define LUID_BASE 4
  51. class PBasicEntry
  52. {
  53. public:
  54. inline DFLUID GetLuid(void);
  55. static DFLUID GetNewLuid(const IMalloc *pMalloc);
  56. inline void AddRef(void);
  57. void Release(void);
  58. protected:
  59. PBasicEntry(DFLUID dl);
  60. ULONG _sig;
  61. LONG _cReferences;
  62. private:
  63. const DFLUID _dl;
  64. };
  65. //+--------------------------------------------------------------
  66. //
  67. // Member: PBasicEntry::PBasicEntry, protected
  68. //
  69. // Synopsis: Constructor, sets luid
  70. //
  71. // History: 21-Oct-92 AlexT Created
  72. //
  73. //---------------------------------------------------------------
  74. inline PBasicEntry::PBasicEntry(DFLUID dl)
  75. : _dl(dl)
  76. {
  77. }
  78. //+--------------------------------------------------------------
  79. //
  80. // Member: PBasicEntry::GetLuid, public
  81. //
  82. // Synopsis: Returns the luid
  83. //
  84. // History: 21-Oct-92 AlexT Created
  85. //
  86. //---------------------------------------------------------------
  87. inline DFLUID PBasicEntry::GetLuid(void)
  88. {
  89. return _dl;
  90. }
  91. //+--------------------------------------------------------------
  92. //
  93. // Member: PBasicEntry::AddRef, public
  94. //
  95. // Synopsis: Increments the ref count
  96. //
  97. // History: 08-May-92 DrewB Created
  98. //
  99. //---------------------------------------------------------------
  100. inline void PBasicEntry::AddRef(void)
  101. {
  102. olDebugOut((DEB_ITRACE, "In PBasicEntry::AddRef()\n"));
  103. AtomicInc(&_cReferences);
  104. olDebugOut((DEB_ITRACE, "Out PBasicEntry:AddRef, %lu\n", _cReferences));
  105. }
  106. //+---------------------------------------------------------------------------
  107. //
  108. // Class: PTimeEntry
  109. //
  110. // Purpose: A basic entry plus timestamps
  111. //
  112. // Interface: See below
  113. //
  114. // History: 01-Jul-93 DrewB Created
  115. //
  116. //----------------------------------------------------------------------------
  117. class PTimeEntry : public PBasicEntry
  118. {
  119. public:
  120. SCODE GetTime(WHICHTIME wt, TIME_T *ptm);
  121. SCODE SetTime(WHICHTIME wt, TIME_T tm);
  122. SCODE GetAllTimes(TIME_T *patm, TIME_T *pmtm, TIME_T *pctm);
  123. SCODE SetAllTimes(TIME_T atm, TIME_T mtm, TIME_T ctm);
  124. SCODE CopyTimesFrom(PTimeEntry *penFrom);
  125. protected:
  126. inline PTimeEntry(DFLUID luid);
  127. };
  128. //+---------------------------------------------------------------------------
  129. //
  130. // Member: PTimeEntry::PTimeEntry, protected
  131. //
  132. // Synopsis: Constructor
  133. //
  134. // Arguments: [luid] - LUID
  135. //
  136. // History: 01-Jul-93 DrewB Created
  137. //
  138. //----------------------------------------------------------------------------
  139. inline PTimeEntry::PTimeEntry(DFLUID luid)
  140. : PBasicEntry(luid)
  141. {
  142. }
  143. //+---------------------------------------------------------------------------
  144. //
  145. // Class: CTransactedTimeEntry (tten)
  146. //
  147. // Purpose: Transacted time entry management
  148. //
  149. // Interface: See below
  150. //
  151. // History: 01-Jul-93 DrewB Created
  152. //
  153. //----------------------------------------------------------------------------
  154. #define CTIMES 3
  155. class CTransactedTimeEntry
  156. {
  157. public:
  158. inline void GetTime(WHICHTIME wt, TIME_T *ptm);
  159. inline void SetTime(WHICHTIME wt, TIME_T tm);
  160. inline void GetAllTimes(TIME_T *patm, TIME_T *pmtm,TIME_T *pctm);
  161. inline void SetAllTimes(TIME_T atm, TIME_T mtm,TIME_T ctm);
  162. private:
  163. TIME_T _tt[CTIMES];
  164. };
  165. //+--------------------------------------------------------------
  166. //
  167. // Member: CTransactedTimeEntry::GetTime, public
  168. //
  169. // Synopsis: Returns the time
  170. //
  171. // History: 28-Jul-92 DrewB Created
  172. //
  173. //---------------------------------------------------------------
  174. inline void CTransactedTimeEntry::GetTime(WHICHTIME wt, TIME_T *ptm)
  175. {
  176. msfAssert(wt >= 0 && wt < CTIMES);
  177. *ptm = _tt[wt];
  178. }
  179. //+--------------------------------------------------------------
  180. //
  181. // Member: CTransactedTimeEntry::GetAllTimes, public
  182. //
  183. // Synopsis: Returns all the times
  184. //
  185. // History: 26-May-95 SusiA Created
  186. //
  187. //---------------------------------------------------------------
  188. inline void CTransactedTimeEntry::GetAllTimes(TIME_T *patm,TIME_T *pmtm, TIME_T *pctm)
  189. {
  190. *patm = _tt[WT_ACCESS];
  191. *pmtm = _tt[WT_MODIFICATION];
  192. *pctm = _tt[WT_CREATION];
  193. }
  194. //+--------------------------------------------------------------
  195. //
  196. // Member: CTransactedTimeEntry::SetAllTimes, public
  197. //
  198. // Synopsis: Sets all the times
  199. //
  200. // History: 26-Nov-95 SusiA Created
  201. //
  202. //---------------------------------------------------------------
  203. inline void CTransactedTimeEntry::SetAllTimes(TIME_T atm,TIME_T mtm, TIME_T ctm)
  204. {
  205. _tt[WT_ACCESS] = atm;
  206. _tt[WT_MODIFICATION] = mtm;
  207. _tt[WT_CREATION] = ctm;
  208. }
  209. //+--------------------------------------------------------------
  210. //
  211. // Member: CTransactedTimeEntry::SetTime, public
  212. //
  213. // Synopsis: Sets the time
  214. //
  215. // History: 28-Jul-92 DrewB Created
  216. //
  217. //---------------------------------------------------------------
  218. inline void CTransactedTimeEntry::SetTime(WHICHTIME wt, TIME_T tm)
  219. {
  220. msfAssert(wt >= 0 && wt < CTIMES);
  221. _tt[wt] = tm;
  222. }
  223. #endif // #ifndef __ENTRY_HXX__