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.

227 lines
6.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: tset.cxx
  7. //
  8. // Contents: PTSetMember methods
  9. //
  10. // History: 16-Apr-93 DrewB Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "dfhead.cxx"
  14. #pragma hdrstop
  15. #include <entry.hxx>
  16. //+---------------------------------------------------------------------------
  17. //
  18. // Member: PTSetMember::Stat, public
  19. //
  20. // Synopsis: Fills in a STATSTG for the XSM
  21. //
  22. // Arguments: [pstat] - Buffer to fill in
  23. // [dwFlags] - STATFLAG_*
  24. //
  25. // Returns: Appropriate status code
  26. //
  27. // Modifies: [pstat]
  28. //
  29. // History: 12-Apr-93 DrewB Created
  30. //
  31. //----------------------------------------------------------------------------
  32. SCODE PTSetMember::Stat(STATSTGW *pstat, DWORD dwFlags)
  33. {
  34. CWrappedDocFile *pwdf;
  35. CTransactedStream *ptstm;
  36. SCODE sc;
  37. olDebugOut((DEB_ITRACE, "In PTSetMember::Stat:%p(%p, %lX)\n",
  38. this, pstat, dwFlags));
  39. pstat->type = ObjectType();
  40. if ((pstat->type & STGTY_REAL) == STGTY_STORAGE)
  41. {
  42. PTimeEntry *pen;
  43. pwdf = (CWrappedDocFile *)this;
  44. pen = pwdf;
  45. olChk(pen->GetTime(WT_CREATION, &pstat->ctime));
  46. olChk(pen->GetTime(WT_ACCESS, &pstat->atime));
  47. olChk(pen->GetTime(WT_MODIFICATION, &pstat->mtime));
  48. olChk(pwdf->GetClass(&pstat->clsid));
  49. olChk(pwdf->GetStateBits(&pstat->grfStateBits));
  50. ULISet32(pstat->cbSize, 0);
  51. }
  52. else
  53. {
  54. #ifdef LARGE_STREAMS
  55. ULONGLONG cbSize;
  56. #else
  57. ULONG cbSize;
  58. #endif
  59. ptstm = (CTransactedStream *)this;
  60. ptstm->GetSize(&cbSize);
  61. pstat->cbSize.QuadPart = cbSize;
  62. }
  63. if ((dwFlags & STATFLAG_NONAME) == 0)
  64. {
  65. olMem(pstat->pwcsName =
  66. (WCHAR *)TaskMemAlloc(_dfnName.GetLength()));
  67. memcpy(pstat->pwcsName, _dfnName.GetBuffer(), _dfnName.GetLength());
  68. }
  69. else
  70. {
  71. pstat->pwcsName = NULL;
  72. }
  73. sc = S_OK;
  74. olDebugOut((DEB_ITRACE, "Out PTSetMember::Stat\n"));
  75. // Fall through
  76. EH_Err:
  77. return sc;
  78. }
  79. //+--------------------------------------------------------------
  80. //
  81. // Member: PTSetMember::BeginCommit, public
  82. //
  83. // Synopsis: calls to derived object
  84. //
  85. // History: 20-Jan-98 HenryLee Created
  86. //
  87. //---------------------------------------------------------------
  88. SCODE PTSetMember::BeginCommit(DWORD const dwFlags)
  89. {
  90. if (_sig == CWRAPPEDDOCFILE_SIG)
  91. return ((CWrappedDocFile *)this)->BeginCommit(dwFlags);
  92. else if (_sig == CTRANSACTEDSTREAM_SIG)
  93. return ((CTransactedStream *)this)->BeginCommit (dwFlags);
  94. else
  95. olAssert (!"Invalid signature on PTSetMember!");
  96. return STG_E_INVALIDFUNCTION;
  97. }
  98. //+--------------------------------------------------------------
  99. //
  100. // Member: PTSetMember::EndCommit, public
  101. //
  102. // Synopsis: calls to derived object
  103. //
  104. // History: 20-Jan-98 HenryLee Created
  105. //
  106. //---------------------------------------------------------------
  107. void PTSetMember::EndCommit(DFLAGS const df)
  108. {
  109. if (_sig == CWRAPPEDDOCFILE_SIG)
  110. ((CWrappedDocFile *)this)->EndCommit (df);
  111. else if (_sig == CTRANSACTEDSTREAM_SIG)
  112. ((CTransactedStream *)this)->EndCommit (df);
  113. else
  114. olAssert (!"Invalid signature on PTSetMember!");
  115. return;
  116. }
  117. //+--------------------------------------------------------------
  118. //
  119. // Member: PTSetMember::Revert, public
  120. //
  121. // Synopsis: calls to derived object
  122. //
  123. // History: 20-Jan-98 HenryLee Created
  124. //
  125. //---------------------------------------------------------------
  126. void PTSetMember::Revert(void)
  127. {
  128. if (_sig == CWRAPPEDDOCFILE_SIG)
  129. ((CWrappedDocFile *)this)->Revert ();
  130. else if (_sig == CTRANSACTEDSTREAM_SIG)
  131. ((CTransactedStream *)this)->Revert ();
  132. else
  133. olAssert (!"Invalid signature on PTSetMember!");
  134. return;
  135. }
  136. //+--------------------------------------------------------------
  137. //
  138. // Member: PTSetMember::GetCommitInfo, public
  139. //
  140. // Synopsis: calls to derived object
  141. //
  142. // History: 20-Jan-98 HenryLee Created
  143. //
  144. //---------------------------------------------------------------
  145. #ifdef LARGE_STREAMS
  146. void PTSetMember::GetCommitInfo(ULONGLONG *pulRet1, ULONGLONG *pulRet2)
  147. #else
  148. void PTSetMember::GetCommitInfo(ULONG *pulRet1, ULONG *pulRet2)
  149. #endif
  150. {
  151. if (_sig == CWRAPPEDDOCFILE_SIG)
  152. ((CWrappedDocFile *)this)->GetCommitInfo (pulRet1, pulRet2);
  153. else if (_sig == CTRANSACTEDSTREAM_SIG)
  154. ((CTransactedStream *)this)->GetCommitInfo (pulRet1, pulRet2);
  155. else
  156. {
  157. *pulRet1 = 0;
  158. *pulRet2 = 0;
  159. olAssert (!"Invalid signature on PTSetMember!");
  160. }
  161. return;
  162. }
  163. //+--------------------------------------------------------------
  164. //
  165. // Member: PTSetMember::AddRef, public
  166. //
  167. // Synopsis: calls to derived object
  168. //
  169. // History: 20-Jan-98 HenryLee Created
  170. //
  171. //---------------------------------------------------------------
  172. void PTSetMember::AddRef(void)
  173. {
  174. if (_sig == CWRAPPEDDOCFILE_SIG)
  175. ((CWrappedDocFile *)this)->AddRef ();
  176. else if (_sig == CTRANSACTEDSTREAM_SIG)
  177. ((CTransactedStream *)this)->AddRef ();
  178. else
  179. olAssert (!"Invalid signature on PTSetMember!");
  180. return;
  181. }
  182. //+--------------------------------------------------------------
  183. //
  184. // Member: PTSetMember::Release, public
  185. //
  186. // Synopsis: calls to derived object
  187. //
  188. // History: 20-Jan-98 HenryLee Created
  189. //
  190. //---------------------------------------------------------------
  191. void PTSetMember::Release (void)
  192. {
  193. if (_sig == CWRAPPEDDOCFILE_SIG)
  194. ((CWrappedDocFile *)this)->Release ();
  195. else if (_sig == CTRANSACTEDSTREAM_SIG)
  196. ((CTransactedStream *)this)->Release ();
  197. else
  198. olAssert (!"Invalid signature on PTSetMember!");
  199. return;
  200. }